@vc-shell/framework 2.0.0-alpha.0 → 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/dist/core/plugins/ai-agent/components/_internal/VcAiAgentHeader.vue.d.ts +2 -2
  2. package/dist/test-helpers.d.ts +4 -12
  3. package/dist/test-helpers.d.ts.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts +1 -1
  6. package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts.map +1 -1
  7. package/dist/ui/components/molecules/vc-menu/vc-menu.vue.d.ts +1 -1
  8. package/dist/ui/components/molecules/vc-menu/vc-menu.vue.d.ts.map +1 -1
  9. package/dist/ui/components/organisms/vc-blade/_internal/BladeHeader.vue.d.ts +2 -2
  10. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +2 -2
  11. package/dist/ui/components/organisms/vc-sidebar/vc-sidebar.vue.d.ts +1 -1
  12. package/dist/ui/components/organisms/vc-sidebar/vc-sidebar.vue.d.ts.map +1 -1
  13. package/dist/ui/components/organisms/vc-table/VcDataTable.vue.d.ts +5 -5
  14. package/dist/ui/components/organisms/vc-table/VcDataTable.vue.d.ts.map +1 -1
  15. package/dist/ui/components/organisms/vc-table/components/ColumnFilter.vue.d.ts +1 -1
  16. package/dist/ui/components/organisms/vc-table/components/ColumnFilter.vue.d.ts.map +1 -1
  17. package/dist/ui/components/organisms/vc-table/components/TableRowActions.vue.d.ts +1 -1
  18. package/dist/ui/components/organisms/vc-table/components/TableRowActions.vue.d.ts.map +1 -1
  19. package/dist/ui/components/organisms/vc-table/components/TableSearchHeader.vue.d.ts +1 -1
  20. package/dist/ui/components/organisms/vc-table/components/TableSearchHeader.vue.d.ts.map +1 -1
  21. package/dist/ui/components/organisms/vc-table/components/VcColumn.vue.d.ts +3 -3
  22. package/dist/ui/components/organisms/vc-table/components/mobile/PullToRefresh.vue.d.ts +1 -1
  23. package/dist/ui/components/organisms/vc-table/components/mobile/PullToRefresh.vue.d.ts.map +1 -1
  24. package/package.json +8 -5
  25. package/dist/assets/042c75b764bc78a7.svg +0 -1
  26. package/dist/assets/0ba156439a339f2a.svg +0 -1
  27. package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
  28. package/dist/assets/0d67e9e056b4c500.woff +0 -0
  29. package/dist/assets/0f590f8a94577092.svg +0 -1
  30. package/dist/assets/0fc5820f8be53a1b.svg +0 -1
  31. package/dist/assets/105efd028edc1dfe.woff +0 -0
  32. package/dist/assets/10768e2cc79fc60b.svg +0 -1
  33. package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
  34. package/dist/assets/131b34336aedaf47.woff +0 -0
  35. package/dist/assets/154365acf3010d96.woff2 +0 -0
  36. package/dist/assets/157b8721e0600ea8.svg +0 -1
  37. package/dist/assets/15e91cdd649cde9a.svg +0 -1
  38. package/dist/assets/19275e398ae57130.woff2 +0 -0
  39. package/dist/assets/19bb1c668a5db39f.woff2 +0 -0
  40. package/dist/assets/1a3e84b2457f709a.woff +0 -0
  41. package/dist/assets/1de63eb118636cce.svg +0 -1
  42. package/dist/assets/1ea01de36eb5491b.svg +0 -1
  43. package/dist/assets/2010ada3e82156ed.woff +0 -0
  44. package/dist/assets/204eaf512fde2023.svg +0 -1
  45. package/dist/assets/2088983edf42e153.svg +0 -1
  46. package/dist/assets/208f810a9321a327.svg +0 -1
  47. package/dist/assets/21220a9d10e6c558.svg +0 -1
  48. package/dist/assets/220db345a102045d.woff2 +0 -0
  49. package/dist/assets/225da11d23968333.svg +0 -1
  50. package/dist/assets/226f862dd81bdc13.woff2 +0 -0
  51. package/dist/assets/23a2d53395ddb14f.woff +0 -0
  52. package/dist/assets/259e6ad461a52ad7.svg +0 -1
  53. package/dist/assets/261e6dec4d53b9ac.woff +0 -0
  54. package/dist/assets/262f46a0b6d94bb6.svg +0 -1
  55. package/dist/assets/2857c513073467da.svg +0 -1
  56. package/dist/assets/2b3be7889467d98f.woff +0 -0
  57. package/dist/assets/2d4e6190eec72737.svg +0 -1
  58. package/dist/assets/2eba973185078bc8.woff +0 -0
  59. package/dist/assets/334d3f6bc766c516.woff +0 -0
  60. package/dist/assets/34ff7dd0c2285956.svg +0 -1
  61. package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
  62. package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
  63. package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
  64. package/dist/assets/3fc09a6113184f16.woff +0 -0
  65. package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
  66. package/dist/assets/41275bcb979cb650.svg +0 -1
  67. package/dist/assets/434f7982590e462f.woff +0 -0
  68. package/dist/assets/475937116ee3314a.woff2 +0 -0
  69. package/dist/assets/477e1881a0394cc5.woff +0 -0
  70. package/dist/assets/489710fb710e73f0.woff +0 -0
  71. package/dist/assets/49791943b3872376.woff2 +0 -0
  72. package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
  73. package/dist/assets/4d7a77b0e5373992.svg +0 -1
  74. package/dist/assets/4e43c74354534fb3.svg +0 -1
  75. package/dist/assets/4fe75f5117100705.svg +0 -1
  76. package/dist/assets/52e261a005074e1b.woff +0 -0
  77. package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
  78. package/dist/assets/54cda5482c6c9218.woff +0 -0
  79. package/dist/assets/550f52072e8ccafe.woff2 +0 -0
  80. package/dist/assets/572bb1bb4156a9c1.svg +0 -1
  81. package/dist/assets/6075995d7e74da46.woff2 +0 -0
  82. package/dist/assets/617c4736236e199e.woff +0 -0
  83. package/dist/assets/67230f05dc94a265.svg +0 -1
  84. package/dist/assets/6798e4dd4add9b48.svg +0 -1
  85. package/dist/assets/686d4077c1e26876.woff2 +0 -0
  86. package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
  87. package/dist/assets/6a3e73faf406cf33.svg +0 -1
  88. package/dist/assets/72de3a63bc0b70dd.svg +0 -1
  89. package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
  90. package/dist/assets/74ed5f8a78e71106.svg +0 -1
  91. package/dist/assets/7a5aa5abd625137f.ttf +0 -0
  92. package/dist/assets/7ce0c166fd6a1204.woff +0 -0
  93. package/dist/assets/7d55399c2a7bc985.svg +0 -1
  94. package/dist/assets/7d970675c69fca1d.woff +0 -0
  95. package/dist/assets/7eda727273fd98d3.svg +0 -1
  96. package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
  97. package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
  98. package/dist/assets/861e6b7192b3b6c7.woff +0 -0
  99. package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
  100. package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
  101. package/dist/assets/910b0d99b9e26568.svg +0 -1
  102. package/dist/assets/91fe94e424323d61.woff +0 -0
  103. package/dist/assets/92508f8707159b51.svg +0 -1
  104. package/dist/assets/9392bf1d591e1abb.svg +0 -1
  105. package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
  106. package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
  107. package/dist/assets/9d37314695c0b68d.woff +0 -0
  108. package/dist/assets/a03cdcd8da5bb987.woff +0 -0
  109. package/dist/assets/a18404194e3f9047.svg +0 -1
  110. package/dist/assets/a2017fe7f0a26510.svg +0 -1
  111. package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
  112. package/dist/assets/abf88f301a0730f4.svg +0 -1
  113. package/dist/assets/ac1a99b3d05d8232.woff +0 -0
  114. package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
  115. package/dist/assets/b1a596e31ad1185a.svg +0 -1
  116. package/dist/assets/b27767411c8427be.woff +0 -0
  117. package/dist/assets/b325adcae33bbe7a.svg +0 -1
  118. package/dist/assets/b372390551ca2fa1.svg +0 -1
  119. package/dist/assets/b5bb1e8fc975decd.svg +0 -1
  120. package/dist/assets/b645a4a2181b9dc1.svg +0 -1
  121. package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
  122. package/dist/assets/b7ffde2383bb16ba.woff2 +0 -0
  123. package/dist/assets/b94421fadd23b0f2.svg +0 -1
  124. package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
  125. package/dist/assets/c5195215cb712e9c.woff2 +0 -0
  126. package/dist/assets/c9191b638a10f67b.woff2 +0 -0
  127. package/dist/assets/c97328b91ac5cc66.woff +0 -0
  128. package/dist/assets/ca791c5ca5848a03.svg +0 -1
  129. package/dist/assets/cb32840ce330103f.woff +0 -0
  130. package/dist/assets/ccc878931d74181b.woff2 +0 -0
  131. package/dist/assets/cdc69f8b549c866d.woff2 +0 -0
  132. package/dist/assets/d084bda16abe8a56.svg +0 -1
  133. package/dist/assets/d32b129cae2fffd6.svg +0 -1
  134. package/dist/assets/d35a4c7113315758.woff2 +0 -0
  135. package/dist/assets/d3f792f54ae4c307.svg +0 -1
  136. package/dist/assets/d5a5b8630120073d.svg +0 -1
  137. package/dist/assets/d5eb20bcdcf5616a.woff2 +0 -0
  138. package/dist/assets/d5f9664ebbfb104b.svg +0 -1
  139. package/dist/assets/d84247b59449dd88.woff2 +0 -0
  140. package/dist/assets/da4b7f5883fe7743.woff2 +0 -0
  141. package/dist/assets/dceaf3b39091e6a4.woff +0 -0
  142. package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
  143. package/dist/assets/e2ad5b3428289141.woff +0 -0
  144. package/dist/assets/e38acaa1757232e0.svg +0 -1
  145. package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
  146. package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
  147. package/dist/assets/e61a1889bac955f4.woff2 +0 -0
  148. package/dist/assets/e72bb11356af94c7.svg +0 -1
  149. package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
  150. package/dist/assets/ebec912a42ad49ff.woff +0 -0
  151. package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
  152. package/dist/assets/f09d89268e4c0317.svg +0 -1
  153. package/dist/assets/f239394367fcf005.woff2 +0 -0
  154. package/dist/assets/f5722262b6e7214e.woff2 +0 -0
  155. package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
  156. package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
  157. package/dist/assets/fe141d99763f5d2b.woff +0 -0
  158. package/dist/assets/fed13b0d59903483.svg +0 -1
  159. package/dist/assets/fed757d2c2344ead.woff2 +0 -0
  160. package/dist/assets/ffc438f20e79ce73.woff +0 -0
  161. package/dist/framework.css +0 -9
  162. package/dist/framework.js +0 -36471
  163. package/dist/vendor-boolbase-D2i1C8XR.js +0 -18
  164. package/dist/vendor-cheerio-DrsWhxJH.js +0 -1053
  165. package/dist/vendor-cheerio-select-jw4C2SiT.js +0 -191
  166. package/dist/vendor-core-js-Do_NZFHx.js +0 -880
  167. package/dist/vendor-css-select-BwGMmTuc.js +0 -622
  168. package/dist/vendor-css-what-CZZaquJM.js +0 -267
  169. package/dist/vendor-cypress-signalr-mock-itnm2wpA.js +0 -781
  170. package/dist/vendor-d3-array-9cpTrqlO.js +0 -149
  171. package/dist/vendor-d3-axis-D1_DbKLz.js +0 -74
  172. package/dist/vendor-d3-brush-CcKeJp9e.js +0 -1
  173. package/dist/vendor-d3-color-BOYE6h_9.js +0 -306
  174. package/dist/vendor-d3-dispatch-fx-WMg0D.js +0 -64
  175. package/dist/vendor-d3-ease-Cr34gv04.js +0 -8
  176. package/dist/vendor-d3-format-DaIwZvFc.js +0 -182
  177. package/dist/vendor-d3-interpolate-BYG2gvO4.js +0 -177
  178. package/dist/vendor-d3-interpolate-path-CpGLvKgS.js +0 -299
  179. package/dist/vendor-d3-path-DJOTitNW.js +0 -64
  180. package/dist/vendor-d3-scale-CC5rtdt5.js +0 -561
  181. package/dist/vendor-d3-selection-CNMxsYiL.js +0 -603
  182. package/dist/vendor-d3-shape-DBhCDMiV.js +0 -925
  183. package/dist/vendor-d3-time-DAPP210_.js +0 -212
  184. package/dist/vendor-d3-time-format-hD7iE2WG.js +0 -491
  185. package/dist/vendor-d3-timer-C1cUWKPz.js +0 -67
  186. package/dist/vendor-d3-transition-BbNQT7qF.js +0 -524
  187. package/dist/vendor-d3-zoom-CcKeJp9e.js +0 -1
  188. package/dist/vendor-date-fns-BKO3x1R1.js +0 -3102
  189. package/dist/vendor-dom-serializer-BbVuF1MQ.js +0 -213
  190. package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
  191. package/dist/vendor-domhandler-Kufn9M_V.js +0 -311
  192. package/dist/vendor-dompurify-M2Bspgo5.js +0 -553
  193. package/dist/vendor-domutils-DDRq_ial.js +0 -386
  194. package/dist/vendor-emotion-cache-eEZT5l-Q.js +0 -274
  195. package/dist/vendor-emotion-hash-DImMRhyK.js +0 -22
  196. package/dist/vendor-emotion-memoize-BcEUCz8q.js +0 -9
  197. package/dist/vendor-emotion-serialize-BSDW8NwU.js +0 -123
  198. package/dist/vendor-emotion-sheet-CS8ZBl9s.js +0 -44
  199. package/dist/vendor-emotion-unitless-B7u1PU6w.js +0 -53
  200. package/dist/vendor-emotion-utils-D7refZTM.js +0 -28
  201. package/dist/vendor-entities-J86Og8IU.js +0 -364
  202. package/dist/vendor-floating-ui-core-BoHdh92a.js +0 -432
  203. package/dist/vendor-floating-ui-dom-BvVXFZ4B.js +0 -398
  204. package/dist/vendor-floating-ui-utils-CidJRIm2.js +0 -257
  205. package/dist/vendor-floating-ui-vue-sCrhit51.js +0 -121
  206. package/dist/vendor-gridstack-Dkfw452e.js +0 -3390
  207. package/dist/vendor-headlessui-vue-Cn-RMs4E.js +0 -961
  208. package/dist/vendor-htmlparser2-BxKKzWLL.js +0 -735
  209. package/dist/vendor-internmap-Q5729_cS.js +0 -35
  210. package/dist/vendor-intlify-core-base-YZqJSEvl.js +0 -1130
  211. package/dist/vendor-intlify-message-compiler-C5QaCXcF.js +0 -952
  212. package/dist/vendor-intlify-shared-BrKs3jCC.js +0 -144
  213. package/dist/vendor-iso-639-1-rPqx9HMT.js +0 -786
  214. package/dist/vendor-juggle-resize-observer-DiSiNbbT.js +0 -286
  215. package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
  216. package/dist/vendor-linkifyjs-dCH9UYes.js +0 -701
  217. package/dist/vendor-lodash-es-BtnfG6xF.js +0 -4829
  218. package/dist/vendor-lucide-vue-next-CPgeDcFj.js +0 -33093
  219. package/dist/vendor-markdown-it-Bs9KEWkF.js +0 -2266
  220. package/dist/vendor-markdown-it-task-lists-CHCnS7dl.js +0 -69
  221. package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
  222. package/dist/vendor-microsoft-applicationinsights-analytics-js-DFu_cVaY.js +0 -1207
  223. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-DRQLN2Ue.js +0 -261
  224. package/dist/vendor-microsoft-applicationinsights-channel-js-BIJDcP3D.js +0 -1822
  225. package/dist/vendor-microsoft-applicationinsights-common-CJjmnDMb.js +0 -1921
  226. package/dist/vendor-microsoft-applicationinsights-core-js-BOc_o46i.js +0 -4276
  227. package/dist/vendor-microsoft-applicationinsights-dependencies-js-DDz502id.js +0 -1407
  228. package/dist/vendor-microsoft-applicationinsights-properties-js-9aDWHwXJ.js +0 -572
  229. package/dist/vendor-microsoft-applicationinsights-shims-Dton8Vqy.js +0 -43
  230. package/dist/vendor-microsoft-applicationinsights-web-DTa5YN-h.js +0 -487
  231. package/dist/vendor-microsoft-dynamicproto-js-89GEKjvR.js +0 -147
  232. package/dist/vendor-microsoft-signalr-Bgpbb4fW.js +0 -1761
  233. package/dist/vendor-module-federation-enhanced-CV1CNdJy.js +0 -22
  234. package/dist/vendor-module-federation-error-codes-DdVwX11j.js +0 -55
  235. package/dist/vendor-module-federation-runtime-CVH_lWgu.js +0 -91
  236. package/dist/vendor-module-federation-runtime-core-D5G-s9nP.js +0 -2202
  237. package/dist/vendor-module-federation-runtime-tools-CQbtw-RJ.js +0 -18
  238. package/dist/vendor-module-federation-sdk-DM4AJRa7.js +0 -683
  239. package/dist/vendor-nevware21-ts-async-D4qa7g-U.js +0 -261
  240. package/dist/vendor-nevware21-ts-utils-DII8jruI.js +0 -853
  241. package/dist/vendor-nth-check-CGMdQf59.js +0 -45
  242. package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
  243. package/dist/vendor-parse5-htmlparser2-tree-adapter-BUDJ887-.js +0 -143
  244. package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
  245. package/dist/vendor-prettier-CoRReRqw.js +0 -5215
  246. package/dist/vendor-prosemirror-commands-Bv4ChObl.js +0 -385
  247. package/dist/vendor-prosemirror-dropcursor-kF5UKNFM.js +0 -86
  248. package/dist/vendor-prosemirror-gapcursor-BAwEBHgE.js +0 -203
  249. package/dist/vendor-prosemirror-history-CQYKHz3u.js +0 -248
  250. package/dist/vendor-prosemirror-keymap-CAfQyvJ7.js +0 -62
  251. package/dist/vendor-prosemirror-markdown-rpUTSG_Q.js +0 -663
  252. package/dist/vendor-prosemirror-model-DAA3avbR.js +0 -2730
  253. package/dist/vendor-prosemirror-schema-list-BNJkECdS.js +0 -87
  254. package/dist/vendor-prosemirror-state-IeimrELV.js +0 -821
  255. package/dist/vendor-prosemirror-tables-zVUKdbdQ.js +0 -1414
  256. package/dist/vendor-prosemirror-transform-BUjWd5Tb.js +0 -1525
  257. package/dist/vendor-prosemirror-view-DFpBkGRq.js +0 -3794
  258. package/dist/vendor-punycode-js-CgGegfA_.js +0 -133
  259. package/dist/vendor-rope-sequence-BWC2FSrq.js +0 -100
  260. package/dist/vendor-semver-Dar8oU3V.js +0 -1023
  261. package/dist/vendor-striptags-BrHtQQiF.js +0 -120
  262. package/dist/vendor-stylis-ClfDrgKE.js +0 -334
  263. package/dist/vendor-swiper-1bp0oJwt.js +0 -3387
  264. package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
  265. package/dist/vendor-throttle-debounce-CX0imT7m.js +0 -28
  266. package/dist/vendor-tiptap-core-BfrE48R3.js +0 -3884
  267. package/dist/vendor-tiptap-extension-blockquote-DG5eEgV_.js +0 -55
  268. package/dist/vendor-tiptap-extension-bold-CqPrSfgB.js +0 -74
  269. package/dist/vendor-tiptap-extension-code-Dj9HfL9x.js +0 -52
  270. package/dist/vendor-tiptap-extension-code-block-YnlbQcbJ.js +0 -215
  271. package/dist/vendor-tiptap-extension-document-DyG2LNKD.js +0 -12
  272. package/dist/vendor-tiptap-extension-hard-break-mzhqFFEq.js +0 -59
  273. package/dist/vendor-tiptap-extension-heading-DGnriW33.js +0 -63
  274. package/dist/vendor-tiptap-extension-horizontal-rule-pR7MlJHI.js +0 -56
  275. package/dist/vendor-tiptap-extension-image-BsXHNscz.js +0 -128
  276. package/dist/vendor-tiptap-extension-italic-aoCbIXRj.js +0 -73
  277. package/dist/vendor-tiptap-extension-link-DiV7DqnY.js +0 -312
  278. package/dist/vendor-tiptap-extension-list-BGYRWOyu.js +0 -722
  279. package/dist/vendor-tiptap-extension-paragraph-BEBEvW1W.js +0 -44
  280. package/dist/vendor-tiptap-extension-placeholder-ZfoeEW0T.js +0 -1
  281. package/dist/vendor-tiptap-extension-strike-6vob8J1A.js +0 -64
  282. package/dist/vendor-tiptap-extension-table-CH-0UqG-.js +0 -374
  283. package/dist/vendor-tiptap-extension-table-cell-_uzaJkJG.js +0 -1
  284. package/dist/vendor-tiptap-extension-table-header-_uzaJkJG.js +0 -1
  285. package/dist/vendor-tiptap-extension-table-row-_uzaJkJG.js +0 -1
  286. package/dist/vendor-tiptap-extension-text-CnqQVbB2.js +0 -13
  287. package/dist/vendor-tiptap-extension-text-style-Bj4bCZI1.js +0 -235
  288. package/dist/vendor-tiptap-extension-underline-CVBZMhrs.js +0 -65
  289. package/dist/vendor-tiptap-extensions-2ZbpCG7T.js +0 -296
  290. package/dist/vendor-tiptap-markdown-B7Wvo0s5.js +0 -826
  291. package/dist/vendor-tiptap-pm-DSHuSumV.js +0 -1
  292. package/dist/vendor-tiptap-starter-kit-ipneJHYV.js +0 -28
  293. package/dist/vendor-tiptap-vue-3-IfJcIOl5.js +0 -157
  294. package/dist/vendor-truncate-html-r2r8GKvW.js +0 -145
  295. package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
  296. package/dist/vendor-unovis-ts-Bue71Kwt.js +0 -2382
  297. package/dist/vendor-unovis-vue-C_K1g5KH.js +0 -446
  298. package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
  299. package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
  300. package/dist/vendor-vue-currency-input-CckB4kjx.js +0 -317
  301. package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
  302. package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
  303. package/dist/vendor-vue-i18n-BguHiJqH.js +0 -1381
  304. package/dist/vendor-vue-router-R3V0tq8_.js +0 -6
  305. package/dist/vendor-vue3-application-insights-BmJCYUcp.js +0 -69
  306. package/dist/vendor-vue3-touch-events-DqysuuWh.js +0 -169
  307. package/dist/vendor-vuepic-vue-datepicker-CaZ_qpJp.js +0 -4998
  308. package/dist/vendor-vueuse-components-Be490f6P.js +0 -542
  309. package/dist/vendor-vueuse-core-BW8bO6-j.js +0 -5135
  310. package/dist/vendor-vueuse-shared-bmkWEEYZ.js +0 -1169
  311. package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
  312. package/dist/vendor-web-vitals-vrpLO1bu.js +0 -207
