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