reactjs-tiptap-editor 1.0.25 → 1.0.28

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 (296) hide show
  1. package/lib/{ActionMenuButton-8cTG45Ft.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
  2. package/lib/{ActionMenuButton-CXeFhner.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +14 -14
  5. package/lib/Blockquote.cjs +5 -5
  6. package/lib/Blockquote.js +1497 -53
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +3 -3
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/{Callout-ZlPQrMEt.js → Callout-B9uXfbP3.js} +20 -20
  12. package/lib/{Callout-DWOMZPiP.cjs → Callout-C_TXsss3.cjs} +1 -1
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +4 -4
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +56 -39
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +8 -4
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +2 -2
  27. package/lib/{Drawer-TJY4NuHx.cjs → Drawer-D3B4lQJF.cjs} +1 -1
  28. package/lib/{Drawer-C-EO1uoK.js → Drawer-h401Yy6Y.js} +4 -4
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +1797 -268
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +10 -10
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +5 -5
  43. package/lib/FormatPainter.cjs +1 -0
  44. package/lib/FormatPainter.js +133 -0
  45. package/lib/Heading.cjs +1 -1
  46. package/lib/Heading.js +15 -11
  47. package/lib/Highlight.cjs +1 -1
  48. package/lib/Highlight.js +3 -3
  49. package/lib/History.cjs +7 -1
  50. package/lib/History.js +663 -569
  51. package/lib/HorizontalRule.cjs +1 -1
  52. package/lib/HorizontalRule.js +2 -2
  53. package/lib/{Iframe-CGb6-2LD.js → Iframe-Dhn40BXx.js} +7 -7
  54. package/lib/{Iframe-5zx43DL4.cjs → Iframe-bvGuzYwC.cjs} +1 -1
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +3 -3
  57. package/lib/Image.cjs +1 -1
  58. package/lib/Image.js +9 -6
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +33 -33
  61. package/lib/ImportWord.cjs +1 -1
  62. package/lib/ImportWord.js +5 -5
  63. package/lib/{Indent-CdMYsDNS.js → Indent-BK9DvCL7.js} +2 -2
  64. package/lib/{Indent-DuwV8s1t.cjs → Indent-IOByomps.cjs} +1 -1
  65. package/lib/Indent.cjs +1 -1
  66. package/lib/Indent.js +2 -2
  67. package/lib/Italic.cjs +1 -1
  68. package/lib/Italic.js +2 -2
  69. package/lib/{Katex-CCP_ZQz2.js → Katex-C_Ah9G9w.js} +5 -5
  70. package/lib/{Katex-D9FP7EUE.cjs → Katex-oLGrtLTf.cjs} +1 -1
  71. package/lib/Katex.cjs +1 -1
  72. package/lib/Katex.js +3 -3
  73. package/lib/LineHeight.cjs +1 -1
  74. package/lib/LineHeight.js +4 -4
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-DQ8-iufJ.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
  78. package/lib/{LinkEditBlock-B1m-TVMu.js → LinkEditBlock-DRdKXffy.js} +88 -57
  79. package/lib/MarkdownPaste.cjs +1 -1
  80. package/lib/MarkdownPaste.js +1 -1
  81. package/lib/Mention.cjs +1 -1
  82. package/lib/Mention.js +9 -5
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +14 -14
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +3 -3
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +2 -2
  89. package/lib/SearchAndReplace.cjs +1 -1
  90. package/lib/SearchAndReplace.js +10 -10
  91. package/lib/SlashCommand.cjs +1 -1
  92. package/lib/SlashCommand.js +7 -7
  93. package/lib/{SlashCommandNodeView-DNixmQGa.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
  94. package/lib/{SlashCommandNodeView-Dt6n1SP9.js → SlashCommandNodeView-qwW9cuYt.js} +10 -10
  95. package/lib/Strike.cjs +1 -1
  96. package/lib/Strike.js +2 -2
  97. package/lib/{Table-DdEgaUwa.js → Table-BKM8SvVj.js} +115 -97
  98. package/lib/{Table-C5JxBXef.cjs → Table-CWI7tKme.cjs} +5 -5
  99. package/lib/Table.cjs +1 -1
  100. package/lib/Table.js +1 -1
  101. package/lib/TaskList.cjs +1 -1
  102. package/lib/TaskList.js +2 -2
  103. package/lib/TextAlign.cjs +1 -1
  104. package/lib/TextAlign.js +11 -11
  105. package/lib/TextDirection.cjs +1 -1
  106. package/lib/TextDirection.js +3 -3
  107. package/lib/TextUnderline.cjs +1 -1
  108. package/lib/TextUnderline.js +2 -2
  109. package/lib/Twitter-BfsPzA8_.cjs +1 -0
  110. package/lib/{Twitter-Dnz9qyW0.js → Twitter-CofLQ-zj.js} +191 -191
  111. package/lib/Twitter.cjs +1 -1
  112. package/lib/Twitter.js +3 -3
  113. package/lib/Video.cjs +1 -1
  114. package/lib/Video.js +3 -3
  115. package/lib/bubble.cjs +6 -6
  116. package/lib/bubble.js +2504 -2152
  117. package/lib/{clsx-D6gYQn3o.cjs → clsx-DJURdKPs.cjs} +2 -2
  118. package/lib/{clsx-0OU6n9va.js → clsx-b_2OwHLk.js} +28 -18
  119. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
  120. package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
  121. package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
  122. package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
  123. package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
  124. package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
  125. package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
  126. package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
  127. package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
  128. package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
  129. package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
  130. package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
  131. package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
  132. package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
  133. package/lib/components/ColorPicker.d.ts +1 -1
  134. package/lib/components/ReactBus.d.ts +1 -1
  135. package/lib/components/RichTextProvider.d.ts +1 -1
  136. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
  137. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
  138. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
  139. package/lib/components/icons/Activity.d.ts +2 -1
  140. package/lib/components/icons/Animas.d.ts +2 -1
  141. package/lib/components/icons/AspectRatio.d.ts +1 -1
  142. package/lib/components/icons/Blockquote.d.ts +1 -1
  143. package/lib/components/icons/CodeView.d.ts +1 -1
  144. package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
  145. package/lib/components/icons/ColumnAddRight.d.ts +1 -1
  146. package/lib/components/icons/DeleteColumn.d.ts +1 -1
  147. package/lib/components/icons/DeleteRow.d.ts +1 -1
  148. package/lib/components/icons/Direction.d.ts +1 -1
  149. package/lib/components/icons/Excalidraw.d.ts +1 -1
  150. package/lib/components/icons/ExportPdf.d.ts +1 -1
  151. package/lib/components/icons/ExportWord.d.ts +2 -1
  152. package/lib/components/icons/FileWordOutline.d.ts +1 -1
  153. package/lib/components/icons/Flag.d.ts +2 -1
  154. package/lib/components/icons/Food.d.ts +2 -1
  155. package/lib/components/icons/GIfIcon.d.ts +1 -1
  156. package/lib/components/icons/Html.d.ts +1 -1
  157. package/lib/components/icons/Icon.d.ts +1 -1
  158. package/lib/components/icons/IconColorFill.d.ts +1 -1
  159. package/lib/components/icons/IconHighlightFill.d.ts +1 -1
  160. package/lib/components/icons/ImportWord.d.ts +2 -1
  161. package/lib/components/icons/LeftToRight.d.ts +1 -1
  162. package/lib/components/icons/LineHeight.d.ts +1 -1
  163. package/lib/components/icons/MenuDown.d.ts +1 -1
  164. package/lib/components/icons/Mermaid.d.ts +1 -1
  165. package/lib/components/icons/NoFill.d.ts +1 -1
  166. package/lib/components/icons/Object.d.ts +2 -1
  167. package/lib/components/icons/RightToLeft.d.ts +1 -1
  168. package/lib/components/icons/SizeL.d.ts +1 -1
  169. package/lib/components/icons/SizeM.d.ts +1 -1
  170. package/lib/components/icons/SizeS.d.ts +1 -1
  171. package/lib/components/icons/Symbol.d.ts +2 -1
  172. package/lib/components/icons/Travel.d.ts +2 -1
  173. package/lib/components/icons/Twitter.d.ts +1 -1
  174. package/lib/components/ui/dialog.d.ts +2 -2
  175. package/lib/components/ui/dropdown-menu.d.ts +1 -1
  176. package/lib/components/ui/emoji-picker.d.ts +4 -4
  177. package/lib/components/ui/toaster.d.ts +1 -1
  178. package/lib/{dropdown-menu-yQ-sQ1k4.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
  179. package/lib/{dropdown-menu-ROihzXsP.js → dropdown-menu-CKAKsyqu.js} +1 -1
  180. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
  181. package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
  182. package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
  183. package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
  184. package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
  185. package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
  186. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
  187. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
  188. package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
  189. package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
  190. package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
  191. package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
  192. package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
  193. package/lib/extensions/Column/Column.d.ts +10 -2
  194. package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
  195. package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
  196. package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
  197. package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
  198. package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
  199. package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
  200. package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
  201. package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
  202. package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
  203. package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
  204. package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
  205. package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
  206. package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
  207. package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
  208. package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
  209. package/lib/extensions/FormatPainter/index.d.ts +1 -0
  210. package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
  211. package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
  212. package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
  213. package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
  214. package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
  215. package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
  216. package/lib/extensions/Image/Image.d.ts +13 -1
  217. package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
  218. package/lib/extensions/Image/components/ImageView.d.ts +2 -1
  219. package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
  220. package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
  221. package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
  222. package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
  223. package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
  224. package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
  225. package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
  226. package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
  227. package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
  228. package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
  229. package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
  230. package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
  231. package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
  232. package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
  233. package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
  234. package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
  235. package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
  236. package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
  237. package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
  238. package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
  239. package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
  240. package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
  241. package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
  242. package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
  243. package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
  244. package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
  245. package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
  246. package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
  247. package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
  248. package/lib/index-BJQ1G8B1.js +311 -0
  249. package/lib/index-BO82_0q8.cjs +1 -0
  250. package/lib/{index-D-Ouz0vF.js → index-Bn_WPziX.js} +1 -1
  251. package/lib/index-CwbGrQFa.cjs +1 -0
  252. package/lib/{index-oj858lQO.js → index-DKruDABV.js} +209 -209
  253. package/lib/{index-BAb_UADw.cjs → index-DN-IR-K0.cjs} +1 -1
  254. package/lib/{index-X6WZUM9O.js → index-DRcwHivm.js} +1702 -1486
  255. package/lib/index-DUeBQoIA.cjs +1 -0
  256. package/lib/index-DeoYYWEA.js +1756 -0
  257. package/lib/{index-CUvjYuRp.cjs → index-Dgs2thVL.cjs} +1 -1
  258. package/lib/index-DjB2kNdz.js +1120 -0
  259. package/lib/{index-zw-Kd38i.js → index-DuWMq-Qs.js} +1 -1
  260. package/lib/index-EoGU7W4e.cjs +26 -0
  261. package/lib/index-MDz4NZcT.cjs +12 -0
  262. package/lib/{index-BblvcbTH.js → index-n4kM0Ll-.js} +1527 -1406
  263. package/lib/index-qZURFC5Q.cjs +2 -0
  264. package/lib/index.cjs +1 -1
  265. package/lib/index.js +2 -2
  266. package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
  267. package/lib/locale-bundle.cjs +1 -1
  268. package/lib/locale-bundle.js +1 -1
  269. package/lib/locales/index.d.ts +1 -1
  270. package/lib/{popover-BfWFqCIs.js → popover-Beieacfy.js} +1 -1
  271. package/lib/{popover-BPzkMuyi.cjs → popover-Bl1kxRJX.cjs} +1 -1
  272. package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
  273. package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-Bi58v3DZ.js} +2 -2
  274. package/lib/{separator-DpaS43Gt.cjs → separator-DMLtkcoo.cjs} +1 -1
  275. package/lib/{separator-CBPrZizK.js → separator-DfvK668q.js} +11 -11
  276. package/lib/store/EditorEditableReactive.d.ts +1 -1
  277. package/lib/store/ThemeColorReactive.d.ts +1 -1
  278. package/lib/style.css +1 -1
  279. package/lib/{textarea-wvARZKyA.cjs → textarea-DV9Fw3y1.cjs} +1 -1
  280. package/lib/{textarea-Bl64keav.js → textarea-GXaWJbm9.js} +1 -1
  281. package/lib/theme.cjs +1 -1
  282. package/lib/theme.js +1 -1
  283. package/lib/types.d.ts +2 -2
  284. package/lib/{updatePosition-BwzAsiY0.js → updatePosition-DY1jI7qb.js} +2 -2
  285. package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
  286. package/package.json +86 -72
  287. package/lib/Twitter--tfifMt1.cjs +0 -1
  288. package/lib/index-BF3EVCB1.cjs +0 -2
  289. package/lib/index-BG0kQamI.js +0 -285
  290. package/lib/index-Bcj8cyOO.cjs +0 -24
  291. package/lib/index-CGjT-a9h.js +0 -1377
  292. package/lib/index-CPTpXLfX.cjs +0 -11
  293. package/lib/index-CWw4s87s.cjs +0 -1
  294. package/lib/index-Cal5SPfB.js +0 -779
  295. package/lib/index-Gi752TMk.cjs +0 -1
  296. package/lib/index-NsYff_Ni.cjs +0 -1
package/lib/Blockquote.js CHANGED
@@ -1,10 +1,1453 @@
1
- import { N as k, w as h, m as g } from "./index-BblvcbTH.js";
2
- import { h as p } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { jsx as m, Fragment as b } from "react/jsx-runtime";
4
- import { u as f, d as q, A as v } from "./index-X6WZUM9O.js";
1
+ import { N as Rt, w as At, m as Ot } from "./index-n4kM0Ll-.js";
2
+ import { h as Z } from "./jsx-runtime-DE8oVoME.js";
3
+ import { jsx as j, Fragment as Et } from "react/jsx-runtime";
4
+ import { u as Tt, d as It, A as zt } from "./index-DRcwHivm.js";
5
5
  import "react";
6
6
  import "./theme.js";
7
- var B = /^\s*>\s$/, A = k.create({
7
+ function st(n, t, e) {
8
+ for (let r = 0; ; r++) {
9
+ if (r == n.childCount || r == t.childCount)
10
+ return n.childCount == t.childCount ? null : e;
11
+ let i = n.child(r), s = t.child(r);
12
+ if (i == s) {
13
+ e += i.nodeSize;
14
+ continue;
15
+ }
16
+ if (!i.sameMarkup(s))
17
+ return e;
18
+ if (i.isText && i.text != s.text) {
19
+ let o = i.text, a = s.text, l = 0;
20
+ for (; o[l] == a[l]; l++)
21
+ e++;
22
+ return l && l < o.length && l < a.length && lt(o.charCodeAt(l - 1)) && at(o.charCodeAt(l)) && e--, e;
23
+ }
24
+ if (i.content.size || s.content.size) {
25
+ let o = st(i.content, s.content, e + 1);
26
+ if (o != null)
27
+ return o;
28
+ }
29
+ e += i.nodeSize;
30
+ }
31
+ }
32
+ function ot(n, t, e, r) {
33
+ for (let i = n.childCount, s = t.childCount; ; ) {
34
+ if (i == 0 || s == 0)
35
+ return i == s ? null : { a: e, b: r };
36
+ let o = n.child(--i), a = t.child(--s), l = o.nodeSize;
37
+ if (o == a) {
38
+ e -= l, r -= l;
39
+ continue;
40
+ }
41
+ if (!o.sameMarkup(a))
42
+ return { a: e, b: r };
43
+ if (o.isText && o.text != a.text) {
44
+ let u = o.text, h = a.text, f = u.length, k = h.length;
45
+ for (; f > 0 && k > 0 && u[f - 1] == h[k - 1]; )
46
+ f--, k--, e--, r--;
47
+ return f && k && f < u.length && lt(u.charCodeAt(f - 1)) && at(u.charCodeAt(f)) && (e++, r++), { a: e, b: r };
48
+ }
49
+ if (o.content.size || a.content.size) {
50
+ let u = ot(o.content, a.content, e - 1, r - 1);
51
+ if (u)
52
+ return u;
53
+ }
54
+ e -= l, r -= l;
55
+ }
56
+ }
57
+ function at(n) {
58
+ return n >= 56320 && n < 57344;
59
+ }
60
+ function lt(n) {
61
+ return n >= 55296 && n < 56320;
62
+ }
63
+ var g = class d {
64
+ /**
65
+ @internal
66
+ */
67
+ constructor(t, e) {
68
+ if (this.content = t, this.size = e || 0, e == null)
69
+ for (let r = 0; r < t.length; r++)
70
+ this.size += t[r].nodeSize;
71
+ }
72
+ /**
73
+ Invoke a callback for all descendant nodes between the given two
74
+ positions (relative to start of this fragment). Doesn't descend
75
+ into a node when the callback returns `false`.
76
+ */
77
+ nodesBetween(t, e, r, i = 0, s) {
78
+ for (let o = 0, a = 0; a < e; o++) {
79
+ let l = this.content[o], u = a + l.nodeSize;
80
+ if (u > t && r(l, i + a, s || null, o) !== !1 && l.content.size) {
81
+ let h = a + 1;
82
+ l.nodesBetween(Math.max(0, t - h), Math.min(l.content.size, e - h), r, i + h);
83
+ }
84
+ a = u;
85
+ }
86
+ }
87
+ /**
88
+ Call the given callback for every descendant node. `pos` will be
89
+ relative to the start of the fragment. The callback may return
90
+ `false` to prevent traversal of a given node's children.
91
+ */
92
+ descendants(t) {
93
+ this.nodesBetween(0, this.size, t);
94
+ }
95
+ /**
96
+ Extract the text between `from` and `to`. See the same method on
97
+ [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
98
+ */
99
+ textBetween(t, e, r, i) {
100
+ let s = "", o = !0;
101
+ return this.nodesBetween(t, e, (a, l) => {
102
+ let u = a.isText ? a.text.slice(Math.max(t, l) - l, e - l) : a.isLeaf ? i ? typeof i == "function" ? i(a) : i : a.type.spec.leafText ? a.type.spec.leafText(a) : "" : "";
103
+ a.isBlock && (a.isLeaf && u || a.isTextblock) && r && (o ? o = !1 : s += r), s += u;
104
+ }, 0), s;
105
+ }
106
+ /**
107
+ Create a new fragment containing the combined content of this
108
+ fragment and the other.
109
+ */
110
+ append(t) {
111
+ if (!t.size)
112
+ return this;
113
+ if (!this.size)
114
+ return t;
115
+ let e = this.lastChild, r = t.firstChild, i = this.content.slice(), s = 0;
116
+ for (e.isText && e.sameMarkup(r) && (i[i.length - 1] = e.withText(e.text + r.text), s = 1); s < t.content.length; s++)
117
+ i.push(t.content[s]);
118
+ return new d(i, this.size + t.size);
119
+ }
120
+ /**
121
+ Cut out the sub-fragment between the two given positions.
122
+ */
123
+ cut(t, e = this.size) {
124
+ if (t == 0 && e == this.size)
125
+ return this;
126
+ let r = [], i = 0;
127
+ if (e > t)
128
+ for (let s = 0, o = 0; o < e; s++) {
129
+ let a = this.content[s], l = o + a.nodeSize;
130
+ l > t && ((o < t || l > e) && (a.isText ? a = a.cut(Math.max(0, t - o), Math.min(a.text.length, e - o)) : a = a.cut(Math.max(0, t - o - 1), Math.min(a.content.size, e - o - 1))), r.push(a), i += a.nodeSize), o = l;
131
+ }
132
+ return new d(r, i);
133
+ }
134
+ /**
135
+ @internal
136
+ */
137
+ cutByIndex(t, e) {
138
+ return t == e ? d.empty : t == 0 && e == this.content.length ? this : new d(this.content.slice(t, e));
139
+ }
140
+ /**
141
+ Create a new fragment in which the node at the given index is
142
+ replaced by the given node.
143
+ */
144
+ replaceChild(t, e) {
145
+ let r = this.content[t];
146
+ if (r == e)
147
+ return this;
148
+ let i = this.content.slice(), s = this.size + e.nodeSize - r.nodeSize;
149
+ return i[t] = e, new d(i, s);
150
+ }
151
+ /**
152
+ Create a new fragment by prepending the given node to this
153
+ fragment.
154
+ */
155
+ addToStart(t) {
156
+ return new d([t].concat(this.content), this.size + t.nodeSize);
157
+ }
158
+ /**
159
+ Create a new fragment by appending the given node to this
160
+ fragment.
161
+ */
162
+ addToEnd(t) {
163
+ return new d(this.content.concat(t), this.size + t.nodeSize);
164
+ }
165
+ /**
166
+ Compare this fragment to another one.
167
+ */
168
+ eq(t) {
169
+ if (this.content.length != t.content.length)
170
+ return !1;
171
+ for (let e = 0; e < this.content.length; e++)
172
+ if (!this.content[e].eq(t.content[e]))
173
+ return !1;
174
+ return !0;
175
+ }
176
+ /**
177
+ The first child of the fragment, or `null` if it is empty.
178
+ */
179
+ get firstChild() {
180
+ return this.content.length ? this.content[0] : null;
181
+ }
182
+ /**
183
+ The last child of the fragment, or `null` if it is empty.
184
+ */
185
+ get lastChild() {
186
+ return this.content.length ? this.content[this.content.length - 1] : null;
187
+ }
188
+ /**
189
+ The number of child nodes in this fragment.
190
+ */
191
+ get childCount() {
192
+ return this.content.length;
193
+ }
194
+ /**
195
+ Get the child node at the given index. Raise an error when the
196
+ index is out of range.
197
+ */
198
+ child(t) {
199
+ let e = this.content[t];
200
+ if (!e)
201
+ throw new RangeError("Index " + t + " out of range for " + this);
202
+ return e;
203
+ }
204
+ /**
205
+ Get the child node at the given index, if it exists.
206
+ */
207
+ maybeChild(t) {
208
+ return this.content[t] || null;
209
+ }
210
+ /**
211
+ Call `f` for every child node, passing the node, its offset
212
+ into this parent node, and its index.
213
+ */
214
+ forEach(t) {
215
+ for (let e = 0, r = 0; e < this.content.length; e++) {
216
+ let i = this.content[e];
217
+ t(i, r, e), r += i.nodeSize;
218
+ }
219
+ }
220
+ /**
221
+ Find the first position at which this fragment and another
222
+ fragment differ, or `null` if they are the same.
223
+ */
224
+ findDiffStart(t, e = 0) {
225
+ return st(this, t, e);
226
+ }
227
+ /**
228
+ Find the first position, searching from the end, at which this
229
+ fragment and the given fragment differ, or `null` if they are
230
+ the same. Since this position will not be the same in both
231
+ nodes, an object with two separate positions is returned.
232
+ */
233
+ findDiffEnd(t, e = this.size, r = t.size) {
234
+ return ot(this, t, e, r);
235
+ }
236
+ /**
237
+ Find the index and inner offset corresponding to a given relative
238
+ position in this fragment. The result object will be reused
239
+ (overwritten) the next time the function is called. @internal
240
+ */
241
+ findIndex(t) {
242
+ if (t == 0)
243
+ return F(0, t);
244
+ if (t == this.size)
245
+ return F(this.content.length, t);
246
+ if (t > this.size || t < 0)
247
+ throw new RangeError(`Position ${t} outside of fragment (${this})`);
248
+ for (let e = 0, r = 0; ; e++) {
249
+ let i = this.child(e), s = r + i.nodeSize;
250
+ if (s >= t)
251
+ return s == t ? F(e + 1, s) : F(e, r);
252
+ r = s;
253
+ }
254
+ }
255
+ /**
256
+ Return a debugging string that describes this fragment.
257
+ */
258
+ toString() {
259
+ return "<" + this.toStringInner() + ">";
260
+ }
261
+ /**
262
+ @internal
263
+ */
264
+ toStringInner() {
265
+ return this.content.join(", ");
266
+ }
267
+ /**
268
+ Create a JSON-serializeable representation of this fragment.
269
+ */
270
+ toJSON() {
271
+ return this.content.length ? this.content.map((t) => t.toJSON()) : null;
272
+ }
273
+ /**
274
+ Deserialize a fragment from its JSON representation.
275
+ */
276
+ static fromJSON(t, e) {
277
+ if (!e)
278
+ return d.empty;
279
+ if (!Array.isArray(e))
280
+ throw new RangeError("Invalid input for Fragment.fromJSON");
281
+ return d.fromArray(e.map(t.nodeFromJSON));
282
+ }
283
+ /**
284
+ Build a fragment from an array of nodes. Ensures that adjacent
285
+ text nodes with the same marks are joined together.
286
+ */
287
+ static fromArray(t) {
288
+ if (!t.length)
289
+ return d.empty;
290
+ let e, r = 0;
291
+ for (let i = 0; i < t.length; i++) {
292
+ let s = t[i];
293
+ r += s.nodeSize, i && s.isText && t[i - 1].sameMarkup(s) ? (e || (e = t.slice(0, i)), e[e.length - 1] = s.withText(e[e.length - 1].text + s.text)) : e && e.push(s);
294
+ }
295
+ return new d(e || t, r);
296
+ }
297
+ /**
298
+ Create a fragment from something that can be interpreted as a
299
+ set of nodes. For `null`, it returns the empty fragment. For a
300
+ fragment, the fragment itself. For a node or array of nodes, a
301
+ fragment containing those nodes.
302
+ */
303
+ static from(t) {
304
+ if (!t)
305
+ return d.empty;
306
+ if (t instanceof d)
307
+ return t;
308
+ if (Array.isArray(t))
309
+ return this.fromArray(t);
310
+ if (t.attrs)
311
+ return new d([t], t.nodeSize);
312
+ throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
313
+ }
314
+ };
315
+ g.empty = new g([], 0);
316
+ var $ = { index: 0, offset: 0 };
317
+ function F(n, t) {
318
+ return $.index = n, $.offset = t, $;
319
+ }
320
+ var Jt = class extends Error {
321
+ }, c = class x {
322
+ /**
323
+ Create a slice. When specifying a non-zero open depth, you must
324
+ make sure that there are nodes of at least that depth at the
325
+ appropriate side of the fragment—i.e. if the fragment is an
326
+ empty paragraph node, `openStart` and `openEnd` can't be greater
327
+ than 1.
328
+
329
+ It is not necessary for the content of open nodes to conform to
330
+ the schema's content constraints, though it should be a valid
331
+ start/end/middle for such a node, depending on which sides are
332
+ open.
333
+ */
334
+ constructor(t, e, r) {
335
+ this.content = t, this.openStart = e, this.openEnd = r;
336
+ }
337
+ /**
338
+ The size this slice would add when inserted into a document.
339
+ */
340
+ get size() {
341
+ return this.content.size - this.openStart - this.openEnd;
342
+ }
343
+ /**
344
+ @internal
345
+ */
346
+ insertAt(t, e) {
347
+ let r = ht(this.content, t + this.openStart, e, this.openStart + 1, this.openEnd + 1);
348
+ return r && new x(r, this.openStart, this.openEnd);
349
+ }
350
+ /**
351
+ @internal
352
+ */
353
+ removeBetween(t, e) {
354
+ return new x(ut(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
355
+ }
356
+ /**
357
+ Tests whether this slice is equal to another slice.
358
+ */
359
+ eq(t) {
360
+ return this.content.eq(t.content) && this.openStart == t.openStart && this.openEnd == t.openEnd;
361
+ }
362
+ /**
363
+ @internal
364
+ */
365
+ toString() {
366
+ return this.content + "(" + this.openStart + "," + this.openEnd + ")";
367
+ }
368
+ /**
369
+ Convert a slice to a JSON-serializable representation.
370
+ */
371
+ toJSON() {
372
+ if (!this.content.size)
373
+ return null;
374
+ let t = { content: this.content.toJSON() };
375
+ return this.openStart > 0 && (t.openStart = this.openStart), this.openEnd > 0 && (t.openEnd = this.openEnd), t;
376
+ }
377
+ /**
378
+ Deserialize a slice from its JSON representation.
379
+ */
380
+ static fromJSON(t, e) {
381
+ if (!e)
382
+ return x.empty;
383
+ let r = e.openStart || 0, i = e.openEnd || 0;
384
+ if (typeof r != "number" || typeof i != "number")
385
+ throw new RangeError("Invalid input for Slice.fromJSON");
386
+ return new x(g.fromJSON(t, e.content), r, i);
387
+ }
388
+ /**
389
+ Create a slice from a fragment by taking the maximum possible
390
+ open value on both side of the fragment.
391
+ */
392
+ static maxOpen(t, e = !0) {
393
+ let r = 0, i = 0;
394
+ for (let s = t.firstChild; s && !s.isLeaf && (e || !s.type.spec.isolating); s = s.firstChild)
395
+ r++;
396
+ for (let s = t.lastChild; s && !s.isLeaf && (e || !s.type.spec.isolating); s = s.lastChild)
397
+ i++;
398
+ return new x(t, r, i);
399
+ }
400
+ };
401
+ c.empty = new c(g.empty, 0, 0);
402
+ function ut(n, t, e) {
403
+ let { index: r, offset: i } = n.findIndex(t), s = n.maybeChild(r), { index: o, offset: a } = n.findIndex(e);
404
+ if (i == t || s.isText) {
405
+ if (a != e && !n.child(o).isText)
406
+ throw new RangeError("Removing non-flat range");
407
+ return n.cut(0, t).append(n.cut(e));
408
+ }
409
+ if (r != o)
410
+ throw new RangeError("Removing non-flat range");
411
+ return n.replaceChild(r, s.copy(ut(s.content, t - i - 1, e - i - 1)));
412
+ }
413
+ function ht(n, t, e, r, i, s) {
414
+ let { index: o, offset: a } = n.findIndex(t), l = n.maybeChild(o);
415
+ if (a == t || l.isText)
416
+ return s && r <= 0 && i <= 0 && !s.canReplace(o, o, e) ? null : n.cut(0, t).append(e).append(n.cut(t));
417
+ let u = ht(l.content, t - a - 1, e, o == 0 ? r - 1 : 0, o == n.childCount - 1 ? i - 1 : 0, l);
418
+ return u && n.replaceChild(o, l.copy(u));
419
+ }
420
+ var ct = 65535, ft = Math.pow(2, 16);
421
+ function Mt(n, t) {
422
+ return n + t * ft;
423
+ }
424
+ function _(n) {
425
+ return n & ct;
426
+ }
427
+ function bt(n) {
428
+ return (n - (n & ct)) / ft;
429
+ }
430
+ var pt = 1, mt = 2, q = 4, dt = 8, tt = class {
431
+ /**
432
+ @internal
433
+ */
434
+ constructor(n, t, e) {
435
+ this.pos = n, this.delInfo = t, this.recover = e;
436
+ }
437
+ /**
438
+ Tells you whether the position was deleted, that is, whether the
439
+ step removed the token on the side queried (via the `assoc`)
440
+ argument from the document.
441
+ */
442
+ get deleted() {
443
+ return (this.delInfo & dt) > 0;
444
+ }
445
+ /**
446
+ Tells you whether the token before the mapped position was deleted.
447
+ */
448
+ get deletedBefore() {
449
+ return (this.delInfo & (pt | q)) > 0;
450
+ }
451
+ /**
452
+ True when the token after the mapped position was deleted.
453
+ */
454
+ get deletedAfter() {
455
+ return (this.delInfo & (mt | q)) > 0;
456
+ }
457
+ /**
458
+ Tells whether any of the steps mapped through deletes across the
459
+ position (including both the token before and after the
460
+ position).
461
+ */
462
+ get deletedAcross() {
463
+ return (this.delInfo & q) > 0;
464
+ }
465
+ }, v = class N {
466
+ /**
467
+ Create a position map. The modifications to the document are
468
+ represented as an array of numbers, in which each group of three
469
+ represents a modified chunk as `[start, oldSize, newSize]`.
470
+ */
471
+ constructor(t, e = !1) {
472
+ if (this.ranges = t, this.inverted = e, !t.length && N.empty)
473
+ return N.empty;
474
+ }
475
+ /**
476
+ @internal
477
+ */
478
+ recover(t) {
479
+ let e = 0, r = _(t);
480
+ if (!this.inverted)
481
+ for (let i = 0; i < r; i++)
482
+ e += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
483
+ return this.ranges[r * 3] + e + bt(t);
484
+ }
485
+ mapResult(t, e = 1) {
486
+ return this._map(t, e, !1);
487
+ }
488
+ map(t, e = 1) {
489
+ return this._map(t, e, !0);
490
+ }
491
+ /**
492
+ @internal
493
+ */
494
+ _map(t, e, r) {
495
+ let i = 0, s = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
496
+ for (let a = 0; a < this.ranges.length; a += 3) {
497
+ let l = this.ranges[a] - (this.inverted ? i : 0);
498
+ if (l > t)
499
+ break;
500
+ let u = this.ranges[a + s], h = this.ranges[a + o], f = l + u;
501
+ if (t <= f) {
502
+ let k = u ? t == l ? -1 : t == f ? 1 : e : e, E = l + i + (k < 0 ? 0 : h);
503
+ if (r)
504
+ return E;
505
+ let y = t == (e < 0 ? l : f) ? null : Mt(a / 3, t - l), Y = t == l ? mt : t == f ? pt : q;
506
+ return (e < 0 ? t != l : t != f) && (Y |= dt), new tt(E, Y, y);
507
+ }
508
+ i += h - u;
509
+ }
510
+ return r ? t + i : new tt(t + i, 0, null);
511
+ }
512
+ /**
513
+ @internal
514
+ */
515
+ touches(t, e) {
516
+ let r = 0, i = _(e), s = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
517
+ for (let a = 0; a < this.ranges.length; a += 3) {
518
+ let l = this.ranges[a] - (this.inverted ? r : 0);
519
+ if (l > t)
520
+ break;
521
+ let u = this.ranges[a + s], h = l + u;
522
+ if (t <= h && a == i * 3)
523
+ return !0;
524
+ r += this.ranges[a + o] - u;
525
+ }
526
+ return !1;
527
+ }
528
+ /**
529
+ Calls the given function on each of the changed ranges included in
530
+ this map.
531
+ */
532
+ forEach(t) {
533
+ let e = this.inverted ? 2 : 1, r = this.inverted ? 1 : 2;
534
+ for (let i = 0, s = 0; i < this.ranges.length; i += 3) {
535
+ let o = this.ranges[i], a = o - (this.inverted ? s : 0), l = o + (this.inverted ? 0 : s), u = this.ranges[i + e], h = this.ranges[i + r];
536
+ t(a, a + u, l, l + h), s += h - u;
537
+ }
538
+ }
539
+ /**
540
+ Create an inverted version of this map. The result can be used to
541
+ map positions in the post-step document to the pre-step document.
542
+ */
543
+ invert() {
544
+ return new N(this.ranges, !this.inverted);
545
+ }
546
+ /**
547
+ @internal
548
+ */
549
+ toString() {
550
+ return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
551
+ }
552
+ /**
553
+ Create a map that moves all positions by offset `n` (which may be
554
+ negative). This can be useful when applying steps meant for a
555
+ sub-document to a larger document, or vice-versa.
556
+ */
557
+ static offset(t) {
558
+ return t == 0 ? N.empty : new N(t < 0 ? [0, -t, 0] : [0, 0, t]);
559
+ }
560
+ };
561
+ v.empty = new v([]);
562
+ var K = /* @__PURE__ */ Object.create(null), m = class {
563
+ /**
564
+ Get the step map that represents the changes made by this step,
565
+ and which can be used to transform between positions in the old
566
+ and the new document.
567
+ */
568
+ getMap() {
569
+ return v.empty;
570
+ }
571
+ /**
572
+ Try to merge this step with another one, to be applied directly
573
+ after it. Returns the merged step when possible, null if the
574
+ steps can't be merged.
575
+ */
576
+ merge(n) {
577
+ return null;
578
+ }
579
+ /**
580
+ Deserialize a step from its JSON representation. Will call
581
+ through to the step class' own implementation of this method.
582
+ */
583
+ static fromJSON(n, t) {
584
+ if (!t || !t.stepType)
585
+ throw new RangeError("Invalid input for Step.fromJSON");
586
+ let e = K[t.stepType];
587
+ if (!e)
588
+ throw new RangeError(`No step type ${t.stepType} defined`);
589
+ return e.fromJSON(n, t);
590
+ }
591
+ /**
592
+ To be able to serialize steps to JSON, each step needs a string
593
+ ID to attach to its JSON representation. Use this method to
594
+ register an ID for your step classes. Try to pick something
595
+ that's unlikely to clash with steps from other modules.
596
+ */
597
+ static jsonID(n, t) {
598
+ if (n in K)
599
+ throw new RangeError("Duplicate use of step JSON ID " + n);
600
+ return K[n] = t, t.prototype.jsonID = n, t;
601
+ }
602
+ }, S = class T {
603
+ /**
604
+ @internal
605
+ */
606
+ constructor(t, e) {
607
+ this.doc = t, this.failed = e;
608
+ }
609
+ /**
610
+ Create a successful step result.
611
+ */
612
+ static ok(t) {
613
+ return new T(t, null);
614
+ }
615
+ /**
616
+ Create a failed step result.
617
+ */
618
+ static fail(t) {
619
+ return new T(null, t);
620
+ }
621
+ /**
622
+ Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
623
+ arguments. Create a successful result if it succeeds, and a
624
+ failed one if it throws a `ReplaceError`.
625
+ */
626
+ static fromReplace(t, e, r, i) {
627
+ try {
628
+ return T.ok(t.replace(e, r, i));
629
+ } catch (s) {
630
+ if (s instanceof Jt)
631
+ return T.fail(s.message);
632
+ throw s;
633
+ }
634
+ }
635
+ };
636
+ function U(n, t, e) {
637
+ let r = [];
638
+ for (let i = 0; i < n.childCount; i++) {
639
+ let s = n.child(i);
640
+ s.content.size && (s = s.copy(U(s.content, t, s))), s.isInline && (s = t(s, e, i)), r.push(s);
641
+ }
642
+ return g.fromArray(r);
643
+ }
644
+ var St = class I extends m {
645
+ /**
646
+ Create a mark step.
647
+ */
648
+ constructor(t, e, r) {
649
+ super(), this.from = t, this.to = e, this.mark = r;
650
+ }
651
+ apply(t) {
652
+ let e = t.slice(this.from, this.to), r = t.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new c(U(e.content, (o, a) => !o.isAtom || !a.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), i), e.openStart, e.openEnd);
653
+ return S.fromReplace(t, this.from, this.to, s);
654
+ }
655
+ invert() {
656
+ return new gt(this.from, this.to, this.mark);
657
+ }
658
+ map(t) {
659
+ let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
660
+ return e.deleted && r.deleted || e.pos >= r.pos ? null : new I(e.pos, r.pos, this.mark);
661
+ }
662
+ merge(t) {
663
+ return t instanceof I && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new I(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
664
+ }
665
+ toJSON() {
666
+ return {
667
+ stepType: "addMark",
668
+ mark: this.mark.toJSON(),
669
+ from: this.from,
670
+ to: this.to
671
+ };
672
+ }
673
+ /**
674
+ @internal
675
+ */
676
+ static fromJSON(t, e) {
677
+ if (typeof e.from != "number" || typeof e.to != "number")
678
+ throw new RangeError("Invalid input for AddMarkStep.fromJSON");
679
+ return new I(e.from, e.to, t.markFromJSON(e.mark));
680
+ }
681
+ };
682
+ m.jsonID("addMark", St);
683
+ var gt = class z extends m {
684
+ /**
685
+ Create a mark-removing step.
686
+ */
687
+ constructor(t, e, r) {
688
+ super(), this.from = t, this.to = e, this.mark = r;
689
+ }
690
+ apply(t) {
691
+ let e = t.slice(this.from, this.to), r = new c(U(e.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), t), e.openStart, e.openEnd);
692
+ return S.fromReplace(t, this.from, this.to, r);
693
+ }
694
+ invert() {
695
+ return new St(this.from, this.to, this.mark);
696
+ }
697
+ map(t) {
698
+ let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
699
+ return e.deleted && r.deleted || e.pos >= r.pos ? null : new z(e.pos, r.pos, this.mark);
700
+ }
701
+ merge(t) {
702
+ return t instanceof z && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new z(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
703
+ }
704
+ toJSON() {
705
+ return {
706
+ stepType: "removeMark",
707
+ mark: this.mark.toJSON(),
708
+ from: this.from,
709
+ to: this.to
710
+ };
711
+ }
712
+ /**
713
+ @internal
714
+ */
715
+ static fromJSON(t, e) {
716
+ if (typeof e.from != "number" || typeof e.to != "number")
717
+ throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
718
+ return new z(e.from, e.to, t.markFromJSON(e.mark));
719
+ }
720
+ };
721
+ m.jsonID("removeMark", gt);
722
+ var wt = class J extends m {
723
+ /**
724
+ Create a node mark step.
725
+ */
726
+ constructor(t, e) {
727
+ super(), this.pos = t, this.mark = e;
728
+ }
729
+ apply(t) {
730
+ let e = t.nodeAt(this.pos);
731
+ if (!e)
732
+ return S.fail("No node at mark step's position");
733
+ let r = e.type.create(e.attrs, null, this.mark.addToSet(e.marks));
734
+ return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(r), 0, e.isLeaf ? 0 : 1));
735
+ }
736
+ invert(t) {
737
+ let e = t.nodeAt(this.pos);
738
+ if (e) {
739
+ let r = this.mark.addToSet(e.marks);
740
+ if (r.length == e.marks.length) {
741
+ for (let i = 0; i < e.marks.length; i++)
742
+ if (!e.marks[i].isInSet(r))
743
+ return new J(this.pos, e.marks[i]);
744
+ return new J(this.pos, this.mark);
745
+ }
746
+ }
747
+ return new kt(this.pos, this.mark);
748
+ }
749
+ map(t) {
750
+ let e = t.mapResult(this.pos, 1);
751
+ return e.deletedAfter ? null : new J(e.pos, this.mark);
752
+ }
753
+ toJSON() {
754
+ return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
755
+ }
756
+ /**
757
+ @internal
758
+ */
759
+ static fromJSON(t, e) {
760
+ if (typeof e.pos != "number")
761
+ throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
762
+ return new J(e.pos, t.markFromJSON(e.mark));
763
+ }
764
+ };
765
+ m.jsonID("addNodeMark", wt);
766
+ var kt = class V extends m {
767
+ /**
768
+ Create a mark-removing step.
769
+ */
770
+ constructor(t, e) {
771
+ super(), this.pos = t, this.mark = e;
772
+ }
773
+ apply(t) {
774
+ let e = t.nodeAt(this.pos);
775
+ if (!e)
776
+ return S.fail("No node at mark step's position");
777
+ let r = e.type.create(e.attrs, null, this.mark.removeFromSet(e.marks));
778
+ return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(r), 0, e.isLeaf ? 0 : 1));
779
+ }
780
+ invert(t) {
781
+ let e = t.nodeAt(this.pos);
782
+ return !e || !this.mark.isInSet(e.marks) ? this : new wt(this.pos, this.mark);
783
+ }
784
+ map(t) {
785
+ let e = t.mapResult(this.pos, 1);
786
+ return e.deletedAfter ? null : new V(e.pos, this.mark);
787
+ }
788
+ toJSON() {
789
+ return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
790
+ }
791
+ /**
792
+ @internal
793
+ */
794
+ static fromJSON(t, e) {
795
+ if (typeof e.pos != "number")
796
+ throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
797
+ return new V(e.pos, t.markFromJSON(e.mark));
798
+ }
799
+ };
800
+ m.jsonID("removeNodeMark", kt);
801
+ var X = class w extends m {
802
+ /**
803
+ The given `slice` should fit the 'gap' between `from` and
804
+ `to`—the depths must line up, and the surrounding nodes must be
805
+ able to be joined with the open sides of the slice. When
806
+ `structure` is true, the step will fail if the content between
807
+ from and to is not just a sequence of closing and then opening
808
+ tokens (this is to guard against rebased replace steps
809
+ overwriting something they weren't supposed to).
810
+ */
811
+ constructor(t, e, r, i = !1) {
812
+ super(), this.from = t, this.to = e, this.slice = r, this.structure = i;
813
+ }
814
+ apply(t) {
815
+ return this.structure && G(t, this.from, this.to) ? S.fail("Structure replace would overwrite content") : S.fromReplace(t, this.from, this.to, this.slice);
816
+ }
817
+ getMap() {
818
+ return new v([this.from, this.to - this.from, this.slice.size]);
819
+ }
820
+ invert(t) {
821
+ return new w(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
822
+ }
823
+ map(t) {
824
+ let e = t.mapResult(this.to, -1), r = this.from == this.to && w.MAP_BIAS < 0 ? e : t.mapResult(this.from, 1);
825
+ return r.deletedAcross && e.deletedAcross ? null : new w(r.pos, Math.max(r.pos, e.pos), this.slice, this.structure);
826
+ }
827
+ merge(t) {
828
+ if (!(t instanceof w) || t.structure || this.structure)
829
+ return null;
830
+ if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
831
+ let e = this.slice.size + t.slice.size == 0 ? c.empty : new c(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
832
+ return new w(this.from, this.to + (t.to - t.from), e, this.structure);
833
+ } else if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
834
+ let e = this.slice.size + t.slice.size == 0 ? c.empty : new c(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
835
+ return new w(t.from, this.to, e, this.structure);
836
+ } else
837
+ return null;
838
+ }
839
+ toJSON() {
840
+ let t = { stepType: "replace", from: this.from, to: this.to };
841
+ return this.slice.size && (t.slice = this.slice.toJSON()), this.structure && (t.structure = !0), t;
842
+ }
843
+ /**
844
+ @internal
845
+ */
846
+ static fromJSON(t, e) {
847
+ if (typeof e.from != "number" || typeof e.to != "number")
848
+ throw new RangeError("Invalid input for ReplaceStep.fromJSON");
849
+ return new w(e.from, e.to, c.fromJSON(t, e.slice), !!e.structure);
850
+ }
851
+ };
852
+ X.MAP_BIAS = 1;
853
+ m.jsonID("replace", X);
854
+ var vt = class L extends m {
855
+ /**
856
+ Create a replace-around step with the given range and gap.
857
+ `insert` should be the point in the slice into which the content
858
+ of the gap should be moved. `structure` has the same meaning as
859
+ it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
860
+ */
861
+ constructor(t, e, r, i, s, o, a = !1) {
862
+ super(), this.from = t, this.to = e, this.gapFrom = r, this.gapTo = i, this.slice = s, this.insert = o, this.structure = a;
863
+ }
864
+ apply(t) {
865
+ if (this.structure && (G(t, this.from, this.gapFrom) || G(t, this.gapTo, this.to)))
866
+ return S.fail("Structure gap-replace would overwrite content");
867
+ let e = t.slice(this.gapFrom, this.gapTo);
868
+ if (e.openStart || e.openEnd)
869
+ return S.fail("Gap is not a flat range");
870
+ let r = this.slice.insertAt(this.insert, e.content);
871
+ return r ? S.fromReplace(t, this.from, this.to, r) : S.fail("Content does not fit in gap");
872
+ }
873
+ getMap() {
874
+ return new v([
875
+ this.from,
876
+ this.gapFrom - this.from,
877
+ this.insert,
878
+ this.gapTo,
879
+ this.to - this.gapTo,
880
+ this.slice.size - this.insert
881
+ ]);
882
+ }
883
+ invert(t) {
884
+ let e = this.gapTo - this.gapFrom;
885
+ return new L(this.from, this.from + this.slice.size + e, this.from + this.insert, this.from + this.insert + e, t.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
886
+ }
887
+ map(t) {
888
+ let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1), i = this.from == this.gapFrom ? e.pos : t.map(this.gapFrom, -1), s = this.to == this.gapTo ? r.pos : t.map(this.gapTo, 1);
889
+ return e.deletedAcross && r.deletedAcross || i < e.pos || s > r.pos ? null : new L(e.pos, r.pos, i, s, this.slice, this.insert, this.structure);
890
+ }
891
+ toJSON() {
892
+ let t = {
893
+ stepType: "replaceAround",
894
+ from: this.from,
895
+ to: this.to,
896
+ gapFrom: this.gapFrom,
897
+ gapTo: this.gapTo,
898
+ insert: this.insert
899
+ };
900
+ return this.slice.size && (t.slice = this.slice.toJSON()), this.structure && (t.structure = !0), t;
901
+ }
902
+ /**
903
+ @internal
904
+ */
905
+ static fromJSON(t, e) {
906
+ if (typeof e.from != "number" || typeof e.to != "number" || typeof e.gapFrom != "number" || typeof e.gapTo != "number" || typeof e.insert != "number")
907
+ throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
908
+ return new L(e.from, e.to, e.gapFrom, e.gapTo, c.fromJSON(t, e.slice), e.insert, !!e.structure);
909
+ }
910
+ };
911
+ m.jsonID("replaceAround", vt);
912
+ function G(n, t, e) {
913
+ let r = n.resolve(t), i = e - t, s = r.depth;
914
+ for (; i > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
915
+ s--, i--;
916
+ if (i > 0) {
917
+ let o = r.node(s).maybeChild(r.indexAfter(s));
918
+ for (; i > 0; ) {
919
+ if (!o || o.isLeaf)
920
+ return !0;
921
+ o = o.firstChild, i--;
922
+ }
923
+ }
924
+ return !1;
925
+ }
926
+ var Ct = class P extends m {
927
+ /**
928
+ Construct an attribute step.
929
+ */
930
+ constructor(t, e, r) {
931
+ super(), this.pos = t, this.attr = e, this.value = r;
932
+ }
933
+ apply(t) {
934
+ let e = t.nodeAt(this.pos);
935
+ if (!e)
936
+ return S.fail("No node at attribute step's position");
937
+ let r = /* @__PURE__ */ Object.create(null);
938
+ for (let s in e.attrs)
939
+ r[s] = e.attrs[s];
940
+ r[this.attr] = this.value;
941
+ let i = e.type.create(r, null, e.marks);
942
+ return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(i), 0, e.isLeaf ? 0 : 1));
943
+ }
944
+ getMap() {
945
+ return v.empty;
946
+ }
947
+ invert(t) {
948
+ return new P(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
949
+ }
950
+ map(t) {
951
+ let e = t.mapResult(this.pos, 1);
952
+ return e.deletedAfter ? null : new P(e.pos, this.attr, this.value);
953
+ }
954
+ toJSON() {
955
+ return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
956
+ }
957
+ static fromJSON(t, e) {
958
+ if (typeof e.pos != "number" || typeof e.attr != "string")
959
+ throw new RangeError("Invalid input for AttrStep.fromJSON");
960
+ return new P(e.pos, e.attr, e.value);
961
+ }
962
+ };
963
+ m.jsonID("attr", Ct);
964
+ var Bt = class Q extends m {
965
+ /**
966
+ Construct an attribute step.
967
+ */
968
+ constructor(t, e) {
969
+ super(), this.attr = t, this.value = e;
970
+ }
971
+ apply(t) {
972
+ let e = /* @__PURE__ */ Object.create(null);
973
+ for (let i in t.attrs)
974
+ e[i] = t.attrs[i];
975
+ e[this.attr] = this.value;
976
+ let r = t.type.create(e, t.content, t.marks);
977
+ return S.ok(r);
978
+ }
979
+ getMap() {
980
+ return v.empty;
981
+ }
982
+ invert(t) {
983
+ return new Q(this.attr, t.attrs[this.attr]);
984
+ }
985
+ map(t) {
986
+ return this;
987
+ }
988
+ toJSON() {
989
+ return { stepType: "docAttr", attr: this.attr, value: this.value };
990
+ }
991
+ static fromJSON(t, e) {
992
+ if (typeof e.attr != "string")
993
+ throw new RangeError("Invalid input for DocAttrStep.fromJSON");
994
+ return new Q(e.attr, e.value);
995
+ }
996
+ };
997
+ m.jsonID("docAttr", Bt);
998
+ var B = class extends Error {
999
+ };
1000
+ B = function n(t) {
1001
+ let e = Error.call(this, t);
1002
+ return e.__proto__ = n.prototype, e;
1003
+ };
1004
+ B.prototype = Object.create(Error.prototype);
1005
+ B.prototype.constructor = B;
1006
+ B.prototype.name = "TransformError";
1007
+ var W = /* @__PURE__ */ Object.create(null), p = class {
1008
+ /**
1009
+ Initialize a selection with the head and anchor and ranges. If no
1010
+ ranges are given, constructs a single range across `$anchor` and
1011
+ `$head`.
1012
+ */
1013
+ constructor(n, t, e) {
1014
+ this.$anchor = n, this.$head = t, this.ranges = e || [new Ft(n.min(t), n.max(t))];
1015
+ }
1016
+ /**
1017
+ The selection's anchor, as an unresolved position.
1018
+ */
1019
+ get anchor() {
1020
+ return this.$anchor.pos;
1021
+ }
1022
+ /**
1023
+ The selection's head.
1024
+ */
1025
+ get head() {
1026
+ return this.$head.pos;
1027
+ }
1028
+ /**
1029
+ The lower bound of the selection's main range.
1030
+ */
1031
+ get from() {
1032
+ return this.$from.pos;
1033
+ }
1034
+ /**
1035
+ The upper bound of the selection's main range.
1036
+ */
1037
+ get to() {
1038
+ return this.$to.pos;
1039
+ }
1040
+ /**
1041
+ The resolved lower bound of the selection's main range.
1042
+ */
1043
+ get $from() {
1044
+ return this.ranges[0].$from;
1045
+ }
1046
+ /**
1047
+ The resolved upper bound of the selection's main range.
1048
+ */
1049
+ get $to() {
1050
+ return this.ranges[0].$to;
1051
+ }
1052
+ /**
1053
+ Indicates whether the selection contains any content.
1054
+ */
1055
+ get empty() {
1056
+ let n = this.ranges;
1057
+ for (let t = 0; t < n.length; t++)
1058
+ if (n[t].$from.pos != n[t].$to.pos)
1059
+ return !1;
1060
+ return !0;
1061
+ }
1062
+ /**
1063
+ Get the content of this selection as a slice.
1064
+ */
1065
+ content() {
1066
+ return this.$from.doc.slice(this.from, this.to, !0);
1067
+ }
1068
+ /**
1069
+ Replace the selection with a slice or, if no slice is given,
1070
+ delete the selection. Will append to the given transaction.
1071
+ */
1072
+ replace(n, t = c.empty) {
1073
+ let e = t.content.lastChild, r = null;
1074
+ for (let o = 0; o < t.openEnd; o++)
1075
+ r = e, e = e.lastChild;
1076
+ let i = n.steps.length, s = this.ranges;
1077
+ for (let o = 0; o < s.length; o++) {
1078
+ let { $from: a, $to: l } = s[o], u = n.mapping.slice(i);
1079
+ n.replaceRange(u.map(a.pos), u.map(l.pos), o ? c.empty : t), o == 0 && nt(n, i, (e ? e.isInline : r && r.isTextblock) ? -1 : 1);
1080
+ }
1081
+ }
1082
+ /**
1083
+ Replace the selection with the given node, appending the changes
1084
+ to the given transaction.
1085
+ */
1086
+ replaceWith(n, t) {
1087
+ let e = n.steps.length, r = this.ranges;
1088
+ for (let i = 0; i < r.length; i++) {
1089
+ let { $from: s, $to: o } = r[i], a = n.mapping.slice(e), l = a.map(s.pos), u = a.map(o.pos);
1090
+ i ? n.deleteRange(l, u) : (n.replaceRangeWith(l, u, t), nt(n, e, t.isInline ? -1 : 1));
1091
+ }
1092
+ }
1093
+ /**
1094
+ Find a valid cursor or leaf node selection starting at the given
1095
+ position and searching back if `dir` is negative, and forward if
1096
+ positive. When `textOnly` is true, only consider cursor
1097
+ selections. Will return null when no valid selection position is
1098
+ found.
1099
+ */
1100
+ static findFrom(n, t, e = !1) {
1101
+ let r = n.parent.inlineContent ? new A(n) : R(n.node(0), n.parent, n.pos, n.index(), t, e);
1102
+ if (r)
1103
+ return r;
1104
+ for (let i = n.depth - 1; i >= 0; i--) {
1105
+ let s = t < 0 ? R(n.node(0), n.node(i), n.before(i + 1), n.index(i), t, e) : R(n.node(0), n.node(i), n.after(i + 1), n.index(i) + 1, t, e);
1106
+ if (s)
1107
+ return s;
1108
+ }
1109
+ return null;
1110
+ }
1111
+ /**
1112
+ Find a valid cursor or leaf node selection near the given
1113
+ position. Searches forward first by default, but if `bias` is
1114
+ negative, it will search backwards first.
1115
+ */
1116
+ static near(n, t = 1) {
1117
+ return this.findFrom(n, t) || this.findFrom(n, -t) || new C(n.node(0));
1118
+ }
1119
+ /**
1120
+ Find the cursor or leaf node selection closest to the start of
1121
+ the given document. Will return an
1122
+ [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
1123
+ exists.
1124
+ */
1125
+ static atStart(n) {
1126
+ return R(n, n, 0, 0, 1) || new C(n);
1127
+ }
1128
+ /**
1129
+ Find the cursor or leaf node selection closest to the end of the
1130
+ given document.
1131
+ */
1132
+ static atEnd(n) {
1133
+ return R(n, n, n.content.size, n.childCount, -1) || new C(n);
1134
+ }
1135
+ /**
1136
+ Deserialize the JSON representation of a selection. Must be
1137
+ implemented for custom classes (as a static class method).
1138
+ */
1139
+ static fromJSON(n, t) {
1140
+ if (!t || !t.type)
1141
+ throw new RangeError("Invalid input for Selection.fromJSON");
1142
+ let e = W[t.type];
1143
+ if (!e)
1144
+ throw new RangeError(`No selection type ${t.type} defined`);
1145
+ return e.fromJSON(n, t);
1146
+ }
1147
+ /**
1148
+ To be able to deserialize selections from JSON, custom selection
1149
+ classes must register themselves with an ID string, so that they
1150
+ can be disambiguated. Try to pick something that's unlikely to
1151
+ clash with classes from other modules.
1152
+ */
1153
+ static jsonID(n, t) {
1154
+ if (n in W)
1155
+ throw new RangeError("Duplicate use of selection JSON ID " + n);
1156
+ return W[n] = t, t.prototype.jsonID = n, t;
1157
+ }
1158
+ /**
1159
+ Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
1160
+ which is a value that can be mapped without having access to a
1161
+ current document, and later resolved to a real selection for a
1162
+ given document again. (This is used mostly by the history to
1163
+ track and restore old selections.) The default implementation of
1164
+ this method just converts the selection to a text selection and
1165
+ returns the bookmark for that.
1166
+ */
1167
+ getBookmark() {
1168
+ return A.between(this.$anchor, this.$head).getBookmark();
1169
+ }
1170
+ };
1171
+ p.prototype.visible = !0;
1172
+ var Ft = class {
1173
+ /**
1174
+ Create a range.
1175
+ */
1176
+ constructor(n, t) {
1177
+ this.$from = n, this.$to = t;
1178
+ }
1179
+ }, et = !1;
1180
+ function rt(n) {
1181
+ !et && !n.parent.inlineContent && (et = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
1182
+ }
1183
+ var A = class M extends p {
1184
+ /**
1185
+ Construct a text selection between the given points.
1186
+ */
1187
+ constructor(t, e = t) {
1188
+ rt(t), rt(e), super(t, e);
1189
+ }
1190
+ /**
1191
+ Returns a resolved position if this is a cursor selection (an
1192
+ empty text selection), and null otherwise.
1193
+ */
1194
+ get $cursor() {
1195
+ return this.$anchor.pos == this.$head.pos ? this.$head : null;
1196
+ }
1197
+ map(t, e) {
1198
+ let r = t.resolve(e.map(this.head));
1199
+ if (!r.parent.inlineContent)
1200
+ return p.near(r);
1201
+ let i = t.resolve(e.map(this.anchor));
1202
+ return new M(i.parent.inlineContent ? i : r, r);
1203
+ }
1204
+ replace(t, e = c.empty) {
1205
+ if (super.replace(t, e), e == c.empty) {
1206
+ let r = this.$from.marksAcross(this.$to);
1207
+ r && t.ensureMarks(r);
1208
+ }
1209
+ }
1210
+ eq(t) {
1211
+ return t instanceof M && t.anchor == this.anchor && t.head == this.head;
1212
+ }
1213
+ getBookmark() {
1214
+ return new yt(this.anchor, this.head);
1215
+ }
1216
+ toJSON() {
1217
+ return { type: "text", anchor: this.anchor, head: this.head };
1218
+ }
1219
+ /**
1220
+ @internal
1221
+ */
1222
+ static fromJSON(t, e) {
1223
+ if (typeof e.anchor != "number" || typeof e.head != "number")
1224
+ throw new RangeError("Invalid input for TextSelection.fromJSON");
1225
+ return new M(t.resolve(e.anchor), t.resolve(e.head));
1226
+ }
1227
+ /**
1228
+ Create a text selection from non-resolved positions.
1229
+ */
1230
+ static create(t, e, r = e) {
1231
+ let i = t.resolve(e);
1232
+ return new this(i, r == e ? i : t.resolve(r));
1233
+ }
1234
+ /**
1235
+ Return a text selection that spans the given positions or, if
1236
+ they aren't text positions, find a text selection near them.
1237
+ `bias` determines whether the method searches forward (default)
1238
+ or backwards (negative number) first. Will fall back to calling
1239
+ [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
1240
+ doesn't contain a valid text position.
1241
+ */
1242
+ static between(t, e, r) {
1243
+ let i = t.pos - e.pos;
1244
+ if ((!r || i) && (r = i >= 0 ? 1 : -1), !e.parent.inlineContent) {
1245
+ let s = p.findFrom(e, r, !0) || p.findFrom(e, -r, !0);
1246
+ if (s)
1247
+ e = s.$head;
1248
+ else
1249
+ return p.near(e, r);
1250
+ }
1251
+ return t.parent.inlineContent || (i == 0 ? t = e : (t = (p.findFrom(t, -r, !0) || p.findFrom(t, r, !0)).$anchor, t.pos < e.pos != i < 0 && (t = e))), new M(t, e);
1252
+ }
1253
+ };
1254
+ p.jsonID("text", A);
1255
+ var yt = class xt {
1256
+ constructor(t, e) {
1257
+ this.anchor = t, this.head = e;
1258
+ }
1259
+ map(t) {
1260
+ return new xt(t.map(this.anchor), t.map(this.head));
1261
+ }
1262
+ resolve(t) {
1263
+ return A.between(t.resolve(this.anchor), t.resolve(this.head));
1264
+ }
1265
+ }, O = class b extends p {
1266
+ /**
1267
+ Create a node selection. Does not verify the validity of its
1268
+ argument.
1269
+ */
1270
+ constructor(t) {
1271
+ let e = t.nodeAfter, r = t.node(0).resolve(t.pos + e.nodeSize);
1272
+ super(t, r), this.node = e;
1273
+ }
1274
+ map(t, e) {
1275
+ let { deleted: r, pos: i } = e.mapResult(this.anchor), s = t.resolve(i);
1276
+ return r ? p.near(s) : new b(s);
1277
+ }
1278
+ content() {
1279
+ return new c(g.from(this.node), 0, 0);
1280
+ }
1281
+ eq(t) {
1282
+ return t instanceof b && t.anchor == this.anchor;
1283
+ }
1284
+ toJSON() {
1285
+ return { type: "node", anchor: this.anchor };
1286
+ }
1287
+ getBookmark() {
1288
+ return new Dt(this.anchor);
1289
+ }
1290
+ /**
1291
+ @internal
1292
+ */
1293
+ static fromJSON(t, e) {
1294
+ if (typeof e.anchor != "number")
1295
+ throw new RangeError("Invalid input for NodeSelection.fromJSON");
1296
+ return new b(t.resolve(e.anchor));
1297
+ }
1298
+ /**
1299
+ Create a node selection from non-resolved positions.
1300
+ */
1301
+ static create(t, e) {
1302
+ return new b(t.resolve(e));
1303
+ }
1304
+ /**
1305
+ Determines whether the given node may be selected as a node
1306
+ selection.
1307
+ */
1308
+ static isSelectable(t) {
1309
+ return !t.isText && t.type.spec.selectable !== !1;
1310
+ }
1311
+ };
1312
+ O.prototype.visible = !1;
1313
+ p.jsonID("node", O);
1314
+ var Dt = class Nt {
1315
+ constructor(t) {
1316
+ this.anchor = t;
1317
+ }
1318
+ map(t) {
1319
+ let { deleted: e, pos: r } = t.mapResult(this.anchor);
1320
+ return e ? new yt(r, r) : new Nt(r);
1321
+ }
1322
+ resolve(t) {
1323
+ let e = t.resolve(this.anchor), r = e.nodeAfter;
1324
+ return r && O.isSelectable(r) ? new O(e) : p.near(e);
1325
+ }
1326
+ }, C = class H extends p {
1327
+ /**
1328
+ Create an all-selection over the given document.
1329
+ */
1330
+ constructor(t) {
1331
+ super(t.resolve(0), t.resolve(t.content.size));
1332
+ }
1333
+ replace(t, e = c.empty) {
1334
+ if (e == c.empty) {
1335
+ t.delete(0, t.doc.content.size);
1336
+ let r = p.atStart(t.doc);
1337
+ r.eq(t.selection) || t.setSelection(r);
1338
+ } else
1339
+ super.replace(t, e);
1340
+ }
1341
+ toJSON() {
1342
+ return { type: "all" };
1343
+ }
1344
+ /**
1345
+ @internal
1346
+ */
1347
+ static fromJSON(t) {
1348
+ return new H(t);
1349
+ }
1350
+ map(t) {
1351
+ return new H(t);
1352
+ }
1353
+ eq(t) {
1354
+ return t instanceof H;
1355
+ }
1356
+ getBookmark() {
1357
+ return qt;
1358
+ }
1359
+ };
1360
+ p.jsonID("all", C);
1361
+ var qt = {
1362
+ map() {
1363
+ return this;
1364
+ },
1365
+ resolve(n) {
1366
+ return new C(n);
1367
+ }
1368
+ };
1369
+ function R(n, t, e, r, i, s = !1) {
1370
+ if (t.inlineContent)
1371
+ return A.create(n, e);
1372
+ for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
1373
+ let a = t.child(o);
1374
+ if (a.isAtom) {
1375
+ if (!s && O.isSelectable(a))
1376
+ return O.create(n, e - (i < 0 ? a.nodeSize : 0));
1377
+ } else {
1378
+ let l = R(n, a, e + i, i < 0 ? a.childCount : 0, i, s);
1379
+ if (l)
1380
+ return l;
1381
+ }
1382
+ e += a.nodeSize * i;
1383
+ }
1384
+ return null;
1385
+ }
1386
+ function nt(n, t, e) {
1387
+ let r = n.steps.length - 1;
1388
+ if (r < t)
1389
+ return;
1390
+ let i = n.steps[r];
1391
+ if (!(i instanceof X || i instanceof vt))
1392
+ return;
1393
+ let s = n.mapping.maps[r], o;
1394
+ s.forEach((a, l, u, h) => {
1395
+ o == null && (o = h);
1396
+ }), n.setSelection(p.near(n.doc.resolve(o), e));
1397
+ }
1398
+ function it(n, t) {
1399
+ return !t || !n ? n : n.bind(t);
1400
+ }
1401
+ var D = class {
1402
+ constructor(n, t, e) {
1403
+ this.name = n, this.init = it(t.init, e), this.apply = it(t.apply, e);
1404
+ }
1405
+ };
1406
+ new D("doc", {
1407
+ init(n) {
1408
+ return n.doc || n.schema.topNodeType.createAndFill();
1409
+ },
1410
+ apply(n) {
1411
+ return n.doc;
1412
+ }
1413
+ }), new D("selection", {
1414
+ init(n, t) {
1415
+ return n.selection || p.atStart(t.doc);
1416
+ },
1417
+ apply(n) {
1418
+ return n.selection;
1419
+ }
1420
+ }), new D("storedMarks", {
1421
+ init(n) {
1422
+ return n.storedMarks || null;
1423
+ },
1424
+ apply(n, t, e, r) {
1425
+ return r.selection.$cursor ? n.storedMarks : null;
1426
+ }
1427
+ }), new D("scrollToSelection", {
1428
+ init() {
1429
+ return 0;
1430
+ },
1431
+ apply(n, t) {
1432
+ return n.scrolledIntoView ? t + 1 : t;
1433
+ }
1434
+ });
1435
+ var Lt = (n, t) => {
1436
+ var e;
1437
+ const { state: r, view: i } = n, { selection: s } = r;
1438
+ if (!s.empty) return !1;
1439
+ const { $from: o } = s;
1440
+ if (o.parentOffset !== 0) return !1;
1441
+ const a = o.depth - 1, l = o.node(a), u = o.index(a);
1442
+ if (u === 0) return !1;
1443
+ if (l.type === t)
1444
+ return n.commands.lift(t.name);
1445
+ const h = l.child(u - 1);
1446
+ if (h.type !== t || !((e = h.lastChild) != null && e.isTextblock))
1447
+ return !1;
1448
+ const f = o.before(), E = f - 1 - 1, { tr: y } = r;
1449
+ return y.delete(f, o.after()).insert(E, o.parent.content), y.setSelection(A.create(y.doc, E)), i.dispatch(y.scrollIntoView()), !0;
1450
+ }, Pt = /^\s*>\s$/, Ht = Rt.create({
8
1451
  name: "blockquote",
9
1452
  addOptions() {
10
1453
  return {
@@ -17,89 +1460,90 @@ var B = /^\s*>\s$/, A = k.create({
17
1460
  parseHTML() {
18
1461
  return [{ tag: "blockquote" }];
19
1462
  },
20
- renderHTML({ HTMLAttributes: t }) {
21
- return /* @__PURE__ */ p("blockquote", { ...g(this.options.HTMLAttributes, t), children: /* @__PURE__ */ p("slot", {}) });
1463
+ renderHTML({ HTMLAttributes: n }) {
1464
+ return /* @__PURE__ */ Z("blockquote", { ...Ot(this.options.HTMLAttributes, n), children: /* @__PURE__ */ Z("slot", {}) });
22
1465
  },
23
- parseMarkdown: (t, o) => {
1466
+ parseMarkdown: (n, t) => {
24
1467
  var e;
25
- const n = (e = o.parseBlockChildren) != null ? e : o.parseChildren;
26
- return o.createNode("blockquote", void 0, n(t.tokens || []));
1468
+ const r = (e = t.parseBlockChildren) != null ? e : t.parseChildren;
1469
+ return t.createNode("blockquote", void 0, r(n.tokens || []));
27
1470
  },
28
- renderMarkdown: (t, o) => {
29
- if (!t.content)
1471
+ renderMarkdown: (n, t) => {
1472
+ if (!n.content)
30
1473
  return "";
31
- const e = ">", n = [];
32
- return t.content.forEach((r, i) => {
33
- var s, c;
34
- const a = ((c = (s = o.renderChild) == null ? void 0 : s.call(o, r, i)) != null ? c : o.renderChildren([r])).split(`
35
- `).map((d) => d.trim() === "" ? e : `${e} ${d}`);
36
- n.push(a.join(`
1474
+ const e = ">", r = [];
1475
+ return n.content.forEach((i, s) => {
1476
+ var o, a;
1477
+ const h = ((a = (o = t.renderChild) == null ? void 0 : o.call(t, i, s)) != null ? a : t.renderChildren([i])).split(`
1478
+ `).map((f) => f.trim() === "" ? e : `${e} ${f}`);
1479
+ r.push(h.join(`
37
1480
  `));
38
- }), n.join(`
1481
+ }), r.join(`
39
1482
  ${e}
40
1483
  `);
41
1484
  },
42
1485
  addCommands() {
43
1486
  return {
44
- setBlockquote: () => ({ commands: t }) => t.wrapIn(this.name),
45
- toggleBlockquote: () => ({ commands: t }) => t.toggleWrap(this.name),
46
- unsetBlockquote: () => ({ commands: t }) => t.lift(this.name)
1487
+ setBlockquote: () => ({ commands: n }) => n.wrapIn(this.name),
1488
+ toggleBlockquote: () => ({ commands: n }) => n.toggleWrap(this.name),
1489
+ unsetBlockquote: () => ({ commands: n }) => n.lift(this.name)
47
1490
  };
48
1491
  },
49
1492
  addKeyboardShortcuts() {
50
1493
  return {
51
- "Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
1494
+ "Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
1495
+ Backspace: () => Lt(this.editor, this.type)
52
1496
  };
53
1497
  },
54
1498
  addInputRules() {
55
1499
  return [
56
- h({
57
- find: B,
1500
+ At({
1501
+ find: Pt,
58
1502
  type: this.type
59
1503
  })
60
1504
  ];
61
1505
  }
62
1506
  });
63
- function L() {
64
- const t = f(x.name), {
65
- icon: o = void 0,
1507
+ function Xt() {
1508
+ const n = Tt($t.name), {
1509
+ icon: t = void 0,
66
1510
  tooltip: e = void 0,
67
- shortcutKeys: n = void 0,
68
- tooltipOptions: r = {},
69
- action: i = void 0,
70
- isActive: s = void 0
71
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: u, update: l } = q(s), a = () => {
72
- u || i && (i(), l());
1511
+ shortcutKeys: r = void 0,
1512
+ tooltipOptions: i = {},
1513
+ action: s = void 0,
1514
+ isActive: o = void 0
1515
+ } = (n == null ? void 0 : n.componentProps) ?? {}, { dataState: a, disabled: l, update: u } = It(o), h = () => {
1516
+ l || s && (s(), u());
73
1517
  };
74
- return t ? /* @__PURE__ */ m(
75
- v,
1518
+ return n ? /* @__PURE__ */ j(
1519
+ zt,
76
1520
  {
77
- action: a,
78
- dataState: c,
79
- disabled: u,
80
- icon: o,
81
- shortcutKeys: n,
1521
+ action: h,
1522
+ dataState: a,
1523
+ disabled: l,
1524
+ icon: t,
1525
+ shortcutKeys: r,
82
1526
  tooltip: e,
83
- tooltipOptions: r
1527
+ tooltipOptions: i
84
1528
  }
85
- ) : /* @__PURE__ */ m(b, {});
1529
+ ) : /* @__PURE__ */ j(Et, {});
86
1530
  }
87
- const x = /* @__PURE__ */ A.extend({
1531
+ const $t = /* @__PURE__ */ Ht.extend({
88
1532
  //@ts-expect-error
89
1533
  addOptions() {
90
- var t;
1534
+ var n;
91
1535
  return {
92
- ...(t = this.parent) == null ? void 0 : t.call(this),
1536
+ ...(n = this.parent) == null ? void 0 : n.call(this),
93
1537
  HTMLAttributes: {
94
1538
  class: "blockquote"
95
1539
  },
96
- button: ({ editor: o, t: e, extension: n }) => ({
1540
+ button: ({ editor: t, t: e, extension: r }) => ({
97
1541
  componentProps: {
98
- action: () => o.commands.toggleBlockquote(),
99
- isActive: () => o.isActive("blockquote"),
100
- disabled: !o.can().toggleBlockquote(),
1542
+ action: () => t.commands.toggleBlockquote(),
1543
+ isActive: () => t.isActive("blockquote"),
1544
+ disabled: !t.can().toggleBlockquote(),
101
1545
  icon: "TextQuote",
102
- shortcutKeys: n.options.shortcutKeys ?? ["shift", "mod", "B"],
1546
+ shortcutKeys: r.options.shortcutKeys ?? ["shift", "mod", "B"],
103
1547
  tooltip: e("editor.blockquote.tooltip")
104
1548
  }
105
1549
  })
@@ -107,6 +1551,6 @@ const x = /* @__PURE__ */ A.extend({
107
1551
  }
108
1552
  });
109
1553
  export {
110
- x as Blockquote,
111
- L as RichTextBlockquote
1554
+ $t as Blockquote,
1555
+ Xt as RichTextBlockquote
112
1556
  };