@blocknote/core 0.56.0 → 0.57.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 (733) hide show
  1. package/NOTICE.txt +101 -0
  2. package/dist/BlockNoteExtension-U58cXw1g.js +64 -0
  3. package/dist/ThreadStore-CSEwCO0O.js +8 -0
  4. package/dist/{UserStore-OZJP3K8T.js → UserStore-BFv6NXA-.js} +3 -7
  5. package/dist/ar-DPJDxCQI.js +3 -0
  6. package/dist/blocknote.js +8 -6
  7. package/dist/blocks-BUX9dXi9.js +2063 -0
  8. package/dist/blocks.js +3 -2
  9. package/dist/comments.js +8 -9
  10. package/dist/de-CakHBokE.js +3 -0
  11. package/dist/emoji-data.js +102 -0
  12. package/dist/en-BGdzE27X.js +3 -0
  13. package/dist/{en-Ch-vvt5e.js → en-Ne9rlj9Y.js} +9 -6
  14. package/dist/es-VeBX6MEG.js +3 -0
  15. package/dist/{extensions-BbM81hHa.js → extensions-CEgexSyF.js} +846 -824
  16. package/dist/extensions.js +4 -4
  17. package/dist/fa-Dt7EYtKf.js +3 -0
  18. package/dist/fr-DUhhjxrJ.js +3 -0
  19. package/dist/getDefaultSlashMenuItems-DfDOr807.js +1939 -0
  20. package/dist/he-BShJg1dK.js +3 -0
  21. package/dist/hr-BXtyqmwg.js +3 -0
  22. package/dist/is-2Fb-0w_j.js +3 -0
  23. package/dist/it-CiZtVb3Y.js +3 -0
  24. package/dist/ja-CsxD3kEL.js +3 -0
  25. package/dist/ko-It6g03Cy.js +3 -0
  26. package/dist/locales.js +692 -54
  27. package/dist/markGroups-BszXCkX8.js +18 -0
  28. package/dist/nb-CLao87La.js +3 -0
  29. package/dist/nl-JQSo8dht.js +3 -0
  30. package/dist/pl-DEMBgHEP.js +3 -0
  31. package/dist/pt-CBCdYAax.js +3 -0
  32. package/dist/ru-BQk_9Q-L.js +3 -0
  33. package/dist/sk-kgB2DtDL.js +3 -0
  34. package/dist/{src-BmLsLZfE.js → src-DksfoQmN.js} +1173 -1090
  35. package/dist/style.css +1 -1
  36. package/dist/tr-DkcSXX8f.js +3 -0
  37. package/dist/uk-Bib-e6bV.js +3 -0
  38. package/dist/uz-B2jaKhJb.js +3 -0
  39. package/dist/vi-V_GFRxE8.js +3 -0
  40. package/dist/y.js +356 -361
  41. package/dist/yjs.js +134 -135
  42. package/dist/zh-hant-2ZrAkFnC.js +3 -0
  43. package/dist/zh-jglyCmjs.js +3 -0
  44. package/package.json +45 -21
  45. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.d.ts +5 -0
  46. package/types/src/api/blockManipulation/tables/tables.d.ts +9 -4
  47. package/types/src/api/clipboard/fromClipboard/normalizeOfficeHTML.d.ts +5 -0
  48. package/types/src/api/exporters/markdown/wrapWithDelimiter.d.ts +6 -0
  49. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
  50. package/types/src/blocks/defaultBlocks.d.ts +10 -0
  51. package/types/src/editor/BlockNoteEditor.d.ts +2 -1
  52. package/types/src/editor/managers/ExtensionManager/index.d.ts +4 -4
  53. package/types/src/editor/managers/StyleManager.d.ts +2 -1
  54. package/types/src/emoji-data/frimousse/ar.d.ts +2 -0
  55. package/types/src/emoji-data/frimousse/common.d.ts +3 -0
  56. package/types/src/emoji-data/frimousse/de.d.ts +2 -0
  57. package/types/src/emoji-data/frimousse/en.d.ts +2 -0
  58. package/types/src/emoji-data/frimousse/es.d.ts +2 -0
  59. package/types/src/emoji-data/frimousse/fa.d.ts +2 -0
  60. package/types/src/emoji-data/frimousse/fr.d.ts +2 -0
  61. package/types/src/emoji-data/frimousse/he.d.ts +2 -0
  62. package/types/src/emoji-data/frimousse/hr.d.ts +2 -0
  63. package/types/src/emoji-data/frimousse/is.d.ts +2 -0
  64. package/types/src/emoji-data/frimousse/it.d.ts +2 -0
  65. package/types/src/emoji-data/frimousse/ja.d.ts +2 -0
  66. package/types/src/emoji-data/frimousse/ko.d.ts +2 -0
  67. package/types/src/emoji-data/frimousse/loadFrimousseData.d.ts +2 -0
  68. package/types/src/emoji-data/frimousse/nb.d.ts +2 -0
  69. package/types/src/emoji-data/frimousse/nl.d.ts +2 -0
  70. package/types/src/emoji-data/frimousse/pl.d.ts +2 -0
  71. package/types/src/emoji-data/frimousse/pt.d.ts +2 -0
  72. package/types/src/emoji-data/frimousse/ru.d.ts +2 -0
  73. package/types/src/emoji-data/frimousse/sk.d.ts +2 -0
  74. package/types/src/emoji-data/frimousse/tr.d.ts +2 -0
  75. package/types/src/emoji-data/frimousse/types.d.ts +21 -0
  76. package/types/src/emoji-data/frimousse/uk.d.ts +2 -0
  77. package/types/src/emoji-data/frimousse/uz.d.ts +2 -0
  78. package/types/src/emoji-data/frimousse/vi.d.ts +2 -0
  79. package/types/src/emoji-data/frimousse/zh-hant.d.ts +2 -0
  80. package/types/src/emoji-data/frimousse/zh.d.ts +2 -0
  81. package/types/src/emoji-data/index.d.ts +3 -0
  82. package/types/src/emoji-data/searchEmojis.d.ts +5 -0
  83. package/types/src/extensions/Loading/Loading.d.ts +11 -0
  84. package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +13 -4
  85. package/types/src/extensions/SideMenu/SideMenu.d.ts +2 -1
  86. package/types/src/extensions/Versioning/Versioning.d.ts +2 -0
  87. package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +1 -0
  88. package/types/src/extensions/Versioning/types.d.ts +12 -6
  89. package/types/src/extensions/Versioning/versioningState.d.ts +6 -0
  90. package/types/src/extensions/index.d.ts +1 -2
  91. package/types/src/i18n/dictionary.d.ts +4 -1
  92. package/types/src/i18n/locales/en.d.ts +6 -0
  93. package/types/src/i18n/locales/fa.d.ts +6 -0
  94. package/types/src/i18n/locales/index.d.ts +1 -0
  95. package/types/src/i18n/locales/sk.d.ts +6 -0
  96. package/types/src/i18n/locales/tr.d.ts +378 -0
  97. package/types/src/index.d.ts +0 -1
  98. package/types/src/schema/inlineContent/createSpec.d.ts +2 -1
  99. package/types/src/schema/inlineContent/internal.d.ts +1 -1
  100. package/types/src/schema/inlineContent/types.d.ts +2 -4
  101. package/types/src/schema/styles/createSpec.d.ts +2 -1
  102. package/types/src/schema/styles/internal.d.ts +4 -1
  103. package/types/src/schema/styles/types.d.ts +2 -0
  104. package/types/src/y/extensions/YSync.d.ts +1 -1
  105. package/types/src/y/extensions/index.d.ts +1 -1
  106. package/types/src/y/versioning/yhub.d.ts +2 -0
  107. package/types/src/yjs/extensions/Versioning.d.ts +1 -0
  108. package/types/src/yjs/extensions/YUndo.d.ts +3 -2
  109. package/types/src/yjs/extensions/index.d.ts +1 -1
  110. package/dist/BlockNoteExtension-DjEkXkR5.cjs +0 -2
  111. package/dist/BlockNoteExtension-DjEkXkR5.cjs.map +0 -1
  112. package/dist/BlockNoteExtension-TsTGtIeX.js +0 -87
  113. package/dist/BlockNoteExtension-TsTGtIeX.js.map +0 -1
  114. package/dist/ThreadStore-Bx-gSEh1.cjs +0 -2
  115. package/dist/ThreadStore-Bx-gSEh1.cjs.map +0 -1
  116. package/dist/ThreadStore-et9wB5Xt.js +0 -11
  117. package/dist/ThreadStore-et9wB5Xt.js.map +0 -1
  118. package/dist/UserStore-CTVzVGh-.cjs +0 -2
  119. package/dist/UserStore-CTVzVGh-.cjs.map +0 -1
  120. package/dist/UserStore-OZJP3K8T.js.map +0 -1
  121. package/dist/blocknote.cjs +0 -1
  122. package/dist/blocks-COVwe5Cf.cjs +0 -12
  123. package/dist/blocks-COVwe5Cf.cjs.map +0 -1
  124. package/dist/blocks-COYcDVg7.js +0 -3943
  125. package/dist/blocks-COYcDVg7.js.map +0 -1
  126. package/dist/blocks.cjs +0 -1
  127. package/dist/comments.cjs +0 -2
  128. package/dist/comments.cjs.map +0 -1
  129. package/dist/comments.js.map +0 -1
  130. package/dist/en-Ch-vvt5e.js.map +0 -1
  131. package/dist/en-N5lu0-j8.cjs +0 -2
  132. package/dist/en-N5lu0-j8.cjs.map +0 -1
  133. package/dist/extensions-BbM81hHa.js.map +0 -1
  134. package/dist/extensions-D_WkAfSt.cjs +0 -58
  135. package/dist/extensions-D_WkAfSt.cjs.map +0 -1
  136. package/dist/extensions.cjs +0 -1
  137. package/dist/locales.cjs +0 -2
  138. package/dist/locales.cjs.map +0 -1
  139. package/dist/locales.js.map +0 -1
  140. package/dist/src-4OQT3z5S.cjs +0 -23
  141. package/dist/src-4OQT3z5S.cjs.map +0 -1
  142. package/dist/src-BmLsLZfE.js.map +0 -1
  143. package/dist/webpack-stats.json +0 -1
  144. package/dist/y.cjs +0 -2
  145. package/dist/y.cjs.map +0 -1
  146. package/dist/y.js.map +0 -1
  147. package/dist/yjs.cjs +0 -2
  148. package/dist/yjs.cjs.map +0 -1
  149. package/dist/yjs.js.map +0 -1
  150. package/src/api/README.md +0 -8
  151. package/src/api/__snapshots__/blocks-deleted-nested-deep.json +0 -26
  152. package/src/api/__snapshots__/blocks-deleted-nested.json +0 -68
  153. package/src/api/__snapshots__/blocks-deleted.json +0 -26
  154. package/src/api/__snapshots__/blocks-indented-changed.json +0 -129
  155. package/src/api/__snapshots__/blocks-inserted-nested.json +0 -62
  156. package/src/api/__snapshots__/blocks-inserted.json +0 -20
  157. package/src/api/__snapshots__/blocks-moved-deeper-into-nesting.json +0 -164
  158. package/src/api/__snapshots__/blocks-moved-down-twice-in-same-parent.json +0 -44
  159. package/src/api/__snapshots__/blocks-moved-insert-changes-sibling-order.json +0 -26
  160. package/src/api/__snapshots__/blocks-moved-multiple-in-same-transaction.json +0 -188
  161. package/src/api/__snapshots__/blocks-moved-nested-sibling-reorder.json +0 -180
  162. package/src/api/__snapshots__/blocks-moved-to-different-parent.json +0 -78
  163. package/src/api/__snapshots__/blocks-moved-to-root-level.json +0 -78
  164. package/src/api/__snapshots__/blocks-moved-up-down-in-same-parent.json +0 -44
  165. package/src/api/__snapshots__/blocks-moved-up-down-in-same-transaction.json +0 -44
  166. package/src/api/__snapshots__/blocks-outdented-changed.json +0 -129
  167. package/src/api/__snapshots__/blocks-updated-content-inserted.json +0 -42
  168. package/src/api/__snapshots__/blocks-updated-multiple-insert.json +0 -50
  169. package/src/api/__snapshots__/blocks-updated-multiple.json +0 -82
  170. package/src/api/__snapshots__/blocks-updated-nested-deep.json +0 -42
  171. package/src/api/__snapshots__/blocks-updated-nested-multiple.json +0 -118
  172. package/src/api/__snapshots__/blocks-updated-nested.json +0 -78
  173. package/src/api/__snapshots__/blocks-updated-single.json +0 -42
  174. package/src/api/__snapshots__/blocks-updated.json +0 -42
  175. package/src/api/blockManipulation/__snapshots__/transactions.test.ts.snap +0 -34
  176. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -4570
  177. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +0 -176
  178. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +0 -95
  179. package/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.ts +0 -217
  180. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -2761
  181. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +0 -251
  182. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +0 -187
  183. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +0 -13625
  184. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +0 -391
  185. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +0 -350
  186. package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -952
  187. package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +0 -917
  188. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +0 -248
  189. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -5710
  190. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +0 -306
  191. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +0 -143
  192. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -3507
  193. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +0 -364
  194. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +0 -90
  195. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -15085
  196. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +0 -1210
  197. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +0 -706
  198. package/src/api/blockManipulation/getBlock/getBlock.ts +0 -104
  199. package/src/api/blockManipulation/insertContentAt.ts +0 -83
  200. package/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.ts +0 -173
  201. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.ts +0 -293
  202. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.ts +0 -145
  203. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.ts +0 -783
  204. package/src/api/blockManipulation/layoutBlocks/plainBlocks.test.ts +0 -180
  205. package/src/api/blockManipulation/layoutBlocks/titledBlocks.test.ts +0 -365
  206. package/src/api/blockManipulation/selections/selection.ts +0 -234
  207. package/src/api/blockManipulation/selections/textCursorPosition.ts +0 -63
  208. package/src/api/blockManipulation/setupTestEnv.ts +0 -223
  209. package/src/api/blockManipulation/tables/tables.test.ts +0 -2127
  210. package/src/api/blockManipulation/tables/tables.ts +0 -887
  211. package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +0 -8
  212. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +0 -55
  213. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +0 -209
  214. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +0 -38
  215. package/src/api/clipboard/fromClipboard/pasteExtension.ts +0 -157
  216. package/src/api/clipboard/toClipboard/copyExtension.ts +0 -299
  217. package/src/api/combineTransactionSteps.ts +0 -22
  218. package/src/api/exporters/html/externalHTMLExporter.ts +0 -76
  219. package/src/api/exporters/html/internalHTMLSerializer.ts +0 -182
  220. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +0 -510
  221. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +0 -283
  222. package/src/api/exporters/markdown/htmlToMarkdown.ts +0 -895
  223. package/src/api/exporters/markdown/markdownExporter.ts +0 -41
  224. package/src/api/getBlockInfoFromPos.test.ts +0 -681
  225. package/src/api/getBlockInfoFromPos.ts +0 -693
  226. package/src/api/getBlocksChangedByTransaction.test.ts +0 -783
  227. package/src/api/getBlocksChangedByTransaction.ts +0 -458
  228. package/src/api/getChangedRangeWithAttrs.ts +0 -54
  229. package/src/api/getChangedRanges.test.ts +0 -391
  230. package/src/api/getChangedRanges.ts +0 -368
  231. package/src/api/nodeConversions/blockToNode.test.ts +0 -113
  232. package/src/api/nodeConversions/blockToNode.ts +0 -427
  233. package/src/api/nodeConversions/fragmentToBlocks.ts +0 -48
  234. package/src/api/nodeConversions/nodeToBlock.ts +0 -717
  235. package/src/api/nodeUtil.ts +0 -46
  236. package/src/api/parsers/html/parseHTML.ts +0 -80
  237. package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +0 -144
  238. package/src/api/parsers/html/util/nestedLists.test.ts +0 -165
  239. package/src/api/parsers/html/util/nestedLists.ts +0 -123
  240. package/src/api/parsers/html/util/normalizeWhitespace.ts +0 -87
  241. package/src/api/parsers/markdown/autolink.ts +0 -23
  242. package/src/api/parsers/markdown/detectMarkdown.test.ts +0 -211
  243. package/src/api/parsers/markdown/detectMarkdown.ts +0 -61
  244. package/src/api/parsers/markdown/markdownToHtml.ts +0 -1444
  245. package/src/api/parsers/markdown/parseMarkdown.ts +0 -24
  246. package/src/api/pmUtil.ts +0 -79
  247. package/src/api/positionMapping.test.ts +0 -209
  248. package/src/api/positionMapping.ts +0 -42
  249. package/src/blocks/Audio/block.ts +0 -171
  250. package/src/blocks/Audio/parseAudioElement.ts +0 -5
  251. package/src/blocks/BlockNoteSchema.ts +0 -59
  252. package/src/blocks/Code/CodeBlockOptions.ts +0 -83
  253. package/src/blocks/Code/block.test.ts +0 -265
  254. package/src/blocks/Code/block.ts +0 -56
  255. package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +0 -125
  256. package/src/blocks/Code/helpers/parse/parsePreCode.ts +0 -45
  257. package/src/blocks/Code/helpers/render/createCodeBlock.ts +0 -98
  258. package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +0 -14
  259. package/src/blocks/Divider/block.ts +0 -49
  260. package/src/blocks/File/block.ts +0 -95
  261. package/src/blocks/File/helpers/parse/parseEmbedElement.ts +0 -5
  262. package/src/blocks/File/helpers/parse/parseFigureElement.ts +0 -16
  263. package/src/blocks/File/helpers/render/createAddFileButton.ts +0 -69
  264. package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +0 -88
  265. package/src/blocks/File/helpers/render/createFileNameWithIcon.ts +0 -37
  266. package/src/blocks/File/helpers/render/createResizableFileBlockWrapper.ts +0 -271
  267. package/src/blocks/File/helpers/toExternalHTML/createFigureWithCaption.ts +0 -13
  268. package/src/blocks/File/helpers/toExternalHTML/createLinkWithCaption.ts +0 -15
  269. package/src/blocks/Heading/block.ts +0 -227
  270. package/src/blocks/Image/block.ts +0 -193
  271. package/src/blocks/Image/parseImageElement.ts +0 -7
  272. package/src/blocks/ListItem/BulletListItem/block.ts +0 -129
  273. package/src/blocks/ListItem/CheckListItem/block.test.ts +0 -61
  274. package/src/blocks/ListItem/CheckListItem/block.ts +0 -184
  275. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +0 -352
  276. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +0 -239
  277. package/src/blocks/ListItem/NumberedListItem/block.ts +0 -143
  278. package/src/blocks/ListItem/ToggleListItem/block.ts +0 -139
  279. package/src/blocks/ListItem/getListItemContent.ts +0 -115
  280. package/src/blocks/PageBreak/block.ts +0 -72
  281. package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +0 -47
  282. package/src/blocks/Paragraph/block.ts +0 -80
  283. package/src/blocks/Quote/block.ts +0 -99
  284. package/src/blocks/README.md +0 -3
  285. package/src/blocks/Table/TableExtension.test.ts +0 -231
  286. package/src/blocks/Table/TableExtension.ts +0 -115
  287. package/src/blocks/Table/block.ts +0 -492
  288. package/src/blocks/ToggleWrapper/createToggleFrame.ts +0 -126
  289. package/src/blocks/ToggleWrapper/toggleBlocks.browser.test.ts +0 -1056
  290. package/src/blocks/Video/block.ts +0 -142
  291. package/src/blocks/Video/parseVideoElement.ts +0 -7
  292. package/src/blocks/defaultBlockHelpers.ts +0 -113
  293. package/src/blocks/defaultBlockTypeGuards.ts +0 -167
  294. package/src/blocks/defaultBlockTypeItems.test.ts +0 -70
  295. package/src/blocks/defaultBlockTypeItems.ts +0 -99
  296. package/src/blocks/defaultBlocks.test.ts +0 -67
  297. package/src/blocks/defaultBlocks.ts +0 -214
  298. package/src/blocks/defaultProps.ts +0 -165
  299. package/src/blocks/getDetailsContent.ts +0 -77
  300. package/src/blocks/index.ts +0 -30
  301. package/src/comments/CommentEditorSubmitExtension.test.ts +0 -141
  302. package/src/comments/CommentEditorSubmitExtension.ts +0 -56
  303. package/src/comments/extension.ts +0 -396
  304. package/src/comments/index.ts +0 -8
  305. package/src/comments/mark.ts +0 -64
  306. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +0 -106
  307. package/src/comments/threadstore/ThreadStore.ts +0 -130
  308. package/src/comments/threadstore/ThreadStoreAuth.ts +0 -13
  309. package/src/comments/threadstore/TipTapThreadStore.ts +0 -292
  310. package/src/comments/threadstore/tiptap/types.ts +0 -131
  311. package/src/comments/types.ts +0 -121
  312. package/src/editor/Block.css +0 -1498
  313. package/src/editor/BlockNoteEditor.node.test.ts +0 -35
  314. package/src/editor/BlockNoteEditor.test.ts +0 -278
  315. package/src/editor/BlockNoteEditor.ts +0 -1559
  316. package/src/editor/BlockNoteExtension.test.ts +0 -103
  317. package/src/editor/BlockNoteExtension.ts +0 -246
  318. package/src/editor/README.md +0 -3
  319. package/src/editor/blockColors.browser.test.ts +0 -127
  320. package/src/editor/cursorPositionTypes.ts +0 -17
  321. package/src/editor/defaultColors.ts +0 -77
  322. package/src/editor/editor.css +0 -257
  323. package/src/editor/managers/BlockManager.ts +0 -256
  324. package/src/editor/managers/EventManager.browser.test.ts +0 -334
  325. package/src/editor/managers/EventManager.ts +0 -260
  326. package/src/editor/managers/ExportManager.ts +0 -137
  327. package/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.ts +0 -45
  328. package/src/editor/managers/ExtensionManager/ExtensionManager.node.test.ts +0 -209
  329. package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +0 -336
  330. package/src/editor/managers/ExtensionManager/extensions.ts +0 -200
  331. package/src/editor/managers/ExtensionManager/index.ts +0 -764
  332. package/src/editor/managers/ExtensionManager/symbol.ts +0 -5
  333. package/src/editor/managers/SelectionManager.ts +0 -120
  334. package/src/editor/managers/StateManager.ts +0 -261
  335. package/src/editor/managers/StyleManager.browser.test.ts +0 -122
  336. package/src/editor/managers/StyleManager.test.ts +0 -98
  337. package/src/editor/managers/StyleManager.ts +0 -278
  338. package/src/editor/managers/index.ts +0 -8
  339. package/src/editor/performance.test.ts +0 -192
  340. package/src/editor/selectionTypes.ts +0 -14
  341. package/src/editor/transformPasted.test.ts +0 -295
  342. package/src/editor/transformPasted.ts +0 -294
  343. package/src/exporter/ExportImage.ts +0 -50
  344. package/src/exporter/Exporter.test.ts +0 -255
  345. package/src/exporter/Exporter.ts +0 -185
  346. package/src/exporter/index.ts +0 -3
  347. package/src/exporter/mapping.ts +0 -110
  348. package/src/extensions/BlockChange/BlockChange.ts +0 -67
  349. package/src/extensions/DropCursor/DropCursor.ts +0 -376
  350. package/src/extensions/DropCursor/dropIntoChildren.ts +0 -80
  351. package/src/extensions/DropCursor/utils.ts +0 -195
  352. package/src/extensions/FilePanel/FilePanel.ts +0 -41
  353. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +0 -157
  354. package/src/extensions/History/History.ts +0 -11
  355. package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +0 -109
  356. package/src/extensions/LinkToolbar/LinkToolbar.ts +0 -76
  357. package/src/extensions/LinkToolbar/protocols.ts +0 -13
  358. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.ts +0 -190
  359. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +0 -112
  360. package/src/extensions/Placeholder/Placeholder.test.ts +0 -23
  361. package/src/extensions/Placeholder/Placeholder.ts +0 -150
  362. package/src/extensions/PositionMapping/PositionMapping.ts +0 -68
  363. package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +0 -156
  364. package/src/extensions/PreviousBlockType/PreviousBlockType.ts +0 -201
  365. package/src/extensions/README.md +0 -3
  366. package/src/extensions/ReadOnly/ReadOnly.test.ts +0 -181
  367. package/src/extensions/ReadOnly/ReadOnly.ts +0 -73
  368. package/src/extensions/ShowSelection/ShowSelection.ts +0 -61
  369. package/src/extensions/SideMenu/MultipleNodeSelection.ts +0 -89
  370. package/src/extensions/SideMenu/SideMenu.ts +0 -470
  371. package/src/extensions/SideMenu/blockDropHandling.ts +0 -372
  372. package/src/extensions/SideMenu/blockGeometry.browser.test.ts +0 -148
  373. package/src/extensions/SideMenu/blockGeometry.test.ts +0 -46
  374. package/src/extensions/SideMenu/blockGeometry.ts +0 -53
  375. package/src/extensions/SideMenu/dragging.ts +0 -200
  376. package/src/extensions/SideMenu/sideMenuHover.test.ts +0 -36
  377. package/src/extensions/SideMenu/sideMenuHover.ts +0 -270
  378. package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +0 -193
  379. package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +0 -142
  380. package/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts +0 -4
  381. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +0 -11
  382. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +0 -309
  383. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +0 -436
  384. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +0 -76
  385. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +0 -299
  386. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +0 -130
  387. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +0 -89
  388. package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +0 -135
  389. package/src/extensions/SyntaxHighlighting/shiki.ts +0 -116
  390. package/src/extensions/TableHandles/TableHandles.browser.test.ts +0 -307
  391. package/src/extensions/TableHandles/TableHandles.ts +0 -1263
  392. package/src/extensions/TrailingNode/TrailingNode.ts +0 -233
  393. package/src/extensions/Versioning/Versioning.browser.test.ts +0 -151
  394. package/src/extensions/Versioning/Versioning.node.test.ts +0 -177
  395. package/src/extensions/Versioning/Versioning.ts +0 -161
  396. package/src/extensions/Versioning/__test__/result.ts +0 -12
  397. package/src/extensions/Versioning/comparison.test.ts +0 -40
  398. package/src/extensions/Versioning/createVersioning.test.ts +0 -867
  399. package/src/extensions/Versioning/createVersioning.ts +0 -499
  400. package/src/extensions/Versioning/formatVersionDate.ts +0 -24
  401. package/src/extensions/Versioning/inMemoryVersioning.test.ts +0 -572
  402. package/src/extensions/Versioning/inMemoryVersioning.ts +0 -268
  403. package/src/extensions/Versioning/index.ts +0 -6
  404. package/src/extensions/Versioning/scrollScheduling.test.ts +0 -51
  405. package/src/extensions/Versioning/scrollToFirstChange.test.ts +0 -320
  406. package/src/extensions/Versioning/scrollToFirstChange.ts +0 -139
  407. package/src/extensions/Versioning/types.ts +0 -219
  408. package/src/extensions/Versioning/versioningState.ts +0 -154
  409. package/src/extensions/blockDOM.browser.test.ts +0 -102
  410. package/src/extensions/blockDOM.test.ts +0 -178
  411. package/src/extensions/blockDOM.ts +0 -135
  412. package/src/extensions/index.ts +0 -27
  413. package/src/extensions/tiptap-extensions/BackgroundColor/BackgroundColorExtension.ts +0 -17
  414. package/src/extensions/tiptap-extensions/HardBreak/HardBreak.ts +0 -35
  415. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +0 -1870
  416. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +0 -1116
  417. package/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.ts +0 -152
  418. package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +0 -174
  419. package/src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts +0 -82
  420. package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +0 -412
  421. package/src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts +0 -53
  422. package/src/extensions/tiptap-extensions/Link/helpers/tlds.ts +0 -7
  423. package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +0 -13
  424. package/src/extensions/tiptap-extensions/Link/index.ts +0 -2
  425. package/src/extensions/tiptap-extensions/Link/link.test.ts +0 -945
  426. package/src/extensions/tiptap-extensions/Link/link.ts +0 -238
  427. package/src/extensions/tiptap-extensions/TextAlignment/TextAlignmentExtension.ts +0 -33
  428. package/src/extensions/tiptap-extensions/TextColor/TextColorExtension.ts +0 -17
  429. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +0 -173
  430. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +0 -339
  431. package/src/extensions/tiptap-extensions/index.ts +0 -7
  432. package/src/extensions-shared/UiElementPosition.ts +0 -4
  433. package/src/fonts/inter.browser.test.ts +0 -57
  434. package/src/i18n/dictionary.ts +0 -17
  435. package/src/i18n/index.ts +0 -2
  436. package/src/i18n/locales/ar.ts +0 -443
  437. package/src/i18n/locales/de.ts +0 -477
  438. package/src/i18n/locales/en.ts +0 -458
  439. package/src/i18n/locales/es.ts +0 -456
  440. package/src/i18n/locales/fa.ts +0 -427
  441. package/src/i18n/locales/fr.ts +0 -504
  442. package/src/i18n/locales/he.ts +0 -458
  443. package/src/i18n/locales/hr.ts +0 -472
  444. package/src/i18n/locales/index.ts +0 -23
  445. package/src/i18n/locales/is.ts +0 -472
  446. package/src/i18n/locales/it.ts +0 -480
  447. package/src/i18n/locales/ja.ts +0 -498
  448. package/src/i18n/locales/ko.ts +0 -471
  449. package/src/i18n/locales/nl.ts +0 -459
  450. package/src/i18n/locales/no.ts +0 -476
  451. package/src/i18n/locales/pl.ts +0 -449
  452. package/src/i18n/locales/pt.ts +0 -451
  453. package/src/i18n/locales/ru.ts +0 -502
  454. package/src/i18n/locales/sk.ts +0 -456
  455. package/src/i18n/locales/uk.ts +0 -482
  456. package/src/i18n/locales/uz.ts +0 -492
  457. package/src/i18n/locales/vi.ts +0 -457
  458. package/src/i18n/locales/zh-tw.ts +0 -499
  459. package/src/i18n/locales/zh.ts +0 -499
  460. package/src/index.ts +0 -66
  461. package/src/locales.ts +0 -1
  462. package/src/pm-nodes/BlockContainer.test.ts +0 -101
  463. package/src/pm-nodes/BlockContainer.ts +0 -200
  464. package/src/pm-nodes/BlockGroup.ts +0 -58
  465. package/src/pm-nodes/Doc.ts +0 -11
  466. package/src/pm-nodes/README.md +0 -143
  467. package/src/pm-nodes/index.ts +0 -3
  468. package/src/pm-nodes/suggestionMarks.ts +0 -43
  469. package/src/schema/README.md +0 -3
  470. package/src/schema/blocks/children.test.ts +0 -288
  471. package/src/schema/blocks/children.ts +0 -136
  472. package/src/schema/blocks/createSpec.browser.test.ts +0 -176
  473. package/src/schema/blocks/createSpec.test.ts +0 -354
  474. package/src/schema/blocks/createSpec.ts +0 -732
  475. package/src/schema/blocks/extendBlockSpec.test.ts +0 -188
  476. package/src/schema/blocks/frame.test.ts +0 -112
  477. package/src/schema/blocks/frame.ts +0 -337
  478. package/src/schema/blocks/internal.test.ts +0 -86
  479. package/src/schema/blocks/internal.ts +0 -288
  480. package/src/schema/blocks/keyboard.ts +0 -154
  481. package/src/schema/blocks/layoutBlockAttributes.ts +0 -29
  482. package/src/schema/blocks/meta.test.ts +0 -53
  483. package/src/schema/blocks/meta.ts +0 -35
  484. package/src/schema/blocks/renderFrame.test.ts +0 -691
  485. package/src/schema/blocks/types.ts +0 -966
  486. package/src/schema/blocks/validateChildren.ts +0 -156
  487. package/src/schema/contentTypePropagation.test.ts +0 -182
  488. package/src/schema/dataAttributes.test.ts +0 -72
  489. package/src/schema/dataAttributes.ts +0 -69
  490. package/src/schema/index.ts +0 -15
  491. package/src/schema/inlineContent/createSpec.test.ts +0 -161
  492. package/src/schema/inlineContent/createSpec.ts +0 -409
  493. package/src/schema/inlineContent/internal.ts +0 -131
  494. package/src/schema/inlineContent/types.ts +0 -204
  495. package/src/schema/markGroups.ts +0 -82
  496. package/src/schema/nodeViewMutations.test.ts +0 -146
  497. package/src/schema/nodeViewMutations.ts +0 -49
  498. package/src/schema/propTypes.ts +0 -61
  499. package/src/schema/schema.test.ts +0 -110
  500. package/src/schema/schema.ts +0 -243
  501. package/src/schema/styles/createSpec.ts +0 -140
  502. package/src/schema/styles/internal.ts +0 -155
  503. package/src/schema/styles/types.ts +0 -57
  504. package/src/style.css +0 -2
  505. package/src/user/UserStore.ts +0 -199
  506. package/src/user/createUserStore.test.ts +0 -126
  507. package/src/user/index.ts +0 -2
  508. package/src/user/userColors.test.ts +0 -108
  509. package/src/user/userColors.ts +0 -101
  510. package/src/util/EventEmitter.ts +0 -59
  511. package/src/util/README.md +0 -3
  512. package/src/util/Store.test.ts +0 -132
  513. package/src/util/Store.ts +0 -135
  514. package/src/util/browser.ts +0 -54
  515. package/src/util/combineByGroup.ts +0 -25
  516. package/src/util/expandToWords.ts +0 -38
  517. package/src/util/string.ts +0 -36
  518. package/src/util/table.ts +0 -110
  519. package/src/util/topo-sort.test.ts +0 -125
  520. package/src/util/topo-sort.ts +0 -206
  521. package/src/util/typescript.ts +0 -17
  522. package/src/vite-env.d.ts +0 -7
  523. package/src/y/README.md +0 -5
  524. package/src/y/comments/RESTYjsThreadStore.ts +0 -138
  525. package/src/y/comments/YjsThreadStore.test.ts +0 -295
  526. package/src/y/comments/YjsThreadStore.ts +0 -358
  527. package/src/y/comments/YjsThreadStoreBase.ts +0 -50
  528. package/src/y/comments/index.ts +0 -3
  529. package/src/y/comments/yjsHelpers.ts +0 -125
  530. package/src/y/extensions/AttributionExtension.test.ts +0 -364
  531. package/src/y/extensions/AttributionExtension.ts +0 -401
  532. package/src/y/extensions/DiffVersioningExtension.test.ts +0 -242
  533. package/src/y/extensions/DiffVersioningExtension.ts +0 -200
  534. package/src/y/extensions/EmptyDocBinding.test.ts +0 -282
  535. package/src/y/extensions/ForkYDoc.node.test.ts +0 -77
  536. package/src/y/extensions/ForkYDoc.test.ts +0 -344
  537. package/src/y/extensions/ForkYDoc.ts +0 -117
  538. package/src/y/extensions/History.test.ts +0 -125
  539. package/src/y/extensions/RelativePositionMapping.test.ts +0 -453
  540. package/src/y/extensions/RelativePositionMapping.ts +0 -45
  541. package/src/y/extensions/Suggestions.ts +0 -174
  542. package/src/y/extensions/Versioning.node.test.ts +0 -126
  543. package/src/y/extensions/Versioning.test.ts +0 -117
  544. package/src/y/extensions/Versioning.ts +0 -74
  545. package/src/y/extensions/YAttributionMarks.ts +0 -422
  546. package/src/y/extensions/YCursorPlugin.ts +0 -192
  547. package/src/y/extensions/YSync.node.test.ts +0 -75
  548. package/src/y/extensions/YSync.ts +0 -197
  549. package/src/y/extensions/YSyncRemount.test.ts +0 -99
  550. package/src/y/extensions/blockMatchNodes.ts +0 -173
  551. package/src/y/extensions/index.ts +0 -140
  552. package/src/y/extensions/legacyYjsDocBinding.test.ts +0 -652
  553. package/src/y/extensions/nestingChanges.test.ts +0 -326
  554. package/src/y/extensions/persistentBlockGroups.test.ts +0 -1709
  555. package/src/y/extensions/persistentBlockGroups.ts +0 -953
  556. package/src/y/extensions/snapshotCodec.test.ts +0 -105
  557. package/src/y/extensions/snapshotCodec.ts +0 -39
  558. package/src/y/extensions/snapshotPreview.test.ts +0 -201
  559. package/src/y/extensions/snapshotPreview.ts +0 -292
  560. package/src/y/extensions/tableReshape.test.ts +0 -121
  561. package/src/y/extensions/v1BindingSnapshotDiff.test.ts +0 -121
  562. package/src/y/extensions/versionDiffAttribution.test.ts +0 -944
  563. package/src/y/extensions/versionDiffPerformance.test.ts +0 -101
  564. package/src/y/index.ts +0 -5
  565. package/src/y/utils.test.ts +0 -1309
  566. package/src/y/utils.ts +0 -366
  567. package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
  568. package/src/y/versioning/__test__/fixtures/activity-all-after.json +0 -50
  569. package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
  570. package/src/y/versioning/__test__/fixtures/activity-all.json +0 -20
  571. package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
  572. package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +0 -32
  573. package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +0 -1
  574. package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
  575. package/src/y/versioning/__test__/fixtures/patch-response.json +0 -4
  576. package/src/y/versioning/__test__/yhub.test.ts +0 -966
  577. package/src/y/versioning/index.ts +0 -6
  578. package/src/y/versioning/yhub.ts +0 -350
  579. package/src/y/versioning/yhubClient.ts +0 -345
  580. package/src/yjs/README.md +0 -5
  581. package/src/yjs/comments/RESTYjsThreadStore.test.ts +0 -95
  582. package/src/yjs/comments/RESTYjsThreadStore.ts +0 -172
  583. package/src/yjs/comments/YjsThreadStore.test.ts +0 -295
  584. package/src/yjs/comments/YjsThreadStore.ts +0 -345
  585. package/src/yjs/comments/YjsThreadStoreBase.ts +0 -50
  586. package/src/yjs/comments/index.ts +0 -3
  587. package/src/yjs/comments/yjsHelpers.ts +0 -127
  588. package/src/yjs/extensions/FixUpSchema.test.ts +0 -421
  589. package/src/yjs/extensions/FixUpSchema.ts +0 -99
  590. package/src/yjs/extensions/ForkYDoc.browser.test.ts +0 -84
  591. package/src/yjs/extensions/ForkYDoc.node.test.ts +0 -231
  592. package/src/yjs/extensions/ForkYDoc.test.ts +0 -320
  593. package/src/yjs/extensions/ForkYDoc.ts +0 -177
  594. package/src/yjs/extensions/RelativePositionMapping.test.ts +0 -418
  595. package/src/yjs/extensions/RelativePositionMapping.ts +0 -77
  596. package/src/yjs/extensions/Versioning.test.ts +0 -376
  597. package/src/yjs/extensions/Versioning.ts +0 -126
  598. package/src/yjs/extensions/YCursorPlugin.ts +0 -201
  599. package/src/yjs/extensions/YSync.ts +0 -16
  600. package/src/yjs/extensions/YUndo.ts +0 -12
  601. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor-forked.json +0 -19
  602. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor.json +0 -19
  603. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-forked.html +0 -1
  604. package/src/yjs/extensions/__snapshots__/fork-yjs-snap.html +0 -1
  605. package/src/yjs/extensions/index.ts +0 -89
  606. package/src/yjs/extensions/schemaMigration/SchemaMigration.ts +0 -59
  607. package/src/yjs/extensions/schemaMigration/migrationRules/index.ts +0 -4
  608. package/src/yjs/extensions/schemaMigration/migrationRules/migrationRule.ts +0 -4
  609. package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.ts +0 -130
  610. package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.ts +0 -91
  611. package/src/yjs/index.ts +0 -7
  612. package/src/yjs/utils.test.ts +0 -1013
  613. package/src/yjs/utils.ts +0 -186
  614. package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.d.ts +0 -1
  615. package/types/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.d.ts +0 -1
  616. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.d.ts +0 -1
  617. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.d.ts +0 -1
  618. package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.test.d.ts +0 -1
  619. package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.d.ts +0 -1
  620. package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.test.d.ts +0 -1
  621. package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.test.d.ts +0 -1
  622. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.d.ts +0 -1
  623. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.d.ts +0 -1
  624. package/types/src/api/blockManipulation/layoutBlocks/plainBlocks.test.d.ts +0 -1
  625. package/types/src/api/blockManipulation/layoutBlocks/titledBlocks.test.d.ts +0 -1
  626. package/types/src/api/blockManipulation/tables/tables.test.d.ts +0 -1
  627. package/types/src/api/getBlockInfoFromPos.test.d.ts +0 -1
  628. package/types/src/api/getBlocksChangedByTransaction.test.d.ts +0 -1
  629. package/types/src/api/getChangedRanges.test.d.ts +0 -1
  630. package/types/src/api/nodeConversions/blockToNode.test.d.ts +0 -1
  631. package/types/src/api/parsers/html/util/nestedLists.test.d.ts +0 -1
  632. package/types/src/api/parsers/markdown/detectMarkdown.test.d.ts +0 -1
  633. package/types/src/api/positionMapping.test.d.ts +0 -1
  634. package/types/src/blocks/Code/block.test.d.ts +0 -1
  635. package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +0 -1
  636. package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.d.ts +0 -1
  637. package/types/src/blocks/Table/TableExtension.test.d.ts +0 -1
  638. package/types/src/blocks/ToggleWrapper/toggleBlocks.browser.test.d.ts +0 -1
  639. package/types/src/blocks/defaultBlockTypeItems.test.d.ts +0 -1
  640. package/types/src/blocks/defaultBlocks.test.d.ts +0 -1
  641. package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +0 -1
  642. package/types/src/editor/BlockNoteEditor.node.test.d.ts +0 -1
  643. package/types/src/editor/BlockNoteEditor.test.d.ts +0 -1
  644. package/types/src/editor/BlockNoteExtension.test.d.ts +0 -1
  645. package/types/src/editor/blockColors.browser.test.d.ts +0 -1
  646. package/types/src/editor/managers/EventManager.browser.test.d.ts +0 -1
  647. package/types/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.d.ts +0 -1
  648. package/types/src/editor/managers/ExtensionManager/ExtensionManager.node.test.d.ts +0 -1
  649. package/types/src/editor/managers/ExtensionManager/ExtensionManager.test.d.ts +0 -1
  650. package/types/src/editor/managers/StyleManager.browser.test.d.ts +0 -1
  651. package/types/src/editor/managers/StyleManager.test.d.ts +0 -1
  652. package/types/src/editor/performance.test.d.ts +0 -1
  653. package/types/src/editor/transformPasted.test.d.ts +0 -1
  654. package/types/src/exporter/Exporter.test.d.ts +0 -1
  655. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.d.ts +0 -1
  656. package/types/src/extensions/Placeholder/Placeholder.test.d.ts +0 -1
  657. package/types/src/extensions/PreviousBlockType/PreviousBlockType.test.d.ts +0 -1
  658. package/types/src/extensions/ReadOnly/ReadOnly.test.d.ts +0 -1
  659. package/types/src/extensions/SideMenu/blockGeometry.browser.test.d.ts +0 -1
  660. package/types/src/extensions/SideMenu/blockGeometry.test.d.ts +0 -1
  661. package/types/src/extensions/SideMenu/sideMenuHover.test.d.ts +0 -1
  662. package/types/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.d.ts +0 -4
  663. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +0 -1
  664. package/types/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.d.ts +0 -4
  665. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +0 -1
  666. package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +0 -1
  667. package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +0 -1
  668. package/types/src/extensions/Versioning/Versioning.browser.test.d.ts +0 -1
  669. package/types/src/extensions/Versioning/Versioning.node.test.d.ts +0 -1
  670. package/types/src/extensions/Versioning/__test__/result.d.ts +0 -3
  671. package/types/src/extensions/Versioning/comparison.test.d.ts +0 -1
  672. package/types/src/extensions/Versioning/createVersioning.test.d.ts +0 -1
  673. package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +0 -1
  674. package/types/src/extensions/Versioning/scrollScheduling.test.d.ts +0 -1
  675. package/types/src/extensions/Versioning/scrollToFirstChange.test.d.ts +0 -1
  676. package/types/src/extensions/blockDOM.browser.test.d.ts +0 -1
  677. package/types/src/extensions/blockDOM.test.d.ts +0 -1
  678. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +0 -4
  679. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.d.ts +0 -1
  680. package/types/src/extensions/tiptap-extensions/Link/link.test.d.ts +0 -1
  681. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +0 -4
  682. package/types/src/fonts/inter.browser.test.d.ts +0 -2
  683. package/types/src/pm-nodes/BlockContainer.test.d.ts +0 -1
  684. package/types/src/schema/blocks/children.test.d.ts +0 -1
  685. package/types/src/schema/blocks/createSpec.browser.test.d.ts +0 -1
  686. package/types/src/schema/blocks/createSpec.test.d.ts +0 -1
  687. package/types/src/schema/blocks/extendBlockSpec.test.d.ts +0 -1
  688. package/types/src/schema/blocks/frame.test.d.ts +0 -1
  689. package/types/src/schema/blocks/internal.test.d.ts +0 -1
  690. package/types/src/schema/blocks/meta.test.d.ts +0 -1
  691. package/types/src/schema/blocks/renderFrame.test.d.ts +0 -1
  692. package/types/src/schema/contentTypePropagation.test.d.ts +0 -1
  693. package/types/src/schema/dataAttributes.test.d.ts +0 -1
  694. package/types/src/schema/inlineContent/createSpec.test.d.ts +0 -1
  695. package/types/src/schema/nodeViewMutations.test.d.ts +0 -1
  696. package/types/src/schema/schema.test.d.ts +0 -1
  697. package/types/src/user/createUserStore.test.d.ts +0 -1
  698. package/types/src/user/userColors.test.d.ts +0 -1
  699. package/types/src/util/Store.test.d.ts +0 -1
  700. package/types/src/util/topo-sort.test.d.ts +0 -1
  701. package/types/src/y/comments/YjsThreadStore.test.d.ts +0 -1
  702. package/types/src/y/extensions/AttributionExtension.test.d.ts +0 -1
  703. package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +0 -1
  704. package/types/src/y/extensions/EmptyDocBinding.test.d.ts +0 -1
  705. package/types/src/y/extensions/ForkYDoc.node.test.d.ts +0 -1
  706. package/types/src/y/extensions/ForkYDoc.test.d.ts +0 -1
  707. package/types/src/y/extensions/History.test.d.ts +0 -1
  708. package/types/src/y/extensions/RelativePositionMapping.test.d.ts +0 -1
  709. package/types/src/y/extensions/Versioning.node.test.d.ts +0 -1
  710. package/types/src/y/extensions/Versioning.test.d.ts +0 -1
  711. package/types/src/y/extensions/YSync.node.test.d.ts +0 -1
  712. package/types/src/y/extensions/YSyncRemount.test.d.ts +0 -1
  713. package/types/src/y/extensions/legacyYjsDocBinding.test.d.ts +0 -1
  714. package/types/src/y/extensions/nestingChanges.test.d.ts +0 -1
  715. package/types/src/y/extensions/persistentBlockGroups.test.d.ts +0 -1
  716. package/types/src/y/extensions/snapshotCodec.test.d.ts +0 -1
  717. package/types/src/y/extensions/snapshotPreview.test.d.ts +0 -1
  718. package/types/src/y/extensions/tableReshape.test.d.ts +0 -1
  719. package/types/src/y/extensions/v1BindingSnapshotDiff.test.d.ts +0 -1
  720. package/types/src/y/extensions/versionDiffAttribution.test.d.ts +0 -1
  721. package/types/src/y/extensions/versionDiffPerformance.test.d.ts +0 -1
  722. package/types/src/y/utils.test.d.ts +0 -1
  723. package/types/src/y/versioning/__test__/yhub.test.d.ts +0 -1
  724. package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +0 -1
  725. package/types/src/yjs/comments/YjsThreadStore.test.d.ts +0 -1
  726. package/types/src/yjs/extensions/FixUpSchema.test.d.ts +0 -1
  727. package/types/src/yjs/extensions/ForkYDoc.browser.test.d.ts +0 -1
  728. package/types/src/yjs/extensions/ForkYDoc.node.test.d.ts +0 -1
  729. package/types/src/yjs/extensions/ForkYDoc.test.d.ts +0 -1
  730. package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +0 -1
  731. package/types/src/yjs/extensions/Versioning.test.d.ts +0 -1
  732. package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +0 -1
  733. package/types/src/yjs/utils.test.d.ts +0 -1
