@caspeco/casper-ui-library 10.4.0 → 10.5.1

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 (842) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
  3. package/dist/components/accordion/accordion-context.js +5 -6
  4. package/dist/components/accordion/accordion-item.js +28 -40
  5. package/dist/components/accordion/accordion-panel.js +17 -14
  6. package/dist/components/accordion/accordion-recipe.js +85 -120
  7. package/dist/components/accordion/accordion.js +23 -20
  8. package/dist/components/alert/alert.js +80 -59
  9. package/dist/components/alert/helper.js +30 -42
  10. package/dist/components/alert/types.d.ts.map +1 -1
  11. package/dist/components/badge/badge-recipe.js +57 -49
  12. package/dist/components/badge/badge.js +66 -71
  13. package/dist/components/badge/helper.js +8 -9
  14. package/dist/components/box/box.js +14 -11
  15. package/dist/components/breadcrumbs/breadcrumb-item.js +21 -17
  16. package/dist/components/breadcrumbs/breadcrumb-link.js +21 -20
  17. package/dist/components/breadcrumbs/breadcrumbs.js +123 -90
  18. package/dist/components/button/button-recipe.js +280 -315
  19. package/dist/components/button/button.js +39 -40
  20. package/dist/components/checkbox/checkbox-icon.js +38 -46
  21. package/dist/components/checkbox/checkbox-recipe.js +176 -204
  22. package/dist/components/checkbox/checkbox.js +43 -36
  23. package/dist/components/checkbox/icons/check.js +5 -5
  24. package/dist/components/checkbox/icons/minus.js +5 -5
  25. package/dist/components/checkbox/icons/plus.js +5 -5
  26. package/dist/components/checkbox-group/checkbox-group.js +17 -16
  27. package/dist/components/collapsible/collapsible.js +117 -101
  28. package/dist/components/collapsible/translations.js +29 -29
  29. package/dist/components/combobox/combobox-button.js +173 -143
  30. package/dist/components/combobox/combobox-item.js +45 -23
  31. package/dist/components/combobox/combobox-menu.js +240 -190
  32. package/dist/components/combobox/combobox-recipe.js +69 -103
  33. package/dist/components/combobox/combobox.js +243 -273
  34. package/dist/components/combobox/translations.js +49 -50
  35. package/dist/components/date-picker/base-date-picker.js +238 -248
  36. package/dist/components/date-picker/date-cell-recipe.js +149 -179
  37. package/dist/components/date-picker/date-multi-picker.js +35 -29
  38. package/dist/components/date-picker/date-picker-date-cell.js +109 -114
  39. package/dist/components/date-picker/date-picker-header.js +152 -170
  40. package/dist/components/date-picker/date-picker-week-cell.js +41 -43
  41. package/dist/components/date-picker/date-picker.js +32 -29
  42. package/dist/components/date-picker/date-range-picker.js +29 -24
  43. package/dist/components/date-picker/date-week-picker.js +29 -22
  44. package/dist/components/date-picker/datepicker-week-recipe.js +75 -91
  45. package/dist/components/date-picker/helper.js +11 -16
  46. package/dist/components/divider/divider-recipe.js +9 -11
  47. package/dist/components/divider/divider.js +19 -18
  48. package/dist/components/drawer/drawer-recipe.js +21 -50
  49. package/dist/components/drawer/drawer.js +45 -41
  50. package/dist/components/drawer/inline-drawer.js +69 -66
  51. package/dist/components/drawer/use-drawer-key-down.js +20 -20
  52. package/dist/components/fieldset/fieldset-error-text.js +15 -15
  53. package/dist/components/fieldset/fieldset-helper-text.js +15 -15
  54. package/dist/components/fieldset/fieldset-legend.js +15 -15
  55. package/dist/components/fieldset/fieldset-recipe.js +14 -24
  56. package/dist/components/fieldset/fieldset.js +17 -17
  57. package/dist/components/flex/flex.js +15 -15
  58. package/dist/components/form-control/form-control-recipe.js +42 -46
  59. package/dist/components/form-control/form-control.js +19 -19
  60. package/dist/components/form-control/form-error-message.js +15 -15
  61. package/dist/components/form-control/form-helper-text.js +15 -15
  62. package/dist/components/form-control/form-label.js +24 -26
  63. package/dist/components/grid/grid-item.js +15 -15
  64. package/dist/components/grid/grid.js +15 -15
  65. package/dist/components/heading/heading.js +24 -23
  66. package/dist/components/highlight/highlight.js +22 -21
  67. package/dist/components/icon/create-icon.js +27 -26
  68. package/dist/components/icon/icons/absence-icon.js +5 -5
  69. package/dist/components/icon/icons/accessibility-icon.js +5 -5
  70. package/dist/components/icon/icons/add-absence-icon.js +5 -5
  71. package/dist/components/icon/icons/add-emoji-icon.js +5 -5
  72. package/dist/components/icon/icons/add-icon.js +5 -5
  73. package/dist/components/icon/icons/apple-icon.js +5 -5
  74. package/dist/components/icon/icons/apps-icon.js +5 -5
  75. package/dist/components/icon/icons/archive-icon.js +6 -6
  76. package/dist/components/icon/icons/area-icon.js +5 -5
  77. package/dist/components/icon/icons/at-icon.js +5 -5
  78. package/dist/components/icon/icons/attachment-icon.js +5 -5
  79. package/dist/components/icon/icons/baby-icon.js +5 -5
  80. package/dist/components/icon/icons/back-icon.js +5 -5
  81. package/dist/components/icon/icons/backspace-icon.js +5 -5
  82. package/dist/components/icon/icons/bank-icon.js +5 -5
  83. package/dist/components/icon/icons/bank-id-icon.js +5 -5
  84. package/dist/components/icon/icons/barcode-icon.js +5 -5
  85. package/dist/components/icon/icons/bell-icon.js +5 -5
  86. package/dist/components/icon/icons/bolt-icon.js +7 -7
  87. package/dist/components/icon/icons/calendar-icon.js +5 -5
  88. package/dist/components/icon/icons/camera-icon.js +5 -5
  89. package/dist/components/icon/icons/cancel-icon.js +5 -5
  90. package/dist/components/icon/icons/card-icon.js +5 -5
  91. package/dist/components/icon/icons/cart-icon.js +5 -5
  92. package/dist/components/icon/icons/caspeco-icon.js +7 -7
  93. package/dist/components/icon/icons/channels-icon.js +5 -5
  94. package/dist/components/icon/icons/chart-icon.js +5 -5
  95. package/dist/components/icon/icons/chart-line-icon.js +5 -5
  96. package/dist/components/icon/icons/chart-mixed-icon.js +5 -5
  97. package/dist/components/icon/icons/chart-pie-icon.js +5 -5
  98. package/dist/components/icon/icons/chart-scatter-icon.js +5 -5
  99. package/dist/components/icon/icons/check-icon.js +5 -5
  100. package/dist/components/icon/icons/checkbox-icon.js +5 -5
  101. package/dist/components/icon/icons/chevron-left-icon.js +5 -5
  102. package/dist/components/icon/icons/chevron-right-icon.js +5 -5
  103. package/dist/components/icon/icons/child-icon.js +5 -5
  104. package/dist/components/icon/icons/circle-info-icon.js +5 -5
  105. package/dist/components/icon/icons/circle-parking-icon.js +5 -5
  106. package/dist/components/icon/icons/circle-question-icon.js +5 -5
  107. package/dist/components/icon/icons/circle-select-icon.js +5 -5
  108. package/dist/components/icon/icons/circle-success-icon.js +5 -5
  109. package/dist/components/icon/icons/circle-user-icon.js +5 -5
  110. package/dist/components/icon/icons/clear-icon.js +5 -5
  111. package/dist/components/icon/icons/close-icon.js +5 -5
  112. package/dist/components/icon/icons/closed-icon.js +5 -5
  113. package/dist/components/icon/icons/collapse-icon.js +5 -5
  114. package/dist/components/icon/icons/color-icon.js +5 -5
  115. package/dist/components/icon/icons/columns-icon.js +5 -5
  116. package/dist/components/icon/icons/comment-add-icon.js +5 -5
  117. package/dist/components/icon/icons/comment-icon.js +5 -5
  118. package/dist/components/icon/icons/cookies-icon.js +5 -5
  119. package/dist/components/icon/icons/copy-icon.js +5 -5
  120. package/dist/components/icon/icons/date-icon.js +5 -5
  121. package/dist/components/icon/icons/decrease-icon.js +4 -4
  122. package/dist/components/icon/icons/delete-icon.js +5 -5
  123. package/dist/components/icon/icons/deliverect-icon.js +5 -5
  124. package/dist/components/icon/icons/delivery-icon.js +5 -5
  125. package/dist/components/icon/icons/description-icon.js +5 -5
  126. package/dist/components/icon/icons/discount-icon.js +5 -5
  127. package/dist/components/icon/icons/distribute-evenly-icon.js +5 -5
  128. package/dist/components/icon/icons/door-closed-icon.js +5 -5
  129. package/dist/components/icon/icons/door-open-icon.js +5 -5
  130. package/dist/components/icon/icons/down-icon.js +5 -5
  131. package/dist/components/icon/icons/eat-in-icon.js +5 -5
  132. package/dist/components/icon/icons/edit-icon.js +5 -5
  133. package/dist/components/icon/icons/email-icon.js +5 -5
  134. package/dist/components/icon/icons/error-icon.js +5 -5
  135. package/dist/components/icon/icons/expand-icon.js +5 -5
  136. package/dist/components/icon/icons/export-icon.js +5 -5
  137. package/dist/components/icon/icons/extract-icon.js +5 -5
  138. package/dist/components/icon/icons/facebook-icon.js +5 -5
  139. package/dist/components/icon/icons/failed-print-icon.js +5 -5
  140. package/dist/components/icon/icons/file-icon.js +5 -5
  141. package/dist/components/icon/icons/filter-icon.js +5 -5
  142. package/dist/components/icon/icons/folder-icon.js +5 -5
  143. package/dist/components/icon/icons/foodora-icon.js +5 -5
  144. package/dist/components/icon/icons/forward-icon.js +5 -5
  145. package/dist/components/icon/icons/glovo-icon.js +7 -7
  146. package/dist/components/icon/icons/goal-icon.js +5 -5
  147. package/dist/components/icon/icons/google-icon.js +5 -5
  148. package/dist/components/icon/icons/grip-more-icon.js +5 -5
  149. package/dist/components/icon/icons/hash-icon.js +5 -5
  150. package/dist/components/icon/icons/hexagon-error-icon.js +5 -5
  151. package/dist/components/icon/icons/hide-icon.js +5 -5
  152. package/dist/components/icon/icons/history-icon.js +5 -5
  153. package/dist/components/icon/icons/icon-picker-anchor-icon.js +5 -5
  154. package/dist/components/icon/icons/icon-picker-asterisk-icon.js +5 -5
  155. package/dist/components/icon/icons/icon-picker-beer-icon.js +5 -5
  156. package/dist/components/icon/icons/icon-picker-bicycle-icon.js +5 -5
  157. package/dist/components/icon/icons/icon-picker-binoculars-icon.js +5 -5
  158. package/dist/components/icon/icons/icon-picker-bomb-icon.js +5 -5
  159. package/dist/components/icon/icons/icon-picker-car-icon.js +5 -5
  160. package/dist/components/icon/icons/icon-picker-cocktail-icon.js +5 -5
  161. package/dist/components/icon/icons/icon-picker-gem-icon.js +5 -5
  162. package/dist/components/icon/icons/icon-picker-heart-full-icon.js +5 -5
  163. package/dist/components/icon/icons/icon-picker-heart-icon.js +5 -5
  164. package/dist/components/icon/icons/icon-picker-magnet-icon.js +5 -5
  165. package/dist/components/icon/icons/icon-picker-money-icon.js +5 -5
  166. package/dist/components/icon/icons/icon-picker-moon-icon.js +5 -5
  167. package/dist/components/icon/icons/icon-picker-music-icon.js +5 -5
  168. package/dist/components/icon/icons/icon-picker-star-full-icon.js +5 -5
  169. package/dist/components/icon/icons/icon-picker-star-half-icon.js +5 -5
  170. package/dist/components/icon/icons/icon-picker-star-icon.js +5 -5
  171. package/dist/components/icon/icons/icon-picker-tint-icon.js +5 -5
  172. package/dist/components/icon/icons/icon-picker-tree-icon.js +5 -5
  173. package/dist/components/icon/icons/icon-picker-utensils-icon.js +5 -5
  174. package/dist/components/icon/icons/icon-picker-wheelchair-icon.js +5 -5
  175. package/dist/components/icon/icons/image-icon.js +5 -5
  176. package/dist/components/icon/icons/import-icon.js +5 -5
  177. package/dist/components/icon/icons/inbox-icon.js +5 -5
  178. package/dist/components/icon/icons/increase-icon.js +5 -5
  179. package/dist/components/icon/icons/indeterminate-icon.js +4 -4
  180. package/dist/components/icon/icons/info-icon.js +5 -5
  181. package/dist/components/icon/icons/inheritance-icon.js +5 -5
  182. package/dist/components/icon/icons/just-eat-icon.js +5 -5
  183. package/dist/components/icon/icons/karma-icon.js +5 -5
  184. package/dist/components/icon/icons/key-command-icon.js +5 -5
  185. package/dist/components/icon/icons/key-enter-icon.js +5 -5
  186. package/dist/components/icon/icons/key-icon.js +5 -5
  187. package/dist/components/icon/icons/key-option-icon.js +5 -5
  188. package/dist/components/icon/icons/language-icon.js +5 -5
  189. package/dist/components/icon/icons/link-broken-icon.js +5 -5
  190. package/dist/components/icon/icons/link-external-icon.js +5 -5
  191. package/dist/components/icon/icons/link-icon.js +5 -5
  192. package/dist/components/icon/icons/list-ol-icon.js +5 -5
  193. package/dist/components/icon/icons/list-ul-icon.js +5 -5
  194. package/dist/components/icon/icons/loading-icon.js +5 -5
  195. package/dist/components/icon/icons/location-icon.js +5 -5
  196. package/dist/components/icon/icons/lock-icon.js +5 -5
  197. package/dist/components/icon/icons/log-in-icon.js +5 -5
  198. package/dist/components/icon/icons/log-out-icon.js +5 -5
  199. package/dist/components/icon/icons/map-icon.js +5 -5
  200. package/dist/components/icon/icons/maximize-icon.js +5 -5
  201. package/dist/components/icon/icons/members-icon.js +5 -5
  202. package/dist/components/icon/icons/menu-hide-icon.js +5 -5
  203. package/dist/components/icon/icons/menu-icon.js +5 -5
  204. package/dist/components/icon/icons/menu-show-icon.js +5 -5
  205. package/dist/components/icon/icons/message-add-icon.js +5 -5
  206. package/dist/components/icon/icons/message-icon.js +5 -5
  207. package/dist/components/icon/icons/message-lines-icon.js +5 -5
  208. package/dist/components/icon/icons/minimize-icon.js +5 -5
  209. package/dist/components/icon/icons/minimize-window-icon.js +5 -5
  210. package/dist/components/icon/icons/mobile-rotate-icon.js +5 -5
  211. package/dist/components/icon/icons/module-accounting-icon.js +5 -5
  212. package/dist/components/icon/icons/module-ai-forecast-icon.js +5 -5
  213. package/dist/components/icon/icons/module-app-icon.js +5 -5
  214. package/dist/components/icon/icons/module-articles-icon.js +5 -5
  215. package/dist/components/icon/icons/module-benchmark-icon.js +5 -5
  216. package/dist/components/icon/icons/module-booking-icon.js +5 -5
  217. package/dist/components/icon/icons/module-cai-icon.js +5 -5
  218. package/dist/components/icon/icons/module-campaigns-icon.js +5 -5
  219. package/dist/components/icon/icons/module-cashier-icon.js +5 -5
  220. package/dist/components/icon/icons/module-communication-icon.js +5 -5
  221. package/dist/components/icon/icons/module-copilot-icon.js +5 -5
  222. package/dist/components/icon/icons/module-dashboard-icon.js +5 -5
  223. package/dist/components/icon/icons/module-document-icon.js +5 -5
  224. package/dist/components/icon/icons/module-employees-icon.js +5 -5
  225. package/dist/components/icon/icons/module-feed-icon.js +5 -5
  226. package/dist/components/icon/icons/module-history-icon.js +5 -5
  227. package/dist/components/icon/icons/module-home-icon.js +5 -5
  228. package/dist/components/icon/icons/module-insights-icon.js +5 -5
  229. package/dist/components/icon/icons/module-kds-icon.js +5 -5
  230. package/dist/components/icon/icons/module-members-icon.js +5 -5
  231. package/dist/components/icon/icons/module-menus-icon.js +5 -5
  232. package/dist/components/icon/icons/module-my-city-icon.js +5 -5
  233. package/dist/components/icon/icons/module-notification-center-icon.js +5 -5
  234. package/dist/components/icon/icons/module-online-order-icon.js +5 -5
  235. package/dist/components/icon/icons/module-organisation-icon.js +5 -5
  236. package/dist/components/icon/icons/module-pos-icon.js +5 -5
  237. package/dist/components/icon/icons/module-pulse-icon.js +5 -5
  238. package/dist/components/icon/icons/module-result-icon.js +5 -5
  239. package/dist/components/icon/icons/module-salary-icon.js +5 -5
  240. package/dist/components/icon/icons/module-schedule-icon.js +5 -5
  241. package/dist/components/icon/icons/module-settings-alt-icon.js +5 -5
  242. package/dist/components/icon/icons/module-settings-icon.js +5 -5
  243. package/dist/components/icon/icons/module-support-icon.js +5 -5
  244. package/dist/components/icon/icons/module-survey-icon.js +5 -5
  245. package/dist/components/icon/icons/module-table-map-icon.js +6 -6
  246. package/dist/components/icon/icons/module-tablet-icon.js +5 -5
  247. package/dist/components/icon/icons/module-time-icon.js +5 -5
  248. package/dist/components/icon/icons/module-timeline-icon.js +5 -5
  249. package/dist/components/icon/icons/module-tip-icon.js +5 -5
  250. package/dist/components/icon/icons/module-to-do-icon.js +5 -5
  251. package/dist/components/icon/icons/module-tools-icon.js +5 -5
  252. package/dist/components/icon/icons/module-top-list-icon.js +5 -5
  253. package/dist/components/icon/icons/module-web-charts-icon.js +5 -5
  254. package/dist/components/icon/icons/module-web-icon.js +5 -5
  255. package/dist/components/icon/icons/more-horizontal-icon.js +5 -5
  256. package/dist/components/icon/icons/more-vertical-icon.js +5 -5
  257. package/dist/components/icon/icons/nfc-icon.js +5 -5
  258. package/dist/components/icon/icons/no-cart-icon.js +5 -5
  259. package/dist/components/icon/icons/note-icon.js +5 -5
  260. package/dist/components/icon/icons/number-icon.js +6 -6
  261. package/dist/components/icon/icons/open-modal-icon.js +5 -5
  262. package/dist/components/icon/icons/parking-icon.js +5 -5
  263. package/dist/components/icon/icons/party-horn-icon.js +5 -5
  264. package/dist/components/icon/icons/paste-icon.js +5 -5
  265. package/dist/components/icon/icons/pause-icon.js +5 -5
  266. package/dist/components/icon/icons/payment-card-icon.js +5 -5
  267. package/dist/components/icon/icons/payment-cash-icon.js +5 -5
  268. package/dist/components/icon/icons/payment-generic-icon.js +5 -5
  269. package/dist/components/icon/icons/payment-giftcard-icon.js +5 -5
  270. package/dist/components/icon/icons/payment-hotel-icon.js +5 -5
  271. package/dist/components/icon/icons/payment-invoice-icon.js +5 -5
  272. package/dist/components/icon/icons/percentage-icon.js +5 -5
  273. package/dist/components/icon/icons/phone-icon.js +5 -5
  274. package/dist/components/icon/icons/pin-icon.js +5 -5
  275. package/dist/components/icon/icons/pin-map-icon.js +5 -5
  276. package/dist/components/icon/icons/play-icon.js +5 -5
  277. package/dist/components/icon/icons/preview-icon.js +5 -5
  278. package/dist/components/icon/icons/print-icon.js +5 -5
  279. package/dist/components/icon/icons/privacy-icon.js +5 -5
  280. package/dist/components/icon/icons/product-admin-icon.js +5 -5
  281. package/dist/components/icon/icons/product-analytics-icon.js +5 -5
  282. package/dist/components/icon/icons/product-booking-icon.js +5 -5
  283. package/dist/components/icon/icons/product-checkout-icon.js +5 -5
  284. package/dist/components/icon/icons/product-my-pages-icon.js +5 -5
  285. package/dist/components/icon/icons/product-staff-icon.js +5 -5
  286. package/dist/components/icon/icons/puck-icon.js +5 -5
  287. package/dist/components/icon/icons/qr-code-icon.js +5 -5
  288. package/dist/components/icon/icons/question-icon.js +5 -5
  289. package/dist/components/icon/icons/radio-icon.js +5 -5
  290. package/dist/components/icon/icons/receipt-icon.js +5 -5
  291. package/dist/components/icon/icons/redo-icon.js +5 -5
  292. package/dist/components/icon/icons/refund-icon.js +5 -5
  293. package/dist/components/icon/icons/remove-icon.js +5 -5
  294. package/dist/components/icon/icons/replace-icon.js +5 -5
  295. package/dist/components/icon/icons/schedule-icon.js +5 -5
  296. package/dist/components/icon/icons/search-icon.js +5 -5
  297. package/dist/components/icon/icons/select-icon.js +4 -4
  298. package/dist/components/icon/icons/send-icon.js +5 -5
  299. package/dist/components/icon/icons/share-icon.js +5 -5
  300. package/dist/components/icon/icons/show-icon.js +5 -5
  301. package/dist/components/icon/icons/shuffle-icon.js +5 -5
  302. package/dist/components/icon/icons/sidebar-hide-icon.js +4 -4
  303. package/dist/components/icon/icons/sidebar-left-icon.js +4 -4
  304. package/dist/components/icon/icons/sidebar-right-icon.js +5 -5
  305. package/dist/components/icon/icons/sidebar-show-icon.js +5 -5
  306. package/dist/components/icon/icons/sliders-icon.js +5 -5
  307. package/dist/components/icon/icons/slightly-sad-icon.js +5 -5
  308. package/dist/components/icon/icons/smile-icon.js +5 -5
  309. package/dist/components/icon/icons/sort-asc-icon.js +5 -5
  310. package/dist/components/icon/icons/sort-desc-icon.js +5 -5
  311. package/dist/components/icon/icons/split-icon.js +5 -5
  312. package/dist/components/icon/icons/status-icon.js +5 -5
  313. package/dist/components/icon/icons/stop-icon.js +5 -5
  314. package/dist/components/icon/icons/submenu-icon.js +5 -5
  315. package/dist/components/icon/icons/success-icon.js +5 -5
  316. package/dist/components/icon/icons/swap-icon.js +5 -5
  317. package/dist/components/icon/icons/swatch-icon.js +5 -5
  318. package/dist/components/icon/icons/sweat-icon.js +5 -5
  319. package/dist/components/icon/icons/table-icon.js +5 -5
  320. package/dist/components/icon/icons/table-map-icon.js +5 -5
  321. package/dist/components/icon/icons/take-away-dot-com-icon.js +5 -5
  322. package/dist/components/icon/icons/take-away-icon.js +5 -5
  323. package/dist/components/icon/icons/talk-icon.js +5 -5
  324. package/dist/components/icon/icons/thumbtack-icon.js +5 -5
  325. package/dist/components/icon/icons/time-icon.js +5 -5
  326. package/dist/components/icon/icons/timeline-icon.js +5 -5
  327. package/dist/components/icon/icons/tip-icon.js +5 -5
  328. package/dist/components/icon/icons/title-icon.js +5 -5
  329. package/dist/components/icon/icons/translate-icon.js +5 -5
  330. package/dist/components/icon/icons/tree-view-collapse-icon.js +4 -4
  331. package/dist/components/icon/icons/tree-view-expand-icon.js +4 -4
  332. package/dist/components/icon/icons/tree-view-last-icon.js +4 -4
  333. package/dist/components/icon/icons/trend-down-icon.js +5 -5
  334. package/dist/components/icon/icons/trend-up-icon.js +5 -5
  335. package/dist/components/icon/icons/triangle-warning-icon.js +5 -5
  336. package/dist/components/icon/icons/trivec-icon.js +6 -6
  337. package/dist/components/icon/icons/uber-eats-icon.js +5 -5
  338. package/dist/components/icon/icons/undo-icon.js +5 -5
  339. package/dist/components/icon/icons/unlock-icon.js +5 -5
  340. package/dist/components/icon/icons/unwrap-content-icon.js +5 -5
  341. package/dist/components/icon/icons/up-icon.js +5 -5
  342. package/dist/components/icon/icons/user-group-icon.js +5 -5
  343. package/dist/components/icon/icons/user-icon.js +5 -5
  344. package/dist/components/icon/icons/user-permissions-icon.js +5 -5
  345. package/dist/components/icon/icons/user-wait-icon.js +5 -5
  346. package/dist/components/icon/icons/users-icon.js +5 -5
  347. package/dist/components/icon/icons/version-control-icon.js +5 -5
  348. package/dist/components/icon/icons/volume-high-icon.js +5 -5
  349. package/dist/components/icon/icons/volume-icon.js +5 -5
  350. package/dist/components/icon/icons/volume-low-icon.js +5 -5
  351. package/dist/components/icon/icons/volume-off-icon.js +5 -5
  352. package/dist/components/icon/icons/warning-icon.js +5 -5
  353. package/dist/components/icon/icons/waste-icon.js +5 -5
  354. package/dist/components/icon/icons/wifi-icon.js +5 -5
  355. package/dist/components/icon/icons/wifi-off-icon.js +5 -5
  356. package/dist/components/icon/icons/wolt-icon.js +5 -5
  357. package/dist/components/icon/icons/wrap-content-icon.js +5 -5
  358. package/dist/components/icon-button/icon-button.js +37 -39
  359. package/dist/components/image/image.js +12 -14
  360. package/dist/components/image-upload/image-cropper.helper.js +74 -82
  361. package/dist/components/image-upload/image-cropper.js +156 -183
  362. package/dist/components/image-upload/image-upload-dropzone.js +134 -112
  363. package/dist/components/image-upload/image-upload-helper.js +15 -19
  364. package/dist/components/image-upload/image-upload-icons.js +52 -20
  365. package/dist/components/image-upload/image-upload-modal.js +131 -106
  366. package/dist/components/image-upload/image-upload.js +96 -86
  367. package/dist/components/image-upload/translations.js +65 -65
  368. package/dist/components/image-upload/types.js +6 -4
  369. package/dist/components/input/helper.js +18 -29
  370. package/dist/components/input/input-addon-recipe.js +37 -43
  371. package/dist/components/input/input-recipe.js +124 -133
  372. package/dist/components/input/input.js +78 -83
  373. package/dist/components/link/link-recipe.js +18 -22
  374. package/dist/components/link/link.js +14 -14
  375. package/dist/components/list/list-item.js +15 -15
  376. package/dist/components/list/list.js +19 -20
  377. package/dist/components/menu/helper.js +12 -16
  378. package/dist/components/menu/menu-box-button.js +22 -18
  379. package/dist/components/menu/menu-button.js +18 -16
  380. package/dist/components/menu/menu-divider.js +31 -28
  381. package/dist/components/menu/menu-group.js +138 -142
  382. package/dist/components/menu/menu-icon-button.js +13 -11
  383. package/dist/components/menu/menu-item.js +44 -45
  384. package/dist/components/menu/menu-list.js +14 -15
  385. package/dist/components/menu/menu-recipe.js +67 -81
  386. package/dist/components/menu/menu.js +34 -41
  387. package/dist/components/message/message.js +52 -38
  388. package/dist/components/modal/modal-body-context.js +6 -7
  389. package/dist/components/modal/modal-body.js +17 -17
  390. package/dist/components/modal/modal-close-button.js +23 -18
  391. package/dist/components/modal/modal-footer.js +29 -32
  392. package/dist/components/modal/modal-header.js +17 -17
  393. package/dist/components/modal/modal-recipe.js +110 -141
  394. package/dist/components/modal/modal.js +54 -58
  395. package/dist/components/navigation-list/navigation-list-item.js +76 -88
  396. package/dist/components/navigation-list/navigation-list.js +23 -17
  397. package/dist/components/paginator/paginator-recipe.js +34 -40
  398. package/dist/components/paginator/paginator.js +65 -70
  399. package/dist/components/paginator/translations.js +35 -35
  400. package/dist/components/phone-input/country-data.d.ts +1 -1
  401. package/dist/components/phone-input/country-data.d.ts.map +1 -1
  402. package/dist/components/phone-input/country-data.js +31 -36
  403. package/dist/components/phone-input/country-list.d.ts +1 -1
  404. package/dist/components/phone-input/country-list.d.ts.map +1 -1
  405. package/dist/components/phone-input/country-list.js +46 -25
  406. package/dist/components/phone-input/country-selector.d.ts +1 -1
  407. package/dist/components/phone-input/country-selector.d.ts.map +1 -1
  408. package/dist/components/phone-input/country-selector.js +167 -115
  409. package/dist/components/phone-input/phone-input-helpers.d.ts +1 -1
  410. package/dist/components/phone-input/phone-input-helpers.d.ts.map +1 -1
  411. package/dist/components/phone-input/phone-input-helpers.js +91 -119
  412. package/dist/components/phone-input/phone-input.js +47 -42
  413. package/dist/components/phone-input/translations.js +53 -53
  414. package/dist/components/phone-input/types.d.ts +1 -1
  415. package/dist/components/phone-input/types.d.ts.map +1 -1
  416. package/dist/components/phone-input/use-phone-input.d.ts +1 -1
  417. package/dist/components/phone-input/use-phone-input.d.ts.map +1 -1
  418. package/dist/components/phone-input/use-phone-input.js +110 -137
  419. package/dist/components/quantity-button/minus-button.js +18 -16
  420. package/dist/components/quantity-button/plus-button.js +18 -16
  421. package/dist/components/quantity-button/quantity-button.js +72 -40
  422. package/dist/components/radio/check-icon.js +5 -5
  423. package/dist/components/radio/hover-styles.js +21 -36
  424. package/dist/components/radio/radio-group-context.js +5 -6
  425. package/dist/components/radio/radio-group-recipe.js +124 -142
  426. package/dist/components/radio/radio-group.js +30 -28
  427. package/dist/components/radio/radio.js +72 -55
  428. package/dist/components/radio-card/hover-styles.js +21 -36
  429. package/dist/components/radio-card/radio-card-group.js +24 -25
  430. package/dist/components/radio-card/radio-card.js +87 -67
  431. package/dist/components/rich-text-editor/boolean-control.js +51 -54
  432. package/dist/components/rich-text-editor/extensions.js +39 -34
  433. package/dist/components/rich-text-editor/index.js +26 -22
  434. package/dist/components/rich-text-editor/rich-text-editor-context.js +9 -11
  435. package/dist/components/rich-text-editor/rich-text-editor-control.js +290 -284
  436. package/dist/components/rich-text-editor/rich-text-editor-recipe.js +71 -83
  437. package/dist/components/rich-text-editor/rich-text-editor.js +72 -69
  438. package/dist/components/rich-text-editor/rich-text-renderer.js +32 -32
  439. package/dist/components/rich-text-editor/translations.js +119 -119
  440. package/dist/components/rich-text-editor/use-rich-text-editor.js +22 -29
  441. package/dist/components/segmented-control/segmented-control-item.js +24 -25
  442. package/dist/components/segmented-control/segmented-control.js +49 -40
  443. package/dist/components/select/select-recipe.js +91 -106
  444. package/dist/components/select/select.js +27 -29
  445. package/dist/components/skeleton/skeleton-text.js +18 -19
  446. package/dist/components/skeleton/skeleton.js +19 -20
  447. package/dist/components/spinner/spinner.js +44 -28
  448. package/dist/components/stack/stack.js +18 -18
  449. package/dist/components/stepper/check-icon.js +5 -5
  450. package/dist/components/stepper/step-context.js +5 -5
  451. package/dist/components/stepper/step.js +111 -106
  452. package/dist/components/stepper/stepper.js +42 -43
  453. package/dist/components/stepper/times-icon.js +5 -5
  454. package/dist/components/switch/hover-styles.js +30 -44
  455. package/dist/components/switch/switch-recipe.js +76 -84
  456. package/dist/components/switch/switch.d.ts +3 -3
  457. package/dist/components/switch/switch.d.ts.map +1 -1
  458. package/dist/components/switch/switch.js +30 -31
  459. package/dist/components/switch/types.d.ts +4 -2
  460. package/dist/components/switch/types.d.ts.map +1 -1
  461. package/dist/components/table/helper.d.ts +6 -0
  462. package/dist/components/table/helper.d.ts.map +1 -1
  463. package/dist/components/table/helper.js +29 -9
  464. package/dist/components/table/index.d.ts +1 -1
  465. package/dist/components/table/index.d.ts.map +1 -1
  466. package/dist/components/table/table-cell.d.ts.map +1 -1
  467. package/dist/components/table/table-cell.js +136 -122
  468. package/dist/components/table/table-column-resize-handle.d.ts +12 -0
  469. package/dist/components/table/table-column-resize-handle.d.ts.map +1 -0
  470. package/dist/components/table/table-column-resize-handle.js +69 -0
  471. package/dist/components/table/table-content.d.ts.map +1 -1
  472. package/dist/components/table/table-content.js +174 -98
  473. package/dist/components/table/table-context-provider.d.ts +7 -2
  474. package/dist/components/table/table-context-provider.d.ts.map +1 -1
  475. package/dist/components/table/table-context-provider.js +203 -151
  476. package/dist/components/table/table-context.d.ts +24 -0
  477. package/dist/components/table/table-context.d.ts.map +1 -1
  478. package/dist/components/table/table-context.js +18 -11
  479. package/dist/components/table/table-filter.js +170 -118
  480. package/dist/components/table/table-header-dropdown.js +131 -89
  481. package/dist/components/table/table-header-row.d.ts.map +1 -1
  482. package/dist/components/table/table-header-row.js +202 -140
  483. package/dist/components/table/table-recipe.d.ts.map +1 -1
  484. package/dist/components/table/table-recipe.js +75 -96
  485. package/dist/components/table/table-row-expand-toggle-button.js +28 -35
  486. package/dist/components/table/table-row.d.ts.map +1 -1
  487. package/dist/components/table/table-row.js +51 -41
  488. package/dist/components/table/table-toolbar-actions.js +19 -19
  489. package/dist/components/table/table-toolbar-add-button.js +18 -13
  490. package/dist/components/table/table-toolbar-search.js +17 -12
  491. package/dist/components/table/table-toolbar-settings.js +180 -133
  492. package/dist/components/table/table-toolbar.js +72 -51
  493. package/dist/components/table/table.composition.d.ts +1 -0
  494. package/dist/components/table/table.composition.d.ts.map +1 -1
  495. package/dist/components/table/table.constants.d.ts +4 -0
  496. package/dist/components/table/table.constants.d.ts.map +1 -1
  497. package/dist/components/table/table.constants.js +9 -4
  498. package/dist/components/table/table.d.ts +1 -1
  499. package/dist/components/table/table.d.ts.map +1 -1
  500. package/dist/components/table/table.js +41 -37
  501. package/dist/components/table/translations.d.ts +7 -0
  502. package/dist/components/table/translations.d.ts.map +1 -1
  503. package/dist/components/table/translations.js +199 -194
  504. package/dist/components/table/types.d.ts +33 -2
  505. package/dist/components/table/types.d.ts.map +1 -1
  506. package/dist/components/tabs/tab-list.js +16 -17
  507. package/dist/components/tabs/tab-panel.js +14 -14
  508. package/dist/components/tabs/tab-panels.js +15 -15
  509. package/dist/components/tabs/tab-with-image.js +60 -53
  510. package/dist/components/tabs/tab.js +26 -22
  511. package/dist/components/tabs/tabs-recipe.js +96 -116
  512. package/dist/components/tabs/tabs.js +25 -24
  513. package/dist/components/tag/tag-recipe.js +225 -252
  514. package/dist/components/tag/tag.js +121 -62
  515. package/dist/components/text/text-recipe.js +3 -8
  516. package/dist/components/text/text.js +26 -27
  517. package/dist/components/textarea/textarea-recipe.js +90 -96
  518. package/dist/components/textarea/textarea.js +19 -19
  519. package/dist/components/toaster/toast-store.d.ts +2 -2
  520. package/dist/components/toaster/toast-store.d.ts.map +1 -1
  521. package/dist/components/toaster/toast-store.js +25 -32
  522. package/dist/components/toaster/toaster.js +39 -34
  523. package/dist/components/toggle-button/toggle-button.js +23 -25
  524. package/dist/components/toggle-button/use-button-children.js +36 -35
  525. package/dist/components/tooltip/tooltip.js +43 -47
  526. package/dist/hooks/use-color-mode.js +17 -22
  527. package/dist/hooks/use-disclosure.js +10 -13
  528. package/dist/hooks/use-measured-width.js +21 -21
  529. package/dist/hooks/use-remove-attributes.js +25 -24
  530. package/dist/index.js +396 -802
  531. package/dist/node_modules/@dnd-kit/abstract/index.js +658 -1185
  532. package/dist/node_modules/@dnd-kit/collision/dist/index.js +51 -90
  533. package/dist/node_modules/@dnd-kit/dom/index.js +1256 -1518
  534. package/dist/node_modules/@dnd-kit/dom/sortable.js +529 -654
  535. package/dist/node_modules/@dnd-kit/dom/utilities.js +772 -940
  536. package/dist/node_modules/@dnd-kit/geometry/dist/index.js +228 -196
  537. package/dist/node_modules/@dnd-kit/react/hooks.js +51 -63
  538. package/dist/node_modules/@dnd-kit/react/index.js +175 -235
  539. package/dist/node_modules/@dnd-kit/react/sortable.js +67 -142
  540. package/dist/node_modules/@dnd-kit/react/utilities.js +7 -9
  541. package/dist/node_modules/@dnd-kit/state/dist/index.js +157 -172
  542. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +154 -243
  543. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +294 -369
  544. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +95 -133
  545. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +96 -122
  546. package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +249 -264
  547. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +34 -88
  548. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +74 -88
  549. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1463 -1822
  550. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +633 -768
  551. package/dist/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +30 -32
  552. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +35 -48
  553. package/dist/node_modules/@tiptap/core/dist/index.js +3433 -3946
  554. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +19 -19
  555. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +73 -1498
  556. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +71 -84
  557. package/dist/node_modules/@tiptap/extension-code/dist/index.js +65 -70
  558. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +155 -216
  559. package/dist/node_modules/@tiptap/extension-document/dist/index.js +9 -11
  560. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +48 -60
  561. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +65 -66
  562. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +47 -55
  563. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +68 -82
  564. package/dist/node_modules/@tiptap/extension-link/dist/index.js +365 -334
  565. package/dist/node_modules/@tiptap/extension-list/dist/index.js +936 -1105
  566. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +43 -48
  567. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +53 -65
  568. package/dist/node_modules/@tiptap/extension-text/dist/index.js +12 -12
  569. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +60 -64
  570. package/dist/node_modules/@tiptap/extensions/dist/index.js +439 -462
  571. package/dist/node_modules/@tiptap/react/dist/index.js +314 -0
  572. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +23 -24
  573. package/dist/node_modules/country-flag-icons/modules/countries.json.js +4 -4
  574. package/dist/node_modules/country-flag-icons/modules/hasFlag.js +6 -6
  575. package/dist/node_modules/country-flag-icons/modules/react/3x2/index.js +5469 -6298
  576. package/dist/node_modules/country-flag-icons/react/3x2/index.js +273 -269
  577. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +5 -6
  578. package/dist/node_modules/date-fns/_lib/defaultOptions.js +6 -6
  579. package/dist/node_modules/date-fns/_lib/format/formatters.js +385 -544
  580. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +42 -57
  581. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +37 -48
  582. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +7 -17
  583. package/dist/node_modules/date-fns/_lib/normalizeDates.js +6 -9
  584. package/dist/node_modules/date-fns/_lib/protectedTokens.js +19 -16
  585. package/dist/node_modules/date-fns/addDays.js +8 -8
  586. package/dist/node_modules/date-fns/addMonths.js +11 -18
  587. package/dist/node_modules/date-fns/addWeeks.js +6 -6
  588. package/dist/node_modules/date-fns/constants.js +10 -6
  589. package/dist/node_modules/date-fns/constructFrom.js +6 -6
  590. package/dist/node_modules/date-fns/constructNow.js +6 -6
  591. package/dist/node_modules/date-fns/differenceInCalendarDays.js +10 -14
  592. package/dist/node_modules/date-fns/endOfDay.js +7 -7
  593. package/dist/node_modules/date-fns/endOfMonth.js +7 -7
  594. package/dist/node_modules/date-fns/format.js +57 -55
  595. package/dist/node_modules/date-fns/getDayOfYear.js +9 -9
  596. package/dist/node_modules/date-fns/getISOWeek.js +10 -10
  597. package/dist/node_modules/date-fns/getISOWeekYear.js +13 -13
  598. package/dist/node_modules/date-fns/getWeek.js +10 -10
  599. package/dist/node_modules/date-fns/getWeekYear.js +14 -14
  600. package/dist/node_modules/date-fns/isBefore.js +6 -6
  601. package/dist/node_modules/date-fns/isDate.js +5 -5
  602. package/dist/node_modules/date-fns/isPast.js +6 -6
  603. package/dist/node_modules/date-fns/isSameDay.js +8 -12
  604. package/dist/node_modules/date-fns/isSameMonth.js +7 -11
  605. package/dist/node_modules/date-fns/isSameWeek.js +8 -12
  606. package/dist/node_modules/date-fns/isSameYear.js +7 -11
  607. package/dist/node_modules/date-fns/isToday.js +7 -10
  608. package/dist/node_modules/date-fns/isValid.js +7 -7
  609. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +8 -8
  610. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +16 -17
  611. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +19 -28
  612. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +17 -14
  613. package/dist/node_modules/date-fns/locale/da/_lib/formatDistance.js +68 -69
  614. package/dist/node_modules/date-fns/locale/da/_lib/formatLong.js +31 -32
  615. package/dist/node_modules/date-fns/locale/da/_lib/formatRelative.js +11 -11
  616. package/dist/node_modules/date-fns/locale/da/_lib/localize.js +193 -142
  617. package/dist/node_modules/date-fns/locale/da/_lib/match.js +123 -109
  618. package/dist/node_modules/date-fns/locale/da.js +17 -17
  619. package/dist/node_modules/date-fns/locale/en-GB/_lib/formatLong.js +31 -32
  620. package/dist/node_modules/date-fns/locale/en-GB.js +18 -18
  621. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +68 -69
  622. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +31 -32
  623. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -11
  624. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +200 -153
  625. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +123 -109
  626. package/dist/node_modules/date-fns/locale/en-US.js +18 -18
  627. package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js +68 -69
  628. package/dist/node_modules/date-fns/locale/es/_lib/formatLong.js +31 -32
  629. package/dist/node_modules/date-fns/locale/es/_lib/formatRelative.js +18 -18
  630. package/dist/node_modules/date-fns/locale/es/_lib/localize.js +192 -141
  631. package/dist/node_modules/date-fns/locale/es/_lib/match.js +127 -114
  632. package/dist/node_modules/date-fns/locale/es.js +18 -18
  633. package/dist/node_modules/date-fns/locale/et/_lib/formatDistance.js +161 -162
  634. package/dist/node_modules/date-fns/locale/et/_lib/formatLong.js +31 -32
  635. package/dist/node_modules/date-fns/locale/et/_lib/formatRelative.js +11 -11
  636. package/dist/node_modules/date-fns/locale/et/_lib/localize.js +196 -152
  637. package/dist/node_modules/date-fns/locale/et/_lib/match.js +109 -107
  638. package/dist/node_modules/date-fns/locale/et.js +19 -19
  639. package/dist/node_modules/date-fns/locale/fi/_lib/formatDistance.js +101 -101
  640. package/dist/node_modules/date-fns/locale/fi/_lib/formatLong.js +31 -32
  641. package/dist/node_modules/date-fns/locale/fi/_lib/formatRelative.js +11 -11
  642. package/dist/node_modules/date-fns/locale/fi/_lib/localize.js +192 -140
  643. package/dist/node_modules/date-fns/locale/fi/_lib/match.js +122 -108
  644. package/dist/node_modules/date-fns/locale/fi.js +18 -18
  645. package/dist/node_modules/date-fns/locale/fr/_lib/formatDistance.js +68 -69
  646. package/dist/node_modules/date-fns/locale/fr/_lib/formatLong.js +31 -32
  647. package/dist/node_modules/date-fns/locale/fr/_lib/formatRelative.js +11 -11
  648. package/dist/node_modules/date-fns/locale/fr/_lib/localize.js +176 -120
  649. package/dist/node_modules/date-fns/locale/fr/_lib/match.js +122 -108
  650. package/dist/node_modules/date-fns/locale/fr.js +18 -18
  651. package/dist/node_modules/date-fns/locale/lt/_lib/formatDistance.js +93 -109
  652. package/dist/node_modules/date-fns/locale/lt/_lib/formatLong.js +31 -32
  653. package/dist/node_modules/date-fns/locale/lt/_lib/formatRelative.js +11 -11
  654. package/dist/node_modules/date-fns/locale/lt/_lib/localize.js +298 -195
  655. package/dist/node_modules/date-fns/locale/lt/_lib/match.js +154 -121
  656. package/dist/node_modules/date-fns/locale/lt.js +19 -19
  657. package/dist/node_modules/date-fns/locale/lv/_lib/formatDistance.js +226 -120
  658. package/dist/node_modules/date-fns/locale/lv/_lib/formatLong.js +31 -32
  659. package/dist/node_modules/date-fns/locale/lv/_lib/formatRelative.js +22 -22
  660. package/dist/node_modules/date-fns/locale/lv/_lib/localize.js +298 -221
  661. package/dist/node_modules/date-fns/locale/lv/_lib/match.js +138 -112
  662. package/dist/node_modules/date-fns/locale/lv.js +18 -18
  663. package/dist/node_modules/date-fns/locale/nb/_lib/formatDistance.js +68 -69
  664. package/dist/node_modules/date-fns/locale/nb/_lib/formatLong.js +31 -32
  665. package/dist/node_modules/date-fns/locale/nb/_lib/formatRelative.js +11 -11
  666. package/dist/node_modules/date-fns/locale/nb/_lib/localize.js +159 -108
  667. package/dist/node_modules/date-fns/locale/nb/_lib/match.js +112 -108
  668. package/dist/node_modules/date-fns/locale/nb.js +18 -18
  669. package/dist/node_modules/date-fns/locale/nl/_lib/formatDistance.js +68 -69
  670. package/dist/node_modules/date-fns/locale/nl/_lib/formatLong.js +31 -32
  671. package/dist/node_modules/date-fns/locale/nl/_lib/formatRelative.js +11 -11
  672. package/dist/node_modules/date-fns/locale/nl/_lib/localize.js +160 -109
  673. package/dist/node_modules/date-fns/locale/nl/_lib/match.js +120 -108
  674. package/dist/node_modules/date-fns/locale/nl-BE/_lib/formatDistance.js +68 -69
  675. package/dist/node_modules/date-fns/locale/nl-BE/_lib/formatLong.js +31 -32
  676. package/dist/node_modules/date-fns/locale/nl-BE/_lib/formatRelative.js +11 -11
  677. package/dist/node_modules/date-fns/locale/nl-BE/_lib/localize.js +160 -109
  678. package/dist/node_modules/date-fns/locale/nl-BE/_lib/match.js +120 -108
  679. package/dist/node_modules/date-fns/locale/nl-BE.js +18 -18
  680. package/dist/node_modules/date-fns/locale/nl.js +18 -18
  681. package/dist/node_modules/date-fns/locale/sv/_lib/formatDistance.js +82 -86
  682. package/dist/node_modules/date-fns/locale/sv/_lib/formatLong.js +31 -32
  683. package/dist/node_modules/date-fns/locale/sv/_lib/formatRelative.js +11 -11
  684. package/dist/node_modules/date-fns/locale/sv/_lib/localize.js +199 -142
  685. package/dist/node_modules/date-fns/locale/sv/_lib/match.js +109 -107
  686. package/dist/node_modules/date-fns/locale/sv.js +18 -18
  687. package/dist/node_modules/date-fns/startOfDay.js +7 -7
  688. package/dist/node_modules/date-fns/startOfISOWeek.js +9 -6
  689. package/dist/node_modules/date-fns/startOfISOWeekYear.js +9 -9
  690. package/dist/node_modules/date-fns/startOfMonth.js +7 -7
  691. package/dist/node_modules/date-fns/startOfWeek.js +8 -8
  692. package/dist/node_modules/date-fns/startOfWeekYear.js +10 -10
  693. package/dist/node_modules/date-fns/startOfYear.js +7 -7
  694. package/dist/node_modules/date-fns/subDays.js +6 -6
  695. package/dist/node_modules/date-fns/subMonths.js +6 -6
  696. package/dist/node_modules/date-fns/subWeeks.js +6 -6
  697. package/dist/node_modules/date-fns/toDate.js +6 -6
  698. package/dist/node_modules/fast-equals/dist/es/index.js +239 -298
  699. package/dist/node_modules/libphonenumber-js/es6-modern/ParseError.js +8 -0
  700. package/dist/node_modules/libphonenumber-js/es6-modern/PhoneNumber.js +73 -0
  701. package/dist/node_modules/libphonenumber-js/es6-modern/constants.js +4 -0
  702. package/dist/node_modules/libphonenumber-js/es6-modern/format.js +77 -0
  703. package/dist/node_modules/libphonenumber-js/es6-modern/getCountries.js +7 -0
  704. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/RFC3966.js +8 -0
  705. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/applyInternationalSeparatorStyle.js +7 -0
  706. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/checkNumberLength.js +21 -0
  707. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extension/createExtensionPattern.js +9 -0
  708. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extension/extractExtension.js +17 -0
  709. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractCountryCallingCode.js +37 -0
  710. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +21 -0
  711. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +21 -0
  712. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractNationalNumber.js +27 -0
  713. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +27 -0
  714. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/extractPhoneContext.js +16 -0
  715. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/formatNationalNumberUsingFormat.js +9 -0
  716. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getCountryAndCallingCodeFromOneOfThem.js +12 -0
  717. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getCountryByCallingCode.js +8 -0
  718. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getCountryByNationalNumber.js +14 -0
  719. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getIddPrefix.js +10 -0
  720. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getNumberType.js +30 -0
  721. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/getPossibleCountriesForNumber.js +12 -0
  722. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/isCallingCode.js +7 -0
  723. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/isCountryCode.js +7 -0
  724. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/isObject.js +7 -0
  725. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/isViablePhoneNumber.js +12 -0
  726. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/matchesEntirely.js +6 -0
  727. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/mergeArrays.js +8 -0
  728. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/parseDigits.js +48 -0
  729. package/dist/node_modules/libphonenumber-js/es6-modern/helpers/stripIddPrefix.js +16 -0
  730. package/dist/node_modules/libphonenumber-js/es6-modern/isPossible.js +32 -0
  731. package/dist/node_modules/libphonenumber-js/es6-modern/isValid.js +13 -0
  732. package/dist/node_modules/libphonenumber-js/es6-modern/isValidPhoneNumber.js +20 -0
  733. package/dist/node_modules/libphonenumber-js/es6-modern/metadata.js +254 -0
  734. package/dist/node_modules/libphonenumber-js/es6-modern/normalizeArguments.js +26 -0
  735. package/dist/node_modules/libphonenumber-js/es6-modern/parse.js +100 -0
  736. package/dist/node_modules/libphonenumber-js/es6-modern/parseIncompletePhoneNumber.js +19 -0
  737. package/dist/node_modules/libphonenumber-js/es6-modern/parsePhoneNumber.js +9 -0
  738. package/dist/node_modules/libphonenumber-js/es6-modern/parsePhoneNumberWithError_.js +16 -0
  739. package/dist/node_modules/libphonenumber-js/es6-modern/parsePhoneNumber_.js +24 -0
  740. package/dist/node_modules/libphonenumber-js/es6-modern/tools/semver-compare.js +14 -0
  741. package/dist/node_modules/libphonenumber-js/max/es6/exports/PhoneNumber.js +10 -0
  742. package/dist/node_modules/libphonenumber-js/max/es6/exports/getCountries.js +8 -0
  743. package/dist/node_modules/libphonenumber-js/max/es6/exports/getCountryCallingCode.js +8 -0
  744. package/dist/node_modules/libphonenumber-js/max/es6/exports/isSupportedCountry.js +8 -0
  745. package/dist/node_modules/libphonenumber-js/max/es6/exports/isValidPhoneNumber.js +8 -0
  746. package/dist/node_modules/libphonenumber-js/max/es6/exports/parsePhoneNumber.js +9 -0
  747. package/dist/node_modules/libphonenumber-js/max/es6/exports/withMetadataArgument.js +10 -0
  748. package/dist/node_modules/libphonenumber-js/metadata.max.json.js +10497 -0
  749. package/dist/node_modules/linkifyjs/dist/linkify.js +486 -679
  750. package/dist/node_modules/next-themes/dist/index.js +120 -85
  751. package/dist/node_modules/orderedmap/dist/index.js +64 -100
  752. package/dist/node_modules/prosemirror-commands/dist/index.js +313 -368
  753. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +109 -84
  754. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +162 -195
  755. package/dist/node_modules/prosemirror-history/dist/index.js +203 -239
  756. package/dist/node_modules/prosemirror-keymap/dist/index.js +45 -57
  757. package/dist/node_modules/prosemirror-model/dist/index.js +1783 -2735
  758. package/dist/node_modules/prosemirror-schema-list/dist/index.js +66 -81
  759. package/dist/node_modules/prosemirror-state/dist/index.js +517 -814
  760. package/dist/node_modules/prosemirror-transform/dist/index.js +1104 -1505
  761. package/dist/node_modules/prosemirror-view/dist/index.js +3274 -3782
  762. package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +15 -21
  763. package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +12 -14
  764. package/dist/node_modules/react/compiler-runtime.js +10 -10
  765. package/dist/node_modules/rope-sequence/dist/index.js +82 -99
  766. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +55 -58
  767. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +53 -57
  768. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +53 -58
  769. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +45 -46
  770. package/dist/node_modules/use-sync-external-store/shim/index.js +10 -10
  771. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +10 -10
  772. package/dist/node_modules/w3c-keyname/index.js +87 -92
  773. package/dist/theme/component-recipes.js +52 -53
  774. package/dist/theme/theme-casper-ui.js +179 -420
  775. package/dist/theme/theme-helper.js +4 -4
  776. package/dist/theme/theme-provider.js +33 -34
  777. package/dist/theme/theme-style-props.d.ts.map +1 -1
  778. package/dist/theme/theme-tokens.js +22 -12
  779. package/dist/theme/theme-types.js +22 -12
  780. package/dist/theme/theme.js +213 -268
  781. package/package.json +30 -29
  782. package/dist/_virtual/compiler-runtime.js +0 -5
  783. package/dist/_virtual/compiler-runtime2.js +0 -4
  784. package/dist/_virtual/index.js +0 -5
  785. package/dist/_virtual/index2.js +0 -4
  786. package/dist/_virtual/react-compiler-runtime.development.js +0 -4
  787. package/dist/_virtual/react-compiler-runtime.production.js +0 -4
  788. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -4
  789. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -4
  790. package/dist/_virtual/with-selector.development.js +0 -4
  791. package/dist/_virtual/with-selector.js +0 -5
  792. package/dist/_virtual/with-selector.production.js +0 -4
  793. package/dist/_virtual/with-selector2.js +0 -4
  794. package/dist/node_modules/libphonenumber-js/es6/ParseError.js +0 -89
  795. package/dist/node_modules/libphonenumber-js/es6/PhoneNumber.js +0 -192
  796. package/dist/node_modules/libphonenumber-js/es6/constants.js +0 -10
  797. package/dist/node_modules/libphonenumber-js/es6/format.js +0 -98
  798. package/dist/node_modules/libphonenumber-js/es6/getCountries.js +0 -7
  799. package/dist/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +0 -11
  800. package/dist/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -7
  801. package/dist/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -16
  802. package/dist/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -11
  803. package/dist/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -18
  804. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -46
  805. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -27
  806. package/dist/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -23
  807. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -39
  808. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -31
  809. package/dist/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -23
  810. package/dist/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -25
  811. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js +0 -12
  812. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -9
  813. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -43
  814. package/dist/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -12
  815. package/dist/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +0 -52
  816. package/dist/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -14
  817. package/dist/node_modules/libphonenumber-js/es6/helpers/isCallingCode.js +0 -7
  818. package/dist/node_modules/libphonenumber-js/es6/helpers/isCountryCode.js +0 -7
  819. package/dist/node_modules/libphonenumber-js/es6/helpers/isObject.js +0 -7
  820. package/dist/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -20
  821. package/dist/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -6
  822. package/dist/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +0 -79
  823. package/dist/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -19
  824. package/dist/node_modules/libphonenumber-js/es6/isPossible.js +0 -35
  825. package/dist/node_modules/libphonenumber-js/es6/isValid.js +0 -14
  826. package/dist/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js +0 -59
  827. package/dist/node_modules/libphonenumber-js/es6/metadata.js +0 -494
  828. package/dist/node_modules/libphonenumber-js/es6/normalizeArguments.js +0 -108
  829. package/dist/node_modules/libphonenumber-js/es6/parse.js +0 -138
  830. package/dist/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -40
  831. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +0 -9
  832. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -55
  833. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +0 -62
  834. package/dist/node_modules/libphonenumber-js/es6/tools/semver-compare.js +0 -14
  835. package/dist/node_modules/libphonenumber-js/metadata.min.json.js +0 -4
  836. package/dist/node_modules/libphonenumber-js/min/exports/getCountries.js +0 -8
  837. package/dist/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js +0 -8
  838. package/dist/node_modules/libphonenumber-js/min/exports/isSupportedCountry.js +0 -8
  839. package/dist/node_modules/libphonenumber-js/min/exports/isValidPhoneNumber.js +0 -8
  840. package/dist/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +0 -8
  841. package/dist/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +0 -8
  842. package/dist/packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js +0 -506
