@fewangsit/wangsvue 1.5.219-alpha.0 → 1.5.219-alpha.2

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 (598) hide show
  1. package/animation/index.es.js +54 -37
  2. package/assets/lottiejs/loading-page.es.js +14 -9
  3. package/assets/lottiejs/loading-plane.es.js +2 -2
  4. package/assets/lottiejs/loading-table.es.js +14 -9
  5. package/assets/lottiejs/no-data.es.js +14 -9
  6. package/backgroundimagecropper/index.es.js +61 -37
  7. package/badge/index.es.js +77 -67
  8. package/badgegroup/index.es.js +62 -50
  9. package/basecalendar/index.es.js +1258 -735
  10. package/basetree/index.es.js +213 -113
  11. package/breadcrumb/index.es.js +46 -38
  12. package/button/index.es.js +60 -54
  13. package/buttonbulkaction/index.es.js +168 -117
  14. package/buttoncopy/index.es.js +25 -22
  15. package/buttondownload/index.es.js +125 -76
  16. package/buttonfilter/index.es.js +21 -15
  17. package/buttonradio/index.es.js +91 -67
  18. package/buttonsearch/index.es.js +62 -46
  19. package/buttonselecttree/index.es.js +233 -172
  20. package/buttontoggle/index.es.js +8 -6
  21. package/calendar/index.es.js +113 -58
  22. package/card/index.es.js +44 -42
  23. package/checkbox/index.es.js +105 -74
  24. package/codesnippet/index.es.js +91 -71
  25. package/codesnippetadapter/index.es.js +25 -21
  26. package/columnlist/index.es.js +249 -171
  27. package/components.d.ts +0 -21
  28. package/config/defaultProps.es.js +9 -9
  29. package/config/index.es.js +11 -10
  30. package/config/locale.es.js +2 -2
  31. package/customcolumn/index.es.js +95 -78
  32. package/datatable/index.es.js +1071 -732
  33. package/dialog/index.es.js +54 -54
  34. package/dialogconfirm/index.es.js +90 -75
  35. package/dialogform/index.es.js +170 -133
  36. package/dialogselecttree/index.es.js +242 -194
  37. package/directives/focus.es.js +13 -8
  38. package/dropdown/index.es.js +250 -196
  39. package/editor/index.es.js +694 -498
  40. package/editorbutton/index.es.js +21 -19
  41. package/event-bus/index.es.js +3 -3
  42. package/event-bus/mitt.es.js +37 -20
  43. package/fieldwrapper/index.es.js +30 -25
  44. package/fileupload/index.es.js +230 -140
  45. package/filtercontainer/index.es.js +299 -222
  46. package/form/index.es.js +176 -126
  47. package/gallerypreview/index.es.js +138 -101
  48. package/icon/index.es.js +38 -36
  49. package/image/index.es.js +161 -108
  50. package/imagecompressor/index.es.js +616 -449
  51. package/imageinputinfo/index.es.js +26 -22
  52. package/inlinemessage/index.es.js +77 -65
  53. package/inputbadge/index.es.js +230 -156
  54. package/inputcurrency/index.es.js +146 -109
  55. package/inputemail/index.es.js +18 -16
  56. package/inputgroup/index.es.js +19 -16
  57. package/inputnumber/index.es.js +252 -182
  58. package/inputpassword/index.es.js +120 -94
  59. package/inputphonenumber/index.es.js +1017 -550
  60. package/inputrangenumber/index.es.js +129 -98
  61. package/inputtext/index.es.js +264 -189
  62. package/inputurl/index.es.js +31 -29
  63. package/invisiblefield/index.es.js +24 -16
  64. package/litedropdown/index.es.js +87 -81
  65. package/loading/index.es.js +21 -19
  66. package/loading-page-BXZ4fLOS.js +8 -0
  67. package/loading-page-BuLpsb_1.js +8 -0
  68. package/loading-page-CNqVBg__.js +4 -0
  69. package/loading-page-DbhhZih2.js +4 -0
  70. package/loading-page-DjfWXoOy.js +8 -0
  71. package/loading-page-S-KRY5zm.js +4 -0
  72. package/loading-plane-C1mi7Whv.js +4 -0
  73. package/loading-plane-CWq1hz_l.js +8 -0
  74. package/loading-table-B7LAXzAp.js +4 -0
  75. package/loading-table-BLmgKUsR.js +4 -0
  76. package/loading-table-CG7-cuhv.js +8 -0
  77. package/loading-table-CUPS49ta.js +4 -0
  78. package/loading-table-CuWWrTbv.js +8 -0
  79. package/loading-table-DbBzVwaZ.js +8 -0
  80. package/mentionlist/index.es.js +77 -44
  81. package/mentionsection/index.es.js +53 -43
  82. package/menu/index.es.js +65 -51
  83. package/menuitem/index.es.js +39 -37
  84. package/multirow/index.es.js +29 -28
  85. package/multiselect/index.es.js +184 -152
  86. package/no-data-B781skt3.js +4 -0
  87. package/no-data-CAksOnDl.js +4 -0
  88. package/no-data-DCsjBXQR.js +4 -0
  89. package/no-data-Dz0QOe7Q.js +8 -0
  90. package/no-data-_Huxiv9q.js +8 -0
  91. package/no-data-ybRQontJ.js +8 -0
  92. package/overlaypanel/index.es.js +49 -36
  93. package/package.json +1 -1
  94. package/paginator/index.es.js +36 -33
  95. package/plugins/WangsVue.es.js +63 -45
  96. package/plugins/formValidation.es.js +15 -11
  97. package/progressbar/index.es.js +39 -32
  98. package/quickfilter/index.es.js +94 -81
  99. package/stats.html +1 -1
  100. package/style.css +2 -2
  101. package/tabmenu/index.es.js +18 -16
  102. package/textarea/index.es.js +94 -72
  103. package/timeline/index.es.js +124 -102
  104. package/timelinecontentbytype/index.es.js +114 -92
  105. package/toast/index.es.js +67 -54
  106. package/toggleswitch/index.es.js +83 -66
  107. package/tree/index.es.js +306 -198
  108. package/treenode/index.es.js +464 -339
  109. package/treesearchinput/index.es.js +32 -26
  110. package/usergroup/index.es.js +83 -67
  111. package/username/index.es.js +99 -85
  112. package/utils/addAttachment.util.es.js +47 -21
  113. package/utils/baseToast.util.es.js +41 -33
  114. package/utils/convertJsonImage.util.es.js +24 -24
  115. package/utils/date.util.es.js +131 -106
  116. package/utils/exportToExcel.util.es.js +81 -47
  117. package/utils/filterOptions.util.es.js +8 -2
  118. package/utils/genPlaceholder.util.es.js +30 -16
  119. package/utils/getProjectPermission.util.es.js +15 -12
  120. package/utils/getSalesRole.util.es.js +4 -4
  121. package/utils/getUser.util.es.js +2 -2
  122. package/utils/getUserType.util.es.js +13 -8
  123. package/utils/isIntersect.es.js +4 -2
  124. package/utils/mergePropsWithDefaults.util.es.js +7 -6
  125. package/utils/object.util.es.js +88 -54
  126. package/utils/queryParamsStringfy.util.es.js +19 -11
  127. package/utils/role.util.es.js +5 -4
  128. package/utils/statusSeverity.util.es.js +20 -5
  129. package/utils/textFormatter.util.es.js +28 -50
  130. package/utils/toast.util.es.js +8 -5
  131. package/utils/xlsx.util.es.js +12 -6
  132. package/validatormessage/index.es.js +9 -9
  133. package/vendor/@popperjs/core/lib/createPopper.es.js +110 -83
  134. package/vendor/@popperjs/core/lib/dom-utils/contains.es.js +14 -13
  135. package/vendor/@popperjs/core/lib/dom-utils/getBoundingClientRect.es.js +33 -18
  136. package/vendor/@popperjs/core/lib/dom-utils/getClippingRect.es.js +55 -31
  137. package/vendor/@popperjs/core/lib/dom-utils/getCompositeRect.es.js +43 -22
  138. package/vendor/@popperjs/core/lib/dom-utils/getComputedStyle.es.js +4 -4
  139. package/vendor/@popperjs/core/lib/dom-utils/getDocumentElement.es.js +5 -5
  140. package/vendor/@popperjs/core/lib/dom-utils/getDocumentRect.es.js +23 -13
  141. package/vendor/@popperjs/core/lib/dom-utils/getHTMLElementScroll.es.js +4 -4
  142. package/vendor/@popperjs/core/lib/dom-utils/getLayoutRect.es.js +17 -9
  143. package/vendor/@popperjs/core/lib/dom-utils/getNodeName.es.js +3 -3
  144. package/vendor/@popperjs/core/lib/dom-utils/getNodeScroll.es.js +11 -7
  145. package/vendor/@popperjs/core/lib/dom-utils/getOffsetParent.es.js +42 -26
  146. package/vendor/@popperjs/core/lib/dom-utils/getParentNode.es.js +13 -10
  147. package/vendor/@popperjs/core/lib/dom-utils/getScrollParent.es.js +13 -7
  148. package/vendor/@popperjs/core/lib/dom-utils/getViewportRect.es.js +25 -15
  149. package/vendor/@popperjs/core/lib/dom-utils/getWindow.es.js +8 -7
  150. package/vendor/@popperjs/core/lib/dom-utils/getWindowScroll.es.js +8 -6
  151. package/vendor/@popperjs/core/lib/dom-utils/getWindowScrollBarX.es.js +6 -6
  152. package/vendor/@popperjs/core/lib/dom-utils/instanceOf.es.js +16 -15
  153. package/vendor/@popperjs/core/lib/dom-utils/isLayoutViewport.es.js +4 -4
  154. package/vendor/@popperjs/core/lib/dom-utils/isScrollParent.es.js +5 -5
  155. package/vendor/@popperjs/core/lib/dom-utils/isTableElement.es.js +4 -4
  156. package/vendor/@popperjs/core/lib/dom-utils/listScrollParents.es.js +17 -11
  157. package/vendor/@popperjs/core/lib/enums.es.js +43 -20
  158. package/vendor/@popperjs/core/lib/modifiers/applyStyles.es.js +49 -25
  159. package/vendor/@popperjs/core/lib/modifiers/arrow.es.js +61 -26
  160. package/vendor/@popperjs/core/lib/modifiers/computeStyles.es.js +101 -69
  161. package/vendor/@popperjs/core/lib/modifiers/eventListeners.es.js +30 -16
  162. package/vendor/@popperjs/core/lib/modifiers/flip.es.js +99 -60
  163. package/vendor/@popperjs/core/lib/modifiers/hide.es.js +44 -31
  164. package/vendor/@popperjs/core/lib/modifiers/offset.es.js +32 -20
  165. package/vendor/@popperjs/core/lib/modifiers/popperOffsets.es.js +11 -11
  166. package/vendor/@popperjs/core/lib/modifiers/preventOverflow.es.js +91 -40
  167. package/vendor/@popperjs/core/lib/popper.es.js +14 -13
  168. package/vendor/@popperjs/core/lib/utils/computeAutoPlacement.es.js +29 -21
  169. package/vendor/@popperjs/core/lib/utils/computeOffsets.es.js +41 -36
  170. package/vendor/@popperjs/core/lib/utils/debounce.es.js +11 -7
  171. package/vendor/@popperjs/core/lib/utils/detectOverflow.es.js +42 -28
  172. package/vendor/@popperjs/core/lib/utils/expandToHashMap.es.js +5 -4
  173. package/vendor/@popperjs/core/lib/utils/getAltAxis.es.js +3 -3
  174. package/vendor/@popperjs/core/lib/utils/getBasePlacement.es.js +3 -3
  175. package/vendor/@popperjs/core/lib/utils/getFreshSideObject.es.js +2 -2
  176. package/vendor/@popperjs/core/lib/utils/getMainAxisFromPlacement.es.js +3 -3
  177. package/vendor/@popperjs/core/lib/utils/getOppositePlacement.es.js +5 -5
  178. package/vendor/@popperjs/core/lib/utils/getOppositeVariationPlacement.es.js +5 -5
  179. package/vendor/@popperjs/core/lib/utils/getVariation.es.js +3 -3
  180. package/vendor/@popperjs/core/lib/utils/math.es.js +6 -4
  181. package/vendor/@popperjs/core/lib/utils/mergeByName.es.js +11 -10
  182. package/vendor/@popperjs/core/lib/utils/mergePaddingObject.es.js +4 -4
  183. package/vendor/@popperjs/core/lib/utils/orderModifiers.es.js +30 -22
  184. package/vendor/@popperjs/core/lib/utils/rectToClientRect.es.js +7 -7
  185. package/vendor/@popperjs/core/lib/utils/userAgent.es.js +9 -6
  186. package/vendor/@popperjs/core/lib/utils/within.es.js +8 -8
  187. package/vendor/@tiptap/core/dist/index.es.js +3494 -2000
  188. package/vendor/@tiptap/extension-bold/dist/index.es.js +29 -19
  189. package/vendor/@tiptap/extension-bubble-menu/dist/index.es.js +145 -71
  190. package/vendor/@tiptap/extension-bullet-list/dist/index.es.js +32 -19
  191. package/vendor/@tiptap/extension-code/dist/index.es.js +22 -14
  192. package/vendor/@tiptap/extension-document/dist/index.es.js +4 -4
  193. package/vendor/@tiptap/extension-floating-menu/dist/index.es.js +106 -51
  194. package/vendor/@tiptap/extension-heading/dist/index.es.js +38 -22
  195. package/vendor/@tiptap/extension-history/dist/index.es.js +11 -7
  196. package/vendor/@tiptap/extension-image/dist/index.es.js +20 -17
  197. package/vendor/@tiptap/extension-italic/dist/index.es.js +28 -18
  198. package/vendor/@tiptap/extension-link/dist/index.es.js +236 -147
  199. package/vendor/@tiptap/extension-list-item/dist/index.es.js +6 -6
  200. package/vendor/@tiptap/extension-mention/dist/index.es.js +98 -63
  201. package/vendor/@tiptap/extension-ordered-list/dist/index.es.js +38 -25
  202. package/vendor/@tiptap/extension-paragraph/dist/index.es.js +8 -6
  203. package/vendor/@tiptap/extension-placeholder/dist/index.es.js +34 -27
  204. package/vendor/@tiptap/extension-text/dist/index.es.js +3 -3
  205. package/vendor/@tiptap/extension-underline/dist/index.es.js +16 -10
  206. package/vendor/@tiptap/suggestion/dist/index.es.js +174 -90
  207. package/vendor/@tiptap/vue-3/dist/index.es.js +287 -188
  208. package/vendor/@wangs-ui/core/components/p-BU8h34na.es.js +17 -14
  209. package/vendor/@wangs-ui/core/components/p-C5lMEBcj.es.js +69 -55
  210. package/vendor/@wangs-ui/core/components/p-CKYwZoTo.es.js +26 -22
  211. package/vendor/@wangs-ui/core/components/p-CsoK-EWG.es.js +147 -102
  212. package/vendor/@wangs-ui/core/components/p-DPHEi31J.es.js +102 -77
  213. package/vendor/@wangs-ui/core/components/p-DTTCzifR.es.js +1298 -551
  214. package/vendor/@wangs-ui/core/components/p-Duri5p90.es.js +60 -49
  215. package/vendor/@wangs-ui/core/components/wangs-button.es.js +19 -15
  216. package/vendor/@wangs-ui/core/components/wangs-icon.es.js +3 -3
  217. package/vendor/@wangs-ui/core/components/wangs-input-otp.es.js +3 -3
  218. package/vendor/@wangs-ui/core/components/wangs-tab-menu.es.js +3 -3
  219. package/vendor/@wangs-ui/core/dist/esm/index-DCkh3cGv.es.js +116 -102
  220. package/vendor/@wangs-ui/vue/dist/index.es.js +77 -77
  221. package/vendor/base64toblob/base64toblob.es.js +31 -15
  222. package/vendor/highlight.js/es/core.es.js +5 -5
  223. package/vendor/highlight.js/es/languages/javascript.es.js +237 -193
  224. package/vendor/highlight.js/es/languages/json.es.js +18 -15
  225. package/vendor/highlight.js/es/languages/typescript.es.js +288 -228
  226. package/vendor/highlight.js/es/languages/vbscript-html.es.js +2 -2
  227. package/vendor/highlight.js/lib/core.es.js +1144 -666
  228. package/vendor/linkifyjs/dist/linkify.es.es.js +858 -405
  229. package/vendor/lodash/_Symbol.es.js +11 -8
  230. package/vendor/lodash/_baseGetTag.es.js +19 -12
  231. package/vendor/lodash/_baseTrim.es.js +13 -10
  232. package/vendor/lodash/_freeGlobal.es.js +10 -8
  233. package/vendor/lodash/_getRawTag.es.js +28 -15
  234. package/vendor/lodash/_objectToString.es.js +12 -9
  235. package/vendor/lodash/_root.es.js +12 -8
  236. package/vendor/lodash/_trimmedEndIndex.es.js +14 -11
  237. package/vendor/lodash/debounce.es.js +92 -54
  238. package/vendor/lodash/isObject.es.js +11 -9
  239. package/vendor/lodash/isObjectLike.es.js +10 -8
  240. package/vendor/lodash/isSymbol.es.js +14 -11
  241. package/vendor/lodash/now.es.js +12 -9
  242. package/vendor/lodash/throttle.es.js +25 -17
  243. package/vendor/lodash/toNumber.es.js +33 -23
  244. package/vendor/lodash-es/_DataView.es.js +4 -4
  245. package/vendor/lodash-es/_Hash.es.js +17 -16
  246. package/vendor/lodash-es/_ListCache.es.js +17 -16
  247. package/vendor/lodash-es/_Map.es.js +4 -4
  248. package/vendor/lodash-es/_MapCache.es.js +17 -16
  249. package/vendor/lodash-es/_Promise.es.js +4 -4
  250. package/vendor/lodash-es/_Set.es.js +4 -4
  251. package/vendor/lodash-es/_SetCache.es.js +12 -10
  252. package/vendor/lodash-es/_Stack.es.js +15 -15
  253. package/vendor/lodash-es/_Symbol.es.js +3 -3
  254. package/vendor/lodash-es/_Uint8Array.es.js +3 -3
  255. package/vendor/lodash-es/_WeakMap.es.js +4 -4
  256. package/vendor/lodash-es/_arrayEach.es.js +9 -5
  257. package/vendor/lodash-es/_arrayFilter.es.js +9 -6
  258. package/vendor/lodash-es/_arrayLikeKeys.es.js +21 -17
  259. package/vendor/lodash-es/_arrayPush.es.js +7 -5
  260. package/vendor/lodash-es/_arraySome.es.js +9 -6
  261. package/vendor/lodash-es/_assignValue.es.js +10 -7
  262. package/vendor/lodash-es/_assocIndexOf.es.js +9 -6
  263. package/vendor/lodash-es/_baseAssignValue.es.js +13 -9
  264. package/vendor/lodash-es/_baseClone.es.js +67 -49
  265. package/vendor/lodash-es/_baseCreate.es.js +15 -11
  266. package/vendor/lodash-es/_baseGetAllKeys.es.js +6 -6
  267. package/vendor/lodash-es/_baseGetTag.es.js +11 -7
  268. package/vendor/lodash-es/_baseIsArguments.es.js +6 -6
  269. package/vendor/lodash-es/_baseIsEqual.es.js +11 -5
  270. package/vendor/lodash-es/_baseIsEqualDeep.es.js +39 -26
  271. package/vendor/lodash-es/_baseIsMap.es.js +6 -6
  272. package/vendor/lodash-es/_baseIsNative.es.js +18 -12
  273. package/vendor/lodash-es/_baseIsSet.es.js +6 -6
  274. package/vendor/lodash-es/_baseIsTypedArray.es.js +11 -9
  275. package/vendor/lodash-es/_baseKeys.es.js +16 -11
  276. package/vendor/lodash-es/_baseTimes.es.js +7 -5
  277. package/vendor/lodash-es/_baseTrim.es.js +5 -5
  278. package/vendor/lodash-es/_baseUnary.es.js +4 -4
  279. package/vendor/lodash-es/_cacheHas.es.js +3 -3
  280. package/vendor/lodash-es/_cloneArrayBuffer.es.js +6 -5
  281. package/vendor/lodash-es/_cloneBuffer.es.js +11 -6
  282. package/vendor/lodash-es/_cloneDataView.es.js +5 -5
  283. package/vendor/lodash-es/_cloneRegExp.es.js +6 -5
  284. package/vendor/lodash-es/_cloneSymbol.es.js +5 -5
  285. package/vendor/lodash-es/_cloneTypedArray.es.js +5 -5
  286. package/vendor/lodash-es/_coreJsData.es.js +3 -3
  287. package/vendor/lodash-es/_defineProperty.es.js +7 -6
  288. package/vendor/lodash-es/_equalArrays.es.js +38 -28
  289. package/vendor/lodash-es/_equalByTag.es.js +55 -41
  290. package/vendor/lodash-es/_equalObjects.es.js +42 -28
  291. package/vendor/lodash-es/_freeGlobal.es.js +2 -2
  292. package/vendor/lodash-es/_getAllKeys.es.js +6 -6
  293. package/vendor/lodash-es/_getMapData.es.js +5 -5
  294. package/vendor/lodash-es/_getNative.es.js +6 -6
  295. package/vendor/lodash-es/_getPrototype.es.js +3 -3
  296. package/vendor/lodash-es/_getRawTag.es.js +20 -10
  297. package/vendor/lodash-es/_getSymbols.es.js +15 -8
  298. package/vendor/lodash-es/_getTag.es.js +31 -25
  299. package/vendor/lodash-es/_getValue.es.js +3 -3
  300. package/vendor/lodash-es/_hashClear.es.js +5 -4
  301. package/vendor/lodash-es/_hashDelete.es.js +5 -4
  302. package/vendor/lodash-es/_hashGet.es.js +11 -9
  303. package/vendor/lodash-es/_hashHas.es.js +7 -6
  304. package/vendor/lodash-es/_hashSet.es.js +8 -6
  305. package/vendor/lodash-es/_initCloneArray.es.js +10 -5
  306. package/vendor/lodash-es/_initCloneByTag.es.js +39 -38
  307. package/vendor/lodash-es/_initCloneObject.es.js +6 -6
  308. package/vendor/lodash-es/_isIndex.es.js +7 -5
  309. package/vendor/lodash-es/_isKeyable.es.js +4 -4
  310. package/vendor/lodash-es/_isMasked.es.js +7 -7
  311. package/vendor/lodash-es/_isPrototype.es.js +5 -5
  312. package/vendor/lodash-es/_listCacheClear.es.js +4 -3
  313. package/vendor/lodash-es/_listCacheDelete.es.js +17 -9
  314. package/vendor/lodash-es/_listCacheGet.es.js +5 -5
  315. package/vendor/lodash-es/_listCacheHas.es.js +4 -4
  316. package/vendor/lodash-es/_listCacheSet.es.js +11 -5
  317. package/vendor/lodash-es/_mapCacheClear.es.js +10 -9
  318. package/vendor/lodash-es/_mapCacheDelete.es.js +6 -5
  319. package/vendor/lodash-es/_mapCacheGet.es.js +4 -4
  320. package/vendor/lodash-es/_mapCacheHas.es.js +4 -4
  321. package/vendor/lodash-es/_mapCacheSet.es.js +7 -5
  322. package/vendor/lodash-es/_mapToArray.es.js +7 -6
  323. package/vendor/lodash-es/_nativeCreate.es.js +3 -3
  324. package/vendor/lodash-es/_nativeKeys.es.js +3 -3
  325. package/vendor/lodash-es/_nodeUtil.es.js +13 -6
  326. package/vendor/lodash-es/_objectToString.es.js +5 -4
  327. package/vendor/lodash-es/_overArg.es.js +4 -4
  328. package/vendor/lodash-es/_root.es.js +4 -3
  329. package/vendor/lodash-es/_setCacheAdd.es.js +5 -4
  330. package/vendor/lodash-es/_setCacheHas.es.js +3 -3
  331. package/vendor/lodash-es/_setToArray.es.js +7 -6
  332. package/vendor/lodash-es/_stackClear.es.js +5 -4
  333. package/vendor/lodash-es/_stackDelete.es.js +5 -4
  334. package/vendor/lodash-es/_stackGet.es.js +3 -3
  335. package/vendor/lodash-es/_stackHas.es.js +3 -3
  336. package/vendor/lodash-es/_stackSet.es.js +18 -13
  337. package/vendor/lodash-es/_toSource.es.js +9 -8
  338. package/vendor/lodash-es/_trimmedEndIndex.es.js +7 -6
  339. package/vendor/lodash-es/cloneDeep.es.js +5 -5
  340. package/vendor/lodash-es/debounce.es.js +84 -49
  341. package/vendor/lodash-es/eq.es.js +3 -3
  342. package/vendor/lodash-es/isArguments.es.js +9 -6
  343. package/vendor/lodash-es/isArray.es.js +2 -2
  344. package/vendor/lodash-es/isArrayLike.es.js +5 -5
  345. package/vendor/lodash-es/isBuffer.es.js +9 -4
  346. package/vendor/lodash-es/isEqual.es.js +4 -4
  347. package/vendor/lodash-es/isFunction.es.js +10 -9
  348. package/vendor/lodash-es/isLength.es.js +4 -4
  349. package/vendor/lodash-es/isMap.es.js +6 -5
  350. package/vendor/lodash-es/isObject.es.js +4 -4
  351. package/vendor/lodash-es/isObjectLike.es.js +3 -3
  352. package/vendor/lodash-es/isSet.es.js +6 -5
  353. package/vendor/lodash-es/isSymbol.es.js +6 -6
  354. package/vendor/lodash-es/isTypedArray.es.js +6 -5
  355. package/vendor/lodash-es/keys.es.js +6 -6
  356. package/vendor/lodash-es/now.es.js +4 -4
  357. package/vendor/lodash-es/stubArray.es.js +2 -2
  358. package/vendor/lodash-es/stubFalse.es.js +3 -3
  359. package/vendor/lodash-es/toNumber.es.js +25 -18
  360. package/vendor/lodash-es/toString.es.js +2 -2
  361. package/vendor/lodash-es/uniqueId.es.js +6 -6
  362. package/vendor/orderedmap/dist/index.es.js +65 -49
  363. package/vendor/primevue/api/api.esm.es.js +214 -121
  364. package/vendor/primevue/avatar/avatar.esm.es.js +44 -41
  365. package/vendor/primevue/avatar/style/avatarstyle.esm.es.js +12 -11
  366. package/vendor/primevue/avatargroup/avatargroup.esm.es.js +17 -16
  367. package/vendor/primevue/avatargroup/style/avatargroupstyle.esm.es.js +6 -5
  368. package/vendor/primevue/badge/badge.esm.es.js +21 -20
  369. package/vendor/primevue/badge/style/badgestyle.esm.es.js +19 -18
  370. package/vendor/primevue/base/style/basestyle.esm.es.js +88 -99
  371. package/vendor/primevue/basecomponent/basecomponent.esm.es.js +327 -261
  372. package/vendor/primevue/basedirective/basedirective.esm.es.js +257 -186
  373. package/vendor/primevue/baseicon/baseicon.esm.es.js +55 -49
  374. package/vendor/primevue/baseicon/style/baseiconstyle.esm.es.js +5 -35
  375. package/vendor/primevue/button/button.esm.es.js +76 -72
  376. package/vendor/primevue/button/style/buttonstyle.esm.es.js +46 -39
  377. package/vendor/primevue/card/card.esm.es.js +30 -29
  378. package/vendor/primevue/card/style/cardstyle.esm.es.js +6 -5
  379. package/vendor/primevue/checkbox/checkbox.esm.es.js +109 -101
  380. package/vendor/primevue/checkbox/style/checkboxstyle.esm.es.js +12 -11
  381. package/vendor/primevue/config/config.esm.es.js +76 -58
  382. package/vendor/primevue/dialog/dialog.esm.es.js +421 -281
  383. package/vendor/primevue/dialog/style/dialogstyle.esm.es.js +26 -22
  384. package/vendor/primevue/dropdown/dropdown.esm.es.js +956 -742
  385. package/vendor/primevue/dropdown/style/dropdownstyle.esm.es.js +33 -31
  386. package/vendor/primevue/fileupload/fileupload.esm.es.js +559 -450
  387. package/vendor/primevue/fileupload/style/fileuploadstyle.esm.es.js +14 -13
  388. package/vendor/primevue/focustrap/focustrap.esm.es.js +128 -90
  389. package/vendor/primevue/focustrap/style/focustrapstyle.esm.es.js +2 -2
  390. package/vendor/primevue/icons/angledoubleleft/index.esm.es.js +13 -11
  391. package/vendor/primevue/icons/angledoubleright/index.esm.es.js +13 -11
  392. package/vendor/primevue/icons/angledown/index.esm.es.js +13 -11
  393. package/vendor/primevue/icons/angleleft/index.esm.es.js +13 -11
  394. package/vendor/primevue/icons/angleright/index.esm.es.js +13 -11
  395. package/vendor/primevue/icons/angleup/index.esm.es.js +13 -11
  396. package/vendor/primevue/icons/blank/index.esm.es.js +13 -11
  397. package/vendor/primevue/icons/check/index.esm.es.js +13 -11
  398. package/vendor/primevue/icons/chevrondown/index.esm.es.js +13 -11
  399. package/vendor/primevue/icons/exclamationtriangle/index.esm.es.js +17 -13
  400. package/vendor/primevue/icons/eye/index.esm.es.js +13 -11
  401. package/vendor/primevue/icons/eyeslash/index.esm.es.js +13 -11
  402. package/vendor/primevue/icons/infocircle/index.esm.es.js +13 -11
  403. package/vendor/primevue/icons/plus/index.esm.es.js +13 -11
  404. package/vendor/primevue/icons/refresh/index.esm.es.js +13 -11
  405. package/vendor/primevue/icons/search/index.esm.es.js +13 -11
  406. package/vendor/primevue/icons/searchminus/index.esm.es.js +13 -11
  407. package/vendor/primevue/icons/searchplus/index.esm.es.js +13 -11
  408. package/vendor/primevue/icons/spinner/index.esm.es.js +13 -11
  409. package/vendor/primevue/icons/times/index.esm.es.js +13 -11
  410. package/vendor/primevue/icons/timescircle/index.esm.es.js +13 -11
  411. package/vendor/primevue/icons/undo/index.esm.es.js +13 -11
  412. package/vendor/primevue/icons/upload/index.esm.es.js +13 -11
  413. package/vendor/primevue/icons/windowmaximize/index.esm.es.js +13 -11
  414. package/vendor/primevue/icons/windowminimize/index.esm.es.js +13 -11
  415. package/vendor/primevue/image/image.esm.es.js +280 -235
  416. package/vendor/primevue/image/style/imagestyle.esm.es.js +18 -17
  417. package/vendor/primevue/inputgroup/inputgroup.esm.es.js +17 -16
  418. package/vendor/primevue/inputgroup/style/inputgroupstyle.esm.es.js +6 -5
  419. package/vendor/primevue/inputgroupaddon/inputgroupaddon.esm.es.js +17 -16
  420. package/vendor/primevue/inputgroupaddon/style/inputgroupaddonstyle.esm.es.js +6 -5
  421. package/vendor/primevue/inputnumber/inputnumber.esm.es.js +834 -566
  422. package/vendor/primevue/inputnumber/style/inputnumberstyle.esm.es.js +23 -22
  423. package/vendor/primevue/inputtext/inputtext.esm.es.js +32 -30
  424. package/vendor/primevue/inputtext/style/inputtextstyle.esm.es.js +13 -12
  425. package/vendor/primevue/menu/menu.esm.es.js +402 -304
  426. package/vendor/primevue/menu/style/menustyle.esm.es.js +14 -13
  427. package/vendor/primevue/message/message.esm.es.js +126 -112
  428. package/vendor/primevue/message/style/messagestyle.esm.es.js +9 -8
  429. package/vendor/primevue/multiselect/multiselect.esm.es.js +1083 -835
  430. package/vendor/primevue/multiselect/style/multiselectstyle.esm.es.js +38 -36
  431. package/vendor/primevue/overlayeventbus/overlayeventbus.esm.es.js +3 -3
  432. package/vendor/primevue/overlaypanel/overlaypanel.esm.es.js +275 -169
  433. package/vendor/primevue/overlaypanel/style/overlaypanelstyle.esm.es.js +9 -8
  434. package/vendor/primevue/paginator/paginator.esm.es.js +513 -469
  435. package/vendor/primevue/paginator/style/paginatorstyle.esm.es.js +50 -43
  436. package/vendor/primevue/password/password.esm.es.js +306 -233
  437. package/vendor/primevue/password/style/passwordstyle.esm.es.js +26 -24
  438. package/vendor/primevue/portal/portal.esm.es.js +17 -17
  439. package/vendor/primevue/progressbar/progressbar.esm.es.js +37 -35
  440. package/vendor/primevue/progressbar/style/progressbarstyle.esm.es.js +10 -9
  441. package/vendor/primevue/ripple/ripple.esm.es.js +90 -62
  442. package/vendor/primevue/ripple/style/ripplestyle.esm.es.js +6 -5
  443. package/vendor/primevue/selectbutton/selectbutton.esm.es.js +213 -167
  444. package/vendor/primevue/selectbutton/style/selectbuttonstyle.esm.es.js +14 -13
  445. package/vendor/primevue/skeleton/skeleton.esm.es.js +28 -26
  446. package/vendor/primevue/skeleton/style/skeletonstyle.esm.es.js +13 -11
  447. package/vendor/primevue/textarea/style/textareastyle.esm.es.js +12 -11
  448. package/vendor/primevue/textarea/textarea.esm.es.js +49 -33
  449. package/vendor/primevue/timeline/style/timelinestyle.esm.es.js +9 -8
  450. package/vendor/primevue/timeline/timeline.esm.es.js +53 -52
  451. package/vendor/primevue/toast/style/toaststyle.esm.es.js +54 -46
  452. package/vendor/primevue/toast/toast.esm.es.js +309 -260
  453. package/vendor/primevue/toasteventbus/toasteventbus.esm.es.js +3 -3
  454. package/vendor/primevue/toastservice/toastservice.esm.es.js +16 -15
  455. package/vendor/primevue/tooltip/style/tooltipstyle.esm.es.js +6 -5
  456. package/vendor/primevue/tooltip/tooltip.esm.es.js +383 -186
  457. package/vendor/primevue/usestyle/usestyle.esm.es.js +94 -64
  458. package/vendor/primevue/usetoast/usetoast.esm.es.js +9 -8
  459. package/vendor/primevue/utils/utils.esm.es.js +1078 -772
  460. package/vendor/primevue/virtualscroller/style/virtualscrollerstyle.esm.es.js +5 -67
  461. package/vendor/primevue/virtualscroller/virtualscroller.esm.es.js +655 -428
  462. package/vendor/prosemirror-commands/dist/index.es.js +454 -316
  463. package/vendor/prosemirror-history/dist/index.es.js +286 -178
  464. package/vendor/prosemirror-keymap/dist/index.es.js +68 -48
  465. package/vendor/prosemirror-model/dist/index.es.js +1905 -1436
  466. package/vendor/prosemirror-schema-list/dist/index.es.js +115 -73
  467. package/vendor/prosemirror-state/dist/index.es.js +467 -353
  468. package/vendor/prosemirror-transform/dist/index.es.js +1146 -829
  469. package/vendor/prosemirror-view/dist/index.es.js +4127 -2719
  470. package/vendor/rope-sequence/dist/index.es.js +165 -82
  471. package/vendor/simplebar-core/dist/index.es.js +670 -242
  472. package/vendor/simplebar-vue/dist/simplebar-vue.esm.es.js +73 -60
  473. package/vendor/single-spa/lib/es2015/esm/single-spa.min.es.js +511 -510
  474. package/vendor/tippy.js/dist/tippy.esm.es.js +971 -525
  475. package/vendor/vee-validate/dist/vee-validate.esm.es.js +1830 -1097
  476. package/vendor/vue-advanced-cropper/dist/index.esm-bundler.es.js +740 -738
  477. package/vendor/w3c-keyname/index.es.js +25 -13
  478. package/wangsvue.es.js +167 -208
  479. package/wangsvue.esm.browser.js +49417 -48026
  480. package/wangsvue.system.js +67600 -234
  481. package/api/index.es.js +0 -149
  482. package/apiitem/index.es.js +0 -611
  483. package/assignmember/index.es.js +0 -434
  484. package/attachment/index.es.js +0 -118
  485. package/attachmentchangelog/index.es.js +0 -79
  486. package/attachmentitem/index.es.js +0 -231
  487. package/attachmentthumbnail/index.es.js +0 -83
  488. package/changelog/index.d.ts +0 -164
  489. package/changelog/index.es.js +0 -85
  490. package/changelogfilter/index.es.js +0 -113
  491. package/changelogpage/index.d.ts +0 -184
  492. package/changelogpage/index.es.js +0 -176
  493. package/checklist/index.es.js +0 -571
  494. package/checklistchangelog/index.es.js +0 -85
  495. package/comment/index.d.ts +0 -187
  496. package/comment/index.es.js +0 -267
  497. package/commentblock/index.es.js +0 -337
  498. package/confirmdeploy/index.es.js +0 -64
  499. package/dependencycol/index.es.js +0 -32
  500. package/description/index.es.js +0 -135
  501. package/descriptiontab/index.es.js +0 -30
  502. package/detailmember/index.d.ts +0 -77
  503. package/detailmember/index.es.js +0 -32
  504. package/detailmemberadmin/index.es.js +0 -210
  505. package/detailmemberleader/index.es.js +0 -164
  506. package/detailmemberlog/index.es.js +0 -117
  507. package/detailsprint/index.d.ts +0 -86
  508. package/detailsprint/index.es.js +0 -414
  509. package/dialogaddattachment/index.es.js +0 -273
  510. package/dialogaddchecklist/index.es.js +0 -120
  511. package/dialogaddeditapi/index.es.js +0 -87
  512. package/dialogaddpbi/index.es.js +0 -197
  513. package/dialogadjustmenttask/index.es.js +0 -484
  514. package/dialogadjustmenttaskheader/index.es.js +0 -193
  515. package/dialogapichangelog/index.es.js +0 -83
  516. package/dialogassignmember/index.es.js +0 -171
  517. package/dialogconfirmapproval/index.es.js +0 -54
  518. package/dialogconfirmchecklist/index.es.js +0 -189
  519. package/dialogconfirmdeletetask/index.es.js +0 -70
  520. package/dialogconfirmdeletetaskpermanently/index.es.js +0 -50
  521. package/dialogconfirmedit/index.es.js +0 -50
  522. package/dialogconfirmfinishtask/index.es.js +0 -50
  523. package/dialogconfirmrestoretask/index.es.js +0 -46
  524. package/dialogconfirmsprint/index.es.js +0 -42
  525. package/dialogcopyapi/index.es.js +0 -130
  526. package/dialogcustomdependency/index.es.js +0 -55
  527. package/dialogdetailchecklisttemplate/index.es.js +0 -214
  528. package/dialogdetailcomponent/index.es.js +0 -121
  529. package/dialogdetailpbi/index.es.js +0 -192
  530. package/dialogfinishreview/index.es.js +0 -126
  531. package/dialogimprovementtask/index.es.js +0 -191
  532. package/dialogmemberadmin/index.es.js +0 -93
  533. package/dialogpreparepbi/index.es.js +0 -93
  534. package/dialogpriorityvalue/index.es.js +0 -85
  535. package/dialogreportbug/index.es.js +0 -207
  536. package/dialogreviewleader/index.es.js +0 -280
  537. package/dialogsavechecklisttemplate/index.es.js +0 -127
  538. package/dialogselectproject/index.es.js +0 -69
  539. package/dialogsetduration/index.es.js +0 -109
  540. package/dialogsettasklink/index.es.js +0 -153
  541. package/dialogtestapi/index.es.js +0 -389
  542. package/eventlogtab/index.es.js +0 -50
  543. package/infotasktab/index.es.js +0 -186
  544. package/inputadditional/index.es.js +0 -62
  545. package/inputinitialname/index.d.ts +0 -118
  546. package/inputinitialname/index.es.js +0 -95
  547. package/inputrepositoryname/index.d.ts +0 -86
  548. package/inputrepositoryname/index.es.js +0 -41
  549. package/isrequiredtext/index.es.js +0 -16
  550. package/legend/index.es.js +0 -727
  551. package/legendlist/index.es.js +0 -33
  552. package/loading-page-BrQattYE.js +0 -1
  553. package/loading-page-CgfbWppy.js +0 -1
  554. package/loading-page-CoC9UhfC.js +0 -4
  555. package/loading-page-CoXtqoc9.js +0 -4
  556. package/loading-page-DbLuqCHa.js +0 -1
  557. package/loading-page-f8D03l3G.js +0 -4
  558. package/loading-plane-CgfbWppy.js +0 -1
  559. package/loading-plane-CoXtqoc9.js +0 -4
  560. package/loading-table-Bdr9ZhtP.js +0 -1
  561. package/loading-table-ByUoWqUo.js +0 -4
  562. package/loading-table-BygEMzFM.js +0 -4
  563. package/loading-table-BzrSQlA0.js +0 -1
  564. package/loading-table-D9bw9OcI.js +0 -4
  565. package/loading-table-chOgXi94.js +0 -1
  566. package/no-data-CTKux8RI.js +0 -4
  567. package/no-data-Cgze_Rvp.js +0 -1
  568. package/no-data-DLHO1L_u.js +0 -4
  569. package/no-data-Dep79CBh.js +0 -1
  570. package/no-data-g0dJCy2p.js +0 -4
  571. package/no-data-y1X5WtcQ.js +0 -1
  572. package/notificationitem/index.d.ts +0 -107
  573. package/notificationitem/index.es.js +0 -333
  574. package/reviewitem/index.es.js +0 -65
  575. package/reviewtab/index.es.js +0 -44
  576. package/services/calendar.service.es.js +0 -32
  577. package/sonarqubesummary/index.es.js +0 -234
  578. package/sprintsummary/index.es.js +0 -73
  579. package/summaryaccordion/index.d.ts +0 -121
  580. package/summaryaccordion/index.es.js +0 -365
  581. package/taskdependency/index.es.js +0 -686
  582. package/taskdetail/index.d.ts +0 -82
  583. package/taskdetail/index.es.js +0 -491
  584. package/taskdetailpbi/index.d.ts +0 -35
  585. package/taskdetailpbi/index.es.js +0 -172
  586. package/taskdetailunassignedpbi/index.es.js +0 -261
  587. package/tasklink/index.es.js +0 -257
  588. package/tasklinkchangelog/index.es.js +0 -93
  589. package/tasklist/index.es.js +0 -92
  590. package/taskmore/index.es.js +0 -52
  591. package/taskstatusbadge/index.es.js +0 -18
  592. package/tasktable/index.d.ts +0 -87
  593. package/tasktable/index.es.js +0 -832
  594. package/ticket/index.es.js +0 -151
  595. package/tooltipspan/index.es.js +0 -30
  596. package/utils/updateSprintStatus.util.es.js +0 -17
  597. package/valueformdatainput/index.es.js +0 -70
  598. package/workcalendar/index.es.js +0 -351