@@ -0,0 +1,1939 @@
1
+ import { n as e, t } from "./BlockNoteExtension-U58cXw1g.js";
2
+ import { Fragment as n, Slice as r } from "prosemirror-model";
3
+ import { NodeSelection as i, Plugin as a, PluginKey as o, Selection as s, TextSelection as c } from "prosemirror-state";
4
+ import { Fragment as l } from "@tiptap/pm/model";
5
+ import { Extension as u, combineTransactionSteps as d, findChildrenInRange as f, findParentNode as p, getChangedRanges as m } from "@tiptap/core";
6
+ import { uuidv4 as h } from "lib0/random";
7
+ import { CellSelection as g } from "prosemirror-tables";
8
+ import { Decoration as _, DecorationSet as ee } from "prosemirror-view";
9
+ // src/schema/blocks/children.ts
10
+ var te = "childContainer", ne = "blockGroupChild";
11
+ function v(e) {
12
+ return e.isInGroup("childContainer") && e.isInGroup("bnBlock");
13
+ }
14
+ function re(e, t) {
15
+ return e.nodes.blockGroup.createChecked({}, t);
16
+ }
17
+ function ie(e) {
18
+ return v(e) && e.spec.blockConfig?.placeable === "namedOnly";
19
+ }
20
+ var ae = {
21
+ min: 30,
22
+ max: 49
23
+ }, oe = 101;
24
+ function se(e) {
25
+ if (e === void 0) return 40;
26
+ let t = Math.round((e - oe) / 10);
27
+ return Math.min(ae.max, Math.max(ae.min, 40 + t));
28
+ }
29
+ function ce(e) {
30
+ return e !== void 0 && "min" in e ? e.min ?? 1 : 1;
31
+ }
32
+ function le(e, t) {
33
+ if (e.length === 0) return ne;
34
+ let n = ["blockContainer", ...Object.entries(t).filter(([t, { config: n }]) => n.layoutOnly === !0 && n.placeable !== "namedOnly" && !e.includes(t)).map(([e]) => e)];
35
+ return n.length === 1 ? n[0] : `(${n.join(" | ")})`;
36
+ }
37
+ function ue(e = {}, t = ne) {
38
+ let { allow: n = "blocks" } = e, r = ce(e), i;
39
+ if (n === "blocks") i = t;
40
+ else {
41
+ if (n.length === 0) throw Error("Layout block `allow` permits nothing. A layout block must accept at least one block or layout block type; drop `children` entirely for a block that holds none.");
42
+ i = n.length === 1 ? n[0] : `(${n.join(" | ")})`;
43
+ }
44
+ return i + (r === 0 ? "*" : r === 1 ? "+" : `{${r},}`);
45
+ }
46
+ // src/api/getBlockInfoFromPos.ts
47
+ function de(e, t) {
48
+ return t === "start" ? e.beforePos + 4 : e.afterPos - 4;
49
+ }
50
+ function fe(e, t) {
51
+ return !e.hasContent || e.contentKind === "none" ? null : e.contentKind === "table" ? de(e.content, t) : t === "start" ? e.contentStart : e.contentEnd;
52
+ }
53
+ function pe(e, t, n) {
54
+ let r = fe(t, n);
55
+ if (r !== null) return c.create(e, r);
56
+ if (t.hasContent) return i.create(e, t.content.beforePos);
57
+ let { node: a, childrenStart: o, childrenEnd: s } = t.children, l = n === "start" ? a.firstChild : a.lastChild;
58
+ return l ? pe(e, b(l, n === "start" ? o : s - l.nodeSize), n) : i.create(e, t.block.beforePos);
59
+ }
60
+ function y(e) {
61
+ return e.marks.some((e) => ["y-attributed-delete"].includes(e.type.name));
62
+ }
63
+ var me = /* @__PURE__ */ new WeakMap();
64
+ function he(e) {
65
+ let t = me.get(e);
66
+ if (t === void 0) {
67
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
68
+ e.descendants((e) => {
69
+ let t = e.attrs.id;
70
+ if (t) {
71
+ let i = r.get(t) ?? 0;
72
+ y(e) && !n.has(e) && n.set(e, `${t}-${i}`), r.set(t, i + 1);
73
+ }
74
+ return !0;
75
+ }), t = n, me.set(e, t);
76
+ }
77
+ return t;
78
+ }
79
+ function ge(e, t) {
80
+ let n = e.attrs.id;
81
+ if (!n) throw Error(`Node ${e.type.name} does not have an ID`);
82
+ if (y(e)) {
83
+ let r = he(t).get(e);
84
+ if (r === void 0) throw Error(`Node ${e.type.name} with ID ${n} not found in document`);
85
+ return r;
86
+ }
87
+ return n;
88
+ }
89
+ function _e(e, t) {
90
+ let n = e.resolve(t);
91
+ if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
92
+ posBeforeNode: n.pos,
93
+ node: n.nodeAfter
94
+ };
95
+ let r = n.depth, i = n.node(r);
96
+ for (; r > 0;) {
97
+ if (i.type.isInGroup("bnBlock")) return {
98
+ posBeforeNode: n.before(r),
99
+ node: i
100
+ };
101
+ r--, i = n.node(r);
102
+ }
103
+ let a = [];
104
+ e.descendants((e, t) => {
105
+ e.type.isInGroup("bnBlock") && a.push(t);
106
+ }), console.warn(`Position ${t} is not within a blockContainer node.`);
107
+ let o = a.find((e) => e >= t) ?? a.at(-1);
108
+ if (o === void 0) throw Error("Document has no block containers");
109
+ let s = e.resolve(o);
110
+ return {
111
+ posBeforeNode: s.pos,
112
+ node: s.nodeAfter
113
+ };
114
+ }
115
+ function b(e, t) {
116
+ if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get block node at position but found node of different type ${e.type.name}`);
117
+ let n = {
118
+ node: e,
119
+ beforePos: t,
120
+ afterPos: t + e.nodeSize
121
+ };
122
+ if (v(e.type)) return {
123
+ hasContent: !1,
124
+ block: n,
125
+ children: {
126
+ ...n,
127
+ childrenStart: n.beforePos + 1,
128
+ childrenEnd: n.afterPos - 1
129
+ },
130
+ blockNoteType: e.type.name
131
+ };
132
+ if (e.type.name === "blockContainer") {
133
+ let r = e.firstChild;
134
+ if (!r || !r.type.isInGroup("blockContent")) throw Error("blockContainer must start with a block content node.");
135
+ let i = {
136
+ node: r,
137
+ beforePos: t + 1,
138
+ afterPos: t + 1 + r.nodeSize
139
+ }, a;
140
+ if (e.childCount > 1) {
141
+ let t = e.child(1);
142
+ if (e.childCount !== 2 || t.type.name !== "blockGroup") throw Error("blockContainer may only have a blockGroup after its content.");
143
+ a = {
144
+ node: t,
145
+ beforePos: i.afterPos,
146
+ afterPos: n.afterPos - 1,
147
+ childrenStart: i.afterPos + 1,
148
+ childrenEnd: n.afterPos - 2
149
+ };
150
+ }
151
+ let o = i.node.type.spec.blockConfig;
152
+ if (!o) throw Error(`Block content node "${i.node.type.name}" was not built from a block spec, so it has no content kind. Register it with \`createBlockSpec\`/\`createBlockSpecFromTiptapNode\` instead of joining the \`blockContent\` group directly.`);
153
+ return {
154
+ hasContent: !0,
155
+ block: n,
156
+ content: i,
157
+ children: a,
158
+ contentStart: i.beforePos + 1,
159
+ contentEnd: i.afterPos - 1,
160
+ contentKind: o.content,
161
+ isContentEmpty: i.node.childCount === 0,
162
+ blockNoteType: i.node.type.name
163
+ };
164
+ }
165
+ throw Error(`Node "${e.type.name}" is not a container or blockContainer.`);
166
+ }
167
+ function x(e, t) {
168
+ let n = e.resolve(t);
169
+ if (!n.nodeAfter) throw Error(`Attempted to get block node at position ${t} but a node at this position does not exist`);
170
+ return b(n.nodeAfter, n.pos);
171
+ }
172
+ function ve(e, t) {
173
+ let n = _e(e.doc, t);
174
+ return b(n.node, n.posBeforeNode);
175
+ }
176
+ function ye(e) {
177
+ return ve(e, e.selection.anchor);
178
+ }
179
+ function be(e, t) {
180
+ let n = e.resolve(t), r = n.node();
181
+ if (r.type.isInGroup("bnBlock")) return x(e, n.before(n.depth));
182
+ if (r.type.isInGroup("childContainer") && n.depth > 1) return x(e, n.before(n.depth - 1));
183
+ }
184
+ function xe(e, t) {
185
+ let n = e.resolve(t), r = n.index();
186
+ if (r !== 0) return x(e, n.posAtIndex(r - 1));
187
+ }
188
+ function Se(e, t) {
189
+ let n = e.resolve(t), r = n.index();
190
+ if (r !== n.node().childCount - 1) return x(e, n.posAtIndex(r + 1));
191
+ }
192
+ function Ce(e) {
193
+ for (; e.children && e.children.node.childCount;) {
194
+ let t = e.children.node.lastChild;
195
+ e = b(t, e.children.childrenEnd - t.nodeSize);
196
+ }
197
+ return e;
198
+ }
199
+ function we(e, t, n, r) {
200
+ if (n === "before" || n === "after") {
201
+ let i = n === "before" ? t.block.beforePos : t.block.afterPos, a = e.resolve(i);
202
+ return a.parent.canReplaceWith(a.index(), a.index(), r) ? { pos: i } : null;
203
+ }
204
+ if (!t.children) {
205
+ let e = r.schema.nodes.blockGroup;
206
+ return t.hasContent && e?.contentMatch.matchType(r) ? {
207
+ pos: t.content.afterPos,
208
+ wrapIn: e
209
+ } : null;
210
+ }
211
+ let i = n === "last-child";
212
+ for (; t.children;) {
213
+ let e = t.children, n = i ? e.node.childCount : 0;
214
+ if (e.node.canReplaceWith(n, n, r)) return { pos: i ? e.childrenEnd : e.childrenStart };
215
+ let a = i ? e.node.lastChild : e.node.firstChild;
216
+ if (!a || !v(a.type)) break;
217
+ t = b(a, i ? e.childrenEnd - a.nodeSize : e.childrenStart);
218
+ }
219
+ return null;
220
+ }
221
+ function Te(e) {
222
+ for (; !e.hasContent;) {
223
+ let { node: t, childrenStart: n } = e.children;
224
+ if (!t.firstChild) return null;
225
+ e = b(t.firstChild, n);
226
+ }
227
+ return e;
228
+ }
229
+ function Ee(e, t, n, r = "before") {
230
+ for (;;) {
231
+ let i = e.resolve(t), a = i.node();
232
+ if (a.canReplaceWith(i.index(), i.index(), n)) return t;
233
+ if (i.depth > 0 && v(a.type)) t = r === "before" ? i.before() : i.after();
234
+ else return;
235
+ }
236
+ }
237
+ function De(e, t) {
238
+ let n = e.resolve(t), r = [];
239
+ for (let e = n.depth; e > 0; e--) {
240
+ let t = n.node(e);
241
+ if (!v(t.type)) break;
242
+ t.attrs.id && r.push({
243
+ id: t.attrs.id,
244
+ depth: e
245
+ });
246
+ }
247
+ return r;
248
+ }
249
+ // src/api/combineTransactionSteps.ts
250
+ function Oe(e, t) {
251
+ return t.length === 1 && t[0].before === e ? t[0] : d(e, [...t]);
252
+ }
253
+ // src/api/getChangedRanges.ts
254
+ function ke(e) {
255
+ let { mapping: t, steps: n } = e, r = t.maps;
256
+ for (let e = 0; e < r.length; e++) if (t.getMirror(e) !== void 0) return m({
257
+ mapping: t,
258
+ steps: n
259
+ });
260
+ let i = new je(r), a = [];
261
+ return r.forEach((e, t) => {
262
+ let r = [];
263
+ if (e.forEach((e, t) => r.push({
264
+ from: e,
265
+ to: t
266
+ })), !r.length) {
267
+ let { from: e, to: i } = n[t];
268
+ if (e === void 0 || i === void 0) return;
269
+ r.push({
270
+ from: e,
271
+ to: i
272
+ });
273
+ }
274
+ for (let { from: e, to: n } of r) {
275
+ let r = i.mapForward(e, -1, t), o = i.mapForward(n, 1, t);
276
+ a.push({
277
+ oldRange: {
278
+ from: i.mapBackward(r, -1),
279
+ to: i.mapBackward(o, 1)
280
+ },
281
+ newRange: {
282
+ from: r,
283
+ to: o
284
+ }
285
+ });
286
+ }
287
+ }), Ae(a);
288
+ }
289
+ function Ae(e) {
290
+ let t = /* @__PURE__ */ new Set(), n = e.filter(({ oldRange: e, newRange: n }) => {
291
+ let r = `${e.from},${e.to},${n.from},${n.to}`;
292
+ return !t.has(r) && (t.add(r), !0);
293
+ });
294
+ if (n.length === 1) return n;
295
+ let r = n.map((e, t) => t).sort((e, t) => n[e].newRange.from - n[t].newRange.from), i = new C(r.map((e) => n[e].newRange.to), "max");
296
+ return n.filter((e, t) => {
297
+ let a = 0, o = r.length - 1;
298
+ for (; a < o;) {
299
+ let t = a + o + 1 >> 1;
300
+ n[r[t]].newRange.from <= e.newRange.from ? a = t : o = t - 1;
301
+ }
302
+ return !i.someBefore(a, (t) => t >= e.newRange.to, (e) => r[e] !== t);
303
+ });
304
+ }
305
+ var je = class {
306
+ maps;
307
+ inverted;
308
+ firstStarts = [];
309
+ oldEnds = [];
310
+ newEnds = [];
311
+ shift = [0];
312
+ trees;
313
+ constructor(e) {
314
+ this.maps = e, this.inverted = Array(e.length);
315
+ for (let t of e) {
316
+ let e = Infinity, n = -Infinity, r = -Infinity, i = 0;
317
+ t.forEach((t, a, o, s) => {
318
+ e = Math.min(e, t, o), n = Math.max(n, a), r = Math.max(r, s), i += s - o - (a - t);
319
+ }), this.firstStarts.push(e), this.oldEnds.push(n), this.newEnds.push(r), this.shift.push(this.shift[this.shift.length - 1] + i);
320
+ }
321
+ }
322
+ mapForward(e, t, n) {
323
+ let r = 0, i = n;
324
+ for (; i < this.maps.length;) if (e < this.firstStarts[i]) r = Math.max(r, 0) + 1, r > S ? (i = this.getTrees().firstStart.firstFrom(i, (t) => t <= e), r = 0) : i++;
325
+ else if (e > this.oldEnds[i]) {
326
+ if (r = Math.min(r, 0) - 1, r < -S) {
327
+ let t = e - this.shift[i], n = this.getTrees().forwardShiftFrom.firstFrom(i, (e) => e >= t);
328
+ e += this.shift[n] - this.shift[i], i = n, r = 0;
329
+ } else e += this.shift[i + 1] - this.shift[i], i++;
330
+ } else e = this.maps[i].map(e, t), r = 0, i++;
331
+ return e;
332
+ }
333
+ mapBackward(e, t) {
334
+ let n = 0, r = this.maps.length - 1;
335
+ for (; r >= 0;) if (e < this.firstStarts[r]) n = Math.max(n, 0) + 1, n > S ? (r = this.getTrees().firstStart.lastFrom(r, (t) => t <= e), n = 0) : r--;
336
+ else if (e > this.newEnds[r]) {
337
+ if (n = Math.min(n, 0) - 1, n < -S) {
338
+ let t = e - this.shift[r + 1], i = this.getTrees().backwardShiftFrom.lastFrom(r, (e) => e >= t);
339
+ e -= this.shift[r + 1] - this.shift[i + 1], r = i, n = 0;
340
+ } else e -= this.shift[r + 1] - this.shift[r], r--;
341
+ } else this.inverted[r] ??= this.maps[r].invert(), e = this.inverted[r].map(e, t), n = 0, r--;
342
+ return e;
343
+ }
344
+ getTrees() {
345
+ return this.trees ??= {
346
+ firstStart: new C(this.firstStarts, "min"),
347
+ forwardShiftFrom: new C(this.oldEnds.map((e, t) => e - this.shift[t]), "max"),
348
+ backwardShiftFrom: new C(this.newEnds.map((e, t) => e - this.shift[t + 1]), "max")
349
+ }, this.trees;
350
+ }
351
+ }, S = 8, C = class {
352
+ values;
353
+ kind;
354
+ size;
355
+ tree;
356
+ constructor(e, t) {
357
+ this.values = e, this.kind = t, this.size = e.length, this.tree = Array(4 * Math.max(1, e.length)), e.length && this.build(1, 0, e.length - 1);
358
+ }
359
+ firstFrom(e, t) {
360
+ let n = this.first(1, 0, this.size - 1, e, t);
361
+ return n === -1 ? this.size : n;
362
+ }
363
+ lastFrom(e, t) {
364
+ return this.last(1, 0, this.size - 1, e, t);
365
+ }
366
+ someBefore(e, t, n) {
367
+ for (let r = this.lastFrom(e, t); r !== -1;) {
368
+ if (n(r)) return !0;
369
+ r = r === 0 ? -1 : this.lastFrom(r - 1, t);
370
+ }
371
+ return !1;
372
+ }
373
+ build(e, t, n) {
374
+ if (t === n) {
375
+ this.tree[e] = this.values[t];
376
+ return;
377
+ }
378
+ let r = t + n >> 1;
379
+ this.build(2 * e, t, r), this.build(2 * e + 1, r + 1, n), this.tree[e] = this.kind === "min" ? Math.min(this.tree[2 * e], this.tree[2 * e + 1]) : Math.max(this.tree[2 * e], this.tree[2 * e + 1]);
380
+ }
381
+ first(e, t, n, r, i) {
382
+ if (n < r || !i(this.tree[e])) return -1;
383
+ if (t === n) return t;
384
+ let a = t + n >> 1, o = this.first(2 * e, t, a, r, i);
385
+ return o === -1 ? this.first(2 * e + 1, a + 1, n, r, i) : o;
386
+ }
387
+ last(e, t, n, r, i) {
388
+ if (t > r || !i(this.tree[e])) return -1;
389
+ if (t === n) return t;
390
+ let a = t + n >> 1, o = this.last(2 * e + 1, a + 1, n, r, i);
391
+ return o === -1 ? this.last(2 * e, t, a, r, i) : o;
392
+ }
393
+ };
394
+ // src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
395
+ function Me(e, t = JSON.stringify) {
396
+ let n = {};
397
+ return e.filter((e) => {
398
+ let r = t(e);
399
+ return Object.hasOwn(n, r) ? !1 : n[r] = !0;
400
+ });
401
+ }
402
+ function Ne(e) {
403
+ return Me(e.filter((t, n) => e.indexOf(t) !== n));
404
+ }
405
+ function Pe(e) {
406
+ return e.marks.some((e) => e.type.name === "y-attributed-delete");
407
+ }
408
+ var w = u.create({
409
+ name: "uniqueID",
410
+ priority: 1e4,
411
+ addOptions() {
412
+ return {
413
+ types: [],
414
+ setIdAttribute: !1,
415
+ isWithinEditor: void 0,
416
+ generateID: () => {
417
+ let e = globalThis.window ?? globalThis;
418
+ if (e.__TEST_OPTIONS) {
419
+ let t = e.__TEST_OPTIONS;
420
+ return t.mockID === void 0 ? t.mockID = 0 : t.mockID++, t.mockID.toString();
421
+ }
422
+ return h();
423
+ }
424
+ };
425
+ },
426
+ addGlobalAttributes() {
427
+ return [{
428
+ types: this.options.types,
429
+ attributes: { id: {
430
+ default: null,
431
+ parseHTML: (e) => e.getAttribute("data-id"),
432
+ renderHTML: (e) => {
433
+ let t = { "data-id": e.id };
434
+ return this.options.setIdAttribute ? {
435
+ ...t,
436
+ id: e.id
437
+ } : t;
438
+ }
439
+ } }
440
+ }];
441
+ },
442
+ addProseMirrorPlugins() {
443
+ let { isWithinEditor: e } = this.options, t = null, i = !1;
444
+ return [new a({
445
+ key: new o("uniqueID"),
446
+ appendTransaction: (e, t, n) => {
447
+ if (!e.some((e) => e.docChanged) || t.doc.eq(n.doc)) return;
448
+ let { tr: r } = n, { types: i, generateID: a } = this.options, o = Oe(t.doc, e), { mapping: s } = o;
449
+ if (ke(o).forEach(({ newRange: e }) => {
450
+ let o = f(n.doc, e, (e) => i.includes(e.type.name)), c = Ne(o.filter(({ node: e }) => !Pe(e)).map(({ node: e }) => e.attrs.id).filter((e) => e !== null));
451
+ o.forEach(({ node: e, pos: i }) => {
452
+ if (Pe(e)) return;
453
+ let o = r.doc.nodeAt(i)?.attrs.id;
454
+ if (o === null) {
455
+ let o = t.doc.type.createAndFill().content;
456
+ if (t.doc.content.findDiffStart(o) === null) {
457
+ let t = JSON.parse(JSON.stringify(n.doc.toJSON()));
458
+ if (t.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(t.content) === JSON.stringify(o.toJSON())) {
459
+ r.setNodeMarkup(i, void 0, {
460
+ ...e.attrs,
461
+ id: "initialBlockId"
462
+ });
463
+ return;
464
+ }
465
+ }
466
+ r.setNodeMarkup(i, void 0, {
467
+ ...e.attrs,
468
+ id: a()
469
+ });
470
+ } else c.includes(o) && s.invert().mapResult(i).deleted && r.setNodeMarkup(i, void 0, {
471
+ ...e.attrs,
472
+ id: a()
473
+ });
474
+ });
475
+ }), r.steps.length) return r.setMeta("uniqueID", !0), r;
476
+ },
477
+ view(n) {
478
+ let r = (r) => {
479
+ let i = n.dom.parentElement;
480
+ t = i?.contains(r.target) || e?.(r.target) ? i : null;
481
+ };
482
+ return window.addEventListener("dragstart", r), { destroy() {
483
+ window.removeEventListener("dragstart", r);
484
+ } };
485
+ },
486
+ props: {
487
+ handleDOMEvents: {
488
+ drop: (e, n) => (i = t !== e.dom.parentElement || n.dataTransfer?.effectAllowed === "copy", t = null, !1),
489
+ paste: () => (i = !0, !1)
490
+ },
491
+ transformPasted: (e) => {
492
+ if (!i) return e;
493
+ let { types: t } = this.options, a = (e) => {
494
+ let r = [];
495
+ return e.forEach((e) => {
496
+ if (e.isText) {
497
+ r.push(e);
498
+ return;
499
+ }
500
+ if (!t.includes(e.type.name)) {
501
+ r.push(e.copy(a(e.content)));
502
+ return;
503
+ }
504
+ let n = e.type.create({
505
+ ...e.attrs,
506
+ id: null
507
+ }, a(e.content), e.marks);
508
+ r.push(n);
509
+ }), n.from(r);
510
+ };
511
+ return i = !1, new r(a(e.content), e.openStart, e.openEnd);
512
+ }
513
+ }
514
+ })];
515
+ }
516
+ });
517
+ // src/schema/inlineContent/types.ts
518
+ function T(e) {
519
+ return e.type === "link";
520
+ }
521
+ function Fe(e) {
522
+ return typeof e != "string" && e.type === "link";
523
+ }
524
+ function E(e) {
525
+ return typeof e != "string" && e.type === "text";
526
+ }
527
+ // src/util/table.ts
528
+ function D(e) {
529
+ return k(e) ? { ...e } : O(e) ? {
530
+ type: "tableCell",
531
+ content: [].concat(e.content),
532
+ props: {
533
+ backgroundColor: e.props?.backgroundColor ?? "default",
534
+ textColor: e.props?.textColor ?? "default",
535
+ textAlignment: e.props?.textAlignment ?? "left",
536
+ colspan: e.props?.colspan ?? 1,
537
+ rowspan: e.props?.rowspan ?? 1
538
+ }
539
+ } : {
540
+ type: "tableCell",
541
+ content: [].concat(e),
542
+ props: {
543
+ backgroundColor: "default",
544
+ textColor: "default",
545
+ textAlignment: "left",
546
+ colspan: 1,
547
+ rowspan: 1
548
+ }
549
+ };
550
+ }
551
+ function O(e) {
552
+ return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
553
+ }
554
+ function k(e) {
555
+ return O(e) && e.props !== void 0 && e.content !== void 0;
556
+ }
557
+ function A(e) {
558
+ return k(e) ? e.props.colspan ?? 1 : 1;
559
+ }
560
+ function j(e) {
561
+ return k(e) ? e.props.rowspan ?? 1 : 1;
562
+ }
563
+ // src/util/typescript.ts
564
+ var M = class extends Error {
565
+ constructor(e) {
566
+ super(`Unreachable case: ${e}`);
567
+ }
568
+ };
569
+ function Ie(e, t = !0) {
570
+ let { "data-test": n, ...r } = e;
571
+ if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
572
+ }
573
+ // src/util/browser.ts
574
+ var Le = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
575
+ function N(e, t = "Ctrl") {
576
+ return Le() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
577
+ }
578
+ function P(...e) {
579
+ return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
580
+ }
581
+ var Re = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), ze = () => typeof navigator < "u" && /android/i.test(navigator.userAgent), F, Be = () => typeof navigator > "u" || typeof window > "u" ? !1 : (F === void 0 && (F = navigator.maxTouchPoints > 0 && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches), F);
582
+ // src/blocks/defaultBlockHelpers.ts
583
+ function Ve(e, t, n, r) {
584
+ let i = document.createElement("div");
585
+ i.className = P("bn-block-content", n.class), i.setAttribute("data-content-type", e);
586
+ for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
587
+ let a = document.createElement(t);
588
+ a.className = P("bn-inline-content", r.class);
589
+ for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
590
+ return i.appendChild(a), {
591
+ dom: i,
592
+ contentDOM: a
593
+ };
594
+ }
595
+ var He = (e, t) => {
596
+ let n = q(e, t.pmSchema);
597
+ n.type.name === "blockContainer" && (n = n.firstChild);
598
+ let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
599
+ if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
600
+ let i = r(n);
601
+ if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
602
+ return i;
603
+ };
604
+ function Ue(e, t = "<br>") {
605
+ let n = e.querySelectorAll("p");
606
+ if (n.length > 1) {
607
+ let e = n[0];
608
+ for (let r = 1; r < n.length; r++) {
609
+ let i = n[r];
610
+ e.innerHTML += t + i.innerHTML, i.remove();
611
+ }
612
+ }
613
+ }
614
+ // src/schema/nodeViewMutations.ts
615
+ function We(e) {
616
+ return e.type !== "attributes" || !e.attributeName ? !1 : e.attributeName.startsWith("data-darkreader") ? !0 : e.attributeName === "style" ? (e.target.getAttribute("style") ?? "").includes("--darkreader") || (e.oldValue ?? "").includes("--darkreader") : !1;
617
+ }
618
+ function Ge(e) {
619
+ let t = e.ignoreMutation?.bind(e), n = e.contentDOM;
620
+ e.ignoreMutation = (e) => We(e) ? !0 : t ? t(e) : !n && e.type !== "selection";
621
+ }
622
+ // src/util/string.ts
623
+ function I(e) {
624
+ return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
625
+ }
626
+ function Ke(e) {
627
+ let t = e.split("/");
628
+ return !t.length || t.at(-1) === "" ? e : t.at(-1) ?? e;
629
+ }
630
+ function qe(e) {
631
+ let t = [
632
+ "mp4",
633
+ "webm",
634
+ "ogg",
635
+ "mov",
636
+ "mkv",
637
+ "flv",
638
+ "avi",
639
+ "wmv",
640
+ "m4v"
641
+ ];
642
+ try {
643
+ let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
644
+ return t.includes(n);
645
+ } catch {
646
+ return !1;
647
+ }
648
+ }
649
+ // src/schema/dataAttributes.ts
650
+ function Je(e, t) {
651
+ return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((e) => e in t);
652
+ }
653
+ function L(e, t) {
654
+ let n = {};
655
+ for (let r of Je(e, t)) {
656
+ let i = e[r];
657
+ i !== void 0 && i !== t[r].default && (n[I(r)] = String(i));
658
+ }
659
+ return n;
660
+ }
661
+ function Ye(e, t) {
662
+ for (let [n, r] of Object.entries(t)) e.setAttribute(n, r);
663
+ }
664
+ function Xe(e, t, n) {
665
+ let r = L(t, n);
666
+ for (let i of Je(t, n)) {
667
+ let t = I(i);
668
+ t in r ? e.setAttribute(t, r[t]) : e.removeAttribute(t);
669
+ }
670
+ }
671
+ // src/api/pmUtil.ts
672
+ function Ze(e) {
673
+ return "doc" in e ? e.doc.type.schema : e.type.schema;
674
+ }
675
+ function Qe(e) {
676
+ return e.cached.blockNoteEditor;
677
+ }
678
+ function R(e) {
679
+ return Qe(e).schema;
680
+ }
681
+ function $e(e) {
682
+ return R(e).blockSchema;
683
+ }
684
+ function et(e) {
685
+ return R(e).inlineContentSchema;
686
+ }
687
+ function z(e) {
688
+ return R(e).styleSchema;
689
+ }
690
+ function tt(e) {
691
+ return Qe(e).blockCache;
692
+ }
693
+ function nt(e, t) {
694
+ if ($e(e)[t.name]?.content === "plain") return !0;
695
+ let n = et(e)[t.name];
696
+ return typeof n == "object" && n.content === "plain";
697
+ }
698
+ // src/api/nodeConversions/nodeToBlock.ts
699
+ function rt(e) {
700
+ let t = "";
701
+ return e.forEach((e) => {
702
+ y(e) || (t += e.textContent);
703
+ }), t;
704
+ }
705
+ function it(e, t, n) {
706
+ let r = {
707
+ type: "tableContent",
708
+ columnWidths: [],
709
+ headerRows: void 0,
710
+ headerCols: void 0,
711
+ rows: []
712
+ }, i = [];
713
+ e.content.forEach((e, a, o) => {
714
+ let s = { cells: [] };
715
+ o === 0 && e.content.forEach((e) => {
716
+ let t = e.attrs.colwidth;
717
+ t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
718
+ }), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
719
+ type: "tableCell",
720
+ content: e.content.content.map((e) => B(e, t, n)).reduce((e, t) => {
721
+ let n = e.at(-1);
722
+ if (!n) return t;
723
+ let r = t[0];
724
+ return r && E(n) && E(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
725
+ }, []),
726
+ props: {
727
+ colspan: e.attrs.colspan,
728
+ rowspan: e.attrs.rowspan,
729
+ backgroundColor: e.attrs.backgroundColor,
730
+ textColor: e.attrs.textColor,
731
+ textAlignment: e.attrs.textAlignment
732
+ }
733
+ })), r.rows.push(s);
734
+ });
735
+ for (let e = 0; e < i.length; e++) i[e]?.every((e) => e) && (r.headerRows = (r.headerRows ?? 0) + 1);
736
+ for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
737
+ return r;
738
+ }
739
+ function B(e, t, n) {
740
+ let r = [], i;
741
+ return e.content.forEach((e) => {
742
+ if (e.type.name === "hardBreak") {
743
+ if (i) {
744
+ if (E(i)) i.text += "\n";
745
+ else if (T(i)) {
746
+ let e = i.content.at(-1);
747
+ if (!e) throw Error("Link content is unexpectedly empty");
748
+ e.text += "\n";
749
+ } else throw Error("unexpected");
750
+ } else i = {
751
+ type: "text",
752
+ text: "\n",
753
+ styles: {}
754
+ };
755
+ return;
756
+ }
757
+ if (e.type.name !== "link" && e.type.name !== "text") {
758
+ if (!t[e.type.name]) {
759
+ console.warn("unrecognized inline content type", e.type.name);
760
+ return;
761
+ }
762
+ i &&= (r.push(i), void 0), r.push(at(e, t, n));
763
+ return;
764
+ }
765
+ let a = {}, o;
766
+ for (let t of e.marks) if (t.type.name === "link") o = t;
767
+ else {
768
+ let e = n[t.type.name];
769
+ if (!e) {
770
+ if (t.type.spec.blocknoteIgnore) continue;
771
+ throw Error(`style ${t.type.name} not found in styleSchema`);
772
+ }
773
+ if (e.propSchema === "boolean") a[e.type] = !0;
774
+ else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
775
+ else throw new M(e.propSchema);
776
+ }
777
+ if (i) {
778
+ if (E(i)) o ? (r.push(i), i = {
779
+ type: "link",
780
+ href: o.attrs.href,
781
+ content: [{
782
+ type: "text",
783
+ text: e.textContent,
784
+ styles: a
785
+ }]
786
+ }) : JSON.stringify(i.styles) === JSON.stringify(a) ? i.text += e.textContent : (r.push(i), i = {
787
+ type: "text",
788
+ text: e.textContent,
789
+ styles: a
790
+ });
791
+ else if (T(i)) {
792
+ if (o) {
793
+ if (i.href === o.attrs.href) {
794
+ let t = i.content.at(-1);
795
+ if (!t) throw Error("Link content is unexpectedly empty");
796
+ JSON.stringify(t.styles) === JSON.stringify(a) ? t.text += e.textContent : i.content.push({
797
+ type: "text",
798
+ text: e.textContent,
799
+ styles: a
800
+ });
801
+ } else r.push(i), i = {
802
+ type: "link",
803
+ href: o.attrs.href,
804
+ content: [{
805
+ type: "text",
806
+ text: e.textContent,
807
+ styles: a
808
+ }]
809
+ };
810
+ } else r.push(i), i = {
811
+ type: "text",
812
+ text: e.textContent,
813
+ styles: a
814
+ };
815
+ }
816
+ } else i = o ? {
817
+ type: "link",
818
+ href: o.attrs.href,
819
+ content: [{
820
+ type: "text",
821
+ text: e.textContent,
822
+ styles: a
823
+ }]
824
+ } : {
825
+ type: "text",
826
+ text: e.textContent,
827
+ styles: a
828
+ };
829
+ }), i && r.push(i), r;
830
+ }
831
+ function at(e, t, n) {
832
+ if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
833
+ let r = {}, i = t[e.type.name];
834
+ for (let [t, n] of Object.entries(e.attrs)) {
835
+ if (!i) throw Error("ic node is of an unrecognized type: " + e.type.name);
836
+ t in i.propSchema && (r[t] = n);
837
+ }
838
+ let a;
839
+ return a = i.content === "styled" ? B(e, t, n) : i.content === "plain" ? rt(e) : void 0, {
840
+ type: e.type.name,
841
+ props: r,
842
+ content: a
843
+ };
844
+ }
845
+ function V(e, t) {
846
+ let n = e.type.schema, r = $e(n), i = et(n), a = z(n), o = tt(n);
847
+ if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a block, but is instead: " + e.type.name);
848
+ let s = o?.get(e);
849
+ if (s) return s;
850
+ let c = b(e, 0), l;
851
+ try {
852
+ l = ge(c.block.node, t);
853
+ } catch {
854
+ l = w.options.generateID();
855
+ }
856
+ let u = r[c.blockNoteType];
857
+ if (!u) throw Error("Block is of an unrecognized type: " + c.blockNoteType);
858
+ let d = {};
859
+ for (let [t, n] of Object.entries({
860
+ ...e.attrs,
861
+ ...c.hasContent ? c.content.node.attrs : {}
862
+ })) {
863
+ let e = u.propSchema;
864
+ t in e && (e[t].default !== void 0 || n !== void 0) && (d[t] = n);
865
+ }
866
+ let f = [];
867
+ c.children?.node.forEach((e) => {
868
+ f.push(V(e, t));
869
+ });
870
+ let p;
871
+ switch (c.contentKind) {
872
+ case "inline":
873
+ p = B(c.content.node, i, a);
874
+ break;
875
+ case "table":
876
+ p = it(c.content.node, i, a);
877
+ break;
878
+ case "plain": {
879
+ let e = rt(c.content.node);
880
+ p = e.length > 0 ? [{
881
+ type: "text",
882
+ text: e,
883
+ styles: {}
884
+ }] : [];
885
+ break;
886
+ }
887
+ case "none":
888
+ case void 0:
889
+ p = void 0;
890
+ break;
891
+ default: throw new M(c);
892
+ }
893
+ let m = {
894
+ id: l,
895
+ type: u.type,
896
+ props: d,
897
+ content: p,
898
+ children: f
899
+ };
900
+ return o?.set(e, m), m;
901
+ }
902
+ function ot(e) {
903
+ let t = [];
904
+ return e.firstChild && e.firstChild.descendants((n) => (t.push(V(n, e)), !1)), t;
905
+ }
906
+ function st(e) {
907
+ function t(n, r, i) {
908
+ if (n.type.name !== "blockGroup" && !v(n.type)) throw Error("unexpected");
909
+ let a = [], o, s;
910
+ return n.forEach((c, l, u) => {
911
+ let d = u === 0, f = u === n.childCount - 1, p = v(c.type);
912
+ if (!p) {
913
+ if (c.type.name !== "blockContainer") throw Error("unexpected");
914
+ if (c.childCount === 0) return;
915
+ if (c.childCount > 2) throw Error("unexpected, blockContainer.childCount: " + c.childCount);
916
+ }
917
+ let m = !p && c.firstChild.type.name === "blockGroup";
918
+ if (m && !d) throw Error("unexpected");
919
+ if (m || p && (d && r > 0 || f && i > 0)) {
920
+ let e = t(p ? c : c.firstChild, d ? Math.max(0, r - 1) : 0, f ? Math.max(0, i - 1) : 0);
921
+ d && (o = e.blockCutAtStart), f && (s = e.blockCutAtEnd), a.push(...e.blocks);
922
+ return;
923
+ }
924
+ if (p) {
925
+ a.push(V(c, e.content.firstChild));
926
+ return;
927
+ }
928
+ let h = V(c, e.content.firstChild), g = c.childCount > 1 ? c.child(1) : void 0, _ = [];
929
+ if (g) {
930
+ let e = t(g, 0, f ? Math.max(0, i - 1) : 0);
931
+ _ = e.blocks, f && (s = e.blockCutAtEnd);
932
+ }
933
+ f && !g && i > 1 && (s = h.id), d && r > 1 && (o = h.id), a.push({
934
+ ...h,
935
+ children: _
936
+ });
937
+ }), {
938
+ blocks: a,
939
+ blockCutAtStart: o,
940
+ blockCutAtEnd: s
941
+ };
942
+ }
943
+ if (e.content.childCount === 0) return {
944
+ blocks: [],
945
+ blockCutAtStart: void 0,
946
+ blockCutAtEnd: void 0
947
+ };
948
+ if (e.content.childCount !== 1) throw Error("slice must be a single block, did you forget includeParents=true?");
949
+ return t(e.content.firstChild, Math.max(e.openStart - 1, 0), Math.max(e.openEnd - 1, 0));
950
+ }
951
+ // src/schema/blocks/layoutBlockAttributes.ts
952
+ function ct(e, t, n, r, i) {
953
+ e && (Xe(e, n, r), e.setAttribute("data-node-type", t), i && e.setAttribute("data-id", i));
954
+ }
955
+ // src/schema/blocks/frame.ts
956
+ var lt = "data-frame-slot";
957
+ function ut(e) {
958
+ e.setAttribute(lt, "");
959
+ }
960
+ function dt(e) {
961
+ if (e.hasAttribute("data-frame-slot")) return e;
962
+ for (let t of e.querySelectorAll(`[${lt}]`)) if (t.closest("[data-node-type]") === e) return t;
963
+ }
964
+ function ft(e, t, n) {
965
+ ct(t.dom, e.type, n.props, e.propSchema, n.id), ut(t.slot);
966
+ }
967
+ function pt(e, t) {
968
+ let n = e.blockImplementations[t.type], r = n.implementation.renderFrame?.call({
969
+ renderType: "dom",
970
+ props: void 0,
971
+ propSchema: n.config.propSchema
972
+ }, t, e);
973
+ if (n.config.layoutOnly === !0) {
974
+ if (!r) throw Error(`Layout block "${t.type}" must draw its frame: \`renderFrame\` returned undefined.`);
975
+ ft(n.config, r, t);
976
+ }
977
+ return r;
978
+ }
979
+ function mt(e) {
980
+ let { props: t, editor: n, blockNode: r } = e;
981
+ return n.blockImplementations[r(t.node).type.name].implementation.frameView?.(t) ?? ht(e);
982
+ }
983
+ function ht(e) {
984
+ let { props: t, editor: n, blockNode: r, unframed: i } = e, a = n.blockImplementations[r(t.node).type.name].config;
985
+ function o(e, t) {
986
+ a.layoutOnly === !0 && ft(a, e, t);
987
+ }
988
+ function s(e) {
989
+ let i = n.blockImplementations[r(e).type.name], a = i.implementation.renderFrame;
990
+ if (!a) return;
991
+ let s = V(e, t.view.state.doc), c = a.call({
992
+ renderType: "nodeView",
993
+ props: t,
994
+ propSchema: i.config.propSchema
995
+ }, s, n);
996
+ if (c) return o(c, s), c;
997
+ }
998
+ let c = s(t.node), l, u;
999
+ if (c) l = c.dom, u = c.slot;
1000
+ else if (i) l = i, u = i;
1001
+ else throw Error(`Block "${r(t.node).type.name}" must draw its frame: \`renderFrame\` returned undefined.`);
1002
+ let d = t.node;
1003
+ return {
1004
+ dom: l,
1005
+ slot: u,
1006
+ get node() {
1007
+ return d;
1008
+ },
1009
+ update(e) {
1010
+ let n = r(d), i = r(e);
1011
+ if (!c) {
1012
+ let t = i.sameMarkup(n) ? void 0 : s(e);
1013
+ return t ? (t.destroy?.(), !1) : (d = e, !0);
1014
+ }
1015
+ if (i.type !== n.type) return !1;
1016
+ if (c.update) {
1017
+ let n = V(e, t.view.state.doc);
1018
+ if (c.update(n) === !1) return !1;
1019
+ o(c, n);
1020
+ } else if (!i.sameMarkup(n)) return !1;
1021
+ return d = e, !0;
1022
+ },
1023
+ destroy: () => c?.destroy?.()
1024
+ };
1025
+ }
1026
+ var gt = /* @__PURE__ */ new Set([
1027
+ "dragenter",
1028
+ "dragover",
1029
+ "dragleave",
1030
+ "drop",
1031
+ "copy",
1032
+ "cut",
1033
+ "paste"
1034
+ ]);
1035
+ function _t(e, t) {
1036
+ let n = t.target;
1037
+ return n instanceof globalThis.Node && e.dom.contains(n) && !e.slot.contains(n) && !gt.has(t.type);
1038
+ }
1039
+ function vt(e, t) {
1040
+ return t.type === "selection" ? !1 : We(t) || t.target === e.slot && t.type === "attributes" ? !0 : e.dom.contains(t.target) && !e.slot.contains(t.target);
1041
+ }
1042
+ function yt(e) {
1043
+ return {
1044
+ stopEvent: (t) => _t(e, t),
1045
+ ignoreMutation: (t) => vt(e, t),
1046
+ selectNode: e.selectNode?.bind(e),
1047
+ deselectNode: e.deselectNode?.bind(e),
1048
+ destroy: e.destroy?.bind(e)
1049
+ };
1050
+ }
1051
+ // src/schema/blocks/keyboard.ts
1052
+ function bt(e, t) {
1053
+ let { isLayoutBlock: n, hardBreakShortcut: r } = t, i = {
1054
+ enter: r === "enter" ? "line-break" : "split",
1055
+ shiftEnter: r === "none" ? "same-as-enter" : "line-break",
1056
+ splitKeepsType: !1,
1057
+ splitKeepsChildren: !1,
1058
+ resetsTo: { type: "paragraph" },
1059
+ emptyEnterResets: !1,
1060
+ emptyChildEnter: n ? "exit-at-end" : "outdent",
1061
+ childrenCanOutdent: !n
1062
+ };
1063
+ if (typeof e == "function") return (t) => xt(i, e(t));
1064
+ let a = xt(i, e);
1065
+ return () => a;
1066
+ }
1067
+ function xt(e, t) {
1068
+ let n = { ...e };
1069
+ for (let [e, r] of Object.entries(t ?? {})) r !== void 0 && Object.assign(n, { [e]: r });
1070
+ return t?.splitKeepsChildren === void 0 && (n.splitKeepsChildren = n.enter === "into-children"), n;
1071
+ }
1072
+ // src/schema/blocks/meta.ts
1073
+ function St(e, t) {
1074
+ let n = t.layoutOnly === !0;
1075
+ return {
1076
+ ...e,
1077
+ selectable: e?.selectable ?? !0,
1078
+ code: n ? !1 : e?.code ?? !1,
1079
+ defining: n ? !0 : e?.defining ?? !0,
1080
+ isolating: n ? !1 : e?.isolating ?? !0,
1081
+ draggable: e?.draggable ?? t.placeable !== "namedOnly"
1082
+ };
1083
+ }
1084
+ // src/schema/blocks/internal.ts
1085
+ function Ct(e) {
1086
+ let t = {};
1087
+ return Object.entries(e).forEach(([e, n]) => {
1088
+ t[e] = {
1089
+ default: n.default,
1090
+ keepOnSplit: !0,
1091
+ parseHTML: (t) => {
1092
+ let r = t.getAttribute(I(e));
1093
+ if (r === null) return null;
1094
+ if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" || r !== "false" && null;
1095
+ if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
1096
+ let e = parseFloat(r);
1097
+ return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
1098
+ }
1099
+ return r;
1100
+ },
1101
+ renderHTML: (t) => L({ [e]: t[e] }, { [e]: n })
1102
+ };
1103
+ }), t;
1104
+ }
1105
+ function wt(e, t) {
1106
+ let n = e();
1107
+ if (n === void 0) throw Error("Cannot find node position");
1108
+ let r = t.resolve(n).node();
1109
+ if (!r) throw Error("Cannot find block container");
1110
+ return V(r, t);
1111
+ }
1112
+ function Tt(e, t, n) {
1113
+ try {
1114
+ return wt(e, n);
1115
+ } catch (e) {
1116
+ let r = n.type.schema.nodes.blockContainer?.createAndFill(null, t);
1117
+ if (r) return V(r, n);
1118
+ throw e;
1119
+ }
1120
+ }
1121
+ var Et = 11;
1122
+ function Dt(e) {
1123
+ return e.nodeType === Et;
1124
+ }
1125
+ function Ot(e, t) {
1126
+ if (t && !Dt(e)) for (let [n, r] of Object.entries(t)) n === "class" ? e.className = P(e.className, r) : e.setAttribute(n, r);
1127
+ }
1128
+ function kt(e, t, n, r, i = !1, a) {
1129
+ let o = document.createElement("div");
1130
+ if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
1131
+ return o.className = P("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t), Ye(o, L(n, r)), i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = P("bn-inline-content", e.contentDOM.className)), {
1132
+ ...e,
1133
+ dom: o
1134
+ };
1135
+ }
1136
+ function At(e, t, n) {
1137
+ return {
1138
+ config: {
1139
+ type: e.type,
1140
+ content: e.content,
1141
+ propSchema: t
1142
+ },
1143
+ implementation: {
1144
+ node: e.node,
1145
+ meta: St(void 0, {}),
1146
+ keyboard: bt(void 0, {
1147
+ isLayoutBlock: !1,
1148
+ hardBreakShortcut: void 0
1149
+ }),
1150
+ render: He,
1151
+ toExternalHTML: He
1152
+ },
1153
+ extensions: n
1154
+ };
1155
+ }
1156
+ // src/api/blockManipulation/tables/tables.ts
1157
+ function H(e) {
1158
+ let { height: t, width: n } = G(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
1159
+ for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
1160
+ row: a,
1161
+ col: e
1162
+ };
1163
+ throw Error("Unable to create occupancy grid for table, no more available cells");
1164
+ };
1165
+ for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
1166
+ let a = D(e.content.rows[t].cells[n]), o = j(a), s = A(a), { row: c, col: l } = i(t, n);
1167
+ for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
1168
+ if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
1169
+ r[e][i] = {
1170
+ row: t,
1171
+ col: n,
1172
+ rowspan: o,
1173
+ colspan: s,
1174
+ cell: a
1175
+ };
1176
+ }
1177
+ }
1178
+ return r;
1179
+ }
1180
+ function U(e) {
1181
+ let t = /* @__PURE__ */ new Set();
1182
+ return e.map((e) => ({ cells: e.map((e) => !t.has(e.row + ":" + e.col) && (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
1183
+ }
1184
+ function W(e, t, n = H(t)) {
1185
+ for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
1186
+ let i = n[t][r];
1187
+ if (i && i.row === e.row && i.col === e.col) return {
1188
+ row: t,
1189
+ col: r,
1190
+ cell: i.cell
1191
+ };
1192
+ }
1193
+ throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
1194
+ }
1195
+ function jt(e) {
1196
+ let t = H(e), n = [];
1197
+ for (let e = 0; e < t.length; e++) {
1198
+ let r = t[e];
1199
+ for (let t = 0; t < r.length; t++) {
1200
+ let i = r[t];
1201
+ if (!i) continue;
1202
+ let a = n[i.row] ??= [];
1203
+ a[i.col] ??= {
1204
+ row: e,
1205
+ col: t
1206
+ };
1207
+ }
1208
+ }
1209
+ return ({ row: e, col: t }) => {
1210
+ let r = n[e]?.[t];
1211
+ if (r === void 0) throw Error(`Unable to resolve relative table cell indices for table, cell at ${e},${t} is not occupied`);
1212
+ return r;
1213
+ };
1214
+ }
1215
+ function G(e) {
1216
+ let t = e.content.rows.length, n = 0;
1217
+ return e.content.rows.forEach((e) => {
1218
+ let t = 0;
1219
+ e.cells.forEach((e) => {
1220
+ t += A(e);
1221
+ }), n = Math.max(n, t);
1222
+ }), {
1223
+ height: t,
1224
+ width: n
1225
+ };
1226
+ }
1227
+ function Mt(e, t, n = H(t)) {
1228
+ let r = n[e.row]?.[e.col];
1229
+ if (r) return {
1230
+ row: r.row,
1231
+ col: r.col,
1232
+ cell: r.cell
1233
+ };
1234
+ }
1235
+ function Nt(e, t, n = H(e)) {
1236
+ if (t < 0 || t >= n.length) return [];
1237
+ let r = 0;
1238
+ for (let e = 0; e < t; e++) {
1239
+ let e = n[r]?.[0];
1240
+ if (!e) return [];
1241
+ r += e.rowspan;
1242
+ }
1243
+ let i = Array(n[0].length).fill(!1).map((t, i) => Mt({
1244
+ row: r,
1245
+ col: i
1246
+ }, e, n)).filter((e) => e !== void 0), a = /* @__PURE__ */ new Set();
1247
+ return i.filter(({ row: e, col: t }) => {
1248
+ let n = `${e},${t}`;
1249
+ return !a.has(n) && (a.add(n), !0);
1250
+ });
1251
+ }
1252
+ function Pt(e, t, n = H(e)) {
1253
+ if (t < 0 || t >= n[0].length) return [];
1254
+ let r = 0;
1255
+ for (let e = 0; e < t; e++) {
1256
+ let e = n[0]?.[r];
1257
+ if (!e) return [];
1258
+ r += e.colspan;
1259
+ }
1260
+ let i = Array(n.length).fill(!1).map((t, i) => Mt({
1261
+ row: i,
1262
+ col: r
1263
+ }, e, n)).filter((e) => e !== void 0), a = /* @__PURE__ */ new Set();
1264
+ return i.filter(({ row: e, col: t }) => {
1265
+ let n = `${e},${t}`;
1266
+ return !a.has(n) && (a.add(n), !0);
1267
+ });
1268
+ }
1269
+ function Ft(e, t, n, r = H(e)) {
1270
+ let { col: i } = W({
1271
+ row: 0,
1272
+ col: t
1273
+ }, e, r), { col: a } = W({
1274
+ row: 0,
1275
+ col: n
1276
+ }, e, r);
1277
+ return r.forEach((e) => {
1278
+ let [t] = e.splice(i, 1);
1279
+ e.splice(a, 0, t);
1280
+ }), U(r);
1281
+ }
1282
+ function It(e, t, n, r = H(e)) {
1283
+ let { row: i } = W({
1284
+ row: t,
1285
+ col: 0
1286
+ }, e, r), { row: a } = W({
1287
+ row: n,
1288
+ col: 0
1289
+ }, e, r), [o] = r.splice(i, 1);
1290
+ return r.splice(a, 0, o), U(r);
1291
+ }
1292
+ function Lt(e) {
1293
+ return e ? O(e) ? Lt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : E(e) ? e.text.length === 0 : Fe(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
1294
+ }
1295
+ function Rt(e, t, n = H(e)) {
1296
+ if (t === "columns") {
1297
+ let e = 0;
1298
+ for (let t = n[0].length - 1; t >= 0 && n.every((e) => Lt(e[t].cell) && e[t].colspan === 1); t--) e++;
1299
+ for (let t = n.length - 1; t >= 0; t--) {
1300
+ let r = Math.max(n[t].length - e, 1);
1301
+ n[t] = n[t].slice(0, r);
1302
+ }
1303
+ return U(n);
1304
+ }
1305
+ let r = 0;
1306
+ for (let e = n.length - 1; e >= 0 && n[e].every((e) => Lt(e.cell) && e.rowspan === 1); e--) r++;
1307
+ let i = Math.min(r, n.length - 1);
1308
+ return n.splice(n.length - i, i), U(n);
1309
+ }
1310
+ function zt(e, t, n, r = H(e)) {
1311
+ let { width: i, height: a } = G(e);
1312
+ if (t === "columns") r.forEach((e, t) => {
1313
+ if (n >= 0) for (let r = 0; r < n; r++) e.push({
1314
+ row: t,
1315
+ col: Math.max(...e.map((e) => e.col)) + 1,
1316
+ rowspan: 1,
1317
+ colspan: 1,
1318
+ cell: D("")
1319
+ });
1320
+ else e.splice(i + n, -1 * n);
1321
+ });
1322
+ else if (n > 0) for (let e = 0; e < n; e++) {
1323
+ let t = Array(i).fill(null).map((t, n) => ({
1324
+ row: a + e,
1325
+ col: n,
1326
+ rowspan: 1,
1327
+ colspan: 1,
1328
+ cell: D("")
1329
+ }));
1330
+ r.push(t);
1331
+ }
1332
+ else n < 0 && r.splice(a + n, -1 * n);
1333
+ return U(r);
1334
+ }
1335
+ function Bt(e, t, n, r = Nt(e, n)) {
1336
+ if (!r.some((e) => j(e.cell) > 1)) return !0;
1337
+ let i = n, a = n;
1338
+ return r.forEach((e) => {
1339
+ let t = j(e.cell);
1340
+ i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
1341
+ }), t < n ? n === i : n === a;
1342
+ }
1343
+ function Vt(e, t, n, r = Pt(e, n)) {
1344
+ if (!r.some((e) => A(e.cell) > 1)) return !0;
1345
+ let i = n, a = n;
1346
+ return r.forEach((e) => {
1347
+ let t = A(e.cell);
1348
+ i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
1349
+ }), t < n ? n === i : n === a;
1350
+ }
1351
+ function Ht(e, t, n) {
1352
+ let r = jt(n);
1353
+ return r(e).col === r(t).col;
1354
+ }
1355
+ // src/api/nodeConversions/blockToNode.ts
1356
+ function Ut(e, t, n, r) {
1357
+ let i = [];
1358
+ for (let [r, a] of Object.entries(e.styles || {})) {
1359
+ let e = n[r];
1360
+ if (!e) throw Error(`style ${r} not found in styleSchema`);
1361
+ if (e.propSchema === "boolean") a && i.push(t.mark(r));
1362
+ else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
1363
+ else throw new M(e.propSchema);
1364
+ }
1365
+ let a = r && t.nodes[r] && nt(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
1366
+ return r && nt(t, t.nodes[r]) ? e.text.length > 0 ? [t.text(e.text, a)] : [] : e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a));
1367
+ }
1368
+ function Wt(e, t, n) {
1369
+ let r = t.marks.link.create({ href: e.href });
1370
+ return Gt(e.content, t, n).map((e) => {
1371
+ if (e.type.name === "text") return e.mark([...e.marks, r]);
1372
+ if (e.type.name === "hardBreak") return e;
1373
+ throw Error("unexpected node type");
1374
+ });
1375
+ }
1376
+ function Gt(e, t, n, r) {
1377
+ let i = [];
1378
+ if (typeof e == "string") return i.push(...Ut({
1379
+ type: "text",
1380
+ text: e,
1381
+ styles: {}
1382
+ }, t, n, r)), i;
1383
+ for (let a of e) i.push(...Ut(a, t, n, r));
1384
+ return i;
1385
+ }
1386
+ function K(e, t, n, r = z(t)) {
1387
+ let i = [];
1388
+ for (let a of e) typeof a == "string" ? i.push(...Gt(a, t, r, n)) : Fe(a) ? i.push(...Wt(a, t, r)) : E(a) ? i.push(...Gt([a], t, r, n)) : i.push(qt(a, t, r));
1389
+ return i;
1390
+ }
1391
+ function Kt(e, t, n = z(t)) {
1392
+ let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [], s = jt({
1393
+ type: "table",
1394
+ content: e
1395
+ });
1396
+ for (let c = 0; c < e.rows.length; c++) {
1397
+ let l = e.rows[c], u = [], d = i[c];
1398
+ for (let e = 0; e < l.cells.length; e++) {
1399
+ let r = l.cells[e], i = a[e], f = null, { col: p } = s({
1400
+ row: c,
1401
+ col: e
1402
+ }), m = o[p] ? [o[p]] : null;
1403
+ if (r) {
1404
+ if (typeof r == "string") f = t.text(r);
1405
+ else if (O(r)) {
1406
+ r.content && (f = K(r.content, t, "tableParagraph", n));
1407
+ let e = A(r);
1408
+ e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p + t] ?? void 0));
1409
+ } else f = K(r, t, "tableParagraph", n);
1410
+ }
1411
+ let h = t.nodes[i || d ? "tableHeader" : "tableCell"].createChecked({
1412
+ ...O(r) ? r.props : {},
1413
+ colwidth: m
1414
+ }, t.nodes.tableParagraph.createChecked(void 0, f));
1415
+ u.push(h);
1416
+ }
1417
+ let f = t.nodes.tableRow.createChecked({}, u);
1418
+ r.push(f);
1419
+ }
1420
+ return r;
1421
+ }
1422
+ function qt(e, t, n) {
1423
+ let r, i = e.type;
1424
+ if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
1425
+ if (!e.content) r = t.nodes[i].createChecked(e.props);
1426
+ else if (typeof e.content == "string") {
1427
+ let a = K([e.content], t, i, n);
1428
+ r = t.nodes[i].createChecked(e.props, a);
1429
+ } else if (Array.isArray(e.content)) {
1430
+ let a = K(e.content, t, i, n);
1431
+ r = t.nodes[i].createChecked(e.props, a);
1432
+ } else if (e.content.type === "tableContent") {
1433
+ let a = Kt(e.content, t, n);
1434
+ r = t.nodes[i].createChecked(e.props, a);
1435
+ } else throw new M(e.content.type);
1436
+ return r;
1437
+ }
1438
+ function Jt(e) {
1439
+ if (e.isText) return e;
1440
+ let t = [];
1441
+ e.forEach((e) => t.push(Jt(e)));
1442
+ let n = e.type.isInGroup("bnBlock") && e.attrs.id === null;
1443
+ return e.type.create(n ? {
1444
+ ...e.attrs,
1445
+ id: w.options.generateID()
1446
+ } : e.attrs, l.from(t), e.marks);
1447
+ }
1448
+ function q(e, t, n = z(t)) {
1449
+ let r = e.id;
1450
+ r === void 0 && (r = w.options.generateID());
1451
+ let i = [];
1452
+ if (e.children) for (let r of e.children) i.push(q(r, t, n));
1453
+ if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
1454
+ let a = qt(e, t, n), o = i.length > 0 ? re(t, i) : void 0;
1455
+ return t.nodes.blockContainer.createChecked({
1456
+ id: r,
1457
+ ...e.props
1458
+ }, o ? [a, o] : a);
1459
+ }
1460
+ if (v(t.nodes[e.type])) {
1461
+ let n = t.nodes[e.type], a = {
1462
+ id: r,
1463
+ ...e.props
1464
+ }, o = n.createAndFill(a, i);
1465
+ if (!o) throw Error(`Cannot create block "${e.type}": its children don't fit its \`children\` config (it accepts \`${n.spec.content}\`).`);
1466
+ return Jt(o);
1467
+ }
1468
+ throw Error(`block type ${e.type} doesn't match blockContent or bnBlock group`);
1469
+ }
1470
+ // src/extensions/FilePanel/FilePanel.ts
1471
+ var J = t(({ editor: t }) => {
1472
+ let n = e(void 0);
1473
+ function r() {
1474
+ n.setState(void 0);
1475
+ }
1476
+ return {
1477
+ key: "filePanel",
1478
+ store: n,
1479
+ mount({ signal: e }) {
1480
+ let n = t.onChange(r, !1), i = t.onSelectionChange(r, !1);
1481
+ e.addEventListener("abort", () => {
1482
+ n(), i();
1483
+ });
1484
+ },
1485
+ closeMenu: r,
1486
+ showMenu(e) {
1487
+ n.setState(e);
1488
+ }
1489
+ };
1490
+ });
1491
+ // src/blocks/defaultBlockTypeGuards.ts
1492
+ function Y(e, t, n) {
1493
+ if (!(t in e.schema.blockSpecs)) return !1;
1494
+ if (!n) return !0;
1495
+ for (let [r, i] of Object.entries(n)) {
1496
+ if (!(r in e.schema.blockSpecs[t].config.propSchema)) return !1;
1497
+ if (typeof i == "string") {
1498
+ if (e.schema.blockSpecs[t].config.propSchema[r].default !== void 0 && typeof e.schema.blockSpecs[t].config.propSchema[r].default !== i || e.schema.blockSpecs[t].config.propSchema[r].type !== void 0 && e.schema.blockSpecs[t].config.propSchema[r].type !== i) return !1;
1499
+ } else {
1500
+ if (e.schema.blockSpecs[t].config.propSchema[r].default !== i.default || e.schema.blockSpecs[t].config.propSchema[r].default === void 0 && i.default === void 0 && e.schema.blockSpecs[t].config.propSchema[r].type !== i.type || typeof e.schema.blockSpecs[t].config.propSchema[r].values != typeof i.values) return !1;
1501
+ if (typeof e.schema.blockSpecs[t].config.propSchema[r].values == "object" && typeof i.values == "object") {
1502
+ for (let n of i.values) if (!e.schema.blockSpecs[t].config.propSchema[r].values.includes(n)) return !1;
1503
+ }
1504
+ }
1505
+ }
1506
+ return !0;
1507
+ }
1508
+ function Yt(e, t, n, r) {
1509
+ return Y(t, n, r) && e.type === n;
1510
+ }
1511
+ function Xt(e) {
1512
+ return e instanceof g;
1513
+ }
1514
+ function Zt(e) {
1515
+ let t = e.type.spec.tableRole;
1516
+ return t === "cell" || t === "header_cell";
1517
+ }
1518
+ // src/blocks/defaultBlockTypeItems.ts
1519
+ var Qt = {
1520
+ 1: "heading",
1521
+ 2: "heading_2",
1522
+ 3: "heading_3",
1523
+ 4: "heading_4",
1524
+ 5: "heading_5",
1525
+ 6: "heading_6"
1526
+ }, $t = {
1527
+ 1: "toggle_heading",
1528
+ 2: "toggle_heading_2",
1529
+ 3: "toggle_heading_3"
1530
+ };
1531
+ function en(e) {
1532
+ let t = [];
1533
+ if (Y(e, "paragraph") && t.push({
1534
+ key: "paragraph",
1535
+ type: "paragraph"
1536
+ }), Y(e, "heading", { level: "number" })) {
1537
+ let n = e.schema.blockSchema.heading.propSchema.level.values, r = Y(e, "heading", {
1538
+ level: "number",
1539
+ isToggleable: "boolean"
1540
+ });
1541
+ for (let e of [
1542
+ 1,
1543
+ 2,
1544
+ 3,
1545
+ 4,
1546
+ 5,
1547
+ 6
1548
+ ]) n?.includes(e) && t.push({
1549
+ key: Qt[e],
1550
+ type: "heading",
1551
+ props: r ? {
1552
+ level: e,
1553
+ isToggleable: !1
1554
+ } : { level: e }
1555
+ });
1556
+ if (r) for (let e of [
1557
+ 1,
1558
+ 2,
1559
+ 3
1560
+ ]) n?.includes(e) && t.push({
1561
+ key: $t[e],
1562
+ type: "heading",
1563
+ props: {
1564
+ level: e,
1565
+ isToggleable: !0
1566
+ }
1567
+ });
1568
+ }
1569
+ for (let [n, r] of [
1570
+ ["quote", "quote"],
1571
+ ["toggle_list", "toggleListItem"],
1572
+ ["bullet_list", "bulletListItem"],
1573
+ ["numbered_list", "numberedListItem"],
1574
+ ["check_list", "checkListItem"]
1575
+ ]) Y(e, r) && t.push({
1576
+ key: n,
1577
+ type: r
1578
+ });
1579
+ return t;
1580
+ }
1581
+ // src/extensions/SideMenu/MultipleNodeSelection.ts
1582
+ var X = class e extends s {
1583
+ nodes;
1584
+ constructor(e, t) {
1585
+ super(e, t);
1586
+ let n = e.node();
1587
+ this.nodes = [], e.doc.nodesBetween(e.pos, t.pos, (e, t, r) => {
1588
+ if (r !== null && r.eq(n)) return this.nodes.push(e), !1;
1589
+ });
1590
+ }
1591
+ static create(t, n, r = n) {
1592
+ return new e(t.resolve(n), t.resolve(r));
1593
+ }
1594
+ static fromJSON(t, n) {
1595
+ if (typeof n.anchor != "number" || typeof n.head != "number") throw RangeError("Invalid input for MultipleNodeSelection.fromJSON");
1596
+ return e.create(t, n.anchor, n.head);
1597
+ }
1598
+ content() {
1599
+ return new r(n.from(this.nodes), 0, 0);
1600
+ }
1601
+ eq(t) {
1602
+ if (!(t instanceof e) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to) return !1;
1603
+ for (let e = 0; e < this.nodes.length; e++) if (!this.nodes[e].eq(t.nodes[e])) return !1;
1604
+ return !0;
1605
+ }
1606
+ map(e, t) {
1607
+ return this.getBookmark().map(t).resolve(e);
1608
+ }
1609
+ getBookmark() {
1610
+ return new tn(this.from, this.to);
1611
+ }
1612
+ toJSON() {
1613
+ return {
1614
+ type: "multiple-node",
1615
+ anchor: this.anchor,
1616
+ head: this.head
1617
+ };
1618
+ }
1619
+ }, tn = class e {
1620
+ from;
1621
+ to;
1622
+ constructor(e, t) {
1623
+ this.from = e, this.to = t;
1624
+ }
1625
+ map(t) {
1626
+ let n = t.mapResult(this.from, 1);
1627
+ if (this.from === this.to) return new e(n.pos, n.pos);
1628
+ let r = t.mapResult(this.to, -1);
1629
+ return r.deleted ? new e(n.pos, n.pos) : n.deleted ? new e(r.pos, r.pos) : new e(n.pos, r.pos);
1630
+ }
1631
+ resolve(e) {
1632
+ let t = e.resolve(this.from), n = e.resolve(this.to);
1633
+ return this.from < this.to && t.sameParent(n) && t.textOffset === 0 && n.textOffset === 0 ? new X(t, n) : s.near(t);
1634
+ }
1635
+ };
1636
+ s.jsonID("multiple-node", X);
1637
+ // src/extensions/FormattingToolbar/FormattingToolbar.ts
1638
+ var Z = t(({ editor: t }) => {
1639
+ let n = e(!1), r = () => t.transact((e) => {
1640
+ if (e.selection.empty || e.selection instanceof X || e.selection instanceof i && e.selection.node.type.isInGroup("bnBlock") || e.selection instanceof c && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
1641
+ let t = !1;
1642
+ return e.selection.content().content.descendants((e) => (e.type.spec.content === "text*" && (t = !0), !t)), !t;
1643
+ });
1644
+ return {
1645
+ key: "formattingToolbar",
1646
+ store: n,
1647
+ mount({ dom: e, signal: i }) {
1648
+ let a = !1, o = !1, c = t.onChange(() => {
1649
+ a || o || n.setState(r());
1650
+ }), l = t.onSelectionChange(() => {
1651
+ a || o || n.setState(r());
1652
+ }), u = t.onFocusChange((e, { focused: i }) => {
1653
+ i ? a || o || t.isFocused() && n.setState(r()) : (n.setState(!1), Be() && t.transact((e) => {
1654
+ e.selection.empty || e.setSelection(s.near(e.selection.$head));
1655
+ }));
1656
+ }, { includeEditorUI: !0 });
1657
+ Be() && window.addEventListener("blur", () => {
1658
+ t.isFocused() && t.blur();
1659
+ }, { signal: i }), e.addEventListener("pointerdown", () => {
1660
+ a = !0, n.setState(!1);
1661
+ }, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
1662
+ a = !1, t.isFocused() && n.setState(r());
1663
+ }, {
1664
+ signal: i,
1665
+ capture: !0
1666
+ }), e.addEventListener("pointercancel", () => {
1667
+ a = !0;
1668
+ }, {
1669
+ signal: i,
1670
+ capture: !0
1671
+ }), t.prosemirrorView.root.addEventListener("dragstart", () => {
1672
+ o = !0, n.setState(!1);
1673
+ }, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
1674
+ o = !1;
1675
+ }, { signal: i }), i.addEventListener("abort", () => {
1676
+ c(), l(), u();
1677
+ });
1678
+ }
1679
+ };
1680
+ });
1681
+ // src/api/positionMapping.ts
1682
+ function nn(e, t, n = "left") {
1683
+ let r = e.getExtension("yPositionMapping");
1684
+ if (r) return r.mapPosition(t, n);
1685
+ let i = e.getExtension("positionMapping");
1686
+ if (i) return i.mapPosition(t, n);
1687
+ throw Error("No position mapping extension found");
1688
+ }
1689
+ // src/extensions/SuggestionMenu/SuggestionMenu.ts
1690
+ var rn = p((e) => e.type.name === "blockContainer"), an = class {
1691
+ editor;
1692
+ state;
1693
+ emitUpdate;
1694
+ rootEl;
1695
+ pluginState;
1696
+ constructor(e, t, n) {
1697
+ this.editor = e, this.pluginState = void 0, this.emitUpdate = (e) => {
1698
+ if (!this.state) throw Error("Attempting to update uninitialized suggestions menu");
1699
+ t(e, {
1700
+ ...this.state,
1701
+ ignoreQueryLength: this.pluginState?.ignoreQueryLength
1702
+ });
1703
+ }, this.rootEl = n.root, this.rootEl?.addEventListener("scroll", this.handleScroll, !0);
1704
+ }
1705
+ handleScroll = (e) => {
1706
+ if (this.state?.show) {
1707
+ let t = this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);
1708
+ if (!t || e.target instanceof Node && !e.target.contains(t)) return;
1709
+ this.state.referencePos = t.getBoundingClientRect().toJSON(), this.emitUpdate(this.pluginState.triggerCharacter);
1710
+ }
1711
+ };
1712
+ update(e, t) {
1713
+ let n = Q.getState(t), r = Q.getState(e.state), i = n === void 0 && r !== void 0, a = n !== void 0 && r === void 0;
1714
+ if (!i && (n === void 0 || r === void 0) && !a) return;
1715
+ if (this.pluginState = a ? n : r, a || !this.editor.isEditable) {
1716
+ this.state && (this.state.show = !1), this.emitUpdate(this.pluginState.triggerCharacter);
1717
+ return;
1718
+ }
1719
+ let o = this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);
1720
+ this.editor.isEditable && o && (this.state = {
1721
+ show: !0,
1722
+ referencePos: o.getBoundingClientRect().toJSON(),
1723
+ query: this.pluginState.query
1724
+ }, this.emitUpdate(this.pluginState.triggerCharacter));
1725
+ }
1726
+ destroy() {
1727
+ this.rootEl?.removeEventListener("scroll", this.handleScroll, !0);
1728
+ }
1729
+ closeMenu = () => {
1730
+ this.editor.transact((e) => e.setMeta(Q, null));
1731
+ };
1732
+ clearQuery = () => {
1733
+ this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
1734
+ from: this.pluginState.queryStartPos() - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
1735
+ to: this.editor.transact((e) => e.selection.from)
1736
+ }).run();
1737
+ };
1738
+ }, Q = new o("SuggestionMenuPlugin"), on = t(({ editor: t }) => {
1739
+ let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
1740
+ return {
1741
+ key: "suggestionMenu",
1742
+ store: i,
1743
+ addSuggestionMenu: (e) => {
1744
+ n.set(e.triggerCharacter, e);
1745
+ },
1746
+ removeSuggestionMenu: (e) => {
1747
+ n.delete(e);
1748
+ },
1749
+ closeMenu: () => {
1750
+ r?.closeMenu();
1751
+ },
1752
+ clearQuery: () => {
1753
+ r?.clearQuery();
1754
+ },
1755
+ shown: () => r?.state?.show || !1,
1756
+ openSuggestionMenu: (e, n) => {
1757
+ t.headless || (t.focus(), t.transact((t) => {
1758
+ n?.deleteTriggerCharacter && t.insertText(e), t.scrollIntoView().setMeta(Q, {
1759
+ triggerCharacter: e,
1760
+ deleteTriggerCharacter: n?.deleteTriggerCharacter || !1,
1761
+ ignoreQueryLength: n?.ignoreQueryLength || !1
1762
+ });
1763
+ }));
1764
+ },
1765
+ prosemirrorPlugins: [new a({
1766
+ key: Q,
1767
+ view: (e) => (r = new an(t, (e, t) => {
1768
+ i.setState({
1769
+ ...t,
1770
+ triggerCharacter: e
1771
+ });
1772
+ }, e), r),
1773
+ state: {
1774
+ init() {},
1775
+ apply: (e, n, i, a) => {
1776
+ if (e.selection.$from.parent.type.spec.code) return n;
1777
+ let o = e.getMeta(Q);
1778
+ if (typeof o == "object" && o) {
1779
+ n && r?.closeMenu();
1780
+ let e = nn(t, a.selection.from - o.triggerCharacter.length);
1781
+ return {
1782
+ triggerCharacter: o.triggerCharacter,
1783
+ deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
1784
+ queryStartPos: () => e() + o.triggerCharacter.length,
1785
+ query: "",
1786
+ decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
1787
+ ignoreQueryLength: o?.ignoreQueryLength
1788
+ };
1789
+ }
1790
+ if (n === void 0) return n;
1791
+ if (a.selection.from !== a.selection.to || o === null || e.getMeta("focus") || e.getMeta("blur") || e.getMeta("pointer") || n.triggerCharacter !== void 0 && a.selection.from < n.queryStartPos() || !a.selection.$from.sameParent(a.doc.resolve(n.queryStartPos()))) return;
1792
+ let s = { ...n };
1793
+ return s.query = a.doc.textBetween(n.queryStartPos(), a.selection.from), s;
1794
+ }
1795
+ },
1796
+ props: {
1797
+ handleTextInput(e, t, r, i) {
1798
+ let a = e.state.doc, o = [...n.entries()].sort(([e], [t]) => t.length - e.length);
1799
+ for (let [n, r] of o) {
1800
+ let o = a.textBetween(Math.max(0, t - (n.length - i.length)), t) + i;
1801
+ if (n === o) {
1802
+ if (r.shouldOpen && !r.shouldOpen(e.state.tr)) continue;
1803
+ return e.dispatch(e.state.tr.insertText(i)), e.dispatch(e.state.tr.setMeta(Q, { triggerCharacter: o }).scrollIntoView()), !0;
1804
+ }
1805
+ }
1806
+ return !1;
1807
+ },
1808
+ decorations(e) {
1809
+ let t = this.getState(e);
1810
+ if (t === void 0) return null;
1811
+ if (!t.deleteTriggerCharacter) {
1812
+ let n = rn(e.selection);
1813
+ if (n) return ee.create(e.doc, [_.node(n.pos, n.pos + n.node.nodeSize, {
1814
+ nodeName: "span",
1815
+ class: "bn-suggestion-decorator",
1816
+ "data-decoration-id": t.decorationId
1817
+ })]);
1818
+ }
1819
+ return ee.create(e.doc, [_.inline(t.queryStartPos() - t.triggerCharacter.length, t.queryStartPos(), {
1820
+ nodeName: "span",
1821
+ class: "bn-suggestion-decorator",
1822
+ "data-decoration-id": t.decorationId
1823
+ })]);
1824
+ }
1825
+ }
1826
+ })]
1827
+ };
1828
+ });
1829
+ // src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
1830
+ function sn(e) {
1831
+ let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
1832
+ for (; n === "none";) {
1833
+ if (t = e.getTextCursorPosition().nextBlock, t === void 0) {
1834
+ let t = e.document[e.document.length - 1], n = e.insertBlocks([{ type: "paragraph" }], t, "after")[0];
1835
+ e.setTextCursorPosition(n, "end");
1836
+ return;
1837
+ }
1838
+ n = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
1839
+ }
1840
+ }
1841
+ function $(e, t) {
1842
+ let n = e.getTextCursorPosition().block;
1843
+ if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
1844
+ let r;
1845
+ return Array.isArray(n.content) && (n.content.length === 1 && E(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), sn(e), r;
1846
+ }
1847
+ function cn(e) {
1848
+ let t = [], n = new Map(en(e).map((e) => [e.key, e]));
1849
+ function r(r, i) {
1850
+ let a = n.get(r);
1851
+ a && t.push({
1852
+ onItemClick: () => {
1853
+ $(e, {
1854
+ type: a.type,
1855
+ props: a.props
1856
+ });
1857
+ },
1858
+ badge: i,
1859
+ key: r,
1860
+ ...e.dictionary.slash_menu[r]
1861
+ });
1862
+ }
1863
+ return r("heading", N("Mod-Alt-1")), r("heading_2", N("Mod-Alt-2")), r("heading_3", N("Mod-Alt-3")), r("quote"), r("toggle_list", N("Mod-Shift-6")), r("numbered_list", N("Mod-Shift-7")), r("bullet_list", N("Mod-Shift-8")), r("check_list", N("Mod-Shift-9")), r("paragraph", N("Mod-Alt-0")), Y(e, "codeBlock") && t.push({
1864
+ onItemClick: () => {
1865
+ $(e, { type: "codeBlock" });
1866
+ },
1867
+ badge: N("Mod-Alt-c"),
1868
+ key: "code_block",
1869
+ ...e.dictionary.slash_menu.code_block
1870
+ }), Y(e, "divider") && t.push({
1871
+ onItemClick: () => {
1872
+ $(e, { type: "divider" });
1873
+ },
1874
+ key: "divider",
1875
+ ...e.dictionary.slash_menu.divider
1876
+ }), Y(e, "table") && t.push({
1877
+ onItemClick: () => {
1878
+ $(e, {
1879
+ type: "table",
1880
+ content: {
1881
+ type: "tableContent",
1882
+ rows: [{ cells: [
1883
+ "",
1884
+ "",
1885
+ ""
1886
+ ] }, { cells: [
1887
+ "",
1888
+ "",
1889
+ ""
1890
+ ] }]
1891
+ }
1892
+ });
1893
+ },
1894
+ badge: void 0,
1895
+ key: "table",
1896
+ ...e.dictionary.slash_menu.table
1897
+ }), Y(e, "image", { url: "string" }) && t.push({
1898
+ onItemClick: () => {
1899
+ let t = $(e, { type: "image" });
1900
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
1901
+ },
1902
+ key: "image",
1903
+ ...e.dictionary.slash_menu.image
1904
+ }), Y(e, "video", { url: "string" }) && t.push({
1905
+ onItemClick: () => {
1906
+ let t = $(e, { type: "video" });
1907
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
1908
+ },
1909
+ key: "video",
1910
+ ...e.dictionary.slash_menu.video
1911
+ }), Y(e, "audio", { url: "string" }) && t.push({
1912
+ onItemClick: () => {
1913
+ let t = $(e, { type: "audio" });
1914
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
1915
+ },
1916
+ key: "audio",
1917
+ ...e.dictionary.slash_menu.audio
1918
+ }), Y(e, "file", { url: "string" }) && t.push({
1919
+ onItemClick: () => {
1920
+ let t = $(e, { type: "file" });
1921
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
1922
+ },
1923
+ key: "file",
1924
+ ...e.dictionary.slash_menu.file
1925
+ }), r("toggle_heading"), r("toggle_heading_2"), r("toggle_heading_3"), r("heading_4", N("Mod-Alt-4")), r("heading_5", N("Mod-Alt-5")), r("heading_6", N("Mod-Alt-6")), t.push({
1926
+ onItemClick: () => {
1927
+ e.getExtension(on)?.openSuggestionMenu(":", {
1928
+ deleteTriggerCharacter: !0,
1929
+ ignoreQueryLength: !0
1930
+ });
1931
+ },
1932
+ key: "emoji",
1933
+ ...e.dictionary.slash_menu.emoji
1934
+ }), t;
1935
+ }
1936
+ function ln(e, t) {
1937
+ return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
1938
+ }
1939
+ export { tt as $, ne as $t, Tt as A, Fe as At, yt as B, b as Bt, Nt as C, Ie as Ct, It as D, k as Dt, Ft as E, O as Et, St as F, Ee as Ft, ft as G, Ce as Gt, vt as H, ve as Ht, bt as I, fe as It, it as J, ge as Jt, ct as K, _e as Kt, lt as L, pe as Lt, Dt as M, w as Mt, Ct as N, ke as Nt, Ot as O, D as Ot, kt as P, Oe as Pt, st as Q, de as Qt, mt as R, De as Rt, Pt as S, M as St, H as T, j as Tt, ut as U, Te as Ut, _t as V, ye as Vt, pt as W, we as Wt, V as X, xe as Xt, ot as Y, be as Yt, at as Z, y as Zt, zt as _, ze as _t, nn as a, ie as an, nt as at, Bt as b, Be as bt, en as c, Ye as ct, Zt as d, qe as dt, te as en, R as et, Xt as f, Ge as ft, Kt as g, N as gt, K as h, Ue as ht, on as i, v as in, z as it, wt as j, E as jt, At as k, T as kt, Yt as l, I as lt, q as m, He as mt, cn as n, ue as nn, et as nt, Z as o, se as on, Xe as ot, J as p, Ve as pt, B as q, Se as qt, $ as r, re as rn, Ze as rt, X as s, ce as sn, L as st, ln as t, le as tn, $e as tt, Y as u, Ke as ut, Ht as v, Le as vt, G as w, A as wt, Rt as x, P as xt, Vt as y, Re as yt, dt as z, x as zt };