@@ -1,1552 +1,1151 @@
1
- import { Slice as g, Fragment as w, Mark as se, MarkType as oe, ReplaceError as le } from "../../prosemirror-model/dist/index.js";
2
- const Q = 65535, U = Math.pow(2, 16);
3
- function ae(s, e) {
4
- return s + e * U;
1
+ import { Fragment as e, Mark as t, MarkType as n, ReplaceError as r, Slice as i } from "../../prosemirror-model/dist/index.js";
2
+ //#region ../../node_modules/prosemirror-transform/dist/index.js
3
+ var a = 65535, o = 2 ** 16;
4
+ function s(e, t) {
5
+ return e + t * o;
5
6
  }
6
- function H(s) {
7
- return s & Q;
7
+ function c(e) {
8
+ return e & a;
8
9
  }
9
- function he(s) {
10
- return (s - (s & Q)) / U;
10
+ function l(e) {
11
+ return (e - (e & a)) / o;
11
12
  }
12
- const V = 1, X = 2, A = 4, Y = 8;
13
- class L {
14
- /**
15
- @internal
16
- */
17
- constructor(e, t, r) {
18
- this.pos = e, this.delInfo = t, this.recover = r;
19
- }
20
- /**
21
- Tells you whether the position was deleted, that is, whether the
22
- step removed the token on the side queried (via the `assoc`)
23
- argument from the document.
24
- */
25
- get deleted() {
26
- return (this.delInfo & Y) > 0;
27
- }
28
- /**
29
- Tells you whether the token before the mapped position was deleted.
30
- */
31
- get deletedBefore() {
32
- return (this.delInfo & (V | A)) > 0;
33
- }
34
- /**
35
- True when the token after the mapped position was deleted.
36
- */
37
- get deletedAfter() {
38
- return (this.delInfo & (X | A)) > 0;
39
- }
40
- /**
41
- Tells whether any of the steps mapped through deletes across the
42
- position (including both the token before and after the
43
- position).
44
- */
45
- get deletedAcross() {
46
- return (this.delInfo & A) > 0;
47
- }
48
- }
49
- class S {
50
- /**
51
- Create a position map. The modifications to the document are
52
- represented as an array of numbers, in which each group of three
53
- represents a modified chunk as `[start, oldSize, newSize]`.
54
- */
55
- constructor(e, t = !1) {
56
- if (this.ranges = e, this.inverted = t, !e.length && S.empty)
57
- return S.empty;
58
- }
59
- /**
60
- @internal
61
- */
62
- recover(e) {
63
- let t = 0, r = H(e);
64
- 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);
68
- }
69
- mapResult(e, t = 1) {
70
- return this._map(e, t, !1);
71
- }
72
- map(e, t = 1) {
73
- return this._map(e, t, !0);
74
- }
75
- /**
76
- @internal
77
- */
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
- 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 : A;
90
- return (t < 0 ? e != a : e != c) && (m |= Y), new L(d, m, u);
91
- }
92
- n += p - h;
93
- }
94
- return r ? e + n : new L(e + n, 0, null);
95
- }
96
- /**
97
- @internal
98
- */
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)
104
- 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;
109
- }
110
- return !1;
111
- }
112
- /**
113
- Calls the given function on each of the changed ranges included in
114
- this map.
115
- */
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;
121
- }
122
- }
123
- /**
124
- Create an inverted version of this map. The result can be used to
125
- map positions in the post-step document to the pre-step document.
126
- */
127
- invert() {
128
- return new S(this.ranges, !this.inverted);
129
- }
130
- /**
131
- @internal
132
- */
133
- toString() {
134
- return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
135
- }
136
- /**
137
- Create a map that moves all positions by offset `n` (which may be
138
- negative). This can be useful when applying steps meant for a
139
- sub-document to a larger document, or vice-versa.
140
- */
141
- static offset(e) {
142
- return e == 0 ? S.empty : new S(e < 0 ? [0, -e, 0] : [0, 0, e]);
143
- }
144
- }
145
- S.empty = new S([]);
146
- class J {
147
- /**
148
- Create a new mapping with the given position maps.
149
- */
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);
152
- }
153
- /**
154
- The step maps in this mapping.
155
- */
156
- get maps() {
157
- return this._maps;
158
- }
159
- /**
160
- Create a mapping that maps only through a part of this one.
161
- */
162
- slice(e = 0, t = this.maps.length) {
163
- return new J(this._maps, this.mirror, e, t);
164
- }
165
- /**
166
- Add a step map to the end of this mapping. If `mirrors` is
167
- given, it should be the index of the step map that is the mirror
168
- image of this one.
169
- */
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);
172
- }
173
- /**
174
- Add all the step maps in a given mapping to this one (preserving
175
- mirroring information).
176
- */
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);
181
- }
182
- }
183
- /**
184
- Finds the offset of the step map that mirrors the map at the
185
- given offset, in this mapping (as per the second argument to
186
- `appendMap`).
187
- */
188
- getMirror(e) {
189
- 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)];
193
- }
194
- }
195
- /**
196
- @internal
197
- */
198
- setMirror(e, t) {
199
- this.mirror || (this.mirror = []), this.mirror.push(e, t);
200
- }
201
- /**
202
- Append the inverse of the given mapping to this one.
203
- */
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);
208
- }
209
- }
210
- /**
211
- Create an inverted version of this mapping.
212
- */
213
- invert() {
214
- let e = new J();
215
- return e.appendMappingInverted(this), e;
216
- }
217
- /**
218
- Map a position through this mapping.
219
- */
220
- map(e, t = 1) {
221
- 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;
226
- }
227
- /**
228
- Map a position through this mapping, returning a mapping
229
- result.
230
- */
231
- mapResult(e, t = 1) {
232
- return this._map(e, t, !1);
233
- }
234
- /**
235
- @internal
236
- */
237
- _map(e, t, r) {
238
- let n = 0;
239
- 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);
245
- continue;
246
- }
247
- }
248
- n |= l.delInfo, e = l.pos;
249
- }
250
- return r ? e : new L(e, n, null);
251
- }
252
- }
253
- const B = /* @__PURE__ */ Object.create(null);
254
- class v {
255
- /**
256
- Get the step map that represents the changes made by this step,
257
- and which can be used to transform between positions in the old
258
- and the new document.
259
- */
260
- getMap() {
261
- return S.empty;
262
- }
263
- /**
264
- Try to merge this step with another one, to be applied directly
265
- after it. Returns the merged step when possible, null if the
266
- steps can't be merged.
267
- */
268
- merge(e) {
269
- return null;
270
- }
271
- /**
272
- Deserialize a step from its JSON representation. Will call
273
- through to the step class' own implementation of this method.
274
- */
275
- static fromJSON(e, t) {
276
- if (!t || !t.stepType)
277
- 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);
282
- }
283
- /**
284
- To be able to serialize steps to JSON, each step needs a string
285
- ID to attach to its JSON representation. Use this method to
286
- register an ID for your step classes. Try to pick something
287
- that's unlikely to clash with steps from other modules.
288
- */
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;
293
- }
294
- }
295
- class y {
296
- /**
297
- @internal
298
- */
299
- constructor(e, t) {
300
- this.doc = e, this.failed = t;
301
- }
302
- /**
303
- Create a successful step result.
304
- */
305
- static ok(e) {
306
- return new y(e, null);
307
- }
308
- /**
309
- Create a failed step result.
310
- */
311
- static fail(e) {
312
- return new y(null, e);
313
- }
314
- /**
315
- Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
316
- arguments. Create a successful result if it succeeds, and a
317
- failed one if it throws a `ReplaceError`.
318
- */
319
- static fromReplace(e, t, r, n) {
320
- 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;
326
- }
327
- }
328
- }
329
- function q(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(q(i.content, e, i))), i.isInline && (i = e(i, t, n)), r.push(i);
334
- }
335
- return w.fromArray(r);
336
- }
337
- class C extends v {
338
- /**
339
- Create a mark step.
340
- */
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 g(q(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);
347
- }
348
- invert() {
349
- return new b(this.from, this.to, this.mark);
350
- }
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);
354
- }
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;
357
- }
358
- toJSON() {
359
- return {
360
- stepType: "addMark",
361
- mark: this.mark.toJSON(),
362
- from: this.from,
363
- to: this.to
364
- };
365
- }
366
- /**
367
- @internal
368
- */
369
- static fromJSON(e, t) {
370
- if (typeof t.from != "number" || typeof t.to != "number")
371
- throw new RangeError("Invalid input for AddMarkStep.fromJSON");
372
- return new C(t.from, t.to, e.markFromJSON(t.mark));
373
- }
374
- }
375
- v.jsonID("addMark", C);
376
- class b extends v {
377
- /**
378
- Create a mark-removing step.
379
- */
380
- constructor(e, t, r) {
381
- super(), this.from = e, this.to = t, this.mark = r;
382
- }
383
- apply(e) {
384
- let t = e.slice(this.from, this.to), r = new g(q(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);
386
- }
387
- invert() {
388
- return new C(this.from, this.to, this.mark);
389
- }
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);
393
- }
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;
396
- }
397
- toJSON() {
398
- return {
399
- stepType: "removeMark",
400
- mark: this.mark.toJSON(),
401
- from: this.from,
402
- to: this.to
403
- };
404
- }
405
- /**
406
- @internal
407
- */
408
- static fromJSON(e, t) {
409
- if (typeof t.from != "number" || typeof t.to != "number")
410
- throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
411
- return new b(t.from, t.to, e.markFromJSON(t.mark));
412
- }
413
- }
414
- v.jsonID("removeMark", b);
415
- class I extends v {
416
- /**
417
- Create a node mark step.
418
- */
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 g(w.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 I(this.pos, t.marks[n]);
437
- return new I(this.pos, this.mark);
438
- }
439
- }
440
- return new R(this.pos, this.mark);
441
- }
442
- map(e) {
443
- let t = e.mapResult(this.pos, 1);
444
- return t.deletedAfter ? null : new I(t.pos, this.mark);
445
- }
446
- toJSON() {
447
- return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
448
- }
449
- /**
450
- @internal
451
- */
452
- static fromJSON(e, t) {
453
- if (typeof t.pos != "number")
454
- throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
455
- return new I(t.pos, e.markFromJSON(t.mark));
456
- }
457
- }
458
- v.jsonID("addNodeMark", I);
459
- class R extends v {
460
- /**
461
- Create a mark-removing step.
462
- */
463
- constructor(e, t) {
464
- super(), this.pos = e, this.mark = t;
465
- }
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 g(w.from(r), 0, t.isLeaf ? 0 : 1));
472
- }
473
- invert(e) {
474
- let t = e.nodeAt(this.pos);
475
- return !t || !this.mark.isInSet(t.marks) ? this : new I(this.pos, this.mark);
476
- }
477
- map(e) {
478
- let t = e.mapResult(this.pos, 1);
479
- return t.deletedAfter ? null : new R(t.pos, this.mark);
480
- }
481
- toJSON() {
482
- return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
483
- }
484
- /**
485
- @internal
486
- */
487
- static fromJSON(e, t) {
488
- if (typeof t.pos != "number")
489
- throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
490
- return new R(t.pos, e.markFromJSON(t.mark));
491
- }
492
- }
493
- v.jsonID("removeNodeMark", R);
494
- class k extends v {
495
- /**
496
- The given `slice` should fit the 'gap' between `from` and
497
- `to`—the depths must line up, and the surrounding nodes must be
498
- able to be joined with the open sides of the slice. When
499
- `structure` is true, the step will fail if the content between
500
- from and to is not just a sequence of closing and then opening
501
- tokens (this is to guard against rebased replace steps
502
- overwriting something they weren't supposed to).
503
- */
504
- constructor(e, t, r, n = !1) {
505
- super(), this.from = e, this.to = t, this.slice = r, this.structure = n;
506
- }
507
- apply(e) {
508
- return this.structure && P(e, this.from, this.to) ? y.fail("Structure replace would overwrite content") : y.fromReplace(e, this.from, this.to, this.slice);
509
- }
510
- getMap() {
511
- return new S([this.from, this.to - this.from, this.slice.size]);
512
- }
513
- invert(e) {
514
- return new k(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
515
- }
516
- map(e) {
517
- let t = e.mapResult(this.to, -1), r = this.from == this.to && k.MAP_BIAS < 0 ? t : e.mapResult(this.from, 1);
518
- return r.deletedAcross && t.deletedAcross ? null : new k(r.pos, Math.max(r.pos, t.pos), this.slice, this.structure);
519
- }
520
- merge(e) {
521
- if (!(e instanceof k) || e.structure || this.structure)
522
- 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 ? g.empty : new g(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
525
- return new k(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 ? g.empty : new g(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
528
- return new k(e.from, this.to, t, this.structure);
529
- } else
530
- return null;
531
- }
532
- 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;
535
- }
536
- /**
537
- @internal
538
- */
539
- static fromJSON(e, t) {
540
- if (typeof t.from != "number" || typeof t.to != "number")
541
- throw new RangeError("Invalid input for ReplaceStep.fromJSON");
542
- return new k(t.from, t.to, g.fromJSON(e, t.slice), !!t.structure);
543
- }
544
- }
545
- k.MAP_BIAS = 1;
546
- v.jsonID("replace", k);
547
- class M extends v {
548
- /**
549
- Create a replace-around step with the given range and gap.
550
- `insert` should be the point in the slice into which the content
551
- of the gap should be moved. `structure` has the same meaning as
552
- it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
553
- */
554
- constructor(e, t, r, n, i, o, l = !1) {
555
- super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = n, this.slice = i, this.insert = o, this.structure = l;
556
- }
557
- apply(e) {
558
- if (this.structure && (P(e, this.from, this.gapFrom) || P(e, this.gapTo, this.to)))
559
- return y.fail("Structure gap-replace would overwrite content");
560
- let t = e.slice(this.gapFrom, this.gapTo);
561
- if (t.openStart || t.openEnd)
562
- return y.fail("Gap is not a flat range");
563
- let r = this.slice.insertAt(this.insert, t.content);
564
- return r ? y.fromReplace(e, this.from, this.to, r) : y.fail("Content does not fit in gap");
565
- }
566
- getMap() {
567
- return new S([
568
- this.from,
569
- this.gapFrom - this.from,
570
- this.insert,
571
- this.gapTo,
572
- this.to - this.gapTo,
573
- this.slice.size - this.insert
574
- ]);
575
- }
576
- invert(e) {
577
- let t = this.gapTo - this.gapFrom;
578
- 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);
579
- }
580
- map(e) {
581
- 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);
582
- 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);
583
- }
584
- toJSON() {
585
- let e = {
586
- stepType: "replaceAround",
587
- from: this.from,
588
- to: this.to,
589
- gapFrom: this.gapFrom,
590
- gapTo: this.gapTo,
591
- insert: this.insert
592
- };
593
- return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
594
- }
595
- /**
596
- @internal
597
- */
598
- static fromJSON(e, t) {
599
- if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
600
- throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
601
- return new M(t.from, t.to, t.gapFrom, t.gapTo, g.fromJSON(e, t.slice), t.insert, !!t.structure);
602
- }
603
- }
604
- v.jsonID("replaceAround", M);
605
- function P(s, e, t) {
606
- let r = s.resolve(e), n = t - e, i = r.depth;
607
- for (; n > 0 && i > 0 && r.indexAfter(i) == r.node(i).childCount; )
608
- i--, n--;
609
- if (n > 0) {
610
- let o = r.node(i).maybeChild(r.indexAfter(i));
611
- for (; n > 0; ) {
612
- if (!o || o.isLeaf)
613
- return !0;
614
- o = o.firstChild, n--;
615
- }
616
- }
617
- return !1;
618
- }
619
- function pe(s, e, t, r) {
620
- let n = [], i = [], o, l;
621
- s.doc.nodesBetween(e, t, (a, h, p) => {
622
- if (!a.isInline)
623
- return;
624
- let c = a.marks;
625
- if (!r.isInSet(c) && p.type.allowsMarkType(r.type)) {
626
- let f = Math.max(h, e), d = Math.min(h + a.nodeSize, t), u = r.addToSet(c);
627
- for (let m = 0; m < c.length; m++)
628
- 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])));
629
- l && l.to == f ? l.to = d : i.push(l = new C(f, d, r));
630
- }
631
- }), n.forEach((a) => s.step(a)), i.forEach((a) => s.step(a));
632
- }
633
- function fe(s, e, t, r) {
634
- let n = [], i = 0;
635
- s.doc.nodesBetween(e, t, (o, l) => {
636
- if (!o.isInline)
637
- return;
638
- i++;
639
- let a = null;
640
- if (r instanceof oe) {
641
- let h = o.marks, p;
642
- for (; p = r.isInSet(h); )
643
- (a || (a = [])).push(p), h = p.removeFromSet(h);
644
- } else r ? r.isInSet(o.marks) && (a = [r]) : a = o.marks;
645
- if (a && a.length) {
646
- let h = Math.min(l + o.nodeSize, t);
647
- for (let p = 0; p < a.length; p++) {
648
- let c = a[p], f;
649
- for (let d = 0; d < n.length; d++) {
650
- let u = n[d];
651
- u.step == i - 1 && c.eq(n[d].style) && (f = u);
652
- }
653
- f ? (f.to = h, f.step = i) : n.push({ style: c, from: Math.max(l, e), to: h, step: i });
654
- }
655
- }
656
- }), n.forEach((o) => s.step(new b(o.from, o.to, o.style)));
13
+ var u = 1, d = 2, f = 4, p = 8, m = class {
14
+ constructor(e, t, n) {
15
+ this.pos = e, this.delInfo = t, this.recover = n;
16
+ }
17
+ get deleted() {
18
+ return (this.delInfo & p) > 0;
19
+ }
20
+ get deletedBefore() {
21
+ return (this.delInfo & 5) > 0;
22
+ }
23
+ get deletedAfter() {
24
+ return (this.delInfo & 6) > 0;
25
+ }
26
+ get deletedAcross() {
27
+ return (this.delInfo & f) > 0;
28
+ }
29
+ }, h = class e {
30
+ constructor(t, n = !1) {
31
+ if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
32
+ }
33
+ recover(e) {
34
+ let t = 0, n = c(e);
35
+ if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
36
+ return this.ranges[n * 3] + t + l(e);
37
+ }
38
+ mapResult(e, t = 1) {
39
+ return this._map(e, t, !1);
40
+ }
41
+ map(e, t = 1) {
42
+ return this._map(e, t, !0);
43
+ }
44
+ _map(e, t, n) {
45
+ let r = 0, i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
46
+ for (let o = 0; o < this.ranges.length; o += 3) {
47
+ let c = this.ranges[o] - (this.inverted ? r : 0);
48
+ if (c > e) break;
49
+ let l = this.ranges[o + i], h = this.ranges[o + a], g = c + l;
50
+ if (e <= g) {
51
+ let i = l ? e == c ? -1 : e == g ? 1 : t : t, a = c + r + (i < 0 ? 0 : h);
52
+ if (n) return a;
53
+ let _ = e == (t < 0 ? c : g) ? null : s(o / 3, e - c), v = e == c ? d : e == g ? u : f;
54
+ return (t < 0 ? e != c : e != g) && (v |= p), new m(a, v, _);
55
+ }
56
+ r += h - l;
57
+ }
58
+ return n ? e + r : new m(e + r, 0, null);
59
+ }
60
+ touches(e, t) {
61
+ let n = 0, r = c(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
62
+ for (let t = 0; t < this.ranges.length; t += 3) {
63
+ let o = this.ranges[t] - (this.inverted ? n : 0);
64
+ if (o > e) break;
65
+ let s = this.ranges[t + i];
66
+ if (e <= o + s && t == r * 3) return !0;
67
+ n += this.ranges[t + a] - s;
68
+ }
69
+ return !1;
70
+ }
71
+ forEach(e) {
72
+ let t = this.inverted ? 2 : 1, n = this.inverted ? 1 : 2;
73
+ for (let r = 0, i = 0; r < this.ranges.length; r += 3) {
74
+ let a = this.ranges[r], o = a - (this.inverted ? i : 0), s = a + (this.inverted ? 0 : i), c = this.ranges[r + t], l = this.ranges[r + n];
75
+ e(o, o + c, s, s + l), i += l - c;
76
+ }
77
+ }
78
+ invert() {
79
+ return new e(this.ranges, !this.inverted);
80
+ }
81
+ toString() {
82
+ return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
83
+ }
84
+ static offset(t) {
85
+ return t == 0 ? e.empty : new e(t < 0 ? [
86
+ 0,
87
+ -t,
88
+ 0
89
+ ] : [
90
+ 0,
91
+ 0,
92
+ t
93
+ ]);
94
+ }
95
+ };
96
+ h.empty = new h([]);
97
+ var g = class e {
98
+ constructor(e, t, n = 0, r = e ? e.length : 0) {
99
+ this.mirror = t, this.from = n, this.to = r, this._maps = e || [], this.ownData = !(e || t);
100
+ }
101
+ get maps() {
102
+ return this._maps;
103
+ }
104
+ slice(t = 0, n = this.maps.length) {
105
+ return new e(this._maps, this.mirror, t, n);
106
+ }
107
+ appendMap(e, t) {
108
+ this.ownData ||= (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), !0), this.to = this._maps.push(e), t != null && this.setMirror(this._maps.length - 1, t);
109
+ }
110
+ appendMapping(e) {
111
+ for (let t = 0, n = this._maps.length; t < e._maps.length; t++) {
112
+ let r = e.getMirror(t);
113
+ this.appendMap(e._maps[t], r != null && r < t ? n + r : void 0);
114
+ }
115
+ }
116
+ getMirror(e) {
117
+ if (this.mirror) {
118
+ for (let t = 0; t < this.mirror.length; t++) if (this.mirror[t] == e) return this.mirror[t + (t % 2 ? -1 : 1)];
119
+ }
120
+ }
121
+ setMirror(e, t) {
122
+ this.mirror ||= [], this.mirror.push(e, t);
123
+ }
124
+ appendMappingInverted(e) {
125
+ for (let t = e.maps.length - 1, n = this._maps.length + e._maps.length; t >= 0; t--) {
126
+ let r = e.getMirror(t);
127
+ this.appendMap(e._maps[t].invert(), r != null && r > t ? n - r - 1 : void 0);
128
+ }
129
+ }
130
+ invert() {
131
+ let t = new e();
132
+ return t.appendMappingInverted(this), t;
133
+ }
134
+ map(e, t = 1) {
135
+ if (this.mirror) return this._map(e, t, !0);
136
+ for (let n = this.from; n < this.to; n++) e = this._maps[n].map(e, t);
137
+ return e;
138
+ }
139
+ mapResult(e, t = 1) {
140
+ return this._map(e, t, !1);
141
+ }
142
+ _map(e, t, n) {
143
+ let r = 0;
144
+ for (let n = this.from; n < this.to; n++) {
145
+ let i = this._maps[n].mapResult(e, t);
146
+ if (i.recover != null) {
147
+ let t = this.getMirror(n);
148
+ if (t != null && t > n && t < this.to) {
149
+ n = t, e = this._maps[t].recover(i.recover);
150
+ continue;
151
+ }
152
+ }
153
+ r |= i.delInfo, e = i.pos;
154
+ }
155
+ return n ? e : new m(e, r, null);
156
+ }
157
+ }, _ = Object.create(null), v = class {
158
+ getMap() {
159
+ return h.empty;
160
+ }
161
+ merge(e) {
162
+ return null;
163
+ }
164
+ static fromJSON(e, t) {
165
+ if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
166
+ let n = _[t.stepType];
167
+ if (!n) throw RangeError(`No step type ${t.stepType} defined`);
168
+ return n.fromJSON(e, t);
169
+ }
170
+ static jsonID(e, t) {
171
+ if (e in _) throw RangeError("Duplicate use of step JSON ID " + e);
172
+ return _[e] = t, t.prototype.jsonID = e, t;
173
+ }
174
+ }, y = class e {
175
+ constructor(e, t) {
176
+ this.doc = e, this.failed = t;
177
+ }
178
+ static ok(t) {
179
+ return new e(t, null);
180
+ }
181
+ static fail(t) {
182
+ return new e(null, t);
183
+ }
184
+ static fromReplace(t, n, i, a) {
185
+ try {
186
+ return e.ok(t.replace(n, i, a));
187
+ } catch (t) {
188
+ if (t instanceof r) return e.fail(t.message);
189
+ throw t;
190
+ }
191
+ }
192
+ };
193
+ function b(t, n, r) {
194
+ let i = [];
195
+ for (let e = 0; e < t.childCount; e++) {
196
+ let a = t.child(e);
197
+ a.content.size && (a = a.copy(b(a.content, n, a))), a.isInline && (a = n(a, r, e)), i.push(a);
198
+ }
199
+ return e.fromArray(i);
657
200
  }
658
- function $(s, e, t, r = t.contentMatch, n = !0) {
659
- let i = s.doc.nodeAt(e), o = [], l = e + 1;
660
- for (let a = 0; a < i.childCount; a++) {
661
- let h = i.child(a), p = l + h.nodeSize, c = r.matchType(h.type);
662
- if (!c)
663
- o.push(new k(l, p, g.empty));
664
- else {
665
- r = c;
666
- for (let f = 0; f < h.marks.length; f++)
667
- t.allowsMarkType(h.marks[f].type) || s.step(new b(l, p, h.marks[f]));
668
- if (n && h.isText && t.whitespace != "pre") {
669
- let f, d = /\r?\n|\r/g, u;
670
- for (; f = d.exec(h.text); )
671
- u || (u = new g(w.from(t.schema.text(" ", t.allowedMarks(h.marks))), 0, 0)), o.push(new k(l + f.index, l + f.index + f[0].length, u));
672
- }
673
- }
674
- l = p;
675
- }
676
- if (!r.validEnd) {
677
- let a = r.fillBefore(w.empty, !0);
678
- s.replace(l, l, new g(a, 0, 0));
679
- }
680
- for (let a = o.length - 1; a >= 0; a--)
681
- s.step(o[a]);
201
+ var x = class e extends v {
202
+ constructor(e, t, n) {
203
+ super(), this.from = e, this.to = t, this.mark = n;
204
+ }
205
+ apply(e) {
206
+ let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), a = new i(b(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
207
+ return y.fromReplace(e, this.from, this.to, a);
208
+ }
209
+ invert() {
210
+ return new S(this.from, this.to, this.mark);
211
+ }
212
+ map(t) {
213
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
214
+ return n.deleted && r.deleted || n.pos >= r.pos ? null : new e(n.pos, r.pos, this.mark);
215
+ }
216
+ merge(t) {
217
+ return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
218
+ }
219
+ toJSON() {
220
+ return {
221
+ stepType: "addMark",
222
+ mark: this.mark.toJSON(),
223
+ from: this.from,
224
+ to: this.to
225
+ };
226
+ }
227
+ static fromJSON(t, n) {
228
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for AddMarkStep.fromJSON");
229
+ return new e(n.from, n.to, t.markFromJSON(n.mark));
230
+ }
231
+ };
232
+ v.jsonID("addMark", x);
233
+ var S = class e extends v {
234
+ constructor(e, t, n) {
235
+ super(), this.from = e, this.to = t, this.mark = n;
236
+ }
237
+ apply(e) {
238
+ let t = e.slice(this.from, this.to), n = new i(b(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
239
+ return y.fromReplace(e, this.from, this.to, n);
240
+ }
241
+ invert() {
242
+ return new x(this.from, this.to, this.mark);
243
+ }
244
+ map(t) {
245
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
246
+ return n.deleted && r.deleted || n.pos >= r.pos ? null : new e(n.pos, r.pos, this.mark);
247
+ }
248
+ merge(t) {
249
+ return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
250
+ }
251
+ toJSON() {
252
+ return {
253
+ stepType: "removeMark",
254
+ mark: this.mark.toJSON(),
255
+ from: this.from,
256
+ to: this.to
257
+ };
258
+ }
259
+ static fromJSON(t, n) {
260
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for RemoveMarkStep.fromJSON");
261
+ return new e(n.from, n.to, t.markFromJSON(n.mark));
262
+ }
263
+ };
264
+ v.jsonID("removeMark", S);
265
+ var C = class t extends v {
266
+ constructor(e, t) {
267
+ super(), this.pos = e, this.mark = t;
268
+ }
269
+ apply(t) {
270
+ let n = t.nodeAt(this.pos);
271
+ if (!n) return y.fail("No node at mark step's position");
272
+ let r = n.type.create(n.attrs, null, this.mark.addToSet(n.marks));
273
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
274
+ }
275
+ invert(e) {
276
+ let n = e.nodeAt(this.pos);
277
+ if (n) {
278
+ let e = this.mark.addToSet(n.marks);
279
+ if (e.length == n.marks.length) {
280
+ for (let r = 0; r < n.marks.length; r++) if (!n.marks[r].isInSet(e)) return new t(this.pos, n.marks[r]);
281
+ return new t(this.pos, this.mark);
282
+ }
283
+ }
284
+ return new w(this.pos, this.mark);
285
+ }
286
+ map(e) {
287
+ let n = e.mapResult(this.pos, 1);
288
+ return n.deletedAfter ? null : new t(n.pos, this.mark);
289
+ }
290
+ toJSON() {
291
+ return {
292
+ stepType: "addNodeMark",
293
+ pos: this.pos,
294
+ mark: this.mark.toJSON()
295
+ };
296
+ }
297
+ static fromJSON(e, n) {
298
+ if (typeof n.pos != "number") throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");
299
+ return new t(n.pos, e.markFromJSON(n.mark));
300
+ }
301
+ };
302
+ v.jsonID("addNodeMark", C);
303
+ var w = class t extends v {
304
+ constructor(e, t) {
305
+ super(), this.pos = e, this.mark = t;
306
+ }
307
+ apply(t) {
308
+ let n = t.nodeAt(this.pos);
309
+ if (!n) return y.fail("No node at mark step's position");
310
+ let r = n.type.create(n.attrs, null, this.mark.removeFromSet(n.marks));
311
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
312
+ }
313
+ invert(e) {
314
+ let t = e.nodeAt(this.pos);
315
+ return !t || !this.mark.isInSet(t.marks) ? this : new C(this.pos, this.mark);
316
+ }
317
+ map(e) {
318
+ let n = e.mapResult(this.pos, 1);
319
+ return n.deletedAfter ? null : new t(n.pos, this.mark);
320
+ }
321
+ toJSON() {
322
+ return {
323
+ stepType: "removeNodeMark",
324
+ pos: this.pos,
325
+ mark: this.mark.toJSON()
326
+ };
327
+ }
328
+ static fromJSON(e, n) {
329
+ if (typeof n.pos != "number") throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
330
+ return new t(n.pos, e.markFromJSON(n.mark));
331
+ }
332
+ };
333
+ v.jsonID("removeNodeMark", w);
334
+ var T = class e extends v {
335
+ constructor(e, t, n, r = !1) {
336
+ super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
337
+ }
338
+ apply(e) {
339
+ return this.structure && D(e, this.from, this.to) ? y.fail("Structure replace would overwrite content") : y.fromReplace(e, this.from, this.to, this.slice);
340
+ }
341
+ getMap() {
342
+ return new h([
343
+ this.from,
344
+ this.to - this.from,
345
+ this.slice.size
346
+ ]);
347
+ }
348
+ invert(t) {
349
+ return new e(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
350
+ }
351
+ map(t) {
352
+ let n = t.mapResult(this.to, -1), r = this.from == this.to && e.MAP_BIAS < 0 ? n : t.mapResult(this.from, 1);
353
+ return r.deletedAcross && n.deletedAcross ? null : new e(r.pos, Math.max(r.pos, n.pos), this.slice, this.structure);
354
+ }
355
+ merge(t) {
356
+ if (!(t instanceof e) || t.structure || this.structure) return null;
357
+ if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
358
+ let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
359
+ return new e(this.from, this.to + (t.to - t.from), n, this.structure);
360
+ }
361
+ if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
362
+ let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
363
+ return new e(t.from, this.to, n, this.structure);
364
+ }
365
+ return null;
366
+ }
367
+ toJSON() {
368
+ let e = {
369
+ stepType: "replace",
370
+ from: this.from,
371
+ to: this.to
372
+ };
373
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
374
+ }
375
+ static fromJSON(t, n) {
376
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
377
+ return new e(n.from, n.to, i.fromJSON(t, n.slice), !!n.structure);
378
+ }
379
+ };
380
+ T.MAP_BIAS = 1, v.jsonID("replace", T);
381
+ var E = class e extends v {
382
+ constructor(e, t, n, r, i, a, o = !1) {
383
+ super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
384
+ }
385
+ apply(e) {
386
+ if (this.structure && (D(e, this.from, this.gapFrom) || D(e, this.gapTo, this.to))) return y.fail("Structure gap-replace would overwrite content");
387
+ let t = e.slice(this.gapFrom, this.gapTo);
388
+ if (t.openStart || t.openEnd) return y.fail("Gap is not a flat range");
389
+ let n = this.slice.insertAt(this.insert, t.content);
390
+ return n ? y.fromReplace(e, this.from, this.to, n) : y.fail("Content does not fit in gap");
391
+ }
392
+ getMap() {
393
+ return new h([
394
+ this.from,
395
+ this.gapFrom - this.from,
396
+ this.insert,
397
+ this.gapTo,
398
+ this.to - this.gapTo,
399
+ this.slice.size - this.insert
400
+ ]);
401
+ }
402
+ invert(t) {
403
+ let n = this.gapTo - this.gapFrom;
404
+ return new e(this.from, this.from + this.slice.size + n, this.from + this.insert, this.from + this.insert + n, t.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
405
+ }
406
+ map(t) {
407
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1), i = this.from == this.gapFrom ? n.pos : t.map(this.gapFrom, -1), a = this.to == this.gapTo ? r.pos : t.map(this.gapTo, 1);
408
+ return n.deletedAcross && r.deletedAcross || i < n.pos || a > r.pos ? null : new e(n.pos, r.pos, i, a, this.slice, this.insert, this.structure);
409
+ }
410
+ toJSON() {
411
+ let e = {
412
+ stepType: "replaceAround",
413
+ from: this.from,
414
+ to: this.to,
415
+ gapFrom: this.gapFrom,
416
+ gapTo: this.gapTo,
417
+ insert: this.insert
418
+ };
419
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
420
+ }
421
+ static fromJSON(t, n) {
422
+ if (typeof n.from != "number" || typeof n.to != "number" || typeof n.gapFrom != "number" || typeof n.gapTo != "number" || typeof n.insert != "number") throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");
423
+ return new e(n.from, n.to, n.gapFrom, n.gapTo, i.fromJSON(t, n.slice), n.insert, !!n.structure);
424
+ }
425
+ };
426
+ v.jsonID("replaceAround", E);
427
+ function D(e, t, n) {
428
+ let r = e.resolve(t), i = n - t, a = r.depth;
429
+ for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
430
+ if (i > 0) {
431
+ let e = r.node(a).maybeChild(r.indexAfter(a));
432
+ for (; i > 0;) {
433
+ if (!e || e.isLeaf) return !0;
434
+ e = e.firstChild, i--;
435
+ }
436
+ }
437
+ return !1;
682
438
  }
683
- function ce(s, e, t) {
684
- return (e == 0 || s.canReplace(e, s.childCount)) && (t == s.childCount || s.canReplace(0, t));
439
+ function ee(e, t, n, r) {
440
+ let i = [], a = [], o, s;
441
+ e.doc.nodesBetween(t, n, (e, c, l) => {
442
+ if (!e.isInline) return;
443
+ let u = e.marks;
444
+ if (!r.isInSet(u) && l.type.allowsMarkType(r.type)) {
445
+ let l = Math.max(c, t), d = Math.min(c + e.nodeSize, n), f = r.addToSet(u);
446
+ for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new S(l, d, u[e])));
447
+ s && s.to == l ? s.to = d : a.push(s = new x(l, d, r));
448
+ }
449
+ }), i.forEach((t) => e.step(t)), a.forEach((t) => e.step(t));
685
450
  }
686
- function Fe(s) {
687
- let t = s.parent.content.cutByIndex(s.startIndex, s.endIndex);
688
- for (let r = s.depth, n = 0, i = 0; ; --r) {
689
- let o = s.$from.node(r), l = s.$from.index(r) + n, a = s.$to.indexAfter(r) - i;
690
- if (r < s.depth && o.canReplace(l, a, t))
691
- return r;
692
- if (r == 0 || o.type.spec.isolating || !ce(o, l, a))
693
- break;
694
- l && (n = 1), a < o.childCount && (i = 1);
695
- }
696
- return null;
451
+ function te(e, t, r, i) {
452
+ let a = [], o = 0;
453
+ e.doc.nodesBetween(t, r, (e, s) => {
454
+ if (!e.isInline) return;
455
+ o++;
456
+ let c = null;
457
+ if (i instanceof n) {
458
+ let t = e.marks, n;
459
+ for (; n = i.isInSet(t);) (c ||= []).push(n), t = n.removeFromSet(t);
460
+ } else i ? i.isInSet(e.marks) && (c = [i]) : c = e.marks;
461
+ if (c && c.length) {
462
+ let n = Math.min(s + e.nodeSize, r);
463
+ for (let e = 0; e < c.length; e++) {
464
+ let r = c[e], i;
465
+ for (let e = 0; e < a.length; e++) {
466
+ let t = a[e];
467
+ t.step == o - 1 && r.eq(a[e].style) && (i = t);
468
+ }
469
+ i ? (i.to = n, i.step = o) : a.push({
470
+ style: r,
471
+ from: Math.max(s, t),
472
+ to: n,
473
+ step: o
474
+ });
475
+ }
476
+ }
477
+ }), a.forEach((t) => e.step(new S(t.from, t.to, t.style)));
697
478
  }
698
- function de(s, e, t) {
699
- let { $from: r, $to: n, depth: i } = e, o = r.before(i + 1), l = n.after(i + 1), a = o, h = l, p = w.empty, c = 0;
700
- for (let u = i, m = !1; u > t; u--)
701
- m || r.index(u) > 0 ? (m = !0, p = w.from(r.node(u).copy(p)), c++) : a--;
702
- let f = w.empty, d = 0;
703
- for (let u = i, m = !1; u > t; u--)
704
- m || n.after(u + 1) < n.end(u) ? (m = !0, f = w.from(n.node(u).copy(f)), d++) : h++;
705
- s.step(new M(a, h, o, l, new g(p.append(f), c, d), p.size - c, !0));
479
+ function O(t, n, r, a = r.contentMatch, o = !0) {
480
+ let s = t.doc.nodeAt(n), c = [], l = n + 1;
481
+ for (let n = 0; n < s.childCount; n++) {
482
+ let u = s.child(n), d = l + u.nodeSize, f = a.matchType(u.type);
483
+ if (!f) c.push(new T(l, d, i.empty));
484
+ else {
485
+ a = f;
486
+ for (let e = 0; e < u.marks.length; e++) r.allowsMarkType(u.marks[e].type) || t.step(new S(l, d, u.marks[e]));
487
+ if (o && u.isText && r.whitespace != "pre") {
488
+ let t, n = /\r?\n|\r/g, a;
489
+ for (; t = n.exec(u.text);) a ||= new i(e.from(r.schema.text(" ", r.allowedMarks(u.marks))), 0, 0), c.push(new T(l + t.index, l + t.index + t[0].length, a));
490
+ }
491
+ }
492
+ l = d;
493
+ }
494
+ if (!a.validEnd) {
495
+ let n = a.fillBefore(e.empty, !0);
496
+ t.replace(l, l, new i(n, 0, 0));
497
+ }
498
+ for (let e = c.length - 1; e >= 0; e--) t.step(c[e]);
706
499
  }
707
- function ze(s, e, t = null, r = s) {
708
- let n = ue(s, e), i = n && me(r, e);
709
- return i ? n.map(K).concat({ type: e, attrs: t }).concat(i.map(K)) : null;
500
+ function ne(e, t, n) {
501
+ return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
710
502
  }
711
- function K(s) {
712
- return { type: s, attrs: null };
503
+ function re(e) {
504
+ let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
505
+ for (let n = e.depth, r = 0, i = 0;; --n) {
506
+ let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
507
+ if (n < e.depth && a.canReplace(o, s, t)) return n;
508
+ if (n == 0 || a.type.spec.isolating || !ne(a, o, s)) break;
509
+ o && (r = 1), s < a.childCount && (i = 1);
510
+ }
511
+ return null;
713
512
  }
714
- function ue(s, e) {
715
- let { parent: t, startIndex: r, endIndex: n } = s, i = t.contentMatchAt(r).findWrapping(e);
716
- if (!i)
717
- return null;
718
- let o = i.length ? i[0] : e;
719
- return t.canReplaceWith(r, n, o) ? i : null;
513
+ function ie(t, n, r) {
514
+ let { $from: a, $to: o, depth: s } = n, c = a.before(s + 1), l = o.after(s + 1), u = c, d = l, f = e.empty, p = 0;
515
+ for (let t = s, n = !1; t > r; t--) n || a.index(t) > 0 ? (n = !0, f = e.from(a.node(t).copy(f)), p++) : u--;
516
+ let m = e.empty, h = 0;
517
+ for (let t = s, n = !1; t > r; t--) n || o.after(t + 1) < o.end(t) ? (n = !0, m = e.from(o.node(t).copy(m)), h++) : d++;
518
+ t.step(new E(u, d, c, l, new i(f.append(m), p, h), f.size - p, !0));
720
519
  }
721
- function me(s, e) {
722
- let { parent: t, startIndex: r, endIndex: n } = s, i = t.child(r), o = e.contentMatch.findWrapping(i.type);
723
- if (!o)
724
- return null;
725
- let a = (o.length ? o[o.length - 1] : e).contentMatch;
726
- for (let h = r; a && h < n; h++)
727
- a = a.matchType(t.child(h).type);
728
- return !a || !a.validEnd ? null : o;
520
+ function ae(e, t, n = null, r = e) {
521
+ let i = oe(e, t), a = i && se(r, t);
522
+ return a ? i.map(k).concat({
523
+ type: t,
524
+ attrs: n
525
+ }).concat(a.map(k)) : null;
729
526
  }
730
- function ge(s, e, t) {
731
- let r = w.empty;
732
- for (let o = t.length - 1; o >= 0; o--) {
733
- if (r.size) {
734
- let l = t[o].type.contentMatch.matchFragment(r);
735
- if (!l || !l.validEnd)
736
- throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
737
- }
738
- r = w.from(t[o].type.create(t[o].attrs, r));
739
- }
740
- let n = e.start, i = e.end;
741
- s.step(new M(n, i, n, i, new g(r, 0, 0), t.length, !0));
527
+ function k(e) {
528
+ return {
529
+ type: e,
530
+ attrs: null
531
+ };
742
532
  }
743
- function we(s, e, t, r, n) {
744
- if (!r.isTextblock)
745
- throw new RangeError("Type given to setBlockType should be a textblock");
746
- let i = s.steps.length;
747
- s.doc.nodesBetween(e, t, (o, l) => {
748
- let a = typeof n == "function" ? n(o) : n;
749
- if (o.isTextblock && !o.hasMarkup(r, a) && ye(s.doc, s.mapping.slice(i).map(l), r)) {
750
- let h = null;
751
- if (r.schema.linebreakReplacement) {
752
- let d = r.whitespace == "pre", u = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
753
- d && !u ? h = !1 : !d && u && (h = !0);
754
- }
755
- h === !1 && _(s, o, l, i), $(s, s.mapping.slice(i).map(l, 1), r, void 0, h === null);
756
- let p = s.mapping.slice(i), c = p.map(l, 1), f = p.map(l + o.nodeSize, 1);
757
- return s.step(new M(c, f, c + 1, f - 1, new g(w.from(r.create(a, null, o.marks)), 0, 0), 1, !0)), h === !0 && Z(s, o, l, i), !1;
758
- }
759
- });
533
+ function oe(e, t) {
534
+ let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
535
+ if (!a) return null;
536
+ let o = a.length ? a[0] : t;
537
+ return n.canReplaceWith(r, i, o) ? a : null;
760
538
  }
761
- function Z(s, e, t, r) {
762
- e.forEach((n, i) => {
763
- if (n.isText) {
764
- let o, l = /\r?\n|\r/g;
765
- for (; o = l.exec(n.text); ) {
766
- let a = s.mapping.slice(r).map(t + 1 + i + o.index);
767
- s.replaceWith(a, a + 1, e.type.schema.linebreakReplacement.create());
768
- }
769
- }
770
- });
539
+ function se(e, t) {
540
+ let { parent: n, startIndex: r, endIndex: i } = e, a = n.child(r), o = t.contentMatch.findWrapping(a.type);
541
+ if (!o) return null;
542
+ let s = (o.length ? o[o.length - 1] : t).contentMatch;
543
+ for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
544
+ return !s || !s.validEnd ? null : o;
771
545
  }
772
- function _(s, e, t, r) {
773
- e.forEach((n, i) => {
774
- if (n.type == n.type.schema.linebreakReplacement) {
775
- let o = s.mapping.slice(r).map(t + 1 + i);
776
- s.replaceWith(o, o + 1, e.type.schema.text(`
777
- `));
778
- }
779
- });
546
+ function A(t, n, r) {
547
+ let a = e.empty;
548
+ for (let t = r.length - 1; t >= 0; t--) {
549
+ if (a.size) {
550
+ let e = r[t].type.contentMatch.matchFragment(a);
551
+ if (!e || !e.validEnd) throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
552
+ }
553
+ a = e.from(r[t].type.create(r[t].attrs, a));
554
+ }
555
+ let o = n.start, s = n.end;
556
+ t.step(new E(o, s, o, s, new i(a, 0, 0), r.length, !0));
780
557
  }
781
- function ye(s, e, t) {
782
- let r = s.resolve(e), n = r.index();
783
- return r.parent.canReplaceWith(n, n + 1, t);
558
+ function j(t, n, r, a, o) {
559
+ if (!a.isTextblock) throw RangeError("Type given to setBlockType should be a textblock");
560
+ let s = t.steps.length;
561
+ t.doc.nodesBetween(n, r, (n, r) => {
562
+ let c = typeof o == "function" ? o(n) : o;
563
+ if (n.isTextblock && !n.hasMarkup(a, c) && P(t.doc, t.mapping.slice(s).map(r), a)) {
564
+ let o = null;
565
+ if (a.schema.linebreakReplacement) {
566
+ let e = a.whitespace == "pre", t = !!a.contentMatch.matchType(a.schema.linebreakReplacement);
567
+ e && !t ? o = !1 : !e && t && (o = !0);
568
+ }
569
+ o === !1 && N(t, n, r, s), O(t, t.mapping.slice(s).map(r, 1), a, void 0, o === null);
570
+ let l = t.mapping.slice(s), u = l.map(r, 1), d = l.map(r + n.nodeSize, 1);
571
+ return t.step(new E(u, d, u + 1, d - 1, new i(e.from(a.create(c, null, n.marks)), 0, 0), 1, !0)), o === !0 && M(t, n, r, s), !1;
572
+ }
573
+ });
784
574
  }
785
- function ke(s, e, t, r, n) {
786
- let i = s.doc.nodeAt(e);
787
- if (!i)
788
- throw new RangeError("No node at given position");
789
- t || (t = i.type);
790
- let o = t.create(r, null, n || i.marks);
791
- if (i.isLeaf)
792
- return s.replaceWith(e, e + i.nodeSize, o);
793
- if (!t.validContent(i.content))
794
- throw new RangeError("Invalid content for node type " + t.name);
795
- s.step(new M(e, e + i.nodeSize, e + 1, e + i.nodeSize - 1, new g(w.from(o), 0, 0), 1, !0));
575
+ function M(e, t, n, r) {
576
+ t.forEach((i, a) => {
577
+ if (i.isText) {
578
+ let o, s = /\r?\n|\r/g;
579
+ for (; o = s.exec(i.text);) {
580
+ let i = e.mapping.slice(r).map(n + 1 + a + o.index);
581
+ e.replaceWith(i, i + 1, t.type.schema.linebreakReplacement.create());
582
+ }
583
+ }
584
+ });
796
585
  }
797
- function Ae(s, e, t = 1, r) {
798
- let n = s.resolve(e), i = n.depth - t, o = r && r[r.length - 1] || n.parent;
799
- 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)))
800
- return !1;
801
- for (let h = n.depth - 1, p = t - 2; h > i; h--, p--) {
802
- let c = n.node(h), f = n.index(h);
803
- if (c.type.spec.isolating)
804
- return !1;
805
- let d = c.content.cutByIndex(f, c.childCount), u = r && r[p + 1];
806
- u && (d = d.replaceChild(0, u.type.create(u.attrs)));
807
- let m = r && r[p] || c;
808
- if (!c.canReplace(f + 1, c.childCount) || !m.type.validContent(d))
809
- return !1;
810
- }
811
- let l = n.indexAfter(i), a = r && r[0];
812
- return n.node(i).canReplaceWith(l, l, a ? a.type : n.node(i + 1).type);
586
+ function N(e, t, n, r) {
587
+ t.forEach((i, a) => {
588
+ if (i.type == i.type.schema.linebreakReplacement) {
589
+ let i = e.mapping.slice(r).map(n + 1 + a);
590
+ e.replaceWith(i, i + 1, t.type.schema.text("\n"));
591
+ }
592
+ });
813
593
  }
814
- function ve(s, e, t = 1, r) {
815
- let n = s.doc.resolve(e), i = w.empty, o = w.empty;
816
- for (let l = n.depth, a = n.depth - t, h = t - 1; l > a; l--, h--) {
817
- i = w.from(n.node(l).copy(i));
818
- let p = r && r[h];
819
- o = w.from(p ? p.type.create(p.attrs, o) : n.node(l).copy(o));
820
- }
821
- s.step(new k(e, e, new g(i.append(o), t, t), !0));
594
+ function P(e, t, n) {
595
+ let r = e.resolve(t), i = r.index();
596
+ return r.parent.canReplaceWith(i, i + 1, n);
822
597
  }
823
- function Je(s, e) {
824
- let t = s.resolve(e), r = t.index();
825
- return j(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(r, r + 1);
598
+ function F(t, n, r, a, o) {
599
+ let s = t.doc.nodeAt(n);
600
+ if (!s) throw RangeError("No node at given position");
601
+ r ||= s.type;
602
+ let c = r.create(a, null, o || s.marks);
603
+ if (s.isLeaf) return t.replaceWith(n, n + s.nodeSize, c);
604
+ if (!r.validContent(s.content)) throw RangeError("Invalid content for node type " + r.name);
605
+ t.step(new E(n, n + s.nodeSize, n + 1, n + s.nodeSize - 1, new i(e.from(c), 0, 0), 1, !0));
826
606
  }
827
- function xe(s, e) {
828
- e.content.size || s.type.compatibleContent(e.type);
829
- let t = s.contentMatchAt(s.childCount), { linebreakReplacement: r } = s.type.schema;
830
- for (let n = 0; n < e.childCount; n++) {
831
- let i = e.child(n), o = i.type == r ? s.type.schema.nodes.text : i.type;
832
- if (t = t.matchType(o), !t || !s.type.allowsMarks(i.marks))
833
- return !1;
834
- }
835
- return t.validEnd;
607
+ function ce(e, t, n = 1, r) {
608
+ let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
609
+ if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount))) return !1;
610
+ for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
611
+ let n = i.node(e), a = i.index(e);
612
+ if (n.type.spec.isolating) return !1;
613
+ let o = n.content.cutByIndex(a, n.childCount), s = r && r[t + 1];
614
+ s && (o = o.replaceChild(0, s.type.create(s.attrs)));
615
+ let c = r && r[t] || n;
616
+ if (!n.canReplace(a + 1, n.childCount) || !c.type.validContent(o)) return !1;
617
+ }
618
+ let s = i.indexAfter(a), c = r && r[0];
619
+ return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
836
620
  }
837
- function j(s, e) {
838
- return !!(s && e && !s.isLeaf && xe(s, e));
621
+ function le(t, n, r = 1, a) {
622
+ let o = t.doc.resolve(n), s = e.empty, c = e.empty;
623
+ for (let t = o.depth, n = o.depth - r, i = r - 1; t > n; t--, i--) {
624
+ s = e.from(o.node(t).copy(s));
625
+ let n = a && a[i];
626
+ c = e.from(n ? n.type.create(n.attrs, c) : o.node(t).copy(c));
627
+ }
628
+ t.step(new T(n, n, new i(s.append(c), r, r), !0));
839
629
  }
840
- function Be(s, e, t = -1) {
841
- let r = s.resolve(e);
842
- for (let n = r.depth; ; n--) {
843
- let i, o, l = r.index(n);
844
- 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))
845
- return e;
846
- if (n == 0)
847
- break;
848
- e = t < 0 ? r.before(n) : r.after(n);
849
- }
630
+ function ue(e, t) {
631
+ let n = e.resolve(t), r = n.index();
632
+ return I(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
850
633
  }
851
- function Se(s, e, t) {
852
- let r = null, { linebreakReplacement: n } = s.doc.type.schema, i = s.doc.resolve(e - t), o = i.node().type;
853
- if (n && o.inlineContent) {
854
- let p = o.whitespace == "pre", c = !!o.contentMatch.matchType(n);
855
- p && !c ? r = !1 : !p && c && (r = !0);
856
- }
857
- let l = s.steps.length;
858
- if (r === !1) {
859
- let p = s.doc.resolve(e + t);
860
- _(s, p.node(), p.before(), l);
861
- }
862
- o.inlineContent && $(s, e + t - 1, o, i.node().contentMatchAt(i.index()), r == null);
863
- let a = s.mapping.slice(l), h = a.map(e - t);
864
- if (s.step(new k(h, a.map(e + t, -1), g.empty, !0)), r === !0) {
865
- let p = s.doc.resolve(h);
866
- Z(s, p.node(), p.before(), s.steps.length);
867
- }
868
- return s;
634
+ function de(e, t) {
635
+ t.content.size || e.type.compatibleContent(t.type);
636
+ let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
637
+ for (let i = 0; i < t.childCount; i++) {
638
+ let a = t.child(i), o = a.type == r ? e.type.schema.nodes.text : a.type;
639
+ if (n = n.matchType(o), !n || !e.type.allowsMarks(a.marks)) return !1;
640
+ }
641
+ return n.validEnd;
869
642
  }
870
- function be(s, e, t) {
871
- let r = s.resolve(e);
872
- if (r.parent.canReplaceWith(r.index(), r.index(), t))
873
- return e;
874
- if (r.parentOffset == 0)
875
- for (let n = r.depth - 1; n >= 0; n--) {
876
- let i = r.index(n);
877
- if (r.node(n).canReplaceWith(i, i, t))
878
- return r.before(n + 1);
879
- if (i > 0)
880
- return null;
881
- }
882
- if (r.parentOffset == r.parent.content.size)
883
- for (let n = r.depth - 1; n >= 0; n--) {
884
- let i = r.indexAfter(n);
885
- if (r.node(n).canReplaceWith(i, i, t))
886
- return r.after(n + 1);
887
- if (i < r.node(n).childCount)
888
- return null;
889
- }
890
- return null;
643
+ function I(e, t) {
644
+ return !!(e && t && !e.isLeaf && de(e, t));
891
645
  }
892
- function De(s, e, t) {
893
- let r = s.resolve(e);
894
- if (!t.content.size)
895
- return e;
896
- let n = t.content;
897
- for (let i = 0; i < t.openStart; i++)
898
- n = n.firstChild.content;
899
- for (let i = 1; i <= (t.openStart == 0 && t.size ? 2 : 1); i++)
900
- for (let o = r.depth; o >= 0; o--) {
901
- 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;
902
- if (i == 1)
903
- p = h.canReplace(a, a, n);
904
- else {
905
- let c = h.contentMatchAt(a).findWrapping(n.firstChild.type);
906
- p = c && h.canReplaceWith(a, a, c[0]);
907
- }
908
- if (p)
909
- return l == 0 ? r.pos : l < 0 ? r.before(o + 1) : r.after(o + 1);
910
- }
911
- return null;
646
+ function L(e, t, n = -1) {
647
+ let r = e.resolve(t);
648
+ for (let e = r.depth;; e--) {
649
+ let i, a, o = r.index(e);
650
+ if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && I(i, a) && r.node(e).canReplace(o, o + 1)) return t;
651
+ if (e == 0) break;
652
+ t = n < 0 ? r.before(e) : r.after(e);
653
+ }
912
654
  }
913
- function Me(s, e, t = e, r = g.empty) {
914
- if (e == t && !r.size)
915
- return null;
916
- let n = s.resolve(e), i = s.resolve(t);
917
- return ee(n, i, r) ? new k(e, t, r) : new Ce(n, i, r).fit();
655
+ function R(e, t, n) {
656
+ let r = null, { linebreakReplacement: a } = e.doc.type.schema, o = e.doc.resolve(t - n), s = o.node().type;
657
+ if (a && s.inlineContent) {
658
+ let e = s.whitespace == "pre", t = !!s.contentMatch.matchType(a);
659
+ e && !t ? r = !1 : !e && t && (r = !0);
660
+ }
661
+ let c = e.steps.length;
662
+ if (r === !1) {
663
+ let r = e.doc.resolve(t + n);
664
+ N(e, r.node(), r.before(), c);
665
+ }
666
+ s.inlineContent && O(e, t + n - 1, s, o.node().contentMatchAt(o.index()), r == null);
667
+ let l = e.mapping.slice(c), u = l.map(t - n);
668
+ if (e.step(new T(u, l.map(t + n, -1), i.empty, !0)), r === !0) {
669
+ let t = e.doc.resolve(u);
670
+ M(e, t.node(), t.before(), e.steps.length);
671
+ }
672
+ return e;
918
673
  }
919
- function ee(s, e, t) {
920
- return !t.openStart && !t.openEnd && s.start() == e.start() && s.parent.canReplace(s.index(), e.index(), t.content);
674
+ function z(e, t, n) {
675
+ let r = e.resolve(t);
676
+ if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
677
+ if (r.parentOffset == 0) for (let e = r.depth - 1; e >= 0; e--) {
678
+ let t = r.index(e);
679
+ if (r.node(e).canReplaceWith(t, t, n)) return r.before(e + 1);
680
+ if (t > 0) return null;
681
+ }
682
+ if (r.parentOffset == r.parent.content.size) for (let e = r.depth - 1; e >= 0; e--) {
683
+ let t = r.indexAfter(e);
684
+ if (r.node(e).canReplaceWith(t, t, n)) return r.after(e + 1);
685
+ if (t < r.node(e).childCount) return null;
686
+ }
687
+ return null;
921
688
  }
922
- class Ce {
923
- constructor(e, t, r) {
924
- this.$from = e, this.$to = t, this.unplaced = r, this.frontier = [], this.placed = w.empty;
925
- for (let n = 0; n <= e.depth; n++) {
926
- let i = e.node(n);
927
- this.frontier.push({
928
- type: i.type,
929
- match: i.contentMatchAt(e.indexAfter(n))
930
- });
931
- }
932
- for (let n = e.depth; n > 0; n--)
933
- this.placed = w.from(e.node(n).copy(this.placed));
934
- }
935
- get depth() {
936
- return this.frontier.length - 1;
937
- }
938
- fit() {
939
- for (; this.unplaced.size; ) {
940
- let h = this.findFittable();
941
- h ? this.placeNodes(h) : this.openMore() || this.dropNode();
942
- }
943
- 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));
944
- if (!n)
945
- return null;
946
- let i = this.placed, o = r.depth, l = n.depth;
947
- for (; o && l && i.childCount == 1; )
948
- i = i.firstChild.content, o--, l--;
949
- let a = new g(i, o, l);
950
- return e > -1 ? new M(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new k(r.pos, n.pos, a) : null;
951
- }
952
- // Find a position on the start spine of `this.unplaced` that has
953
- // content that can be moved somewhere on the frontier. Returns two
954
- // depths, one for the slice and one for the frontier.
955
- findFittable() {
956
- let e = this.unplaced.openStart;
957
- for (let t = this.unplaced.content, r = 0, n = this.unplaced.openEnd; r < e; r++) {
958
- let i = t.firstChild;
959
- if (t.childCount > 1 && (n = 0), i.type.spec.isolating && n <= r) {
960
- e = r;
961
- break;
962
- }
963
- t = i.content;
964
- }
965
- for (let t = 1; t <= 2; t++)
966
- for (let r = t == 1 ? e : this.unplaced.openStart; r >= 0; r--) {
967
- let n, i = null;
968
- r ? (i = D(this.unplaced.content, r - 1).firstChild, n = i.content) : n = this.unplaced.content;
969
- let o = n.firstChild;
970
- for (let l = this.depth; l >= 0; l--) {
971
- let { type: a, match: h } = this.frontier[l], p, c = null;
972
- if (t == 1 && (o ? h.matchType(o.type) || (c = h.fillBefore(w.from(o), !1)) : i && a.compatibleContent(i.type)))
973
- return { sliceDepth: r, frontierDepth: l, parent: i, inject: c };
974
- if (t == 2 && o && (p = h.findWrapping(o.type)))
975
- return { sliceDepth: r, frontierDepth: l, parent: i, wrap: p };
976
- if (i && h.matchType(i.type))
977
- break;
978
- }
979
- }
980
- }
981
- openMore() {
982
- let { content: e, openStart: t, openEnd: r } = this.unplaced, n = D(e, t);
983
- return !n.childCount || n.firstChild.isLeaf ? !1 : (this.unplaced = new g(e, t + 1, Math.max(r, n.size + t >= e.size - r ? t + 1 : 0)), !0);
984
- }
985
- dropNode() {
986
- let { content: e, openStart: t, openEnd: r } = this.unplaced, n = D(e, t);
987
- if (n.childCount <= 1 && t > 0) {
988
- let i = e.size - t <= t + n.size;
989
- this.unplaced = new g(O(e, t - 1, 1), t - 1, i ? t - 1 : r);
990
- } else
991
- this.unplaced = new g(O(e, t, 1), t, r);
992
- }
993
- // Move content from the unplaced slice at `sliceDepth` to the
994
- // frontier node at `frontierDepth`. Close that frontier node when
995
- // applicable.
996
- placeNodes({ sliceDepth: e, frontierDepth: t, parent: r, inject: n, wrap: i }) {
997
- for (; this.depth > t; )
998
- this.closeFrontierNode();
999
- if (i)
1000
- for (let m = 0; m < i.length; m++)
1001
- this.openFrontierNode(i[m]);
1002
- let o = this.unplaced, l = r ? r.content : o.content, a = o.openStart - e, h = 0, p = [], { match: c, type: f } = this.frontier[t];
1003
- if (n) {
1004
- for (let m = 0; m < n.childCount; m++)
1005
- p.push(n.child(m));
1006
- c = c.matchFragment(n);
1007
- }
1008
- let d = l.size + e - (o.content.size - o.openEnd);
1009
- for (; h < l.childCount; ) {
1010
- let m = l.child(h), x = c.matchType(m.type);
1011
- if (!x)
1012
- break;
1013
- 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)));
1014
- }
1015
- let u = h == l.childCount;
1016
- u || (d = -1), this.placed = F(this.placed, t, w.from(p)), this.frontier[t].match = c, u && d < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
1017
- for (let m = 0, x = l; m < d; m++) {
1018
- let N = x.lastChild;
1019
- this.frontier.push({ type: N.type, match: N.contentMatchAt(N.childCount) }), x = N.content;
1020
- }
1021
- this.unplaced = u ? e == 0 ? g.empty : new g(O(o.content, e - 1, 1), e - 1, d < 0 ? o.openEnd : e - 1) : new g(O(o.content, e, h), o.openStart, o.openEnd);
1022
- }
1023
- mustMoveInline() {
1024
- if (!this.$to.parent.isTextblock)
1025
- return -1;
1026
- let e = this.frontier[this.depth], t;
1027
- if (!e.type.isTextblock || !W(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth)
1028
- return -1;
1029
- let { depth: r } = this.$to, n = this.$to.after(r);
1030
- for (; r > 1 && n == this.$to.end(--r); )
1031
- ++n;
1032
- return n;
1033
- }
1034
- findCloseLevel(e) {
1035
- e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
1036
- let { match: r, type: n } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), o = W(e, t, n, r, i);
1037
- if (o) {
1038
- for (let l = t - 1; l >= 0; l--) {
1039
- let { match: a, type: h } = this.frontier[l], p = W(e, l, h, a, !0);
1040
- if (!p || p.childCount)
1041
- continue e;
1042
- }
1043
- return { depth: t, fit: o, move: i ? e.doc.resolve(e.after(t + 1)) : e };
1044
- }
1045
- }
1046
- }
1047
- close(e) {
1048
- let t = this.findCloseLevel(e);
1049
- if (!t)
1050
- return null;
1051
- for (; this.depth > t.depth; )
1052
- this.closeFrontierNode();
1053
- t.fit.childCount && (this.placed = F(this.placed, t.depth, t.fit)), e = t.move;
1054
- for (let r = t.depth + 1; r <= e.depth; r++) {
1055
- let n = e.node(r), i = n.type.contentMatch.fillBefore(n.content, !0, e.index(r));
1056
- this.openFrontierNode(n.type, n.attrs, i);
1057
- }
1058
- return e;
1059
- }
1060
- openFrontierNode(e, t = null, r) {
1061
- let n = this.frontier[this.depth];
1062
- n.match = n.match.matchType(e), this.placed = F(this.placed, this.depth, w.from(e.create(t, r))), this.frontier.push({ type: e, match: e.contentMatch });
1063
- }
1064
- closeFrontierNode() {
1065
- let t = this.frontier.pop().match.fillBefore(w.empty, !0);
1066
- t.childCount && (this.placed = F(this.placed, this.frontier.length, t));
1067
- }
689
+ function B(e, t, n) {
690
+ let r = e.resolve(t);
691
+ if (!n.content.size) return t;
692
+ let i = n.content;
693
+ for (let e = 0; e < n.openStart; e++) i = i.firstChild.content;
694
+ for (let e = 1; e <= (n.openStart == 0 && n.size ? 2 : 1); e++) for (let t = r.depth; t >= 0; t--) {
695
+ let n = t == r.depth ? 0 : r.pos <= (r.start(t + 1) + r.end(t + 1)) / 2 ? -1 : 1, a = r.index(t) + +(n > 0), o = r.node(t), s = !1;
696
+ if (e == 1) s = o.canReplace(a, a, i);
697
+ else {
698
+ let e = o.contentMatchAt(a).findWrapping(i.firstChild.type);
699
+ s = e && o.canReplaceWith(a, a, e[0]);
700
+ }
701
+ if (s) return n == 0 ? r.pos : n < 0 ? r.before(t + 1) : r.after(t + 1);
702
+ }
703
+ return null;
1068
704
  }
1069
- function O(s, e, t) {
1070
- return e == 0 ? s.cutByIndex(t, s.childCount) : s.replaceChild(0, s.firstChild.copy(O(s.firstChild.content, e - 1, t)));
705
+ function V(e, t, n = t, r = i.empty) {
706
+ if (t == n && !r.size) return null;
707
+ let a = e.resolve(t), o = e.resolve(n);
708
+ return H(a, o, r) ? new T(t, n, r) : new fe(a, o, r).fit();
1071
709
  }
1072
- function F(s, e, t) {
1073
- return e == 0 ? s.append(t) : s.replaceChild(s.childCount - 1, s.lastChild.copy(F(s.lastChild.content, e - 1, t)));
710
+ function H(e, t, n) {
711
+ return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
1074
712
  }
1075
- function D(s, e) {
1076
- for (let t = 0; t < e; t++)
1077
- s = s.firstChild.content;
1078
- return s;
713
+ var fe = class {
714
+ constructor(t, n, r) {
715
+ this.$from = t, this.$to = n, this.unplaced = r, this.frontier = [], this.placed = e.empty;
716
+ for (let e = 0; e <= t.depth; e++) {
717
+ let n = t.node(e);
718
+ this.frontier.push({
719
+ type: n.type,
720
+ match: n.contentMatchAt(t.indexAfter(e))
721
+ });
722
+ }
723
+ for (let n = t.depth; n > 0; n--) this.placed = e.from(t.node(n).copy(this.placed));
724
+ }
725
+ get depth() {
726
+ return this.frontier.length - 1;
727
+ }
728
+ fit() {
729
+ for (; this.unplaced.size;) {
730
+ let e = this.findFittable();
731
+ e ? this.placeNodes(e) : this.openMore() || this.dropNode();
732
+ }
733
+ let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, n = this.$from, r = this.close(e < 0 ? this.$to : n.doc.resolve(e));
734
+ if (!r) return null;
735
+ let a = this.placed, o = n.depth, s = r.depth;
736
+ for (; o && s && a.childCount == 1;) a = a.firstChild.content, o--, s--;
737
+ let c = new i(a, o, s);
738
+ return e > -1 ? new E(n.pos, e, this.$to.pos, this.$to.end(), c, t) : c.size || n.pos != this.$to.pos ? new T(n.pos, r.pos, c) : null;
739
+ }
740
+ findFittable() {
741
+ let t = this.unplaced.openStart;
742
+ for (let e = this.unplaced.content, n = 0, r = this.unplaced.openEnd; n < t; n++) {
743
+ let i = e.firstChild;
744
+ if (e.childCount > 1 && (r = 0), i.type.spec.isolating && r <= n) {
745
+ t = n;
746
+ break;
747
+ }
748
+ e = i.content;
749
+ }
750
+ for (let n = 1; n <= 2; n++) for (let r = n == 1 ? t : this.unplaced.openStart; r >= 0; r--) {
751
+ let t, i = null;
752
+ r ? (i = G(this.unplaced.content, r - 1).firstChild, t = i.content) : t = this.unplaced.content;
753
+ let a = t.firstChild;
754
+ for (let t = this.depth; t >= 0; t--) {
755
+ let { type: o, match: s } = this.frontier[t], c, l = null;
756
+ if (n == 1 && (a ? s.matchType(a.type) || (l = s.fillBefore(e.from(a), !1)) : i && o.compatibleContent(i.type))) return {
757
+ sliceDepth: r,
758
+ frontierDepth: t,
759
+ parent: i,
760
+ inject: l
761
+ };
762
+ if (n == 2 && a && (c = s.findWrapping(a.type))) return {
763
+ sliceDepth: r,
764
+ frontierDepth: t,
765
+ parent: i,
766
+ wrap: c
767
+ };
768
+ if (i && s.matchType(i.type)) break;
769
+ }
770
+ }
771
+ }
772
+ openMore() {
773
+ let { content: e, openStart: t, openEnd: n } = this.unplaced, r = G(e, t);
774
+ return !r.childCount || r.firstChild.isLeaf ? !1 : (this.unplaced = new i(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0);
775
+ }
776
+ dropNode() {
777
+ let { content: e, openStart: t, openEnd: n } = this.unplaced, r = G(e, t);
778
+ if (r.childCount <= 1 && t > 0) {
779
+ let a = e.size - t <= t + r.size;
780
+ this.unplaced = new i(U(e, t - 1, 1), t - 1, a ? t - 1 : n);
781
+ } else this.unplaced = new i(U(e, t, 1), t, n);
782
+ }
783
+ placeNodes({ sliceDepth: t, frontierDepth: n, parent: r, inject: a, wrap: o }) {
784
+ for (; this.depth > n;) this.closeFrontierNode();
785
+ if (o) for (let e = 0; e < o.length; e++) this.openFrontierNode(o[e]);
786
+ let s = this.unplaced, c = r ? r.content : s.content, l = s.openStart - t, u = 0, d = [], { match: f, type: p } = this.frontier[n];
787
+ if (a) {
788
+ for (let e = 0; e < a.childCount; e++) d.push(a.child(e));
789
+ f = f.matchFragment(a);
790
+ }
791
+ let m = c.size + t - (s.content.size - s.openEnd);
792
+ for (; u < c.childCount;) {
793
+ let e = c.child(u), t = f.matchType(e.type);
794
+ if (!t) break;
795
+ u++, (u > 1 || l == 0 || e.content.size) && (f = t, d.push(K(e.mark(p.allowedMarks(e.marks)), u == 1 ? l : 0, u == c.childCount ? m : -1)));
796
+ }
797
+ let h = u == c.childCount;
798
+ h || (m = -1), this.placed = W(this.placed, n, e.from(d)), this.frontier[n].match = f, h && m < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
799
+ for (let e = 0, t = c; e < m; e++) {
800
+ let e = t.lastChild;
801
+ this.frontier.push({
802
+ type: e.type,
803
+ match: e.contentMatchAt(e.childCount)
804
+ }), t = e.content;
805
+ }
806
+ this.unplaced = h ? t == 0 ? i.empty : new i(U(s.content, t - 1, 1), t - 1, m < 0 ? s.openEnd : t - 1) : new i(U(s.content, t, u), s.openStart, s.openEnd);
807
+ }
808
+ mustMoveInline() {
809
+ if (!this.$to.parent.isTextblock) return -1;
810
+ let e = this.frontier[this.depth], t;
811
+ if (!e.type.isTextblock || !q(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth) return -1;
812
+ let { depth: n } = this.$to, r = this.$to.after(n);
813
+ for (; n > 1 && r == this.$to.end(--n);) ++r;
814
+ return r;
815
+ }
816
+ findCloseLevel(e) {
817
+ scan: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
818
+ let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = q(e, t, r, n, i);
819
+ if (a) {
820
+ for (let n = t - 1; n >= 0; n--) {
821
+ let { match: t, type: r } = this.frontier[n], i = q(e, n, r, t, !0);
822
+ if (!i || i.childCount) continue scan;
823
+ }
824
+ return {
825
+ depth: t,
826
+ fit: a,
827
+ move: i ? e.doc.resolve(e.after(t + 1)) : e
828
+ };
829
+ }
830
+ }
831
+ }
832
+ close(e) {
833
+ let t = this.findCloseLevel(e);
834
+ if (!t) return null;
835
+ for (; this.depth > t.depth;) this.closeFrontierNode();
836
+ t.fit.childCount && (this.placed = W(this.placed, t.depth, t.fit)), e = t.move;
837
+ for (let n = t.depth + 1; n <= e.depth; n++) {
838
+ let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
839
+ this.openFrontierNode(t.type, t.attrs, r);
840
+ }
841
+ return e;
842
+ }
843
+ openFrontierNode(t, n = null, r) {
844
+ let i = this.frontier[this.depth];
845
+ i.match = i.match.matchType(t), this.placed = W(this.placed, this.depth, e.from(t.create(n, r))), this.frontier.push({
846
+ type: t,
847
+ match: t.contentMatch
848
+ });
849
+ }
850
+ closeFrontierNode() {
851
+ let t = this.frontier.pop().match.fillBefore(e.empty, !0);
852
+ t.childCount && (this.placed = W(this.placed, this.frontier.length, t));
853
+ }
854
+ };
855
+ function U(e, t, n) {
856
+ return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(U(e.firstChild.content, t - 1, n)));
1079
857
  }
1080
- function te(s, e, t) {
1081
- if (e <= 0)
1082
- return s;
1083
- let r = s.content;
1084
- 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(w.empty, !0)))), s.copy(r);
858
+ function W(e, t, n) {
859
+ return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(W(e.lastChild.content, t - 1, n)));
1085
860
  }
1086
- function W(s, e, t, r, n) {
1087
- let i = s.node(e), o = n ? s.indexAfter(e) : s.index(e);
1088
- if (o == i.childCount && !t.compatibleContent(i.type))
1089
- return null;
1090
- let l = r.fillBefore(i.content, !0, o);
1091
- return l && !Ie(t, i.content, o) ? l : null;
861
+ function G(e, t) {
862
+ for (let n = 0; n < t; n++) e = e.firstChild.content;
863
+ return e;
1092
864
  }
1093
- function Ie(s, e, t) {
1094
- for (let r = t; r < e.childCount; r++)
1095
- if (!s.allowsMarks(e.child(r).marks))
1096
- return !0;
1097
- return !1;
865
+ function K(t, n, r) {
866
+ if (n <= 0) return t;
867
+ let i = t.content;
868
+ return n > 1 && (i = i.replaceChild(0, K(i.firstChild, n - 1, i.childCount == 1 ? r - 1 : 0))), n > 0 && (i = t.type.contentMatch.fillBefore(i).append(i), r <= 0 && (i = i.append(t.type.contentMatch.matchFragment(i).fillBefore(e.empty, !0)))), t.copy(i);
1098
869
  }
1099
- function Ne(s) {
1100
- return s.spec.defining || s.spec.definingForContent;
870
+ function q(e, t, n, r, i) {
871
+ let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
872
+ if (o == a.childCount && !n.compatibleContent(a.type)) return null;
873
+ let s = r.fillBefore(a.content, !0, o);
874
+ return s && !pe(n, a.content, o) ? s : null;
1101
875
  }
1102
- function Re(s, e, t, r) {
1103
- if (!r.size)
1104
- return s.deleteRange(e, t);
1105
- let n = s.doc.resolve(e), i = s.doc.resolve(t);
1106
- if (ee(n, i, r))
1107
- return s.step(new k(e, t, r));
1108
- let o = ne(n, i);
1109
- o[o.length - 1] == 0 && o.pop();
1110
- let l = -(n.depth + 1);
1111
- o.unshift(l);
1112
- for (let f = n.depth, d = n.pos - 1; f > 0; f--, d--) {
1113
- let u = n.node(f).type.spec;
1114
- if (u.defining || u.definingAsContext || u.isolating)
1115
- break;
1116
- o.indexOf(f) > -1 ? l = f : n.before(f) == d && o.splice(1, 0, -f);
1117
- }
1118
- let a = o.indexOf(l), h = [], p = r.openStart;
1119
- for (let f = r.content, d = 0; ; d++) {
1120
- let u = f.firstChild;
1121
- if (h.push(u), d == r.openStart)
1122
- break;
1123
- f = u.content;
1124
- }
1125
- for (let f = p - 1; f >= 0; f--) {
1126
- let d = h[f], u = Ne(d.type);
1127
- if (u && !d.sameMarkup(n.node(Math.abs(l) - 1)))
1128
- p = f;
1129
- else if (u || !d.type.isTextblock)
1130
- break;
1131
- }
1132
- for (let f = r.openStart; f >= 0; f--) {
1133
- let d = (f + p + 1) % (r.openStart + 1), u = h[d];
1134
- if (u)
1135
- for (let m = 0; m < o.length; m++) {
1136
- let x = o[(m + a) % o.length], N = !0;
1137
- x < 0 && (N = !1, x = -x);
1138
- let ie = n.node(x - 1), G = n.index(x - 1);
1139
- if (ie.canReplaceWith(G, G, u.type, u.marks))
1140
- return s.replace(n.before(x), N ? i.after(x) : t, new g(re(r.content, 0, r.openStart, d), d, r.openEnd));
1141
- }
1142
- }
1143
- let c = s.steps.length;
1144
- for (let f = o.length - 1; f >= 0 && (s.replace(e, t, r), !(s.steps.length > c)); f--) {
1145
- let d = o[f];
1146
- d < 0 || (e = n.before(d), t = i.after(d));
1147
- }
876
+ function pe(e, t, n) {
877
+ for (let r = n; r < t.childCount; r++) if (!e.allowsMarks(t.child(r).marks)) return !0;
878
+ return !1;
1148
879
  }
1149
- function re(s, e, t, r, n) {
1150
- if (e < t) {
1151
- let i = s.firstChild;
1152
- s = s.replaceChild(0, i.copy(re(i.content, e + 1, t, r, i)));
1153
- }
1154
- if (e > r) {
1155
- let i = n.contentMatchAt(0), o = i.fillBefore(s).append(s);
1156
- s = o.append(i.matchFragment(o).fillBefore(w.empty, !0));
1157
- }
1158
- return s;
880
+ function me(e) {
881
+ return e.spec.defining || e.spec.definingForContent;
1159
882
  }
1160
- function Te(s, e, t, r) {
1161
- if (!r.isInline && e == t && s.doc.resolve(e).parent.content.size) {
1162
- let n = be(s.doc, e, r.type);
1163
- n != null && (e = t = n);
1164
- }
1165
- s.replaceRange(e, t, new g(w.from(r), 0, 0));
883
+ function he(e, t, n, r) {
884
+ if (!r.size) return e.deleteRange(t, n);
885
+ let a = e.doc.resolve(t), o = e.doc.resolve(n);
886
+ if (H(a, o, r)) return e.step(new T(t, n, r));
887
+ let s = X(a, o);
888
+ s[s.length - 1] == 0 && s.pop();
889
+ let c = -(a.depth + 1);
890
+ s.unshift(c);
891
+ for (let e = a.depth, t = a.pos - 1; e > 0; e--, t--) {
892
+ let n = a.node(e).type.spec;
893
+ if (n.defining || n.definingAsContext || n.isolating) break;
894
+ s.indexOf(e) > -1 ? c = e : a.before(e) == t && s.splice(1, 0, -e);
895
+ }
896
+ let l = s.indexOf(c), u = [], d = r.openStart;
897
+ for (let e = r.content, t = 0;; t++) {
898
+ let n = e.firstChild;
899
+ if (u.push(n), t == r.openStart) break;
900
+ e = n.content;
901
+ }
902
+ for (let e = d - 1; e >= 0; e--) {
903
+ let t = u[e], n = me(t.type);
904
+ if (n && !t.sameMarkup(a.node(Math.abs(c) - 1))) d = e;
905
+ else if (n || !t.type.isTextblock) break;
906
+ }
907
+ for (let t = r.openStart; t >= 0; t--) {
908
+ let c = (t + d + 1) % (r.openStart + 1), f = u[c];
909
+ if (f) for (let t = 0; t < s.length; t++) {
910
+ let u = s[(t + l) % s.length], d = !0;
911
+ u < 0 && (d = !1, u = -u);
912
+ let p = a.node(u - 1), m = a.index(u - 1);
913
+ if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(a.before(u), d ? o.after(u) : n, new i(J(r.content, 0, r.openStart, c), c, r.openEnd));
914
+ }
915
+ }
916
+ let f = e.steps.length;
917
+ for (let i = s.length - 1; i >= 0 && (e.replace(t, n, r), !(e.steps.length > f)); i--) {
918
+ let e = s[i];
919
+ e < 0 || (t = a.before(e), n = o.after(e));
920
+ }
1166
921
  }
1167
- function Ee(s, e, t) {
1168
- let r = s.doc.resolve(e), n = s.doc.resolve(t);
1169
- if (r.parent.isTextblock && n.parent.isTextblock && r.start() != n.start() && r.parentOffset == 0 && n.parentOffset == 0) {
1170
- let o = r.sharedDepth(t), l = !1;
1171
- for (let a = r.depth; a > o; a--)
1172
- r.node(a).type.spec.isolating && (l = !0);
1173
- for (let a = n.depth; a > o; a--)
1174
- n.node(a).type.spec.isolating && (l = !0);
1175
- if (!l) {
1176
- for (let a = r.depth; a > 0 && e == r.start(a); a--)
1177
- e = r.before(a);
1178
- for (let a = n.depth; a > 0 && t == n.start(a); a--)
1179
- t = n.before(a);
1180
- r = s.doc.resolve(e), n = s.doc.resolve(t);
1181
- }
1182
- }
1183
- let i = ne(r, n);
1184
- for (let o = 0; o < i.length; o++) {
1185
- let l = i[o], a = o == i.length - 1;
1186
- if (a && l == 0 || r.node(l).type.contentMatch.validEnd)
1187
- return s.delete(r.start(l), n.end(l));
1188
- if (l > 0 && (a || r.node(l - 1).canReplace(r.index(l - 1), n.indexAfter(l - 1))))
1189
- return s.delete(r.before(l), n.after(l));
1190
- }
1191
- for (let o = 1; o <= r.depth && o <= n.depth; o++)
1192
- 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)))
1193
- return s.delete(r.before(o), t);
1194
- s.delete(e, t);
922
+ function J(t, n, r, i, a) {
923
+ if (n < r) {
924
+ let e = t.firstChild;
925
+ t = t.replaceChild(0, e.copy(J(e.content, n + 1, r, i, e)));
926
+ }
927
+ if (n > i) {
928
+ let n = a.contentMatchAt(0), r = n.fillBefore(t).append(t);
929
+ t = r.append(n.matchFragment(r).fillBefore(e.empty, !0));
930
+ }
931
+ return t;
1195
932
  }
1196
- function ne(s, e) {
1197
- let t = [], r = Math.min(s.depth, e.depth);
1198
- for (let n = r; n >= 0; n--) {
1199
- let i = s.start(n);
1200
- 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)
1201
- break;
1202
- (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);
1203
- }
1204
- return t;
933
+ function Y(t, n, r, a) {
934
+ if (!a.isInline && n == r && t.doc.resolve(n).parent.content.size) {
935
+ let e = z(t.doc, n, a.type);
936
+ e != null && (n = r = e);
937
+ }
938
+ t.replaceRange(n, r, new i(e.from(a), 0, 0));
1205
939
  }
1206
- class T extends v {
1207
- /**
1208
- Construct an attribute step.
1209
- */
1210
- constructor(e, t, r) {
1211
- super(), this.pos = e, this.attr = t, this.value = r;
1212
- }
1213
- apply(e) {
1214
- let t = e.nodeAt(this.pos);
1215
- if (!t)
1216
- return y.fail("No node at attribute step's position");
1217
- let r = /* @__PURE__ */ Object.create(null);
1218
- for (let i in t.attrs)
1219
- r[i] = t.attrs[i];
1220
- r[this.attr] = this.value;
1221
- let n = t.type.create(r, null, t.marks);
1222
- return y.fromReplace(e, this.pos, this.pos + 1, new g(w.from(n), 0, t.isLeaf ? 0 : 1));
1223
- }
1224
- getMap() {
1225
- return S.empty;
1226
- }
1227
- invert(e) {
1228
- return new T(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
1229
- }
1230
- map(e) {
1231
- let t = e.mapResult(this.pos, 1);
1232
- return t.deletedAfter ? null : new T(t.pos, this.attr, this.value);
1233
- }
1234
- toJSON() {
1235
- return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
1236
- }
1237
- static fromJSON(e, t) {
1238
- if (typeof t.pos != "number" || typeof t.attr != "string")
1239
- throw new RangeError("Invalid input for AttrStep.fromJSON");
1240
- return new T(t.pos, t.attr, t.value);
1241
- }
940
+ function ge(e, t, n) {
941
+ let r = e.doc.resolve(t), i = e.doc.resolve(n);
942
+ if (r.parent.isTextblock && i.parent.isTextblock && r.start() != i.start() && r.parentOffset == 0 && i.parentOffset == 0) {
943
+ let a = r.sharedDepth(n), o = !1;
944
+ for (let e = r.depth; e > a; e--) r.node(e).type.spec.isolating && (o = !0);
945
+ for (let e = i.depth; e > a; e--) i.node(e).type.spec.isolating && (o = !0);
946
+ if (!o) {
947
+ for (let e = r.depth; e > 0 && t == r.start(e); e--) t = r.before(e);
948
+ for (let e = i.depth; e > 0 && n == i.start(e); e--) n = i.before(e);
949
+ r = e.doc.resolve(t), i = e.doc.resolve(n);
950
+ }
951
+ }
952
+ let a = X(r, i);
953
+ for (let t = 0; t < a.length; t++) {
954
+ let n = a[t], o = t == a.length - 1;
955
+ if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
956
+ if (n > 0 && (o || r.node(n - 1).canReplace(r.index(n - 1), i.indexAfter(n - 1)))) return e.delete(r.before(n), i.after(n));
957
+ }
958
+ for (let a = 1; a <= r.depth && a <= i.depth; a++) if (t - r.start(a) == r.depth - a && n > r.end(a) && i.end(a) - n != i.depth - a && r.start(a - 1) == i.start(a - 1) && r.node(a - 1).canReplace(r.index(a - 1), i.index(a - 1))) return e.delete(r.before(a), n);
959
+ e.delete(t, n);
1242
960
  }
1243
- v.jsonID("attr", T);
1244
- class z extends v {
1245
- /**
1246
- Construct an attribute step.
1247
- */
1248
- constructor(e, t) {
1249
- super(), this.attr = e, this.value = t;
1250
- }
1251
- apply(e) {
1252
- let t = /* @__PURE__ */ Object.create(null);
1253
- for (let n in e.attrs)
1254
- t[n] = e.attrs[n];
1255
- t[this.attr] = this.value;
1256
- let r = e.type.create(t, e.content, e.marks);
1257
- return y.ok(r);
1258
- }
1259
- getMap() {
1260
- return S.empty;
1261
- }
1262
- invert(e) {
1263
- return new z(this.attr, e.attrs[this.attr]);
1264
- }
1265
- map(e) {
1266
- return this;
1267
- }
1268
- toJSON() {
1269
- return { stepType: "docAttr", attr: this.attr, value: this.value };
1270
- }
1271
- static fromJSON(e, t) {
1272
- if (typeof t.attr != "string")
1273
- throw new RangeError("Invalid input for DocAttrStep.fromJSON");
1274
- return new z(t.attr, t.value);
1275
- }
961
+ function X(e, t) {
962
+ let n = [], r = Math.min(e.depth, t.depth);
963
+ for (let i = r; i >= 0; i--) {
964
+ let r = e.start(i);
965
+ if (r < e.pos - (e.depth - i) || t.end(i) > t.pos + (t.depth - i) || e.node(i).type.spec.isolating || t.node(i).type.spec.isolating) break;
966
+ (r == t.start(i) || i == e.depth && i == t.depth && e.parent.inlineContent && t.parent.inlineContent && i && t.start(i - 1) == r - 1) && n.push(i);
967
+ }
968
+ return n;
1276
969
  }
1277
- v.jsonID("docAttr", z);
1278
- let E = class extends Error {
970
+ var Z = class t extends v {
971
+ constructor(e, t, n) {
972
+ super(), this.pos = e, this.attr = t, this.value = n;
973
+ }
974
+ apply(t) {
975
+ let n = t.nodeAt(this.pos);
976
+ if (!n) return y.fail("No node at attribute step's position");
977
+ let r = Object.create(null);
978
+ for (let e in n.attrs) r[e] = n.attrs[e];
979
+ r[this.attr] = this.value;
980
+ let a = n.type.create(r, null, n.marks);
981
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(a), 0, +!n.isLeaf));
982
+ }
983
+ getMap() {
984
+ return h.empty;
985
+ }
986
+ invert(e) {
987
+ return new t(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
988
+ }
989
+ map(e) {
990
+ let n = e.mapResult(this.pos, 1);
991
+ return n.deletedAfter ? null : new t(n.pos, this.attr, this.value);
992
+ }
993
+ toJSON() {
994
+ return {
995
+ stepType: "attr",
996
+ pos: this.pos,
997
+ attr: this.attr,
998
+ value: this.value
999
+ };
1000
+ }
1001
+ static fromJSON(e, n) {
1002
+ if (typeof n.pos != "number" || typeof n.attr != "string") throw RangeError("Invalid input for AttrStep.fromJSON");
1003
+ return new t(n.pos, n.attr, n.value);
1004
+ }
1279
1005
  };
1280
- E = function s(e) {
1281
- let t = Error.call(this, e);
1282
- return t.__proto__ = s.prototype, t;
1006
+ v.jsonID("attr", Z);
1007
+ var Q = class e extends v {
1008
+ constructor(e, t) {
1009
+ super(), this.attr = e, this.value = t;
1010
+ }
1011
+ apply(e) {
1012
+ let t = Object.create(null);
1013
+ for (let n in e.attrs) t[n] = e.attrs[n];
1014
+ t[this.attr] = this.value;
1015
+ let n = e.type.create(t, e.content, e.marks);
1016
+ return y.ok(n);
1017
+ }
1018
+ getMap() {
1019
+ return h.empty;
1020
+ }
1021
+ invert(t) {
1022
+ return new e(this.attr, t.attrs[this.attr]);
1023
+ }
1024
+ map(e) {
1025
+ return this;
1026
+ }
1027
+ toJSON() {
1028
+ return {
1029
+ stepType: "docAttr",
1030
+ attr: this.attr,
1031
+ value: this.value
1032
+ };
1033
+ }
1034
+ static fromJSON(t, n) {
1035
+ if (typeof n.attr != "string") throw RangeError("Invalid input for DocAttrStep.fromJSON");
1036
+ return new e(n.attr, n.value);
1037
+ }
1283
1038
  };
1284
- E.prototype = Object.create(Error.prototype);
1285
- E.prototype.constructor = E;
1286
- E.prototype.name = "TransformError";
1287
- class We {
1288
- /**
1289
- Create a transform that starts with the given document.
1290
- */
1291
- constructor(e) {
1292
- this.doc = e, this.steps = [], this.docs = [], this.mapping = new J();
1293
- }
1294
- /**
1295
- The starting document.
1296
- */
1297
- get before() {
1298
- return this.docs.length ? this.docs[0] : this.doc;
1299
- }
1300
- /**
1301
- Apply a new step in this transform, saving the result. Throws an
1302
- error when the step fails.
1303
- */
1304
- step(e) {
1305
- let t = this.maybeStep(e);
1306
- if (t.failed)
1307
- throw new E(t.failed);
1308
- return this;
1309
- }
1310
- /**
1311
- Try to apply a step in this transformation, ignoring it if it
1312
- fails. Returns the step result.
1313
- */
1314
- maybeStep(e) {
1315
- let t = e.apply(this.doc);
1316
- return t.failed || this.addStep(e, t.doc), t;
1317
- }
1318
- /**
1319
- True when the document has been changed (when there are any
1320
- steps).
1321
- */
1322
- get docChanged() {
1323
- return this.steps.length > 0;
1324
- }
1325
- /**
1326
- Return a single range, in post-transform document positions,
1327
- that covers all content changed by this transform. Returns null
1328
- if no replacements are made. Note that this will ignore changes
1329
- that add/remove marks without replacing the underlying content.
1330
- */
1331
- changedRange() {
1332
- let e = 1e9, t = -1e9;
1333
- for (let r = 0; r < this.mapping.maps.length; r++) {
1334
- let n = this.mapping.maps[r];
1335
- r && (e = n.map(e, 1), t = n.map(t, -1)), n.forEach((i, o, l, a) => {
1336
- e = Math.min(e, l), t = Math.max(t, a);
1337
- });
1338
- }
1339
- return e == 1e9 ? null : { from: e, to: t };
1340
- }
1341
- /**
1342
- @internal
1343
- */
1344
- addStep(e, t) {
1345
- this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
1346
- }
1347
- /**
1348
- Replace the part of the document between `from` and `to` with the
1349
- given `slice`.
1350
- */
1351
- replace(e, t = e, r = g.empty) {
1352
- let n = Me(this.doc, e, t, r);
1353
- return n && this.step(n), this;
1354
- }
1355
- /**
1356
- Replace the given range with the given content, which may be a
1357
- fragment, node, or array of nodes.
1358
- */
1359
- replaceWith(e, t, r) {
1360
- return this.replace(e, t, new g(w.from(r), 0, 0));
1361
- }
1362
- /**
1363
- Delete the content between the given positions.
1364
- */
1365
- delete(e, t) {
1366
- return this.replace(e, t, g.empty);
1367
- }
1368
- /**
1369
- Insert the given content at the given position.
1370
- */
1371
- insert(e, t) {
1372
- return this.replaceWith(e, e, t);
1373
- }
1374
- /**
1375
- Replace a range of the document with a given slice, using
1376
- `from`, `to`, and the slice's
1377
- [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather
1378
- than fixed start and end points. This method may grow the
1379
- replaced area or close open nodes in the slice in order to get a
1380
- fit that is more in line with WYSIWYG expectations, by dropping
1381
- fully covered parent nodes of the replaced region when they are
1382
- marked [non-defining as
1383
- context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an
1384
- open parent node from the slice that _is_ marked as [defining
1385
- its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
1386
-
1387
- This is the method, for example, to handle paste. The similar
1388
- [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more
1389
- primitive tool which will _not_ move the start and end of its given
1390
- range, and is useful in situations where you need more precise
1391
- control over what happens.
1392
- */
1393
- replaceRange(e, t, r) {
1394
- return Re(this, e, t, r), this;
1395
- }
1396
- /**
1397
- Replace the given range with a node, but use `from` and `to` as
1398
- hints, rather than precise positions. When from and to are the same
1399
- and are at the start or end of a parent node in which the given
1400
- node doesn't fit, this method may _move_ them out towards a parent
1401
- that does allow the given node to be placed. When the given range
1402
- completely covers a parent node, this method may completely replace
1403
- that parent node.
1404
- */
1405
- replaceRangeWith(e, t, r) {
1406
- return Te(this, e, t, r), this;
1407
- }
1408
- /**
1409
- Delete the given range, expanding it to cover fully covered
1410
- parent nodes until a valid replace is found.
1411
- */
1412
- deleteRange(e, t) {
1413
- return Ee(this, e, t), this;
1414
- }
1415
- /**
1416
- Split the content in the given range off from its parent, if there
1417
- is sibling content before or after it, and move it up the tree to
1418
- the depth specified by `target`. You'll probably want to use
1419
- [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
1420
- sure the lift is valid.
1421
- */
1422
- lift(e, t) {
1423
- return de(this, e, t), this;
1424
- }
1425
- /**
1426
- Join the blocks around the given position. If depth is 2, their
1427
- last and first siblings are also joined, and so on.
1428
- */
1429
- join(e, t = 1) {
1430
- return Se(this, e, t), this;
1431
- }
1432
- /**
1433
- Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
1434
- The wrappers are assumed to be valid in this position, and should
1435
- probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
1436
- */
1437
- wrap(e, t) {
1438
- return ge(this, e, t), this;
1439
- }
1440
- /**
1441
- Set the type of all textblocks (partly) between `from` and `to` to
1442
- the given node type with the given attributes.
1443
- */
1444
- setBlockType(e, t = e, r, n = null) {
1445
- return we(this, e, t, r, n), this;
1446
- }
1447
- /**
1448
- Change the type, attributes, and/or marks of the node at `pos`.
1449
- When `type` isn't given, the existing node type is preserved,
1450
- */
1451
- setNodeMarkup(e, t, r = null, n) {
1452
- return ke(this, e, t, r, n), this;
1453
- }
1454
- /**
1455
- Set a single attribute on a given node to a new value.
1456
- The `pos` addresses the document content. Use `setDocAttribute`
1457
- to set attributes on the document itself.
1458
- */
1459
- setNodeAttribute(e, t, r) {
1460
- return this.step(new T(e, t, r)), this;
1461
- }
1462
- /**
1463
- Set a single attribute on the document to a new value.
1464
- */
1465
- setDocAttribute(e, t) {
1466
- return this.step(new z(e, t)), this;
1467
- }
1468
- /**
1469
- Add a mark to the node at position `pos`.
1470
- */
1471
- addNodeMark(e, t) {
1472
- return this.step(new I(e, t)), this;
1473
- }
1474
- /**
1475
- Remove a mark (or all marks of the given type) from the node at
1476
- position `pos`.
1477
- */
1478
- removeNodeMark(e, t) {
1479
- let r = this.doc.nodeAt(e);
1480
- if (!r)
1481
- throw new RangeError("No node at position " + e);
1482
- if (t instanceof se)
1483
- t.isInSet(r.marks) && this.step(new R(e, t));
1484
- else {
1485
- let n = r.marks, i, o = [];
1486
- for (; i = t.isInSet(n); )
1487
- o.push(new R(e, i)), n = i.removeFromSet(n);
1488
- for (let l = o.length - 1; l >= 0; l--)
1489
- this.step(o[l]);
1490
- }
1491
- return this;
1492
- }
1493
- /**
1494
- Split the node at the given position, and optionally, if `depth` is
1495
- greater than one, any number of nodes above that. By default, the
1496
- parts split off will inherit the node type of the original node.
1497
- This can be changed by passing an array of types and attributes to
1498
- use after the split (with the outermost nodes coming first).
1499
- */
1500
- split(e, t = 1, r) {
1501
- return ve(this, e, t, r), this;
1502
- }
1503
- /**
1504
- Add the given mark to the inline content between `from` and `to`.
1505
- */
1506
- addMark(e, t, r) {
1507
- return pe(this, e, t, r), this;
1508
- }
1509
- /**
1510
- Remove marks from inline nodes between `from` and `to`. When
1511
- `mark` is a single mark, remove precisely that mark. When it is
1512
- a mark type, remove all marks of that type. When it is null,
1513
- remove all marks of any type.
1514
- */
1515
- removeMark(e, t, r) {
1516
- return fe(this, e, t, r), this;
1517
- }
1518
- /**
1519
- Removes all marks and nodes from the content of the node at
1520
- `pos` that don't match the given new parent node type. Accepts
1521
- an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
1522
- third argument.
1523
- */
1524
- clearIncompatible(e, t, r) {
1525
- return $(this, e, t, r), this;
1526
- }
1527
- }
1528
- export {
1529
- C as AddMarkStep,
1530
- I as AddNodeMarkStep,
1531
- T as AttrStep,
1532
- z as DocAttrStep,
1533
- L as MapResult,
1534
- J as Mapping,
1535
- b as RemoveMarkStep,
1536
- R as RemoveNodeMarkStep,
1537
- M as ReplaceAroundStep,
1538
- k as ReplaceStep,
1539
- v as Step,
1540
- S as StepMap,
1541
- y as StepResult,
1542
- We as Transform,
1543
- E as TransformError,
1544
- Je as canJoin,
1545
- Ae as canSplit,
1546
- De as dropPoint,
1547
- ze as findWrapping,
1548
- be as insertPoint,
1549
- Be as joinPoint,
1550
- Fe as liftTarget,
1551
- Me as replaceStep
1039
+ v.jsonID("docAttr", Q);
1040
+ var $ = class extends Error {};
1041
+ $ = function e(t) {
1042
+ let n = Error.call(this, t);
1043
+ return n.__proto__ = e.prototype, n;
1044
+ }, $.prototype = Object.create(Error.prototype), $.prototype.constructor = $, $.prototype.name = "TransformError";
1045
+ var _e = class {
1046
+ constructor(e) {
1047
+ this.doc = e, this.steps = [], this.docs = [], this.mapping = new g();
1048
+ }
1049
+ get before() {
1050
+ return this.docs.length ? this.docs[0] : this.doc;
1051
+ }
1052
+ step(e) {
1053
+ let t = this.maybeStep(e);
1054
+ if (t.failed) throw new $(t.failed);
1055
+ return this;
1056
+ }
1057
+ maybeStep(e) {
1058
+ let t = e.apply(this.doc);
1059
+ return t.failed || this.addStep(e, t.doc), t;
1060
+ }
1061
+ get docChanged() {
1062
+ return this.steps.length > 0;
1063
+ }
1064
+ changedRange() {
1065
+ let e = 1e9, t = -1e9;
1066
+ for (let n = 0; n < this.mapping.maps.length; n++) {
1067
+ let r = this.mapping.maps[n];
1068
+ n && (e = r.map(e, 1), t = r.map(t, -1)), r.forEach((n, r, i, a) => {
1069
+ e = Math.min(e, i), t = Math.max(t, a);
1070
+ });
1071
+ }
1072
+ return e == 1e9 ? null : {
1073
+ from: e,
1074
+ to: t
1075
+ };
1076
+ }
1077
+ addStep(e, t) {
1078
+ this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
1079
+ }
1080
+ replace(e, t = e, n = i.empty) {
1081
+ let r = V(this.doc, e, t, n);
1082
+ return r && this.step(r), this;
1083
+ }
1084
+ replaceWith(t, n, r) {
1085
+ return this.replace(t, n, new i(e.from(r), 0, 0));
1086
+ }
1087
+ delete(e, t) {
1088
+ return this.replace(e, t, i.empty);
1089
+ }
1090
+ insert(e, t) {
1091
+ return this.replaceWith(e, e, t);
1092
+ }
1093
+ replaceRange(e, t, n) {
1094
+ return he(this, e, t, n), this;
1095
+ }
1096
+ replaceRangeWith(e, t, n) {
1097
+ return Y(this, e, t, n), this;
1098
+ }
1099
+ deleteRange(e, t) {
1100
+ return ge(this, e, t), this;
1101
+ }
1102
+ lift(e, t) {
1103
+ return ie(this, e, t), this;
1104
+ }
1105
+ join(e, t = 1) {
1106
+ return R(this, e, t), this;
1107
+ }
1108
+ wrap(e, t) {
1109
+ return A(this, e, t), this;
1110
+ }
1111
+ setBlockType(e, t = e, n, r = null) {
1112
+ return j(this, e, t, n, r), this;
1113
+ }
1114
+ setNodeMarkup(e, t, n = null, r) {
1115
+ return F(this, e, t, n, r), this;
1116
+ }
1117
+ setNodeAttribute(e, t, n) {
1118
+ return this.step(new Z(e, t, n)), this;
1119
+ }
1120
+ setDocAttribute(e, t) {
1121
+ return this.step(new Q(e, t)), this;
1122
+ }
1123
+ addNodeMark(e, t) {
1124
+ return this.step(new C(e, t)), this;
1125
+ }
1126
+ removeNodeMark(e, n) {
1127
+ let r = this.doc.nodeAt(e);
1128
+ if (!r) throw RangeError("No node at position " + e);
1129
+ if (n instanceof t) n.isInSet(r.marks) && this.step(new w(e, n));
1130
+ else {
1131
+ let t = r.marks, i, a = [];
1132
+ for (; i = n.isInSet(t);) a.push(new w(e, i)), t = i.removeFromSet(t);
1133
+ for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
1134
+ }
1135
+ return this;
1136
+ }
1137
+ split(e, t = 1, n) {
1138
+ return le(this, e, t, n), this;
1139
+ }
1140
+ addMark(e, t, n) {
1141
+ return ee(this, e, t, n), this;
1142
+ }
1143
+ removeMark(e, t, n) {
1144
+ return te(this, e, t, n), this;
1145
+ }
1146
+ clearIncompatible(e, t, n) {
1147
+ return O(this, e, t, n), this;
1148
+ }
1552
1149
  };
1150
+ //#endregion
1151
+ export { x as AddMarkStep, C as AddNodeMarkStep, Z as AttrStep, Q as DocAttrStep, m as MapResult, g as Mapping, S as RemoveMarkStep, w as RemoveNodeMarkStep, E as ReplaceAroundStep, T as ReplaceStep, v as Step, h as StepMap, y as StepResult, _e as Transform, $ as TransformError, ue as canJoin, ce as canSplit, B as dropPoint, ae as findWrapping, z as insertPoint, L as joinPoint, re as liftTarget, V as replaceStep };