@vc-shell/framework 1.1.74 → 1.1.75

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 (451) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue.d.ts.map +1 -1
  3. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue.d.ts.map +1 -1
  4. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
  5. package/dist/shared/components/change-password/change-password.vue.d.ts.map +1 -1
  6. package/dist/shared/components/change-password-button/change-password-button.vue.d.ts.map +1 -1
  7. package/dist/shared/components/common/popup/vc-popup-error.vue.d.ts.map +1 -1
  8. package/dist/shared/components/common/popup/vc-popup-info.vue.d.ts.map +1 -1
  9. package/dist/shared/components/common/popup/vc-popup-warning.vue.d.ts.map +1 -1
  10. package/dist/shared/components/dashboard-widget-card/dashboard-widget-card.vue.d.ts.map +1 -1
  11. package/dist/shared/components/draggable-dashboard/DraggableDashboard.vue.d.ts.map +1 -1
  12. package/dist/shared/components/draggable-dashboard/_internal/DashboardWidget.vue.d.ts.map +1 -1
  13. package/dist/shared/components/generic-dropdown/generic-dropdown.vue.d.ts +2 -2
  14. package/dist/shared/components/generic-dropdown/generic-dropdown.vue.d.ts.map +1 -1
  15. package/dist/shared/components/language-selector/language-selector.vue.d.ts.map +1 -1
  16. package/dist/shared/components/logout-button/logout-button.vue.d.ts.map +1 -1
  17. package/dist/shared/components/multilanguage-selector/multilanguage-selector.vue.d.ts +1 -1
  18. package/dist/shared/components/multilanguage-selector/multilanguage-selector.vue.d.ts.map +1 -1
  19. package/dist/shared/components/notification-dropdown/_internal/notification/notification.vue.d.ts.map +1 -1
  20. package/dist/shared/components/notification-dropdown/notification-dropdown.vue.d.ts.map +1 -1
  21. package/dist/shared/components/notification-template/notification-template.vue.d.ts.map +1 -1
  22. package/dist/shared/components/notifications/components/notification-container/index.d.ts +10 -10
  23. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  24. package/dist/shared/components/popup-handler/components/vc-popup-container/vc-popup-container.vue.d.ts.map +1 -1
  25. package/dist/shared/components/settings-menu/settings-menu.vue.d.ts.map +1 -1
  26. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  27. package/dist/shared/components/sidebar/sidebar.vue.d.ts.map +1 -1
  28. package/dist/shared/components/sign-in/external-provider.vue.d.ts.map +1 -1
  29. package/dist/shared/components/sign-in/external-providers.vue.d.ts.map +1 -1
  30. package/dist/shared/components/theme-selector/theme-selector.vue.d.ts.map +1 -1
  31. package/dist/shared/components/user-dropdown-button/_internal/user-info.vue.d.ts.map +1 -1
  32. package/dist/shared/components/user-dropdown-button/_internal/user-sidebar.vue.d.ts.map +1 -1
  33. package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts.map +1 -1
  34. package/dist/shared/composables/useMenuExpanded.d.ts +1 -1
  35. package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts.map +1 -1
  36. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -2
  37. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
  38. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  39. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  40. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
  41. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  42. package/dist/shared/pages/ChangePasswordPage/components/change-password/ChangePassword.vue.d.ts.map +1 -1
  43. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +1 -1
  44. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
  45. package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
  46. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +1 -1
  47. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
  50. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
  51. package/dist/ui/components/atoms/vc-banner/vc-banner.vue.d.ts.map +1 -1
  52. package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts.map +1 -1
  53. package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
  54. package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts.map +1 -1
  55. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +4 -4
  56. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts.map +1 -1
  57. package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
  58. package/dist/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue.d.ts.map +1 -1
  59. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  60. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  61. package/dist/ui/components/atoms/vc-icon/vc-icon-examples.vue.d.ts.map +1 -1
  62. package/dist/ui/components/atoms/vc-icon/vc-icon-test.vue.d.ts.map +1 -1
  63. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
  64. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  65. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  66. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  67. package/dist/ui/components/atoms/vc-icon/vc-svg-icon.vue.d.ts.map +1 -1
  68. package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts.map +1 -1
  69. package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
  70. package/dist/ui/components/atoms/vc-link/vc-link.vue.d.ts.map +1 -1
  71. package/dist/ui/components/atoms/vc-loading/vc-loading.vue.d.ts.map +1 -1
  72. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +1 -1
  73. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
  74. package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts.map +1 -1
  75. package/dist/ui/components/atoms/vc-skeleton/vc-skeleton.vue.d.ts.map +1 -1
  76. package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
  77. package/dist/ui/components/atoms/vc-status-icon/vc-status-icon.vue.d.ts.map +1 -1
  78. package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts.map +1 -1
  79. package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
  80. package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
  81. package/dist/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue.d.ts.map +1 -1
  82. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  83. package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
  84. package/dist/ui/components/molecules/vc-editor/_internal/extensions/font-size.d.ts +12 -0
  85. package/dist/ui/components/molecules/vc-editor/_internal/extensions/font-size.d.ts.map +1 -0
  86. package/dist/ui/components/molecules/vc-editor/_internal/toolbar-types.d.ts +49 -0
  87. package/dist/ui/components/molecules/vc-editor/_internal/toolbar-types.d.ts.map +1 -0
  88. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +1 -1
  89. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts.map +1 -1
  90. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-custom-button.vue.d.ts +10 -0
  91. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-custom-button.vue.d.ts.map +1 -0
  92. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-font-selector.vue.d.ts +8 -0
  93. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-font-selector.vue.d.ts.map +1 -0
  94. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts +4 -1
  95. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts.map +1 -1
  96. package/dist/ui/components/molecules/vc-editor/index.d.ts +1 -0
  97. package/dist/ui/components/molecules/vc-editor/index.d.ts.map +1 -1
  98. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +7 -3
  99. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  100. package/dist/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue.d.ts.map +1 -1
  101. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
  102. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +2 -2
  103. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
  104. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  105. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +2 -2
  106. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
  107. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  108. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  109. package/dist/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.vue.d.ts.map +1 -1
  110. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +2 -2
  111. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
  112. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  113. package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.vue.d.ts.map +1 -1
  114. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +1 -1
  115. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  116. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +2 -2
  117. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  118. package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts +7 -8
  119. package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts.map +1 -1
  120. package/dist/ui/components/molecules/vc-switch/vc-switch.vue.d.ts.map +1 -1
  121. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  122. package/dist/ui/components/molecules/vc-toast/vc-toast.vue.d.ts.map +1 -1
  123. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarContent.vue.d.ts.map +1 -1
  124. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarHeader.vue.d.ts.map +1 -1
  125. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarMobileActions.vue.d.ts.map +1 -1
  126. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarOverlay.vue.d.ts +2 -2
  127. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarOverlay.vue.d.ts.map +1 -1
  128. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarSlots.vue.d.ts.map +1 -1
  129. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarWidgetItem.vue.d.ts.map +1 -1
  130. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarWidgetsMenu.vue.d.ts.map +1 -1
  131. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue.d.ts.map +1 -1
  132. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  133. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  134. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +1 -1
  135. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
  136. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts.map +1 -1
  137. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  138. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts +2 -2
  139. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
  140. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +1 -1
  141. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts.map +1 -1
  142. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +1 -1
  143. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
  144. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
  145. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
  146. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/desktop/vc-blade-toolbar-desktop.vue.d.ts.map +1 -1
  147. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/mobile/vc-blade-toolbar-mobile.vue.d.ts.map +1 -1
  148. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/vc-blade-toolbar-buttons.vue.d.ts.map +1 -1
  149. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts +2 -2
  150. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  151. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue.d.ts.map +1 -1
  152. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts.map +1 -1
  153. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/vc-widget-container.vue.d.ts.map +1 -1
  154. package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +3 -3
  155. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
  156. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  157. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +2 -2
  158. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
  159. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  160. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts.map +1 -1
  161. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +1 -1
  162. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
  163. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +5 -5
  164. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
  165. package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts.map +1 -1
  166. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
  167. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
  168. package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts.map +1 -1
  169. package/dist/ui/components/organisms/vc-table/_internal/vc-table-base-header/vc-table-base-header.vue.d.ts +2 -2
  170. package/dist/ui/components/organisms/vc-table/_internal/vc-table-base-header/vc-table-base-header.vue.d.ts.map +1 -1
  171. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
  172. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
  173. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +1 -1
  174. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
  175. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +25 -3
  176. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts.map +1 -1
  177. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts +2 -2
  178. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts.map +1 -1
  179. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +25 -3
  180. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts.map +1 -1
  181. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-select-all-header/vc-table-select-all-header.vue.d.ts.map +1 -1
  182. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +31 -3
  183. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts.map +1 -1
  184. package/dist/ui/components/organisms/vc-table/_internal/vc-table-empty/vc-table-empty.vue.d.ts.map +1 -1
  185. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts +2 -2
  186. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
  187. package/dist/ui/components/organisms/vc-table/_internal/vc-table-footer/vc-table-footer.vue.d.ts.map +1 -1
  188. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts.map +1 -1
  189. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue.d.ts +2 -2
  190. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue.d.ts.map +1 -1
  191. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts +2 -2
  192. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts.map +1 -1
  193. package/dist/ui/components/organisms/vc-table/_internal/vc-table-select-all/vc-table-select-all.vue.d.ts.map +1 -1
  194. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +28 -3
  195. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  196. package/package.json +33 -27
  197. package/ui/components/molecules/vc-editor/_internal/extensions/font-size.ts +59 -0
  198. package/ui/components/molecules/vc-editor/_internal/toolbar-types.ts +57 -0
  199. package/ui/components/molecules/vc-editor/_internal/vc-editor-custom-button.vue +79 -0
  200. package/ui/components/molecules/vc-editor/_internal/vc-editor-font-selector.vue +215 -0
  201. package/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue +42 -0
  202. package/ui/components/molecules/vc-editor/index.ts +5 -0
  203. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +172 -3
  204. package/ui/components/molecules/vc-editor/vc-editor.vue +49 -26
  205. package/ui/components/molecules/vc-slider/vc-slider.vue +8 -8
  206. package/dist/assets/042c75b764bc78a7.svg +0 -1
  207. package/dist/assets/0ba156439a339f2a.svg +0 -1
  208. package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
  209. package/dist/assets/0f590f8a94577092.svg +0 -1
  210. package/dist/assets/0fc5820f8be53a1b.svg +0 -1
  211. package/dist/assets/10768e2cc79fc60b.svg +0 -1
  212. package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
  213. package/dist/assets/154365acf3010d96.woff2 +0 -0
  214. package/dist/assets/157b8721e0600ea8.svg +0 -1
  215. package/dist/assets/15e91cdd649cde9a.svg +0 -1
  216. package/dist/assets/1a3e84b2457f709a.woff +0 -0
  217. package/dist/assets/1de63eb118636cce.svg +0 -1
  218. package/dist/assets/1ea01de36eb5491b.svg +0 -1
  219. package/dist/assets/204eaf512fde2023.svg +0 -1
  220. package/dist/assets/2088983edf42e153.svg +0 -1
  221. package/dist/assets/208f810a9321a327.svg +0 -1
  222. package/dist/assets/21220a9d10e6c558.svg +0 -1
  223. package/dist/assets/220db345a102045d.woff2 +0 -0
  224. package/dist/assets/225da11d23968333.svg +0 -1
  225. package/dist/assets/226f862dd81bdc13.woff2 +0 -0
  226. package/dist/assets/23a2d53395ddb14f.woff +0 -0
  227. package/dist/assets/259e6ad461a52ad7.svg +0 -1
  228. package/dist/assets/261e6dec4d53b9ac.woff +0 -0
  229. package/dist/assets/262f46a0b6d94bb6.svg +0 -1
  230. package/dist/assets/2857c513073467da.svg +0 -1
  231. package/dist/assets/2b3be7889467d98f.woff +0 -0
  232. package/dist/assets/2d4e6190eec72737.svg +0 -1
  233. package/dist/assets/2eba973185078bc8.woff +0 -0
  234. package/dist/assets/327511cd4a7ba7f9.woff +0 -0
  235. package/dist/assets/334d3f6bc766c516.woff +0 -0
  236. package/dist/assets/34ff7dd0c2285956.svg +0 -1
  237. package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
  238. package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
  239. package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
  240. package/dist/assets/41275bcb979cb650.svg +0 -1
  241. package/dist/assets/42df4e2d6fa3fd2a.woff2 +0 -0
  242. package/dist/assets/434f7982590e462f.woff +0 -0
  243. package/dist/assets/475937116ee3314a.woff2 +0 -0
  244. package/dist/assets/49791943b3872376.woff2 +0 -0
  245. package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
  246. package/dist/assets/4d7a77b0e5373992.svg +0 -1
  247. package/dist/assets/4e43c74354534fb3.svg +0 -1
  248. package/dist/assets/4fe75f5117100705.svg +0 -1
  249. package/dist/assets/52610491f372cb0c.woff2 +0 -0
  250. package/dist/assets/52e261a005074e1b.woff +0 -0
  251. package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
  252. package/dist/assets/572bb1bb4156a9c1.svg +0 -1
  253. package/dist/assets/5b3661be8be679d0.woff2 +0 -0
  254. package/dist/assets/5d96cfcc5bedd917.woff2 +0 -0
  255. package/dist/assets/6075995d7e74da46.woff2 +0 -0
  256. package/dist/assets/617c4736236e199e.woff +0 -0
  257. package/dist/assets/6619e9e10beea0e7.woff2 +0 -0
  258. package/dist/assets/67230f05dc94a265.svg +0 -1
  259. package/dist/assets/6798e4dd4add9b48.svg +0 -1
  260. package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
  261. package/dist/assets/6a3e73faf406cf33.svg +0 -1
  262. package/dist/assets/72de3a63bc0b70dd.svg +0 -1
  263. package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
  264. package/dist/assets/74ed5f8a78e71106.svg +0 -1
  265. package/dist/assets/7a5aa5abd625137f.ttf +0 -0
  266. package/dist/assets/7ce0c166fd6a1204.woff +0 -0
  267. package/dist/assets/7d55399c2a7bc985.svg +0 -1
  268. package/dist/assets/7d970675c69fca1d.woff +0 -0
  269. package/dist/assets/7eda727273fd98d3.svg +0 -1
  270. package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
  271. package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
  272. package/dist/assets/861e6b7192b3b6c7.woff +0 -0
  273. package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
  274. package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
  275. package/dist/assets/910b0d99b9e26568.svg +0 -1
  276. package/dist/assets/91eee1aa81f72683.woff +0 -0
  277. package/dist/assets/92508f8707159b51.svg +0 -1
  278. package/dist/assets/9392bf1d591e1abb.svg +0 -1
  279. package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
  280. package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
  281. package/dist/assets/9d37314695c0b68d.woff +0 -0
  282. package/dist/assets/a18404194e3f9047.svg +0 -1
  283. package/dist/assets/a2017fe7f0a26510.svg +0 -1
  284. package/dist/assets/a47034e65dbcc3d7.woff +0 -0
  285. package/dist/assets/a617e11804bbacb7.woff +0 -0
  286. package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
  287. package/dist/assets/abf88f301a0730f4.svg +0 -1
  288. package/dist/assets/ac1a99b3d05d8232.woff +0 -0
  289. package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
  290. package/dist/assets/b1a596e31ad1185a.svg +0 -1
  291. package/dist/assets/b27767411c8427be.woff +0 -0
  292. package/dist/assets/b291dc35a17511f7.woff +0 -0
  293. package/dist/assets/b325adcae33bbe7a.svg +0 -1
  294. package/dist/assets/b372390551ca2fa1.svg +0 -1
  295. package/dist/assets/b5bb1e8fc975decd.svg +0 -1
  296. package/dist/assets/b645a4a2181b9dc1.svg +0 -1
  297. package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
  298. package/dist/assets/b94421fadd23b0f2.svg +0 -1
  299. package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
  300. package/dist/assets/bfbe205759295eca.woff2 +0 -0
  301. package/dist/assets/ca791c5ca5848a03.svg +0 -1
  302. package/dist/assets/cb32840ce330103f.woff +0 -0
  303. package/dist/assets/ccc878931d74181b.woff2 +0 -0
  304. package/dist/assets/d084bda16abe8a56.svg +0 -1
  305. package/dist/assets/d32b129cae2fffd6.svg +0 -1
  306. package/dist/assets/d35a4c7113315758.woff2 +0 -0
  307. package/dist/assets/d3f792f54ae4c307.svg +0 -1
  308. package/dist/assets/d5a5b8630120073d.svg +0 -1
  309. package/dist/assets/d5f9664ebbfb104b.svg +0 -1
  310. package/dist/assets/d80b05788e407de7.woff2 +0 -0
  311. package/dist/assets/d84247b59449dd88.woff2 +0 -0
  312. package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
  313. package/dist/assets/e38acaa1757232e0.svg +0 -1
  314. package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
  315. package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
  316. package/dist/assets/e61a1889bac955f4.woff2 +0 -0
  317. package/dist/assets/e72bb11356af94c7.svg +0 -1
  318. package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
  319. package/dist/assets/ebec912a42ad49ff.woff +0 -0
  320. package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
  321. package/dist/assets/f09d89268e4c0317.svg +0 -1
  322. package/dist/assets/f276d55184e05a07.woff +0 -0
  323. package/dist/assets/f5722262b6e7214e.woff2 +0 -0
  324. package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
  325. package/dist/assets/fcb1c1ffb5640194.woff +0 -0
  326. package/dist/assets/fe141d99763f5d2b.woff +0 -0
  327. package/dist/assets/fed13b0d59903483.svg +0 -1
  328. package/dist/assets/fed757d2c2344ead.woff2 +0 -0
  329. package/dist/assets/ffc438f20e79ce73.woff +0 -0
  330. package/dist/framework.js +0 -24357
  331. package/dist/index.css +0 -9
  332. package/dist/vendor-boolbase-A_-Pp38P.js +0 -23
  333. package/dist/vendor-cheerio-C46iBpCu.js +0 -1053
  334. package/dist/vendor-cheerio-select-C8emRZsx.js +0 -191
  335. package/dist/vendor-core-js-DFA7rceR.js +0 -1206
  336. package/dist/vendor-css-select-DR9bp36p.js +0 -622
  337. package/dist/vendor-css-what-CZZaquJM.js +0 -267
  338. package/dist/vendor-cypress-signalr-mock-CdKwIhWw.js +0 -769
  339. package/dist/vendor-date-fns-sZ1zMzTH.js +0 -3008
  340. package/dist/vendor-dom-serializer-Sk3xHhQk.js +0 -213
  341. package/dist/vendor-dom7-wvIUV9pT.js +0 -529
  342. package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
  343. package/dist/vendor-domhandler-CL40eeX9.js +0 -311
  344. package/dist/vendor-dompurify-eYFoHPwR.js +0 -528
  345. package/dist/vendor-domutils-BiVCXO8c.js +0 -386
  346. package/dist/vendor-entities-CCReaWqU.js +0 -364
  347. package/dist/vendor-floating-ui-core-3dy7r5mx.js +0 -349
  348. package/dist/vendor-floating-ui-dom-DCjH_QK4.js +0 -393
  349. package/dist/vendor-floating-ui-utils-D2sT7feD.js +0 -259
  350. package/dist/vendor-floating-ui-vue-BUBCqiRN.js +0 -107
  351. package/dist/vendor-headlessui-vue-Dg0Llidi.js +0 -961
  352. package/dist/vendor-htmlparser2-CpQu33io.js +0 -735
  353. package/dist/vendor-intlify-core-base-txnziOTW.js +0 -1130
  354. package/dist/vendor-intlify-message-compiler-XquMv3aB.js +0 -947
  355. package/dist/vendor-intlify-shared-CE1Dfvjf.js +0 -144
  356. package/dist/vendor-iso-639-1-BJO6WZAt.js +0 -781
  357. package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
  358. package/dist/vendor-linkifyjs-DTu7SY_Y.js +0 -705
  359. package/dist/vendor-lodash-es-CrYlgAi8.js +0 -4816
  360. package/dist/vendor-lucide-vue-next-m0L4DzUL.js +0 -29780
  361. package/dist/vendor-markdown-it-RJo-N9ov.js +0 -2263
  362. package/dist/vendor-markdown-it-task-lists-BxLwscWK.js +0 -69
  363. package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
  364. package/dist/vendor-microsoft-applicationinsights-analytics-js-CauId95v.js +0 -1105
  365. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-DGfB75It.js +0 -261
  366. package/dist/vendor-microsoft-applicationinsights-channel-js-B4PYlGv8.js +0 -1809
  367. package/dist/vendor-microsoft-applicationinsights-common-Bj6sQeoz.js +0 -1921
  368. package/dist/vendor-microsoft-applicationinsights-core-js-Cga21Mpw.js +0 -4127
  369. package/dist/vendor-microsoft-applicationinsights-dependencies-js-CH87Sln6.js +0 -1399
  370. package/dist/vendor-microsoft-applicationinsights-properties-js-CLE2OEt_.js +0 -572
  371. package/dist/vendor-microsoft-applicationinsights-shims-CxtPYiwp.js +0 -43
  372. package/dist/vendor-microsoft-applicationinsights-web-8IaeIl22.js +0 -487
  373. package/dist/vendor-microsoft-dynamicproto-js-DSkQkH3T.js +0 -147
  374. package/dist/vendor-microsoft-signalr-qIrag5xx.js +0 -1761
  375. package/dist/vendor-moment-CwOqp704.js +0 -2589
  376. package/dist/vendor-nevware21-ts-async-DadHEt7N.js +0 -260
  377. package/dist/vendor-nevware21-ts-utils-Dy41wRhA.js +0 -853
  378. package/dist/vendor-nth-check-CS1D-zr5.js +0 -45
  379. package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
  380. package/dist/vendor-parse5-htmlparser2-tree-adapter-BWywtwol.js +0 -143
  381. package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
  382. package/dist/vendor-popperjs-core-LGjf7Wza.js +0 -905
  383. package/dist/vendor-prettier-DaiSFsWE.js +0 -4875
  384. package/dist/vendor-prosemirror-commands-B8fhFbTo.js +0 -385
  385. package/dist/vendor-prosemirror-dropcursor-CdHQ9kQG.js +0 -86
  386. package/dist/vendor-prosemirror-gapcursor-W-ky5QTm.js +0 -200
  387. package/dist/vendor-prosemirror-history-CrtTR5Cd.js +0 -248
  388. package/dist/vendor-prosemirror-keymap-DWvoDWf6.js +0 -62
  389. package/dist/vendor-prosemirror-markdown-CuzWQ2N6.js +0 -650
  390. package/dist/vendor-prosemirror-model-CVTn1Stc.js +0 -2722
  391. package/dist/vendor-prosemirror-schema-list-Ds6x_KLX.js +0 -87
  392. package/dist/vendor-prosemirror-state-CRUasa1V.js +0 -821
  393. package/dist/vendor-prosemirror-tables-DzTfCeHX.js +0 -1711
  394. package/dist/vendor-prosemirror-transform-BeDaI3CS.js +0 -1507
  395. package/dist/vendor-prosemirror-view-BGYdOWiJ.js +0 -3748
  396. package/dist/vendor-punycode-js-CNI-zL6U.js +0 -133
  397. package/dist/vendor-rope-sequence-sEGCUMi8.js +0 -100
  398. package/dist/vendor-semver-FuwqpOls.js +0 -1021
  399. package/dist/vendor-ssr-window-D4k3p53c.js +0 -133
  400. package/dist/vendor-swiper-DrZzJvo8.js +0 -2825
  401. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +0 -1
  402. package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
  403. package/dist/vendor-tippy-js-nNhcw_JH.js +0 -812
  404. package/dist/vendor-tiptap-core-dlTW4S11.js +0 -2817
  405. package/dist/vendor-tiptap-extension-blockquote-iAIM-meW.js +0 -43
  406. package/dist/vendor-tiptap-extension-bold-bkOLNH6E.js +0 -71
  407. package/dist/vendor-tiptap-extension-bubble-menu-BRWVLpun.js +0 -128
  408. package/dist/vendor-tiptap-extension-bullet-list-DfU428XB.js +0 -53
  409. package/dist/vendor-tiptap-extension-code-CgIql8q6.js +0 -51
  410. package/dist/vendor-tiptap-extension-code-block-V26-erQk.js +0 -133
  411. package/dist/vendor-tiptap-extension-document-BYF_BzDD.js +0 -9
  412. package/dist/vendor-tiptap-extension-dropcursor-DqjaaFex.js +0 -20
  413. package/dist/vendor-tiptap-extension-floating-menu-vptdm_Y0.js +0 -99
  414. package/dist/vendor-tiptap-extension-gapcursor-DxLBw8V0.js +0 -24
  415. package/dist/vendor-tiptap-extension-hard-break-DygHhzqw.js +0 -55
  416. package/dist/vendor-tiptap-extension-heading-C-ArDc3_.js +0 -54
  417. package/dist/vendor-tiptap-extension-history-C41RW3Bv.js +0 -35
  418. package/dist/vendor-tiptap-extension-horizontal-rule-BGMGd9fo.js +0 -58
  419. package/dist/vendor-tiptap-extension-image-DChcWb4v.js +0 -64
  420. package/dist/vendor-tiptap-extension-italic-BNJrFvrR.js +0 -70
  421. package/dist/vendor-tiptap-extension-link-DFN4ENph.js +0 -270
  422. package/dist/vendor-tiptap-extension-list-item-3qKYhGHe.js +0 -33
  423. package/dist/vendor-tiptap-extension-ordered-list-D3QL0eiW.js +0 -71
  424. package/dist/vendor-tiptap-extension-paragraph-DZfkaJJ-.js +0 -33
  425. package/dist/vendor-tiptap-extension-placeholder-CoOAmd0a.js +0 -52
  426. package/dist/vendor-tiptap-extension-strike-BlGNozxy.js +0 -61
  427. package/dist/vendor-tiptap-extension-table-CZn6Xykb.js +0 -213
  428. package/dist/vendor-tiptap-extension-table-cell-BQuS-XFD.js +0 -40
  429. package/dist/vendor-tiptap-extension-table-header-ZrtK7HiQ.js +0 -40
  430. package/dist/vendor-tiptap-extension-table-row-CBrXvqsO.js +0 -22
  431. package/dist/vendor-tiptap-extension-text-DwA7jrBq.js +0 -8
  432. package/dist/vendor-tiptap-extension-underline-CIVtuRLl.js +0 -40
  433. package/dist/vendor-tiptap-markdown-CidDIpZ-.js +0 -826
  434. package/dist/vendor-tiptap-pm-9TOy65Oe.js +0 -1
  435. package/dist/vendor-tiptap-starter-kit-BdU6UtqB.js +0 -29
  436. package/dist/vendor-tiptap-vue-3-CnYccgV4.js +0 -225
  437. package/dist/vendor-truncate-html-DYC0Lj9o.js +0 -145
  438. package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
  439. package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
  440. package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
  441. package/dist/vendor-vue-currency-input-BqaYAdhD.js +0 -317
  442. package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
  443. package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
  444. package/dist/vendor-vue-i18n-BeXi5L3e.js +0 -1370
  445. package/dist/vendor-vue3-application-insights-C8xbxXXX.js +0 -69
  446. package/dist/vendor-vue3-touch-events-8Pa3HHlV.js +0 -169
  447. package/dist/vendor-vuepic-vue-datepicker-Chx5s5I-.js +0 -5116
  448. package/dist/vendor-vueuse-components-B0zqjNRW.js +0 -542
  449. package/dist/vendor-vueuse-core-CYgwn-B2.js +0 -5130
  450. package/dist/vendor-vueuse-shared-B_uDJJ6V.js +0 -1169
  451. package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