@@ -1,21 +1,24 @@
1
- import { b as w, F as g, M as se, d as oe, R as le } from "../../prosemirror-model/dist/index.es.js";
2
- const Q = 65535, U = Math.pow(2, 16);
3
- function ae(s, e) {
4
- return s + e * U;
1
+ import { b as Slice, F as Fragment, M as Mark, d as MarkType, R as ReplaceError } from "../../prosemirror-model/dist/index.es.js";
2
+ const lower16 = 65535;
3
+ const factor16 = Math.pow(2, 16);
4
+ function makeRecover(index, offset) {
5
+ return index + offset * factor16;
5
6
  }
6
- function H(s) {
7
- return s & Q;
7
+ function recoverIndex(value) {
8
+ return value & lower16;
8
9
  }
9
- function he(s) {
10
- return (s - (s & Q)) / U;
10
+ function recoverOffset(value) {
11
+ return (value - (value & lower16)) / factor16;
11
12
  }
12
- const V = 1, X = 2, J = 4, Y = 8;
13
- class L {
13
+ const DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;
14
+ class MapResult {
14
15
  /**
15
16
  @internal
16
17
  */
17
- constructor(e, t, r) {
18
- this.pos = e, this.delInfo = t, this.recover = r;
18
+ constructor(pos, delInfo, recover) {
19
+ this.pos = pos;
20
+ this.delInfo = delInfo;
21
+ this.recover = recover;
19
22
  }
20
23
  /**
21
24
  Tells you whether the position was deleted, that is, whether the
@@ -23,19 +26,19 @@ class L {
23
26
  argument from the document.
24
27
  */
25
28
  get deleted() {
26
- return (this.delInfo & Y) > 0;
29
+ return (this.delInfo & DEL_SIDE) > 0;
27
30
  }
28
31
  /**
29
32
  Tells you whether the token before the mapped position was deleted.
30
33
  */
31
34
  get deletedBefore() {
32
- return (this.delInfo & (V | J)) > 0;
35
+ return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;
33
36
  }
34
37
  /**
35
38
  True when the token after the mapped position was deleted.
36
39
  */
37
40
  get deletedAfter() {
38
- return (this.delInfo & (X | J)) > 0;
41
+ return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
39
42
  }
40
43
  /**
41
44
  Tells whether any of the steps mapped through deletes across the
@@ -43,81 +46,90 @@ class L {
43
46
  position).
44
47
  */
45
48
  get deletedAcross() {
46
- return (this.delInfo & J) > 0;
49
+ return (this.delInfo & DEL_ACROSS) > 0;
47
50
  }
48
51
  }
49
- class S {
52
+ class StepMap {
50
53
  /**
51
54
  Create a position map. The modifications to the document are
52
55
  represented as an array of numbers, in which each group of three
53
56
  represents a modified chunk as `[start, oldSize, newSize]`.
54
57
  */
55
- constructor(e, t = !1) {
56
- if (this.ranges = e, this.inverted = t, !e.length && S.empty)
57
- return S.empty;
58
+ constructor(ranges, inverted = false) {
59
+ this.ranges = ranges;
60
+ this.inverted = inverted;
61
+ if (!ranges.length && StepMap.empty)
62
+ return StepMap.empty;
58
63
  }
59
64
  /**
60
65
  @internal
61
66
  */
62
- recover(e) {
63
- let t = 0, r = H(e);
67
+ recover(value) {
68
+ let diff = 0, index = recoverIndex(value);
64
69
  if (!this.inverted)
65
- for (let n = 0; n < r; n++)
66
- t += this.ranges[n * 3 + 2] - this.ranges[n * 3 + 1];
67
- return this.ranges[r * 3] + t + he(e);
70
+ for (let i = 0; i < index; i++)
71
+ diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
72
+ return this.ranges[index * 3] + diff + recoverOffset(value);
68
73
  }
69
- mapResult(e, t = 1) {
70
- return this._map(e, t, !1);
74
+ mapResult(pos, assoc = 1) {
75
+ return this._map(pos, assoc, false);
71
76
  }
72
- map(e, t = 1) {
73
- return this._map(e, t, !0);
77
+ map(pos, assoc = 1) {
78
+ return this._map(pos, assoc, true);
74
79
  }
75
80
  /**
76
81
  @internal
77
82
  */
78
- _map(e, t, r) {
79
- let n = 0, i = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
80
- for (let l = 0; l < this.ranges.length; l += 3) {
81
- let a = this.ranges[l] - (this.inverted ? n : 0);
82
- if (a > e)
83
+ _map(pos, assoc, simple) {
84
+ let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
85
+ for (let i = 0; i < this.ranges.length; i += 3) {
86
+ let start = this.ranges[i] - (this.inverted ? diff : 0);
87
+ if (start > pos)
83
88
  break;
84
- let h = this.ranges[l + i], p = this.ranges[l + o], c = a + h;
85
- if (e <= c) {
86
- let f = h ? e == a ? -1 : e == c ? 1 : t : t, d = a + n + (f < 0 ? 0 : p);
87
- if (r)
88
- return d;
89
- let u = e == (t < 0 ? a : c) ? null : ae(l / 3, e - a), m = e == a ? X : e == c ? V : J;
90
- return (t < 0 ? e != a : e != c) && (m |= Y), new L(d, m, u);
89
+ let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
90
+ if (pos <= end) {
91
+ let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
92
+ let result = start + diff + (side < 0 ? 0 : newSize);
93
+ if (simple)
94
+ return result;
95
+ let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
96
+ let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
97
+ if (assoc < 0 ? pos != start : pos != end)
98
+ del |= DEL_SIDE;
99
+ return new MapResult(result, del, recover);
91
100
  }
92
- n += p - h;
101
+ diff += newSize - oldSize;
93
102
  }
94
- return r ? e + n : new L(e + n, 0, null);
103
+ return simple ? pos + diff : new MapResult(pos + diff, 0, null);
95
104
  }
96
105
  /**
97
106
  @internal
98
107
  */
99
- touches(e, t) {
100
- let r = 0, n = H(t), i = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
101
- for (let l = 0; l < this.ranges.length; l += 3) {
102
- let a = this.ranges[l] - (this.inverted ? r : 0);
103
- if (a > e)
108
+ touches(pos, recover) {
109
+ let diff = 0, index = recoverIndex(recover);
110
+ let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
111
+ for (let i = 0; i < this.ranges.length; i += 3) {
112
+ let start = this.ranges[i] - (this.inverted ? diff : 0);
113
+ if (start > pos)
104
114
  break;
105
- let h = this.ranges[l + i], p = a + h;
106
- if (e <= p && l == n * 3)
107
- return !0;
108
- r += this.ranges[l + o] - h;
115
+ let oldSize = this.ranges[i + oldIndex], end = start + oldSize;
116
+ if (pos <= end && i == index * 3)
117
+ return true;
118
+ diff += this.ranges[i + newIndex] - oldSize;
109
119
  }
110
- return !1;
120
+ return false;
111
121
  }
112
122
  /**
113
123
  Calls the given function on each of the changed ranges included in
114
124
  this map.
115
125
  */
116
- forEach(e) {
117
- let t = this.inverted ? 2 : 1, r = this.inverted ? 1 : 2;
118
- for (let n = 0, i = 0; n < this.ranges.length; n += 3) {
119
- let o = this.ranges[n], l = o - (this.inverted ? i : 0), a = o + (this.inverted ? 0 : i), h = this.ranges[n + t], p = this.ranges[n + r];
120
- e(l, l + h, a, a + p), i += p - h;
126
+ forEach(f) {
127
+ let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
128
+ for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
129
+ let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
130
+ let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
131
+ f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
132
+ diff += newSize - oldSize;
121
133
  }
122
134
  }
123
135
  /**
@@ -125,7 +137,7 @@ class S {
125
137
  map positions in the post-step document to the pre-step document.
126
138
  */
127
139
  invert() {
128
- return new S(this.ranges, !this.inverted);
140
+ return new StepMap(this.ranges, !this.inverted);
129
141
  }
130
142
  /**
131
143
  @internal
@@ -138,17 +150,21 @@ class S {
138
150
  negative). This can be useful when applying steps meant for a
139
151
  sub-document to a larger document, or vice-versa.
140
152
  */
141
- static offset(e) {
142
- return e == 0 ? S.empty : new S(e < 0 ? [0, -e, 0] : [0, 0, e]);
153
+ static offset(n) {
154
+ return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);
143
155
  }
144
156
  }
145
- S.empty = new S([]);
146
- class A {
157
+ StepMap.empty = new StepMap([]);
158
+ class Mapping {
147
159
  /**
148
160
  Create a new mapping with the given position maps.
149
161
  */
150
- constructor(e, t, r = 0, n = e ? e.length : 0) {
151
- this.mirror = t, this.from = r, this.to = n, this._maps = e || [], this.ownData = !(e || t);
162
+ constructor(maps, mirror, from = 0, to = maps ? maps.length : 0) {
163
+ this.mirror = mirror;
164
+ this.from = from;
165
+ this.to = to;
166
+ this._maps = maps || [];
167
+ this.ownData = !(maps || mirror);
152
168
  }
153
169
  /**
154
170
  The step maps in this mapping.
@@ -159,25 +175,32 @@ class A {
159
175
  /**
160
176
  Create a mapping that maps only through a part of this one.
161
177
  */
162
- slice(e = 0, t = this.maps.length) {
163
- return new A(this._maps, this.mirror, e, t);
178
+ slice(from = 0, to = this.maps.length) {
179
+ return new Mapping(this._maps, this.mirror, from, to);
164
180
  }
165
181
  /**
166
182
  Add a step map to the end of this mapping. If `mirrors` is
167
183
  given, it should be the index of the step map that is the mirror
168
184
  image of this one.
169
185
  */
170
- appendMap(e, t) {
171
- this.ownData || (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), this.ownData = !0), this.to = this._maps.push(e), t != null && this.setMirror(this._maps.length - 1, t);
186
+ appendMap(map, mirrors) {
187
+ if (!this.ownData) {
188
+ this._maps = this._maps.slice();
189
+ this.mirror = this.mirror && this.mirror.slice();
190
+ this.ownData = true;
191
+ }
192
+ this.to = this._maps.push(map);
193
+ if (mirrors != null)
194
+ this.setMirror(this._maps.length - 1, mirrors);
172
195
  }
173
196
  /**
174
197
  Add all the step maps in a given mapping to this one (preserving
175
198
  mirroring information).
176
199
  */
177
- appendMapping(e) {
178
- for (let t = 0, r = this._maps.length; t < e._maps.length; t++) {
179
- let n = e.getMirror(t);
180
- this.appendMap(e._maps[t], n != null && n < t ? r + n : void 0);
200
+ appendMapping(mapping) {
201
+ for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
202
+ let mirr = mapping.getMirror(i);
203
+ this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : void 0);
181
204
  }
182
205
  }
183
206
  /**
@@ -185,100 +208,105 @@ class A {
185
208
  given offset, in this mapping (as per the second argument to
186
209
  `appendMap`).
187
210
  */
188
- getMirror(e) {
211
+ getMirror(n) {
189
212
  if (this.mirror) {
190
- for (let t = 0; t < this.mirror.length; t++)
191
- if (this.mirror[t] == e)
192
- return this.mirror[t + (t % 2 ? -1 : 1)];
213
+ for (let i = 0; i < this.mirror.length; i++)
214
+ if (this.mirror[i] == n)
215
+ return this.mirror[i + (i % 2 ? -1 : 1)];
193
216
  }
194
217
  }
195
218
  /**
196
219
  @internal
197
220
  */
198
- setMirror(e, t) {
199
- this.mirror || (this.mirror = []), this.mirror.push(e, t);
221
+ setMirror(n, m) {
222
+ if (!this.mirror)
223
+ this.mirror = [];
224
+ this.mirror.push(n, m);
200
225
  }
201
226
  /**
202
227
  Append the inverse of the given mapping to this one.
203
228
  */
204
- appendMappingInverted(e) {
205
- for (let t = e.maps.length - 1, r = this._maps.length + e._maps.length; t >= 0; t--) {
206
- let n = e.getMirror(t);
207
- this.appendMap(e._maps[t].invert(), n != null && n > t ? r - n - 1 : void 0);
229
+ appendMappingInverted(mapping) {
230
+ for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
231
+ let mirr = mapping.getMirror(i);
232
+ this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : void 0);
208
233
  }
209
234
  }
210
235
  /**
211
236
  Create an inverted version of this mapping.
212
237
  */
213
238
  invert() {
214
- let e = new A();
215
- return e.appendMappingInverted(this), e;
239
+ let inverse = new Mapping();
240
+ inverse.appendMappingInverted(this);
241
+ return inverse;
216
242
  }
217
243
  /**
218
244
  Map a position through this mapping.
219
245
  */
220
- map(e, t = 1) {
246
+ map(pos, assoc = 1) {
221
247
  if (this.mirror)
222
- return this._map(e, t, !0);
223
- for (let r = this.from; r < this.to; r++)
224
- e = this._maps[r].map(e, t);
225
- return e;
248
+ return this._map(pos, assoc, true);
249
+ for (let i = this.from; i < this.to; i++)
250
+ pos = this._maps[i].map(pos, assoc);
251
+ return pos;
226
252
  }
227
253
  /**
228
254
  Map a position through this mapping, returning a mapping
229
255
  result.
230
256
  */
231
- mapResult(e, t = 1) {
232
- return this._map(e, t, !1);
257
+ mapResult(pos, assoc = 1) {
258
+ return this._map(pos, assoc, false);
233
259
  }
234
260
  /**
235
261
  @internal
236
262
  */
237
- _map(e, t, r) {
238
- let n = 0;
263
+ _map(pos, assoc, simple) {
264
+ let delInfo = 0;
239
265
  for (let i = this.from; i < this.to; i++) {
240
- let o = this._maps[i], l = o.mapResult(e, t);
241
- if (l.recover != null) {
242
- let a = this.getMirror(i);
243
- if (a != null && a > i && a < this.to) {
244
- i = a, e = this._maps[a].recover(l.recover);
266
+ let map = this._maps[i], result = map.mapResult(pos, assoc);
267
+ if (result.recover != null) {
268
+ let corr = this.getMirror(i);
269
+ if (corr != null && corr > i && corr < this.to) {
270
+ i = corr;
271
+ pos = this._maps[corr].recover(result.recover);
245
272
  continue;
246
273
  }
247
274
  }
248
- n |= l.delInfo, e = l.pos;
275
+ delInfo |= result.delInfo;
276
+ pos = result.pos;
249
277
  }
250
- return r ? e : new L(e, n, null);
278
+ return simple ? pos : new MapResult(pos, delInfo, null);
251
279
  }
252
280
  }
253
- const B = /* @__PURE__ */ Object.create(null);
254
- class k {
281
+ const stepsByID = /* @__PURE__ */ Object.create(null);
282
+ class Step {
255
283
  /**
256
284
  Get the step map that represents the changes made by this step,
257
285
  and which can be used to transform between positions in the old
258
286
  and the new document.
259
287
  */
260
288
  getMap() {
261
- return S.empty;
289
+ return StepMap.empty;
262
290
  }
263
291
  /**
264
292
  Try to merge this step with another one, to be applied directly
265
293
  after it. Returns the merged step when possible, null if the
266
294
  steps can't be merged.
267
295
  */
268
- merge(e) {
296
+ merge(other) {
269
297
  return null;
270
298
  }
271
299
  /**
272
300
  Deserialize a step from its JSON representation. Will call
273
301
  through to the step class' own implementation of this method.
274
302
  */
275
- static fromJSON(e, t) {
276
- if (!t || !t.stepType)
303
+ static fromJSON(schema, json) {
304
+ if (!json || !json.stepType)
277
305
  throw new RangeError("Invalid input for Step.fromJSON");
278
- let r = B[t.stepType];
279
- if (!r)
280
- throw new RangeError(`No step type ${t.stepType} defined`);
281
- return r.fromJSON(e, t);
306
+ let type = stepsByID[json.stepType];
307
+ if (!type)
308
+ throw new RangeError(`No step type ${json.stepType} defined`);
309
+ return type.fromJSON(schema, json);
282
310
  }
283
311
  /**
284
312
  To be able to serialize steps to JSON, each step needs a string
@@ -286,74 +314,94 @@ class k {
286
314
  register an ID for your step classes. Try to pick something
287
315
  that's unlikely to clash with steps from other modules.
288
316
  */
289
- static jsonID(e, t) {
290
- if (e in B)
291
- throw new RangeError("Duplicate use of step JSON ID " + e);
292
- return B[e] = t, t.prototype.jsonID = e, t;
317
+ static jsonID(id, stepClass) {
318
+ if (id in stepsByID)
319
+ throw new RangeError("Duplicate use of step JSON ID " + id);
320
+ stepsByID[id] = stepClass;
321
+ stepClass.prototype.jsonID = id;
322
+ return stepClass;
293
323
  }
294
324
  }
295
- class y {
325
+ class StepResult {
296
326
  /**
297
327
  @internal
298
328
  */
299
- constructor(e, t) {
300
- this.doc = e, this.failed = t;
329
+ constructor(doc, failed) {
330
+ this.doc = doc;
331
+ this.failed = failed;
301
332
  }
302
333
  /**
303
334
  Create a successful step result.
304
335
  */
305
- static ok(e) {
306
- return new y(e, null);
336
+ static ok(doc) {
337
+ return new StepResult(doc, null);
307
338
  }
308
339
  /**
309
340
  Create a failed step result.
310
341
  */
311
- static fail(e) {
312
- return new y(null, e);
342
+ static fail(message) {
343
+ return new StepResult(null, message);
313
344
  }
314
345
  /**
315
346
  Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
316
347
  arguments. Create a successful result if it succeeds, and a
317
348
  failed one if it throws a `ReplaceError`.
318
349
  */
319
- static fromReplace(e, t, r, n) {
350
+ static fromReplace(doc, from, to, slice) {
320
351
  try {
321
- return y.ok(e.replace(t, r, n));
322
- } catch (i) {
323
- if (i instanceof le)
324
- return y.fail(i.message);
325
- throw i;
352
+ return StepResult.ok(doc.replace(from, to, slice));
353
+ } catch (e) {
354
+ if (e instanceof ReplaceError)
355
+ return StepResult.fail(e.message);
356
+ throw e;
326
357
  }
327
358
  }
328
359
  }
329
- function P(s, e, t) {
330
- let r = [];
331
- for (let n = 0; n < s.childCount; n++) {
332
- let i = s.child(n);
333
- i.content.size && (i = i.copy(P(i.content, e, i))), i.isInline && (i = e(i, t, n)), r.push(i);
334
- }
335
- return g.fromArray(r);
360
+ function mapFragment(fragment, f, parent) {
361
+ let mapped = [];
362
+ for (let i = 0; i < fragment.childCount; i++) {
363
+ let child = fragment.child(i);
364
+ if (child.content.size)
365
+ child = child.copy(mapFragment(child.content, f, child));
366
+ if (child.isInline)
367
+ child = f(child, parent, i);
368
+ mapped.push(child);
369
+ }
370
+ return Fragment.fromArray(mapped);
336
371
  }
337
- class C extends k {
372
+ class AddMarkStep extends Step {
338
373
  /**
339
374
  Create a mark step.
340
375
  */
341
- constructor(e, t, r) {
342
- super(), this.from = e, this.to = t, this.mark = r;
343
- }
344
- apply(e) {
345
- let t = e.slice(this.from, this.to), r = e.resolve(this.from), n = r.node(r.sharedDepth(this.to)), i = new w(P(t.content, (o, l) => !o.isAtom || !l.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), n), t.openStart, t.openEnd);
346
- return y.fromReplace(e, this.from, this.to, i);
376
+ constructor(from, to, mark) {
377
+ super();
378
+ this.from = from;
379
+ this.to = to;
380
+ this.mark = mark;
381
+ }
382
+ apply(doc) {
383
+ let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
384
+ let parent = $from.node($from.sharedDepth(this.to));
385
+ let slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
386
+ if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type))
387
+ return node;
388
+ return node.mark(this.mark.addToSet(node.marks));
389
+ }, parent), oldSlice.openStart, oldSlice.openEnd);
390
+ return StepResult.fromReplace(doc, this.from, this.to, slice);
347
391
  }
348
392
  invert() {
349
- return new b(this.from, this.to, this.mark);
393
+ return new RemoveMarkStep(this.from, this.to, this.mark);
350
394
  }
351
- map(e) {
352
- let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
353
- return t.deleted && r.deleted || t.pos >= r.pos ? null : new C(t.pos, r.pos, this.mark);
395
+ map(mapping) {
396
+ let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
397
+ if (from.deleted && to.deleted || from.pos >= to.pos)
398
+ return null;
399
+ return new AddMarkStep(from.pos, to.pos, this.mark);
354
400
  }
355
- merge(e) {
356
- return e instanceof C && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new C(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
401
+ merge(other) {
402
+ if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
403
+ return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
404
+ return null;
357
405
  }
358
406
  toJSON() {
359
407
  return {
@@ -366,33 +414,43 @@ class C extends k {
366
414
  /**
367
415
  @internal
368
416
  */
369
- static fromJSON(e, t) {
370
- if (typeof t.from != "number" || typeof t.to != "number")
417
+ static fromJSON(schema, json) {
418
+ if (typeof json.from != "number" || typeof json.to != "number")
371
419
  throw new RangeError("Invalid input for AddMarkStep.fromJSON");
372
- return new C(t.from, t.to, e.markFromJSON(t.mark));
420
+ return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
373
421
  }
374
422
  }
375
- k.jsonID("addMark", C);
376
- class b extends k {
423
+ Step.jsonID("addMark", AddMarkStep);
424
+ class RemoveMarkStep extends Step {
377
425
  /**
378
426
  Create a mark-removing step.
379
427
  */
380
- constructor(e, t, r) {
381
- super(), this.from = e, this.to = t, this.mark = r;
428
+ constructor(from, to, mark) {
429
+ super();
430
+ this.from = from;
431
+ this.to = to;
432
+ this.mark = mark;
382
433
  }
383
- apply(e) {
384
- let t = e.slice(this.from, this.to), r = new w(P(t.content, (n) => n.mark(this.mark.removeFromSet(n.marks)), e), t.openStart, t.openEnd);
385
- return y.fromReplace(e, this.from, this.to, r);
434
+ apply(doc) {
435
+ let oldSlice = doc.slice(this.from, this.to);
436
+ let slice = new Slice(mapFragment(oldSlice.content, (node) => {
437
+ return node.mark(this.mark.removeFromSet(node.marks));
438
+ }, doc), oldSlice.openStart, oldSlice.openEnd);
439
+ return StepResult.fromReplace(doc, this.from, this.to, slice);
386
440
  }
387
441
  invert() {
388
- return new C(this.from, this.to, this.mark);
442
+ return new AddMarkStep(this.from, this.to, this.mark);
389
443
  }
390
- map(e) {
391
- let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
392
- return t.deleted && r.deleted || t.pos >= r.pos ? null : new b(t.pos, r.pos, this.mark);
444
+ map(mapping) {
445
+ let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
446
+ if (from.deleted && to.deleted || from.pos >= to.pos)
447
+ return null;
448
+ return new RemoveMarkStep(from.pos, to.pos, this.mark);
393
449
  }
394
- merge(e) {
395
- return e instanceof b && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new b(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
450
+ merge(other) {
451
+ if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
452
+ return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
453
+ return null;
396
454
  }
397
455
  toJSON() {
398
456
  return {
@@ -405,43 +463,45 @@ class b extends k {
405
463
  /**
406
464
  @internal
407
465
  */
408
- static fromJSON(e, t) {
409
- if (typeof t.from != "number" || typeof t.to != "number")
466
+ static fromJSON(schema, json) {
467
+ if (typeof json.from != "number" || typeof json.to != "number")
410
468
  throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
411
- return new b(t.from, t.to, e.markFromJSON(t.mark));
469
+ return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
412
470
  }
413
471
  }
414
- k.jsonID("removeMark", b);
415
- class N extends k {
472
+ Step.jsonID("removeMark", RemoveMarkStep);
473
+ class AddNodeMarkStep extends Step {
416
474
  /**
417
475
  Create a node mark step.
418
476
  */
419
- constructor(e, t) {
420
- super(), this.pos = e, this.mark = t;
421
- }
422
- apply(e) {
423
- let t = e.nodeAt(this.pos);
424
- if (!t)
425
- return y.fail("No node at mark step's position");
426
- let r = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
427
- return y.fromReplace(e, this.pos, this.pos + 1, new w(g.from(r), 0, t.isLeaf ? 0 : 1));
428
- }
429
- invert(e) {
430
- let t = e.nodeAt(this.pos);
431
- if (t) {
432
- let r = this.mark.addToSet(t.marks);
433
- if (r.length == t.marks.length) {
434
- for (let n = 0; n < t.marks.length; n++)
435
- if (!t.marks[n].isInSet(r))
436
- return new N(this.pos, t.marks[n]);
437
- return new N(this.pos, this.mark);
477
+ constructor(pos, mark) {
478
+ super();
479
+ this.pos = pos;
480
+ this.mark = mark;
481
+ }
482
+ apply(doc) {
483
+ let node = doc.nodeAt(this.pos);
484
+ if (!node)
485
+ return StepResult.fail("No node at mark step's position");
486
+ let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
487
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
488
+ }
489
+ invert(doc) {
490
+ let node = doc.nodeAt(this.pos);
491
+ if (node) {
492
+ let newSet = this.mark.addToSet(node.marks);
493
+ if (newSet.length == node.marks.length) {
494
+ for (let i = 0; i < node.marks.length; i++)
495
+ if (!node.marks[i].isInSet(newSet))
496
+ return new AddNodeMarkStep(this.pos, node.marks[i]);
497
+ return new AddNodeMarkStep(this.pos, this.mark);
438
498
  }
439
499
  }
440
- return new R(this.pos, this.mark);
500
+ return new RemoveNodeMarkStep(this.pos, this.mark);
441
501
  }
442
- map(e) {
443
- let t = e.mapResult(this.pos, 1);
444
- return t.deletedAfter ? null : new N(t.pos, this.mark);
502
+ map(mapping) {
503
+ let pos = mapping.mapResult(this.pos, 1);
504
+ return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
445
505
  }
446
506
  toJSON() {
447
507
  return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
@@ -449,34 +509,38 @@ class N extends k {
449
509
  /**
450
510
  @internal
451
511
  */
452
- static fromJSON(e, t) {
453
- if (typeof t.pos != "number")
512
+ static fromJSON(schema, json) {
513
+ if (typeof json.pos != "number")
454
514
  throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
455
- return new N(t.pos, e.markFromJSON(t.mark));
515
+ return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
456
516
  }
457
517
  }
458
- k.jsonID("addNodeMark", N);
459
- class R extends k {
518
+ Step.jsonID("addNodeMark", AddNodeMarkStep);
519
+ class RemoveNodeMarkStep extends Step {
460
520
  /**
461
521
  Create a mark-removing step.
462
522
  */
463
- constructor(e, t) {
464
- super(), this.pos = e, this.mark = t;
523
+ constructor(pos, mark) {
524
+ super();
525
+ this.pos = pos;
526
+ this.mark = mark;
465
527
  }
466
- apply(e) {
467
- let t = e.nodeAt(this.pos);
468
- if (!t)
469
- return y.fail("No node at mark step's position");
470
- let r = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
471
- return y.fromReplace(e, this.pos, this.pos + 1, new w(g.from(r), 0, t.isLeaf ? 0 : 1));
528
+ apply(doc) {
529
+ let node = doc.nodeAt(this.pos);
530
+ if (!node)
531
+ return StepResult.fail("No node at mark step's position");
532
+ let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
533
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
472
534
  }
473
- invert(e) {
474
- let t = e.nodeAt(this.pos);
475
- return !t || !this.mark.isInSet(t.marks) ? this : new N(this.pos, this.mark);
535
+ invert(doc) {
536
+ let node = doc.nodeAt(this.pos);
537
+ if (!node || !this.mark.isInSet(node.marks))
538
+ return this;
539
+ return new AddNodeMarkStep(this.pos, this.mark);
476
540
  }
477
- map(e) {
478
- let t = e.mapResult(this.pos, 1);
479
- return t.deletedAfter ? null : new R(t.pos, this.mark);
541
+ map(mapping) {
542
+ let pos = mapping.mapResult(this.pos, 1);
543
+ return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
480
544
  }
481
545
  toJSON() {
482
546
  return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
@@ -484,14 +548,14 @@ class R extends k {
484
548
  /**
485
549
  @internal
486
550
  */
487
- static fromJSON(e, t) {
488
- if (typeof t.pos != "number")
551
+ static fromJSON(schema, json) {
552
+ if (typeof json.pos != "number")
489
553
  throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
490
- return new R(t.pos, e.markFromJSON(t.mark));
554
+ return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
491
555
  }
492
556
  }
493
- k.jsonID("removeNodeMark", R);
494
- class v extends k {
557
+ Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
558
+ class ReplaceStep extends Step {
495
559
  /**
496
560
  The given `slice` should fit the 'gap' between `from` and
497
561
  `to`—the depths must line up, and the surrounding nodes must be
@@ -501,69 +565,91 @@ class v extends k {
501
565
  tokens (this is to guard against rebased replace steps
502
566
  overwriting something they weren't supposed to).
503
567
  */
504
- constructor(e, t, r, n = !1) {
505
- super(), this.from = e, this.to = t, this.slice = r, this.structure = n;
568
+ constructor(from, to, slice, structure = false) {
569
+ super();
570
+ this.from = from;
571
+ this.to = to;
572
+ this.slice = slice;
573
+ this.structure = structure;
506
574
  }
507
- apply(e) {
508
- return this.structure && q(e, this.from, this.to) ? y.fail("Structure replace would overwrite content") : y.fromReplace(e, this.from, this.to, this.slice);
575
+ apply(doc) {
576
+ if (this.structure && contentBetween(doc, this.from, this.to))
577
+ return StepResult.fail("Structure replace would overwrite content");
578
+ return StepResult.fromReplace(doc, this.from, this.to, this.slice);
509
579
  }
510
580
  getMap() {
511
- return new S([this.from, this.to - this.from, this.slice.size]);
581
+ return new StepMap([this.from, this.to - this.from, this.slice.size]);
512
582
  }
513
- invert(e) {
514
- return new v(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
583
+ invert(doc) {
584
+ return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
515
585
  }
516
- map(e) {
517
- let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
518
- return t.deletedAcross && r.deletedAcross ? null : new v(t.pos, Math.max(t.pos, r.pos), this.slice, this.structure);
586
+ map(mapping) {
587
+ let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
588
+ if (from.deletedAcross && to.deletedAcross)
589
+ return null;
590
+ return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
519
591
  }
520
- merge(e) {
521
- if (!(e instanceof v) || e.structure || this.structure)
592
+ merge(other) {
593
+ if (!(other instanceof ReplaceStep) || other.structure || this.structure)
522
594
  return null;
523
- if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
524
- let t = this.slice.size + e.slice.size == 0 ? w.empty : new w(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
525
- return new v(this.from, this.to + (e.to - e.from), t, this.structure);
526
- } else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
527
- let t = this.slice.size + e.slice.size == 0 ? w.empty : new w(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
528
- return new v(e.from, this.to, t, this.structure);
529
- } else
595
+ if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
596
+ let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
597
+ return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
598
+ } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
599
+ let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
600
+ return new ReplaceStep(other.from, this.to, slice, this.structure);
601
+ } else {
530
602
  return null;
603
+ }
531
604
  }
532
605
  toJSON() {
533
- let e = { stepType: "replace", from: this.from, to: this.to };
534
- return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
606
+ let json = { stepType: "replace", from: this.from, to: this.to };
607
+ if (this.slice.size)
608
+ json.slice = this.slice.toJSON();
609
+ if (this.structure)
610
+ json.structure = true;
611
+ return json;
535
612
  }
536
613
  /**
537
614
  @internal
538
615
  */
539
- static fromJSON(e, t) {
540
- if (typeof t.from != "number" || typeof t.to != "number")
616
+ static fromJSON(schema, json) {
617
+ if (typeof json.from != "number" || typeof json.to != "number")
541
618
  throw new RangeError("Invalid input for ReplaceStep.fromJSON");
542
- return new v(t.from, t.to, w.fromJSON(e, t.slice), !!t.structure);
619
+ return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
543
620
  }
544
621
  }
545
- k.jsonID("replace", v);
546
- class M extends k {
622
+ Step.jsonID("replace", ReplaceStep);
623
+ class ReplaceAroundStep extends Step {
547
624
  /**
548
625
  Create a replace-around step with the given range and gap.
549
626
  `insert` should be the point in the slice into which the content
550
627
  of the gap should be moved. `structure` has the same meaning as
551
628
  it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
552
629
  */
553
- constructor(e, t, r, n, i, o, l = !1) {
554
- super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = n, this.slice = i, this.insert = o, this.structure = l;
555
- }
556
- apply(e) {
557
- if (this.structure && (q(e, this.from, this.gapFrom) || q(e, this.gapTo, this.to)))
558
- return y.fail("Structure gap-replace would overwrite content");
559
- let t = e.slice(this.gapFrom, this.gapTo);
560
- if (t.openStart || t.openEnd)
561
- return y.fail("Gap is not a flat range");
562
- let r = this.slice.insertAt(this.insert, t.content);
563
- return r ? y.fromReplace(e, this.from, this.to, r) : y.fail("Content does not fit in gap");
630
+ constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
631
+ super();
632
+ this.from = from;
633
+ this.to = to;
634
+ this.gapFrom = gapFrom;
635
+ this.gapTo = gapTo;
636
+ this.slice = slice;
637
+ this.insert = insert;
638
+ this.structure = structure;
639
+ }
640
+ apply(doc) {
641
+ if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to)))
642
+ return StepResult.fail("Structure gap-replace would overwrite content");
643
+ let gap = doc.slice(this.gapFrom, this.gapTo);
644
+ if (gap.openStart || gap.openEnd)
645
+ return StepResult.fail("Gap is not a flat range");
646
+ let inserted = this.slice.insertAt(this.insert, gap.content);
647
+ if (!inserted)
648
+ return StepResult.fail("Content does not fit in gap");
649
+ return StepResult.fromReplace(doc, this.from, this.to, inserted);
564
650
  }
565
651
  getMap() {
566
- return new S([
652
+ return new StepMap([
567
653
  this.from,
568
654
  this.gapFrom - this.from,
569
655
  this.insert,
@@ -572,16 +658,20 @@ class M extends k {
572
658
  this.slice.size - this.insert
573
659
  ]);
574
660
  }
575
- invert(e) {
576
- let t = this.gapTo - this.gapFrom;
577
- return new M(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
661
+ invert(doc) {
662
+ let gap = this.gapTo - this.gapFrom;
663
+ return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
578
664
  }
579
- map(e) {
580
- let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1), n = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), i = this.to == this.gapTo ? r.pos : e.map(this.gapTo, 1);
581
- return t.deletedAcross && r.deletedAcross || n < t.pos || i > r.pos ? null : new M(t.pos, r.pos, n, i, this.slice, this.insert, this.structure);
665
+ map(mapping) {
666
+ let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
667
+ let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
668
+ let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
669
+ if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos)
670
+ return null;
671
+ return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
582
672
  }
583
673
  toJSON() {
584
- let e = {
674
+ let json = {
585
675
  stepType: "replaceAround",
586
676
  from: this.from,
587
677
  to: this.to,
@@ -589,690 +679,892 @@ class M extends k {
589
679
  gapTo: this.gapTo,
590
680
  insert: this.insert
591
681
  };
592
- return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
682
+ if (this.slice.size)
683
+ json.slice = this.slice.toJSON();
684
+ if (this.structure)
685
+ json.structure = true;
686
+ return json;
593
687
  }
594
688
  /**
595
689
  @internal
596
690
  */
597
- static fromJSON(e, t) {
598
- if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
691
+ static fromJSON(schema, json) {
692
+ if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
599
693
  throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
600
- return new M(t.from, t.to, t.gapFrom, t.gapTo, w.fromJSON(e, t.slice), t.insert, !!t.structure);
694
+ return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
601
695
  }
602
696
  }
603
- k.jsonID("replaceAround", M);
604
- function q(s, e, t) {
605
- let r = s.resolve(e), n = t - e, i = r.depth;
606
- for (; n > 0 && i > 0 && r.indexAfter(i) == r.node(i).childCount; )
607
- i--, n--;
608
- if (n > 0) {
609
- let o = r.node(i).maybeChild(r.indexAfter(i));
610
- for (; n > 0; ) {
611
- if (!o || o.isLeaf)
612
- return !0;
613
- o = o.firstChild, n--;
697
+ Step.jsonID("replaceAround", ReplaceAroundStep);
698
+ function contentBetween(doc, from, to) {
699
+ let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
700
+ while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
701
+ depth--;
702
+ dist--;
703
+ }
704
+ if (dist > 0) {
705
+ let next = $from.node(depth).maybeChild($from.indexAfter(depth));
706
+ while (dist > 0) {
707
+ if (!next || next.isLeaf)
708
+ return true;
709
+ next = next.firstChild;
710
+ dist--;
614
711
  }
615
712
  }
616
- return !1;
713
+ return false;
617
714
  }
618
- function pe(s, e, t, r) {
619
- let n = [], i = [], o, l;
620
- s.doc.nodesBetween(e, t, (a, h, p) => {
621
- if (!a.isInline)
715
+ function addMark(tr, from, to, mark) {
716
+ let removed = [], added = [];
717
+ let removing, adding;
718
+ tr.doc.nodesBetween(from, to, (node, pos, parent) => {
719
+ if (!node.isInline)
622
720
  return;
623
- let c = a.marks;
624
- if (!r.isInSet(c) && p.type.allowsMarkType(r.type)) {
625
- let f = Math.max(h, e), d = Math.min(h + a.nodeSize, t), u = r.addToSet(c);
626
- for (let m = 0; m < c.length; m++)
627
- c[m].isInSet(u) || (o && o.to == f && o.mark.eq(c[m]) ? o.to = d : n.push(o = new b(f, d, c[m])));
628
- l && l.to == f ? l.to = d : i.push(l = new C(f, d, r));
721
+ let marks = node.marks;
722
+ if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
723
+ let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
724
+ let newSet = mark.addToSet(marks);
725
+ for (let i = 0; i < marks.length; i++) {
726
+ if (!marks[i].isInSet(newSet)) {
727
+ if (removing && removing.to == start && removing.mark.eq(marks[i]))
728
+ removing.to = end;
729
+ else
730
+ removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
731
+ }
732
+ }
733
+ if (adding && adding.to == start)
734
+ adding.to = end;
735
+ else
736
+ added.push(adding = new AddMarkStep(start, end, mark));
629
737
  }
630
- }), n.forEach((a) => s.step(a)), i.forEach((a) => s.step(a));
738
+ });
739
+ removed.forEach((s) => tr.step(s));
740
+ added.forEach((s) => tr.step(s));
631
741
  }
632
- function fe(s, e, t, r) {
633
- let n = [], i = 0;
634
- s.doc.nodesBetween(e, t, (o, l) => {
635
- if (!o.isInline)
742
+ function removeMark(tr, from, to, mark) {
743
+ let matched = [], step = 0;
744
+ tr.doc.nodesBetween(from, to, (node, pos) => {
745
+ if (!node.isInline)
636
746
  return;
637
- i++;
638
- let a = null;
639
- if (r instanceof oe) {
640
- let h = o.marks, p;
641
- for (; p = r.isInSet(h); )
642
- (a || (a = [])).push(p), h = p.removeFromSet(h);
643
- } else r ? r.isInSet(o.marks) && (a = [r]) : a = o.marks;
644
- if (a && a.length) {
645
- let h = Math.min(l + o.nodeSize, t);
646
- for (let p = 0; p < a.length; p++) {
647
- let c = a[p], f;
648
- for (let d = 0; d < n.length; d++) {
649
- let u = n[d];
650
- u.step == i - 1 && c.eq(n[d].style) && (f = u);
747
+ step++;
748
+ let toRemove = null;
749
+ if (mark instanceof MarkType) {
750
+ let set = node.marks, found;
751
+ while (found = mark.isInSet(set)) {
752
+ (toRemove || (toRemove = [])).push(found);
753
+ set = found.removeFromSet(set);
754
+ }
755
+ } else if (mark) {
756
+ if (mark.isInSet(node.marks))
757
+ toRemove = [mark];
758
+ } else {
759
+ toRemove = node.marks;
760
+ }
761
+ if (toRemove && toRemove.length) {
762
+ let end = Math.min(pos + node.nodeSize, to);
763
+ for (let i = 0; i < toRemove.length; i++) {
764
+ let style = toRemove[i], found;
765
+ for (let j = 0; j < matched.length; j++) {
766
+ let m = matched[j];
767
+ if (m.step == step - 1 && style.eq(matched[j].style))
768
+ found = m;
769
+ }
770
+ if (found) {
771
+ found.to = end;
772
+ found.step = step;
773
+ } else {
774
+ matched.push({ style, from: Math.max(pos, from), to: end, step });
651
775
  }
652
- f ? (f.to = h, f.step = i) : n.push({ style: c, from: Math.max(l, e), to: h, step: i });
653
776
  }
654
777
  }
655
- }), n.forEach((o) => s.step(new b(o.from, o.to, o.style)));
778
+ });
779
+ matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
656
780
  }
657
- function $(s, e, t, r = t.contentMatch, n = !0) {
658
- let i = s.doc.nodeAt(e), o = [], l = e + 1;
659
- for (let a = 0; a < i.childCount; a++) {
660
- let h = i.child(a), p = l + h.nodeSize, c = r.matchType(h.type);
661
- if (!c)
662
- o.push(new v(l, p, w.empty));
663
- else {
664
- r = c;
665
- for (let f = 0; f < h.marks.length; f++)
666
- t.allowsMarkType(h.marks[f].type) || s.step(new b(l, p, h.marks[f]));
667
- if (n && h.isText && t.whitespace != "pre") {
668
- let f, d = /\r?\n|\r/g, u;
669
- for (; f = d.exec(h.text); )
670
- u || (u = new w(g.from(t.schema.text(" ", t.allowedMarks(h.marks))), 0, 0)), o.push(new v(l + f.index, l + f.index + f[0].length, u));
781
+ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
782
+ let node = tr.doc.nodeAt(pos);
783
+ let replSteps = [], cur = pos + 1;
784
+ for (let i = 0; i < node.childCount; i++) {
785
+ let child = node.child(i), end = cur + child.nodeSize;
786
+ let allowed = match.matchType(child.type);
787
+ if (!allowed) {
788
+ replSteps.push(new ReplaceStep(cur, end, Slice.empty));
789
+ } else {
790
+ match = allowed;
791
+ for (let j = 0; j < child.marks.length; j++)
792
+ if (!parentType.allowsMarkType(child.marks[j].type))
793
+ tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
794
+ if (clearNewlines && child.isText && parentType.whitespace != "pre") {
795
+ let m, newline = /\r?\n|\r/g, slice;
796
+ while (m = newline.exec(child.text)) {
797
+ if (!slice)
798
+ slice = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
799
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
800
+ }
671
801
  }
672
802
  }
673
- l = p;
803
+ cur = end;
674
804
  }
675
- if (!r.validEnd) {
676
- let a = r.fillBefore(g.empty, !0);
677
- s.replace(l, l, new w(a, 0, 0));
805
+ if (!match.validEnd) {
806
+ let fill = match.fillBefore(Fragment.empty, true);
807
+ tr.replace(cur, cur, new Slice(fill, 0, 0));
678
808
  }
679
- for (let a = o.length - 1; a >= 0; a--)
680
- s.step(o[a]);
809
+ for (let i = replSteps.length - 1; i >= 0; i--)
810
+ tr.step(replSteps[i]);
681
811
  }
682
- function ce(s, e, t) {
683
- return (e == 0 || s.canReplace(e, s.childCount)) && (t == s.childCount || s.canReplace(0, t));
812
+ function canCut(node, start, end) {
813
+ return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
684
814
  }
685
- function Fe(s) {
686
- let t = s.parent.content.cutByIndex(s.startIndex, s.endIndex);
687
- for (let r = s.depth; ; --r) {
688
- let n = s.$from.node(r), i = s.$from.index(r), o = s.$to.indexAfter(r);
689
- if (r < s.depth && n.canReplace(i, o, t))
690
- return r;
691
- if (r == 0 || n.type.spec.isolating || !ce(n, i, o))
815
+ function liftTarget(range) {
816
+ let parent = range.parent;
817
+ let content = parent.content.cutByIndex(range.startIndex, range.endIndex);
818
+ for (let depth = range.depth; ; --depth) {
819
+ let node = range.$from.node(depth);
820
+ let index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth);
821
+ if (depth < range.depth && node.canReplace(index, endIndex, content))
822
+ return depth;
823
+ if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))
692
824
  break;
693
825
  }
694
826
  return null;
695
827
  }
696
- function de(s, e, t) {
697
- let { $from: r, $to: n, depth: i } = e, o = r.before(i + 1), l = n.after(i + 1), a = o, h = l, p = g.empty, c = 0;
698
- for (let u = i, m = !1; u > t; u--)
699
- m || r.index(u) > 0 ? (m = !0, p = g.from(r.node(u).copy(p)), c++) : a--;
700
- let f = g.empty, d = 0;
701
- for (let u = i, m = !1; u > t; u--)
702
- m || n.after(u + 1) < n.end(u) ? (m = !0, f = g.from(n.node(u).copy(f)), d++) : h++;
703
- s.step(new M(a, h, o, l, new w(p.append(f), c, d), p.size - c, !0));
828
+ function lift(tr, range, target) {
829
+ let { $from, $to, depth } = range;
830
+ let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
831
+ let start = gapStart, end = gapEnd;
832
+ let before = Fragment.empty, openStart = 0;
833
+ for (let d = depth, splitting = false; d > target; d--)
834
+ if (splitting || $from.index(d) > 0) {
835
+ splitting = true;
836
+ before = Fragment.from($from.node(d).copy(before));
837
+ openStart++;
838
+ } else {
839
+ start--;
840
+ }
841
+ let after = Fragment.empty, openEnd = 0;
842
+ for (let d = depth, splitting = false; d > target; d--)
843
+ if (splitting || $to.after(d + 1) < $to.end(d)) {
844
+ splitting = true;
845
+ after = Fragment.from($to.node(d).copy(after));
846
+ openEnd++;
847
+ } else {
848
+ end++;
849
+ }
850
+ tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
704
851
  }
705
- function ze(s, e, t = null, r = s) {
706
- let n = ue(s, e), i = n && me(r, e);
707
- return i ? n.map(K).concat({ type: e, attrs: t }).concat(i.map(K)) : null;
852
+ function findWrapping(range, nodeType, attrs = null, innerRange = range) {
853
+ let around = findWrappingOutside(range, nodeType);
854
+ let inner = around && findWrappingInside(innerRange, nodeType);
855
+ if (!inner)
856
+ return null;
857
+ return around.map(withAttrs).concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));
708
858
  }
709
- function K(s) {
710
- return { type: s, attrs: null };
859
+ function withAttrs(type) {
860
+ return { type, attrs: null };
711
861
  }
712
- function ue(s, e) {
713
- let { parent: t, startIndex: r, endIndex: n } = s, i = t.contentMatchAt(r).findWrapping(e);
714
- if (!i)
862
+ function findWrappingOutside(range, type) {
863
+ let { parent, startIndex, endIndex } = range;
864
+ let around = parent.contentMatchAt(startIndex).findWrapping(type);
865
+ if (!around)
715
866
  return null;
716
- let o = i.length ? i[0] : e;
717
- return t.canReplaceWith(r, n, o) ? i : null;
867
+ let outer = around.length ? around[0] : type;
868
+ return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
718
869
  }
719
- function me(s, e) {
720
- let { parent: t, startIndex: r, endIndex: n } = s, i = t.child(r), o = e.contentMatch.findWrapping(i.type);
721
- if (!o)
870
+ function findWrappingInside(range, type) {
871
+ let { parent, startIndex, endIndex } = range;
872
+ let inner = parent.child(startIndex);
873
+ let inside = type.contentMatch.findWrapping(inner.type);
874
+ if (!inside)
875
+ return null;
876
+ let lastType = inside.length ? inside[inside.length - 1] : type;
877
+ let innerMatch = lastType.contentMatch;
878
+ for (let i = startIndex; innerMatch && i < endIndex; i++)
879
+ innerMatch = innerMatch.matchType(parent.child(i).type);
880
+ if (!innerMatch || !innerMatch.validEnd)
722
881
  return null;
723
- let a = (o.length ? o[o.length - 1] : e).contentMatch;
724
- for (let h = r; a && h < n; h++)
725
- a = a.matchType(t.child(h).type);
726
- return !a || !a.validEnd ? null : o;
882
+ return inside;
727
883
  }
728
- function we(s, e, t) {
729
- let r = g.empty;
730
- for (let o = t.length - 1; o >= 0; o--) {
731
- if (r.size) {
732
- let l = t[o].type.contentMatch.matchFragment(r);
733
- if (!l || !l.validEnd)
884
+ function wrap(tr, range, wrappers) {
885
+ let content = Fragment.empty;
886
+ for (let i = wrappers.length - 1; i >= 0; i--) {
887
+ if (content.size) {
888
+ let match = wrappers[i].type.contentMatch.matchFragment(content);
889
+ if (!match || !match.validEnd)
734
890
  throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
735
891
  }
736
- r = g.from(t[o].type.create(t[o].attrs, r));
892
+ content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
737
893
  }
738
- let n = e.start, i = e.end;
739
- s.step(new M(n, i, n, i, new w(r, 0, 0), t.length, !0));
894
+ let start = range.start, end = range.end;
895
+ tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
740
896
  }
741
- function ge(s, e, t, r, n) {
742
- if (!r.isTextblock)
897
+ function setBlockType(tr, from, to, type, attrs) {
898
+ if (!type.isTextblock)
743
899
  throw new RangeError("Type given to setBlockType should be a textblock");
744
- let i = s.steps.length;
745
- s.doc.nodesBetween(e, t, (o, l) => {
746
- let a = typeof n == "function" ? n(o) : n;
747
- if (o.isTextblock && !o.hasMarkup(r, a) && ye(s.doc, s.mapping.slice(i).map(l), r)) {
748
- let h = null;
749
- if (r.schema.linebreakReplacement) {
750
- let d = r.whitespace == "pre", u = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
751
- d && !u ? h = !1 : !d && u && (h = !0);
900
+ let mapFrom = tr.steps.length;
901
+ tr.doc.nodesBetween(from, to, (node, pos) => {
902
+ let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
903
+ if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
904
+ let convertNewlines = null;
905
+ if (type.schema.linebreakReplacement) {
906
+ let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
907
+ if (pre && !supportLinebreak)
908
+ convertNewlines = false;
909
+ else if (!pre && supportLinebreak)
910
+ convertNewlines = true;
752
911
  }
753
- h === !1 && _(s, o, l, i), $(s, s.mapping.slice(i).map(l, 1), r, void 0, h === null);
754
- let p = s.mapping.slice(i), c = p.map(l, 1), f = p.map(l + o.nodeSize, 1);
755
- return s.step(new M(c, f, c + 1, f - 1, new w(g.from(r.create(a, null, o.marks)), 0, 0), 1, !0)), h === !0 && Z(s, o, l, i), !1;
912
+ if (convertNewlines === false)
913
+ replaceLinebreaks(tr, node, pos, mapFrom);
914
+ clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
915
+ let mapping = tr.mapping.slice(mapFrom);
916
+ let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
917
+ tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
918
+ if (convertNewlines === true)
919
+ replaceNewlines(tr, node, pos, mapFrom);
920
+ return false;
756
921
  }
757
922
  });
758
923
  }
759
- function Z(s, e, t, r) {
760
- e.forEach((n, i) => {
761
- if (n.isText) {
762
- let o, l = /\r?\n|\r/g;
763
- for (; o = l.exec(n.text); ) {
764
- let a = s.mapping.slice(r).map(t + 1 + i + o.index);
765
- s.replaceWith(a, a + 1, e.type.schema.linebreakReplacement.create());
924
+ function replaceNewlines(tr, node, pos, mapFrom) {
925
+ node.forEach((child, offset) => {
926
+ if (child.isText) {
927
+ let m, newline = /\r?\n|\r/g;
928
+ while (m = newline.exec(child.text)) {
929
+ let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
930
+ tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
766
931
  }
767
932
  }
768
933
  });
769
934
  }
770
- function _(s, e, t, r) {
771
- e.forEach((n, i) => {
772
- if (n.type == n.type.schema.linebreakReplacement) {
773
- let o = s.mapping.slice(r).map(t + 1 + i);
774
- s.replaceWith(o, o + 1, e.type.schema.text(`
775
- `));
935
+ function replaceLinebreaks(tr, node, pos, mapFrom) {
936
+ node.forEach((child, offset) => {
937
+ if (child.type == child.type.schema.linebreakReplacement) {
938
+ let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
939
+ tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
776
940
  }
777
941
  });
778
942
  }
779
- function ye(s, e, t) {
780
- let r = s.resolve(e), n = r.index();
781
- return r.parent.canReplaceWith(n, n + 1, t);
943
+ function canChangeType(doc, pos, type) {
944
+ let $pos = doc.resolve(pos), index = $pos.index();
945
+ return $pos.parent.canReplaceWith(index, index + 1, type);
782
946
  }
783
- function ke(s, e, t, r, n) {
784
- let i = s.doc.nodeAt(e);
785
- if (!i)
947
+ function setNodeMarkup(tr, pos, type, attrs, marks) {
948
+ let node = tr.doc.nodeAt(pos);
949
+ if (!node)
786
950
  throw new RangeError("No node at given position");
787
- t || (t = i.type);
788
- let o = t.create(r, null, n || i.marks);
789
- if (i.isLeaf)
790
- return s.replaceWith(e, e + i.nodeSize, o);
791
- if (!t.validContent(i.content))
792
- throw new RangeError("Invalid content for node type " + t.name);
793
- s.step(new M(e, e + i.nodeSize, e + 1, e + i.nodeSize - 1, new w(g.from(o), 0, 0), 1, !0));
951
+ if (!type)
952
+ type = node.type;
953
+ let newNode = type.create(attrs, null, marks || node.marks);
954
+ if (node.isLeaf)
955
+ return tr.replaceWith(pos, pos + node.nodeSize, newNode);
956
+ if (!type.validContent(node.content))
957
+ throw new RangeError("Invalid content for node type " + type.name);
958
+ tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
794
959
  }
795
- function Je(s, e, t = 1, r) {
796
- let n = s.resolve(e), i = n.depth - t, o = r && r[r.length - 1] || n.parent;
797
- if (i < 0 || n.parent.type.spec.isolating || !n.parent.canReplace(n.index(), n.parent.childCount) || !o.type.validContent(n.parent.content.cutByIndex(n.index(), n.parent.childCount)))
798
- return !1;
799
- for (let h = n.depth - 1, p = t - 2; h > i; h--, p--) {
800
- let c = n.node(h), f = n.index(h);
801
- if (c.type.spec.isolating)
802
- return !1;
803
- let d = c.content.cutByIndex(f, c.childCount), u = r && r[p + 1];
804
- u && (d = d.replaceChild(0, u.type.create(u.attrs)));
805
- let m = r && r[p] || c;
806
- if (!c.canReplace(f + 1, c.childCount) || !m.type.validContent(d))
807
- return !1;
808
- }
809
- let l = n.indexAfter(i), a = r && r[0];
810
- return n.node(i).canReplaceWith(l, l, a ? a.type : n.node(i + 1).type);
960
+ function canSplit(doc, pos, depth = 1, typesAfter) {
961
+ let $pos = doc.resolve(pos), base = $pos.depth - depth;
962
+ let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
963
+ if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
964
+ return false;
965
+ for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
966
+ let node = $pos.node(d), index2 = $pos.index(d);
967
+ if (node.type.spec.isolating)
968
+ return false;
969
+ let rest = node.content.cutByIndex(index2, node.childCount);
970
+ let overrideChild = typesAfter && typesAfter[i + 1];
971
+ if (overrideChild)
972
+ rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
973
+ let after = typesAfter && typesAfter[i] || node;
974
+ if (!node.canReplace(index2 + 1, node.childCount) || !after.type.validContent(rest))
975
+ return false;
976
+ }
977
+ let index = $pos.indexAfter(base);
978
+ let baseType = typesAfter && typesAfter[0];
979
+ return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
811
980
  }
812
- function ve(s, e, t = 1, r) {
813
- let n = s.doc.resolve(e), i = g.empty, o = g.empty;
814
- for (let l = n.depth, a = n.depth - t, h = t - 1; l > a; l--, h--) {
815
- i = g.from(n.node(l).copy(i));
816
- let p = r && r[h];
817
- o = g.from(p ? p.type.create(p.attrs, o) : n.node(l).copy(o));
818
- }
819
- s.step(new v(e, e, new w(i.append(o), t, t), !0));
981
+ function split(tr, pos, depth = 1, typesAfter) {
982
+ let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;
983
+ for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
984
+ before = Fragment.from($pos.node(d).copy(before));
985
+ let typeAfter = typesAfter && typesAfter[i];
986
+ after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
987
+ }
988
+ tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
820
989
  }
821
- function Ae(s, e) {
822
- let t = s.resolve(e), r = t.index();
823
- return j(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(r, r + 1);
990
+ function canJoin(doc, pos) {
991
+ let $pos = doc.resolve(pos), index = $pos.index();
992
+ return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
824
993
  }
825
- function xe(s, e) {
826
- e.content.size || s.type.compatibleContent(e.type);
827
- let t = s.contentMatchAt(s.childCount), { linebreakReplacement: r } = s.type.schema;
828
- for (let n = 0; n < e.childCount; n++) {
829
- let i = e.child(n), o = i.type == r ? s.type.schema.nodes.text : i.type;
830
- if (t = t.matchType(o), !t || !s.type.allowsMarks(i.marks))
831
- return !1;
832
- }
833
- return t.validEnd;
994
+ function canAppendWithSubstitutedLinebreaks(a, b) {
995
+ if (!b.content.size)
996
+ a.type.compatibleContent(b.type);
997
+ let match = a.contentMatchAt(a.childCount);
998
+ let { linebreakReplacement } = a.type.schema;
999
+ for (let i = 0; i < b.childCount; i++) {
1000
+ let child = b.child(i);
1001
+ let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
1002
+ match = match.matchType(type);
1003
+ if (!match)
1004
+ return false;
1005
+ if (!a.type.allowsMarks(child.marks))
1006
+ return false;
1007
+ }
1008
+ return match.validEnd;
834
1009
  }
835
- function j(s, e) {
836
- return !!(s && e && !s.isLeaf && xe(s, e));
1010
+ function joinable(a, b) {
1011
+ return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
837
1012
  }
838
- function Be(s, e, t = -1) {
839
- let r = s.resolve(e);
840
- for (let n = r.depth; ; n--) {
841
- let i, o, l = r.index(n);
842
- if (n == r.depth ? (i = r.nodeBefore, o = r.nodeAfter) : t > 0 ? (i = r.node(n + 1), l++, o = r.node(n).maybeChild(l)) : (i = r.node(n).maybeChild(l - 1), o = r.node(n + 1)), i && !i.isTextblock && j(i, o) && r.node(n).canReplace(l, l + 1))
843
- return e;
844
- if (n == 0)
1013
+ function joinPoint(doc, pos, dir = -1) {
1014
+ let $pos = doc.resolve(pos);
1015
+ for (let d = $pos.depth; ; d--) {
1016
+ let before, after, index = $pos.index(d);
1017
+ if (d == $pos.depth) {
1018
+ before = $pos.nodeBefore;
1019
+ after = $pos.nodeAfter;
1020
+ } else if (dir > 0) {
1021
+ before = $pos.node(d + 1);
1022
+ index++;
1023
+ after = $pos.node(d).maybeChild(index);
1024
+ } else {
1025
+ before = $pos.node(d).maybeChild(index - 1);
1026
+ after = $pos.node(d + 1);
1027
+ }
1028
+ if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1))
1029
+ return pos;
1030
+ if (d == 0)
845
1031
  break;
846
- e = t < 0 ? r.before(n) : r.after(n);
1032
+ pos = dir < 0 ? $pos.before(d) : $pos.after(d);
847
1033
  }
848
1034
  }
849
- function Se(s, e, t) {
850
- let r = null, { linebreakReplacement: n } = s.doc.type.schema, i = s.doc.resolve(e - t), o = i.node().type;
851
- if (n && o.inlineContent) {
852
- let p = o.whitespace == "pre", c = !!o.contentMatch.matchType(n);
853
- p && !c ? r = !1 : !p && c && (r = !0);
854
- }
855
- let l = s.steps.length;
856
- if (r === !1) {
857
- let p = s.doc.resolve(e + t);
858
- _(s, p.node(), p.before(), l);
859
- }
860
- o.inlineContent && $(s, e + t - 1, o, i.node().contentMatchAt(i.index()), r == null);
861
- let a = s.mapping.slice(l), h = a.map(e - t);
862
- if (s.step(new v(h, a.map(e + t, -1), w.empty, !0)), r === !0) {
863
- let p = s.doc.resolve(h);
864
- Z(s, p.node(), p.before(), s.steps.length);
865
- }
866
- return s;
1035
+ function join(tr, pos, depth) {
1036
+ let convertNewlines = null;
1037
+ let { linebreakReplacement } = tr.doc.type.schema;
1038
+ let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;
1039
+ if (linebreakReplacement && beforeType.inlineContent) {
1040
+ let pre = beforeType.whitespace == "pre";
1041
+ let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
1042
+ if (pre && !supportLinebreak)
1043
+ convertNewlines = false;
1044
+ else if (!pre && supportLinebreak)
1045
+ convertNewlines = true;
1046
+ }
1047
+ let mapFrom = tr.steps.length;
1048
+ if (convertNewlines === false) {
1049
+ let $after = tr.doc.resolve(pos + depth);
1050
+ replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
1051
+ }
1052
+ if (beforeType.inlineContent)
1053
+ clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
1054
+ let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);
1055
+ tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));
1056
+ if (convertNewlines === true) {
1057
+ let $full = tr.doc.resolve(start);
1058
+ replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
1059
+ }
1060
+ return tr;
867
1061
  }
868
- function be(s, e, t) {
869
- let r = s.resolve(e);
870
- if (r.parent.canReplaceWith(r.index(), r.index(), t))
871
- return e;
872
- if (r.parentOffset == 0)
873
- for (let n = r.depth - 1; n >= 0; n--) {
874
- let i = r.index(n);
875
- if (r.node(n).canReplaceWith(i, i, t))
876
- return r.before(n + 1);
877
- if (i > 0)
1062
+ function insertPoint(doc, pos, nodeType) {
1063
+ let $pos = doc.resolve(pos);
1064
+ if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))
1065
+ return pos;
1066
+ if ($pos.parentOffset == 0)
1067
+ for (let d = $pos.depth - 1; d >= 0; d--) {
1068
+ let index = $pos.index(d);
1069
+ if ($pos.node(d).canReplaceWith(index, index, nodeType))
1070
+ return $pos.before(d + 1);
1071
+ if (index > 0)
878
1072
  return null;
879
1073
  }
880
- if (r.parentOffset == r.parent.content.size)
881
- for (let n = r.depth - 1; n >= 0; n--) {
882
- let i = r.indexAfter(n);
883
- if (r.node(n).canReplaceWith(i, i, t))
884
- return r.after(n + 1);
885
- if (i < r.node(n).childCount)
1074
+ if ($pos.parentOffset == $pos.parent.content.size)
1075
+ for (let d = $pos.depth - 1; d >= 0; d--) {
1076
+ let index = $pos.indexAfter(d);
1077
+ if ($pos.node(d).canReplaceWith(index, index, nodeType))
1078
+ return $pos.after(d + 1);
1079
+ if (index < $pos.node(d).childCount)
886
1080
  return null;
887
1081
  }
888
1082
  return null;
889
1083
  }
890
- function We(s, e, t) {
891
- let r = s.resolve(e);
892
- if (!t.content.size)
893
- return e;
894
- let n = t.content;
895
- for (let i = 0; i < t.openStart; i++)
896
- n = n.firstChild.content;
897
- for (let i = 1; i <= (t.openStart == 0 && t.size ? 2 : 1); i++)
898
- for (let o = r.depth; o >= 0; o--) {
899
- let l = o == r.depth ? 0 : r.pos <= (r.start(o + 1) + r.end(o + 1)) / 2 ? -1 : 1, a = r.index(o) + (l > 0 ? 1 : 0), h = r.node(o), p = !1;
900
- if (i == 1)
901
- p = h.canReplace(a, a, n);
902
- else {
903
- let c = h.contentMatchAt(a).findWrapping(n.firstChild.type);
904
- p = c && h.canReplaceWith(a, a, c[0]);
1084
+ function dropPoint(doc, pos, slice) {
1085
+ let $pos = doc.resolve(pos);
1086
+ if (!slice.content.size)
1087
+ return pos;
1088
+ let content = slice.content;
1089
+ for (let i = 0; i < slice.openStart; i++)
1090
+ content = content.firstChild.content;
1091
+ for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
1092
+ for (let d = $pos.depth; d >= 0; d--) {
1093
+ let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
1094
+ let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
1095
+ let parent = $pos.node(d), fits = false;
1096
+ if (pass == 1) {
1097
+ fits = parent.canReplace(insertPos, insertPos, content);
1098
+ } else {
1099
+ let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
1100
+ fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
905
1101
  }
906
- if (p)
907
- return l == 0 ? r.pos : l < 0 ? r.before(o + 1) : r.after(o + 1);
1102
+ if (fits)
1103
+ return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
908
1104
  }
1105
+ }
909
1106
  return null;
910
1107
  }
911
- function Me(s, e, t = e, r = w.empty) {
912
- if (e == t && !r.size)
1108
+ function replaceStep(doc, from, to = from, slice = Slice.empty) {
1109
+ if (from == to && !slice.size)
913
1110
  return null;
914
- let n = s.resolve(e), i = s.resolve(t);
915
- return ee(n, i, r) ? new v(e, t, r) : new Ce(n, i, r).fit();
1111
+ let $from = doc.resolve(from), $to = doc.resolve(to);
1112
+ if (fitsTrivially($from, $to, slice))
1113
+ return new ReplaceStep(from, to, slice);
1114
+ return new Fitter($from, $to, slice).fit();
916
1115
  }
917
- function ee(s, e, t) {
918
- return !t.openStart && !t.openEnd && s.start() == e.start() && s.parent.canReplace(s.index(), e.index(), t.content);
1116
+ function fitsTrivially($from, $to, slice) {
1117
+ return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
919
1118
  }
920
- class Ce {
921
- constructor(e, t, r) {
922
- this.$from = e, this.$to = t, this.unplaced = r, this.frontier = [], this.placed = g.empty;
923
- for (let n = 0; n <= e.depth; n++) {
924
- let i = e.node(n);
1119
+ class Fitter {
1120
+ constructor($from, $to, unplaced) {
1121
+ this.$from = $from;
1122
+ this.$to = $to;
1123
+ this.unplaced = unplaced;
1124
+ this.frontier = [];
1125
+ this.placed = Fragment.empty;
1126
+ for (let i = 0; i <= $from.depth; i++) {
1127
+ let node = $from.node(i);
925
1128
  this.frontier.push({
926
- type: i.type,
927
- match: i.contentMatchAt(e.indexAfter(n))
1129
+ type: node.type,
1130
+ match: node.contentMatchAt($from.indexAfter(i))
928
1131
  });
929
1132
  }
930
- for (let n = e.depth; n > 0; n--)
931
- this.placed = g.from(e.node(n).copy(this.placed));
1133
+ for (let i = $from.depth; i > 0; i--)
1134
+ this.placed = Fragment.from($from.node(i).copy(this.placed));
932
1135
  }
933
1136
  get depth() {
934
1137
  return this.frontier.length - 1;
935
1138
  }
936
1139
  fit() {
937
- for (; this.unplaced.size; ) {
938
- let h = this.findFittable();
939
- h ? this.placeNodes(h) : this.openMore() || this.dropNode();
1140
+ while (this.unplaced.size) {
1141
+ let fit = this.findFittable();
1142
+ if (fit)
1143
+ this.placeNodes(fit);
1144
+ else
1145
+ this.openMore() || this.dropNode();
940
1146
  }
941
- let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, r = this.$from, n = this.close(e < 0 ? this.$to : r.doc.resolve(e));
942
- if (!n)
1147
+ let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;
1148
+ let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
1149
+ if (!$to)
943
1150
  return null;
944
- let i = this.placed, o = r.depth, l = n.depth;
945
- for (; o && l && i.childCount == 1; )
946
- i = i.firstChild.content, o--, l--;
947
- let a = new w(i, o, l);
948
- return e > -1 ? new M(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new v(r.pos, n.pos, a) : null;
1151
+ let content = this.placed, openStart = $from.depth, openEnd = $to.depth;
1152
+ while (openStart && openEnd && content.childCount == 1) {
1153
+ content = content.firstChild.content;
1154
+ openStart--;
1155
+ openEnd--;
1156
+ }
1157
+ let slice = new Slice(content, openStart, openEnd);
1158
+ if (moveInline > -1)
1159
+ return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
1160
+ if (slice.size || $from.pos != this.$to.pos)
1161
+ return new ReplaceStep($from.pos, $to.pos, slice);
1162
+ return null;
949
1163
  }
950
1164
  // Find a position on the start spine of `this.unplaced` that has
951
1165
  // content that can be moved somewhere on the frontier. Returns two
952
1166
  // depths, one for the slice and one for the frontier.
953
1167
  findFittable() {
954
- let e = this.unplaced.openStart;
955
- for (let t = this.unplaced.content, r = 0, n = this.unplaced.openEnd; r < e; r++) {
956
- let i = t.firstChild;
957
- if (t.childCount > 1 && (n = 0), i.type.spec.isolating && n <= r) {
958
- e = r;
1168
+ let startDepth = this.unplaced.openStart;
1169
+ for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
1170
+ let node = cur.firstChild;
1171
+ if (cur.childCount > 1)
1172
+ openEnd = 0;
1173
+ if (node.type.spec.isolating && openEnd <= d) {
1174
+ startDepth = d;
959
1175
  break;
960
1176
  }
961
- t = i.content;
1177
+ cur = node.content;
962
1178
  }
963
- for (let t = 1; t <= 2; t++)
964
- for (let r = t == 1 ? e : this.unplaced.openStart; r >= 0; r--) {
965
- let n, i = null;
966
- r ? (i = W(this.unplaced.content, r - 1).firstChild, n = i.content) : n = this.unplaced.content;
967
- let o = n.firstChild;
968
- for (let l = this.depth; l >= 0; l--) {
969
- let { type: a, match: h } = this.frontier[l], p, c = null;
970
- if (t == 1 && (o ? h.matchType(o.type) || (c = h.fillBefore(g.from(o), !1)) : i && a.compatibleContent(i.type)))
971
- return { sliceDepth: r, frontierDepth: l, parent: i, inject: c };
972
- if (t == 2 && o && (p = h.findWrapping(o.type)))
973
- return { sliceDepth: r, frontierDepth: l, parent: i, wrap: p };
974
- if (i && h.matchType(i.type))
1179
+ for (let pass = 1; pass <= 2; pass++) {
1180
+ for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
1181
+ let fragment, parent = null;
1182
+ if (sliceDepth) {
1183
+ parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
1184
+ fragment = parent.content;
1185
+ } else {
1186
+ fragment = this.unplaced.content;
1187
+ }
1188
+ let first = fragment.firstChild;
1189
+ for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
1190
+ let { type, match } = this.frontier[frontierDepth], wrap2, inject = null;
1191
+ if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false)) : parent && type.compatibleContent(parent.type)))
1192
+ return { sliceDepth, frontierDepth, parent, inject };
1193
+ else if (pass == 2 && first && (wrap2 = match.findWrapping(first.type)))
1194
+ return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
1195
+ if (parent && match.matchType(parent.type))
975
1196
  break;
976
1197
  }
977
1198
  }
1199
+ }
978
1200
  }
979
1201
  openMore() {
980
- let { content: e, openStart: t, openEnd: r } = this.unplaced, n = W(e, t);
981
- return !n.childCount || n.firstChild.isLeaf ? !1 : (this.unplaced = new w(e, t + 1, Math.max(r, n.size + t >= e.size - r ? t + 1 : 0)), !0);
1202
+ let { content, openStart, openEnd } = this.unplaced;
1203
+ let inner = contentAt(content, openStart);
1204
+ if (!inner.childCount || inner.firstChild.isLeaf)
1205
+ return false;
1206
+ this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
1207
+ return true;
982
1208
  }
983
1209
  dropNode() {
984
- let { content: e, openStart: t, openEnd: r } = this.unplaced, n = W(e, t);
985
- if (n.childCount <= 1 && t > 0) {
986
- let i = e.size - t <= t + n.size;
987
- this.unplaced = new w(O(e, t - 1, 1), t - 1, i ? t - 1 : r);
988
- } else
989
- this.unplaced = new w(O(e, t, 1), t, r);
1210
+ let { content, openStart, openEnd } = this.unplaced;
1211
+ let inner = contentAt(content, openStart);
1212
+ if (inner.childCount <= 1 && openStart > 0) {
1213
+ let openAtEnd = content.size - openStart <= openStart + inner.size;
1214
+ this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
1215
+ } else {
1216
+ this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
1217
+ }
990
1218
  }
991
1219
  // Move content from the unplaced slice at `sliceDepth` to the
992
1220
  // frontier node at `frontierDepth`. Close that frontier node when
993
1221
  // applicable.
994
- placeNodes({ sliceDepth: e, frontierDepth: t, parent: r, inject: n, wrap: i }) {
995
- for (; this.depth > t; )
1222
+ placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap: wrap2 }) {
1223
+ while (this.depth > frontierDepth)
996
1224
  this.closeFrontierNode();
997
- if (i)
998
- for (let m = 0; m < i.length; m++)
999
- this.openFrontierNode(i[m]);
1000
- let o = this.unplaced, l = r ? r.content : o.content, a = o.openStart - e, h = 0, p = [], { match: c, type: f } = this.frontier[t];
1001
- if (n) {
1002
- for (let m = 0; m < n.childCount; m++)
1003
- p.push(n.child(m));
1004
- c = c.matchFragment(n);
1225
+ if (wrap2)
1226
+ for (let i = 0; i < wrap2.length; i++)
1227
+ this.openFrontierNode(wrap2[i]);
1228
+ let slice = this.unplaced, fragment = parent ? parent.content : slice.content;
1229
+ let openStart = slice.openStart - sliceDepth;
1230
+ let taken = 0, add = [];
1231
+ let { match, type } = this.frontier[frontierDepth];
1232
+ if (inject) {
1233
+ for (let i = 0; i < inject.childCount; i++)
1234
+ add.push(inject.child(i));
1235
+ match = match.matchFragment(inject);
1005
1236
  }
1006
- let d = l.size + e - (o.content.size - o.openEnd);
1007
- for (; h < l.childCount; ) {
1008
- let m = l.child(h), x = c.matchType(m.type);
1009
- if (!x)
1237
+ let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
1238
+ while (taken < fragment.childCount) {
1239
+ let next = fragment.child(taken), matches = match.matchType(next.type);
1240
+ if (!matches)
1010
1241
  break;
1011
- h++, (h > 1 || a == 0 || m.content.size) && (c = x, p.push(te(m.mark(f.allowedMarks(m.marks)), h == 1 ? a : 0, h == l.childCount ? d : -1)));
1242
+ taken++;
1243
+ if (taken > 1 || openStart == 0 || next.content.size) {
1244
+ match = matches;
1245
+ add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
1246
+ }
1012
1247
  }
1013
- let u = h == l.childCount;
1014
- u || (d = -1), this.placed = F(this.placed, t, g.from(p)), this.frontier[t].match = c, u && d < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
1015
- for (let m = 0, x = l; m < d; m++) {
1016
- let I = x.lastChild;
1017
- this.frontier.push({ type: I.type, match: I.contentMatchAt(I.childCount) }), x = I.content;
1248
+ let toEnd = taken == fragment.childCount;
1249
+ if (!toEnd)
1250
+ openEndCount = -1;
1251
+ this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));
1252
+ this.frontier[frontierDepth].match = match;
1253
+ if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
1254
+ this.closeFrontierNode();
1255
+ for (let i = 0, cur = fragment; i < openEndCount; i++) {
1256
+ let node = cur.lastChild;
1257
+ this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });
1258
+ cur = node.content;
1018
1259
  }
1019
- this.unplaced = u ? e == 0 ? w.empty : new w(O(o.content, e - 1, 1), e - 1, d < 0 ? o.openEnd : e - 1) : new w(O(o.content, e, h), o.openStart, o.openEnd);
1260
+ this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
1020
1261
  }
1021
1262
  mustMoveInline() {
1022
1263
  if (!this.$to.parent.isTextblock)
1023
1264
  return -1;
1024
- let e = this.frontier[this.depth], t;
1025
- if (!e.type.isTextblock || !D(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth)
1265
+ let top = this.frontier[this.depth], level;
1266
+ if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth)
1026
1267
  return -1;
1027
- let { depth: r } = this.$to, n = this.$to.after(r);
1028
- for (; r > 1 && n == this.$to.end(--r); )
1029
- ++n;
1030
- return n;
1031
- }
1032
- findCloseLevel(e) {
1033
- e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
1034
- let { match: r, type: n } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), o = D(e, t, n, r, i);
1035
- if (o) {
1036
- for (let l = t - 1; l >= 0; l--) {
1037
- let { match: a, type: h } = this.frontier[l], p = D(e, l, h, a, !0);
1038
- if (!p || p.childCount)
1039
- continue e;
1040
- }
1041
- return { depth: t, fit: o, move: i ? e.doc.resolve(e.after(t + 1)) : e };
1268
+ let { depth } = this.$to, after = this.$to.after(depth);
1269
+ while (depth > 1 && after == this.$to.end(--depth))
1270
+ ++after;
1271
+ return after;
1272
+ }
1273
+ findCloseLevel($to) {
1274
+ scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
1275
+ let { match, type } = this.frontier[i];
1276
+ let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
1277
+ let fit = contentAfterFits($to, i, type, match, dropInner);
1278
+ if (!fit)
1279
+ continue;
1280
+ for (let d = i - 1; d >= 0; d--) {
1281
+ let { match: match2, type: type2 } = this.frontier[d];
1282
+ let matches = contentAfterFits($to, d, type2, match2, true);
1283
+ if (!matches || matches.childCount)
1284
+ continue scan;
1042
1285
  }
1286
+ return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };
1043
1287
  }
1044
1288
  }
1045
- close(e) {
1046
- let t = this.findCloseLevel(e);
1047
- if (!t)
1289
+ close($to) {
1290
+ let close = this.findCloseLevel($to);
1291
+ if (!close)
1048
1292
  return null;
1049
- for (; this.depth > t.depth; )
1293
+ while (this.depth > close.depth)
1050
1294
  this.closeFrontierNode();
1051
- t.fit.childCount && (this.placed = F(this.placed, t.depth, t.fit)), e = t.move;
1052
- for (let r = t.depth + 1; r <= e.depth; r++) {
1053
- let n = e.node(r), i = n.type.contentMatch.fillBefore(n.content, !0, e.index(r));
1054
- this.openFrontierNode(n.type, n.attrs, i);
1295
+ if (close.fit.childCount)
1296
+ this.placed = addToFragment(this.placed, close.depth, close.fit);
1297
+ $to = close.move;
1298
+ for (let d = close.depth + 1; d <= $to.depth; d++) {
1299
+ let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
1300
+ this.openFrontierNode(node.type, node.attrs, add);
1055
1301
  }
1056
- return e;
1302
+ return $to;
1057
1303
  }
1058
- openFrontierNode(e, t = null, r) {
1059
- let n = this.frontier[this.depth];
1060
- n.match = n.match.matchType(e), this.placed = F(this.placed, this.depth, g.from(e.create(t, r))), this.frontier.push({ type: e, match: e.contentMatch });
1304
+ openFrontierNode(type, attrs = null, content) {
1305
+ let top = this.frontier[this.depth];
1306
+ top.match = top.match.matchType(type);
1307
+ this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));
1308
+ this.frontier.push({ type, match: type.contentMatch });
1061
1309
  }
1062
1310
  closeFrontierNode() {
1063
- let t = this.frontier.pop().match.fillBefore(g.empty, !0);
1064
- t.childCount && (this.placed = F(this.placed, this.frontier.length, t));
1311
+ let open = this.frontier.pop();
1312
+ let add = open.match.fillBefore(Fragment.empty, true);
1313
+ if (add.childCount)
1314
+ this.placed = addToFragment(this.placed, this.frontier.length, add);
1065
1315
  }
1066
1316
  }
1067
- function O(s, e, t) {
1068
- return e == 0 ? s.cutByIndex(t, s.childCount) : s.replaceChild(0, s.firstChild.copy(O(s.firstChild.content, e - 1, t)));
1317
+ function dropFromFragment(fragment, depth, count) {
1318
+ if (depth == 0)
1319
+ return fragment.cutByIndex(count, fragment.childCount);
1320
+ return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
1069
1321
  }
1070
- function F(s, e, t) {
1071
- return e == 0 ? s.append(t) : s.replaceChild(s.childCount - 1, s.lastChild.copy(F(s.lastChild.content, e - 1, t)));
1322
+ function addToFragment(fragment, depth, content) {
1323
+ if (depth == 0)
1324
+ return fragment.append(content);
1325
+ return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
1072
1326
  }
1073
- function W(s, e) {
1074
- for (let t = 0; t < e; t++)
1075
- s = s.firstChild.content;
1076
- return s;
1327
+ function contentAt(fragment, depth) {
1328
+ for (let i = 0; i < depth; i++)
1329
+ fragment = fragment.firstChild.content;
1330
+ return fragment;
1077
1331
  }
1078
- function te(s, e, t) {
1079
- if (e <= 0)
1080
- return s;
1081
- let r = s.content;
1082
- return e > 1 && (r = r.replaceChild(0, te(r.firstChild, e - 1, r.childCount == 1 ? t - 1 : 0))), e > 0 && (r = s.type.contentMatch.fillBefore(r).append(r), t <= 0 && (r = r.append(s.type.contentMatch.matchFragment(r).fillBefore(g.empty, !0)))), s.copy(r);
1332
+ function closeNodeStart(node, openStart, openEnd) {
1333
+ if (openStart <= 0)
1334
+ return node;
1335
+ let frag = node.content;
1336
+ if (openStart > 1)
1337
+ frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
1338
+ if (openStart > 0) {
1339
+ frag = node.type.contentMatch.fillBefore(frag).append(frag);
1340
+ if (openEnd <= 0)
1341
+ frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));
1342
+ }
1343
+ return node.copy(frag);
1083
1344
  }
1084
- function D(s, e, t, r, n) {
1085
- let i = s.node(e), o = n ? s.indexAfter(e) : s.index(e);
1086
- if (o == i.childCount && !t.compatibleContent(i.type))
1345
+ function contentAfterFits($to, depth, type, match, open) {
1346
+ let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);
1347
+ if (index == node.childCount && !type.compatibleContent(node.type))
1087
1348
  return null;
1088
- let l = r.fillBefore(i.content, !0, o);
1089
- return l && !Ne(t, i.content, o) ? l : null;
1349
+ let fit = match.fillBefore(node.content, true, index);
1350
+ return fit && !invalidMarks(type, node.content, index) ? fit : null;
1090
1351
  }
1091
- function Ne(s, e, t) {
1092
- for (let r = t; r < e.childCount; r++)
1093
- if (!s.allowsMarks(e.child(r).marks))
1094
- return !0;
1095
- return !1;
1352
+ function invalidMarks(type, fragment, start) {
1353
+ for (let i = start; i < fragment.childCount; i++)
1354
+ if (!type.allowsMarks(fragment.child(i).marks))
1355
+ return true;
1356
+ return false;
1096
1357
  }
1097
- function Ie(s) {
1098
- return s.spec.defining || s.spec.definingForContent;
1358
+ function definesContent(type) {
1359
+ return type.spec.defining || type.spec.definingForContent;
1099
1360
  }
1100
- function Re(s, e, t, r) {
1101
- if (!r.size)
1102
- return s.deleteRange(e, t);
1103
- let n = s.doc.resolve(e), i = s.doc.resolve(t);
1104
- if (ee(n, i, r))
1105
- return s.step(new v(e, t, r));
1106
- let o = ne(n, s.doc.resolve(t));
1107
- o[o.length - 1] == 0 && o.pop();
1108
- let l = -(n.depth + 1);
1109
- o.unshift(l);
1110
- for (let f = n.depth, d = n.pos - 1; f > 0; f--, d--) {
1111
- let u = n.node(f).type.spec;
1112
- if (u.defining || u.definingAsContext || u.isolating)
1361
+ function replaceRange(tr, from, to, slice) {
1362
+ if (!slice.size)
1363
+ return tr.deleteRange(from, to);
1364
+ let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
1365
+ if (fitsTrivially($from, $to, slice))
1366
+ return tr.step(new ReplaceStep(from, to, slice));
1367
+ let targetDepths = coveredDepths($from, tr.doc.resolve(to));
1368
+ if (targetDepths[targetDepths.length - 1] == 0)
1369
+ targetDepths.pop();
1370
+ let preferredTarget = -($from.depth + 1);
1371
+ targetDepths.unshift(preferredTarget);
1372
+ for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
1373
+ let spec = $from.node(d).type.spec;
1374
+ if (spec.defining || spec.definingAsContext || spec.isolating)
1113
1375
  break;
1114
- o.indexOf(f) > -1 ? l = f : n.before(f) == d && o.splice(1, 0, -f);
1115
- }
1116
- let a = o.indexOf(l), h = [], p = r.openStart;
1117
- for (let f = r.content, d = 0; ; d++) {
1118
- let u = f.firstChild;
1119
- if (h.push(u), d == r.openStart)
1376
+ if (targetDepths.indexOf(d) > -1)
1377
+ preferredTarget = d;
1378
+ else if ($from.before(d) == pos)
1379
+ targetDepths.splice(1, 0, -d);
1380
+ }
1381
+ let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
1382
+ let leftNodes = [], preferredDepth = slice.openStart;
1383
+ for (let content = slice.content, i = 0; ; i++) {
1384
+ let node = content.firstChild;
1385
+ leftNodes.push(node);
1386
+ if (i == slice.openStart)
1120
1387
  break;
1121
- f = u.content;
1388
+ content = node.content;
1122
1389
  }
1123
- for (let f = p - 1; f >= 0; f--) {
1124
- let d = h[f], u = Ie(d.type);
1125
- if (u && !d.sameMarkup(n.node(Math.abs(l) - 1)))
1126
- p = f;
1127
- else if (u || !d.type.isTextblock)
1390
+ for (let d = preferredDepth - 1; d >= 0; d--) {
1391
+ let leftNode = leftNodes[d], def = definesContent(leftNode.type);
1392
+ if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))
1393
+ preferredDepth = d;
1394
+ else if (def || !leftNode.type.isTextblock)
1128
1395
  break;
1129
1396
  }
1130
- for (let f = r.openStart; f >= 0; f--) {
1131
- let d = (f + p + 1) % (r.openStart + 1), u = h[d];
1132
- if (u)
1133
- for (let m = 0; m < o.length; m++) {
1134
- let x = o[(m + a) % o.length], I = !0;
1135
- x < 0 && (I = !1, x = -x);
1136
- let ie = n.node(x - 1), G = n.index(x - 1);
1137
- if (ie.canReplaceWith(G, G, u.type, u.marks))
1138
- return s.replace(n.before(x), I ? i.after(x) : t, new w(re(r.content, 0, r.openStart, d), d, r.openEnd));
1397
+ for (let j = slice.openStart; j >= 0; j--) {
1398
+ let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
1399
+ let insert = leftNodes[openDepth];
1400
+ if (!insert)
1401
+ continue;
1402
+ for (let i = 0; i < targetDepths.length; i++) {
1403
+ let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;
1404
+ if (targetDepth < 0) {
1405
+ expand = false;
1406
+ targetDepth = -targetDepth;
1139
1407
  }
1408
+ let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
1409
+ if (parent.canReplaceWith(index, index, insert.type, insert.marks))
1410
+ return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
1411
+ }
1140
1412
  }
1141
- let c = s.steps.length;
1142
- for (let f = o.length - 1; f >= 0 && (s.replace(e, t, r), !(s.steps.length > c)); f--) {
1143
- let d = o[f];
1144
- d < 0 || (e = n.before(d), t = i.after(d));
1413
+ let startSteps = tr.steps.length;
1414
+ for (let i = targetDepths.length - 1; i >= 0; i--) {
1415
+ tr.replace(from, to, slice);
1416
+ if (tr.steps.length > startSteps)
1417
+ break;
1418
+ let depth = targetDepths[i];
1419
+ if (depth < 0)
1420
+ continue;
1421
+ from = $from.before(depth);
1422
+ to = $to.after(depth);
1145
1423
  }
1146
1424
  }
1147
- function re(s, e, t, r, n) {
1148
- if (e < t) {
1149
- let i = s.firstChild;
1150
- s = s.replaceChild(0, i.copy(re(i.content, e + 1, t, r, i)));
1425
+ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
1426
+ if (depth < oldOpen) {
1427
+ let first = fragment.firstChild;
1428
+ fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
1151
1429
  }
1152
- if (e > r) {
1153
- let i = n.contentMatchAt(0), o = i.fillBefore(s).append(s);
1154
- s = o.append(i.matchFragment(o).fillBefore(g.empty, !0));
1430
+ if (depth > newOpen) {
1431
+ let match = parent.contentMatchAt(0);
1432
+ let start = match.fillBefore(fragment).append(fragment);
1433
+ fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));
1155
1434
  }
1156
- return s;
1435
+ return fragment;
1157
1436
  }
1158
- function Te(s, e, t, r) {
1159
- if (!r.isInline && e == t && s.doc.resolve(e).parent.content.size) {
1160
- let n = be(s.doc, e, r.type);
1161
- n != null && (e = t = n);
1437
+ function replaceRangeWith(tr, from, to, node) {
1438
+ if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
1439
+ let point = insertPoint(tr.doc, from, node.type);
1440
+ if (point != null)
1441
+ from = to = point;
1162
1442
  }
1163
- s.replaceRange(e, t, new w(g.from(r), 0, 0));
1443
+ tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));
1164
1444
  }
1165
- function Ee(s, e, t) {
1166
- let r = s.doc.resolve(e), n = s.doc.resolve(t), i = ne(r, n);
1167
- for (let o = 0; o < i.length; o++) {
1168
- let l = i[o], a = o == i.length - 1;
1169
- if (a && l == 0 || r.node(l).type.contentMatch.validEnd)
1170
- return s.delete(r.start(l), n.end(l));
1171
- if (l > 0 && (a || r.node(l - 1).canReplace(r.index(l - 1), n.indexAfter(l - 1))))
1172
- return s.delete(r.before(l), n.after(l));
1173
- }
1174
- for (let o = 1; o <= r.depth && o <= n.depth; o++)
1175
- if (e - r.start(o) == r.depth - o && t > r.end(o) && n.end(o) - t != n.depth - o && r.start(o - 1) == n.start(o - 1) && r.node(o - 1).canReplace(r.index(o - 1), n.index(o - 1)))
1176
- return s.delete(r.before(o), t);
1177
- s.delete(e, t);
1445
+ function deleteRange(tr, from, to) {
1446
+ let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
1447
+ let covered = coveredDepths($from, $to);
1448
+ for (let i = 0; i < covered.length; i++) {
1449
+ let depth = covered[i], last = i == covered.length - 1;
1450
+ if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd)
1451
+ return tr.delete($from.start(depth), $to.end(depth));
1452
+ if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))
1453
+ return tr.delete($from.before(depth), $to.after(depth));
1454
+ }
1455
+ for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
1456
+ if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))
1457
+ return tr.delete($from.before(d), to);
1458
+ }
1459
+ tr.delete(from, to);
1178
1460
  }
1179
- function ne(s, e) {
1180
- let t = [], r = Math.min(s.depth, e.depth);
1181
- for (let n = r; n >= 0; n--) {
1182
- let i = s.start(n);
1183
- if (i < s.pos - (s.depth - n) || e.end(n) > e.pos + (e.depth - n) || s.node(n).type.spec.isolating || e.node(n).type.spec.isolating)
1461
+ function coveredDepths($from, $to) {
1462
+ let result = [], minDepth = Math.min($from.depth, $to.depth);
1463
+ for (let d = minDepth; d >= 0; d--) {
1464
+ let start = $from.start(d);
1465
+ if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating)
1184
1466
  break;
1185
- (i == e.start(n) || n == s.depth && n == e.depth && s.parent.inlineContent && e.parent.inlineContent && n && e.start(n - 1) == i - 1) && t.push(n);
1467
+ if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1)
1468
+ result.push(d);
1186
1469
  }
1187
- return t;
1470
+ return result;
1188
1471
  }
1189
- class T extends k {
1472
+ class AttrStep extends Step {
1190
1473
  /**
1191
1474
  Construct an attribute step.
1192
1475
  */
1193
- constructor(e, t, r) {
1194
- super(), this.pos = e, this.attr = t, this.value = r;
1195
- }
1196
- apply(e) {
1197
- let t = e.nodeAt(this.pos);
1198
- if (!t)
1199
- return y.fail("No node at attribute step's position");
1200
- let r = /* @__PURE__ */ Object.create(null);
1201
- for (let i in t.attrs)
1202
- r[i] = t.attrs[i];
1203
- r[this.attr] = this.value;
1204
- let n = t.type.create(r, null, t.marks);
1205
- return y.fromReplace(e, this.pos, this.pos + 1, new w(g.from(n), 0, t.isLeaf ? 0 : 1));
1476
+ constructor(pos, attr, value) {
1477
+ super();
1478
+ this.pos = pos;
1479
+ this.attr = attr;
1480
+ this.value = value;
1481
+ }
1482
+ apply(doc) {
1483
+ let node = doc.nodeAt(this.pos);
1484
+ if (!node)
1485
+ return StepResult.fail("No node at attribute step's position");
1486
+ let attrs = /* @__PURE__ */ Object.create(null);
1487
+ for (let name in node.attrs)
1488
+ attrs[name] = node.attrs[name];
1489
+ attrs[this.attr] = this.value;
1490
+ let updated = node.type.create(attrs, null, node.marks);
1491
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
1206
1492
  }
1207
1493
  getMap() {
1208
- return S.empty;
1494
+ return StepMap.empty;
1209
1495
  }
1210
- invert(e) {
1211
- return new T(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
1496
+ invert(doc) {
1497
+ return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
1212
1498
  }
1213
- map(e) {
1214
- let t = e.mapResult(this.pos, 1);
1215
- return t.deletedAfter ? null : new T(t.pos, this.attr, this.value);
1499
+ map(mapping) {
1500
+ let pos = mapping.mapResult(this.pos, 1);
1501
+ return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
1216
1502
  }
1217
1503
  toJSON() {
1218
1504
  return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
1219
1505
  }
1220
- static fromJSON(e, t) {
1221
- if (typeof t.pos != "number" || typeof t.attr != "string")
1506
+ static fromJSON(schema, json) {
1507
+ if (typeof json.pos != "number" || typeof json.attr != "string")
1222
1508
  throw new RangeError("Invalid input for AttrStep.fromJSON");
1223
- return new T(t.pos, t.attr, t.value);
1509
+ return new AttrStep(json.pos, json.attr, json.value);
1224
1510
  }
1225
1511
  }
1226
- k.jsonID("attr", T);
1227
- class z extends k {
1512
+ Step.jsonID("attr", AttrStep);
1513
+ class DocAttrStep extends Step {
1228
1514
  /**
1229
1515
  Construct an attribute step.
1230
1516
  */
1231
- constructor(e, t) {
1232
- super(), this.attr = e, this.value = t;
1517
+ constructor(attr, value) {
1518
+ super();
1519
+ this.attr = attr;
1520
+ this.value = value;
1233
1521
  }
1234
- apply(e) {
1235
- let t = /* @__PURE__ */ Object.create(null);
1236
- for (let n in e.attrs)
1237
- t[n] = e.attrs[n];
1238
- t[this.attr] = this.value;
1239
- let r = e.type.create(t, e.content, e.marks);
1240
- return y.ok(r);
1522
+ apply(doc) {
1523
+ let attrs = /* @__PURE__ */ Object.create(null);
1524
+ for (let name in doc.attrs)
1525
+ attrs[name] = doc.attrs[name];
1526
+ attrs[this.attr] = this.value;
1527
+ let updated = doc.type.create(attrs, doc.content, doc.marks);
1528
+ return StepResult.ok(updated);
1241
1529
  }
1242
1530
  getMap() {
1243
- return S.empty;
1531
+ return StepMap.empty;
1244
1532
  }
1245
- invert(e) {
1246
- return new z(this.attr, e.attrs[this.attr]);
1533
+ invert(doc) {
1534
+ return new DocAttrStep(this.attr, doc.attrs[this.attr]);
1247
1535
  }
1248
- map(e) {
1536
+ map(mapping) {
1249
1537
  return this;
1250
1538
  }
1251
1539
  toJSON() {
1252
1540
  return { stepType: "docAttr", attr: this.attr, value: this.value };
1253
1541
  }
1254
- static fromJSON(e, t) {
1255
- if (typeof t.attr != "string")
1542
+ static fromJSON(schema, json) {
1543
+ if (typeof json.attr != "string")
1256
1544
  throw new RangeError("Invalid input for DocAttrStep.fromJSON");
1257
- return new z(t.attr, t.value);
1545
+ return new DocAttrStep(json.attr, json.value);
1258
1546
  }
1259
1547
  }
1260
- k.jsonID("docAttr", z);
1261
- let E = class extends Error {
1548
+ Step.jsonID("docAttr", DocAttrStep);
1549
+ let TransformError = class extends Error {
1262
1550
  };
1263
- E = function s(e) {
1264
- let t = Error.call(this, e);
1265
- return t.__proto__ = s.prototype, t;
1551
+ TransformError = function TransformError2(message) {
1552
+ let err = Error.call(this, message);
1553
+ err.__proto__ = TransformError2.prototype;
1554
+ return err;
1266
1555
  };
1267
- E.prototype = Object.create(Error.prototype);
1268
- E.prototype.constructor = E;
1269
- E.prototype.name = "TransformError";
1270
- class De {
1556
+ TransformError.prototype = Object.create(Error.prototype);
1557
+ TransformError.prototype.constructor = TransformError;
1558
+ TransformError.prototype.name = "TransformError";
1559
+ class Transform {
1271
1560
  /**
1272
1561
  Create a transform that starts with the given document.
1273
1562
  */
1274
- constructor(e) {
1275
- this.doc = e, this.steps = [], this.docs = [], this.mapping = new A();
1563
+ constructor(doc) {
1564
+ this.doc = doc;
1565
+ this.steps = [];
1566
+ this.docs = [];
1567
+ this.mapping = new Mapping();
1276
1568
  }
1277
1569
  /**
1278
1570
  The starting document.
@@ -1284,19 +1576,21 @@ class De {
1284
1576
  Apply a new step in this transform, saving the result. Throws an
1285
1577
  error when the step fails.
1286
1578
  */
1287
- step(e) {
1288
- let t = this.maybeStep(e);
1289
- if (t.failed)
1290
- throw new E(t.failed);
1579
+ step(step) {
1580
+ let result = this.maybeStep(step);
1581
+ if (result.failed)
1582
+ throw new TransformError(result.failed);
1291
1583
  return this;
1292
1584
  }
1293
1585
  /**
1294
1586
  Try to apply a step in this transformation, ignoring it if it
1295
1587
  fails. Returns the step result.
1296
1588
  */
1297
- maybeStep(e) {
1298
- let t = e.apply(this.doc);
1299
- return t.failed || this.addStep(e, t.doc), t;
1589
+ maybeStep(step) {
1590
+ let result = step.apply(this.doc);
1591
+ if (!result.failed)
1592
+ this.addStep(step, result.doc);
1593
+ return result;
1300
1594
  }
1301
1595
  /**
1302
1596
  True when the document has been changed (when there are any
@@ -1308,35 +1602,40 @@ class De {
1308
1602
  /**
1309
1603
  @internal
1310
1604
  */
1311
- addStep(e, t) {
1312
- this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
1605
+ addStep(step, doc) {
1606
+ this.docs.push(this.doc);
1607
+ this.steps.push(step);
1608
+ this.mapping.appendMap(step.getMap());
1609
+ this.doc = doc;
1313
1610
  }
1314
1611
  /**
1315
1612
  Replace the part of the document between `from` and `to` with the
1316
1613
  given `slice`.
1317
1614
  */
1318
- replace(e, t = e, r = w.empty) {
1319
- let n = Me(this.doc, e, t, r);
1320
- return n && this.step(n), this;
1615
+ replace(from, to = from, slice = Slice.empty) {
1616
+ let step = replaceStep(this.doc, from, to, slice);
1617
+ if (step)
1618
+ this.step(step);
1619
+ return this;
1321
1620
  }
1322
1621
  /**
1323
1622
  Replace the given range with the given content, which may be a
1324
1623
  fragment, node, or array of nodes.
1325
1624
  */
1326
- replaceWith(e, t, r) {
1327
- return this.replace(e, t, new w(g.from(r), 0, 0));
1625
+ replaceWith(from, to, content) {
1626
+ return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));
1328
1627
  }
1329
1628
  /**
1330
1629
  Delete the content between the given positions.
1331
1630
  */
1332
- delete(e, t) {
1333
- return this.replace(e, t, w.empty);
1631
+ delete(from, to) {
1632
+ return this.replace(from, to, Slice.empty);
1334
1633
  }
1335
1634
  /**
1336
1635
  Insert the given content at the given position.
1337
1636
  */
1338
- insert(e, t) {
1339
- return this.replaceWith(e, e, t);
1637
+ insert(pos, content) {
1638
+ return this.replaceWith(pos, pos, content);
1340
1639
  }
1341
1640
  /**
1342
1641
  Replace a range of the document with a given slice, using
@@ -1357,8 +1656,9 @@ class De {
1357
1656
  range, and is useful in situations where you need more precise
1358
1657
  control over what happens.
1359
1658
  */
1360
- replaceRange(e, t, r) {
1361
- return Re(this, e, t, r), this;
1659
+ replaceRange(from, to, slice) {
1660
+ replaceRange(this, from, to, slice);
1661
+ return this;
1362
1662
  }
1363
1663
  /**
1364
1664
  Replace the given range with a node, but use `from` and `to` as
@@ -1369,15 +1669,17 @@ class De {
1369
1669
  completely covers a parent node, this method may completely replace
1370
1670
  that parent node.
1371
1671
  */
1372
- replaceRangeWith(e, t, r) {
1373
- return Te(this, e, t, r), this;
1672
+ replaceRangeWith(from, to, node) {
1673
+ replaceRangeWith(this, from, to, node);
1674
+ return this;
1374
1675
  }
1375
1676
  /**
1376
1677
  Delete the given range, expanding it to cover fully covered
1377
1678
  parent nodes until a valid replace is found.
1378
1679
  */
1379
- deleteRange(e, t) {
1380
- return Ee(this, e, t), this;
1680
+ deleteRange(from, to) {
1681
+ deleteRange(this, from, to);
1682
+ return this;
1381
1683
  }
1382
1684
  /**
1383
1685
  Split the content in the given range off from its parent, if there
@@ -1386,74 +1688,85 @@ class De {
1386
1688
  [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
1387
1689
  sure the lift is valid.
1388
1690
  */
1389
- lift(e, t) {
1390
- return de(this, e, t), this;
1691
+ lift(range, target) {
1692
+ lift(this, range, target);
1693
+ return this;
1391
1694
  }
1392
1695
  /**
1393
1696
  Join the blocks around the given position. If depth is 2, their
1394
1697
  last and first siblings are also joined, and so on.
1395
1698
  */
1396
- join(e, t = 1) {
1397
- return Se(this, e, t), this;
1699
+ join(pos, depth = 1) {
1700
+ join(this, pos, depth);
1701
+ return this;
1398
1702
  }
1399
1703
  /**
1400
1704
  Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
1401
1705
  The wrappers are assumed to be valid in this position, and should
1402
1706
  probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
1403
1707
  */
1404
- wrap(e, t) {
1405
- return we(this, e, t), this;
1708
+ wrap(range, wrappers) {
1709
+ wrap(this, range, wrappers);
1710
+ return this;
1406
1711
  }
1407
1712
  /**
1408
1713
  Set the type of all textblocks (partly) between `from` and `to` to
1409
1714
  the given node type with the given attributes.
1410
1715
  */
1411
- setBlockType(e, t = e, r, n = null) {
1412
- return ge(this, e, t, r, n), this;
1716
+ setBlockType(from, to = from, type, attrs = null) {
1717
+ setBlockType(this, from, to, type, attrs);
1718
+ return this;
1413
1719
  }
1414
1720
  /**
1415
1721
  Change the type, attributes, and/or marks of the node at `pos`.
1416
1722
  When `type` isn't given, the existing node type is preserved,
1417
1723
  */
1418
- setNodeMarkup(e, t, r = null, n) {
1419
- return ke(this, e, t, r, n), this;
1724
+ setNodeMarkup(pos, type, attrs = null, marks) {
1725
+ setNodeMarkup(this, pos, type, attrs, marks);
1726
+ return this;
1420
1727
  }
1421
1728
  /**
1422
1729
  Set a single attribute on a given node to a new value.
1423
1730
  The `pos` addresses the document content. Use `setDocAttribute`
1424
1731
  to set attributes on the document itself.
1425
1732
  */
1426
- setNodeAttribute(e, t, r) {
1427
- return this.step(new T(e, t, r)), this;
1733
+ setNodeAttribute(pos, attr, value) {
1734
+ this.step(new AttrStep(pos, attr, value));
1735
+ return this;
1428
1736
  }
1429
1737
  /**
1430
1738
  Set a single attribute on the document to a new value.
1431
1739
  */
1432
- setDocAttribute(e, t) {
1433
- return this.step(new z(e, t)), this;
1740
+ setDocAttribute(attr, value) {
1741
+ this.step(new DocAttrStep(attr, value));
1742
+ return this;
1434
1743
  }
1435
1744
  /**
1436
1745
  Add a mark to the node at position `pos`.
1437
1746
  */
1438
- addNodeMark(e, t) {
1439
- return this.step(new N(e, t)), this;
1747
+ addNodeMark(pos, mark) {
1748
+ this.step(new AddNodeMarkStep(pos, mark));
1749
+ return this;
1440
1750
  }
1441
1751
  /**
1442
1752
  Remove a mark (or all marks of the given type) from the node at
1443
1753
  position `pos`.
1444
1754
  */
1445
- removeNodeMark(e, t) {
1446
- let r = this.doc.nodeAt(e);
1447
- if (!r)
1448
- throw new RangeError("No node at position " + e);
1449
- if (t instanceof se)
1450
- t.isInSet(r.marks) && this.step(new R(e, t));
1451
- else {
1452
- let n = r.marks, i, o = [];
1453
- for (; i = t.isInSet(n); )
1454
- o.push(new R(e, i)), n = i.removeFromSet(n);
1455
- for (let l = o.length - 1; l >= 0; l--)
1456
- this.step(o[l]);
1755
+ removeNodeMark(pos, mark) {
1756
+ let node = this.doc.nodeAt(pos);
1757
+ if (!node)
1758
+ throw new RangeError("No node at position " + pos);
1759
+ if (mark instanceof Mark) {
1760
+ if (mark.isInSet(node.marks))
1761
+ this.step(new RemoveNodeMarkStep(pos, mark));
1762
+ } else {
1763
+ let set = node.marks, found, steps = [];
1764
+ while (found = mark.isInSet(set)) {
1765
+ steps.push(new RemoveNodeMarkStep(pos, found));
1766
+ set = found.removeFromSet(set);
1767
+ }
1768
+ for (let i = steps.length - 1; i >= 0; i--)
1769
+ this.step(steps[i]);
1457
1770
  }
1458
1771
  return this;
1459
1772
  }
@@ -1464,14 +1777,16 @@ class De {
1464
1777
  This can be changed by passing an array of types and attributes to
1465
1778
  use after the split (with the outermost nodes coming first).
1466
1779
  */
1467
- split(e, t = 1, r) {
1468
- return ve(this, e, t, r), this;
1780
+ split(pos, depth = 1, typesAfter) {
1781
+ split(this, pos, depth, typesAfter);
1782
+ return this;
1469
1783
  }
1470
1784
  /**
1471
1785
  Add the given mark to the inline content between `from` and `to`.
1472
1786
  */
1473
- addMark(e, t, r) {
1474
- return pe(this, e, t, r), this;
1787
+ addMark(from, to, mark) {
1788
+ addMark(this, from, to, mark);
1789
+ return this;
1475
1790
  }
1476
1791
  /**
1477
1792
  Remove marks from inline nodes between `from` and `to`. When
@@ -1479,8 +1794,9 @@ class De {
1479
1794
  a mark type, remove all marks of that type. When it is null,
1480
1795
  remove all marks of any type.
1481
1796
  */
1482
- removeMark(e, t, r) {
1483
- return fe(this, e, t, r), this;
1797
+ removeMark(from, to, mark) {
1798
+ removeMark(this, from, to, mark);
1799
+ return this;
1484
1800
  }
1485
1801
  /**
1486
1802
  Removes all marks and nodes from the content of the node at
@@ -1488,20 +1804,21 @@ class De {
1488
1804
  an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
1489
1805
  third argument.
1490
1806
  */
1491
- clearIncompatible(e, t, r) {
1492
- return $(this, e, t, r), this;
1807
+ clearIncompatible(pos, parentType, match) {
1808
+ clearIncompatible(this, pos, parentType, match);
1809
+ return this;
1493
1810
  }
1494
1811
  }
1495
1812
  export {
1496
- A as M,
1497
- v as R,
1498
- De as T,
1499
- Je as a,
1500
- M as b,
1501
- Ae as c,
1502
- We as d,
1503
- ze as f,
1504
- Be as j,
1505
- Fe as l,
1506
- Me as r
1813
+ Mapping as M,
1814
+ ReplaceStep as R,
1815
+ Transform as T,
1816
+ canSplit as a,
1817
+ ReplaceAroundStep as b,
1818
+ canJoin as c,
1819
+ dropPoint as d,
1820
+ findWrapping as f,
1821
+ joinPoint as j,
1822
+ liftTarget as l,
1823
+ replaceStep as r
1507
1824
  };