@geminilight/mindos-windows-arm64 1.0.8 → 1.0.10

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 (310) hide show
  1. package/_standalone/.mindos-build-version +1 -1
  2. package/_standalone/__next/BUILD_ID +1 -1
  3. package/_standalone/__next/app-path-routes-manifest.json +22 -22
  4. package/_standalone/__next/build-manifest.json +3 -3
  5. package/_standalone/__next/prerender-manifest.json +3 -3
  6. package/_standalone/__next/react-loadable-manifest.json +15 -9
  7. package/_standalone/__next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  8. package/_standalone/__next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/_standalone/__next/server/app/_global-error.html +2 -2
  10. package/_standalone/__next/server/app/_global-error.rsc +1 -1
  11. package/_standalone/__next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/_standalone/__next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/_standalone/__next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/_standalone/__next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/_standalone/__next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/_standalone/__next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/_standalone/__next/server/app/_not-found/page.js +1 -1
  18. package/_standalone/__next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/_standalone/__next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/_standalone/__next/server/app/agents/[agentKey]/page.js +1 -1
  21. package/_standalone/__next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  22. package/_standalone/__next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  23. package/_standalone/__next/server/app/agents/page.js +1 -1
  24. package/_standalone/__next/server/app/agents/page.js.nft.json +1 -1
  25. package/_standalone/__next/server/app/agents/page_client-reference-manifest.js +1 -1
  26. package/_standalone/__next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  27. package/_standalone/__next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  28. package/_standalone/__next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  29. package/_standalone/__next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  30. package/_standalone/__next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  31. package/_standalone/__next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  32. package/_standalone/__next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  33. package/_standalone/__next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  34. package/_standalone/__next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  35. package/_standalone/__next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  36. package/_standalone/__next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
  37. package/_standalone/__next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  38. package/_standalone/__next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  39. package/_standalone/__next/server/app/api/ask/route.js +5 -5
  40. package/_standalone/__next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  41. package/_standalone/__next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  42. package/_standalone/__next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  43. package/_standalone/__next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  44. package/_standalone/__next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  45. package/_standalone/__next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  46. package/_standalone/__next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
  47. package/_standalone/__next/server/app/api/connect/route_client-reference-manifest.js +1 -1
  48. package/_standalone/__next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
  49. package/_standalone/__next/server/app/api/export/route_client-reference-manifest.js +1 -1
  50. package/_standalone/__next/server/app/api/extract-docx/route_client-reference-manifest.js +1 -1
  51. package/_standalone/__next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  52. package/_standalone/__next/server/app/api/file/import/route.js +1 -1
  53. package/_standalone/__next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  54. package/_standalone/__next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  55. package/_standalone/__next/server/app/api/file/route_client-reference-manifest.js +1 -1
  56. package/_standalone/__next/server/app/api/files/route_client-reference-manifest.js +1 -1
  57. package/_standalone/__next/server/app/api/git/route_client-reference-manifest.js +1 -1
  58. package/_standalone/__next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  59. package/_standalone/__next/server/app/api/health/route_client-reference-manifest.js +1 -1
  60. package/_standalone/__next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
  61. package/_standalone/__next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
  62. package/_standalone/__next/server/app/api/im/feishu/long-connection/event/route_client-reference-manifest.js +1 -1
  63. package/_standalone/__next/server/app/api/im/feishu/long-connection/route_client-reference-manifest.js +1 -1
  64. package/_standalone/__next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
  65. package/_standalone/__next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
  66. package/_standalone/__next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
  67. package/_standalone/__next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
  68. package/_standalone/__next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
  69. package/_standalone/__next/server/app/api/inbox/route.js +1 -1
  70. package/_standalone/__next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  71. package/_standalone/__next/server/app/api/init/route_client-reference-manifest.js +1 -1
  72. package/_standalone/__next/server/app/api/lint/route_client-reference-manifest.js +1 -1
  73. package/_standalone/__next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  74. package/_standalone/__next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
  75. package/_standalone/__next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  76. package/_standalone/__next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  77. package/_standalone/__next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  78. package/_standalone/__next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  79. package/_standalone/__next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
  80. package/_standalone/__next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  81. package/_standalone/__next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  82. package/_standalone/__next/server/app/api/obsidian/compat-report/route_client-reference-manifest.js +1 -1
  83. package/_standalone/__next/server/app/api/obsidian/import/route_client-reference-manifest.js +1 -1
  84. package/_standalone/__next/server/app/api/obsidian-plugins/settings/route_client-reference-manifest.js +1 -1
  85. package/_standalone/__next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  86. package/_standalone/__next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  87. package/_standalone/__next/server/app/api/search/prewarm/route_client-reference-manifest.js +1 -1
  88. package/_standalone/__next/server/app/api/search/route_client-reference-manifest.js +1 -1
  89. package/_standalone/__next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  90. package/_standalone/__next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  91. package/_standalone/__next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  92. package/_standalone/__next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  93. package/_standalone/__next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  94. package/_standalone/__next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  95. package/_standalone/__next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  96. package/_standalone/__next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  97. package/_standalone/__next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  98. package/_standalone/__next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  99. package/_standalone/__next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
  100. package/_standalone/__next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  101. package/_standalone/__next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  102. package/_standalone/__next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  103. package/_standalone/__next/server/app/api/update/route_client-reference-manifest.js +1 -1
  104. package/_standalone/__next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  105. package/_standalone/__next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  106. package/_standalone/__next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  107. package/_standalone/__next/server/app/capture/history/page.js +1 -1
  108. package/_standalone/__next/server/app/capture/history/page.js.nft.json +1 -1
  109. package/_standalone/__next/server/app/capture/history/page_client-reference-manifest.js +1 -1
  110. package/_standalone/__next/server/app/capture/page.js +1 -1
  111. package/_standalone/__next/server/app/capture/page.js.nft.json +1 -1
  112. package/_standalone/__next/server/app/capture/page_client-reference-manifest.js +1 -1
  113. package/_standalone/__next/server/app/changelog/page.js +1 -1
  114. package/_standalone/__next/server/app/changelog/page.js.nft.json +1 -1
  115. package/_standalone/__next/server/app/changelog/page_client-reference-manifest.js +1 -1
  116. package/_standalone/__next/server/app/changes/page.js +1 -1
  117. package/_standalone/__next/server/app/changes/page.js.nft.json +1 -1
  118. package/_standalone/__next/server/app/changes/page_client-reference-manifest.js +1 -1
  119. package/_standalone/__next/server/app/echo/[segment]/page.js +1 -1
  120. package/_standalone/__next/server/app/echo/[segment]/page.js.nft.json +1 -1
  121. package/_standalone/__next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  122. package/_standalone/__next/server/app/echo/page.js +1 -1
  123. package/_standalone/__next/server/app/echo/page.js.nft.json +1 -1
  124. package/_standalone/__next/server/app/echo/page_client-reference-manifest.js +1 -1
  125. package/_standalone/__next/server/app/explore/page.js +1 -1
  126. package/_standalone/__next/server/app/explore/page.js.nft.json +1 -1
  127. package/_standalone/__next/server/app/explore/page_client-reference-manifest.js +1 -1
  128. package/_standalone/__next/server/app/help/page.js +1 -1
  129. package/_standalone/__next/server/app/help/page.js.nft.json +1 -1
  130. package/_standalone/__next/server/app/help/page_client-reference-manifest.js +1 -1
  131. package/_standalone/__next/server/app/inbox/history/page.js +1 -1
  132. package/_standalone/__next/server/app/inbox/history/page.js.nft.json +1 -1
  133. package/_standalone/__next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  134. package/_standalone/__next/server/app/login/page.js +1 -1
  135. package/_standalone/__next/server/app/login/page.js.nft.json +1 -1
  136. package/_standalone/__next/server/app/login/page_client-reference-manifest.js +1 -1
  137. package/_standalone/__next/server/app/page.js +1 -1
  138. package/_standalone/__next/server/app/page.js.nft.json +1 -1
  139. package/_standalone/__next/server/app/page_client-reference-manifest.js +1 -1
  140. package/_standalone/__next/server/app/settings/page.js +2 -2
  141. package/_standalone/__next/server/app/settings/page.js.nft.json +1 -1
  142. package/_standalone/__next/server/app/settings/page_client-reference-manifest.js +1 -1
  143. package/_standalone/__next/server/app/setup/page.js +1 -1
  144. package/_standalone/__next/server/app/setup/page.js.nft.json +1 -1
  145. package/_standalone/__next/server/app/setup/page_client-reference-manifest.js +1 -1
  146. package/_standalone/__next/server/app/todo/page.js +1 -1
  147. package/_standalone/__next/server/app/todo/page.js.nft.json +1 -1
  148. package/_standalone/__next/server/app/todo/page_client-reference-manifest.js +1 -1
  149. package/_standalone/__next/server/app/trash/page.js +3 -3
  150. package/_standalone/__next/server/app/trash/page_client-reference-manifest.js +1 -1
  151. package/_standalone/__next/server/app/view/[...path]/page.js +3 -3
  152. package/_standalone/__next/server/app/view/[...path]/page.js.nft.json +1 -1
  153. package/_standalone/__next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  154. package/_standalone/__next/server/app/wiki/page.js +2 -2
  155. package/_standalone/__next/server/app/wiki/page.js.nft.json +1 -1
  156. package/_standalone/__next/server/app/wiki/page_client-reference-manifest.js +1 -1
  157. package/_standalone/__next/server/app-paths-manifest.json +22 -22
  158. package/_standalone/__next/server/chunks/1665.js +3 -3
  159. package/_standalone/__next/server/chunks/1976.js +1 -1
  160. package/_standalone/__next/server/chunks/2428.js +3 -3
  161. package/_standalone/__next/server/chunks/4466.js +4 -4
  162. package/_standalone/__next/server/chunks/{9969.js → 5768.js} +2 -2
  163. package/_standalone/__next/server/chunks/6279.js +1 -0
  164. package/_standalone/__next/server/chunks/6602.js +47 -47
  165. package/_standalone/__next/server/chunks/8461.js +17 -17
  166. package/_standalone/__next/server/middleware-build-manifest.js +1 -1
  167. package/_standalone/__next/server/middleware-react-loadable-manifest.js +1 -1
  168. package/_standalone/__next/server/pages/500.html +2 -2
  169. package/_standalone/__next/server/server-reference-manifest.js +1 -1
  170. package/_standalone/__next/server/server-reference-manifest.json +1 -1
  171. package/_standalone/__next/static/chunks/1023-3a5a295bdb8f036e.js +53 -0
  172. package/_standalone/__next/static/chunks/1469-a47a8fdf907854b7.js +1 -0
  173. package/_standalone/__next/static/chunks/1471.26592788eb019d91.js +1 -0
  174. package/_standalone/__next/static/chunks/{2073-fadffc82a27afdc7.js → 2073-85e9695b8754ccd4.js} +4 -4
  175. package/_standalone/__next/static/chunks/2303.da761b42cec4cd5c.js +1 -0
  176. package/_standalone/__next/static/chunks/2571-f83b7e0b3f478222.js +1 -0
  177. package/_standalone/__next/static/chunks/2762-e6982806b63ccb64.js +1 -0
  178. package/_standalone/__next/static/chunks/3045-a957e615254f5059.js +20 -0
  179. package/_standalone/__next/static/chunks/3288-8f2809685fe349a8.js +1 -0
  180. package/_standalone/__next/static/chunks/3819-665b50f4dc3af9e2.js +1 -0
  181. package/_standalone/__next/static/chunks/3995-efb3b8f34f1a5a8f.js +27 -0
  182. package/_standalone/__next/static/chunks/4304-ee72ac41d1513389.js +8 -0
  183. package/_standalone/__next/static/chunks/{2245.ef71edb24c5232c2.js → 5098.096f96bd198d864c.js} +1 -1
  184. package/_standalone/__next/static/chunks/5840.ad2131db64e173a7.js +1 -0
  185. package/{static-web/_next/static/chunks/5913.a0a734f87b13f81a.js → _standalone/__next/static/chunks/5913.0aa553b16c2b0302.js} +1 -1
  186. package/{static-web/_next/static/chunks/3819.42b0ef6a61a01d67.js → _standalone/__next/static/chunks/6200.3f2d00ee8c2e9f9e.js} +1 -1
  187. package/_standalone/__next/static/chunks/6274-f173cb227ad1ef21.js +1 -0
  188. package/_standalone/__next/static/chunks/7904-fadcd92068780b59.js +16 -0
  189. package/_standalone/__next/static/chunks/8132-466a3fea8940c114.js +1 -0
  190. package/_standalone/__next/static/chunks/8924-685d2215bfd7204e.js +14 -0
  191. package/_standalone/__next/static/chunks/9202-9a33f968862439f5.js +1 -0
  192. package/_standalone/__next/static/chunks/{9602.218427fc7b3d6b11.js → 9602.cbfa1195944c2e3d.js} +1 -1
  193. package/_standalone/__next/static/chunks/{9947.81409c5539cd781d.js → 9947.99304c5fc22b4fbe.js} +1 -1
  194. package/_standalone/__next/static/chunks/app/agents/[agentKey]/{page-ef111ea0a3368752.js → page-89e05039dfc56a33.js} +1 -1
  195. package/_standalone/__next/static/chunks/app/agents/{page-aacead0f47cedb0d.js → page-9f4d0c5a3ec17720.js} +1 -1
  196. package/_standalone/__next/static/chunks/app/capture/page-86fc5eabdb1f3f87.js +14 -0
  197. package/_standalone/__next/static/chunks/app/echo/[segment]/{page-c5ea40ac04f2dc29.js → page-f0e6a66b3c9d60c0.js} +1 -1
  198. package/_standalone/__next/static/chunks/app/{layout-ed608bbf9585e78f.js → layout-1c84d9542b3d194e.js} +15 -15
  199. package/_standalone/__next/static/chunks/app/page-408daa74e14f5f27.js +1 -0
  200. package/_standalone/__next/static/chunks/app/settings/page-5eeea2c7c6dbf1d8.js +1 -0
  201. package/_standalone/__next/static/chunks/app/trash/page-31dba65333b30cc6.js +1 -0
  202. package/_standalone/__next/static/chunks/app/view/[...path]/page-5e9f49ab1b3bc3b2.js +12 -0
  203. package/_standalone/__next/static/chunks/app/wiki/page-d727a6cfe99e38a6.js +14 -0
  204. package/_standalone/__next/static/chunks/webpack-7fb8bc60a549efe2.js +1 -0
  205. package/_standalone/__next/static/css/67a9446950c3630b.css +1 -0
  206. package/assets/images/wechat-qr.png +0 -0
  207. package/dist/server/handlers/inbox.d.ts.map +1 -1
  208. package/dist/server/handlers/inbox.js +23 -2
  209. package/dist/server/handlers/inbox.js.map +1 -1
  210. package/dist/server/handlers/skills.d.ts.map +1 -1
  211. package/dist/server/handlers/skills.js +59 -5
  212. package/dist/server/handlers/skills.js.map +1 -1
  213. package/dist/server/runtime.d.ts +1 -0
  214. package/dist/server/runtime.d.ts.map +1 -1
  215. package/dist/server/runtime.js +10 -1
  216. package/dist/server/runtime.js.map +1 -1
  217. package/dist/session/index.d.ts +1 -0
  218. package/dist/session/index.d.ts.map +1 -1
  219. package/dist/session/index.js +1 -0
  220. package/dist/session/index.js.map +1 -1
  221. package/package.json +1 -1
  222. package/runtime-manifest.json +1 -1
  223. package/static-web/.mindos-build-version +1 -1
  224. package/static-web/_next/static/chunks/1023-3a5a295bdb8f036e.js +53 -0
  225. package/static-web/_next/static/chunks/1469-a47a8fdf907854b7.js +1 -0
  226. package/static-web/_next/static/chunks/1471.26592788eb019d91.js +1 -0
  227. package/static-web/_next/static/chunks/{2073-fadffc82a27afdc7.js → 2073-85e9695b8754ccd4.js} +4 -4
  228. package/static-web/_next/static/chunks/2303.da761b42cec4cd5c.js +1 -0
  229. package/static-web/_next/static/chunks/2571-f83b7e0b3f478222.js +1 -0
  230. package/static-web/_next/static/chunks/2762-e6982806b63ccb64.js +1 -0
  231. package/static-web/_next/static/chunks/3045-a957e615254f5059.js +20 -0
  232. package/static-web/_next/static/chunks/3288-8f2809685fe349a8.js +1 -0
  233. package/static-web/_next/static/chunks/3819-665b50f4dc3af9e2.js +1 -0
  234. package/static-web/_next/static/chunks/3995-efb3b8f34f1a5a8f.js +27 -0
  235. package/static-web/_next/static/chunks/4304-ee72ac41d1513389.js +8 -0
  236. package/static-web/_next/static/chunks/{2245.ef71edb24c5232c2.js → 5098.096f96bd198d864c.js} +1 -1
  237. package/static-web/_next/static/chunks/5840.ad2131db64e173a7.js +1 -0
  238. package/{_standalone/__next/static/chunks/5913.a0a734f87b13f81a.js → static-web/_next/static/chunks/5913.0aa553b16c2b0302.js} +1 -1
  239. package/{_standalone/__next/static/chunks/3819.42b0ef6a61a01d67.js → static-web/_next/static/chunks/6200.3f2d00ee8c2e9f9e.js} +1 -1
  240. package/static-web/_next/static/chunks/6274-f173cb227ad1ef21.js +1 -0
  241. package/static-web/_next/static/chunks/7904-fadcd92068780b59.js +16 -0
  242. package/static-web/_next/static/chunks/8132-466a3fea8940c114.js +1 -0
  243. package/static-web/_next/static/chunks/8924-685d2215bfd7204e.js +14 -0
  244. package/static-web/_next/static/chunks/9202-9a33f968862439f5.js +1 -0
  245. package/static-web/_next/static/chunks/{9602.218427fc7b3d6b11.js → 9602.cbfa1195944c2e3d.js} +1 -1
  246. package/static-web/_next/static/chunks/{9947.81409c5539cd781d.js → 9947.99304c5fc22b4fbe.js} +1 -1
  247. package/static-web/_next/static/chunks/app/agents/[agentKey]/{page-ef111ea0a3368752.js → page-89e05039dfc56a33.js} +1 -1
  248. package/static-web/_next/static/chunks/app/agents/{page-aacead0f47cedb0d.js → page-9f4d0c5a3ec17720.js} +1 -1
  249. package/static-web/_next/static/chunks/app/capture/page-86fc5eabdb1f3f87.js +14 -0
  250. package/static-web/_next/static/chunks/app/echo/[segment]/{page-c5ea40ac04f2dc29.js → page-f0e6a66b3c9d60c0.js} +1 -1
  251. package/static-web/_next/static/chunks/app/{layout-ed608bbf9585e78f.js → layout-1c84d9542b3d194e.js} +15 -15
  252. package/static-web/_next/static/chunks/app/page-408daa74e14f5f27.js +1 -0
  253. package/static-web/_next/static/chunks/app/settings/page-5eeea2c7c6dbf1d8.js +1 -0
  254. package/static-web/_next/static/chunks/app/trash/page-31dba65333b30cc6.js +1 -0
  255. package/static-web/_next/static/chunks/app/view/[...path]/page-5e9f49ab1b3bc3b2.js +12 -0
  256. package/static-web/_next/static/chunks/app/wiki/page-d727a6cfe99e38a6.js +14 -0
  257. package/static-web/_next/static/chunks/webpack-7fb8bc60a549efe2.js +1 -0
  258. package/static-web/_next/static/css/67a9446950c3630b.css +1 -0
  259. package/static-web/help/index.html +12 -8
  260. package/static-web/index.html +11 -7
  261. package/static-web/setup/index.html +12 -8
  262. package/static-web/static-web-manifest.json +1 -1
  263. package/static-web/wiki/index.html +11 -7
  264. package/_standalone/__next/server/chunks/3727.js +0 -1
  265. package/_standalone/__next/static/chunks/1104-0822d9349a412b9b.js +0 -16
  266. package/_standalone/__next/static/chunks/2258-2d3b5aac6a1fa92a.js +0 -53
  267. package/_standalone/__next/static/chunks/2303.ac755d2213a6ba9e.js +0 -1
  268. package/_standalone/__next/static/chunks/2409-244f9b90dceb0c04.js +0 -1
  269. package/_standalone/__next/static/chunks/3279-b49c25a4f2964b16.js +0 -1
  270. package/_standalone/__next/static/chunks/3807-115388f118106ca8.js +0 -1
  271. package/_standalone/__next/static/chunks/5026-7fed7ca22272c18f.js +0 -1
  272. package/_standalone/__next/static/chunks/5840.b812d86b830668e3.js +0 -1
  273. package/_standalone/__next/static/chunks/6272-6889f9239e888604.js +0 -14
  274. package/_standalone/__next/static/chunks/8174-50048777dc2469c0.js +0 -1
  275. package/_standalone/__next/static/chunks/8922-3babcd35e18e9e4f.js +0 -1
  276. package/_standalone/__next/static/chunks/9440-eee639175695be7d.js +0 -33
  277. package/_standalone/__next/static/chunks/9479-b48d19e3588823c1.js +0 -34
  278. package/_standalone/__next/static/chunks/app/capture/page-ae4d683afdc7a7b2.js +0 -1
  279. package/_standalone/__next/static/chunks/app/page-d22928276c36528c.js +0 -1
  280. package/_standalone/__next/static/chunks/app/settings/page-045afd8c0908f923.js +0 -1
  281. package/_standalone/__next/static/chunks/app/trash/page-251aaf5aac9d5a0b.js +0 -1
  282. package/_standalone/__next/static/chunks/app/view/[...path]/page-7e17c3d13fe2e275.js +0 -12
  283. package/_standalone/__next/static/chunks/app/wiki/page-4c9bc816069b6f2a.js +0 -14
  284. package/_standalone/__next/static/chunks/webpack-1decda0633a8a874.js +0 -1
  285. package/_standalone/__next/static/css/5f000212c8b2e09a.css +0 -1
  286. package/static-web/_next/static/chunks/1104-0822d9349a412b9b.js +0 -16
  287. package/static-web/_next/static/chunks/2258-2d3b5aac6a1fa92a.js +0 -53
  288. package/static-web/_next/static/chunks/2303.ac755d2213a6ba9e.js +0 -1
  289. package/static-web/_next/static/chunks/2409-244f9b90dceb0c04.js +0 -1
  290. package/static-web/_next/static/chunks/3279-b49c25a4f2964b16.js +0 -1
  291. package/static-web/_next/static/chunks/3807-115388f118106ca8.js +0 -1
  292. package/static-web/_next/static/chunks/5026-7fed7ca22272c18f.js +0 -1
  293. package/static-web/_next/static/chunks/5840.b812d86b830668e3.js +0 -1
  294. package/static-web/_next/static/chunks/6272-6889f9239e888604.js +0 -14
  295. package/static-web/_next/static/chunks/8174-50048777dc2469c0.js +0 -1
  296. package/static-web/_next/static/chunks/8922-3babcd35e18e9e4f.js +0 -1
  297. package/static-web/_next/static/chunks/9440-eee639175695be7d.js +0 -33
  298. package/static-web/_next/static/chunks/9479-b48d19e3588823c1.js +0 -34
  299. package/static-web/_next/static/chunks/app/capture/page-ae4d683afdc7a7b2.js +0 -1
  300. package/static-web/_next/static/chunks/app/page-d22928276c36528c.js +0 -1
  301. package/static-web/_next/static/chunks/app/settings/page-045afd8c0908f923.js +0 -1
  302. package/static-web/_next/static/chunks/app/trash/page-251aaf5aac9d5a0b.js +0 -1
  303. package/static-web/_next/static/chunks/app/view/[...path]/page-7e17c3d13fe2e275.js +0 -12
  304. package/static-web/_next/static/chunks/app/wiki/page-4c9bc816069b6f2a.js +0 -14
  305. package/static-web/_next/static/chunks/webpack-1decda0633a8a874.js +0 -1
  306. package/static-web/_next/static/css/5f000212c8b2e09a.css +0 -1
  307. /package/_standalone/__next/static/{apol5mbXb7N_sqaKgpXN1 → QRVhXGG4IotxFfmor1t55}/_buildManifest.js +0 -0
  308. /package/_standalone/__next/static/{apol5mbXb7N_sqaKgpXN1 → QRVhXGG4IotxFfmor1t55}/_ssgManifest.js +0 -0
  309. /package/static-web/_next/static/{apol5mbXb7N_sqaKgpXN1 → QRVhXGG4IotxFfmor1t55}/_buildManifest.js +0 -0
  310. /package/static-web/_next/static/{apol5mbXb7N_sqaKgpXN1 → QRVhXGG4IotxFfmor1t55}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9602],{182:(e,t,n)=>{"use strict";let r,i,o,l,a,s,c,d;n.d(t,{mA:()=>m7,y$:()=>fd});let u=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},h=function(e){return e};var p,f,m,g,v,y,w,b,k,C,x,S,M,T,N,A,O,I,E,_,R,L,P,$,D,j,F,B,H,z,q,K,W,U,V,J,G,Z,Y,X,Q,ee,et,en,er,ei,eo,el,ea,es,ec,ed,eu,eh,ep,ef,em,eg,ev,ey,ew,eb,ek,eC,ex,eS,eM,eT,eN=Math.max,eA="object"==typeof global&&global&&global.Object===Object&&global,eO="object"==typeof self&&self&&self.Object===Object&&self,eI=eA||eO||Function("return this")(),eE=eI.Symbol,e_=Object.prototype,eR=e_.hasOwnProperty,eL=e_.toString,eP=eE?eE.toStringTag:void 0;let e$=function(e){var t=eR.call(e,eP),n=e[eP];try{e[eP]=void 0;var r=!0}catch(e){}var i=eL.call(e);return r&&(t?e[eP]=n:delete e[eP]),i};var eD=Object.prototype.toString,ej=eE?eE.toStringTag:void 0;let eF=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ej&&ej in Object(e)?e$(e):eD.call(e)},eB=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eH=function(e){if(!eB(e))return!1;var t=eF(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var ez=eI["__core-js_shared__"],eq=(f=/[^.]+$/.exec(ez&&ez.keys&&ez.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",eK=Function.prototype.toString;let eW=function(e){if(null!=e){try{return eK.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var eU=/^\[object .+?Constructor\]$/,eV=Object.prototype,eJ=Function.prototype.toString,eG=eV.hasOwnProperty,eZ=RegExp("^"+eJ.call(eG).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eY=function(e){return!!eB(e)&&(!eq||!(eq in e))&&(eH(e)?eZ:eU).test(eW(e))},eX=function(e,t){var n=null==e?void 0:e[t];return eY(n)?n:void 0};var eQ=function(){try{var e=eX(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),e1=Date.now,e0=(m=eQ?function(e,t){return eQ(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:h,g=0,v=0,function(){var e=e1(),t=16-(e-v);if(v=e,t>0){if(++g>=800)return arguments[0]}else g=0;return m.apply(void 0,arguments)});let e2=function(e,t){var n;return e0((n=eN(void 0===(n=t)?e.length-1:n,0),function(){for(var t=arguments,r=-1,i=eN(t.length-n,0),o=Array(i);++r<i;)o[r]=t[n+r];r=-1;for(var l=Array(n+1);++r<n;)l[r]=t[r];return l[n]=h(o),u(e,this,l)}),e+"")},e5=function(e,t){return e===t||e!=e&&t!=t},e3=function(e,t){for(var n=e.length;n--;)if(e5(e[n][0],t))return n;return -1};var e9=Array.prototype.splice;function e7(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}e7.prototype.clear=function(){this.__data__=[],this.size=0},e7.prototype.delete=function(e){var t=this.__data__,n=e3(t,e);return!(n<0)&&(n==t.length-1?t.pop():e9.call(t,n,1),--this.size,!0)},e7.prototype.get=function(e){var t=this.__data__,n=e3(t,e);return n<0?void 0:t[n][1]},e7.prototype.has=function(e){return e3(this.__data__,e)>-1},e7.prototype.set=function(e,t){var n=this.__data__,r=e3(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var e4=eX(eI,"Map"),e8=eX(Object,"create"),e6=Object.prototype.hasOwnProperty,te=Object.prototype.hasOwnProperty;function tt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tt.prototype.clear=function(){this.__data__=e8?e8(null):{},this.size=0},tt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},tt.prototype.get=function(e){var t=this.__data__;if(e8){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return e6.call(t,e)?t[e]:void 0},tt.prototype.has=function(e){var t=this.__data__;return e8?void 0!==t[e]:te.call(t,e)},tt.prototype.set=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=e8&&void 0===t?"__lodash_hash_undefined__":t,this};let tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},tr=function(e,t){var n=e.__data__;return tn(t)?n["string"==typeof t?"string":"hash"]:n.map};function ti(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function to(e){var t=this.__data__=new e7(e);this.size=t.size}ti.prototype.clear=function(){this.size=0,this.__data__={hash:new tt,map:new(e4||e7),string:new tt}},ti.prototype.delete=function(e){var t=tr(this,e).delete(e);return this.size-=!!t,t},ti.prototype.get=function(e){return tr(this,e).get(e)},ti.prototype.has=function(e){return tr(this,e).has(e)},ti.prototype.set=function(e,t){var n=tr(this,e),r=n.size;return n.set(e,t),this.size+=+(n.size!=r),this},to.prototype.clear=function(){this.__data__=new e7,this.size=0},to.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},to.prototype.get=function(e){return this.__data__.get(e)},to.prototype.has=function(e){return this.__data__.has(e)},to.prototype.set=function(e,t){var n=this.__data__;if(n instanceof e7){var r=n.__data__;if(!e4||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ti(r)}return n.set(e,t),this.size=n.size,this};let tl=function(e,t,n){"__proto__"==t&&eQ?eQ(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ta=function(e,t,n){(void 0===n||e5(e[t],n))&&(void 0!==n||t in e)||tl(e,t,n)},ts=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),l=o.length;l--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e};var tc="object"==typeof exports&&exports&&!exports.nodeType&&exports,td=tc&&"object"==typeof module&&module&&!module.nodeType&&module,tu=td&&td.exports===tc?eI.Buffer:void 0,th=tu?tu.allocUnsafe:void 0;let tp=function(e,t){if(t)return e.slice();var n=e.length,r=th?th(n):new e.constructor(n);return e.copy(r),r};var tf=eI.Uint8Array;let tm=function(e){var t=new e.constructor(e.byteLength);return new tf(t).set(new tf(e)),t},tg=function(e,t){var n=t?tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},tv=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var ty=Object.create,tw=function(){function e(){}return function(t){if(!eB(t))return{};if(ty)return ty(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),tb=(y=Object.getPrototypeOf,w=Object,function(e){return y(w(e))}),tk=Object.prototype;let tC=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tk)},tx=function(e){return null!=e&&"object"==typeof e},tS=function(e){return tx(e)&&"[object Arguments]"==eF(e)};var tM=Object.prototype,tT=tM.hasOwnProperty,tN=tM.propertyIsEnumerable,tA=tS(function(){return arguments}())?tS:function(e){return tx(e)&&tT.call(e,"callee")&&!tN.call(e,"callee")},tO=Array.isArray;let tI=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},tE=function(e){return null!=e&&tI(e.length)&&!eH(e)};var t_="object"==typeof exports&&exports&&!exports.nodeType&&exports,tR=t_&&"object"==typeof module&&module&&!module.nodeType&&module,tL=tR&&tR.exports===t_?eI.Buffer:void 0;let tP=(tL?tL.isBuffer:void 0)||function(){return!1};var t$=Object.prototype,tD=Function.prototype.toString,tj=t$.hasOwnProperty,tF=tD.call(Object);let tB=function(e){if(!tx(e)||"[object Object]"!=eF(e))return!1;var t=tb(e);if(null===t)return!0;var n=tj.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&tD.call(n)==tF};var tH={};tH["[object Float32Array]"]=tH["[object Float64Array]"]=tH["[object Int8Array]"]=tH["[object Int16Array]"]=tH["[object Int32Array]"]=tH["[object Uint8Array]"]=tH["[object Uint8ClampedArray]"]=tH["[object Uint16Array]"]=tH["[object Uint32Array]"]=!0,tH["[object Arguments]"]=tH["[object Array]"]=tH["[object ArrayBuffer]"]=tH["[object Boolean]"]=tH["[object DataView]"]=tH["[object Date]"]=tH["[object Error]"]=tH["[object Function]"]=tH["[object Map]"]=tH["[object Number]"]=tH["[object Object]"]=tH["[object RegExp]"]=tH["[object Set]"]=tH["[object String]"]=tH["[object WeakMap]"]=!1;var tz="object"==typeof exports&&exports&&!exports.nodeType&&exports,tq=tz&&"object"==typeof module&&module&&!module.nodeType&&module,tK=tq&&tq.exports===tz&&eA.process,tW=function(){try{var e=tq&&tq.require&&tq.require("util").types;if(e)return e;return tK&&tK.binding&&tK.binding("util")}catch(e){}}(),tU=tW&&tW.isTypedArray,tV=tU?function(e){return tU(e)}:function(e){return tx(e)&&tI(e.length)&&!!tH[eF(e)]};let tJ=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tG=Object.prototype.hasOwnProperty;let tZ=function(e,t,n){var r=e[t];tG.call(e,t)&&e5(r,n)&&(void 0!==n||t in e)||tl(e,t,n)},tY=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,l=t.length;++o<l;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;void 0===s&&(s=e[a]),i?tl(n,a,s):tZ(n,a,s)}return n},tX=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var tQ=/^(?:0|[1-9]\d*)$/;let t1=function(e,t){var n=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==n||"symbol"!=n&&tQ.test(e))&&e>-1&&e%1==0&&e<t};var t0=Object.prototype.hasOwnProperty;let t2=function(e,t){var n=tO(e),r=!n&&tA(e),i=!n&&!r&&tP(e),o=!n&&!r&&!i&&tV(e),l=n||r||i||o,a=l?tX(e.length,String):[],s=a.length;for(var c in e)(t||t0.call(e,c))&&!(l&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||t1(c,s)))&&a.push(c);return a},t5=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var t3=Object.prototype.hasOwnProperty;let t9=function(e){if(!eB(e))return t5(e);var t=tC(e),n=[];for(var r in e)"constructor"==r&&(t||!t3.call(e,r))||n.push(r);return n},t7=function(e){return tE(e)?t2(e,!0):t9(e)},t4=function(e,t,n,r,i,o,l){var a=tJ(e,n),s=tJ(t,n),c=l.get(s);if(c)return void ta(e,n,c);var d=o?o(a,s,n+"",e,t,l):void 0,u=void 0===d;if(u){var h=tO(s),p=!h&&tP(s),f=!h&&!p&&tV(s);(d=s,h||p||f)?tO(a)?d=a:tx(a)&&tE(a)?d=tv(a):p?(u=!1,d=tp(s,!0)):f?(u=!1,d=tg(s,!0)):d=[]:tB(s)||tA(s)?(d=a,tA(a))?d=tY(a,t7(a)):(!eB(a)||eH(a))&&(d="function"!=typeof s.constructor||tC(s)?{}:tw(tb(s))):u=!1}u&&(l.set(s,d),i(d,s,r,o,l),l.delete(s)),ta(e,n,d)},t8=function e(t,n,r,i,o){t!==n&&ts(n,function(l,a){if(o||(o=new to),eB(l))t4(t,n,a,r,e,i,o);else{var s=i?i(tJ(t,a),l,a+"",t,n,o):void 0;void 0===s&&(s=l),ta(t,a,s)}},t7)},t6=function e(t,n,r,i,o,l){return eB(t)&&eB(n)&&(l.set(n,t),t8(t,n,void 0,e,l),l.delete(n)),t},ne=function(e,t,n){if(!eB(n))return!1;var r=typeof t;return("number"==r?!!(tE(n)&&t1(t,n.length)):"string"==r&&t in n)&&e5(n[t],e)};var nt=(b=function(e,t,n,r){t8(e,t,n,r)},e2(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=b.length>3&&"function"==typeof i?(r--,i):void 0,o&&ne(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var l=t[n];l&&b(e,l,n,i)}return e})),nn=e2(function(e){return e.push(void 0,t6),u(nt,void 0,e)}),nr=n(23696);function ni(e){return new nr.Yy(nr.Tg.define(e))}function no(e){return Promise.all([n.e(7906),n.e(7687)]).then(n.bind(n,87687)).then(t=>t.sql({dialect:t[e]}))}let nl=[nr.t$.of({name:"C",extensions:["c","h","ino"],load:()=>Promise.all([n.e(7906),n.e(4113)]).then(n.bind(n,24113)).then(e=>e.cpp())}),nr.t$.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>Promise.all([n.e(7906),n.e(4113)]).then(n.bind(n,24113)).then(e=>e.cpp())}),nr.t$.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>no("Cassandra")}),nr.t$.of({name:"CSS",extensions:["css"],load:()=>Promise.all([n.e(7906),n.e(4938)]).then(n.bind(n,22557)).then(e=>e.css())}),nr.t$.of({name:"Go",extensions:["go"],load:()=>Promise.all([n.e(7906),n.e(7882)]).then(n.bind(n,47882)).then(e=>e.go())}),nr.t$.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570)]).then(n.bind(n,80570)).then(e=>e.html())}),nr.t$.of({name:"Java",extensions:["java"],load:()=>Promise.all([n.e(7906),n.e(7229)]).then(n.bind(n,17229)).then(e=>e.java())}),nr.t$.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript())}),nr.t$.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(7041)]).then(n.bind(n,27041)).then(e=>e.jinja())}),nr.t$.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>Promise.all([n.e(7906),n.e(1050)]).then(n.bind(n,71050)).then(e=>e.json())}),nr.t$.of({name:"JSX",extensions:["jsx"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({jsx:!0}))}),nr.t$.of({name:"LESS",extensions:["less"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(8160)]).then(n.bind(n,98160)).then(e=>e.less())}),nr.t$.of({name:"Liquid",extensions:["liquid"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(2507)]).then(n.bind(n,92507)).then(e=>e.liquid())}),nr.t$.of({name:"MariaDB SQL",load:()=>no("MariaSQL")}),nr.t$.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(9837)]).then(n.bind(n,69837)).then(e=>e.markdown())}),nr.t$.of({name:"MS SQL",load:()=>no("MSSQL")}),nr.t$.of({name:"MySQL",load:()=>no("MySQL")}),nr.t$.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(6989)]).then(n.bind(n,76989)).then(e=>e.php())}),nr.t$.of({name:"PLSQL",extensions:["pls"],load:()=>no("PLSQL")}),nr.t$.of({name:"PostgreSQL",load:()=>no("PostgreSQL")}),nr.t$.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>Promise.all([n.e(7906),n.e(2293)]).then(n.bind(n,42293)).then(e=>e.python())}),nr.t$.of({name:"Rust",extensions:["rs"],load:()=>Promise.all([n.e(7906),n.e(8164)]).then(n.bind(n,98164)).then(e=>e.rust())}),nr.t$.of({name:"Sass",extensions:["sass"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(7941)]).then(n.bind(n,7941)).then(e=>e.sass({indented:!0}))}),nr.t$.of({name:"SCSS",extensions:["scss"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(7941)]).then(n.bind(n,7941)).then(e=>e.sass())}),nr.t$.of({name:"SQL",extensions:["sql"],load:()=>no("StandardSQL")}),nr.t$.of({name:"SQLite",load:()=>no("SQLite")}),nr.t$.of({name:"TSX",extensions:["tsx"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({jsx:!0,typescript:!0}))}),nr.t$.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({typescript:!0}))}),nr.t$.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>Promise.all([n.e(7906),n.e(7584)]).then(n.bind(n,77584)).then(e=>e.wast())}),nr.t$.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>Promise.all([n.e(7906),n.e(8294)]).then(n.bind(n,95913)).then(e=>e.xml())}),nr.t$.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>Promise.all([n.e(7906),n.e(6700)]).then(n.bind(n,46700)).then(e=>e.yaml())}),nr.t$.of({name:"APL",extensions:["dyalog","apl"],load:()=>n.e(5791).then(n.bind(n,35791)).then(e=>ni(e.apl))}),nr.t$.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>n.e(7750).then(n.bind(n,87750)).then(e=>ni(e.asciiArmor))}),nr.t$.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>n.e(1121).then(n.bind(n,41121)).then(e=>ni(e.asn1({})))}),nr.t$.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>n.e(3336).then(n.bind(n,53336)).then(e=>ni(e.asterisk))}),nr.t$.of({name:"Brainfuck",extensions:["b","bf"],load:()=>n.e(8127).then(n.bind(n,88127)).then(e=>ni(e.brainfuck))}),nr.t$.of({name:"Cobol",extensions:["cob","cpy"],load:()=>n.e(4867).then(n.bind(n,4867)).then(e=>ni(e.cobol))}),nr.t$.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.csharp))}),nr.t$.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"ClojureScript",extensions:["cljs"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>n.e(3819).then(n.bind(n,73819)).then(e=>ni(e.gss))}),nr.t$.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>n.e(7507).then(n.bind(n,47507)).then(e=>ni(e.cmake))}),nr.t$.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>n.e(1191).then(n.bind(n,71191)).then(e=>ni(e.coffeeScript))}),nr.t$.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>n.e(293).then(n.bind(n,20293)).then(e=>ni(e.commonLisp))}),nr.t$.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>n.e(5491).then(n.bind(n,65491)).then(e=>ni(e.cypher))}),nr.t$.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>n.e(8082).then(n.bind(n,78082)).then(e=>ni(e.cython))}),nr.t$.of({name:"Crystal",extensions:["cr"],load:()=>n.e(6730).then(n.bind(n,36730)).then(e=>ni(e.crystal))}),nr.t$.of({name:"D",extensions:["d"],load:()=>n.e(540).then(n.bind(n,70540)).then(e=>ni(e.d))}),nr.t$.of({name:"Dart",extensions:["dart"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.dart))}),nr.t$.of({name:"diff",extensions:["diff","patch"],load:()=>n.e(5771).then(n.bind(n,85771)).then(e=>ni(e.diff))}),nr.t$.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>n.e(7398).then(n.bind(n,47398)).then(e=>ni(e.dockerFile))}),nr.t$.of({name:"DTD",extensions:["dtd"],load:()=>n.e(3820).then(n.bind(n,73820)).then(e=>ni(e.dtd))}),nr.t$.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>n.e(882).then(n.bind(n,80882)).then(e=>ni(e.dylan))}),nr.t$.of({name:"EBNF",load:()=>n.e(1695).then(n.bind(n,14076)).then(e=>ni(e.ebnf))}),nr.t$.of({name:"ECL",extensions:["ecl"],load:()=>n.e(5700).then(n.bind(n,5700)).then(e=>ni(e.ecl))}),nr.t$.of({name:"edn",extensions:["edn"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"Eiffel",extensions:["e"],load:()=>n.e(5627).then(n.bind(n,15627)).then(e=>ni(e.eiffel))}),nr.t$.of({name:"Elm",extensions:["elm"],load:()=>n.e(7292).then(n.bind(n,97292)).then(e=>ni(e.elm))}),nr.t$.of({name:"Erlang",extensions:["erl"],load:()=>n.e(1855).then(n.bind(n,51855)).then(e=>ni(e.erlang))}),nr.t$.of({name:"Esper",load:()=>n.e(7600).then(n.bind(n,77600)).then(e=>ni(e.esper))}),nr.t$.of({name:"Factor",extensions:["factor"],load:()=>n.e(2095).then(n.bind(n,12095)).then(e=>ni(e.factor))}),nr.t$.of({name:"FCL",load:()=>n.e(6257).then(n.bind(n,16257)).then(e=>ni(e.fcl))}),nr.t$.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>n.e(319).then(n.bind(n,50319)).then(e=>ni(e.forth))}),nr.t$.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>n.e(690).then(n.bind(n,60690)).then(e=>ni(e.fortran))}),nr.t$.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.fSharp))}),nr.t$.of({name:"Gas",extensions:["s"],load:()=>n.e(953).then(n.bind(n,953)).then(e=>ni(e.gas))}),nr.t$.of({name:"Gherkin",extensions:["feature"],load:()=>n.e(7530).then(n.bind(n,47530)).then(e=>ni(e.gherkin))}),nr.t$.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>n.e(918).then(n.bind(n,60918)).then(e=>ni(e.groovy))}),nr.t$.of({name:"Haskell",extensions:["hs"],load:()=>n.e(7340).then(n.bind(n,57340)).then(e=>ni(e.haskell))}),nr.t$.of({name:"Haxe",extensions:["hx"],load:()=>n.e(9856).then(n.bind(n,79856)).then(e=>ni(e.haxe))}),nr.t$.of({name:"HXML",extensions:["hxml"],load:()=>n.e(9856).then(n.bind(n,79856)).then(e=>ni(e.hxml))}),nr.t$.of({name:"HTTP",load:()=>n.e(6868).then(n.bind(n,76868)).then(e=>ni(e.http))}),nr.t$.of({name:"IDL",extensions:["pro"],load:()=>n.e(1515).then(n.bind(n,1515)).then(e=>ni(e.idl))}),nr.t$.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>n.e(939).then(n.bind(n,40939)).then(e=>ni(e.jsonld))}),nr.t$.of({name:"Julia",extensions:["jl"],load:()=>n.e(4169).then(n.bind(n,34169)).then(e=>ni(e.julia))}),nr.t$.of({name:"Kotlin",extensions:["kt","kts"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.kotlin))}),nr.t$.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>n.e(121).then(n.bind(n,70121)).then(e=>ni(e.liveScript))}),nr.t$.of({name:"Lua",extensions:["lua"],load:()=>n.e(9730).then(n.bind(n,89730)).then(e=>ni(e.lua))}),nr.t$.of({name:"mIRC",extensions:["mrc"],load:()=>n.e(9657).then(n.bind(n,99657)).then(e=>ni(e.mirc))}),nr.t$.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>n.e(20).then(n.bind(n,30020)).then(e=>ni(e.mathematica))}),nr.t$.of({name:"Modelica",extensions:["mo"],load:()=>n.e(2056).then(n.bind(n,42056)).then(e=>ni(e.modelica))}),nr.t$.of({name:"MUMPS",extensions:["mps"],load:()=>n.e(324).then(n.bind(n,90324)).then(e=>ni(e.mumps))}),nr.t$.of({name:"Mbox",extensions:["mbox"],load:()=>n.e(8020).then(n.bind(n,88020)).then(e=>ni(e.mbox))}),nr.t$.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>n.e(5256).then(n.bind(n,45256)).then(e=>ni(e.nginx))}),nr.t$.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>n.e(3983).then(n.bind(n,43983)).then(e=>ni(e.nsis))}),nr.t$.of({name:"NTriples",extensions:["nt","nq"],load:()=>n.e(2631).then(n.bind(n,42631)).then(e=>ni(e.ntriples))}),nr.t$.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.objectiveC))}),nr.t$.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.objectiveCpp))}),nr.t$.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.oCaml))}),nr.t$.of({name:"Octave",extensions:["m"],load:()=>n.e(920).then(n.bind(n,60920)).then(e=>ni(e.octave))}),nr.t$.of({name:"Oz",extensions:["oz"],load:()=>n.e(3741).then(n.bind(n,83741)).then(e=>ni(e.oz))}),nr.t$.of({name:"Pascal",extensions:["p","pas"],load:()=>n.e(7568).then(n.bind(n,77568)).then(e=>ni(e.pascal))}),nr.t$.of({name:"Perl",extensions:["pl","pm"],load:()=>n.e(3085).then(n.bind(n,23085)).then(e=>ni(e.perl))}),nr.t$.of({name:"Pig",extensions:["pig"],load:()=>n.e(4096).then(n.bind(n,34096)).then(e=>ni(e.pig))}),nr.t$.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>n.e(7469).then(n.bind(n,67469)).then(e=>ni(e.powerShell))}),nr.t$.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>n.e(21).then(n.bind(n,60021)).then(e=>ni(e.properties))}),nr.t$.of({name:"ProtoBuf",extensions:["proto"],load:()=>n.e(447).then(n.bind(n,447)).then(e=>ni(e.protobuf))}),nr.t$.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>n.e(6516).then(n.bind(n,46516)).then(e=>ni(e.pug))}),nr.t$.of({name:"Puppet",extensions:["pp"],load:()=>n.e(158).then(n.bind(n,60158)).then(e=>ni(e.puppet))}),nr.t$.of({name:"Q",extensions:["q"],load:()=>n.e(4347).then(n.bind(n,4347)).then(e=>ni(e.q))}),nr.t$.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>n.e(2694).then(n.bind(n,12694)).then(e=>ni(e.r))}),nr.t$.of({name:"RPM Changes",load:()=>n.e(1965).then(n.bind(n,31965)).then(e=>ni(e.rpmChanges))}),nr.t$.of({name:"RPM Spec",extensions:["spec"],load:()=>n.e(1965).then(n.bind(n,31965)).then(e=>ni(e.rpmSpec))}),nr.t$.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>n.e(4148).then(n.bind(n,64148)).then(e=>ni(e.ruby))}),nr.t$.of({name:"SAS",extensions:["sas"],load:()=>n.e(4021).then(n.bind(n,94021)).then(e=>ni(e.sas))}),nr.t$.of({name:"Scala",extensions:["scala"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.scala))}),nr.t$.of({name:"Scheme",extensions:["scm","ss"],load:()=>n.e(4883).then(n.bind(n,34883)).then(e=>ni(e.scheme))}),nr.t$.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>n.e(9090).then(n.bind(n,39090)).then(e=>ni(e.shell))}),nr.t$.of({name:"Sieve",extensions:["siv","sieve"],load:()=>n.e(1766).then(n.bind(n,41766)).then(e=>ni(e.sieve))}),nr.t$.of({name:"Smalltalk",extensions:["st"],load:()=>n.e(4953).then(n.bind(n,34953)).then(e=>ni(e.smalltalk))}),nr.t$.of({name:"Solr",load:()=>n.e(1296).then(n.bind(n,81296)).then(e=>ni(e.solr))}),nr.t$.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.sml))}),nr.t$.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>n.e(5457).then(n.bind(n,25457)).then(e=>ni(e.sparql))}),nr.t$.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>n.e(397).then(n.bind(n,72778)).then(e=>ni(e.spreadsheet))}),nr.t$.of({name:"Squirrel",extensions:["nut"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.squirrel))}),nr.t$.of({name:"Stylus",extensions:["styl"],load:()=>n.e(9642).then(n.bind(n,89642)).then(e=>ni(e.stylus))}),nr.t$.of({name:"Swift",extensions:["swift"],load:()=>n.e(3479).then(n.bind(n,43479)).then(e=>ni(e.swift))}),nr.t$.of({name:"sTeX",load:()=>n.e(1790).then(n.bind(n,21790)).then(e=>ni(e.stex))}),nr.t$.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>n.e(1790).then(n.bind(n,21790)).then(e=>ni(e.stex))}),nr.t$.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>n.e(986).then(n.bind(n,90986)).then(e=>ni(e.verilog))}),nr.t$.of({name:"Tcl",extensions:["tcl"],load:()=>n.e(7047).then(n.bind(n,57047)).then(e=>ni(e.tcl))}),nr.t$.of({name:"Textile",extensions:["textile"],load:()=>n.e(8769).then(n.bind(n,78769)).then(e=>ni(e.textile))}),nr.t$.of({name:"TiddlyWiki",load:()=>n.e(1856).then(n.bind(n,51856)).then(e=>ni(e.tiddlyWiki))}),nr.t$.of({name:"Tiki wiki",load:()=>n.e(5247).then(n.bind(n,85247)).then(e=>ni(e.tiki))}),nr.t$.of({name:"TOML",extensions:["toml"],load:()=>n.e(5496).then(n.bind(n,55496)).then(e=>ni(e.toml))}),nr.t$.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>n.e(5199).then(n.bind(n,75199)).then(e=>ni(e.troff))}),nr.t$.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>n.e(4173).then(n.bind(n,14173)).then(e=>ni(e.ttcn))}),nr.t$.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>n.e(2778).then(n.bind(n,42778)).then(e=>ni(e.ttcnCfg))}),nr.t$.of({name:"Turtle",extensions:["ttl"],load:()=>n.e(2606).then(n.bind(n,22606)).then(e=>ni(e.turtle))}),nr.t$.of({name:"Web IDL",extensions:["webidl"],load:()=>n.e(2402).then(n.bind(n,82402)).then(e=>ni(e.webIDL))}),nr.t$.of({name:"VB.NET",extensions:["vb"],load:()=>n.e(1476).then(n.bind(n,61476)).then(e=>ni(e.vb))}),nr.t$.of({name:"VBScript",extensions:["vbs"],load:()=>n.e(3907).then(n.bind(n,23907)).then(e=>ni(e.vbScript))}),nr.t$.of({name:"Velocity",extensions:["vtl"],load:()=>n.e(4987).then(n.bind(n,37368)).then(e=>ni(e.velocity))}),nr.t$.of({name:"Verilog",extensions:["v"],load:()=>n.e(986).then(n.bind(n,90986)).then(e=>ni(e.verilog))}),nr.t$.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>n.e(2394).then(n.bind(n,72394)).then(e=>ni(e.vhdl))}),nr.t$.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>n.e(9100).then(n.bind(n,79100)).then(e=>ni(e.xQuery))}),nr.t$.of({name:"Yacas",extensions:["ys"],load:()=>n.e(339).then(n.bind(n,50339)).then(e=>ni(e.yacas))}),nr.t$.of({name:"Z80",extensions:["z80"],load:()=>n.e(422).then(n.bind(n,40422)).then(e=>ni(e.z80))}),nr.t$.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.mscgen))}),nr.t$.of({name:"X\xf9",extensions:["xu"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.xu))}),nr.t$.of({name:"MsGenny",extensions:["msgenny"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.msgenny))}),nr.t$.of({name:"Vue",extensions:["vue"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(4900)]).then(n.bind(n,34900)).then(e=>e.vue())}),nr.t$.of({name:"Angular Template",load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(9599)]).then(n.bind(n,49599)).then(e=>e.angular())})];var na=n(70638),ns=n(35445),nc=n(67080);class nd{constructor(e,t,n={}){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,i){let o=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);o+=n[0].slice(e+n[1].length);let t=(r+=e)-i;t>0&&(o=n[0].slice(e-t,e)+o,r=i)}return t.tr.insertText(o,r,i)}}(t):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}let nu=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i=n[r],o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};function nh(e,t,n=null,r){return new nd(e,(e,i,o,l)=>{let a=n instanceof Function?n(i):n,s=e.tr.delete(o,l),c=s.doc.resolve(o).blockRange(),d=c&&(0,nc.oM)(c,t,a);if(!d)return null;s.wrap(c,d);let u=s.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&(0,nc.n9)(s.doc,o-1)&&(!r||r(i,u))&&s.join(o-1),s})}function np(e,t,n=null){return new nd(e,(e,r,i,o)=>{let l=e.doc.resolve(i),a=n instanceof Function?n(r):n;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,a):null})}new nd(/--$/,"—",{inCodeMark:!1}),new nd(/\.\.\.$/,"…",{inCodeMark:!1}),new nd(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new nd(/"$/,"”",{inCodeMark:!1}),new nd(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new nd(/'$/,"’",{inCodeMark:!1});var nf=((k={}).docTypeError="docTypeError",k.contextNotFound="contextNotFound",k.timerNotFound="timerNotFound",k.ctxCallOutOfScope="ctxCallOutOfScope",k.createNodeInParserFail="createNodeInParserFail",k.stackOverFlow="stackOverFlow",k.parserMatchError="parserMatchError",k.serializerMatchError="serializerMatchError",k.getAtomFromSchemaFail="getAtomFromSchemaFail",k.expectDomTypeError="expectDomTypeError",k.callCommandBeforeEditorView="callCommandBeforeEditorView",k.missingRootElement="missingRootElement",k.missingNodeInSchema="missingNodeInSchema",k.missingMarkInSchema="missingMarkInSchema",k.ctxNotBind="ctxNotBind",k.missingYjsDoc="missingYjsDoc",k),nm=class extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}},ng=(e,t)=>"function"==typeof t?"[Function]":t;function nv(){return new nm(nf.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function ny(){return new nm(nf.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function nw(e){return new nm(nf.expectDomTypeError,`Expect to be a dom, but get: ${JSON.stringify(e,ng)}.`)}function nb(){return new nm(nf.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function nk(e){return new nm(nf.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}let nC="u">typeof navigator?navigator:null,nx="u">typeof document?document:null,nS=nC&&nC.userAgent||"",nM=/Edge\/(\d+)/.exec(nS),nT=/MSIE \d/.exec(nS),nN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nS),nA=!!(nT||nN||nM),nO=nT?document.documentMode:nN?+nN[1]:nM?+nM[1]:0,nI=!nA&&/gecko\/(\d+)/i.test(nS),nE=nI&&+(/Firefox\/(\d+)/.exec(nS)||[0,0])[1],n_=!nA&&/Chrome\/(\d+)/.exec(nS),nR=!!n_,nL=n_?+n_[1]:0,nP=!nA&&!!nC&&/Apple Computer/.test(nC.vendor),n$=nP&&(/Mobile\/\w+/.test(nS)||!!nC&&nC.maxTouchPoints>2),nD=n$||!!nC&&/Mac/.test(nC.platform),nj=/Android \d/.test(nS),nF=!!nx&&"webkitFontSmoothing"in nx.documentElement.style,nB=nF?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var nH=Object.freeze({__proto__:null,android:nj,chrome:nR,chrome_version:nL,gecko:nI,gecko_version:nE,ie:nA,ie_version:nO,ios:n$,mac:nD,safari:nP,webkit:nF,webkit_version:nB});function nz(e,t,n,r,i,o){if(e.composing)return!1;let l=e.state,a=l.doc.resolve(t);if(a.parent.type.spec.code)return!1;let s=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){let i=a.match.exec(s),c=i&&i[0]&&a.handler(l,i,t-(i[0].length-r.length),n);if(c)return!1!==a.undoable&&c.setMeta(o,{transform:c,from:t,to:n,text:r}),e.dispatch(c),!0}return!1}let nq=new ns.hs("MILKDOWN_CUSTOM_INPUTRULES");function nK(e,t,n={}){return new nd(e,(e,r,i,o)=>{var l,a,s,c;let d,{tr:u}=e,h=r.length,p=r[h-1],f=r[0],m=[],g={group:p,fullMatch:f,start:i,end:o},v=null==(l=n.updateCaptured)?void 0:l.call(n,g);if(Object.assign(g,v),{group:p,fullMatch:f,start:i,end:o}=g,null===f||(null==p?void 0:p.trim())==="")return null;if(p){let e=f.search(/\S/),l=i+f.indexOf(p),h=l+p.length;m=null!=(a=u.storedMarks)?a:[],h<o&&u.delete(h,o),l>i&&u.delete(i+e,l),d=i+e+p.length;let g=null==(s=n.getAttr)?void 0:s.call(n,r);u.addMark(i,d,t.create(g)),u.setStoredMarks(m),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:i,end:o,tr:u})}return u})}var nW=Object.defineProperty,nU=Object.defineProperties,nV=Object.getOwnPropertyDescriptors,nJ=Object.getOwnPropertySymbols,nG=Object.prototype.hasOwnProperty,nZ=Object.prototype.propertyIsEnumerable,nY=(e,t,n)=>t in e?nW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function nX(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nQ(e,t,n){let r=e.state.doc.content.size,i=nX(t,0,r),o=nX(n,0,r),l=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),s=Math.min(l.top,a.top),c=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),u=Math.max(l.right,a.right),h={top:s,bottom:c,left:d,right:u,width:u-d,height:c-s,x:d,y:s};return nU(((e,t)=>{for(var n in t||(t={}))nG.call(t,n)&&nY(e,n,t[n]);if(nJ)for(var n of nJ(t))nZ.call(t,n)&&nY(e,n,t[n]);return e})({},h),nV({toJSON:()=>h}))}function n1(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function n0(e){return t=>{for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{from:t.before(n),to:t.after(n),node:r}}}}function n2(e){return t=>{for(let n=t.depth;n>0;n--){let r=t.node(n);if(e(r))return{pos:t.before(n),start:t.start(n),depth:n,node:r}}}}let n5=(e,t)=>{let{selection:n,doc:r}=e;if(n instanceof ns.nh)return{hasNode:n.node.type===t,pos:n.from,target:n.node};let{from:i,to:o}=n,l=!1,a=-1,s=null;return r.nodesBetween(i,o,(e,n)=>!s&&(e.type!==t||(l=!0,a=n,s=e,!1))),{hasNode:l,pos:a,target:s}};var n3=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){var n;throw n="string"==typeof e?e:e.name,new nm(nf.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}return t},this.remove=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},n9=class{#e=[];#t;#n=()=>{this.#e.forEach(e=>e(this.#t))};constructor(e,t,n){this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},n7=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw nv()}}create(e,t=this._defaultValue){return new n9(e,t,this)}},n4=(e,t)=>new n7(e,t),n8=class{#r;#i;#o;#l=new Set;#a=new Set;#s=new Map;#c=new Map;constructor(e,t,n){this.read=()=>({metadata:this.#r,injectedSlices:[...this.#l].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),consumedSlices:[...this.#a].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),recordedTimers:[...this.#s].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)})),waitTimers:[...this.#c].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)}))}),this.onRecord=e=>{this.#s.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#s.delete(e)},this.onDone=e=>{let t=this.#s.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{let n=Date.now();t.finally(()=>{this.#c.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#l.add(e)},this.onRemove=e=>{this.#l.delete(e)},this.onUse=e=>{this.#a.add(e)},this.#i=e,this.#o=t,this.#r=n}#d=e=>this.#i.get(e).get();#u=e=>this.#o.get(e).status},n6=class e{#i;#o;#r;#h;constructor(t,n,r){this.produce=t=>t&&Object.keys(t).length?new e(this.#i,this.#o,{...t}):this,this.inject=(e,t)=>{let n=e.create(this.#i.sliceMap);return null!=t&&n.set(t),this.#h?.onInject(e),this},this.remove=e=>(this.#i.remove(e),this.#h?.onRemove(e),this),this.record=e=>(e.create(this.#o.store),this.#h?.onRecord(e),this),this.clearTimer=e=>(this.#o.remove(e),this.#h?.onClear(e),this),this.isInjected=e=>this.#i.has(e),this.isRecorded=e=>this.#o.has(e),this.use=e=>(this.#h?.onUse(e),this.#i.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#o.get(e),this.done=e=>{this.timer(e).done(),this.#h?.onDone(e)},this.wait=e=>{let t=this.timer(e).start();return this.#h?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#i=t,this.#o=n,this.#r=r,r&&(this.#h=new n8(t,n,r))}get meta(){return this.#r}get inspector(){return this.#h}},re=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t){var n;throw n=e.name,new nm(nf.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},rt=class{#p=null;#f=null;#m;#g="pending";constructor(e,t){this.start=()=>(this.#p??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#m&&(this.#g="resolved",this.#v(),t.stopImmediatePropagation(),e())},this.#y(()=>{"pending"===this.#g&&(this.#g="rejected"),this.#v(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#g="pending",addEventListener(this.type.name,this.#f)}),this.#p),this.done=()=>{dispatchEvent(new CustomEvent(this.type.name,{detail:{id:this.#m}}))},this.#m=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#g}#v=()=>{this.#f&&removeEventListener(this.type.name,this.#f)};#y=e=>{setTimeout(()=>{e()},this.type.timeout)}},rn=class{constructor(e,t=3e3){this.create=e=>new rt(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},rr=(e,t=3e3)=>new rn(e,t),ri=n(4949),ro=n(18545);let rl={}.hasOwnProperty;var ra=n(48433),rs=n(91565),rc=n(12944);let rd=[function(e,t,n,r){if("code"===t.type&&(0,rs.m)(t,r)&&("list"===e.type||e.type===t.type&&(0,rs.m)(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&(0,rc.f)(t,r)))return;return+!!n.spread}}],ru=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],rh=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ru},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"+",after:"(?:[ \r\n])"},{atBreak:!0,character:"-",after:"(?:[ \r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ru},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ru},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"~"}];var rp=n(97930);function rf(e){return e.label||!e.identifier?e.label||"":(0,rp.s)(e.identifier)}function rm(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}var rg=n(88093);let rv=/\r?\n|\r/g;function ry(e,t){let n,r=[],i=0,o=0;for(;n=rv.exec(e);)l(e.slice(i,n.index)),r.push(n[0]),i=n.index+n[0].length,o++;return l(e.slice(i)),r.join("");function l(e){r.push(t(e,o,!e))}}var rw=n(62018);function rb(e,t){return e-t}function rk(e,t){let n,r=/\\(?=[!-/:-@[-`{-~])/g,i=[],o=[],l=e+t,a=-1,s=0;for(;n=r.exec(l);)i.push(n.index);for(;++a<i.length;)s!==i[a]&&o.push(e.slice(s,i[a])),o.push("\\"),s=i[a];return o.push(e.slice(s)),o.join("")}function rC(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,o=n.column||1;return{move:function(e){let t=e||"",n=t.split(/\r?\n|\r/g),l=n[n.length-1];return i+=n.length-1,o=1===n.length?o+l.length:1+l.length+r,t},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function rx(e){throw Error("Cannot handle value `"+e+"`, expected node")}function rS(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function rM(e,t){if("definition"===e.type&&e.type===t.type)return 0}function rT(e,t){return function(e,t,n){let r,i=t.indexStack,o=e.children||[],l=[],a=-1,s=n.before;i.push(-1);let c=t.createTracker(n);for(;++a<o.length;){let d,u=o[a];if(i[i.length-1]=a,a+1<o.length){let n=t.handle.handlers[o[a+1].type];n&&n.peek&&(n=n.peek),d=n?n(o[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;l.length>0&&("\r"===s||"\n"===s)&&"html"===u.type&&(l[l.length-1]=l[l.length-1].replace(/(\r?\n|\r)$/," "),s=" ",(c=t.createTracker(n)).move(l.join("")));let h=t.handle(u,e,t,{...c.current(),after:d,before:s});r&&r===h.slice(0,1)&&(h=(0,rg.T)(r.charCodeAt(0))+h.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,r=void 0,p&&(l.length>0&&p.before&&s===l[l.length-1].slice(-1)&&(l[l.length-1]=l[l.length-1].slice(0,-1)+(0,rg.T)(s.charCodeAt(0))),p.after&&(r=d)),c.move(h),l.push(h),s=h.slice(-1)}return i.pop(),l.join("")}(e,this,t)}function rN(e,t){return function(e,t,n){let r=t.indexStack,i=e.children||[],o=t.createTracker(n),l=[],a=-1;for(r.push(-1);++a<i.length;){let n=i[a];r[r.length-1]=a,l.push(o.move(t.handle(n,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&l.push(o.move(function(e,t,n,r){let i=r.join.length;for(;i--;){let o=r.join[i](e,t,n,r);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}(n,i[a+1],e,t)))}return r.pop(),l.join("")}(e,this,t)}function rA(e,t){return function(e,t,n){let r=(n.before||"")+(t||"")+(n.after||""),i=[],o=[],l={},a=-1;for(;++a<e.unsafe.length;){let t,n=e.unsafe[a];if(!(0,rw.q)(e.stack,n))continue;let o=e.compilePattern(n);for(;t=o.exec(r);){let e="before"in n||!!n.atBreak,r="after"in n,o=t.index+(e?t[1].length:0);i.includes(o)?(l[o].before&&!e&&(l[o].before=!1),l[o].after&&!r&&(l[o].after=!1)):(i.push(o),l[o]={before:e,after:r})}}i.sort(rb);let s=n.before?n.before.length:0,c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){let e=i[a];!(e<s)&&!(e>=c)&&(!(e+1<c)||i[a+1]!==e+1||!l[e].after||l[e+1].before||l[e+1].after)&&(i[a-1]!==e-1||!l[e].before||l[e-1].before||l[e-1].after)&&(s!==e&&o.push(rk(r.slice(s,e),"\\")),s=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(o.push((0,rg.T)(r.charCodeAt(e))),s++):o.push("\\"))}return o.push(rk(r.slice(s,c),n.after)),o.join("")}(this,e,t)}function rO(e){let t=this;t.compiler=function(n){var r;let i,o;return r={...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]},!function e(t,n){var r,i,o,l;let a,s=-1;if(n.extensions)for(;++s<n.extensions.length;)e(t,n.extensions[s]);for(a in n)if(rl.call(n,a))switch(a){case"extensions":break;case"unsafe":case"join":r=t[a],(i=n[a])&&r.push(...i);break;case"handlers":o=t[a],(l=n[a])&&Object.assign(o,l);break;default:t.options[a]=n[a]}return t}(i={associationId:rf,containerPhrasing:rT,containerFlow:rN,createTracker:rC,compilePattern:rm,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...ra.p},handle:void 0,indentLines:ry,indexStack:[],join:[...rd],options:{},safe:rA,stack:[],unsafe:[...rh]},r||{}),i.options.tightDefinitions&&i.join.push(rM),i.handle=(0,ro.A)("type",{invalid:rx,unknown:rS,handlers:i.handlers}),(o=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0}))&&10!==o.charCodeAt(o.length-1)&&13!==o.charCodeAt(o.length-1)&&(o+="\n"),o}}var rI=n(28972),rE=n(32545);let r_=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function rR(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let rL=(e,t,n)=>{let r=rR(e,n);if(!r)return!1;let i=rj(r);if(!i){let n=r.blockRange(),i=n&&(0,nc.jP)(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(rz(e,i,t,-1))return!0;if(0==r.parent.content.size&&(r$(o,"end")||ns.nh.isSelectable(o)))for(let n=r.depth;;n--){let l=(0,nc.$L)(e.doc,r.before(n),r.after(n),rE.Ji.empty);if(l&&l.slice.size<l.to-l.from){if(t){let n=e.tr.step(l);n.setSelection(r$(o,"end")?ns.LN.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):ns.nh.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},rP=(e,t,n)=>{let r=rR(e,n);if(!r)return!1;let i=rj(r);return!!i&&function(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,l=t.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=(0,nc.$L)(e.doc,i,l,rE.Ji.empty);if(!a||a.from!=i||a instanceof nc.Ln&&a.slice.size>=l-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(ns.U3.create(t.doc,i)),n(t.scrollIntoView())}return!0}(e,i,t)};function r$(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let rD=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=rj(r)}let l=o&&o.nodeBefore;return!!l&&!!ns.nh.isSelectable(l)&&(t&&t(e.tr.setSelection(ns.nh.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function rj(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function rF(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function rB(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let rH=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),l=rB(i.contentMatchAt(o));if(!l||!i.canReplaceWith(o,o,l))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,l.createAndFill());i.setSelection(ns.LN.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0};function rz(e,t,n,r){let i,o,l,a=t.nodeBefore,s=t.nodeAfter,c,d,u=a.type.spec.isolating||s.type.spec.isolating;if(!u&&(i=t.nodeBefore,o=t.nodeAfter,l=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(l-1,l)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(l,l+1)&&!!(o.isTextblock||(0,nc.n9)(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let h=!u&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(c=(d=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&d.matchType(c[0]||s.type).validEnd){if(n){let r=t.pos+s.nodeSize,i=rE.FK.empty;for(let e=c.length-1;e>=0;e--)i=rE.FK.from(c[e].create(null,i));i=rE.FK.from(a.copy(i));let o=e.tr.step(new nc.Wg(t.pos-1,r,t.pos,r,new rE.Ji(i,1,0),c.length,!0)),l=o.doc.resolve(r+2*c.length);l.nodeAfter&&l.nodeAfter.type==a.type&&(0,nc.n9)(o.doc,l.pos)&&o.join(l.pos),n(o.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&u?null:ns.LN.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&(0,nc.jP)(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(h&&r$(s,"start",!0)&&r$(a,"end")){let r=a,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=s,l=1;for(;!o.isTextblock;o=o.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=rE.FK.empty;for(let e=i.length-1;e>=0;e--)r=rE.FK.from(i[e].copy(r));n(e.tr.step(new nc.Wg(t.pos-i.length,t.pos+s.nodeSize,t.pos+l,t.pos+s.nodeSize-l,new rE.Ji(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function rq(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(ns.U3.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let rK=rq(-1),rW=rq(1);function rU(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,l=i.blockRange(o),a=l&&(0,nc.oM)(l,e,t);return!!a&&(r&&r(n.tr.wrap(l,a).scrollIntoView()),!0)}}function rV(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[r];n.doc.nodesBetween(o,l,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[r];i.setBlockType(o,l,e,t)}r(i.scrollIntoView())}return!0}}function rJ(e,t=null,n){let r=!1!==(n&&n.removeWhenPresent),i=!1!==(n&&n.enterInlineAtoms),o=!(n&&n.includeWhitespace);return function(n,l){let{empty:a,$cursor:s,ranges:c}=n.selection;if(a&&!s||!function(e,t,n,r){for(let i=0;i<t.length;i++){let{$from:o,$to:l}=t[i],a=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,l.pos,(e,t)=>{if(a||!r&&e.isAtom&&e.isInline&&t>=o.pos&&t+e.nodeSize<=l.pos)return!1;a=e.inlineContent&&e.type.allowsMarkType(n)}),a)return!0}return!1}(n.doc,c,e,i))return!1;if(l)if(s)l(e.isInSet(n.storedMarks||s.marks())?n.tr.removeStoredMark(e):n.tr.addStoredMark(e.create(t)));else{let a,s=n.tr;i||(c=function(e){let t=[];for(let n=0;n<e.length;n++){let{$from:r,$to:i}=e[n];r.doc.nodesBetween(r.pos,i.pos,(e,n)=>{if(e.isAtom&&e.content.size&&e.isInline&&n>=r.pos&&n+e.nodeSize<=i.pos)return n+1>r.pos&&t.push(new ns.yn(r,r.doc.resolve(n+1))),r=r.doc.resolve(n+1+e.content.size),!1}),r.pos<i.pos&&t.push(new ns.yn(r,i))}return t}(c)),a=r?!c.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)):!c.every(t=>{let n=!1;return s.doc.nodesBetween(t.$from.pos,t.$to.pos,(r,i,o)=>{if(n)return!1;n=!e.isInSet(r.marks)&&!!o&&o.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-i),Math.min(r.nodeSize,t.$to.pos-i))))}),!n});for(let n=0;n<c.length;n++){let{$from:r,$to:i}=c[n];if(a){let n=r.pos,l=i.pos,a=r.nodeAfter,c=i.nodeBefore,d=o&&a&&a.isText?/^\s*/.exec(a.text)[0].length:0,u=o&&c&&c.isText?/\s*$/.exec(c.text)[0].length:0;n+d<l&&(n+=d,l-=u),s.addMark(n,l,e.create(t))}else s.removeMark(r.pos,i.pos,e)}l(s.scrollIntoView())}return!0}}function rG(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let rZ=rG(r_,rL,rD),rY=rG(r_,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}(e,n);if(!r)return!1;let i=rF(r);if(!i)return!1;let o=i.nodeAfter;if(rz(e,i,t,1))return!0;if(0==r.parent.content.size&&(r$(o,"start")||ns.nh.isSelectable(o))){let n=(0,nc.$L)(e.doc,r.before(),r.after(),rE.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(r$(o,"start")?ns.LN.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):ns.nh.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=rF(r)}let l=o&&o.nodeAfter;return!!l&&!!ns.nh.isSelectable(l)&&(t&&t(e.tr.setSelection(ns.nh.create(e.doc,o.pos)).scrollIntoView()),!0)}),rX={Enter:rG((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof ns.i5||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=rB(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=e.tr.insert(n,o.createAndFill());l.setSelection(ns.U3.create(l.doc,n+1)),t(l.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if((0,nc.zy)(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&(0,nc.jP)(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof ns.nh&&e.selection.node.isBlock)return!!n.parentOffset&&!!(0,nc.zy)(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,l,a=!1,s=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),s=n.start(e)==n.pos-(n.depth-e),l=rB(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&l?{type:l}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof ns.U3||e.selection instanceof ns.i5)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=(0,nc.zy)(c.doc,d,i.length,i);if(u||(i[0]=l?{type:l}:null,u=(0,nc.zy)(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&s&&n.node(o).type!=l){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);l&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,l)&&c.setNodeMarkup(c.mapping.map(n.before(o)),l)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":rH,Backspace:rZ,"Mod-Backspace":rZ,"Shift-Backspace":rZ,Delete:rY,"Mod-Delete":rY,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new ns.i5(e.doc))),!0)},rQ={"Ctrl-h":rX.Backspace,"Alt-Backspace":rX["Mod-Backspace"],"Ctrl-d":rX.Delete,"Ctrl-Alt-Backspace":rX["Mod-Delete"],"Alt-Delete":rX["Mod-Delete"],"Alt-d":rX["Mod-Delete"],"Ctrl-a":rK,"Ctrl-e":rW};for(let e in rX)rQ[e]=rX[e];let r1=("u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&!!os.platform&&"darwin"==os.platform())?rQ:rX;var r0=n(96455);let r2="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),r5="u">typeof navigator&&/Win/.test(navigator.platform);function r3(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function r9(e){return new ns.k_({props:{handleKeyDown:r7(e)}})}function r7(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),l=o[o.length-1];"Space"==l&&(l=" ");for(let e=0;e<o.length-1;e++){let l=o[e];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))r2?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+l)}return t&&(l="Alt-"+l),n&&(l="Ctrl-"+l),i&&(l="Meta-"+l),r&&(l="Shift-"+l),l}(n)]=e[n];return t}(e);return function(e,n){let r=(0,r0.xT)(n),i,o=t[r3(r,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==r.length&&" "!=r){if(n.shiftKey){let i=t[r3(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(r5&&n.ctrlKey&&n.altKey)&&(i=r0.E3[n.keyCode])&&i!=r){let r=t[r3(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var r4=class{},r8=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw ny();return e}}},r6=class e extends r4{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},ie=class extends r8{#w=rE.CU.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(r6.create(e,[],t)),this),this.closeNode=()=>{try{this.#b()}catch(e){console.error(e)}return this},this.addNode=(e,t,n)=>{try{this.#k(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>(this.#w=e.create(t).addToSet(this.#w),this),this.closeMark=e=>(this.#w=e.removeFromSet(this.#w),this),this.addText=e=>{try{let t=this.top();if(!t)throw ny();let n=t.pop(),r=this.schema.text(e,this.#w);if(!n)return t.push(r),this;let i=this.#C(n,r);if(i)return t.push(i),this;return t.push(n,r),this}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=this.#b();while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#x(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#S=e=>e.isText;#C=(e,t)=>{if(this.#S(e)&&this.#S(t)&&rE.CU.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)};#M=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t){var n;throw n=e,new nm(nf.parserMatchError,`Cannot match target parser for node: ${JSON.stringify(n,ng)}.`)}return t};#x=e=>{let t=this.#M(e);t.spec.parseMarkdown.runner(this,e,t)};#b=()=>{this.#w=rE.CU.none;let e=this.close();return this.#k(e.type,e.attrs,e.content)};#k=(e,t,n)=>{let r=e.createAndFill(t,n,this.#w);if(!r){let r,i,o;throw r=`Cannot create node for ${"name"in e?e.name:e}`,i=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(i).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},o=[["[Description]",r],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:i(e):"null")]].reduce((e,[t,n])=>{let r=`${t}: ${i(n)}.`;return e.concat(r)},[]),new nm(nf.createNodeInParserFail,o.join("\n"))}return this.push(r),r}},it=class e extends r4{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,i={})=>new e(t,n,r,i)}},ir=class extends r8{#w=rE.CU.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.openNode=(e,t,n)=>(this.open(it.create(e,void 0,t,n)),this),this.closeNode=()=>(this.#b(),this),this.addNode=(e,t,n,r)=>(this.#k(e,t,n,r),this),this.withMark=(e,t,n,r)=>(this.#T(e,t,n,r),this),this.closeMark=e=>(this.#N(e),this),this.build=()=>{let e=null;do e=this.#b();while(this.size());return e},this.next=e=>(Object.prototype.hasOwnProperty.call(e,"size")?e.forEach(e=>{this.#x(e)}):this.#x(e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}#M=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t){var n;throw n=e.type,new nm(nf.serializerMatchError,`Cannot match target serializer for node: ${JSON.stringify(n,ng)}.`)}return t};#A=e=>this.#M(e).spec.toMarkdown.runner(this,e);#O=(e,t)=>this.#M(e).spec.toMarkdown.runner(this,e,t);#x=e=>{let{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!this.#O(t,e))&&this.#A(e),t.forEach(e=>this.#N(e))};#I=(e,t)=>{if(e.type===t||e.children?.length!==1)return e;let n=e=>{if(e.type===t)return null!=e.value?null:e;if(e.children?.length!==1)return null;let[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;let i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r};#E=e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){let{children:n,...i}=t=this.#I(t,r.type),{children:o,...l}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(l)){let t={...l,children:[...o,...n]};return e.slice(0,-1).concat(this.#E(t))}}return e.concat(t)},[])),e};#_=e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t};#R=(e,t)=>{let n="",r="",i=e.children,o=-1,l=-1;if(i){i&&i.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),l=t)});let e=i?.[l],t=i?.[o];if(e&&e.value.endsWith(" ")){let t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){let e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&this.#k("text",void 0,n);let a=t();return r.length&&this.#k("text",void 0,r),a};#b=(e=!1)=>{let t=this.close(),n=()=>this.#k(t.type,t.children,t.value,t.props);return e?this.#R(t,n):n()};#k=(e,t,n,r)=>{let i=it.create(e,t,n,r),o=this.#E(this.#_(i));return this.push(o),o};#T=(e,t,n,r)=>e.isInSet(this.#w)?this:(this.#w=e.addToSet(this.#w),this.openNode(t,n,{...r,isMark:!0}));#N=e=>{e.isInSet(this.#w)&&(this.#w=e.type.removeFromSet(this.#w),this.#b(!0))}},ii=n(85204);function io(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}var il={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||"*",o=n.enter("strong"),l=n.createTracker(r),a=l.move(i+i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i+i),o(),a},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),l=n.createTracker(r),a=l.move(i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i),o(),a}},ia=n4({},"editorView"),is=n4({},"editorState"),ic=n4([],"initTimer"),id=n4({},"editor"),iu=n4([],"inputRules"),ih=n4([],"prosePlugins"),ip=n4([],"remarkPlugins"),im=n4([],"nodeView"),ig=n4([],"markView"),iv=n4((0,rI.l)().use(ri.A).use(rO),"remark"),iy=n4({handlers:il,encode:[]},"remarkStringifyOptions"),iw=rr("ConfigReady"),ib=rr("InitReady"),ik=rr("SchemaReady"),iC=n4([],"schemaTimer"),ix=n4({},"schema"),iS=n4([],"nodes"),iM=n4([],"marks");function iT(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var iN=e=>(e.inject(ix,{}).inject(iS,[]).inject(iM,[]).inject(iC,[ib]).record(ik),async()=>{await e.waitTimers(iC);let t=e.get(iv),n=e.get(ip).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(iv,n);let r=new rE.Sj({nodes:Object.fromEntries(e.get(iS).map(([e,t])=>[e,iT(t)])),marks:Object.fromEntries(e.get(iM).map(([e,t])=>[e,iT(t)]))});return e.set(ix,r),e.done(ik),()=>{e.remove(ix).remove(iS).remove(iM).remove(iC).clearTimer(ik)}});io(iN,{displayName:"Schema"});var iA=class{constructor(){this.setCtx=e=>{this.#L=e},this.chain=()=>{if(null==this.#L)throw nb();let e=this.#L,t=[],n=this.get.bind(this),r={run:()=>{let n=rG(...t),r=e.get(ia);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:(function(e,i){let o=n(e);return t.push(o(i)),r}).bind(this)};return r}}#i=new n3;#L=null;get ctx(){return this.#L}create(e,t){let n=e.create(this.#i.sliceMap);return n.set(t),n}get(e){return this.#i.get(e).get()}remove(e){return this.#i.remove(e)}call(e,t){if(null==this.#L)throw nb();let n=this.get(e)(t),r=this.#L.get(ia);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#L)throw nb();let t=this.#L.get(ia);return e(t.state,t.dispatch,t)}},iO=n4(new iA,"commands"),iI=n4([ik],"commandsTimer"),iE=rr("CommandsReady"),i_=e=>{let t=new iA;return t.setCtx(e),e.inject(iO,t).inject(iI,[ik]).record(iE),async()=>(await e.waitTimers(iI),e.done(iE),()=>{e.remove(iO).remove(iI).clearTimer(iE)})};io(i_,{displayName:"Commands"});var iR=class{constructor(){this.setCtx=e=>{this.#L=e},this.add=e=>(this.#P.push(e),()=>{this.#P=this.#P.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){let r={key:e,onRun:()=>n};this.#P.push(r),t.push(()=>{this.#P=this.#P.filter(e=>e!==r)})}else this.#P.push(n),t.push(()=>{this.#P=this.#P.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=(r1.Backspace=rG(nu,r_,rP,rD),r1);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#P.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{let i=this.#L;if(null==i)throw nv();return rG(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#L=null;#P=[];get ctx(){return this.#L}},iL=n4(new iR,"keymap"),iP=n4([ik],"keymapTimer"),i$=rr("KeymapReady"),iD=e=>{let t=new iR;return t.setCtx(e),e.inject(iL,t).inject(iP,[ik]).record(i$),async()=>(await e.waitTimers(iP),e.done(i$),()=>{e.remove(iL).remove(iP).clearTimer(i$)})},ij=rr("ParserReady"),iF=()=>{throw nv()},iB=n4(iF,"parser"),iH=n4([],"parserTimer"),iz=e=>(e.inject(iB,iF).inject(iH,[ik]).record(ij),async()=>{await e.waitTimers(iH);let t=e.get(iv),n=e.get(ix);return e.set(iB,ie.create(n,t)),e.done(ij),()=>{e.remove(iB).remove(iH).clearTimer(ij)}});io(iz,{displayName:"Parser"});var iq=rr("SerializerReady"),iK=n4([],"serializerTimer"),iW=()=>{throw nv()},iU=n4(iW,"serializer"),iV=e=>(e.inject(iU,iW).inject(iK,[ik]).record(iq),async()=>{await e.waitTimers(iK);let t=e.get(iv),n=e.get(ix);return e.set(iU,ir.create(n,t)),e.done(iq),()=>{e.remove(iU).remove(iK).clearTimer(iq)}});io(iV,{displayName:"Serializer"});var iJ=n4("","defaultValue"),iG=n4(e=>e,"stateOptions"),iZ=n4([],"editorStateTimer"),iY=rr("EditorStateReady"),iX=new ns.hs("MILKDOWN_STATE_TRACKER"),iQ=e=>(e.inject(iJ,"").inject(is,{}).inject(iG,e=>e).inject(iZ,[ij,iq,iE,i$]).record(iY),async()=>{await e.waitTimers(iZ);let t=e.get(ix),n=e.get(iB),r=e.get(iu),i=e.get(iG),o=e.get(ih),l=function(e,t,n){var r;if("string"==typeof e)return t(e);if("html"===e.type)return rE.S4.fromSchema(n).parse(e.dom);if("json"===e.type)return rE.bP.fromJSON(n,e.value);throw r=e,new nm(nf.docTypeError,`Doc type error, unsupported type: ${JSON.stringify(r,ng)}`)}(e.get(iJ),n,t),a=e.get(iL),s=a.addBaseKeymap(),c=[...o,new ns.k_({key:iX,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(is,i)}}}),function({rules:e}){let t=new ns.k_({key:nq,isInputRules:!0,state:{init:()=>null,apply(e,t){let n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>nz(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&nz(n,r.pos,r.pos,"",e,t)}),!1),keydown:(e,t)=>!!(nj&&nR&&"Enter"===t.key)&&!e.composing&&!!e.someProp("handleKeyDown",n=>n(e,t))&&(t.preventDefault(),!0)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;let{$cursor:i}=n.state.selection;return!!i&&nz(n,i.pos,i.pos,"\n",e,t)}}});return t}({rules:r}),r9(a.build())];e.set(ih,c);let d=i({schema:t,doc:l,plugins:c}),u=ns.$t.create(d);return e.set(is,u),e.done(iY),()=>{s(),e.remove(iJ).remove(is).remove(iG).remove(iZ).clearTimer(iY)}});io(iQ,{displayName:"EditorState"});var i1=n4([],"pasteRule"),i0=n4([ik],"pasteRuleTimer"),i2=rr("PasteRuleReady"),i5=e=>(e.inject(i1,[]).inject(i0,[ik]).record(i2),async()=>(await e.waitTimers(i0),e.done(i2),()=>{e.remove(i1).remove(i0).clearTimer(i2)}));io(i5,{displayName:"PasteRule"});var i3=rr("EditorViewReady"),i9=n4([],"editorViewTimer"),i7=n4({},"editorViewOptions"),i4=n4(null,"root"),i8=n4(null,"rootDOM"),i6=n4({},"rootAttrs"),oe=new ns.hs("MILKDOWN_VIEW_CLEAR"),ot=e=>(e.inject(i4,document.body).inject(ia,{}).inject(i7,{}).inject(i8,null).inject(i6,{}).inject(i9,[iY,i2]).record(i3),async()=>{var t;await e.wait(ib);let n=e.get(i4)||document.body,r="string"==typeof n?document.querySelector(n):n;e.update(ih,t=>[new ns.k_({key:oe,view:t=>{let n,i=r?((n=document.createElement("div")).className="milkdown",r.appendChild(n),e.set(i8,n),Object.entries(e.get(i6)).forEach(([e,t])=>n.setAttribute(e,t)),n):void 0;if(i&&r){let e=t.dom;r.replaceChild(i,e),i.appendChild(e)}return{destroy:()=>{i?.parentNode&&i?.parentNode.replaceChild(t.dom,i),i?.remove()}}}}),...t]),await e.waitTimers(i9);let i=e.get(is),o=e.get(i7),l=new ii.Lz(r,{state:i,nodeViews:Object.fromEntries(e.get(im)),markViews:Object.fromEntries(e.get(ig)),transformPasted:(t,n,r)=>(e.get(i1).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...o});return(t=l.dom).classList.add("editor"),t.setAttribute("role","textbox"),e.set(ia,l),e.done(i3),()=>{l?.destroy(),e.remove(i4).remove(ia).remove(i7).remove(i8).remove(i6).remove(i9).clearTimer(i3)}});io(ot,{displayName:"EditorView"});var on=((C={}).Idle="Idle",C.OnCreate="OnCreate",C.Created="Created",C.OnDestroy="OnDestroy",C.Destroyed="Destroyed",C),or=class e{constructor(){this.enableInspector=(e=!0)=>(this.#$=e,this),this.onStatusChange=e=>(this.#D=e,this),this.config=e=>(this.#j.push(e),this),this.removeConfig=e=>(this.#j=this.#j.filter(t=>t!==e),this),this.use=e=>{let t=[e].flat();return t.flat().forEach(e=>{this.#F.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#g===on.Created&&this.#B(t,this.#F),this},this.remove=async e=>this.#g===on.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#H([e].flat(),!0),this),this.create=async()=>(this.#g===on.OnCreate||(this.#g===on.Created&&await this.destroy(),this.#z(on.OnCreate),this.#q(),this.#B([...this.#F.keys()],this.#F),await Promise.all([this.#K(this.#W),this.#K(this.#F)].flat()),this.#z(on.Created)),this),this.destroy=async(e=!1)=>this.#g===on.Destroyed||this.#g===on.OnDestroy?this:this.#g===on.OnCreate?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#j=[]),this.#z(on.OnDestroy),await this.#H([...this.#F.keys()],e),await this.#U(),this.#z(on.Destroyed),this),this.action=e=>e(this.#L),this.inspect=()=>this.#$?[...this.#W.values(),...this.#F.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#$=!1;#g=on.Idle;#j=[];#D=()=>void 0;#i=new n3;#o=new re;#F=new Map;#W=new Map;#L=new n6(this.#i,this.#o);#q=()=>{var e,t;let n,r,i=(e=async e=>{await Promise.all(this.#j.map(t=>Promise.resolve(t(e))))},io(n=t=>(t.record(iw),async()=>(await e(t),t.done(iw),()=>{t.clearTimer(iw)})),{displayName:"Config"}),n),o=[iN,iz,iV,i_,iD,i5,iQ,ot,(t=this,io(r=e=>(e.inject(id,t).inject(ih,[]).inject(ip,[]).inject(iu,[]).inject(im,[]).inject(ig,[]).inject(iy,{handlers:il,encode:[]}).inject(iv,(0,rI.l)().use(ri.A).use(rO)).inject(ic,[iw]).record(ib),async()=>{await e.waitTimers(ic);let t=e.get(iy);return e.set(iv,(0,rI.l)().use(ri.A).use(rO,t)),e.done(ib),()=>{e.remove(id).remove(ih).remove(ip).remove(iu).remove(im).remove(ig).remove(iy).remove(iv).remove(ic).clearTimer(ib)}}),{displayName:"Init"}),r),i];this.#B(o,this.#W)};#B=(e,t)=>{e.forEach(e=>{let n=this.#L.produce(this.#$?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})};#H=(e,t=!1)=>Promise.all([e].flat().map(async e=>{let n=this.#F.get(e)?.cleanup;return(t?this.#F.delete(e):this.#F.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof n)?n():n}));#U=async()=>{await Promise.all([...this.#W.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#W.clear()};#z=e=>{this.#g=e,this.#D(e)};#K=e=>[...e.entries()].map(async([t,n])=>{let{ctx:r,handler:i}=n;if(!i)return;let o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})});get ctx(){return this.#L}get status(){return this.#g}};let oi=e=>crypto.getRandomValues(new Uint8Array(e)),oo=(e,t=21)=>((e,t,n)=>{let r=256-256%e.length;if(256===r){let r=e.length-1;return (i=t)=>{if(!i)return"";let o="";for(;;){let t=n(i),l=i;for(;l--;)if((o+=e[t[l]&r]).length>=i)return o}}}let i=Math.ceil(409.6*t/r);return (o=t)=>{if(!o)return"";let l="";for(;;){let t=n(i),a=i;for(;a--;)if(t[a]<r&&(l+=e[t[a]%e.length]).length>=o)return l}}})(e,0|t,oi);function ol(e,t){let n=function(e="cmdKey"){return n4(()=>()=>!1,e)}(e),r=i=>async()=>{r.key=n,await i.wait(iE);let o=t(i);return i.get(iO).create(n,o),r.run=t=>i.get(iO).call(e,t),()=>{i.get(iO).remove(n)}};return r}function oa(e){let t=n=>async()=>{await n.wait(ik);let r=e(n);return n.update(iu,e=>[...e,r]),t.inputRule=r,()=>{n.update(iu,e=>e.filter(e=>e!==r))}};return t}function oc(e,t){let n=r=>async()=>{let i=t(r);return r.update(iS,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(iS,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{let n=t.get(ix).nodes[e];if(!n)throw nk(e);return n},n}function od(e){let t,n=n=>async()=>(await n.wait(ik),t=e(n),n.update(ih,e=>[...e,t]),()=>{n.update(ih,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function ou(e){let t=n=>async()=>{await n.wait(i$);let r=n.get(iL),i=e(n),o=r.addObjectKeymap(i);return t.keymap=i,()=>{o()}};return t}function oh(e,t){let n=r=>async()=>{await r.wait(ik);let i=t(r);return e.type(r)instanceof rE.Z6?r.update(im,t=>[...t,[e.id,i]]):r.update(ig,t=>[...t,[e.id,i]]),n.view=i,n.type=e,()=>{e.type(r)instanceof rE.Z6?r.update(im,t=>t.filter(t=>t[0]!==e.id)):r.update(ig,t=>t.filter(t=>t[0]!==e.id))}};return n}function op(e,t){let n=n4(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function of(e,t){let n=op(t,e),r=oc(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>of(e,n(t)),i}function om(e,t){var n;let r,i=op(t,e),o=(n=e=>e.get(i.key)(e),(r=t=>async()=>{let i=n(t);return t.update(iM,t=>[...t.filter(t=>t[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{t.update(iM,t=>t.filter(([t])=>t!==e))}}).type=t=>{let n=t.get(ix).marks[e];if(!n)throw new nm(nf.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`);return n},r),l=[i,o];return l.id=o.id,l.mark=o,l.type=e=>o.type(e),l.ctx=i,l.key=i.key,l.extendSchema=n=>om(e,n(t)),l}function og(e,t){let n=op(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=ou(e=>{let r=e.get(n.key);return Object.fromEntries(Object.entries(t).flatMap(([e,{command:t}])=>{let n=r[e],i=[n.shortcuts].flat(),o=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:o}])}))}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}oo("abcedfghicklmn",10);var ov=(e,t=()=>({}))=>op(t,`${e}Attr`),oy=(e,t=()=>({}))=>op(t,`${e}Attr`);function ow(e,t,n){let r=op(n??{},e),i=e=>async()=>{await e.wait(ib);let n={plugin:t(e),options:e.get(r.key)};return e.update(ip,e=>[...e,n]),()=>{e.update(ip,e=>e.filter(e=>e!==n))}},o=[r,i];return o.id=e,o.plugin=i,o.options=r,o}let ob=function(){return eI.Date.now()};var ok=/\s/;let oC=function(e){for(var t=e.length;t--&&ok.test(e.charAt(t)););return t};var ox=/^\s+/,oS=0/0,oM=/^[-+]0x[0-9a-f]+$/i,oT=/^0b[01]+$/i,oN=/^0o[0-7]+$/i,oA=parseInt;let oO=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||tx(t)&&"[object Symbol]"==eF(t))return oS;if(eB(e)){var t,n,r="function"==typeof e.valueOf?e.valueOf():e;e=eB(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=(n=e)?n.slice(0,oC(n)+1).replace(ox,""):n;var i=oT.test(e);return i||oN.test(e)?oA(e.slice(2),i?2:8):oM.test(e)?oS:+e};var oI=Math.max,oE=Math.min;let o_=function(e,t,n){var r,i,o,l,a,s,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function p(t){var n=r,o=i;return r=i=void 0,c=t,l=e.apply(o,n)}function f(e){var n=e-s,r=e-c;return void 0===s||n>=t||n<0||u&&r>=o}function m(){var e,n,r,i=ob();if(f(i))return g(i);a=setTimeout(m,(e=i-s,n=i-c,r=t-e,u?oE(r,o-n):r))}function g(e){return(a=void 0,h&&r)?p(e):(r=i=void 0,l)}function v(){var e,n=ob(),o=f(n);if(r=arguments,i=this,s=n,o){if(void 0===a)return c=e=s,a=setTimeout(m,t),d?p(e):l;if(u)return clearTimeout(a),a=setTimeout(m,t),p(s)}return void 0===a&&(a=setTimeout(m,t)),l}return t=oO(t)||0,eB(n)&&(d=!!n.leading,o=(u="maxWait"in n)?oI(oO(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=s=i=a=void 0},v.flush=function(){return void 0===a?l:g(ob())},v},oR=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw TypeError("Expected a function");return eB(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),o_(e,t,{leading:r,maxWait:t,trailing:i})};var oL=n(70878);function oP(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}var o$=op({filterNodes:e=>!n0(e=>"table"===e.type.name)(e)},"blockConfig");oP(o$,{displayName:"Ctx<blockConfig>"});var oD=nH.ie&&nH.ie_version<15||nH.ios&&nH.webkit_version<604,oj=class{constructor(){this.bind=(e,t)=>{this.#L=e,this.#V=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#J),e.addEventListener("mouseup",this.#G),e.addEventListener("dragstart",this.#Z),e.addEventListener("dragend",this.#Y)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#J),e.removeEventListener("mouseup",this.#G),e.removeEventListener("dragstart",this.#Z),e.removeEventListener("dragend",this.#Y)},this.unBind=()=>{this.#V=void 0},this.keydownCallback=e=>(this.#X(),this.#Q=!1,e.dom.dataset.dragging="false",!1),this.mousemoveCallback=(e,t)=>!e.composing&&!!e.editable&&(this.#ee(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#Q){let n=this.#et?.dom.parentElement;if(!n)return!1;let r=n.scrollHeight>n.clientHeight,i=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&20>Math.abs(t.y-i.y))return n.scrollTop=n.scrollTop>10?n.scrollTop-10:0,!1;let r=Math.round(e.dom.getBoundingClientRect().height);Math.round(n.scrollTop+i.height)<r&&20>Math.abs(t.y-(i.height+i.y))&&(n.scrollTop=n.scrollTop+10)}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#Q=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{let n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#en=null,this.#er(e))},this.dropCallback=e=>(this.#er(e),!1),this.dragendCallback=e=>{this.#er(e)}}#L;#ei=()=>{if(!this.#en)return null;let e=this.#en,t=this.#et;if(t&&ns.nh.isSelectable(e.node)){let n=ns.nh.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#eo=n,n}return null};#eo=null;#en=null;#el=void 0;#Q=!1;get #ea(){try{return this.#L?.get(o$.key).filterNodes}catch{return}}get #et(){return this.#L?.get(ia)}#V;#X=()=>{this.#V?.({type:"hide"}),this.#en=null};#es=e=>{this.#en=e,this.#V?.({type:"show",active:e})};#J=()=>{this.#el=this.#en?.el.getBoundingClientRect(),this.#ei()};#G=()=>{this.#Q?(this.#Q=!1,this.#eo=null):requestAnimationFrame(()=>{this.#el&&this.#et?.focus()})};#Z=e=>{this.#Q=!0;let t=this.#et;if(!t)return;t.dom.dataset.dragging="true";let n=this.#eo;if(e.dataTransfer&&n){let r=n.content();e.dataTransfer.effectAllowed="copyMove";let{dom:i,text:o}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(oD?"Text":"text/html",i.innerHTML),oD||e.dataTransfer.setData("text/plain",o);let l=this.#en?.el;l&&e.dataTransfer.setDragImage(l,0,0),t.dragging={slice:r,move:!0}}};#Y=()=>{this.#et&&this.#er(this.#et)};#ee=oR((e,t)=>{if(!e.editable)return;let n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element))return void this.#X();let i=this.#ea;if(!i)return;let o=function(e,t,n){if(!e.dom.parentElement)return null;try{let r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==r||r<0)return null;let i=e.state.doc.resolve(r),o=e.state.doc.nodeAt(r),l=e.nodeDOM(r),a=t=>{let r=i.depth>=1&&0===i.index(i.depth);if(!(t||r))return;let s=i.before(i.depth);o=e.state.doc.nodeAt(s),l=e.nodeDOM(s),i=e.state.doc.resolve(s),n(i,o)||a(!0)};if(a(!n(i,o)),!l||!o)return null;return{node:o,$pos:i,el:l}}catch{return null}}(e,{x:r,y:t.clientY},i);o?this.#es(o):this.#X()},200);#er=e=>{this.#Q=!1,e.dom.dataset.dragging="false"}},oF=op(()=>new oj,"blockService"),oB=op({},"blockServiceInstance");oP(oF,{displayName:"Ctx<blockService>"}),oP(oB,{displayName:"Ctx<blockServiceInstance>"});var oH=op({},"blockSpec");oP(oH,{displayName:"Ctx<blockSpec>"});var oz=od(e=>{let t=new ns.hs("MILKDOWN_BLOCK"),n=e.get(oF.key)();e.set(oB.key,n);let r=e.get(oH.key);return new ns.k_({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});oP(oz,{displayName:"Prose<block>"});var oq=class{#ec;#L;#ed;#eu=null;#eh;#ep=!1;#ef;#em;#eg;#ev;#ey;get active(){return this.#eu}constructor(e){this.update=()=>{requestAnimationFrame(()=>{if(!this.#ep)try{this.#ew(),this.#ep=!0}catch{}})},this.destroy=()=>{this.#ed?.unBind(),this.#ed?.removeEvent(this.#ec),this.#ec.remove()},this.show=e=>{let t=e.el,n=this.#L.get(ia).dom,r={ctx:this.#L,active:e,editorDom:n,blockDom:this.#ec},i=[(0,oL.UU)()];if(this.#eg){let e=(0,oL.cY)(this.#eg(r));i.push(e)}(0,oL.rD)({contextElement:t,getBoundingClientRect:()=>this.#ev?this.#ev(r):t.getBoundingClientRect()},this.#ec,{placement:this.#ey?this.#ey(r):"left",middleware:[...i,...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.#ec.style,{left:`${e}px`,top:`${t}px`}),this.#ec.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#ec.dataset.show="false"},this.#L=e.ctx,this.#ec=e.content,this.#eg=e.getOffset,this.#ev=e.getPosition,this.#ey=e.getPlacement,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.hide()}#ew(){let e=this.#L.get(ia);(this.#eh??e.dom.parentElement??document.body).appendChild(this.#ec);let t=this.#L.get(oB.key);t.bind(this.#L,e=>{"hide"===e.type?(this.hide(),this.#eu=null):"show"===e.type&&(this.show(e.active),this.#eu=e.active)}),this.#ed=t,this.#ed.addEvent(this.#ec),this.#ec.draggable=!0}},oK=[oH,o$,oF,oB,oz];oK.key=oH.key,oK.pluginKey=oz.key;var oW=n(17631),oU=n(38547);function oV(e){return String(e||"").toUpperCase()}function oJ(){return function(e){let t=function(e){let t=new Map;if(!e||!e.type)throw Error("mdast-util-definitions expected node");return(0,oU.YR)(e,"definition",function(e){let n=oV(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){let n=oV(e);return t.get(n)}}(e);(0,oU.YR)(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[oW._Z,n];if("imageReference"===e.type||"linkReference"===e.type){let i=t(e.identifier);if(i&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children},[oW._Z,n]}})}}function oG(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak"))return void e.next(t.content);let n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(rE.FK.fromArray(n))}function oZ(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var oY=oy("emphasis");oZ(oY,{displayName:"Attr<emphasis>",group:"Emphasis"});var oX=om("emphasis",e=>({attrs:{marker:{default:e.get(iy).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(oY.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));oZ(oX.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),oZ(oX.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var oQ=ol("ToggleEmphasis",e=>()=>rJ(oX.type(e)));oZ(oQ,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var o1=oa(e=>nK(/(?:^|[^*])\*([^*]+)\*$/,oX.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));oZ(o1,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var o0=oa(e=>nK(/\b_(?![_\s])(.*?[^_\s])_\b/,oX.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));oZ(o0,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var o2=og("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{let t=e.get(iO);return()=>t.call(oQ.key)}}});oZ(o2.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),oZ(o2.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var o5=oy("strong");oZ(o5,{displayName:"Attr<strong>",group:"Strong"});var o3=om("strong",e=>({attrs:{marker:{default:e.get(iy).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(o5.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));oZ(o3.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),oZ(o3.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var o9=ol("ToggleStrong",e=>()=>rJ(o3.type(e)));oZ(o9,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var o7=oa(e=>nK(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,o3.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));oZ(o7,{displayName:"InputRule<strong>",group:"Strong"});var o4=og("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{let t=e.get(iO);return()=>t.call(o9.key)}}});oZ(o4.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),oZ(o4.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var o8=oy("inlineCode");oZ(o8,{displayName:"Attr<inlineCode>",group:"InlineCode"});var o6=om("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(o8.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));oZ(o6.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),oZ(o6.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var le=ol("ToggleInlineCode",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(r.empty)return!1;let{from:o,to:l}=r;return t.doc.rangeHasMark(o,l,o6.type(e))?n?.(i.removeMark(o,l,o6.type(e))):(Object.keys(t.schema.marks).filter(e=>e!==o6.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(o,l,e)}),n?.(i.addMark(o,l,o6.type(e).create()))),!0});oZ(le,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var lt=oa(e=>nK(/(?:`)([^`]+)(?:`)$/,o6.type(e)));oZ(lt,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var ln=og("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{let t=e.get(iO);return()=>t.call(le.key)}}});oZ(ln.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),oZ(ln.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var lr=oy("link");oZ(lr,{displayName:"Attr<link>",group:"Link"});var li=om("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(lr.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{let r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));oZ(li.mark,{displayName:"MarkSchema<link>",group:"Link"});var lo=ol("ToggleLink",e=>(t={})=>rJ(li.type(e),t));oZ(lo,{displayName:"Command<toggleLinkCommand>",group:"Link"});var ll=ol("UpdateLink",e=>(t={})=>(n,r)=>{let i;if(!r)return!1;let o=-1,{selection:l}=n,{from:a,to:s}=l;if(n.doc.nodesBetween(a,a===s?s+1:s,(t,n)=>{if(li.type(e).isInSet(t.marks))return i=t,o=n,!1}),!i)return!1;let c=i.marks.find(({type:t})=>t===li.type(e));if(!c)return!1;let d=o,u=o+i.nodeSize,{tr:h}=n,p=li.type(e).create({...c.attrs,...t});return!!p&&(r(h.removeMark(d,u,c).addMark(d,u,p).setSelection(new ns.U3(h.selection.$anchor)).scrollIntoView()),!0)});oZ(ll,{displayName:"Command<updateLinkCommand>",group:"Link"});var la=oc("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function ls(e){return(0,oW.VG)(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;let n=t[t.length-1];if(!n)return;let r=n.children.indexOf(e);-1!==r&&n.children.splice(r,1)},!0)}oZ(la,{displayName:"NodeSchema<doc>",group:"Doc"});var lc=ow("remark-preserve-empty-line",()=>()=>ls);oZ(lc.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),oZ(lc.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var ld=ov("paragraph");oZ(ld,{displayName:"Attr<paragraph>",group:"Paragraph"});var lu=of("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(ld.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{let r=e.get(ia).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||0===n.content.size)&&n!==r&&function(e){let t=!1;try{e.get(lc.id),t=!0}catch{t=!1}return t}(e)?t.addNode("html",void 0,"<br />"):oG(t,n),t.closeNode()}}}));oZ(lu.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),oZ(lu.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var lh=ol("TurnIntoText",e=>()=>rV(lu.type(e)));oZ(lh,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var lp=og("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{let t=e.get(iO);return()=>t.call(lh.key)}}});oZ(lp.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),oZ(lp.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var lf=Array(6).fill(0).map((e,t)=>t+1),lm=op(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");oZ(lm,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var lg=ov("heading");oZ(lg,{displayName:"Attr<heading>",group:"Heading"});var lv=of("heading",e=>{let t=e.get(lm.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:lf.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nw(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(lg.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{let r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),oG(e,t),e.closeNode()}}}});oZ(lv.node,{displayName:"NodeSchema<heading>",group:"Heading"}),oZ(lv.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var ly=oa(e=>np(/^(?<hashes>#+)\s$/,lv.type(e),t=>{let n=t.groups?.hashes?.length||0,{$from:r}=e.get(ia).state.selection,i=r.node();if("heading"===i.type.name){let e=Number(i.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));oZ(ly,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var lw=ol("WrapInHeading",e=>t=>(t??=1)<1?rV(lu.type(e)):rV(lv.type(e),{level:t}));oZ(lw,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var lb=ol("DowngradeHeading",e=>()=>(t,n,r)=>{let{$from:i}=t.selection,o=i.node();if(o.type!==lv.type(e)||!t.selection.empty||0!==i.parentOffset)return!1;let l=o.attrs.level-1;return l?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:l})),!0):rV(lu.type(e))(t,n,r)});oZ(lb,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var lk=og("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{let t=e.get(iO);return()=>t.call(lb.key)}}});oZ(lk.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),oZ(lk.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var lC=ov("blockquote");oZ(lC,{displayName:"Attr<blockquote>",group:"Blockquote"});var lx=of("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(lC.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));oZ(lx.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),oZ(lx.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var lS=oa(e=>nh(/^\s*>\s$/,lx.type(e)));oZ(lS,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var lM=ol("WrapInBlockquote",e=>()=>rU(lx.type(e)));oZ(lM,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var lT=og("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{let t=e.get(iO);return()=>t.call(lM.key)}}});oZ(lT.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),oZ(lT.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var lN=ov("codeBlock",()=>({pre:{},code:{}}));oZ(lN,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var lA=of("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{language:e.dataset.language}}}],toDOM:t=>{let n=e.get(lN.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{let r=t.lang??"",i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));oZ(lA.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),oZ(lA.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var lO=oa(e=>np(/^```(?<language>[a-z]*)?[\s\n]$/,lA.type(e),e=>({language:e.groups?.language??""})));oZ(lO,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var lI=ol("CreateCodeBlock",e=>(t="")=>rV(lA.type(e),{language:t}));oZ(lI,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),oZ(ol("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0)),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var lE=og("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{let t=e.get(iO);return()=>t.call(lI.key)}}});oZ(lE.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),oZ(lE.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var l_=ov("image");oZ(l_,{displayName:"Attr<image>",group:"Image"});var lR=of("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(l_.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{let r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));oZ(lR.node,{displayName:"NodeSchema<image>",group:"Image"}),oZ(lR.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var lL=ol("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;let{src:i="",alt:o="",title:l=""}=t,a=lR.type(e).create({src:i,alt:o,title:l});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});oZ(lL,{displayName:"Command<insertImageCommand>",group:"Image"});var lP=ol("UpdateImage",e=>(t={})=>(n,r)=>{let i=function(e,t){if(!(e instanceof ns.nh))return;let{node:n,$from:r}=e;if(Array.isArray(t)&&t.includes(n.type)||n.type===t)return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}(n.selection,lR.type(e));if(!i)return!1;let{node:o,pos:l}=i,a={...o.attrs},{src:s,alt:c,title:d}=t;return void 0!==s&&(a.src=s),void 0!==c&&(a.alt=c),void 0!==d&&(a.title=d),r?.(n.tr.setNodeMarkup(l,void 0,a).scrollIntoView()),!0});oZ(lP,{displayName:"Command<updateImageCommand>",group:"Image"}),oZ(oa(e=>new nd(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{let[o,l,a="",s]=n;return o?t.tr.replaceWith(r,i,lR.type(e).create({src:a,alt:l,title:s})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});var l$=ov("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));oZ(l$,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var lD=of("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(l$.key)(t)," "]:["br",e.get(l$.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:!!t.data?.isInline})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));oZ(lD.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),oZ(lD.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var lj=ol("InsertHardbreak",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(!(r instanceof ns.U3))return!1;if(r.empty){let e=r.$from.node();if(e.childCount>0&&e.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(ns.LN.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(lD.type(e).create()).scrollIntoView()),!0});oZ(lj,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var lF=og("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{let t=e.get(iO);return()=>t.call(lj.key)}}});oZ(lF.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),oZ(lF.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var lB=ov("hr");oZ(lB,{displayName:"Attr<hr>",group:"Hr"});var lH=of("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(lB.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));oZ(lH.node,{displayName:"NodeSchema<hr>",group:"Hr"}),oZ(lH.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var lz=oa(e=>new nd(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{let{tr:o}=t;return n[0]&&o.replaceWith(r-1,i,lH.type(e).create()),o}));oZ(lz,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var lq=ol("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;let r=lu.node.type(e).create(),{tr:i,selection:o}=t,{from:l}=o,a=lH.type(e).create();if(!a)return!0;let s=i.replaceSelectionWith(a).insert(l,r),c=ns.LN.findFrom(s.doc.resolve(l),1,!0);return!c||(n(s.setSelection(c).scrollIntoView()),!0)});oZ(lq,{displayName:"Command<insertHrCommand>",group:"Hr"});var lK=ov("bulletList");oZ(lK,{displayName:"Attr<bulletList>",group:"BulletList"});var lW=of("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(lK.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));oZ(lW.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),oZ(lW.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var lU=oa(e=>nh(/^\s*([-+*])\s$/,lW.type(e)));oZ(lU,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var lV=ol("WrapInBulletList",e=>()=>rU(lW.type(e)));oZ(lV,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var lJ=og("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{let t=e.get(iO);return()=>t.call(lV.key)}}});oZ(lJ.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),oZ(lJ.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var lG=ov("orderedList");oZ(lG,{displayName:"Attr<orderedList>",group:"OrderedList"});var lZ=of("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(lG.key)(t),...1===t.attrs.order?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:t.attrs.order??1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));oZ(lZ.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),oZ(lZ.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var lY=oa(e=>nh(/^\s*(\d+)\.\s$/,lZ.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));oZ(lY,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var lX=ol("WrapInOrderedList",e=>()=>rU(lZ.type(e)));oZ(lX,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var lQ=og("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{let t=e.get(iO);return()=>t.call(lX.key)}}});oZ(lQ.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),oZ(lQ.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var l1=ov("listItem");oZ(l1,{displayName:"Attr<listItem>",group:"ListItem"});var l0=of("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(l1.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{let r=null!=t.label?`${t.label}.`:"•",i=null!=t.label?"ordered":"bullet",o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:i,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));oZ(l0.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),oZ(l0.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var l2=ol("SinkListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(0==l)return!1;let a=o.parent,s=a.child(l-1);if(s.type!=t)return!1;if(n){let r=s.lastChild&&s.lastChild.type==a.type,i=rE.FK.from(r?t.create():null),l=new rE.Ji(rE.FK.from(t.create(null,rE.FK.from(a.type.create(null,i)))),r?3:1,0),c=o.start,d=o.end;n(e.tr.step(new nc.Wg(c-(r?3:1),d,c,d,l,1,!0)).scrollIntoView())}return!0}});oZ(l2,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var l5=ol("LiftListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);return!!o&&(!n||(r.node(o.depth-1).type==t?function(e,t,n,r){let i=e.tr,o=r.end,l=r.$to.end(r.depth);o<l&&(i.step(new nc.Wg(o-1,l,o,l,new rE.Ji(rE.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new rE.u$(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));let a=(0,nc.jP)(r);if(null==a)return!1;i.lift(r,a);let s=i.doc.resolve(i.mapping.map(o,-1)-1);return(0,nc.n9)(i.doc,s.pos)&&s.nodeBefore.type==s.nodeAfter.type&&i.join(s.pos),t(i.scrollIntoView()),!0}(e,n,t,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),l=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,s=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!a,d+1,l.content.append(s?rE.FK.empty:rE.FK.from(i))))return!1;let u=o.pos,h=u+l.nodeSize;return r.step(new nc.Wg(u-!!a,h+ +!!s,u+1,h-1,new rE.Ji((a?rE.FK.empty:rE.FK.from(i.copy(rE.FK.empty))).append(s?rE.FK.empty:rE.FK.from(i.copy(rE.FK.empty))),+!a,+!s),+!a)),t(r.scrollIntoView()),!0}(e,n,o)))}});oZ(l5,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var l3=ol("SplitListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i,node:o}=e.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(i))return!1;let l=r.node(-1);if(l.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let i=rE.FK.empty,o=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-o;e>=r.depth-3;e--)i=rE.FK.from(r.node(e).copy(i));let l=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;i=i.append(rE.FK.from(t.createAndFill()));let a=r.before(r.depth-(o-1)),s=e.tr.replace(a,r.after(-l),new rE.Ji(i,4-o,0)),c=-1;s.doc.nodesBetween(a,s.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&s.setSelection(ns.LN.near(s.doc.resolve(c))),n(s.scrollIntoView())}return!0}let a=i.pos==r.end()?l.contentMatchAt(0).defaultType:null,s=e.tr.delete(r.pos,i.pos),c=a?[null,{type:a}]:void 0;return!!(0,nc.zy)(s.doc,r.pos,2,c)&&(n&&n(s.split(r.pos,2,c).scrollIntoView()),!0)}});oZ(l3,{displayName:"Command<splitListItemCommand>",group:"ListItem"});var l9=ol("LiftFirstListItem",e=>()=>(t,n,r)=>{let{selection:i}=t;if(!(i instanceof ns.U3))return!1;let{empty:o,$from:l}=i;return!!o&&0===l.parentOffset&&l.node(-1).type===l0.type(e)&&rL(t,n,r)});oZ(l9,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var l7=og("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{let t=e.get(iO);return()=>t.call(l3.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{let t=e.get(iO);return()=>t.call(l2.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{let t=e.get(iO);return()=>t.call(l5.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{let t=e.get(iO);return()=>t.call(l9.key)}}});oZ(l7.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),oZ(l7.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var l4=oc("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));oZ(l4,{displayName:"NodeSchema<text>",group:"Text"});var l8=ov("html");oZ(l8,{displayName:"Attr<html>",group:"Html"});var l6=of("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{let n=document.createElement("span"),r={...e.get(l8.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>"html"===e,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));oZ(l6.node,{displayName:"NodeSchema<html>",group:"Html"}),oZ(l6.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var ae=[la,ld,lu,lm,lg,lv,l$,lD,lC,lx,lN,lA,lB,lH,l_,lR,lK,lW,lG,lZ,l1,l0,oY,oX,o5,o3,o8,o6,lr,li,l8,l6,l4].flat(),at=[lS,lU,lY,lO,lz,ly].flat(),an=[o1,o0,lt,o7],ar=ol("IsMarkSelected",()=>e=>t=>{if(!e)return!1;let{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),ai=ol("IsNoteSelected",()=>e=>t=>!!e&&n5(t,e).hasNode),ao=ol("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr,{$from:r,$to:i}=n.selection,{pos:o}=r,{pos:l}=i,a=o-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,l),t?.(n),!0)}),al=ol("SetBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr,{from:l,to:a}=o.selection;try{o.setBlockType(l,a,r,i)}catch{return!1}return n?.(o),!0}),aa=ol("WrapInBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let{$from:e,$to:t}=o.selection,n=e.blockRange(t),l=n&&(0,nc.oM)(n,r,i);if(!l)return!1;o=o.wrap(n,l)}catch{return!1}return n?.(o),!0}),as=ol("AddBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let e=r instanceof rE.bP?r:r.createAndFill(i);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return n?.(o),!0}),ac=ol("SelectTextNearPos",()=>e=>(t,n)=>{let{pos:r}=e??{};if(null==r)return!1;let i=t.tr;try{let e,n=t.doc.resolve((e=t.doc.content.size,Math.min(Math.max(r,0),e)));i.setSelection(ns.U3.near(n))}catch{return!1}return n?.(i.scrollIntoView()),!0}),ad=[lh,lM,lw,lb,lI,lj,lq,lL,lP,lX,lV,l2,l3,l5,l9,oQ,le,o9,lo,ll,ar,ai,ao,al,aa,as,ac],au=[lT,lE,lF,lk,l7,lQ,lJ,lp,o2,ln,o4].flat(),ah=ow("remarkAddOrderInList",()=>()=>e=>{(0,oU.YR)(e,"list",e=>{if(e.ordered){let t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});oZ(ah.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),oZ(ah.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var ap=ow("remarkLineBreak",()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;(0,oU.YR)(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;let i=[],o=0;t.lastIndex=0;let l=t.exec(e.value);for(;l;){let n=l.index;o!==n&&i.push({type:"text",value:e.value.slice(o,n)}),i.push({type:"break",data:{isInline:!0}}),o=n+l[0].length,l=t.exec(e.value)}if(i.length>0&&r&&"number"==typeof n)return o<e.value.length&&i.push({type:"text",value:e.value.slice(o)}),r.children.splice(n,1,...i),n+i.length})});oZ(ap.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),oZ(ap.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var af=ow("remarkInlineLink",()=>oJ);oZ(af.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),oZ(af.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var am=["root","blockquote","listItem"],ag=ow("remarkHTMLTransformer",()=>()=>e=>{(function e(t,n,r){if(t.children){let n=[];for(let r=0,i=t.children.length;r<i;r++){let i=t.children[r];if(i){let o=e(i,r,t);if(o)for(let e=0,t=o.length;e<t;e++){let t=o[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>("html"!==e.type||n&&am.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]))(t,n,r)})(e,0,null)[0]});oZ(ag.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),oZ(ag.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var av=ow("remarkMarker",()=>()=>(e,t)=>{(0,oU.YR)(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=t.value.charAt(e.position.start.offset)})});oZ(av.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),oZ(av.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var ay=od(()=>{let e=!1,t=new ns.k_({key:new ns.hs("MILKDOWN_INLINE_NODES_CURSOR"),state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;let t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!!n&&!!r&&!!n.isInline&&!n.isText&&!!r.isInline&&!r.isText}},props:{handleDOMEvents:{compositionend:(n,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){let e=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,r)=>{if(t.getState(n.state)&&r instanceof InputEvent&&r.data&&!e){let e=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(t.getState(e)){let t=e.selection.$from.pos,n=document.createElement("span"),r=ii.NZ.widget(t,n,{side:-1}),i=document.createElement("span"),o=ii.NZ.widget(t,i);return setTimeout(()=>{n.contentEditable="true",i.contentEditable="true"}),ii.zF.create(e.doc,[r,o])}return ii.zF.empty}}});return t});oZ(ay,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var aw=od(e=>new ns.k_({key:new ns.hs("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;let[i]=t;if(!i)return;let[o]=i.steps;if(i.getMeta("hardbreak")){if(!(o instanceof nc.Ln))return;let{from:t}=o;return r.tr.setNodeMarkup(t,lD.type(e),void 0,[])}if(o instanceof nc.XE){let t=r.tr,{from:n,to:i}=o;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===lD.type(e)&&(t=t.setNodeMarkup(r,lD.type(e),void 0,[]))}),t}}}));oZ(aw,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var ab=op(["table","code_block"],"hardbreakFilterNodes");oZ(ab,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var ak=od(e=>{let t=e.get(ab.key);return new ns.k_({key:new ns.hs("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{let r=e.getMeta("hardbreak"),[i]=e.steps;if(r&&i){let{from:e}=i,r=n.doc.resolve(e),o=r.depth,l=!0;for(;o>0;)t.includes(r.node(o).type.name)&&(l=!1),o--;return l}return!0}})});oZ(ak,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var aC=od(e=>{let t=new ns.hs("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;let r=e.get(lm.key),i=n.state.tr.setMeta("addToHistory",!1),o=!1,l={};n.state.doc.descendants((n,a)=>{if(n.type===lv.type(e)){if(0===n.textContent.trim().length)return;let e=n.attrs,s=r(n);l[s]?(l[s]+=1,s+=`-#${l[s]}`):l[s]=1,e.id!==s&&(o=!0,i.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:s}))}}),o&&n.dispatch(i)};return new ns.k_({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});oZ(aC,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var ax=od(e=>new ns.k_({key:new ns.hs("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;let i=lZ.type(e),o=lW.type(e),l=l0.type(e),a=(e,t,n=1)=>{let r=!1,i=`${t+n}.`;return e.label!==i&&(e.label=i,r=!0),r},s=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===o){let n=e.maybeChild(0);n?.type===l&&"ordered"===n.attrs.listType&&(c=!0,s.setNodeMarkup(t,i,{spread:"true"}),e.descendants((e,t,n,r)=>{if(e.type===l){let n={...e.attrs};a(n,r)&&(s=s.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===l&&n?.type===i){let i={...e.attrs},o=!1;"ordered"!==i.listType&&(i.listType="ordered",o=!0),n?.maybeChild(0)&&(o=a(i,r,n?.attrs.order??1)),o&&(s=s.setNodeMarkup(t,void 0,i),c=!0)}}),c?s.setMeta("addToHistory",!1):null}}));oZ(ax,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var aS=[ae,at,an,ad,au,[aw,ab,ak,ay,ah,af,ap,ag,av,lc,aC,ax].flat()].flat(),aM=n(36454),aT=n(32550),aN=n(42159);let aA="u">typeof window&&window.trustedTypes;if(aA)try{l=aA.createPolicy("vue",{createHTML:e=>e})}catch(e){}let aO=l?e=>l.createHTML(e):e=>e,aI="u">typeof document?document:null,aE=aI&&aI.createElement("template"),a_=Symbol("_vtc");aM.QP;let aR=Symbol("_vod"),aL=Symbol("_vsh"),aP=Symbol(""),a$=/(?:^|;)\s*display\s*:/,aD=/\s*!important$/;function aj(e,t,n){if((0,aN.cy)(n))n.forEach(n=>aj(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{let r=function(e,t){let n=aB[t];if(n)return n;let r=(0,aN.PT)(t);if("filter"!==r&&r in e)return aB[t]=r;r=(0,aN.ZH)(r);for(let n=0;n<aF.length;n++){let i=aF[n]+r;if(i in e)return aB[t]=i}return t}(e,t);aD.test(n)?e.setProperty((0,aN.Tg)(r),n.replace(aD,""),"important"):e[r]=n}}let aF=["Webkit","Moz","ms"],aB={},aH="http://www.w3.org/1999/xlink";function az(e,t,n,r,i,o=(0,aN.J$)(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(aH,t.slice(6,t.length)):e.setAttributeNS(aH,t,n):null==n||o&&!(0,aN.Y2)(n)?e.removeAttribute(t):e.setAttribute(t,o?"":(0,aN.Bm)(n)?String(n):n)}function aq(e,t,n,r,i){if("innerHTML"===t||"textContent"===t){null!=n&&(e[t]="innerHTML"===t?aO(n):n);return}let o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){let r="OPTION"===o?e.getAttribute("value")||"":e.value,i=null==n?"checkbox"===e.type?"on":"":String(n);r===i&&"_value"in e||(e.value=i),null==n&&e.removeAttribute(t),e._value=n;return}let l=!1;if(""===n||null==n){let r=typeof e[t];"boolean"===r?n=(0,aN.Y2)(n):null==n&&"string"===r?(n="",l=!0):"number"===r&&(n=0,l=!0)}try{e[t]=n}catch(e){}l&&e.removeAttribute(i||t)}let aK=Symbol("_vei"),aW=/(?:Once|Passive|Capture)$/,aU=0,aV=Promise.resolve(),aJ=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&123>e.charCodeAt(2);"u">typeof HTMLElement&&HTMLElement;let aG=(0,aN.X$)({patchProp:(e,t,n,r,i,o)=>{let l="svg"===i;if("class"===t){var a;let t;a=r,(t=e[a_])&&(a=(a?[a,...t]:[...t]).join(" ")),null==a?e.removeAttribute("class"):l?e.setAttribute("class",a):e.className=a}else"style"===t?function(e,t,n){let r=e.style,i=(0,aN.Kg)(n),o=!1;if(n&&!i){if(t)if((0,aN.Kg)(t))for(let e of t.split(";")){let t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&aj(r,t,"")}else for(let e in t)null==n[e]&&aj(r,e,"");for(let i in n){var l,a,s,c;"display"===i&&(o=!0);let d=n[i];null!=d?(l=e,a=i,s=!(0,aN.Kg)(t)&&t?t[i]:void 0,c=d,"TEXTAREA"===l.tagName&&("width"===a||"height"===a)&&(0,aN.Kg)(c)&&s===c||aj(r,i,d)):aj(r,i,"")}}else if(i){if(t!==n){let e=r[aP];e&&(n+=";"+e),r.cssText=n,o=a$.test(n)}}else t&&e.removeAttribute("style");aR in e&&(e[aR]=o?r.display:"",e[aL]&&(r.display="none"))}(e,n,r):(0,aN.Mp)(t)?(0,aN.CP)(t)||function(e,t,n,r,i=null){let o=e[aK]||(e[aK]={}),l=o[t];if(r&&l)l.value=r;else{let[n,c]=function(e){let t;if(aW.test(e)){let n;for(t={};n=e.match(aW);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):(0,aN.Tg)(e.slice(2)),t]}(t);if(r){var a,s;let l,d=o[t]=(a=r,s=i,(l=e=>{if(e._vts){if(e._vts<=l.attached)return}else e._vts=Date.now();(0,aM.qL)(function(e,t){if(!(0,aN.cy)(t))return t;{let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}}(e,l.value),s,5,[e])}).value=a,l.attached=aU||(aV.then(()=>aU=0),aU=Date.now()),l);e.addEventListener(n,d,c)}else l&&(e.removeEventListener(n,l,c),o[t]=void 0)}}(e,t,0,r,o):("."===t[0]?(t=t.slice(1),0):"^"===t[0]?(t=t.slice(1),1):!function(e,t,n,r){if(r)return!!("innerHTML"===t||"textContent"===t||t in e&&aJ(t)&&(0,aN.Tn)(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t||"sandbox"===t&&"IFRAME"===e.tagName||"form"===t||"list"===t&&"INPUT"===e.tagName||"type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){let t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return!(aJ(t)&&(0,aN.Kg)(n))&&t in e}(e,t,r,l))?e._isVueCE&&(function(e,t){let n=e._def.props;if(!n)return!1;let r=(0,aN.PT)(t);return Array.isArray(n)?n.some(e=>(0,aN.PT)(e)===r):Object.keys(n).some(e=>(0,aN.PT)(e)===r)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!(0,aN.Kg)(r)))?aq(e,(0,aN.PT)(t),r,o,t):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),az(e,t,r,l)):(aq(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||az(e,t,r,l,o,"value"!==t))}},{insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i="svg"===t?aI.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?aI.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?aI.createElement(e,{is:n}):aI.createElement(e);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:e=>aI.createTextNode(e),createComment:e=>aI.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>aI.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,i,o){let l=n?n.previousSibling:t.lastChild;if(i&&(i===o||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==o&&(i=i.nextSibling););else{aE.innerHTML=aO("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);let i=aE.content;if("svg"===r||"mathml"===r){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[l?l.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}}),aZ=(...e)=>{let t=(r||(r=(0,aM.K9)(aG))).createApp(...e),{mount:n}=t;return t.mount=e=>{var r,i;let o=(r=e,(0,aN.Kg)(r)?document.querySelector(r):r);if(!o)return;let l=t._component;(0,aN.Tn)(l)||l.render||l.template||(l.template=o.innerHTML),1===o.nodeType&&(o.textContent="");let a=n(o,!1,(i=o)instanceof SVGElement?"svg":"function"==typeof MathMLElement&&i instanceof MathMLElement?"mathml":void 0);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),a},t};var aY=class{#ep=!1;#ef;#em;#eh;#eb;#ek;#eC;#ex;#eS;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#ex(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{let{selection:n}=e.state,{empty:r,$from:i}=n,o=e.state.selection instanceof ns.U3;if("u"<typeof document)return;let l=this.element.contains(document.activeElement),a=!e.hasFocus()&&!l,s=!e.editable,c=!(e=>n2(t)(e.$from))(e.state.selection);if(!a&&!s&&r&&o&&!c)return i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,"")},this.destroy=()=>{this.#ex.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#eb=e.debounce??200,this.#eC=e.shouldShow??this.#eM,this.#ek=e.trigger??"/",this.#eS=e.offset,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.#ex=o_(this.#eT,this.#eb)}#eT=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:l}=i,a=Math.min(...l.map(e=>e.$from.pos)),s=Math.max(...l.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(this.#ep||((this.#eh??e.dom.parentElement??document.body).appendChild(this.element),this.#ep=!0),!r&&!c){if(!this.#eC(e,t))return void this.hide();(0,oL.rD)({getBoundingClientRect:()=>nQ(e,a,s)},this.element,{placement:"bottom-start",middleware:[(0,oL.UU)(),(0,oL.cY)(this.#eS),...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()}};#eM=e=>{let t=this.getContent(e);if(!t)return!1;let n=t.at(-1);return!!n&&(Array.isArray(this.#ek)?this.#ek.includes(n):this.#ek===n)}},aX=n(10325);let{entries:aQ,setPrototypeOf:a1,isFrozen:a0,getPrototypeOf:a2,getOwnPropertyDescriptor:a5}=Object,{freeze:a3,seal:a9,create:a7}=Object,{apply:a4,construct:a8}="u">typeof Reflect&&Reflect;a3||(a3=function(e){return e}),a9||(a9=function(e){return e}),a4||(a4=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),a8||(a8=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let a6=sw(Array.prototype.forEach),se=sw(Array.prototype.lastIndexOf),st=sw(Array.prototype.pop),sn=sw(Array.prototype.push),sr=sw(Array.prototype.splice),si=Array.isArray,so=sw(String.prototype.toLowerCase),sl=sw(String.prototype.toString),sa=sw(String.prototype.match),ss=sw(String.prototype.replace),sc=sw(String.prototype.indexOf),sd=sw(String.prototype.trim),su=sw(Number.prototype.toString),sh=sw(Boolean.prototype.toString),sp="u"<typeof BigInt?null:sw(BigInt.prototype.toString),sf="u"<typeof Symbol?null:sw(Symbol.prototype.toString),sm=sw(Object.prototype.hasOwnProperty),sg=sw(Object.prototype.toString),sv=sw(RegExp.prototype.test),sy=(p=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return a8(p,t)});function sw(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return a4(e,t,r)}}function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:so;if(a1&&a1(e,null),!si(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){let e=n(i);e!==i&&(a0(t)||(t[r]=e),i=e)}e[i]=!0}return e}function sk(e){let t=a7(null);for(let[n,r]of aQ(e))sm(e,n)&&(si(r)?t[n]=function(e){for(let t=0;t<e.length;t++)sm(e,t)||(e[t]=null);return e}(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=sk(r):t[n]=r);return t}function sC(e,t){for(;null!==e;){let n=a5(e,t);if(n){if(n.get)return sw(n.get);if("function"==typeof n.value)return sw(n.value)}e=a2(e)}return function(){return null}}let sx=a3(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sS=a3(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),sM=a3(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sT=a3(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sN=a3(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),sA=a3(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sO=a3(["#text"]),sI=a3(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sE=a3(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),s_=a3(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),sR=a3(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sL=a9(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sP=a9(/<%[\w\W]*|[\w\W]*%>/gm),s$=a9(/\$\{[\w\W]*/gm),sD=a9(/^data-[\-\w.\u00B7-\uFFFF]+$/),sj=a9(/^aria-[\-\w]+$/),sF=a9(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sB=a9(/^(?:\w+script|data):/i),sH=a9(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sz=a9(/^html$/i);var sq=Object.freeze({__proto__:null,ARIA_ATTR:sj,ATTR_WHITESPACE:sH,CUSTOM_ELEMENT:a9(/^[a-z][.\w]*(-[.\w]+)+$/i),DATA_ATTR:sD,DOCTYPE_NAME:sz,ERB_EXPR:sP,IS_ALLOWED_URI:sF,IS_SCRIPT_OR_DATA:sB,MUSTACHE_EXPR:sL,TMPLIT_EXPR:s$});let sK=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},sW=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};var sU=function e(){let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"u"<typeof window?null:window,r=t=>e(t);if(r.version="3.4.1",r.removed=[],!n||!n.document||9!==n.document.nodeType||!n.Element)return r.isSupported=!1,r;let{document:i}=n,o=i,l=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:c,Element:d,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=n,g=d.prototype,v=sC(g,"cloneNode"),y=sC(g,"remove"),w=sC(g,"nextSibling"),b=sC(g,"childNodes"),k=sC(g,"parentNode");if("function"==typeof s){let e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C="",{implementation:x,createNodeIterator:S,createDocumentFragment:M,getElementsByTagName:T}=i,{importNode:N}=o,A=sW();r.isSupported="function"==typeof aQ&&"function"==typeof k&&x&&void 0!==x.createHTMLDocument;let{MUSTACHE_EXPR:O,ERB_EXPR:I,TMPLIT_EXPR:E,DATA_ATTR:_,ARIA_ATTR:R,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:$}=sq,{IS_ALLOWED_URI:D}=sq,j=null,F=sb({},[...sx,...sS,...sM,...sN,...sO]),B=null,H=sb({},[...sI,...sE,...s_,...sR]),z=Object.seal(a7(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,K=null,W=Object.seal(a7(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),U=!0,V=!0,J=!1,G=!0,Z=!1,Y=!0,X=!1,Q=!1,ee=!1,et=!1,en=!1,er=!1,ei=!0,eo=!1,el="user-content-",ea=!0,es=!1,ec={},ed=null,eu=sb({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),eh=null,ep=sb({},["audio","video","img","source","image","track"]),ef=null,em=sb({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eg="http://www.w3.org/1998/Math/MathML",ev="http://www.w3.org/2000/svg",ey="http://www.w3.org/1999/xhtml",ew=ey,eb=!1,ek=null,eC=sb({},[eg,ev,ey],sl),ex=sb({},["mi","mo","mn","ms","mtext"]),eS=sb({},["annotation-xml"]),eM=sb({},["title","style","font","a","script"]),eT=null,eN=["application/xhtml+xml","text/html"],eA=null,eO=null,eI=i.createElement("form"),eE=function(e){return e instanceof RegExp||e instanceof Function},e_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(eO&&eO===e)return;e&&"object"==typeof e||(e={}),e=sk(e),eA="application/xhtml+xml"===(eT=-1===eN.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?sl:so,j=sm(e,"ALLOWED_TAGS")&&si(e.ALLOWED_TAGS)?sb({},e.ALLOWED_TAGS,eA):F,B=sm(e,"ALLOWED_ATTR")&&si(e.ALLOWED_ATTR)?sb({},e.ALLOWED_ATTR,eA):H,ek=sm(e,"ALLOWED_NAMESPACES")&&si(e.ALLOWED_NAMESPACES)?sb({},e.ALLOWED_NAMESPACES,sl):eC,ef=sm(e,"ADD_URI_SAFE_ATTR")&&si(e.ADD_URI_SAFE_ATTR)?sb(sk(em),e.ADD_URI_SAFE_ATTR,eA):em,eh=sm(e,"ADD_DATA_URI_TAGS")&&si(e.ADD_DATA_URI_TAGS)?sb(sk(ep),e.ADD_DATA_URI_TAGS,eA):ep,ed=sm(e,"FORBID_CONTENTS")&&si(e.FORBID_CONTENTS)?sb({},e.FORBID_CONTENTS,eA):eu,q=sm(e,"FORBID_TAGS")&&si(e.FORBID_TAGS)?sb({},e.FORBID_TAGS,eA):sk({}),K=sm(e,"FORBID_ATTR")&&si(e.FORBID_ATTR)?sb({},e.FORBID_ATTR,eA):sk({}),ec=!!sm(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?sk(e.USE_PROFILES):e.USE_PROFILES),U=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,Y=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,et=e.RETURN_DOM||!1,en=e.RETURN_DOM_FRAGMENT||!1,er=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,ei=!1!==e.SANITIZE_DOM,eo=e.SANITIZE_NAMED_PROPS||!1,ea=!1!==e.KEEP_CONTENT,es=e.IN_PLACE||!1,D=!function(e){try{return sv(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?sF:e.ALLOWED_URI_REGEXP,ew="string"==typeof e.NAMESPACE?e.NAMESPACE:ey,ex=sm(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?sk(e.MATHML_TEXT_INTEGRATION_POINTS):sb({},["mi","mo","mn","ms","mtext"]),eS=sm(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?sk(e.HTML_INTEGRATION_POINTS):sb({},["annotation-xml"]);let n=sm(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?sk(e.CUSTOM_ELEMENT_HANDLING):a7(null);if(z=a7(null),sm(n,"tagNameCheck")&&eE(n.tagNameCheck)&&(z.tagNameCheck=n.tagNameCheck),sm(n,"attributeNameCheck")&&eE(n.attributeNameCheck)&&(z.attributeNameCheck=n.attributeNameCheck),sm(n,"allowCustomizedBuiltInElements")&&"boolean"==typeof n.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=n.allowCustomizedBuiltInElements),Z&&(V=!1),en&&(et=!0),ec&&(j=sb({},sO),B=a7(null),!0===ec.html&&(sb(j,sx),sb(B,sI)),!0===ec.svg&&(sb(j,sS),sb(B,sE),sb(B,sR)),!0===ec.svgFilters&&(sb(j,sM),sb(B,sE),sb(B,sR)),!0===ec.mathMl&&(sb(j,sN),sb(B,s_),sb(B,sR))),W.tagCheck=null,W.attributeCheck=null,sm(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?W.tagCheck=e.ADD_TAGS:si(e.ADD_TAGS)&&(j===F&&(j=sk(j)),sb(j,e.ADD_TAGS,eA))),sm(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?W.attributeCheck=e.ADD_ATTR:si(e.ADD_ATTR)&&(B===H&&(B=sk(B)),sb(B,e.ADD_ATTR,eA))),sm(e,"ADD_URI_SAFE_ATTR")&&si(e.ADD_URI_SAFE_ATTR)&&sb(ef,e.ADD_URI_SAFE_ATTR,eA),sm(e,"FORBID_CONTENTS")&&si(e.FORBID_CONTENTS)&&(ed===eu&&(ed=sk(ed)),sb(ed,e.FORBID_CONTENTS,eA)),sm(e,"ADD_FORBID_CONTENTS")&&si(e.ADD_FORBID_CONTENTS)&&(ed===eu&&(ed=sk(ed)),sb(ed,e.ADD_FORBID_CONTENTS,eA)),ea&&(j["#text"]=!0),X&&sb(j,["html","head","body"]),j.table&&(sb(j,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw sy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw sy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=(t=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===t&&(t=sK(m,l)),null!==t&&"string"==typeof C&&(C=t.createHTML(""));a3&&a3(e),eO=e},eR=sb({},[...sS,...sM,...sT]),eL=sb({},[...sN,...sA]),eP=function(e){let t=k(e);t&&t.tagName||(t={namespaceURI:ew,tagName:"template"});let n=so(e.tagName),r=so(t.tagName);return!!ek[e.namespaceURI]&&(e.namespaceURI===ev?t.namespaceURI===ey?"svg"===n:t.namespaceURI===eg?"svg"===n&&("annotation-xml"===r||ex[r]):!!eR[n]:e.namespaceURI===eg?t.namespaceURI===ey?"math"===n:t.namespaceURI===ev?"math"===n&&eS[r]:!!eL[n]:e.namespaceURI===ey?(t.namespaceURI!==ev||!!eS[r])&&(t.namespaceURI!==eg||!!ex[r])&&!eL[n]&&(eM[n]||!eR[n]):"application/xhtml+xml"===eT&&!!ek[e.namespaceURI])},e$=function(e){sn(r.removed,{element:e});try{k(e).removeChild(e)}catch(t){y(e)}},eD=function(e,t){try{sn(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){sn(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(et||en)try{e$(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ej=function(e){let n=null,r=null;if(ee)e="<remove></remove>"+e;else{let t=sa(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===eT&&ew===ey&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let o=t?t.createHTML(e):e;if(ew===ey)try{n=new f().parseFromString(o,eT)}catch(e){}if(!n||!n.documentElement){n=x.createDocument(ew,"template",null);try{n.documentElement.innerHTML=eb?C:o}catch(e){}}let l=n.body||n.documentElement;return(e&&r&&l.insertBefore(i.createTextNode(r),l.childNodes[0]||null),ew===ey)?T.call(n,X?"html":"body")[0]:X?n.documentElement:l},eF=function(e){return S.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},eB=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},eH=function(e){return"function"==typeof c&&e instanceof c};function ez(e,t,n){a6(e,e=>{e.call(r,t,n,eO)})}let eq=function(e){let t=null;if(ez(A.beforeSanitizeElements,e,null),eB(e))return e$(e),!0;let n=eA(e.nodeName);if(ez(A.uponSanitizeElement,e,{tagName:n,allowedTags:j}),Y&&e.hasChildNodes()&&!eH(e.firstElementChild)&&sv(/<[/\w!]/g,e.innerHTML)&&sv(/<[/\w!]/g,e.textContent)||Y&&e.namespaceURI===ey&&"style"===n&&eH(e.firstElementChild)||7===e.nodeType||Y&&8===e.nodeType&&sv(/<[/\w]/g,e.data))return e$(e),!0;if(q[n]||!(W.tagCheck instanceof Function&&W.tagCheck(n))&&!j[n]){if(!q[n]&&eU(n)&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n)))return!1;if(ea&&!ed[n]){let t=k(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=v(n[i],!0);t.insertBefore(r,w(e))}}}return e$(e),!0}return e instanceof d&&!eP(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&sv(/<\/no(script|embed|frames)/i,e.innerHTML)?(e$(e),!0):(Z&&3===e.nodeType&&(t=e.textContent,a6([O,I,E],e=>{t=ss(t,e," ")}),e.textContent!==t&&(sn(r.removed,{element:e.cloneNode()}),e.textContent=t)),ez(A.afterSanitizeElements,e,null),!1)},eK=function(e,t,n){if(K[t]||ei&&("id"===t||"name"===t)&&(n in i||n in eI))return!1;if(V&&!K[t]&&sv(_,t));else if(U&&sv(R,t));else if(W.attributeCheck instanceof Function&&W.attributeCheck(t,e));else if(!B[t]||K[t]){if(!(eU(e)&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&sv(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t,e))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n))))return!1}else if(ef[t]);else if(sv(D,ss(n,P,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===sc(n,"data:")&&eh[e]);else if(J&&!sv(L,ss(n,P,"")));else if(n)return!1;return!0},eW=sb({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),eU=function(e){return!eW[so(e)]&&sv($,e)},eV=function(e){ez(A.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||eB(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0},o=n.length;for(;o--;){let{name:l,namespaceURI:a,value:s}=n[o],c=eA(l),d="value"===l?s:sd(s);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,ez(A.uponSanitizeAttribute,e,i),d=i.attrValue,eo&&("id"===c||"name"===c)&&0!==sc(d,el)&&(eD(l,e),d=el+d),Y&&sv(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)||"attributename"===c&&sa(d,"href")){eD(l,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr||!G&&sv(/\/>/i,d)){eD(l,e);continue}Z&&a6([O,I,E],e=>{d=ss(d,e," ")});let u=eA(e.nodeName);if(!eK(u,c,d)){eD(l,e);continue}if(t&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(a);else switch(m.getAttributeType(u,c)){case"TrustedHTML":d=t.createHTML(d);break;case"TrustedScriptURL":d=t.createScriptURL(d)}if(d!==s)try{a?e.setAttributeNS(a,l,d):e.setAttribute(l,d),eB(e)?e$(e):st(r.removed)}catch(t){eD(l,e)}}ez(A.afterSanitizeAttributes,e,null)},eJ=function(e){let t=null,n=eF(e);for(ez(A.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)ez(A.uponSanitizeShadowNode,t,null),eq(t),eV(t),t.content instanceof a&&eJ(t.content);ez(A.afterSanitizeShadowDOM,e,null)};return r.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,l=null,s=null,d=null;if((eb=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!eH(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return su(e);case"boolean":return sh(e);case"bigint":return sp?sp(e):"0";case"symbol":return sf?sf(e):"Symbol()";case"undefined":default:return sg(e);case"function":case"object":{if(null===e)return sg(e);let t=sC(e,"toString");if("function"==typeof t){let n=t(e);return"string"==typeof n?n:sg(n)}return sg(e)}}}(e)))throw sy("dirty is not a string, aborting");if(!r.isSupported)return e;if(Q||e_(n),r.removed=[],"string"==typeof e&&(es=!1),es){let t=e.nodeName;if("string"==typeof t){let e=eA(t);if(!j[e]||q[e])throw sy("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)1===(l=(i=ej("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?i=l:i.appendChild(l);else{if(!et&&!Z&&!X&&-1===e.indexOf("<"))return t&&er?t.createHTML(e):e;if(!(i=ej(e)))return et?null:er?C:""}i&&ee&&e$(i.firstChild);let u=eF(es?e:i);for(;s=u.nextNode();)eq(s),eV(s),s.content instanceof a&&eJ(s.content);if(es)return e;if(et){if(Z){i.normalize();let e=i.innerHTML;a6([O,I,E],t=>{e=ss(e,t," ")}),i.innerHTML=e}if(en)for(d=M.call(i.ownerDocument);i.firstChild;)d.appendChild(i.firstChild);else d=i;return(B.shadowroot||B.shadowrootmode)&&(d=N.call(o,d,!0)),d}let h=X?i.outerHTML:i.innerHTML;return X&&j["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&sv(sz,i.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+h),Z&&a6([O,I,E],e=>{h=ss(h,e," ")}),t&&er?t.createHTML(h):h},r.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e_(e),Q=!0},r.clearConfig=function(){eO=null,Q=!1},r.isValidAttribute=function(e,t,n){return eO||e_({}),eK(eA(e),eA(t),n)},r.addHook=function(e,t){"function"==typeof t&&sn(A[e],t)},r.removeHook=function(e,t){if(void 0!==t){let n=se(A[e],t);return -1===n?void 0:sr(A[e],n,1)[0]}return st(A[e])},r.removeHooks=function(e){A[e]=[]},r.removeAllHooks=function(){A=sW()},r}();function sV({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}aM.h,sV.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var sJ=Object.defineProperty,sG=Object.getOwnPropertySymbols,sZ=Object.prototype.hasOwnProperty,sY=Object.prototype.propertyIsEnumerable,sX=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function sQ(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))sZ.call(t,n)&&sX(e,n,t[n]);if(sG)for(var n of sG(t))sY.call(t,n)&&sX(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let s1=op({imageIcon:"\uD83C\uDF0C",captionIcon:"\uD83D\uDCAC",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function s0(e){return(0,oU.YR)(e,"paragraph",(e,t,n)=>{var r,i;if((null==(r=e.children)?void 0:r.length)!==1)return;let o=null==(i=e.children)?void 0:i[0];if(!o||"image"!==o.type)return;let{url:l,alt:a,title:s}=o;n.children.splice(t,1,{type:"image-block",url:l,alt:a,title:s})})}sQ(s1,{displayName:"Config<image-block>",group:"ImageBlock"});let s2=ow("remark-image-block",()=>()=>s0);sQ(s2.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),sQ(s2.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var s5=Object.defineProperty,s3=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,s7=Object.prototype.propertyIsEnumerable,s4=(e,t,n)=>t in e?s5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;let s8="image-block",s6=of("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${s8}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw nw(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",((e,t)=>{for(var n in t||(t={}))s9.call(t,n)&&s4(e,n,t[n]);if(s3)for(var n of s3(t))s7.call(t,n)&&s4(e,n,t[n]);return e})({"data-type":s8},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{let r=t.url,i=t.title,o=Number(t.alt||1);(Number.isNaN(o)||0===o)&&(o=1),e.addNode(n,{src:r,caption:i,ratio:o})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));function ce({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}sQ(s6.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"}),aM.h,ce.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let ct=oo("abcdefg",8),cn=(0,aM.pM)({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:l,uploadPlaceholderText:a,className:s,onImageLoadError:c}){var d,u;let h=(0,aT.KR)(!1),p=(0,aT.KR)(),f=(0,aT.KR)(null!=(d=t.value)?d:""),m=(0,aT.KR)(ct()),g=(0,aT.KR)((null==(u=t.value)?void 0:u.length)!==0),v=e=>{let t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},w=e=>{var t;let i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>(0,aM.h)("div",{class:(0,aX.A)("image-edit",s)},(0,aM.h)(ce,{icon:i,class:"image-icon"}),(0,aM.h)("div",{class:(0,aX.A)("link-importer",h.value&&"focus")},(0,aM.h)("input",{ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!g.value&&(0,aM.h)("div",{class:"placeholder"},(0,aM.h)("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),(0,aM.h)("label",{class:"uploader",for:m.value},(0,aM.h)(ce,{icon:o})),(0,aM.h)("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&(0,aM.h)(Fragment,null,(0,aM.h)("div",{class:"image-preview"},(0,aM.h)("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),(0,aM.h)("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},(0,aM.h)(ce,{icon:l}))))}});aM.h,aM.FK;let cr=(0,aM.pM)({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:r,setAttr:i,config:o}){var l;let a=(0,aT.KR)(),s=(0,aT.KR)(),c=(0,aT.KR)(!!(null==(l=t.value)?void 0:l.length)),d=(0,aT.KR)(0),u=()=>{var e;let t=a.value;if(!t)return;let r=t.closest(".milkdown-image-block");if(!r)return;let i=r.getBoundingClientRect().width;if(!i)return;o.maxWidth&&o.maxWidth<i&&(i=o.maxWidth);let l=t.naturalHeight,s=t.naturalWidth,c=s<i?l:l/s*i;o.maxHeight&&c>o.maxHeight&&(c=o.maxHeight);let d=(c*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=c.toFixed(2),t.dataset.height=d,t.style.height=`${d}px`,o.maxWidth&&(t.style.maxWidth=`${o.maxWidth}px`)},h=e=>{e.preventDefault(),e.stopPropagation(),r.value||(c.value=!c.value)},p=e=>{let t=e.target.value;d.value&&window.clearTimeout(d.value),d.value=window.setTimeout(()=>{i("caption",t)},1e3)},f=e=>{let t=e.target.value;d.value&&(window.clearTimeout(d.value),d.value=0),i("caption",t)},m=e=>{e.preventDefault();let t=a.value;if(!t)return;let n=t.getBoundingClientRect().top,r=e.clientY-n;r<100&&(r=100),o.maxHeight&&r>o.maxHeight&&(r=o.maxHeight);let i=Number(r).toFixed(2);t.dataset.height=i,t.style.height=`${i}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);let e=a.value;if(!e)return;let t=Number(e.dataset.origin),n=Number.parseFloat(Number(Number(e.dataset.height)/t).toFixed(2));Number.isNaN(n)||i("ratio",n)},v=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"image-wrapper"},(0,aM.h)("div",{class:"operation"},(0,aM.h)("div",{class:"operation-item",onPointerdown:h},(0,aM.h)(ce,{icon:o.captionIcon}))),(0,aM.h)("img",{ref:a,"data-type":s8,onLoad:u,src:e.value,alt:t.value,onError:e=>{var t;return Promise.resolve(null==(t=o.onImageLoadError)?void 0:t.call(o,e)).catch(()=>{})}}),(0,aM.h)("div",{ref:s,class:"image-resize-handle",onPointerdown:v})),c.value&&(0,aM.h)("input",{draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==o?void 0:o.captionPlaceholderText,onInput:p,onBlur:f,value:t.value}))}});var ci=Object.defineProperty,co=Object.getOwnPropertySymbols,cl=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable,cs=(e,t,n)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;aM.h,aM.FK;let cc=(0,aM.pM)({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?(0,aM.h)(cr,((e,t)=>{for(var n in t||(t={}))cl.call(t,n)&&cs(e,n,t[n]);if(co)for(var n of co(t))ca.call(t,n)&&cs(e,n,t[n]);return e})({},e)):(0,aM.h)(cn,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,onImageLoadError:e.config.onImageLoadError})}}}),cd=oh(s6.node,e=>(t,n,r)=>{let i=(0,aT.KR)(t.attrs.src),o=(0,aT.KR)(t.attrs.caption),l=(0,aT.KR)(t.attrs.ratio),a=(0,aT.KR)(!1),s=(0,aT.KR)(!n.editable),c=e.get(s1.key),d=aZ(cc,{src:i,caption:o,ratio:l,selected:a,readonly:s,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?sU.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";let h=(0,aM.nT)(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){let t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;l.value=e.attrs.ratio,o.value=e.attrs.caption,s.value=!n.editable};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});sQ(cd,{displayName:"NodeView<image-block>",group:"ImageBlock"});let cu=[s2,s6,cd,s1].flat();if("u">typeof WeakMap){let e=new WeakMap;i=t=>e.get(t),o=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;i=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},o=(n,r)=>(10==t&&(t=0),e[t++]=n,e[t++]=r)}var ch=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,o=r+1,l=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;l<this.height&&this.map[t+this.width*e]==n;e++)l++;return{left:r,top:i,right:o,bottom:l}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:o,bottom:l}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:l==this.height)?null:this.map[r+this.width*(n<0?o-1:l)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:l,right:a,top:s,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,s),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let o=r*this.width+i,l=this.map[o];!n[l]&&(n[l]=!0,i==e.left&&i&&this.map[o-1]==l||r==e.top&&r&&this.map[o-this.width]==l||t.push(l))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return i(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),o=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[],i=0,o=null,l=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,s=0;a<n;a++){let c=e.child(a);s++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;let d=c.child(e),{colspan:u,rowspan:h,colwidth:p}=d.attrs;for(let e=0;e<h;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:s,n:h-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=s:(o||(o=[])).push({type:"collision",row:a,pos:s,n:u-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=l[r];null==i||i!=n&&1==l[r+1]?(l[r]=n,l[r+1]=1):i==n&&l[r+1]++}}}i+=u,s+=d.nodeSize}let d=(a+1)*t,u=0;for(;i<d;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),s++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new ch(t,n,r,o),s=!1;for(let e=0;!s&&e<l.length;e+=2)null!=l[e]&&l[e+1]<n&&(s=!0);return s&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let o=e.map[i];if(r[o])continue;r[o]=!0;let l=n.nodeAt(o);if(!l)throw RangeError(`No cell with offset ${o} found`);let a=null,s=l.attrs;for(let n=0;n<s.colspan;n++){let r=t[(i+n)%e.width*2];null==r||s.colwidth&&s.colwidth[n]==r||((a||(a=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(s)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,l,e),a}(e))}};function cp(e,t){if("string"==typeof e)return{};let n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,i=Number(e.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(let n in t){let r=t[n].getFromDOM,i=r&&r(e);null!=i&&(o[n]=i)}return o}function cf(e,t){let n={};for(let r in 1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(",")),t){let i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function cm(e){if(null!==e){if(!Array.isArray(e))throw TypeError("colwidth must be null or an array");for(let t of e)if("number"!=typeof t)throw TypeError("colwidth must be null or an array of numbers")}}function cg(e){let t=e.cached.tableNodeTypes;if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let cv=new ns.hs("selectingCells");function cy(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function cw(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function cb(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=cy(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function ck(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function cC(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function cx(e,t,n){let r=e.node(-1),i=ch.get(r),o=e.start(-1),l=i.nextCell(e.pos-o,t,n);return null==l?null:e.node(0).resolve(o+l)}function cS(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var cM=class e extends ns.LN{constructor(e,t=e){const n=e.node(-1),r=ch.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const s=a.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new ns.yn(l.resolve(r),l.resolve(r+t.content.size))});super(s[0].$from,s[0].$to,s),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ck(r)&&ck(i)&&cC(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return ns.U3.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=ch.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){let l=[];for(let o=n*t.width+r.left,a=r.left;a<r.right;a++,o++){let n=t.map[o];if(i[n])continue;i[n]=!0;let a=t.findCell(n),s=e.nodeAt(n);if(!s)throw RangeError(`No cell with offset ${n} found`);let c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=s.attrs;if(c>0&&(e=cS(e,0,c)),d>0&&(e=cS(e,e.colspan-d,d)),a.left<r.left){if(!(s=s.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else s=s.type.create(e,s.content)}if(a.top<r.top||a.bottom>r.bottom){let e={...s.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};s=a.top<r.top?s.type.createAndFill(e):s.type.create(e,s.content)}l.push(s)}o.push(e.child(n).copy(rE.FK.from(l)))}let l=this.isColSelection()&&this.isRowSelection()?e:o;return new rE.Ji(rE.FK.from(l),1,1)}replace(e,t=rE.Ji.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:l}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(l.pos),i?rE.Ji.empty:t)}let i=ns.LN.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new rE.Ji(rE.FK.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=ch.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=ch.get(r),o=t.start(-1),l=i.findCell(t.pos-o),a=i.findCell(n.pos-o),s=t.node(0);return l.top<=a.top?(l.top>0&&(t=s.resolve(o+i.map[l.left])),a.bottom<i.height&&(n=s.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=s.resolve(o+i.map[a.left])),l.bottom<i.height&&(t=s.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ch.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=ch.get(r),o=t.start(-1),l=i.findCell(t.pos-o),a=i.findCell(n.pos-o),s=t.node(0);return l.left<=a.left?(l.left>0&&(t=s.resolve(o+i.map[l.top*i.width])),a.right<i.width&&(n=s.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=s.resolve(o+i.map[a.top*i.width])),l.right<i.width&&(t=s.resolve(o+i.map[i.width*(l.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new cT(this.$anchorCell.pos,this.$headCell.pos)}};cM.prototype.visible=!1,ns.LN.jsonID("cell",cM);var cT=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&cC(t,n)?new cM(t,n):ns.LN.near(n,1)}};function cN(e){if(!(e.selection instanceof cM))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(ii.NZ.node(n,n+e.nodeSize,{class:"selectedCell"}))}),ii.zF.create(e.doc,t)}let cA=new ns.hs("fix-tables");function cO(e){let t=ch.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){let r=[];for(let n=0;n<i;n++){let l=o*i+n,a=t.map[l];if(o>0){let e=l-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=l-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function cI(e,t){let n=[],r=ch.get(e),i=r.height,o=r.width;for(let l=0;l<i;l++){let i=e.child(l),a=[];for(let n=0;n<o;n++){let i=t[l][n];if(!i)continue;let o=r.map[l*r.width+n],s=e.nodeAt(o);if(!s)continue;let c=s.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let s=i.type.createChecked(i.attrs,a,i.marks);n.push(s)}return e.type.createChecked(e.attrs,n,e.marks)}function cE(e,t,n,r){let i,o=t[0]>n[0]?-1:1,l=e.splice(t[0],t.length),a=+(l.length%2==0);return i=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-a+1:-1===o?n[0]:n[n.length-1]-a,e.splice(i,0,...l),e}function c_(e){var t=e;for(let e=t.depth;e>=0;e-=1){let n=t.node(e);if((e=>"table"===e.type.spec.tableRole)(n))return{node:n,pos:0===e?0:t.before(e),start:t.start(e),depth:e}}return null}function cR(e,t){let n=c_(t.$from);if(!n)return;let r=ch.get(n.node);if(!(e<0)&&!(e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function cL(e,t){let n=c_(t.$from);if(!n)return;let r=ch.get(n.node);if(!(e<0)&&!(e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function cP(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=cR(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=cR(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>o&&(o=t)})}let l=[];for(let t=i;t<=o;t++){let n=cR(t,e.selection);n&&n.length>0&&l.push(t)}i=l[0],o=l[l.length-1];let a=cR(i,e.selection),s=cL(0,e.selection);if(!a||!s)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=cR(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:l}}function c$(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=cL(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=cL(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>o&&(o=t)})}let l=[];for(let t=i;t<=o;t++){let n=cL(t,e.selection);n&&n.length>0&&l.push(t)}i=l[0],o=l[l.length-1];let a=cL(i,e.selection),s=cR(0,e.selection);if(!a||!s)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=cL(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:l}}function cD(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function cj(e){let t=e.selection,n=cb(e),r=n.node(-1),i=n.start(-1),o=ch.get(r);return{...t instanceof cM?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function cF(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=cg(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let l=0;l<t.height;l++){let a=l*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],s=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,function(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}(s.attrs,i-t.colCount(o))),l+=s.attrs.rowspan-1}else{let s=null==o?cg(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(l,i,r);e.insert(e.mapping.map(n+c),s.createAndFill())}}return e}function cB(e,t){if(!cw(e))return!1;if(t){let n=cj(e);t(cF(e.tr,n,n.left))}return!0}function cH(e,t){if(!cw(e))return!1;if(t){let n=cj(e);t(cF(e.tr,n,n.right))}return!0}function cz(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function cq(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!cw(t))return!1;if(n){let r=cg(t.schema),i=cj(t),o=t.tr,l=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=l.map(e=>i.table.nodeAt(e));for(let e=0;e<l.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+l[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<l.length;e++)o.setNodeMarkup(i.tableStart+l[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!cw(t))return!1;if(n){let r=cg(t.schema),i=cj(t),o=t.tr,l=cz("row",i,r),a=cz("column",i,r),s=+("column"===e?!!l:"row"===e&&!!a),c="column"==e?{left:0,top:s,right:1,bottom:i.map.height}:"row"==e?{left:s,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,d,n.attrs)}),n(o)}return!0}}function cK(e){return function(t,n){if(!cw(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(cb(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(ns.U3.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function cW(e,t){let n=e.selection;if(!(n instanceof cM))return!1;if(t){let r=e.tr,i=cg(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new rE.Ji(i,0,0))}),r.docChanged&&t(r)}return!0}function cU(e,t){let n=e.createAndFill();return new nc.dL(n).replace(0,n.content.size,t).doc}function cV(e,t,n,r,i,o,l,a){if(0==l||l==t.height)return!1;let s=!1;for(let c=i;c<o;c++){let i=l*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){s=!0;let i=n.nodeAt(o),{top:d,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:l-d}),e.insert(e.mapping.slice(a).map(t.positionAt(l,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-l})),c+=i.attrs.colspan-1}}return s}function cJ(e,t,n,r,i,o,l,a){if(0==l||l==t.width)return!1;let s=!1;for(let c=i;c<o;c++){let i=c*t.width+l,o=t.map[i];if(t.map[i-1]==o){s=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,cS(i.attrs,l-d,i.attrs.colspan-(l-d))),e.insert(u+i.nodeSize,i.type.createAndFill(cS(i.attrs,0,l-d))),c+=i.attrs.rowspan-1}}return s}function cG(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw Error("No table found");let l=ch.get(o),{top:a,left:s}=r,c=s+i.width,d=a+i.height,u=e.tr,h=0;function p(){if(!(o=n?u.doc.nodeAt(n-1):u.doc))throw Error("No table found");l=ch.get(o),h=u.mapping.maps.length}(function(e,t,n,r,i,o,l){let a,s,c=cg(e.doc.type.schema);if(i>t.width)for(let o=0,l=0;o<t.height;o++){let d,u=n.child(o);l+=u.nodeSize;let h=[];d=null==u.lastChild||u.lastChild.type==c.cell?a||(a=c.cell.createAndFill()):s||(s=c.header_cell.createAndFill());for(let e=t.width;e<i;e++)h.push(d);e.insert(e.mapping.slice(0).map(l-1+r),h)}if(o>t.height){let l=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==c.header_cell;l.push(i?s||(s=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}let d=c.row.create(null,rE.FK.from(l)),u=[];for(let e=t.height;e<o;e++)u.push(d);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),u)}return!!(a||s)})(u,l,o,n,c,d,0)&&p(),cV(u,l,o,n,s,c,a,h)&&p(),cV(u,l,o,n,s,c,d,h)&&p(),cJ(u,l,o,n,a,d,s,h)&&p(),cJ(u,l,o,n,a,d,c,h)&&p();for(let e=a;e<d;e++){let t=l.positionAt(e,s,o),r=l.positionAt(e,c,o);u.replace(u.mapping.slice(h).map(t+n),u.mapping.slice(h).map(r+n),new rE.Ji(i.rows[e-a],0,0))}p(),u.setSelection(new cM(u.doc.resolve(n+l.positionAt(a,s,o)),u.doc.resolve(n+l.positionAt(d-1,c-1,o)))),t(u)}cq("row",{useDeprecatedLogic:!0}),cq("column",{useDeprecatedLogic:!0}),cq("cell",{useDeprecatedLogic:!0});let cZ=r7({ArrowLeft:cX("horiz",-1),ArrowRight:cX("horiz",1),ArrowUp:cX("vert",-1),ArrowDown:cX("vert",1),"Shift-ArrowLeft":cQ("horiz",-1),"Shift-ArrowRight":cQ("horiz",1),"Shift-ArrowUp":cQ("vert",-1),"Shift-ArrowDown":cQ("vert",1),Backspace:cW,"Mod-Backspace":cW,Delete:cW,"Mod-Delete":cW});function cY(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function cX(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof cM)return cY(n,r,ns.LN.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let l=c5(i,e,t);if(null==l)return!1;if("horiz"==e)return cY(n,r,ns.LN.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(l),a=cx(o,e,t);return i=a?ns.LN.near(a,1):t<0?ns.LN.near(n.doc.resolve(o.before(-1)),-1):ns.LN.near(n.doc.resolve(o.after(-1)),1),cY(n,r,i)}}}function cQ(e,t){return(n,r,i)=>{let o;if(!i)return!1;let l=n.selection;if(l instanceof cM)o=l;else{let r=c5(i,e,t);if(null==r)return!1;o=new cM(n.doc.resolve(r))}let a=cx(o.$headCell,e,t);return!!a&&cY(n,r,new cM(o.$anchorCell,a))}}function c1(e,t){let n=cy(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new cM(n))),!0)}function c0(e,t,n){if(!cw(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),o=i.type.spec.tableRole,l=i.type.schema,a=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,o=e?0:Math.max(0,n-1),s=e<t.childCount-1?0:Math.max(0,r-1);(o||s)&&(i=cU(cg(l).row,new rE.Ji(i,o,s)).content),a.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;a.push(n||r?cU(cg(l).row,new rE.Ji(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(rE.FK.empty),n[i]<r){let o=cg(e).cell.createAndFill(),l=[];for(let e=n[i];e<r;e++)l.push(o);t[i]=t[i].append(rE.FK.from(l))}return{height:t.length,width:r,rows:t}}(l,a)}(n),i=e.state.selection;if(i instanceof cM){r||(r={width:1,height:1,rows:[rE.FK.from(cU(cg(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=ch.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let o=n[e],l=[];for(let n=t[e]||0,i=0;n<r;i++){let a=o.child(i%o.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(cS(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),l.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(rE.FK.from(l))}n=i,e=r}if(t!=i){let e=[];for(let r=0,o=0;r<i;r++,o++){let l=[],a=n[o%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),l.push(t)}e.push(rE.FK.from(l))}n=e,t=i}return{width:e,height:t,rows:n}}(r,l.right-l.left,l.bottom-l.top),cG(e.state,e.dispatch,o,l,r),!0}if(!r)return!1;{let t=cb(e.state),n=t.start(-1);return cG(e.state,e.dispatch,n,ch.get(t.node(-1)).findCell(t.pos-n),r),!0}}function c2(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=c3(e,t.target);if(t.shiftKey&&e.state.selection instanceof cM)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=cy(e.state.selection.$anchor))&&(null==(n=c9(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=c9(e,n),i=null==cv.getState(e.state);if(!r||!cC(t,r))if(!i)return;else r=t;let o=new cM(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(cv,t.pos),e.dispatch(n)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",a),null!=cv.getState(e.state)&&e.dispatch(e.state.tr.setMeta(cv,-1))}function a(n){let r,a=cv.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(c3(e,n.target)!=i&&!(r=c9(e,t)))return l();r&&o(r,n)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",a)}function c5(e,t,n){if(!(e.state.selection instanceof ns.U3))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))break;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){let o=r.before(i),l="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?o:null}}return null}function c3(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function c9(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&cy(e.state.doc.resolve(r))||cy(e.state.doc.resolve(i))}var c7=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),c4(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,c4(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function c4(e,t,n,r,i,o){let l=0,a=!0,s=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=i==n?o:u&&u[e],d=c?c+"px":"";if(l+=c||r,c||(a=!1),s)s.style.width!=d&&(s.style.width=d),s=s.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;s;){var d;let e=s.nextSibling;null==(d=s.parentNode)||d.removeChild(s),s=e}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}let c8=new ns.hs("tableColumnResizing");var c6=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(c8);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return ck(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function de(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:o}=i,l=cy(e.state.doc.resolve(o));if(!l)return -1;if("right"==n)return l.pos;let a=ch.get(l.node(-1)),s=l.start(-1),c=a.map.indexOf(l.pos-s);return c%a.width==0?-1:s+a.map[c-1]}function dt(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function dn(e,t){e.dispatch(e.state.tr.setMeta(c8,{setHandle:t}))}function dr(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),l=i.start(-1),a=ch.get(o).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1,s=e.domAtPos(i.start(-1)).node;for(;s&&"TABLE"!=s.nodeName;)s=s.parentNode;s&&c4(o,s.firstChild,s,r,a,n)}var di="u">typeof navigator?navigator:null,dl=di&&di.userAgent||"",da=/Edge\/(\d+)/.exec(dl),ds=/MSIE \d/.exec(dl),dc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dl),dd=!(ds||dc||da)&&!!di&&/Apple Computer/.test(di.vendor),du=new ns.hs("safari-ime-span"),dh=!1;function dp(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var df=new ns.k_(dd?{key:du,props:{decorations:function(e){let{$from:t,$to:n,to:r}=e.selection;if(dh&&t.sameParent(n)){let t=ii.NZ.widget(r,dp,{ignoreSelection:!0,key:"safari-ime-span"});return ii.zF.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{dh=!0},compositionend:()=>{dh=!1}}}}:{key:du}),dm=n(74576);function dg(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var dv=oy("strike_through");dg(dv,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var dy=om("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(dv.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));dg(dy.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),dg(dy.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var dw=ol("ToggleStrikeThrough",e=>()=>rJ(dy.type(e)));dg(dw,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var db=oa(e=>nK(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,dy.type(e)));dg(db,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var dk=og("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{let t=e.get(iO);return()=>t.call(dw.key)}}});dg(dk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),dg(dk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var dC=function(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:cm}};for(let e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>cp(e,t)}],toDOM:e=>["td",cf(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>cp(e,t)}],toDOM:e=>["th",cf(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),dx=of("table",()=>({...dC.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:0===t}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{let n=t.content.firstChild?.content;if(!n)return;let r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));dg(dx.node,{displayName:"NodeSchema<table>",group:"Table"}),dg(dx.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var dS=of("table_header_row",()=>({...dC.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&!!e.querySelector("th")&&{}}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>!!("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));dg(dS.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),dg(dS.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var dM=of("table_row",()=>({...dC.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));dg(dM.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),dg(dM.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var dT=of("table_cell",()=>({...dC.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));dg(dT.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),dg(dT.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var dN=of("table_header",()=>({...dC.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));function dA(e,t=3,n=3){let r=Array(n).fill(0).map(()=>dT.type(e).createAndFill()),i=Array(n).fill(0).map(()=>dN.type(e).createAndFill()),o=Array(t).fill(0).map((t,n)=>0===n?dS.type(e).create(null,i):dM.type(e).create(null,r));return dx.type(e).create(null,o)}function dO(e){return(t,n)=>r=>{n=n??r.selection.from;let i=r.doc.resolve(n),o=n2(e=>"table"===e.type.name)(i),l=o?{node:o.node,from:o.start}:void 0,a="row"===e;if(l){let e=ch.get(l.node);if(t>=0&&t<(a?e.height:e.width)){let n=e.positionAt(a?t:e.height-1,a?e.width-1:t,l.node),i=r.doc.resolve(l.from+n),o=a?cM.rowSelection:cM.colSelection,s=e.positionAt(a?t:0,a?0:t,l.node),c=r.doc.resolve(l.from+s);return n1(r.setSelection(o(i,c)))}}return r}}dg(dN.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),dg(dN.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});var dI=dO("row"),dE=dO("col");function d_(e,t,{map:n,tableStart:r,table:i},o){let l=Array(o).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),a=Array(n.width).fill(0).map((t,r)=>{let o=i.nodeAt(n.map[r]);return dT.type(e).createAndFill({alignment:o?.attrs.alignment})});return t.insert(l,dM.type(e).create(null,a)),t}var dR=ol("GoToPrevTableCell",()=>()=>cK(-1));dg(dR,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var dL=ol("GoToNextTableCell",()=>()=>cK(1));dg(dL,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var dP=ol("ExitTable",e=>()=>(t,n)=>{var r;if(!cw(t))return!1;let{$head:i}=t.selection,o=(r=dx.type(e),n0(e=>e.type===r)(i));if(!o)return!1;let{to:l}=o,a=t.tr.replaceWith(l,l,lu.type(e).createAndFill());return a.setSelection(ns.LN.near(a.doc.resolve(l),1)).scrollIntoView(),n?.(a),!0});dg(dP,{displayName:"Command<breakTableCommand>",group:"Table"});var d$=ol("InsertTable",e=>({row:t,col:n}={})=>(r,i)=>{let{selection:o,tr:l}=r,{from:a}=o,s=dA(e,t,n),c=l.replaceSelectionWith(s),d=ns.LN.findFrom(c.doc.resolve(a),1,!0);return d&&c.setSelection(d),i?.(c),!0});dg(d$,{displayName:"Command<insertTableCommand>",group:"Table"});var dD=ol("MoveRow",()=>({from:e,to:t,pos:n}={})=>{var r;return r={from:e??0,to:t??0,pos:n},(e,t)=>{let{from:n,to:i,select:o=!0,pos:l=e.selection.from}=r,a=e.tr;return!!function(e){var t,n,r,i,o,l;let a,{tr:s,originIndex:c,targetIndex:d,select:u,pos:h}=e,p=c_(s.doc.resolve(h));if(!p)return!1;let f=null==(t=c$(s,c))?void 0:t.indexes,m=null==(n=c$(s,d))?void 0:n.indexes;if(!f||!m||f.includes(d))return!1;let g=(r=p.node,i=f,o=m,l=0,a=cO(r),cI(r,a=cE(a,i,o,0)));if(s.replaceWith(p.pos,p.pos+p.node.nodeSize,g),!u)return!0;let v=ch.get(g),y=p.start,w=v.positionAt(d,v.width-1,g),b=s.doc.resolve(y+w),k=v.positionAt(d,0,g),C=s.doc.resolve(y+k);return s.setSelection(cM.rowSelection(b,C)),!0}({tr:a,originIndex:n,targetIndex:i,select:o,pos:l})&&(null==t||t(a),!0)}});dg(dD,{displayName:"Command<moveRowCommand>",group:"Table"});var dj=ol("MoveCol",()=>({from:e,to:t,pos:n}={})=>{var r;return r={from:e??0,to:t??0,pos:n},(e,t)=>{let{from:n,to:i,select:o=!0,pos:l=e.selection.from}=r,a=e.tr;return!!function(e){var t,n,r,i,o,l;let a,{tr:s,originIndex:c,targetIndex:d,select:u,pos:h}=e,p=c_(s.doc.resolve(h));if(!p)return!1;let f=null==(t=cP(s,c))?void 0:t.indexes,m=null==(n=cP(s,d))?void 0:n.indexes;if(!f||!m||f.includes(d))return!1;let g=(r=p.node,i=f,o=m,l=0,a=cD(cO(r)),cI(r,a=cD(a=cE(a,i,o,0))));if(s.replaceWith(p.pos,p.pos+p.node.nodeSize,g),!u)return!0;let v=ch.get(g),y=p.start,w=v.positionAt(v.height-1,d,g),b=s.doc.resolve(y+w),k=v.positionAt(0,d,g),C=s.doc.resolve(y+k);return s.setSelection(cM.colSelection(b,C)),!0}({tr:a,originIndex:n,targetIndex:i,select:o,pos:l})&&(null==t||t(a),!0)}});dg(dj,{displayName:"Command<moveColCommand>",group:"Table"});var dF=ol("SelectRow",()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(dI(e.index,e.pos)(r))});dg(dF,{displayName:"Command<selectRowCommand>",group:"Table"});var dB=ol("SelectCol",()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(dE(e.index,e.pos)(r))});dg(dB,{displayName:"Command<selectColCommand>",group:"Table"});var dH=ol("SelectTable",()=>()=>(e,t)=>{let{tr:n}=e;return!!t?.(function(e){let t=function(e){let t=c_(e.$from);if(!t)return;let n=ch.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{let n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}(e.selection);if(t&&t[0]){let n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){let t=e.doc.resolve(r.pos);return n1(e.setSelection(new cM(t,n)))}}return e}(n))});dg(dH,{displayName:"Command<selectTableCommand>",group:"Table"});var dz=ol("DeleteSelectedCells",()=>()=>(e,t)=>{let{selection:n}=e;if(!(n instanceof cM))return!1;let r=n.isRowSelection(),i=n.isColSelection();if(r&&i){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}if(i){if(!cw(e))return!1;if(t){let n=cj(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let o=e.mapping.maps.length;for(let l=0;l<t.height;){let a=l*t.width+i,s=t.map[a],c=n.nodeAt(s),d=c.attrs;if(i>0&&t.map[a-1]==s||i<t.width-1&&t.map[a+1]==s)e.setNodeMarkup(e.mapping.slice(o).map(r+s),null,cS(d,i-t.colCount(s)));else{let t=e.mapping.slice(o).map(r+s);e.delete(t,t+c.nodeSize)}l+=d.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ch.get(e)}t(r)}return!0}if(!cw(e))return!1;if(t){let n=cj(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;let l=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,l+r);let s=new Set;for(let o=0,l=i*t.width;o<t.width;o++,l++){let c=t.map[l];if(!s.has(c)){if(s.add(c),i>0&&c==t.map[l-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[l+t.width]){let l=n.nodeAt(c),s=l.attrs,d=l.type.create({...s,rowspan:l.attrs.rowspan-1},l.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=s.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ch.get(n.table)}t(r)}return!0});dg(dz,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var dq=ol("AddColBefore",()=>()=>cB);dg(dq,{displayName:"Command<addColBeforeCommand>",group:"Table"});var dK=ol("AddColAfter",()=>()=>cH);dg(dK,{displayName:"Command<addColAfterCommand>",group:"Table"});var dW=ol("AddRowBefore",e=>()=>(t,n)=>{if(!cw(t))return!1;if(n){let r=cj(t);n(d_(e,t.tr,r,r.top))}return!0});dg(dW,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var dU=ol("AddRowAfter",e=>()=>(t,n)=>{if(!cw(t))return!1;if(n){let r=cj(t);n(d_(e,t.tr,r,r.bottom))}return!0});dg(dU,{displayName:"Command<addRowAfterCommand>",group:"Table"});var dV=ol("SetAlign",()=>(e="left")=>{var t;return t="alignment",function(n,r){if(!cw(n))return!1;let i=cb(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){let o=n.tr;n.selection instanceof cM?n.selection.forEachCell((n,r)=>{n.attrs[t]!==e&&o.setNodeMarkup(r,null,{...n.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}});dg(dV,{displayName:"Command<setAlignCommand>",group:"Table"});var dJ=oa(e=>new nd(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,i)=>{let o=t.doc.resolve(r);if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),dx.type(e)))return null;let l=dA(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),a=t.tr.replaceRangeWith(r,i,l);return a.setSelection(ns.U3.create(a.doc,r+3)).scrollIntoView()}));dg(dJ,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var dG=(x=e=>({run:(t,n,r)=>{if(r)return t;function i(t){let n=t.childCount,r=t.lastChild?.childCount??0;if(0===n||0===r)return lu.type(e).create();let i=t.firstChild;if(!(r>0&&i&&0===i.childCount))return t;if(n>=3){let r=t.child(1),o=[];for(let t=0;t<r.childCount;t++){let n=r.child(t);o.push(dN.type(e).create(n.attrs,n.content,n.marks))}let l=i.type.create(i.attrs,o),a=[];for(let e=2;e<n;e++)a.push(t.child(e));return t.type.create(t.attrs,[l,...a])}let o=Array(r).fill(0).map(()=>dN.type(e).createAndFill()),l=new rE.Ji(rE.FK.from(o),0,0),a=i.replace(0,0,l);return t.replace(0,i.nodeSize,new rE.Ji(rE.FK.from(a),0,0))}let o=function t(n){let r=function(t){let n=dM.type(e),r=[],o=[],l=!1;function a(){if(0===o.length)return;let t=dS.type(e).createAndFill(),n=dx.type(e).create(null,[t,...o]);r.push(i(n)),o=[]}return t.forEach(e=>{e.type===n?(l=!0,o.push(e)):(a(),r.push(e))}),a(),l?rE.FK.from(r):t}(n),o=r!==n,l=[];return r.forEach(n=>{if(n.type===dx.type(e)){let e=i(n);e!==n&&(o=!0),l.push(e)}else if(n.childCount>0){let e=t(n.content);e!==n.content?(o=!0,l.push(n.copy(e))):l.push(n)}else l.push(n)}),o?rE.FK.from(l):n}(t.content);return o=function(t){let n=[],r=[];t.forEach(e=>r.push(e));for(let t=0;t<r.length;t++){let i=r[t],o=r[t+1];i.type===lu.type(e)&&0===i.content.size&&o&&o.type===dx.type(e)||n.push(i)}return n.length<r.length?rE.FK.from(n):t}(o),new rE.Ji(rE.FK.from(o),t.openStart,t.openEnd)}}),a=e=>async()=>{await e.wait(ik);let t=x(e);return e.update(i1,e=>[...e,t]),a.pasteRule=t,()=>{e.update(i1,e=>e.filter(e=>e!==t))}});dg(dG,{displayName:"PasteRule<table>",group:"Table"});var dZ=og("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{let t=e.get(iO);return()=>t.call(dL.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{let t=e.get(iO);return()=>t.call(dR.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{let t=e.get(iO);return()=>t.call(dP.key)}}});dg(dZ.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),dg(dZ.shortcuts,{displayName:"Keymap<table>",group:"Table"});var dY="footnote_definition",dX="footnoteDefinition",dQ=of("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${dY}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{let t=e.attrs.label;return["dl",{"data-label":t,"data-type":dY},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===dX,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===dY,runner:(e,t)=>{e.openNode(dX,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));dg(dQ.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),dg(dQ.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var d1="footnote_reference",d0=of("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${d1}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return["sup",{"data-label":t,"data-type":d1},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===d1,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));dg(d0.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),dg(d0.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var d2=l0.extendSchema(e=>t=>{let n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);let i=null!=t.label?`${t.label}.`:"•",o=null!=t.checked?!!t.checked:null,l=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:i,listType:l,spread:a,checked:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);let r=t.attrs.label,i=t.attrs.listType,o="true"===t.attrs.spread,l=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:i,spread:o,checked:l}),e.next(t.content),e.closeNode()}}}});dg(d2.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),dg(d2.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var d5=oa(()=>new nd(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{let i=e.doc.resolve(n),o=0,l=i.node(o);for(;l&&"list_item"!==l.type.name;)o--,l=i.node(o);if(!l||null!=l.attrs.checked)return null;let a=t.groups?.checked==="x",s=i.before(o),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(s,void 0,{...l.attrs,checked:a}),c}));dg(d5,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var d3=[dk,dZ].flat(),d9=[dJ,d5],d7=[db],d4=[dG],d8=od(()=>df);dg(d8,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"}),dg(od(()=>(function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=c7,lastColumnResizable:i=!0}={}){let o=new ns.k_({key:c8,state:{init(e,t){var i;let l=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=cg(t.schema).table.name;return r&&l&&(l[a]=(e,t)=>new r(e,n,t)),new c6(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=c8.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=c8.getState(e.state);if(i&&!i.dragging){let o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),l=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?l=de(e,t,"left",n):i-t.clientX<=n&&(l=de(e,t,"right",n))}if(l!=i.activeHandle){if(!r&&-1!==l){let t=e.state.doc.resolve(l),n=t.node(-1),r=ch.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}dn(e,l)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=c8.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&dn(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,l=c8.getState(e.state);if(!l||-1==l.activeHandle||l.dragging)return;let a=e.state.doc.nodeAt(l.activeHandle),s=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),l=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(l-=r[e],a--);return l/a}(e,l.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=c8.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),o=ch.get(i),l=r.start(-1),a=o.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,s=e.state.tr;for(let e=0;e<o.height;e++){let t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;let r=o.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;let u=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);u[d]=n,s.setNodeMarkup(l+r,null,{...c,colwidth:u})}s.docChanged&&e.dispatch(s)}(e,r.activeHandle,dt(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(c8,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=c8.getState(e.state);if(i&&i.dragging){let o=dt(i.dragging,t,n);dr(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(c8,{setDragging:{startX:t.clientX,startWidth:s}})),dr(e,l.activeHandle,s,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=c8.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return ii.zF.empty;let o=ch.get(i),l=r.start(-1),a=o.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<o.height;t++){let r=a+t*o.width;if((a==o.width-1||o.map[r]!=o.map[r+1])&&(0==t||o.map[r]!=o.map[r-o.width])){var s;let t=o.map[r],a=l+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(s=c8.getState(e))?void 0:s.dragging)&&n.push(ii.NZ.node(l+t,l+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(ii.NZ.widget(a,c))}}return ii.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o})({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var d6=od(()=>(function({allowTableNodeSelection:e=!1}={}){return new ns.k_({key:cv,state:{init:()=>null,apply(e,t){let n=e.getMeta(cv);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:cN,handleDOMEvents:{mousedown:c2},createSelectionBetween:e=>null!=cv.getState(e.state)?e.state.selection:null,handleTripleClick:c1,handleKeyDown:cZ,handlePaste:c0},appendTransaction:(t,n,r)=>{let i,o;return function(e,t,n){let r,i,o=(t||e).selection,l=(t||e).doc;if(o instanceof ns.nh&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=cM.create(l,o.from);else if("row"==i){let e=l.resolve(o.from+1);r=cM.rowSelection(e,e)}else if(!n){let e=ch.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=cM.create(l,t+1,n)}}else o instanceof ns.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(o)?r=ns.U3.create(l,o.from):o instanceof ns.U3&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(o)&&(r=ns.U3.create(l,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}(r,(o=(e,t)=>{"table"==e.type.spec.tableRole&&(i=function(e,t,n,r){let i,o,l=ch.get(t);if(!l.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<l.height;e++)a.push(0);for(let e=0;e<l.problems.length;e++){let i=l.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let o=e.attrs;for(let e=0;e<o.rowspan;e++)a[i.row+e]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,cS(o,o.colspan-i.n,i.n))}else if("missing"==i.type)a[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<a.length;e++)a[e]&&(null==i&&(i=e),o=e);for(let s=0,c=n+1;s<l.height;s++){let n=t.child(s),l=c+n.nodeSize,d=a[s];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<d;n++){let n=cg(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==s||i==s-1)&&o==s?c+1:l-1;r.insert(r.mapping.map(u),a)}c=l}return r.setMeta(cA,{fixTables:!0})}(r,e,t,i))},n?n.doc!=r.doc&&function e(t,n,r,i){let o=t.childCount,l=n.childCount;e:for(let a=0,s=0;a<l;a++){let l=n.child(a);for(let e=s,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==l){s=e+1,r+=l.nodeSize;continue e}i(l,r),s<o&&t.child(s).sameMarkup(l)?e(t.child(s),l,r+1,i):l.nodesBetween(0,l.content.size,i,r+1),r+=l.nodeSize}}(n.doc,r.doc,0,o):r.doc.descendants(o),i),e)}})})({allowTableNodeSelection:!0}));dg(d6,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var ue=ow("remarkGFM",()=>dm.A);dg(ue.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),dg(ue.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var ut=new ns.hs("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN"),un=od(()=>new ns.k_({key:ut,appendTransaction:(e,t,n)=>{let r;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{let i;if(r||(r=n.tr),"table_cell"!==e.type.name)return;let o=n.doc.resolve(t),l=o.node(o.depth),a=o.node(o.depth-1).firstChild;if(!a)return;let s=(i=0,l.forEach((t,n,r)=>{t===e&&(i=r)}),i),c=a.maybeChild(s);if(!c)return;let d=c.attrs.alignment;d!==e.attrs.alignment&&r.setNodeMarkup(t,void 0,{...e.attrs,alignment:d})}),r}}));dg(un,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var ur=[un,d8,ue,d6].flat(),ui=[[d2,dx,dS,dM,dN,dT,dQ,d0,dv,dy].flat(),d9,d4,d7,d3,[dL,dR,dP,d$,dD,dj,dF,dB,dH,dz,dW,dU,dq,dK,dV,dw],ur].flat(),uo=n(35930),ul=n(44020),ua=n(43854),us=function(){};us.prototype.append=function(e){return e.length?(e=us.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},us.prototype.prepend=function(e){return e.length?us.from(e).append(this):this},us.prototype.appendInner=function(e){return new ud(this,e)},us.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?us.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},us.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},us.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},us.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},us.from=function(e){return e instanceof us?e:e&&e.length?new uc(e):us.empty};var uc=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(us);us.empty=new uc([]);var ud=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(us);class uu{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let l=this.items.length;for(;;l--)if(this.items.get(l-1).selection){--l;break}t&&(r=(n=this.remapping(l,this.items.length)).maps.length);let a=e.tr,s=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(l,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new uh(e.map));let t=e.step.map(n.slice(r)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],s.push(new uh(i,void 0,void 0,s.length+c.length))),r--,i&&n.appendMap(i,r)}else a.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new uu(this.items.slice(0,l).append(c.reverse().concat(s)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:a,selection:i}}addTransform(e,t,n,r){var i,o;let l,a=[],s=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new uh(e.mapping.maps[n],i,t),l;(l=d&&d.merge(o))&&(o=l,n?a.pop():c=c.slice(0,c.length-1)),a.push(o),t&&(s++,t=void 0),r||(d=o)}let u=s-n.depth;return u>uf&&(i=c,o=u,i.forEach((e,t)=>{if(e.selection&&0==o--)return l=t,!1}),c=i.slice(l),s-=u),new uu(c.append(a),s)}remapping(e,t){let n=new nc.X9;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new uu(this.items.append(e.map(e=>new uh(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(e=>{e.selection&&l--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let s=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&l++,n.push(new uh(s,o,c))}else n.push(new uh(s))},r);let s=[];for(let e=t;e<o;e++)s.push(new uh(i.maps[e]));let c=new uu(this.items.slice(0,r).append(s).append(n),l);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),l=e&&e.getMap();if(n--,l&&t.appendMap(l,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let s=new uh(l.invert(),e,a),c,d=r.length-1;(c=r.length&&r[d].merge(s))?r[d]=c:r.push(s)}}else o.map&&n--},this.items.length,0),new uu(us.from(r.reverse()),i)}}uu.empty=new uu(us.empty,0);class uh{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new uh(t.getMap().invert(),t,this.selection)}}}class up{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let uf=20;function um(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function ug(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let uv=!1,uy=null;function uw(e){let t=e.plugins;if(uy!=t){uv=!1,uy=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){uv=!0;break}}return uv}let ub=new ns.hs("history"),uk=new ns.hs("closeHistory");function uC(e,t){return(n,r)=>{let i=ub.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=uw(t),i=ub.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let l=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),s=new up(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(l).setMeta(ub,{redo:n,historyState:s})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let ux=uC(!1,!0),uS=uC(!0,!0);uC(!1,!1),uC(!0,!1);var uM=Object.defineProperty,uT=Object.getOwnPropertySymbols,uN=Object.prototype.hasOwnProperty,uA=Object.prototype.propertyIsEnumerable,uO=(e,t,n)=>t in e?uM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function uI(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))uN.call(t,n)&&uO(e,n,t[n]);if(uT)for(var n of uT(t))uA.call(t,n)&&uO(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let uE=op({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"\uD83D\uDD0D",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"\uD83D\uDCCB",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");uI(uE,{displayName:"Config<code-block>",group:"CodeBlock"});class u_{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){let t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function uR({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}aM.h,uR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h,aM.FK;let uL=(0,aM.pM)({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){let t=()=>{(function(e){let t,n;return t=this,n=function*(){try{return navigator.clipboard.writeText(e)}catch(o){let t=document.createElement("textarea"),n=document.activeElement;t.value=e,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";let r=document.getSelection(),i=r?r.rangeCount>0&&r.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(t),i&&(r.removeAllRanges(),r.addRange(i)),n&&n.focus()}},new Promise((e,r)=>{var i=e=>{try{l(n.next(e))}catch(e){r(e)}},o=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);l((n=n.apply(t,null)).next())})})(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>(0,aM.h)(aM.FK,null,(0,aM.h)("button",{type:"button",class:"copy-button",onClick:t},(0,aM.h)(uR,{icon:e.copyIcon}),e.copyText))}});aM.h,aM.FK;let uP=(0,aM.pM)({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:i}){let o=(0,aT.KR)(),l=(0,aT.KR)(!1),a=(0,aT.KR)(),s=(0,aT.KR)(),c=(0,aT.KR)("");(0,aM.wB)([l,o,s],()=>{c.value="";let e=o.value,t=s.value;e&&t&&(0,oL.rD)(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});let d=e=>{if(e.preventDefault(),e.stopPropagation(),i())return;let t=!l.value;l.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},u=e=>{c.value=e.target.value},h=e=>{"Escape"===e.key&&(c.value="")},p=(0,aM.EW)(()=>{var t;if(!l.value)return[];let n=null!=(t=r())?t:[],i=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),o=n.filter(e=>{let t=c.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==i});return 0===o.length?[]:i?[i,...o]:o}),f=e=>{let t=e.target;if(o.value&&o.value.contains(t))return;let n=s.value,r=o.value;r&&n&&"true"===r.dataset.expanded&&(n.contains(t)||(l.value=!1))};return(0,aM.sV)(()=>{window.addEventListener("click",f)}),(0,aM.hi)(()=>{window.removeEventListener("click",f)}),()=>(0,aM.h)(aM.FK,null,(0,aM.h)("button",{type:"button",ref:o,class:"language-button",onClick:d,"data-expanded":String(l.value)},e.value||"Text",(0,aM.h)("div",{class:"expand-icon"},(0,aM.h)(uR,{icon:t.expandIcon}))),(0,aM.h)("div",{ref:s,class:"language-picker"},l.value?(0,aM.h)("div",{class:"list-wrapper"},(0,aM.h)("div",{class:"search-box"},(0,aM.h)("div",{class:"search-icon"},(0,aM.h)(uR,{icon:t.searchIcon})),(0,aM.h)("input",{ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:c.value,onInput:u,onKeydown:h}),(0,aM.h)("div",{class:(0,aX.A)("clear-icon",0===c.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),c.value=""}},(0,aM.h)(uR,{icon:t.clearSearchIcon}))),(0,aM.h)("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){let e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},p.value.length?p.value.map(r=>(0,aM.h)("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),l.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):(0,aM.h)("li",{class:"language-list-item no-result"},t.noResultText))):null))}});aM.h,aM.FK;let u$=(0,aM.pM)({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){let{previewOnlyMode:t,config:n,preview:r}=e,i=(0,aT.KR)();return(0,aM.nT)(()=>{let e=i.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);let t=r.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=sU.sanitize(t))}),()=>r.value?(0,aM.h)("div",{class:"preview-panel"},!t.value&&(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"preview-divider"}),(0,aM.h)("div",{class:"preview-label"},n.previewLabel)),(0,aM.h)("div",{ref:i,class:"preview"})):null}});aM.h,aM.FK;let uD=(0,aM.pM)({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){var t;let n=null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly(),r=(0,aT.KR)(n),i=(0,aT.KR)(),o=(0,aT.KR)(null);(0,aM.sV)(()=>{for(var t;null==(t=i.value)?void 0:t.firstChild;)i.value.removeChild(i.value.firstChild);i.value&&i.value.appendChild(e.codemirror.dom)}),(0,aM.wB)(()=>[e.text.value,e.language.value],()=>{let t=e.config.renderPreview(e.language.value,e.text.value,e=>o.value=e);t&&(o.value=t),void 0!==t||o.value||(o.value=sU.sanitize(e.config.previewLoading)),null===t&&(o.value=null)},{immediate:!0});let l=()=>{};return()=>{var t;return(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"tools"},(0,aM.h)(uP,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),(0,aM.h)("div",{class:"tools-button-group"},(0,aM.h)(uL,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:l,text:e.text.value}),o.value?(0,aM.h)("button",{class:"preview-toggle-button",onClick:()=>r.value=!r.value},(0,aM.h)(uR,{icon:e.config.previewToggleButton(r.value)})):null)),(0,aM.h)("div",{ref:i,class:(0,aX.A)("codemirror-host",o.value&&r.value&&"hidden")}),(0,aM.h)(u$,{text:e.text,language:e.language,config:e.config,previewOnlyMode:r,preview:o}))}}});class uj{constructor(e,t,n,r,i){this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=i,this.selected=(0,aT.KR)(!1),this.language=(0,aT.KR)(""),this.text=(0,aT.KR)(""),this.updating=!1,this.languageName="",this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1,{main:r}=e.state.selection,i=n+r.from,o=n+r.to,l=this.view.state.selection;if(e.docChanged||l.from!==i||l.to!==o){let t=this.view.state.tr;e.changes.iterChanges((e,r,i,o,l)=>{l.length?t.replaceWith(n+e,n+r,this.view.state.schema.text(l.toString())):t.delete(n+e,n+r),n+=o-i-(r-e)}),t.setSelection(ns.U3.create(t.doc,i,o)),this.view.dispatch(t)}},this.createApp=()=>aZ(uD,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{let e=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>!!rH(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>ux(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>uS(e.state,e.dispatch)},{key:"Mod-y",run:()=>uS(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;let t=this.cm.state.selection.ranges;if(t.length>1)return!1;let n=t[0];if(n&&(!n.empty||n.anchor>0)||this.cm.state.doc.lines>=2)return!1;let r=this.view.state,i=null!=(e=this.getPos())?e:0,o=r.tr.replaceWith(i,i+this.node.nodeSize,r.schema.nodes.paragraph.createChecked({},this.node.content));return o.setSelection(ns.U3.near(o.doc.resolve(i))),this.view.dispatch(o),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;let{state:r}=this.cm,i=r.selection.main;if(!i.empty||("line"===e&&(i=r.doc.lineAt(i.head)),t<0?i.from>0:i.to<r.doc.length))return!1;let o=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),l=ns.U3.near(this.view.state.doc.resolve(o),t),a=this.view.state.tr.setSelection(l).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new ua.xx,this.readOnlyConf=new ua.xx,this.cm=new ul.Lz({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(ua.$t.readOnly.of(!this.view.editable)),(0,ul.VH)(),ul.w4.of(this.codeMirrorKeymap()),this.languageConf.of([]),ua.$t.changeFilter.of(()=>this.view.editable),...i.extensions,ul.Lz.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=(0,aM.nT)(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){let t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){let e=this.node.attrs.language;e===this.languageName||(this.language.value=e,this.loader.load(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error))}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(ua.$t.readOnly.of(!this.view.editable))});let t=function(e,t){if(e===t)return null;let n=0,r=e.length,i=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&i>n&&e.charCodeAt(r-1)===t.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:t.slice(n,i)}}(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}let uF=oh(lA.node,e=>{let t=e.get(uE.key),n=new u_(t.languages);return(e,r,i)=>new uj(e,r,i,n,t)});uI(uF,{displayName:"NodeView<code-block>",group:"CodeBlock"});let uB=[uF,uE];var uH=n(1148);function uz(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function uq(e,t){return Math.min(uz(e,[t[0],t[1]]),uz(e,[t[2],t[3]]))}WeakMap,WeakMap;class uK extends ns.LN{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return uK.valid(n)?new uK(n):ns.LN.near(n)}content(){return rE.Ji.empty}eq(e){return e instanceof uK&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new uK(e.resolve(t.pos))}getBookmark(){return new uW(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||uU(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||uU(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){t:for(;;){if(!n&&uK.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let l=e.doc.resolve(r);if(uK.valid(l))return l}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ns.nh.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue t}break}i=o,r+=t;let l=e.doc.resolve(r);if(uK.valid(l))return l}return null}}}uK.prototype.visible=!1,uK.findFrom=uK.findGapCursorFrom,ns.LN.jsonID("gapcursor",uK);class uW{constructor(e){this.pos=e}map(e){return new uW(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return uK.valid(t)?new uK(t):ns.LN.near(t)}}function uU(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let uV=r7({ArrowLeft:uJ("horiz",-1),ArrowRight:uJ("horiz",1),ArrowUp:uJ("vert",-1),ArrowDown:uJ("vert",1)});function uJ(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,l=t>0?o.$to:o.$from,a=o.empty;if(o instanceof ns.U3){if(!i.endOfTextblock(n)||0==l.depth)return!1;a=!1,l=e.doc.resolve(t>0?l.after():l.before())}let s=uK.findGapCursorFrom(l,t,a);return!!s&&(r&&r(e.tr.setSelection(new uK(s))),!0)}}function uG(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!uK.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&ns.nh.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new uK(r))),!0)}function uZ(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof uK))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=rE.FK.empty;for(let e=r.length-1;e>=0;e--)i=rE.FK.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new rE.Ji(i,0,0));return o.setSelection(ns.U3.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function uY(e){if(!(e.selection instanceof uK))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ii.zF.create(e.doc,[ii.NZ.widget(e.selection.head,t,{key:"gapcursor"})])}function uX(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}var uQ=op(null,"dropIndicatorState");uX(uQ,{displayName:"Ctx<dropIndicatorState>"});var u1=op({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");uX(u1,{displayName:"Ctx<dropIndicatorConfig>"});var u0=new ns.hs("MILKDOWN_DROP_INDICATOR_DOM"),u2=od(e=>new ns.k_({key:u0,view:t=>{let n=e.get(u1.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(r);let i=e.use(uQ.key),o=e=>{!function(e,t,n){let r,i;if(!t)return Object.assign(e.style,{display:"none"});let{line:o}=t,{width:l}=n,{p1:{x:a,y:s},p2:{x:c,y:d}}=o,u=s,h=a;s===d?(r=c-a,i=l,u-=l/2):(r=l,i=d-s,h-=l/2),u=Math.round(u),h=Math.round(h),Object.assign(e.style,{display:"block",width:`${r}px`,height:`${i}px`,transform:`translate(${h}px, ${u}px)`})}(r,e,n)};return i.on(o),{destroy:()=>{i.off(o),r.remove()}}}}));uX(u2,{displayName:"Prose<dropIndicatorDOM>"});var u5=od(e=>{var t;let n;return t={onShow:t=>{e.set(uQ.key,t)},onHide:()=>{e.set(uQ.key,null)},onDrag:()=>!0},new ns.k_({key:new ns.hs("prosekit-drop-indicator"),view:e=>{var r,i,o,l;let a,s,c,d,u,h,p,f,m,g,v,y;return r=t.onDrag,u=[],i=e,o=n=(t,n)=>{var i,o;return c&&(i=c,o=t,i[0]===o[0]&&i[1]===o[1])?d:(c=t,d=((t,n)=>{let i,o;if(!e.editable||e.isDestroyed)return;let l=(i=e.dom.getBoundingClientRect(),o=e.state.doc,u&&a&&s&&i.width===s.width&&i.height===s.height&&i.x===s.x&&i.y===s.y&&a.eq(o)?u:(s=i,a=o,u=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){let[i,o]=t.pop();if(i>=0){var r;let t=e.nodeDOM(i);if(t&&1===(r=t).nodeType&&"http://www.w3.org/1999/xhtml"===r.namespaceURI){let{top:e,bottom:r,left:l,right:a}=t.getBoundingClientRect();n.push([i,[l,e,a,e]],[i+o.nodeSize,[l,r,a,r]])}}if(o.isBlock&&!o.isTextblock){let e=i+1;for(let n of o.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)));l.sort((e,n)=>{let[r,i]=e,[o,l]=n;return uq(t,i)-uq(t,l)||r-o});let c=(l=l.slice(0,8)).find(t=>r?.({view:e,pos:t[0],event:n})!==!1);if(!(c&&function(e,t){let n=e.dragging;if(!n)return;let{move:r}=n;if(!r)return;let i=e.state.selection;if(!(i instanceof ns.nh))return;let{from:o,to:l}=i;return o<=t&&t<=l}(e,c[0])))return c})(t,n))},l=t,m=i.dom,g=!1,v=()=>{h&&clearTimeout(h),g=!1,h=setTimeout(()=>{g||l.onHide?.()},30)},y=e=>{g=!0;let{clientX:t,clientY:n}=e;if(p===t&&f===n)return;p=t,f=n;let r=o([t,n],e);if(!r)return void v();{let[e,[t,n,o,a]]=r;l.onShow?.({view:i,pos:e,line:{p1:{x:t,y:n},p2:{x:o,y:a}}})}},m.addEventListener("dragover",y),m.addEventListener("dragend",v),m.addEventListener("drop",v),m.addEventListener("dragleave",v),{destroy:()=>{m.removeEventListener("dragover",y),m.removeEventListener("dragend",v),m.removeEventListener("drop",v),m.removeEventListener("dragleave",v)}}},props:{handleDrop(e,t,r,i){if(!n)return!1;let o=n([t.clientX,t.clientY],t);if(!o)return!1;t.preventDefault();let l=o[0],a=e.state.tr;if(i){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let s=a.mapping.map(l),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,d=a.doc;if(c?a.replaceRangeWith(s,s,r.content.firstChild):a.replaceRange(s,s,r),a.doc.eq(d))return!0;let u=a.doc.resolve(s);if(c&&ns.nh.isSelectable(r.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new ns.nh(u));else{var h,p,f;let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection((h=e,p=u,f=a.doc.resolve(t),h.someProp("createSelectionBetween",e=>e(h,p,f))||ns.U3.between(p,f,void 0)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})});uX(u5,{displayName:"Prose<dropIndicator>"});var u3=od(()=>new ns.k_({props:{decorations:uY,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&uK.valid(n)?new uK(n):null,handleClick:uG,handleKeyDown:uV,handleDOMEvents:{beforeinput:uZ}}}));uX(u3,{displayName:"Prose<gapCursor>"});var u9=[u3,u1,uQ,u2,u5].flat(),u7=new ns.hs("prosemirror-virtual-cursor");function u4(e){let t=e.index(),n=e.parent.maybeChild(t),r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[null==r?void 0:r.marks,null==n?void 0:n.marks]}function u8(e){return e&&"object"==typeof e&&"$cursor"in e}var u6=Object.defineProperty,he=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,hr=(e,t,n)=>t in e?u6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function hi(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))ht.call(t,n)&&hr(e,n,t[n]);if(he)for(var n of he(t))hn.call(t,n)&&hr(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let ho=op({imageIcon:"\uD83C\uDF0C",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");function hl({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}hi(ho,{displayName:"Config<image-inline>",group:"ImageInline"}),aM.h,hl.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let ha=oo("abcdefg",8),hs=(0,aM.pM)({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:l,uploadPlaceholderText:a,className:s,onImageLoadError:c}){var d,u;let h=(0,aT.KR)(!1),p=(0,aT.KR)(),f=(0,aT.KR)(null!=(d=t.value)?d:""),m=(0,aT.KR)(ha()),g=(0,aT.KR)((null==(u=t.value)?void 0:u.length)!==0),v=e=>{let t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},w=e=>{var t;let i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>(0,aM.h)("div",{class:(0,aX.A)("image-edit",s)},(0,aM.h)(hl,{icon:i,class:"image-icon"}),(0,aM.h)("div",{class:(0,aX.A)("link-importer",h.value&&"focus")},(0,aM.h)("input",{ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!g.value&&(0,aM.h)("div",{class:"placeholder"},(0,aM.h)("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),(0,aM.h)("label",{class:"uploader",for:m.value},(0,aM.h)(hl,{icon:o})),(0,aM.h)("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&(0,aM.h)(Fragment,null,(0,aM.h)("div",{class:"image-preview"},(0,aM.h)("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),(0,aM.h)("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},(0,aM.h)(hl,{icon:l}))))}});aM.h,aM.FK;let hc=(0,aM.pM)({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t,alt:n,title:r}=e;return()=>{var i;return(null==(i=t.value)?void 0:i.length)?(0,aM.h)("img",{class:"image-inline",src:t.value,alt:n.value,title:r.value}):(0,aM.h)(hs,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),hd=oh(lR.node,e=>(t,n,r)=>{let i=(0,aT.KR)(t.attrs.src),o=(0,aT.KR)(t.attrs.alt),l=(0,aT.KR)(t.attrs.title),a=(0,aT.KR)(!1),s=(0,aT.KR)(!n.editable),c=e.get(ho.key),d=aZ(hc,{src:i,alt:o,title:l,selected:a,readonly:s,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?sU.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";let h=(0,aM.nT)(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){let t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;o.value=e.attrs.alt,l.value=e.attrs.title};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});hi(hd,{displayName:"NodeView<image-inline>",group:"ImageInline"});let hu=[ho,hd];var hh=n(68876),hp=class{#eb;#eC;#ef;#em;#eh;#ep=!1;#eN;#eS;#eA;#ex;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#ex(e,t)},this.destroy=()=>{this.#eN?.(),this.#ex.cancel()},this.show=(e,t)=>{if(this.element.dataset.show="true",e){this.#eN?.(),this.#eN=void 0;let n={...e,contextElement:t?.dom};t&&this.#eO(t)?this.#eN=(0,oL.ll)(n,this.element,()=>this.#eI(n)):this.#eI(n)}this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#eb=e.debounce??200,this.#eC=e.shouldShow??this.#eM,this.#eS=e.offset,this.#eA=e.shift,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.element.dataset.show="false",this.#ex=oR(this.#eT,this.#eb)}#eI=e=>{(0,oL.rD)(e,this.element,{placement:this.#em.placement??"top",middleware:[(0,oL.UU)(),(0,oL.cY)(this.#eS),(0,oL.BN)(this.#eA),...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error)};#eO=e=>this.#eh!==e.dom.parentElement;#eT=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:l}=i,a=Math.min(...l.map(e=>e.$from.pos)),s=Math.max(...l.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(this.#ep||((this.#eh??e.dom.parentElement??document.body).appendChild(this.element),this.#ep=!0),r||c)return;if(this.#eN?.(),this.#eN=void 0,!this.#eC(e,t))return void this.hide();let d={getBoundingClientRect:()=>nQ(e,a,s),contextElement:e.dom};this.#eO(e)?this.#eN=(0,oL.ll)(d,this.element,()=>this.#eI(d)):this.#eI(d),this.show()};#eM=e=>{let{doc:t,selection:n}=e.state,{empty:r,from:i,to:o}=n,l=!t.textBetween(i,o).length&&e.state.selection instanceof ns.U3,a=this.element.contains(document.activeElement),s=!e.hasFocus()&&!a,c=!e.editable;return!s&&!r&&!l&&!c}};function hf(e){let t=op({},`${e}_TOOLTIP_SPEC`),n=od(n=>{let r=n.get(t.key);return new ns.k_({key:new ns.hs(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}var hm=n(69286),hg=n(69817),hv=n(28986),hy=n(66017);let hw={tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,l=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(r){return 36===r?(e.consume(r),l++,t):l<2?n(r):(e.exit("mathFlowFenceSequence"),(0,hv.N)(e,a,"whitespace")(r))}(t)};function a(t){return null===t||(0,hy.HP)(t)?s(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(r){return null===r||(0,hy.HP)(r)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),s(r)):36===r?n(r):(e.consume(r),t)}(t))}function s(n){return(e.exit("mathFlowFence"),r.interrupt)?t(n):e.attempt(hb,c,h)(n)}function c(t){return e.attempt({tokenize:p,partial:!0},h,d)(t)}function d(t){return(o?(0,hv.N)(e,u,"linePrefix",o+1):u)(t)}function u(t){return null===t?h(t):(0,hy.HP)(t)?e.attempt(hb,c,h)(t):(e.enter("mathFlowValue"),function t(n){return null===n||(0,hy.HP)(n)?(e.exit("mathFlowValue"),u(n)):(e.consume(n),t)}(t))}function h(n){return e.exit("mathFlow"),t(n)}function p(e,t,n){let i=0;return(0,hv.N)(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(r){return 36===r?(i++,e.consume(r),t):i<l?n(r):(e.exit("mathFlowFenceSequence"),(0,hv.N)(e,o,"whitespace")(r))}(t)},"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(r){return null===r||(0,hy.HP)(r)?(e.exit("mathFlowFence"),t(r)):n(r)}}},concrete:!0,name:"mathFlow"},hb={tokenize:function(e,t,n){let r=this;return function(n){return null===n?t(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0};function hk(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("mathTextData"===e[t][1].type){e[r][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="mathTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e}function hC(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}let hx={};function hS(e){let t,n=e||hx,r=this.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push({flow:{36:hw},text:{36:(null==(t=(n||{}).singleDollarTextMath)&&(t=!0),{tokenize:function(e,n,r){let i,o,l=0;return function(n){return e.enter("mathText"),e.enter("mathTextSequence"),function n(i){return 36===i?(e.consume(i),l++,n):l<2&&!t?r(i):(e.exit("mathTextSequence"),a(i))}(n)};function a(t){return null===t?r(t):36===t?(o=e.enter("mathTextSequence"),i=0,function t(r){return 36===r?(e.consume(r),i++,t):i===l?(e.exit("mathTextSequence"),e.exit("mathText"),n(r)):(o.type="mathTextData",s(r))}(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):(0,hy.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("mathTextData"),s(t))}function s(t){return null===t||32===t||36===t||(0,hy.HP)(t)?(e.exit("mathTextData"),a(t)):(e.consume(t),s)}},resolve:hk,previous:hC,name:"mathText"})}}),o.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),n=this.stack[this.stack.length-1];(0,hm.ok)("math"===n.type),this.exit(e),n.value=t;let r=n.data.hChildren[0];(0,hm.ok)("element"===r.type),(0,hm.ok)("code"===r.tagName),r.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){let e=this.resume(),t=this.stack[this.stack.length-1];(0,hm.ok)("math"===t.type),t.meta=e},mathFlowValue:e,mathText:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];(0,hm.ok)("inlineMath"===n.type),this.exit(e),n.value=t,n.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),l.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),n.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,n,r){let i=e.value||"",o=n.createTracker(r),l="$".repeat(Math.max((0,hg.D)(i,"$")+1,2)),a=n.enter("mathFlow"),s=o.move(l);if(e.meta){let t=n.enter("mathFlowMeta");s+=o.move(n.safe(e.meta,{after:"\n",before:s,encode:["$"],...o.current()})),t()}return s+=o.move("\n"),i&&(s+=o.move(i+"\n")),s+=o.move(l),a(),s},inlineMath:n}};function n(e,n,r){let i=e.value||"",o=1;for(!t&&o++;RegExp("(^|[^$])"+"\\$".repeat(o)+"([^$]|$)").test(i);)o++;let l="$".repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let a=-1;for(;++a<r.unsafe.length;){let e,t=r.unsafe[a];if(!t.atBreak)continue;let n=r.compilePattern(t);for(;e=n.exec(i);){let t=e.index;10===i.codePointAt(t)&&13===i.codePointAt(t-1)&&t--,i=i.slice(0,t)+" "+i.slice(e.index+1)}}return l+i+l}}(n))}var hM=Object.defineProperty,hT=Object.getOwnPropertySymbols,hN=Object.prototype.hasOwnProperty,hA=Object.prototype.propertyIsEnumerable,hO=(e,t,n)=>t in e?hM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function hI(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))hN.call(t,n)&&hO(e,n,t[n]);if(hT)for(var n of hT(t))hA.call(t,n)&&hO(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}var hE=Object.defineProperty,h_=Object.getOwnPropertySymbols,hR=Object.prototype.hasOwnProperty,hL=Object.prototype.propertyIsEnumerable,hP=(e,t,n)=>t in e?hE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h$=(e,t)=>{for(var n in t||(t={}))hR.call(t,n)&&hP(e,n,t[n]);if(h_)for(var n of h_(t))hL.call(t,n)&&hP(e,n,t[n]);return e};let hD=op(h$({},{mode:"preview"}),"linkTooltipStateCtx");hI(hD,{displayName:"State<link-tooltip>",group:"LinkTooltip"});let hj=op(h$({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");hI(hD,{displayName:"API<link-tooltip>",group:"LinkTooltip"});let hF=op(h$({},{linkIcon:"\uD83D\uDD17",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");hI(hD,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});let hB=ol("ToggleLink",e=>()=>t=>{let{doc:n,selection:r}=t,i=li.type(e);return n.rangeHasMark(r.from,r.to,i)?e.get(hj.key).removeLink(r.from,r.to):e.get(hj.key).addLink(r.from,r.to),!0}),hH=hf("LINK_PREVIEW");hI(hH[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(hH[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});let hz=hf("LINK_EDIT");function hq({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}hI(hz[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(hz[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),aM.h,hq.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let hK=(0,aM.pM)({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){let i=(0,aT.KR)(t);(0,aM.wB)(t,e=>{i.value=e});let o=()=>{n(i.value)},l=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),o()),"Escape"===e.key&&(e.preventDefault(),r())};return()=>(0,aM.h)("div",{class:"link-edit"},(0,aM.h)("input",{class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:l,onInput:e=>{i.value=e.target.value},value:i.value}),i.value?(0,aM.h)(hq,{class:"button confirm",icon:e.value.confirmButton,onClick:o}):null)}});var hW=Object.defineProperty,hU=Object.defineProperties,hV=Object.getOwnPropertyDescriptors,hJ=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,hZ=Object.prototype.propertyIsEnumerable,hY=e=>{throw TypeError(e)},hX=(e,t,n)=>t in e?hW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hQ=(e,t)=>{for(var n in t||(t={}))hG.call(t,n)&&hX(e,n,t[n]);if(hJ)for(var n of hJ(t))hZ.call(t,n)&&hX(e,n,t[n]);return e},h1=(e,t,n)=>t.has(e)||hY("Cannot "+n),h0=(e,t,n)=>(h1(e,t,"read from private field"),n?n.call(e):t.get(e)),h2=(e,t,n)=>t.has(e)?hY("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),h5=(e,t,n,r)=>(h1(e,t,"write to private field"),t.set(e,n),n);let h3={from:-1,to:-1,mark:null};class h9{constructor(e,t){this.ctx=e,h2(this,T),h2(this,N),h2(this,A,hQ({},h3)),h2(this,O),h2(this,I),h2(this,E,(0,aT.KR)("")),h2(this,_,()=>{h0(this,N).hide(),this.ctx.update(hD.key,e=>hU(hQ({},e),hV({mode:"preview"}))),h5(this,A,hQ({},h3))}),h2(this,R,e=>{let t=this.ctx.get(ia),{from:n,to:r,mark:i}=h0(this,A),o=li.type(this.ctx),l=sU.sanitize(e);if(i&&i.attrs.href===l)return void h0(this,_).call(this);let a=t.state.tr;i&&a.removeMark(n,r,i),a.addMark(n,r,o.create({href:l})),t.dispatch(a),h0(this,_).call(this)}),h2(this,L,(e,t,n)=>{let r=this.ctx.get(hF.key);h0(this,I).value=r,h0(this,E).value=e,this.ctx.update(hD.key,e=>hU(hQ({},e),hV({mode:"edit"})));let i=this.ctx.get(ia);i.dispatch(i.state.tr.setSelection(ns.U3.create(i.state.doc,t,n))),h0(this,N).show({getBoundingClientRect:()=>nQ(i,t,n)},i),requestAnimationFrame(()=>{var e;null==(e=h0(this,T).querySelector("input"))||e.focus()})}),this.update=e=>{let{state:t}=e,{selection:n}=t;if(!(n instanceof ns.U3))return;let{from:r,to:i}=n;(r!==h0(this,A).from||i!==h0(this,A).to)&&h0(this,_).call(this)},this.destroy=()=>{h0(this,O).unmount(),h0(this,N).destroy(),h0(this,T).remove()},this.addLink=(e,t)=>{h5(this,A,{from:e,to:t,mark:null}),h0(this,L).call(this,"",e,t)},this.editLink=(e,t,n)=>{h5(this,A,{from:t,to:n,mark:e}),h0(this,L).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{let n=this.ctx.get(ia),r=n.state.tr;r.removeMark(e,t,li.type(this.ctx)),n.dispatch(r),h0(this,_).call(this)},h5(this,I,(0,aT.KR)(this.ctx.get(hF.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const r=aZ(hK,{config:h0(this,I),src:h0(this,E),onConfirm:h0(this,R),onCancel:h0(this,_)});r.mount(n),h5(this,O,r),h5(this,T,n),h5(this,N,new hp({content:n,debounce:0,shouldShow:()=>!1})),h0(this,N).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},h0(this,N).update(t)}}T=new WeakMap,N=new WeakMap,A=new WeakMap,O=new WeakMap,I=new WeakMap,E=new WeakMap,_=new WeakMap,R=new WeakMap,L=new WeakMap;var h7=Object.defineProperty,h4=Object.defineProperties,h8=Object.getOwnPropertyDescriptors,h6=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,pn=(e,t,n)=>t in e?h7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;aM.h;let pr=(0,aM.pM)({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){let i=e=>{e.preventDefault(),e.stopPropagation(),n.value()},o=e=>{e.preventDefault(),e.stopPropagation(),r.value()},l=n=>{n.preventDefault();let r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>(0,aM.h)("div",{class:"link-preview"},(0,aM.h)(hq,{class:"button link-icon",icon:e.value.linkIcon,onClick:l}),(0,aM.h)("a",{href:t.value,target:"_blank",class:"link-display"},t.value),(0,aM.h)(hq,{class:"button link-edit-button",icon:e.value.editButton,onClick:i}),(0,aM.h)(hq,{class:"button link-remove-button",icon:e.value.removeButton,onClick:o}))}});var pi=e=>{throw TypeError(e)},po=(e,t,n)=>t.has(e)||pi("Cannot "+n),pl=(e,t,n)=>(po(e,t,"read from private field"),n?n.call(e):t.get(e)),pa=(e,t,n)=>t.has(e)?pi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ps=(e,t,n,r)=>(po(e,t,"write to private field"),t.set(e,n),n);class pc{constructor(e,t){this.ctx=e,pa(this,P),pa(this,$),pa(this,D),pa(this,j),pa(this,F,(0,aT.KR)("")),pa(this,B,(0,aT.KR)(()=>{})),pa(this,H,(0,aT.KR)(()=>{})),pa(this,z),pa(this,q),pa(this,K,!1),pa(this,W,({mode:e})=>{"edit"===e&&pl(this,J).call(this)}),pa(this,U,()=>{ps(this,K,!0)}),pa(this,V,()=>{ps(this,K,!1)}),pa(this,J,()=>{pl(this,$).hide(),pl(this,$).element.removeEventListener("mouseenter",pl(this,U)),pl(this,$).element.removeEventListener("mouseleave",pl(this,V))}),this.show=(e,t,n,r)=>{pl(this,j).value=this.ctx.get(hF.key),pl(this,F).value=e.attrs.href,pl(this,B).value=()=>{this.ctx.get(hj.key).editLink(e,t,n)},pl(this,H).value=()=>{this.ctx.get(hj.key).removeLink(t,n),pl(this,J).call(this)},pl(this,$).show({getBoundingClientRect:()=>r},pl(this,q)),pl(this,$).element.addEventListener("mouseenter",pl(this,U)),pl(this,$).element.addEventListener("mouseleave",pl(this,V))},this.hide=()=>{pl(this,K)||pl(this,J).call(this)},this.update=()=>{},this.destroy=()=>{pl(this,z).unmount(),pl(this,D).off(pl(this,W)),pl(this,$).destroy(),pl(this,P).remove()},ps(this,q,t),ps(this,j,(0,aT.KR)(this.ctx.get(hF.key))),ps(this,z,aZ(pr,{config:pl(this,j),src:pl(this,F),onEdit:pl(this,B),onRemove:pl(this,H)})),ps(this,P,document.createElement("div")),pl(this,P).className="milkdown-link-preview",pl(this,z).mount(pl(this,P)),ps(this,$,new hp({debounce:0,content:pl(this,P),shouldShow:()=>!1})),pl(this,$).update(t),ps(this,D,e.use(hD.key)),pl(this,D).on(pl(this,W))}}function pd(e){let t,n,r;n=o_((n,r)=>{if(!t||!n.hasFocus()||"edit"===e.get(hD.key).mode)return;let i=function(e,t,n){let r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;let{pos:i}=r,o=t.state.doc.nodeAt(i);if(!o)return;let l=o.marks.find(t=>t.type===li.mark.type(e));if(l&&hH.pluginKey())return{show:!0,pos:i,node:o,mark:l}}(e,n,r);if(i){var o,l,a,s,c;let e,r=n.state.doc.resolve(i.pos),d=(o=i.mark,l=i.node,a=n.state.doc,s=r.before(),c=r.after(),e={start:-1,end:-1},a.nodesBetween(s,c,(t,n)=>{if(e.start>-1)return!1;-1===e.start&&o.isInSet(t.marks)&&l===t&&(e={start:n,end:n+Math.max(t.textContent.length,1)})}),e),u=d.start,h=d.end;t.show(i.mark,u,h,nQ(n,u,h));return}t.hide()},50),e.set(hH.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>t=new pc(e,n)}),e.update(hj.key,e=>h4(((e,t)=>{for(var n in t||(t={}))pe.call(t,n)&&pn(e,n,t[n]);if(h6)for(var n of h6(t))pt.call(t,n)&&pn(e,n,t[n]);return e})({},e),h8({addLink:(e,t)=>{null==r||r.addLink(e,t)},editLink:(e,t,n)=>{null==r||r.editLink(e,t,n)},removeLink:(e,t)=>{null==r||r.removeLink(e,t)}}))),e.set(hz.key,{view:t=>r=new h9(e,t)})}P=new WeakMap,$=new WeakMap,D=new WeakMap,j=new WeakMap,F=new WeakMap,B=new WeakMap,H=new WeakMap,z=new WeakMap,q=new WeakMap,K=new WeakMap,W=new WeakMap,U=new WeakMap,V=new WeakMap,J=new WeakMap;let pu=[hD,hj,hF,hH,hz,hB].flat();var ph=Object.defineProperty,pp=Object.getOwnPropertySymbols,pf=Object.prototype.hasOwnProperty,pm=Object.prototype.propertyIsEnumerable,pg=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pv(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))pf.call(t,n)&&pg(e,n,t[n]);if(pp)for(var n of pp(t))pm.call(t,n)&&pg(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let py=op({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function pw({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}pv(py,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),aM.h,pw.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let pb=(0,aM.pM)({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:r,readonly:i,setAttr:o,onMount:l,selected:a}){let s=e=>{null!=e&&e instanceof Element&&l(e)},c=e=>{e.stopPropagation(),e.preventDefault(),null!=t.value&&o("checked",!t.value)},d=(0,aM.EW)(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:i.value})),u=(0,aM.EW)(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>(0,aM.h)("li",{class:(0,aX.A)("list-item",a.value&&"ProseMirror-selectednode")},(0,aM.h)("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},(0,aM.h)(pw,{class:(0,aX.A)("label",i.value&&"readonly",u.value),icon:d.value})),(0,aM.h)("div",{class:"children",ref:s}))}}),pk=oh(l0.node,e=>(t,n,r)=>{let i=document.createElement("div");i.className="milkdown-list-item-block";let o=document.createElement("div");o.setAttribute("data-content-dom","true"),o.classList.add("content-dom");let l=(0,aT.KR)(t.attrs.label),a=(0,aT.KR)(t.attrs.checked),s=(0,aT.KR)(t.attrs.listType),c=(0,aT.KR)(!n.editable),d=e.get(py.key),u=(0,aT.KR)(!1),h=(0,aM.nT)(()=>{u.value?i.classList.add("selected"):i.classList.remove("selected")}),p=0,f=aZ(pb,{label:l,checked:a,listType:s,readonly:c,config:d,selected:u,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(i,e,t)))},onMount:e=>{let{anchor:t,head:r}=n.state.selection;e.appendChild(o);let i=n.state.doc.resolve(t),l=n.state.doc.resolve(r);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!i.doc.eq(n.state.doc))return;let e=new ns.U3(i,l);n.dispatch(n.state.tr.setSelection(e))})}});f.mount(i);let m=e=>{s.value=e.attrs.listType,l.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:i,contentDOM:o,update:e=>e.type===t.type&&(!!(e.sameMarkup(g)&&e.content.eq(g.content))||(g=e,m(e),!0)),ignoreMutation:e=>!i||!o||"selection"!==e.type&&(o===e.target&&"attributes"===e.type||!o.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{h(),f.unmount(),i.remove(),o.remove()}}});pv(pk,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});let pC=[py,pk];var px=Object.defineProperty,pS=Object.getOwnPropertySymbols,pM=Object.prototype.hasOwnProperty,pT=Object.prototype.propertyIsEnumerable,pN=(e,t,n)=>t in e?px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pA(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))pM.call(t,n)&&pN(e,n,t[n]);if(pS)for(var n of pS(t))pT.call(t,n)&&pN(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}var pO=Object.defineProperty,pI=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,p_=Object.prototype.propertyIsEnumerable,pR=(e,t,n)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;let pL=op(((e,t)=>{for(var n in t||(t={}))pE.call(t,n)&&pR(e,n,t[n]);if(pI)for(var n of pI(t))p_.call(t,n)&&pR(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function pP({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}function p$(e){let{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:l,rowHandleRef:a}=e,s=t.value;if(!s)return;let c=n.value;if(!c)return;let d=r.value;if(!d)return;let u=d.querySelector("tbody");if(!u)return;let h=s.querySelector("tbody");if(!h)return;let p=i.value;if(!p)return;let f=o.value;if(!f)return;let m=l.value;if(!m)return;let g=a.value;if(g)return{preview:s,wrapper:c,content:d,contentRoot:u,previewRoot:h,yHandle:p,xHandle:f,colHandle:m,rowHandle:g}}function pD(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function pj(e,t,n,r,i){let{width:o,height:l}=r.querySelector("tbody").getBoundingClientRect();if("y"===e){let e=r.querySelectorAll("tr")[i];if(!e)return;n.appendChild(e.cloneNode(!0));let l=e.getBoundingClientRect().height;Object.assign(t.style,{width:`${o}px`,height:`${l}px`}),t.dataset.show="true";return}if("x"===e){let e;Array.from(r.querySelectorAll("tr")).forEach(t=>{let r=t.children[i];if(!r)return;void 0===e&&(e=r.getBoundingClientRect().width);let o=r.parentElement.cloneNode(!1),l=r.cloneNode(!0);o.appendChild(l),n.appendChild(o)}),Object.assign(t.style,{width:`${e}px`,height:`${l}px`}),t.dataset.show="true";return}}function pF(e,t,n,r){let{xHandle:i,yHandle:o,colHandle:l,rowHandle:a,preview:s}=n;i.dataset.displayType="y"===e?"indicator":"none",o.dataset.displayType="x"===e?"indicator":"none","y"===e?(l.dataset.show="false",pH(a)):(a.dataset.show="false",pH(l));let{hoverIndex:c,dragInfo:d}=r,[u,h]=c.value;d.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:h,endIndex:"y"===e?u:h,type:"y"===e?"row":"col"},s.dataset.direction="y"===e?"vertical":"horizontal"}function pB(e,t,n,r){let i=null==n?void 0:n.get(ia);if(!(null==i?void 0:i.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");let o=p$(e);o&&requestAnimationFrame(()=>{r(o)})}function pH(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function pz(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return -1}function pq(e,[t,n]){let r=e.value;if(!r)return;let i=r.querySelectorAll("tr"),o=i[t];if(!o)return;let l=i[0];if(!l)return;let a=l.children[n];if(!a)return;let s=o.children[n];if(s)return{row:o,col:s,headerCol:a}}function pK({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,colHandleRef:o,hoverIndex:l}=e,a=o.value;if(!a)return;l.value=t;let s=pq(i,t);if(!s)return;let{headerCol:c}=s;a.dataset.show="true",n&&n(a),(0,oL.rD)(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function pW({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,rowHandleRef:o,hoverIndex:l}=e,a=o.value;if(!a)return;l.value=t;let s=pq(i,t);if(!s)return;let{row:c}=s;a.dataset.show="true",n&&n(a),(0,oL.rD)(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function pU(e,t,n){let r="x"===n?"left":"top",i="x"===n?"right":"bottom",o=e.length-1,l=e.findIndex((e,n)=>{let l=e.getBoundingClientRect(),a=l[r],s=l[i];return!!(a<=t)&&!!(t<=s)||n===o&&!!(t>s)||0===n&&!!(t<a)}),a=e[l];return a?[a,l]:void 0}pA(pL,{displayName:"Config<table-block>",group:"TableBlock"}),aM.h,pP.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let pV=(0,aM.pM)({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:r,config:i,onMount:o}){let l=(0,aT.KR)(),a=e=>{null!=e&&(e instanceof HTMLElement?(l.value=e,o(e)):l.value=void 0)},s=(0,aT.KR)(),c=(0,aT.KR)(),d=(0,aT.KR)(),u=(0,aT.KR)(),h=(0,aT.KR)(),p=(0,aT.KR)(),f=(0,aT.KR)([0,0]),m={dragPreviewRef:p,tableWrapperRef:h,contentWrapperRef:l,yLineHandleRef:u,xLineHandleRef:d,colHandleRef:s,rowHandleRef:c,hoverIndex:f,lineHoverIndex:(0,aT.KR)([-1,-1]),dragInfo:(0,aT.KR)()},{pointerLeave:g,pointerMove:v}={pointerMove:oR(t=>{if(!(null==e?void 0:e.editable))return;let{contentWrapperRef:n,yLineHandleRef:r,xLineHandleRef:i,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:s}=m,c=r.value;if(!c)return;let d=i.value;if(!d)return;let u=n.value;if(!u)return;let h=l.value;if(!h)return;let p=o.value;if(!p)return;let f=function(e,t){var n,r,i;if(t)try{let o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return;let l=null==o?void 0:o.inside;if(null==l||l<0)return;let a=t.state.doc.resolve(l),s=t.state.doc.nodeAt(l);if(!s)return;let c=["table_cell","table_header"],d=["table_row","table_header_row"],u=c.includes(s.type.name)?s:null==(n=n0(e=>c.includes(e.type.name))(a))?void 0:n.node,h=null==(r=n0(e=>d.includes(e.type.name))(a))?void 0:r.node,p=null==(i=n0(e=>"table"===e.type.name)(a))?void 0:i.node;if(!u||!h||!p)return;let f=pz(h,u);return[pz(p,h),f]}catch(e){return}}(t,e);if(!f)return;let g=pq(n,f);if(!g)return;let[v,y]=f,w=g.col.getBoundingClientRect(),b=8>Math.abs(t.clientX-w.left),k=8>Math.abs(w.right-t.clientX),C=8>Math.abs(t.clientY-w.top),x=8>Math.abs(w.bottom-t.clientY),S=h.querySelector(".button-group"),M=p.querySelector(".button-group");if(S&&(S.dataset.show="false"),M&&(M.dataset.show="false"),b||k||C||x){let e=u.getBoundingClientRect();h.dataset.show="false",p.dataset.show="false",d.dataset.displayType="tool",c.dataset.displayType="tool";let t=c.getBoundingClientRect().width,n=d.getBoundingClientRect().height;b||k?(s.value[1]=b?y:y+1,(0,oL.rD)(g.col,c,{placement:b?"left":"right",middleware:[(0,oL.cY)(b?-1*t:0)]}).then(({x:t})=>{c.dataset.show="true",Object.assign(c.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):c.dataset.show="false",0!==f[0]&&(C||x)?(s.value[0]=C?v:v+1,(0,oL.rD)(g.row,d,{placement:C?"top":"bottom",middleware:[(0,oL.cY)(C?-1*n:0)]}).then(({y:t})=>{d.dataset.show="true",Object.assign(d.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):d.dataset.show="false";return}s.value=[-1,-1],c.dataset.show="false",d.dataset.show="false",h.dataset.show="true",p.dataset.show="true",pW({refs:m,index:f}),pK({refs:m,index:f}),a.value=f},20),pointerLeave:()=>{let{rowHandleRef:e,colHandleRef:t,yLineHandleRef:n,xLineHandleRef:r}=m;setTimeout(()=>{let i=e.value;if(!i)return;let o=t.value;if(!o)return;let l=n.value;if(!l)return;let a=r.value;a&&(i.dataset.show="false",o.dataset.show="false",l.dataset.show="false",a.dataset.show="false")},200)}},{dragRow:y,dragCol:w}=function(e,t,n){let{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:o,dragInfo:l}=e,a=n=>{pB(e,n,t,t=>{pF("y",n,t,e);let{preview:r,content:i,previewRoot:o}=t;pD(o);let{hoverIndex:l}=e,[a]=l.value;pj("y",r,o,i,a)})},s=n=>{pB(e,n,t,t=>{pF("x",n,t,e);let{preview:r,content:i,previewRoot:o}=t,{hoverIndex:l}=e,[a,s]=l.value;pD(o),pj("x",r,o,i,s)})},c=()=>{let e=r.value;if(!e||"false"===e.dataset.show)return;let t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},d=()=>{var a;let s=r.value;if(!s)return;let c=i.value;if(!c)return;let d=o.value;if(!d)return;let u=l.value;if(!u||!t||"false"===s.dataset.show||!e.colHandleRef.value||!e.rowHandleRef.value||(c.dataset.show="false",d.dataset.show="false",u.startIndex===u.endIndex))return;let h=t.get(iO),p={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};"col"===u.type?(h.call(dB.key,{pos:p.pos,index:u.startIndex}),h.call(dj.key,p),pK({refs:e,index:[0,u.endIndex]})):(h.call(dF.key,{pos:p.pos,index:u.startIndex}),h.call(dD.key,p),pW({refs:e,index:[u.endIndex,0]})),requestAnimationFrame(()=>{t.get(ia).focus()})},u=oR(t=>{let n=p$(e);if(!n)return;let{preview:r,content:i,contentRoot:o,xHandle:l,yHandle:a}=n,{dragInfo:s,hoverIndex:c}=e;if("false"===r.dataset.show)return;let d=pq(e.contentWrapperRef,c.value);if(!d||!o.querySelector("tr"))return;let u=s.value;if(!u||!o.offsetParent)return;let h=o.offsetParent.offsetTop,p=o.offsetParent.offsetLeft;if("col"===u.type){let e=d.col.getBoundingClientRect().width,{left:n,width:l}=o.getBoundingClientRect(),s=p-n,c=t.clientX+s-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";r.style.top=`${h}px`;let g=c<n+s-20?n+s-20:c>n+l+s-e+20?n+l+s-e+20:c;r.style.left=`${g}px`;let v=function(e,t){let n=e.querySelector("tr");if(n)return pU(Array.from(n.children),t,"x")}(o,t.clientX);if(v){let[e,t]=v,n=a.getBoundingClientRect().width,r=i.getBoundingClientRect();u.endIndex=t,(0,oL.rD)(e,a,{placement:"left"===m?"left":"right",middleware:[(0,oL.cY)("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${r.height}px`,left:`${e}px`,top:`${h}px`})}).catch(console.error)}}else if("row"===u.type){var f;let e=d.row.getBoundingClientRect().height,{top:n,height:a}=o.getBoundingClientRect(),s=h-n,c=t.clientY+s-e/2,[m,g]=u.startCoords,v=g<t.clientY?"down":"up",y=c<n+s-20?n+s-20:c>n+a+s-e+20?n+a+s-e+20:c;r.style.top=`${y}px`,r.style.left=`${p}px`;let w=(f=t.clientY,pU(Array.from(o.querySelectorAll("tr")),f,"y"));if(w){let[e,t]=w,n=l.getBoundingClientRect().height,r=i.getBoundingClientRect();u.endIndex=t,(0,oL.rD)(e,l,{placement:"up"===v?"top":"bottom",middleware:[(0,oL.cY)("up"===v?-1*n:0)]}).then(({y:e})=>{l.dataset.show="true",Object.assign(l.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20);return(0,aM.sV)(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",d)}),(0,aM.hi)(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",d)}),{dragRow:a,dragCol:s}}(m,n,r),{onAddRow:b,onAddCol:k,selectCol:C,selectRow:x,deleteSelected:S,onAlign:M}=function(e,t,n){let{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:s}=e;return{onAddRow:()=>{var e,o,l;if(!t)return;let a=r.value;if(!a)return;let[c]=s.value;if(c<0||!t.get(ia).editable)return;let d=Array.from(null!=(o=null==(e=i.value)?void 0:e.querySelectorAll("tr"))?o:[]),u=t.get(iO),h=(null!=(l=null==n?void 0:n())?l:0)+1;d.length===c?(u.call(dF.key,{pos:h,index:c-1}),u.call(dU.key)):(u.call(dF.key,{pos:h,index:c}),u.call(dW.key)),u.call(dF.key,{pos:h,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,o,l,a;if(!t||!r.value)return;let[c,d]=s.value;if(d<0||!t.get(ia).editable)return;let u=Array.from(null!=(l=null==(o=null==(e=i.value)?void 0:e.querySelector("tr"))?void 0:o.children)?l:[]),h=t.get(iO),p=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===d?(h.call(dB.key,{pos:p,index:d-1}),h.call(dK.key)):(h.call(dB.key,{pos:p,index:d}),h.call(dq.key)),h.call(dB.key,{pos:p,index:d})},selectCol:()=>{var e,r;if(!t)return;let[i,l]=a.value,s=t.get(iO),c=(null!=(e=null==n?void 0:n())?e:0)+1;s.call(dB.key,{pos:c,index:l});let d=null==(r=o.value)?void 0:r.querySelector(".button-group");d&&(d.dataset.show="true"===d.dataset.show?"false":"true")},selectRow:()=>{var e,r;if(!t)return;let[i,o]=a.value,s=t.get(iO),c=(null!=(e=null==n?void 0:n())?e:0)+1;s.call(dF.key,{pos:c,index:i});let d=null==(r=l.value)?void 0:r.querySelector(".button-group");d&&i>0&&(d.dataset.show="true"===d.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(ia).editable&&(e.preventDefault(),e.stopPropagation(),t.get(iO).call(dz.key),requestAnimationFrame(()=>{t.get(ia).focus()}))},onAlign:e=>n=>{t&&t.get(ia).editable&&(n.preventDefault(),n.stopPropagation(),t.get(iO).call(dV.key,e),requestAnimationFrame(()=>{t.get(ia).focus()}))}}}(m,n,r);return(0,aM.sV)(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n||!t)return;let{selection:r}=t.state;if(!(r instanceof cM))return;let{$from:i}=r,o=c_(i);if(o&&o.node===n){if(r.isColSelection()){let{$head:t}=r;pK({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}});return}if(r.isRowSelection()){let{$head:t}=r,n=n0(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;let i=pz(o.node,n.node);pW({refs:e,index:[i,0],before:e=>{var t;i>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}}(m,e,t.value)})}),()=>(0,aM.h)("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:v,onPointerleave:g},(0,aM.h)("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:w,onClick:C,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:s},(0,aM.h)(pP,{icon:i.renderButton("col_drag_handle")}),(0,aM.h)("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},(0,aM.h)("button",{type:"button",onPointerdown:M("left")},(0,aM.h)(pP,{icon:i.renderButton("align_col_left")})),(0,aM.h)("button",{type:"button",onPointerdown:M("center")},(0,aM.h)(pP,{icon:i.renderButton("align_col_center")})),(0,aM.h)("button",{type:"button",onPointerdown:M("right")},(0,aM.h)(pP,{icon:i.renderButton("align_col_right")})),(0,aM.h)("button",{type:"button",onPointerdown:S},(0,aM.h)(pP,{icon:i.renderButton("delete_col")})))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:y,onClick:x,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},(0,aM.h)(pP,{icon:i.renderButton("row_drag_handle")}),(0,aM.h)("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},(0,aM.h)("button",{type:"button",onPointerdown:S},(0,aM.h)(pP,{icon:i.renderButton("delete_row")})))),(0,aM.h)("div",{class:"table-wrapper",ref:h},(0,aM.h)("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},(0,aM.h)("table",null,(0,aM.h)("tbody",null))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:d},(0,aM.h)("button",{type:"button",onClick:b,class:"add-button"},(0,aM.h)(pP,{icon:i.renderButton("add_row")}))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},(0,aM.h)("button",{type:"button",onClick:k,class:"add-button"},(0,aM.h)(pP,{icon:i.renderButton("add_col")}))),(0,aM.h)("table",{ref:a,class:"children"})))}});var pJ=e=>{throw TypeError(e)};class pG{constructor(e,t,n,r){this.ctx=e,this.node=t,this.view=n,this.getPos=r,((e,t,n)=>t.has(e)?pJ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n))(this,G);const i=document.createElement("div");i.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=(0,aT.IJ)(t);const l=aZ(pV,{view:n,ctx:e,getPos:r,config:e.get(pL.key),onMount:e=>{e.appendChild(o)},node:this.nodeRef});l.mount(i),this.app=l,this.dom=i}update(e){return!(e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){if(e.target instanceof Element&&e.target.closest("button"))return!0;let r=e.target;if(r instanceof HTMLElement&&(r.closest("th")||r.closest("td"))){var t,n;return(t=G,n=Z,t.has(this)||pJ("Cannot access private method"),n).call(this,e)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}G=new WeakSet,Z=function(e){let t=this.view;if(!t.editable)return!1;let{state:n,dispatch:r}=t,i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return!1;let o=n.doc.resolve(i.inside),l=n0(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(o);if(!l)return!1;if(n.selection instanceof ns.U3){let e=n0(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===l.node)return!1}let{from:a}=l,s=ns.nh.create(n.doc,a+1);return!n.selection.eq(s)&&(n.selection instanceof cM?setTimeout(()=>{r(n.tr.setSelection(s).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(s).scrollIntoView())}),!0)};let pZ=oh(dx.node,e=>(t,n,r)=>new pG(e,t,n,r));pA(pZ,{displayName:"NodeView<table-block>",group:"TableBlock"});let pY=[pL,pZ];function pX(e,t){let n=function(e){if(1===e.content.childCount){let t=e.content.firstChild;if((null==t?void 0:t.type.name)==="text"&&0===t.marks.length)return t;if((null==t?void 0:t.type.name)==="paragraph"&&1===t.childCount){let e=t.firstChild;if((null==e?void 0:e.type.name)==="text"&&0===e.marks.length)return e}}return!1}(t);if(n)return e.dispatch(e.state.tr.replaceSelectionWith(n,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(t)),!0}catch{return!1}}var pQ=od(e=>{let t=e.get(ix);return e.update(i7,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{let r=e.transformPastedHTML;return r&&(t=r(t,n)),t.includes("docs-internal-guid")&&(t=(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1")).replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),t}})),new ns.k_({key:new ns.hs("MILKDOWN_CLIPBOARD"),props:{handlePaste:(n,r,i)=>{let o,l=e.get(iB),a=n.props.editable?.(n.state),{clipboardData:s}=r;if(!a||!s||n.state.selection.$from.node().type.spec.code)return!1;let c=s.getData("text/plain"),d=s.getData("vscode-editor-data");if(d){let e=JSON.parse(d)?.mode;if(c&&e){let{tr:r}=n.state,i=function(e,t){let n=t.nodes[e];if(!n)throw new nm(nf.getAtomFromSchemaFail,`Cannot get node: ${e} from schema.`);return n}("code_block",t);return r.replaceSelectionWith(i.create({language:e})).setSelection(ns.U3.near(r.doc.resolve(Math.max(0,r.selection.from-2)))).insertText(c.replace(/\r\n?/g,"\n")),n.dispatch(r),!0}}let u=s.getData("text/html");if(0===u.length&&0===c.length)return!1;if(u.length>0&&i)return pX(n,i);let h=rE.S4.fromSchema(t);if(0===u.length){let e=l(c);if(!e||"string"==typeof e)return!1;o=rE.ZF.fromSchema(t).serializeFragment(e.content)}else{let e=document.createElement("template");e.innerHTML=u,o=e.content.cloneNode(!0),e.remove()}return pX(n,h.parseSlice(o))},clipboardTextSerializer:n=>{let r=e.get(iU);if(function e(t){if(!t)return!1;if(Array.isArray(t))return!(t.length>1)&&e(t[0]);let n=t.content;return n?e(n):"text"===t.type}(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");let i=t.topNodeType.createAndFill(void 0,n.content);return i?r(i):""}}})});function p1(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}Object.assign(pQ,{meta:{package:"@milkdown/plugin-clipboard",displayName:"Prose<clipboard>"}});var p0=ol("Undo",()=>()=>ux);p1(p0,{displayName:"Command<undo>"});var p2=ol("Redo",()=>()=>uS);p1(p2,{displayName:"Command<redo>"});var p5=op({},"historyProviderConfig");p1(p5,{displayName:"Ctx<historyProviderConfig>"});var p3=od(e=>(function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ns.k_({key:ub,state:{init:()=>new up(uu.empty,uu.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(ub),o;if(i)return i.historyState;n.getMeta(uk)&&(e=new up(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(l&&l.getMeta(ub))if(l.getMeta(ub).redo)return new up(e.done.addTransform(n,void 0,r,uw(t)),e.undone,um(n.mapping.maps),e.prevTime,e.prevComposition);else return new up(e.done,e.undone.addTransform(n,void 0,r,uw(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||l&&!1===l.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new up(e.done.rebased(n,o),e.undone.rebased(n,o),ug(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new up(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),ug(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!l&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=l?ug(e.prevRanges,n.mapping):um(n.mapping.maps);return new up(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,uw(t)),uu.empty,a,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?ux:"historyRedo"==n?uS:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})})(e.get(p5.key)));p1(p3,{displayName:"Ctx<historyProviderPlugin>"});var p9=og("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{let t=e.get(iO);return()=>t.call(p0.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{let t=e.get(iO);return()=>t.call(p2.key)}}});p1(p9.ctx,{displayName:"KeymapCtx<history>"}),p1(p9.shortcuts,{displayName:"Keymap<history>"});var p7=[p5,p3,p9,p0,p2].flat(),p4=op({type:"space",size:2},"indentConfig");p4.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var p8=ou(e=>({Tab:(t,n)=>{let r=e.get(p4.key),{tr:i}=t,o=function(e,t){let{doc:n,selection:r}=e;if(!n||!r||!(r instanceof ns.U3||r instanceof ns.i5))return e;let{to:i}=r,o="space"===t.type?Array(t.size).fill(" ").join(""):" ";return e.insertText(o,i)}(i,r);return!!o.docChanged&&(n?.(o),!0)}}));p8.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var p6=[p4,p8],fe=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},ft=n4(new fe,"listener"),fn=new ns.hs("MILKDOWN_LISTENER"),fr=e=>(e.inject(ft,new fe),async()=>{await e.wait(ib);let{listeners:t}=e.get(ft);t.beforeMount.forEach(t=>t(e)),await e.wait(iq);let n=e.get(iU),r=null,i=null,o=null,l=null,a=o_(()=>{if(!l)return;let{doc:o}=l;if(t.updated.length>0&&r&&!r.eq(o)&&t.updated.forEach(t=>{t(e,o,r)}),t.markdownUpdated.length>0&&r&&!r.eq(o)){let r=n(o);t.markdownUpdated.forEach(t=>{t(e,r,i)}),i=r}r=o,l=null},200),s=new ns.k_({key:fn,view:()=>({destroy:()=>{t.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(t=>t(e)),!1),blur:()=>(t.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{r=t.doc,i=n(t.doc)},apply:n=>{let r=n.selection;(!o&&r||o&&!r.eq(o))&&(t.selectionUpdated.forEach(t=>{t(e,r,o)}),o=r),(n.docChanged||n.storedMarksSet)&&!1!==n.getMeta("addToHistory")&&(l=n,a())}}});e.update(ih,e=>e.concat(s)),await e.wait(i3),t.mounted.forEach(t=>t(e))});fr.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var fi=op({shouldAppend:e=>!(!e||["heading","paragraph"].includes(e.type.name)),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");fi.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var fo=od(e=>{let t=new ns.hs("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=e.get(fi.key),i=new ns.k_({key:t,state:{init:(e,t)=>n(t.tr.doc.lastChild,t),apply:(e,t,r,i)=>e.docChanged?n(e.doc.lastChild,i):t},appendTransaction:(e,t,n)=>{let{doc:o,tr:l}=n,a=r?.(n),s=i.getState(n),c=o.content.size;if(s&&a)return l.insert(c,a)}});return i});fo.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var fl=[fi,fo],fa=op({uploader:async(e,t)=>{let n=[];for(let t=0;t<e.length;t++){let r=e.item(t);r&&r.type.includes("image")&&n.push(r)}let{image:r}=t.nodes;if(!r)throw nk("image");return(await Promise.all(n.map(e=>new Promise(t=>{let n=new FileReader;n.addEventListener("load",()=>{t({alt:e.name,src:n.result})},!1),n.readAsDataURL(e)})))).map(({alt:e,src:t})=>r.createAndFill({src:t,alt:e}))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{let n=document.createElement("span");return n.textContent="Upload in progress...",ii.NZ.widget(e,n,t)}},"uploadConfig");fa.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var fs=od(e=>{let t=new ns.hs("MILKDOWN_UPLOAD"),n=(n,r,i)=>{if(!i||i.length<=0)return!1;let o=Symbol("upload symbol"),l=e.get(ix),{uploader:a,getInsertPos:s}=e.get(fa.key),{tr:c}=n.state,d=r instanceof DragEvent?n.posAtCoords({left:r.clientX,top:r.clientY})?.pos??c.selection.from:c.selection.from,u="function"==typeof s?s(r,e,d):d;return n.dispatch(c.setMeta(t,{add:{id:o,pos:u}})),a(i,l,e,u).then(e=>{let r=((e,n)=>{let r=t.getState(e);if(!r)return -1;let i=r.find(void 0,void 0,e=>e.id===n);return i.length?i[0]?.from??-1:-1})(n.state,o);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:o}}))}).catch(e=>{console.error(e)}),!0};return new ns.k_({key:t,state:{init:()=>ii.zF.empty,apply(t,n){let r=n.map(t.mapping,t.doc),i=t.getMeta(this);if(!i)return r;if(i.add){let{uploadWidgetFactory:n}=e.get(fa.key),o=n(i.add.pos,{id:i.add.id});return r.add(t.doc,[o])}if(i.remove){let e=r.find(void 0,void 0,e=>e.id===i.remove.id);return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{let{enableHtmlFileUploader:i}=e.get(fa.key);return!(!(r instanceof ClipboardEvent)||!i&&r.clipboardData?.getData("text/html"))&&n(t,r,r.clipboardData?.files)},handleDrop:(e,t)=>t instanceof DragEvent&&n(e,t,t.dataTransfer?.files)}})});fs.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var fc=[fa,fs],fd=((S=fd||{}).CodeMirror="code-mirror",S.ListItem="list-item",S.LinkTooltip="link-tooltip",S.Cursor="cursor",S.ImageBlock="image-block",S.BlockEdit="block-edit",S.Toolbar="toolbar",S.Placeholder="placeholder",S.Table="table",S.Latex="latex",S.TopBar="top-bar",S);let fu={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1},fh=`
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9602],{182:(e,t,n)=>{"use strict";let r,i,o,l,a,s,c,d;n.d(t,{mA:()=>m7,y$:()=>fd});let u=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},h=function(e){return e};var p,f,m,g,v,y,w,b,k,C,x,S,M,T,N,A,O,I,E,_,R,L,P,$,D,j,F,B,H,z,q,K,W,U,V,J,G,Z,Y,X,Q,ee,et,en,er,ei,eo,el,ea,es,ec,ed,eu,eh,ep,ef,em,eg,ev,ey,ew,eb,ek,eC,ex,eS,eM,eT,eN=Math.max,eA="object"==typeof global&&global&&global.Object===Object&&global,eO="object"==typeof self&&self&&self.Object===Object&&self,eI=eA||eO||Function("return this")(),eE=eI.Symbol,e_=Object.prototype,eR=e_.hasOwnProperty,eL=e_.toString,eP=eE?eE.toStringTag:void 0;let e$=function(e){var t=eR.call(e,eP),n=e[eP];try{e[eP]=void 0;var r=!0}catch(e){}var i=eL.call(e);return r&&(t?e[eP]=n:delete e[eP]),i};var eD=Object.prototype.toString,ej=eE?eE.toStringTag:void 0;let eF=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ej&&ej in Object(e)?e$(e):eD.call(e)},eB=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eH=function(e){if(!eB(e))return!1;var t=eF(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var ez=eI["__core-js_shared__"],eq=(f=/[^.]+$/.exec(ez&&ez.keys&&ez.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",eK=Function.prototype.toString;let eW=function(e){if(null!=e){try{return eK.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var eU=/^\[object .+?Constructor\]$/,eV=Object.prototype,eJ=Function.prototype.toString,eG=eV.hasOwnProperty,eZ=RegExp("^"+eJ.call(eG).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eY=function(e){return!!eB(e)&&(!eq||!(eq in e))&&(eH(e)?eZ:eU).test(eW(e))},eX=function(e,t){var n=null==e?void 0:e[t];return eY(n)?n:void 0};var eQ=function(){try{var e=eX(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),e1=Date.now,e0=(m=eQ?function(e,t){return eQ(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:h,g=0,v=0,function(){var e=e1(),t=16-(e-v);if(v=e,t>0){if(++g>=800)return arguments[0]}else g=0;return m.apply(void 0,arguments)});let e2=function(e,t){var n;return e0((n=eN(void 0===(n=t)?e.length-1:n,0),function(){for(var t=arguments,r=-1,i=eN(t.length-n,0),o=Array(i);++r<i;)o[r]=t[n+r];r=-1;for(var l=Array(n+1);++r<n;)l[r]=t[r];return l[n]=h(o),u(e,this,l)}),e+"")},e5=function(e,t){return e===t||e!=e&&t!=t},e3=function(e,t){for(var n=e.length;n--;)if(e5(e[n][0],t))return n;return -1};var e9=Array.prototype.splice;function e7(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}e7.prototype.clear=function(){this.__data__=[],this.size=0},e7.prototype.delete=function(e){var t=this.__data__,n=e3(t,e);return!(n<0)&&(n==t.length-1?t.pop():e9.call(t,n,1),--this.size,!0)},e7.prototype.get=function(e){var t=this.__data__,n=e3(t,e);return n<0?void 0:t[n][1]},e7.prototype.has=function(e){return e3(this.__data__,e)>-1},e7.prototype.set=function(e,t){var n=this.__data__,r=e3(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var e4=eX(eI,"Map"),e8=eX(Object,"create"),e6=Object.prototype.hasOwnProperty,te=Object.prototype.hasOwnProperty;function tt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tt.prototype.clear=function(){this.__data__=e8?e8(null):{},this.size=0},tt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},tt.prototype.get=function(e){var t=this.__data__;if(e8){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return e6.call(t,e)?t[e]:void 0},tt.prototype.has=function(e){var t=this.__data__;return e8?void 0!==t[e]:te.call(t,e)},tt.prototype.set=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=e8&&void 0===t?"__lodash_hash_undefined__":t,this};let tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},tr=function(e,t){var n=e.__data__;return tn(t)?n["string"==typeof t?"string":"hash"]:n.map};function ti(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function to(e){var t=this.__data__=new e7(e);this.size=t.size}ti.prototype.clear=function(){this.size=0,this.__data__={hash:new tt,map:new(e4||e7),string:new tt}},ti.prototype.delete=function(e){var t=tr(this,e).delete(e);return this.size-=!!t,t},ti.prototype.get=function(e){return tr(this,e).get(e)},ti.prototype.has=function(e){return tr(this,e).has(e)},ti.prototype.set=function(e,t){var n=tr(this,e),r=n.size;return n.set(e,t),this.size+=+(n.size!=r),this},to.prototype.clear=function(){this.__data__=new e7,this.size=0},to.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},to.prototype.get=function(e){return this.__data__.get(e)},to.prototype.has=function(e){return this.__data__.has(e)},to.prototype.set=function(e,t){var n=this.__data__;if(n instanceof e7){var r=n.__data__;if(!e4||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ti(r)}return n.set(e,t),this.size=n.size,this};let tl=function(e,t,n){"__proto__"==t&&eQ?eQ(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ta=function(e,t,n){(void 0===n||e5(e[t],n))&&(void 0!==n||t in e)||tl(e,t,n)},ts=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),l=o.length;l--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e};var tc="object"==typeof exports&&exports&&!exports.nodeType&&exports,td=tc&&"object"==typeof module&&module&&!module.nodeType&&module,tu=td&&td.exports===tc?eI.Buffer:void 0,th=tu?tu.allocUnsafe:void 0;let tp=function(e,t){if(t)return e.slice();var n=e.length,r=th?th(n):new e.constructor(n);return e.copy(r),r};var tf=eI.Uint8Array;let tm=function(e){var t=new e.constructor(e.byteLength);return new tf(t).set(new tf(e)),t},tg=function(e,t){var n=t?tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},tv=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var ty=Object.create,tw=function(){function e(){}return function(t){if(!eB(t))return{};if(ty)return ty(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),tb=(y=Object.getPrototypeOf,w=Object,function(e){return y(w(e))}),tk=Object.prototype;let tC=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tk)},tx=function(e){return null!=e&&"object"==typeof e},tS=function(e){return tx(e)&&"[object Arguments]"==eF(e)};var tM=Object.prototype,tT=tM.hasOwnProperty,tN=tM.propertyIsEnumerable,tA=tS(function(){return arguments}())?tS:function(e){return tx(e)&&tT.call(e,"callee")&&!tN.call(e,"callee")},tO=Array.isArray;let tI=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},tE=function(e){return null!=e&&tI(e.length)&&!eH(e)};var t_="object"==typeof exports&&exports&&!exports.nodeType&&exports,tR=t_&&"object"==typeof module&&module&&!module.nodeType&&module,tL=tR&&tR.exports===t_?eI.Buffer:void 0;let tP=(tL?tL.isBuffer:void 0)||function(){return!1};var t$=Object.prototype,tD=Function.prototype.toString,tj=t$.hasOwnProperty,tF=tD.call(Object);let tB=function(e){if(!tx(e)||"[object Object]"!=eF(e))return!1;var t=tb(e);if(null===t)return!0;var n=tj.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&tD.call(n)==tF};var tH={};tH["[object Float32Array]"]=tH["[object Float64Array]"]=tH["[object Int8Array]"]=tH["[object Int16Array]"]=tH["[object Int32Array]"]=tH["[object Uint8Array]"]=tH["[object Uint8ClampedArray]"]=tH["[object Uint16Array]"]=tH["[object Uint32Array]"]=!0,tH["[object Arguments]"]=tH["[object Array]"]=tH["[object ArrayBuffer]"]=tH["[object Boolean]"]=tH["[object DataView]"]=tH["[object Date]"]=tH["[object Error]"]=tH["[object Function]"]=tH["[object Map]"]=tH["[object Number]"]=tH["[object Object]"]=tH["[object RegExp]"]=tH["[object Set]"]=tH["[object String]"]=tH["[object WeakMap]"]=!1;var tz="object"==typeof exports&&exports&&!exports.nodeType&&exports,tq=tz&&"object"==typeof module&&module&&!module.nodeType&&module,tK=tq&&tq.exports===tz&&eA.process,tW=function(){try{var e=tq&&tq.require&&tq.require("util").types;if(e)return e;return tK&&tK.binding&&tK.binding("util")}catch(e){}}(),tU=tW&&tW.isTypedArray,tV=tU?function(e){return tU(e)}:function(e){return tx(e)&&tI(e.length)&&!!tH[eF(e)]};let tJ=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tG=Object.prototype.hasOwnProperty;let tZ=function(e,t,n){var r=e[t];tG.call(e,t)&&e5(r,n)&&(void 0!==n||t in e)||tl(e,t,n)},tY=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,l=t.length;++o<l;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;void 0===s&&(s=e[a]),i?tl(n,a,s):tZ(n,a,s)}return n},tX=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var tQ=/^(?:0|[1-9]\d*)$/;let t1=function(e,t){var n=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==n||"symbol"!=n&&tQ.test(e))&&e>-1&&e%1==0&&e<t};var t0=Object.prototype.hasOwnProperty;let t2=function(e,t){var n=tO(e),r=!n&&tA(e),i=!n&&!r&&tP(e),o=!n&&!r&&!i&&tV(e),l=n||r||i||o,a=l?tX(e.length,String):[],s=a.length;for(var c in e)(t||t0.call(e,c))&&!(l&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||t1(c,s)))&&a.push(c);return a},t5=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var t3=Object.prototype.hasOwnProperty;let t9=function(e){if(!eB(e))return t5(e);var t=tC(e),n=[];for(var r in e)"constructor"==r&&(t||!t3.call(e,r))||n.push(r);return n},t7=function(e){return tE(e)?t2(e,!0):t9(e)},t4=function(e,t,n,r,i,o,l){var a=tJ(e,n),s=tJ(t,n),c=l.get(s);if(c)return void ta(e,n,c);var d=o?o(a,s,n+"",e,t,l):void 0,u=void 0===d;if(u){var h=tO(s),p=!h&&tP(s),f=!h&&!p&&tV(s);(d=s,h||p||f)?tO(a)?d=a:tx(a)&&tE(a)?d=tv(a):p?(u=!1,d=tp(s,!0)):f?(u=!1,d=tg(s,!0)):d=[]:tB(s)||tA(s)?(d=a,tA(a))?d=tY(a,t7(a)):(!eB(a)||eH(a))&&(d="function"!=typeof s.constructor||tC(s)?{}:tw(tb(s))):u=!1}u&&(l.set(s,d),i(d,s,r,o,l),l.delete(s)),ta(e,n,d)},t8=function e(t,n,r,i,o){t!==n&&ts(n,function(l,a){if(o||(o=new to),eB(l))t4(t,n,a,r,e,i,o);else{var s=i?i(tJ(t,a),l,a+"",t,n,o):void 0;void 0===s&&(s=l),ta(t,a,s)}},t7)},t6=function e(t,n,r,i,o,l){return eB(t)&&eB(n)&&(l.set(n,t),t8(t,n,void 0,e,l),l.delete(n)),t},ne=function(e,t,n){if(!eB(n))return!1;var r=typeof t;return("number"==r?!!(tE(n)&&t1(t,n.length)):"string"==r&&t in n)&&e5(n[t],e)};var nt=(b=function(e,t,n,r){t8(e,t,n,r)},e2(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=b.length>3&&"function"==typeof i?(r--,i):void 0,o&&ne(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var l=t[n];l&&b(e,l,n,i)}return e})),nn=e2(function(e){return e.push(void 0,t6),u(nt,void 0,e)}),nr=n(23696);function ni(e){return new nr.Yy(nr.Tg.define(e))}function no(e){return Promise.all([n.e(7906),n.e(7687)]).then(n.bind(n,87687)).then(t=>t.sql({dialect:t[e]}))}let nl=[nr.t$.of({name:"C",extensions:["c","h","ino"],load:()=>Promise.all([n.e(7906),n.e(4113)]).then(n.bind(n,24113)).then(e=>e.cpp())}),nr.t$.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>Promise.all([n.e(7906),n.e(4113)]).then(n.bind(n,24113)).then(e=>e.cpp())}),nr.t$.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>no("Cassandra")}),nr.t$.of({name:"CSS",extensions:["css"],load:()=>Promise.all([n.e(7906),n.e(4938)]).then(n.bind(n,22557)).then(e=>e.css())}),nr.t$.of({name:"Go",extensions:["go"],load:()=>Promise.all([n.e(7906),n.e(7882)]).then(n.bind(n,47882)).then(e=>e.go())}),nr.t$.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570)]).then(n.bind(n,80570)).then(e=>e.html())}),nr.t$.of({name:"Java",extensions:["java"],load:()=>Promise.all([n.e(7906),n.e(7229)]).then(n.bind(n,17229)).then(e=>e.java())}),nr.t$.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript())}),nr.t$.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(7041)]).then(n.bind(n,27041)).then(e=>e.jinja())}),nr.t$.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>Promise.all([n.e(7906),n.e(1050)]).then(n.bind(n,71050)).then(e=>e.json())}),nr.t$.of({name:"JSX",extensions:["jsx"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({jsx:!0}))}),nr.t$.of({name:"LESS",extensions:["less"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(8160)]).then(n.bind(n,98160)).then(e=>e.less())}),nr.t$.of({name:"Liquid",extensions:["liquid"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(2507)]).then(n.bind(n,92507)).then(e=>e.liquid())}),nr.t$.of({name:"MariaDB SQL",load:()=>no("MariaSQL")}),nr.t$.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(9837)]).then(n.bind(n,69837)).then(e=>e.markdown())}),nr.t$.of({name:"MS SQL",load:()=>no("MSSQL")}),nr.t$.of({name:"MySQL",load:()=>no("MySQL")}),nr.t$.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(6989)]).then(n.bind(n,76989)).then(e=>e.php())}),nr.t$.of({name:"PLSQL",extensions:["pls"],load:()=>no("PLSQL")}),nr.t$.of({name:"PostgreSQL",load:()=>no("PostgreSQL")}),nr.t$.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>Promise.all([n.e(7906),n.e(2293)]).then(n.bind(n,42293)).then(e=>e.python())}),nr.t$.of({name:"Rust",extensions:["rs"],load:()=>Promise.all([n.e(7906),n.e(8164)]).then(n.bind(n,98164)).then(e=>e.rust())}),nr.t$.of({name:"Sass",extensions:["sass"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(7941)]).then(n.bind(n,7941)).then(e=>e.sass({indented:!0}))}),nr.t$.of({name:"SCSS",extensions:["scss"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(7941)]).then(n.bind(n,7941)).then(e=>e.sass())}),nr.t$.of({name:"SQL",extensions:["sql"],load:()=>no("StandardSQL")}),nr.t$.of({name:"SQLite",load:()=>no("SQLite")}),nr.t$.of({name:"TSX",extensions:["tsx"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({jsx:!0,typescript:!0}))}),nr.t$.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>Promise.all([n.e(7906),n.e(3648)]).then(n.bind(n,73648)).then(e=>e.javascript({typescript:!0}))}),nr.t$.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>Promise.all([n.e(7906),n.e(7584)]).then(n.bind(n,77584)).then(e=>e.wast())}),nr.t$.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>Promise.all([n.e(7906),n.e(8294)]).then(n.bind(n,95913)).then(e=>e.xml())}),nr.t$.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>Promise.all([n.e(7906),n.e(6700)]).then(n.bind(n,46700)).then(e=>e.yaml())}),nr.t$.of({name:"APL",extensions:["dyalog","apl"],load:()=>n.e(5791).then(n.bind(n,35791)).then(e=>ni(e.apl))}),nr.t$.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>n.e(7750).then(n.bind(n,87750)).then(e=>ni(e.asciiArmor))}),nr.t$.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>n.e(1121).then(n.bind(n,41121)).then(e=>ni(e.asn1({})))}),nr.t$.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>n.e(3336).then(n.bind(n,53336)).then(e=>ni(e.asterisk))}),nr.t$.of({name:"Brainfuck",extensions:["b","bf"],load:()=>n.e(8127).then(n.bind(n,88127)).then(e=>ni(e.brainfuck))}),nr.t$.of({name:"Cobol",extensions:["cob","cpy"],load:()=>n.e(4867).then(n.bind(n,4867)).then(e=>ni(e.cobol))}),nr.t$.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.csharp))}),nr.t$.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"ClojureScript",extensions:["cljs"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>n.e(6200).then(n.bind(n,73819)).then(e=>ni(e.gss))}),nr.t$.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>n.e(7507).then(n.bind(n,47507)).then(e=>ni(e.cmake))}),nr.t$.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>n.e(1191).then(n.bind(n,71191)).then(e=>ni(e.coffeeScript))}),nr.t$.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>n.e(293).then(n.bind(n,20293)).then(e=>ni(e.commonLisp))}),nr.t$.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>n.e(5491).then(n.bind(n,65491)).then(e=>ni(e.cypher))}),nr.t$.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>n.e(8082).then(n.bind(n,78082)).then(e=>ni(e.cython))}),nr.t$.of({name:"Crystal",extensions:["cr"],load:()=>n.e(6730).then(n.bind(n,36730)).then(e=>ni(e.crystal))}),nr.t$.of({name:"D",extensions:["d"],load:()=>n.e(540).then(n.bind(n,70540)).then(e=>ni(e.d))}),nr.t$.of({name:"Dart",extensions:["dart"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.dart))}),nr.t$.of({name:"diff",extensions:["diff","patch"],load:()=>n.e(5771).then(n.bind(n,85771)).then(e=>ni(e.diff))}),nr.t$.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>n.e(7398).then(n.bind(n,47398)).then(e=>ni(e.dockerFile))}),nr.t$.of({name:"DTD",extensions:["dtd"],load:()=>n.e(3820).then(n.bind(n,73820)).then(e=>ni(e.dtd))}),nr.t$.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>n.e(882).then(n.bind(n,80882)).then(e=>ni(e.dylan))}),nr.t$.of({name:"EBNF",load:()=>n.e(1695).then(n.bind(n,14076)).then(e=>ni(e.ebnf))}),nr.t$.of({name:"ECL",extensions:["ecl"],load:()=>n.e(5700).then(n.bind(n,5700)).then(e=>ni(e.ecl))}),nr.t$.of({name:"edn",extensions:["edn"],load:()=>n.e(2220).then(n.bind(n,52220)).then(e=>ni(e.clojure))}),nr.t$.of({name:"Eiffel",extensions:["e"],load:()=>n.e(5627).then(n.bind(n,15627)).then(e=>ni(e.eiffel))}),nr.t$.of({name:"Elm",extensions:["elm"],load:()=>n.e(7292).then(n.bind(n,97292)).then(e=>ni(e.elm))}),nr.t$.of({name:"Erlang",extensions:["erl"],load:()=>n.e(1855).then(n.bind(n,51855)).then(e=>ni(e.erlang))}),nr.t$.of({name:"Esper",load:()=>n.e(7600).then(n.bind(n,77600)).then(e=>ni(e.esper))}),nr.t$.of({name:"Factor",extensions:["factor"],load:()=>n.e(2095).then(n.bind(n,12095)).then(e=>ni(e.factor))}),nr.t$.of({name:"FCL",load:()=>n.e(6257).then(n.bind(n,16257)).then(e=>ni(e.fcl))}),nr.t$.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>n.e(319).then(n.bind(n,50319)).then(e=>ni(e.forth))}),nr.t$.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>n.e(690).then(n.bind(n,60690)).then(e=>ni(e.fortran))}),nr.t$.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.fSharp))}),nr.t$.of({name:"Gas",extensions:["s"],load:()=>n.e(953).then(n.bind(n,953)).then(e=>ni(e.gas))}),nr.t$.of({name:"Gherkin",extensions:["feature"],load:()=>n.e(7530).then(n.bind(n,47530)).then(e=>ni(e.gherkin))}),nr.t$.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>n.e(918).then(n.bind(n,60918)).then(e=>ni(e.groovy))}),nr.t$.of({name:"Haskell",extensions:["hs"],load:()=>n.e(7340).then(n.bind(n,57340)).then(e=>ni(e.haskell))}),nr.t$.of({name:"Haxe",extensions:["hx"],load:()=>n.e(9856).then(n.bind(n,79856)).then(e=>ni(e.haxe))}),nr.t$.of({name:"HXML",extensions:["hxml"],load:()=>n.e(9856).then(n.bind(n,79856)).then(e=>ni(e.hxml))}),nr.t$.of({name:"HTTP",load:()=>n.e(6868).then(n.bind(n,76868)).then(e=>ni(e.http))}),nr.t$.of({name:"IDL",extensions:["pro"],load:()=>n.e(1515).then(n.bind(n,1515)).then(e=>ni(e.idl))}),nr.t$.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>n.e(939).then(n.bind(n,40939)).then(e=>ni(e.jsonld))}),nr.t$.of({name:"Julia",extensions:["jl"],load:()=>n.e(4169).then(n.bind(n,34169)).then(e=>ni(e.julia))}),nr.t$.of({name:"Kotlin",extensions:["kt","kts"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.kotlin))}),nr.t$.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>n.e(121).then(n.bind(n,70121)).then(e=>ni(e.liveScript))}),nr.t$.of({name:"Lua",extensions:["lua"],load:()=>n.e(9730).then(n.bind(n,89730)).then(e=>ni(e.lua))}),nr.t$.of({name:"mIRC",extensions:["mrc"],load:()=>n.e(9657).then(n.bind(n,99657)).then(e=>ni(e.mirc))}),nr.t$.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>n.e(20).then(n.bind(n,30020)).then(e=>ni(e.mathematica))}),nr.t$.of({name:"Modelica",extensions:["mo"],load:()=>n.e(2056).then(n.bind(n,42056)).then(e=>ni(e.modelica))}),nr.t$.of({name:"MUMPS",extensions:["mps"],load:()=>n.e(324).then(n.bind(n,90324)).then(e=>ni(e.mumps))}),nr.t$.of({name:"Mbox",extensions:["mbox"],load:()=>n.e(8020).then(n.bind(n,88020)).then(e=>ni(e.mbox))}),nr.t$.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>n.e(5256).then(n.bind(n,45256)).then(e=>ni(e.nginx))}),nr.t$.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>n.e(3983).then(n.bind(n,43983)).then(e=>ni(e.nsis))}),nr.t$.of({name:"NTriples",extensions:["nt","nq"],load:()=>n.e(2631).then(n.bind(n,42631)).then(e=>ni(e.ntriples))}),nr.t$.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.objectiveC))}),nr.t$.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.objectiveCpp))}),nr.t$.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.oCaml))}),nr.t$.of({name:"Octave",extensions:["m"],load:()=>n.e(920).then(n.bind(n,60920)).then(e=>ni(e.octave))}),nr.t$.of({name:"Oz",extensions:["oz"],load:()=>n.e(3741).then(n.bind(n,83741)).then(e=>ni(e.oz))}),nr.t$.of({name:"Pascal",extensions:["p","pas"],load:()=>n.e(7568).then(n.bind(n,77568)).then(e=>ni(e.pascal))}),nr.t$.of({name:"Perl",extensions:["pl","pm"],load:()=>n.e(3085).then(n.bind(n,23085)).then(e=>ni(e.perl))}),nr.t$.of({name:"Pig",extensions:["pig"],load:()=>n.e(4096).then(n.bind(n,34096)).then(e=>ni(e.pig))}),nr.t$.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>n.e(7469).then(n.bind(n,67469)).then(e=>ni(e.powerShell))}),nr.t$.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>n.e(21).then(n.bind(n,60021)).then(e=>ni(e.properties))}),nr.t$.of({name:"ProtoBuf",extensions:["proto"],load:()=>n.e(447).then(n.bind(n,447)).then(e=>ni(e.protobuf))}),nr.t$.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>n.e(6516).then(n.bind(n,46516)).then(e=>ni(e.pug))}),nr.t$.of({name:"Puppet",extensions:["pp"],load:()=>n.e(158).then(n.bind(n,60158)).then(e=>ni(e.puppet))}),nr.t$.of({name:"Q",extensions:["q"],load:()=>n.e(4347).then(n.bind(n,4347)).then(e=>ni(e.q))}),nr.t$.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>n.e(2694).then(n.bind(n,12694)).then(e=>ni(e.r))}),nr.t$.of({name:"RPM Changes",load:()=>n.e(1965).then(n.bind(n,31965)).then(e=>ni(e.rpmChanges))}),nr.t$.of({name:"RPM Spec",extensions:["spec"],load:()=>n.e(1965).then(n.bind(n,31965)).then(e=>ni(e.rpmSpec))}),nr.t$.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>n.e(4148).then(n.bind(n,64148)).then(e=>ni(e.ruby))}),nr.t$.of({name:"SAS",extensions:["sas"],load:()=>n.e(4021).then(n.bind(n,94021)).then(e=>ni(e.sas))}),nr.t$.of({name:"Scala",extensions:["scala"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.scala))}),nr.t$.of({name:"Scheme",extensions:["scm","ss"],load:()=>n.e(4883).then(n.bind(n,34883)).then(e=>ni(e.scheme))}),nr.t$.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>n.e(9090).then(n.bind(n,39090)).then(e=>ni(e.shell))}),nr.t$.of({name:"Sieve",extensions:["siv","sieve"],load:()=>n.e(1766).then(n.bind(n,41766)).then(e=>ni(e.sieve))}),nr.t$.of({name:"Smalltalk",extensions:["st"],load:()=>n.e(4953).then(n.bind(n,34953)).then(e=>ni(e.smalltalk))}),nr.t$.of({name:"Solr",load:()=>n.e(1296).then(n.bind(n,81296)).then(e=>ni(e.solr))}),nr.t$.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>n.e(598).then(n.bind(n,60598)).then(e=>ni(e.sml))}),nr.t$.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>n.e(5457).then(n.bind(n,25457)).then(e=>ni(e.sparql))}),nr.t$.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>n.e(397).then(n.bind(n,72778)).then(e=>ni(e.spreadsheet))}),nr.t$.of({name:"Squirrel",extensions:["nut"],load:()=>n.e(8598).then(n.bind(n,86217)).then(e=>ni(e.squirrel))}),nr.t$.of({name:"Stylus",extensions:["styl"],load:()=>n.e(9642).then(n.bind(n,89642)).then(e=>ni(e.stylus))}),nr.t$.of({name:"Swift",extensions:["swift"],load:()=>n.e(3479).then(n.bind(n,43479)).then(e=>ni(e.swift))}),nr.t$.of({name:"sTeX",load:()=>n.e(1790).then(n.bind(n,21790)).then(e=>ni(e.stex))}),nr.t$.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>n.e(1790).then(n.bind(n,21790)).then(e=>ni(e.stex))}),nr.t$.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>n.e(986).then(n.bind(n,90986)).then(e=>ni(e.verilog))}),nr.t$.of({name:"Tcl",extensions:["tcl"],load:()=>n.e(7047).then(n.bind(n,57047)).then(e=>ni(e.tcl))}),nr.t$.of({name:"Textile",extensions:["textile"],load:()=>n.e(8769).then(n.bind(n,78769)).then(e=>ni(e.textile))}),nr.t$.of({name:"TiddlyWiki",load:()=>n.e(1856).then(n.bind(n,51856)).then(e=>ni(e.tiddlyWiki))}),nr.t$.of({name:"Tiki wiki",load:()=>n.e(5247).then(n.bind(n,85247)).then(e=>ni(e.tiki))}),nr.t$.of({name:"TOML",extensions:["toml"],load:()=>n.e(5496).then(n.bind(n,55496)).then(e=>ni(e.toml))}),nr.t$.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>n.e(5199).then(n.bind(n,75199)).then(e=>ni(e.troff))}),nr.t$.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>n.e(4173).then(n.bind(n,14173)).then(e=>ni(e.ttcn))}),nr.t$.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>n.e(2778).then(n.bind(n,42778)).then(e=>ni(e.ttcnCfg))}),nr.t$.of({name:"Turtle",extensions:["ttl"],load:()=>n.e(2606).then(n.bind(n,22606)).then(e=>ni(e.turtle))}),nr.t$.of({name:"Web IDL",extensions:["webidl"],load:()=>n.e(2402).then(n.bind(n,82402)).then(e=>ni(e.webIDL))}),nr.t$.of({name:"VB.NET",extensions:["vb"],load:()=>n.e(1476).then(n.bind(n,61476)).then(e=>ni(e.vb))}),nr.t$.of({name:"VBScript",extensions:["vbs"],load:()=>n.e(3907).then(n.bind(n,23907)).then(e=>ni(e.vbScript))}),nr.t$.of({name:"Velocity",extensions:["vtl"],load:()=>n.e(4987).then(n.bind(n,37368)).then(e=>ni(e.velocity))}),nr.t$.of({name:"Verilog",extensions:["v"],load:()=>n.e(986).then(n.bind(n,90986)).then(e=>ni(e.verilog))}),nr.t$.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>n.e(2394).then(n.bind(n,72394)).then(e=>ni(e.vhdl))}),nr.t$.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>n.e(9100).then(n.bind(n,79100)).then(e=>ni(e.xQuery))}),nr.t$.of({name:"Yacas",extensions:["ys"],load:()=>n.e(339).then(n.bind(n,50339)).then(e=>ni(e.yacas))}),nr.t$.of({name:"Z80",extensions:["z80"],load:()=>n.e(422).then(n.bind(n,40422)).then(e=>ni(e.z80))}),nr.t$.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.mscgen))}),nr.t$.of({name:"X\xf9",extensions:["xu"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.xu))}),nr.t$.of({name:"MsGenny",extensions:["msgenny"],load:()=>n.e(2557).then(n.bind(n,12557)).then(e=>ni(e.msgenny))}),nr.t$.of({name:"Vue",extensions:["vue"],load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(4900)]).then(n.bind(n,34900)).then(e=>e.vue())}),nr.t$.of({name:"Angular Template",load:()=>Promise.all([n.e(7906),n.e(4938),n.e(3648),n.e(570),n.e(9599)]).then(n.bind(n,49599)).then(e=>e.angular())})];var na=n(70638),ns=n(35445),nc=n(67080);class nd{constructor(e,t,n={}){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,i){let o=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);o+=n[0].slice(e+n[1].length);let t=(r+=e)-i;t>0&&(o=n[0].slice(e-t,e)+o,r=i)}return t.tr.insertText(o,r,i)}}(t):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}let nu=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i=n[r],o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};function nh(e,t,n=null,r){return new nd(e,(e,i,o,l)=>{let a=n instanceof Function?n(i):n,s=e.tr.delete(o,l),c=s.doc.resolve(o).blockRange(),d=c&&(0,nc.oM)(c,t,a);if(!d)return null;s.wrap(c,d);let u=s.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&(0,nc.n9)(s.doc,o-1)&&(!r||r(i,u))&&s.join(o-1),s})}function np(e,t,n=null){return new nd(e,(e,r,i,o)=>{let l=e.doc.resolve(i),a=n instanceof Function?n(r):n;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,a):null})}new nd(/--$/,"—",{inCodeMark:!1}),new nd(/\.\.\.$/,"…",{inCodeMark:!1}),new nd(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new nd(/"$/,"”",{inCodeMark:!1}),new nd(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new nd(/'$/,"’",{inCodeMark:!1});var nf=((k={}).docTypeError="docTypeError",k.contextNotFound="contextNotFound",k.timerNotFound="timerNotFound",k.ctxCallOutOfScope="ctxCallOutOfScope",k.createNodeInParserFail="createNodeInParserFail",k.stackOverFlow="stackOverFlow",k.parserMatchError="parserMatchError",k.serializerMatchError="serializerMatchError",k.getAtomFromSchemaFail="getAtomFromSchemaFail",k.expectDomTypeError="expectDomTypeError",k.callCommandBeforeEditorView="callCommandBeforeEditorView",k.missingRootElement="missingRootElement",k.missingNodeInSchema="missingNodeInSchema",k.missingMarkInSchema="missingMarkInSchema",k.ctxNotBind="ctxNotBind",k.missingYjsDoc="missingYjsDoc",k),nm=class extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}},ng=(e,t)=>"function"==typeof t?"[Function]":t;function nv(){return new nm(nf.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function ny(){return new nm(nf.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function nw(e){return new nm(nf.expectDomTypeError,`Expect to be a dom, but get: ${JSON.stringify(e,ng)}.`)}function nb(){return new nm(nf.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function nk(e){return new nm(nf.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}let nC="u">typeof navigator?navigator:null,nx="u">typeof document?document:null,nS=nC&&nC.userAgent||"",nM=/Edge\/(\d+)/.exec(nS),nT=/MSIE \d/.exec(nS),nN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nS),nA=!!(nT||nN||nM),nO=nT?document.documentMode:nN?+nN[1]:nM?+nM[1]:0,nI=!nA&&/gecko\/(\d+)/i.test(nS),nE=nI&&+(/Firefox\/(\d+)/.exec(nS)||[0,0])[1],n_=!nA&&/Chrome\/(\d+)/.exec(nS),nR=!!n_,nL=n_?+n_[1]:0,nP=!nA&&!!nC&&/Apple Computer/.test(nC.vendor),n$=nP&&(/Mobile\/\w+/.test(nS)||!!nC&&nC.maxTouchPoints>2),nD=n$||!!nC&&/Mac/.test(nC.platform),nj=/Android \d/.test(nS),nF=!!nx&&"webkitFontSmoothing"in nx.documentElement.style,nB=nF?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var nH=Object.freeze({__proto__:null,android:nj,chrome:nR,chrome_version:nL,gecko:nI,gecko_version:nE,ie:nA,ie_version:nO,ios:n$,mac:nD,safari:nP,webkit:nF,webkit_version:nB});function nz(e,t,n,r,i,o){if(e.composing)return!1;let l=e.state,a=l.doc.resolve(t);if(a.parent.type.spec.code)return!1;let s=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){let i=a.match.exec(s),c=i&&i[0]&&a.handler(l,i,t-(i[0].length-r.length),n);if(c)return!1!==a.undoable&&c.setMeta(o,{transform:c,from:t,to:n,text:r}),e.dispatch(c),!0}return!1}let nq=new ns.hs("MILKDOWN_CUSTOM_INPUTRULES");function nK(e,t,n={}){return new nd(e,(e,r,i,o)=>{var l,a,s,c;let d,{tr:u}=e,h=r.length,p=r[h-1],f=r[0],m=[],g={group:p,fullMatch:f,start:i,end:o},v=null==(l=n.updateCaptured)?void 0:l.call(n,g);if(Object.assign(g,v),{group:p,fullMatch:f,start:i,end:o}=g,null===f||(null==p?void 0:p.trim())==="")return null;if(p){let e=f.search(/\S/),l=i+f.indexOf(p),h=l+p.length;m=null!=(a=u.storedMarks)?a:[],h<o&&u.delete(h,o),l>i&&u.delete(i+e,l),d=i+e+p.length;let g=null==(s=n.getAttr)?void 0:s.call(n,r);u.addMark(i,d,t.create(g)),u.setStoredMarks(m),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:i,end:o,tr:u})}return u})}var nW=Object.defineProperty,nU=Object.defineProperties,nV=Object.getOwnPropertyDescriptors,nJ=Object.getOwnPropertySymbols,nG=Object.prototype.hasOwnProperty,nZ=Object.prototype.propertyIsEnumerable,nY=(e,t,n)=>t in e?nW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function nX(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nQ(e,t,n){let r=e.state.doc.content.size,i=nX(t,0,r),o=nX(n,0,r),l=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),s=Math.min(l.top,a.top),c=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),u=Math.max(l.right,a.right),h={top:s,bottom:c,left:d,right:u,width:u-d,height:c-s,x:d,y:s};return nU(((e,t)=>{for(var n in t||(t={}))nG.call(t,n)&&nY(e,n,t[n]);if(nJ)for(var n of nJ(t))nZ.call(t,n)&&nY(e,n,t[n]);return e})({},h),nV({toJSON:()=>h}))}function n1(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function n0(e){return t=>{for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{from:t.before(n),to:t.after(n),node:r}}}}function n2(e){return t=>{for(let n=t.depth;n>0;n--){let r=t.node(n);if(e(r))return{pos:t.before(n),start:t.start(n),depth:n,node:r}}}}let n5=(e,t)=>{let{selection:n,doc:r}=e;if(n instanceof ns.nh)return{hasNode:n.node.type===t,pos:n.from,target:n.node};let{from:i,to:o}=n,l=!1,a=-1,s=null;return r.nodesBetween(i,o,(e,n)=>!s&&(e.type!==t||(l=!0,a=n,s=e,!1))),{hasNode:l,pos:a,target:s}};var n3=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){var n;throw n="string"==typeof e?e:e.name,new nm(nf.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}return t},this.remove=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},n9=class{#e=[];#t;#n=()=>{this.#e.forEach(e=>e(this.#t))};constructor(e,t,n){this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},n7=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw nv()}}create(e,t=this._defaultValue){return new n9(e,t,this)}},n4=(e,t)=>new n7(e,t),n8=class{#r;#i;#o;#l=new Set;#a=new Set;#s=new Map;#c=new Map;constructor(e,t,n){this.read=()=>({metadata:this.#r,injectedSlices:[...this.#l].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),consumedSlices:[...this.#a].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),recordedTimers:[...this.#s].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)})),waitTimers:[...this.#c].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)}))}),this.onRecord=e=>{this.#s.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#s.delete(e)},this.onDone=e=>{let t=this.#s.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{let n=Date.now();t.finally(()=>{this.#c.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#l.add(e)},this.onRemove=e=>{this.#l.delete(e)},this.onUse=e=>{this.#a.add(e)},this.#i=e,this.#o=t,this.#r=n}#d=e=>this.#i.get(e).get();#u=e=>this.#o.get(e).status},n6=class e{#i;#o;#r;#h;constructor(t,n,r){this.produce=t=>t&&Object.keys(t).length?new e(this.#i,this.#o,{...t}):this,this.inject=(e,t)=>{let n=e.create(this.#i.sliceMap);return null!=t&&n.set(t),this.#h?.onInject(e),this},this.remove=e=>(this.#i.remove(e),this.#h?.onRemove(e),this),this.record=e=>(e.create(this.#o.store),this.#h?.onRecord(e),this),this.clearTimer=e=>(this.#o.remove(e),this.#h?.onClear(e),this),this.isInjected=e=>this.#i.has(e),this.isRecorded=e=>this.#o.has(e),this.use=e=>(this.#h?.onUse(e),this.#i.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#o.get(e),this.done=e=>{this.timer(e).done(),this.#h?.onDone(e)},this.wait=e=>{let t=this.timer(e).start();return this.#h?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#i=t,this.#o=n,this.#r=r,r&&(this.#h=new n8(t,n,r))}get meta(){return this.#r}get inspector(){return this.#h}},re=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t){var n;throw n=e.name,new nm(nf.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},rt=class{#p=null;#f=null;#m;#g="pending";constructor(e,t){this.start=()=>(this.#p??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#m&&(this.#g="resolved",this.#v(),t.stopImmediatePropagation(),e())},this.#y(()=>{"pending"===this.#g&&(this.#g="rejected"),this.#v(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#g="pending",addEventListener(this.type.name,this.#f)}),this.#p),this.done=()=>{dispatchEvent(new CustomEvent(this.type.name,{detail:{id:this.#m}}))},this.#m=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#g}#v=()=>{this.#f&&removeEventListener(this.type.name,this.#f)};#y=e=>{setTimeout(()=>{e()},this.type.timeout)}},rn=class{constructor(e,t=3e3){this.create=e=>new rt(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},rr=(e,t=3e3)=>new rn(e,t),ri=n(4949),ro=n(18545);let rl={}.hasOwnProperty;var ra=n(48433),rs=n(91565),rc=n(12944);let rd=[function(e,t,n,r){if("code"===t.type&&(0,rs.m)(t,r)&&("list"===e.type||e.type===t.type&&(0,rs.m)(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&(0,rc.f)(t,r)))return;return+!!n.spread}}],ru=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],rh=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ru},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"+",after:"(?:[ \r\n])"},{atBreak:!0,character:"-",after:"(?:[ \r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ru},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ru},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ru},{atBreak:!0,character:"~"}];var rp=n(97930);function rf(e){return e.label||!e.identifier?e.label||"":(0,rp.s)(e.identifier)}function rm(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}var rg=n(88093);let rv=/\r?\n|\r/g;function ry(e,t){let n,r=[],i=0,o=0;for(;n=rv.exec(e);)l(e.slice(i,n.index)),r.push(n[0]),i=n.index+n[0].length,o++;return l(e.slice(i)),r.join("");function l(e){r.push(t(e,o,!e))}}var rw=n(62018);function rb(e,t){return e-t}function rk(e,t){let n,r=/\\(?=[!-/:-@[-`{-~])/g,i=[],o=[],l=e+t,a=-1,s=0;for(;n=r.exec(l);)i.push(n.index);for(;++a<i.length;)s!==i[a]&&o.push(e.slice(s,i[a])),o.push("\\"),s=i[a];return o.push(e.slice(s)),o.join("")}function rC(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,o=n.column||1;return{move:function(e){let t=e||"",n=t.split(/\r?\n|\r/g),l=n[n.length-1];return i+=n.length-1,o=1===n.length?o+l.length:1+l.length+r,t},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function rx(e){throw Error("Cannot handle value `"+e+"`, expected node")}function rS(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function rM(e,t){if("definition"===e.type&&e.type===t.type)return 0}function rT(e,t){return function(e,t,n){let r,i=t.indexStack,o=e.children||[],l=[],a=-1,s=n.before;i.push(-1);let c=t.createTracker(n);for(;++a<o.length;){let d,u=o[a];if(i[i.length-1]=a,a+1<o.length){let n=t.handle.handlers[o[a+1].type];n&&n.peek&&(n=n.peek),d=n?n(o[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;l.length>0&&("\r"===s||"\n"===s)&&"html"===u.type&&(l[l.length-1]=l[l.length-1].replace(/(\r?\n|\r)$/," "),s=" ",(c=t.createTracker(n)).move(l.join("")));let h=t.handle(u,e,t,{...c.current(),after:d,before:s});r&&r===h.slice(0,1)&&(h=(0,rg.T)(r.charCodeAt(0))+h.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,r=void 0,p&&(l.length>0&&p.before&&s===l[l.length-1].slice(-1)&&(l[l.length-1]=l[l.length-1].slice(0,-1)+(0,rg.T)(s.charCodeAt(0))),p.after&&(r=d)),c.move(h),l.push(h),s=h.slice(-1)}return i.pop(),l.join("")}(e,this,t)}function rN(e,t){return function(e,t,n){let r=t.indexStack,i=e.children||[],o=t.createTracker(n),l=[],a=-1;for(r.push(-1);++a<i.length;){let n=i[a];r[r.length-1]=a,l.push(o.move(t.handle(n,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&l.push(o.move(function(e,t,n,r){let i=r.join.length;for(;i--;){let o=r.join[i](e,t,n,r);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}(n,i[a+1],e,t)))}return r.pop(),l.join("")}(e,this,t)}function rA(e,t){return function(e,t,n){let r=(n.before||"")+(t||"")+(n.after||""),i=[],o=[],l={},a=-1;for(;++a<e.unsafe.length;){let t,n=e.unsafe[a];if(!(0,rw.q)(e.stack,n))continue;let o=e.compilePattern(n);for(;t=o.exec(r);){let e="before"in n||!!n.atBreak,r="after"in n,o=t.index+(e?t[1].length:0);i.includes(o)?(l[o].before&&!e&&(l[o].before=!1),l[o].after&&!r&&(l[o].after=!1)):(i.push(o),l[o]={before:e,after:r})}}i.sort(rb);let s=n.before?n.before.length:0,c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){let e=i[a];!(e<s)&&!(e>=c)&&(!(e+1<c)||i[a+1]!==e+1||!l[e].after||l[e+1].before||l[e+1].after)&&(i[a-1]!==e-1||!l[e].before||l[e-1].before||l[e-1].after)&&(s!==e&&o.push(rk(r.slice(s,e),"\\")),s=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(o.push((0,rg.T)(r.charCodeAt(e))),s++):o.push("\\"))}return o.push(rk(r.slice(s,c),n.after)),o.join("")}(this,e,t)}function rO(e){let t=this;t.compiler=function(n){var r;let i,o;return r={...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]},!function e(t,n){var r,i,o,l;let a,s=-1;if(n.extensions)for(;++s<n.extensions.length;)e(t,n.extensions[s]);for(a in n)if(rl.call(n,a))switch(a){case"extensions":break;case"unsafe":case"join":r=t[a],(i=n[a])&&r.push(...i);break;case"handlers":o=t[a],(l=n[a])&&Object.assign(o,l);break;default:t.options[a]=n[a]}return t}(i={associationId:rf,containerPhrasing:rT,containerFlow:rN,createTracker:rC,compilePattern:rm,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...ra.p},handle:void 0,indentLines:ry,indexStack:[],join:[...rd],options:{},safe:rA,stack:[],unsafe:[...rh]},r||{}),i.options.tightDefinitions&&i.join.push(rM),i.handle=(0,ro.A)("type",{invalid:rx,unknown:rS,handlers:i.handlers}),(o=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0}))&&10!==o.charCodeAt(o.length-1)&&13!==o.charCodeAt(o.length-1)&&(o+="\n"),o}}var rI=n(28972),rE=n(32545);let r_=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function rR(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let rL=(e,t,n)=>{let r=rR(e,n);if(!r)return!1;let i=rj(r);if(!i){let n=r.blockRange(),i=n&&(0,nc.jP)(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(rz(e,i,t,-1))return!0;if(0==r.parent.content.size&&(r$(o,"end")||ns.nh.isSelectable(o)))for(let n=r.depth;;n--){let l=(0,nc.$L)(e.doc,r.before(n),r.after(n),rE.Ji.empty);if(l&&l.slice.size<l.to-l.from){if(t){let n=e.tr.step(l);n.setSelection(r$(o,"end")?ns.LN.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):ns.nh.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},rP=(e,t,n)=>{let r=rR(e,n);if(!r)return!1;let i=rj(r);return!!i&&function(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,l=t.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=(0,nc.$L)(e.doc,i,l,rE.Ji.empty);if(!a||a.from!=i||a instanceof nc.Ln&&a.slice.size>=l-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(ns.U3.create(t.doc,i)),n(t.scrollIntoView())}return!0}(e,i,t)};function r$(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let rD=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=rj(r)}let l=o&&o.nodeBefore;return!!l&&!!ns.nh.isSelectable(l)&&(t&&t(e.tr.setSelection(ns.nh.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function rj(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function rF(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function rB(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let rH=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),l=rB(i.contentMatchAt(o));if(!l||!i.canReplaceWith(o,o,l))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,l.createAndFill());i.setSelection(ns.LN.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0};function rz(e,t,n,r){let i,o,l,a=t.nodeBefore,s=t.nodeAfter,c,d,u=a.type.spec.isolating||s.type.spec.isolating;if(!u&&(i=t.nodeBefore,o=t.nodeAfter,l=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(l-1,l)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(l,l+1)&&!!(o.isTextblock||(0,nc.n9)(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let h=!u&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(c=(d=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&d.matchType(c[0]||s.type).validEnd){if(n){let r=t.pos+s.nodeSize,i=rE.FK.empty;for(let e=c.length-1;e>=0;e--)i=rE.FK.from(c[e].create(null,i));i=rE.FK.from(a.copy(i));let o=e.tr.step(new nc.Wg(t.pos-1,r,t.pos,r,new rE.Ji(i,1,0),c.length,!0)),l=o.doc.resolve(r+2*c.length);l.nodeAfter&&l.nodeAfter.type==a.type&&(0,nc.n9)(o.doc,l.pos)&&o.join(l.pos),n(o.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&u?null:ns.LN.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&(0,nc.jP)(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(h&&r$(s,"start",!0)&&r$(a,"end")){let r=a,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=s,l=1;for(;!o.isTextblock;o=o.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=rE.FK.empty;for(let e=i.length-1;e>=0;e--)r=rE.FK.from(i[e].copy(r));n(e.tr.step(new nc.Wg(t.pos-i.length,t.pos+s.nodeSize,t.pos+l,t.pos+s.nodeSize-l,new rE.Ji(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function rq(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(ns.U3.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let rK=rq(-1),rW=rq(1);function rU(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,l=i.blockRange(o),a=l&&(0,nc.oM)(l,e,t);return!!a&&(r&&r(n.tr.wrap(l,a).scrollIntoView()),!0)}}function rV(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[r];n.doc.nodesBetween(o,l,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[r];i.setBlockType(o,l,e,t)}r(i.scrollIntoView())}return!0}}function rJ(e,t=null,n){let r=!1!==(n&&n.removeWhenPresent),i=!1!==(n&&n.enterInlineAtoms),o=!(n&&n.includeWhitespace);return function(n,l){let{empty:a,$cursor:s,ranges:c}=n.selection;if(a&&!s||!function(e,t,n,r){for(let i=0;i<t.length;i++){let{$from:o,$to:l}=t[i],a=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,l.pos,(e,t)=>{if(a||!r&&e.isAtom&&e.isInline&&t>=o.pos&&t+e.nodeSize<=l.pos)return!1;a=e.inlineContent&&e.type.allowsMarkType(n)}),a)return!0}return!1}(n.doc,c,e,i))return!1;if(l)if(s)l(e.isInSet(n.storedMarks||s.marks())?n.tr.removeStoredMark(e):n.tr.addStoredMark(e.create(t)));else{let a,s=n.tr;i||(c=function(e){let t=[];for(let n=0;n<e.length;n++){let{$from:r,$to:i}=e[n];r.doc.nodesBetween(r.pos,i.pos,(e,n)=>{if(e.isAtom&&e.content.size&&e.isInline&&n>=r.pos&&n+e.nodeSize<=i.pos)return n+1>r.pos&&t.push(new ns.yn(r,r.doc.resolve(n+1))),r=r.doc.resolve(n+1+e.content.size),!1}),r.pos<i.pos&&t.push(new ns.yn(r,i))}return t}(c)),a=r?!c.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)):!c.every(t=>{let n=!1;return s.doc.nodesBetween(t.$from.pos,t.$to.pos,(r,i,o)=>{if(n)return!1;n=!e.isInSet(r.marks)&&!!o&&o.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-i),Math.min(r.nodeSize,t.$to.pos-i))))}),!n});for(let n=0;n<c.length;n++){let{$from:r,$to:i}=c[n];if(a){let n=r.pos,l=i.pos,a=r.nodeAfter,c=i.nodeBefore,d=o&&a&&a.isText?/^\s*/.exec(a.text)[0].length:0,u=o&&c&&c.isText?/\s*$/.exec(c.text)[0].length:0;n+d<l&&(n+=d,l-=u),s.addMark(n,l,e.create(t))}else s.removeMark(r.pos,i.pos,e)}l(s.scrollIntoView())}return!0}}function rG(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let rZ=rG(r_,rL,rD),rY=rG(r_,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}(e,n);if(!r)return!1;let i=rF(r);if(!i)return!1;let o=i.nodeAfter;if(rz(e,i,t,1))return!0;if(0==r.parent.content.size&&(r$(o,"start")||ns.nh.isSelectable(o))){let n=(0,nc.$L)(e.doc,r.before(),r.after(),rE.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(r$(o,"start")?ns.LN.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):ns.nh.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=rF(r)}let l=o&&o.nodeAfter;return!!l&&!!ns.nh.isSelectable(l)&&(t&&t(e.tr.setSelection(ns.nh.create(e.doc,o.pos)).scrollIntoView()),!0)}),rX={Enter:rG((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof ns.i5||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=rB(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=e.tr.insert(n,o.createAndFill());l.setSelection(ns.U3.create(l.doc,n+1)),t(l.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if((0,nc.zy)(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&(0,nc.jP)(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof ns.nh&&e.selection.node.isBlock)return!!n.parentOffset&&!!(0,nc.zy)(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,l,a=!1,s=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),s=n.start(e)==n.pos-(n.depth-e),l=rB(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&l?{type:l}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof ns.U3||e.selection instanceof ns.i5)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=(0,nc.zy)(c.doc,d,i.length,i);if(u||(i[0]=l?{type:l}:null,u=(0,nc.zy)(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&s&&n.node(o).type!=l){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);l&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,l)&&c.setNodeMarkup(c.mapping.map(n.before(o)),l)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":rH,Backspace:rZ,"Mod-Backspace":rZ,"Shift-Backspace":rZ,Delete:rY,"Mod-Delete":rY,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new ns.i5(e.doc))),!0)},rQ={"Ctrl-h":rX.Backspace,"Alt-Backspace":rX["Mod-Backspace"],"Ctrl-d":rX.Delete,"Ctrl-Alt-Backspace":rX["Mod-Delete"],"Alt-Delete":rX["Mod-Delete"],"Alt-d":rX["Mod-Delete"],"Ctrl-a":rK,"Ctrl-e":rW};for(let e in rX)rQ[e]=rX[e];let r1=("u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&!!os.platform&&"darwin"==os.platform())?rQ:rX;var r0=n(96455);let r2="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),r5="u">typeof navigator&&/Win/.test(navigator.platform);function r3(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function r9(e){return new ns.k_({props:{handleKeyDown:r7(e)}})}function r7(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),l=o[o.length-1];"Space"==l&&(l=" ");for(let e=0;e<o.length-1;e++){let l=o[e];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))r2?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+l)}return t&&(l="Alt-"+l),n&&(l="Ctrl-"+l),i&&(l="Meta-"+l),r&&(l="Shift-"+l),l}(n)]=e[n];return t}(e);return function(e,n){let r=(0,r0.xT)(n),i,o=t[r3(r,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==r.length&&" "!=r){if(n.shiftKey){let i=t[r3(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(r5&&n.ctrlKey&&n.altKey)&&(i=r0.E3[n.keyCode])&&i!=r){let r=t[r3(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var r4=class{},r8=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw ny();return e}}},r6=class e extends r4{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},ie=class extends r8{#w=rE.CU.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(r6.create(e,[],t)),this),this.closeNode=()=>{try{this.#b()}catch(e){console.error(e)}return this},this.addNode=(e,t,n)=>{try{this.#k(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>(this.#w=e.create(t).addToSet(this.#w),this),this.closeMark=e=>(this.#w=e.removeFromSet(this.#w),this),this.addText=e=>{try{let t=this.top();if(!t)throw ny();let n=t.pop(),r=this.schema.text(e,this.#w);if(!n)return t.push(r),this;let i=this.#C(n,r);if(i)return t.push(i),this;return t.push(n,r),this}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=this.#b();while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#x(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#S=e=>e.isText;#C=(e,t)=>{if(this.#S(e)&&this.#S(t)&&rE.CU.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)};#M=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t){var n;throw n=e,new nm(nf.parserMatchError,`Cannot match target parser for node: ${JSON.stringify(n,ng)}.`)}return t};#x=e=>{let t=this.#M(e);t.spec.parseMarkdown.runner(this,e,t)};#b=()=>{this.#w=rE.CU.none;let e=this.close();return this.#k(e.type,e.attrs,e.content)};#k=(e,t,n)=>{let r=e.createAndFill(t,n,this.#w);if(!r){let r,i,o;throw r=`Cannot create node for ${"name"in e?e.name:e}`,i=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(i).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},o=[["[Description]",r],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:i(e):"null")]].reduce((e,[t,n])=>{let r=`${t}: ${i(n)}.`;return e.concat(r)},[]),new nm(nf.createNodeInParserFail,o.join("\n"))}return this.push(r),r}},it=class e extends r4{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,i={})=>new e(t,n,r,i)}},ir=class extends r8{#w=rE.CU.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.openNode=(e,t,n)=>(this.open(it.create(e,void 0,t,n)),this),this.closeNode=()=>(this.#b(),this),this.addNode=(e,t,n,r)=>(this.#k(e,t,n,r),this),this.withMark=(e,t,n,r)=>(this.#T(e,t,n,r),this),this.closeMark=e=>(this.#N(e),this),this.build=()=>{let e=null;do e=this.#b();while(this.size());return e},this.next=e=>(Object.prototype.hasOwnProperty.call(e,"size")?e.forEach(e=>{this.#x(e)}):this.#x(e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}#M=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t){var n;throw n=e.type,new nm(nf.serializerMatchError,`Cannot match target serializer for node: ${JSON.stringify(n,ng)}.`)}return t};#A=e=>this.#M(e).spec.toMarkdown.runner(this,e);#O=(e,t)=>this.#M(e).spec.toMarkdown.runner(this,e,t);#x=e=>{let{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!this.#O(t,e))&&this.#A(e),t.forEach(e=>this.#N(e))};#I=(e,t)=>{if(e.type===t||e.children?.length!==1)return e;let n=e=>{if(e.type===t)return null!=e.value?null:e;if(e.children?.length!==1)return null;let[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;let i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r};#E=e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){let{children:n,...i}=t=this.#I(t,r.type),{children:o,...l}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(l)){let t={...l,children:[...o,...n]};return e.slice(0,-1).concat(this.#E(t))}}return e.concat(t)},[])),e};#_=e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t};#R=(e,t)=>{let n="",r="",i=e.children,o=-1,l=-1;if(i){i&&i.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),l=t)});let e=i?.[l],t=i?.[o];if(e&&e.value.endsWith(" ")){let t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){let e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&this.#k("text",void 0,n);let a=t();return r.length&&this.#k("text",void 0,r),a};#b=(e=!1)=>{let t=this.close(),n=()=>this.#k(t.type,t.children,t.value,t.props);return e?this.#R(t,n):n()};#k=(e,t,n,r)=>{let i=it.create(e,t,n,r),o=this.#E(this.#_(i));return this.push(o),o};#T=(e,t,n,r)=>e.isInSet(this.#w)?this:(this.#w=e.addToSet(this.#w),this.openNode(t,n,{...r,isMark:!0}));#N=e=>{e.isInSet(this.#w)&&(this.#w=e.type.removeFromSet(this.#w),this.#b(!0))}},ii=n(85204);function io(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}var il={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||"*",o=n.enter("strong"),l=n.createTracker(r),a=l.move(i+i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i+i),o(),a},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),l=n.createTracker(r),a=l.move(i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i),o(),a}},ia=n4({},"editorView"),is=n4({},"editorState"),ic=n4([],"initTimer"),id=n4({},"editor"),iu=n4([],"inputRules"),ih=n4([],"prosePlugins"),ip=n4([],"remarkPlugins"),im=n4([],"nodeView"),ig=n4([],"markView"),iv=n4((0,rI.l)().use(ri.A).use(rO),"remark"),iy=n4({handlers:il,encode:[]},"remarkStringifyOptions"),iw=rr("ConfigReady"),ib=rr("InitReady"),ik=rr("SchemaReady"),iC=n4([],"schemaTimer"),ix=n4({},"schema"),iS=n4([],"nodes"),iM=n4([],"marks");function iT(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var iN=e=>(e.inject(ix,{}).inject(iS,[]).inject(iM,[]).inject(iC,[ib]).record(ik),async()=>{await e.waitTimers(iC);let t=e.get(iv),n=e.get(ip).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(iv,n);let r=new rE.Sj({nodes:Object.fromEntries(e.get(iS).map(([e,t])=>[e,iT(t)])),marks:Object.fromEntries(e.get(iM).map(([e,t])=>[e,iT(t)]))});return e.set(ix,r),e.done(ik),()=>{e.remove(ix).remove(iS).remove(iM).remove(iC).clearTimer(ik)}});io(iN,{displayName:"Schema"});var iA=class{constructor(){this.setCtx=e=>{this.#L=e},this.chain=()=>{if(null==this.#L)throw nb();let e=this.#L,t=[],n=this.get.bind(this),r={run:()=>{let n=rG(...t),r=e.get(ia);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:(function(e,i){let o=n(e);return t.push(o(i)),r}).bind(this)};return r}}#i=new n3;#L=null;get ctx(){return this.#L}create(e,t){let n=e.create(this.#i.sliceMap);return n.set(t),n}get(e){return this.#i.get(e).get()}remove(e){return this.#i.remove(e)}call(e,t){if(null==this.#L)throw nb();let n=this.get(e)(t),r=this.#L.get(ia);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#L)throw nb();let t=this.#L.get(ia);return e(t.state,t.dispatch,t)}},iO=n4(new iA,"commands"),iI=n4([ik],"commandsTimer"),iE=rr("CommandsReady"),i_=e=>{let t=new iA;return t.setCtx(e),e.inject(iO,t).inject(iI,[ik]).record(iE),async()=>(await e.waitTimers(iI),e.done(iE),()=>{e.remove(iO).remove(iI).clearTimer(iE)})};io(i_,{displayName:"Commands"});var iR=class{constructor(){this.setCtx=e=>{this.#L=e},this.add=e=>(this.#P.push(e),()=>{this.#P=this.#P.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){let r={key:e,onRun:()=>n};this.#P.push(r),t.push(()=>{this.#P=this.#P.filter(e=>e!==r)})}else this.#P.push(n),t.push(()=>{this.#P=this.#P.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=(r1.Backspace=rG(nu,r_,rP,rD),r1);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#P.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{let i=this.#L;if(null==i)throw nv();return rG(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#L=null;#P=[];get ctx(){return this.#L}},iL=n4(new iR,"keymap"),iP=n4([ik],"keymapTimer"),i$=rr("KeymapReady"),iD=e=>{let t=new iR;return t.setCtx(e),e.inject(iL,t).inject(iP,[ik]).record(i$),async()=>(await e.waitTimers(iP),e.done(i$),()=>{e.remove(iL).remove(iP).clearTimer(i$)})},ij=rr("ParserReady"),iF=()=>{throw nv()},iB=n4(iF,"parser"),iH=n4([],"parserTimer"),iz=e=>(e.inject(iB,iF).inject(iH,[ik]).record(ij),async()=>{await e.waitTimers(iH);let t=e.get(iv),n=e.get(ix);return e.set(iB,ie.create(n,t)),e.done(ij),()=>{e.remove(iB).remove(iH).clearTimer(ij)}});io(iz,{displayName:"Parser"});var iq=rr("SerializerReady"),iK=n4([],"serializerTimer"),iW=()=>{throw nv()},iU=n4(iW,"serializer"),iV=e=>(e.inject(iU,iW).inject(iK,[ik]).record(iq),async()=>{await e.waitTimers(iK);let t=e.get(iv),n=e.get(ix);return e.set(iU,ir.create(n,t)),e.done(iq),()=>{e.remove(iU).remove(iK).clearTimer(iq)}});io(iV,{displayName:"Serializer"});var iJ=n4("","defaultValue"),iG=n4(e=>e,"stateOptions"),iZ=n4([],"editorStateTimer"),iY=rr("EditorStateReady"),iX=new ns.hs("MILKDOWN_STATE_TRACKER"),iQ=e=>(e.inject(iJ,"").inject(is,{}).inject(iG,e=>e).inject(iZ,[ij,iq,iE,i$]).record(iY),async()=>{await e.waitTimers(iZ);let t=e.get(ix),n=e.get(iB),r=e.get(iu),i=e.get(iG),o=e.get(ih),l=function(e,t,n){var r;if("string"==typeof e)return t(e);if("html"===e.type)return rE.S4.fromSchema(n).parse(e.dom);if("json"===e.type)return rE.bP.fromJSON(n,e.value);throw r=e,new nm(nf.docTypeError,`Doc type error, unsupported type: ${JSON.stringify(r,ng)}`)}(e.get(iJ),n,t),a=e.get(iL),s=a.addBaseKeymap(),c=[...o,new ns.k_({key:iX,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(is,i)}}}),function({rules:e}){let t=new ns.k_({key:nq,isInputRules:!0,state:{init:()=>null,apply(e,t){let n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>nz(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&nz(n,r.pos,r.pos,"",e,t)}),!1),keydown:(e,t)=>!!(nj&&nR&&"Enter"===t.key)&&!e.composing&&!!e.someProp("handleKeyDown",n=>n(e,t))&&(t.preventDefault(),!0)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;let{$cursor:i}=n.state.selection;return!!i&&nz(n,i.pos,i.pos,"\n",e,t)}}});return t}({rules:r}),r9(a.build())];e.set(ih,c);let d=i({schema:t,doc:l,plugins:c}),u=ns.$t.create(d);return e.set(is,u),e.done(iY),()=>{s(),e.remove(iJ).remove(is).remove(iG).remove(iZ).clearTimer(iY)}});io(iQ,{displayName:"EditorState"});var i1=n4([],"pasteRule"),i0=n4([ik],"pasteRuleTimer"),i2=rr("PasteRuleReady"),i5=e=>(e.inject(i1,[]).inject(i0,[ik]).record(i2),async()=>(await e.waitTimers(i0),e.done(i2),()=>{e.remove(i1).remove(i0).clearTimer(i2)}));io(i5,{displayName:"PasteRule"});var i3=rr("EditorViewReady"),i9=n4([],"editorViewTimer"),i7=n4({},"editorViewOptions"),i4=n4(null,"root"),i8=n4(null,"rootDOM"),i6=n4({},"rootAttrs"),oe=new ns.hs("MILKDOWN_VIEW_CLEAR"),ot=e=>(e.inject(i4,document.body).inject(ia,{}).inject(i7,{}).inject(i8,null).inject(i6,{}).inject(i9,[iY,i2]).record(i3),async()=>{var t;await e.wait(ib);let n=e.get(i4)||document.body,r="string"==typeof n?document.querySelector(n):n;e.update(ih,t=>[new ns.k_({key:oe,view:t=>{let n,i=r?((n=document.createElement("div")).className="milkdown",r.appendChild(n),e.set(i8,n),Object.entries(e.get(i6)).forEach(([e,t])=>n.setAttribute(e,t)),n):void 0;if(i&&r){let e=t.dom;r.replaceChild(i,e),i.appendChild(e)}return{destroy:()=>{i?.parentNode&&i?.parentNode.replaceChild(t.dom,i),i?.remove()}}}}),...t]),await e.waitTimers(i9);let i=e.get(is),o=e.get(i7),l=new ii.Lz(r,{state:i,nodeViews:Object.fromEntries(e.get(im)),markViews:Object.fromEntries(e.get(ig)),transformPasted:(t,n,r)=>(e.get(i1).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...o});return(t=l.dom).classList.add("editor"),t.setAttribute("role","textbox"),e.set(ia,l),e.done(i3),()=>{l?.destroy(),e.remove(i4).remove(ia).remove(i7).remove(i8).remove(i6).remove(i9).clearTimer(i3)}});io(ot,{displayName:"EditorView"});var on=((C={}).Idle="Idle",C.OnCreate="OnCreate",C.Created="Created",C.OnDestroy="OnDestroy",C.Destroyed="Destroyed",C),or=class e{constructor(){this.enableInspector=(e=!0)=>(this.#$=e,this),this.onStatusChange=e=>(this.#D=e,this),this.config=e=>(this.#j.push(e),this),this.removeConfig=e=>(this.#j=this.#j.filter(t=>t!==e),this),this.use=e=>{let t=[e].flat();return t.flat().forEach(e=>{this.#F.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#g===on.Created&&this.#B(t,this.#F),this},this.remove=async e=>this.#g===on.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#H([e].flat(),!0),this),this.create=async()=>(this.#g===on.OnCreate||(this.#g===on.Created&&await this.destroy(),this.#z(on.OnCreate),this.#q(),this.#B([...this.#F.keys()],this.#F),await Promise.all([this.#K(this.#W),this.#K(this.#F)].flat()),this.#z(on.Created)),this),this.destroy=async(e=!1)=>this.#g===on.Destroyed||this.#g===on.OnDestroy?this:this.#g===on.OnCreate?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#j=[]),this.#z(on.OnDestroy),await this.#H([...this.#F.keys()],e),await this.#U(),this.#z(on.Destroyed),this),this.action=e=>e(this.#L),this.inspect=()=>this.#$?[...this.#W.values(),...this.#F.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#$=!1;#g=on.Idle;#j=[];#D=()=>void 0;#i=new n3;#o=new re;#F=new Map;#W=new Map;#L=new n6(this.#i,this.#o);#q=()=>{var e,t;let n,r,i=(e=async e=>{await Promise.all(this.#j.map(t=>Promise.resolve(t(e))))},io(n=t=>(t.record(iw),async()=>(await e(t),t.done(iw),()=>{t.clearTimer(iw)})),{displayName:"Config"}),n),o=[iN,iz,iV,i_,iD,i5,iQ,ot,(t=this,io(r=e=>(e.inject(id,t).inject(ih,[]).inject(ip,[]).inject(iu,[]).inject(im,[]).inject(ig,[]).inject(iy,{handlers:il,encode:[]}).inject(iv,(0,rI.l)().use(ri.A).use(rO)).inject(ic,[iw]).record(ib),async()=>{await e.waitTimers(ic);let t=e.get(iy);return e.set(iv,(0,rI.l)().use(ri.A).use(rO,t)),e.done(ib),()=>{e.remove(id).remove(ih).remove(ip).remove(iu).remove(im).remove(ig).remove(iy).remove(iv).remove(ic).clearTimer(ib)}}),{displayName:"Init"}),r),i];this.#B(o,this.#W)};#B=(e,t)=>{e.forEach(e=>{let n=this.#L.produce(this.#$?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})};#H=(e,t=!1)=>Promise.all([e].flat().map(async e=>{let n=this.#F.get(e)?.cleanup;return(t?this.#F.delete(e):this.#F.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof n)?n():n}));#U=async()=>{await Promise.all([...this.#W.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#W.clear()};#z=e=>{this.#g=e,this.#D(e)};#K=e=>[...e.entries()].map(async([t,n])=>{let{ctx:r,handler:i}=n;if(!i)return;let o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})});get ctx(){return this.#L}get status(){return this.#g}};let oi=e=>crypto.getRandomValues(new Uint8Array(e)),oo=(e,t=21)=>((e,t,n)=>{let r=256-256%e.length;if(256===r){let r=e.length-1;return (i=t)=>{if(!i)return"";let o="";for(;;){let t=n(i),l=i;for(;l--;)if((o+=e[t[l]&r]).length>=i)return o}}}let i=Math.ceil(409.6*t/r);return (o=t)=>{if(!o)return"";let l="";for(;;){let t=n(i),a=i;for(;a--;)if(t[a]<r&&(l+=e[t[a]%e.length]).length>=o)return l}}})(e,0|t,oi);function ol(e,t){let n=function(e="cmdKey"){return n4(()=>()=>!1,e)}(e),r=i=>async()=>{r.key=n,await i.wait(iE);let o=t(i);return i.get(iO).create(n,o),r.run=t=>i.get(iO).call(e,t),()=>{i.get(iO).remove(n)}};return r}function oa(e){let t=n=>async()=>{await n.wait(ik);let r=e(n);return n.update(iu,e=>[...e,r]),t.inputRule=r,()=>{n.update(iu,e=>e.filter(e=>e!==r))}};return t}function oc(e,t){let n=r=>async()=>{let i=t(r);return r.update(iS,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(iS,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{let n=t.get(ix).nodes[e];if(!n)throw nk(e);return n},n}function od(e){let t,n=n=>async()=>(await n.wait(ik),t=e(n),n.update(ih,e=>[...e,t]),()=>{n.update(ih,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function ou(e){let t=n=>async()=>{await n.wait(i$);let r=n.get(iL),i=e(n),o=r.addObjectKeymap(i);return t.keymap=i,()=>{o()}};return t}function oh(e,t){let n=r=>async()=>{await r.wait(ik);let i=t(r);return e.type(r)instanceof rE.Z6?r.update(im,t=>[...t,[e.id,i]]):r.update(ig,t=>[...t,[e.id,i]]),n.view=i,n.type=e,()=>{e.type(r)instanceof rE.Z6?r.update(im,t=>t.filter(t=>t[0]!==e.id)):r.update(ig,t=>t.filter(t=>t[0]!==e.id))}};return n}function op(e,t){let n=n4(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function of(e,t){let n=op(t,e),r=oc(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>of(e,n(t)),i}function om(e,t){var n;let r,i=op(t,e),o=(n=e=>e.get(i.key)(e),(r=t=>async()=>{let i=n(t);return t.update(iM,t=>[...t.filter(t=>t[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{t.update(iM,t=>t.filter(([t])=>t!==e))}}).type=t=>{let n=t.get(ix).marks[e];if(!n)throw new nm(nf.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`);return n},r),l=[i,o];return l.id=o.id,l.mark=o,l.type=e=>o.type(e),l.ctx=i,l.key=i.key,l.extendSchema=n=>om(e,n(t)),l}function og(e,t){let n=op(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=ou(e=>{let r=e.get(n.key);return Object.fromEntries(Object.entries(t).flatMap(([e,{command:t}])=>{let n=r[e],i=[n.shortcuts].flat(),o=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:o}])}))}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}oo("abcedfghicklmn",10);var ov=(e,t=()=>({}))=>op(t,`${e}Attr`),oy=(e,t=()=>({}))=>op(t,`${e}Attr`);function ow(e,t,n){let r=op(n??{},e),i=e=>async()=>{await e.wait(ib);let n={plugin:t(e),options:e.get(r.key)};return e.update(ip,e=>[...e,n]),()=>{e.update(ip,e=>e.filter(e=>e!==n))}},o=[r,i];return o.id=e,o.plugin=i,o.options=r,o}let ob=function(){return eI.Date.now()};var ok=/\s/;let oC=function(e){for(var t=e.length;t--&&ok.test(e.charAt(t)););return t};var ox=/^\s+/,oS=0/0,oM=/^[-+]0x[0-9a-f]+$/i,oT=/^0b[01]+$/i,oN=/^0o[0-7]+$/i,oA=parseInt;let oO=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||tx(t)&&"[object Symbol]"==eF(t))return oS;if(eB(e)){var t,n,r="function"==typeof e.valueOf?e.valueOf():e;e=eB(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=(n=e)?n.slice(0,oC(n)+1).replace(ox,""):n;var i=oT.test(e);return i||oN.test(e)?oA(e.slice(2),i?2:8):oM.test(e)?oS:+e};var oI=Math.max,oE=Math.min;let o_=function(e,t,n){var r,i,o,l,a,s,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function p(t){var n=r,o=i;return r=i=void 0,c=t,l=e.apply(o,n)}function f(e){var n=e-s,r=e-c;return void 0===s||n>=t||n<0||u&&r>=o}function m(){var e,n,r,i=ob();if(f(i))return g(i);a=setTimeout(m,(e=i-s,n=i-c,r=t-e,u?oE(r,o-n):r))}function g(e){return(a=void 0,h&&r)?p(e):(r=i=void 0,l)}function v(){var e,n=ob(),o=f(n);if(r=arguments,i=this,s=n,o){if(void 0===a)return c=e=s,a=setTimeout(m,t),d?p(e):l;if(u)return clearTimeout(a),a=setTimeout(m,t),p(s)}return void 0===a&&(a=setTimeout(m,t)),l}return t=oO(t)||0,eB(n)&&(d=!!n.leading,o=(u="maxWait"in n)?oI(oO(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=s=i=a=void 0},v.flush=function(){return void 0===a?l:g(ob())},v},oR=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw TypeError("Expected a function");return eB(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),o_(e,t,{leading:r,maxWait:t,trailing:i})};var oL=n(70878);function oP(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}var o$=op({filterNodes:e=>!n0(e=>"table"===e.type.name)(e)},"blockConfig");oP(o$,{displayName:"Ctx<blockConfig>"});var oD=nH.ie&&nH.ie_version<15||nH.ios&&nH.webkit_version<604,oj=class{constructor(){this.bind=(e,t)=>{this.#L=e,this.#V=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#J),e.addEventListener("mouseup",this.#G),e.addEventListener("dragstart",this.#Z),e.addEventListener("dragend",this.#Y)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#J),e.removeEventListener("mouseup",this.#G),e.removeEventListener("dragstart",this.#Z),e.removeEventListener("dragend",this.#Y)},this.unBind=()=>{this.#V=void 0},this.keydownCallback=e=>(this.#X(),this.#Q=!1,e.dom.dataset.dragging="false",!1),this.mousemoveCallback=(e,t)=>!e.composing&&!!e.editable&&(this.#ee(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#Q){let n=this.#et?.dom.parentElement;if(!n)return!1;let r=n.scrollHeight>n.clientHeight,i=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&20>Math.abs(t.y-i.y))return n.scrollTop=n.scrollTop>10?n.scrollTop-10:0,!1;let r=Math.round(e.dom.getBoundingClientRect().height);Math.round(n.scrollTop+i.height)<r&&20>Math.abs(t.y-(i.height+i.y))&&(n.scrollTop=n.scrollTop+10)}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#Q=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{let n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#en=null,this.#er(e))},this.dropCallback=e=>(this.#er(e),!1),this.dragendCallback=e=>{this.#er(e)}}#L;#ei=()=>{if(!this.#en)return null;let e=this.#en,t=this.#et;if(t&&ns.nh.isSelectable(e.node)){let n=ns.nh.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#eo=n,n}return null};#eo=null;#en=null;#el=void 0;#Q=!1;get #ea(){try{return this.#L?.get(o$.key).filterNodes}catch{return}}get #et(){return this.#L?.get(ia)}#V;#X=()=>{this.#V?.({type:"hide"}),this.#en=null};#es=e=>{this.#en=e,this.#V?.({type:"show",active:e})};#J=()=>{this.#el=this.#en?.el.getBoundingClientRect(),this.#ei()};#G=()=>{this.#Q?(this.#Q=!1,this.#eo=null):requestAnimationFrame(()=>{this.#el&&this.#et?.focus()})};#Z=e=>{this.#Q=!0;let t=this.#et;if(!t)return;t.dom.dataset.dragging="true";let n=this.#eo;if(e.dataTransfer&&n){let r=n.content();e.dataTransfer.effectAllowed="copyMove";let{dom:i,text:o}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(oD?"Text":"text/html",i.innerHTML),oD||e.dataTransfer.setData("text/plain",o);let l=this.#en?.el;l&&e.dataTransfer.setDragImage(l,0,0),t.dragging={slice:r,move:!0}}};#Y=()=>{this.#et&&this.#er(this.#et)};#ee=oR((e,t)=>{if(!e.editable)return;let n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element))return void this.#X();let i=this.#ea;if(!i)return;let o=function(e,t,n){if(!e.dom.parentElement)return null;try{let r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==r||r<0)return null;let i=e.state.doc.resolve(r),o=e.state.doc.nodeAt(r),l=e.nodeDOM(r),a=t=>{let r=i.depth>=1&&0===i.index(i.depth);if(!(t||r))return;let s=i.before(i.depth);o=e.state.doc.nodeAt(s),l=e.nodeDOM(s),i=e.state.doc.resolve(s),n(i,o)||a(!0)};if(a(!n(i,o)),!l||!o)return null;return{node:o,$pos:i,el:l}}catch{return null}}(e,{x:r,y:t.clientY},i);o?this.#es(o):this.#X()},200);#er=e=>{this.#Q=!1,e.dom.dataset.dragging="false"}},oF=op(()=>new oj,"blockService"),oB=op({},"blockServiceInstance");oP(oF,{displayName:"Ctx<blockService>"}),oP(oB,{displayName:"Ctx<blockServiceInstance>"});var oH=op({},"blockSpec");oP(oH,{displayName:"Ctx<blockSpec>"});var oz=od(e=>{let t=new ns.hs("MILKDOWN_BLOCK"),n=e.get(oF.key)();e.set(oB.key,n);let r=e.get(oH.key);return new ns.k_({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});oP(oz,{displayName:"Prose<block>"});var oq=class{#ec;#L;#ed;#eu=null;#eh;#ep=!1;#ef;#em;#eg;#ev;#ey;get active(){return this.#eu}constructor(e){this.update=()=>{requestAnimationFrame(()=>{if(!this.#ep)try{this.#ew(),this.#ep=!0}catch{}})},this.destroy=()=>{this.#ed?.unBind(),this.#ed?.removeEvent(this.#ec),this.#ec.remove()},this.show=e=>{let t=e.el,n=this.#L.get(ia).dom,r={ctx:this.#L,active:e,editorDom:n,blockDom:this.#ec},i=[(0,oL.UU)()];if(this.#eg){let e=(0,oL.cY)(this.#eg(r));i.push(e)}(0,oL.rD)({contextElement:t,getBoundingClientRect:()=>this.#ev?this.#ev(r):t.getBoundingClientRect()},this.#ec,{placement:this.#ey?this.#ey(r):"left",middleware:[...i,...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.#ec.style,{left:`${e}px`,top:`${t}px`}),this.#ec.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#ec.dataset.show="false"},this.#L=e.ctx,this.#ec=e.content,this.#eg=e.getOffset,this.#ev=e.getPosition,this.#ey=e.getPlacement,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.hide()}#ew(){let e=this.#L.get(ia);(this.#eh??e.dom.parentElement??document.body).appendChild(this.#ec);let t=this.#L.get(oB.key);t.bind(this.#L,e=>{"hide"===e.type?(this.hide(),this.#eu=null):"show"===e.type&&(this.show(e.active),this.#eu=e.active)}),this.#ed=t,this.#ed.addEvent(this.#ec),this.#ec.draggable=!0}},oK=[oH,o$,oF,oB,oz];oK.key=oH.key,oK.pluginKey=oz.key;var oW=n(17631),oU=n(38547);function oV(e){return String(e||"").toUpperCase()}function oJ(){return function(e){let t=function(e){let t=new Map;if(!e||!e.type)throw Error("mdast-util-definitions expected node");return(0,oU.YR)(e,"definition",function(e){let n=oV(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){let n=oV(e);return t.get(n)}}(e);(0,oU.YR)(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[oW._Z,n];if("imageReference"===e.type||"linkReference"===e.type){let i=t(e.identifier);if(i&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children},[oW._Z,n]}})}}function oG(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak"))return void e.next(t.content);let n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(rE.FK.fromArray(n))}function oZ(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var oY=oy("emphasis");oZ(oY,{displayName:"Attr<emphasis>",group:"Emphasis"});var oX=om("emphasis",e=>({attrs:{marker:{default:e.get(iy).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(oY.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));oZ(oX.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),oZ(oX.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var oQ=ol("ToggleEmphasis",e=>()=>rJ(oX.type(e)));oZ(oQ,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var o1=oa(e=>nK(/(?:^|[^*])\*([^*]+)\*$/,oX.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));oZ(o1,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var o0=oa(e=>nK(/\b_(?![_\s])(.*?[^_\s])_\b/,oX.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));oZ(o0,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var o2=og("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{let t=e.get(iO);return()=>t.call(oQ.key)}}});oZ(o2.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),oZ(o2.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var o5=oy("strong");oZ(o5,{displayName:"Attr<strong>",group:"Strong"});var o3=om("strong",e=>({attrs:{marker:{default:e.get(iy).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(o5.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));oZ(o3.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),oZ(o3.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var o9=ol("ToggleStrong",e=>()=>rJ(o3.type(e)));oZ(o9,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var o7=oa(e=>nK(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,o3.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));oZ(o7,{displayName:"InputRule<strong>",group:"Strong"});var o4=og("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{let t=e.get(iO);return()=>t.call(o9.key)}}});oZ(o4.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),oZ(o4.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var o8=oy("inlineCode");oZ(o8,{displayName:"Attr<inlineCode>",group:"InlineCode"});var o6=om("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(o8.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));oZ(o6.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),oZ(o6.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var le=ol("ToggleInlineCode",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(r.empty)return!1;let{from:o,to:l}=r;return t.doc.rangeHasMark(o,l,o6.type(e))?n?.(i.removeMark(o,l,o6.type(e))):(Object.keys(t.schema.marks).filter(e=>e!==o6.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(o,l,e)}),n?.(i.addMark(o,l,o6.type(e).create()))),!0});oZ(le,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var lt=oa(e=>nK(/(?:`)([^`]+)(?:`)$/,o6.type(e)));oZ(lt,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var ln=og("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{let t=e.get(iO);return()=>t.call(le.key)}}});oZ(ln.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),oZ(ln.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var lr=oy("link");oZ(lr,{displayName:"Attr<link>",group:"Link"});var li=om("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(lr.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{let r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));oZ(li.mark,{displayName:"MarkSchema<link>",group:"Link"});var lo=ol("ToggleLink",e=>(t={})=>rJ(li.type(e),t));oZ(lo,{displayName:"Command<toggleLinkCommand>",group:"Link"});var ll=ol("UpdateLink",e=>(t={})=>(n,r)=>{let i;if(!r)return!1;let o=-1,{selection:l}=n,{from:a,to:s}=l;if(n.doc.nodesBetween(a,a===s?s+1:s,(t,n)=>{if(li.type(e).isInSet(t.marks))return i=t,o=n,!1}),!i)return!1;let c=i.marks.find(({type:t})=>t===li.type(e));if(!c)return!1;let d=o,u=o+i.nodeSize,{tr:h}=n,p=li.type(e).create({...c.attrs,...t});return!!p&&(r(h.removeMark(d,u,c).addMark(d,u,p).setSelection(new ns.U3(h.selection.$anchor)).scrollIntoView()),!0)});oZ(ll,{displayName:"Command<updateLinkCommand>",group:"Link"});var la=oc("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function ls(e){return(0,oW.VG)(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;let n=t[t.length-1];if(!n)return;let r=n.children.indexOf(e);-1!==r&&n.children.splice(r,1)},!0)}oZ(la,{displayName:"NodeSchema<doc>",group:"Doc"});var lc=ow("remark-preserve-empty-line",()=>()=>ls);oZ(lc.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),oZ(lc.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var ld=ov("paragraph");oZ(ld,{displayName:"Attr<paragraph>",group:"Paragraph"});var lu=of("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(ld.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{let r=e.get(ia).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||0===n.content.size)&&n!==r&&function(e){let t=!1;try{e.get(lc.id),t=!0}catch{t=!1}return t}(e)?t.addNode("html",void 0,"<br />"):oG(t,n),t.closeNode()}}}));oZ(lu.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),oZ(lu.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var lh=ol("TurnIntoText",e=>()=>rV(lu.type(e)));oZ(lh,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var lp=og("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{let t=e.get(iO);return()=>t.call(lh.key)}}});oZ(lp.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),oZ(lp.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var lf=Array(6).fill(0).map((e,t)=>t+1),lm=op(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");oZ(lm,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var lg=ov("heading");oZ(lg,{displayName:"Attr<heading>",group:"Heading"});var lv=of("heading",e=>{let t=e.get(lm.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:lf.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw nw(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(lg.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{let r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),oG(e,t),e.closeNode()}}}});oZ(lv.node,{displayName:"NodeSchema<heading>",group:"Heading"}),oZ(lv.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var ly=oa(e=>np(/^(?<hashes>#+)\s$/,lv.type(e),t=>{let n=t.groups?.hashes?.length||0,{$from:r}=e.get(ia).state.selection,i=r.node();if("heading"===i.type.name){let e=Number(i.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));oZ(ly,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var lw=ol("WrapInHeading",e=>t=>(t??=1)<1?rV(lu.type(e)):rV(lv.type(e),{level:t}));oZ(lw,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var lb=ol("DowngradeHeading",e=>()=>(t,n,r)=>{let{$from:i}=t.selection,o=i.node();if(o.type!==lv.type(e)||!t.selection.empty||0!==i.parentOffset)return!1;let l=o.attrs.level-1;return l?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:l})),!0):rV(lu.type(e))(t,n,r)});oZ(lb,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var lk=og("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{let t=e.get(iO);return()=>t.call(lw.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{let t=e.get(iO);return()=>t.call(lb.key)}}});oZ(lk.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),oZ(lk.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var lC=ov("blockquote");oZ(lC,{displayName:"Attr<blockquote>",group:"Blockquote"});var lx=of("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(lC.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));oZ(lx.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),oZ(lx.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var lS=oa(e=>nh(/^\s*>\s$/,lx.type(e)));oZ(lS,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var lM=ol("WrapInBlockquote",e=>()=>rU(lx.type(e)));oZ(lM,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var lT=og("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{let t=e.get(iO);return()=>t.call(lM.key)}}});oZ(lT.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),oZ(lT.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var lN=ov("codeBlock",()=>({pre:{},code:{}}));oZ(lN,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var lA=of("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{language:e.dataset.language}}}],toDOM:t=>{let n=e.get(lN.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{let r=t.lang??"",i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));oZ(lA.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),oZ(lA.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var lO=oa(e=>np(/^```(?<language>[a-z]*)?[\s\n]$/,lA.type(e),e=>({language:e.groups?.language??""})));oZ(lO,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var lI=ol("CreateCodeBlock",e=>(t="")=>rV(lA.type(e),{language:t}));oZ(lI,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),oZ(ol("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0)),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var lE=og("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{let t=e.get(iO);return()=>t.call(lI.key)}}});oZ(lE.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),oZ(lE.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var l_=ov("image");oZ(l_,{displayName:"Attr<image>",group:"Image"});var lR=of("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(l_.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{let r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));oZ(lR.node,{displayName:"NodeSchema<image>",group:"Image"}),oZ(lR.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var lL=ol("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;let{src:i="",alt:o="",title:l=""}=t,a=lR.type(e).create({src:i,alt:o,title:l});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});oZ(lL,{displayName:"Command<insertImageCommand>",group:"Image"});var lP=ol("UpdateImage",e=>(t={})=>(n,r)=>{let i=function(e,t){if(!(e instanceof ns.nh))return;let{node:n,$from:r}=e;if(Array.isArray(t)&&t.includes(n.type)||n.type===t)return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}(n.selection,lR.type(e));if(!i)return!1;let{node:o,pos:l}=i,a={...o.attrs},{src:s,alt:c,title:d}=t;return void 0!==s&&(a.src=s),void 0!==c&&(a.alt=c),void 0!==d&&(a.title=d),r?.(n.tr.setNodeMarkup(l,void 0,a).scrollIntoView()),!0});oZ(lP,{displayName:"Command<updateImageCommand>",group:"Image"}),oZ(oa(e=>new nd(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{let[o,l,a="",s]=n;return o?t.tr.replaceWith(r,i,lR.type(e).create({src:a,alt:l,title:s})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});var l$=ov("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));oZ(l$,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var lD=of("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(l$.key)(t)," "]:["br",e.get(l$.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:!!t.data?.isInline})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));oZ(lD.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),oZ(lD.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var lj=ol("InsertHardbreak",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(!(r instanceof ns.U3))return!1;if(r.empty){let e=r.$from.node();if(e.childCount>0&&e.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(ns.LN.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(lD.type(e).create()).scrollIntoView()),!0});oZ(lj,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var lF=og("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{let t=e.get(iO);return()=>t.call(lj.key)}}});oZ(lF.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),oZ(lF.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var lB=ov("hr");oZ(lB,{displayName:"Attr<hr>",group:"Hr"});var lH=of("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(lB.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));oZ(lH.node,{displayName:"NodeSchema<hr>",group:"Hr"}),oZ(lH.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var lz=oa(e=>new nd(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{let{tr:o}=t;return n[0]&&o.replaceWith(r-1,i,lH.type(e).create()),o}));oZ(lz,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var lq=ol("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;let r=lu.node.type(e).create(),{tr:i,selection:o}=t,{from:l}=o,a=lH.type(e).create();if(!a)return!0;let s=i.replaceSelectionWith(a).insert(l,r),c=ns.LN.findFrom(s.doc.resolve(l),1,!0);return!c||(n(s.setSelection(c).scrollIntoView()),!0)});oZ(lq,{displayName:"Command<insertHrCommand>",group:"Hr"});var lK=ov("bulletList");oZ(lK,{displayName:"Attr<bulletList>",group:"BulletList"});var lW=of("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(lK.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));oZ(lW.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),oZ(lW.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var lU=oa(e=>nh(/^\s*([-+*])\s$/,lW.type(e)));oZ(lU,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var lV=ol("WrapInBulletList",e=>()=>rU(lW.type(e)));oZ(lV,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var lJ=og("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{let t=e.get(iO);return()=>t.call(lV.key)}}});oZ(lJ.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),oZ(lJ.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var lG=ov("orderedList");oZ(lG,{displayName:"Attr<orderedList>",group:"OrderedList"});var lZ=of("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(lG.key)(t),...1===t.attrs.order?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:t.attrs.order??1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));oZ(lZ.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),oZ(lZ.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var lY=oa(e=>nh(/^\s*(\d+)\.\s$/,lZ.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));oZ(lY,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var lX=ol("WrapInOrderedList",e=>()=>rU(lZ.type(e)));oZ(lX,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var lQ=og("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{let t=e.get(iO);return()=>t.call(lX.key)}}});oZ(lQ.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),oZ(lQ.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var l1=ov("listItem");oZ(l1,{displayName:"Attr<listItem>",group:"ListItem"});var l0=of("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(l1.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{let r=null!=t.label?`${t.label}.`:"•",i=null!=t.label?"ordered":"bullet",o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:i,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));oZ(l0.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),oZ(l0.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var l2=ol("SinkListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(0==l)return!1;let a=o.parent,s=a.child(l-1);if(s.type!=t)return!1;if(n){let r=s.lastChild&&s.lastChild.type==a.type,i=rE.FK.from(r?t.create():null),l=new rE.Ji(rE.FK.from(t.create(null,rE.FK.from(a.type.create(null,i)))),r?3:1,0),c=o.start,d=o.end;n(e.tr.step(new nc.Wg(c-(r?3:1),d,c,d,l,1,!0)).scrollIntoView())}return!0}});oZ(l2,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var l5=ol("LiftListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);return!!o&&(!n||(r.node(o.depth-1).type==t?function(e,t,n,r){let i=e.tr,o=r.end,l=r.$to.end(r.depth);o<l&&(i.step(new nc.Wg(o-1,l,o,l,new rE.Ji(rE.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new rE.u$(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));let a=(0,nc.jP)(r);if(null==a)return!1;i.lift(r,a);let s=i.doc.resolve(i.mapping.map(o,-1)-1);return(0,nc.n9)(i.doc,s.pos)&&s.nodeBefore.type==s.nodeAfter.type&&i.join(s.pos),t(i.scrollIntoView()),!0}(e,n,t,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),l=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,s=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!a,d+1,l.content.append(s?rE.FK.empty:rE.FK.from(i))))return!1;let u=o.pos,h=u+l.nodeSize;return r.step(new nc.Wg(u-!!a,h+ +!!s,u+1,h-1,new rE.Ji((a?rE.FK.empty:rE.FK.from(i.copy(rE.FK.empty))).append(s?rE.FK.empty:rE.FK.from(i.copy(rE.FK.empty))),+!a,+!s),+!a)),t(r.scrollIntoView()),!0}(e,n,o)))}});oZ(l5,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var l3=ol("SplitListItem",e=>()=>{var t;return t=l0.type(e),function(e,n){let{$from:r,$to:i,node:o}=e.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(i))return!1;let l=r.node(-1);if(l.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let i=rE.FK.empty,o=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-o;e>=r.depth-3;e--)i=rE.FK.from(r.node(e).copy(i));let l=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;i=i.append(rE.FK.from(t.createAndFill()));let a=r.before(r.depth-(o-1)),s=e.tr.replace(a,r.after(-l),new rE.Ji(i,4-o,0)),c=-1;s.doc.nodesBetween(a,s.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&s.setSelection(ns.LN.near(s.doc.resolve(c))),n(s.scrollIntoView())}return!0}let a=i.pos==r.end()?l.contentMatchAt(0).defaultType:null,s=e.tr.delete(r.pos,i.pos),c=a?[null,{type:a}]:void 0;return!!(0,nc.zy)(s.doc,r.pos,2,c)&&(n&&n(s.split(r.pos,2,c).scrollIntoView()),!0)}});oZ(l3,{displayName:"Command<splitListItemCommand>",group:"ListItem"});var l9=ol("LiftFirstListItem",e=>()=>(t,n,r)=>{let{selection:i}=t;if(!(i instanceof ns.U3))return!1;let{empty:o,$from:l}=i;return!!o&&0===l.parentOffset&&l.node(-1).type===l0.type(e)&&rL(t,n,r)});oZ(l9,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var l7=og("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{let t=e.get(iO);return()=>t.call(l3.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{let t=e.get(iO);return()=>t.call(l2.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{let t=e.get(iO);return()=>t.call(l5.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{let t=e.get(iO);return()=>t.call(l9.key)}}});oZ(l7.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),oZ(l7.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var l4=oc("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));oZ(l4,{displayName:"NodeSchema<text>",group:"Text"});var l8=ov("html");oZ(l8,{displayName:"Attr<html>",group:"Html"});var l6=of("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{let n=document.createElement("span"),r={...e.get(l8.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>"html"===e,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));oZ(l6.node,{displayName:"NodeSchema<html>",group:"Html"}),oZ(l6.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var ae=[la,ld,lu,lm,lg,lv,l$,lD,lC,lx,lN,lA,lB,lH,l_,lR,lK,lW,lG,lZ,l1,l0,oY,oX,o5,o3,o8,o6,lr,li,l8,l6,l4].flat(),at=[lS,lU,lY,lO,lz,ly].flat(),an=[o1,o0,lt,o7],ar=ol("IsMarkSelected",()=>e=>t=>{if(!e)return!1;let{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),ai=ol("IsNoteSelected",()=>e=>t=>!!e&&n5(t,e).hasNode),ao=ol("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr,{$from:r,$to:i}=n.selection,{pos:o}=r,{pos:l}=i,a=o-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,l),t?.(n),!0)}),al=ol("SetBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr,{from:l,to:a}=o.selection;try{o.setBlockType(l,a,r,i)}catch{return!1}return n?.(o),!0}),aa=ol("WrapInBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let{$from:e,$to:t}=o.selection,n=e.blockRange(t),l=n&&(0,nc.oM)(n,r,i);if(!l)return!1;o=o.wrap(n,l)}catch{return!1}return n?.(o),!0}),as=ol("AddBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let e=r instanceof rE.bP?r:r.createAndFill(i);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return n?.(o),!0}),ac=ol("SelectTextNearPos",()=>e=>(t,n)=>{let{pos:r}=e??{};if(null==r)return!1;let i=t.tr;try{let e,n=t.doc.resolve((e=t.doc.content.size,Math.min(Math.max(r,0),e)));i.setSelection(ns.U3.near(n))}catch{return!1}return n?.(i.scrollIntoView()),!0}),ad=[lh,lM,lw,lb,lI,lj,lq,lL,lP,lX,lV,l2,l3,l5,l9,oQ,le,o9,lo,ll,ar,ai,ao,al,aa,as,ac],au=[lT,lE,lF,lk,l7,lQ,lJ,lp,o2,ln,o4].flat(),ah=ow("remarkAddOrderInList",()=>()=>e=>{(0,oU.YR)(e,"list",e=>{if(e.ordered){let t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});oZ(ah.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),oZ(ah.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var ap=ow("remarkLineBreak",()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;(0,oU.YR)(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;let i=[],o=0;t.lastIndex=0;let l=t.exec(e.value);for(;l;){let n=l.index;o!==n&&i.push({type:"text",value:e.value.slice(o,n)}),i.push({type:"break",data:{isInline:!0}}),o=n+l[0].length,l=t.exec(e.value)}if(i.length>0&&r&&"number"==typeof n)return o<e.value.length&&i.push({type:"text",value:e.value.slice(o)}),r.children.splice(n,1,...i),n+i.length})});oZ(ap.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),oZ(ap.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var af=ow("remarkInlineLink",()=>oJ);oZ(af.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),oZ(af.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var am=["root","blockquote","listItem"],ag=ow("remarkHTMLTransformer",()=>()=>e=>{(function e(t,n,r){if(t.children){let n=[];for(let r=0,i=t.children.length;r<i;r++){let i=t.children[r];if(i){let o=e(i,r,t);if(o)for(let e=0,t=o.length;e<t;e++){let t=o[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>("html"!==e.type||n&&am.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]))(t,n,r)})(e,0,null)[0]});oZ(ag.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),oZ(ag.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var av=ow("remarkMarker",()=>()=>(e,t)=>{(0,oU.YR)(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=t.value.charAt(e.position.start.offset)})});oZ(av.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),oZ(av.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var ay=od(()=>{let e=!1,t=new ns.k_({key:new ns.hs("MILKDOWN_INLINE_NODES_CURSOR"),state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;let t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!!n&&!!r&&!!n.isInline&&!n.isText&&!!r.isInline&&!r.isText}},props:{handleDOMEvents:{compositionend:(n,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){let e=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,r)=>{if(t.getState(n.state)&&r instanceof InputEvent&&r.data&&!e){let e=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(t.getState(e)){let t=e.selection.$from.pos,n=document.createElement("span"),r=ii.NZ.widget(t,n,{side:-1}),i=document.createElement("span"),o=ii.NZ.widget(t,i);return setTimeout(()=>{n.contentEditable="true",i.contentEditable="true"}),ii.zF.create(e.doc,[r,o])}return ii.zF.empty}}});return t});oZ(ay,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var aw=od(e=>new ns.k_({key:new ns.hs("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;let[i]=t;if(!i)return;let[o]=i.steps;if(i.getMeta("hardbreak")){if(!(o instanceof nc.Ln))return;let{from:t}=o;return r.tr.setNodeMarkup(t,lD.type(e),void 0,[])}if(o instanceof nc.XE){let t=r.tr,{from:n,to:i}=o;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===lD.type(e)&&(t=t.setNodeMarkup(r,lD.type(e),void 0,[]))}),t}}}));oZ(aw,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var ab=op(["table","code_block"],"hardbreakFilterNodes");oZ(ab,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var ak=od(e=>{let t=e.get(ab.key);return new ns.k_({key:new ns.hs("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{let r=e.getMeta("hardbreak"),[i]=e.steps;if(r&&i){let{from:e}=i,r=n.doc.resolve(e),o=r.depth,l=!0;for(;o>0;)t.includes(r.node(o).type.name)&&(l=!1),o--;return l}return!0}})});oZ(ak,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var aC=od(e=>{let t=new ns.hs("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;let r=e.get(lm.key),i=n.state.tr.setMeta("addToHistory",!1),o=!1,l={};n.state.doc.descendants((n,a)=>{if(n.type===lv.type(e)){if(0===n.textContent.trim().length)return;let e=n.attrs,s=r(n);l[s]?(l[s]+=1,s+=`-#${l[s]}`):l[s]=1,e.id!==s&&(o=!0,i.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:s}))}}),o&&n.dispatch(i)};return new ns.k_({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});oZ(aC,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var ax=od(e=>new ns.k_({key:new ns.hs("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;let i=lZ.type(e),o=lW.type(e),l=l0.type(e),a=(e,t,n=1)=>{let r=!1,i=`${t+n}.`;return e.label!==i&&(e.label=i,r=!0),r},s=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===o){let n=e.maybeChild(0);n?.type===l&&"ordered"===n.attrs.listType&&(c=!0,s.setNodeMarkup(t,i,{spread:"true"}),e.descendants((e,t,n,r)=>{if(e.type===l){let n={...e.attrs};a(n,r)&&(s=s.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===l&&n?.type===i){let i={...e.attrs},o=!1;"ordered"!==i.listType&&(i.listType="ordered",o=!0),n?.maybeChild(0)&&(o=a(i,r,n?.attrs.order??1)),o&&(s=s.setNodeMarkup(t,void 0,i),c=!0)}}),c?s.setMeta("addToHistory",!1):null}}));oZ(ax,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var aS=[ae,at,an,ad,au,[aw,ab,ak,ay,ah,af,ap,ag,av,lc,aC,ax].flat()].flat(),aM=n(36454),aT=n(32550),aN=n(42159);let aA="u">typeof window&&window.trustedTypes;if(aA)try{l=aA.createPolicy("vue",{createHTML:e=>e})}catch(e){}let aO=l?e=>l.createHTML(e):e=>e,aI="u">typeof document?document:null,aE=aI&&aI.createElement("template"),a_=Symbol("_vtc");aM.QP;let aR=Symbol("_vod"),aL=Symbol("_vsh"),aP=Symbol(""),a$=/(?:^|;)\s*display\s*:/,aD=/\s*!important$/;function aj(e,t,n){if((0,aN.cy)(n))n.forEach(n=>aj(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{let r=function(e,t){let n=aB[t];if(n)return n;let r=(0,aN.PT)(t);if("filter"!==r&&r in e)return aB[t]=r;r=(0,aN.ZH)(r);for(let n=0;n<aF.length;n++){let i=aF[n]+r;if(i in e)return aB[t]=i}return t}(e,t);aD.test(n)?e.setProperty((0,aN.Tg)(r),n.replace(aD,""),"important"):e[r]=n}}let aF=["Webkit","Moz","ms"],aB={},aH="http://www.w3.org/1999/xlink";function az(e,t,n,r,i,o=(0,aN.J$)(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(aH,t.slice(6,t.length)):e.setAttributeNS(aH,t,n):null==n||o&&!(0,aN.Y2)(n)?e.removeAttribute(t):e.setAttribute(t,o?"":(0,aN.Bm)(n)?String(n):n)}function aq(e,t,n,r,i){if("innerHTML"===t||"textContent"===t){null!=n&&(e[t]="innerHTML"===t?aO(n):n);return}let o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){let r="OPTION"===o?e.getAttribute("value")||"":e.value,i=null==n?"checkbox"===e.type?"on":"":String(n);r===i&&"_value"in e||(e.value=i),null==n&&e.removeAttribute(t),e._value=n;return}let l=!1;if(""===n||null==n){let r=typeof e[t];"boolean"===r?n=(0,aN.Y2)(n):null==n&&"string"===r?(n="",l=!0):"number"===r&&(n=0,l=!0)}try{e[t]=n}catch(e){}l&&e.removeAttribute(i||t)}let aK=Symbol("_vei"),aW=/(?:Once|Passive|Capture)$/,aU=0,aV=Promise.resolve(),aJ=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&123>e.charCodeAt(2);"u">typeof HTMLElement&&HTMLElement;let aG=(0,aN.X$)({patchProp:(e,t,n,r,i,o)=>{let l="svg"===i;if("class"===t){var a;let t;a=r,(t=e[a_])&&(a=(a?[a,...t]:[...t]).join(" ")),null==a?e.removeAttribute("class"):l?e.setAttribute("class",a):e.className=a}else"style"===t?function(e,t,n){let r=e.style,i=(0,aN.Kg)(n),o=!1;if(n&&!i){if(t)if((0,aN.Kg)(t))for(let e of t.split(";")){let t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&aj(r,t,"")}else for(let e in t)null==n[e]&&aj(r,e,"");for(let i in n){var l,a,s,c;"display"===i&&(o=!0);let d=n[i];null!=d?(l=e,a=i,s=!(0,aN.Kg)(t)&&t?t[i]:void 0,c=d,"TEXTAREA"===l.tagName&&("width"===a||"height"===a)&&(0,aN.Kg)(c)&&s===c||aj(r,i,d)):aj(r,i,"")}}else if(i){if(t!==n){let e=r[aP];e&&(n+=";"+e),r.cssText=n,o=a$.test(n)}}else t&&e.removeAttribute("style");aR in e&&(e[aR]=o?r.display:"",e[aL]&&(r.display="none"))}(e,n,r):(0,aN.Mp)(t)?(0,aN.CP)(t)||function(e,t,n,r,i=null){let o=e[aK]||(e[aK]={}),l=o[t];if(r&&l)l.value=r;else{let[n,c]=function(e){let t;if(aW.test(e)){let n;for(t={};n=e.match(aW);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):(0,aN.Tg)(e.slice(2)),t]}(t);if(r){var a,s;let l,d=o[t]=(a=r,s=i,(l=e=>{if(e._vts){if(e._vts<=l.attached)return}else e._vts=Date.now();(0,aM.qL)(function(e,t){if(!(0,aN.cy)(t))return t;{let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}}(e,l.value),s,5,[e])}).value=a,l.attached=aU||(aV.then(()=>aU=0),aU=Date.now()),l);e.addEventListener(n,d,c)}else l&&(e.removeEventListener(n,l,c),o[t]=void 0)}}(e,t,0,r,o):("."===t[0]?(t=t.slice(1),0):"^"===t[0]?(t=t.slice(1),1):!function(e,t,n,r){if(r)return!!("innerHTML"===t||"textContent"===t||t in e&&aJ(t)&&(0,aN.Tn)(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t||"sandbox"===t&&"IFRAME"===e.tagName||"form"===t||"list"===t&&"INPUT"===e.tagName||"type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){let t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return!(aJ(t)&&(0,aN.Kg)(n))&&t in e}(e,t,r,l))?e._isVueCE&&(function(e,t){let n=e._def.props;if(!n)return!1;let r=(0,aN.PT)(t);return Array.isArray(n)?n.some(e=>(0,aN.PT)(e)===r):Object.keys(n).some(e=>(0,aN.PT)(e)===r)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!(0,aN.Kg)(r)))?aq(e,(0,aN.PT)(t),r,o,t):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),az(e,t,r,l)):(aq(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||az(e,t,r,l,o,"value"!==t))}},{insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i="svg"===t?aI.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?aI.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?aI.createElement(e,{is:n}):aI.createElement(e);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:e=>aI.createTextNode(e),createComment:e=>aI.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>aI.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,i,o){let l=n?n.previousSibling:t.lastChild;if(i&&(i===o||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==o&&(i=i.nextSibling););else{aE.innerHTML=aO("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);let i=aE.content;if("svg"===r||"mathml"===r){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[l?l.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}}),aZ=(...e)=>{let t=(r||(r=(0,aM.K9)(aG))).createApp(...e),{mount:n}=t;return t.mount=e=>{var r,i;let o=(r=e,(0,aN.Kg)(r)?document.querySelector(r):r);if(!o)return;let l=t._component;(0,aN.Tn)(l)||l.render||l.template||(l.template=o.innerHTML),1===o.nodeType&&(o.textContent="");let a=n(o,!1,(i=o)instanceof SVGElement?"svg":"function"==typeof MathMLElement&&i instanceof MathMLElement?"mathml":void 0);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),a},t};var aY=class{#ep=!1;#ef;#em;#eh;#eb;#ek;#eC;#ex;#eS;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#ex(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{let{selection:n}=e.state,{empty:r,$from:i}=n,o=e.state.selection instanceof ns.U3;if("u"<typeof document)return;let l=this.element.contains(document.activeElement),a=!e.hasFocus()&&!l,s=!e.editable,c=!(e=>n2(t)(e.$from))(e.state.selection);if(!a&&!s&&r&&o&&!c)return i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,"")},this.destroy=()=>{this.#ex.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#eb=e.debounce??200,this.#eC=e.shouldShow??this.#eM,this.#ek=e.trigger??"/",this.#eS=e.offset,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.#ex=o_(this.#eT,this.#eb)}#eT=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:l}=i,a=Math.min(...l.map(e=>e.$from.pos)),s=Math.max(...l.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(this.#ep||((this.#eh??e.dom.parentElement??document.body).appendChild(this.element),this.#ep=!0),!r&&!c){if(!this.#eC(e,t))return void this.hide();(0,oL.rD)({getBoundingClientRect:()=>nQ(e,a,s)},this.element,{placement:"bottom-start",middleware:[(0,oL.UU)(),(0,oL.cY)(this.#eS),...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()}};#eM=e=>{let t=this.getContent(e);if(!t)return!1;let n=t.at(-1);return!!n&&(Array.isArray(this.#ek)?this.#ek.includes(n):this.#ek===n)}},aX=n(10325);let{entries:aQ,setPrototypeOf:a1,isFrozen:a0,getPrototypeOf:a2,getOwnPropertyDescriptor:a5}=Object,{freeze:a3,seal:a9,create:a7}=Object,{apply:a4,construct:a8}="u">typeof Reflect&&Reflect;a3||(a3=function(e){return e}),a9||(a9=function(e){return e}),a4||(a4=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),a8||(a8=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let a6=sw(Array.prototype.forEach),se=sw(Array.prototype.lastIndexOf),st=sw(Array.prototype.pop),sn=sw(Array.prototype.push),sr=sw(Array.prototype.splice),si=Array.isArray,so=sw(String.prototype.toLowerCase),sl=sw(String.prototype.toString),sa=sw(String.prototype.match),ss=sw(String.prototype.replace),sc=sw(String.prototype.indexOf),sd=sw(String.prototype.trim),su=sw(Number.prototype.toString),sh=sw(Boolean.prototype.toString),sp="u"<typeof BigInt?null:sw(BigInt.prototype.toString),sf="u"<typeof Symbol?null:sw(Symbol.prototype.toString),sm=sw(Object.prototype.hasOwnProperty),sg=sw(Object.prototype.toString),sv=sw(RegExp.prototype.test),sy=(p=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return a8(p,t)});function sw(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return a4(e,t,r)}}function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:so;if(a1&&a1(e,null),!si(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){let e=n(i);e!==i&&(a0(t)||(t[r]=e),i=e)}e[i]=!0}return e}function sk(e){let t=a7(null);for(let[n,r]of aQ(e))sm(e,n)&&(si(r)?t[n]=function(e){for(let t=0;t<e.length;t++)sm(e,t)||(e[t]=null);return e}(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=sk(r):t[n]=r);return t}function sC(e,t){for(;null!==e;){let n=a5(e,t);if(n){if(n.get)return sw(n.get);if("function"==typeof n.value)return sw(n.value)}e=a2(e)}return function(){return null}}let sx=a3(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sS=a3(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),sM=a3(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sT=a3(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sN=a3(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),sA=a3(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),sO=a3(["#text"]),sI=a3(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sE=a3(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),s_=a3(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),sR=a3(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sL=a9(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sP=a9(/<%[\w\W]*|[\w\W]*%>/gm),s$=a9(/\$\{[\w\W]*/gm),sD=a9(/^data-[\-\w.\u00B7-\uFFFF]+$/),sj=a9(/^aria-[\-\w]+$/),sF=a9(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sB=a9(/^(?:\w+script|data):/i),sH=a9(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sz=a9(/^html$/i);var sq=Object.freeze({__proto__:null,ARIA_ATTR:sj,ATTR_WHITESPACE:sH,CUSTOM_ELEMENT:a9(/^[a-z][.\w]*(-[.\w]+)+$/i),DATA_ATTR:sD,DOCTYPE_NAME:sz,ERB_EXPR:sP,IS_ALLOWED_URI:sF,IS_SCRIPT_OR_DATA:sB,MUSTACHE_EXPR:sL,TMPLIT_EXPR:s$});let sK=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},sW=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};var sU=function e(){let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"u"<typeof window?null:window,r=t=>e(t);if(r.version="3.4.1",r.removed=[],!n||!n.document||9!==n.document.nodeType||!n.Element)return r.isSupported=!1,r;let{document:i}=n,o=i,l=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:c,Element:d,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:m}=n,g=d.prototype,v=sC(g,"cloneNode"),y=sC(g,"remove"),w=sC(g,"nextSibling"),b=sC(g,"childNodes"),k=sC(g,"parentNode");if("function"==typeof s){let e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C="",{implementation:x,createNodeIterator:S,createDocumentFragment:M,getElementsByTagName:T}=i,{importNode:N}=o,A=sW();r.isSupported="function"==typeof aQ&&"function"==typeof k&&x&&void 0!==x.createHTMLDocument;let{MUSTACHE_EXPR:O,ERB_EXPR:I,TMPLIT_EXPR:E,DATA_ATTR:_,ARIA_ATTR:R,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:$}=sq,{IS_ALLOWED_URI:D}=sq,j=null,F=sb({},[...sx,...sS,...sM,...sN,...sO]),B=null,H=sb({},[...sI,...sE,...s_,...sR]),z=Object.seal(a7(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,K=null,W=Object.seal(a7(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),U=!0,V=!0,J=!1,G=!0,Z=!1,Y=!0,X=!1,Q=!1,ee=!1,et=!1,en=!1,er=!1,ei=!0,eo=!1,el="user-content-",ea=!0,es=!1,ec={},ed=null,eu=sb({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),eh=null,ep=sb({},["audio","video","img","source","image","track"]),ef=null,em=sb({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eg="http://www.w3.org/1998/Math/MathML",ev="http://www.w3.org/2000/svg",ey="http://www.w3.org/1999/xhtml",ew=ey,eb=!1,ek=null,eC=sb({},[eg,ev,ey],sl),ex=sb({},["mi","mo","mn","ms","mtext"]),eS=sb({},["annotation-xml"]),eM=sb({},["title","style","font","a","script"]),eT=null,eN=["application/xhtml+xml","text/html"],eA=null,eO=null,eI=i.createElement("form"),eE=function(e){return e instanceof RegExp||e instanceof Function},e_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(eO&&eO===e)return;e&&"object"==typeof e||(e={}),e=sk(e),eA="application/xhtml+xml"===(eT=-1===eN.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?sl:so,j=sm(e,"ALLOWED_TAGS")&&si(e.ALLOWED_TAGS)?sb({},e.ALLOWED_TAGS,eA):F,B=sm(e,"ALLOWED_ATTR")&&si(e.ALLOWED_ATTR)?sb({},e.ALLOWED_ATTR,eA):H,ek=sm(e,"ALLOWED_NAMESPACES")&&si(e.ALLOWED_NAMESPACES)?sb({},e.ALLOWED_NAMESPACES,sl):eC,ef=sm(e,"ADD_URI_SAFE_ATTR")&&si(e.ADD_URI_SAFE_ATTR)?sb(sk(em),e.ADD_URI_SAFE_ATTR,eA):em,eh=sm(e,"ADD_DATA_URI_TAGS")&&si(e.ADD_DATA_URI_TAGS)?sb(sk(ep),e.ADD_DATA_URI_TAGS,eA):ep,ed=sm(e,"FORBID_CONTENTS")&&si(e.FORBID_CONTENTS)?sb({},e.FORBID_CONTENTS,eA):eu,q=sm(e,"FORBID_TAGS")&&si(e.FORBID_TAGS)?sb({},e.FORBID_TAGS,eA):sk({}),K=sm(e,"FORBID_ATTR")&&si(e.FORBID_ATTR)?sb({},e.FORBID_ATTR,eA):sk({}),ec=!!sm(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?sk(e.USE_PROFILES):e.USE_PROFILES),U=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,Y=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,et=e.RETURN_DOM||!1,en=e.RETURN_DOM_FRAGMENT||!1,er=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,ei=!1!==e.SANITIZE_DOM,eo=e.SANITIZE_NAMED_PROPS||!1,ea=!1!==e.KEEP_CONTENT,es=e.IN_PLACE||!1,D=!function(e){try{return sv(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?sF:e.ALLOWED_URI_REGEXP,ew="string"==typeof e.NAMESPACE?e.NAMESPACE:ey,ex=sm(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?sk(e.MATHML_TEXT_INTEGRATION_POINTS):sb({},["mi","mo","mn","ms","mtext"]),eS=sm(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?sk(e.HTML_INTEGRATION_POINTS):sb({},["annotation-xml"]);let n=sm(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?sk(e.CUSTOM_ELEMENT_HANDLING):a7(null);if(z=a7(null),sm(n,"tagNameCheck")&&eE(n.tagNameCheck)&&(z.tagNameCheck=n.tagNameCheck),sm(n,"attributeNameCheck")&&eE(n.attributeNameCheck)&&(z.attributeNameCheck=n.attributeNameCheck),sm(n,"allowCustomizedBuiltInElements")&&"boolean"==typeof n.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=n.allowCustomizedBuiltInElements),Z&&(V=!1),en&&(et=!0),ec&&(j=sb({},sO),B=a7(null),!0===ec.html&&(sb(j,sx),sb(B,sI)),!0===ec.svg&&(sb(j,sS),sb(B,sE),sb(B,sR)),!0===ec.svgFilters&&(sb(j,sM),sb(B,sE),sb(B,sR)),!0===ec.mathMl&&(sb(j,sN),sb(B,s_),sb(B,sR))),W.tagCheck=null,W.attributeCheck=null,sm(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?W.tagCheck=e.ADD_TAGS:si(e.ADD_TAGS)&&(j===F&&(j=sk(j)),sb(j,e.ADD_TAGS,eA))),sm(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?W.attributeCheck=e.ADD_ATTR:si(e.ADD_ATTR)&&(B===H&&(B=sk(B)),sb(B,e.ADD_ATTR,eA))),sm(e,"ADD_URI_SAFE_ATTR")&&si(e.ADD_URI_SAFE_ATTR)&&sb(ef,e.ADD_URI_SAFE_ATTR,eA),sm(e,"FORBID_CONTENTS")&&si(e.FORBID_CONTENTS)&&(ed===eu&&(ed=sk(ed)),sb(ed,e.FORBID_CONTENTS,eA)),sm(e,"ADD_FORBID_CONTENTS")&&si(e.ADD_FORBID_CONTENTS)&&(ed===eu&&(ed=sk(ed)),sb(ed,e.ADD_FORBID_CONTENTS,eA)),ea&&(j["#text"]=!0),X&&sb(j,["html","head","body"]),j.table&&(sb(j,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw sy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw sy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=(t=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===t&&(t=sK(m,l)),null!==t&&"string"==typeof C&&(C=t.createHTML(""));a3&&a3(e),eO=e},eR=sb({},[...sS,...sM,...sT]),eL=sb({},[...sN,...sA]),eP=function(e){let t=k(e);t&&t.tagName||(t={namespaceURI:ew,tagName:"template"});let n=so(e.tagName),r=so(t.tagName);return!!ek[e.namespaceURI]&&(e.namespaceURI===ev?t.namespaceURI===ey?"svg"===n:t.namespaceURI===eg?"svg"===n&&("annotation-xml"===r||ex[r]):!!eR[n]:e.namespaceURI===eg?t.namespaceURI===ey?"math"===n:t.namespaceURI===ev?"math"===n&&eS[r]:!!eL[n]:e.namespaceURI===ey?(t.namespaceURI!==ev||!!eS[r])&&(t.namespaceURI!==eg||!!ex[r])&&!eL[n]&&(eM[n]||!eR[n]):"application/xhtml+xml"===eT&&!!ek[e.namespaceURI])},e$=function(e){sn(r.removed,{element:e});try{k(e).removeChild(e)}catch(t){y(e)}},eD=function(e,t){try{sn(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){sn(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(et||en)try{e$(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ej=function(e){let n=null,r=null;if(ee)e="<remove></remove>"+e;else{let t=sa(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===eT&&ew===ey&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let o=t?t.createHTML(e):e;if(ew===ey)try{n=new f().parseFromString(o,eT)}catch(e){}if(!n||!n.documentElement){n=x.createDocument(ew,"template",null);try{n.documentElement.innerHTML=eb?C:o}catch(e){}}let l=n.body||n.documentElement;return(e&&r&&l.insertBefore(i.createTextNode(r),l.childNodes[0]||null),ew===ey)?T.call(n,X?"html":"body")[0]:X?n.documentElement:l},eF=function(e){return S.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},eB=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},eH=function(e){return"function"==typeof c&&e instanceof c};function ez(e,t,n){a6(e,e=>{e.call(r,t,n,eO)})}let eq=function(e){let t=null;if(ez(A.beforeSanitizeElements,e,null),eB(e))return e$(e),!0;let n=eA(e.nodeName);if(ez(A.uponSanitizeElement,e,{tagName:n,allowedTags:j}),Y&&e.hasChildNodes()&&!eH(e.firstElementChild)&&sv(/<[/\w!]/g,e.innerHTML)&&sv(/<[/\w!]/g,e.textContent)||Y&&e.namespaceURI===ey&&"style"===n&&eH(e.firstElementChild)||7===e.nodeType||Y&&8===e.nodeType&&sv(/<[/\w]/g,e.data))return e$(e),!0;if(q[n]||!(W.tagCheck instanceof Function&&W.tagCheck(n))&&!j[n]){if(!q[n]&&eU(n)&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n)))return!1;if(ea&&!ed[n]){let t=k(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=v(n[i],!0);t.insertBefore(r,w(e))}}}return e$(e),!0}return e instanceof d&&!eP(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&sv(/<\/no(script|embed|frames)/i,e.innerHTML)?(e$(e),!0):(Z&&3===e.nodeType&&(t=e.textContent,a6([O,I,E],e=>{t=ss(t,e," ")}),e.textContent!==t&&(sn(r.removed,{element:e.cloneNode()}),e.textContent=t)),ez(A.afterSanitizeElements,e,null),!1)},eK=function(e,t,n){if(K[t]||ei&&("id"===t||"name"===t)&&(n in i||n in eI))return!1;if(V&&!K[t]&&sv(_,t));else if(U&&sv(R,t));else if(W.attributeCheck instanceof Function&&W.attributeCheck(t,e));else if(!B[t]||K[t]){if(!(eU(e)&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&sv(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t,e))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&sv(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n))))return!1}else if(ef[t]);else if(sv(D,ss(n,P,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===sc(n,"data:")&&eh[e]);else if(J&&!sv(L,ss(n,P,"")));else if(n)return!1;return!0},eW=sb({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),eU=function(e){return!eW[so(e)]&&sv($,e)},eV=function(e){ez(A.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||eB(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0},o=n.length;for(;o--;){let{name:l,namespaceURI:a,value:s}=n[o],c=eA(l),d="value"===l?s:sd(s);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,ez(A.uponSanitizeAttribute,e,i),d=i.attrValue,eo&&("id"===c||"name"===c)&&0!==sc(d,el)&&(eD(l,e),d=el+d),Y&&sv(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)||"attributename"===c&&sa(d,"href")){eD(l,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr||!G&&sv(/\/>/i,d)){eD(l,e);continue}Z&&a6([O,I,E],e=>{d=ss(d,e," ")});let u=eA(e.nodeName);if(!eK(u,c,d)){eD(l,e);continue}if(t&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(a);else switch(m.getAttributeType(u,c)){case"TrustedHTML":d=t.createHTML(d);break;case"TrustedScriptURL":d=t.createScriptURL(d)}if(d!==s)try{a?e.setAttributeNS(a,l,d):e.setAttribute(l,d),eB(e)?e$(e):st(r.removed)}catch(t){eD(l,e)}}ez(A.afterSanitizeAttributes,e,null)},eJ=function(e){let t=null,n=eF(e);for(ez(A.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)ez(A.uponSanitizeShadowNode,t,null),eq(t),eV(t),t.content instanceof a&&eJ(t.content);ez(A.afterSanitizeShadowDOM,e,null)};return r.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,l=null,s=null,d=null;if((eb=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!eH(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return su(e);case"boolean":return sh(e);case"bigint":return sp?sp(e):"0";case"symbol":return sf?sf(e):"Symbol()";case"undefined":default:return sg(e);case"function":case"object":{if(null===e)return sg(e);let t=sC(e,"toString");if("function"==typeof t){let n=t(e);return"string"==typeof n?n:sg(n)}return sg(e)}}}(e)))throw sy("dirty is not a string, aborting");if(!r.isSupported)return e;if(Q||e_(n),r.removed=[],"string"==typeof e&&(es=!1),es){let t=e.nodeName;if("string"==typeof t){let e=eA(t);if(!j[e]||q[e])throw sy("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)1===(l=(i=ej("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?i=l:i.appendChild(l);else{if(!et&&!Z&&!X&&-1===e.indexOf("<"))return t&&er?t.createHTML(e):e;if(!(i=ej(e)))return et?null:er?C:""}i&&ee&&e$(i.firstChild);let u=eF(es?e:i);for(;s=u.nextNode();)eq(s),eV(s),s.content instanceof a&&eJ(s.content);if(es)return e;if(et){if(Z){i.normalize();let e=i.innerHTML;a6([O,I,E],t=>{e=ss(e,t," ")}),i.innerHTML=e}if(en)for(d=M.call(i.ownerDocument);i.firstChild;)d.appendChild(i.firstChild);else d=i;return(B.shadowroot||B.shadowrootmode)&&(d=N.call(o,d,!0)),d}let h=X?i.outerHTML:i.innerHTML;return X&&j["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&sv(sz,i.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+h),Z&&a6([O,I,E],e=>{h=ss(h,e," ")}),t&&er?t.createHTML(h):h},r.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e_(e),Q=!0},r.clearConfig=function(){eO=null,Q=!1},r.isValidAttribute=function(e,t,n){return eO||e_({}),eK(eA(e),eA(t),n)},r.addHook=function(e,t){"function"==typeof t&&sn(A[e],t)},r.removeHook=function(e,t){if(void 0!==t){let n=se(A[e],t);return -1===n?void 0:sr(A[e],n,1)[0]}return st(A[e])},r.removeHooks=function(e){A[e]=[]},r.removeAllHooks=function(){A=sW()},r}();function sV({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}aM.h,sV.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var sJ=Object.defineProperty,sG=Object.getOwnPropertySymbols,sZ=Object.prototype.hasOwnProperty,sY=Object.prototype.propertyIsEnumerable,sX=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function sQ(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))sZ.call(t,n)&&sX(e,n,t[n]);if(sG)for(var n of sG(t))sY.call(t,n)&&sX(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let s1=op({imageIcon:"\uD83C\uDF0C",captionIcon:"\uD83D\uDCAC",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function s0(e){return(0,oU.YR)(e,"paragraph",(e,t,n)=>{var r,i;if((null==(r=e.children)?void 0:r.length)!==1)return;let o=null==(i=e.children)?void 0:i[0];if(!o||"image"!==o.type)return;let{url:l,alt:a,title:s}=o;n.children.splice(t,1,{type:"image-block",url:l,alt:a,title:s})})}sQ(s1,{displayName:"Config<image-block>",group:"ImageBlock"});let s2=ow("remark-image-block",()=>()=>s0);sQ(s2.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),sQ(s2.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var s5=Object.defineProperty,s3=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,s7=Object.prototype.propertyIsEnumerable,s4=(e,t,n)=>t in e?s5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;let s8="image-block",s6=of("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${s8}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw nw(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",((e,t)=>{for(var n in t||(t={}))s9.call(t,n)&&s4(e,n,t[n]);if(s3)for(var n of s3(t))s7.call(t,n)&&s4(e,n,t[n]);return e})({"data-type":s8},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{let r=t.url,i=t.title,o=Number(t.alt||1);(Number.isNaN(o)||0===o)&&(o=1),e.addNode(n,{src:r,caption:i,ratio:o})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));function ce({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}sQ(s6.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"}),aM.h,ce.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let ct=oo("abcdefg",8),cn=(0,aM.pM)({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:l,uploadPlaceholderText:a,className:s,onImageLoadError:c}){var d,u;let h=(0,aT.KR)(!1),p=(0,aT.KR)(),f=(0,aT.KR)(null!=(d=t.value)?d:""),m=(0,aT.KR)(ct()),g=(0,aT.KR)((null==(u=t.value)?void 0:u.length)!==0),v=e=>{let t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},w=e=>{var t;let i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>(0,aM.h)("div",{class:(0,aX.A)("image-edit",s)},(0,aM.h)(ce,{icon:i,class:"image-icon"}),(0,aM.h)("div",{class:(0,aX.A)("link-importer",h.value&&"focus")},(0,aM.h)("input",{ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!g.value&&(0,aM.h)("div",{class:"placeholder"},(0,aM.h)("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),(0,aM.h)("label",{class:"uploader",for:m.value},(0,aM.h)(ce,{icon:o})),(0,aM.h)("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&(0,aM.h)(Fragment,null,(0,aM.h)("div",{class:"image-preview"},(0,aM.h)("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),(0,aM.h)("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},(0,aM.h)(ce,{icon:l}))))}});aM.h,aM.FK;let cr=(0,aM.pM)({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:r,setAttr:i,config:o}){var l;let a=(0,aT.KR)(),s=(0,aT.KR)(),c=(0,aT.KR)(!!(null==(l=t.value)?void 0:l.length)),d=(0,aT.KR)(0),u=()=>{var e;let t=a.value;if(!t)return;let r=t.closest(".milkdown-image-block");if(!r)return;let i=r.getBoundingClientRect().width;if(!i)return;o.maxWidth&&o.maxWidth<i&&(i=o.maxWidth);let l=t.naturalHeight,s=t.naturalWidth,c=s<i?l:l/s*i;o.maxHeight&&c>o.maxHeight&&(c=o.maxHeight);let d=(c*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=c.toFixed(2),t.dataset.height=d,t.style.height=`${d}px`,o.maxWidth&&(t.style.maxWidth=`${o.maxWidth}px`)},h=e=>{e.preventDefault(),e.stopPropagation(),r.value||(c.value=!c.value)},p=e=>{let t=e.target.value;d.value&&window.clearTimeout(d.value),d.value=window.setTimeout(()=>{i("caption",t)},1e3)},f=e=>{let t=e.target.value;d.value&&(window.clearTimeout(d.value),d.value=0),i("caption",t)},m=e=>{e.preventDefault();let t=a.value;if(!t)return;let n=t.getBoundingClientRect().top,r=e.clientY-n;r<100&&(r=100),o.maxHeight&&r>o.maxHeight&&(r=o.maxHeight);let i=Number(r).toFixed(2);t.dataset.height=i,t.style.height=`${i}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);let e=a.value;if(!e)return;let t=Number(e.dataset.origin),n=Number.parseFloat(Number(Number(e.dataset.height)/t).toFixed(2));Number.isNaN(n)||i("ratio",n)},v=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"image-wrapper"},(0,aM.h)("div",{class:"operation"},(0,aM.h)("div",{class:"operation-item",onPointerdown:h},(0,aM.h)(ce,{icon:o.captionIcon}))),(0,aM.h)("img",{ref:a,"data-type":s8,onLoad:u,src:e.value,alt:t.value,onError:e=>{var t;return Promise.resolve(null==(t=o.onImageLoadError)?void 0:t.call(o,e)).catch(()=>{})}}),(0,aM.h)("div",{ref:s,class:"image-resize-handle",onPointerdown:v})),c.value&&(0,aM.h)("input",{draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==o?void 0:o.captionPlaceholderText,onInput:p,onBlur:f,value:t.value}))}});var ci=Object.defineProperty,co=Object.getOwnPropertySymbols,cl=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable,cs=(e,t,n)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;aM.h,aM.FK;let cc=(0,aM.pM)({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?(0,aM.h)(cr,((e,t)=>{for(var n in t||(t={}))cl.call(t,n)&&cs(e,n,t[n]);if(co)for(var n of co(t))ca.call(t,n)&&cs(e,n,t[n]);return e})({},e)):(0,aM.h)(cn,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,onImageLoadError:e.config.onImageLoadError})}}}),cd=oh(s6.node,e=>(t,n,r)=>{let i=(0,aT.KR)(t.attrs.src),o=(0,aT.KR)(t.attrs.caption),l=(0,aT.KR)(t.attrs.ratio),a=(0,aT.KR)(!1),s=(0,aT.KR)(!n.editable),c=e.get(s1.key),d=aZ(cc,{src:i,caption:o,ratio:l,selected:a,readonly:s,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?sU.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";let h=(0,aM.nT)(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){let t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;l.value=e.attrs.ratio,o.value=e.attrs.caption,s.value=!n.editable};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});sQ(cd,{displayName:"NodeView<image-block>",group:"ImageBlock"});let cu=[s2,s6,cd,s1].flat();if("u">typeof WeakMap){let e=new WeakMap;i=t=>e.get(t),o=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;i=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},o=(n,r)=>(10==t&&(t=0),e[t++]=n,e[t++]=r)}var ch=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,o=r+1,l=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;l<this.height&&this.map[t+this.width*e]==n;e++)l++;return{left:r,top:i,right:o,bottom:l}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:o,bottom:l}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:l==this.height)?null:this.map[r+this.width*(n<0?o-1:l)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:l,right:a,top:s,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,s),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let o=r*this.width+i,l=this.map[o];!n[l]&&(n[l]=!0,i==e.left&&i&&this.map[o-1]==l||r==e.top&&r&&this.map[o-this.width]==l||t.push(l))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return i(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),o=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[],i=0,o=null,l=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,s=0;a<n;a++){let c=e.child(a);s++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;let d=c.child(e),{colspan:u,rowspan:h,colwidth:p}=d.attrs;for(let e=0;e<h;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:s,n:h-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=s:(o||(o=[])).push({type:"collision",row:a,pos:s,n:u-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=l[r];null==i||i!=n&&1==l[r+1]?(l[r]=n,l[r+1]=1):i==n&&l[r+1]++}}}i+=u,s+=d.nodeSize}let d=(a+1)*t,u=0;for(;i<d;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),s++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new ch(t,n,r,o),s=!1;for(let e=0;!s&&e<l.length;e+=2)null!=l[e]&&l[e+1]<n&&(s=!0);return s&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let o=e.map[i];if(r[o])continue;r[o]=!0;let l=n.nodeAt(o);if(!l)throw RangeError(`No cell with offset ${o} found`);let a=null,s=l.attrs;for(let n=0;n<s.colspan;n++){let r=t[(i+n)%e.width*2];null==r||s.colwidth&&s.colwidth[n]==r||((a||(a=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(s)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,l,e),a}(e))}};function cp(e,t){if("string"==typeof e)return{};let n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,i=Number(e.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(let n in t){let r=t[n].getFromDOM,i=r&&r(e);null!=i&&(o[n]=i)}return o}function cf(e,t){let n={};for(let r in 1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(",")),t){let i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function cm(e){if(null!==e){if(!Array.isArray(e))throw TypeError("colwidth must be null or an array");for(let t of e)if("number"!=typeof t)throw TypeError("colwidth must be null or an array of numbers")}}function cg(e){let t=e.cached.tableNodeTypes;if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let cv=new ns.hs("selectingCells");function cy(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function cw(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function cb(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=cy(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function ck(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function cC(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function cx(e,t,n){let r=e.node(-1),i=ch.get(r),o=e.start(-1),l=i.nextCell(e.pos-o,t,n);return null==l?null:e.node(0).resolve(o+l)}function cS(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var cM=class e extends ns.LN{constructor(e,t=e){const n=e.node(-1),r=ch.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const s=a.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new ns.yn(l.resolve(r),l.resolve(r+t.content.size))});super(s[0].$from,s[0].$to,s),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ck(r)&&ck(i)&&cC(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return ns.U3.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=ch.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){let l=[];for(let o=n*t.width+r.left,a=r.left;a<r.right;a++,o++){let n=t.map[o];if(i[n])continue;i[n]=!0;let a=t.findCell(n),s=e.nodeAt(n);if(!s)throw RangeError(`No cell with offset ${n} found`);let c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=s.attrs;if(c>0&&(e=cS(e,0,c)),d>0&&(e=cS(e,e.colspan-d,d)),a.left<r.left){if(!(s=s.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else s=s.type.create(e,s.content)}if(a.top<r.top||a.bottom>r.bottom){let e={...s.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};s=a.top<r.top?s.type.createAndFill(e):s.type.create(e,s.content)}l.push(s)}o.push(e.child(n).copy(rE.FK.from(l)))}let l=this.isColSelection()&&this.isRowSelection()?e:o;return new rE.Ji(rE.FK.from(l),1,1)}replace(e,t=rE.Ji.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:l}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(l.pos),i?rE.Ji.empty:t)}let i=ns.LN.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new rE.Ji(rE.FK.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=ch.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=ch.get(r),o=t.start(-1),l=i.findCell(t.pos-o),a=i.findCell(n.pos-o),s=t.node(0);return l.top<=a.top?(l.top>0&&(t=s.resolve(o+i.map[l.left])),a.bottom<i.height&&(n=s.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=s.resolve(o+i.map[a.left])),l.bottom<i.height&&(t=s.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ch.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=ch.get(r),o=t.start(-1),l=i.findCell(t.pos-o),a=i.findCell(n.pos-o),s=t.node(0);return l.left<=a.left?(l.left>0&&(t=s.resolve(o+i.map[l.top*i.width])),a.right<i.width&&(n=s.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=s.resolve(o+i.map[a.top*i.width])),l.right<i.width&&(t=s.resolve(o+i.map[i.width*(l.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new cT(this.$anchorCell.pos,this.$headCell.pos)}};cM.prototype.visible=!1,ns.LN.jsonID("cell",cM);var cT=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&cC(t,n)?new cM(t,n):ns.LN.near(n,1)}};function cN(e){if(!(e.selection instanceof cM))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(ii.NZ.node(n,n+e.nodeSize,{class:"selectedCell"}))}),ii.zF.create(e.doc,t)}let cA=new ns.hs("fix-tables");function cO(e){let t=ch.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){let r=[];for(let n=0;n<i;n++){let l=o*i+n,a=t.map[l];if(o>0){let e=l-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=l-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function cI(e,t){let n=[],r=ch.get(e),i=r.height,o=r.width;for(let l=0;l<i;l++){let i=e.child(l),a=[];for(let n=0;n<o;n++){let i=t[l][n];if(!i)continue;let o=r.map[l*r.width+n],s=e.nodeAt(o);if(!s)continue;let c=s.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let s=i.type.createChecked(i.attrs,a,i.marks);n.push(s)}return e.type.createChecked(e.attrs,n,e.marks)}function cE(e,t,n,r){let i,o=t[0]>n[0]?-1:1,l=e.splice(t[0],t.length),a=+(l.length%2==0);return i=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-a+1:-1===o?n[0]:n[n.length-1]-a,e.splice(i,0,...l),e}function c_(e){var t=e;for(let e=t.depth;e>=0;e-=1){let n=t.node(e);if((e=>"table"===e.type.spec.tableRole)(n))return{node:n,pos:0===e?0:t.before(e),start:t.start(e),depth:e}}return null}function cR(e,t){let n=c_(t.$from);if(!n)return;let r=ch.get(n.node);if(!(e<0)&&!(e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function cL(e,t){let n=c_(t.$from);if(!n)return;let r=ch.get(n.node);if(!(e<0)&&!(e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function cP(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=cR(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=cR(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>o&&(o=t)})}let l=[];for(let t=i;t<=o;t++){let n=cR(t,e.selection);n&&n.length>0&&l.push(t)}i=l[0],o=l[l.length-1];let a=cR(i,e.selection),s=cL(0,e.selection);if(!a||!s)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=cR(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:l}}function c$(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=cL(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=cL(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>o&&(o=t)})}let l=[];for(let t=i;t<=o;t++){let n=cL(t,e.selection);n&&n.length>0&&l.push(t)}i=l[0],o=l[l.length-1];let a=cL(i,e.selection),s=cR(0,e.selection);if(!a||!s)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=cL(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:l}}function cD(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function cj(e){let t=e.selection,n=cb(e),r=n.node(-1),i=n.start(-1),o=ch.get(r);return{...t instanceof cM?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function cF(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=cg(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let l=0;l<t.height;l++){let a=l*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],s=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,function(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}(s.attrs,i-t.colCount(o))),l+=s.attrs.rowspan-1}else{let s=null==o?cg(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(l,i,r);e.insert(e.mapping.map(n+c),s.createAndFill())}}return e}function cB(e,t){if(!cw(e))return!1;if(t){let n=cj(e);t(cF(e.tr,n,n.left))}return!0}function cH(e,t){if(!cw(e))return!1;if(t){let n=cj(e);t(cF(e.tr,n,n.right))}return!0}function cz(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function cq(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!cw(t))return!1;if(n){let r=cg(t.schema),i=cj(t),o=t.tr,l=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=l.map(e=>i.table.nodeAt(e));for(let e=0;e<l.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+l[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<l.length;e++)o.setNodeMarkup(i.tableStart+l[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!cw(t))return!1;if(n){let r=cg(t.schema),i=cj(t),o=t.tr,l=cz("row",i,r),a=cz("column",i,r),s=+("column"===e?!!l:"row"===e&&!!a),c="column"==e?{left:0,top:s,right:1,bottom:i.map.height}:"row"==e?{left:s,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,d,n.attrs)}),n(o)}return!0}}function cK(e){return function(t,n){if(!cw(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(cb(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(ns.U3.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function cW(e,t){let n=e.selection;if(!(n instanceof cM))return!1;if(t){let r=e.tr,i=cg(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new rE.Ji(i,0,0))}),r.docChanged&&t(r)}return!0}function cU(e,t){let n=e.createAndFill();return new nc.dL(n).replace(0,n.content.size,t).doc}function cV(e,t,n,r,i,o,l,a){if(0==l||l==t.height)return!1;let s=!1;for(let c=i;c<o;c++){let i=l*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){s=!0;let i=n.nodeAt(o),{top:d,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:l-d}),e.insert(e.mapping.slice(a).map(t.positionAt(l,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-l})),c+=i.attrs.colspan-1}}return s}function cJ(e,t,n,r,i,o,l,a){if(0==l||l==t.width)return!1;let s=!1;for(let c=i;c<o;c++){let i=c*t.width+l,o=t.map[i];if(t.map[i-1]==o){s=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,cS(i.attrs,l-d,i.attrs.colspan-(l-d))),e.insert(u+i.nodeSize,i.type.createAndFill(cS(i.attrs,0,l-d))),c+=i.attrs.rowspan-1}}return s}function cG(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw Error("No table found");let l=ch.get(o),{top:a,left:s}=r,c=s+i.width,d=a+i.height,u=e.tr,h=0;function p(){if(!(o=n?u.doc.nodeAt(n-1):u.doc))throw Error("No table found");l=ch.get(o),h=u.mapping.maps.length}(function(e,t,n,r,i,o,l){let a,s,c=cg(e.doc.type.schema);if(i>t.width)for(let o=0,l=0;o<t.height;o++){let d,u=n.child(o);l+=u.nodeSize;let h=[];d=null==u.lastChild||u.lastChild.type==c.cell?a||(a=c.cell.createAndFill()):s||(s=c.header_cell.createAndFill());for(let e=t.width;e<i;e++)h.push(d);e.insert(e.mapping.slice(0).map(l-1+r),h)}if(o>t.height){let l=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==c.header_cell;l.push(i?s||(s=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}let d=c.row.create(null,rE.FK.from(l)),u=[];for(let e=t.height;e<o;e++)u.push(d);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),u)}return!!(a||s)})(u,l,o,n,c,d,0)&&p(),cV(u,l,o,n,s,c,a,h)&&p(),cV(u,l,o,n,s,c,d,h)&&p(),cJ(u,l,o,n,a,d,s,h)&&p(),cJ(u,l,o,n,a,d,c,h)&&p();for(let e=a;e<d;e++){let t=l.positionAt(e,s,o),r=l.positionAt(e,c,o);u.replace(u.mapping.slice(h).map(t+n),u.mapping.slice(h).map(r+n),new rE.Ji(i.rows[e-a],0,0))}p(),u.setSelection(new cM(u.doc.resolve(n+l.positionAt(a,s,o)),u.doc.resolve(n+l.positionAt(d-1,c-1,o)))),t(u)}cq("row",{useDeprecatedLogic:!0}),cq("column",{useDeprecatedLogic:!0}),cq("cell",{useDeprecatedLogic:!0});let cZ=r7({ArrowLeft:cX("horiz",-1),ArrowRight:cX("horiz",1),ArrowUp:cX("vert",-1),ArrowDown:cX("vert",1),"Shift-ArrowLeft":cQ("horiz",-1),"Shift-ArrowRight":cQ("horiz",1),"Shift-ArrowUp":cQ("vert",-1),"Shift-ArrowDown":cQ("vert",1),Backspace:cW,"Mod-Backspace":cW,Delete:cW,"Mod-Delete":cW});function cY(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function cX(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof cM)return cY(n,r,ns.LN.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let l=c5(i,e,t);if(null==l)return!1;if("horiz"==e)return cY(n,r,ns.LN.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(l),a=cx(o,e,t);return i=a?ns.LN.near(a,1):t<0?ns.LN.near(n.doc.resolve(o.before(-1)),-1):ns.LN.near(n.doc.resolve(o.after(-1)),1),cY(n,r,i)}}}function cQ(e,t){return(n,r,i)=>{let o;if(!i)return!1;let l=n.selection;if(l instanceof cM)o=l;else{let r=c5(i,e,t);if(null==r)return!1;o=new cM(n.doc.resolve(r))}let a=cx(o.$headCell,e,t);return!!a&&cY(n,r,new cM(o.$anchorCell,a))}}function c1(e,t){let n=cy(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new cM(n))),!0)}function c0(e,t,n){if(!cw(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),o=i.type.spec.tableRole,l=i.type.schema,a=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,o=e?0:Math.max(0,n-1),s=e<t.childCount-1?0:Math.max(0,r-1);(o||s)&&(i=cU(cg(l).row,new rE.Ji(i,o,s)).content),a.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;a.push(n||r?cU(cg(l).row,new rE.Ji(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(rE.FK.empty),n[i]<r){let o=cg(e).cell.createAndFill(),l=[];for(let e=n[i];e<r;e++)l.push(o);t[i]=t[i].append(rE.FK.from(l))}return{height:t.length,width:r,rows:t}}(l,a)}(n),i=e.state.selection;if(i instanceof cM){r||(r={width:1,height:1,rows:[rE.FK.from(cU(cg(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=ch.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let o=n[e],l=[];for(let n=t[e]||0,i=0;n<r;i++){let a=o.child(i%o.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(cS(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),l.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(rE.FK.from(l))}n=i,e=r}if(t!=i){let e=[];for(let r=0,o=0;r<i;r++,o++){let l=[],a=n[o%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),l.push(t)}e.push(rE.FK.from(l))}n=e,t=i}return{width:e,height:t,rows:n}}(r,l.right-l.left,l.bottom-l.top),cG(e.state,e.dispatch,o,l,r),!0}if(!r)return!1;{let t=cb(e.state),n=t.start(-1);return cG(e.state,e.dispatch,n,ch.get(t.node(-1)).findCell(t.pos-n),r),!0}}function c2(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=c3(e,t.target);if(t.shiftKey&&e.state.selection instanceof cM)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=cy(e.state.selection.$anchor))&&(null==(n=c9(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=c9(e,n),i=null==cv.getState(e.state);if(!r||!cC(t,r))if(!i)return;else r=t;let o=new cM(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(cv,t.pos),e.dispatch(n)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",a),null!=cv.getState(e.state)&&e.dispatch(e.state.tr.setMeta(cv,-1))}function a(n){let r,a=cv.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(c3(e,n.target)!=i&&!(r=c9(e,t)))return l();r&&o(r,n)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",a)}function c5(e,t,n){if(!(e.state.selection instanceof ns.U3))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))break;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){let o=r.before(i),l="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?o:null}}return null}function c3(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function c9(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&cy(e.state.doc.resolve(r))||cy(e.state.doc.resolve(i))}var c7=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),c4(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,c4(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function c4(e,t,n,r,i,o){let l=0,a=!0,s=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=i==n?o:u&&u[e],d=c?c+"px":"";if(l+=c||r,c||(a=!1),s)s.style.width!=d&&(s.style.width=d),s=s.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;s;){var d;let e=s.nextSibling;null==(d=s.parentNode)||d.removeChild(s),s=e}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}let c8=new ns.hs("tableColumnResizing");var c6=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(c8);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return ck(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function de(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:o}=i,l=cy(e.state.doc.resolve(o));if(!l)return -1;if("right"==n)return l.pos;let a=ch.get(l.node(-1)),s=l.start(-1),c=a.map.indexOf(l.pos-s);return c%a.width==0?-1:s+a.map[c-1]}function dt(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function dn(e,t){e.dispatch(e.state.tr.setMeta(c8,{setHandle:t}))}function dr(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),l=i.start(-1),a=ch.get(o).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1,s=e.domAtPos(i.start(-1)).node;for(;s&&"TABLE"!=s.nodeName;)s=s.parentNode;s&&c4(o,s.firstChild,s,r,a,n)}var di="u">typeof navigator?navigator:null,dl=di&&di.userAgent||"",da=/Edge\/(\d+)/.exec(dl),ds=/MSIE \d/.exec(dl),dc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dl),dd=!(ds||dc||da)&&!!di&&/Apple Computer/.test(di.vendor),du=new ns.hs("safari-ime-span"),dh=!1;function dp(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var df=new ns.k_(dd?{key:du,props:{decorations:function(e){let{$from:t,$to:n,to:r}=e.selection;if(dh&&t.sameParent(n)){let t=ii.NZ.widget(r,dp,{ignoreSelection:!0,key:"safari-ime-span"});return ii.zF.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{dh=!0},compositionend:()=>{dh=!1}}}}:{key:du}),dm=n(74576);function dg(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var dv=oy("strike_through");dg(dv,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var dy=om("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(dv.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));dg(dy.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),dg(dy.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var dw=ol("ToggleStrikeThrough",e=>()=>rJ(dy.type(e)));dg(dw,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var db=oa(e=>nK(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,dy.type(e)));dg(db,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var dk=og("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{let t=e.get(iO);return()=>t.call(dw.key)}}});dg(dk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),dg(dk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var dC=function(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:cm}};for(let e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>cp(e,t)}],toDOM:e=>["td",cf(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>cp(e,t)}],toDOM:e=>["th",cf(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),dx=of("table",()=>({...dC.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:0===t}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{let n=t.content.firstChild?.content;if(!n)return;let r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));dg(dx.node,{displayName:"NodeSchema<table>",group:"Table"}),dg(dx.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var dS=of("table_header_row",()=>({...dC.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&!!e.querySelector("th")&&{}}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>!!("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));dg(dS.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),dg(dS.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var dM=of("table_row",()=>({...dC.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));dg(dM.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),dg(dM.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var dT=of("table_cell",()=>({...dC.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));dg(dT.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),dg(dT.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var dN=of("table_header",()=>({...dC.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));function dA(e,t=3,n=3){let r=Array(n).fill(0).map(()=>dT.type(e).createAndFill()),i=Array(n).fill(0).map(()=>dN.type(e).createAndFill()),o=Array(t).fill(0).map((t,n)=>0===n?dS.type(e).create(null,i):dM.type(e).create(null,r));return dx.type(e).create(null,o)}function dO(e){return(t,n)=>r=>{n=n??r.selection.from;let i=r.doc.resolve(n),o=n2(e=>"table"===e.type.name)(i),l=o?{node:o.node,from:o.start}:void 0,a="row"===e;if(l){let e=ch.get(l.node);if(t>=0&&t<(a?e.height:e.width)){let n=e.positionAt(a?t:e.height-1,a?e.width-1:t,l.node),i=r.doc.resolve(l.from+n),o=a?cM.rowSelection:cM.colSelection,s=e.positionAt(a?t:0,a?0:t,l.node),c=r.doc.resolve(l.from+s);return n1(r.setSelection(o(i,c)))}}return r}}dg(dN.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),dg(dN.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});var dI=dO("row"),dE=dO("col");function d_(e,t,{map:n,tableStart:r,table:i},o){let l=Array(o).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),a=Array(n.width).fill(0).map((t,r)=>{let o=i.nodeAt(n.map[r]);return dT.type(e).createAndFill({alignment:o?.attrs.alignment})});return t.insert(l,dM.type(e).create(null,a)),t}var dR=ol("GoToPrevTableCell",()=>()=>cK(-1));dg(dR,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var dL=ol("GoToNextTableCell",()=>()=>cK(1));dg(dL,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var dP=ol("ExitTable",e=>()=>(t,n)=>{var r;if(!cw(t))return!1;let{$head:i}=t.selection,o=(r=dx.type(e),n0(e=>e.type===r)(i));if(!o)return!1;let{to:l}=o,a=t.tr.replaceWith(l,l,lu.type(e).createAndFill());return a.setSelection(ns.LN.near(a.doc.resolve(l),1)).scrollIntoView(),n?.(a),!0});dg(dP,{displayName:"Command<breakTableCommand>",group:"Table"});var d$=ol("InsertTable",e=>({row:t,col:n}={})=>(r,i)=>{let{selection:o,tr:l}=r,{from:a}=o,s=dA(e,t,n),c=l.replaceSelectionWith(s),d=ns.LN.findFrom(c.doc.resolve(a),1,!0);return d&&c.setSelection(d),i?.(c),!0});dg(d$,{displayName:"Command<insertTableCommand>",group:"Table"});var dD=ol("MoveRow",()=>({from:e,to:t,pos:n}={})=>{var r;return r={from:e??0,to:t??0,pos:n},(e,t)=>{let{from:n,to:i,select:o=!0,pos:l=e.selection.from}=r,a=e.tr;return!!function(e){var t,n,r,i,o,l;let a,{tr:s,originIndex:c,targetIndex:d,select:u,pos:h}=e,p=c_(s.doc.resolve(h));if(!p)return!1;let f=null==(t=c$(s,c))?void 0:t.indexes,m=null==(n=c$(s,d))?void 0:n.indexes;if(!f||!m||f.includes(d))return!1;let g=(r=p.node,i=f,o=m,l=0,a=cO(r),cI(r,a=cE(a,i,o,0)));if(s.replaceWith(p.pos,p.pos+p.node.nodeSize,g),!u)return!0;let v=ch.get(g),y=p.start,w=v.positionAt(d,v.width-1,g),b=s.doc.resolve(y+w),k=v.positionAt(d,0,g),C=s.doc.resolve(y+k);return s.setSelection(cM.rowSelection(b,C)),!0}({tr:a,originIndex:n,targetIndex:i,select:o,pos:l})&&(null==t||t(a),!0)}});dg(dD,{displayName:"Command<moveRowCommand>",group:"Table"});var dj=ol("MoveCol",()=>({from:e,to:t,pos:n}={})=>{var r;return r={from:e??0,to:t??0,pos:n},(e,t)=>{let{from:n,to:i,select:o=!0,pos:l=e.selection.from}=r,a=e.tr;return!!function(e){var t,n,r,i,o,l;let a,{tr:s,originIndex:c,targetIndex:d,select:u,pos:h}=e,p=c_(s.doc.resolve(h));if(!p)return!1;let f=null==(t=cP(s,c))?void 0:t.indexes,m=null==(n=cP(s,d))?void 0:n.indexes;if(!f||!m||f.includes(d))return!1;let g=(r=p.node,i=f,o=m,l=0,a=cD(cO(r)),cI(r,a=cD(a=cE(a,i,o,0))));if(s.replaceWith(p.pos,p.pos+p.node.nodeSize,g),!u)return!0;let v=ch.get(g),y=p.start,w=v.positionAt(v.height-1,d,g),b=s.doc.resolve(y+w),k=v.positionAt(0,d,g),C=s.doc.resolve(y+k);return s.setSelection(cM.colSelection(b,C)),!0}({tr:a,originIndex:n,targetIndex:i,select:o,pos:l})&&(null==t||t(a),!0)}});dg(dj,{displayName:"Command<moveColCommand>",group:"Table"});var dF=ol("SelectRow",()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(dI(e.index,e.pos)(r))});dg(dF,{displayName:"Command<selectRowCommand>",group:"Table"});var dB=ol("SelectCol",()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(dE(e.index,e.pos)(r))});dg(dB,{displayName:"Command<selectColCommand>",group:"Table"});var dH=ol("SelectTable",()=>()=>(e,t)=>{let{tr:n}=e;return!!t?.(function(e){let t=function(e){let t=c_(e.$from);if(!t)return;let n=ch.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{let n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}(e.selection);if(t&&t[0]){let n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){let t=e.doc.resolve(r.pos);return n1(e.setSelection(new cM(t,n)))}}return e}(n))});dg(dH,{displayName:"Command<selectTableCommand>",group:"Table"});var dz=ol("DeleteSelectedCells",()=>()=>(e,t)=>{let{selection:n}=e;if(!(n instanceof cM))return!1;let r=n.isRowSelection(),i=n.isColSelection();if(r&&i){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}if(i){if(!cw(e))return!1;if(t){let n=cj(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let o=e.mapping.maps.length;for(let l=0;l<t.height;){let a=l*t.width+i,s=t.map[a],c=n.nodeAt(s),d=c.attrs;if(i>0&&t.map[a-1]==s||i<t.width-1&&t.map[a+1]==s)e.setNodeMarkup(e.mapping.slice(o).map(r+s),null,cS(d,i-t.colCount(s)));else{let t=e.mapping.slice(o).map(r+s);e.delete(t,t+c.nodeSize)}l+=d.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ch.get(e)}t(r)}return!0}if(!cw(e))return!1;if(t){let n=cj(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;let l=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,l+r);let s=new Set;for(let o=0,l=i*t.width;o<t.width;o++,l++){let c=t.map[l];if(!s.has(c)){if(s.add(c),i>0&&c==t.map[l-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[l+t.width]){let l=n.nodeAt(c),s=l.attrs,d=l.type.create({...s,rowspan:l.attrs.rowspan-1},l.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=s.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ch.get(n.table)}t(r)}return!0});dg(dz,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var dq=ol("AddColBefore",()=>()=>cB);dg(dq,{displayName:"Command<addColBeforeCommand>",group:"Table"});var dK=ol("AddColAfter",()=>()=>cH);dg(dK,{displayName:"Command<addColAfterCommand>",group:"Table"});var dW=ol("AddRowBefore",e=>()=>(t,n)=>{if(!cw(t))return!1;if(n){let r=cj(t);n(d_(e,t.tr,r,r.top))}return!0});dg(dW,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var dU=ol("AddRowAfter",e=>()=>(t,n)=>{if(!cw(t))return!1;if(n){let r=cj(t);n(d_(e,t.tr,r,r.bottom))}return!0});dg(dU,{displayName:"Command<addRowAfterCommand>",group:"Table"});var dV=ol("SetAlign",()=>(e="left")=>{var t;return t="alignment",function(n,r){if(!cw(n))return!1;let i=cb(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){let o=n.tr;n.selection instanceof cM?n.selection.forEachCell((n,r)=>{n.attrs[t]!==e&&o.setNodeMarkup(r,null,{...n.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}});dg(dV,{displayName:"Command<setAlignCommand>",group:"Table"});var dJ=oa(e=>new nd(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,i)=>{let o=t.doc.resolve(r);if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),dx.type(e)))return null;let l=dA(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),a=t.tr.replaceRangeWith(r,i,l);return a.setSelection(ns.U3.create(a.doc,r+3)).scrollIntoView()}));dg(dJ,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var dG=(x=e=>({run:(t,n,r)=>{if(r)return t;function i(t){let n=t.childCount,r=t.lastChild?.childCount??0;if(0===n||0===r)return lu.type(e).create();let i=t.firstChild;if(!(r>0&&i&&0===i.childCount))return t;if(n>=3){let r=t.child(1),o=[];for(let t=0;t<r.childCount;t++){let n=r.child(t);o.push(dN.type(e).create(n.attrs,n.content,n.marks))}let l=i.type.create(i.attrs,o),a=[];for(let e=2;e<n;e++)a.push(t.child(e));return t.type.create(t.attrs,[l,...a])}let o=Array(r).fill(0).map(()=>dN.type(e).createAndFill()),l=new rE.Ji(rE.FK.from(o),0,0),a=i.replace(0,0,l);return t.replace(0,i.nodeSize,new rE.Ji(rE.FK.from(a),0,0))}let o=function t(n){let r=function(t){let n=dM.type(e),r=[],o=[],l=!1;function a(){if(0===o.length)return;let t=dS.type(e).createAndFill(),n=dx.type(e).create(null,[t,...o]);r.push(i(n)),o=[]}return t.forEach(e=>{e.type===n?(l=!0,o.push(e)):(a(),r.push(e))}),a(),l?rE.FK.from(r):t}(n),o=r!==n,l=[];return r.forEach(n=>{if(n.type===dx.type(e)){let e=i(n);e!==n&&(o=!0),l.push(e)}else if(n.childCount>0){let e=t(n.content);e!==n.content?(o=!0,l.push(n.copy(e))):l.push(n)}else l.push(n)}),o?rE.FK.from(l):n}(t.content);return o=function(t){let n=[],r=[];t.forEach(e=>r.push(e));for(let t=0;t<r.length;t++){let i=r[t],o=r[t+1];i.type===lu.type(e)&&0===i.content.size&&o&&o.type===dx.type(e)||n.push(i)}return n.length<r.length?rE.FK.from(n):t}(o),new rE.Ji(rE.FK.from(o),t.openStart,t.openEnd)}}),a=e=>async()=>{await e.wait(ik);let t=x(e);return e.update(i1,e=>[...e,t]),a.pasteRule=t,()=>{e.update(i1,e=>e.filter(e=>e!==t))}});dg(dG,{displayName:"PasteRule<table>",group:"Table"});var dZ=og("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{let t=e.get(iO);return()=>t.call(dL.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{let t=e.get(iO);return()=>t.call(dR.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{let t=e.get(iO);return()=>t.call(dP.key)}}});dg(dZ.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),dg(dZ.shortcuts,{displayName:"Keymap<table>",group:"Table"});var dY="footnote_definition",dX="footnoteDefinition",dQ=of("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${dY}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{let t=e.attrs.label;return["dl",{"data-label":t,"data-type":dY},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===dX,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===dY,runner:(e,t)=>{e.openNode(dX,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));dg(dQ.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),dg(dQ.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var d1="footnote_reference",d0=of("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${d1}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return["sup",{"data-label":t,"data-type":d1},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===d1,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));dg(d0.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),dg(d0.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var d2=l0.extendSchema(e=>t=>{let n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw nw(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);let i=null!=t.label?`${t.label}.`:"•",o=null!=t.checked?!!t.checked:null,l=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:i,listType:l,spread:a,checked:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);let r=t.attrs.label,i=t.attrs.listType,o="true"===t.attrs.spread,l=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:i,spread:o,checked:l}),e.next(t.content),e.closeNode()}}}});dg(d2.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),dg(d2.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var d5=oa(()=>new nd(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{let i=e.doc.resolve(n),o=0,l=i.node(o);for(;l&&"list_item"!==l.type.name;)o--,l=i.node(o);if(!l||null!=l.attrs.checked)return null;let a=t.groups?.checked==="x",s=i.before(o),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(s,void 0,{...l.attrs,checked:a}),c}));dg(d5,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var d3=[dk,dZ].flat(),d9=[dJ,d5],d7=[db],d4=[dG],d8=od(()=>df);dg(d8,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"}),dg(od(()=>(function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=c7,lastColumnResizable:i=!0}={}){let o=new ns.k_({key:c8,state:{init(e,t){var i;let l=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=cg(t.schema).table.name;return r&&l&&(l[a]=(e,t)=>new r(e,n,t)),new c6(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=c8.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=c8.getState(e.state);if(i&&!i.dragging){let o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),l=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?l=de(e,t,"left",n):i-t.clientX<=n&&(l=de(e,t,"right",n))}if(l!=i.activeHandle){if(!r&&-1!==l){let t=e.state.doc.resolve(l),n=t.node(-1),r=ch.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}dn(e,l)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=c8.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&dn(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,l=c8.getState(e.state);if(!l||-1==l.activeHandle||l.dragging)return;let a=e.state.doc.nodeAt(l.activeHandle),s=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),l=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(l-=r[e],a--);return l/a}(e,l.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=c8.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),o=ch.get(i),l=r.start(-1),a=o.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,s=e.state.tr;for(let e=0;e<o.height;e++){let t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;let r=o.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;let u=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);u[d]=n,s.setNodeMarkup(l+r,null,{...c,colwidth:u})}s.docChanged&&e.dispatch(s)}(e,r.activeHandle,dt(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(c8,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=c8.getState(e.state);if(i&&i.dragging){let o=dt(i.dragging,t,n);dr(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(c8,{setDragging:{startX:t.clientX,startWidth:s}})),dr(e,l.activeHandle,s,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=c8.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return ii.zF.empty;let o=ch.get(i),l=r.start(-1),a=o.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<o.height;t++){let r=a+t*o.width;if((a==o.width-1||o.map[r]!=o.map[r+1])&&(0==t||o.map[r]!=o.map[r-o.width])){var s;let t=o.map[r],a=l+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(s=c8.getState(e))?void 0:s.dragging)&&n.push(ii.NZ.node(l+t,l+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(ii.NZ.widget(a,c))}}return ii.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o})({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var d6=od(()=>(function({allowTableNodeSelection:e=!1}={}){return new ns.k_({key:cv,state:{init:()=>null,apply(e,t){let n=e.getMeta(cv);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:cN,handleDOMEvents:{mousedown:c2},createSelectionBetween:e=>null!=cv.getState(e.state)?e.state.selection:null,handleTripleClick:c1,handleKeyDown:cZ,handlePaste:c0},appendTransaction:(t,n,r)=>{let i,o;return function(e,t,n){let r,i,o=(t||e).selection,l=(t||e).doc;if(o instanceof ns.nh&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=cM.create(l,o.from);else if("row"==i){let e=l.resolve(o.from+1);r=cM.rowSelection(e,e)}else if(!n){let e=ch.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=cM.create(l,t+1,n)}}else o instanceof ns.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(o)?r=ns.U3.create(l,o.from):o instanceof ns.U3&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(o)&&(r=ns.U3.create(l,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}(r,(o=(e,t)=>{"table"==e.type.spec.tableRole&&(i=function(e,t,n,r){let i,o,l=ch.get(t);if(!l.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<l.height;e++)a.push(0);for(let e=0;e<l.problems.length;e++){let i=l.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let o=e.attrs;for(let e=0;e<o.rowspan;e++)a[i.row+e]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,cS(o,o.colspan-i.n,i.n))}else if("missing"==i.type)a[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<a.length;e++)a[e]&&(null==i&&(i=e),o=e);for(let s=0,c=n+1;s<l.height;s++){let n=t.child(s),l=c+n.nodeSize,d=a[s];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<d;n++){let n=cg(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==s||i==s-1)&&o==s?c+1:l-1;r.insert(r.mapping.map(u),a)}c=l}return r.setMeta(cA,{fixTables:!0})}(r,e,t,i))},n?n.doc!=r.doc&&function e(t,n,r,i){let o=t.childCount,l=n.childCount;e:for(let a=0,s=0;a<l;a++){let l=n.child(a);for(let e=s,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==l){s=e+1,r+=l.nodeSize;continue e}i(l,r),s<o&&t.child(s).sameMarkup(l)?e(t.child(s),l,r+1,i):l.nodesBetween(0,l.content.size,i,r+1),r+=l.nodeSize}}(n.doc,r.doc,0,o):r.doc.descendants(o),i),e)}})})({allowTableNodeSelection:!0}));dg(d6,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var ue=ow("remarkGFM",()=>dm.A);dg(ue.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),dg(ue.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var ut=new ns.hs("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN"),un=od(()=>new ns.k_({key:ut,appendTransaction:(e,t,n)=>{let r;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{let i;if(r||(r=n.tr),"table_cell"!==e.type.name)return;let o=n.doc.resolve(t),l=o.node(o.depth),a=o.node(o.depth-1).firstChild;if(!a)return;let s=(i=0,l.forEach((t,n,r)=>{t===e&&(i=r)}),i),c=a.maybeChild(s);if(!c)return;let d=c.attrs.alignment;d!==e.attrs.alignment&&r.setNodeMarkup(t,void 0,{...e.attrs,alignment:d})}),r}}));dg(un,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var ur=[un,d8,ue,d6].flat(),ui=[[d2,dx,dS,dM,dN,dT,dQ,d0,dv,dy].flat(),d9,d4,d7,d3,[dL,dR,dP,d$,dD,dj,dF,dB,dH,dz,dW,dU,dq,dK,dV,dw],ur].flat(),uo=n(35930),ul=n(44020),ua=n(43854),us=function(){};us.prototype.append=function(e){return e.length?(e=us.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},us.prototype.prepend=function(e){return e.length?us.from(e).append(this):this},us.prototype.appendInner=function(e){return new ud(this,e)},us.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?us.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},us.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},us.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},us.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},us.from=function(e){return e instanceof us?e:e&&e.length?new uc(e):us.empty};var uc=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(us);us.empty=new uc([]);var ud=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(us);class uu{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let l=this.items.length;for(;;l--)if(this.items.get(l-1).selection){--l;break}t&&(r=(n=this.remapping(l,this.items.length)).maps.length);let a=e.tr,s=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(l,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new uh(e.map));let t=e.step.map(n.slice(r)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],s.push(new uh(i,void 0,void 0,s.length+c.length))),r--,i&&n.appendMap(i,r)}else a.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new uu(this.items.slice(0,l).append(c.reverse().concat(s)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:a,selection:i}}addTransform(e,t,n,r){var i,o;let l,a=[],s=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new uh(e.mapping.maps[n],i,t),l;(l=d&&d.merge(o))&&(o=l,n?a.pop():c=c.slice(0,c.length-1)),a.push(o),t&&(s++,t=void 0),r||(d=o)}let u=s-n.depth;return u>uf&&(i=c,o=u,i.forEach((e,t)=>{if(e.selection&&0==o--)return l=t,!1}),c=i.slice(l),s-=u),new uu(c.append(a),s)}remapping(e,t){let n=new nc.X9;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new uu(this.items.append(e.map(e=>new uh(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(e=>{e.selection&&l--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let s=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&l++,n.push(new uh(s,o,c))}else n.push(new uh(s))},r);let s=[];for(let e=t;e<o;e++)s.push(new uh(i.maps[e]));let c=new uu(this.items.slice(0,r).append(s).append(n),l);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),l=e&&e.getMap();if(n--,l&&t.appendMap(l,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let s=new uh(l.invert(),e,a),c,d=r.length-1;(c=r.length&&r[d].merge(s))?r[d]=c:r.push(s)}}else o.map&&n--},this.items.length,0),new uu(us.from(r.reverse()),i)}}uu.empty=new uu(us.empty,0);class uh{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new uh(t.getMap().invert(),t,this.selection)}}}class up{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let uf=20;function um(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function ug(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let uv=!1,uy=null;function uw(e){let t=e.plugins;if(uy!=t){uv=!1,uy=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){uv=!0;break}}return uv}let ub=new ns.hs("history"),uk=new ns.hs("closeHistory");function uC(e,t){return(n,r)=>{let i=ub.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=uw(t),i=ub.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let l=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),s=new up(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(l).setMeta(ub,{redo:n,historyState:s})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let ux=uC(!1,!0),uS=uC(!0,!0);uC(!1,!1),uC(!0,!1);var uM=Object.defineProperty,uT=Object.getOwnPropertySymbols,uN=Object.prototype.hasOwnProperty,uA=Object.prototype.propertyIsEnumerable,uO=(e,t,n)=>t in e?uM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function uI(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))uN.call(t,n)&&uO(e,n,t[n]);if(uT)for(var n of uT(t))uA.call(t,n)&&uO(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let uE=op({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"\uD83D\uDD0D",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"\uD83D\uDCCB",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");uI(uE,{displayName:"Config<code-block>",group:"CodeBlock"});class u_{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){let t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function uR({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}aM.h,uR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h,aM.FK;let uL=(0,aM.pM)({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){let t=()=>{(function(e){let t,n;return t=this,n=function*(){try{return navigator.clipboard.writeText(e)}catch(o){let t=document.createElement("textarea"),n=document.activeElement;t.value=e,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";let r=document.getSelection(),i=r?r.rangeCount>0&&r.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(t),i&&(r.removeAllRanges(),r.addRange(i)),n&&n.focus()}},new Promise((e,r)=>{var i=e=>{try{l(n.next(e))}catch(e){r(e)}},o=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);l((n=n.apply(t,null)).next())})})(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>(0,aM.h)(aM.FK,null,(0,aM.h)("button",{type:"button",class:"copy-button",onClick:t},(0,aM.h)(uR,{icon:e.copyIcon}),e.copyText))}});aM.h,aM.FK;let uP=(0,aM.pM)({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:i}){let o=(0,aT.KR)(),l=(0,aT.KR)(!1),a=(0,aT.KR)(),s=(0,aT.KR)(),c=(0,aT.KR)("");(0,aM.wB)([l,o,s],()=>{c.value="";let e=o.value,t=s.value;e&&t&&(0,oL.rD)(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});let d=e=>{if(e.preventDefault(),e.stopPropagation(),i())return;let t=!l.value;l.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},u=e=>{c.value=e.target.value},h=e=>{"Escape"===e.key&&(c.value="")},p=(0,aM.EW)(()=>{var t;if(!l.value)return[];let n=null!=(t=r())?t:[],i=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),o=n.filter(e=>{let t=c.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==i});return 0===o.length?[]:i?[i,...o]:o}),f=e=>{let t=e.target;if(o.value&&o.value.contains(t))return;let n=s.value,r=o.value;r&&n&&"true"===r.dataset.expanded&&(n.contains(t)||(l.value=!1))};return(0,aM.sV)(()=>{window.addEventListener("click",f)}),(0,aM.hi)(()=>{window.removeEventListener("click",f)}),()=>(0,aM.h)(aM.FK,null,(0,aM.h)("button",{type:"button",ref:o,class:"language-button",onClick:d,"data-expanded":String(l.value)},e.value||"Text",(0,aM.h)("div",{class:"expand-icon"},(0,aM.h)(uR,{icon:t.expandIcon}))),(0,aM.h)("div",{ref:s,class:"language-picker"},l.value?(0,aM.h)("div",{class:"list-wrapper"},(0,aM.h)("div",{class:"search-box"},(0,aM.h)("div",{class:"search-icon"},(0,aM.h)(uR,{icon:t.searchIcon})),(0,aM.h)("input",{ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:c.value,onInput:u,onKeydown:h}),(0,aM.h)("div",{class:(0,aX.A)("clear-icon",0===c.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),c.value=""}},(0,aM.h)(uR,{icon:t.clearSearchIcon}))),(0,aM.h)("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){let e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},p.value.length?p.value.map(r=>(0,aM.h)("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),l.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):(0,aM.h)("li",{class:"language-list-item no-result"},t.noResultText))):null))}});aM.h,aM.FK;let u$=(0,aM.pM)({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){let{previewOnlyMode:t,config:n,preview:r}=e,i=(0,aT.KR)();return(0,aM.nT)(()=>{let e=i.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);let t=r.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=sU.sanitize(t))}),()=>r.value?(0,aM.h)("div",{class:"preview-panel"},!t.value&&(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"preview-divider"}),(0,aM.h)("div",{class:"preview-label"},n.previewLabel)),(0,aM.h)("div",{ref:i,class:"preview"})):null}});aM.h,aM.FK;let uD=(0,aM.pM)({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){var t;let n=null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly(),r=(0,aT.KR)(n),i=(0,aT.KR)(),o=(0,aT.KR)(null);(0,aM.sV)(()=>{for(var t;null==(t=i.value)?void 0:t.firstChild;)i.value.removeChild(i.value.firstChild);i.value&&i.value.appendChild(e.codemirror.dom)}),(0,aM.wB)(()=>[e.text.value,e.language.value],()=>{let t=e.config.renderPreview(e.language.value,e.text.value,e=>o.value=e);t&&(o.value=t),void 0!==t||o.value||(o.value=sU.sanitize(e.config.previewLoading)),null===t&&(o.value=null)},{immediate:!0});let l=()=>{};return()=>{var t;return(0,aM.h)(aM.FK,null,(0,aM.h)("div",{class:"tools"},(0,aM.h)(uP,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),(0,aM.h)("div",{class:"tools-button-group"},(0,aM.h)(uL,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:l,text:e.text.value}),o.value?(0,aM.h)("button",{class:"preview-toggle-button",onClick:()=>r.value=!r.value},(0,aM.h)(uR,{icon:e.config.previewToggleButton(r.value)})):null)),(0,aM.h)("div",{ref:i,class:(0,aX.A)("codemirror-host",o.value&&r.value&&"hidden")}),(0,aM.h)(u$,{text:e.text,language:e.language,config:e.config,previewOnlyMode:r,preview:o}))}}});class uj{constructor(e,t,n,r,i){this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=i,this.selected=(0,aT.KR)(!1),this.language=(0,aT.KR)(""),this.text=(0,aT.KR)(""),this.updating=!1,this.languageName="",this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1,{main:r}=e.state.selection,i=n+r.from,o=n+r.to,l=this.view.state.selection;if(e.docChanged||l.from!==i||l.to!==o){let t=this.view.state.tr;e.changes.iterChanges((e,r,i,o,l)=>{l.length?t.replaceWith(n+e,n+r,this.view.state.schema.text(l.toString())):t.delete(n+e,n+r),n+=o-i-(r-e)}),t.setSelection(ns.U3.create(t.doc,i,o)),this.view.dispatch(t)}},this.createApp=()=>aZ(uD,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{let e=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>!!rH(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>ux(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>uS(e.state,e.dispatch)},{key:"Mod-y",run:()=>uS(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;let t=this.cm.state.selection.ranges;if(t.length>1)return!1;let n=t[0];if(n&&(!n.empty||n.anchor>0)||this.cm.state.doc.lines>=2)return!1;let r=this.view.state,i=null!=(e=this.getPos())?e:0,o=r.tr.replaceWith(i,i+this.node.nodeSize,r.schema.nodes.paragraph.createChecked({},this.node.content));return o.setSelection(ns.U3.near(o.doc.resolve(i))),this.view.dispatch(o),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;let{state:r}=this.cm,i=r.selection.main;if(!i.empty||("line"===e&&(i=r.doc.lineAt(i.head)),t<0?i.from>0:i.to<r.doc.length))return!1;let o=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),l=ns.U3.near(this.view.state.doc.resolve(o),t),a=this.view.state.tr.setSelection(l).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new ua.xx,this.readOnlyConf=new ua.xx,this.cm=new ul.Lz({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(ua.$t.readOnly.of(!this.view.editable)),(0,ul.VH)(),ul.w4.of(this.codeMirrorKeymap()),this.languageConf.of([]),ua.$t.changeFilter.of(()=>this.view.editable),...i.extensions,ul.Lz.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=(0,aM.nT)(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){let t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){let e=this.node.attrs.language;e===this.languageName||(this.language.value=e,this.loader.load(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error))}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(ua.$t.readOnly.of(!this.view.editable))});let t=function(e,t){if(e===t)return null;let n=0,r=e.length,i=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&i>n&&e.charCodeAt(r-1)===t.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:t.slice(n,i)}}(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}let uF=oh(lA.node,e=>{let t=e.get(uE.key),n=new u_(t.languages);return(e,r,i)=>new uj(e,r,i,n,t)});uI(uF,{displayName:"NodeView<code-block>",group:"CodeBlock"});let uB=[uF,uE];var uH=n(1148);function uz(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function uq(e,t){return Math.min(uz(e,[t[0],t[1]]),uz(e,[t[2],t[3]]))}WeakMap,WeakMap;class uK extends ns.LN{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return uK.valid(n)?new uK(n):ns.LN.near(n)}content(){return rE.Ji.empty}eq(e){return e instanceof uK&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new uK(e.resolve(t.pos))}getBookmark(){return new uW(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||uU(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||uU(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){t:for(;;){if(!n&&uK.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let l=e.doc.resolve(r);if(uK.valid(l))return l}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ns.nh.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue t}break}i=o,r+=t;let l=e.doc.resolve(r);if(uK.valid(l))return l}return null}}}uK.prototype.visible=!1,uK.findFrom=uK.findGapCursorFrom,ns.LN.jsonID("gapcursor",uK);class uW{constructor(e){this.pos=e}map(e){return new uW(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return uK.valid(t)?new uK(t):ns.LN.near(t)}}function uU(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let uV=r7({ArrowLeft:uJ("horiz",-1),ArrowRight:uJ("horiz",1),ArrowUp:uJ("vert",-1),ArrowDown:uJ("vert",1)});function uJ(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,l=t>0?o.$to:o.$from,a=o.empty;if(o instanceof ns.U3){if(!i.endOfTextblock(n)||0==l.depth)return!1;a=!1,l=e.doc.resolve(t>0?l.after():l.before())}let s=uK.findGapCursorFrom(l,t,a);return!!s&&(r&&r(e.tr.setSelection(new uK(s))),!0)}}function uG(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!uK.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&ns.nh.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new uK(r))),!0)}function uZ(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof uK))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=rE.FK.empty;for(let e=r.length-1;e>=0;e--)i=rE.FK.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new rE.Ji(i,0,0));return o.setSelection(ns.U3.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function uY(e){if(!(e.selection instanceof uK))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ii.zF.create(e.doc,[ii.NZ.widget(e.selection.head,t,{key:"gapcursor"})])}function uX(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}var uQ=op(null,"dropIndicatorState");uX(uQ,{displayName:"Ctx<dropIndicatorState>"});var u1=op({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");uX(u1,{displayName:"Ctx<dropIndicatorConfig>"});var u0=new ns.hs("MILKDOWN_DROP_INDICATOR_DOM"),u2=od(e=>new ns.k_({key:u0,view:t=>{let n=e.get(u1.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(r);let i=e.use(uQ.key),o=e=>{!function(e,t,n){let r,i;if(!t)return Object.assign(e.style,{display:"none"});let{line:o}=t,{width:l}=n,{p1:{x:a,y:s},p2:{x:c,y:d}}=o,u=s,h=a;s===d?(r=c-a,i=l,u-=l/2):(r=l,i=d-s,h-=l/2),u=Math.round(u),h=Math.round(h),Object.assign(e.style,{display:"block",width:`${r}px`,height:`${i}px`,transform:`translate(${h}px, ${u}px)`})}(r,e,n)};return i.on(o),{destroy:()=>{i.off(o),r.remove()}}}}));uX(u2,{displayName:"Prose<dropIndicatorDOM>"});var u5=od(e=>{var t;let n;return t={onShow:t=>{e.set(uQ.key,t)},onHide:()=>{e.set(uQ.key,null)},onDrag:()=>!0},new ns.k_({key:new ns.hs("prosekit-drop-indicator"),view:e=>{var r,i,o,l;let a,s,c,d,u,h,p,f,m,g,v,y;return r=t.onDrag,u=[],i=e,o=n=(t,n)=>{var i,o;return c&&(i=c,o=t,i[0]===o[0]&&i[1]===o[1])?d:(c=t,d=((t,n)=>{let i,o;if(!e.editable||e.isDestroyed)return;let l=(i=e.dom.getBoundingClientRect(),o=e.state.doc,u&&a&&s&&i.width===s.width&&i.height===s.height&&i.x===s.x&&i.y===s.y&&a.eq(o)?u:(s=i,a=o,u=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){let[i,o]=t.pop();if(i>=0){var r;let t=e.nodeDOM(i);if(t&&1===(r=t).nodeType&&"http://www.w3.org/1999/xhtml"===r.namespaceURI){let{top:e,bottom:r,left:l,right:a}=t.getBoundingClientRect();n.push([i,[l,e,a,e]],[i+o.nodeSize,[l,r,a,r]])}}if(o.isBlock&&!o.isTextblock){let e=i+1;for(let n of o.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)));l.sort((e,n)=>{let[r,i]=e,[o,l]=n;return uq(t,i)-uq(t,l)||r-o});let c=(l=l.slice(0,8)).find(t=>r?.({view:e,pos:t[0],event:n})!==!1);if(!(c&&function(e,t){let n=e.dragging;if(!n)return;let{move:r}=n;if(!r)return;let i=e.state.selection;if(!(i instanceof ns.nh))return;let{from:o,to:l}=i;return o<=t&&t<=l}(e,c[0])))return c})(t,n))},l=t,m=i.dom,g=!1,v=()=>{h&&clearTimeout(h),g=!1,h=setTimeout(()=>{g||l.onHide?.()},30)},y=e=>{g=!0;let{clientX:t,clientY:n}=e;if(p===t&&f===n)return;p=t,f=n;let r=o([t,n],e);if(!r)return void v();{let[e,[t,n,o,a]]=r;l.onShow?.({view:i,pos:e,line:{p1:{x:t,y:n},p2:{x:o,y:a}}})}},m.addEventListener("dragover",y),m.addEventListener("dragend",v),m.addEventListener("drop",v),m.addEventListener("dragleave",v),{destroy:()=>{m.removeEventListener("dragover",y),m.removeEventListener("dragend",v),m.removeEventListener("drop",v),m.removeEventListener("dragleave",v)}}},props:{handleDrop(e,t,r,i){if(!n)return!1;let o=n([t.clientX,t.clientY],t);if(!o)return!1;t.preventDefault();let l=o[0],a=e.state.tr;if(i){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let s=a.mapping.map(l),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,d=a.doc;if(c?a.replaceRangeWith(s,s,r.content.firstChild):a.replaceRange(s,s,r),a.doc.eq(d))return!0;let u=a.doc.resolve(s);if(c&&ns.nh.isSelectable(r.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new ns.nh(u));else{var h,p,f;let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection((h=e,p=u,f=a.doc.resolve(t),h.someProp("createSelectionBetween",e=>e(h,p,f))||ns.U3.between(p,f,void 0)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})});uX(u5,{displayName:"Prose<dropIndicator>"});var u3=od(()=>new ns.k_({props:{decorations:uY,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&uK.valid(n)?new uK(n):null,handleClick:uG,handleKeyDown:uV,handleDOMEvents:{beforeinput:uZ}}}));uX(u3,{displayName:"Prose<gapCursor>"});var u9=[u3,u1,uQ,u2,u5].flat(),u7=new ns.hs("prosemirror-virtual-cursor");function u4(e){let t=e.index(),n=e.parent.maybeChild(t),r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[null==r?void 0:r.marks,null==n?void 0:n.marks]}function u8(e){return e&&"object"==typeof e&&"$cursor"in e}var u6=Object.defineProperty,he=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,hr=(e,t,n)=>t in e?u6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function hi(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))ht.call(t,n)&&hr(e,n,t[n]);if(he)for(var n of he(t))hn.call(t,n)&&hr(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let ho=op({imageIcon:"\uD83C\uDF0C",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");function hl({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}hi(ho,{displayName:"Config<image-inline>",group:"ImageInline"}),aM.h,hl.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let ha=oo("abcdefg",8),hs=(0,aM.pM)({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:l,uploadPlaceholderText:a,className:s,onImageLoadError:c}){var d,u;let h=(0,aT.KR)(!1),p=(0,aT.KR)(),f=(0,aT.KR)(null!=(d=t.value)?d:""),m=(0,aT.KR)(ha()),g=(0,aT.KR)((null==(u=t.value)?void 0:u.length)!==0),v=e=>{let t=e.target.value;g.value=0!==t.length,f.value=t},y=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},w=e=>{var t;let i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>(0,aM.h)("div",{class:(0,aX.A)("image-edit",s)},(0,aM.h)(hl,{icon:i,class:"image-icon"}),(0,aM.h)("div",{class:(0,aX.A)("link-importer",h.value&&"focus")},(0,aM.h)("input",{ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:v,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!g.value&&(0,aM.h)("div",{class:"placeholder"},(0,aM.h)("input",{disabled:e.value,class:"hidden",id:m.value,type:"file",accept:"image/*",onChange:w}),(0,aM.h)("label",{class:"uploader",for:m.value},(0,aM.h)(hl,{icon:o})),(0,aM.h)("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&(0,aM.h)(Fragment,null,(0,aM.h)("div",{class:"image-preview"},(0,aM.h)("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),(0,aM.h)("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},(0,aM.h)(hl,{icon:l}))))}});aM.h,aM.FK;let hc=(0,aM.pM)({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t,alt:n,title:r}=e;return()=>{var i;return(null==(i=t.value)?void 0:i.length)?(0,aM.h)("img",{class:"image-inline",src:t.value,alt:n.value,title:r.value}):(0,aM.h)(hs,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),hd=oh(lR.node,e=>(t,n,r)=>{let i=(0,aT.KR)(t.attrs.src),o=(0,aT.KR)(t.attrs.alt),l=(0,aT.KR)(t.attrs.title),a=(0,aT.KR)(!1),s=(0,aT.KR)(!n.editable),c=e.get(ho.key),d=aZ(hc,{src:i,alt:o,title:l,selected:a,readonly:s,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?sU.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";let h=(0,aM.nT)(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){let t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;o.value=e.attrs.alt,l.value=e.attrs.title};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});hi(hd,{displayName:"NodeView<image-inline>",group:"ImageInline"});let hu=[ho,hd];var hh=n(68876),hp=class{#eb;#eC;#ef;#em;#eh;#ep=!1;#eN;#eS;#eA;#ex;constructor(e){this.onShow=()=>{},this.onHide=()=>{},this.update=(e,t)=>{this.#ex(e,t)},this.destroy=()=>{this.#eN?.(),this.#ex.cancel()},this.show=(e,t)=>{if(this.element.dataset.show="true",e){this.#eN?.(),this.#eN=void 0;let n={...e,contextElement:t?.dom};t&&this.#eO(t)?this.#eN=(0,oL.ll)(n,this.element,()=>this.#eI(n)):this.#eI(n)}this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#eb=e.debounce??200,this.#eC=e.shouldShow??this.#eM,this.#eS=e.offset,this.#eA=e.shift,this.#ef=e.middleware??[],this.#em=e.floatingUIOptions??{},this.#eh=e.root,this.element.dataset.show="false",this.#ex=oR(this.#eT,this.#eb)}#eI=e=>{(0,oL.rD)(e,this.element,{placement:this.#em.placement??"top",middleware:[(0,oL.UU)(),(0,oL.cY)(this.#eS),(0,oL.BN)(this.#eA),...this.#ef],...this.#em}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error)};#eO=e=>this.#eh!==e.dom.parentElement;#eT=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:l}=i,a=Math.min(...l.map(e=>e.$from.pos)),s=Math.max(...l.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(this.#ep||((this.#eh??e.dom.parentElement??document.body).appendChild(this.element),this.#ep=!0),r||c)return;if(this.#eN?.(),this.#eN=void 0,!this.#eC(e,t))return void this.hide();let d={getBoundingClientRect:()=>nQ(e,a,s),contextElement:e.dom};this.#eO(e)?this.#eN=(0,oL.ll)(d,this.element,()=>this.#eI(d)):this.#eI(d),this.show()};#eM=e=>{let{doc:t,selection:n}=e.state,{empty:r,from:i,to:o}=n,l=!t.textBetween(i,o).length&&e.state.selection instanceof ns.U3,a=this.element.contains(document.activeElement),s=!e.hasFocus()&&!a,c=!e.editable;return!s&&!r&&!l&&!c}};function hf(e){let t=op({},`${e}_TOOLTIP_SPEC`),n=od(n=>{let r=n.get(t.key);return new ns.k_({key:new ns.hs(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}var hm=n(69286),hg=n(69817),hv=n(28986),hy=n(66017);let hw={tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,l=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(r){return 36===r?(e.consume(r),l++,t):l<2?n(r):(e.exit("mathFlowFenceSequence"),(0,hv.N)(e,a,"whitespace")(r))}(t)};function a(t){return null===t||(0,hy.HP)(t)?s(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(r){return null===r||(0,hy.HP)(r)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),s(r)):36===r?n(r):(e.consume(r),t)}(t))}function s(n){return(e.exit("mathFlowFence"),r.interrupt)?t(n):e.attempt(hb,c,h)(n)}function c(t){return e.attempt({tokenize:p,partial:!0},h,d)(t)}function d(t){return(o?(0,hv.N)(e,u,"linePrefix",o+1):u)(t)}function u(t){return null===t?h(t):(0,hy.HP)(t)?e.attempt(hb,c,h)(t):(e.enter("mathFlowValue"),function t(n){return null===n||(0,hy.HP)(n)?(e.exit("mathFlowValue"),u(n)):(e.consume(n),t)}(t))}function h(n){return e.exit("mathFlow"),t(n)}function p(e,t,n){let i=0;return(0,hv.N)(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(r){return 36===r?(i++,e.consume(r),t):i<l?n(r):(e.exit("mathFlowFenceSequence"),(0,hv.N)(e,o,"whitespace")(r))}(t)},"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(r){return null===r||(0,hy.HP)(r)?(e.exit("mathFlowFence"),t(r)):n(r)}}},concrete:!0,name:"mathFlow"},hb={tokenize:function(e,t,n){let r=this;return function(n){return null===n?t(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0};function hk(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("mathTextData"===e[t][1].type){e[r][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="mathTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e}function hC(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}let hx={};function hS(e){let t,n=e||hx,r=this.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push({flow:{36:hw},text:{36:(null==(t=(n||{}).singleDollarTextMath)&&(t=!0),{tokenize:function(e,n,r){let i,o,l=0;return function(n){return e.enter("mathText"),e.enter("mathTextSequence"),function n(i){return 36===i?(e.consume(i),l++,n):l<2&&!t?r(i):(e.exit("mathTextSequence"),a(i))}(n)};function a(t){return null===t?r(t):36===t?(o=e.enter("mathTextSequence"),i=0,function t(r){return 36===r?(e.consume(r),i++,t):i===l?(e.exit("mathTextSequence"),e.exit("mathText"),n(r)):(o.type="mathTextData",s(r))}(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):(0,hy.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("mathTextData"),s(t))}function s(t){return null===t||32===t||36===t||(0,hy.HP)(t)?(e.exit("mathTextData"),a(t)):(e.consume(t),s)}},resolve:hk,previous:hC,name:"mathText"})}}),o.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),n=this.stack[this.stack.length-1];(0,hm.ok)("math"===n.type),this.exit(e),n.value=t;let r=n.data.hChildren[0];(0,hm.ok)("element"===r.type),(0,hm.ok)("code"===r.tagName),r.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){let e=this.resume(),t=this.stack[this.stack.length-1];(0,hm.ok)("math"===t.type),t.meta=e},mathFlowValue:e,mathText:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];(0,hm.ok)("inlineMath"===n.type),this.exit(e),n.value=t,n.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),l.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),n.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,n,r){let i=e.value||"",o=n.createTracker(r),l="$".repeat(Math.max((0,hg.D)(i,"$")+1,2)),a=n.enter("mathFlow"),s=o.move(l);if(e.meta){let t=n.enter("mathFlowMeta");s+=o.move(n.safe(e.meta,{after:"\n",before:s,encode:["$"],...o.current()})),t()}return s+=o.move("\n"),i&&(s+=o.move(i+"\n")),s+=o.move(l),a(),s},inlineMath:n}};function n(e,n,r){let i=e.value||"",o=1;for(!t&&o++;RegExp("(^|[^$])"+"\\$".repeat(o)+"([^$]|$)").test(i);)o++;let l="$".repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let a=-1;for(;++a<r.unsafe.length;){let e,t=r.unsafe[a];if(!t.atBreak)continue;let n=r.compilePattern(t);for(;e=n.exec(i);){let t=e.index;10===i.codePointAt(t)&&13===i.codePointAt(t-1)&&t--,i=i.slice(0,t)+" "+i.slice(e.index+1)}}return l+i+l}}(n))}var hM=Object.defineProperty,hT=Object.getOwnPropertySymbols,hN=Object.prototype.hasOwnProperty,hA=Object.prototype.propertyIsEnumerable,hO=(e,t,n)=>t in e?hM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function hI(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))hN.call(t,n)&&hO(e,n,t[n]);if(hT)for(var n of hT(t))hA.call(t,n)&&hO(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}var hE=Object.defineProperty,h_=Object.getOwnPropertySymbols,hR=Object.prototype.hasOwnProperty,hL=Object.prototype.propertyIsEnumerable,hP=(e,t,n)=>t in e?hE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h$=(e,t)=>{for(var n in t||(t={}))hR.call(t,n)&&hP(e,n,t[n]);if(h_)for(var n of h_(t))hL.call(t,n)&&hP(e,n,t[n]);return e};let hD=op(h$({},{mode:"preview"}),"linkTooltipStateCtx");hI(hD,{displayName:"State<link-tooltip>",group:"LinkTooltip"});let hj=op(h$({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");hI(hD,{displayName:"API<link-tooltip>",group:"LinkTooltip"});let hF=op(h$({},{linkIcon:"\uD83D\uDD17",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");hI(hD,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});let hB=ol("ToggleLink",e=>()=>t=>{let{doc:n,selection:r}=t,i=li.type(e);return n.rangeHasMark(r.from,r.to,i)?e.get(hj.key).removeLink(r.from,r.to):e.get(hj.key).addLink(r.from,r.to),!0}),hH=hf("LINK_PREVIEW");hI(hH[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(hH[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});let hz=hf("LINK_EDIT");function hq({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}hI(hz[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(hz[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),aM.h,hq.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let hK=(0,aM.pM)({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){let i=(0,aT.KR)(t);(0,aM.wB)(t,e=>{i.value=e});let o=()=>{n(i.value)},l=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),o()),"Escape"===e.key&&(e.preventDefault(),r())};return()=>(0,aM.h)("div",{class:"link-edit"},(0,aM.h)("input",{class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:l,onInput:e=>{i.value=e.target.value},value:i.value}),i.value?(0,aM.h)(hq,{class:"button confirm",icon:e.value.confirmButton,onClick:o}):null)}});var hW=Object.defineProperty,hU=Object.defineProperties,hV=Object.getOwnPropertyDescriptors,hJ=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,hZ=Object.prototype.propertyIsEnumerable,hY=e=>{throw TypeError(e)},hX=(e,t,n)=>t in e?hW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hQ=(e,t)=>{for(var n in t||(t={}))hG.call(t,n)&&hX(e,n,t[n]);if(hJ)for(var n of hJ(t))hZ.call(t,n)&&hX(e,n,t[n]);return e},h1=(e,t,n)=>t.has(e)||hY("Cannot "+n),h0=(e,t,n)=>(h1(e,t,"read from private field"),n?n.call(e):t.get(e)),h2=(e,t,n)=>t.has(e)?hY("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),h5=(e,t,n,r)=>(h1(e,t,"write to private field"),t.set(e,n),n);let h3={from:-1,to:-1,mark:null};class h9{constructor(e,t){this.ctx=e,h2(this,T),h2(this,N),h2(this,A,hQ({},h3)),h2(this,O),h2(this,I),h2(this,E,(0,aT.KR)("")),h2(this,_,()=>{h0(this,N).hide(),this.ctx.update(hD.key,e=>hU(hQ({},e),hV({mode:"preview"}))),h5(this,A,hQ({},h3))}),h2(this,R,e=>{let t=this.ctx.get(ia),{from:n,to:r,mark:i}=h0(this,A),o=li.type(this.ctx),l=sU.sanitize(e);if(i&&i.attrs.href===l)return void h0(this,_).call(this);let a=t.state.tr;i&&a.removeMark(n,r,i),a.addMark(n,r,o.create({href:l})),t.dispatch(a),h0(this,_).call(this)}),h2(this,L,(e,t,n)=>{let r=this.ctx.get(hF.key);h0(this,I).value=r,h0(this,E).value=e,this.ctx.update(hD.key,e=>hU(hQ({},e),hV({mode:"edit"})));let i=this.ctx.get(ia);i.dispatch(i.state.tr.setSelection(ns.U3.create(i.state.doc,t,n))),h0(this,N).show({getBoundingClientRect:()=>nQ(i,t,n)},i),requestAnimationFrame(()=>{var e;null==(e=h0(this,T).querySelector("input"))||e.focus()})}),this.update=e=>{let{state:t}=e,{selection:n}=t;if(!(n instanceof ns.U3))return;let{from:r,to:i}=n;(r!==h0(this,A).from||i!==h0(this,A).to)&&h0(this,_).call(this)},this.destroy=()=>{h0(this,O).unmount(),h0(this,N).destroy(),h0(this,T).remove()},this.addLink=(e,t)=>{h5(this,A,{from:e,to:t,mark:null}),h0(this,L).call(this,"",e,t)},this.editLink=(e,t,n)=>{h5(this,A,{from:t,to:n,mark:e}),h0(this,L).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{let n=this.ctx.get(ia),r=n.state.tr;r.removeMark(e,t,li.type(this.ctx)),n.dispatch(r),h0(this,_).call(this)},h5(this,I,(0,aT.KR)(this.ctx.get(hF.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const r=aZ(hK,{config:h0(this,I),src:h0(this,E),onConfirm:h0(this,R),onCancel:h0(this,_)});r.mount(n),h5(this,O,r),h5(this,T,n),h5(this,N,new hp({content:n,debounce:0,shouldShow:()=>!1})),h0(this,N).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},h0(this,N).update(t)}}T=new WeakMap,N=new WeakMap,A=new WeakMap,O=new WeakMap,I=new WeakMap,E=new WeakMap,_=new WeakMap,R=new WeakMap,L=new WeakMap;var h7=Object.defineProperty,h4=Object.defineProperties,h8=Object.getOwnPropertyDescriptors,h6=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,pn=(e,t,n)=>t in e?h7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;aM.h;let pr=(0,aM.pM)({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){let i=e=>{e.preventDefault(),e.stopPropagation(),n.value()},o=e=>{e.preventDefault(),e.stopPropagation(),r.value()},l=n=>{n.preventDefault();let r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>(0,aM.h)("div",{class:"link-preview"},(0,aM.h)(hq,{class:"button link-icon",icon:e.value.linkIcon,onClick:l}),(0,aM.h)("a",{href:t.value,target:"_blank",class:"link-display"},t.value),(0,aM.h)(hq,{class:"button link-edit-button",icon:e.value.editButton,onClick:i}),(0,aM.h)(hq,{class:"button link-remove-button",icon:e.value.removeButton,onClick:o}))}});var pi=e=>{throw TypeError(e)},po=(e,t,n)=>t.has(e)||pi("Cannot "+n),pl=(e,t,n)=>(po(e,t,"read from private field"),n?n.call(e):t.get(e)),pa=(e,t,n)=>t.has(e)?pi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ps=(e,t,n,r)=>(po(e,t,"write to private field"),t.set(e,n),n);class pc{constructor(e,t){this.ctx=e,pa(this,P),pa(this,$),pa(this,D),pa(this,j),pa(this,F,(0,aT.KR)("")),pa(this,B,(0,aT.KR)(()=>{})),pa(this,H,(0,aT.KR)(()=>{})),pa(this,z),pa(this,q),pa(this,K,!1),pa(this,W,({mode:e})=>{"edit"===e&&pl(this,J).call(this)}),pa(this,U,()=>{ps(this,K,!0)}),pa(this,V,()=>{ps(this,K,!1)}),pa(this,J,()=>{pl(this,$).hide(),pl(this,$).element.removeEventListener("mouseenter",pl(this,U)),pl(this,$).element.removeEventListener("mouseleave",pl(this,V))}),this.show=(e,t,n,r)=>{pl(this,j).value=this.ctx.get(hF.key),pl(this,F).value=e.attrs.href,pl(this,B).value=()=>{this.ctx.get(hj.key).editLink(e,t,n)},pl(this,H).value=()=>{this.ctx.get(hj.key).removeLink(t,n),pl(this,J).call(this)},pl(this,$).show({getBoundingClientRect:()=>r},pl(this,q)),pl(this,$).element.addEventListener("mouseenter",pl(this,U)),pl(this,$).element.addEventListener("mouseleave",pl(this,V))},this.hide=()=>{pl(this,K)||pl(this,J).call(this)},this.update=()=>{},this.destroy=()=>{pl(this,z).unmount(),pl(this,D).off(pl(this,W)),pl(this,$).destroy(),pl(this,P).remove()},ps(this,q,t),ps(this,j,(0,aT.KR)(this.ctx.get(hF.key))),ps(this,z,aZ(pr,{config:pl(this,j),src:pl(this,F),onEdit:pl(this,B),onRemove:pl(this,H)})),ps(this,P,document.createElement("div")),pl(this,P).className="milkdown-link-preview",pl(this,z).mount(pl(this,P)),ps(this,$,new hp({debounce:0,content:pl(this,P),shouldShow:()=>!1})),pl(this,$).update(t),ps(this,D,e.use(hD.key)),pl(this,D).on(pl(this,W))}}function pd(e){let t,n,r;n=o_((n,r)=>{if(!t||!n.hasFocus()||"edit"===e.get(hD.key).mode)return;let i=function(e,t,n){let r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;let{pos:i}=r,o=t.state.doc.nodeAt(i);if(!o)return;let l=o.marks.find(t=>t.type===li.mark.type(e));if(l&&hH.pluginKey())return{show:!0,pos:i,node:o,mark:l}}(e,n,r);if(i){var o,l,a,s,c;let e,r=n.state.doc.resolve(i.pos),d=(o=i.mark,l=i.node,a=n.state.doc,s=r.before(),c=r.after(),e={start:-1,end:-1},a.nodesBetween(s,c,(t,n)=>{if(e.start>-1)return!1;-1===e.start&&o.isInSet(t.marks)&&l===t&&(e={start:n,end:n+Math.max(t.textContent.length,1)})}),e),u=d.start,h=d.end;t.show(i.mark,u,h,nQ(n,u,h));return}t.hide()},50),e.set(hH.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>t=new pc(e,n)}),e.update(hj.key,e=>h4(((e,t)=>{for(var n in t||(t={}))pe.call(t,n)&&pn(e,n,t[n]);if(h6)for(var n of h6(t))pt.call(t,n)&&pn(e,n,t[n]);return e})({},e),h8({addLink:(e,t)=>{null==r||r.addLink(e,t)},editLink:(e,t,n)=>{null==r||r.editLink(e,t,n)},removeLink:(e,t)=>{null==r||r.removeLink(e,t)}}))),e.set(hz.key,{view:t=>r=new h9(e,t)})}P=new WeakMap,$=new WeakMap,D=new WeakMap,j=new WeakMap,F=new WeakMap,B=new WeakMap,H=new WeakMap,z=new WeakMap,q=new WeakMap,K=new WeakMap,W=new WeakMap,U=new WeakMap,V=new WeakMap,J=new WeakMap;let pu=[hD,hj,hF,hH,hz,hB].flat();var ph=Object.defineProperty,pp=Object.getOwnPropertySymbols,pf=Object.prototype.hasOwnProperty,pm=Object.prototype.propertyIsEnumerable,pg=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pv(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))pf.call(t,n)&&pg(e,n,t[n]);if(pp)for(var n of pp(t))pm.call(t,n)&&pg(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}let py=op({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function pw({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}pv(py,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),aM.h,pw.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let pb=(0,aM.pM)({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:r,readonly:i,setAttr:o,onMount:l,selected:a}){let s=e=>{null!=e&&e instanceof Element&&l(e)},c=e=>{e.stopPropagation(),e.preventDefault(),null!=t.value&&o("checked",!t.value)},d=(0,aM.EW)(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:i.value})),u=(0,aM.EW)(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>(0,aM.h)("li",{class:(0,aX.A)("list-item",a.value&&"ProseMirror-selectednode")},(0,aM.h)("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},(0,aM.h)(pw,{class:(0,aX.A)("label",i.value&&"readonly",u.value),icon:d.value})),(0,aM.h)("div",{class:"children",ref:s}))}}),pk=oh(l0.node,e=>(t,n,r)=>{let i=document.createElement("div");i.className="milkdown-list-item-block";let o=document.createElement("div");o.setAttribute("data-content-dom","true"),o.classList.add("content-dom");let l=(0,aT.KR)(t.attrs.label),a=(0,aT.KR)(t.attrs.checked),s=(0,aT.KR)(t.attrs.listType),c=(0,aT.KR)(!n.editable),d=e.get(py.key),u=(0,aT.KR)(!1),h=(0,aM.nT)(()=>{u.value?i.classList.add("selected"):i.classList.remove("selected")}),p=0,f=aZ(pb,{label:l,checked:a,listType:s,readonly:c,config:d,selected:u,setAttr:(e,t)=>{if(!n.editable)return;let i=r();null!=i&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(i,e,t)))},onMount:e=>{let{anchor:t,head:r}=n.state.selection;e.appendChild(o);let i=n.state.doc.resolve(t),l=n.state.doc.resolve(r);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!i.doc.eq(n.state.doc))return;let e=new ns.U3(i,l);n.dispatch(n.state.tr.setSelection(e))})}});f.mount(i);let m=e=>{s.value=e.attrs.listType,l.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:i,contentDOM:o,update:e=>e.type===t.type&&(!!(e.sameMarkup(g)&&e.content.eq(g.content))||(g=e,m(e),!0)),ignoreMutation:e=>!i||!o||"selection"!==e.type&&(o===e.target&&"attributes"===e.type||!o.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{h(),f.unmount(),i.remove(),o.remove()}}});pv(pk,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});let pC=[py,pk];var px=Object.defineProperty,pS=Object.getOwnPropertySymbols,pM=Object.prototype.hasOwnProperty,pT=Object.prototype.propertyIsEnumerable,pN=(e,t,n)=>t in e?px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pA(e,t){return Object.assign(e,{meta:((e,t)=>{for(var n in t||(t={}))pM.call(t,n)&&pN(e,n,t[n]);if(pS)for(var n of pS(t))pT.call(t,n)&&pN(e,n,t[n]);return e})({package:"@milkdown/components"},t)}),e}var pO=Object.defineProperty,pI=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,p_=Object.prototype.propertyIsEnumerable,pR=(e,t,n)=>t in e?pO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;let pL=op(((e,t)=>{for(var n in t||(t={}))pE.call(t,n)&&pR(e,n,t[n]);if(pI)for(var n of pI(t))p_.call(t,n)&&pR(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function pP({icon:e,class:t,onClick:n}){return(0,aM.h)("span",{class:(0,aX.A)("milkdown-icon",t),onPointerdown:n,innerHTML:e?sU.sanitize(e.trim()):void 0})}function p$(e){let{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:l,rowHandleRef:a}=e,s=t.value;if(!s)return;let c=n.value;if(!c)return;let d=r.value;if(!d)return;let u=d.querySelector("tbody");if(!u)return;let h=s.querySelector("tbody");if(!h)return;let p=i.value;if(!p)return;let f=o.value;if(!f)return;let m=l.value;if(!m)return;let g=a.value;if(g)return{preview:s,wrapper:c,content:d,contentRoot:u,previewRoot:h,yHandle:p,xHandle:f,colHandle:m,rowHandle:g}}function pD(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function pj(e,t,n,r,i){let{width:o,height:l}=r.querySelector("tbody").getBoundingClientRect();if("y"===e){let e=r.querySelectorAll("tr")[i];if(!e)return;n.appendChild(e.cloneNode(!0));let l=e.getBoundingClientRect().height;Object.assign(t.style,{width:`${o}px`,height:`${l}px`}),t.dataset.show="true";return}if("x"===e){let e;Array.from(r.querySelectorAll("tr")).forEach(t=>{let r=t.children[i];if(!r)return;void 0===e&&(e=r.getBoundingClientRect().width);let o=r.parentElement.cloneNode(!1),l=r.cloneNode(!0);o.appendChild(l),n.appendChild(o)}),Object.assign(t.style,{width:`${e}px`,height:`${l}px`}),t.dataset.show="true";return}}function pF(e,t,n,r){let{xHandle:i,yHandle:o,colHandle:l,rowHandle:a,preview:s}=n;i.dataset.displayType="y"===e?"indicator":"none",o.dataset.displayType="x"===e?"indicator":"none","y"===e?(l.dataset.show="false",pH(a)):(a.dataset.show="false",pH(l));let{hoverIndex:c,dragInfo:d}=r,[u,h]=c.value;d.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:h,endIndex:"y"===e?u:h,type:"y"===e?"row":"col"},s.dataset.direction="y"===e?"vertical":"horizontal"}function pB(e,t,n,r){let i=null==n?void 0:n.get(ia);if(!(null==i?void 0:i.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");let o=p$(e);o&&requestAnimationFrame(()=>{r(o)})}function pH(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function pz(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return -1}function pq(e,[t,n]){let r=e.value;if(!r)return;let i=r.querySelectorAll("tr"),o=i[t];if(!o)return;let l=i[0];if(!l)return;let a=l.children[n];if(!a)return;let s=o.children[n];if(s)return{row:o,col:s,headerCol:a}}function pK({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,colHandleRef:o,hoverIndex:l}=e,a=o.value;if(!a)return;l.value=t;let s=pq(i,t);if(!s)return;let{headerCol:c}=s;a.dataset.show="true",n&&n(a),(0,oL.rD)(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function pW({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,rowHandleRef:o,hoverIndex:l}=e,a=o.value;if(!a)return;l.value=t;let s=pq(i,t);if(!s)return;let{row:c}=s;a.dataset.show="true",n&&n(a),(0,oL.rD)(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function pU(e,t,n){let r="x"===n?"left":"top",i="x"===n?"right":"bottom",o=e.length-1,l=e.findIndex((e,n)=>{let l=e.getBoundingClientRect(),a=l[r],s=l[i];return!!(a<=t)&&!!(t<=s)||n===o&&!!(t>s)||0===n&&!!(t<a)}),a=e[l];return a?[a,l]:void 0}pA(pL,{displayName:"Config<table-block>",group:"TableBlock"}),aM.h,pP.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}},aM.h;let pV=(0,aM.pM)({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:r,config:i,onMount:o}){let l=(0,aT.KR)(),a=e=>{null!=e&&(e instanceof HTMLElement?(l.value=e,o(e)):l.value=void 0)},s=(0,aT.KR)(),c=(0,aT.KR)(),d=(0,aT.KR)(),u=(0,aT.KR)(),h=(0,aT.KR)(),p=(0,aT.KR)(),f=(0,aT.KR)([0,0]),m={dragPreviewRef:p,tableWrapperRef:h,contentWrapperRef:l,yLineHandleRef:u,xLineHandleRef:d,colHandleRef:s,rowHandleRef:c,hoverIndex:f,lineHoverIndex:(0,aT.KR)([-1,-1]),dragInfo:(0,aT.KR)()},{pointerLeave:g,pointerMove:v}={pointerMove:oR(t=>{if(!(null==e?void 0:e.editable))return;let{contentWrapperRef:n,yLineHandleRef:r,xLineHandleRef:i,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:s}=m,c=r.value;if(!c)return;let d=i.value;if(!d)return;let u=n.value;if(!u)return;let h=l.value;if(!h)return;let p=o.value;if(!p)return;let f=function(e,t){var n,r,i;if(t)try{let o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return;let l=null==o?void 0:o.inside;if(null==l||l<0)return;let a=t.state.doc.resolve(l),s=t.state.doc.nodeAt(l);if(!s)return;let c=["table_cell","table_header"],d=["table_row","table_header_row"],u=c.includes(s.type.name)?s:null==(n=n0(e=>c.includes(e.type.name))(a))?void 0:n.node,h=null==(r=n0(e=>d.includes(e.type.name))(a))?void 0:r.node,p=null==(i=n0(e=>"table"===e.type.name)(a))?void 0:i.node;if(!u||!h||!p)return;let f=pz(h,u);return[pz(p,h),f]}catch(e){return}}(t,e);if(!f)return;let g=pq(n,f);if(!g)return;let[v,y]=f,w=g.col.getBoundingClientRect(),b=8>Math.abs(t.clientX-w.left),k=8>Math.abs(w.right-t.clientX),C=8>Math.abs(t.clientY-w.top),x=8>Math.abs(w.bottom-t.clientY),S=h.querySelector(".button-group"),M=p.querySelector(".button-group");if(S&&(S.dataset.show="false"),M&&(M.dataset.show="false"),b||k||C||x){let e=u.getBoundingClientRect();h.dataset.show="false",p.dataset.show="false",d.dataset.displayType="tool",c.dataset.displayType="tool";let t=c.getBoundingClientRect().width,n=d.getBoundingClientRect().height;b||k?(s.value[1]=b?y:y+1,(0,oL.rD)(g.col,c,{placement:b?"left":"right",middleware:[(0,oL.cY)(b?-1*t:0)]}).then(({x:t})=>{c.dataset.show="true",Object.assign(c.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):c.dataset.show="false",0!==f[0]&&(C||x)?(s.value[0]=C?v:v+1,(0,oL.rD)(g.row,d,{placement:C?"top":"bottom",middleware:[(0,oL.cY)(C?-1*n:0)]}).then(({y:t})=>{d.dataset.show="true",Object.assign(d.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):d.dataset.show="false";return}s.value=[-1,-1],c.dataset.show="false",d.dataset.show="false",h.dataset.show="true",p.dataset.show="true",pW({refs:m,index:f}),pK({refs:m,index:f}),a.value=f},20),pointerLeave:()=>{let{rowHandleRef:e,colHandleRef:t,yLineHandleRef:n,xLineHandleRef:r}=m;setTimeout(()=>{let i=e.value;if(!i)return;let o=t.value;if(!o)return;let l=n.value;if(!l)return;let a=r.value;a&&(i.dataset.show="false",o.dataset.show="false",l.dataset.show="false",a.dataset.show="false")},200)}},{dragRow:y,dragCol:w}=function(e,t,n){let{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:o,dragInfo:l}=e,a=n=>{pB(e,n,t,t=>{pF("y",n,t,e);let{preview:r,content:i,previewRoot:o}=t;pD(o);let{hoverIndex:l}=e,[a]=l.value;pj("y",r,o,i,a)})},s=n=>{pB(e,n,t,t=>{pF("x",n,t,e);let{preview:r,content:i,previewRoot:o}=t,{hoverIndex:l}=e,[a,s]=l.value;pD(o),pj("x",r,o,i,s)})},c=()=>{let e=r.value;if(!e||"false"===e.dataset.show)return;let t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},d=()=>{var a;let s=r.value;if(!s)return;let c=i.value;if(!c)return;let d=o.value;if(!d)return;let u=l.value;if(!u||!t||"false"===s.dataset.show||!e.colHandleRef.value||!e.rowHandleRef.value||(c.dataset.show="false",d.dataset.show="false",u.startIndex===u.endIndex))return;let h=t.get(iO),p={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};"col"===u.type?(h.call(dB.key,{pos:p.pos,index:u.startIndex}),h.call(dj.key,p),pK({refs:e,index:[0,u.endIndex]})):(h.call(dF.key,{pos:p.pos,index:u.startIndex}),h.call(dD.key,p),pW({refs:e,index:[u.endIndex,0]})),requestAnimationFrame(()=>{t.get(ia).focus()})},u=oR(t=>{let n=p$(e);if(!n)return;let{preview:r,content:i,contentRoot:o,xHandle:l,yHandle:a}=n,{dragInfo:s,hoverIndex:c}=e;if("false"===r.dataset.show)return;let d=pq(e.contentWrapperRef,c.value);if(!d||!o.querySelector("tr"))return;let u=s.value;if(!u||!o.offsetParent)return;let h=o.offsetParent.offsetTop,p=o.offsetParent.offsetLeft;if("col"===u.type){let e=d.col.getBoundingClientRect().width,{left:n,width:l}=o.getBoundingClientRect(),s=p-n,c=t.clientX+s-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";r.style.top=`${h}px`;let g=c<n+s-20?n+s-20:c>n+l+s-e+20?n+l+s-e+20:c;r.style.left=`${g}px`;let v=function(e,t){let n=e.querySelector("tr");if(n)return pU(Array.from(n.children),t,"x")}(o,t.clientX);if(v){let[e,t]=v,n=a.getBoundingClientRect().width,r=i.getBoundingClientRect();u.endIndex=t,(0,oL.rD)(e,a,{placement:"left"===m?"left":"right",middleware:[(0,oL.cY)("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${r.height}px`,left:`${e}px`,top:`${h}px`})}).catch(console.error)}}else if("row"===u.type){var f;let e=d.row.getBoundingClientRect().height,{top:n,height:a}=o.getBoundingClientRect(),s=h-n,c=t.clientY+s-e/2,[m,g]=u.startCoords,v=g<t.clientY?"down":"up",y=c<n+s-20?n+s-20:c>n+a+s-e+20?n+a+s-e+20:c;r.style.top=`${y}px`,r.style.left=`${p}px`;let w=(f=t.clientY,pU(Array.from(o.querySelectorAll("tr")),f,"y"));if(w){let[e,t]=w,n=l.getBoundingClientRect().height,r=i.getBoundingClientRect();u.endIndex=t,(0,oL.rD)(e,l,{placement:"up"===v?"top":"bottom",middleware:[(0,oL.cY)("up"===v?-1*n:0)]}).then(({y:e})=>{l.dataset.show="true",Object.assign(l.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20);return(0,aM.sV)(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",d)}),(0,aM.hi)(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",d)}),{dragRow:a,dragCol:s}}(m,n,r),{onAddRow:b,onAddCol:k,selectCol:C,selectRow:x,deleteSelected:S,onAlign:M}=function(e,t,n){let{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:s}=e;return{onAddRow:()=>{var e,o,l;if(!t)return;let a=r.value;if(!a)return;let[c]=s.value;if(c<0||!t.get(ia).editable)return;let d=Array.from(null!=(o=null==(e=i.value)?void 0:e.querySelectorAll("tr"))?o:[]),u=t.get(iO),h=(null!=(l=null==n?void 0:n())?l:0)+1;d.length===c?(u.call(dF.key,{pos:h,index:c-1}),u.call(dU.key)):(u.call(dF.key,{pos:h,index:c}),u.call(dW.key)),u.call(dF.key,{pos:h,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,o,l,a;if(!t||!r.value)return;let[c,d]=s.value;if(d<0||!t.get(ia).editable)return;let u=Array.from(null!=(l=null==(o=null==(e=i.value)?void 0:e.querySelector("tr"))?void 0:o.children)?l:[]),h=t.get(iO),p=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===d?(h.call(dB.key,{pos:p,index:d-1}),h.call(dK.key)):(h.call(dB.key,{pos:p,index:d}),h.call(dq.key)),h.call(dB.key,{pos:p,index:d})},selectCol:()=>{var e,r;if(!t)return;let[i,l]=a.value,s=t.get(iO),c=(null!=(e=null==n?void 0:n())?e:0)+1;s.call(dB.key,{pos:c,index:l});let d=null==(r=o.value)?void 0:r.querySelector(".button-group");d&&(d.dataset.show="true"===d.dataset.show?"false":"true")},selectRow:()=>{var e,r;if(!t)return;let[i,o]=a.value,s=t.get(iO),c=(null!=(e=null==n?void 0:n())?e:0)+1;s.call(dF.key,{pos:c,index:i});let d=null==(r=l.value)?void 0:r.querySelector(".button-group");d&&i>0&&(d.dataset.show="true"===d.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(ia).editable&&(e.preventDefault(),e.stopPropagation(),t.get(iO).call(dz.key),requestAnimationFrame(()=>{t.get(ia).focus()}))},onAlign:e=>n=>{t&&t.get(ia).editable&&(n.preventDefault(),n.stopPropagation(),t.get(iO).call(dV.key,e),requestAnimationFrame(()=>{t.get(ia).focus()}))}}}(m,n,r);return(0,aM.sV)(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n||!t)return;let{selection:r}=t.state;if(!(r instanceof cM))return;let{$from:i}=r,o=c_(i);if(o&&o.node===n){if(r.isColSelection()){let{$head:t}=r;pK({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}});return}if(r.isRowSelection()){let{$head:t}=r,n=n0(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;let i=pz(o.node,n.node);pW({refs:e,index:[i,0],before:e=>{var t;i>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}}(m,e,t.value)})}),()=>(0,aM.h)("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:v,onPointerleave:g},(0,aM.h)("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:w,onClick:C,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:s},(0,aM.h)(pP,{icon:i.renderButton("col_drag_handle")}),(0,aM.h)("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},(0,aM.h)("button",{type:"button",onPointerdown:M("left")},(0,aM.h)(pP,{icon:i.renderButton("align_col_left")})),(0,aM.h)("button",{type:"button",onPointerdown:M("center")},(0,aM.h)(pP,{icon:i.renderButton("align_col_center")})),(0,aM.h)("button",{type:"button",onPointerdown:M("right")},(0,aM.h)(pP,{icon:i.renderButton("align_col_right")})),(0,aM.h)("button",{type:"button",onPointerdown:S},(0,aM.h)(pP,{icon:i.renderButton("delete_col")})))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:y,onClick:x,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},(0,aM.h)(pP,{icon:i.renderButton("row_drag_handle")}),(0,aM.h)("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},(0,aM.h)("button",{type:"button",onPointerdown:S},(0,aM.h)(pP,{icon:i.renderButton("delete_row")})))),(0,aM.h)("div",{class:"table-wrapper",ref:h},(0,aM.h)("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},(0,aM.h)("table",null,(0,aM.h)("tbody",null))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:d},(0,aM.h)("button",{type:"button",onClick:b,class:"add-button"},(0,aM.h)(pP,{icon:i.renderButton("add_row")}))),(0,aM.h)("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},(0,aM.h)("button",{type:"button",onClick:k,class:"add-button"},(0,aM.h)(pP,{icon:i.renderButton("add_col")}))),(0,aM.h)("table",{ref:a,class:"children"})))}});var pJ=e=>{throw TypeError(e)};class pG{constructor(e,t,n,r){this.ctx=e,this.node=t,this.view=n,this.getPos=r,((e,t,n)=>t.has(e)?pJ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n))(this,G);const i=document.createElement("div");i.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=(0,aT.IJ)(t);const l=aZ(pV,{view:n,ctx:e,getPos:r,config:e.get(pL.key),onMount:e=>{e.appendChild(o)},node:this.nodeRef});l.mount(i),this.app=l,this.dom=i}update(e){return!(e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){if(e.target instanceof Element&&e.target.closest("button"))return!0;let r=e.target;if(r instanceof HTMLElement&&(r.closest("th")||r.closest("td"))){var t,n;return(t=G,n=Z,t.has(this)||pJ("Cannot access private method"),n).call(this,e)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}G=new WeakSet,Z=function(e){let t=this.view;if(!t.editable)return!1;let{state:n,dispatch:r}=t,i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return!1;let o=n.doc.resolve(i.inside),l=n0(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(o);if(!l)return!1;if(n.selection instanceof ns.U3){let e=n0(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===l.node)return!1}let{from:a}=l,s=ns.nh.create(n.doc,a+1);return!n.selection.eq(s)&&(n.selection instanceof cM?setTimeout(()=>{r(n.tr.setSelection(s).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(s).scrollIntoView())}),!0)};let pZ=oh(dx.node,e=>(t,n,r)=>new pG(e,t,n,r));pA(pZ,{displayName:"NodeView<table-block>",group:"TableBlock"});let pY=[pL,pZ];function pX(e,t){let n=function(e){if(1===e.content.childCount){let t=e.content.firstChild;if((null==t?void 0:t.type.name)==="text"&&0===t.marks.length)return t;if((null==t?void 0:t.type.name)==="paragraph"&&1===t.childCount){let e=t.firstChild;if((null==e?void 0:e.type.name)==="text"&&0===e.marks.length)return e}}return!1}(t);if(n)return e.dispatch(e.state.tr.replaceSelectionWith(n,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(t)),!0}catch{return!1}}var pQ=od(e=>{let t=e.get(ix);return e.update(i7,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{let r=e.transformPastedHTML;return r&&(t=r(t,n)),t.includes("docs-internal-guid")&&(t=(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1")).replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),t}})),new ns.k_({key:new ns.hs("MILKDOWN_CLIPBOARD"),props:{handlePaste:(n,r,i)=>{let o,l=e.get(iB),a=n.props.editable?.(n.state),{clipboardData:s}=r;if(!a||!s||n.state.selection.$from.node().type.spec.code)return!1;let c=s.getData("text/plain"),d=s.getData("vscode-editor-data");if(d){let e=JSON.parse(d)?.mode;if(c&&e){let{tr:r}=n.state,i=function(e,t){let n=t.nodes[e];if(!n)throw new nm(nf.getAtomFromSchemaFail,`Cannot get node: ${e} from schema.`);return n}("code_block",t);return r.replaceSelectionWith(i.create({language:e})).setSelection(ns.U3.near(r.doc.resolve(Math.max(0,r.selection.from-2)))).insertText(c.replace(/\r\n?/g,"\n")),n.dispatch(r),!0}}let u=s.getData("text/html");if(0===u.length&&0===c.length)return!1;if(u.length>0&&i)return pX(n,i);let h=rE.S4.fromSchema(t);if(0===u.length){let e=l(c);if(!e||"string"==typeof e)return!1;o=rE.ZF.fromSchema(t).serializeFragment(e.content)}else{let e=document.createElement("template");e.innerHTML=u,o=e.content.cloneNode(!0),e.remove()}return pX(n,h.parseSlice(o))},clipboardTextSerializer:n=>{let r=e.get(iU);if(function e(t){if(!t)return!1;if(Array.isArray(t))return!(t.length>1)&&e(t[0]);let n=t.content;return n?e(n):"text"===t.type}(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");let i=t.topNodeType.createAndFill(void 0,n.content);return i?r(i):""}}})});function p1(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}Object.assign(pQ,{meta:{package:"@milkdown/plugin-clipboard",displayName:"Prose<clipboard>"}});var p0=ol("Undo",()=>()=>ux);p1(p0,{displayName:"Command<undo>"});var p2=ol("Redo",()=>()=>uS);p1(p2,{displayName:"Command<redo>"});var p5=op({},"historyProviderConfig");p1(p5,{displayName:"Ctx<historyProviderConfig>"});var p3=od(e=>(function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ns.k_({key:ub,state:{init:()=>new up(uu.empty,uu.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(ub),o;if(i)return i.historyState;n.getMeta(uk)&&(e=new up(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(l&&l.getMeta(ub))if(l.getMeta(ub).redo)return new up(e.done.addTransform(n,void 0,r,uw(t)),e.undone,um(n.mapping.maps),e.prevTime,e.prevComposition);else return new up(e.done,e.undone.addTransform(n,void 0,r,uw(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||l&&!1===l.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new up(e.done.rebased(n,o),e.undone.rebased(n,o),ug(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new up(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),ug(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!l&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=l?ug(e.prevRanges,n.mapping):um(n.mapping.maps);return new up(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,uw(t)),uu.empty,a,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?ux:"historyRedo"==n?uS:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})})(e.get(p5.key)));p1(p3,{displayName:"Ctx<historyProviderPlugin>"});var p9=og("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{let t=e.get(iO);return()=>t.call(p0.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{let t=e.get(iO);return()=>t.call(p2.key)}}});p1(p9.ctx,{displayName:"KeymapCtx<history>"}),p1(p9.shortcuts,{displayName:"Keymap<history>"});var p7=[p5,p3,p9,p0,p2].flat(),p4=op({type:"space",size:2},"indentConfig");p4.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var p8=ou(e=>({Tab:(t,n)=>{let r=e.get(p4.key),{tr:i}=t,o=function(e,t){let{doc:n,selection:r}=e;if(!n||!r||!(r instanceof ns.U3||r instanceof ns.i5))return e;let{to:i}=r,o="space"===t.type?Array(t.size).fill(" ").join(""):" ";return e.insertText(o,i)}(i,r);return!!o.docChanged&&(n?.(o),!0)}}));p8.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var p6=[p4,p8],fe=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},ft=n4(new fe,"listener"),fn=new ns.hs("MILKDOWN_LISTENER"),fr=e=>(e.inject(ft,new fe),async()=>{await e.wait(ib);let{listeners:t}=e.get(ft);t.beforeMount.forEach(t=>t(e)),await e.wait(iq);let n=e.get(iU),r=null,i=null,o=null,l=null,a=o_(()=>{if(!l)return;let{doc:o}=l;if(t.updated.length>0&&r&&!r.eq(o)&&t.updated.forEach(t=>{t(e,o,r)}),t.markdownUpdated.length>0&&r&&!r.eq(o)){let r=n(o);t.markdownUpdated.forEach(t=>{t(e,r,i)}),i=r}r=o,l=null},200),s=new ns.k_({key:fn,view:()=>({destroy:()=>{t.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(t=>t(e)),!1),blur:()=>(t.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{r=t.doc,i=n(t.doc)},apply:n=>{let r=n.selection;(!o&&r||o&&!r.eq(o))&&(t.selectionUpdated.forEach(t=>{t(e,r,o)}),o=r),(n.docChanged||n.storedMarksSet)&&!1!==n.getMeta("addToHistory")&&(l=n,a())}}});e.update(ih,e=>e.concat(s)),await e.wait(i3),t.mounted.forEach(t=>t(e))});fr.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var fi=op({shouldAppend:e=>!(!e||["heading","paragraph"].includes(e.type.name)),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");fi.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var fo=od(e=>{let t=new ns.hs("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=e.get(fi.key),i=new ns.k_({key:t,state:{init:(e,t)=>n(t.tr.doc.lastChild,t),apply:(e,t,r,i)=>e.docChanged?n(e.doc.lastChild,i):t},appendTransaction:(e,t,n)=>{let{doc:o,tr:l}=n,a=r?.(n),s=i.getState(n),c=o.content.size;if(s&&a)return l.insert(c,a)}});return i});fo.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var fl=[fi,fo],fa=op({uploader:async(e,t)=>{let n=[];for(let t=0;t<e.length;t++){let r=e.item(t);r&&r.type.includes("image")&&n.push(r)}let{image:r}=t.nodes;if(!r)throw nk("image");return(await Promise.all(n.map(e=>new Promise(t=>{let n=new FileReader;n.addEventListener("load",()=>{t({alt:e.name,src:n.result})},!1),n.readAsDataURL(e)})))).map(({alt:e,src:t})=>r.createAndFill({src:t,alt:e}))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{let n=document.createElement("span");return n.textContent="Upload in progress...",ii.NZ.widget(e,n,t)}},"uploadConfig");fa.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var fs=od(e=>{let t=new ns.hs("MILKDOWN_UPLOAD"),n=(n,r,i)=>{if(!i||i.length<=0)return!1;let o=Symbol("upload symbol"),l=e.get(ix),{uploader:a,getInsertPos:s}=e.get(fa.key),{tr:c}=n.state,d=r instanceof DragEvent?n.posAtCoords({left:r.clientX,top:r.clientY})?.pos??c.selection.from:c.selection.from,u="function"==typeof s?s(r,e,d):d;return n.dispatch(c.setMeta(t,{add:{id:o,pos:u}})),a(i,l,e,u).then(e=>{let r=((e,n)=>{let r=t.getState(e);if(!r)return -1;let i=r.find(void 0,void 0,e=>e.id===n);return i.length?i[0]?.from??-1:-1})(n.state,o);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:o}}))}).catch(e=>{console.error(e)}),!0};return new ns.k_({key:t,state:{init:()=>ii.zF.empty,apply(t,n){let r=n.map(t.mapping,t.doc),i=t.getMeta(this);if(!i)return r;if(i.add){let{uploadWidgetFactory:n}=e.get(fa.key),o=n(i.add.pos,{id:i.add.id});return r.add(t.doc,[o])}if(i.remove){let e=r.find(void 0,void 0,e=>e.id===i.remove.id);return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{let{enableHtmlFileUploader:i}=e.get(fa.key);return!(!(r instanceof ClipboardEvent)||!i&&r.clipboardData?.getData("text/html"))&&n(t,r,r.clipboardData?.files)},handleDrop:(e,t)=>t instanceof DragEvent&&n(e,t,t.dataTransfer?.files)}})});fs.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var fc=[fa,fs],fd=((S=fd||{}).CodeMirror="code-mirror",S.ListItem="list-item",S.LinkTooltip="link-tooltip",S.Cursor="cursor",S.ImageBlock="image-block",S.BlockEdit="block-edit",S.Toolbar="toolbar",S.Placeholder="placeholder",S.Table="table",S.Latex="latex",S.TopBar="top-bar",S);let fu={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1},fh=`
2
2
  <svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  width="24"