@@ -1,3748 +0,0 @@
1
- import { N as D, S as he, T as x, A as Sn } from "./vendor-prosemirror-state-CRUasa1V.js";
2
- import { S as J, D as Re, F as _, d as qt, M as Cn } from "./vendor-prosemirror-model-CVTn1Stc.js";
3
- import { d as On } from "./vendor-prosemirror-transform-BeDaI3CS.js";
4
- const C = function(t) {
5
- for (var e = 0; ; e++)
6
- if (t = t.previousSibling, !t)
7
- return e;
8
- }, ue = function(t) {
9
- let e = t.assignedSlot || t.parentNode;
10
- return e && e.nodeType == 11 ? e.host : e;
11
- };
12
- let He = null;
13
- const K = function(t, e, n) {
14
- let o = He || (He = document.createRange());
15
- return o.setEnd(t, n ?? t.nodeValue.length), o.setStart(t, e || 0), o;
16
- }, Mn = function() {
17
- He = null;
18
- }, re = function(t, e, n, o) {
19
- return n && (rt(t, e, n, o, -1) || rt(t, e, n, o, 1));
20
- }, xn = /^(img|br|input|textarea|hr)$/i;
21
- function rt(t, e, n, o, i) {
22
- for (var s; ; ) {
23
- if (t == n && e == o)
24
- return !0;
25
- if (e == (i < 0 ? 0 : B(t))) {
26
- let r = t.parentNode;
27
- if (!r || r.nodeType != 1 || Ce(t) || xn.test(t.nodeName) || t.contentEditable == "false")
28
- return !1;
29
- e = C(t) + (i < 0 ? 0 : 1), t = r;
30
- } else if (t.nodeType == 1) {
31
- let r = t.childNodes[e + (i < 0 ? -1 : 0)];
32
- if (r.nodeType == 1 && r.contentEditable == "false")
33
- if (!((s = r.pmViewDesc) === null || s === void 0) && s.ignoreForSelection)
34
- e += i;
35
- else
36
- return !1;
37
- else
38
- t = r, e = i < 0 ? B(t) : 0;
39
- } else
40
- return !1;
41
- }
42
- }
43
- function B(t) {
44
- return t.nodeType == 3 ? t.nodeValue.length : t.childNodes.length;
45
- }
46
- function kn(t, e) {
47
- for (; ; ) {
48
- if (t.nodeType == 3 && e)
49
- return t;
50
- if (t.nodeType == 1 && e > 0) {
51
- if (t.contentEditable == "false")
52
- return null;
53
- t = t.childNodes[e - 1], e = B(t);
54
- } else if (t.parentNode && !Ce(t))
55
- e = C(t), t = t.parentNode;
56
- else
57
- return null;
58
- }
59
- }
60
- function Tn(t, e) {
61
- for (; ; ) {
62
- if (t.nodeType == 3 && e < t.nodeValue.length)
63
- return t;
64
- if (t.nodeType == 1 && e < t.childNodes.length) {
65
- if (t.contentEditable == "false")
66
- return null;
67
- t = t.childNodes[e], e = 0;
68
- } else if (t.parentNode && !Ce(t))
69
- e = C(t) + 1, t = t.parentNode;
70
- else
71
- return null;
72
- }
73
- }
74
- function An(t, e, n) {
75
- for (let o = e == 0, i = e == B(t); o || i; ) {
76
- if (t == n)
77
- return !0;
78
- let s = C(t);
79
- if (t = t.parentNode, !t)
80
- return !1;
81
- o = o && s == 0, i = i && s == B(t);
82
- }
83
- }
84
- function Ce(t) {
85
- let e;
86
- for (let n = t; n && !(e = n.pmViewDesc); n = n.parentNode)
87
- ;
88
- return e && e.node && e.node.isBlock && (e.dom == t || e.contentDOM == t);
89
- }
90
- const Be = function(t) {
91
- return t.focusNode && re(t.focusNode, t.focusOffset, t.anchorNode, t.anchorOffset);
92
- };
93
- function te(t, e) {
94
- let n = document.createEvent("Event");
95
- return n.initEvent("keydown", !0, !0), n.keyCode = t, n.key = n.code = e, n;
96
- }
97
- function En(t) {
98
- let e = t.activeElement;
99
- for (; e && e.shadowRoot; )
100
- e = e.shadowRoot.activeElement;
101
- return e;
102
- }
103
- function Pn(t, e, n) {
104
- if (t.caretPositionFromPoint)
105
- try {
106
- let o = t.caretPositionFromPoint(e, n);
107
- if (o)
108
- return { node: o.offsetNode, offset: Math.min(B(o.offsetNode), o.offset) };
109
- } catch {
110
- }
111
- if (t.caretRangeFromPoint) {
112
- let o = t.caretRangeFromPoint(e, n);
113
- if (o)
114
- return { node: o.startContainer, offset: Math.min(B(o.startContainer), o.startOffset) };
115
- }
116
- }
117
- const L = typeof navigator < "u" ? navigator : null, lt = typeof document < "u" ? document : null, v = L && L.userAgent || "", We = /Edge\/(\d+)/.exec(v), Kt = /MSIE \d/.exec(v), _e = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(v), P = !!(Kt || _e || We), Z = Kt ? document.documentMode : _e ? +_e[1] : We ? +We[1] : 0, z = !P && /gecko\/(\d+)/i.test(v);
118
- z && +(/Firefox\/(\d+)/.exec(v) || [0, 0])[1];
119
- const je = !P && /Chrome\/(\d+)/.exec(v), M = !!je, Ht = je ? +je[1] : 0, k = !P && !!L && /Apple Computer/.test(L.vendor), pe = k && (/Mobile\/\w+/.test(v) || !!L && L.maxTouchPoints > 2), R = pe || (L ? /Mac/.test(L.platform) : !1), Vn = L ? /Win/.test(L.platform) : !1, H = /Android \d/.test(v), Oe = !!lt && "webkitFontSmoothing" in lt.documentElement.style, Rn = Oe ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
120
- function Bn(t) {
121
- let e = t.defaultView && t.defaultView.visualViewport;
122
- return e ? {
123
- left: 0,
124
- right: e.width,
125
- top: 0,
126
- bottom: e.height
127
- } : {
128
- left: 0,
129
- right: t.documentElement.clientWidth,
130
- top: 0,
131
- bottom: t.documentElement.clientHeight
132
- };
133
- }
134
- function q(t, e) {
135
- return typeof t == "number" ? t : t[e];
136
- }
137
- function In(t) {
138
- let e = t.getBoundingClientRect(), n = e.width / t.offsetWidth || 1, o = e.height / t.offsetHeight || 1;
139
- return {
140
- left: e.left,
141
- right: e.left + t.clientWidth * n,
142
- top: e.top,
143
- bottom: e.top + t.clientHeight * o
144
- };
145
- }
146
- function at(t, e, n) {
147
- let o = t.someProp("scrollThreshold") || 0, i = t.someProp("scrollMargin") || 5, s = t.dom.ownerDocument;
148
- for (let r = n || t.dom; r; ) {
149
- if (r.nodeType != 1) {
150
- r = ue(r);
151
- continue;
152
- }
153
- let l = r, a = l == s.body, c = a ? Bn(s) : In(l), d = 0, f = 0;
154
- if (e.top < c.top + q(o, "top") ? f = -(c.top - e.top + q(i, "top")) : e.bottom > c.bottom - q(o, "bottom") && (f = e.bottom - e.top > c.bottom - c.top ? e.top + q(i, "top") - c.top : e.bottom - c.bottom + q(i, "bottom")), e.left < c.left + q(o, "left") ? d = -(c.left - e.left + q(i, "left")) : e.right > c.right - q(o, "right") && (d = e.right - c.right + q(i, "right")), d || f)
155
- if (a)
156
- s.defaultView.scrollBy(d, f);
157
- else {
158
- let p = l.scrollLeft, h = l.scrollTop;
159
- f && (l.scrollTop += f), d && (l.scrollLeft += d);
160
- let g = l.scrollLeft - p, m = l.scrollTop - h;
161
- e = { left: e.left - g, top: e.top - m, right: e.right - g, bottom: e.bottom - m };
162
- }
163
- let u = a ? "fixed" : getComputedStyle(r).position;
164
- if (/^(fixed|sticky)$/.test(u))
165
- break;
166
- r = u == "absolute" ? r.offsetParent : ue(r);
167
- }
168
- }
169
- function Fn(t) {
170
- let e = t.dom.getBoundingClientRect(), n = Math.max(0, e.top), o, i;
171
- for (let s = (e.left + e.right) / 2, r = n + 1; r < Math.min(innerHeight, e.bottom); r += 5) {
172
- let l = t.root.elementFromPoint(s, r);
173
- if (!l || l == t.dom || !t.dom.contains(l))
174
- continue;
175
- let a = l.getBoundingClientRect();
176
- if (a.top >= n - 20) {
177
- o = l, i = a.top;
178
- break;
179
- }
180
- }
181
- return { refDOM: o, refTop: i, stack: Wt(t.dom) };
182
- }
183
- function Wt(t) {
184
- let e = [], n = t.ownerDocument;
185
- for (let o = t; o && (e.push({ dom: o, top: o.scrollTop, left: o.scrollLeft }), t != n); o = ue(o))
186
- ;
187
- return e;
188
- }
189
- function zn({ refDOM: t, refTop: e, stack: n }) {
190
- let o = t ? t.getBoundingClientRect().top : 0;
191
- _t(n, o == 0 ? 0 : o - e);
192
- }
193
- function _t(t, e) {
194
- for (let n = 0; n < t.length; n++) {
195
- let { dom: o, top: i, left: s } = t[n];
196
- o.scrollTop != i + e && (o.scrollTop = i + e), o.scrollLeft != s && (o.scrollLeft = s);
197
- }
198
- }
199
- let ae = null;
200
- function Ln(t) {
201
- if (t.setActive)
202
- return t.setActive();
203
- if (ae)
204
- return t.focus(ae);
205
- let e = Wt(t);
206
- t.focus(ae == null ? {
207
- get preventScroll() {
208
- return ae = { preventScroll: !0 }, !0;
209
- }
210
- } : void 0), ae || (ae = !1, _t(e, 0));
211
- }
212
- function jt(t, e) {
213
- let n, o = 2e8, i, s = 0, r = e.top, l = e.top, a, c;
214
- for (let d = t.firstChild, f = 0; d; d = d.nextSibling, f++) {
215
- let u;
216
- if (d.nodeType == 1)
217
- u = d.getClientRects();
218
- else if (d.nodeType == 3)
219
- u = K(d).getClientRects();
220
- else
221
- continue;
222
- for (let p = 0; p < u.length; p++) {
223
- let h = u[p];
224
- if (h.top <= r && h.bottom >= l) {
225
- r = Math.max(h.bottom, r), l = Math.min(h.top, l);
226
- let g = h.left > e.left ? h.left - e.left : h.right < e.left ? e.left - h.right : 0;
227
- if (g < o) {
228
- n = d, o = g, i = g && n.nodeType == 3 ? {
229
- left: h.right < e.left ? h.right : h.left,
230
- top: e.top
231
- } : e, d.nodeType == 1 && g && (s = f + (e.left >= (h.left + h.right) / 2 ? 1 : 0));
232
- continue;
233
- }
234
- } else h.top > e.top && !a && h.left <= e.left && h.right >= e.left && (a = d, c = { left: Math.max(h.left, Math.min(h.right, e.left)), top: h.top });
235
- !n && (e.left >= h.right && e.top >= h.top || e.left >= h.left && e.top >= h.bottom) && (s = f + 1);
236
- }
237
- }
238
- return !n && a && (n = a, i = c, o = 0), n && n.nodeType == 3 ? $n(n, i) : !n || o && n.nodeType == 1 ? { node: t, offset: s } : jt(n, i);
239
- }
240
- function $n(t, e) {
241
- let n = t.nodeValue.length, o = document.createRange();
242
- for (let i = 0; i < n; i++) {
243
- o.setEnd(t, i + 1), o.setStart(t, i);
244
- let s = U(o, 1);
245
- if (s.top != s.bottom && Qe(e, s))
246
- return { node: t, offset: i + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
247
- }
248
- return { node: t, offset: 0 };
249
- }
250
- function Qe(t, e) {
251
- return t.left >= e.left - 1 && t.left <= e.right + 1 && t.top >= e.top - 1 && t.top <= e.bottom + 1;
252
- }
253
- function qn(t, e) {
254
- let n = t.parentNode;
255
- return n && /^li$/i.test(n.nodeName) && e.left < t.getBoundingClientRect().left ? n : t;
256
- }
257
- function Kn(t, e, n) {
258
- let { node: o, offset: i } = jt(e, n), s = -1;
259
- if (o.nodeType == 1 && !o.firstChild) {
260
- let r = o.getBoundingClientRect();
261
- s = r.left != r.right && n.left > (r.left + r.right) / 2 ? 1 : -1;
262
- }
263
- return t.docView.posFromDOM(o, i, s);
264
- }
265
- function Hn(t, e, n, o) {
266
- let i = -1;
267
- for (let s = e, r = !1; s != t.dom; ) {
268
- let l = t.docView.nearestDesc(s, !0), a;
269
- if (!l)
270
- return null;
271
- if (l.dom.nodeType == 1 && (l.node.isBlock && l.parent || !l.contentDOM) && // Ignore elements with zero-size bounding rectangles
272
- ((a = l.dom.getBoundingClientRect()).width || a.height) && (l.node.isBlock && l.parent && (!r && a.left > o.left || a.top > o.top ? i = l.posBefore : (!r && a.right < o.left || a.bottom < o.top) && (i = l.posAfter), r = !0), !l.contentDOM && i < 0 && !l.node.isText))
273
- return (l.node.isBlock ? o.top < (a.top + a.bottom) / 2 : o.left < (a.left + a.right) / 2) ? l.posBefore : l.posAfter;
274
- s = l.dom.parentNode;
275
- }
276
- return i > -1 ? i : t.docView.posFromDOM(e, n, -1);
277
- }
278
- function Ut(t, e, n) {
279
- let o = t.childNodes.length;
280
- if (o && n.top < n.bottom)
281
- for (let i = Math.max(0, Math.min(o - 1, Math.floor(o * (e.top - n.top) / (n.bottom - n.top)) - 2)), s = i; ; ) {
282
- let r = t.childNodes[s];
283
- if (r.nodeType == 1) {
284
- let l = r.getClientRects();
285
- for (let a = 0; a < l.length; a++) {
286
- let c = l[a];
287
- if (Qe(e, c))
288
- return Ut(r, e, c);
289
- }
290
- }
291
- if ((s = (s + 1) % o) == i)
292
- break;
293
- }
294
- return t;
295
- }
296
- function Wn(t, e) {
297
- let n = t.dom.ownerDocument, o, i = 0, s = Pn(n, e.left, e.top);
298
- s && ({ node: o, offset: i } = s);
299
- let r = (t.root.elementFromPoint ? t.root : n).elementFromPoint(e.left, e.top), l;
300
- if (!r || !t.dom.contains(r.nodeType != 1 ? r.parentNode : r)) {
301
- let c = t.dom.getBoundingClientRect();
302
- if (!Qe(e, c) || (r = Ut(t.dom, e, c), !r))
303
- return null;
304
- }
305
- if (k)
306
- for (let c = r; o && c; c = ue(c))
307
- c.draggable && (o = void 0);
308
- if (r = qn(r, e), o) {
309
- if (z && o.nodeType == 1 && (i = Math.min(i, o.childNodes.length), i < o.childNodes.length)) {
310
- let d = o.childNodes[i], f;
311
- d.nodeName == "IMG" && (f = d.getBoundingClientRect()).right <= e.left && f.bottom > e.top && i++;
312
- }
313
- let c;
314
- Oe && i && o.nodeType == 1 && (c = o.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, o == t.dom && i == o.childNodes.length - 1 && o.lastChild.nodeType == 1 && e.top > o.lastChild.getBoundingClientRect().bottom ? l = t.state.doc.content.size : (i == 0 || o.nodeType != 1 || o.childNodes[i - 1].nodeName != "BR") && (l = Hn(t, o, i, e));
315
- }
316
- l == null && (l = Kn(t, r, e));
317
- let a = t.docView.nearestDesc(r, !0);
318
- return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
319
- }
320
- function ct(t) {
321
- return t.top < t.bottom || t.left < t.right;
322
- }
323
- function U(t, e) {
324
- let n = t.getClientRects();
325
- if (n.length) {
326
- let o = n[e < 0 ? 0 : n.length - 1];
327
- if (ct(o))
328
- return o;
329
- }
330
- return Array.prototype.find.call(n, ct) || t.getBoundingClientRect();
331
- }
332
- const _n = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
333
- function Yt(t, e, n) {
334
- let { node: o, offset: i, atom: s } = t.docView.domFromPos(e, n < 0 ? -1 : 1), r = Oe || z;
335
- if (o.nodeType == 3)
336
- if (r && (_n.test(o.nodeValue) || (n < 0 ? !i : i == o.nodeValue.length))) {
337
- let a = U(K(o, i, i), n);
338
- if (z && i && /\s/.test(o.nodeValue[i - 1]) && i < o.nodeValue.length) {
339
- let c = U(K(o, i - 1, i - 1), -1);
340
- if (c.top == a.top) {
341
- let d = U(K(o, i, i + 1), -1);
342
- if (d.top != a.top)
343
- return ge(d, d.left < c.left);
344
- }
345
- }
346
- return a;
347
- } else {
348
- let a = i, c = i, d = n < 0 ? 1 : -1;
349
- return n < 0 && !i ? (c++, d = -1) : n >= 0 && i == o.nodeValue.length ? (a--, d = 1) : n < 0 ? a-- : c++, ge(U(K(o, a, c), d), d < 0);
350
- }
351
- if (!t.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
352
- if (s == null && i && (n < 0 || i == B(o))) {
353
- let a = o.childNodes[i - 1];
354
- if (a.nodeType == 1)
355
- return ze(a.getBoundingClientRect(), !1);
356
- }
357
- if (s == null && i < B(o)) {
358
- let a = o.childNodes[i];
359
- if (a.nodeType == 1)
360
- return ze(a.getBoundingClientRect(), !0);
361
- }
362
- return ze(o.getBoundingClientRect(), n >= 0);
363
- }
364
- if (s == null && i && (n < 0 || i == B(o))) {
365
- let a = o.childNodes[i - 1], c = a.nodeType == 3 ? K(a, B(a) - (r ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
366
- if (c)
367
- return ge(U(c, 1), !1);
368
- }
369
- if (s == null && i < B(o)) {
370
- let a = o.childNodes[i];
371
- for (; a.pmViewDesc && a.pmViewDesc.ignoreForCoords; )
372
- a = a.nextSibling;
373
- let c = a ? a.nodeType == 3 ? K(a, 0, r ? 0 : 1) : a.nodeType == 1 ? a : null : null;
374
- if (c)
375
- return ge(U(c, -1), !0);
376
- }
377
- return ge(U(o.nodeType == 3 ? K(o) : o, -n), n >= 0);
378
- }
379
- function ge(t, e) {
380
- if (t.width == 0)
381
- return t;
382
- let n = e ? t.left : t.right;
383
- return { top: t.top, bottom: t.bottom, left: n, right: n };
384
- }
385
- function ze(t, e) {
386
- if (t.height == 0)
387
- return t;
388
- let n = e ? t.top : t.bottom;
389
- return { top: n, bottom: n, left: t.left, right: t.right };
390
- }
391
- function Gt(t, e, n) {
392
- let o = t.state, i = t.root.activeElement;
393
- o != e && t.updateState(e), i != t.dom && t.focus();
394
- try {
395
- return n();
396
- } finally {
397
- o != e && t.updateState(o), i != t.dom && i && i.focus();
398
- }
399
- }
400
- function jn(t, e, n) {
401
- let o = e.selection, i = n == "up" ? o.$from : o.$to;
402
- return Gt(t, e, () => {
403
- let { node: s } = t.docView.domFromPos(i.pos, n == "up" ? -1 : 1);
404
- for (; ; ) {
405
- let l = t.docView.nearestDesc(s, !0);
406
- if (!l)
407
- break;
408
- if (l.node.isBlock) {
409
- s = l.contentDOM || l.dom;
410
- break;
411
- }
412
- s = l.dom.parentNode;
413
- }
414
- let r = Yt(t, i.pos, 1);
415
- for (let l = s.firstChild; l; l = l.nextSibling) {
416
- let a;
417
- if (l.nodeType == 1)
418
- a = l.getClientRects();
419
- else if (l.nodeType == 3)
420
- a = K(l, 0, l.nodeValue.length).getClientRects();
421
- else
422
- continue;
423
- for (let c = 0; c < a.length; c++) {
424
- let d = a[c];
425
- if (d.bottom > d.top + 1 && (n == "up" ? r.top - d.top > (d.bottom - r.top) * 2 : d.bottom - r.bottom > (r.bottom - d.top) * 2))
426
- return !1;
427
- }
428
- }
429
- return !0;
430
- });
431
- }
432
- const Un = /[\u0590-\u08ac]/;
433
- function Yn(t, e, n) {
434
- let { $head: o } = e.selection;
435
- if (!o.parent.isTextblock)
436
- return !1;
437
- let i = o.parentOffset, s = !i, r = i == o.parent.content.size, l = t.domSelection();
438
- return l ? !Un.test(o.parent.textContent) || !l.modify ? n == "left" || n == "backward" ? s : r : Gt(t, e, () => {
439
- let { focusNode: a, focusOffset: c, anchorNode: d, anchorOffset: f } = t.domSelectionRange(), u = l.caretBidiLevel;
440
- l.modify("move", n, "character");
441
- let p = o.depth ? t.docView.domAfterPos(o.before()) : t.dom, { focusNode: h, focusOffset: g } = t.domSelectionRange(), m = h && !p.contains(h.nodeType == 1 ? h : h.parentNode) || a == h && c == g;
442
- try {
443
- l.collapse(d, f), a && (a != d || c != f) && l.extend && l.extend(a, c);
444
- } catch {
445
- }
446
- return u != null && (l.caretBidiLevel = u), m;
447
- }) : o.pos == o.start() || o.pos == o.end();
448
- }
449
- let dt = null, ft = null, ht = !1;
450
- function Gn(t, e, n) {
451
- return dt == e && ft == n ? ht : (dt = e, ft = n, ht = n == "up" || n == "down" ? jn(t, e, n) : Yn(t, e, n));
452
- }
453
- const I = 0, ut = 1, ne = 2, $ = 3;
454
- class Me {
455
- constructor(e, n, o, i) {
456
- this.parent = e, this.children = n, this.dom = o, this.contentDOM = i, this.dirty = I, o.pmViewDesc = this;
457
- }
458
- // Used to check whether a given description corresponds to a
459
- // widget/mark/node.
460
- matchesWidget(e) {
461
- return !1;
462
- }
463
- matchesMark(e) {
464
- return !1;
465
- }
466
- matchesNode(e, n, o) {
467
- return !1;
468
- }
469
- matchesHack(e) {
470
- return !1;
471
- }
472
- // When parsing in-editor content (in domchange.js), we allow
473
- // descriptions to determine the parse rules that should be used to
474
- // parse them.
475
- parseRule() {
476
- return null;
477
- }
478
- // Used by the editor's event handler to ignore events that come
479
- // from certain descs.
480
- stopEvent(e) {
481
- return !1;
482
- }
483
- // The size of the content represented by this desc.
484
- get size() {
485
- let e = 0;
486
- for (let n = 0; n < this.children.length; n++)
487
- e += this.children[n].size;
488
- return e;
489
- }
490
- // For block nodes, this represents the space taken up by their
491
- // start/end tokens.
492
- get border() {
493
- return 0;
494
- }
495
- destroy() {
496
- this.parent = void 0, this.dom.pmViewDesc == this && (this.dom.pmViewDesc = void 0);
497
- for (let e = 0; e < this.children.length; e++)
498
- this.children[e].destroy();
499
- }
500
- posBeforeChild(e) {
501
- for (let n = 0, o = this.posAtStart; ; n++) {
502
- let i = this.children[n];
503
- if (i == e)
504
- return o;
505
- o += i.size;
506
- }
507
- }
508
- get posBefore() {
509
- return this.parent.posBeforeChild(this);
510
- }
511
- get posAtStart() {
512
- return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
513
- }
514
- get posAfter() {
515
- return this.posBefore + this.size;
516
- }
517
- get posAtEnd() {
518
- return this.posAtStart + this.size - 2 * this.border;
519
- }
520
- localPosFromDOM(e, n, o) {
521
- if (this.contentDOM && this.contentDOM.contains(e.nodeType == 1 ? e : e.parentNode))
522
- if (o < 0) {
523
- let s, r;
524
- if (e == this.contentDOM)
525
- s = e.childNodes[n - 1];
526
- else {
527
- for (; e.parentNode != this.contentDOM; )
528
- e = e.parentNode;
529
- s = e.previousSibling;
530
- }
531
- for (; s && !((r = s.pmViewDesc) && r.parent == this); )
532
- s = s.previousSibling;
533
- return s ? this.posBeforeChild(r) + r.size : this.posAtStart;
534
- } else {
535
- let s, r;
536
- if (e == this.contentDOM)
537
- s = e.childNodes[n];
538
- else {
539
- for (; e.parentNode != this.contentDOM; )
540
- e = e.parentNode;
541
- s = e.nextSibling;
542
- }
543
- for (; s && !((r = s.pmViewDesc) && r.parent == this); )
544
- s = s.nextSibling;
545
- return s ? this.posBeforeChild(r) : this.posAtEnd;
546
- }
547
- let i;
548
- if (e == this.dom && this.contentDOM)
549
- i = n > C(this.contentDOM);
550
- else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
551
- i = e.compareDocumentPosition(this.contentDOM) & 2;
552
- else if (this.dom.firstChild) {
553
- if (n == 0)
554
- for (let s = e; ; s = s.parentNode) {
555
- if (s == this.dom) {
556
- i = !1;
557
- break;
558
- }
559
- if (s.previousSibling)
560
- break;
561
- }
562
- if (i == null && n == e.childNodes.length)
563
- for (let s = e; ; s = s.parentNode) {
564
- if (s == this.dom) {
565
- i = !0;
566
- break;
567
- }
568
- if (s.nextSibling)
569
- break;
570
- }
571
- }
572
- return i ?? o > 0 ? this.posAtEnd : this.posAtStart;
573
- }
574
- nearestDesc(e, n = !1) {
575
- for (let o = !0, i = e; i; i = i.parentNode) {
576
- let s = this.getDesc(i), r;
577
- if (s && (!n || s.node))
578
- if (o && (r = s.nodeDOM) && !(r.nodeType == 1 ? r.contains(e.nodeType == 1 ? e : e.parentNode) : r == e))
579
- o = !1;
580
- else
581
- return s;
582
- }
583
- }
584
- getDesc(e) {
585
- let n = e.pmViewDesc;
586
- for (let o = n; o; o = o.parent)
587
- if (o == this)
588
- return n;
589
- }
590
- posFromDOM(e, n, o) {
591
- for (let i = e; i; i = i.parentNode) {
592
- let s = this.getDesc(i);
593
- if (s)
594
- return s.localPosFromDOM(e, n, o);
595
- }
596
- return -1;
597
- }
598
- // Find the desc for the node after the given pos, if any. (When a
599
- // parent node overrode rendering, there might not be one.)
600
- descAt(e) {
601
- for (let n = 0, o = 0; n < this.children.length; n++) {
602
- let i = this.children[n], s = o + i.size;
603
- if (o == e && s != o) {
604
- for (; !i.border && i.children.length; )
605
- for (let r = 0; r < i.children.length; r++) {
606
- let l = i.children[r];
607
- if (l.size) {
608
- i = l;
609
- break;
610
- }
611
- }
612
- return i;
613
- }
614
- if (e < s)
615
- return i.descAt(e - o - i.border);
616
- o = s;
617
- }
618
- }
619
- domFromPos(e, n) {
620
- if (!this.contentDOM)
621
- return { node: this.dom, offset: 0, atom: e + 1 };
622
- let o = 0, i = 0;
623
- for (let s = 0; o < this.children.length; o++) {
624
- let r = this.children[o], l = s + r.size;
625
- if (l > e || r instanceof Jt) {
626
- i = e - s;
627
- break;
628
- }
629
- s = l;
630
- }
631
- if (i)
632
- return this.children[o].domFromPos(i - this.children[o].border, n);
633
- for (let s; o && !(s = this.children[o - 1]).size && s instanceof Xt && s.side >= 0; o--)
634
- ;
635
- if (n <= 0) {
636
- let s, r = !0;
637
- for (; s = o ? this.children[o - 1] : null, !(!s || s.dom.parentNode == this.contentDOM); o--, r = !1)
638
- ;
639
- return s && n && r && !s.border && !s.domAtom ? s.domFromPos(s.size, n) : { node: this.contentDOM, offset: s ? C(s.dom) + 1 : 0 };
640
- } else {
641
- let s, r = !0;
642
- for (; s = o < this.children.length ? this.children[o] : null, !(!s || s.dom.parentNode == this.contentDOM); o++, r = !1)
643
- ;
644
- return s && r && !s.border && !s.domAtom ? s.domFromPos(0, n) : { node: this.contentDOM, offset: s ? C(s.dom) : this.contentDOM.childNodes.length };
645
- }
646
- }
647
- // Used to find a DOM range in a single parent for a given changed
648
- // range.
649
- parseRange(e, n, o = 0) {
650
- if (this.children.length == 0)
651
- return { node: this.contentDOM, from: e, to: n, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
652
- let i = -1, s = -1;
653
- for (let r = o, l = 0; ; l++) {
654
- let a = this.children[l], c = r + a.size;
655
- if (i == -1 && e <= c) {
656
- let d = r + a.border;
657
- if (e >= d && n <= c - a.border && a.node && a.contentDOM && this.contentDOM.contains(a.contentDOM))
658
- return a.parseRange(e, n, d);
659
- e = r;
660
- for (let f = l; f > 0; f--) {
661
- let u = this.children[f - 1];
662
- if (u.size && u.dom.parentNode == this.contentDOM && !u.emptyChildAt(1)) {
663
- i = C(u.dom) + 1;
664
- break;
665
- }
666
- e -= u.size;
667
- }
668
- i == -1 && (i = 0);
669
- }
670
- if (i > -1 && (c > n || l == this.children.length - 1)) {
671
- n = c;
672
- for (let d = l + 1; d < this.children.length; d++) {
673
- let f = this.children[d];
674
- if (f.size && f.dom.parentNode == this.contentDOM && !f.emptyChildAt(-1)) {
675
- s = C(f.dom);
676
- break;
677
- }
678
- n += f.size;
679
- }
680
- s == -1 && (s = this.contentDOM.childNodes.length);
681
- break;
682
- }
683
- r = c;
684
- }
685
- return { node: this.contentDOM, from: e, to: n, fromOffset: i, toOffset: s };
686
- }
687
- emptyChildAt(e) {
688
- if (this.border || !this.contentDOM || !this.children.length)
689
- return !1;
690
- let n = this.children[e < 0 ? 0 : this.children.length - 1];
691
- return n.size == 0 || n.emptyChildAt(e);
692
- }
693
- domAfterPos(e) {
694
- let { node: n, offset: o } = this.domFromPos(e, 0);
695
- if (n.nodeType != 1 || o == n.childNodes.length)
696
- throw new RangeError("No node after pos " + e);
697
- return n.childNodes[o];
698
- }
699
- // View descs are responsible for setting any selection that falls
700
- // entirely inside of them, so that custom implementations can do
701
- // custom things with the selection. Note that this falls apart when
702
- // a selection starts in such a node and ends in another, in which
703
- // case we just use whatever domFromPos produces as a best effort.
704
- setSelection(e, n, o, i = !1) {
705
- let s = Math.min(e, n), r = Math.max(e, n);
706
- for (let p = 0, h = 0; p < this.children.length; p++) {
707
- let g = this.children[p], m = h + g.size;
708
- if (s > h && r < m)
709
- return g.setSelection(e - h - g.border, n - h - g.border, o, i);
710
- h = m;
711
- }
712
- let l = this.domFromPos(e, e ? -1 : 1), a = n == e ? l : this.domFromPos(n, n ? -1 : 1), c = o.root.getSelection(), d = o.domSelectionRange(), f = !1;
713
- if ((z || k) && e == n) {
714
- let { node: p, offset: h } = l;
715
- if (p.nodeType == 3) {
716
- if (f = !!(h && p.nodeValue[h - 1] == `
717
- `), f && h == p.nodeValue.length)
718
- for (let g = p, m; g; g = g.parentNode) {
719
- if (m = g.nextSibling) {
720
- m.nodeName == "BR" && (l = a = { node: m.parentNode, offset: C(m) + 1 });
721
- break;
722
- }
723
- let y = g.pmViewDesc;
724
- if (y && y.node && y.node.isBlock)
725
- break;
726
- }
727
- } else {
728
- let g = p.childNodes[h - 1];
729
- f = g && (g.nodeName == "BR" || g.contentEditable == "false");
730
- }
731
- }
732
- if (z && d.focusNode && d.focusNode != a.node && d.focusNode.nodeType == 1) {
733
- let p = d.focusNode.childNodes[d.focusOffset];
734
- p && p.contentEditable == "false" && (i = !0);
735
- }
736
- if (!(i || f && k) && re(l.node, l.offset, d.anchorNode, d.anchorOffset) && re(a.node, a.offset, d.focusNode, d.focusOffset))
737
- return;
738
- let u = !1;
739
- if ((c.extend || e == n) && !f) {
740
- c.collapse(l.node, l.offset);
741
- try {
742
- e != n && c.extend(a.node, a.offset), u = !0;
743
- } catch {
744
- }
745
- }
746
- if (!u) {
747
- if (e > n) {
748
- let h = l;
749
- l = a, a = h;
750
- }
751
- let p = document.createRange();
752
- p.setEnd(a.node, a.offset), p.setStart(l.node, l.offset), c.removeAllRanges(), c.addRange(p);
753
- }
754
- }
755
- ignoreMutation(e) {
756
- return !this.contentDOM && e.type != "selection";
757
- }
758
- get contentLost() {
759
- return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
760
- }
761
- // Remove a subtree of the element tree that has been touched
762
- // by a DOM change, so that the next update will redraw it.
763
- markDirty(e, n) {
764
- for (let o = 0, i = 0; i < this.children.length; i++) {
765
- let s = this.children[i], r = o + s.size;
766
- if (o == r ? e <= r && n >= o : e < r && n > o) {
767
- let l = o + s.border, a = r - s.border;
768
- if (e >= l && n <= a) {
769
- this.dirty = e == o || n == r ? ne : ut, e == l && n == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = $ : s.markDirty(e - l, n - l);
770
- return;
771
- } else
772
- s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? ne : $;
773
- }
774
- o = r;
775
- }
776
- this.dirty = ne;
777
- }
778
- markParentsDirty() {
779
- let e = 1;
780
- for (let n = this.parent; n; n = n.parent, e++) {
781
- let o = e == 1 ? ne : ut;
782
- n.dirty < o && (n.dirty = o);
783
- }
784
- }
785
- get domAtom() {
786
- return !1;
787
- }
788
- get ignoreForCoords() {
789
- return !1;
790
- }
791
- get ignoreForSelection() {
792
- return !1;
793
- }
794
- isText(e) {
795
- return !1;
796
- }
797
- }
798
- class Xt extends Me {
799
- constructor(e, n, o, i) {
800
- let s, r = n.type.toDOM;
801
- if (typeof r == "function" && (r = r(o, () => {
802
- if (!s)
803
- return i;
804
- if (s.parent)
805
- return s.parent.posBeforeChild(s);
806
- })), !n.type.spec.raw) {
807
- if (r.nodeType != 1) {
808
- let l = document.createElement("span");
809
- l.appendChild(r), r = l;
810
- }
811
- r.contentEditable = "false", r.classList.add("ProseMirror-widget");
812
- }
813
- super(e, [], r, null), this.widget = n, this.widget = n, s = this;
814
- }
815
- matchesWidget(e) {
816
- return this.dirty == I && e.type.eq(this.widget.type);
817
- }
818
- parseRule() {
819
- return { ignore: !0 };
820
- }
821
- stopEvent(e) {
822
- let n = this.widget.spec.stopEvent;
823
- return n ? n(e) : !1;
824
- }
825
- ignoreMutation(e) {
826
- return e.type != "selection" || this.widget.spec.ignoreSelection;
827
- }
828
- destroy() {
829
- this.widget.type.destroy(this.dom), super.destroy();
830
- }
831
- get domAtom() {
832
- return !0;
833
- }
834
- get ignoreForSelection() {
835
- return !!this.widget.type.spec.relaxedSide;
836
- }
837
- get side() {
838
- return this.widget.type.side;
839
- }
840
- }
841
- class Xn extends Me {
842
- constructor(e, n, o, i) {
843
- super(e, [], n, null), this.textDOM = o, this.text = i;
844
- }
845
- get size() {
846
- return this.text.length;
847
- }
848
- localPosFromDOM(e, n) {
849
- return e != this.textDOM ? this.posAtStart + (n ? this.size : 0) : this.posAtStart + n;
850
- }
851
- domFromPos(e) {
852
- return { node: this.textDOM, offset: e };
853
- }
854
- ignoreMutation(e) {
855
- return e.type === "characterData" && e.target.nodeValue == e.oldValue;
856
- }
857
- }
858
- class le extends Me {
859
- constructor(e, n, o, i, s) {
860
- super(e, [], o, i), this.mark = n, this.spec = s;
861
- }
862
- static create(e, n, o, i) {
863
- let s = i.nodeViews[n.type.name], r = s && s(n, i, o);
864
- return (!r || !r.dom) && (r = Re.renderSpec(document, n.type.spec.toDOM(n, o), null, n.attrs)), new le(e, n, r.dom, r.contentDOM || r.dom, r);
865
- }
866
- parseRule() {
867
- return this.dirty & $ || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
868
- }
869
- matchesMark(e) {
870
- return this.dirty != $ && this.mark.eq(e);
871
- }
872
- markDirty(e, n) {
873
- if (super.markDirty(e, n), this.dirty != I) {
874
- let o = this.parent;
875
- for (; !o.node; )
876
- o = o.parent;
877
- o.dirty < this.dirty && (o.dirty = this.dirty), this.dirty = I;
878
- }
879
- }
880
- slice(e, n, o) {
881
- let i = le.create(this.parent, this.mark, !0, o), s = this.children, r = this.size;
882
- n < r && (s = Ye(s, n, r, o)), e > 0 && (s = Ye(s, 0, e, o));
883
- for (let l = 0; l < s.length; l++)
884
- s[l].parent = i;
885
- return i.children = s, i;
886
- }
887
- ignoreMutation(e) {
888
- return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
889
- }
890
- destroy() {
891
- this.spec.destroy && this.spec.destroy(), super.destroy();
892
- }
893
- }
894
- class Q extends Me {
895
- constructor(e, n, o, i, s, r, l, a, c) {
896
- super(e, [], s, r), this.node = n, this.outerDeco = o, this.innerDeco = i, this.nodeDOM = l;
897
- }
898
- // By default, a node is rendered using the `toDOM` method from the
899
- // node type spec. But client code can use the `nodeViews` spec to
900
- // supply a custom node view, which can influence various aspects of
901
- // the way the node works.
902
- //
903
- // (Using subclassing for this was intentionally decided against,
904
- // since it'd require exposing a whole slew of finicky
905
- // implementation details to the user code that they probably will
906
- // never need.)
907
- static create(e, n, o, i, s, r) {
908
- let l = s.nodeViews[n.type.name], a, c = l && l(n, s, () => {
909
- if (!a)
910
- return r;
911
- if (a.parent)
912
- return a.parent.posBeforeChild(a);
913
- }, o, i), d = c && c.dom, f = c && c.contentDOM;
914
- if (n.isText) {
915
- if (!d)
916
- d = document.createTextNode(n.text);
917
- else if (d.nodeType != 3)
918
- throw new RangeError("Text must be rendered as a DOM text node");
919
- } else d || ({ dom: d, contentDOM: f } = Re.renderSpec(document, n.type.spec.toDOM(n), null, n.attrs));
920
- !f && !n.isText && d.nodeName != "BR" && (d.hasAttribute("contenteditable") || (d.contentEditable = "false"), n.type.spec.draggable && (d.draggable = !0));
921
- let u = d;
922
- return d = wt(d, o, n), c ? a = new Jn(e, n, o, i, d, f || null, u, c, s, r + 1) : n.isText ? new Ie(e, n, o, i, d, u, s) : new Q(e, n, o, i, d, f || null, u, s, r + 1);
923
- }
924
- parseRule() {
925
- if (this.node.type.spec.reparseInView)
926
- return null;
927
- let e = { node: this.node.type.name, attrs: this.node.attrs };
928
- if (this.node.type.whitespace == "pre" && (e.preserveWhitespace = "full"), !this.contentDOM)
929
- e.getContent = () => this.node.content;
930
- else if (!this.contentLost)
931
- e.contentElement = this.contentDOM;
932
- else {
933
- for (let n = this.children.length - 1; n >= 0; n--) {
934
- let o = this.children[n];
935
- if (this.dom.contains(o.dom.parentNode)) {
936
- e.contentElement = o.dom.parentNode;
937
- break;
938
- }
939
- }
940
- e.contentElement || (e.getContent = () => _.empty);
941
- }
942
- return e;
943
- }
944
- matchesNode(e, n, o) {
945
- return this.dirty == I && e.eq(this.node) && Te(n, this.outerDeco) && o.eq(this.innerDeco);
946
- }
947
- get size() {
948
- return this.node.nodeSize;
949
- }
950
- get border() {
951
- return this.node.isLeaf ? 0 : 1;
952
- }
953
- // Syncs `this.children` to match `this.node.content` and the local
954
- // decorations, possibly introducing nesting for marks. Then, in a
955
- // separate step, syncs the DOM inside `this.contentDOM` to
956
- // `this.children`.
957
- updateChildren(e, n) {
958
- let o = this.node.inlineContent, i = n, s = e.composing ? this.localCompositionInfo(e, n) : null, r = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new Qn(this, r && r.node, e);
959
- eo(this.node, this.innerDeco, (c, d, f) => {
960
- c.spec.marks ? a.syncToMarks(c.spec.marks, o, e) : c.type.side >= 0 && !f && a.syncToMarks(d == this.node.childCount ? Cn.none : this.node.child(d).marks, o, e), a.placeWidget(c, e, i);
961
- }, (c, d, f, u) => {
962
- a.syncToMarks(c.marks, o, e);
963
- let p;
964
- a.findNodeMatch(c, d, f, u) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (p = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, d, f, p, e) || a.updateNextNode(c, d, f, e, u, i) || a.addNode(c, d, f, e, i), i += c.nodeSize;
965
- }), a.syncToMarks([], o, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == ne) && (r && this.protectLocalComposition(e, r), Zt(this.contentDOM, this.children, e), pe && to(this.dom));
966
- }
967
- localCompositionInfo(e, n) {
968
- let { from: o, to: i } = e.state.selection;
969
- if (!(e.state.selection instanceof x) || o < n || i > n + this.node.content.size)
970
- return null;
971
- let s = e.input.compositionNode;
972
- if (!s || !this.dom.contains(s.parentNode))
973
- return null;
974
- if (this.node.inlineContent) {
975
- let r = s.nodeValue, l = no(this.node.content, r, o - n, i - n);
976
- return l < 0 ? null : { node: s, pos: l, text: r };
977
- } else
978
- return { node: s, pos: -1, text: "" };
979
- }
980
- protectLocalComposition(e, { node: n, pos: o, text: i }) {
981
- if (this.getDesc(n))
982
- return;
983
- let s = n;
984
- for (; s.parentNode != this.contentDOM; s = s.parentNode) {
985
- for (; s.previousSibling; )
986
- s.parentNode.removeChild(s.previousSibling);
987
- for (; s.nextSibling; )
988
- s.parentNode.removeChild(s.nextSibling);
989
- s.pmViewDesc && (s.pmViewDesc = void 0);
990
- }
991
- let r = new Xn(this, s, n, i);
992
- e.input.compositionNodes.push(r), this.children = Ye(this.children, o, o + i.length, e, r);
993
- }
994
- // If this desc must be updated to match the given node decoration,
995
- // do so and return true.
996
- update(e, n, o, i) {
997
- return this.dirty == $ || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, n, o, i), !0);
998
- }
999
- updateInner(e, n, o, i) {
1000
- this.updateOuterDeco(n), this.node = e, this.innerDeco = o, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = I;
1001
- }
1002
- updateOuterDeco(e) {
1003
- if (Te(e, this.outerDeco))
1004
- return;
1005
- let n = this.nodeDOM.nodeType != 1, o = this.dom;
1006
- this.dom = Qt(this.dom, this.nodeDOM, Ue(this.outerDeco, this.node, n), Ue(e, this.node, n)), this.dom != o && (o.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
1007
- }
1008
- // Mark this node as being the selected node.
1009
- selectNode() {
1010
- this.nodeDOM.nodeType == 1 && this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.dom.draggable = !0);
1011
- }
1012
- // Remove selected node marking from this node.
1013
- deselectNode() {
1014
- this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.dom.removeAttribute("draggable"));
1015
- }
1016
- get domAtom() {
1017
- return this.node.isAtom;
1018
- }
1019
- }
1020
- function pt(t, e, n, o, i) {
1021
- wt(o, e, t);
1022
- let s = new Q(void 0, t, e, n, o, o, o, i, 0);
1023
- return s.contentDOM && s.updateChildren(i, 0), s;
1024
- }
1025
- class Ie extends Q {
1026
- constructor(e, n, o, i, s, r, l) {
1027
- super(e, n, o, i, s, null, r, l, 0);
1028
- }
1029
- parseRule() {
1030
- let e = this.nodeDOM.parentNode;
1031
- for (; e && e != this.dom && !e.pmIsDeco; )
1032
- e = e.parentNode;
1033
- return { skip: e || !0 };
1034
- }
1035
- update(e, n, o, i) {
1036
- return this.dirty == $ || this.dirty != I && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(n), (this.dirty != I || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = I, !0);
1037
- }
1038
- inParent() {
1039
- let e = this.parent.contentDOM;
1040
- for (let n = this.nodeDOM; n; n = n.parentNode)
1041
- if (n == e)
1042
- return !0;
1043
- return !1;
1044
- }
1045
- domFromPos(e) {
1046
- return { node: this.nodeDOM, offset: e };
1047
- }
1048
- localPosFromDOM(e, n, o) {
1049
- return e == this.nodeDOM ? this.posAtStart + Math.min(n, this.node.text.length) : super.localPosFromDOM(e, n, o);
1050
- }
1051
- ignoreMutation(e) {
1052
- return e.type != "characterData" && e.type != "selection";
1053
- }
1054
- slice(e, n, o) {
1055
- let i = this.node.cut(e, n), s = document.createTextNode(i.text);
1056
- return new Ie(this.parent, i, this.outerDeco, this.innerDeco, s, s, o);
1057
- }
1058
- markDirty(e, n) {
1059
- super.markDirty(e, n), this.dom != this.nodeDOM && (e == 0 || n == this.nodeDOM.nodeValue.length) && (this.dirty = $);
1060
- }
1061
- get domAtom() {
1062
- return !1;
1063
- }
1064
- isText(e) {
1065
- return this.node.text == e;
1066
- }
1067
- }
1068
- class Jt extends Me {
1069
- parseRule() {
1070
- return { ignore: !0 };
1071
- }
1072
- matchesHack(e) {
1073
- return this.dirty == I && this.dom.nodeName == e;
1074
- }
1075
- get domAtom() {
1076
- return !0;
1077
- }
1078
- get ignoreForCoords() {
1079
- return this.dom.nodeName == "IMG";
1080
- }
1081
- }
1082
- class Jn extends Q {
1083
- constructor(e, n, o, i, s, r, l, a, c, d) {
1084
- super(e, n, o, i, s, r, l, c, d), this.spec = a;
1085
- }
1086
- // A custom `update` method gets to decide whether the update goes
1087
- // through. If it does, and there's a `contentDOM` node, our logic
1088
- // updates the children.
1089
- update(e, n, o, i) {
1090
- if (this.dirty == $)
1091
- return !1;
1092
- if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
1093
- let s = this.spec.update(e, n, o);
1094
- return s && this.updateInner(e, n, o, i), s;
1095
- } else return !this.contentDOM && !e.isLeaf ? !1 : super.update(e, n, o, i);
1096
- }
1097
- selectNode() {
1098
- this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
1099
- }
1100
- deselectNode() {
1101
- this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
1102
- }
1103
- setSelection(e, n, o, i) {
1104
- this.spec.setSelection ? this.spec.setSelection(e, n, o.root) : super.setSelection(e, n, o, i);
1105
- }
1106
- destroy() {
1107
- this.spec.destroy && this.spec.destroy(), super.destroy();
1108
- }
1109
- stopEvent(e) {
1110
- return this.spec.stopEvent ? this.spec.stopEvent(e) : !1;
1111
- }
1112
- ignoreMutation(e) {
1113
- return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
1114
- }
1115
- }
1116
- function Zt(t, e, n) {
1117
- let o = t.firstChild, i = !1;
1118
- for (let s = 0; s < e.length; s++) {
1119
- let r = e[s], l = r.dom;
1120
- if (l.parentNode == t) {
1121
- for (; l != o; )
1122
- o = mt(o), i = !0;
1123
- o = o.nextSibling;
1124
- } else
1125
- i = !0, t.insertBefore(l, o);
1126
- if (r instanceof le) {
1127
- let a = o ? o.previousSibling : t.lastChild;
1128
- Zt(r.contentDOM, r.children, n), o = a ? a.nextSibling : t.firstChild;
1129
- }
1130
- }
1131
- for (; o; )
1132
- o = mt(o), i = !0;
1133
- i && n.trackWrites == t && (n.trackWrites = null);
1134
- }
1135
- const ye = function(t) {
1136
- t && (this.nodeName = t);
1137
- };
1138
- ye.prototype = /* @__PURE__ */ Object.create(null);
1139
- const oe = [new ye()];
1140
- function Ue(t, e, n) {
1141
- if (t.length == 0)
1142
- return oe;
1143
- let o = n ? oe[0] : new ye(), i = [o];
1144
- for (let s = 0; s < t.length; s++) {
1145
- let r = t[s].type.attrs;
1146
- if (r) {
1147
- r.nodeName && i.push(o = new ye(r.nodeName));
1148
- for (let l in r) {
1149
- let a = r[l];
1150
- a != null && (n && i.length == 1 && i.push(o = new ye(e.isInline ? "span" : "div")), l == "class" ? o.class = (o.class ? o.class + " " : "") + a : l == "style" ? o.style = (o.style ? o.style + ";" : "") + a : l != "nodeName" && (o[l] = a));
1151
- }
1152
- }
1153
- }
1154
- return i;
1155
- }
1156
- function Qt(t, e, n, o) {
1157
- if (n == oe && o == oe)
1158
- return e;
1159
- let i = e;
1160
- for (let s = 0; s < o.length; s++) {
1161
- let r = o[s], l = n[s];
1162
- if (s) {
1163
- let a;
1164
- l && l.nodeName == r.nodeName && i != t && (a = i.parentNode) && a.nodeName.toLowerCase() == r.nodeName || (a = document.createElement(r.nodeName), a.pmIsDeco = !0, a.appendChild(i), l = oe[0]), i = a;
1165
- }
1166
- Zn(i, l || oe[0], r);
1167
- }
1168
- return i;
1169
- }
1170
- function Zn(t, e, n) {
1171
- for (let o in e)
1172
- o != "class" && o != "style" && o != "nodeName" && !(o in n) && t.removeAttribute(o);
1173
- for (let o in n)
1174
- o != "class" && o != "style" && o != "nodeName" && n[o] != e[o] && t.setAttribute(o, n[o]);
1175
- if (e.class != n.class) {
1176
- let o = e.class ? e.class.split(" ").filter(Boolean) : [], i = n.class ? n.class.split(" ").filter(Boolean) : [];
1177
- for (let s = 0; s < o.length; s++)
1178
- i.indexOf(o[s]) == -1 && t.classList.remove(o[s]);
1179
- for (let s = 0; s < i.length; s++)
1180
- o.indexOf(i[s]) == -1 && t.classList.add(i[s]);
1181
- t.classList.length == 0 && t.removeAttribute("class");
1182
- }
1183
- if (e.style != n.style) {
1184
- if (e.style) {
1185
- let o = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, i;
1186
- for (; i = o.exec(e.style); )
1187
- t.style.removeProperty(i[1]);
1188
- }
1189
- n.style && (t.style.cssText += n.style);
1190
- }
1191
- }
1192
- function wt(t, e, n) {
1193
- return Qt(t, t, oe, Ue(e, n, t.nodeType != 1));
1194
- }
1195
- function Te(t, e) {
1196
- if (t.length != e.length)
1197
- return !1;
1198
- for (let n = 0; n < t.length; n++)
1199
- if (!t[n].type.eq(e[n].type))
1200
- return !1;
1201
- return !0;
1202
- }
1203
- function mt(t) {
1204
- let e = t.nextSibling;
1205
- return t.parentNode.removeChild(t), e;
1206
- }
1207
- class Qn {
1208
- constructor(e, n, o) {
1209
- this.lock = n, this.view = o, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = wn(e.node.content, e);
1210
- }
1211
- // Destroy and remove the children between the given indices in
1212
- // `this.top`.
1213
- destroyBetween(e, n) {
1214
- if (e != n) {
1215
- for (let o = e; o < n; o++)
1216
- this.top.children[o].destroy();
1217
- this.top.children.splice(e, n - e), this.changed = !0;
1218
- }
1219
- }
1220
- // Destroy all remaining children in `this.top`.
1221
- destroyRest() {
1222
- this.destroyBetween(this.index, this.top.children.length);
1223
- }
1224
- // Sync the current stack of mark descs with the given array of
1225
- // marks, reusing existing mark descs when possible.
1226
- syncToMarks(e, n, o) {
1227
- let i = 0, s = this.stack.length >> 1, r = Math.min(s, e.length);
1228
- for (; i < r && (i == s - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1; )
1229
- i++;
1230
- for (; i < s; )
1231
- this.destroyRest(), this.top.dirty = I, this.index = this.stack.pop(), this.top = this.stack.pop(), s--;
1232
- for (; s < e.length; ) {
1233
- this.stack.push(this.top, this.index + 1);
1234
- let l = -1;
1235
- for (let a = this.index; a < Math.min(this.index + 3, this.top.children.length); a++) {
1236
- let c = this.top.children[a];
1237
- if (c.matchesMark(e[s]) && !this.isLocked(c.dom)) {
1238
- l = a;
1239
- break;
1240
- }
1241
- }
1242
- if (l > -1)
1243
- l > this.index && (this.changed = !0, this.destroyBetween(this.index, l)), this.top = this.top.children[this.index];
1244
- else {
1245
- let a = le.create(this.top, e[s], n, o);
1246
- this.top.children.splice(this.index, 0, a), this.top = a, this.changed = !0;
1247
- }
1248
- this.index = 0, s++;
1249
- }
1250
- }
1251
- // Try to find a node desc matching the given data. Skip over it and
1252
- // return true when successful.
1253
- findNodeMatch(e, n, o, i) {
1254
- let s = -1, r;
1255
- if (i >= this.preMatch.index && (r = this.preMatch.matches[i - this.preMatch.index]).parent == this.top && r.matchesNode(e, n, o))
1256
- s = this.top.children.indexOf(r, this.index);
1257
- else
1258
- for (let l = this.index, a = Math.min(this.top.children.length, l + 5); l < a; l++) {
1259
- let c = this.top.children[l];
1260
- if (c.matchesNode(e, n, o) && !this.preMatch.matched.has(c)) {
1261
- s = l;
1262
- break;
1263
- }
1264
- }
1265
- return s < 0 ? !1 : (this.destroyBetween(this.index, s), this.index++, !0);
1266
- }
1267
- updateNodeAt(e, n, o, i, s) {
1268
- let r = this.top.children[i];
1269
- return r.dirty == $ && r.dom == r.contentDOM && (r.dirty = ne), r.update(e, n, o, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
1270
- }
1271
- findIndexWithChild(e) {
1272
- for (; ; ) {
1273
- let n = e.parentNode;
1274
- if (!n)
1275
- return -1;
1276
- if (n == this.top.contentDOM) {
1277
- let o = e.pmViewDesc;
1278
- if (o) {
1279
- for (let i = this.index; i < this.top.children.length; i++)
1280
- if (this.top.children[i] == o)
1281
- return i;
1282
- }
1283
- return -1;
1284
- }
1285
- e = n;
1286
- }
1287
- }
1288
- // Try to update the next node, if any, to the given data. Checks
1289
- // pre-matches to avoid overwriting nodes that could still be used.
1290
- updateNextNode(e, n, o, i, s, r) {
1291
- for (let l = this.index; l < this.top.children.length; l++) {
1292
- let a = this.top.children[l];
1293
- if (a instanceof Q) {
1294
- let c = this.preMatch.matched.get(a);
1295
- if (c != null && c != s)
1296
- return !1;
1297
- let d = a.dom, f, u = this.isLocked(d) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != $ && Te(n, a.outerDeco));
1298
- if (!u && a.update(e, n, o, i))
1299
- return this.destroyBetween(this.index, l), a.dom != d && (this.changed = !0), this.index++, !0;
1300
- if (!u && (f = this.recreateWrapper(a, e, n, o, i, r)))
1301
- return this.destroyBetween(this.index, l), this.top.children[this.index] = f, f.contentDOM && (f.dirty = ne, f.updateChildren(i, r + 1), f.dirty = I), this.changed = !0, this.index++, !0;
1302
- break;
1303
- }
1304
- }
1305
- return !1;
1306
- }
1307
- // When a node with content is replaced by a different node with
1308
- // identical content, move over its children.
1309
- recreateWrapper(e, n, o, i, s, r) {
1310
- if (e.dirty || n.isAtom || !e.children.length || !e.node.content.eq(n.content) || !Te(o, e.outerDeco) || !i.eq(e.innerDeco))
1311
- return null;
1312
- let l = Q.create(this.top, n, o, i, s, r);
1313
- if (l.contentDOM) {
1314
- l.children = e.children, e.children = [];
1315
- for (let a of l.children)
1316
- a.parent = l;
1317
- }
1318
- return e.destroy(), l;
1319
- }
1320
- // Insert the node as a newly created node desc.
1321
- addNode(e, n, o, i, s) {
1322
- let r = Q.create(this.top, e, n, o, i, s);
1323
- r.contentDOM && r.updateChildren(i, s + 1), this.top.children.splice(this.index++, 0, r), this.changed = !0;
1324
- }
1325
- placeWidget(e, n, o) {
1326
- let i = this.index < this.top.children.length ? this.top.children[this.index] : null;
1327
- if (i && i.matchesWidget(e) && (e == i.widget || !i.widget.type.toDOM.parentNode))
1328
- this.index++;
1329
- else {
1330
- let s = new Xt(this.top, e, n, o);
1331
- this.top.children.splice(this.index++, 0, s), this.changed = !0;
1332
- }
1333
- }
1334
- // Make sure a textblock looks and behaves correctly in
1335
- // contentEditable.
1336
- addTextblockHacks() {
1337
- let e = this.top.children[this.index - 1], n = this.top;
1338
- for (; e instanceof le; )
1339
- n = e, e = n.children[n.children.length - 1];
1340
- (!e || // Empty textblock
1341
- !(e instanceof Ie) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((k || M) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", n), this.addHackNode("BR", this.top));
1342
- }
1343
- addHackNode(e, n) {
1344
- if (n == this.top && this.index < n.children.length && n.children[this.index].matchesHack(e))
1345
- this.index++;
1346
- else {
1347
- let o = document.createElement(e);
1348
- e == "IMG" && (o.className = "ProseMirror-separator", o.alt = ""), e == "BR" && (o.className = "ProseMirror-trailingBreak");
1349
- let i = new Jt(this.top, [], o, null);
1350
- n != this.top ? n.children.push(i) : n.children.splice(this.index++, 0, i), this.changed = !0;
1351
- }
1352
- }
1353
- isLocked(e) {
1354
- return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
1355
- }
1356
- }
1357
- function wn(t, e) {
1358
- let n = e, o = n.children.length, i = t.childCount, s = /* @__PURE__ */ new Map(), r = [];
1359
- e: for (; i > 0; ) {
1360
- let l;
1361
- for (; ; )
1362
- if (o) {
1363
- let c = n.children[o - 1];
1364
- if (c instanceof le)
1365
- n = c, o = c.children.length;
1366
- else {
1367
- l = c, o--;
1368
- break;
1369
- }
1370
- } else {
1371
- if (n == e)
1372
- break e;
1373
- o = n.parent.children.indexOf(n), n = n.parent;
1374
- }
1375
- let a = l.node;
1376
- if (a) {
1377
- if (a != t.child(i - 1))
1378
- break;
1379
- --i, s.set(l, i), r.push(l);
1380
- }
1381
- }
1382
- return { index: i, matched: s, matches: r.reverse() };
1383
- }
1384
- function vn(t, e) {
1385
- return t.type.side - e.type.side;
1386
- }
1387
- function eo(t, e, n, o) {
1388
- let i = e.locals(t), s = 0;
1389
- if (i.length == 0) {
1390
- for (let c = 0; c < t.childCount; c++) {
1391
- let d = t.child(c);
1392
- o(d, i, e.forChild(s, d), c), s += d.nodeSize;
1393
- }
1394
- return;
1395
- }
1396
- let r = 0, l = [], a = null;
1397
- for (let c = 0; ; ) {
1398
- let d, f;
1399
- for (; r < i.length && i[r].to == s; ) {
1400
- let m = i[r++];
1401
- m.widget && (d ? (f || (f = [d])).push(m) : d = m);
1402
- }
1403
- if (d)
1404
- if (f) {
1405
- f.sort(vn);
1406
- for (let m = 0; m < f.length; m++)
1407
- n(f[m], c, !!a);
1408
- } else
1409
- n(d, c, !!a);
1410
- let u, p;
1411
- if (a)
1412
- p = -1, u = a, a = null;
1413
- else if (c < t.childCount)
1414
- p = c, u = t.child(c++);
1415
- else
1416
- break;
1417
- for (let m = 0; m < l.length; m++)
1418
- l[m].to <= s && l.splice(m--, 1);
1419
- for (; r < i.length && i[r].from <= s && i[r].to > s; )
1420
- l.push(i[r++]);
1421
- let h = s + u.nodeSize;
1422
- if (u.isText) {
1423
- let m = h;
1424
- r < i.length && i[r].from < m && (m = i[r].from);
1425
- for (let y = 0; y < l.length; y++)
1426
- l[y].to < m && (m = l[y].to);
1427
- m < h && (a = u.cut(m - s), u = u.cut(0, m - s), h = m, p = -1);
1428
- } else
1429
- for (; r < i.length && i[r].to < h; )
1430
- r++;
1431
- let g = u.isInline && !u.isLeaf ? l.filter((m) => !m.inline) : l.slice();
1432
- o(u, g, e.forChild(s, u), p), s = h;
1433
- }
1434
- }
1435
- function to(t) {
1436
- if (t.nodeName == "UL" || t.nodeName == "OL") {
1437
- let e = t.style.cssText;
1438
- t.style.cssText = e + "; list-style: square !important", window.getComputedStyle(t).listStyle, t.style.cssText = e;
1439
- }
1440
- }
1441
- function no(t, e, n, o) {
1442
- for (let i = 0, s = 0; i < t.childCount && s <= o; ) {
1443
- let r = t.child(i++), l = s;
1444
- if (s += r.nodeSize, !r.isText)
1445
- continue;
1446
- let a = r.text;
1447
- for (; i < t.childCount; ) {
1448
- let c = t.child(i++);
1449
- if (s += c.nodeSize, !c.isText)
1450
- break;
1451
- a += c.text;
1452
- }
1453
- if (s >= n) {
1454
- if (s >= o && a.slice(o - e.length - l, o - l) == e)
1455
- return o - e.length;
1456
- let c = l < o ? a.lastIndexOf(e, o - l - 1) : -1;
1457
- if (c >= 0 && c + e.length + l >= n)
1458
- return l + c;
1459
- if (n == o && a.length >= o + e.length - l && a.slice(o - l, o - l + e.length) == e)
1460
- return o;
1461
- }
1462
- }
1463
- return -1;
1464
- }
1465
- function Ye(t, e, n, o, i) {
1466
- let s = [];
1467
- for (let r = 0, l = 0; r < t.length; r++) {
1468
- let a = t[r], c = l, d = l += a.size;
1469
- c >= n || d <= e ? s.push(a) : (c < e && s.push(a.slice(0, e - c, o)), i && (s.push(i), i = void 0), d > n && s.push(a.slice(n - c, a.size, o)));
1470
- }
1471
- return s;
1472
- }
1473
- function we(t, e = null) {
1474
- let n = t.domSelectionRange(), o = t.state.doc;
1475
- if (!n.focusNode)
1476
- return null;
1477
- let i = t.docView.nearestDesc(n.focusNode), s = i && i.size == 0, r = t.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
1478
- if (r < 0)
1479
- return null;
1480
- let l = o.resolve(r), a, c;
1481
- if (Be(n)) {
1482
- for (a = r; i && !i.node; )
1483
- i = i.parent;
1484
- let f = i.node;
1485
- if (i && f.isAtom && D.isSelectable(f) && i.parent && !(f.isInline && An(n.focusNode, n.focusOffset, i.dom))) {
1486
- let u = i.posBefore;
1487
- c = new D(r == u ? l : o.resolve(u));
1488
- }
1489
- } else {
1490
- if (n instanceof t.dom.ownerDocument.defaultView.Selection && n.rangeCount > 1) {
1491
- let f = r, u = r;
1492
- for (let p = 0; p < n.rangeCount; p++) {
1493
- let h = n.getRangeAt(p);
1494
- f = Math.min(f, t.docView.posFromDOM(h.startContainer, h.startOffset, 1)), u = Math.max(u, t.docView.posFromDOM(h.endContainer, h.endOffset, -1));
1495
- }
1496
- if (f < 0)
1497
- return null;
1498
- [a, r] = u == t.state.selection.anchor ? [u, f] : [f, u], l = o.resolve(r);
1499
- } else
1500
- a = t.docView.posFromDOM(n.anchorNode, n.anchorOffset, 1);
1501
- if (a < 0)
1502
- return null;
1503
- }
1504
- let d = o.resolve(a);
1505
- if (!c) {
1506
- let f = e == "pointer" || t.state.selection.head < l.pos && !s ? 1 : -1;
1507
- c = ve(t, d, l, f);
1508
- }
1509
- return c;
1510
- }
1511
- function vt(t) {
1512
- return t.editable ? t.hasFocus() : tn(t) && document.activeElement && document.activeElement.contains(t.dom);
1513
- }
1514
- function W(t, e = !1) {
1515
- let n = t.state.selection;
1516
- if (en(t, n), !!vt(t)) {
1517
- if (!e && t.input.mouseDown && t.input.mouseDown.allowDefault && M) {
1518
- let o = t.domSelectionRange(), i = t.domObserver.currentSelection;
1519
- if (o.anchorNode && i.anchorNode && re(o.anchorNode, o.anchorOffset, i.anchorNode, i.anchorOffset)) {
1520
- t.input.mouseDown.delayedSelectionSync = !0, t.domObserver.setCurSelection();
1521
- return;
1522
- }
1523
- }
1524
- if (t.domObserver.disconnectSelection(), t.cursorWrapper)
1525
- io(t);
1526
- else {
1527
- let { anchor: o, head: i } = n, s, r;
1528
- gt && !(n instanceof x) && (n.$from.parent.inlineContent || (s = yt(t, n.from)), !n.empty && !n.$from.parent.inlineContent && (r = yt(t, n.to))), t.docView.setSelection(o, i, t, e), gt && (s && bt(s), r && bt(r)), n.visible ? t.dom.classList.remove("ProseMirror-hideselection") : (t.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && oo(t));
1529
- }
1530
- t.domObserver.setCurSelection(), t.domObserver.connectSelection();
1531
- }
1532
- }
1533
- const gt = k || M && Ht < 63;
1534
- function yt(t, e) {
1535
- let { node: n, offset: o } = t.docView.domFromPos(e, 0), i = o < n.childNodes.length ? n.childNodes[o] : null, s = o ? n.childNodes[o - 1] : null;
1536
- if (k && i && i.contentEditable == "false")
1537
- return Le(i);
1538
- if ((!i || i.contentEditable == "false") && (!s || s.contentEditable == "false")) {
1539
- if (i)
1540
- return Le(i);
1541
- if (s)
1542
- return Le(s);
1543
- }
1544
- }
1545
- function Le(t) {
1546
- return t.contentEditable = "true", k && t.draggable && (t.draggable = !1, t.wasDraggable = !0), t;
1547
- }
1548
- function bt(t) {
1549
- t.contentEditable = "false", t.wasDraggable && (t.draggable = !0, t.wasDraggable = null);
1550
- }
1551
- function oo(t) {
1552
- let e = t.dom.ownerDocument;
1553
- e.removeEventListener("selectionchange", t.input.hideSelectionGuard);
1554
- let n = t.domSelectionRange(), o = n.anchorNode, i = n.anchorOffset;
1555
- e.addEventListener("selectionchange", t.input.hideSelectionGuard = () => {
1556
- (n.anchorNode != o || n.anchorOffset != i) && (e.removeEventListener("selectionchange", t.input.hideSelectionGuard), setTimeout(() => {
1557
- (!vt(t) || t.state.selection.visible) && t.dom.classList.remove("ProseMirror-hideselection");
1558
- }, 20));
1559
- });
1560
- }
1561
- function io(t) {
1562
- let e = t.domSelection(), n = document.createRange();
1563
- if (!e)
1564
- return;
1565
- let o = t.cursorWrapper.dom, i = o.nodeName == "IMG";
1566
- i ? n.setStart(o.parentNode, C(o) + 1) : n.setStart(o, 0), n.collapse(!0), e.removeAllRanges(), e.addRange(n), !i && !t.state.selection.visible && P && Z <= 11 && (o.disabled = !0, o.disabled = !1);
1567
- }
1568
- function en(t, e) {
1569
- if (e instanceof D) {
1570
- let n = t.docView.descAt(e.from);
1571
- n != t.lastSelectedViewDesc && (Dt(t), n && n.selectNode(), t.lastSelectedViewDesc = n);
1572
- } else
1573
- Dt(t);
1574
- }
1575
- function Dt(t) {
1576
- t.lastSelectedViewDesc && (t.lastSelectedViewDesc.parent && t.lastSelectedViewDesc.deselectNode(), t.lastSelectedViewDesc = void 0);
1577
- }
1578
- function ve(t, e, n, o) {
1579
- return t.someProp("createSelectionBetween", (i) => i(t, e, n)) || x.between(e, n, o);
1580
- }
1581
- function Nt(t) {
1582
- return t.editable && !t.hasFocus() ? !1 : tn(t);
1583
- }
1584
- function tn(t) {
1585
- let e = t.domSelectionRange();
1586
- if (!e.anchorNode)
1587
- return !1;
1588
- try {
1589
- return t.dom.contains(e.anchorNode.nodeType == 3 ? e.anchorNode.parentNode : e.anchorNode) && (t.editable || t.dom.contains(e.focusNode.nodeType == 3 ? e.focusNode.parentNode : e.focusNode));
1590
- } catch {
1591
- return !1;
1592
- }
1593
- }
1594
- function so(t) {
1595
- let e = t.docView.domFromPos(t.state.selection.anchor, 0), n = t.domSelectionRange();
1596
- return re(e.node, e.offset, n.anchorNode, n.anchorOffset);
1597
- }
1598
- function Ge(t, e) {
1599
- let { $anchor: n, $head: o } = t.selection, i = e > 0 ? n.max(o) : n.min(o), s = i.parent.inlineContent ? i.depth ? t.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
1600
- return s && he.findFrom(s, e);
1601
- }
1602
- function Y(t, e) {
1603
- return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()), !0;
1604
- }
1605
- function St(t, e, n) {
1606
- let o = t.state.selection;
1607
- if (o instanceof x)
1608
- if (n.indexOf("s") > -1) {
1609
- let { $head: i } = o, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
1610
- if (!s || s.isText || !s.isLeaf)
1611
- return !1;
1612
- let r = t.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
1613
- return Y(t, new x(o.$anchor, r));
1614
- } else if (o.empty) {
1615
- if (t.endOfTextblock(e > 0 ? "forward" : "backward")) {
1616
- let i = Ge(t.state, e);
1617
- return i && i instanceof D ? Y(t, i) : !1;
1618
- } else if (!(R && n.indexOf("m") > -1)) {
1619
- let i = o.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, r;
1620
- if (!s || s.isText)
1621
- return !1;
1622
- let l = e < 0 ? i.pos - s.nodeSize : i.pos;
1623
- return s.isAtom || (r = t.docView.descAt(l)) && !r.contentDOM ? D.isSelectable(s) ? Y(t, new D(e < 0 ? t.state.doc.resolve(i.pos - s.nodeSize) : i)) : Oe ? Y(t, new x(t.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
1624
- }
1625
- } else return !1;
1626
- else {
1627
- if (o instanceof D && o.node.isInline)
1628
- return Y(t, new x(e > 0 ? o.$to : o.$from));
1629
- {
1630
- let i = Ge(t.state, e);
1631
- return i ? Y(t, i) : !1;
1632
- }
1633
- }
1634
- }
1635
- function Ae(t) {
1636
- return t.nodeType == 3 ? t.nodeValue.length : t.childNodes.length;
1637
- }
1638
- function be(t, e) {
1639
- let n = t.pmViewDesc;
1640
- return n && n.size == 0 && (e < 0 || t.nextSibling || t.nodeName != "BR");
1641
- }
1642
- function ce(t, e) {
1643
- return e < 0 ? ro(t) : lo(t);
1644
- }
1645
- function ro(t) {
1646
- let e = t.domSelectionRange(), n = e.focusNode, o = e.focusOffset;
1647
- if (!n)
1648
- return;
1649
- let i, s, r = !1;
1650
- for (z && n.nodeType == 1 && o < Ae(n) && be(n.childNodes[o], -1) && (r = !0); ; )
1651
- if (o > 0) {
1652
- if (n.nodeType != 1)
1653
- break;
1654
- {
1655
- let l = n.childNodes[o - 1];
1656
- if (be(l, -1))
1657
- i = n, s = --o;
1658
- else if (l.nodeType == 3)
1659
- n = l, o = n.nodeValue.length;
1660
- else
1661
- break;
1662
- }
1663
- } else {
1664
- if (nn(n))
1665
- break;
1666
- {
1667
- let l = n.previousSibling;
1668
- for (; l && be(l, -1); )
1669
- i = n.parentNode, s = C(l), l = l.previousSibling;
1670
- if (l)
1671
- n = l, o = Ae(n);
1672
- else {
1673
- if (n = n.parentNode, n == t.dom)
1674
- break;
1675
- o = 0;
1676
- }
1677
- }
1678
- }
1679
- r ? Xe(t, n, o) : i && Xe(t, i, s);
1680
- }
1681
- function lo(t) {
1682
- let e = t.domSelectionRange(), n = e.focusNode, o = e.focusOffset;
1683
- if (!n)
1684
- return;
1685
- let i = Ae(n), s, r;
1686
- for (; ; )
1687
- if (o < i) {
1688
- if (n.nodeType != 1)
1689
- break;
1690
- let l = n.childNodes[o];
1691
- if (be(l, 1))
1692
- s = n, r = ++o;
1693
- else
1694
- break;
1695
- } else {
1696
- if (nn(n))
1697
- break;
1698
- {
1699
- let l = n.nextSibling;
1700
- for (; l && be(l, 1); )
1701
- s = l.parentNode, r = C(l) + 1, l = l.nextSibling;
1702
- if (l)
1703
- n = l, o = 0, i = Ae(n);
1704
- else {
1705
- if (n = n.parentNode, n == t.dom)
1706
- break;
1707
- o = i = 0;
1708
- }
1709
- }
1710
- }
1711
- s && Xe(t, s, r);
1712
- }
1713
- function nn(t) {
1714
- let e = t.pmViewDesc;
1715
- return e && e.node && e.node.isBlock;
1716
- }
1717
- function ao(t, e) {
1718
- for (; t && e == t.childNodes.length && !Ce(t); )
1719
- e = C(t) + 1, t = t.parentNode;
1720
- for (; t && e < t.childNodes.length; ) {
1721
- let n = t.childNodes[e];
1722
- if (n.nodeType == 3)
1723
- return n;
1724
- if (n.nodeType == 1 && n.contentEditable == "false")
1725
- break;
1726
- t = n, e = 0;
1727
- }
1728
- }
1729
- function co(t, e) {
1730
- for (; t && !e && !Ce(t); )
1731
- e = C(t), t = t.parentNode;
1732
- for (; t && e; ) {
1733
- let n = t.childNodes[e - 1];
1734
- if (n.nodeType == 3)
1735
- return n;
1736
- if (n.nodeType == 1 && n.contentEditable == "false")
1737
- break;
1738
- t = n, e = t.childNodes.length;
1739
- }
1740
- }
1741
- function Xe(t, e, n) {
1742
- if (e.nodeType != 3) {
1743
- let s, r;
1744
- (r = ao(e, n)) ? (e = r, n = 0) : (s = co(e, n)) && (e = s, n = s.nodeValue.length);
1745
- }
1746
- let o = t.domSelection();
1747
- if (!o)
1748
- return;
1749
- if (Be(o)) {
1750
- let s = document.createRange();
1751
- s.setEnd(e, n), s.setStart(e, n), o.removeAllRanges(), o.addRange(s);
1752
- } else o.extend && o.extend(e, n);
1753
- t.domObserver.setCurSelection();
1754
- let { state: i } = t;
1755
- setTimeout(() => {
1756
- t.state == i && W(t);
1757
- }, 50);
1758
- }
1759
- function Ct(t, e) {
1760
- let n = t.state.doc.resolve(e);
1761
- if (!(M || Vn) && n.parent.inlineContent) {
1762
- let i = t.coordsAtPos(e);
1763
- if (e > n.start()) {
1764
- let s = t.coordsAtPos(e - 1), r = (s.top + s.bottom) / 2;
1765
- if (r > i.top && r < i.bottom && Math.abs(s.left - i.left) > 1)
1766
- return s.left < i.left ? "ltr" : "rtl";
1767
- }
1768
- if (e < n.end()) {
1769
- let s = t.coordsAtPos(e + 1), r = (s.top + s.bottom) / 2;
1770
- if (r > i.top && r < i.bottom && Math.abs(s.left - i.left) > 1)
1771
- return s.left > i.left ? "ltr" : "rtl";
1772
- }
1773
- }
1774
- return getComputedStyle(t.dom).direction == "rtl" ? "rtl" : "ltr";
1775
- }
1776
- function Ot(t, e, n) {
1777
- let o = t.state.selection;
1778
- if (o instanceof x && !o.empty || n.indexOf("s") > -1 || R && n.indexOf("m") > -1)
1779
- return !1;
1780
- let { $from: i, $to: s } = o;
1781
- if (!i.parent.inlineContent || t.endOfTextblock(e < 0 ? "up" : "down")) {
1782
- let r = Ge(t.state, e);
1783
- if (r && r instanceof D)
1784
- return Y(t, r);
1785
- }
1786
- if (!i.parent.inlineContent) {
1787
- let r = e < 0 ? i : s, l = o instanceof Sn ? he.near(r, e) : he.findFrom(r, e);
1788
- return l ? Y(t, l) : !1;
1789
- }
1790
- return !1;
1791
- }
1792
- function Mt(t, e) {
1793
- if (!(t.state.selection instanceof x))
1794
- return !0;
1795
- let { $head: n, $anchor: o, empty: i } = t.state.selection;
1796
- if (!n.sameParent(o))
1797
- return !0;
1798
- if (!i)
1799
- return !1;
1800
- if (t.endOfTextblock(e > 0 ? "forward" : "backward"))
1801
- return !0;
1802
- let s = !n.textOffset && (e < 0 ? n.nodeBefore : n.nodeAfter);
1803
- if (s && !s.isText) {
1804
- let r = t.state.tr;
1805
- return e < 0 ? r.delete(n.pos - s.nodeSize, n.pos) : r.delete(n.pos, n.pos + s.nodeSize), t.dispatch(r), !0;
1806
- }
1807
- return !1;
1808
- }
1809
- function xt(t, e, n) {
1810
- t.domObserver.stop(), e.contentEditable = n, t.domObserver.start();
1811
- }
1812
- function fo(t) {
1813
- if (!k || t.state.selection.$head.parentOffset > 0)
1814
- return !1;
1815
- let { focusNode: e, focusOffset: n } = t.domSelectionRange();
1816
- if (e && e.nodeType == 1 && n == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
1817
- let o = e.firstChild;
1818
- xt(t, o, "true"), setTimeout(() => xt(t, o, "false"), 20);
1819
- }
1820
- return !1;
1821
- }
1822
- function ho(t) {
1823
- let e = "";
1824
- return t.ctrlKey && (e += "c"), t.metaKey && (e += "m"), t.altKey && (e += "a"), t.shiftKey && (e += "s"), e;
1825
- }
1826
- function uo(t, e) {
1827
- let n = e.keyCode, o = ho(e);
1828
- if (n == 8 || R && n == 72 && o == "c")
1829
- return Mt(t, -1) || ce(t, -1);
1830
- if (n == 46 && !e.shiftKey || R && n == 68 && o == "c")
1831
- return Mt(t, 1) || ce(t, 1);
1832
- if (n == 13 || n == 27)
1833
- return !0;
1834
- if (n == 37 || R && n == 66 && o == "c") {
1835
- let i = n == 37 ? Ct(t, t.state.selection.from) == "ltr" ? -1 : 1 : -1;
1836
- return St(t, i, o) || ce(t, i);
1837
- } else if (n == 39 || R && n == 70 && o == "c") {
1838
- let i = n == 39 ? Ct(t, t.state.selection.from) == "ltr" ? 1 : -1 : 1;
1839
- return St(t, i, o) || ce(t, i);
1840
- } else {
1841
- if (n == 38 || R && n == 80 && o == "c")
1842
- return Ot(t, -1, o) || ce(t, -1);
1843
- if (n == 40 || R && n == 78 && o == "c")
1844
- return fo(t) || Ot(t, 1, o) || ce(t, 1);
1845
- if (o == (R ? "m" : "c") && (n == 66 || n == 73 || n == 89 || n == 90))
1846
- return !0;
1847
- }
1848
- return !1;
1849
- }
1850
- function et(t, e) {
1851
- t.someProp("transformCopied", (p) => {
1852
- e = p(e, t);
1853
- });
1854
- let n = [], { content: o, openStart: i, openEnd: s } = e;
1855
- for (; i > 1 && s > 1 && o.childCount == 1 && o.firstChild.childCount == 1; ) {
1856
- i--, s--;
1857
- let p = o.firstChild;
1858
- n.push(p.type.name, p.attrs != p.type.defaultAttrs ? p.attrs : null), o = p.content;
1859
- }
1860
- let r = t.someProp("clipboardSerializer") || Re.fromSchema(t.state.schema), l = cn(), a = l.createElement("div");
1861
- a.appendChild(r.serializeFragment(o, { document: l }));
1862
- let c = a.firstChild, d, f = 0;
1863
- for (; c && c.nodeType == 1 && (d = an[c.nodeName.toLowerCase()]); ) {
1864
- for (let p = d.length - 1; p >= 0; p--) {
1865
- let h = l.createElement(d[p]);
1866
- for (; a.firstChild; )
1867
- h.appendChild(a.firstChild);
1868
- a.appendChild(h), f++;
1869
- }
1870
- c = a.firstChild;
1871
- }
1872
- c && c.nodeType == 1 && c.setAttribute("data-pm-slice", `${i} ${s}${f ? ` -${f}` : ""} ${JSON.stringify(n)}`);
1873
- let u = t.someProp("clipboardTextSerializer", (p) => p(e, t)) || e.content.textBetween(0, e.content.size, `
1874
-
1875
- `);
1876
- return { dom: a, text: u, slice: e };
1877
- }
1878
- function on(t, e, n, o, i) {
1879
- let s = i.parent.type.spec.code, r, l;
1880
- if (!n && !e)
1881
- return null;
1882
- let a = e && (o || s || !n);
1883
- if (a) {
1884
- if (t.someProp("transformPastedText", (u) => {
1885
- e = u(e, s || o, t);
1886
- }), s)
1887
- return e ? new J(_.from(t.state.schema.text(e.replace(/\r\n?/g, `
1888
- `))), 0, 0) : J.empty;
1889
- let f = t.someProp("clipboardTextParser", (u) => u(e, i, o, t));
1890
- if (f)
1891
- l = f;
1892
- else {
1893
- let u = i.marks(), { schema: p } = t.state, h = Re.fromSchema(p);
1894
- r = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((g) => {
1895
- let m = r.appendChild(document.createElement("p"));
1896
- g && m.appendChild(h.serializeNode(p.text(g, u)));
1897
- });
1898
- }
1899
- } else
1900
- t.someProp("transformPastedHTML", (f) => {
1901
- n = f(n, t);
1902
- }), r = yo(n), Oe && bo(r);
1903
- let c = r && r.querySelector("[data-pm-slice]"), d = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
1904
- if (d && d[3])
1905
- for (let f = +d[3]; f > 0; f--) {
1906
- let u = r.firstChild;
1907
- for (; u && u.nodeType != 1; )
1908
- u = u.nextSibling;
1909
- if (!u)
1910
- break;
1911
- r = u;
1912
- }
1913
- if (l || (l = (t.someProp("clipboardParser") || t.someProp("domParser") || qt.fromSchema(t.state.schema)).parseSlice(r, {
1914
- preserveWhitespace: !!(a || d),
1915
- context: i,
1916
- ruleFromNode(u) {
1917
- return u.nodeName == "BR" && !u.nextSibling && u.parentNode && !po.test(u.parentNode.nodeName) ? { ignore: !0 } : null;
1918
- }
1919
- })), d)
1920
- l = Do(kt(l, +d[1], +d[2]), d[4]);
1921
- else if (l = J.maxOpen(mo(l.content, i), !0), l.openStart || l.openEnd) {
1922
- let f = 0, u = 0;
1923
- for (let p = l.content.firstChild; f < l.openStart && !p.type.spec.isolating; f++, p = p.firstChild)
1924
- ;
1925
- for (let p = l.content.lastChild; u < l.openEnd && !p.type.spec.isolating; u++, p = p.lastChild)
1926
- ;
1927
- l = kt(l, f, u);
1928
- }
1929
- return t.someProp("transformPasted", (f) => {
1930
- l = f(l, t);
1931
- }), l;
1932
- }
1933
- const po = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
1934
- function mo(t, e) {
1935
- if (t.childCount < 2)
1936
- return t;
1937
- for (let n = e.depth; n >= 0; n--) {
1938
- let i = e.node(n).contentMatchAt(e.index(n)), s, r = [];
1939
- if (t.forEach((l) => {
1940
- if (!r)
1941
- return;
1942
- let a = i.findWrapping(l.type), c;
1943
- if (!a)
1944
- return r = null;
1945
- if (c = r.length && s.length && rn(a, s, l, r[r.length - 1], 0))
1946
- r[r.length - 1] = c;
1947
- else {
1948
- r.length && (r[r.length - 1] = ln(r[r.length - 1], s.length));
1949
- let d = sn(l, a);
1950
- r.push(d), i = i.matchType(d.type), s = a;
1951
- }
1952
- }), r)
1953
- return _.from(r);
1954
- }
1955
- return t;
1956
- }
1957
- function sn(t, e, n = 0) {
1958
- for (let o = e.length - 1; o >= n; o--)
1959
- t = e[o].create(null, _.from(t));
1960
- return t;
1961
- }
1962
- function rn(t, e, n, o, i) {
1963
- if (i < t.length && i < e.length && t[i] == e[i]) {
1964
- let s = rn(t, e, n, o.lastChild, i + 1);
1965
- if (s)
1966
- return o.copy(o.content.replaceChild(o.childCount - 1, s));
1967
- if (o.contentMatchAt(o.childCount).matchType(i == t.length - 1 ? n.type : t[i + 1]))
1968
- return o.copy(o.content.append(_.from(sn(n, t, i + 1))));
1969
- }
1970
- }
1971
- function ln(t, e) {
1972
- if (e == 0)
1973
- return t;
1974
- let n = t.content.replaceChild(t.childCount - 1, ln(t.lastChild, e - 1)), o = t.contentMatchAt(t.childCount).fillBefore(_.empty, !0);
1975
- return t.copy(n.append(o));
1976
- }
1977
- function Je(t, e, n, o, i, s) {
1978
- let r = e < 0 ? t.firstChild : t.lastChild, l = r.content;
1979
- return t.childCount > 1 && (s = 0), i < o - 1 && (l = Je(l, e, n, o, i + 1, s)), i >= n && (l = e < 0 ? r.contentMatchAt(0).fillBefore(l, s <= i).append(l) : l.append(r.contentMatchAt(r.childCount).fillBefore(_.empty, !0))), t.replaceChild(e < 0 ? 0 : t.childCount - 1, r.copy(l));
1980
- }
1981
- function kt(t, e, n) {
1982
- return e < t.openStart && (t = new J(Je(t.content, -1, e, t.openStart, 0, t.openEnd), e, t.openEnd)), n < t.openEnd && (t = new J(Je(t.content, 1, n, t.openEnd, 0, 0), t.openStart, n)), t;
1983
- }
1984
- const an = {
1985
- thead: ["table"],
1986
- tbody: ["table"],
1987
- tfoot: ["table"],
1988
- caption: ["table"],
1989
- colgroup: ["table"],
1990
- col: ["table", "colgroup"],
1991
- tr: ["table", "tbody"],
1992
- td: ["table", "tbody", "tr"],
1993
- th: ["table", "tbody", "tr"]
1994
- };
1995
- let Tt = null;
1996
- function cn() {
1997
- return Tt || (Tt = document.implementation.createHTMLDocument("title"));
1998
- }
1999
- let $e = null;
2000
- function go(t) {
2001
- let e = window.trustedTypes;
2002
- return e ? ($e || ($e = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (n) => n })), $e.createHTML(t)) : t;
2003
- }
2004
- function yo(t) {
2005
- let e = /^(\s*<meta [^>]*>)*/.exec(t);
2006
- e && (t = t.slice(e[0].length));
2007
- let n = cn().createElement("div"), o = /<([a-z][^>\s]+)/i.exec(t), i;
2008
- if ((i = o && an[o[1].toLowerCase()]) && (t = i.map((s) => "<" + s + ">").join("") + t + i.map((s) => "</" + s + ">").reverse().join("")), n.innerHTML = go(t), i)
2009
- for (let s = 0; s < i.length; s++)
2010
- n = n.querySelector(i[s]) || n;
2011
- return n;
2012
- }
2013
- function bo(t) {
2014
- let e = t.querySelectorAll(M ? "span:not([class]):not([style])" : "span.Apple-converted-space");
2015
- for (let n = 0; n < e.length; n++) {
2016
- let o = e[n];
2017
- o.childNodes.length == 1 && o.textContent == " " && o.parentNode && o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "), o);
2018
- }
2019
- }
2020
- function Do(t, e) {
2021
- if (!t.size)
2022
- return t;
2023
- let n = t.content.firstChild.type.schema, o;
2024
- try {
2025
- o = JSON.parse(e);
2026
- } catch {
2027
- return t;
2028
- }
2029
- let { content: i, openStart: s, openEnd: r } = t;
2030
- for (let l = o.length - 2; l >= 0; l -= 2) {
2031
- let a = n.nodes[o[l]];
2032
- if (!a || a.hasRequiredAttrs())
2033
- break;
2034
- i = _.from(a.create(o[l + 1], i)), s++, r++;
2035
- }
2036
- return new J(i, s, r);
2037
- }
2038
- const T = {}, A = {}, No = { touchstart: !0, touchmove: !0 };
2039
- class So {
2040
- constructor() {
2041
- this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "", button: 0 }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
2042
- }
2043
- }
2044
- function Co(t) {
2045
- for (let e in T) {
2046
- let n = T[e];
2047
- t.dom.addEventListener(e, t.input.eventHandlers[e] = (o) => {
2048
- Mo(t, o) && !tt(t, o) && (t.editable || !(o.type in A)) && n(t, o);
2049
- }, No[e] ? { passive: !0 } : void 0);
2050
- }
2051
- k && t.dom.addEventListener("input", () => null), Ze(t);
2052
- }
2053
- function X(t, e) {
2054
- t.input.lastSelectionOrigin = e, t.input.lastSelectionTime = Date.now();
2055
- }
2056
- function Oo(t) {
2057
- t.domObserver.stop();
2058
- for (let e in t.input.eventHandlers)
2059
- t.dom.removeEventListener(e, t.input.eventHandlers[e]);
2060
- clearTimeout(t.input.composingTimeout), clearTimeout(t.input.lastIOSEnterFallbackTimeout);
2061
- }
2062
- function Ze(t) {
2063
- t.someProp("handleDOMEvents", (e) => {
2064
- for (let n in e)
2065
- t.input.eventHandlers[n] || t.dom.addEventListener(n, t.input.eventHandlers[n] = (o) => tt(t, o));
2066
- });
2067
- }
2068
- function tt(t, e) {
2069
- return t.someProp("handleDOMEvents", (n) => {
2070
- let o = n[e.type];
2071
- return o ? o(t, e) || e.defaultPrevented : !1;
2072
- });
2073
- }
2074
- function Mo(t, e) {
2075
- if (!e.bubbles)
2076
- return !0;
2077
- if (e.defaultPrevented)
2078
- return !1;
2079
- for (let n = e.target; n != t.dom; n = n.parentNode)
2080
- if (!n || n.nodeType == 11 || n.pmViewDesc && n.pmViewDesc.stopEvent(e))
2081
- return !1;
2082
- return !0;
2083
- }
2084
- function xo(t, e) {
2085
- !tt(t, e) && T[e.type] && (t.editable || !(e.type in A)) && T[e.type](t, e);
2086
- }
2087
- A.keydown = (t, e) => {
2088
- let n = e;
2089
- if (t.input.shiftKey = n.keyCode == 16 || n.shiftKey, !fn(t, n) && (t.input.lastKeyCode = n.keyCode, t.input.lastKeyCodeTime = Date.now(), !(H && M && n.keyCode == 13)))
2090
- if (n.keyCode != 229 && t.domObserver.forceFlush(), pe && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
2091
- let o = Date.now();
2092
- t.input.lastIOSEnter = o, t.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
2093
- t.input.lastIOSEnter == o && (t.someProp("handleKeyDown", (i) => i(t, te(13, "Enter"))), t.input.lastIOSEnter = 0);
2094
- }, 200);
2095
- } else t.someProp("handleKeyDown", (o) => o(t, n)) || uo(t, n) ? n.preventDefault() : X(t, "key");
2096
- };
2097
- A.keyup = (t, e) => {
2098
- e.keyCode == 16 && (t.input.shiftKey = !1);
2099
- };
2100
- A.keypress = (t, e) => {
2101
- let n = e;
2102
- if (fn(t, n) || !n.charCode || n.ctrlKey && !n.altKey || R && n.metaKey)
2103
- return;
2104
- if (t.someProp("handleKeyPress", (i) => i(t, n))) {
2105
- n.preventDefault();
2106
- return;
2107
- }
2108
- let o = t.state.selection;
2109
- if (!(o instanceof x) || !o.$from.sameParent(o.$to)) {
2110
- let i = String.fromCharCode(n.charCode), s = () => t.state.tr.insertText(i).scrollIntoView();
2111
- !/[\r\n]/.test(i) && !t.someProp("handleTextInput", (r) => r(t, o.$from.pos, o.$to.pos, i, s)) && t.dispatch(s()), n.preventDefault();
2112
- }
2113
- };
2114
- function Fe(t) {
2115
- return { left: t.clientX, top: t.clientY };
2116
- }
2117
- function ko(t, e) {
2118
- let n = e.x - t.clientX, o = e.y - t.clientY;
2119
- return n * n + o * o < 100;
2120
- }
2121
- function nt(t, e, n, o, i) {
2122
- if (o == -1)
2123
- return !1;
2124
- let s = t.state.doc.resolve(o);
2125
- for (let r = s.depth + 1; r > 0; r--)
2126
- if (t.someProp(e, (l) => r > s.depth ? l(t, n, s.nodeAfter, s.before(r), i, !0) : l(t, n, s.node(r), s.before(r), i, !1)))
2127
- return !0;
2128
- return !1;
2129
- }
2130
- function fe(t, e, n) {
2131
- if (t.focused || t.focus(), t.state.selection.eq(e))
2132
- return;
2133
- let o = t.state.tr.setSelection(e);
2134
- o.setMeta("pointer", !0), t.dispatch(o);
2135
- }
2136
- function To(t, e) {
2137
- if (e == -1)
2138
- return !1;
2139
- let n = t.state.doc.resolve(e), o = n.nodeAfter;
2140
- return o && o.isAtom && D.isSelectable(o) ? (fe(t, new D(n)), !0) : !1;
2141
- }
2142
- function Ao(t, e) {
2143
- if (e == -1)
2144
- return !1;
2145
- let n = t.state.selection, o, i;
2146
- n instanceof D && (o = n.node);
2147
- let s = t.state.doc.resolve(e);
2148
- for (let r = s.depth + 1; r > 0; r--) {
2149
- let l = r > s.depth ? s.nodeAfter : s.node(r);
2150
- if (D.isSelectable(l)) {
2151
- o && n.$from.depth > 0 && r >= n.$from.depth && s.before(n.$from.depth + 1) == n.$from.pos ? i = s.before(n.$from.depth) : i = s.before(r);
2152
- break;
2153
- }
2154
- }
2155
- return i != null ? (fe(t, D.create(t.state.doc, i)), !0) : !1;
2156
- }
2157
- function Eo(t, e, n, o, i) {
2158
- return nt(t, "handleClickOn", e, n, o) || t.someProp("handleClick", (s) => s(t, e, o)) || (i ? Ao(t, n) : To(t, n));
2159
- }
2160
- function Po(t, e, n, o) {
2161
- return nt(t, "handleDoubleClickOn", e, n, o) || t.someProp("handleDoubleClick", (i) => i(t, e, o));
2162
- }
2163
- function Vo(t, e, n, o) {
2164
- return nt(t, "handleTripleClickOn", e, n, o) || t.someProp("handleTripleClick", (i) => i(t, e, o)) || Ro(t, n, o);
2165
- }
2166
- function Ro(t, e, n) {
2167
- if (n.button != 0)
2168
- return !1;
2169
- let o = t.state.doc;
2170
- if (e == -1)
2171
- return o.inlineContent ? (fe(t, x.create(o, 0, o.content.size)), !0) : !1;
2172
- let i = o.resolve(e);
2173
- for (let s = i.depth + 1; s > 0; s--) {
2174
- let r = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
2175
- if (r.inlineContent)
2176
- fe(t, x.create(o, l + 1, l + 1 + r.content.size));
2177
- else if (D.isSelectable(r))
2178
- fe(t, D.create(o, l));
2179
- else
2180
- continue;
2181
- return !0;
2182
- }
2183
- }
2184
- function ot(t) {
2185
- return Ee(t);
2186
- }
2187
- const dn = R ? "metaKey" : "ctrlKey";
2188
- T.mousedown = (t, e) => {
2189
- let n = e;
2190
- t.input.shiftKey = n.shiftKey;
2191
- let o = ot(t), i = Date.now(), s = "singleClick";
2192
- i - t.input.lastClick.time < 500 && ko(n, t.input.lastClick) && !n[dn] && t.input.lastClick.button == n.button && (t.input.lastClick.type == "singleClick" ? s = "doubleClick" : t.input.lastClick.type == "doubleClick" && (s = "tripleClick")), t.input.lastClick = { time: i, x: n.clientX, y: n.clientY, type: s, button: n.button };
2193
- let r = t.posAtCoords(Fe(n));
2194
- r && (s == "singleClick" ? (t.input.mouseDown && t.input.mouseDown.done(), t.input.mouseDown = new Bo(t, r, n, !!o)) : (s == "doubleClick" ? Po : Vo)(t, r.pos, r.inside, n) ? n.preventDefault() : X(t, "pointer"));
2195
- };
2196
- class Bo {
2197
- constructor(e, n, o, i) {
2198
- this.view = e, this.pos = n, this.event = o, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!o[dn], this.allowDefault = o.shiftKey;
2199
- let s, r;
2200
- if (n.inside > -1)
2201
- s = e.state.doc.nodeAt(n.inside), r = n.inside;
2202
- else {
2203
- let d = e.state.doc.resolve(n.pos);
2204
- s = d.parent, r = d.depth ? d.before() : 0;
2205
- }
2206
- const l = i ? null : o.target, a = l ? e.docView.nearestDesc(l, !0) : null;
2207
- this.target = a && a.dom.nodeType == 1 ? a.dom : null;
2208
- let { selection: c } = e.state;
2209
- (o.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof D && c.from <= r && c.to > r) && (this.mightDrag = {
2210
- node: s,
2211
- pos: r,
2212
- addAttr: !!(this.target && !this.target.draggable),
2213
- setUneditable: !!(this.target && z && !this.target.hasAttribute("contentEditable"))
2214
- }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
2215
- this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
2216
- }, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), X(e, "pointer");
2217
- }
2218
- done() {
2219
- this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => W(this.view)), this.view.input.mouseDown = null;
2220
- }
2221
- up(e) {
2222
- if (this.done(), !this.view.dom.contains(e.target))
2223
- return;
2224
- let n = this.pos;
2225
- this.view.state.doc != this.startDoc && (n = this.view.posAtCoords(Fe(e))), this.updateAllowDefault(e), this.allowDefault || !n ? X(this.view, "pointer") : Eo(this.view, n.pos, n.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
2226
- k && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
2227
- // cursor, but still report that the node is selected
2228
- // when asked through getSelection. You'll then get a
2229
- // situation where clicking at the point where that
2230
- // (hidden) cursor is doesn't change the selection, and
2231
- // thus doesn't get a reaction from ProseMirror. This
2232
- // works around that.
2233
- M && !this.view.state.selection.visible && Math.min(Math.abs(n.pos - this.view.state.selection.from), Math.abs(n.pos - this.view.state.selection.to)) <= 2) ? (fe(this.view, he.near(this.view.state.doc.resolve(n.pos))), e.preventDefault()) : X(this.view, "pointer");
2234
- }
2235
- move(e) {
2236
- this.updateAllowDefault(e), X(this.view, "pointer"), e.buttons == 0 && this.done();
2237
- }
2238
- updateAllowDefault(e) {
2239
- !this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
2240
- }
2241
- }
2242
- T.touchstart = (t) => {
2243
- t.input.lastTouch = Date.now(), ot(t), X(t, "pointer");
2244
- };
2245
- T.touchmove = (t) => {
2246
- t.input.lastTouch = Date.now(), X(t, "pointer");
2247
- };
2248
- T.contextmenu = (t) => ot(t);
2249
- function fn(t, e) {
2250
- return t.composing ? !0 : k && Math.abs(e.timeStamp - t.input.compositionEndedAt) < 500 ? (t.input.compositionEndedAt = -2e8, !0) : !1;
2251
- }
2252
- const Io = H ? 5e3 : -1;
2253
- A.compositionstart = A.compositionupdate = (t) => {
2254
- if (!t.composing) {
2255
- t.domObserver.flush();
2256
- let { state: e } = t, n = e.selection.$to;
2257
- if (e.selection instanceof x && (e.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((o) => o.type.spec.inclusive === !1)))
2258
- t.markCursor = t.state.storedMarks || n.marks(), Ee(t, !0), t.markCursor = null;
2259
- else if (Ee(t, !e.selection.empty), z && e.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
2260
- let o = t.domSelectionRange();
2261
- for (let i = o.focusNode, s = o.focusOffset; i && i.nodeType == 1 && s != 0; ) {
2262
- let r = s < 0 ? i.lastChild : i.childNodes[s - 1];
2263
- if (!r)
2264
- break;
2265
- if (r.nodeType == 3) {
2266
- let l = t.domSelection();
2267
- l && l.collapse(r, r.nodeValue.length);
2268
- break;
2269
- } else
2270
- i = r, s = -1;
2271
- }
2272
- }
2273
- t.input.composing = !0;
2274
- }
2275
- hn(t, Io);
2276
- };
2277
- A.compositionend = (t, e) => {
2278
- t.composing && (t.input.composing = !1, t.input.compositionEndedAt = e.timeStamp, t.input.compositionPendingChanges = t.domObserver.pendingRecords().length ? t.input.compositionID : 0, t.input.compositionNode = null, t.input.compositionPendingChanges && Promise.resolve().then(() => t.domObserver.flush()), t.input.compositionID++, hn(t, 20));
2279
- };
2280
- function hn(t, e) {
2281
- clearTimeout(t.input.composingTimeout), e > -1 && (t.input.composingTimeout = setTimeout(() => Ee(t), e));
2282
- }
2283
- function un(t) {
2284
- for (t.composing && (t.input.composing = !1, t.input.compositionEndedAt = zo()); t.input.compositionNodes.length > 0; )
2285
- t.input.compositionNodes.pop().markParentsDirty();
2286
- }
2287
- function Fo(t) {
2288
- let e = t.domSelectionRange();
2289
- if (!e.focusNode)
2290
- return null;
2291
- let n = kn(e.focusNode, e.focusOffset), o = Tn(e.focusNode, e.focusOffset);
2292
- if (n && o && n != o) {
2293
- let i = o.pmViewDesc, s = t.domObserver.lastChangedTextNode;
2294
- if (n == s || o == s)
2295
- return s;
2296
- if (!i || !i.isText(o.nodeValue))
2297
- return o;
2298
- if (t.input.compositionNode == o) {
2299
- let r = n.pmViewDesc;
2300
- if (!(!r || !r.isText(n.nodeValue)))
2301
- return o;
2302
- }
2303
- }
2304
- return n || o;
2305
- }
2306
- function zo() {
2307
- let t = document.createEvent("Event");
2308
- return t.initEvent("event", !0, !0), t.timeStamp;
2309
- }
2310
- function Ee(t, e = !1) {
2311
- if (!(H && t.domObserver.flushingSoon >= 0)) {
2312
- if (t.domObserver.forceFlush(), un(t), e || t.docView && t.docView.dirty) {
2313
- let n = we(t), o = t.state.selection;
2314
- return n && !n.eq(o) ? t.dispatch(t.state.tr.setSelection(n)) : (t.markCursor || e) && !o.$from.node(o.$from.sharedDepth(o.to)).inlineContent ? t.dispatch(t.state.tr.deleteSelection()) : t.updateState(t.state), !0;
2315
- }
2316
- return !1;
2317
- }
2318
- }
2319
- function Lo(t, e) {
2320
- if (!t.dom.parentNode)
2321
- return;
2322
- let n = t.dom.parentNode.appendChild(document.createElement("div"));
2323
- n.appendChild(e), n.style.cssText = "position: fixed; left: -10000px; top: 10px";
2324
- let o = getSelection(), i = document.createRange();
2325
- i.selectNodeContents(e), t.dom.blur(), o.removeAllRanges(), o.addRange(i), setTimeout(() => {
2326
- n.parentNode && n.parentNode.removeChild(n), t.focus();
2327
- }, 50);
2328
- }
2329
- const De = P && Z < 15 || pe && Rn < 604;
2330
- T.copy = A.cut = (t, e) => {
2331
- let n = e, o = t.state.selection, i = n.type == "cut";
2332
- if (o.empty)
2333
- return;
2334
- let s = De ? null : n.clipboardData, r = o.content(), { dom: l, text: a } = et(t, r);
2335
- s ? (n.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : Lo(t, l), i && t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
2336
- };
2337
- function $o(t) {
2338
- return t.openStart == 0 && t.openEnd == 0 && t.content.childCount == 1 ? t.content.firstChild : null;
2339
- }
2340
- function qo(t, e) {
2341
- if (!t.dom.parentNode)
2342
- return;
2343
- let n = t.input.shiftKey || t.state.selection.$from.parent.type.spec.code, o = t.dom.parentNode.appendChild(document.createElement(n ? "textarea" : "div"));
2344
- n || (o.contentEditable = "true"), o.style.cssText = "position: fixed; left: -10000px; top: 10px", o.focus();
2345
- let i = t.input.shiftKey && t.input.lastKeyCode != 45;
2346
- setTimeout(() => {
2347
- t.focus(), o.parentNode && o.parentNode.removeChild(o), n ? Ne(t, o.value, null, i, e) : Ne(t, o.textContent, o.innerHTML, i, e);
2348
- }, 50);
2349
- }
2350
- function Ne(t, e, n, o, i) {
2351
- let s = on(t, e, n, o, t.state.selection.$from);
2352
- if (t.someProp("handlePaste", (a) => a(t, i, s || J.empty)))
2353
- return !0;
2354
- if (!s)
2355
- return !1;
2356
- let r = $o(s), l = r ? t.state.tr.replaceSelectionWith(r, o) : t.state.tr.replaceSelection(s);
2357
- return t.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
2358
- }
2359
- function pn(t) {
2360
- let e = t.getData("text/plain") || t.getData("Text");
2361
- if (e)
2362
- return e;
2363
- let n = t.getData("text/uri-list");
2364
- return n ? n.replace(/\r?\n/g, " ") : "";
2365
- }
2366
- A.paste = (t, e) => {
2367
- let n = e;
2368
- if (t.composing && !H)
2369
- return;
2370
- let o = De ? null : n.clipboardData, i = t.input.shiftKey && t.input.lastKeyCode != 45;
2371
- o && Ne(t, pn(o), o.getData("text/html"), i, n) ? n.preventDefault() : qo(t, n);
2372
- };
2373
- class mn {
2374
- constructor(e, n, o) {
2375
- this.slice = e, this.move = n, this.node = o;
2376
- }
2377
- }
2378
- const Ko = R ? "altKey" : "ctrlKey";
2379
- function gn(t, e) {
2380
- let n = t.someProp("dragCopies", (o) => !o(e));
2381
- return n ?? !e[Ko];
2382
- }
2383
- T.dragstart = (t, e) => {
2384
- let n = e, o = t.input.mouseDown;
2385
- if (o && o.done(), !n.dataTransfer)
2386
- return;
2387
- let i = t.state.selection, s = i.empty ? null : t.posAtCoords(Fe(n)), r;
2388
- if (!(s && s.pos >= i.from && s.pos <= (i instanceof D ? i.to - 1 : i.to))) {
2389
- if (o && o.mightDrag)
2390
- r = D.create(t.state.doc, o.mightDrag.pos);
2391
- else if (n.target && n.target.nodeType == 1) {
2392
- let f = t.docView.nearestDesc(n.target, !0);
2393
- f && f.node.type.spec.draggable && f != t.docView && (r = D.create(t.state.doc, f.posBefore));
2394
- }
2395
- }
2396
- let l = (r || t.state.selection).content(), { dom: a, text: c, slice: d } = et(t, l);
2397
- (!n.dataTransfer.files.length || !M || Ht > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData(De ? "Text" : "text/html", a.innerHTML), n.dataTransfer.effectAllowed = "copyMove", De || n.dataTransfer.setData("text/plain", c), t.dragging = new mn(d, gn(t, n), r);
2398
- };
2399
- T.dragend = (t) => {
2400
- let e = t.dragging;
2401
- window.setTimeout(() => {
2402
- t.dragging == e && (t.dragging = null);
2403
- }, 50);
2404
- };
2405
- A.dragover = A.dragenter = (t, e) => e.preventDefault();
2406
- A.drop = (t, e) => {
2407
- let n = e, o = t.dragging;
2408
- if (t.dragging = null, !n.dataTransfer)
2409
- return;
2410
- let i = t.posAtCoords(Fe(n));
2411
- if (!i)
2412
- return;
2413
- let s = t.state.doc.resolve(i.pos), r = o && o.slice;
2414
- r ? t.someProp("transformPasted", (h) => {
2415
- r = h(r, t);
2416
- }) : r = on(t, pn(n.dataTransfer), De ? null : n.dataTransfer.getData("text/html"), !1, s);
2417
- let l = !!(o && gn(t, n));
2418
- if (t.someProp("handleDrop", (h) => h(t, n, r || J.empty, l))) {
2419
- n.preventDefault();
2420
- return;
2421
- }
2422
- if (!r)
2423
- return;
2424
- n.preventDefault();
2425
- let a = r ? On(t.state.doc, s.pos, r) : s.pos;
2426
- a == null && (a = s.pos);
2427
- let c = t.state.tr;
2428
- if (l) {
2429
- let { node: h } = o;
2430
- h ? h.replace(c) : c.deleteSelection();
2431
- }
2432
- let d = c.mapping.map(a), f = r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1, u = c.doc;
2433
- if (f ? c.replaceRangeWith(d, d, r.content.firstChild) : c.replaceRange(d, d, r), c.doc.eq(u))
2434
- return;
2435
- let p = c.doc.resolve(d);
2436
- if (f && D.isSelectable(r.content.firstChild) && p.nodeAfter && p.nodeAfter.sameMarkup(r.content.firstChild))
2437
- c.setSelection(new D(p));
2438
- else {
2439
- let h = c.mapping.map(a);
2440
- c.mapping.maps[c.mapping.maps.length - 1].forEach((g, m, y, V) => h = V), c.setSelection(ve(t, p, c.doc.resolve(h)));
2441
- }
2442
- t.focus(), t.dispatch(c.setMeta("uiEvent", "drop"));
2443
- };
2444
- T.focus = (t) => {
2445
- t.input.lastFocus = Date.now(), t.focused || (t.domObserver.stop(), t.dom.classList.add("ProseMirror-focused"), t.domObserver.start(), t.focused = !0, setTimeout(() => {
2446
- t.docView && t.hasFocus() && !t.domObserver.currentSelection.eq(t.domSelectionRange()) && W(t);
2447
- }, 20));
2448
- };
2449
- T.blur = (t, e) => {
2450
- let n = e;
2451
- t.focused && (t.domObserver.stop(), t.dom.classList.remove("ProseMirror-focused"), t.domObserver.start(), n.relatedTarget && t.dom.contains(n.relatedTarget) && t.domObserver.currentSelection.clear(), t.focused = !1);
2452
- };
2453
- T.beforeinput = (t, e) => {
2454
- if (M && H && e.inputType == "deleteContentBackward") {
2455
- t.domObserver.flushSoon();
2456
- let { domChangeCount: o } = t.input;
2457
- setTimeout(() => {
2458
- if (t.input.domChangeCount != o || (t.dom.blur(), t.focus(), t.someProp("handleKeyDown", (s) => s(t, te(8, "Backspace")))))
2459
- return;
2460
- let { $cursor: i } = t.state.selection;
2461
- i && i.pos > 0 && t.dispatch(t.state.tr.delete(i.pos - 1, i.pos).scrollIntoView());
2462
- }, 50);
2463
- }
2464
- };
2465
- for (let t in A)
2466
- T[t] = A[t];
2467
- function Se(t, e) {
2468
- if (t == e)
2469
- return !0;
2470
- for (let n in t)
2471
- if (t[n] !== e[n])
2472
- return !1;
2473
- for (let n in e)
2474
- if (!(n in t))
2475
- return !1;
2476
- return !0;
2477
- }
2478
- class Pe {
2479
- constructor(e, n) {
2480
- this.toDOM = e, this.spec = n || ie, this.side = this.spec.side || 0;
2481
- }
2482
- map(e, n, o, i) {
2483
- let { pos: s, deleted: r } = e.mapResult(n.from + i, this.side < 0 ? -1 : 1);
2484
- return r ? null : new F(s - o, s - o, this);
2485
- }
2486
- valid() {
2487
- return !0;
2488
- }
2489
- eq(e) {
2490
- return this == e || e instanceof Pe && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && Se(this.spec, e.spec));
2491
- }
2492
- destroy(e) {
2493
- this.spec.destroy && this.spec.destroy(e);
2494
- }
2495
- }
2496
- class w {
2497
- constructor(e, n) {
2498
- this.attrs = e, this.spec = n || ie;
2499
- }
2500
- map(e, n, o, i) {
2501
- let s = e.map(n.from + i, this.spec.inclusiveStart ? -1 : 1) - o, r = e.map(n.to + i, this.spec.inclusiveEnd ? 1 : -1) - o;
2502
- return s >= r ? null : new F(s, r, this);
2503
- }
2504
- valid(e, n) {
2505
- return n.from < n.to;
2506
- }
2507
- eq(e) {
2508
- return this == e || e instanceof w && Se(this.attrs, e.attrs) && Se(this.spec, e.spec);
2509
- }
2510
- static is(e) {
2511
- return e.type instanceof w;
2512
- }
2513
- destroy() {
2514
- }
2515
- }
2516
- class it {
2517
- constructor(e, n) {
2518
- this.attrs = e, this.spec = n || ie;
2519
- }
2520
- map(e, n, o, i) {
2521
- let s = e.mapResult(n.from + i, 1);
2522
- if (s.deleted)
2523
- return null;
2524
- let r = e.mapResult(n.to + i, -1);
2525
- return r.deleted || r.pos <= s.pos ? null : new F(s.pos - o, r.pos - o, this);
2526
- }
2527
- valid(e, n) {
2528
- let { index: o, offset: i } = e.content.findIndex(n.from), s;
2529
- return i == n.from && !(s = e.child(o)).isText && i + s.nodeSize == n.to;
2530
- }
2531
- eq(e) {
2532
- return this == e || e instanceof it && Se(this.attrs, e.attrs) && Se(this.spec, e.spec);
2533
- }
2534
- destroy() {
2535
- }
2536
- }
2537
- class F {
2538
- /**
2539
- @internal
2540
- */
2541
- constructor(e, n, o) {
2542
- this.from = e, this.to = n, this.type = o;
2543
- }
2544
- /**
2545
- @internal
2546
- */
2547
- copy(e, n) {
2548
- return new F(e, n, this.type);
2549
- }
2550
- /**
2551
- @internal
2552
- */
2553
- eq(e, n = 0) {
2554
- return this.type.eq(e.type) && this.from + n == e.from && this.to + n == e.to;
2555
- }
2556
- /**
2557
- @internal
2558
- */
2559
- map(e, n, o) {
2560
- return this.type.map(e, this, n, o);
2561
- }
2562
- /**
2563
- Creates a widget decoration, which is a DOM node that's shown in
2564
- the document at the given position. It is recommended that you
2565
- delay rendering the widget by passing a function that will be
2566
- called when the widget is actually drawn in a view, but you can
2567
- also directly pass a DOM node. `getPos` can be used to find the
2568
- widget's current document position.
2569
- */
2570
- static widget(e, n, o) {
2571
- return new F(e, e, new Pe(n, o));
2572
- }
2573
- /**
2574
- Creates an inline decoration, which adds the given attributes to
2575
- each inline node between `from` and `to`.
2576
- */
2577
- static inline(e, n, o, i) {
2578
- return new F(e, n, new w(o, i));
2579
- }
2580
- /**
2581
- Creates a node decoration. `from` and `to` should point precisely
2582
- before and after a node in the document. That node, and only that
2583
- node, will receive the given attributes.
2584
- */
2585
- static node(e, n, o, i) {
2586
- return new F(e, n, new it(o, i));
2587
- }
2588
- /**
2589
- The spec provided when creating this decoration. Can be useful
2590
- if you've stored extra information in that object.
2591
- */
2592
- get spec() {
2593
- return this.type.spec;
2594
- }
2595
- /**
2596
- @internal
2597
- */
2598
- get inline() {
2599
- return this.type instanceof w;
2600
- }
2601
- /**
2602
- @internal
2603
- */
2604
- get widget() {
2605
- return this.type instanceof Pe;
2606
- }
2607
- }
2608
- const de = [], ie = {};
2609
- class S {
2610
- /**
2611
- @internal
2612
- */
2613
- constructor(e, n) {
2614
- this.local = e.length ? e : de, this.children = n.length ? n : de;
2615
- }
2616
- /**
2617
- Create a set of decorations, using the structure of the given
2618
- document. This will consume (modify) the `decorations` array, so
2619
- you must make a copy if you want need to preserve that.
2620
- */
2621
- static create(e, n) {
2622
- return n.length ? Ve(n, e, 0, ie) : O;
2623
- }
2624
- /**
2625
- Find all decorations in this set which touch the given range
2626
- (including decorations that start or end directly at the
2627
- boundaries) and match the given predicate on their spec. When
2628
- `start` and `end` are omitted, all decorations in the set are
2629
- considered. When `predicate` isn't given, all decorations are
2630
- assumed to match.
2631
- */
2632
- find(e, n, o) {
2633
- let i = [];
2634
- return this.findInner(e ?? 0, n ?? 1e9, i, 0, o), i;
2635
- }
2636
- findInner(e, n, o, i, s) {
2637
- for (let r = 0; r < this.local.length; r++) {
2638
- let l = this.local[r];
2639
- l.from <= n && l.to >= e && (!s || s(l.spec)) && o.push(l.copy(l.from + i, l.to + i));
2640
- }
2641
- for (let r = 0; r < this.children.length; r += 3)
2642
- if (this.children[r] < n && this.children[r + 1] > e) {
2643
- let l = this.children[r] + 1;
2644
- this.children[r + 2].findInner(e - l, n - l, o, i + l, s);
2645
- }
2646
- }
2647
- /**
2648
- Map the set of decorations in response to a change in the
2649
- document.
2650
- */
2651
- map(e, n, o) {
2652
- return this == O || e.maps.length == 0 ? this : this.mapInner(e, n, 0, 0, o || ie);
2653
- }
2654
- /**
2655
- @internal
2656
- */
2657
- mapInner(e, n, o, i, s) {
2658
- let r;
2659
- for (let l = 0; l < this.local.length; l++) {
2660
- let a = this.local[l].map(e, o, i);
2661
- a && a.type.valid(n, a) ? (r || (r = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
2662
- }
2663
- return this.children.length ? Ho(this.children, r || [], e, n, o, i, s) : r ? new S(r.sort(se), de) : O;
2664
- }
2665
- /**
2666
- Add the given array of decorations to the ones in the set,
2667
- producing a new set. Consumes the `decorations` array. Needs
2668
- access to the current document to create the appropriate tree
2669
- structure.
2670
- */
2671
- add(e, n) {
2672
- return n.length ? this == O ? S.create(e, n) : this.addInner(e, n, 0) : this;
2673
- }
2674
- addInner(e, n, o) {
2675
- let i, s = 0;
2676
- e.forEach((l, a) => {
2677
- let c = a + o, d;
2678
- if (d = bn(n, l, c)) {
2679
- for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
2680
- s += 3;
2681
- i[s] == a ? i[s + 2] = i[s + 2].addInner(l, d, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Ve(d, l, c + 1, ie)), s += 3;
2682
- }
2683
- });
2684
- let r = yn(s ? Dn(n) : n, -o);
2685
- for (let l = 0; l < r.length; l++)
2686
- r[l].type.valid(e, r[l]) || r.splice(l--, 1);
2687
- return new S(r.length ? this.local.concat(r).sort(se) : this.local, i || this.children);
2688
- }
2689
- /**
2690
- Create a new set that contains the decorations in this set, minus
2691
- the ones in the given array.
2692
- */
2693
- remove(e) {
2694
- return e.length == 0 || this == O ? this : this.removeInner(e, 0);
2695
- }
2696
- removeInner(e, n) {
2697
- let o = this.children, i = this.local;
2698
- for (let s = 0; s < o.length; s += 3) {
2699
- let r, l = o[s] + n, a = o[s + 1] + n;
2700
- for (let d = 0, f; d < e.length; d++)
2701
- (f = e[d]) && f.from > l && f.to < a && (e[d] = null, (r || (r = [])).push(f));
2702
- if (!r)
2703
- continue;
2704
- o == this.children && (o = this.children.slice());
2705
- let c = o[s + 2].removeInner(r, l + 1);
2706
- c != O ? o[s + 2] = c : (o.splice(s, 3), s -= 3);
2707
- }
2708
- if (i.length) {
2709
- for (let s = 0, r; s < e.length; s++)
2710
- if (r = e[s])
2711
- for (let l = 0; l < i.length; l++)
2712
- i[l].eq(r, n) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
2713
- }
2714
- return o == this.children && i == this.local ? this : i.length || o.length ? new S(i, o) : O;
2715
- }
2716
- forChild(e, n) {
2717
- if (this == O)
2718
- return this;
2719
- if (n.isLeaf)
2720
- return S.empty;
2721
- let o, i;
2722
- for (let l = 0; l < this.children.length; l += 3)
2723
- if (this.children[l] >= e) {
2724
- this.children[l] == e && (o = this.children[l + 2]);
2725
- break;
2726
- }
2727
- let s = e + 1, r = s + n.content.size;
2728
- for (let l = 0; l < this.local.length; l++) {
2729
- let a = this.local[l];
2730
- if (a.from < r && a.to > s && a.type instanceof w) {
2731
- let c = Math.max(s, a.from) - s, d = Math.min(r, a.to) - s;
2732
- c < d && (i || (i = [])).push(a.copy(c, d));
2733
- }
2734
- }
2735
- if (i) {
2736
- let l = new S(i.sort(se), de);
2737
- return o ? new G([l, o]) : l;
2738
- }
2739
- return o || O;
2740
- }
2741
- /**
2742
- @internal
2743
- */
2744
- eq(e) {
2745
- if (this == e)
2746
- return !0;
2747
- if (!(e instanceof S) || this.local.length != e.local.length || this.children.length != e.children.length)
2748
- return !1;
2749
- for (let n = 0; n < this.local.length; n++)
2750
- if (!this.local[n].eq(e.local[n]))
2751
- return !1;
2752
- for (let n = 0; n < this.children.length; n += 3)
2753
- if (this.children[n] != e.children[n] || this.children[n + 1] != e.children[n + 1] || !this.children[n + 2].eq(e.children[n + 2]))
2754
- return !1;
2755
- return !0;
2756
- }
2757
- /**
2758
- @internal
2759
- */
2760
- locals(e) {
2761
- return st(this.localsInner(e));
2762
- }
2763
- /**
2764
- @internal
2765
- */
2766
- localsInner(e) {
2767
- if (this == O)
2768
- return de;
2769
- if (e.inlineContent || !this.local.some(w.is))
2770
- return this.local;
2771
- let n = [];
2772
- for (let o = 0; o < this.local.length; o++)
2773
- this.local[o].type instanceof w || n.push(this.local[o]);
2774
- return n;
2775
- }
2776
- forEachSet(e) {
2777
- e(this);
2778
- }
2779
- }
2780
- S.empty = new S([], []);
2781
- S.removeOverlap = st;
2782
- const O = S.empty;
2783
- class G {
2784
- constructor(e) {
2785
- this.members = e;
2786
- }
2787
- map(e, n) {
2788
- const o = this.members.map((i) => i.map(e, n, ie));
2789
- return G.from(o);
2790
- }
2791
- forChild(e, n) {
2792
- if (n.isLeaf)
2793
- return S.empty;
2794
- let o = [];
2795
- for (let i = 0; i < this.members.length; i++) {
2796
- let s = this.members[i].forChild(e, n);
2797
- s != O && (s instanceof G ? o = o.concat(s.members) : o.push(s));
2798
- }
2799
- return G.from(o);
2800
- }
2801
- eq(e) {
2802
- if (!(e instanceof G) || e.members.length != this.members.length)
2803
- return !1;
2804
- for (let n = 0; n < this.members.length; n++)
2805
- if (!this.members[n].eq(e.members[n]))
2806
- return !1;
2807
- return !0;
2808
- }
2809
- locals(e) {
2810
- let n, o = !0;
2811
- for (let i = 0; i < this.members.length; i++) {
2812
- let s = this.members[i].localsInner(e);
2813
- if (s.length)
2814
- if (!n)
2815
- n = s;
2816
- else {
2817
- o && (n = n.slice(), o = !1);
2818
- for (let r = 0; r < s.length; r++)
2819
- n.push(s[r]);
2820
- }
2821
- }
2822
- return n ? st(o ? n : n.sort(se)) : de;
2823
- }
2824
- // Create a group for the given array of decoration sets, or return
2825
- // a single set when possible.
2826
- static from(e) {
2827
- switch (e.length) {
2828
- case 0:
2829
- return O;
2830
- case 1:
2831
- return e[0];
2832
- default:
2833
- return new G(e.every((n) => n instanceof S) ? e : e.reduce((n, o) => n.concat(o instanceof S ? o : o.members), []));
2834
- }
2835
- }
2836
- forEachSet(e) {
2837
- for (let n = 0; n < this.members.length; n++)
2838
- this.members[n].forEachSet(e);
2839
- }
2840
- }
2841
- function Ho(t, e, n, o, i, s, r) {
2842
- let l = t.slice();
2843
- for (let c = 0, d = s; c < n.maps.length; c++) {
2844
- let f = 0;
2845
- n.maps[c].forEach((u, p, h, g) => {
2846
- let m = g - h - (p - u);
2847
- for (let y = 0; y < l.length; y += 3) {
2848
- let V = l[y + 1];
2849
- if (V < 0 || u > V + d - f)
2850
- continue;
2851
- let me = l[y] + d - f;
2852
- p >= me ? l[y + 1] = u <= me ? -2 : -1 : u >= d && m && (l[y] += m, l[y + 1] += m);
2853
- }
2854
- f += m;
2855
- }), d = n.maps[c].map(d, -1);
2856
- }
2857
- let a = !1;
2858
- for (let c = 0; c < l.length; c += 3)
2859
- if (l[c + 1] < 0) {
2860
- if (l[c + 1] == -2) {
2861
- a = !0, l[c + 1] = -1;
2862
- continue;
2863
- }
2864
- let d = n.map(t[c] + s), f = d - i;
2865
- if (f < 0 || f >= o.content.size) {
2866
- a = !0;
2867
- continue;
2868
- }
2869
- let u = n.map(t[c + 1] + s, -1), p = u - i, { index: h, offset: g } = o.content.findIndex(f), m = o.maybeChild(h);
2870
- if (m && g == f && g + m.nodeSize == p) {
2871
- let y = l[c + 2].mapInner(n, m, d + 1, t[c] + s + 1, r);
2872
- y != O ? (l[c] = f, l[c + 1] = p, l[c + 2] = y) : (l[c + 1] = -2, a = !0);
2873
- } else
2874
- a = !0;
2875
- }
2876
- if (a) {
2877
- let c = Wo(l, t, e, n, i, s, r), d = Ve(c, o, 0, r);
2878
- e = d.local;
2879
- for (let f = 0; f < l.length; f += 3)
2880
- l[f + 1] < 0 && (l.splice(f, 3), f -= 3);
2881
- for (let f = 0, u = 0; f < d.children.length; f += 3) {
2882
- let p = d.children[f];
2883
- for (; u < l.length && l[u] < p; )
2884
- u += 3;
2885
- l.splice(u, 0, d.children[f], d.children[f + 1], d.children[f + 2]);
2886
- }
2887
- }
2888
- return new S(e.sort(se), l);
2889
- }
2890
- function yn(t, e) {
2891
- if (!e || !t.length)
2892
- return t;
2893
- let n = [];
2894
- for (let o = 0; o < t.length; o++) {
2895
- let i = t[o];
2896
- n.push(new F(i.from + e, i.to + e, i.type));
2897
- }
2898
- return n;
2899
- }
2900
- function Wo(t, e, n, o, i, s, r) {
2901
- function l(a, c) {
2902
- for (let d = 0; d < a.local.length; d++) {
2903
- let f = a.local[d].map(o, i, c);
2904
- f ? n.push(f) : r.onRemove && r.onRemove(a.local[d].spec);
2905
- }
2906
- for (let d = 0; d < a.children.length; d += 3)
2907
- l(a.children[d + 2], a.children[d] + c + 1);
2908
- }
2909
- for (let a = 0; a < t.length; a += 3)
2910
- t[a + 1] == -1 && l(t[a + 2], e[a] + s + 1);
2911
- return n;
2912
- }
2913
- function bn(t, e, n) {
2914
- if (e.isLeaf)
2915
- return null;
2916
- let o = n + e.nodeSize, i = null;
2917
- for (let s = 0, r; s < t.length; s++)
2918
- (r = t[s]) && r.from > n && r.to < o && ((i || (i = [])).push(r), t[s] = null);
2919
- return i;
2920
- }
2921
- function Dn(t) {
2922
- let e = [];
2923
- for (let n = 0; n < t.length; n++)
2924
- t[n] != null && e.push(t[n]);
2925
- return e;
2926
- }
2927
- function Ve(t, e, n, o) {
2928
- let i = [], s = !1;
2929
- e.forEach((l, a) => {
2930
- let c = bn(t, l, a + n);
2931
- if (c) {
2932
- s = !0;
2933
- let d = Ve(c, l, n + a + 1, o);
2934
- d != O && i.push(a, a + l.nodeSize, d);
2935
- }
2936
- });
2937
- let r = yn(s ? Dn(t) : t, -n).sort(se);
2938
- for (let l = 0; l < r.length; l++)
2939
- r[l].type.valid(e, r[l]) || (o.onRemove && o.onRemove(r[l].spec), r.splice(l--, 1));
2940
- return r.length || i.length ? new S(r, i) : O;
2941
- }
2942
- function se(t, e) {
2943
- return t.from - e.from || t.to - e.to;
2944
- }
2945
- function st(t) {
2946
- let e = t;
2947
- for (let n = 0; n < e.length - 1; n++) {
2948
- let o = e[n];
2949
- if (o.from != o.to)
2950
- for (let i = n + 1; i < e.length; i++) {
2951
- let s = e[i];
2952
- if (s.from == o.from) {
2953
- s.to != o.to && (e == t && (e = t.slice()), e[i] = s.copy(s.from, o.to), At(e, i + 1, s.copy(o.to, s.to)));
2954
- continue;
2955
- } else {
2956
- s.from < o.to && (e == t && (e = t.slice()), e[n] = o.copy(o.from, s.from), At(e, i, o.copy(s.from, o.to)));
2957
- break;
2958
- }
2959
- }
2960
- }
2961
- return e;
2962
- }
2963
- function At(t, e, n) {
2964
- for (; e < t.length && se(n, t[e]) > 0; )
2965
- e++;
2966
- t.splice(e, 0, n);
2967
- }
2968
- function qe(t) {
2969
- let e = [];
2970
- return t.someProp("decorations", (n) => {
2971
- let o = n(t.state);
2972
- o && o != O && e.push(o);
2973
- }), t.cursorWrapper && e.push(S.create(t.state.doc, [t.cursorWrapper.deco])), G.from(e);
2974
- }
2975
- const _o = {
2976
- childList: !0,
2977
- characterData: !0,
2978
- characterDataOldValue: !0,
2979
- attributes: !0,
2980
- attributeOldValue: !0,
2981
- subtree: !0
2982
- }, jo = P && Z <= 11;
2983
- class Uo {
2984
- constructor() {
2985
- this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
2986
- }
2987
- set(e) {
2988
- this.anchorNode = e.anchorNode, this.anchorOffset = e.anchorOffset, this.focusNode = e.focusNode, this.focusOffset = e.focusOffset;
2989
- }
2990
- clear() {
2991
- this.anchorNode = this.focusNode = null;
2992
- }
2993
- eq(e) {
2994
- return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
2995
- }
2996
- }
2997
- class Yo {
2998
- constructor(e, n) {
2999
- this.view = e, this.handleDOMChange = n, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Uo(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((o) => {
3000
- for (let i = 0; i < o.length; i++)
3001
- this.queue.push(o[i]);
3002
- P && Z <= 11 && o.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
3003
- }), jo && (this.onCharData = (o) => {
3004
- this.queue.push({ target: o.target, type: "characterData", oldValue: o.prevValue }), this.flushSoon();
3005
- }), this.onSelectionChange = this.onSelectionChange.bind(this);
3006
- }
3007
- flushSoon() {
3008
- this.flushingSoon < 0 && (this.flushingSoon = window.setTimeout(() => {
3009
- this.flushingSoon = -1, this.flush();
3010
- }, 20));
3011
- }
3012
- forceFlush() {
3013
- this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
3014
- }
3015
- start() {
3016
- this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, _o)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
3017
- }
3018
- stop() {
3019
- if (this.observer) {
3020
- let e = this.observer.takeRecords();
3021
- if (e.length) {
3022
- for (let n = 0; n < e.length; n++)
3023
- this.queue.push(e[n]);
3024
- window.setTimeout(() => this.flush(), 20);
3025
- }
3026
- this.observer.disconnect();
3027
- }
3028
- this.onCharData && this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData), this.disconnectSelection();
3029
- }
3030
- connectSelection() {
3031
- this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
3032
- }
3033
- disconnectSelection() {
3034
- this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
3035
- }
3036
- suppressSelectionUpdates() {
3037
- this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
3038
- }
3039
- onSelectionChange() {
3040
- if (Nt(this.view)) {
3041
- if (this.suppressingSelectionUpdates)
3042
- return W(this.view);
3043
- if (P && Z <= 11 && !this.view.state.selection.empty) {
3044
- let e = this.view.domSelectionRange();
3045
- if (e.focusNode && re(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
3046
- return this.flushSoon();
3047
- }
3048
- this.flush();
3049
- }
3050
- }
3051
- setCurSelection() {
3052
- this.currentSelection.set(this.view.domSelectionRange());
3053
- }
3054
- ignoreSelectionChange(e) {
3055
- if (!e.focusNode)
3056
- return !0;
3057
- let n = /* @__PURE__ */ new Set(), o;
3058
- for (let s = e.focusNode; s; s = ue(s))
3059
- n.add(s);
3060
- for (let s = e.anchorNode; s; s = ue(s))
3061
- if (n.has(s)) {
3062
- o = s;
3063
- break;
3064
- }
3065
- let i = o && this.view.docView.nearestDesc(o);
3066
- if (i && i.ignoreMutation({
3067
- type: "selection",
3068
- target: o.nodeType == 3 ? o.parentNode : o
3069
- }))
3070
- return this.setCurSelection(), !0;
3071
- }
3072
- pendingRecords() {
3073
- if (this.observer)
3074
- for (let e of this.observer.takeRecords())
3075
- this.queue.push(e);
3076
- return this.queue;
3077
- }
3078
- flush() {
3079
- let { view: e } = this;
3080
- if (!e.docView || this.flushingSoon > -1)
3081
- return;
3082
- let n = this.pendingRecords();
3083
- n.length && (this.queue = []);
3084
- let o = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(o) && Nt(e) && !this.ignoreSelectionChange(o), s = -1, r = -1, l = !1, a = [];
3085
- if (e.editable)
3086
- for (let d = 0; d < n.length; d++) {
3087
- let f = this.registerMutation(n[d], a);
3088
- f && (s = s < 0 ? f.from : Math.min(f.from, s), r = r < 0 ? f.to : Math.max(f.to, r), f.typeOver && (l = !0));
3089
- }
3090
- if (z && a.length) {
3091
- let d = a.filter((f) => f.nodeName == "BR");
3092
- if (d.length == 2) {
3093
- let [f, u] = d;
3094
- f.parentNode && f.parentNode.parentNode == u.parentNode ? u.remove() : f.remove();
3095
- } else {
3096
- let { focusNode: f } = this.currentSelection;
3097
- for (let u of d) {
3098
- let p = u.parentNode;
3099
- p && p.nodeName == "LI" && (!f || Jo(e, f) != p) && u.remove();
3100
- }
3101
- }
3102
- }
3103
- let c = null;
3104
- s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Be(o) && (c = we(e)) && c.eq(he.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, W(e), this.currentSelection.set(o), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, r), Go(e)), this.handleDOMChange(s, r, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(o) || W(e), this.currentSelection.set(o));
3105
- }
3106
- registerMutation(e, n) {
3107
- if (n.indexOf(e.target) > -1)
3108
- return null;
3109
- let o = this.view.docView.nearestDesc(e.target);
3110
- if (e.type == "attributes" && (o == this.view.docView || e.attributeName == "contenteditable" || // Firefox sometimes fires spurious events for null/empty styles
3111
- e.attributeName == "style" && !e.oldValue && !e.target.getAttribute("style")) || !o || o.ignoreMutation(e))
3112
- return null;
3113
- if (e.type == "childList") {
3114
- for (let d = 0; d < e.addedNodes.length; d++) {
3115
- let f = e.addedNodes[d];
3116
- n.push(f), f.nodeType == 3 && (this.lastChangedTextNode = f);
3117
- }
3118
- if (o.contentDOM && o.contentDOM != o.dom && !o.contentDOM.contains(e.target))
3119
- return { from: o.posBefore, to: o.posAfter };
3120
- let i = e.previousSibling, s = e.nextSibling;
3121
- if (P && Z <= 11 && e.addedNodes.length)
3122
- for (let d = 0; d < e.addedNodes.length; d++) {
3123
- let { previousSibling: f, nextSibling: u } = e.addedNodes[d];
3124
- (!f || Array.prototype.indexOf.call(e.addedNodes, f) < 0) && (i = f), (!u || Array.prototype.indexOf.call(e.addedNodes, u) < 0) && (s = u);
3125
- }
3126
- let r = i && i.parentNode == e.target ? C(i) + 1 : 0, l = o.localPosFromDOM(e.target, r, -1), a = s && s.parentNode == e.target ? C(s) : e.target.childNodes.length, c = o.localPosFromDOM(e.target, a, 1);
3127
- return { from: l, to: c };
3128
- } else return e.type == "attributes" ? { from: o.posAtStart - o.border, to: o.posAtEnd + o.border } : (this.lastChangedTextNode = e.target, {
3129
- from: o.posAtStart,
3130
- to: o.posAtEnd,
3131
- // An event was generated for a text change that didn't change
3132
- // any text. Mark the dom change to fall back to assuming the
3133
- // selection was typed over with an identical value if it can't
3134
- // find another change.
3135
- typeOver: e.target.nodeValue == e.oldValue
3136
- });
3137
- }
3138
- }
3139
- let Et = /* @__PURE__ */ new WeakMap(), Pt = !1;
3140
- function Go(t) {
3141
- if (!Et.has(t) && (Et.set(t, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace) !== -1)) {
3142
- if (t.requiresGeckoHackNode = z, Pt)
3143
- return;
3144
- console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Pt = !0;
3145
- }
3146
- }
3147
- function Vt(t, e) {
3148
- let n = e.startContainer, o = e.startOffset, i = e.endContainer, s = e.endOffset, r = t.domAtPos(t.state.selection.anchor);
3149
- return re(r.node, r.offset, i, s) && ([n, o, i, s] = [i, s, n, o]), { anchorNode: n, anchorOffset: o, focusNode: i, focusOffset: s };
3150
- }
3151
- function Xo(t, e) {
3152
- if (e.getComposedRanges) {
3153
- let i = e.getComposedRanges(t.root)[0];
3154
- if (i)
3155
- return Vt(t, i);
3156
- }
3157
- let n;
3158
- function o(i) {
3159
- i.preventDefault(), i.stopImmediatePropagation(), n = i.getTargetRanges()[0];
3160
- }
3161
- return t.dom.addEventListener("beforeinput", o, !0), document.execCommand("indent"), t.dom.removeEventListener("beforeinput", o, !0), n ? Vt(t, n) : null;
3162
- }
3163
- function Jo(t, e) {
3164
- for (let n = e.parentNode; n && n != t.dom; n = n.parentNode) {
3165
- let o = t.docView.nearestDesc(n, !0);
3166
- if (o && o.node.isBlock)
3167
- return n;
3168
- }
3169
- return null;
3170
- }
3171
- function Zo(t, e, n) {
3172
- let { node: o, fromOffset: i, toOffset: s, from: r, to: l } = t.docView.parseRange(e, n), a = t.domSelectionRange(), c, d = a.anchorNode;
3173
- if (d && t.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (c = [{ node: d, offset: a.anchorOffset }], Be(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), M && t.input.lastKeyCode === 8)
3174
- for (let m = s; m > i; m--) {
3175
- let y = o.childNodes[m - 1], V = y.pmViewDesc;
3176
- if (y.nodeName == "BR" && !V) {
3177
- s = m;
3178
- break;
3179
- }
3180
- if (!V || V.size)
3181
- break;
3182
- }
3183
- let f = t.state.doc, u = t.someProp("domParser") || qt.fromSchema(t.state.schema), p = f.resolve(r), h = null, g = u.parse(o, {
3184
- topNode: p.parent,
3185
- topMatch: p.parent.contentMatchAt(p.index()),
3186
- topOpen: !0,
3187
- from: i,
3188
- to: s,
3189
- preserveWhitespace: p.parent.type.whitespace == "pre" ? "full" : !0,
3190
- findPositions: c,
3191
- ruleFromNode: Qo,
3192
- context: p
3193
- });
3194
- if (c && c[0].pos != null) {
3195
- let m = c[0].pos, y = c[1] && c[1].pos;
3196
- y == null && (y = m), h = { anchor: m + r, head: y + r };
3197
- }
3198
- return { doc: g, sel: h, from: r, to: l };
3199
- }
3200
- function Qo(t) {
3201
- let e = t.pmViewDesc;
3202
- if (e)
3203
- return e.parseRule();
3204
- if (t.nodeName == "BR" && t.parentNode) {
3205
- if (k && /^(ul|ol)$/i.test(t.parentNode.nodeName)) {
3206
- let n = document.createElement("div");
3207
- return n.appendChild(document.createElement("li")), { skip: n };
3208
- } else if (t.parentNode.lastChild == t || k && /^(tr|table)$/i.test(t.parentNode.nodeName))
3209
- return { ignore: !0 };
3210
- } else if (t.nodeName == "IMG" && t.getAttribute("mark-placeholder"))
3211
- return { ignore: !0 };
3212
- return null;
3213
- }
3214
- const wo = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
3215
- function vo(t, e, n, o, i) {
3216
- let s = t.input.compositionPendingChanges || (t.composing ? t.input.compositionID : 0);
3217
- if (t.input.compositionPendingChanges = 0, e < 0) {
3218
- let b = t.input.lastSelectionTime > Date.now() - 50 ? t.input.lastSelectionOrigin : null, N = we(t, b);
3219
- if (N && !t.state.selection.eq(N)) {
3220
- if (M && H && t.input.lastKeyCode === 13 && Date.now() - 100 < t.input.lastKeyCodeTime && t.someProp("handleKeyDown", (Nn) => Nn(t, te(13, "Enter"))))
3221
- return;
3222
- let E = t.state.tr.setSelection(N);
3223
- b == "pointer" ? E.setMeta("pointer", !0) : b == "key" && E.scrollIntoView(), s && E.setMeta("composition", s), t.dispatch(E);
3224
- }
3225
- return;
3226
- }
3227
- let r = t.state.doc.resolve(e), l = r.sharedDepth(n);
3228
- e = r.before(l + 1), n = t.state.doc.resolve(n).after(l + 1);
3229
- let a = t.state.selection, c = Zo(t, e, n), d = t.state.doc, f = d.slice(c.from, c.to), u, p;
3230
- t.input.lastKeyCode === 8 && Date.now() - 100 < t.input.lastKeyCodeTime ? (u = t.state.selection.to, p = "end") : (u = t.state.selection.from, p = "start"), t.input.lastKeyCode = null;
3231
- let h = ni(f.content, c.doc.content, c.from, u, p);
3232
- if (h && t.input.domChangeCount++, (pe && t.input.lastIOSEnter > Date.now() - 225 || H) && i.some((b) => b.nodeType == 1 && !wo.test(b.nodeName)) && (!h || h.endA >= h.endB) && t.someProp("handleKeyDown", (b) => b(t, te(13, "Enter")))) {
3233
- t.input.lastIOSEnter = 0;
3234
- return;
3235
- }
3236
- if (!h)
3237
- if (o && a instanceof x && !a.empty && a.$head.sameParent(a.$anchor) && !t.composing && !(c.sel && c.sel.anchor != c.sel.head))
3238
- h = { start: a.from, endA: a.to, endB: a.to };
3239
- else {
3240
- if (c.sel) {
3241
- let b = Rt(t, t.state.doc, c.sel);
3242
- if (b && !b.eq(t.state.selection)) {
3243
- let N = t.state.tr.setSelection(b);
3244
- s && N.setMeta("composition", s), t.dispatch(N);
3245
- }
3246
- }
3247
- return;
3248
- }
3249
- t.state.selection.from < t.state.selection.to && h.start == h.endB && t.state.selection instanceof x && (h.start > t.state.selection.from && h.start <= t.state.selection.from + 2 && t.state.selection.from >= c.from ? h.start = t.state.selection.from : h.endA < t.state.selection.to && h.endA >= t.state.selection.to - 2 && t.state.selection.to <= c.to && (h.endB += t.state.selection.to - h.endA, h.endA = t.state.selection.to)), P && Z <= 11 && h.endB == h.start + 1 && h.endA == h.start && h.start > c.from && c.doc.textBetween(h.start - c.from - 1, h.start - c.from + 1) == "  " && (h.start--, h.endA--, h.endB--);
3250
- let g = c.doc.resolveNoCache(h.start - c.from), m = c.doc.resolveNoCache(h.endB - c.from), y = d.resolve(h.start), V = g.sameParent(m) && g.parent.inlineContent && y.end() >= h.endA, me;
3251
- if ((pe && t.input.lastIOSEnter > Date.now() - 225 && (!V || i.some((b) => b.nodeName == "DIV" || b.nodeName == "P")) || !V && g.pos < c.doc.content.size && (!g.sameParent(m) || !g.parent.inlineContent) && !/\S/.test(c.doc.textBetween(g.pos, m.pos, "", "")) && (me = he.findFrom(c.doc.resolve(g.pos + 1), 1, !0)) && me.head > g.pos) && t.someProp("handleKeyDown", (b) => b(t, te(13, "Enter")))) {
3252
- t.input.lastIOSEnter = 0;
3253
- return;
3254
- }
3255
- if (t.state.selection.anchor > h.start && ti(d, h.start, h.endA, g, m) && t.someProp("handleKeyDown", (b) => b(t, te(8, "Backspace")))) {
3256
- H && M && t.domObserver.suppressSelectionUpdates();
3257
- return;
3258
- }
3259
- M && h.endB == h.start && (t.input.lastChromeDelete = Date.now()), H && !V && g.start() != m.start() && m.parentOffset == 0 && g.depth == m.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == h.endA && (h.endB -= 2, m = c.doc.resolveNoCache(h.endB - c.from), setTimeout(() => {
3260
- t.someProp("handleKeyDown", function(b) {
3261
- return b(t, te(13, "Enter"));
3262
- });
3263
- }, 20));
3264
- let j = h.start, ee = h.endA, xe = (b) => {
3265
- let N = b || t.state.tr.replace(j, ee, c.doc.slice(h.start - c.from, h.endB - c.from));
3266
- if (c.sel) {
3267
- let E = Rt(t, N.doc, c.sel);
3268
- E && !(M && t.composing && E.empty && (h.start != h.endB || t.input.lastChromeDelete < Date.now() - 100) && (E.head == j || E.head == N.mapping.map(ee) - 1) || P && E.empty && E.head == j) && N.setSelection(E);
3269
- }
3270
- return s && N.setMeta("composition", s), N.scrollIntoView();
3271
- }, ke;
3272
- if (V) {
3273
- if (g.pos == m.pos) {
3274
- P && Z <= 11 && g.parentOffset == 0 && (t.domObserver.suppressSelectionUpdates(), setTimeout(() => W(t), 20));
3275
- let b = xe(t.state.tr.delete(j, ee)), N = d.resolve(h.start).marksAcross(d.resolve(h.endA));
3276
- N && b.ensureMarks(N), t.dispatch(b);
3277
- } else if (
3278
- // Adding or removing a mark
3279
- h.endA == h.endB && (ke = ei(g.parent.content.cut(g.parentOffset, m.parentOffset), y.parent.content.cut(y.parentOffset, h.endA - y.start())))
3280
- ) {
3281
- let b = xe(t.state.tr);
3282
- ke.type == "add" ? b.addMark(j, ee, ke.mark) : b.removeMark(j, ee, ke.mark), t.dispatch(b);
3283
- } else if (g.parent.child(g.index()).isText && g.index() == m.index() - (m.textOffset ? 0 : 1)) {
3284
- let b = g.parent.textBetween(g.parentOffset, m.parentOffset), N = () => xe(t.state.tr.insertText(b, j, ee));
3285
- t.someProp("handleTextInput", (E) => E(t, j, ee, b, N)) || t.dispatch(N());
3286
- }
3287
- } else
3288
- t.dispatch(xe());
3289
- }
3290
- function Rt(t, e, n) {
3291
- return Math.max(n.anchor, n.head) > e.content.size ? null : ve(t, e.resolve(n.anchor), e.resolve(n.head));
3292
- }
3293
- function ei(t, e) {
3294
- let n = t.firstChild.marks, o = e.firstChild.marks, i = n, s = o, r, l, a;
3295
- for (let d = 0; d < o.length; d++)
3296
- i = o[d].removeFromSet(i);
3297
- for (let d = 0; d < n.length; d++)
3298
- s = n[d].removeFromSet(s);
3299
- if (i.length == 1 && s.length == 0)
3300
- l = i[0], r = "add", a = (d) => d.mark(l.addToSet(d.marks));
3301
- else if (i.length == 0 && s.length == 1)
3302
- l = s[0], r = "remove", a = (d) => d.mark(l.removeFromSet(d.marks));
3303
- else
3304
- return null;
3305
- let c = [];
3306
- for (let d = 0; d < e.childCount; d++)
3307
- c.push(a(e.child(d)));
3308
- if (_.from(c).eq(t))
3309
- return { mark: l, type: r };
3310
- }
3311
- function ti(t, e, n, o, i) {
3312
- if (
3313
- // The content must have shrunk
3314
- n - e <= i.pos - o.pos || // newEnd must point directly at or after the end of the block that newStart points into
3315
- Ke(o, !0, !1) < i.pos
3316
- )
3317
- return !1;
3318
- let s = t.resolve(e);
3319
- if (!o.parent.isTextblock) {
3320
- let l = s.nodeAfter;
3321
- return l != null && n == e + l.nodeSize;
3322
- }
3323
- if (s.parentOffset < s.parent.content.size || !s.parent.isTextblock)
3324
- return !1;
3325
- let r = t.resolve(Ke(s, !0, !0));
3326
- return !r.parent.isTextblock || r.pos > n || Ke(r, !0, !1) < n ? !1 : o.parent.content.cut(o.parentOffset).eq(r.parent.content);
3327
- }
3328
- function Ke(t, e, n) {
3329
- let o = t.depth, i = e ? t.end() : t.pos;
3330
- for (; o > 0 && (e || t.indexAfter(o) == t.node(o).childCount); )
3331
- o--, i++, e = !1;
3332
- if (n) {
3333
- let s = t.node(o).maybeChild(t.indexAfter(o));
3334
- for (; s && !s.isLeaf; )
3335
- s = s.firstChild, i++;
3336
- }
3337
- return i;
3338
- }
3339
- function ni(t, e, n, o, i) {
3340
- let s = t.findDiffStart(e, n);
3341
- if (s == null)
3342
- return null;
3343
- let { a: r, b: l } = t.findDiffEnd(e, n + t.size, n + e.size);
3344
- if (i == "end") {
3345
- let a = Math.max(0, s - Math.min(r, l));
3346
- o -= r + a - s;
3347
- }
3348
- if (r < s && t.size < e.size) {
3349
- let a = o <= s && o >= r ? s - o : 0;
3350
- s -= a, s && s < e.size && Bt(e.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), l = s + (l - r), r = s;
3351
- } else if (l < s) {
3352
- let a = o <= s && o >= l ? s - o : 0;
3353
- s -= a, s && s < t.size && Bt(t.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), r = s + (r - l), l = s;
3354
- }
3355
- return { start: s, endA: r, endB: l };
3356
- }
3357
- function Bt(t) {
3358
- if (t.length != 2)
3359
- return !1;
3360
- let e = t.charCodeAt(0), n = t.charCodeAt(1);
3361
- return e >= 56320 && e <= 57343 && n >= 55296 && n <= 56319;
3362
- }
3363
- class oi {
3364
- /**
3365
- Create a view. `place` may be a DOM node that the editor should
3366
- be appended to, a function that will place it into the document,
3367
- or an object whose `mount` property holds the node to use as the
3368
- document container. If it is `null`, the editor will not be
3369
- added to the document.
3370
- */
3371
- constructor(e, n) {
3372
- this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new So(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = n, this.state = n.state, this.directPlugins = n.plugins || [], this.directPlugins.forEach($t), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = zt(this), Ft(this), this.nodeViews = Lt(this), this.docView = pt(this.state.doc, It(this), qe(this), this.dom, this), this.domObserver = new Yo(this, (o, i, s, r) => vo(this, o, i, s, r)), this.domObserver.start(), Co(this), this.updatePluginViews();
3373
- }
3374
- /**
3375
- Holds `true` when a
3376
- [composition](https://w3c.github.io/uievents/#events-compositionevents)
3377
- is active.
3378
- */
3379
- get composing() {
3380
- return this.input.composing;
3381
- }
3382
- /**
3383
- The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
3384
- */
3385
- get props() {
3386
- if (this._props.state != this.state) {
3387
- let e = this._props;
3388
- this._props = {};
3389
- for (let n in e)
3390
- this._props[n] = e[n];
3391
- this._props.state = this.state;
3392
- }
3393
- return this._props;
3394
- }
3395
- /**
3396
- Update the view's props. Will immediately cause an update to
3397
- the DOM.
3398
- */
3399
- update(e) {
3400
- e.handleDOMEvents != this._props.handleDOMEvents && Ze(this);
3401
- let n = this._props;
3402
- this._props = e, e.plugins && (e.plugins.forEach($t), this.directPlugins = e.plugins), this.updateStateInner(e.state, n);
3403
- }
3404
- /**
3405
- Update the view by updating existing props object with the object
3406
- given as argument. Equivalent to `view.update(Object.assign({},
3407
- view.props, props))`.
3408
- */
3409
- setProps(e) {
3410
- let n = {};
3411
- for (let o in this._props)
3412
- n[o] = this._props[o];
3413
- n.state = this.state;
3414
- for (let o in e)
3415
- n[o] = e[o];
3416
- this.update(n);
3417
- }
3418
- /**
3419
- Update the editor's `state` prop, without touching any of the
3420
- other props.
3421
- */
3422
- updateState(e) {
3423
- this.updateStateInner(e, this._props);
3424
- }
3425
- updateStateInner(e, n) {
3426
- var o;
3427
- let i = this.state, s = !1, r = !1;
3428
- e.storedMarks && this.composing && (un(this), r = !0), this.state = e;
3429
- let l = i.plugins != e.plugins || this._props.plugins != n.plugins;
3430
- if (l || this._props.plugins != n.plugins || this._props.nodeViews != n.nodeViews) {
3431
- let p = Lt(this);
3432
- si(p, this.nodeViews) && (this.nodeViews = p, s = !0);
3433
- }
3434
- (l || n.handleDOMEvents != this._props.handleDOMEvents) && Ze(this), this.editable = zt(this), Ft(this);
3435
- let a = qe(this), c = It(this), d = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", f = s || !this.docView.matchesNode(e.doc, c, a);
3436
- (f || !e.selection.eq(i.selection)) && (r = !0);
3437
- let u = d == "preserve" && r && this.dom.style.overflowAnchor == null && Fn(this);
3438
- if (r) {
3439
- this.domObserver.stop();
3440
- let p = f && (P || M) && !this.composing && !i.selection.empty && !e.selection.empty && ii(i.selection, e.selection);
3441
- if (f) {
3442
- let h = M ? this.trackWrites = this.domSelectionRange().focusNode : null;
3443
- this.composing && (this.input.compositionNode = Fo(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = pt(e.doc, c, a, this.dom, this)), h && !this.trackWrites && (p = !0);
3444
- }
3445
- p || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && so(this)) ? W(this, p) : (en(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
3446
- }
3447
- this.updatePluginViews(i), !((o = this.dragging) === null || o === void 0) && o.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), d == "reset" ? this.dom.scrollTop = 0 : d == "to selection" ? this.scrollToSelection() : u && zn(u);
3448
- }
3449
- /**
3450
- @internal
3451
- */
3452
- scrollToSelection() {
3453
- let e = this.domSelectionRange().focusNode;
3454
- if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
3455
- if (!this.someProp("handleScrollToSelection", (n) => n(this))) if (this.state.selection instanceof D) {
3456
- let n = this.docView.domAfterPos(this.state.selection.from);
3457
- n.nodeType == 1 && at(this, n.getBoundingClientRect(), e);
3458
- } else
3459
- at(this, this.coordsAtPos(this.state.selection.head, 1), e);
3460
- }
3461
- }
3462
- destroyPluginViews() {
3463
- let e;
3464
- for (; e = this.pluginViews.pop(); )
3465
- e.destroy && e.destroy();
3466
- }
3467
- updatePluginViews(e) {
3468
- if (!e || e.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
3469
- this.prevDirectPlugins = this.directPlugins, this.destroyPluginViews();
3470
- for (let n = 0; n < this.directPlugins.length; n++) {
3471
- let o = this.directPlugins[n];
3472
- o.spec.view && this.pluginViews.push(o.spec.view(this));
3473
- }
3474
- for (let n = 0; n < this.state.plugins.length; n++) {
3475
- let o = this.state.plugins[n];
3476
- o.spec.view && this.pluginViews.push(o.spec.view(this));
3477
- }
3478
- } else
3479
- for (let n = 0; n < this.pluginViews.length; n++) {
3480
- let o = this.pluginViews[n];
3481
- o.update && o.update(this, e);
3482
- }
3483
- }
3484
- updateDraggedNode(e, n) {
3485
- let o = e.node, i = -1;
3486
- if (this.state.doc.nodeAt(o.from) == o.node)
3487
- i = o.from;
3488
- else {
3489
- let s = o.from + (this.state.doc.content.size - n.doc.content.size);
3490
- (s > 0 && this.state.doc.nodeAt(s)) == o.node && (i = s);
3491
- }
3492
- this.dragging = new mn(e.slice, e.move, i < 0 ? void 0 : D.create(this.state.doc, i));
3493
- }
3494
- someProp(e, n) {
3495
- let o = this._props && this._props[e], i;
3496
- if (o != null && (i = n ? n(o) : o))
3497
- return i;
3498
- for (let r = 0; r < this.directPlugins.length; r++) {
3499
- let l = this.directPlugins[r].props[e];
3500
- if (l != null && (i = n ? n(l) : l))
3501
- return i;
3502
- }
3503
- let s = this.state.plugins;
3504
- if (s)
3505
- for (let r = 0; r < s.length; r++) {
3506
- let l = s[r].props[e];
3507
- if (l != null && (i = n ? n(l) : l))
3508
- return i;
3509
- }
3510
- }
3511
- /**
3512
- Query whether the view has focus.
3513
- */
3514
- hasFocus() {
3515
- if (P) {
3516
- let e = this.root.activeElement;
3517
- if (e == this.dom)
3518
- return !0;
3519
- if (!e || !this.dom.contains(e))
3520
- return !1;
3521
- for (; e && this.dom != e && this.dom.contains(e); ) {
3522
- if (e.contentEditable == "false")
3523
- return !1;
3524
- e = e.parentElement;
3525
- }
3526
- return !0;
3527
- }
3528
- return this.root.activeElement == this.dom;
3529
- }
3530
- /**
3531
- Focus the editor.
3532
- */
3533
- focus() {
3534
- this.domObserver.stop(), this.editable && Ln(this.dom), W(this), this.domObserver.start();
3535
- }
3536
- /**
3537
- Get the document root in which the editor exists. This will
3538
- usually be the top-level `document`, but might be a [shadow
3539
- DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
3540
- root if the editor is inside one.
3541
- */
3542
- get root() {
3543
- let e = this._root;
3544
- if (e == null) {
3545
- for (let n = this.dom.parentNode; n; n = n.parentNode)
3546
- if (n.nodeType == 9 || n.nodeType == 11 && n.host)
3547
- return n.getSelection || (Object.getPrototypeOf(n).getSelection = () => n.ownerDocument.getSelection()), this._root = n;
3548
- }
3549
- return e || document;
3550
- }
3551
- /**
3552
- When an existing editor view is moved to a new document or
3553
- shadow tree, call this to make it recompute its root.
3554
- */
3555
- updateRoot() {
3556
- this._root = null;
3557
- }
3558
- /**
3559
- Given a pair of viewport coordinates, return the document
3560
- position that corresponds to them. May return null if the given
3561
- coordinates aren't inside of the editor. When an object is
3562
- returned, its `pos` property is the position nearest to the
3563
- coordinates, and its `inside` property holds the position of the
3564
- inner node that the position falls inside of, or -1 if it is at
3565
- the top level, not in any node.
3566
- */
3567
- posAtCoords(e) {
3568
- return Wn(this, e);
3569
- }
3570
- /**
3571
- Returns the viewport rectangle at a given document position.
3572
- `left` and `right` will be the same number, as this returns a
3573
- flat cursor-ish rectangle. If the position is between two things
3574
- that aren't directly adjacent, `side` determines which element
3575
- is used. When < 0, the element before the position is used,
3576
- otherwise the element after.
3577
- */
3578
- coordsAtPos(e, n = 1) {
3579
- return Yt(this, e, n);
3580
- }
3581
- /**
3582
- Find the DOM position that corresponds to the given document
3583
- position. When `side` is negative, find the position as close as
3584
- possible to the content before the position. When positive,
3585
- prefer positions close to the content after the position. When
3586
- zero, prefer as shallow a position as possible.
3587
-
3588
- Note that you should **not** mutate the editor's internal DOM,
3589
- only inspect it (and even that is usually not necessary).
3590
- */
3591
- domAtPos(e, n = 0) {
3592
- return this.docView.domFromPos(e, n);
3593
- }
3594
- /**
3595
- Find the DOM node that represents the document node after the
3596
- given position. May return `null` when the position doesn't point
3597
- in front of a node or if the node is inside an opaque node view.
3598
-
3599
- This is intended to be able to call things like
3600
- `getBoundingClientRect` on that DOM node. Do **not** mutate the
3601
- editor DOM directly, or add styling this way, since that will be
3602
- immediately overriden by the editor as it redraws the node.
3603
- */
3604
- nodeDOM(e) {
3605
- let n = this.docView.descAt(e);
3606
- return n ? n.nodeDOM : null;
3607
- }
3608
- /**
3609
- Find the document position that corresponds to a given DOM
3610
- position. (Whenever possible, it is preferable to inspect the
3611
- document structure directly, rather than poking around in the
3612
- DOM, but sometimes—for example when interpreting an event
3613
- target—you don't have a choice.)
3614
-
3615
- The `bias` parameter can be used to influence which side of a DOM
3616
- node to use when the position is inside a leaf node.
3617
- */
3618
- posAtDOM(e, n, o = -1) {
3619
- let i = this.docView.posFromDOM(e, n, o);
3620
- if (i == null)
3621
- throw new RangeError("DOM position not inside the editor");
3622
- return i;
3623
- }
3624
- /**
3625
- Find out whether the selection is at the end of a textblock when
3626
- moving in a given direction. When, for example, given `"left"`,
3627
- it will return true if moving left from the current cursor
3628
- position would leave that position's parent textblock. Will apply
3629
- to the view's current state by default, but it is possible to
3630
- pass a different state.
3631
- */
3632
- endOfTextblock(e, n) {
3633
- return Gn(this, n || this.state, e);
3634
- }
3635
- /**
3636
- Run the editor's paste logic with the given HTML string. The
3637
- `event`, if given, will be passed to the
3638
- [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
3639
- */
3640
- pasteHTML(e, n) {
3641
- return Ne(this, "", e, !1, n || new ClipboardEvent("paste"));
3642
- }
3643
- /**
3644
- Run the editor's paste logic with the given plain-text input.
3645
- */
3646
- pasteText(e, n) {
3647
- return Ne(this, e, null, !0, n || new ClipboardEvent("paste"));
3648
- }
3649
- /**
3650
- Serialize the given slice as it would be if it was copied from
3651
- this editor. Returns a DOM element that contains a
3652
- representation of the slice as its children, a textual
3653
- representation, and the transformed slice (which can be
3654
- different from the given input due to hooks like
3655
- [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
3656
- */
3657
- serializeForClipboard(e) {
3658
- return et(this, e);
3659
- }
3660
- /**
3661
- Removes the editor from the DOM and destroys all [node
3662
- views](https://prosemirror.net/docs/ref/#view.NodeView).
3663
- */
3664
- destroy() {
3665
- this.docView && (Oo(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], qe(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Mn());
3666
- }
3667
- /**
3668
- This is true when the view has been
3669
- [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
3670
- used anymore).
3671
- */
3672
- get isDestroyed() {
3673
- return this.docView == null;
3674
- }
3675
- /**
3676
- Used for testing.
3677
- */
3678
- dispatchEvent(e) {
3679
- return xo(this, e);
3680
- }
3681
- /**
3682
- @internal
3683
- */
3684
- domSelectionRange() {
3685
- let e = this.domSelection();
3686
- return e ? k && this.root.nodeType === 11 && En(this.dom.ownerDocument) == this.dom && Xo(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
3687
- }
3688
- /**
3689
- @internal
3690
- */
3691
- domSelection() {
3692
- return this.root.getSelection();
3693
- }
3694
- }
3695
- oi.prototype.dispatch = function(t) {
3696
- let e = this._props.dispatchTransaction;
3697
- e ? e.call(this, t) : this.updateState(this.state.apply(t));
3698
- };
3699
- function It(t) {
3700
- let e = /* @__PURE__ */ Object.create(null);
3701
- return e.class = "ProseMirror", e.contenteditable = String(t.editable), t.someProp("attributes", (n) => {
3702
- if (typeof n == "function" && (n = n(t.state)), n)
3703
- for (let o in n)
3704
- o == "class" ? e.class += " " + n[o] : o == "style" ? e.style = (e.style ? e.style + ";" : "") + n[o] : !e[o] && o != "contenteditable" && o != "nodeName" && (e[o] = String(n[o]));
3705
- }), e.translate || (e.translate = "no"), [F.node(0, t.state.doc.content.size, e)];
3706
- }
3707
- function Ft(t) {
3708
- if (t.markCursor) {
3709
- let e = document.createElement("img");
3710
- e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), t.cursorWrapper = { dom: e, deco: F.widget(t.state.selection.from, e, { raw: !0, marks: t.markCursor }) };
3711
- } else
3712
- t.cursorWrapper = null;
3713
- }
3714
- function zt(t) {
3715
- return !t.someProp("editable", (e) => e(t.state) === !1);
3716
- }
3717
- function ii(t, e) {
3718
- let n = Math.min(t.$anchor.sharedDepth(t.head), e.$anchor.sharedDepth(e.head));
3719
- return t.$anchor.start(n) != e.$anchor.start(n);
3720
- }
3721
- function Lt(t) {
3722
- let e = /* @__PURE__ */ Object.create(null);
3723
- function n(o) {
3724
- for (let i in o)
3725
- Object.prototype.hasOwnProperty.call(e, i) || (e[i] = o[i]);
3726
- }
3727
- return t.someProp("nodeViews", n), t.someProp("markViews", n), e;
3728
- }
3729
- function si(t, e) {
3730
- let n = 0, o = 0;
3731
- for (let i in t) {
3732
- if (t[i] != e[i])
3733
- return !0;
3734
- n++;
3735
- }
3736
- for (let i in e)
3737
- o++;
3738
- return n != o;
3739
- }
3740
- function $t(t) {
3741
- if (t.spec.state || t.spec.filterTransaction || t.spec.appendTransaction)
3742
- throw new RangeError("Plugins passed directly to the view must not have a state component");
3743
- }
3744
- export {
3745
- S as D,
3746
- oi as E,
3747
- F as a
3748
- };