@@ -1,3884 +0,0 @@
1
- import { f as he, c as gt, T as me, e as ge, l as ve, j as Bt, b as Z, R as ye, a as be } from "./vendor-prosemirror-transform-BUjWd5Tb.js";
2
- import { c as we, d as ke, e as Me, j as xe, a as Se, b as Ee, f as Te, g as Ae, h as Ce, l as Pe, i as $e, n as Ne, s as Re, k as ze, m as Ie, o as De, p as Be, q as Tt, w as _e } from "./vendor-prosemirror-commands-Bv4ChObl.js";
3
- import { N as nt, E as Oe, S as j, T as P, P as $, a as B, A as je } from "./vendor-prosemirror-state-IeimrELV.js";
4
- import { D as Le, d as _t, F as D, N as He, c as ut, S as Fe } from "./vendor-prosemirror-model-DAA3avbR.js";
5
- import { l as Ve, s as We, w as Ue } from "./vendor-prosemirror-schema-list-BNJkECdS.js";
6
- import { E as Ke } from "./vendor-prosemirror-view-DFpBkGRq.js";
7
- import { k as qe } from "./vendor-prosemirror-keymap-CAfQyvJ7.js";
8
- var Je = Object.defineProperty, vt = (e, t) => {
9
- for (var n in t)
10
- Je(e, n, { get: t[n], enumerable: !0 });
11
- };
12
- function rt(e) {
13
- const { state: t, transaction: n } = e;
14
- let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
15
- return {
16
- ...t,
17
- apply: t.apply.bind(t),
18
- applyTransaction: t.applyTransaction.bind(t),
19
- plugins: t.plugins,
20
- schema: t.schema,
21
- reconfigure: t.reconfigure.bind(t),
22
- toJSON: t.toJSON.bind(t),
23
- get storedMarks() {
24
- return o;
25
- },
26
- get selection() {
27
- return r;
28
- },
29
- get doc() {
30
- return s;
31
- },
32
- get tr() {
33
- return r = n.selection, s = n.doc, o = n.storedMarks, n;
34
- }
35
- };
36
- }
37
- var st = class {
38
- constructor(e) {
39
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
40
- }
41
- get hasCustomState() {
42
- return !!this.customState;
43
- }
44
- get state() {
45
- return this.customState || this.editor.state;
46
- }
47
- get commands() {
48
- const { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: s } = n, o = this.buildProps(s);
49
- return Object.fromEntries(
50
- Object.entries(e).map(([i, a]) => [i, (...l) => {
51
- const d = a(...l)(o);
52
- return !s.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(s), d;
53
- }])
54
- );
55
- }
56
- get chain() {
57
- return () => this.createChain();
58
- }
59
- get can() {
60
- return () => this.createCan();
61
- }
62
- createChain(e, t = !0) {
63
- const { rawCommands: n, editor: r, state: s } = this, { view: o } = r, i = [], a = !!e, c = e || s.tr, l = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && o.dispatch(c), i.every((u) => u === !0)), d = {
64
- ...Object.fromEntries(
65
- Object.entries(n).map(([u, p]) => [u, (...h) => {
66
- const m = this.buildProps(c, t), g = p(...h)(m);
67
- return i.push(g), d;
68
- }])
69
- ),
70
- run: l
71
- };
72
- return d;
73
- }
74
- createCan(e) {
75
- const { rawCommands: t, state: n } = this, r = !1, s = e || n.tr, o = this.buildProps(s, r);
76
- return {
77
- ...Object.fromEntries(
78
- Object.entries(t).map(([a, c]) => [a, (...l) => c(...l)({ ...o, dispatch: void 0 })])
79
- ),
80
- chain: () => this.createChain(s, r)
81
- };
82
- }
83
- buildProps(e, t = !0) {
84
- const { rawCommands: n, editor: r, state: s } = this, { view: o } = r, i = {
85
- tr: e,
86
- editor: r,
87
- view: o,
88
- state: rt({
89
- state: s,
90
- transaction: e
91
- }),
92
- dispatch: t ? () => {
93
- } : void 0,
94
- chain: () => this.createChain(e, t),
95
- can: () => this.createCan(e),
96
- get commands() {
97
- return Object.fromEntries(
98
- Object.entries(n).map(([a, c]) => [a, (...l) => c(...l)(i)])
99
- );
100
- }
101
- };
102
- return i;
103
- }
104
- }, Ot = {};
105
- vt(Ot, {
106
- blur: () => Xe,
107
- clearContent: () => Ye,
108
- clearNodes: () => Ze,
109
- command: () => Qe,
110
- createParagraphNear: () => Ge,
111
- cut: () => tn,
112
- deleteCurrentNode: () => en,
113
- deleteNode: () => nn,
114
- deleteRange: () => rn,
115
- deleteSelection: () => sn,
116
- enter: () => on,
117
- exitCode: () => an,
118
- extendMarkRange: () => cn,
119
- first: () => ln,
120
- focus: () => un,
121
- forEach: () => fn,
122
- insertContent: () => pn,
123
- insertContentAt: () => gn,
124
- joinBackward: () => bn,
125
- joinDown: () => yn,
126
- joinForward: () => wn,
127
- joinItemBackward: () => kn,
128
- joinItemForward: () => Mn,
129
- joinTextblockBackward: () => xn,
130
- joinTextblockForward: () => Sn,
131
- joinUp: () => vn,
132
- keyboardShortcut: () => Tn,
133
- lift: () => An,
134
- liftEmptyBlock: () => Cn,
135
- liftListItem: () => Pn,
136
- newlineInCode: () => $n,
137
- resetAttributes: () => Nn,
138
- scrollIntoView: () => Rn,
139
- selectAll: () => zn,
140
- selectNodeBackward: () => In,
141
- selectNodeForward: () => Dn,
142
- selectParentNode: () => Bn,
143
- selectTextblockEnd: () => _n,
144
- selectTextblockStart: () => On,
145
- setContent: () => jn,
146
- setMark: () => or,
147
- setMeta: () => ir,
148
- setNode: () => ar,
149
- setNodeSelection: () => cr,
150
- setTextDirection: () => lr,
151
- setTextSelection: () => dr,
152
- sinkListItem: () => ur,
153
- splitBlock: () => fr,
154
- splitListItem: () => pr,
155
- toggleList: () => hr,
156
- toggleMark: () => mr,
157
- toggleNode: () => gr,
158
- toggleWrap: () => vr,
159
- undoInputRule: () => yr,
160
- unsetAllMarks: () => br,
161
- unsetMark: () => wr,
162
- unsetTextDirection: () => kr,
163
- updateAttributes: () => Mr,
164
- wrapIn: () => xr,
165
- wrapInList: () => Sr
166
- });
167
- var Xe = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
168
- var n;
169
- e.isDestroyed || (t.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
- }), !0), Ye = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ze = () => ({ state: e, tr: t, dispatch: n }) => {
171
- const { selection: r } = t, { ranges: s } = r;
172
- return n && s.forEach(({ $from: o, $to: i }) => {
173
- e.doc.nodesBetween(o.pos, i.pos, (a, c) => {
174
- if (a.type.isText)
175
- return;
176
- const { doc: l, mapping: d } = t, u = l.resolve(d.map(c)), p = l.resolve(d.map(c + a.nodeSize)), f = u.blockRange(p);
177
- if (!f)
178
- return;
179
- const h = ve(f);
180
- if (a.type.isTextblock) {
181
- const { defaultType: m } = u.parent.contentMatchAt(u.index());
182
- t.setNodeMarkup(f.start, m);
183
- }
184
- (h || h === 0) && t.lift(f, h);
185
- });
186
- }), !0;
187
- }, Qe = (e) => (t) => e(t), Ge = () => ({ state: e, dispatch: t }) => we(e, t), tn = (e, t) => ({ editor: n, tr: r }) => {
188
- const { state: s } = n, o = s.doc.slice(e.from, e.to);
189
- r.deleteRange(e.from, e.to);
190
- const i = r.mapping.map(t);
191
- return r.insert(i, o.content), r.setSelection(new P(r.doc.resolve(Math.max(i - 1, 0)))), !0;
192
- }, en = () => ({ tr: e, dispatch: t }) => {
193
- const { selection: n } = e, r = n.$anchor.node();
194
- if (r.content.size > 0)
195
- return !1;
196
- const s = e.selection.$anchor;
197
- for (let o = s.depth; o > 0; o -= 1)
198
- if (s.node(o).type === r.type) {
199
- if (t) {
200
- const a = s.before(o), c = s.after(o);
201
- e.delete(a, c).scrollIntoView();
202
- }
203
- return !0;
204
- }
205
- return !1;
206
- };
207
- function T(e, t) {
208
- if (typeof e == "string") {
209
- if (!t.nodes[e])
210
- throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
211
- return t.nodes[e];
212
- }
213
- return e;
214
- }
215
- var nn = (e) => ({ tr: t, state: n, dispatch: r }) => {
216
- const s = T(e, n.schema), o = t.selection.$anchor;
217
- for (let i = o.depth; i > 0; i -= 1)
218
- if (o.node(i).type === s) {
219
- if (r) {
220
- const c = o.before(i), l = o.after(i);
221
- t.delete(c, l).scrollIntoView();
222
- }
223
- return !0;
224
- }
225
- return !1;
226
- }, rn = (e) => ({ tr: t, dispatch: n }) => {
227
- const { from: r, to: s } = e;
228
- return n && t.delete(r, s), !0;
229
- }, sn = () => ({ state: e, dispatch: t }) => ke(e, t), on = () => ({ commands: e }) => e.keyboardShortcut("Enter"), an = () => ({ state: e, dispatch: t }) => Me(e, t);
230
- function yt(e) {
231
- return Object.prototype.toString.call(e) === "[object RegExp]";
232
- }
233
- function G(e, t, n = { strict: !0 }) {
234
- const r = Object.keys(t);
235
- return r.length ? r.every((s) => n.strict ? t[s] === e[s] : yt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
236
- }
237
- function jt(e, t, n = {}) {
238
- return e.find((r) => r.type === t && G(
239
- // Only check equality for the attributes that are provided
240
- Object.fromEntries(Object.keys(n).map((s) => [s, r.attrs[s]])),
241
- n
242
- ));
243
- }
244
- function At(e, t, n = {}) {
245
- return !!jt(e, t, n);
246
- }
247
- function bt(e, t, n) {
248
- var r;
249
- if (!e || !t)
250
- return;
251
- let s = e.parent.childAfter(e.parentOffset);
252
- if ((!s.node || !s.node.marks.some((d) => d.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((d) => d.type === t) || (n = n || ((r = s.node.marks[0]) == null ? void 0 : r.attrs), !jt([...s.node.marks], t, n)))
253
- return;
254
- let i = s.index, a = e.start() + s.offset, c = i + 1, l = a + s.node.nodeSize;
255
- for (; i > 0 && At([...e.parent.child(i - 1).marks], t, n); )
256
- i -= 1, a -= e.parent.child(i).nodeSize;
257
- for (; c < e.parent.childCount && At([...e.parent.child(c).marks], t, n); )
258
- l += e.parent.child(c).nodeSize, c += 1;
259
- return {
260
- from: a,
261
- to: l
262
- };
263
- }
264
- function z(e, t) {
265
- if (typeof e == "string") {
266
- if (!t.marks[e])
267
- throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
268
- return t.marks[e];
269
- }
270
- return e;
271
- }
272
- var cn = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
273
- const o = z(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: d } = a;
274
- if (s) {
275
- const u = bt(c, o, t);
276
- if (u && u.from <= l && u.to >= d) {
277
- const p = P.create(i, u.from, u.to);
278
- n.setSelection(p);
279
- }
280
- }
281
- return !0;
282
- }, ln = (e) => (t) => {
283
- const n = typeof e == "function" ? e(t) : e;
284
- for (let r = 0; r < n.length; r += 1)
285
- if (n[r](t))
286
- return !0;
287
- return !1;
288
- };
289
- function Lt(e) {
290
- return e instanceof P;
291
- }
292
- function O(e = 0, t = 0, n = 0) {
293
- return Math.min(Math.max(e, t), n);
294
- }
295
- function Ht(e, t = null) {
296
- if (!t)
297
- return null;
298
- const n = j.atStart(e), r = j.atEnd(e);
299
- if (t === "start" || t === !0)
300
- return n;
301
- if (t === "end")
302
- return r;
303
- const s = n.from, o = r.to;
304
- return t === "all" ? P.create(e, O(0, s, o), O(e.content.size, s, o)) : P.create(e, O(t, s, o), O(t, s, o));
305
- }
306
- function Ct() {
307
- return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
308
- }
309
- function tt() {
310
- return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
311
- navigator.userAgent.includes("Mac") && "ontouchend" in document;
312
- }
313
- function dn() {
314
- return typeof navigator < "u" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : !1;
315
- }
316
- var un = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
317
- t = {
318
- scrollIntoView: !0,
319
- ...t
320
- };
321
- const i = () => {
322
- (tt() || Ct()) && r.dom.focus(), dn() && !tt() && !Ct() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
323
- n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
324
- });
325
- };
326
- try {
327
- if (r.hasFocus() && e === null || e === !1)
328
- return !0;
329
- } catch {
330
- return !1;
331
- }
332
- if (o && e === null && !Lt(n.state.selection))
333
- return i(), !0;
334
- const a = Ht(s.doc, e) || n.state.selection, c = n.state.selection.eq(a);
335
- return o && (c || s.setSelection(a), c && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
336
- }, fn = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), pn = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Ft = (e) => {
337
- const t = e.childNodes;
338
- for (let n = t.length - 1; n >= 0; n -= 1) {
339
- const r = t[n];
340
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ft(r);
341
- }
342
- return e;
343
- };
344
- function q(e) {
345
- if (typeof window > "u")
346
- throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
347
- const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
348
- return Ft(n);
349
- }
350
- function W(e, t, n) {
351
- if (e instanceof He || e instanceof D)
352
- return e;
353
- n = {
354
- slice: !0,
355
- parseOptions: {},
356
- ...n
357
- };
358
- const r = typeof e == "object" && e !== null, s = typeof e == "string";
359
- if (r)
360
- try {
361
- if (Array.isArray(e) && e.length > 0)
362
- return D.fromArray(e.map((a) => t.nodeFromJSON(a)));
363
- const i = t.nodeFromJSON(e);
364
- return n.errorOnInvalidContent && i.check(), i;
365
- } catch (o) {
366
- if (n.errorOnInvalidContent)
367
- throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
368
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), W("", t, n);
369
- }
370
- if (s) {
371
- if (n.errorOnInvalidContent) {
372
- let i = !1, a = "";
373
- const c = new _t({
374
- topNode: t.spec.topNode,
375
- marks: t.spec.marks,
376
- // Prosemirror's schemas are executed such that: the last to execute, matches last
377
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
378
- nodes: t.spec.nodes.append({
379
- __tiptap__private__unknown__catch__all__node: {
380
- content: "inline*",
381
- group: "block",
382
- parseDOM: [
383
- {
384
- tag: "*",
385
- getAttrs: (l) => (i = !0, a = typeof l == "string" ? l : l.outerHTML, null)
386
- }
387
- ]
388
- }
389
- })
390
- });
391
- if (n.slice ? ut.fromSchema(c).parseSlice(q(e), n.parseOptions) : ut.fromSchema(c).parse(q(e), n.parseOptions), n.errorOnInvalidContent && i)
392
- throw new Error("[tiptap error]: Invalid HTML content", {
393
- cause: new Error(`Invalid element found: ${a}`)
394
- });
395
- }
396
- const o = ut.fromSchema(t);
397
- return n.slice ? o.parseSlice(q(e), n.parseOptions).content : o.parse(q(e), n.parseOptions);
398
- }
399
- return W("", t, n);
400
- }
401
- function hn(e, t, n) {
402
- const r = e.steps.length - 1;
403
- if (r < t)
404
- return;
405
- const s = e.steps[r];
406
- if (!(s instanceof ye || s instanceof be))
407
- return;
408
- const o = e.mapping.maps[r];
409
- let i = 0;
410
- o.forEach((a, c, l, d) => {
411
- i === 0 && (i = d);
412
- }), e.setSelection(j.near(e.doc.resolve(i), n));
413
- }
414
- var mn = (e) => !("type" in e), gn = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
415
- var i;
416
- if (s) {
417
- n = {
418
- parseOptions: o.options.parseOptions,
419
- updateSelection: !0,
420
- applyInputRules: !1,
421
- applyPasteRules: !1,
422
- ...n
423
- };
424
- let a;
425
- const c = (g) => {
426
- o.emit("contentError", {
427
- editor: o,
428
- error: g,
429
- disableCollaboration: () => {
430
- "collaboration" in o.storage && typeof o.storage.collaboration == "object" && o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
431
- }
432
- });
433
- }, l = {
434
- preserveWhitespace: "full",
435
- ...n.parseOptions
436
- };
437
- if (!n.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError)
438
- try {
439
- W(t, o.schema, {
440
- parseOptions: l,
441
- errorOnInvalidContent: !0
442
- });
443
- } catch (g) {
444
- c(g);
445
- }
446
- try {
447
- a = W(t, o.schema, {
448
- parseOptions: l,
449
- errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : o.options.enableContentCheck
450
- });
451
- } catch (g) {
452
- return c(g), !1;
453
- }
454
- let { from: d, to: u } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, p = !0, f = !0;
455
- if ((mn(a) ? a : [a]).forEach((g) => {
456
- g.check(), p = p ? g.isText && g.marks.length === 0 : !1, f = f ? g.isBlock : !1;
457
- }), d === u && f) {
458
- const { parent: g } = r.doc.resolve(d);
459
- g.isTextblock && !g.type.spec.code && !g.childCount && (d -= 1, u += 1);
460
- }
461
- let m;
462
- if (p) {
463
- if (Array.isArray(t))
464
- m = t.map((g) => g.text || "").join("");
465
- else if (t instanceof D) {
466
- let g = "";
467
- t.forEach((v) => {
468
- v.text && (g += v.text);
469
- }), m = g;
470
- } else typeof t == "object" && t && t.text ? m = t.text : m = t;
471
- r.insertText(m, d, u);
472
- } else {
473
- m = a;
474
- const g = r.doc.resolve(d), v = g.node(), b = g.parentOffset === 0, k = v.isText || v.isTextblock, M = v.content.size > 0;
475
- b && k && M && (d = Math.max(0, d - 1)), r.replaceWith(d, u, m);
476
- }
477
- n.updateSelection && hn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: d, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: d, text: m });
478
- }
479
- return !0;
480
- }, vn = () => ({ state: e, dispatch: t }) => xe(e, t), yn = () => ({ state: e, dispatch: t }) => Se(e, t), bn = () => ({ state: e, dispatch: t }) => Ee(e, t), wn = () => ({ state: e, dispatch: t }) => Te(e, t), kn = () => ({ state: e, dispatch: t, tr: n }) => {
481
- try {
482
- const r = Bt(e.doc, e.selection.$from.pos, -1);
483
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
484
- } catch {
485
- return !1;
486
- }
487
- }, Mn = () => ({ state: e, dispatch: t, tr: n }) => {
488
- try {
489
- const r = Bt(e.doc, e.selection.$from.pos, 1);
490
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
491
- } catch {
492
- return !1;
493
- }
494
- }, xn = () => ({ state: e, dispatch: t }) => Ae(e, t), Sn = () => ({ state: e, dispatch: t }) => Ce(e, t);
495
- function Vt() {
496
- return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
497
- }
498
- function En(e) {
499
- const t = e.split(/-(?!$)/);
500
- let n = t[t.length - 1];
501
- n === "Space" && (n = " ");
502
- let r, s, o, i;
503
- for (let a = 0; a < t.length - 1; a += 1) {
504
- const c = t[a];
505
- if (/^(cmd|meta|m)$/i.test(c))
506
- i = !0;
507
- else if (/^a(lt)?$/i.test(c))
508
- r = !0;
509
- else if (/^(c|ctrl|control)$/i.test(c))
510
- s = !0;
511
- else if (/^s(hift)?$/i.test(c))
512
- o = !0;
513
- else if (/^mod$/i.test(c))
514
- tt() || Vt() ? i = !0 : s = !0;
515
- else
516
- throw new Error(`Unrecognized modifier name: ${c}`);
517
- }
518
- return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
519
- }
520
- var Tn = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
521
- const o = En(e).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
522
- key: i === "Space" ? " " : i,
523
- altKey: o.includes("Alt"),
524
- ctrlKey: o.includes("Ctrl"),
525
- metaKey: o.includes("Meta"),
526
- shiftKey: o.includes("Shift"),
527
- bubbles: !0,
528
- cancelable: !0
529
- }), c = t.captureTransaction(() => {
530
- n.someProp("handleKeyDown", (l) => l(n, a));
531
- });
532
- return c?.steps.forEach((l) => {
533
- const d = l.map(r.mapping);
534
- d && s && r.maybeStep(d);
535
- }), !0;
536
- };
537
- function U(e, t, n = {}) {
538
- const { from: r, to: s, empty: o } = e.selection, i = t ? T(t, e.schema) : null, a = [];
539
- e.doc.nodesBetween(r, s, (u, p) => {
540
- if (u.isText)
541
- return;
542
- const f = Math.max(r, p), h = Math.min(s, p + u.nodeSize);
543
- a.push({
544
- node: u,
545
- from: f,
546
- to: h
547
- });
548
- });
549
- const c = s - r, l = a.filter((u) => i ? i.name === u.node.type.name : !0).filter((u) => G(u.node.attrs, n, { strict: !1 }));
550
- return o ? !!l.length : l.reduce((u, p) => u + p.to - p.from, 0) >= c;
551
- }
552
- var An = (e, t = {}) => ({ state: n, dispatch: r }) => {
553
- const s = T(e, n.schema);
554
- return U(n, s, t) ? Pe(n, r) : !1;
555
- }, Cn = () => ({ state: e, dispatch: t }) => $e(e, t), Pn = (e) => ({ state: t, dispatch: n }) => {
556
- const r = T(e, t.schema);
557
- return Ve(r)(t, n);
558
- }, $n = () => ({ state: e, dispatch: t }) => Ne(e, t);
559
- function ot(e, t) {
560
- return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
561
- }
562
- function Pt(e, t) {
563
- const n = typeof t == "string" ? [t] : t;
564
- return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
565
- }
566
- var Nn = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
567
- let o = null, i = null;
568
- const a = ot(
569
- typeof e == "string" ? e : e.name,
570
- r.schema
571
- );
572
- if (!a)
573
- return !1;
574
- a === "node" && (o = T(e, r.schema)), a === "mark" && (i = z(e, r.schema));
575
- let c = !1;
576
- return n.selection.ranges.forEach((l) => {
577
- r.doc.nodesBetween(l.$from.pos, l.$to.pos, (d, u) => {
578
- o && o === d.type && (c = !0, s && n.setNodeMarkup(u, void 0, Pt(d.attrs, t))), i && d.marks.length && d.marks.forEach((p) => {
579
- i === p.type && (c = !0, s && n.addMark(u, u + d.nodeSize, i.create(Pt(p.attrs, t))));
580
- });
581
- });
582
- }), c;
583
- }, Rn = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), zn = () => ({ tr: e, dispatch: t }) => {
584
- if (t) {
585
- const n = new je(e.doc);
586
- e.setSelection(n);
587
- }
588
- return !0;
589
- }, In = () => ({ state: e, dispatch: t }) => Re(e, t), Dn = () => ({ state: e, dispatch: t }) => ze(e, t), Bn = () => ({ state: e, dispatch: t }) => Ie(e, t), _n = () => ({ state: e, dispatch: t }) => De(e, t), On = () => ({ state: e, dispatch: t }) => Be(e, t);
590
- function ht(e, t, n = {}, r = {}) {
591
- return W(e, t, {
592
- slice: !1,
593
- parseOptions: n,
594
- errorOnInvalidContent: r.errorOnInvalidContent
595
- });
596
- }
597
- var jn = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
598
- const { doc: c } = o;
599
- if (r.preserveWhitespace !== "full") {
600
- const l = ht(e, s.schema, r, {
601
- errorOnInvalidContent: t ?? s.options.enableContentCheck
602
- });
603
- return i && o.replaceWith(0, c.content.size, l).setMeta("preventUpdate", !n), !0;
604
- }
605
- return i && o.setMeta("preventUpdate", !n), a.insertContentAt({ from: 0, to: c.content.size }, e, {
606
- parseOptions: r,
607
- errorOnInvalidContent: t ?? s.options.enableContentCheck
608
- });
609
- };
610
- function Wt(e, t) {
611
- const n = z(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
612
- o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (c) => {
613
- i.push(...c.marks);
614
- });
615
- const a = i.find((c) => c.type.name === n.name);
616
- return a ? { ...a.attrs } : {};
617
- }
618
- function Ln(e, t) {
619
- const n = new me(e);
620
- return t.forEach((r) => {
621
- r.steps.forEach((s) => {
622
- n.step(s);
623
- });
624
- }), n;
625
- }
626
- function Hn(e) {
627
- for (let t = 0; t < e.edgeCount; t += 1) {
628
- const { type: n } = e.edge(t);
629
- if (n.isTextblock && !n.hasRequiredAttrs())
630
- return n;
631
- }
632
- return null;
633
- }
634
- function rs(e, t, n) {
635
- const r = [];
636
- return e.nodesBetween(t.from, t.to, (s, o) => {
637
- n(s) && r.push({
638
- node: s,
639
- pos: o
640
- });
641
- }), r;
642
- }
643
- function Fn(e, t) {
644
- for (let n = e.depth; n > 0; n -= 1) {
645
- const r = e.node(n);
646
- if (t(r))
647
- return {
648
- pos: n > 0 ? e.before(n) : 0,
649
- start: e.start(n),
650
- depth: n,
651
- node: r
652
- };
653
- }
654
- }
655
- function it(e) {
656
- return (t) => Fn(t.$from, e);
657
- }
658
- function y(e, t, n) {
659
- return e.config[t] === void 0 && e.parent ? y(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
660
- ...n,
661
- parent: e.parent ? y(e.parent, t, n) : null
662
- }) : e.config[t];
663
- }
664
- function wt(e) {
665
- return e.map((t) => {
666
- const n = {
667
- name: t.name,
668
- options: t.options,
669
- storage: t.storage
670
- }, r = y(t, "addExtensions", n);
671
- return r ? [t, ...wt(r())] : t;
672
- }).flat(10);
673
- }
674
- function kt(e, t) {
675
- const n = Le.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
676
- return s.appendChild(n), s.innerHTML;
677
- }
678
- function Ut(e) {
679
- return typeof e == "function";
680
- }
681
- function x(e, t = void 0, ...n) {
682
- return Ut(e) ? t ? e.bind(t)(...n) : e(...n) : e;
683
- }
684
- function Vn(e = {}) {
685
- return Object.keys(e).length === 0 && e.constructor === Object;
686
- }
687
- function L(e) {
688
- const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
689
- return {
690
- baseExtensions: t,
691
- nodeExtensions: n,
692
- markExtensions: r
693
- };
694
- }
695
- function Kt(e) {
696
- const t = [], { nodeExtensions: n, markExtensions: r } = L(e), s = [...n, ...r], o = {
697
- default: null,
698
- validate: void 0,
699
- rendered: !0,
700
- renderHTML: null,
701
- parseHTML: null,
702
- keepOnSplit: !0,
703
- isRequired: !1
704
- }, i = n.filter((l) => l.name !== "text").map((l) => l.name), a = r.map((l) => l.name), c = [...i, ...a];
705
- return e.forEach((l) => {
706
- const d = {
707
- name: l.name,
708
- options: l.options,
709
- storage: l.storage,
710
- extensions: s
711
- }, u = y(
712
- l,
713
- "addGlobalAttributes",
714
- d
715
- );
716
- if (!u)
717
- return;
718
- u().forEach((f) => {
719
- let h;
720
- Array.isArray(f.types) ? h = f.types : f.types === "*" ? h = c : f.types === "nodes" ? h = i : f.types === "marks" ? h = a : h = [], h.forEach((m) => {
721
- Object.entries(f.attributes).forEach(([g, v]) => {
722
- t.push({
723
- type: m,
724
- name: g,
725
- attribute: {
726
- ...o,
727
- ...v
728
- }
729
- });
730
- });
731
- });
732
- });
733
- }), s.forEach((l) => {
734
- const d = {
735
- name: l.name,
736
- options: l.options,
737
- storage: l.storage
738
- }, u = y(
739
- l,
740
- "addAttributes",
741
- d
742
- );
743
- if (!u)
744
- return;
745
- const p = u();
746
- Object.entries(p).forEach(([f, h]) => {
747
- const m = {
748
- ...o,
749
- ...h
750
- };
751
- typeof m?.default == "function" && (m.default = m.default()), m?.isRequired && m?.default === void 0 && delete m.default, t.push({
752
- type: l.name,
753
- name: f,
754
- attribute: m
755
- });
756
- });
757
- }), t;
758
- }
759
- function Wn(...e) {
760
- return e.filter((t) => !!t).reduce((t, n) => {
761
- const r = { ...t };
762
- return Object.entries(n).forEach(([s, o]) => {
763
- if (!r[s]) {
764
- r[s] = o;
765
- return;
766
- }
767
- if (s === "class") {
768
- const a = o ? String(o).split(" ") : [], c = r[s] ? r[s].split(" ") : [], l = a.filter((d) => !c.includes(d));
769
- r[s] = [...c, ...l].join(" ");
770
- } else if (s === "style") {
771
- const a = o ? o.split(";").map((d) => d.trim()).filter(Boolean) : [], c = r[s] ? r[s].split(";").map((d) => d.trim()).filter(Boolean) : [], l = /* @__PURE__ */ new Map();
772
- c.forEach((d) => {
773
- const [u, p] = d.split(":").map((f) => f.trim());
774
- l.set(u, p);
775
- }), a.forEach((d) => {
776
- const [u, p] = d.split(":").map((f) => f.trim());
777
- l.set(u, p);
778
- }), r[s] = Array.from(l.entries()).map(([d, u]) => `${d}: ${u}`).join("; ");
779
- } else
780
- r[s] = o;
781
- }), r;
782
- }, {});
783
- }
784
- function et(e, t) {
785
- return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
786
- [n.name]: e.attrs[n.name]
787
- }).reduce((n, r) => Wn(n, r), {});
788
- }
789
- function Un(e) {
790
- return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
791
- }
792
- function $t(e, t) {
793
- return "style" in e ? e : {
794
- ...e,
795
- getAttrs: (n) => {
796
- const r = e.getAttrs ? e.getAttrs(n) : e.attrs;
797
- if (r === !1)
798
- return !1;
799
- const s = t.reduce((o, i) => {
800
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Un(n.getAttribute(i.name));
801
- return a == null ? o : {
802
- ...o,
803
- [i.name]: a
804
- };
805
- }, {});
806
- return { ...r, ...s };
807
- }
808
- };
809
- }
810
- function Nt(e) {
811
- return Object.fromEntries(
812
- // @ts-ignore
813
- Object.entries(e).filter(([t, n]) => t === "attrs" && Vn(n) ? !1 : n != null)
814
- );
815
- }
816
- function Rt(e) {
817
- var t, n;
818
- const r = {};
819
- return !((t = e?.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), ((n = e?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
820
- }
821
- function Kn(e, t) {
822
- var n;
823
- const r = Kt(e), { nodeExtensions: s, markExtensions: o } = L(e), i = (n = s.find((l) => y(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
824
- s.map((l) => {
825
- const d = r.filter((v) => v.type === l.name), u = {
826
- name: l.name,
827
- options: l.options,
828
- storage: l.storage,
829
- editor: t
830
- }, p = e.reduce((v, b) => {
831
- const k = y(b, "extendNodeSchema", u);
832
- return {
833
- ...v,
834
- ...k ? k(l) : {}
835
- };
836
- }, {}), f = Nt({
837
- ...p,
838
- content: x(y(l, "content", u)),
839
- marks: x(y(l, "marks", u)),
840
- group: x(y(l, "group", u)),
841
- inline: x(y(l, "inline", u)),
842
- atom: x(y(l, "atom", u)),
843
- selectable: x(y(l, "selectable", u)),
844
- draggable: x(y(l, "draggable", u)),
845
- code: x(y(l, "code", u)),
846
- whitespace: x(y(l, "whitespace", u)),
847
- linebreakReplacement: x(
848
- y(l, "linebreakReplacement", u)
849
- ),
850
- defining: x(y(l, "defining", u)),
851
- isolating: x(y(l, "isolating", u)),
852
- attrs: Object.fromEntries(d.map(Rt))
853
- }), h = x(y(l, "parseHTML", u));
854
- h && (f.parseDOM = h.map(
855
- (v) => $t(v, d)
856
- ));
857
- const m = y(l, "renderHTML", u);
858
- m && (f.toDOM = (v) => m({
859
- node: v,
860
- HTMLAttributes: et(v, d)
861
- }));
862
- const g = y(l, "renderText", u);
863
- return g && (f.toText = g), [l.name, f];
864
- })
865
- ), c = Object.fromEntries(
866
- o.map((l) => {
867
- const d = r.filter((g) => g.type === l.name), u = {
868
- name: l.name,
869
- options: l.options,
870
- storage: l.storage,
871
- editor: t
872
- }, p = e.reduce((g, v) => {
873
- const b = y(v, "extendMarkSchema", u);
874
- return {
875
- ...g,
876
- ...b ? b(l) : {}
877
- };
878
- }, {}), f = Nt({
879
- ...p,
880
- inclusive: x(y(l, "inclusive", u)),
881
- excludes: x(y(l, "excludes", u)),
882
- group: x(y(l, "group", u)),
883
- spanning: x(y(l, "spanning", u)),
884
- code: x(y(l, "code", u)),
885
- attrs: Object.fromEntries(d.map(Rt))
886
- }), h = x(y(l, "parseHTML", u));
887
- h && (f.parseDOM = h.map(
888
- (g) => $t(g, d)
889
- ));
890
- const m = y(l, "renderHTML", u);
891
- return m && (f.toDOM = (g) => m({
892
- mark: g,
893
- HTMLAttributes: et(g, d)
894
- })), [l.name, f];
895
- })
896
- );
897
- return new _t({
898
- topNode: i,
899
- nodes: a,
900
- marks: c
901
- });
902
- }
903
- function qn(e) {
904
- const t = e.filter((n, r) => e.indexOf(n) !== r);
905
- return Array.from(new Set(t));
906
- }
907
- function V(e) {
908
- return e.sort((n, r) => {
909
- const s = y(n, "priority") || 100, o = y(r, "priority") || 100;
910
- return s > o ? -1 : s < o ? 1 : 0;
911
- });
912
- }
913
- function qt(e) {
914
- const t = V(wt(e)), n = qn(t.map((r) => r.name));
915
- return n.length && console.warn(
916
- `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
917
- ), t;
918
- }
919
- function Jt(e, t, n) {
920
- const { from: r, to: s } = t, { blockSeparator: o = `
921
-
922
- `, textSerializers: i = {} } = n || {};
923
- let a = "";
924
- return e.nodesBetween(r, s, (c, l, d, u) => {
925
- var p;
926
- c.isBlock && l > r && (a += o);
927
- const f = i?.[c.type.name];
928
- if (f)
929
- return d && (a += f({
930
- node: c,
931
- pos: l,
932
- parent: d,
933
- index: u,
934
- range: t
935
- })), !1;
936
- c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, s - l));
937
- }), a;
938
- }
939
- function Jn(e, t) {
940
- const n = {
941
- from: 0,
942
- to: e.content.size
943
- };
944
- return Jt(e, n, t);
945
- }
946
- function Xt(e) {
947
- return Object.fromEntries(
948
- Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText])
949
- );
950
- }
951
- function Xn(e, t) {
952
- const n = T(t, e.schema), { from: r, to: s } = e.selection, o = [];
953
- e.doc.nodesBetween(r, s, (a) => {
954
- o.push(a);
955
- });
956
- const i = o.reverse().find((a) => a.type.name === n.name);
957
- return i ? { ...i.attrs } : {};
958
- }
959
- function Yn(e, t) {
960
- const n = ot(
961
- typeof t == "string" ? t : t.name,
962
- e.schema
963
- );
964
- return n === "node" ? Xn(e, t) : n === "mark" ? Wt(e, t) : {};
965
- }
966
- function Zn(e, t = JSON.stringify) {
967
- const n = {};
968
- return e.filter((r) => {
969
- const s = t(r);
970
- return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
971
- });
972
- }
973
- function Qn(e) {
974
- const t = Zn(e);
975
- return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
976
- }
977
- function Gn(e) {
978
- const { mapping: t, steps: n } = e, r = [];
979
- return t.maps.forEach((s, o) => {
980
- const i = [];
981
- if (s.ranges.length)
982
- s.forEach((a, c) => {
983
- i.push({ from: a, to: c });
984
- });
985
- else {
986
- const { from: a, to: c } = n[o];
987
- if (a === void 0 || c === void 0)
988
- return;
989
- i.push({ from: a, to: c });
990
- }
991
- i.forEach(({ from: a, to: c }) => {
992
- const l = t.slice(o).map(a, -1), d = t.slice(o).map(c), u = t.invert().map(l, -1), p = t.invert().map(d);
993
- r.push({
994
- oldRange: {
995
- from: u,
996
- to: p
997
- },
998
- newRange: {
999
- from: l,
1000
- to: d
1001
- }
1002
- });
1003
- });
1004
- }), Qn(r);
1005
- }
1006
- function Yt(e, t, n) {
1007
- const r = [];
1008
- return e === t ? n.resolve(e).marks().forEach((s) => {
1009
- const o = n.resolve(e), i = bt(o, s.type);
1010
- i && r.push({
1011
- mark: s,
1012
- ...i
1013
- });
1014
- }) : n.nodesBetween(e, t, (s, o) => {
1015
- !s || s?.nodeSize === void 0 || r.push(
1016
- ...s.marks.map((i) => ({
1017
- from: o,
1018
- to: o + s.nodeSize,
1019
- mark: i
1020
- }))
1021
- );
1022
- }), r;
1023
- }
1024
- var ss = (e, t, n, r = 20) => {
1025
- const s = e.doc.resolve(n);
1026
- let o = r, i = null;
1027
- for (; o > 0 && i === null; ) {
1028
- const a = s.node(o);
1029
- a?.type.name === t ? i = a : o -= 1;
1030
- }
1031
- return [i, o];
1032
- };
1033
- function H(e, t) {
1034
- return t.nodes[e] || t.marks[e] || null;
1035
- }
1036
- function Q(e, t, n) {
1037
- return Object.fromEntries(
1038
- Object.entries(n).filter(([r]) => {
1039
- const s = e.find((o) => o.type === t && o.name === r);
1040
- return s ? s.attribute.keepOnSplit : !1;
1041
- })
1042
- );
1043
- }
1044
- var tr = (e, t = 500) => {
1045
- let n = "";
1046
- const r = e.parentOffset;
1047
- return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
1048
- var c, l;
1049
- const d = ((l = (c = s.type.spec).toText) == null ? void 0 : l.call(c, {
1050
- node: s,
1051
- pos: o,
1052
- parent: i,
1053
- index: a
1054
- })) || s.textContent || "%leaf%";
1055
- n += s.isAtom && !s.isText ? d : d.slice(0, Math.max(0, r - o));
1056
- }), n;
1057
- };
1058
- function mt(e, t, n = {}) {
1059
- const { empty: r, ranges: s } = e.selection, o = t ? z(t, e.schema) : null;
1060
- if (r)
1061
- return !!(e.storedMarks || e.selection.$from.marks()).filter((u) => o ? o.name === u.type.name : !0).find((u) => G(u.attrs, n, { strict: !1 }));
1062
- let i = 0;
1063
- const a = [];
1064
- if (s.forEach(({ $from: u, $to: p }) => {
1065
- const f = u.pos, h = p.pos;
1066
- e.doc.nodesBetween(f, h, (m, g) => {
1067
- if (o && m.inlineContent && !m.type.allowsMarkType(o))
1068
- return !1;
1069
- if (!m.isText && !m.marks.length)
1070
- return;
1071
- const v = Math.max(f, g), b = Math.min(h, g + m.nodeSize), k = b - v;
1072
- i += k, a.push(
1073
- ...m.marks.map((M) => ({
1074
- mark: M,
1075
- from: v,
1076
- to: b
1077
- }))
1078
- );
1079
- });
1080
- }), i === 0)
1081
- return !1;
1082
- const c = a.filter((u) => o ? o.name === u.mark.type.name : !0).filter((u) => G(u.mark.attrs, n, { strict: !1 })).reduce((u, p) => u + p.to - p.from, 0), l = a.filter((u) => o ? u.mark.type !== o && u.mark.type.excludes(o) : !0).reduce((u, p) => u + p.to - p.from, 0);
1083
- return (c > 0 ? c + l : c) >= i;
1084
- }
1085
- function er(e, t, n = {}) {
1086
- if (!t)
1087
- return U(e, null, n) || mt(e, null, n);
1088
- const r = ot(t, e.schema);
1089
- return r === "node" ? U(e, t, n) : r === "mark" ? mt(e, t, n) : !1;
1090
- }
1091
- var os = (e, t) => {
1092
- const { $from: n, $to: r, $anchor: s } = e.selection;
1093
- if (t) {
1094
- const o = it((a) => a.type.name === t)(e.selection);
1095
- if (!o)
1096
- return !1;
1097
- const i = e.doc.resolve(o.pos + 1);
1098
- return s.pos + 1 === i.end();
1099
- }
1100
- return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1101
- }, is = (e) => {
1102
- const { $from: t, $to: n } = e.selection;
1103
- return !(t.parentOffset > 0 || t.pos !== n.pos);
1104
- };
1105
- function zt(e, t) {
1106
- return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
1107
- }
1108
- function It(e, t) {
1109
- const { nodeExtensions: n } = L(t), r = n.find((i) => i.name === e);
1110
- if (!r)
1111
- return !1;
1112
- const s = {
1113
- name: r.name,
1114
- options: r.options,
1115
- storage: r.storage
1116
- }, o = x(y(r, "group", s));
1117
- return typeof o != "string" ? !1 : o.split(" ").includes("list");
1118
- }
1119
- function Mt(e, {
1120
- checkChildren: t = !0,
1121
- ignoreWhitespace: n = !1
1122
- } = {}) {
1123
- var r;
1124
- if (n) {
1125
- if (e.type.name === "hardBreak")
1126
- return !0;
1127
- if (e.isText)
1128
- return /^\s*$/m.test((r = e.text) != null ? r : "");
1129
- }
1130
- if (e.isText)
1131
- return !e.text;
1132
- if (e.isAtom || e.isLeaf)
1133
- return !1;
1134
- if (e.content.childCount === 0)
1135
- return !0;
1136
- if (t) {
1137
- let s = !0;
1138
- return e.content.forEach((o) => {
1139
- s !== !1 && (Mt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1140
- }), s;
1141
- }
1142
- return !1;
1143
- }
1144
- function as(e) {
1145
- return e instanceof nt;
1146
- }
1147
- var Zt = class Qt {
1148
- constructor(t) {
1149
- this.position = t;
1150
- }
1151
- /**
1152
- * Creates a MappablePosition from a JSON object.
1153
- */
1154
- static fromJSON(t) {
1155
- return new Qt(t.position);
1156
- }
1157
- /**
1158
- * Converts the MappablePosition to a JSON object.
1159
- */
1160
- toJSON() {
1161
- return {
1162
- position: this.position
1163
- };
1164
- }
1165
- };
1166
- function nr(e, t) {
1167
- const n = t.mapping.mapResult(e.position);
1168
- return {
1169
- position: new Zt(n.pos),
1170
- mapResult: n
1171
- };
1172
- }
1173
- function rr(e) {
1174
- return new Zt(e);
1175
- }
1176
- function sr(e, t, n) {
1177
- var r;
1178
- const { selection: s } = t;
1179
- let o = null;
1180
- if (Lt(s) && (o = s.$cursor), o) {
1181
- const a = (r = e.storedMarks) != null ? r : o.marks();
1182
- return o.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
1183
- }
1184
- const { ranges: i } = s;
1185
- return i.some(({ $from: a, $to: c }) => {
1186
- let l = a.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1187
- return e.doc.nodesBetween(a.pos, c.pos, (d, u, p) => {
1188
- if (l)
1189
- return !1;
1190
- if (d.isInline) {
1191
- const f = !p || p.type.allowsMarkType(n), h = !!n.isInSet(d.marks) || !d.marks.some((m) => m.type.excludes(n));
1192
- l = f && h;
1193
- }
1194
- return !l;
1195
- }), l;
1196
- });
1197
- }
1198
- var or = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1199
- const { selection: o } = n, { empty: i, ranges: a } = o, c = z(e, r.schema);
1200
- if (s)
1201
- if (i) {
1202
- const l = Wt(r, c);
1203
- n.addStoredMark(
1204
- c.create({
1205
- ...l,
1206
- ...t
1207
- })
1208
- );
1209
- } else
1210
- a.forEach((l) => {
1211
- const d = l.$from.pos, u = l.$to.pos;
1212
- r.doc.nodesBetween(d, u, (p, f) => {
1213
- const h = Math.max(f, d), m = Math.min(f + p.nodeSize, u);
1214
- p.marks.find((v) => v.type === c) ? p.marks.forEach((v) => {
1215
- c === v.type && n.addMark(
1216
- h,
1217
- m,
1218
- c.create({
1219
- ...v.attrs,
1220
- ...t
1221
- })
1222
- );
1223
- }) : n.addMark(h, m, c.create(t));
1224
- });
1225
- });
1226
- return sr(r, n, c);
1227
- }, ir = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), ar = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
1228
- const o = T(e, n.schema);
1229
- let i;
1230
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) => Tt(o, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Tt(o, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1231
- }, cr = (e) => ({ tr: t, dispatch: n }) => {
1232
- if (n) {
1233
- const { doc: r } = t, s = O(e, 0, r.content.size), o = nt.create(r, s);
1234
- t.setSelection(o);
1235
- }
1236
- return !0;
1237
- }, lr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1238
- const { selection: o } = r;
1239
- let i, a;
1240
- return typeof t == "number" ? (i = t, a = t) : t && "from" in t && "to" in t ? (i = t.from, a = t.to) : (i = o.from, a = o.to), s && n.doc.nodesBetween(i, a, (c, l) => {
1241
- c.isText || n.setNodeMarkup(l, void 0, {
1242
- ...c.attrs,
1243
- dir: e
1244
- });
1245
- }), !0;
1246
- }, dr = (e) => ({ tr: t, dispatch: n }) => {
1247
- if (n) {
1248
- const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = P.atStart(r).from, a = P.atEnd(r).to, c = O(s, i, a), l = O(o, i, a), d = P.create(r, c, l);
1249
- t.setSelection(d);
1250
- }
1251
- return !0;
1252
- }, ur = (e) => ({ state: t, dispatch: n }) => {
1253
- const r = T(e, t.schema);
1254
- return We(r)(t, n);
1255
- };
1256
- function Dt(e, t) {
1257
- const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1258
- if (n) {
1259
- const r = n.filter((s) => t?.includes(s.type.name));
1260
- e.tr.ensureMarks(r);
1261
- }
1262
- }
1263
- var fr = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
1264
- const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, d = Q(l, a.node().type.name, a.node().attrs);
1265
- if (o instanceof nt && o.node.isBlock)
1266
- return !a.parentOffset || !Z(i, a.pos) ? !1 : (r && (e && Dt(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1267
- if (!a.parent.isBlock)
1268
- return !1;
1269
- const u = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Hn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1270
- let f = u && p ? [
1271
- {
1272
- type: p,
1273
- attrs: d
1274
- }
1275
- ] : void 0, h = Z(t.doc, t.mapping.map(a.pos), 1, f);
1276
- if (!f && !h && Z(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, f = p ? [
1277
- {
1278
- type: p,
1279
- attrs: d
1280
- }
1281
- ] : void 0), r) {
1282
- if (h && (o instanceof P && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, f), p && !u && !a.parentOffset && a.parent.type !== p)) {
1283
- const m = t.mapping.map(a.before()), g = t.doc.resolve(m);
1284
- a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1285
- }
1286
- e && Dt(n, s.extensionManager.splittableMarks), t.scrollIntoView();
1287
- }
1288
- return h;
1289
- }, pr = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
1290
- var i;
1291
- const a = T(e, r.schema), { $from: c, $to: l } = r.selection, d = r.selection.node;
1292
- if (d && d.isBlock || c.depth < 2 || !c.sameParent(l))
1293
- return !1;
1294
- const u = c.node(-1);
1295
- if (u.type !== a)
1296
- return !1;
1297
- const p = o.extensionManager.attributes;
1298
- if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1299
- if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
1300
- return !1;
1301
- if (s) {
1302
- let v = D.empty;
1303
- const b = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1304
- for (let A = c.depth - b; A >= c.depth - 3; A -= 1)
1305
- v = D.from(c.node(A).copy(v));
1306
- const k = (
1307
- // eslint-disable-next-line no-nested-ternary
1308
- c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
1309
- ), M = {
1310
- ...Q(p, c.node().type.name, c.node().attrs),
1311
- ...t
1312
- }, w = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
1313
- v = v.append(D.from(a.createAndFill(null, w) || void 0));
1314
- const S = c.before(c.depth - (b - 1));
1315
- n.replace(S, c.after(-k), new Fe(v, 4 - b, 0));
1316
- let E = -1;
1317
- n.doc.nodesBetween(S, n.doc.content.size, (A, C) => {
1318
- if (E > -1)
1319
- return !1;
1320
- A.isTextblock && A.content.size === 0 && (E = C + 1);
1321
- }), E > -1 && n.setSelection(P.near(n.doc.resolve(E))), n.scrollIntoView();
1322
- }
1323
- return !0;
1324
- }
1325
- const f = l.pos === c.end() ? u.contentMatchAt(0).defaultType : null, h = {
1326
- ...Q(p, u.type.name, u.attrs),
1327
- ...t
1328
- }, m = {
1329
- ...Q(p, c.node().type.name, c.node().attrs),
1330
- ...t
1331
- };
1332
- n.delete(c.pos, l.pos);
1333
- const g = f ? [
1334
- { type: a, attrs: h },
1335
- { type: f, attrs: m }
1336
- ] : [{ type: a, attrs: h }];
1337
- if (!Z(n.doc, c.pos, 2))
1338
- return !1;
1339
- if (s) {
1340
- const { selection: v, storedMarks: b } = r, { splittableMarks: k } = o.extensionManager, M = b || v.$to.parentOffset && v.$from.marks();
1341
- if (n.split(c.pos, 2, g).scrollIntoView(), !M || !s)
1342
- return !0;
1343
- const w = M.filter((S) => k.includes(S.type.name));
1344
- n.ensureMarks(w);
1345
- }
1346
- return !0;
1347
- }, ft = (e, t) => {
1348
- const n = it((i) => i.type === t)(e.selection);
1349
- if (!n)
1350
- return !0;
1351
- const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1352
- if (r === void 0)
1353
- return !0;
1354
- const s = e.doc.nodeAt(r);
1355
- return n.node.type === s?.type && gt(e.doc, n.pos) && e.join(n.pos), !0;
1356
- }, pt = (e, t) => {
1357
- const n = it((i) => i.type === t)(e.selection);
1358
- if (!n)
1359
- return !0;
1360
- const r = e.doc.resolve(n.start).after(n.depth);
1361
- if (r === void 0)
1362
- return !0;
1363
- const s = e.doc.nodeAt(r);
1364
- return n.node.type === s?.type && gt(e.doc, r) && e.join(r), !0;
1365
- }, hr = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: c, commands: l, can: d }) => {
1366
- const { extensions: u, splittableMarks: p } = s.extensionManager, f = T(e, i.schema), h = T(t, i.schema), { selection: m, storedMarks: g } = i, { $from: v, $to: b } = m, k = v.blockRange(b), M = g || m.$to.parentOffset && m.$from.marks();
1367
- if (!k)
1368
- return !1;
1369
- const w = it((S) => It(S.type.name, u))(m);
1370
- if (k.depth >= 1 && w && k.depth - w.depth <= 1) {
1371
- if (w.node.type === f)
1372
- return l.liftListItem(h);
1373
- if (It(w.node.type.name, u) && f.validContent(w.node.content) && a)
1374
- return c().command(() => (o.setNodeMarkup(w.pos, f), !0)).command(() => ft(o, f)).command(() => pt(o, f)).run();
1375
- }
1376
- return !n || !M || !a ? c().command(() => d().wrapInList(f, r) ? !0 : l.clearNodes()).wrapInList(f, r).command(() => ft(o, f)).command(() => pt(o, f)).run() : c().command(() => {
1377
- const S = d().wrapInList(f, r), E = M.filter((A) => p.includes(A.type.name));
1378
- return o.ensureMarks(E), S ? !0 : l.clearNodes();
1379
- }).wrapInList(f, r).command(() => ft(o, f)).command(() => pt(o, f)).run();
1380
- }, mr = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
1381
- const { extendEmptyMarkRange: o = !1 } = n, i = z(e, r.schema);
1382
- return mt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
1383
- }, gr = (e, t, n = {}) => ({ state: r, commands: s }) => {
1384
- const o = T(e, r.schema), i = T(t, r.schema), a = U(r, o, n);
1385
- let c;
1386
- return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? s.setNode(i, c) : s.setNode(o, { ...c, ...n });
1387
- }, vr = (e, t = {}) => ({ state: n, commands: r }) => {
1388
- const s = T(e, n.schema);
1389
- return U(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
1390
- }, yr = () => ({ state: e, dispatch: t }) => {
1391
- const n = e.plugins;
1392
- for (let r = 0; r < n.length; r += 1) {
1393
- const s = n[r];
1394
- let o;
1395
- if (s.spec.isInputRules && (o = s.getState(e))) {
1396
- if (t) {
1397
- const i = e.tr, a = o.transform;
1398
- for (let c = a.steps.length - 1; c >= 0; c -= 1)
1399
- i.step(a.steps[c].invert(a.docs[c]));
1400
- if (o.text) {
1401
- const c = i.doc.resolve(o.from).marks();
1402
- i.replaceWith(o.from, o.to, e.schema.text(o.text, c));
1403
- } else
1404
- i.delete(o.from, o.to);
1405
- }
1406
- return !0;
1407
- }
1408
- }
1409
- return !1;
1410
- }, br = () => ({ tr: e, dispatch: t }) => {
1411
- const { selection: n } = e, { empty: r, ranges: s } = n;
1412
- return r || t && s.forEach((o) => {
1413
- e.removeMark(o.$from.pos, o.$to.pos);
1414
- }), !0;
1415
- }, wr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1416
- var o;
1417
- const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = z(e, r.schema), { $from: l, empty: d, ranges: u } = a;
1418
- if (!s)
1419
- return !0;
1420
- if (d && i) {
1421
- let { from: p, to: f } = a;
1422
- const h = (o = l.marks().find((g) => g.type === c)) == null ? void 0 : o.attrs, m = bt(l, c, h);
1423
- m && (p = m.from, f = m.to), n.removeMark(p, f, c);
1424
- } else
1425
- u.forEach((p) => {
1426
- n.removeMark(p.$from.pos, p.$to.pos, c);
1427
- });
1428
- return n.removeStoredMark(c), !0;
1429
- }, kr = (e) => ({ tr: t, state: n, dispatch: r }) => {
1430
- const { selection: s } = n;
1431
- let o, i;
1432
- return typeof e == "number" ? (o = e, i = e) : e && "from" in e && "to" in e ? (o = e.from, i = e.to) : (o = s.from, i = s.to), r && t.doc.nodesBetween(o, i, (a, c) => {
1433
- if (a.isText)
1434
- return;
1435
- const l = { ...a.attrs };
1436
- delete l.dir, t.setNodeMarkup(c, void 0, l);
1437
- }), !0;
1438
- }, Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1439
- let o = null, i = null;
1440
- const a = ot(
1441
- typeof e == "string" ? e : e.name,
1442
- r.schema
1443
- );
1444
- if (!a)
1445
- return !1;
1446
- a === "node" && (o = T(e, r.schema)), a === "mark" && (i = z(e, r.schema));
1447
- let c = !1;
1448
- return n.selection.ranges.forEach((l) => {
1449
- const d = l.$from.pos, u = l.$to.pos;
1450
- let p, f, h, m;
1451
- n.selection.empty ? r.doc.nodesBetween(d, u, (g, v) => {
1452
- o && o === g.type && (c = !0, h = Math.max(v, d), m = Math.min(v + g.nodeSize, u), p = v, f = g);
1453
- }) : r.doc.nodesBetween(d, u, (g, v) => {
1454
- v < d && o && o === g.type && (c = !0, h = Math.max(v, d), m = Math.min(v + g.nodeSize, u), p = v, f = g), v >= d && v <= u && (o && o === g.type && (c = !0, s && n.setNodeMarkup(v, void 0, {
1455
- ...g.attrs,
1456
- ...t
1457
- })), i && g.marks.length && g.marks.forEach((b) => {
1458
- if (i === b.type && (c = !0, s)) {
1459
- const k = Math.max(v, d), M = Math.min(v + g.nodeSize, u);
1460
- n.addMark(
1461
- k,
1462
- M,
1463
- i.create({
1464
- ...b.attrs,
1465
- ...t
1466
- })
1467
- );
1468
- }
1469
- }));
1470
- }), f && (p !== void 0 && s && n.setNodeMarkup(p, void 0, {
1471
- ...f.attrs,
1472
- ...t
1473
- }), i && f.marks.length && f.marks.forEach((g) => {
1474
- i === g.type && s && n.addMark(
1475
- h,
1476
- m,
1477
- i.create({
1478
- ...g.attrs,
1479
- ...t
1480
- })
1481
- );
1482
- }));
1483
- }), c;
1484
- }, xr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1485
- const s = T(e, n.schema);
1486
- return _e(s, t)(n, r);
1487
- }, Sr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1488
- const s = T(e, n.schema);
1489
- return Ue(s, t)(n, r);
1490
- }, Er = class {
1491
- constructor() {
1492
- this.callbacks = {};
1493
- }
1494
- on(e, t) {
1495
- return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
1496
- }
1497
- emit(e, ...t) {
1498
- const n = this.callbacks[e];
1499
- return n && n.forEach((r) => r.apply(this, t)), this;
1500
- }
1501
- off(e, t) {
1502
- const n = this.callbacks[e];
1503
- return n && (t ? this.callbacks[e] = n.filter((r) => r !== t) : delete this.callbacks[e]), this;
1504
- }
1505
- once(e, t) {
1506
- const n = (...r) => {
1507
- this.off(e, n), t.apply(this, r);
1508
- };
1509
- return this.on(e, n);
1510
- }
1511
- removeAllListeners() {
1512
- this.callbacks = {};
1513
- }
1514
- }, at = class {
1515
- constructor(e) {
1516
- var t;
1517
- this.find = e.find, this.handler = e.handler, this.undoable = (t = e.undoable) != null ? t : !0;
1518
- }
1519
- }, Tr = (e, t) => {
1520
- if (yt(t))
1521
- return t.exec(e);
1522
- const n = t(e);
1523
- if (!n)
1524
- return null;
1525
- const r = [n.text];
1526
- return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
1527
- };
1528
- function J(e) {
1529
- var t;
1530
- const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: c } = n;
1531
- if (c.composing)
1532
- return !1;
1533
- const l = c.state.doc.resolve(r);
1534
- if (
1535
- // check for code node
1536
- l.parent.type.spec.code || (t = l.nodeBefore || l.nodeAfter) != null && t.marks.find((p) => p.type.spec.code)
1537
- )
1538
- return !1;
1539
- let d = !1;
1540
- const u = tr(l) + o;
1541
- return i.forEach((p) => {
1542
- if (d)
1543
- return;
1544
- const f = Tr(u, p.find);
1545
- if (!f)
1546
- return;
1547
- const h = c.state.tr, m = rt({
1548
- state: c.state,
1549
- transaction: h
1550
- }), g = {
1551
- from: r - (f[0].length - o.length),
1552
- to: s
1553
- }, { commands: v, chain: b, can: k } = new st({
1554
- editor: n,
1555
- state: m
1556
- });
1557
- p.handler({
1558
- state: m,
1559
- range: g,
1560
- match: f,
1561
- commands: v,
1562
- chain: b,
1563
- can: k
1564
- }) === null || !h.steps.length || (p.undoable && h.setMeta(a, {
1565
- transform: h,
1566
- from: r,
1567
- to: s,
1568
- text: o
1569
- }), c.dispatch(h), d = !0);
1570
- }), d;
1571
- }
1572
- function Ar(e) {
1573
- const { editor: t, rules: n } = e, r = new $({
1574
- state: {
1575
- init() {
1576
- return null;
1577
- },
1578
- apply(s, o, i) {
1579
- const a = s.getMeta(r);
1580
- if (a)
1581
- return a;
1582
- const c = s.getMeta("applyInputRules");
1583
- return !!c && setTimeout(() => {
1584
- let { text: d } = c;
1585
- typeof d == "string" ? d = d : d = kt(D.from(d), i.schema);
1586
- const { from: u } = c, p = u + d.length;
1587
- J({
1588
- editor: t,
1589
- from: u,
1590
- to: p,
1591
- text: d,
1592
- rules: n,
1593
- plugin: r
1594
- });
1595
- }), s.selectionSet || s.docChanged ? null : o;
1596
- }
1597
- },
1598
- props: {
1599
- handleTextInput(s, o, i, a) {
1600
- return J({
1601
- editor: t,
1602
- from: o,
1603
- to: i,
1604
- text: a,
1605
- rules: n,
1606
- plugin: r
1607
- });
1608
- },
1609
- handleDOMEvents: {
1610
- compositionend: (s) => (setTimeout(() => {
1611
- const { $cursor: o } = s.state.selection;
1612
- o && J({
1613
- editor: t,
1614
- from: o.pos,
1615
- to: o.pos,
1616
- text: "",
1617
- rules: n,
1618
- plugin: r
1619
- });
1620
- }), !1)
1621
- },
1622
- // add support for input rules to trigger on enter
1623
- // this is useful for example for code blocks
1624
- handleKeyDown(s, o) {
1625
- if (o.key !== "Enter")
1626
- return !1;
1627
- const { $cursor: i } = s.state.selection;
1628
- return i ? J({
1629
- editor: t,
1630
- from: i.pos,
1631
- to: i.pos,
1632
- text: `
1633
- `,
1634
- rules: n,
1635
- plugin: r
1636
- }) : !1;
1637
- }
1638
- },
1639
- // @ts-ignore
1640
- isInputRules: !0
1641
- });
1642
- return r;
1643
- }
1644
- function Cr(e) {
1645
- return Object.prototype.toString.call(e).slice(8, -1);
1646
- }
1647
- function X(e) {
1648
- return Cr(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1649
- }
1650
- function Gt(e, t) {
1651
- const n = { ...e };
1652
- return X(e) && X(t) && Object.keys(t).forEach((r) => {
1653
- X(t[r]) && X(e[r]) ? n[r] = Gt(e[r], t[r]) : n[r] = t[r];
1654
- }), n;
1655
- }
1656
- var xt = class {
1657
- constructor(e = {}) {
1658
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
1659
- name: this.name
1660
- }, this.config = {
1661
- ...this.config,
1662
- ...e
1663
- }, this.name = this.config.name;
1664
- }
1665
- get options() {
1666
- return {
1667
- ...x(
1668
- y(this, "addOptions", {
1669
- name: this.name
1670
- })
1671
- ) || {}
1672
- };
1673
- }
1674
- get storage() {
1675
- return {
1676
- ...x(
1677
- y(this, "addStorage", {
1678
- name: this.name,
1679
- options: this.options
1680
- })
1681
- ) || {}
1682
- };
1683
- }
1684
- configure(e = {}) {
1685
- const t = this.extend({
1686
- ...this.config,
1687
- addOptions: () => Gt(this.options, e)
1688
- });
1689
- return t.name = this.name, t.parent = this.parent, t;
1690
- }
1691
- extend(e = {}) {
1692
- const t = new this.constructor({ ...this.config, ...e });
1693
- return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
1694
- }
1695
- }, Pr = class te extends xt {
1696
- constructor() {
1697
- super(...arguments), this.type = "mark";
1698
- }
1699
- /**
1700
- * Create a new Mark instance
1701
- * @param config - Mark configuration object or a function that returns a configuration object
1702
- */
1703
- static create(t = {}) {
1704
- const n = typeof t == "function" ? t() : t;
1705
- return new te(n);
1706
- }
1707
- static handleExit({ editor: t, mark: n }) {
1708
- const { tr: r } = t.state, s = t.state.selection.$from;
1709
- if (s.pos === s.end()) {
1710
- const i = s.marks();
1711
- if (!!!i.find((l) => l?.type.name === n.name))
1712
- return !1;
1713
- const c = i.find((l) => l?.type.name === n.name);
1714
- return c && r.removeStoredMark(c), r.insertText(" ", s.pos), t.view.dispatch(r), !0;
1715
- }
1716
- return !1;
1717
- }
1718
- configure(t) {
1719
- return super.configure(t);
1720
- }
1721
- extend(t) {
1722
- const n = typeof t == "function" ? t() : t;
1723
- return super.extend(n);
1724
- }
1725
- };
1726
- function $r(e) {
1727
- return typeof e == "number";
1728
- }
1729
- var Nr = class {
1730
- constructor(e) {
1731
- this.find = e.find, this.handler = e.handler;
1732
- }
1733
- }, Rr = (e, t, n) => {
1734
- if (yt(t))
1735
- return [...e.matchAll(t)];
1736
- const r = t(e, n);
1737
- return r ? r.map((s) => {
1738
- const o = [s.text];
1739
- return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
1740
- }) : [];
1741
- };
1742
- function zr(e) {
1743
- const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: d } = new st({
1744
- editor: t,
1745
- state: n
1746
- }), u = [];
1747
- return n.doc.nodesBetween(r, s, (f, h) => {
1748
- var m, g, v, b, k;
1749
- if ((g = (m = f.type) == null ? void 0 : m.spec) != null && g.code || !(f.isText || f.isTextblock || f.isInline))
1750
- return;
1751
- const M = (k = (b = (v = f.content) == null ? void 0 : v.size) != null ? b : f.nodeSize) != null ? k : 0, w = Math.max(r, h), S = Math.min(s, h + M);
1752
- if (w >= S)
1753
- return;
1754
- const E = f.isText ? f.text || "" : f.textBetween(w - h, S - h, void 0, "");
1755
- Rr(E, o.find, i).forEach((C) => {
1756
- if (C.index === void 0)
1757
- return;
1758
- const _ = w + C.index + 1, lt = _ + C[0].length, K = {
1759
- from: n.tr.mapping.map(_),
1760
- to: n.tr.mapping.map(lt)
1761
- }, dt = o.handler({
1762
- state: n,
1763
- range: K,
1764
- match: C,
1765
- commands: c,
1766
- chain: l,
1767
- can: d,
1768
- pasteEvent: i,
1769
- dropEvent: a
1770
- });
1771
- u.push(dt);
1772
- });
1773
- }), u.every((f) => f !== null);
1774
- }
1775
- var Y = null, Ir = (e) => {
1776
- var t;
1777
- const n = new ClipboardEvent("paste", {
1778
- clipboardData: new DataTransfer()
1779
- });
1780
- return (t = n.clipboardData) == null || t.setData("text/html", e), n;
1781
- };
1782
- function Dr(e) {
1783
- const { editor: t, rules: n } = e;
1784
- let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
1785
- try {
1786
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1787
- } catch {
1788
- a = null;
1789
- }
1790
- const c = ({
1791
- state: d,
1792
- from: u,
1793
- to: p,
1794
- rule: f,
1795
- pasteEvt: h
1796
- }) => {
1797
- const m = d.tr, g = rt({
1798
- state: d,
1799
- transaction: m
1800
- });
1801
- if (!(!zr({
1802
- editor: t,
1803
- state: g,
1804
- from: Math.max(u - 1, 0),
1805
- to: p.b - 1,
1806
- rule: f,
1807
- pasteEvent: h,
1808
- dropEvent: a
1809
- }) || !m.steps.length)) {
1810
- try {
1811
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1812
- } catch {
1813
- a = null;
1814
- }
1815
- return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
1816
- }
1817
- };
1818
- return n.map((d) => new $({
1819
- // we register a global drag handler to track the current drag source element
1820
- view(u) {
1821
- const p = (h) => {
1822
- var m;
1823
- r = (m = u.dom.parentElement) != null && m.contains(h.target) ? u.dom.parentElement : null, r && (Y = t);
1824
- }, f = () => {
1825
- Y && (Y = null);
1826
- };
1827
- return window.addEventListener("dragstart", p), window.addEventListener("dragend", f), {
1828
- destroy() {
1829
- window.removeEventListener("dragstart", p), window.removeEventListener("dragend", f);
1830
- }
1831
- };
1832
- },
1833
- props: {
1834
- handleDOMEvents: {
1835
- drop: (u, p) => {
1836
- if (o = r === u.dom.parentElement, a = p, !o) {
1837
- const f = Y;
1838
- f?.isEditable && setTimeout(() => {
1839
- const h = f.state.selection;
1840
- h && f.commands.deleteRange({ from: h.from, to: h.to });
1841
- }, 10);
1842
- }
1843
- return !1;
1844
- },
1845
- paste: (u, p) => {
1846
- var f;
1847
- const h = (f = p.clipboardData) == null ? void 0 : f.getData("text/html");
1848
- return i = p, s = !!h?.includes("data-pm-slice"), !1;
1849
- }
1850
- }
1851
- },
1852
- appendTransaction: (u, p, f) => {
1853
- const h = u[0], m = h.getMeta("uiEvent") === "paste" && !s, g = h.getMeta("uiEvent") === "drop" && !o, v = h.getMeta("applyPasteRules"), b = !!v;
1854
- if (!m && !g && !b)
1855
- return;
1856
- if (b) {
1857
- let { text: w } = v;
1858
- typeof w == "string" ? w = w : w = kt(D.from(w), f.schema);
1859
- const { from: S } = v, E = S + w.length, A = Ir(w);
1860
- return c({
1861
- rule: d,
1862
- state: f,
1863
- from: S,
1864
- to: { b: E },
1865
- pasteEvt: A
1866
- });
1867
- }
1868
- const k = p.doc.content.findDiffStart(f.doc.content), M = p.doc.content.findDiffEnd(f.doc.content);
1869
- if (!(!$r(k) || !M || k === M.b))
1870
- return c({
1871
- rule: d,
1872
- state: f,
1873
- from: k,
1874
- to: M,
1875
- pasteEvt: i
1876
- });
1877
- }
1878
- }));
1879
- }
1880
- var ct = class {
1881
- constructor(e, t) {
1882
- this.splittableMarks = [], this.editor = t, this.baseExtensions = e, this.extensions = qt(e), this.schema = Kn(this.extensions, t), this.setupExtensions();
1883
- }
1884
- /**
1885
- * Get all commands from the extensions.
1886
- * @returns An object with all commands where the key is the command name and the value is the command function
1887
- */
1888
- get commands() {
1889
- return this.extensions.reduce((e, t) => {
1890
- const n = {
1891
- name: t.name,
1892
- options: t.options,
1893
- storage: this.editor.extensionStorage[t.name],
1894
- editor: this.editor,
1895
- type: H(t.name, this.schema)
1896
- }, r = y(t, "addCommands", n);
1897
- return r ? {
1898
- ...e,
1899
- ...r()
1900
- } : e;
1901
- }, {});
1902
- }
1903
- /**
1904
- * Get all registered Prosemirror plugins from the extensions.
1905
- * @returns An array of Prosemirror plugins
1906
- */
1907
- get plugins() {
1908
- const { editor: e } = this;
1909
- return V([...this.extensions].reverse()).flatMap((r) => {
1910
- const s = {
1911
- name: r.name,
1912
- options: r.options,
1913
- storage: this.editor.extensionStorage[r.name],
1914
- editor: e,
1915
- type: H(r.name, this.schema)
1916
- }, o = [], i = y(
1917
- r,
1918
- "addKeyboardShortcuts",
1919
- s
1920
- );
1921
- let a = {};
1922
- if (r.type === "mark" && y(r, "exitable", s) && (a.ArrowRight = () => Pr.handleExit({ editor: e, mark: r })), i) {
1923
- const p = Object.fromEntries(
1924
- Object.entries(i()).map(([f, h]) => [f, () => h({ editor: e })])
1925
- );
1926
- a = { ...a, ...p };
1927
- }
1928
- const c = qe(a);
1929
- o.push(c);
1930
- const l = y(r, "addInputRules", s);
1931
- if (zt(r, e.options.enableInputRules) && l) {
1932
- const p = l();
1933
- if (p && p.length) {
1934
- const f = Ar({
1935
- editor: e,
1936
- rules: p
1937
- }), h = Array.isArray(f) ? f : [f];
1938
- o.push(...h);
1939
- }
1940
- }
1941
- const d = y(r, "addPasteRules", s);
1942
- if (zt(r, e.options.enablePasteRules) && d) {
1943
- const p = d();
1944
- if (p && p.length) {
1945
- const f = Dr({ editor: e, rules: p });
1946
- o.push(...f);
1947
- }
1948
- }
1949
- const u = y(
1950
- r,
1951
- "addProseMirrorPlugins",
1952
- s
1953
- );
1954
- if (u) {
1955
- const p = u();
1956
- o.push(...p);
1957
- }
1958
- return o;
1959
- });
1960
- }
1961
- /**
1962
- * Get all attributes from the extensions.
1963
- * @returns An array of attributes
1964
- */
1965
- get attributes() {
1966
- return Kt(this.extensions);
1967
- }
1968
- /**
1969
- * Get all node views from the extensions.
1970
- * @returns An object with all node views where the key is the node name and the value is the node view function
1971
- */
1972
- get nodeViews() {
1973
- const { editor: e } = this, { nodeExtensions: t } = L(this.extensions);
1974
- return Object.fromEntries(
1975
- t.filter((n) => !!y(n, "addNodeView")).map((n) => {
1976
- const r = this.attributes.filter((c) => c.type === n.name), s = {
1977
- name: n.name,
1978
- options: n.options,
1979
- storage: this.editor.extensionStorage[n.name],
1980
- editor: e,
1981
- type: T(n.name, this.schema)
1982
- }, o = y(n, "addNodeView", s);
1983
- if (!o)
1984
- return [];
1985
- const i = o();
1986
- if (!i)
1987
- return [];
1988
- const a = (c, l, d, u, p) => {
1989
- const f = et(c, r);
1990
- return i({
1991
- // pass-through
1992
- node: c,
1993
- view: l,
1994
- getPos: d,
1995
- decorations: u,
1996
- innerDecorations: p,
1997
- // tiptap-specific
1998
- editor: e,
1999
- extension: n,
2000
- HTMLAttributes: f
2001
- });
2002
- };
2003
- return [n.name, a];
2004
- })
2005
- );
2006
- }
2007
- /**
2008
- * Get the composed dispatchTransaction function from all extensions.
2009
- * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
2010
- * @returns A composed dispatch function
2011
- */
2012
- dispatchTransaction(e) {
2013
- const { editor: t } = this;
2014
- return V([...this.extensions].reverse()).reduceRight((r, s) => {
2015
- const o = {
2016
- name: s.name,
2017
- options: s.options,
2018
- storage: this.editor.extensionStorage[s.name],
2019
- editor: t,
2020
- type: H(s.name, this.schema)
2021
- }, i = y(
2022
- s,
2023
- "dispatchTransaction",
2024
- o
2025
- );
2026
- return i ? (a) => {
2027
- i.call(o, { transaction: a, next: r });
2028
- } : r;
2029
- }, e);
2030
- }
2031
- /**
2032
- * Get the composed transformPastedHTML function from all extensions.
2033
- * @param baseTransform The base transform function (e.g. from the editor props)
2034
- * @returns A composed transform function that chains all extension transforms
2035
- */
2036
- transformPastedHTML(e) {
2037
- const { editor: t } = this;
2038
- return V([...this.extensions]).reduce(
2039
- (r, s) => {
2040
- const o = {
2041
- name: s.name,
2042
- options: s.options,
2043
- storage: this.editor.extensionStorage[s.name],
2044
- editor: t,
2045
- type: H(s.name, this.schema)
2046
- }, i = y(
2047
- s,
2048
- "transformPastedHTML",
2049
- o
2050
- );
2051
- return i ? (a, c) => {
2052
- const l = r(a, c);
2053
- return i.call(o, l);
2054
- } : r;
2055
- },
2056
- e || ((r) => r)
2057
- );
2058
- }
2059
- get markViews() {
2060
- const { editor: e } = this, { markExtensions: t } = L(this.extensions);
2061
- return Object.fromEntries(
2062
- t.filter((n) => !!y(n, "addMarkView")).map((n) => {
2063
- const r = this.attributes.filter((a) => a.type === n.name), s = {
2064
- name: n.name,
2065
- options: n.options,
2066
- storage: this.editor.extensionStorage[n.name],
2067
- editor: e,
2068
- type: z(n.name, this.schema)
2069
- }, o = y(n, "addMarkView", s);
2070
- if (!o)
2071
- return [];
2072
- const i = (a, c, l) => {
2073
- const d = et(a, r);
2074
- return o()({
2075
- // pass-through
2076
- mark: a,
2077
- view: c,
2078
- inline: l,
2079
- // tiptap-specific
2080
- editor: e,
2081
- extension: n,
2082
- HTMLAttributes: d,
2083
- updateAttributes: (u) => {
2084
- Xr(a, e, u);
2085
- }
2086
- });
2087
- };
2088
- return [n.name, i];
2089
- })
2090
- );
2091
- }
2092
- /**
2093
- * Go through all extensions, create extension storages & setup marks
2094
- * & bind editor event listener.
2095
- */
2096
- setupExtensions() {
2097
- const e = this.extensions;
2098
- this.editor.extensionStorage = Object.fromEntries(
2099
- e.map((t) => [t.name, t.storage])
2100
- ), e.forEach((t) => {
2101
- var n;
2102
- const r = {
2103
- name: t.name,
2104
- options: t.options,
2105
- storage: this.editor.extensionStorage[t.name],
2106
- editor: this.editor,
2107
- type: H(t.name, this.schema)
2108
- };
2109
- t.type === "mark" && ((n = x(y(t, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(t.name);
2110
- const s = y(t, "onBeforeCreate", r), o = y(t, "onCreate", r), i = y(t, "onUpdate", r), a = y(
2111
- t,
2112
- "onSelectionUpdate",
2113
- r
2114
- ), c = y(t, "onTransaction", r), l = y(t, "onFocus", r), d = y(t, "onBlur", r), u = y(t, "onDestroy", r);
2115
- s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), c && this.editor.on("transaction", c), l && this.editor.on("focus", l), d && this.editor.on("blur", d), u && this.editor.on("destroy", u);
2116
- });
2117
- }
2118
- };
2119
- ct.resolve = qt;
2120
- ct.sort = V;
2121
- ct.flatten = wt;
2122
- var Br = {};
2123
- vt(Br, {
2124
- ClipboardTextSerializer: () => ne,
2125
- Commands: () => re,
2126
- Delete: () => se,
2127
- Drop: () => oe,
2128
- Editable: () => ie,
2129
- FocusEvents: () => ce,
2130
- Keymap: () => le,
2131
- Paste: () => de,
2132
- Tabindex: () => ue,
2133
- TextDirection: () => fe,
2134
- focusEventsPluginKey: () => ae
2135
- });
2136
- var N = class ee extends xt {
2137
- constructor() {
2138
- super(...arguments), this.type = "extension";
2139
- }
2140
- /**
2141
- * Create a new Extension instance
2142
- * @param config - Extension configuration object or a function that returns a configuration object
2143
- */
2144
- static create(t = {}) {
2145
- const n = typeof t == "function" ? t() : t;
2146
- return new ee(n);
2147
- }
2148
- configure(t) {
2149
- return super.configure(t);
2150
- }
2151
- extend(t) {
2152
- const n = typeof t == "function" ? t() : t;
2153
- return super.extend(n);
2154
- }
2155
- }, ne = N.create({
2156
- name: "clipboardTextSerializer",
2157
- addOptions() {
2158
- return {
2159
- blockSeparator: void 0
2160
- };
2161
- },
2162
- addProseMirrorPlugins() {
2163
- return [
2164
- new $({
2165
- key: new B("clipboardTextSerializer"),
2166
- props: {
2167
- clipboardTextSerializer: () => {
2168
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((d) => d.$from.pos)), a = Math.max(...o.map((d) => d.$to.pos)), c = Xt(n);
2169
- return Jt(r, { from: i, to: a }, {
2170
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
2171
- textSerializers: c
2172
- });
2173
- }
2174
- }
2175
- })
2176
- ];
2177
- }
2178
- }), re = N.create({
2179
- name: "commands",
2180
- addCommands() {
2181
- return {
2182
- ...Ot
2183
- };
2184
- }
2185
- }), se = N.create({
2186
- name: "delete",
2187
- onUpdate({ transaction: e, appendedTransactions: t }) {
2188
- var n, r, s;
2189
- const o = () => {
2190
- var i, a, c, l;
2191
- if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, e)) != null ? l : e.getMeta("y-sync$"))
2192
- return;
2193
- const d = Ln(e.before, [e, ...t]);
2194
- Gn(d).forEach((f) => {
2195
- d.mapping.mapResult(f.oldRange.from).deletedAfter && d.mapping.mapResult(f.oldRange.to).deletedBefore && d.before.nodesBetween(f.oldRange.from, f.oldRange.to, (h, m) => {
2196
- const g = m + h.nodeSize - 2, v = f.oldRange.from <= m && g <= f.oldRange.to;
2197
- this.editor.emit("delete", {
2198
- type: "node",
2199
- node: h,
2200
- from: m,
2201
- to: g,
2202
- newFrom: d.mapping.map(m),
2203
- newTo: d.mapping.map(g),
2204
- deletedRange: f.oldRange,
2205
- newRange: f.newRange,
2206
- partial: !v,
2207
- editor: this.editor,
2208
- transaction: e,
2209
- combinedTransform: d
2210
- });
2211
- });
2212
- });
2213
- const p = d.mapping;
2214
- d.steps.forEach((f, h) => {
2215
- var m, g;
2216
- if (f instanceof ge) {
2217
- const v = p.slice(h).map(f.from, -1), b = p.slice(h).map(f.to), k = p.invert().map(v, -1), M = p.invert().map(b), w = (m = d.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((E) => E.eq(f.mark)), S = (g = d.doc.nodeAt(b)) == null ? void 0 : g.marks.some((E) => E.eq(f.mark));
2218
- this.editor.emit("delete", {
2219
- type: "mark",
2220
- mark: f.mark,
2221
- from: f.from,
2222
- to: f.to,
2223
- deletedRange: {
2224
- from: k,
2225
- to: M
2226
- },
2227
- newRange: {
2228
- from: v,
2229
- to: b
2230
- },
2231
- partial: !!(S || w),
2232
- editor: this.editor,
2233
- transaction: e,
2234
- combinedTransform: d
2235
- });
2236
- }
2237
- });
2238
- };
2239
- (s = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || s ? setTimeout(o, 0) : o();
2240
- }
2241
- }), oe = N.create({
2242
- name: "drop",
2243
- addProseMirrorPlugins() {
2244
- return [
2245
- new $({
2246
- key: new B("tiptapDrop"),
2247
- props: {
2248
- handleDrop: (e, t, n, r) => {
2249
- this.editor.emit("drop", {
2250
- editor: this.editor,
2251
- event: t,
2252
- slice: n,
2253
- moved: r
2254
- });
2255
- }
2256
- }
2257
- })
2258
- ];
2259
- }
2260
- }), ie = N.create({
2261
- name: "editable",
2262
- addProseMirrorPlugins() {
2263
- return [
2264
- new $({
2265
- key: new B("editable"),
2266
- props: {
2267
- editable: () => this.editor.options.editable
2268
- }
2269
- })
2270
- ];
2271
- }
2272
- }), ae = new B("focusEvents"), ce = N.create({
2273
- name: "focusEvents",
2274
- addProseMirrorPlugins() {
2275
- const { editor: e } = this;
2276
- return [
2277
- new $({
2278
- key: ae,
2279
- props: {
2280
- handleDOMEvents: {
2281
- focus: (t, n) => {
2282
- e.isFocused = !0;
2283
- const r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2284
- return t.dispatch(r), !1;
2285
- },
2286
- blur: (t, n) => {
2287
- e.isFocused = !1;
2288
- const r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2289
- return t.dispatch(r), !1;
2290
- }
2291
- }
2292
- }
2293
- })
2294
- ];
2295
- }
2296
- }), le = N.create({
2297
- name: "keymap",
2298
- addKeyboardShortcuts() {
2299
- const e = () => this.editor.commands.first(({ commands: i }) => [
2300
- () => i.undoInputRule(),
2301
- // maybe convert first text block node to default node
2302
- () => i.command(({ tr: a }) => {
2303
- const { selection: c, doc: l } = a, { empty: d, $anchor: u } = c, { pos: p, parent: f } = u, h = u.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : u, m = h.parent.type.spec.isolating, g = u.pos - u.parentOffset, v = m && h.parent.childCount === 1 ? g === u.pos : j.atStart(l).from === p;
2304
- return !d || !f.type.isTextblock || f.textContent.length || !v || v && u.parent.type.name === "paragraph" ? !1 : i.clearNodes();
2305
- }),
2306
- () => i.deleteSelection(),
2307
- () => i.joinBackward(),
2308
- () => i.selectNodeBackward()
2309
- ]), t = () => this.editor.commands.first(({ commands: i }) => [
2310
- () => i.deleteSelection(),
2311
- () => i.deleteCurrentNode(),
2312
- () => i.joinForward(),
2313
- () => i.selectNodeForward()
2314
- ]), r = {
2315
- Enter: () => this.editor.commands.first(({ commands: i }) => [
2316
- () => i.newlineInCode(),
2317
- () => i.createParagraphNear(),
2318
- () => i.liftEmptyBlock(),
2319
- () => i.splitBlock()
2320
- ]),
2321
- "Mod-Enter": () => this.editor.commands.exitCode(),
2322
- Backspace: e,
2323
- "Mod-Backspace": e,
2324
- "Shift-Backspace": e,
2325
- Delete: t,
2326
- "Mod-Delete": t,
2327
- "Mod-a": () => this.editor.commands.selectAll()
2328
- }, s = {
2329
- ...r
2330
- }, o = {
2331
- ...r,
2332
- "Ctrl-h": e,
2333
- "Alt-Backspace": e,
2334
- "Ctrl-d": t,
2335
- "Ctrl-Alt-Backspace": t,
2336
- "Alt-Delete": t,
2337
- "Alt-d": t,
2338
- "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2339
- "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2340
- };
2341
- return tt() || Vt() ? o : s;
2342
- },
2343
- addProseMirrorPlugins() {
2344
- return [
2345
- // With this plugin we check if the whole document was selected and deleted.
2346
- // In this case we will additionally call `clearNodes()` to convert e.g. a heading
2347
- // to a paragraph if necessary.
2348
- // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
2349
- // with many other commands.
2350
- new $({
2351
- key: new B("clearDocument"),
2352
- appendTransaction: (e, t, n) => {
2353
- if (e.some((m) => m.getMeta("composition")))
2354
- return;
2355
- const r = e.some((m) => m.docChanged) && !t.doc.eq(n.doc), s = e.some((m) => m.getMeta("preventClearDocument"));
2356
- if (!r || s)
2357
- return;
2358
- const { empty: o, from: i, to: a } = t.selection, c = j.atStart(t.doc).from, l = j.atEnd(t.doc).to;
2359
- if (o || !(i === c && a === l) || !Mt(n.doc))
2360
- return;
2361
- const p = n.tr, f = rt({
2362
- state: n,
2363
- transaction: p
2364
- }), { commands: h } = new st({
2365
- editor: this.editor,
2366
- state: f
2367
- });
2368
- if (h.clearNodes(), !!p.steps.length)
2369
- return p;
2370
- }
2371
- })
2372
- ];
2373
- }
2374
- }), de = N.create({
2375
- name: "paste",
2376
- addProseMirrorPlugins() {
2377
- return [
2378
- new $({
2379
- key: new B("tiptapPaste"),
2380
- props: {
2381
- handlePaste: (e, t, n) => {
2382
- this.editor.emit("paste", {
2383
- editor: this.editor,
2384
- event: t,
2385
- slice: n
2386
- });
2387
- }
2388
- }
2389
- })
2390
- ];
2391
- }
2392
- }), ue = N.create({
2393
- name: "tabindex",
2394
- addProseMirrorPlugins() {
2395
- return [
2396
- new $({
2397
- key: new B("tabindex"),
2398
- props: {
2399
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
2400
- }
2401
- })
2402
- ];
2403
- }
2404
- }), fe = N.create({
2405
- name: "textDirection",
2406
- addOptions() {
2407
- return {
2408
- direction: void 0
2409
- };
2410
- },
2411
- addGlobalAttributes() {
2412
- if (!this.options.direction)
2413
- return [];
2414
- const { nodeExtensions: e } = L(this.extensions);
2415
- return [
2416
- {
2417
- types: e.filter((t) => t.name !== "text").map((t) => t.name),
2418
- attributes: {
2419
- dir: {
2420
- default: this.options.direction,
2421
- parseHTML: (t) => {
2422
- const n = t.getAttribute("dir");
2423
- return n && (n === "ltr" || n === "rtl" || n === "auto") ? n : this.options.direction;
2424
- },
2425
- renderHTML: (t) => t.dir ? {
2426
- dir: t.dir
2427
- } : {}
2428
- }
2429
- }
2430
- }
2431
- ];
2432
- },
2433
- addProseMirrorPlugins() {
2434
- return [
2435
- new $({
2436
- key: new B("textDirection"),
2437
- props: {
2438
- attributes: () => {
2439
- const e = this.options.direction;
2440
- return e ? {
2441
- dir: e
2442
- } : {};
2443
- }
2444
- }
2445
- })
2446
- ];
2447
- }
2448
- }), _r = class F {
2449
- constructor(t, n, r = !1, s = null) {
2450
- this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = n, this.currentNode = s;
2451
- }
2452
- get name() {
2453
- return this.node.type.name;
2454
- }
2455
- get node() {
2456
- return this.currentNode || this.resolvedPos.node();
2457
- }
2458
- get element() {
2459
- return this.editor.view.domAtPos(this.pos).node;
2460
- }
2461
- get depth() {
2462
- var t;
2463
- return (t = this.actualDepth) != null ? t : this.resolvedPos.depth;
2464
- }
2465
- get pos() {
2466
- return this.resolvedPos.pos;
2467
- }
2468
- get content() {
2469
- return this.node.content;
2470
- }
2471
- set content(t) {
2472
- let n = this.from, r = this.to;
2473
- if (this.isBlock) {
2474
- if (this.content.size === 0) {
2475
- console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
2476
- return;
2477
- }
2478
- n = this.from + 1, r = this.to - 1;
2479
- }
2480
- this.editor.commands.insertContentAt({ from: n, to: r }, t);
2481
- }
2482
- get attributes() {
2483
- return this.node.attrs;
2484
- }
2485
- get textContent() {
2486
- return this.node.textContent;
2487
- }
2488
- get size() {
2489
- return this.node.nodeSize;
2490
- }
2491
- get from() {
2492
- return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
2493
- }
2494
- get range() {
2495
- return {
2496
- from: this.from,
2497
- to: this.to
2498
- };
2499
- }
2500
- get to() {
2501
- return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
2502
- }
2503
- get parent() {
2504
- if (this.depth === 0)
2505
- return null;
2506
- const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2507
- return new F(n, this.editor);
2508
- }
2509
- get before() {
2510
- let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2511
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new F(t, this.editor);
2512
- }
2513
- get after() {
2514
- let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2515
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new F(t, this.editor);
2516
- }
2517
- get children() {
2518
- const t = [];
2519
- return this.node.content.forEach((n, r) => {
2520
- const s = n.isBlock && !n.isTextblock, o = n.isAtom && !n.isText, i = n.isInline, a = this.pos + r + (o ? 0 : 1);
2521
- if (a < 0 || a > this.resolvedPos.doc.nodeSize - 2)
2522
- return;
2523
- const c = this.resolvedPos.doc.resolve(a);
2524
- if (!s && !i && c.depth <= this.depth)
2525
- return;
2526
- const l = new F(c, this.editor, s, s || i ? n : null);
2527
- s && (l.actualDepth = this.depth + 1), t.push(l);
2528
- }), t;
2529
- }
2530
- get firstChild() {
2531
- return this.children[0] || null;
2532
- }
2533
- get lastChild() {
2534
- const t = this.children;
2535
- return t[t.length - 1] || null;
2536
- }
2537
- closest(t, n = {}) {
2538
- let r = null, s = this.parent;
2539
- for (; s && !r; ) {
2540
- if (s.node.type.name === t)
2541
- if (Object.keys(n).length > 0) {
2542
- const o = s.node.attrs, i = Object.keys(n);
2543
- for (let a = 0; a < i.length; a += 1) {
2544
- const c = i[a];
2545
- if (o[c] !== n[c])
2546
- break;
2547
- }
2548
- } else
2549
- r = s;
2550
- s = s.parent;
2551
- }
2552
- return r;
2553
- }
2554
- querySelector(t, n = {}) {
2555
- return this.querySelectorAll(t, n, !0)[0] || null;
2556
- }
2557
- querySelectorAll(t, n = {}, r = !1) {
2558
- let s = [];
2559
- if (!this.children || this.children.length === 0)
2560
- return s;
2561
- const o = Object.keys(n);
2562
- return this.children.forEach((i) => {
2563
- r && s.length > 0 || (i.node.type.name === t && o.every((c) => n[c] === i.node.attrs[c]) && s.push(i), !(r && s.length > 0) && (s = s.concat(i.querySelectorAll(t, n, r))));
2564
- }), s;
2565
- }
2566
- setAttribute(t) {
2567
- const { tr: n } = this.editor.state;
2568
- n.setNodeMarkup(this.from, void 0, {
2569
- ...this.node.attrs,
2570
- ...t
2571
- }), this.editor.view.dispatch(n);
2572
- }
2573
- }, Or = `.ProseMirror {
2574
- position: relative;
2575
- }
2576
-
2577
- .ProseMirror {
2578
- word-wrap: break-word;
2579
- white-space: pre-wrap;
2580
- white-space: break-spaces;
2581
- -webkit-font-variant-ligatures: none;
2582
- font-variant-ligatures: none;
2583
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
2584
- }
2585
-
2586
- .ProseMirror [contenteditable="false"] {
2587
- white-space: normal;
2588
- }
2589
-
2590
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
2591
- white-space: pre-wrap;
2592
- }
2593
-
2594
- .ProseMirror pre {
2595
- white-space: pre-wrap;
2596
- }
2597
-
2598
- img.ProseMirror-separator {
2599
- display: inline !important;
2600
- border: none !important;
2601
- margin: 0 !important;
2602
- width: 0 !important;
2603
- height: 0 !important;
2604
- }
2605
-
2606
- .ProseMirror-gapcursor {
2607
- display: none;
2608
- pointer-events: none;
2609
- position: absolute;
2610
- margin: 0;
2611
- }
2612
-
2613
- .ProseMirror-gapcursor:after {
2614
- content: "";
2615
- display: block;
2616
- position: absolute;
2617
- top: -2px;
2618
- width: 20px;
2619
- border-top: 1px solid black;
2620
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
2621
- }
2622
-
2623
- @keyframes ProseMirror-cursor-blink {
2624
- to {
2625
- visibility: hidden;
2626
- }
2627
- }
2628
-
2629
- .ProseMirror-hideselection *::selection {
2630
- background: transparent;
2631
- }
2632
-
2633
- .ProseMirror-hideselection *::-moz-selection {
2634
- background: transparent;
2635
- }
2636
-
2637
- .ProseMirror-hideselection * {
2638
- caret-color: transparent;
2639
- }
2640
-
2641
- .ProseMirror-focused .ProseMirror-gapcursor {
2642
- display: block;
2643
- }`;
2644
- function jr(e, t, n) {
2645
- const r = document.querySelector("style[data-tiptap-style]");
2646
- if (r !== null)
2647
- return r;
2648
- const s = document.createElement("style");
2649
- return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
2650
- }
2651
- var cs = class extends Er {
2652
- constructor(t = {}) {
2653
- super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2654
- element: typeof document < "u" ? document.createElement("div") : null,
2655
- content: "",
2656
- injectCSS: !0,
2657
- injectNonce: void 0,
2658
- extensions: [],
2659
- autofocus: !1,
2660
- editable: !0,
2661
- textDirection: void 0,
2662
- editorProps: {},
2663
- parseOptions: {},
2664
- coreExtensionOptions: {},
2665
- enableInputRules: !0,
2666
- enablePasteRules: !0,
2667
- enableCoreExtensions: !0,
2668
- enableContentCheck: !1,
2669
- emitContentError: !1,
2670
- onBeforeCreate: () => null,
2671
- onCreate: () => null,
2672
- onMount: () => null,
2673
- onUnmount: () => null,
2674
- onUpdate: () => null,
2675
- onSelectionUpdate: () => null,
2676
- onTransaction: () => null,
2677
- onFocus: () => null,
2678
- onBlur: () => null,
2679
- onDestroy: () => null,
2680
- onContentError: ({ error: s }) => {
2681
- throw s;
2682
- },
2683
- onPaste: () => null,
2684
- onDrop: () => null,
2685
- onDelete: () => null,
2686
- enableExtensionDispatchTransaction: !0
2687
- }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2688
- getUpdatedPosition: nr,
2689
- createMappablePosition: rr
2690
- }, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: s, slice: o, moved: i }) => this.options.onDrop(s, o, i)), this.on("paste", ({ event: s, slice: o }) => this.options.onPaste(s, o)), this.on("delete", this.options.onDelete);
2691
- const n = this.createDoc(), r = Ht(n, this.options.autofocus);
2692
- this.editorState = Oe.create({
2693
- doc: n,
2694
- schema: this.schema,
2695
- selection: r || void 0
2696
- }), this.options.element && this.mount(this.options.element);
2697
- }
2698
- /**
2699
- * Attach the editor to the DOM, creating a new editor view.
2700
- */
2701
- mount(t) {
2702
- if (typeof document > "u")
2703
- throw new Error(
2704
- "[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment."
2705
- );
2706
- this.createView(t), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2707
- this.isDestroyed || (this.options.autofocus !== !1 && this.options.autofocus !== null && this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2708
- }, 0);
2709
- }
2710
- /**
2711
- * Remove the editor from the DOM, but still allow remounting at a different point in time
2712
- */
2713
- unmount() {
2714
- if (this.editorView) {
2715
- const t = this.editorView.dom;
2716
- t?.editor && delete t.editor, this.editorView.destroy();
2717
- }
2718
- if (this.editorView = null, this.isInitialized = !1, this.css && !document.querySelectorAll(`.${this.className}`).length)
2719
- try {
2720
- typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
2721
- } catch (t) {
2722
- console.warn("Failed to remove CSS element:", t);
2723
- }
2724
- this.css = null, this.emit("unmount", { editor: this });
2725
- }
2726
- /**
2727
- * Returns the editor storage.
2728
- */
2729
- get storage() {
2730
- return this.extensionStorage;
2731
- }
2732
- /**
2733
- * An object of all registered commands.
2734
- */
2735
- get commands() {
2736
- return this.commandManager.commands;
2737
- }
2738
- /**
2739
- * Create a command chain to call multiple commands at once.
2740
- */
2741
- chain() {
2742
- return this.commandManager.chain();
2743
- }
2744
- /**
2745
- * Check if a command or a command chain can be executed. Without executing it.
2746
- */
2747
- can() {
2748
- return this.commandManager.can();
2749
- }
2750
- /**
2751
- * Inject CSS styles.
2752
- */
2753
- injectCSS() {
2754
- this.options.injectCSS && typeof document < "u" && (this.css = jr(Or, this.options.injectNonce));
2755
- }
2756
- /**
2757
- * Update editor options.
2758
- *
2759
- * @param options A list of options
2760
- */
2761
- setOptions(t = {}) {
2762
- this.options = {
2763
- ...this.options,
2764
- ...t
2765
- }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
2766
- }
2767
- /**
2768
- * Update editable state of the editor.
2769
- */
2770
- setEditable(t, n = !0) {
2771
- this.setOptions({ editable: t }), n && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2772
- }
2773
- /**
2774
- * Returns whether the editor is editable.
2775
- */
2776
- get isEditable() {
2777
- return this.options.editable && this.view && this.view.editable;
2778
- }
2779
- /**
2780
- * Returns the editor view.
2781
- */
2782
- get view() {
2783
- return this.editorView ? this.editorView : new Proxy(
2784
- {
2785
- state: this.editorState,
2786
- updateState: (t) => {
2787
- this.editorState = t;
2788
- },
2789
- dispatch: (t) => {
2790
- this.dispatchTransaction(t);
2791
- },
2792
- // Stub some commonly accessed properties to prevent errors
2793
- composing: !1,
2794
- dragging: null,
2795
- editable: !0,
2796
- isDestroyed: !1
2797
- },
2798
- {
2799
- get: (t, n) => {
2800
- if (this.editorView)
2801
- return this.editorView[n];
2802
- if (n === "state")
2803
- return this.editorState;
2804
- if (n in t)
2805
- return Reflect.get(t, n);
2806
- throw new Error(
2807
- `[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`
2808
- );
2809
- }
2810
- }
2811
- );
2812
- }
2813
- /**
2814
- * Returns the editor state.
2815
- */
2816
- get state() {
2817
- return this.editorView && (this.editorState = this.view.state), this.editorState;
2818
- }
2819
- /**
2820
- * Register a ProseMirror plugin.
2821
- *
2822
- * @param plugin A ProseMirror plugin
2823
- * @param handlePlugins Control how to merge the plugin into the existing plugins.
2824
- * @returns The new editor state
2825
- */
2826
- registerPlugin(t, n) {
2827
- const r = Ut(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2828
- return this.view.updateState(s), s;
2829
- }
2830
- /**
2831
- * Unregister a ProseMirror plugin.
2832
- *
2833
- * @param nameOrPluginKeyToRemove The plugins name
2834
- * @returns The new editor state or undefined if the editor is destroyed
2835
- */
2836
- unregisterPlugin(t) {
2837
- if (this.isDestroyed)
2838
- return;
2839
- const n = this.state.plugins;
2840
- let r = n;
2841
- if ([].concat(t).forEach((o) => {
2842
- const i = typeof o == "string" ? `${o}$` : o.key;
2843
- r = r.filter((a) => !a.key.startsWith(i));
2844
- }), n.length === r.length)
2845
- return;
2846
- const s = this.state.reconfigure({
2847
- plugins: r
2848
- });
2849
- return this.view.updateState(s), s;
2850
- }
2851
- /**
2852
- * Creates an extension manager.
2853
- */
2854
- createExtensionManager() {
2855
- var t, n;
2856
- const s = [...this.options.enableCoreExtensions ? [
2857
- ie,
2858
- ne.configure({
2859
- blockSeparator: (n = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : n.blockSeparator
2860
- }),
2861
- re,
2862
- ce,
2863
- le,
2864
- ue,
2865
- oe,
2866
- de,
2867
- se,
2868
- fe.configure({
2869
- direction: this.options.textDirection
2870
- })
2871
- ].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o?.type));
2872
- this.extensionManager = new ct(s, this);
2873
- }
2874
- /**
2875
- * Creates an command manager.
2876
- */
2877
- createCommandManager() {
2878
- this.commandManager = new st({
2879
- editor: this
2880
- });
2881
- }
2882
- /**
2883
- * Creates a ProseMirror schema.
2884
- */
2885
- createSchema() {
2886
- this.schema = this.extensionManager.schema;
2887
- }
2888
- /**
2889
- * Creates the initial document.
2890
- */
2891
- createDoc() {
2892
- let t;
2893
- try {
2894
- t = ht(this.options.content, this.schema, this.options.parseOptions, {
2895
- errorOnInvalidContent: this.options.enableContentCheck
2896
- });
2897
- } catch (n) {
2898
- if (!(n instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(n.message))
2899
- throw n;
2900
- this.emit("contentError", {
2901
- editor: this,
2902
- error: n,
2903
- disableCollaboration: () => {
2904
- "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((r) => r.name !== "collaboration"), this.createExtensionManager();
2905
- }
2906
- }), t = ht(this.options.content, this.schema, this.options.parseOptions, {
2907
- errorOnInvalidContent: !1
2908
- });
2909
- }
2910
- return t;
2911
- }
2912
- /**
2913
- * Creates a ProseMirror view.
2914
- */
2915
- createView(t) {
2916
- const { editorProps: n, enableExtensionDispatchTransaction: r } = this.options, s = n.dispatchTransaction || this.dispatchTransaction.bind(this), o = r ? this.extensionManager.dispatchTransaction(s) : s, i = n.transformPastedHTML, a = this.extensionManager.transformPastedHTML(i);
2917
- this.editorView = new Ke(t, {
2918
- ...n,
2919
- attributes: {
2920
- // add `role="textbox"` to the editor element
2921
- role: "textbox",
2922
- ...n?.attributes
2923
- },
2924
- dispatchTransaction: o,
2925
- transformPastedHTML: a,
2926
- state: this.editorState,
2927
- markViews: this.extensionManager.markViews,
2928
- nodeViews: this.extensionManager.nodeViews
2929
- });
2930
- const c = this.state.reconfigure({
2931
- plugins: this.extensionManager.plugins
2932
- });
2933
- this.view.updateState(c), this.prependClass(), this.injectCSS();
2934
- const l = this.view.dom;
2935
- l.editor = this;
2936
- }
2937
- /**
2938
- * Creates all node and mark views.
2939
- */
2940
- createNodeViews() {
2941
- this.view.isDestroyed || this.view.setProps({
2942
- markViews: this.extensionManager.markViews,
2943
- nodeViews: this.extensionManager.nodeViews
2944
- });
2945
- }
2946
- /**
2947
- * Prepend class name to element.
2948
- */
2949
- prependClass() {
2950
- this.view.dom.className = `${this.className} ${this.view.dom.className}`;
2951
- }
2952
- captureTransaction(t) {
2953
- this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
2954
- const n = this.capturedTransaction;
2955
- return this.capturedTransaction = null, n;
2956
- }
2957
- /**
2958
- * The callback over which to send transactions (state updates) produced by the view.
2959
- *
2960
- * @param transaction An editor state transaction
2961
- */
2962
- dispatchTransaction(t) {
2963
- if (this.view.isDestroyed)
2964
- return;
2965
- if (this.isCapturingTransaction) {
2966
- if (!this.capturedTransaction) {
2967
- this.capturedTransaction = t;
2968
- return;
2969
- }
2970
- t.steps.forEach((d) => {
2971
- var u;
2972
- return (u = this.capturedTransaction) == null ? void 0 : u.step(d);
2973
- });
2974
- return;
2975
- }
2976
- const { state: n, transactions: r } = this.state.applyTransaction(t), s = !this.state.selection.eq(n.selection), o = r.includes(t), i = this.state;
2977
- if (this.emit("beforeTransaction", {
2978
- editor: this,
2979
- transaction: t,
2980
- nextState: n
2981
- }), !o)
2982
- return;
2983
- this.view.updateState(n), this.emit("transaction", {
2984
- editor: this,
2985
- transaction: t,
2986
- appendedTransactions: r.slice(1)
2987
- }), s && this.emit("selectionUpdate", {
2988
- editor: this,
2989
- transaction: t
2990
- });
2991
- const a = r.findLast((d) => d.getMeta("focus") || d.getMeta("blur")), c = a?.getMeta("focus"), l = a?.getMeta("blur");
2992
- c && this.emit("focus", {
2993
- editor: this,
2994
- event: c.event,
2995
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2996
- transaction: a
2997
- }), l && this.emit("blur", {
2998
- editor: this,
2999
- event: l.event,
3000
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3001
- transaction: a
3002
- }), !(t.getMeta("preventUpdate") || !r.some((d) => d.docChanged) || i.doc.eq(n.doc)) && this.emit("update", {
3003
- editor: this,
3004
- transaction: t,
3005
- appendedTransactions: r.slice(1)
3006
- });
3007
- }
3008
- /**
3009
- * Get attributes of the currently selected node or mark.
3010
- */
3011
- getAttributes(t) {
3012
- return Yn(this.state, t);
3013
- }
3014
- isActive(t, n) {
3015
- const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
3016
- return er(this.state, r, s);
3017
- }
3018
- /**
3019
- * Get the document as JSON.
3020
- */
3021
- getJSON() {
3022
- return this.state.doc.toJSON();
3023
- }
3024
- /**
3025
- * Get the document as HTML.
3026
- */
3027
- getHTML() {
3028
- return kt(this.state.doc.content, this.schema);
3029
- }
3030
- /**
3031
- * Get the document as text.
3032
- */
3033
- getText(t) {
3034
- const { blockSeparator: n = `
3035
-
3036
- `, textSerializers: r = {} } = t || {};
3037
- return Jn(this.state.doc, {
3038
- blockSeparator: n,
3039
- textSerializers: {
3040
- ...Xt(this.schema),
3041
- ...r
3042
- }
3043
- });
3044
- }
3045
- /**
3046
- * Check if there is no content.
3047
- */
3048
- get isEmpty() {
3049
- return Mt(this.state.doc);
3050
- }
3051
- /**
3052
- * Destroy the editor.
3053
- */
3054
- destroy() {
3055
- this.emit("destroy"), this.unmount(), this.removeAllListeners();
3056
- }
3057
- /**
3058
- * Check if the editor is already destroyed.
3059
- */
3060
- get isDestroyed() {
3061
- var t, n;
3062
- return (n = (t = this.editorView) == null ? void 0 : t.isDestroyed) != null ? n : !0;
3063
- }
3064
- $node(t, n) {
3065
- var r;
3066
- return ((r = this.$doc) == null ? void 0 : r.querySelector(t, n)) || null;
3067
- }
3068
- $nodes(t, n) {
3069
- var r;
3070
- return ((r = this.$doc) == null ? void 0 : r.querySelectorAll(t, n)) || null;
3071
- }
3072
- $pos(t) {
3073
- const n = this.state.doc.resolve(t);
3074
- return new _r(n, this);
3075
- }
3076
- get $doc() {
3077
- return this.$pos(0);
3078
- }
3079
- };
3080
- function ds(e) {
3081
- return new at({
3082
- find: e.find,
3083
- handler: ({ state: t, range: n, match: r }) => {
3084
- const s = x(e.getAttributes, void 0, r);
3085
- if (s === !1 || s === null)
3086
- return null;
3087
- const { tr: o } = t, i = r[r.length - 1], a = r[0];
3088
- if (i) {
3089
- const c = a.search(/\S/), l = n.from + a.indexOf(i), d = l + i.length;
3090
- if (Yt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((m) => m === e.type && m !== f.mark.type)).filter((f) => f.to > l).length)
3091
- return null;
3092
- d < n.to && o.delete(d, n.to), l > n.from && o.delete(n.from + c, l);
3093
- const p = n.from + c + i.length;
3094
- o.addMark(n.from + c, p, e.type.create(s || {})), o.removeStoredMark(e.type);
3095
- }
3096
- },
3097
- undoable: e.undoable
3098
- });
3099
- }
3100
- function us(e) {
3101
- return new at({
3102
- find: e.find,
3103
- handler: ({ state: t, range: n, match: r }) => {
3104
- const s = x(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
3105
- let a = n.to;
3106
- const c = e.type.create(s);
3107
- if (r[1]) {
3108
- const l = r[0].lastIndexOf(r[1]);
3109
- let d = i + l;
3110
- d > a ? d = a : a = d + r[1].length;
3111
- const u = r[0][r[0].length - 1];
3112
- o.insertText(u, i + r[0].length - 1), o.replaceWith(d, a, c);
3113
- } else if (r[0]) {
3114
- const l = e.type.isInline ? i : i - 1;
3115
- o.insert(l, e.type.create(s)).delete(o.mapping.map(i), o.mapping.map(a));
3116
- }
3117
- o.scrollIntoView();
3118
- },
3119
- undoable: e.undoable
3120
- });
3121
- }
3122
- function fs(e) {
3123
- return new at({
3124
- find: e.find,
3125
- handler: ({ state: t, range: n, match: r }) => {
3126
- const s = t.doc.resolve(n.from), o = x(e.getAttributes, void 0, r) || {};
3127
- if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), e.type))
3128
- return null;
3129
- t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, o);
3130
- },
3131
- undoable: e.undoable
3132
- });
3133
- }
3134
- function ps(e) {
3135
- return new at({
3136
- find: e.find,
3137
- handler: ({ state: t, range: n, match: r, chain: s }) => {
3138
- const o = x(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && he(c, e.type, o);
3139
- if (!l)
3140
- return null;
3141
- if (i.wrap(c, l), e.keepMarks && e.editor) {
3142
- const { selection: u, storedMarks: p } = t, { splittableMarks: f } = e.editor.extensionManager, h = p || u.$to.parentOffset && u.$from.marks();
3143
- if (h) {
3144
- const m = h.filter((g) => f.includes(g.type.name));
3145
- i.ensureMarks(m);
3146
- }
3147
- }
3148
- if (e.keepAttributes) {
3149
- const u = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3150
- s().updateAttributes(u, o).run();
3151
- }
3152
- const d = i.doc.resolve(n.from - 1).nodeBefore;
3153
- d && d.type === e.type && gt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, d)) && i.join(n.from - 1);
3154
- },
3155
- undoable: e.undoable
3156
- });
3157
- }
3158
- var Lr = (e) => "touches" in e, hs = class {
3159
- /**
3160
- * Creates a new ResizableNodeView instance.
3161
- *
3162
- * The constructor sets up the resize handles, applies initial sizing from
3163
- * node attributes, and configures all resize behavior options.
3164
- *
3165
- * @param options - Configuration options for the resizable node view
3166
- */
3167
- constructor(e) {
3168
- this.directions = ["bottom-left", "bottom-right", "top-left", "top-right"], this.minSize = {
3169
- height: 8,
3170
- width: 8
3171
- }, this.preserveAspectRatio = !1, this.classNames = {
3172
- container: "",
3173
- wrapper: "",
3174
- handle: "",
3175
- resizing: ""
3176
- }, this.initialWidth = 0, this.initialHeight = 0, this.aspectRatio = 1, this.isResizing = !1, this.activeHandle = null, this.startX = 0, this.startY = 0, this.startWidth = 0, this.startHeight = 0, this.isShiftKeyPressed = !1, this.lastEditableState = void 0, this.handleMap = /* @__PURE__ */ new Map(), this.handleMouseMove = (a) => {
3177
- if (!this.isResizing || !this.activeHandle)
3178
- return;
3179
- const c = a.clientX - this.startX, l = a.clientY - this.startY;
3180
- this.handleResize(c, l);
3181
- }, this.handleTouchMove = (a) => {
3182
- if (!this.isResizing || !this.activeHandle)
3183
- return;
3184
- const c = a.touches[0];
3185
- if (!c)
3186
- return;
3187
- const l = c.clientX - this.startX, d = c.clientY - this.startY;
3188
- this.handleResize(l, d);
3189
- }, this.handleMouseUp = () => {
3190
- if (!this.isResizing)
3191
- return;
3192
- const a = this.element.offsetWidth, c = this.element.offsetHeight;
3193
- this.onCommit(a, c), this.isResizing = !1, this.activeHandle = null, this.container.dataset.resizeState = "false", this.classNames.resizing && this.container.classList.remove(this.classNames.resizing), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp);
3194
- }, this.handleKeyDown = (a) => {
3195
- a.key === "Shift" && (this.isShiftKeyPressed = !0);
3196
- }, this.handleKeyUp = (a) => {
3197
- a.key === "Shift" && (this.isShiftKeyPressed = !1);
3198
- };
3199
- var t, n, r, s, o, i;
3200
- this.node = e.node, this.editor = e.editor, this.element = e.element, this.contentElement = e.contentElement, this.getPos = e.getPos, this.onResize = e.onResize, this.onCommit = e.onCommit, this.onUpdate = e.onUpdate, (t = e.options) != null && t.min && (this.minSize = {
3201
- ...this.minSize,
3202
- ...e.options.min
3203
- }), (n = e.options) != null && n.max && (this.maxSize = e.options.max), (r = e?.options) != null && r.directions && (this.directions = e.options.directions), (s = e.options) != null && s.preserveAspectRatio && (this.preserveAspectRatio = e.options.preserveAspectRatio), (o = e.options) != null && o.className && (this.classNames = {
3204
- container: e.options.className.container || "",
3205
- wrapper: e.options.className.wrapper || "",
3206
- handle: e.options.className.handle || "",
3207
- resizing: e.options.className.resizing || ""
3208
- }), (i = e.options) != null && i.createCustomHandle && (this.createCustomHandle = e.options.createCustomHandle), this.wrapper = this.createWrapper(), this.container = this.createContainer(), this.applyInitialSize(), this.attachHandles(), this.editor.on("update", this.handleEditorUpdate.bind(this));
3209
- }
3210
- /**
3211
- * Returns the top-level DOM node that should be placed in the editor.
3212
- *
3213
- * This is required by the ProseMirror NodeView interface. The container
3214
- * includes the wrapper, handles, and the actual content element.
3215
- *
3216
- * @returns The container element to be inserted into the editor
3217
- */
3218
- get dom() {
3219
- return this.container;
3220
- }
3221
- get contentDOM() {
3222
- var e;
3223
- return (e = this.contentElement) != null ? e : null;
3224
- }
3225
- handleEditorUpdate() {
3226
- const e = this.editor.isEditable;
3227
- e !== this.lastEditableState && (this.lastEditableState = e, e ? e && this.handleMap.size === 0 && this.attachHandles() : this.removeHandles());
3228
- }
3229
- /**
3230
- * Called when the node's content or attributes change.
3231
- *
3232
- * Updates the internal node reference. If a custom `onUpdate` callback
3233
- * was provided, it will be called to handle additional update logic.
3234
- *
3235
- * @param node - The new/updated node
3236
- * @param decorations - Node decorations
3237
- * @param innerDecorations - Inner decorations
3238
- * @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`
3239
- */
3240
- update(e, t, n) {
3241
- return e.type !== this.node.type ? !1 : (this.node = e, this.onUpdate ? this.onUpdate(e, t, n) : !0);
3242
- }
3243
- /**
3244
- * Cleanup method called when the node view is being removed.
3245
- *
3246
- * Removes all event listeners to prevent memory leaks. This is required
3247
- * by the ProseMirror NodeView interface. If a resize is active when
3248
- * destroy is called, it will be properly cancelled.
3249
- */
3250
- destroy() {
3251
- this.isResizing && (this.container.dataset.resizeState = "false", this.classNames.resizing && this.container.classList.remove(this.classNames.resizing), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp), this.isResizing = !1, this.activeHandle = null), this.editor.off("update", this.handleEditorUpdate.bind(this)), this.container.remove();
3252
- }
3253
- /**
3254
- * Creates the outer container element.
3255
- *
3256
- * The container is the top-level element returned by the NodeView and
3257
- * wraps the entire resizable node. It's set up with flexbox to handle
3258
- * alignment and includes data attributes for styling and identification.
3259
- *
3260
- * @returns The container element
3261
- */
3262
- createContainer() {
3263
- const e = document.createElement("div");
3264
- return e.dataset.resizeContainer = "", e.dataset.node = this.node.type.name, e.style.display = "flex", this.classNames.container && (e.className = this.classNames.container), e.appendChild(this.wrapper), e;
3265
- }
3266
- /**
3267
- * Creates the wrapper element that contains the content and handles.
3268
- *
3269
- * The wrapper uses relative positioning so that resize handles can be
3270
- * positioned absolutely within it. This is the direct parent of the
3271
- * content element being made resizable.
3272
- *
3273
- * @returns The wrapper element
3274
- */
3275
- createWrapper() {
3276
- const e = document.createElement("div");
3277
- return e.style.position = "relative", e.style.display = "block", e.dataset.resizeWrapper = "", this.classNames.wrapper && (e.className = this.classNames.wrapper), e.appendChild(this.element), e;
3278
- }
3279
- /**
3280
- * Creates a resize handle element for a specific direction.
3281
- *
3282
- * Each handle is absolutely positioned and includes a data attribute
3283
- * identifying its direction for styling purposes.
3284
- *
3285
- * @param direction - The resize direction for this handle
3286
- * @returns The handle element
3287
- */
3288
- createHandle(e) {
3289
- const t = document.createElement("div");
3290
- return t.dataset.resizeHandle = e, t.style.position = "absolute", this.classNames.handle && (t.className = this.classNames.handle), t;
3291
- }
3292
- /**
3293
- * Positions a handle element according to its direction.
3294
- *
3295
- * Corner handles (e.g., 'top-left') are positioned at the intersection
3296
- * of two edges. Edge handles (e.g., 'top') span the full width or height.
3297
- *
3298
- * @param handle - The handle element to position
3299
- * @param direction - The direction determining the position
3300
- */
3301
- positionHandle(e, t) {
3302
- const n = t.includes("top"), r = t.includes("bottom"), s = t.includes("left"), o = t.includes("right");
3303
- n && (e.style.top = "0"), r && (e.style.bottom = "0"), s && (e.style.left = "0"), o && (e.style.right = "0"), (t === "top" || t === "bottom") && (e.style.left = "0", e.style.right = "0"), (t === "left" || t === "right") && (e.style.top = "0", e.style.bottom = "0");
3304
- }
3305
- /**
3306
- * Creates and attaches all resize handles to the wrapper.
3307
- *
3308
- * Iterates through the configured directions, creates a handle for each,
3309
- * positions it, attaches the mousedown listener, and appends it to the DOM.
3310
- */
3311
- attachHandles() {
3312
- this.directions.forEach((e) => {
3313
- let t;
3314
- this.createCustomHandle ? t = this.createCustomHandle(e) : t = this.createHandle(e), t instanceof HTMLElement || (console.warn(
3315
- `[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`
3316
- ), t = this.createHandle(e)), this.createCustomHandle || this.positionHandle(t, e), t.addEventListener("mousedown", (n) => this.handleResizeStart(n, e)), t.addEventListener("touchstart", (n) => this.handleResizeStart(n, e)), this.handleMap.set(e, t), this.wrapper.appendChild(t);
3317
- });
3318
- }
3319
- /**
3320
- * Removes all resize handles from the wrapper.
3321
- *
3322
- * Cleans up the handle map and removes each handle element from the DOM.
3323
- */
3324
- removeHandles() {
3325
- this.handleMap.forEach((e) => e.remove()), this.handleMap.clear();
3326
- }
3327
- /**
3328
- * Applies initial sizing from node attributes to the element.
3329
- *
3330
- * If width/height attributes exist on the node, they're applied to the element.
3331
- * Otherwise, the element's natural/current dimensions are measured. The aspect
3332
- * ratio is calculated for later use in aspect-ratio-preserving resizes.
3333
- */
3334
- applyInitialSize() {
3335
- const e = this.node.attrs.width, t = this.node.attrs.height;
3336
- e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
3337
- }
3338
- /**
3339
- * Initiates a resize operation when a handle is clicked.
3340
- *
3341
- * Captures the starting mouse position and element dimensions, sets up
3342
- * the resize state, adds the resizing class and state attribute, and
3343
- * attaches document-level listeners for mouse movement and keyboard input.
3344
- *
3345
- * @param event - The mouse down event
3346
- * @param direction - The direction of the handle being dragged
3347
- */
3348
- handleResizeStart(e, t) {
3349
- e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, Lr(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3350
- }
3351
- handleResize(e, t) {
3352
- if (!this.activeHandle)
3353
- return;
3354
- const n = this.preserveAspectRatio || this.isShiftKeyPressed, { width: r, height: s } = this.calculateNewDimensions(this.activeHandle, e, t), o = this.applyConstraints(r, s, n);
3355
- this.element.style.width = `${o.width}px`, this.element.style.height = `${o.height}px`, this.onResize && this.onResize(o.width, o.height);
3356
- }
3357
- /**
3358
- * Calculates new dimensions based on mouse delta and resize direction.
3359
- *
3360
- * Takes the starting dimensions and applies the mouse movement delta
3361
- * according to the handle direction. For corner handles, both dimensions
3362
- * are affected. For edge handles, only one dimension changes. If aspect
3363
- * ratio should be preserved, delegates to applyAspectRatio.
3364
- *
3365
- * @param direction - The active resize handle direction
3366
- * @param deltaX - Horizontal mouse movement since resize start
3367
- * @param deltaY - Vertical mouse movement since resize start
3368
- * @returns The calculated width and height
3369
- */
3370
- calculateNewDimensions(e, t, n) {
3371
- let r = this.startWidth, s = this.startHeight;
3372
- const o = e.includes("right"), i = e.includes("left"), a = e.includes("bottom"), c = e.includes("top");
3373
- return o ? r = this.startWidth + t : i && (r = this.startWidth - t), a ? s = this.startHeight + n : c && (s = this.startHeight - n), (e === "right" || e === "left") && (r = this.startWidth + (o ? t : -t)), (e === "top" || e === "bottom") && (s = this.startHeight + (a ? n : -n)), this.preserveAspectRatio || this.isShiftKeyPressed ? this.applyAspectRatio(r, s, e) : { width: r, height: s };
3374
- }
3375
- /**
3376
- * Applies min/max constraints to dimensions.
3377
- *
3378
- * When aspect ratio is NOT preserved, constraints are applied independently
3379
- * to width and height. When aspect ratio IS preserved, constraints are
3380
- * applied while maintaining the aspect ratio—if one dimension hits a limit,
3381
- * the other is recalculated proportionally.
3382
- *
3383
- * This ensures that aspect ratio is never broken when constrained.
3384
- *
3385
- * @param width - The unconstrained width
3386
- * @param height - The unconstrained height
3387
- * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
3388
- * @returns The constrained dimensions
3389
- */
3390
- applyConstraints(e, t, n) {
3391
- var r, s, o, i;
3392
- if (!n) {
3393
- let l = Math.max(this.minSize.width, e), d = Math.max(this.minSize.height, t);
3394
- return (r = this.maxSize) != null && r.width && (l = Math.min(this.maxSize.width, l)), (s = this.maxSize) != null && s.height && (d = Math.min(this.maxSize.height, d)), { width: l, height: d };
3395
- }
3396
- let a = e, c = t;
3397
- return a < this.minSize.width && (a = this.minSize.width, c = a / this.aspectRatio), c < this.minSize.height && (c = this.minSize.height, a = c * this.aspectRatio), (o = this.maxSize) != null && o.width && a > this.maxSize.width && (a = this.maxSize.width, c = a / this.aspectRatio), (i = this.maxSize) != null && i.height && c > this.maxSize.height && (c = this.maxSize.height, a = c * this.aspectRatio), { width: a, height: c };
3398
- }
3399
- /**
3400
- * Adjusts dimensions to maintain the original aspect ratio.
3401
- *
3402
- * For horizontal handles (left/right), uses width as the primary dimension
3403
- * and calculates height from it. For vertical handles (top/bottom), uses
3404
- * height as primary and calculates width. For corner handles, uses width
3405
- * as the primary dimension.
3406
- *
3407
- * @param width - The new width
3408
- * @param height - The new height
3409
- * @param direction - The active resize direction
3410
- * @returns Dimensions adjusted to preserve aspect ratio
3411
- */
3412
- applyAspectRatio(e, t, n) {
3413
- const r = n === "left" || n === "right", s = n === "top" || n === "bottom";
3414
- return r ? {
3415
- width: e,
3416
- height: e / this.aspectRatio
3417
- } : s ? {
3418
- width: t * this.aspectRatio,
3419
- height: t
3420
- } : {
3421
- width: e,
3422
- height: e / this.aspectRatio
3423
- };
3424
- }
3425
- };
3426
- function ms(e, t) {
3427
- const { selection: n } = e, { $from: r } = n;
3428
- if (n instanceof nt) {
3429
- const o = r.index();
3430
- return r.parent.canReplaceWith(o, o + 1, t);
3431
- }
3432
- let s = r.depth;
3433
- for (; s >= 0; ) {
3434
- const o = r.index(s);
3435
- if (r.node(s).contentMatchAt(o).matchType(t))
3436
- return !0;
3437
- s -= 1;
3438
- }
3439
- return !1;
3440
- }
3441
- var Hr = {};
3442
- vt(Hr, {
3443
- createAtomBlockMarkdownSpec: () => Fr,
3444
- createBlockMarkdownSpec: () => Vr,
3445
- createInlineMarkdownSpec: () => Kr,
3446
- parseAttributes: () => St,
3447
- parseIndentedBlocks: () => qr,
3448
- renderNestedMarkdownContent: () => Jr,
3449
- serializeAttributes: () => Et
3450
- });
3451
- function St(e) {
3452
- if (!e?.trim())
3453
- return {};
3454
- const t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), s = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3455
- if (s) {
3456
- const l = s.map((d) => d.trim().slice(1));
3457
- t.class = l.join(" ");
3458
- }
3459
- const o = r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
3460
- o && (t.id = o[1]);
3461
- const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
3462
- Array.from(r.matchAll(i)).forEach(([, l, d]) => {
3463
- var u;
3464
- const p = parseInt(((u = d.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), f = n[p];
3465
- f && (t[l] = f.slice(1, -1));
3466
- });
3467
- const c = r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
3468
- return c && c.split(/\s+/).filter(Boolean).forEach((d) => {
3469
- d.match(/^[a-zA-Z][\w-]*$/) && (t[d] = !0);
3470
- }), t;
3471
- }
3472
- function Et(e) {
3473
- if (!e || Object.keys(e).length === 0)
3474
- return "";
3475
- const t = [];
3476
- return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((r) => t.push(`.${r}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([n, r]) => {
3477
- n === "class" || n === "id" || (r === !0 ? t.push(n) : r !== !1 && r != null && t.push(`${n}="${String(r)}"`));
3478
- }), t.join(" ");
3479
- }
3480
- function Fr(e) {
3481
- const {
3482
- nodeName: t,
3483
- name: n,
3484
- parseAttributes: r = St,
3485
- serializeAttributes: s = Et,
3486
- defaultAttributes: o = {},
3487
- requiredAttributes: i = [],
3488
- allowedAttributes: a
3489
- } = e, c = n || t, l = (d) => {
3490
- if (!a)
3491
- return d;
3492
- const u = {};
3493
- return a.forEach((p) => {
3494
- p in d && (u[p] = d[p]);
3495
- }), u;
3496
- };
3497
- return {
3498
- parseMarkdown: (d, u) => {
3499
- const p = { ...o, ...d.attributes };
3500
- return u.createNode(t, p, []);
3501
- },
3502
- markdownTokenizer: {
3503
- name: t,
3504
- level: "block",
3505
- start(d) {
3506
- var u;
3507
- const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), f = (u = d.match(p)) == null ? void 0 : u.index;
3508
- return f !== void 0 ? f : -1;
3509
- },
3510
- tokenize(d, u, p) {
3511
- const f = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), h = d.match(f);
3512
- if (!h)
3513
- return;
3514
- const m = h[1] || "", g = r(m);
3515
- if (!i.find((b) => !(b in g)))
3516
- return {
3517
- type: t,
3518
- raw: h[0],
3519
- attributes: g
3520
- };
3521
- }
3522
- },
3523
- renderMarkdown: (d) => {
3524
- const u = l(d.attrs || {}), p = s(u), f = p ? ` {${p}}` : "";
3525
- return `:::${c}${f} :::`;
3526
- }
3527
- };
3528
- }
3529
- function Vr(e) {
3530
- const {
3531
- nodeName: t,
3532
- name: n,
3533
- getContent: r,
3534
- parseAttributes: s = St,
3535
- serializeAttributes: o = Et,
3536
- defaultAttributes: i = {},
3537
- content: a = "block",
3538
- allowedAttributes: c
3539
- } = e, l = n || t, d = (u) => {
3540
- if (!c)
3541
- return u;
3542
- const p = {};
3543
- return c.forEach((f) => {
3544
- f in u && (p[f] = u[f]);
3545
- }), p;
3546
- };
3547
- return {
3548
- parseMarkdown: (u, p) => {
3549
- let f;
3550
- if (r) {
3551
- const m = r(u);
3552
- f = typeof m == "string" ? [{ type: "text", text: m }] : m;
3553
- } else a === "block" ? f = p.parseChildren(u.tokens || []) : f = p.parseInline(u.tokens || []);
3554
- const h = { ...i, ...u.attributes };
3555
- return p.createNode(t, h, f);
3556
- },
3557
- markdownTokenizer: {
3558
- name: t,
3559
- level: "block",
3560
- start(u) {
3561
- var p;
3562
- const f = new RegExp(`^:::${l}`, "m"), h = (p = u.match(f)) == null ? void 0 : p.index;
3563
- return h !== void 0 ? h : -1;
3564
- },
3565
- tokenize(u, p, f) {
3566
- var h;
3567
- const m = new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = u.match(m);
3568
- if (!g)
3569
- return;
3570
- const [v, b = ""] = g, k = s(b);
3571
- let M = 1;
3572
- const w = v.length;
3573
- let S = "";
3574
- const E = /^:::([\w-]*)(\s.*)?/gm, A = u.slice(w);
3575
- for (E.lastIndex = 0; ; ) {
3576
- const C = E.exec(A);
3577
- if (C === null)
3578
- break;
3579
- const _ = C.index, lt = C[1];
3580
- if (!((h = C[2]) != null && h.endsWith(":::"))) {
3581
- if (lt)
3582
- M += 1;
3583
- else if (M -= 1, M === 0) {
3584
- const K = A.slice(0, _);
3585
- S = K.trim();
3586
- const dt = u.slice(0, w + _ + C[0].length);
3587
- let I = [];
3588
- if (S)
3589
- if (a === "block")
3590
- for (I = f.blockTokens(K), I.forEach((R) => {
3591
- R.text && (!R.tokens || R.tokens.length === 0) && (R.tokens = f.inlineTokens(R.text));
3592
- }); I.length > 0; ) {
3593
- const R = I[I.length - 1];
3594
- if (R.type === "paragraph" && (!R.text || R.text.trim() === ""))
3595
- I.pop();
3596
- else
3597
- break;
3598
- }
3599
- else
3600
- I = f.inlineTokens(S);
3601
- return {
3602
- type: t,
3603
- raw: dt,
3604
- attributes: k,
3605
- content: S,
3606
- tokens: I
3607
- };
3608
- }
3609
- }
3610
- }
3611
- }
3612
- },
3613
- renderMarkdown: (u, p) => {
3614
- const f = d(u.attrs || {}), h = o(f), m = h ? ` {${h}}` : "", g = p.renderChildren(u.content || [], `
3615
-
3616
- `);
3617
- return `:::${l}${m}
3618
-
3619
- ${g}
3620
-
3621
- :::`;
3622
- }
3623
- };
3624
- }
3625
- function Wr(e) {
3626
- if (!e.trim())
3627
- return {};
3628
- const t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3629
- let r = n.exec(e);
3630
- for (; r !== null; ) {
3631
- const [, s, o, i] = r;
3632
- t[s] = o || i, r = n.exec(e);
3633
- }
3634
- return t;
3635
- }
3636
- function Ur(e) {
3637
- return Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => `${t}="${n}"`).join(" ");
3638
- }
3639
- function Kr(e) {
3640
- const {
3641
- nodeName: t,
3642
- name: n,
3643
- getContent: r,
3644
- parseAttributes: s = Wr,
3645
- serializeAttributes: o = Ur,
3646
- defaultAttributes: i = {},
3647
- selfClosing: a = !1,
3648
- allowedAttributes: c
3649
- } = e, l = n || t, d = (p) => {
3650
- if (!c)
3651
- return p;
3652
- const f = {};
3653
- return c.forEach((h) => {
3654
- const m = typeof h == "string" ? h : h.name, g = typeof h == "string" ? void 0 : h.skipIfDefault;
3655
- if (m in p) {
3656
- const v = p[m];
3657
- if (g !== void 0 && v === g)
3658
- return;
3659
- f[m] = v;
3660
- }
3661
- }), f;
3662
- }, u = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3663
- return {
3664
- parseMarkdown: (p, f) => {
3665
- const h = { ...i, ...p.attributes };
3666
- if (a)
3667
- return f.createNode(t, h);
3668
- const m = r ? r(p) : p.content || "";
3669
- return m ? f.createNode(t, h, [f.createTextNode(m)]) : f.createNode(t, h, []);
3670
- },
3671
- markdownTokenizer: {
3672
- name: t,
3673
- level: "inline",
3674
- start(p) {
3675
- const f = a ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), h = p.match(f), m = h?.index;
3676
- return m !== void 0 ? m : -1;
3677
- },
3678
- tokenize(p, f, h) {
3679
- const m = a ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`), g = p.match(m);
3680
- if (!g)
3681
- return;
3682
- let v = "", b = "";
3683
- if (a) {
3684
- const [, M] = g;
3685
- b = M;
3686
- } else {
3687
- const [, M, w] = g;
3688
- b = M, v = w || "";
3689
- }
3690
- const k = s(b.trim());
3691
- return {
3692
- type: t,
3693
- raw: g[0],
3694
- content: v.trim(),
3695
- attributes: k
3696
- };
3697
- }
3698
- },
3699
- renderMarkdown: (p) => {
3700
- let f = "";
3701
- r ? f = r(p) : p.content && p.content.length > 0 && (f = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
3702
- const h = d(p.attrs || {}), m = o(h), g = m ? ` ${m}` : "";
3703
- return a ? `[${l}${g}]` : `[${l}${g}]${f}[/${l}]`;
3704
- }
3705
- };
3706
- }
3707
- function qr(e, t, n) {
3708
- var r, s, o, i;
3709
- const a = e.split(`
3710
- `), c = [];
3711
- let l = "", d = 0;
3712
- const u = t.baseIndentSize || 2;
3713
- for (; d < a.length; ) {
3714
- const p = a[d], f = p.match(t.itemPattern);
3715
- if (!f) {
3716
- if (c.length > 0)
3717
- break;
3718
- if (p.trim() === "") {
3719
- d += 1, l = `${l}${p}
3720
- `;
3721
- continue;
3722
- } else
3723
- return;
3724
- }
3725
- const h = t.extractItemData(f), { indentLevel: m, mainContent: g } = h;
3726
- l = `${l}${p}
3727
- `;
3728
- const v = [g];
3729
- for (d += 1; d < a.length; ) {
3730
- const w = a[d];
3731
- if (w.trim() === "") {
3732
- const E = a.slice(d + 1).findIndex((_) => _.trim() !== "");
3733
- if (E === -1)
3734
- break;
3735
- if ((((s = (r = a[d + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : s.length) || 0) > m) {
3736
- v.push(w), l = `${l}${w}
3737
- `, d += 1;
3738
- continue;
3739
- } else
3740
- break;
3741
- }
3742
- if ((((i = (o = w.match(/^(\s*)/)) == null ? void 0 : o[1]) == null ? void 0 : i.length) || 0) > m)
3743
- v.push(w), l = `${l}${w}
3744
- `, d += 1;
3745
- else
3746
- break;
3747
- }
3748
- let b;
3749
- const k = v.slice(1);
3750
- if (k.length > 0) {
3751
- const w = k.map((S) => S.slice(m + u)).join(`
3752
- `);
3753
- w.trim() && (t.customNestedParser ? b = t.customNestedParser(w) : b = n.blockTokens(w));
3754
- }
3755
- const M = t.createToken(h, b);
3756
- c.push(M);
3757
- }
3758
- if (c.length !== 0)
3759
- return {
3760
- items: c,
3761
- raw: l
3762
- };
3763
- }
3764
- function Jr(e, t, n, r) {
3765
- if (!e || !Array.isArray(e.content))
3766
- return "";
3767
- const s = typeof n == "function" ? n(r) : n, [o, ...i] = e.content, a = t.renderChildren([o]), c = [`${s}${a}`];
3768
- return i && i.length > 0 && i.forEach((l) => {
3769
- const d = t.renderChildren([l]);
3770
- if (d) {
3771
- const u = d.split(`
3772
- `).map((p) => p ? t.indent(p) : "").join(`
3773
- `);
3774
- c.push(u);
3775
- }
3776
- }), c.join(`
3777
- `);
3778
- }
3779
- function Xr(e, t, n = {}) {
3780
- const { state: r } = t, { doc: s, tr: o } = r, i = e;
3781
- s.descendants((a, c) => {
3782
- const l = o.mapping.map(c), d = o.mapping.map(c) + a.nodeSize;
3783
- let u = null;
3784
- if (a.marks.forEach((f) => {
3785
- if (f !== i)
3786
- return !1;
3787
- u = f;
3788
- }), !u)
3789
- return;
3790
- let p = !1;
3791
- if (Object.keys(n).forEach((f) => {
3792
- n[f] !== u.attrs[f] && (p = !0);
3793
- }), p) {
3794
- const f = e.type.create({
3795
- ...e.attrs,
3796
- ...n
3797
- });
3798
- o.removeMark(l, d, e.type), o.addMark(l, d, f);
3799
- }
3800
- }), o.docChanged && t.view.dispatch(o);
3801
- }
3802
- var gs = class pe extends xt {
3803
- constructor() {
3804
- super(...arguments), this.type = "node";
3805
- }
3806
- /**
3807
- * Create a new Node instance
3808
- * @param config - Node configuration object or a function that returns a configuration object
3809
- */
3810
- static create(t = {}) {
3811
- const n = typeof t == "function" ? t() : t;
3812
- return new pe(n);
3813
- }
3814
- configure(t) {
3815
- return super.configure(t);
3816
- }
3817
- extend(t) {
3818
- const n = typeof t == "function" ? t() : t;
3819
- return super.extend(n);
3820
- }
3821
- };
3822
- function vs(e) {
3823
- return new Nr({
3824
- find: e.find,
3825
- handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
3826
- const o = x(e.getAttributes, void 0, r, s);
3827
- if (o === !1 || o === null)
3828
- return null;
3829
- const { tr: i } = t, a = r[r.length - 1], c = r[0];
3830
- let l = n.to;
3831
- if (a) {
3832
- const d = c.search(/\S/), u = n.from + c.indexOf(a), p = u + a.length;
3833
- if (Yt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((g) => g === e.type && g !== h.mark.type)).filter((h) => h.to > u).length)
3834
- return null;
3835
- p < n.to && i.delete(p, n.to), u > n.from && i.delete(n.from + d, u), l = n.from + d + a.length, i.addMark(n.from + d, l, e.type.create(o || {})), i.removeStoredMark(e.type);
3836
- }
3837
- }
3838
- });
3839
- }
3840
- var ys = (e, t) => {
3841
- if (e === "slot")
3842
- return 0;
3843
- if (e instanceof Function)
3844
- return e(t);
3845
- const { children: n, ...r } = t ?? {};
3846
- if (e === "svg")
3847
- throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
3848
- return [e, r, n];
3849
- };
3850
- export {
3851
- Fn as A,
3852
- Br as B,
3853
- kt as C,
3854
- cs as E,
3855
- Pr as M,
3856
- gs as N,
3857
- hs as R,
3858
- vs as a,
3859
- ds as b,
3860
- ms as c,
3861
- Ln as d,
3862
- Yt as e,
3863
- rs as f,
3864
- Gn as g,
3865
- ys as h,
3866
- as as i,
3867
- Yn as j,
3868
- N as k,
3869
- et as l,
3870
- Wn as m,
3871
- us as n,
3872
- U as o,
3873
- qr as p,
3874
- is as q,
3875
- Jr as r,
3876
- os as s,
3877
- fs as t,
3878
- T as u,
3879
- ss as v,
3880
- ps as w,
3881
- x,
3882
- y,
3883
- Mt as z
3884
- };