wiki-viewer 2.6.2 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/standalone/.next/server/app/api/agent/activity/route.js +7 -7
  23. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js +5 -5
  25. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js +5 -5
  27. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js +3 -3
  29. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js +5 -5
  31. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js +5 -5
  33. package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +6 -6
  35. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +8 -8
  37. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +6 -6
  39. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +7 -7
  41. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +7 -7
  43. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +7 -7
  45. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +5 -5
  47. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/agent/settings/route.js +8 -8
  49. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +6 -6
  51. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +1 -1
  53. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js +6 -6
  55. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js +3 -3
  57. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/pdf/save/route.js +5 -5
  59. package/.next/standalone/.next/server/app/api/pdf/save/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/api/share/[token]/asset/route/app-paths-manifest.json +3 -0
  61. package/.next/standalone/.next/server/app/api/share/[token]/asset/route/build-manifest.json +9 -0
  62. package/.next/standalone/.next/server/app/api/share/[token]/asset/route/server-reference-manifest.json +4 -0
  63. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js +9 -0
  64. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js.map +5 -0
  65. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js.nft.json +1 -0
  66. package/.next/standalone/.next/server/app/api/share/[token]/asset/route_client-reference-manifest.js +3 -0
  67. package/.next/standalone/.next/server/app/api/share/[token]/route.js +5 -5
  68. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/share/route.js +5 -5
  70. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/system/admins/route.js +4 -4
  72. package/.next/standalone/.next/server/app/api/system/admins/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/system/auth-config/route.js +6 -6
  74. package/.next/standalone/.next/server/app/api/system/auth-config/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/system/auth-settings/route.js +4 -4
  76. package/.next/standalone/.next/server/app/api/system/auth-settings/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/system/browse/route.js +4 -4
  78. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/system/clear-root/route.js +4 -4
  80. package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/system/config/route.js +6 -6
  82. package/.next/standalone/.next/server/app/api/system/config/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/system/pins/route.js +4 -4
  84. package/.next/standalone/.next/server/app/api/system/pins/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/system/reveal/route.js +5 -5
  86. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/system/root-status/route.js +4 -4
  88. package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/system/set-root/route.js +6 -6
  90. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/system/users/route.js +5 -5
  92. package/.next/standalone/.next/server/app/api/system/users/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/branch/route.js +4 -4
  94. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/branch/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +6 -6
  96. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js +4 -4
  98. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +6 -6
  100. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/system/workspaces/route.js +4 -4
  102. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +6 -6
  104. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/wiki/app/route.js +8 -8
  106. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js +8 -8
  108. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/wiki/content/route.js +6 -6
  110. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  111. package/.next/standalone/.next/server/app/api/wiki/download/route.js +8 -8
  112. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  113. package/.next/standalone/.next/server/app/api/wiki/file/route.js +6 -6
  114. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/api/wiki/folder/route.js +7 -7
  116. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  117. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js +6 -6
  118. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  119. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js +4 -4
  120. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  121. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js +6 -6
  122. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js +6 -6
  124. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js +6 -6
  126. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  127. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js +6 -6
  128. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  129. package/.next/standalone/.next/server/app/api/wiki/move/route.js +5 -5
  130. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  131. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +5 -5
  132. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  133. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js +8 -8
  134. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/wiki/page/route.js +5 -5
  136. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/wiki/presence/route.js +6 -6
  138. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  139. package/.next/standalone/.next/server/app/api/wiki/route.js +6 -6
  140. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/wiki/search/route.js +8 -8
  142. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +6 -6
  144. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  145. package/.next/standalone/.next/server/app/api/wiki/upload/route.js +5 -5
  146. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  147. package/.next/standalone/.next/server/app/api/wiki/watch/route.js +5 -5
  148. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  149. package/.next/standalone/.next/server/app/index.html +1 -1
  150. package/.next/standalone/.next/server/app/index.rsc +3 -3
  151. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  152. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  153. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  154. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  155. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  156. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  157. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  159. package/.next/standalone/.next/server/app/s/[token]/page.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  162. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  163. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0zv_j05._.js → [root-of-the-server]__0-mos44._.js} +2 -2
  164. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0nmx3k2._.js → [root-of-the-server]__00xq4wx._.js} +2 -2
  165. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ovhccp._.js → [root-of-the-server]__038~~rd._.js} +2 -2
  166. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~rntxj._.js → [root-of-the-server]__04jklyx._.js} +2 -2
  167. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0nzlmkb._.js → [root-of-the-server]__04z5.s-._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0a6j6r4._.js → [root-of-the-server]__04~bqmd._.js} +2 -2
  169. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05jd.5~._.js +3 -0
  170. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ajw6de._.js → [root-of-the-server]__05~-fkm._.js} +2 -2
  171. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0esmskc._.js → [root-of-the-server]__06s802c._.js} +2 -2
  172. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0na11h0._.js → [root-of-the-server]__08-0m4o._.js} +4 -4
  173. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0s_8poz._.js → [root-of-the-server]__08mb7mf._.js} +2 -2
  174. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__000spch._.js → [root-of-the-server]__096dpr1._.js} +2 -2
  175. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09i-r6q._.js +12 -0
  176. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0n9zdf0._.js → [root-of-the-server]__0a_c5s5._.js} +2 -2
  177. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0as-u6z._.js → [root-of-the-server]__0asy5fk._.js} +2 -2
  178. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0l-wu5u._.js → [root-of-the-server]__0bikav1._.js} +2 -2
  179. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0fshk._._.js → [root-of-the-server]__0cynf.m._.js} +2 -2
  180. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0yat~ul._.js → [root-of-the-server]__0dyghs~._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0w~__xz._.js → [root-of-the-server]__0ej__9l._.js} +2 -2
  182. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0wfv_by._.js → [root-of-the-server]__0f-y9ak._.js} +2 -2
  183. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0oruwos._.js → [root-of-the-server]__0j456kt._.js} +2 -2
  184. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0zbkgnr._.js → [root-of-the-server]__0kgev~0._.js} +2 -2
  185. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0km~c.f._.js +3 -0
  186. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0.-oq-7._.js → [root-of-the-server]__0le9en3._.js} +2 -2
  187. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lvz22t._.js +1 -1
  188. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0uibxf_._.js → [root-of-the-server]__0lwoa8u._.js} +2 -2
  189. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-jzw2_._.js → [root-of-the-server]__0ocu5kq._.js} +2 -2
  190. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0fu72o7._.js → [root-of-the-server]__0omu2ls._.js} +2 -2
  191. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__09t4v4r._.js → [root-of-the-server]__0ou1yo3._.js} +2 -2
  192. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0u81k~2._.js → [root-of-the-server]__0qe_pj_._.js} +2 -2
  193. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0wlj-yw._.js → [root-of-the-server]__0snmvie._.js} +2 -2
  194. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__06booxp._.js → [root-of-the-server]__0sqf51n._.js} +2 -2
  195. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0vxex1w._.js → [root-of-the-server]__0syhzuy._.js} +2 -2
  196. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__024967n._.js → [root-of-the-server]__0xblgqt._.js} +2 -2
  197. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0s38pid._.js → [root-of-the-server]__0xzvkcg._.js} +2 -2
  198. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0z3wg9x._.js → [root-of-the-server]__0y6a-84._.js} +4 -4
  199. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ywviax._.js +20 -0
  200. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__071_pmz._.js → [root-of-the-server]__0~1k.~a._.js} +2 -2
  201. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0bvtbax._.js → [root-of-the-server]__0~dajlm._.js} +2 -2
  202. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0sggstu._.js → [root-of-the-server]__0~oj7j3._.js} +2 -2
  203. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0e_9pc5._.js → [root-of-the-server]__0~yn~7e._.js} +2 -2
  204. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0c-ee48._.js → [root-of-the-server]__10l3owp._.js} +2 -2
  205. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0o0v6hf._.js → [root-of-the-server]__10ljgl.._.js} +2 -2
  206. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0_1f2cw._.js → [root-of-the-server]__10~3r6l._.js} +2 -2
  207. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__01qcera._.js → [root-of-the-server]__11akjkm._.js} +2 -2
  208. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0aoqat-._.js → [root-of-the-server]__11fcf05._.js} +2 -2
  209. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__02.uul~._.js → [root-of-the-server]__13f0ukk._.js} +2 -2
  210. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0_0bqpg._.js → [root-of-the-server]__13hpe9q._.js} +2 -2
  211. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_share_[token]_asset_route_actions_0mxwvof.js +3 -0
  212. package/.next/standalone/.next/server/chunks/src_lib_auth_server_ts_00f4e0h._.js +452 -0
  213. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_0awdhzw._.js → 0~w0_katex_dist_katex_mjs_1115d6v._.js} +1 -1
  214. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.j71x7._.js +3 -0
  215. package/.next/standalone/.next/server/chunks/ssr/{_0sxeqi8._.js → _03xt0rl._.js} +2 -2
  216. package/.next/standalone/.next/server/chunks/ssr/{_0kcfv3r._.js → _0i3r51-._.js} +2 -2
  217. package/.next/standalone/.next/server/chunks/ssr/_0v4uz-4._.js +3 -3
  218. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0_zq~v6._.js → node_modules__pnpm_0-gfnl9._.js} +1 -1
  219. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0cy5ftq._.js → node_modules__pnpm_0.41jpn._.js} +2 -2
  220. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~5s0h-._.js → node_modules__pnpm_00mt6nh._.js} +1 -1
  221. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01uc1hl._.js → node_modules__pnpm_06za8g0._.js} +1 -1
  222. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t16czj._.js → node_modules__pnpm_0752tb8._.js} +1 -1
  223. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0jywdw0._.js → node_modules__pnpm_08.egvu._.js} +1 -1
  224. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w~3li6._.js → node_modules__pnpm_0a5jwqo._.js} +1 -1
  225. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~xns8v._.js → node_modules__pnpm_0c-_96g._.js} +1 -1
  226. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w3.bto._.js → node_modules__pnpm_0cxeac7._.js} +1 -1
  227. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11-1cme._.js → node_modules__pnpm_0do9l33._.js} +1 -1
  228. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0h8t6~c._.js → node_modules__pnpm_0go8~j7._.js} +1 -1
  229. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_02vvjkq._.js → node_modules__pnpm_0h~ckqb._.js} +1 -1
  230. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~l___j._.js → node_modules__pnpm_0knclqg._.js} +2 -2
  231. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04hymjt._.js → node_modules__pnpm_0lne~4i._.js} +2 -2
  232. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c5xt34._.js → node_modules__pnpm_0mrjai_._.js} +1 -1
  233. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0abi.df._.js → node_modules__pnpm_0mx7wsr._.js} +1 -1
  234. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0u3p3__._.js → node_modules__pnpm_0oi2w2s._.js} +1 -1
  235. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_131u09o._.js → node_modules__pnpm_0qiaujf._.js} +1 -1
  236. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_10y-1uw._.js → node_modules__pnpm_0r529m.._.js} +1 -1
  237. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0zt6ord._.js → node_modules__pnpm_0s8-kbr._.js} +2 -2
  238. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0j2ck16._.js → node_modules__pnpm_0uvds62._.js} +1 -1
  239. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bwtedy._.js → node_modules__pnpm_0w7.zt6._.js} +1 -1
  240. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13kfm1k._.js → node_modules__pnpm_0z5ch94._.js} +2 -2
  241. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0of-lo7._.js → node_modules__pnpm_0zya776._.js} +1 -1
  242. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_05py9u6._.js → node_modules__pnpm_10qgn1p._.js} +1 -1
  243. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ve~5~d._.js → node_modules__pnpm_113-u.n._.js} +2 -2
  244. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0g7aqxf._.js → node_modules__pnpm_12v.ysz._.js} +2 -2
  245. package/.next/standalone/.next/server/chunks/ssr/src_app_s_[token]_page_tsx_0_fzrmd._.js +3 -0
  246. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  247. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  248. package/.next/standalone/.next/server/pages/404.html +1 -1
  249. package/.next/standalone/.next/server/pages/500.html +1 -1
  250. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  251. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  252. package/.next/standalone/.next/static/chunks/{0on-0-cxvzy-7.js → 0-.cn_ir_n9jf.js} +1 -1
  253. package/.next/standalone/.next/static/chunks/{0alhqgtsl8w~~.js → 0jgcnboih8.w8.js} +1 -1
  254. package/.next/standalone/.next/static/chunks/0pd5k_eu2n6lx.js +17 -0
  255. package/.next/standalone/.next/static/chunks/{10~nefki4aqgv.js → 0pfnisq~g.lxv.js} +1 -1
  256. package/.next/standalone/.next/static/chunks/0pw6gfeuvlhiu.css +5 -0
  257. package/.next/standalone/.next/static/chunks/{0~m~l6t.25dxo.js → 10n.a147w._5n.js} +1 -1
  258. package/.next/standalone/.next/static/chunks/11_s27j_.g~44.js +1 -0
  259. package/.next/standalone/package.json +1 -1
  260. package/package.json +1 -1
  261. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08n~vj1._.js +0 -12
  262. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0m6r9ip._.js +0 -3
  263. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sfrx~.._.js +0 -3
  264. package/.next/standalone/.next/server/chunks/_0dr1r1g._.js +0 -452
  265. package/.next/standalone/.next/server/chunks/_101exke._.js +0 -452
  266. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w2ebbx._.js +0 -3
  267. package/.next/standalone/.next/static/chunks/0.g_p6_b0v2sp.js +0 -1
  268. package/.next/standalone/.next/static/chunks/0ncw5hhg~98~p.css +0 -5
  269. package/.next/standalone/.next/static/chunks/11c7-ic7.2nku.js +0 -17
  270. /package/.next/standalone/.next/static/{67H1xYhtLYoTKKFA6Djps → JXxkzDy909cpBo90OOfiL}/_buildManifest.js +0 -0
  271. /package/.next/standalone/.next/static/{67H1xYhtLYoTKKFA6Djps → JXxkzDy909cpBo90OOfiL}/_clientMiddlewareManifest.js +0 -0
  272. /package/.next/standalone/.next/static/{67H1xYhtLYoTKKFA6Djps → JXxkzDy909cpBo90OOfiL}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,425732,e=>{"use strict";let t=(0,e.i(605993).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],425732)},301138,e=>{"use strict";let t=(0,e.i(605993).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",0,t],301138)},567776,e=>{"use strict";let t=(0,e.i(605993).default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);e.s(["Lock",0,t],567776)},764143,e=>{"use strict";let t=(0,e.i(605993).default)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,t],764143)},391548,e=>{"use strict";let t=(0,e.i(605993).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],391548)},43240,367092,e=>{"use strict";var t=e.i(605993);let n=(0,t.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,n],43240);let r=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,r],367092)},702166,e=>{"use strict";let t=(0,e.i(605993).default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);e.s(["Link",0,t],702166)},793479,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,type:n,...i},o)=>(0,t.jsx)("input",{type:n,className:(0,r.cn)("flex h-9 w-full rounded-sm border border-input bg-secondary px-3 py-1 text-sm shadow-e-1 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-normal placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...i}));i.displayName="Input",e.s(["Input",0,i])},515288,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("rounded-md border border-border bg-card text-card-foreground shadow-e-2",e),...n}));i.displayName="Card",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",e),...n})).displayName="CardHeader",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-lg font-normal leading-none tracking-tight",e),...n})).displayName="CardTitle",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-sm text-muted-foreground",e),...n})).displayName="CardDescription",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("p-6 pt-0",e),...n})).displayName="CardContent",e.s(["Card",0,i])},291967,543250,672687,e=>{"use strict";"u">typeof window&&window.document&&window.document.createElement,e.s(["composeEventHandlers",0,function(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}],291967);var t=e.i(101685),n=e.i(44501);e.s(["createContext",0,function(e,r){let i=t.createContext(r),o=e=>{let{children:r,...o}=e,s=t.useMemo(()=>o,Object.values(o));return(0,n.jsx)(i.Provider,{value:s,children:r})};return o.displayName=e+"Provider",[o,function(n){let o=t.useContext(i);if(o)return o;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${e}\``)}]},"createContextScope",0,function(e,r=[]){let i=[],o=()=>{let n=i.map(e=>t.createContext(e));return function(r){let i=r?.[e]||n;return t.useMemo(()=>({[`__scope${e}`]:{...r,[e]:i}}),[r,i])}};return o.scopeName=e,[function(r,o){let s=t.createContext(o),a=i.length;i=[...i,o];let l=r=>{let{scope:i,children:o,...l}=r,c=i?.[e]?.[a]||s,d=t.useMemo(()=>l,Object.values(l));return(0,n.jsx)(c.Provider,{value:d,children:o})};return l.displayName=r+"Provider",[l,function(n,i){let l=i?.[e]?.[a]||s,c=t.useContext(l);if(c)return c;if(void 0!==o)return o;throw Error(`\`${n}\` must be used within \`${r}\``)}]},function(...e){let n=e[0];if(1===e.length)return n;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=r.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return t.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return r.scopeName=n.scopeName,r}(o,...r)]}],543250);var r=globalThis?.document?t.useLayoutEffect:()=>{};e.s(["useLayoutEffect",0,r],672687)},417256,652053,980939,e=>{"use strict";var t=e.i(101685),n=e.i(672687);t[" useEffectEvent ".trim().toString()],t[" useInsertionEffect ".trim().toString()];var r=t[" useInsertionEffect ".trim().toString()]||n.useLayoutEffect;Symbol("RADIX:SYNC_STATE"),e.s(["useControllableState",0,function({prop:e,defaultProp:n,onChange:i=()=>{},caller:o}){let[s,a,l]=function({defaultProp:e,onChange:n}){let[i,o]=t.useState(e),s=t.useRef(i),a=t.useRef(n);return r(()=>{a.current=n},[n]),t.useEffect(()=>{s.current!==i&&(a.current?.(i),s.current=i)},[i,s]),[i,o,a]}({defaultProp:n,onChange:i}),c=void 0!==e,d=c?e:s;{let n=t.useRef(void 0!==e);t.useEffect(()=>{let e=n.current;if(e!==c){let t=c?"controlled":"uncontrolled";console.warn(`${o} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}n.current=c},[c,o])}return[d,t.useCallback(t=>{if(c){let n="function"==typeof t?t(e):t;n!==e&&l.current?.(n)}else a(t)},[c,e,a,l])]}],417256);var i=e.i(380560),o=e.i(967928),s=e.i(44501);function a(e){var n;let r,i=(n=e,(r=t.forwardRef((e,n)=>{let{children:r,...i}=e;if(t.isValidElement(r)){var s;let e,a,l=(s=r,(a=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(a=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),c=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==t.Fragment&&(c.ref=n?(0,o.composeRefs)(n,l):l),t.cloneElement(r,c)}return t.Children.count(r)>1?t.Children.only(null):null})).displayName=`${n}.SlotClone`,r),a=t.forwardRef((e,n)=>{let{children:r,...o}=e,a=t.Children.toArray(r),l=a.find(c);if(l){let e=l.props.children,r=a.map(n=>n!==l?n:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,s.jsx)(i,{...o,ref:n,children:t.isValidElement(e)?t.cloneElement(e,void 0,r):null})}return(0,s.jsx)(i,{...o,ref:n,children:r})});return a.displayName=`${e}.Slot`,a}var l=Symbol("radix.slottable");function c(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===l}e.s(["createSlot",0,a],652053);var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{let r=a(`Primitive.${n}`),i=t.forwardRef((e,t)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(i?r:n,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});e.s(["Primitive",0,d,"dispatchDiscreteCustomEvent",0,function(e,t){e&&i.flushSync(()=>e.dispatchEvent(t))}],980939)},41986,25486,e=>{"use strict";var t=e.i(101685),n=e.i(543250),r=e.i(967928),i=e.i(652053),o=e.i(44501),s=new WeakMap;function a(e,t){var n,r;let i,o,s;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(n=e,r=t,i=n.length,(s=(o=l(r))>=0?o:i+o)<0||s>=i?-1:s);return -1===a?void 0:e[a]}function l(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],s.set(this,!0)}set(e,t){return s.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,i=this.has(t),o=this.#e.length,s=l(e),a=s>=0?s:o+s,c=a<0||a>=o?-1:a;if(c===this.size||i&&c===this.size-1||-1===c)return this.set(t,n),this;let d=this.size+ +!i;s<0&&a++;let u=[...this.#e],h=!1;for(let e=a;e<d;e++)if(a===e){let o=u[e];u[e]===t&&(o=u[e+1]),i&&this.delete(t),r=this.get(o),this.set(t,n)}else{h||u[e-1]!==t||(h=!0);let n=u[h?e:e-1],i=r;r=this.get(n),this.delete(n),this.set(n,i)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=a(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=a(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return a(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=0===r&&1===e.length?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&1===e.length?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}}),e.s(["createCollection",0,function(e){let s=e+"CollectionProvider",[a,l]=(0,n.createContextScope)(s),[c,d]=a(s,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:n,children:r}=e,i=t.default.useRef(null),s=t.default.useRef(new Map).current;return(0,o.jsx)(c,{scope:n,itemMap:s,collectionRef:i,children:r})};u.displayName=s;let h=e+"CollectionSlot",p=(0,i.createSlot)(h),f=t.default.forwardRef((e,t)=>{let{scope:n,children:i}=e,s=d(h,n),a=(0,r.useComposedRefs)(t,s.collectionRef);return(0,o.jsx)(p,{ref:a,children:i})});f.displayName=h;let m=e+"CollectionItemSlot",g="data-radix-collection-item",y=(0,i.createSlot)(m),b=t.default.forwardRef((e,n)=>{let{scope:i,children:s,...a}=e,l=t.default.useRef(null),c=(0,r.useComposedRefs)(n,l),u=d(m,i);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,o.jsx)(y,{...{[g]:""},ref:c,children:s})});return b.displayName=m,[{Provider:u,Slot:f,ItemSlot:b},function(n){let r=d(e+"CollectionConsumer",n);return t.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},l]}],41986);var c=t.createContext(void 0);e.s(["useDirection",0,function(e){let n=t.useContext(c);return e||n||"ltr"}],25486)},348989,136131,e=>{"use strict";var t,n=e.i(101685),r=e.i(291967),i=e.i(980939),o=e.i(967928);function s(e){let t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}e.s(["useCallbackRef",0,s],136131);var a=e.i(44501),l="dismissableLayer.update",c=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),d=n.forwardRef((e,d)=>{let{disableOutsidePointerEvents:p=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:y,onDismiss:b,...v}=e,w=n.useContext(c),[x,k]=n.useState(null),S=x?.ownerDocument??globalThis?.document,[,C]=n.useState({}),E=(0,o.useComposedRefs)(d,e=>k(e)),M=Array.from(w.layers),[N]=[...w.layersWithOutsidePointerEventsDisabled].slice(-1),A=M.indexOf(N),T=x?M.indexOf(x):-1,R=w.layersWithOutsidePointerEventsDisabled.size>0,O=T>=A,D=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{let e=e=>{if(e.target&&!i.current){let n=function(){h("dismissableLayer.pointerDownOutside",r,i,{discrete:!0})},i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);i.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{let t=e.target,n=[...w.branches].some(e=>e.contains(t));O&&!n&&(m?.(e),y?.(e),e.defaultPrevented||b?.())},S),j=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1);return n.useEffect(()=>{let e=e=>{e.target&&!i.current&&h("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{let t=e.target;![...w.branches].some(e=>e.contains(t))&&(g?.(e),y?.(e),e.defaultPrevented||b?.())},S);return!function(e,t=globalThis?.document){let r=s(e);n.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{T===w.layers.size-1&&(f?.(e),!e.defaultPrevented&&b&&(e.preventDefault(),b()))},S),n.useEffect(()=>{if(x)return p&&(0===w.layersWithOutsidePointerEventsDisabled.size&&(t=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),w.layersWithOutsidePointerEventsDisabled.add(x)),w.layers.add(x),u(),()=>{p&&1===w.layersWithOutsidePointerEventsDisabled.size&&(S.body.style.pointerEvents=t)}},[x,S,p,w]),n.useEffect(()=>()=>{x&&(w.layers.delete(x),w.layersWithOutsidePointerEventsDisabled.delete(x),u())},[x,w]),n.useEffect(()=>{let e=()=>C({});return document.addEventListener(l,e),()=>document.removeEventListener(l,e)},[]),(0,a.jsx)(i.Primitive.div,{...v,ref:E,style:{pointerEvents:R?O?"auto":"none":void 0,...e.style},onFocusCapture:(0,r.composeEventHandlers)(e.onFocusCapture,j.onFocusCapture),onBlurCapture:(0,r.composeEventHandlers)(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:(0,r.composeEventHandlers)(e.onPointerDownCapture,D.onPointerDownCapture)})});function u(){let e=new CustomEvent(l);document.dispatchEvent(e)}function h(e,t,n,{discrete:r}){let o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?(0,i.dispatchDiscreteCustomEvent)(o,s):o.dispatchEvent(s)}d.displayName="DismissableLayer",n.forwardRef((e,t)=>{let r=n.useContext(c),s=n.useRef(null),l=(0,o.useComposedRefs)(t,s);return n.useEffect(()=>{let e=s.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,a.jsx)(i.Primitive.div,{...e,ref:l})}).displayName="DismissableLayerBranch",e.s(["DismissableLayer",0,d],348989)},539340,e=>{"use strict";var t=e.i(101685),n=0;function r(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}e.s(["useFocusGuards",0,function(){t.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??r()),document.body.insertAdjacentElement("beforeend",e[1]??r()),n++,()=>{1===n&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),n--}},[])}])},445424,e=>{"use strict";let t;var n=e.i(101685),r=e.i(967928),i=e.i(980939),o=e.i(136131),s=e.i(44501),a="focusScope.autoFocusOnMount",l="focusScope.autoFocusOnUnmount",c={bubbles:!1,cancelable:!0},d=n.forwardRef((e,t)=>{let{loop:d=!1,trapped:m=!1,onMountAutoFocus:g,onUnmountAutoFocus:y,...b}=e,[v,w]=n.useState(null),x=(0,o.useCallbackRef)(g),k=(0,o.useCallbackRef)(y),S=n.useRef(null),C=(0,r.useComposedRefs)(t,e=>w(e)),E=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(m){let e=function(e){if(E.paused||!v)return;let t=e.target;v.contains(t)?S.current=t:p(S.current,{select:!0})},t=function(e){if(E.paused||!v)return;let t=e.relatedTarget;null!==t&&(v.contains(t)||p(S.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&p(v)});return v&&n.observe(v,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[m,v,E.paused]),n.useEffect(()=>{if(v){f.add(E);let e=document.activeElement;if(!v.contains(e)){let t=new CustomEvent(a,c);v.addEventListener(a,x),v.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(p(r,{select:t}),document.activeElement!==n)return}(u(v).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&p(v))}return()=>{v.removeEventListener(a,x),setTimeout(()=>{let t=new CustomEvent(l,c);v.addEventListener(l,k),v.dispatchEvent(t),t.defaultPrevented||p(e??document.body,{select:!0}),v.removeEventListener(l,k),f.remove(E)},0)}}},[v,x,k,E]);let M=n.useCallback(e=>{if(!d&&!m||E.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){var r;let t,i=e.currentTarget,[o,s]=[h(t=u(r=i),r),h(t.reverse(),r)];o&&s?e.shiftKey||n!==s?e.shiftKey&&n===o&&(e.preventDefault(),d&&p(s,{select:!0})):(e.preventDefault(),d&&p(o,{select:!0})):n===i&&e.preventDefault()}},[d,m,E.paused]);return(0,s.jsx)(i.Primitive.div,{tabIndex:-1,...b,ref:C,onKeyDown:M})});function u(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function p(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}d.displayName="FocusScope";var f=(t=[],{add(e){let n=t[0];e!==n&&n?.pause(),(t=m(t,e)).unshift(e)},remove(e){t=m(t,e),t[0]?.resume()}});function m(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}e.s(["FocusScope",0,d])},433616,e=>{"use strict";var t=e.i(101685),n=e.i(672687),r=t[" useId ".trim().toString()]||(()=>void 0),i=0;e.s(["useId",0,function(e){let[o,s]=t.useState(r());return(0,n.useLayoutEffect)(()=>{e||s(e=>e??String(i++))},[e]),e||(o?`radix-${o}`:"")}])},278928,e=>{"use strict";let t,n=["top","right","bottom","left"],r=n.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),i=Math.min,o=Math.max,s=Math.round,a=Math.floor,l=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"};function d(e,t){return"function"==typeof e?e(t):e}function u(e){return e.split("-")[0]}function h(e){return e.split("-")[1]}function p(e){return"x"===e?"y":"x"}function f(e){return"y"===e?"height":"width"}function m(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function g(e,t,n){void 0===n&&(n=!1);let r=h(e),i=p(m(e)),o=f(i),s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=k(s)),[s,k(s)]}function y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let b=["left","right"],v=["right","left"],w=["top","bottom"],x=["bottom","top"];function k(e){let t=u(e);return c[t]+e.slice(t.length)}function S(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function C(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function E(e,t,n){let r,{reference:i,floating:o}=e,s=m(t),a=p(m(t)),l=f(a),c=u(t),d="y"===s,g=i.x+i.width/2-o.width/2,y=i.y+i.height/2-o.height/2,b=i[l]/2-o[l]/2;switch(c){case"top":r={x:g,y:i.y-o.height};break;case"bottom":r={x:g,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:y};break;case"left":r={x:i.x-o.width,y:y};break;default:r={x:i.x,y:i.y}}switch(h(t)){case"start":r[a]-=b*(n&&d?-1:1);break;case"end":r[a]+=b*(n&&d?-1:1)}return r}async function M(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=d(t,e),m=S(f),g=a[p?"floating"===h?"reference":"floating":h],y=C(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(g)))||n?g:g.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),w=await (null==o.isElement?void 0:o.isElement(v))&&await (null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},x=C(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:l}):b);return{top:(y.top-x.top+m.top)/w.y,bottom:(x.bottom-y.bottom+m.bottom)/w.y,left:(y.left-x.left+m.left)/w.x,right:(x.right-y.right+m.right)/w.x}}let N=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:M},l=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=E(c,r,l),h=r,p=0,f={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:y}=m,{x:b,y:v,data:w,reset:x}=await y({x:d,y:u,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=v?v:u,f[g]={...f[g],...w},x&&p<50&&(p++,"object"==typeof x&&(x.placement&&(h=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:u}=E(c,h,l)),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:f}};function A(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function T(e){return n.some(t=>e[t]>=0)}function R(e){let t=i(...e.map(e=>e.left)),n=i(...e.map(e=>e.top));return{x:t,y:n,width:o(...e.map(e=>e.right))-t,height:o(...e.map(e=>e.bottom))-n}}let O=new Set(["left","top"]);async function D(e,t){let{placement:n,platform:r,elements:i}=e,o=await (null==r.isRTL?void 0:r.isRTL(i.floating)),s=u(n),a=h(n),l="y"===m(n),c=O.has(s)?-1:1,p=o&&l?-1:1,f=d(t,e),{mainAxis:g,crossAxis:y,alignmentAxis:b}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&"number"==typeof b&&(y="end"===a?-1*b:b),l?{x:y*p,y:g*c}:{x:g*c,y:y*p}}function j(){return"u">typeof window}function I(e){return _(e)?(e.nodeName||"").toLowerCase():"#document"}function L(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){var t;return null==(t=(_(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function _(e){return!!j()&&(e instanceof Node||e instanceof L(e).Node)}function z(e){return!!j()&&(e instanceof Element||e instanceof L(e).Element)}function $(e){return!!j()&&(e instanceof HTMLElement||e instanceof L(e).HTMLElement)}function H(e){return!(!j()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof L(e).ShadowRoot)}function B(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function F(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let V=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,W=e=>!!e&&"none"!==e;function q(e){let t=z(e)?G(e):e;return W(t.transform)||W(t.translate)||W(t.scale)||W(t.rotate)||W(t.perspective)||!K()&&(W(t.backdropFilter)||W(t.filter))||V.test(t.willChange||"")||U.test(t.contain||"")}function K(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function J(e){return/^(html|body|#document)$/.test(I(e))}function G(e){return L(e).getComputedStyle(e)}function X(e){return z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if("html"===I(e))return e;let t=e.assignedSlot||e.parentNode||H(e)&&e.host||P(e);return H(t)?t.host:t}function Y(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=Z(t);return J(n)?t.ownerDocument?t.ownerDocument.body:t.body:$(n)&&B(n)?n:e(n)}(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=L(i);if(!o)return t.concat(i,Y(i,[],n));{let e=Q(s);return t.concat(s,s.visualViewport||[],B(i)?i:[],e&&n?Y(e):[])}}function Q(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ee(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=s(n)!==o||s(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function et(e){return z(e)?e:e.contextElement}function en(e){let t=et(e);if(!$(t))return l(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=ee(t),a=(o?s(n.width):n.width)/r,c=(o?s(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}let er=l(0);function ei(e){let t=L(e);return K()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:er}function eo(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),s=et(e),a=l(1);t&&(r?z(r)&&(a=en(r)):a=en(e));let c=(void 0===(i=n)&&(i=!1),r&&(!i||r===L(s))&&i)?ei(s):l(0),d=(o.left+c.x)/a.x,u=(o.top+c.y)/a.y,h=o.width/a.x,p=o.height/a.y;if(s){let e=L(s),t=r&&z(r)?L(r):r,n=e,i=Q(n);for(;i&&r&&t!==n;){let e=en(i),t=i.getBoundingClientRect(),r=G(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;d*=e.x,u*=e.y,h*=e.x,p*=e.y,d+=o,u+=s,i=Q(n=L(i))}}return C({width:h,height:p,x:d,y:u})}function es(e,t){let n=X(e).scrollLeft;return t?t.left+n:eo(P(e)).left+n}function ea(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-es(e,n),y:n.top+t.scrollTop}}function el(e,t,n){var r;let i;if("viewport"===t)i=function(e,t){let n=L(e),r=P(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let e=K();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let c=es(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t){let t,n,s,a,l,c,d;r=P(e),t=P(r),n=X(r),s=r.ownerDocument.body,a=o(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=o(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),c=-n.scrollLeft+es(r),d=-n.scrollTop,"rtl"===G(s).direction&&(c+=o(t.clientWidth,s.clientWidth)-a),i={width:a,height:l,x:c,y:d}}else if(z(t)){let e,r,o,s,a,c;r=(e=eo(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,s=$(t)?en(t):l(1),a=t.clientWidth*s.x,c=t.clientHeight*s.y,i={width:a,height:c,x:o*s.x,y:r*s.y}}else{let n=ei(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return C(i)}function ec(e){return"static"===G(e).position}function ed(e,t){if(!$(e)||"fixed"===G(e).position)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function eu(e,t){var n;let r=L(e);if(F(e))return r;if(!$(e)){let t=Z(e);for(;t&&!J(t);){if(z(t)&&!ec(t))return t;t=Z(t)}return r}let i=ed(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(I(n)))&&ec(i);)i=ed(i,t);return i&&J(i)&&ec(i)&&!q(i)?r:i||function(e){let t=Z(e);for(;$(t)&&!J(t);){if(q(t))return t;if(F(t))break;t=Z(t)}return null}(e)||r}let eh=async function(e){let t=this.getOffsetParent||eu,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=$(t),i=P(t),o="fixed"===n,s=eo(e,!0,o,t),a={scrollLeft:0,scrollTop:0},c=l(0);if(r||!r&&!o)if(("body"!==I(t)||B(i))&&(a=X(t)),r){let e=eo(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=es(i));o&&!r&&i&&(c.x=es(i));let d=!i||r||o?l(0):ea(i,a);return{x:s.left+a.scrollLeft-c.x-d.x,y:s.top+a.scrollTop-c.y-d.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},ep={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,s=P(r),a=!!t&&F(t.floating);if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},d=l(1),u=l(0),h=$(r);if((h||!h&&!o)&&(("body"!==I(r)||B(s))&&(c=X(r)),h)){let e=eo(r);d=en(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let p=!s||h||o?l(0):ea(s,c);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}},getDocumentElement:P,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e,a=[..."clippingAncestors"===n?F(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=Y(e,[],!1).filter(e=>z(e)&&"body"!==I(e)),i=null,o="fixed"===G(e).position,s=o?Z(e):e;for(;z(s)&&!J(s);){let t=G(s),n=q(s);n||"fixed"!==t.position||(i=null),(o?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||B(s)&&!n&&function e(t,n){let r=Z(t);return!(r===n||!z(r)||J(r))&&("fixed"===G(r).position||e(r,n))}(e,s)))?i=t:r=r.filter(e=>e!==s),s=Z(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=el(t,a[0],s),c=l.top,d=l.right,u=l.bottom,h=l.left;for(let e=1;e<a.length;e++){let n=el(t,a[e],s);c=o(n.top,c),d=i(n.right,d),u=i(n.bottom,u),h=o(n.left,h)}return{width:d-h,height:u-c,x:h,y:c}},getOffsetParent:eu,getElementRects:eh,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=ee(e);return{width:t,height:n}},getScale:en,isElement:z,isRTL:function(e){return"rtl"===G(e).direction}};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}e.s(["arrow",0,e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:s,rects:a,platform:l,elements:c,middlewareData:u}=t,{element:g,padding:y=0}=d(e,t)||{};if(null==g)return{};let b=S(y),v={x:n,y:r},w=p(m(s)),x=f(w),k=await l.getDimensions(g),C="y"===w,E=C?"clientHeight":"clientWidth",M=a.reference[x]+a.reference[w]-v[w]-a.floating[x],N=v[w]-a.reference[w],A=await (null==l.getOffsetParent?void 0:l.getOffsetParent(g)),T=A?A[E]:0;T&&await (null==l.isElement?void 0:l.isElement(A))||(T=c.floating[E]||a.floating[x]);let R=T/2-k[x]/2-1,O=i(b[C?"top":"left"],R),D=i(b[C?"bottom":"right"],R),j=T-k[x]-D,I=T/2-k[x]/2+(M/2-N/2),L=o(O,i(I,j)),P=!u.arrow&&null!=h(s)&&I!==L&&a.reference[x]/2-(I<O?O:D)-k[x]/2<0,_=P?I<O?I-O:I-j:0;return{[w]:v[w]+_,data:{[w]:L,centerOffset:I-L-_,...P&&{alignmentOffset:_}},reset:P}}}),"autoPlacement",0,function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,o,s;let{rects:a,middlewareData:l,placement:c,platform:p,elements:f}=t,{crossAxis:m=!1,alignment:b,allowedPlacements:v=r,autoAlignment:w=!0,...x}=d(e,t),k=void 0!==b||v===r?((s=b||null)?[...v.filter(e=>h(e)===s),...v.filter(e=>h(e)!==s)]:v.filter(e=>u(e)===e)).filter(e=>!s||h(e)===s||!!w&&y(e)!==e):v,S=await p.detectOverflow(t,x),C=(null==(n=l.autoPlacement)?void 0:n.index)||0,E=k[C];if(null==E)return{};let M=g(E,a,await (null==p.isRTL?void 0:p.isRTL(f.floating)));if(c!==E)return{reset:{placement:k[0]}};let N=[S[u(E)],S[M[0]],S[M[1]]],A=[...(null==(i=l.autoPlacement)?void 0:i.overflows)||[],{placement:E,overflows:N}],T=k[C+1];if(T)return{data:{index:C+1,overflows:A},reset:{placement:T}};let R=A.map(e=>{let t=h(e.placement);return[e.placement,t&&m?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,h(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:C+1,overflows:A},reset:{placement:O}}:{}}}},"autoUpdate",0,function(e,t,n,r){let s;void 0===r&&(r={});let{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d="function"==typeof ResizeObserver,layoutShift:u="function"==typeof IntersectionObserver,animationFrame:h=!1}=r,p=et(e),f=l||c?[...p?Y(p):[],...t?Y(t):[]]:[];f.forEach(e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)});let m=p&&u?function(e,t){let n,r=null,s=P(e);function l(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function c(d,u){void 0===d&&(d=!1),void 0===u&&(u=1),l();let h=e.getBoundingClientRect(),{left:p,top:f,width:m,height:g}=h;if(d||t(),!m||!g)return;let y={rootMargin:-a(f)+"px "+-a(s.clientWidth-(p+m))+"px "+-a(s.clientHeight-(f+g))+"px "+-a(p)+"px",threshold:o(0,i(1,u))||1},b=!0;function v(t){let r=t[0].intersectionRatio;if(r!==u){if(!b)return c();r?c(!1,r):n=setTimeout(()=>{c(!1,1e-7)},1e3)}1!==r||ef(h,e.getBoundingClientRect())||c(),b=!1}try{r=new IntersectionObserver(v,{...y,root:s.ownerDocument})}catch(e){r=new IntersectionObserver(v,y)}r.observe(e)}(!0),l}(p,n):null,g=-1,y=null;d&&(y=new ResizeObserver(e=>{let[r]=e;r&&r.target===p&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=y)||e.observe(t)})),n()}),p&&!h&&y.observe(p),t&&y.observe(t));let b=h?eo(e):null;return h&&function t(){let r=eo(e);b&&!ef(b,r)&&n(),b=r,s=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=y)||e.disconnect(),y=null,h&&cancelAnimationFrame(s)}},"computePosition",0,(e,t,n)=>{let r=new Map,i={platform:ep,...n},o={...i.platform,_c:r};return N(e,t,{...i,platform:o})},"flip",0,function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,o,s;let a,l,c,{placement:p,middlewareData:f,rects:S,initialPlacement:C,platform:E,elements:M}=t,{mainAxis:N=!0,crossAxis:A=!0,fallbackPlacements:T,fallbackStrategy:R="bestFit",fallbackAxisSideDirection:O="none",flipAlignment:D=!0,...j}=d(e,t);if(null!=(n=f.arrow)&&n.alignmentOffset)return{};let I=u(p),L=m(C),P=u(C)===C,_=await (null==E.isRTL?void 0:E.isRTL(M.floating)),z=T||(P||!D?[k(C)]:(a=k(C),[y(C),a,y(a)])),$="none"!==O;!T&&$&&z.push(...(l=h(C),c=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?v:b;return t?b:v;case"left":case"right":return t?w:x;default:return[]}}(u(C),"start"===O,_),l&&(c=c.map(e=>e+"-"+l),D&&(c=c.concat(c.map(y)))),c));let H=[C,...z],B=await E.detectOverflow(t,j),F=[],V=(null==(r=f.flip)?void 0:r.overflows)||[];if(N&&F.push(B[I]),A){let e=g(p,S,_);F.push(B[e[0]],B[e[1]])}if(V=[...V,{placement:p,overflows:F}],!F.every(e=>e<=0)){let e=((null==(i=f.flip)?void 0:i.index)||0)+1,t=H[e];if(t&&("alignment"!==A||L===m(t)||V.every(e=>m(e.placement)!==L||e.overflows[0]>0)))return{data:{index:e,overflows:V},reset:{placement:t}};let n=null==(o=V.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(R){case"bestFit":{let e=null==(s=V.filter(e=>{if($){let t=m(e.placement);return t===L||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=C}if(p!==n)return{reset:{placement:n}}}return{}}}},"hide",0,function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=d(e,t);switch(i){case"referenceHidden":{let e=A(await r.detectOverflow(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:T(e)}}}case"escaped":{let e=A(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:T(e)}}}default:return{}}}}},"inline",0,function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:n,elements:r,rects:s,platform:a,strategy:l}=t,{padding:c=2,x:h,y:p}=d(e,t),f=Array.from(await (null==a.getClientRects?void 0:a.getClientRects(r.reference))||[]),g=function(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>C(R(e)))}(f),y=C(R(f)),b=S(c),v=await a.getElementRects({reference:{getBoundingClientRect:function(){if(2===g.length&&g[0].left>g[1].right&&null!=h&&null!=p)return g.find(e=>h>e.left-b.left&&h<e.right+b.right&&p>e.top-b.top&&p<e.bottom+b.bottom)||y;if(g.length>=2){if("y"===m(n)){let e=g[0],t=g[g.length-1],r="top"===u(n),i=e.top,o=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:i,bottom:o,left:s,right:a,width:a-s,height:o-i,x:s,y:i}}let e="left"===u(n),t=o(...g.map(e=>e.right)),r=i(...g.map(e=>e.left)),s=g.filter(n=>e?n.left===r:n.right===t),a=s[0].top,l=s[s.length-1].bottom;return{top:a,bottom:l,left:r,right:t,width:t-r,height:l-a,x:r,y:a}}return y}},floating:r.floating,strategy:l});return s.reference.x!==v.reference.x||s.reference.y!==v.reference.y||s.reference.width!==v.reference.width||s.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},"limitShift",0,function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=d(e,t),h={x:n,y:r},f=m(i),g=p(f),y=h[g],b=h[f],v=d(a,t),w="number"==typeof v?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){let e="y"===g?"height":"width",t=o.reference[g]-o.floating[e]+w.mainAxis,n=o.reference[g]+o.reference[e]-w.mainAxis;y<t?y=t:y>n&&(y=n)}if(c){var x,k;let e="y"===g?"width":"height",t=O.has(u(i)),n=o.reference[f]-o.floating[e]+(t&&(null==(x=s.offset)?void 0:x[f])||0)+(t?0:w.crossAxis),r=o.reference[f]+o.reference[e]+(t?0:(null==(k=s.offset)?void 0:k[f])||0)-(t?w.crossAxis:0);b<n?b=n:b>r&&(b=r)}return{[g]:y,[f]:b}}}},"offset",0,function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=t,l=await D(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},"shift",0,function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=d(e,t),g={x:n,y:r},y=await a.detectOverflow(t,f),b=m(u(s)),v=p(b),w=g[v],x=g[b];if(l){let e="y"===v?"top":"left",t="y"===v?"bottom":"right",n=w+y[e],r=w-y[t];w=o(n,i(w,r))}if(c){let e="y"===b?"top":"left",t="y"===b?"bottom":"right",n=x+y[e],r=x-y[t];x=o(n,i(x,r))}let k=h.fn({...t,[v]:w,[b]:x});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[v]:l,[b]:c}}}}}},"size",0,function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let s,a,{placement:l,rects:c,platform:p,elements:f}=t,{apply:g=()=>{},...y}=d(e,t),b=await p.detectOverflow(t,y),v=u(l),w=h(l),x="y"===m(l),{width:k,height:S}=c.floating;"top"===v||"bottom"===v?(s=v,a=w===(await (null==p.isRTL?void 0:p.isRTL(f.floating))?"start":"end")?"left":"right"):(a=v,s="end"===w?"top":"bottom");let C=S-b.top-b.bottom,E=k-b.left-b.right,M=i(S-b[s],C),N=i(k-b[a],E),A=!t.middlewareData.shift,T=M,R=N;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(R=E),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(T=C),A&&!w){let e=o(b.left,0),t=o(b.right,0),n=o(b.top,0),r=o(b.bottom,0);x?R=k-2*(0!==e||0!==t?e+t:o(b.left,b.right)):T=S-2*(0!==n||0!==r?n+r:o(b.top,b.bottom))}await g({...t,availableWidth:R,availableHeight:T});let O=await p.getDimensions(f.floating);return k!==O.width||S!==O.height?{reset:{rects:!0}}:{}}}}],278928)},638154,461614,e=>{"use strict";var t=e.i(101685),n=e.i(278928),r=e.i(380560),i="u">typeof document?t.useLayoutEffect:function(){};function o(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!o(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!o(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function s(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function a(e,t){let n=s(e);return Math.round(t*n)/n}function l(e){let n=t.useRef(e);return i(()=>{n.current=e}),n}var c=e.i(980939),d=e.i(44501),u=t.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,d.jsx)(c.Primitive.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,d.jsx)("polygon",{points:"0,0 30,0 15,10"})})});u.displayName="Arrow";var h=e.i(967928),p=e.i(543250),f=e.i(136131),m=e.i(672687);function g(e){let[n,r]=t.useState(void 0);return(0,m.useLayoutEffect)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}e.s(["useSize",0,g],461614);var y="Popper",[b,v]=(0,p.createContextScope)(y),[w,x]=b(y),k=e=>{let{__scopePopper:n,children:r}=e,[i,o]=t.useState(null);return(0,d.jsx)(w,{scope:n,anchor:i,onAnchorChange:o,children:r})};k.displayName=y;var S="PopperAnchor",C=t.forwardRef((e,n)=>{let{__scopePopper:r,virtualRef:i,...o}=e,s=x(S,r),a=t.useRef(null),l=(0,h.useComposedRefs)(n,a),u=t.useRef(null);return t.useEffect(()=>{let e=u.current;u.current=i?.current||a.current,e!==u.current&&s.onAnchorChange(u.current)}),i?null:(0,d.jsx)(c.Primitive.div,{...o,ref:l})});C.displayName=S;var E="PopperContent",[M,N]=b(E),A=t.forwardRef((e,u)=>{var p,y,b,v,w,k,S,C,N,A,T,R,O,L,P;let _,z,$,H,B,F,{__scopePopper:V,side:U="bottom",sideOffset:W=0,align:q="center",alignOffset:K=0,arrowPadding:J=0,avoidCollisions:G=!0,collisionBoundary:X=[],collisionPadding:Z=0,sticky:Y="partial",hideWhenDetached:Q=!1,updatePositionStrategy:ee="optimized",onPlaced:et,...en}=e,er=x(E,V),[ei,eo]=t.useState(null),es=(0,h.useComposedRefs)(u,e=>eo(e)),[ea,el]=t.useState(null),ec=g(ea),ed=ec?.width??0,eu=ec?.height??0,eh="number"==typeof Z?Z:{top:0,right:0,bottom:0,left:0,...Z},ep=Array.isArray(X)?X:[X],ef=ep.length>0,em={padding:eh,boundary:ep.filter(D),altBoundary:ef},{refs:eg,floatingStyles:ey,placement:eb,isPositioned:ev,middlewareData:ew}=function(e){void 0===e&&(e={});let{placement:c="bottom",strategy:d="absolute",middleware:u=[],platform:h,elements:{reference:p,floating:f}={},transform:m=!0,whileElementsMounted:g,open:y}=e,[b,v]=t.useState({x:0,y:0,strategy:d,placement:c,middlewareData:{},isPositioned:!1}),[w,x]=t.useState(u);o(w,u)||x(u);let[k,S]=t.useState(null),[C,E]=t.useState(null),M=t.useCallback(e=>{e!==R.current&&(R.current=e,S(e))},[]),N=t.useCallback(e=>{e!==O.current&&(O.current=e,E(e))},[]),A=p||k,T=f||C,R=t.useRef(null),O=t.useRef(null),D=t.useRef(b),j=null!=g,I=l(g),L=l(h),P=l(y),_=t.useCallback(()=>{if(!R.current||!O.current)return;let e={placement:c,strategy:d,middleware:w};L.current&&(e.platform=L.current),(0,n.computePosition)(R.current,O.current,e).then(e=>{let t={...e,isPositioned:!1!==P.current};z.current&&!o(D.current,t)&&(D.current=t,r.flushSync(()=>{v(t)}))})},[w,c,d,L,P]);i(()=>{!1===y&&D.current.isPositioned&&(D.current.isPositioned=!1,v(e=>({...e,isPositioned:!1})))},[y]);let z=t.useRef(!1);i(()=>(z.current=!0,()=>{z.current=!1}),[]),i(()=>{if(A&&(R.current=A),T&&(O.current=T),A&&T){if(I.current)return I.current(A,T,_);_()}},[A,T,_,I,j]);let $=t.useMemo(()=>({reference:R,floating:O,setReference:M,setFloating:N}),[M,N]),H=t.useMemo(()=>({reference:A,floating:T}),[A,T]),B=t.useMemo(()=>{let e={position:d,left:0,top:0};if(!H.floating)return e;let t=a(H.floating,b.x),n=a(H.floating,b.y);return m?{...e,transform:"translate("+t+"px, "+n+"px)",...s(H.floating)>=1.5&&{willChange:"transform"}}:{position:d,left:t,top:n}},[d,m,H.floating,b.x,b.y]);return t.useMemo(()=>({...b,update:_,refs:$,elements:H,floatingStyles:B}),[b,_,$,H,B])}({strategy:"fixed",placement:U+("center"!==q?"-"+q:""),whileElementsMounted:(...e)=>(0,n.autoUpdate)(...e,{animationFrame:"always"===ee}),elements:{reference:er.anchor},middleware:[(p={mainAxis:W+eu,alignmentAxis:K},{name:(_=(0,n.offset)(p)).name,fn:_.fn,options:[p,y]}),G&&(w={mainAxis:!0,crossAxis:!1,limiter:"partial"===Y?{fn:(0,n.limitShift)(b).fn,options:[b,v]}:void 0,...em},{name:(z=(0,n.shift)(w)).name,fn:z.fn,options:[w,k]}),G&&(S={...em},{name:($=(0,n.flip)(S)).name,fn:$.fn,options:[S,C]}),(N={...em,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}},{name:(H=(0,n.size)(N)).name,fn:H.fn,options:[N,A]}),ea&&{name:(B={name:"arrow",options:O=T={element:ea,padding:J},fn(e){let{element:t,padding:r}="function"==typeof O?O(e):O;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?(0,n.arrow)({element:t.current,padding:r}).fn(e):{}:t?(0,n.arrow)({element:t,padding:r}).fn(e):{}}}).name,fn:B.fn,options:[T,R]},j({arrowWidth:ed,arrowHeight:eu}),Q&&(L={strategy:"referenceHidden",...em},{name:(F=(0,n.hide)(L)).name,fn:F.fn,options:[L,P]})]}),[ex,ek]=I(eb),eS=(0,f.useCallbackRef)(et);(0,m.useLayoutEffect)(()=>{ev&&eS?.()},[ev,eS]);let eC=ew.arrow?.x,eE=ew.arrow?.y,eM=ew.arrow?.centerOffset!==0,[eN,eA]=t.useState();return(0,m.useLayoutEffect)(()=>{ei&&eA(window.getComputedStyle(ei).zIndex)},[ei]),(0,d.jsx)("div",{ref:eg.setFloating,"data-radix-popper-content-wrapper":"",style:{...ey,transform:ev?ey.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eN,"--radix-popper-transform-origin":[ew.transformOrigin?.x,ew.transformOrigin?.y].join(" "),...ew.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,d.jsx)(M,{scope:V,placedSide:ex,onArrowChange:el,arrowX:eC,arrowY:eE,shouldHideArrow:eM,children:(0,d.jsx)(c.Primitive.div,{"data-side":ex,"data-align":ek,...en,ref:es,style:{...en.style,animation:ev?void 0:"none"}})})})});A.displayName=E;var T="PopperArrow",R={top:"bottom",right:"left",bottom:"top",left:"right"},O=t.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=N(T,n),o=R[i.placedSide];return(0,d.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,d.jsx)(u,{...r,ref:t,style:{...r.style,display:"block"}})})});function D(e){return null!==e}O.displayName=T;var j=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=I(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,h=(i.arrow?.y??0)+a/2,p="",f="";return"bottom"===l?(p=o?d:`${u}px`,f=`${-a}px`):"top"===l?(p=o?d:`${u}px`,f=`${r.floating.height+a}px`):"right"===l?(p=`${-a}px`,f=o?d:`${h}px`):"left"===l&&(p=`${r.floating.width+a}px`,f=o?d:`${h}px`),{data:{x:p,y:f}}}});function I(e){let[t,n="center"]=e.split("-");return[t,n]}e.s(["Anchor",0,C,"Arrow",0,O,"Content",0,A,"Root",0,k,"createPopperScope",0,v],638154)},332374,190088,e=>{"use strict";var t=e.i(101685),n=e.i(380560),r=e.i(980939),i=e.i(672687),o=e.i(44501),s=t.forwardRef((e,s)=>{let{container:a,...l}=e,[c,d]=t.useState(!1);(0,i.useLayoutEffect)(()=>d(!0),[]);let u=a||c&&globalThis?.document?.body;return u?n.default.createPortal((0,o.jsx)(r.Primitive.div,{...l,ref:s}),u):null});s.displayName="Portal",e.s(["Portal",0,s],332374);var a=e.i(967928),l=e=>{var n;let r,o,{present:s,children:l}=e,d=function(e){var n,r;let[o,s]=t.useState(),a=t.useRef(null),l=t.useRef(e),d=t.useRef("none"),[u,h]=(n=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},t.useReducer((e,t)=>r[e][t]??e,n));return t.useEffect(()=>{let e=c(a.current);d.current="mounted"===u?e:"none"},[u]),(0,i.useLayoutEffect)(()=>{let t=a.current,n=l.current;if(n!==e){let r=d.current,i=c(t);e?h("MOUNT"):"none"===i||t?.display==="none"?h("UNMOUNT"):n&&r!==i?h("ANIMATION_OUT"):h("UNMOUNT"),l.current=e}},[e,h]),(0,i.useLayoutEffect)(()=>{if(o){let e,t=o.ownerDocument.defaultView??window,n=n=>{let r=c(a.current).includes(CSS.escape(n.animationName));if(n.target===o&&r&&(h("ANIMATION_END"),!l.current)){let n=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=n)})}},r=e=>{e.target===o&&(d.current=c(a.current))};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",n),o.addEventListener("animationend",n),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",n),o.removeEventListener("animationend",n)}}h("ANIMATION_END")},[o,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:t.useCallback(e=>{a.current=e?getComputedStyle(e):null,s(e)},[])}}(s),u="function"==typeof l?l({present:d.isPresent}):t.Children.only(l),h=(0,a.useComposedRefs)(d.ref,(n=u,(o=(r=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.ref:(o=(r=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.props.ref:n.props.ref||n.ref));return"function"==typeof l||d.isPresent?t.cloneElement(u,{ref:h}):null};function c(e){return e?.animationName||"none"}l.displayName="Presence",e.s(["Presence",0,l],190088)},677275,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(41986),i=e.i(967928),o=e.i(543250),s=e.i(433616),a=e.i(980939),l=e.i(136131),c=e.i(417256),d=e.i(25486),u=e.i(44501),h="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},f="RovingFocusGroup",[m,g,y]=(0,r.createCollection)(f),[b,v]=(0,o.createContextScope)(f,[y]),[w,x]=b(f),k=t.forwardRef((e,t)=>(0,u.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(S,{...e,ref:t})})}));k.displayName=f;var S=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:o,orientation:s,loop:m=!1,dir:y,currentTabStopId:b,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:x,onEntryFocus:k,preventScrollOnEntryFocus:S=!1,...C}=e,E=t.useRef(null),M=(0,i.useComposedRefs)(r,E),A=(0,d.useDirection)(y),[T,R]=(0,c.useControllableState)({prop:b,defaultProp:v??null,onChange:x,caller:f}),[O,D]=t.useState(!1),j=(0,l.useCallbackRef)(k),I=g(o),L=t.useRef(!1),[P,_]=t.useState(0);return t.useEffect(()=>{let e=E.current;if(e)return e.addEventListener(h,j),()=>e.removeEventListener(h,j)},[j]),(0,u.jsx)(w,{scope:o,orientation:s,dir:A,loop:m,currentTabStopId:T,onItemFocus:t.useCallback(e=>R(e),[R]),onItemShiftTab:t.useCallback(()=>D(!0),[]),onFocusableItemAdd:t.useCallback(()=>_(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>_(e=>e-1),[]),children:(0,u.jsx)(a.Primitive.div,{tabIndex:O||0===P?-1:0,"data-orientation":s,...C,ref:M,style:{outline:"none",...e.style},onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,()=>{L.current=!0}),onFocus:(0,n.composeEventHandlers)(e.onFocus,e=>{let t=!L.current;if(e.target===e.currentTarget&&t&&!O){let t=new CustomEvent(h,p);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=I().filter(e=>e.focusable);N([e.find(e=>e.active),e.find(e=>e.id===T),...e].filter(Boolean).map(e=>e.ref.current),S)}}L.current=!1}),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>D(!1))})})}),C="RovingFocusGroupItem",E=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:i,focusable:o=!0,active:l=!1,tabStopId:c,children:d,...h}=e,p=(0,s.useId)(),f=c||p,y=x(C,i),b=y.currentTabStopId===f,v=g(i),{onFocusableItemAdd:w,onFocusableItemRemove:k,currentTabStopId:S}=y;return t.useEffect(()=>{if(o)return w(),()=>k()},[o,w,k]),(0,u.jsx)(m.ItemSlot,{scope:i,id:f,focusable:o,active:l,children:(0,u.jsx)(a.Primitive.span,{tabIndex:b?0:-1,"data-orientation":y.orientation,...h,ref:r,onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,e=>{o?y.onItemFocus(f):e.preventDefault()}),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>y.onItemFocus(f)),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void y.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return M[i]}(e,y.orientation,y.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=v().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=y.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>N(i))}}),children:"function"==typeof d?d({isCurrentTabStop:b,hasTabStop:null!=S}):d})})});E.displayName=C;var M={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function N(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}e.s(["Item",0,E,"Root",0,k,"createRovingFocusGroupScope",0,v])},73772,e=>{"use strict";var t=new WeakMap,n=new WeakMap,r={},i=0,o=function(e){return e&&(e.host||o(e.parentNode))},s=function(e,s,a,l){var c=(Array.isArray(e)?e:[e]).map(function(e){if(s.contains(e))return e;var t=o(e);return t&&s.contains(t)?t:(console.error("aria-hidden",e,"in not contained inside",s,". Doing nothing"),null)}).filter(function(e){return!!e});r[a]||(r[a]=new WeakMap);var d=r[a],u=[],h=new Set,p=new Set(c),f=function(e){!e||h.has(e)||(h.add(e),f(e.parentNode))};c.forEach(f);var m=function(e){!e||p.has(e)||Array.prototype.forEach.call(e.children,function(e){if(h.has(e))m(e);else try{var r=e.getAttribute(l),i=null!==r&&"false"!==r,o=(t.get(e)||0)+1,s=(d.get(e)||0)+1;t.set(e,o),d.set(e,s),u.push(e),1===o&&i&&n.set(e,!0),1===s&&e.setAttribute(a,"true"),i||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return m(s),h.clear(),i++,function(){u.forEach(function(e){var r=t.get(e)-1,i=d.get(e)-1;t.set(e,r),d.set(e,i),r||(n.has(e)||e.removeAttribute(l),n.delete(e)),i||e.removeAttribute(a)}),--i||(t=new WeakMap,t=new WeakMap,n=new WeakMap,r={})}};e.s(["hideOthers",0,function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),s(r,i,n,"aria-hidden")):function(){return null}}])},206500,e=>{"use strict";var t,n,r,i,o,s,a,l=e.i(824627),c=e.i(101685),d="right-scroll-bar-position",u="width-before-scroll-bar";function h(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var p="u">typeof window?c.useLayoutEffect:c.useEffect,f=new WeakMap,m=(void 0===t&&(t={}),(void 0===n&&(n=function(e){return e}),r=[],i=!1,o={read:function(){if(i)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var t=n(e,i);return r.push(t),function(){r=r.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(i=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){i=!0;var t=[];if(r.length){var n=r;r=[],n.forEach(e),t=r}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}).options=(0,l.__assign)({async:!0,ssr:!1},t),o),g=function(){},y=c.forwardRef(function(e,t){var n,r,i,o,s=c.useRef(null),a=c.useState({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:g}),d=a[0],u=a[1],y=e.forwardProps,b=e.children,v=e.className,w=e.removeScrollBar,x=e.enabled,k=e.shards,S=e.sideCar,C=e.noRelative,E=e.noIsolation,M=e.inert,N=e.allowPinchZoom,A=e.as,T=e.gapMode,R=(0,l.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=(n=[s,t],r=function(e){return n.forEach(function(t){return h(t,e)})},(i=(0,c.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,p(function(){var e=f.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||h(e,null)}),r.forEach(function(e){t.has(e)||h(e,i)})}f.set(o,n)},[n]),o),D=(0,l.__assign)((0,l.__assign)({},R),d);return c.createElement(c.Fragment,null,x&&c.createElement(S,{sideCar:m,removeScrollBar:w,shards:k,noRelative:C,noIsolation:E,inert:M,setCallbacks:u,allowPinchZoom:!!N,lockRef:s,gapMode:T}),y?c.cloneElement(c.Children.only(b),(0,l.__assign)((0,l.__assign)({},D),{ref:O})):c.createElement(void 0===A?"div":A,(0,l.__assign)({},D,{className:v,ref:O}),b))});y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},y.classNames={fullWidth:u,zeroRight:d};var b=function(e){var t=e.sideCar,n=(0,l.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return c.createElement(r,(0,l.__assign)({},n))};b.isSideCarExport=!0;var v=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=a||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,i;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},w=function(){var e=v();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},x=function(){var e=w();return function(t){return e(t.styles,t.dynamic),null}},k={left:0,top:0,right:0,gap:0},S=function(e){return parseInt(e||"",10)||0},C=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[S(n),S(r),S(i)]},E=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return k;var t=C(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M=x(),N="data-scroll-locked",A=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(N,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(d," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(u," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(d," .").concat(d," {\n right: 0 ").concat(r,";\n }\n \n .").concat(u," .").concat(u," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(N,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},T=function(){var e=parseInt(document.body.getAttribute(N)||"0",10);return isFinite(e)?e:0},R=function(){c.useEffect(function(){return document.body.setAttribute(N,(T()+1).toString()),function(){var e=T()-1;e<=0?document.body.removeAttribute(N):document.body.setAttribute(N,e.toString())}},[])},O=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;R();var o=c.useMemo(function(){return E(i)},[i]);return c.createElement(M,{styles:A(o,!t,i,n?"":"!important")})},D=!1;if("u">typeof window)try{var j=Object.defineProperty({},"passive",{get:function(){return D=!0,!0}});window.addEventListener("test",j,j),window.removeEventListener("test",j,j)}catch(e){D=!1}var I=!!D&&{passive:!1},L=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},P=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),_(e,r)){var i=z(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},_=function(e,t){return"v"===e?L(t,"overflowY"):L(t,"overflowX")},z=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},$=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,c=t.contains(l),d=!1,u=a>0,h=0,p=0;do{if(!l)break;var f=z(e,l),m=f[0],g=f[1]-f[2]-s*m;(m||g)&&_(e,l)&&(h+=g,p+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(h)||!i&&a>h)?d=!0:!u&&(i&&1>Math.abs(p)||!i&&-a>p)&&(d=!0),d},H=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B=function(e){return[e.deltaX,e.deltaY]},F=function(e){return e&&"current"in e?e.current:e},V=0,U=[];let W=(s=function(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),i=c.useState(V++)[0],o=c.useState(x)[0],s=c.useRef(e);c.useEffect(function(){s.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,l.__spreadArray)([e.lockRef.current],(e.shards||[]).map(F),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=c.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=H(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var f=P(u,d);if(!f)return!0;if(f?i=u:(i="v"===u?"h":"v",f=P(u,d)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=i),!i)return!0;var m=r.current||i;return $(m,t,e,"h"===m?l:c,!0)},[]),d=c.useCallback(function(e){if(U.length&&U[U.length-1]===o){var n="deltaY"in e?B(e):H(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(F).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),h=c.useCallback(function(e){n.current=H(e),r.current=void 0},[]),p=c.useCallback(function(t){u(t.type,B(t),t.target,a(t,e.lockRef.current))},[]),f=c.useCallback(function(t){u(t.type,H(t),t.target,a(t,e.lockRef.current))},[]);c.useEffect(function(){return U.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",d,I),document.addEventListener("touchmove",d,I),document.addEventListener("touchstart",h,I),function(){U=U.filter(function(e){return e!==o}),document.removeEventListener("wheel",d,I),document.removeEventListener("touchmove",d,I),document.removeEventListener("touchstart",h,I)}},[]);var m=e.removeScrollBar,g=e.inert;return c.createElement(c.Fragment,null,g?c.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,m?c.createElement(O,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},m.useMedium(s),b);var q=c.forwardRef(function(e,t){return c.createElement(y,(0,l.__assign)({},e,{ref:t,sideCar:W}))});q.classNames=y.classNames,e.s(["RemoveScroll",0,q],206500)},996702,918552,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(967928),i=e.i(543250),o=e.i(417256),s=e.i(980939),a=e.i(41986),l=e.i(25486),c=e.i(348989),d=e.i(539340),u=e.i(445424),h=e.i(433616),p=e.i(638154),f=e.i(332374),m=e.i(190088),g=e.i(677275),y=e.i(652053),b=e.i(136131),v=e.i(73772),w=e.i(206500),x=e.i(44501),k=["Enter"," "],S=["ArrowUp","PageDown","End"],C=["ArrowDown","PageUp","Home",...S],E={ltr:[...k,"ArrowRight"],rtl:[...k,"ArrowLeft"]},M={ltr:["ArrowLeft"],rtl:["ArrowRight"]},N="Menu",[A,T,R]=(0,a.createCollection)(N),[O,D]=(0,i.createContextScope)(N,[R,p.createPopperScope,g.createRovingFocusGroupScope]),j=(0,p.createPopperScope)(),I=(0,g.createRovingFocusGroupScope)(),[L,P]=O(N),[_,z]=O(N),$=e=>{let{__scopeMenu:n,open:r=!1,children:i,dir:o,onOpenChange:s,modal:a=!0}=e,c=j(n),[d,u]=t.useState(null),h=t.useRef(!1),f=(0,b.useCallbackRef)(s),m=(0,l.useDirection)(o);return t.useEffect(()=>{let e=()=>{h.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>h.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,x.jsx)(p.Root,{...c,children:(0,x.jsx)(L,{scope:n,open:r,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(_,{scope:n,onClose:t.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:a,children:i})})})};$.displayName=N;var H=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Anchor,{...i,...r,ref:t})});H.displayName="MenuAnchor";var B="MenuPortal",[F,V]=O(B,{forceMount:void 0}),U=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=P(B,t);return(0,x.jsx)(F,{scope:t,forceMount:n,children:(0,x.jsx)(m.Presence,{present:n||o.open,children:(0,x.jsx)(f.Portal,{asChild:!0,container:i,children:r})})})};U.displayName=B;var W="MenuContent",[q,K]=O(W),J=t.forwardRef((e,t)=>{let n=V(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=P(W,e.__scopeMenu),s=z(W,e.__scopeMenu);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:r||o.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:s.modal?(0,x.jsx)(G,{...i,ref:t}):(0,x.jsx)(X,{...i,ref:t})})})})}),G=t.forwardRef((e,i)=>{let o=P(W,e.__scopeMenu),s=t.useRef(null),a=(0,r.useComposedRefs)(i,s);return t.useEffect(()=>{let e=s.current;if(e)return(0,v.hideOthers)(e)},[]),(0,x.jsx)(Y,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),X=t.forwardRef((e,t)=>{let n=P(W,e.__scopeMenu);return(0,x.jsx)(Y,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Z=(0,y.createSlot)("MenuContent.ScrollLock"),Y=t.forwardRef((e,i)=>{let{__scopeMenu:o,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:h,disableOutsidePointerEvents:f,onEntryFocus:m,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,disableOutsideScroll:M,...N}=e,A=P(W,o),R=z(W,o),O=j(o),D=I(o),L=T(o),[_,$]=t.useState(null),H=t.useRef(null),B=(0,r.useComposedRefs)(i,H,A.onContentChange),F=t.useRef(0),V=t.useRef(""),U=t.useRef(0),K=t.useRef(null),J=t.useRef("right"),G=t.useRef(0),X=M?w.RemoveScroll:t.Fragment;t.useEffect(()=>()=>window.clearTimeout(F.current),[]),(0,d.useFocusGuards)();let Y=t.useCallback(e=>{var t,n;return J.current===K.current?.side&&(t=e,!!(n=K.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,c=s.y,d=a.x,u=a.y;c>r!=u>r&&n<(d-l)*(r-c)/(u-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,x.jsx)(q,{scope:o,searchRef:V,onItemEnter:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),onItemLeave:t.useCallback(e=>{Y(e)||(H.current?.focus(),$(null))},[Y]),onTriggerLeave:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),pointerGraceTimerRef:U,onPointerGraceIntentChange:t.useCallback(e=>{K.current=e},[]),children:(0,x.jsx)(X,{...M?{as:Z,allowPinchZoom:!0}:void 0,children:(0,x.jsx)(u.FocusScope,{asChild:!0,trapped:a,onMountAutoFocus:(0,n.composeEventHandlers)(l,e=>{e.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:h,children:(0,x.jsx)(c.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,children:(0,x.jsx)(g.Root,{asChild:!0,...D,dir:R.dir,orientation:"vertical",loop:s,currentTabStopId:_,onCurrentTabStopIdChange:$,onEntryFocus:(0,n.composeEventHandlers)(m,e=>{R.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,x.jsx)(p.Content,{role:"menu","aria-orientation":"vertical","data-state":eM(A.open),"data-radix-menu-content":"",dir:R.dir,...O,...N,ref:B,style:{outline:"none",...N.style},onKeyDown:(0,n.composeEventHandlers)(N.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=V.current+i,o=L().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),c=o.find(e=>e.textValue===l)?.ref.current,function e(t){V.current=t,window.clearTimeout(F.current),""!==t&&(F.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let o=H.current;if(e.target!==o||!C.includes(e.key))return;e.preventDefault();let s=L().filter(e=>!e.disabled).map(e=>e.ref.current);S.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,n.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),V.current="")}),onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{let t=e.target,n=G.current!==e.clientX;e.currentTarget.contains(t)&&n&&(J.current=e.clientX>G.current?"right":"left",G.current=e.clientX)}))})})})})})})});J.displayName=W;var Q=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"group",...r,ref:t})});Q.displayName="MenuGroup";var ee=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{...r,ref:t})});ee.displayName="MenuLabel";var et="MenuItem",en="menu.itemSelect",er=t.forwardRef((e,i)=>{let{disabled:o=!1,onSelect:a,...l}=e,c=t.useRef(null),d=z(et,e.__scopeMenu),u=K(et,e.__scopeMenu),h=(0,r.useComposedRefs)(i,c),p=t.useRef(!1);return(0,x.jsx)(ei,{...l,ref:h,disabled:o,onClick:(0,n.composeEventHandlers)(e.onClick,()=>{let e=c.current;if(!o&&e){let t=new CustomEvent(en,{bubbles:!0,cancelable:!0});e.addEventListener(en,e=>a?.(e),{once:!0}),(0,s.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?p.current=!1:d.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),p.current=!0},onPointerUp:(0,n.composeEventHandlers)(e.onPointerUp,e=>{p.current||e.currentTarget?.click()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==u.searchRef.current;o||t&&" "===e.key||k.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});er.displayName=et;var ei=t.forwardRef((e,i)=>{let{__scopeMenu:o,disabled:a=!1,textValue:l,...c}=e,d=K(et,o),u=I(o),h=t.useRef(null),p=(0,r.useComposedRefs)(i,h),[f,m]=t.useState(!1),[y,b]=t.useState("");return t.useEffect(()=>{let e=h.current;e&&b((e.textContent??"").trim())},[c.children]),(0,x.jsx)(A.ItemSlot,{scope:o,disabled:a,textValue:l??y,children:(0,x.jsx)(g.Item,{asChild:!0,...u,focusable:!a,children:(0,x.jsx)(s.Primitive.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:p,onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{a?d.onItemLeave(e):(d.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>d.onItemLeave(e))),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>m(!0)),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>m(!1))})})})}),eo=t.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:i,...o}=e;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:r,children:(0,x.jsx)(er,{role:"menuitemcheckbox","aria-checked":eN(r)?"mixed":r,...o,ref:t,"data-state":eA(r),onSelect:(0,n.composeEventHandlers)(o.onSelect,()=>i?.(!!eN(r)||!r),{checkForDefaultPrevented:!1})})})});eo.displayName="MenuCheckboxItem";var es="MenuRadioGroup",[ea,el]=O(es,{value:void 0,onValueChange:()=>{}}),ec=t.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=(0,b.useCallbackRef)(r);return(0,x.jsx)(ea,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,x.jsx)(Q,{...i,ref:t})})});ec.displayName=es;var ed="MenuRadioItem",eu=t.forwardRef((e,t)=>{let{value:r,...i}=e,o=el(ed,e.__scopeMenu),s=r===o.value;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:s,children:(0,x.jsx)(er,{role:"menuitemradio","aria-checked":s,...i,ref:t,"data-state":eA(s),onSelect:(0,n.composeEventHandlers)(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});eu.displayName=ed;var eh="MenuItemIndicator",[ep,ef]=O(eh,{checked:!1}),em=t.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=ef(eh,n);return(0,x.jsx)(m.Presence,{present:r||eN(o.checked)||!0===o.checked,children:(0,x.jsx)(s.Primitive.span,{...i,ref:t,"data-state":eA(o.checked)})})});em.displayName=eh;var eg=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});eg.displayName="MenuSeparator";var ey=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Arrow,{...i,...r,ref:t})});ey.displayName="MenuArrow";var eb="MenuSub",[ev,ew]=O(eb),ex=e=>{let{__scopeMenu:n,children:r,open:i=!1,onOpenChange:o}=e,s=P(eb,n),a=j(n),[l,c]=t.useState(null),[d,u]=t.useState(null),f=(0,b.useCallbackRef)(o);return t.useEffect(()=>(!1===s.open&&f(!1),()=>f(!1)),[s.open,f]),(0,x.jsx)(p.Root,{...a,children:(0,x.jsx)(L,{scope:n,open:i,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(ev,{scope:n,contentId:(0,h.useId)(),triggerId:(0,h.useId)(),trigger:l,onTriggerChange:c,children:r})})})};ex.displayName=eb;var ek="MenuSubTrigger",eS=t.forwardRef((e,i)=>{let o=P(ek,e.__scopeMenu),s=z(ek,e.__scopeMenu),a=ew(ek,e.__scopeMenu),l=K(ek,e.__scopeMenu),c=t.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:u}=l,h={__scopeMenu:e.__scopeMenu},p=t.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return t.useEffect(()=>p,[p]),t.useEffect(()=>{let e=d.current;return()=>{window.clearTimeout(e),u(null)}},[d,u]),(0,x.jsx)(H,{asChild:!0,...h,children:(0,x.jsx)(ei,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":a.contentId,"data-state":eM(o.open),...e,ref:(0,r.composeRefs)(i,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(t=>{l.onItemEnter(t),!t.defaultPrevented&&(e.disabled||o.open||c.current||(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{o.onOpenChange(!0),p()},100)))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>{p();let t=o.content?.getBoundingClientRect();if(t){let n=o.content?.dataset.side,r="right"===n,i=t[r?"left":"right"],s=t[r?"right":"left"];l.onPointerGraceIntentChange({area:[{x:e.clientX+(r?-5:5),y:e.clientY},{x:i,y:t.top},{x:s,y:t.top},{x:s,y:t.bottom},{x:i,y:t.bottom}],side:n}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(e),e.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,t=>{let n=""!==l.searchRef.current;e.disabled||n&&" "===t.key||E[s.dir].includes(t.key)&&(o.onOpenChange(!0),o.content?.focus(),t.preventDefault())})})})});eS.displayName=ek;var eC="MenuSubContent",eE=t.forwardRef((e,i)=>{let o=V(W,e.__scopeMenu),{forceMount:s=o.forceMount,...a}=e,l=P(W,e.__scopeMenu),c=z(W,e.__scopeMenu),d=ew(eC,e.__scopeMenu),u=t.useRef(null),h=(0,r.useComposedRefs)(i,u);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:s||l.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:(0,x.jsx)(Y,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:h,align:"start",side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:(0,n.composeEventHandlers)(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=M[c.dir].includes(e.key);t&&n&&(l.onOpenChange(!1),d.trigger?.focus(),e.preventDefault())})})})})})});function eM(e){return e?"open":"closed"}function eN(e){return"indeterminate"===e}function eA(e){return eN(e)?"indeterminate":e?"checked":"unchecked"}function eT(e){return t=>"mouse"===t.pointerType?e(t):void 0}eE.displayName=eC,e.s(["Anchor",0,H,"Arrow",0,ey,"CheckboxItem",0,eo,"Content",0,J,"Group",0,Q,"Item",0,er,"ItemIndicator",0,em,"Label",0,ee,"Portal",0,U,"RadioGroup",0,ec,"RadioItem",0,eu,"Root",0,$,"Separator",0,eg,"Sub",0,ex,"SubContent",0,eE,"SubTrigger",0,eS,"createMenuScope",0,D],918552);var eR="DropdownMenu",[eO,eD]=(0,i.createContextScope)(eR,[D]),ej=D(),[eI,eL]=eO(eR),eP=e=>{let{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,d=ej(n),u=t.useRef(null),[p,f]=(0,o.useControllableState)({prop:s,defaultProp:a??!1,onChange:l,caller:eR});return(0,x.jsx)(eI,{scope:n,triggerId:(0,h.useId)(),triggerRef:u,contentId:(0,h.useId)(),open:p,onOpenChange:f,onOpenToggle:t.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,x.jsx)($,{...d,open:p,onOpenChange:f,dir:i,modal:c,children:r})})};eP.displayName=eR;var e_="DropdownMenuTrigger",ez=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,disabled:o=!1,...a}=e,l=eL(e_,i),c=ej(i);return(0,x.jsx)(H,{asChild:!0,...c,children:(0,x.jsx)(s.Primitive.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...a,ref:(0,r.composeRefs)(t,l.triggerRef),onPointerDown:(0,n.composeEventHandlers)(e.onPointerDown,e=>{!o&&0===e.button&&!1===e.ctrlKey&&(l.onOpenToggle(),l.open||e.preventDefault())}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{!o&&(["Enter"," "].includes(e.key)&&l.onOpenToggle(),"ArrowDown"===e.key&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});ez.displayName=e_;var e$=e=>{let{__scopeDropdownMenu:t,...n}=e,r=ej(t);return(0,x.jsx)(U,{...r,...n})};e$.displayName="DropdownMenuPortal";var eH="DropdownMenuContent",eB=t.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...o}=e,s=eL(eH,i),a=ej(i),l=t.useRef(!1);return(0,x.jsx)(J,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...o,ref:r,onCloseAutoFocus:(0,n.composeEventHandlers)(e.onCloseAutoFocus,e=>{l.current||s.triggerRef.current?.focus(),l.current=!1,e.preventDefault()}),onInteractOutside:(0,n.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!s.modal||r)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eB.displayName=eH;var eF=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(Q,{...i,...r,ref:t})});eF.displayName="DropdownMenuGroup";var eV=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ee,{...i,...r,ref:t})});eV.displayName="DropdownMenuLabel";var eU=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(er,{...i,...r,ref:t})});eU.displayName="DropdownMenuItem";var eW=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eo,{...i,...r,ref:t})});eW.displayName="DropdownMenuCheckboxItem";var eq=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ec,{...i,...r,ref:t})});eq.displayName="DropdownMenuRadioGroup";var eK=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eu,{...i,...r,ref:t})});eK.displayName="DropdownMenuRadioItem";var eJ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(em,{...i,...r,ref:t})});eJ.displayName="DropdownMenuItemIndicator";var eG=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eg,{...i,...r,ref:t})});eG.displayName="DropdownMenuSeparator",t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ey,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var eX=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eS,{...i,...r,ref:t})});eX.displayName="DropdownMenuSubTrigger";var eZ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eE,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eZ.displayName="DropdownMenuSubContent",e.s(["CheckboxItem",0,eW,"Content",0,eB,"Group",0,eF,"Item",0,eU,"ItemIndicator",0,eJ,"Label",0,eV,"Portal",0,e$,"RadioGroup",0,eq,"RadioItem",0,eK,"Root",0,eP,"Separator",0,eG,"Sub",0,e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,a=ej(t),[l,c]=(0,o.useControllableState)({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return(0,x.jsx)(ex,{...a,open:l,onOpenChange:c,children:n})},"SubContent",0,eZ,"SubTrigger",0,eX,"Trigger",0,ez],996702)},10137,e=>{"use strict";let t=(0,e.i(605993).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],10137)},755146,149427,e=>{"use strict";var t=e.i(44501),n=e.i(996702),r=e.i(43240),i=e.i(10137);let o=(0,e.i(605993).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",0,o],149427);var s=e.i(101685),a=e.i(975157);let l=n.Root,c=n.Trigger;n.Group,n.Portal,n.Sub,n.RadioGroup,s.forwardRef(({className:e,inset:r,children:o,...s},l)=>(0,t.jsxs)(n.SubTrigger,{ref:l,className:(0,a.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...s,children:[o,(0,t.jsx)(i.ChevronRight,{className:"ml-auto h-4 w-4"})]})).displayName=n.SubTrigger.displayName,s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.SubContent,{ref:i,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})).displayName=n.SubContent.displayName;let d=s.forwardRef(({className:e,sideOffset:r=4,...i},o)=>(0,t.jsx)(n.Portal,{children:(0,t.jsx)(n.Content,{ref:o,sideOffset:r,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));d.displayName=n.Content.displayName;let u=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Item,{ref:o,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",e),...i}));u.displayName=n.Item.displayName,s.forwardRef(({className:e,children:i,checked:o,...s},l)=>(0,t.jsxs)(n.CheckboxItem,{ref:l,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...s,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(r.Check,{className:"h-4 w-4"})})}),i]})).displayName=n.CheckboxItem.displayName,s.forwardRef(({className:e,children:r,...i},s)=>(0,t.jsxs)(n.RadioItem,{ref:s,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(o,{className:"h-2 w-2 fill-current"})})}),r]})).displayName=n.RadioItem.displayName;let h=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Label,{ref:o,className:(0,a.cn)("px-2 py-1.5 text-sm font-normal",r&&"pl-8",e),...i}));h.displayName=n.Label.displayName;let p=s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Separator,{ref:i,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",e),...r}));p.displayName=n.Separator.displayName,e.s(["DropdownMenu",0,l,"DropdownMenuContent",0,d,"DropdownMenuItem",0,u,"DropdownMenuLabel",0,h,"DropdownMenuSeparator",0,p,"DropdownMenuTrigger",0,c],755146)},804150,(e,t,n)=>{"use strict";var r=e.r(101685),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,d=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&d({inst:i})},[e,n,t]),s(function(){return c(i)&&d({inst:i}),e(function(){c(i)&&d({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d},3909,(e,t,n)=>{"use strict";t.exports=e.r(804150)},757890,(e,t,n)=>{"use strict";var r=e.r(101685),i=e.r(3909),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,d=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var u=a(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;var p=s(e,(u=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],u[1]);return l(function(){h.hasValue=!0,h.value=p},[p]),d(p),p}},383835,(e,t,n)=>{"use strict";t.exports=e.r(757890)},150663,644575,605842,111092,362615,202008,608926,343603,885047,e=>{"use strict";let t,n;function r(e){this.content=e}r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var i=n&&n!=e?this.remove(n):this,o=i.find(e),s=i.content.slice();return -1==o?s.push(n||e,t):(s[o+1]=t,n&&(s[o]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var i=this.remove(t),o=i.content.slice(),s=i.find(e);return o.splice(-1==s?o.length:s,0,t,n),new r(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};class i{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],a=o+s.nodeSize;a>e&&((o<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=a}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let a=t.child(--o),l=n.child(--s),c=a.nodeSize;if(a==l){r-=c,i-=c;continue}if(!a.sameMarkup(l))return{a:r,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return s(0,e);if(e==this.size)return s(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return s(t+1,r);return s(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);let o={index:0,offset:0};function s(e,t){return o.index=e,o.offset=t,o}function a(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!a(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!a(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class l{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&a(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return l.none;if(e instanceof l)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}l.none=[];class c extends Error{}class d{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:a,offset:l}=t.findIndex(n),c=t.maybeChild(a);if(l==n||c.isText)return s&&i<=0&&o<=0&&!s.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-l-1,r,0==a?i-1:0,a==t.childCount-1?o-1:0,c);return d&&t.replaceChild(a,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new d(n,this.openStart,this.openEnd)}removeBetween(e,t){return new d(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(o==n||s.isText){if(l!=r&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return d.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new d(i.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new d(e,n,r)}}function u(e,t){if(!t.type.compatibleContent(e.type))throw new c("Cannot join "+t.type.name+" onto "+e.type.name)}function h(e,t,n){let r=e.node(n);return u(r,t.node(n)),r}function p(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function f(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(p(e.nodeAfter,r),o++));for(let e=o;e<s;e++)p(i.child(e),r);t&&t.depth==n&&t.textOffset&&p(t.nodeBefore,r)}function m(e,t){return e.type.checkContent(t),e.copy(t)}function g(e,t,n){let r=[];return f(null,e,n,r),e.depth>n&&p(m(h(e,t,n+1),g(e,t,n+1)),r),f(t,null,n,r),new i(r)}d.empty=new d(i.empty,0,0);class y{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return l.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new x(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new y(t,n,i)}static resolveCached(e,t){let n=w.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else w.set(e,n=new b);let r=n.elts[n.i]=y.resolve(e,t);return n.i=(n.i+1)%v,r}}class b{constructor(){this.elts=[],this.i=0}}let v=12,w=new WeakMap;class x{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let k=Object.create(null);class S{constructor(e,t,n,r=l.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&a(this.attrs,t||e.defaultAttrs||k)&&l.sameSet(this.marks,n||l.none)}copy(e=null){return e==this.content?this:new S(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new S(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return d.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new d(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),o=this.resolve(t);if(n.openStart>r.depth)throw new c("Inserted content deeper than insertion position");if(r.depth-n.openStart!=o.depth-n.openEnd)throw new c("Inconsistent open depths");return function e(t,n,r,o){let s=t.index(o),a=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){let i=e(t,n,r,o+1);return a.copy(a.content.replaceChild(s,i))}if(!r.content.size)return m(a,g(t,n,o));if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){let{start:e,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return m(a,function e(t,n,r,o,s){let a=t.depth>s&&h(t,n,s+1),l=o.depth>s&&h(r,o,s+1),c=[];return f(null,t,s,c),a&&l&&n.index(s)==r.index(s)?(u(a,l),p(m(a,e(t,n,r,o,s+1)),c)):(a&&p(m(a,g(t,n,s+1)),c),f(n,r,s,c),l&&p(m(l,g(r,o,s+1)),c)),f(o,null,s,c),new i(c)}(t,e,s,n,o))}{let e=t.parent,i=e.content;return m(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,o,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return y.resolveCached(this,e)}resolveNoCache(e){return y.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),E(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=i.empty,r=0,o=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=l.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!l.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}S.prototype.text=void 0;class C extends S{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):E(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new C(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new C(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function E(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class M{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new N(e,t);if(null==i.next)return M.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=A(e),r=n;return e.eat(",")&&(r="}"!=e.next?A(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);R(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new M(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(T);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(R(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(s,a){let l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return i.from(a.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=o(n,a.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}M.empty=new M(!0);class N{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function A(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function T(e,t){return t-e}function R(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(T)}function O(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function D(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function j(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function I(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new P(e,r,t[r]);return n}class L{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=I(e,n.attrs),this.defaultAttrs=O(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:D(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new S(this,this.computeAttrs(e),i.from(t),l.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new S(this,this.computeAttrs(e),t,l.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(i.empty,!0);return o?new S(this,e,t.append(o),l.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){j(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:l.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new L(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class P{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=I(e,r.attrs),this.excluded=null;let i=O(this.attrs);this.instance=i?new l(this,i):null}create(e=null){return!e&&this.instance?this.instance:new l(this,D(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new _(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){j(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class z{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=r.from(e.nodes),t.marks=r.from(e.marks||{}),this.nodes=L.compile(this.spec.nodes,this),this.marks=_.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=M.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?$(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:$(this,n.split(" "))}this.nodeFromJSON=e=>S.fromJSON(this,e),this.markFromJSON=e=>l.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof L){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new C(n,n.defaultAttrs,e,l.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function $(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class H{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new q(this,t,!1);return n.addAll(e,l.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new q(this,t,!0);return n.addAll(e,l.none,t.from,t.to),d.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new H(e,H.schemaRules(e)))}}let B={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},F={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V={ol:!0,ul:!0};function U(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class W{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=l.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!B.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class q{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=U(null,t.preserveWhitespace,0)|4*!!n;i=r?new W(r.type,r.attrs,l.none,!0,t.topMatch||r.type.contentMatch,o):n?new W(null,null,l.none,!0,null,o):new W(e.schema.topNodeType,null,l.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;V.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&V.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(a?a.ignore:F.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(B.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=l.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):J(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=U(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=l.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!J(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new W(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function K(e){let t={};for(let n in e)t[n]=e[n];return t}function J(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class G{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Z(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Z(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Q(Z(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Q(Z(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:Q(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new G(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=X(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return X(e.marks)}}function X(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Z(e){return e.document||window.document}let Y=new WeakMap;function Q(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=Y.get(r))&&Y.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),l=o)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=a.indexOf(" ");c>0&&(n=a.slice(0,c),a=a.slice(c+1));let d=n?e.createElementNS(n,a):e.createElement(a),u=t[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in h=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof s)d.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=Q(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}e.s(["DOMParser",0,H,"DOMSerializer",0,G,"Fragment",0,i,"Mark",0,l,"MarkType",0,_,"Node",0,S,"NodeRange",0,x,"ReplaceError",0,c,"Schema",0,z,"Slice",0,d],644575);class ee{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class et{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&et.empty)return et.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,o=a+r+(i<0?0:c);if(n)return o;let u=e==(t<0?a:d)?null:s/3+(e-a)*65536,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new ee(o,h,u)}r+=c-l}return n?e+r:new ee(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new et(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?et.empty:new et(e<0?[0,-e,0]:[0,0,e])}}et.empty=new et([]);class en{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new en(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new en;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ee(e,r,null)}}let er=Object.create(null);class ei{getMap(){return et.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=er[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in er)throw RangeError("Duplicate use of step JSON ID "+e);return er[e]=t,t.prototype.jsonID=e,t}}class eo{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new eo(e,null)}static fail(e){return new eo(null,e)}static fromReplace(e,t,n,r){try{return eo.ok(e.replace(t,n,r))}catch(e){if(e instanceof c)return eo.fail(e.message);throw e}}}function es(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(es(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return i.fromArray(r)}class ea extends ei{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new d(es(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,i)}invert(){return new el(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ea(t.pos,n.pos,this.mark)}merge(e){return e instanceof ea&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ea(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new ea(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("addMark",ea);class el extends ei{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new d(es(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,n)}invert(){return new ea(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new el(t.pos,n.pos,this.mark)}merge(e){return e instanceof el&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new el(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new el(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("removeMark",el);class ec extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ec(this.pos,t.marks[n]);return new ec(this.pos,this.mark)}}return new ed(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ec(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ec(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("addNodeMark",ec);class ed extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ec(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ed(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ed(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("removeNodeMark",ed);class eu extends ei{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ep(e,this.from,this.to)?eo.fail("Structure replace would overwrite content"):eo.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new et([this.from,this.to-this.from,this.slice.size])}invert(e){return new eu(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&eu.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new eu(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eu)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?d.empty:new d(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eu(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?d.empty:new d(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eu(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eu(t.from,t.to,d.fromJSON(e,t.slice),!!t.structure)}}eu.MAP_BIAS=1,ei.jsonID("replace",eu);class eh extends ei{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(ep(e,this.from,this.gapFrom)||ep(e,this.gapTo,this.to)))return eo.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return eo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?eo.fromReplace(e,this.from,this.to,n):eo.fail("Content does not fit in gap")}getMap(){return new et([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eh(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eh(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eh(t.from,t.to,t.gapFrom,t.gapTo,d.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ep(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ef(e,t,n,r=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),a=[],l=t+1;for(let t=0;t<s.childCount;t++){let c=s.child(t),u=l+c.nodeSize,h=r.matchType(c.type);if(h){r=h;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new el(l,u,c.marks[t]));if(o&&c.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||(r=new d(i.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new eu(l+e.index,l+e.index+e[0].length,r))}}else a.push(new eu(l,u,d.empty));l=u}if(!r.validEnd){let t=r.fillBefore(i.empty,!0);e.replace(l,l,new d(t,0,0))}for(let t=a.length-1;t>=0;t--)e.step(a[t])}function em(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function eg(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(ey).concat({type:t,attrs:n}).concat(o.map(ey)):null}function ey(e){return{type:e,attrs:null}}function eb(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ev(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function ew(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function ex(e,t){let n=e.resolve(t),r=n.index();return ek(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ek(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function eS(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&ek(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eC(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function eE(e,t,n=t,r=d.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eM(i,o,r)?new eu(t,n,r):new eN(i,o,r).fit()}function eM(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ei.jsonID("replaceAround",eh);class eN{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=i.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new d(i,o,s);return e>-1?new eh(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new eu(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=eR(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:a}=this.frontier[o],l,c=null;if(1==t&&(r?a.matchType(r.type)||(c=a.fillBefore(i.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:c};if(2==t&&r&&(l=a.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eR(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new d(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eR(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new d(eA(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new d(eA(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:h,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)u.push(r.child(e));h=h.matchFragment(r)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=h.matchType(e.type);if(!t)break;(++c>1||0==l||e.content.size)&&(h=t,u.push(function e(t,n,r){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?r-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),r<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(i.empty,!0)))),t.copy(o)}(e.mark(p.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=eT(this.placed,t,i.from(u)),this.frontier[t].match=h,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?d.empty:new d(eA(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new d(eA(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eO(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=eO(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eO(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eT(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=eT(this.placed,this.depth,i.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i.empty,!0);e.childCount&&(this.placed=eT(this.placed,this.frontier.length,e))}}function eA(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eA(e.firstChild.content,t-1,n)))}function eT(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eT(e.lastChild.content,t-1,n)))}function eR(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eO(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function eD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class ej extends ei{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(r),0,+!t.isLeaf))}getMap(){return et.empty}invert(e){return new ej(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ej(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new ej(t.pos,t.attr,t.value)}}ei.jsonID("attr",ej);class eI extends ei{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return eo.ok(n)}getMap(){return et.empty}invert(e){return new eI(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eI(t.attr,t.value)}}ei.jsonID("docAttr",eI);let eL=class extends Error{};(eL=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eL.prototype.constructor=eL,eL.prototype.name="TransformError";class eP{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new en}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eL(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=d.empty){let r=eE(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new d(i.from(n),0,0))}delete(e,t){return this.replace(e,t,d.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(eM(o,s,r))return e.step(new eu(t,n,r));let a=eD(o,s);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:o.before(e)==t&&a.splice(1,0,-e)}let c=a.indexOf(l),u=[],h=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var p;let t=u[e],n=(p=t.type).spec.defining||p.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+h+1)%(r.openStart+1),p=u[l];if(p)for(let t=0;t<a.length;t++){let u=a[(t+c)%a.length],h=!0;u<0&&(h=!1,u=-u);let f=o.node(u-1),m=o.index(u-1);if(f.canReplaceWith(m,m,p.type,p.marks))return e.replace(o.before(u),h?s.after(u):n,new d(function e(t,n,r,o,s){if(n<r){let i=t.firstChild;t=t.replaceChild(0,i.copy(e(i.content,n+1,r,o,i)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let f=e.steps.length;for(let i=a.length-1;i>=0&&(e.replace(t,n,r),!(e.steps.length>f));i--){let e=a[i];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,o=t;if(!n.isInline&&r==o&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=o=e)}return this.replaceRange(r,o,new d(i.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=eD(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:o,depth:s}=t,a=r.before(s+1),l=o.after(s+1),c=a,u=l,h=i.empty,p=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,h=i.from(r.node(e).copy(h)),p++):c--;let f=i.empty,m=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=i.from(o.node(e).copy(f)),m++):u++;e.step(new eh(c,u,a,l,new d(h.append(f),p,m),h.size-p,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);ev(e,r.node(),r.before(),a)}s.inlineContent&&ef(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new eu(c,l.map(t+n,-1),d.empty,!0)),!0===r){let t=e.doc.resolve(c);eb(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=i.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=i.from(n[e].type.create(n[e].attrs,r))}let o=t.start,s=t.end;e.step(new eh(o,s,o,s,new d(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var a,l,c;let u,h,p="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,p)&&(a=o.doc,l=o.mapping.slice(s).map(t),c=n,h=(u=a.resolve(l)).index(),u.parent.canReplaceWith(h,h+1,c))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&ev(o,e,t,s),ef(o,o.mapping.slice(s).map(t,1),n,void 0,null===r);let a=o.mapping.slice(s),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return o.step(new eh(l,c,l+1,c-1,new d(i.from(n.create(p,null,e.marks)),0,0),1,!0)),!0===r&&eb(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new eh(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new d(i.from(a),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new ej(e,t,n)),this}setDocAttribute(e,t){return this.step(new eI(e,t)),this}addNodeMark(e,t){return this.step(new ec(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof l)t.isInSet(n.marks)&&this.step(new ed(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ed(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let o=e.doc.resolve(t),s=i.empty,a=i.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){s=i.from(o.node(e).copy(s));let t=r&&r[l];a=i.from(t?t.type.create(t.attrs,a):o.node(e).copy(a))}e.step(new eu(t,t,new d(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,e),u=Math.min(l+r.nodeSize,t),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new el(c,u,d[e])));o&&o.to==c?o.to=u:a.push(o=new ea(c,u,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let a=null;if(n instanceof _){let e=r.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<a.length;t++){let r=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new el(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return ef(this,e,t,n),this}}e.s(["Mapping",0,en,"RemoveMarkStep",0,el,"ReplaceAroundStep",0,eh,"ReplaceStep",0,eu,"Transform",0,eP,"canJoin",0,ex,"canSplit",0,ew,"dropPoint",0,eC,"findWrapping",0,eg,"joinPoint",0,eS,"liftTarget",0,em,"replaceStep",0,eE],605842);let e_=Object.create(null);class ez{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e$(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=d.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?d.empty:t),0==s&&eG(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),eG(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new eF(e):eJ(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?eJ(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):eJ(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new eq(e.node(0))}static atStart(e){return eJ(e,e,0,0,1)||new eq(e)}static atEnd(e){return eJ(e,e,e.content.size,e.childCount,-1)||new eq(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=e_[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in e_)throw RangeError("Duplicate use of selection JSON ID "+e);return e_[e]=t,t.prototype.jsonID=e,t}getBookmark(){return eF.between(this.$anchor,this.$head).getBookmark()}}ez.prototype.visible=!0;class e${constructor(e,t){this.$from=e,this.$to=t}}let eH=!1;function eB(e){eH||e.parent.inlineContent||(eH=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eF extends ez{constructor(e,t=e){eB(e),eB(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return ez.near(n);let r=e.resolve(t.map(this.anchor));return new eF(r.parent.inlineContent?r:n,n)}replace(e,t=d.empty){if(super.replace(e,t),t==d.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof eF&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eV(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new eF(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=ez.findFrom(t,n,!0)||ez.findFrom(t,-n,!0);if(!e)return ez.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(ez.findFrom(e,-n,!0)||ez.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new eF(e,t)}}ez.jsonID("text",eF);class eV{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eV(e.map(this.anchor),e.map(this.head))}resolve(e){return eF.between(e.resolve(this.anchor),e.resolve(this.head))}}class eU extends ez{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?ez.near(i):new eU(i)}content(){return new d(i.from(this.node),0,0)}eq(e){return e instanceof eU&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eW(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new eU(e.resolve(t.anchor))}static create(e,t){return new eU(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}eU.prototype.visible=!1,ez.jsonID("node",eU);class eW{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new eV(n,n):new eW(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&eU.isSelectable(n)?new eU(t):ez.near(t)}}class eq extends ez{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=d.empty){if(t==d.empty){e.delete(0,e.doc.content.size);let t=ez.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new eq(e)}map(e){return new eq(e)}eq(e){return e instanceof eq}getBookmark(){return eK}}ez.jsonID("all",eq);let eK={map(){return this},resolve:e=>new eq(e)};function eJ(e,t,n,r,i,o=!1){if(t.inlineContent)return eF.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&eU.isSelectable(r))return eU.create(e,n-(i<0?r.nodeSize:0))}else{let t=eJ(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function eG(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof eu||o instanceof eh)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(ez.near(e.doc.resolve(r),n)))}class eX extends eP{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return l.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||l.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(ez.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function eZ(e,t){return t&&e?e.bind(t):e}class eY{constructor(e,t,n){this.name=e,this.init=eZ(t.init,n),this.apply=eZ(t.apply,n)}}let eQ=[new eY("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eY("selection",{init:(e,t)=>e.selection||ez.atStart(t.doc),apply:e=>e.selection}),new eY("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eY("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class e0{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=eQ.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new eY(e.key,e.spec.state,e))})}}class e1{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new e1(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new eX(this)}static create(e){let t=new e0(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new e1(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new e0(this.schema,e.plugins),n=t.fields,r=new e1(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new e0(e.schema,e.plugins),i=new e1(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=S.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=ez.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=a.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class e2{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:e3("plugin")}getState(e){return e[this.key]}}let e5=Object.create(null);function e3(e){return e in e5?e+"$"+ ++e5[e]:(e5[e]=0,e+"$")}class e4{constructor(e="key"){this.key=e3(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}e.s(["AllSelection",0,eq,"EditorState",0,e1,"NodeSelection",0,eU,"Plugin",0,e2,"PluginKey",0,e4,"Selection",0,ez,"SelectionRange",0,e$,"TextSelection",0,eF],111092);let e6=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},e9=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},e7=null,e8=function(e,t,n){let r=e7||(e7=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},te=function(){e7=null},tt=function(e,t,n,r){return n&&(tr(e,t,n,r,-1)||tr(e,t,n,r,1))},tn=/^(img|br|input|textarea|hr)$/i;function tr(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ti(e))){let n=e.parentNode;if(!n||1!=n.nodeType||to(e)||tn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=e6(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?ti(e):0}}}function ti(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function to(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let ts=function(e){return e.focusNode&&tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ta(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let tl="u">typeof navigator?navigator:null,tc="u">typeof document?document:null,td=tl&&tl.userAgent||"",tu=/Edge\/(\d+)/.exec(td),th=/MSIE \d/.exec(td),tp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(td),tf=!!(th||tp||tu),tm=th?document.documentMode:tp?+tp[1]:tu?+tu[1]:0,tg=!tf&&/gecko\/(\d+)/i.test(td);tg&&(/Firefox\/(\d+)/.exec(td)||[0,0])[1];let ty=!tf&&/Chrome\/(\d+)/.exec(td),tb=!!ty,tv=ty?+ty[1]:0,tw=!tf&&!!tl&&/Apple Computer/.test(tl.vendor),tx=tw&&(/Mobile\/\w+/.test(td)||!!tl&&tl.maxTouchPoints>2),tk=tx||!!tl&&/Mac/.test(tl.platform),tS=!!tl&&/Win/.test(tl.platform),tC=/Android \d/.test(td),tE=!!tc&&"webkitFontSmoothing"in tc.documentElement.style,tM=tE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tN(e,t){return"number"==typeof e?e:e[t]}function tA(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=e9(s);continue}let e=s,n=e==o.body,a=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),l=0,c=0;if(t.top<a.top+tN(r,"top")?c=-(a.top-t.top+tN(i,"top")):t.bottom>a.bottom-tN(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+tN(i,"top")-a.top:t.bottom-a.bottom+tN(i,"bottom")),t.left<a.left+tN(r,"left")?l=-(a.left-t.left+tN(i,"left")):t.right>a.right-tN(r,"right")&&(l=t.right-a.right+tN(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:e9(s)}}function tT(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=e9(r));return t}function tR(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tO=null;function tD(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tj(e){return e.top<e.bottom||e.left<e.right}function tI(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(tj(e))return e}return Array.prototype.find.call(n,tj)||e.getBoundingClientRect()}let tL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tP(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=tE||tg;if(3==r.nodeType)if(s&&(tL.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=tI(e8(r,i,i),n);if(tg&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=tI(e8(r,i-1,i-1),-1);if(t.top==e.top){let n=tI(e8(r,i,i+1),-1);if(n.top!=e.top)return t_(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,t_(tI(e8(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return tz(e.getBoundingClientRect(),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];if(1==e.nodeType)return tz(e.getBoundingClientRect(),!0)}return tz(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1],t=3==e.nodeType?e8(e,ti(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return t_(tI(t,1),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?e8(e,0,+!s):1==e.nodeType?e:null:null;if(t)return t_(tI(t,-1),!0)}return t_(tI(3==r.nodeType?e8(r):r,-n),n>=0)}function t_(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function tz(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function t$(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let tH=/[\u0590-\u08ac]/,tB=null,tF=null,tV=!1;class tU{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>e6(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof tZ){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof tW&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?e6(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?e6(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=e6(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=e6(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((tg||tw)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:e6(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(tg&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&tw)&&tt(s.node,s.offset,c.anchorNode,c.anchorOffset)&&tt(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&tg)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class tW extends tU{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class tq extends tU{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class tK extends tU{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=G.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new tK(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=tK.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=t7(i,t,o,n)),e>0&&(i=t7(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class tJ extends tU{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],a,l=s&&s(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:o,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=G.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=t5(c,n,t),l)?a=new tY(e,t,n,r,c,d||null,u,l,i,o+1):t.isText?new tX(e,t,n,r,c,u,i):new tJ(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>i.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&t3(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new t6(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(t9);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?l.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,d,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=t4(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(a instanceof tK){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=t4(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),tx&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof eF)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new tq(this,i,t,r);e.input.compositionNodes.push(o),this.children=t7(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(t3(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=t2(this.dom,this.nodeDOM,t1(this.outerDeco,this.node,t),t1(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function tG(e,t,n,r,i){t5(r,t,e);let o=new tJ(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class tX extends tJ{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new tX(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tZ extends tU{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class tY extends tJ{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let tQ=function(e){e&&(this.nodeName=e)};tQ.prototype=Object.create(null);let t0=[new tQ];function t1(e,t,n){if(0==e.length)return t0;let r=n?t0[0]:new tQ,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new tQ(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new tQ(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function t2(e,t,n,r){if(n==t0&&r==t0)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=t0[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||t0[0],o)}return i}function t5(e,t,n){return t2(e,e,t0,t1(t,n,1!=e.nodeType))}function t3(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function t4(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class t6{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof tK)n=e,r=e.children.length;else{a=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=tK.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof tJ){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c=a.dom,d,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&t3(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!t3(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=tJ.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=tJ.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new tW(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof tK;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof tX)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((tw||tb)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new tZ(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function t9(e,t){return e.type.side-t.type.side}function t7(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function t8(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(ts(n)){for(l=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&eU.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==ti(e);r||i;){if(e==n)return!0;let t=e6(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==ti(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new eU(s==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[l,s]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let n="pointer"==t||e.state.selection.head<a.pos&&!o?1:-1;c=nl(e,d,a,n)}return c}function ne(e){return e.editable?e.hasFocus():nd(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nt(e,t=!1){let n=e.state.selection;if(ns(e,n),ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&tb){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tt(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,e6(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&tf&&tm<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,a,{anchor:l,head:c}=n,d,u;nn&&!(n instanceof eF)&&(n.$from.parent.inlineContent||(d=nr(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=nr(e,n.to))),e.docView.setSelection(l,c,e,t),nn&&(d&&no(d),u&&no(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,a=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!ne(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let nn=tw||tb&&tv<63;function nr(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(tw&&i&&"false"==i.contentEditable)return ni(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return ni(i);else if(o)return ni(o)}}function ni(e){return e.contentEditable="true",tw&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function no(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ns(e,t){if(t instanceof eU){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(na(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else na(e)}function na(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function nl(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||eF.between(t,n,r)}function nc(e){return(!e.editable||!!e.hasFocus())&&nd(e)}function nd(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nu(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&ez.findFrom(o,t)}function nh(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function np(e,t,n){let r=e.state.selection;if(r instanceof eF){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return nh(e,new eF(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nu(e.state,t);return!!n&&n instanceof eU&&nh(e,n)}else if(!(tk&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(eU.isSelectable(i)?nh(e,new eU(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!tE&&nh(e,new eF(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof eU&&r.node.isInline)return nh(e,new eF(t>0?r.$to:r.$from));let n=nu(e.state,t);return!!n&&nh(e,n)}}function nf(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function nm(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ng(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(tg&&1==n.nodeType&&r<nf(n)&&nm(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(nm(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(ny(n))break;else{let t=n.previousSibling;for(;t&&nm(t,-1);)i=n.parentNode,o=e6(t),t=t.previousSibling;if(t)r=nf(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?nb(e,n,r):i&&nb(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=nf(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(nm(i.childNodes[o],1))t=i,n=++o;else break}else if(ny(i))break;else{let r=i.nextSibling;for(;r&&nm(r,1);)t=r.parentNode,n=e6(r)+1,r=r.nextSibling;if(r)o=0,s=nf(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&nb(e,t,n)}(e)}function ny(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function nb(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!to(e);)t=e6(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!to(e);)t=e6(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ts(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&nt(e)},50)}function nv(e,t){let n=e.state.doc.resolve(t);if(!(tb||tS)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function nw(e,t,n){let r=e.state.selection;if(r instanceof eF&&!r.empty||n.indexOf("s")>-1||tk&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nu(e.state,t);if(n&&n instanceof eU)return nh(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof eq?ez.near(n,t):ez.findFrom(n,t);return!!s&&nh(e,s)}return!1}function nx(e,t){if(!(e.state.selection instanceof eF))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function nk(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nS(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||G.fromSchema(e.state.schema),a=nO(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=nT[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function nC(e,t,n,r,o){let s,a,l=o.parent.type.spec.code;if(!n&&!t)return null;let c=!!t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return a=new d(i.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{a=t(a,e,!0)}),a;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)a=n;else{let n=o.marks(),{schema:r}=e.state,i=G.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(i.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=nO().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&nT[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(nD||(nD=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),nD.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),tE&&function(e){let t=e.querySelectorAll(tb?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||H.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||h),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||nE.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)a=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:o,openStart:s,openEnd:a}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;o=i.from(t.create(r[e+1],o)),s++,a++}return new d(o,s,a)}(nA(a,+h[1],+h[2]),h[4]);else if((a=d.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),o,s=[];if(e.forEach(e=>{if(!s)return;let t=r.findWrapping(e.type),n;if(!t)return s=null;if(n=s.length&&o.length&&function e(t,n,r,o,s){if(s<t.length&&s<n.length&&t[s]==n[s]){let a=e(t,n,r,o.lastChild,s+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(s==t.length-1?r.type:t[s+1]))return o.copy(o.content.append(i.from(nM(r,t,s+1))))}}(t,o,e,s[s.length-1],0))s[s.length-1]=n;else{s.length&&(s[s.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),o=t.contentMatchAt(t.childCount).fillBefore(i.empty,!0);return t.copy(r.append(o))}(s[s.length-1],o.length));let n=nM(e,t);s.push(n),r=r.matchType(n.type),o=t}}),s)return i.from(s)}return e}(a.content,o),!0)).openStart||a.openEnd){let e=0,t=0;for(let t=a.content.firstChild;e<a.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=a.content.lastChild;t<a.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);a=nA(a,e,t)}return e.someProp("transformPasted",t=>{a=t(a,e,c)}),a}let nE=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function nM(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,i.from(e));return e}function nN(e,t,n,r,o,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(s=0),o<r-1&&(l=nN(l,t,n,r,o+1,s)),o>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function nA(e,t,n){return t<e.openStart&&(e=new d(nN(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new d(nN(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let nT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nR=null;function nO(){return nR||(nR=document.implementation.createHTMLDocument("title"))}let nD=null,nj={},nI={},nL={touchstart:!0,touchmove:!0};class nP{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function n_(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function nz(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>n$(e,t))})}function n$(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function nH(e){return{left:e.clientX,top:e.clientY}}function nB(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function nF(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}nI.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!nW(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!tC||!tb||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!tx||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||tk&&72==r&&"c"==i)return nx(e,-1)||ng(e,-1);if(46==r&&!t.shiftKey||tk&&68==r&&"c"==i)return nx(e,1)||ng(e,1);if(13==r||27==r)return!0;if(37==r||tk&&66==r&&"c"==i){let t=37==r?"ltr"==nv(e,e.state.selection.from)?-1:1:-1;return np(e,t,i)||ng(e,t)}if(39==r||tk&&70==r&&"c"==i){let t=39==r?"ltr"==nv(e,e.state.selection.from)?1:-1:1;return np(e,t,i)||ng(e,t)}else if(38==r||tk&&80==r&&"c"==i)return nw(e,-1,i)||ng(e,-1);else if(40==r||tk&&78==r&&"c"==i)return function(e){if(!tw||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;nk(e,n,"true"),setTimeout(()=>nk(e,n,"false"),20)}return!1}(e)||nw(e,1,i)||ng(e,1);else if(i==(tk?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():n_(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},nI.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},nI.keypress=(e,t)=>{if(nW(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||tk&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof eF)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let nV=tk?"metaKey":"ctrlKey";nj.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=nG(e),s=Date.now(),a="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[nV]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(nH(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new nU(e,l,t,!!o)):("doubleClick"==a?function(e,t,n,r){return nB(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return nB(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(nF(e,eF.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)nF(e,eF.create(r,o+1,o+1+n.content.size),"pointer");else{if(!eU.isSelectable(n))continue;nF(e,eU.create(r,o),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():n_(e,"pointer"))};class nU{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[nV],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof eU&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&tg&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),n_(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nH(e))),this.updateAllowDefault(e),this.allowDefault||!t)n_(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,nB(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof eU&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(eU.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(nF(e,eU.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&eU.isSelectable(r))&&(nF(e,new eU(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||tw&&this.mightDrag&&!this.mightDrag.node.isAtom||tb&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(nF(this.view,ez.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):n_(this.view,"pointer")}}move(e){this.updateAllowDefault(e),n_(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function nW(e,t){return!!e.composing||!!(tw&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}nj.touchstart=e=>{e.input.lastTouch=Date.now(),nG(e),n_(e,"pointer")},nj.touchmove=e=>{e.input.lastTouch=Date.now(),n_(e,"pointer")},nj.contextmenu=e=>nG(e);let nq=tC?5e3:-1;function nK(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>nG(e),t))}function nJ(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function nG(e,t=!1){if(!tC||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nJ(e),t||e.docView&&e.docView.dirty){let n=t8(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}nI.compositionstart=nI.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof eF&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||tb&&tS&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),nG(e,!0),e.markCursor=null;else if(nG(e,!t.selection.empty),tg&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}nK(e,nq)},nI.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,nK(e,20))};let nX=tf&&tm<15||tx&&tM<604;function nZ(e,t,n,r,i){let o=nC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||d.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nY(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nj.copy=nI.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=nX?null:t.clipboardData,{dom:o,text:s}=nS(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},nI.paste=(e,t)=>{if(e.composing&&!tC)return;let n=nX?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&nZ(e,nY(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nZ(e,r.value,null,i,t):nZ(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class nQ{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let n0=tk?"altKey":"ctrlKey";function n1(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[n0]}for(let e in nj.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(nH(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof eU?i.to-1:i.to));else if(r&&r.mightDrag)n=eU.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=eU.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=nS(e,s);t.dataTransfer.files.length&&tb&&!(tv>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(nX?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",nX||t.dataTransfer.setData("text/plain",l),e.dragging=new nQ(c,n1(e,t),n)},nj.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},nI.dragover=nI.dragenter=(e,t)=>t.preventDefault(),nI.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(nH(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=nC(e,nY(t.dataTransfer),nX?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&n1(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||d.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let a=o?eC(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(h))return;let p=l.doc.resolve(c);if(u&&eU.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new eU(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(nl(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},nj.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&nt(e)},20))},nj.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},nj.beforeinput=(e,t)=>{if(tb&&tC&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,ta(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},nI)nj[e]=nI[e];function n2(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class n5{constructor(e,t){this.toDOM=e,this.spec=t||n7,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new n6(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof n5&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&n2(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class n3{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new n6(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n3&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}static is(e){return e.type instanceof n3}destroy(){}}class n4{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new n6(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof n4&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}destroy(){}}class n6{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new n6(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new n6(e,e,new n5(t,n))}static inline(e,t,n,r){return new n6(e,t,new n3(n,r))}static node(e,t,n,r){return new n6(e,t,new n4(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof n3}get widget(){return this.type instanceof n5}}let n9=[],n7={};class n8{constructor(e,t){this.local=e.length?e:n9,this.children=t.length?t:n9}static create(e,t){return t.length?ro(t,e,0,n7):re}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==re||0==e.maps.length?this:this.mapInner(e,t,0,0,n||n7)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=re?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=ro(function(e,t,n,r,i,o,s){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,o);a?n.push(a):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[a+2],t[a]+o+1);return n}(a,e,t,n,i,o,s),r,0,s);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new n8(t.sort(rs),a)}(this.children,o||[],e,t,n,r,i):o?new n8(o.sort(rs),n9):re}add(e,t){return t.length?this==re?n8.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,a;if(a=rr(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,a,s+1):r.splice(i,0,o,o+e.nodeSize,ro(a,e,s+1,n7)),i+=3}});let o=rn(i?ri(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new n8(o.length?this.local.concat(o).sort(rs):this.local,r||this.children)}remove(e){return 0==e.length||this==re?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=re?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new n8(r,n):re}forChild(e,t){let n,r;if(this==re)return this;if(t.isLeaf)return n8.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof n3){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new n8(r.sort(rs),n9);return n?new rt([e,n]):e}return n||re}eq(e){if(this==e)return!0;if(!(e instanceof n8)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ra(this.localsInner(e))}localsInner(e){if(this==re)return n9;if(e.inlineContent||!this.local.some(n3.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof n3||t.push(this.local[e]);return t}forEachSet(e){e(this)}}n8.empty=new n8([],[]),n8.removeOverlap=ra;let re=n8.empty;class rt{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,n7));return rt.from(n)}forChild(e,t){if(t.isLeaf)return n8.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=re&&(i instanceof rt?n=n.concat(i.members):n.push(i))}return rt.from(n)}eq(e){if(!(e instanceof rt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ra(n?t:t.sort(rs)):n9}static from(e){switch(e.length){case 0:return re;case 1:return e[0];default:return new rt(e.every(e=>e instanceof n8)?e:e.reduce((e,t)=>e.concat(t instanceof n8?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function rn(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new n6(i.from+t,i.to+t,i.type))}return n}function rr(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function ri(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ro(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=rr(e,t,s+n);if(a){o=!0;let e=ro(a,t,n+s+1,r);e!=re&&i.push(s,s+t.nodeSize,e)}});let s=rn(o?ri(e):e,-n).sort(rs);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new n8(s,i):re}function rs(e,t){return e.from-t.from||e.to-t.to}function ra(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),rl(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),rl(t,i,r.copy(o.from,r.to)));break}}return t}function rl(e,t,n){for(;t<e.length&&rs(n,e[t])>0;)t++;e.splice(t,0,n)}function rc(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=re&&t.push(r)}),e.cursorWrapper&&t.push(n8.create(e.state.doc,[e.cursorWrapper.deco])),rt.from(t)}let rd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ru=tf&&tm<=11;class rh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class rp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);tf&&tm<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():tw&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),ru&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nc(this.view)){if(this.suppressingSelectionUpdates)return nt(this.view);if(tf&&tm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=e9(n))t.add(n);for(let r=e.anchorNode;r;r=e9(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nc(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(tg&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&ts(r)&&(c=t8(t))&&c.eq(ez.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nt(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!rf.has(e)&&(rf.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=tg,rm||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),rm=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,l)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nt(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(tf&&tm<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?e6(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?e6(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let rf=new WeakMap,rm=!1;function rg(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return tt(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function ry(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(tw&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||tw&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let rb=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rv(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nl(e,t.resolve(n.anchor),t.resolve(n.head))}function rw(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function rx(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class rk{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new nP,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rE(this),rC(this),this.nodeViews=rM(this),this.docView=tG(this.state.doc,rS(this),rc(this),this.dom,this),this.domObserver=new rp(this,(e,t,n,r)=>(function(e,t,n,r,o){let s,a,l,c=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=t8(e,t);if(n&&!e.state.selection.eq(n)){if(tb&&tC&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let d=e.state.doc.resolve(t),u=d.sharedDepth(n);t=d.before(u+1),n=e.state.doc.resolve(n).after(u+1);let h=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],ts(c)||r.push({node:c.focusNode,offset:c.focusOffset})),tb&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,h=e.someProp("domParser")||H.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:ry,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),f=e.state.doc,m=f.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,a="end"):(s=e.state.selection.from,a="start"),e.input.lastKeyCode=null;let g=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,a));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&rx(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;(o-=t)&&o<e.size&&rx(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(m.content,p.doc.content,p.from,s,a);if(g&&e.input.domChangeCount++,(tx&&e.input.lastIOSEnter>Date.now()-225||tC)&&o.some(e=>1==e.nodeType&&!rb.test(e.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(r&&h instanceof eF&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))g={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let t=rv(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eF&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),tf&&tm<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let y=p.doc.resolveNoCache(g.start-p.from),b=p.doc.resolveNoCache(g.endB-p.from),v=f.resolve(g.start),w=y.sameParent(b)&&y.parent.inlineContent&&v.end()>=g.endA;if((tx&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!w&&y.pos<p.doc.content.size&&(!y.sameParent(b)||!y.parent.inlineContent)&&y.pos<b.pos&&!/\S/.test(p.doc.textBetween(y.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||rw(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(rw(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||rw(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,g.start,g.endA,y,b)&&e.someProp("handleKeyDown",t=>t(e,ta(8,"Backspace")))){tC&&tb&&e.domObserver.suppressSelectionUpdates();return}tb&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),tC&&!w&&y.start()!=b.start()&&0==b.parentOffset&&y.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,b=p.doc.resolveNoCache(g.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,ta(13,"Enter"))})},20));let x=g.start,k=g.endA,S=t=>{let n=t||e.state.tr.replace(x,k,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let t=rv(e,n.doc,p.sel);t&&!(tb&&e.composing&&t.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==n.mapping.map(k)-1)||tf&&t.empty&&t.head==x)&&n.setSelection(t)}return c&&n.setMeta("composition",c),n.scrollIntoView()};if(w)if(y.pos==b.pos){tf&&tm<=11&&0==y.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>nt(e),20));let t=S(e.state.tr.delete(x,k)),n=f.resolve(g.start).marksAcross(f.resolve(g.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(g.endA==g.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,s=r,a,l,c;for(let e=0;e<r.length;e++)o=r[e].removeFromSet(o);for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);if(1==o.length&&0==s.length)l=o[0],a="add",c=e=>e.mark(l.addToSet(e.marks));else{if(0!=o.length||1!=s.length)return null;l=s[0],a="remove",c=e=>e.mark(l.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(c(t.child(e)));if(i.from(d).eq(e))return{mark:l,type:a}}(y.parent.content.cut(y.parentOffset,b.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){let t=S(e.state.tr);"add"==l.type?t.addMark(x,k,l.mark):t.removeMark(x,k,l.mark),e.dispatch(t)}else if(y.parent.child(y.index()).isText&&y.index()==b.index()-!b.textOffset){let t=y.parent.textBetween(y.parentOffset,b.parentOffset),n=()=>S(e.state.tr.insertText(t,x,k));e.someProp("handleTextInput",r=>r(e,x,k,t,n))||e.dispatch(n())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in nj){let n=nj[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||n$(e,t)||!e.editable&&t.type in nI||n(e,t)},nL[t]?{passive:!0}:void 0)}tw&&e.dom.addEventListener("input",()=>null),nz(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nz(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rN),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(nJ(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rM(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&nz(this),this.editable=rE(this),rC(this);let c=rc(this),d=rS(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(o.selection))&&(a=!0);let p="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:tT(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=h&&(tf||tb)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(a)!=i.$anchor.start(a));if(h){let t=tb?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=ti(e=e.childNodes[t-1])}else{if(!e.parentNode||to(e))return null;t=e6(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||to(e))return null;t=e6(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=tG(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),tt(t.node,t.offset,n.anchorNode,n.anchorOffset)))?nt(this,l):(ns(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;tR(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof eU){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&tA(this,t.getBoundingClientRect(),e)}else tA(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new nQ(e.slice,e.move,r<0?void 0:eU.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(tf){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(tO)return e.focus(tO);let t=tT(e);e.focus(null==tO?{get preventScroll(){return tO={preventScroll:!0},!0}}:void 0),tO||(tO=!1,tR(t,0))}(this.dom),nt(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ti(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ti(r.startContainer),r.startOffset)}}}(o,t.left,t.top);l&&({node:s,offset:a}=l);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!tD(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(tD(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(tw)for(let e=c;s&&e;e=e9(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(tg&&1==s.nodeType&&(a=Math.min(a,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}tE&&a&&1==s.nodeType&&1==(n=s.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=s.nodeType||"BR"!=s.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,l=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,a=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(l=u+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=tI(r,1);if(n.top!=n.bottom&&tD(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:l}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return tP(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return tB==t&&tF==n?tV:(tB=t,tF=n,tV="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,t$(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=tP(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?tH.test(r.parent.textContent)&&s.modify?t$(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:a}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,a),t&&(t!=o||i!=a)&&s.extend&&s.extend(t,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return nZ(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return nZ(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nS(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,te()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!n$(this,e)&&nj[e.type]&&(this.editable||!(e.type in nI))&&nj[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?tw&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return rg(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?rg(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function rS(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[n6.node(0,e.state.doc.content.size,t)]}function rC(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:n6.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function rE(e){return!e.someProp("editable",t=>!1===t(e.state))}function rM(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function rN(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}rk.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},e.s(["Decoration",0,n6,"DecorationSet",0,n8,"EditorView",0,rk],362615);for(var rA={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},rT={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rR="u">typeof navigator&&/Mac/.test(navigator.platform),rO="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rD=0;rD<10;rD++)rA[48+rD]=rA[96+rD]=String(rD);for(var rD=1;rD<=24;rD++)rA[rD+111]="F"+rD;for(var rD=65;rD<=90;rD++)rA[rD]=String.fromCharCode(rD+32),rT[rD]=String.fromCharCode(rD);for(var rj in rA)rT.hasOwnProperty(rj)||(rT[rj]=rA[rj]);let rI="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),rL="u">typeof navigator&&/Win/.test(navigator.platform);function rP(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 r_(e){return new e2({props:{handleKeyDown:rz(e)}})}function rz(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(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))rI?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(rR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||rO&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?rT:rA)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[rP(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[rP(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(rL&&n.ctrlKey&&n.altKey)&&(o=rA[n.keyCode])&&o!=i){let r=t[rP(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}if(e.s(["keydownHandler",0,rz,"keymap",0,r_],202008),"u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var r$=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,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}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:s}=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:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),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,s=this.map[o];!n[s]&&(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}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 t(e)||n(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,s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){let c=e.child(a);l++;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:l,n:h-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=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}),l++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new r$(t,n,r,o),l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&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 s=n.nodeAt(o);if(!s)throw RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let n=0;n<l.colspan;n++){let r=t[(i+n)%e.width*2];null==r||l.colwidth&&l.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}(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e),a}(e))}};function rH(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 rB=new e4("selectingCells");function rF(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 rV(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 rU(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=rF(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 rW(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function rq(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function rK(e,t,n){let r=e.node(-1),i=r$.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function rJ(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}function rG(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}var rX=class e extends ez{constructor(e,t=e){const n=e.node(-1),r=r$.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=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 e$(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),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(rW(r)&&rW(i)&&rq(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 eF.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=r$.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let n=r.top;n<r.bottom;n++){let a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){let n=t.map[i];if(o[n])continue;o[n]=!0;let s=t.findCell(n),l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);let c=r.left-s.left,d=s.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=rJ(e,0,c)),d>0&&(e=rJ(e,e.colspan-d,d)),s.left<r.left){if(!(l=l.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}s.push(e.child(n).copy(i.from(a)))}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new d(i.from(a),1,1)}replace(e,t=d.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?d.empty:t)}let i=ez.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new d(i.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=r$.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=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=r$.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=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.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 rZ(this.$anchorCell.pos,this.$headCell.pos)}};rX.prototype.visible=!1,ez.jsonID("cell",rX);var rZ=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&&rq(t,n)?new rX(t,n):ez.near(n,1)}};function rY(e){if(!(e.selection instanceof rX))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(n6.node(n,n+e.nodeSize,{class:"selectedCell"}))}),n8.create(e.doc,t)}let rQ=new e4("fix-tables");function r0(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,o,s=r$.get(t);if(!s.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<s.height;e++)a.push(0);for(let e=0;e<s.problems.length;e++){let i=s.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,rJ(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 l=0,c=n+1;l<s.height;l++){let n=t.child(l),s=c+n.nodeSize,d=a[l];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=rH(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==l||i==l-1)&&o==l?c+1:s-1;r.insert(r.mapping.map(u),a)}c=s}return r.setMeta(rQ,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let o=t.childCount,s=n.childCount;n:for(let a=0,l=0;a<s;a++){let s=n.child(a);for(let e=l,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==s){l=e+1,r+=s.nodeSize;continue n}i(s,r),l<o&&t.child(l).sameMarkup(s)?e(t.child(l),s,r+1,i):s.nodesBetween(0,s.content.size,i,r+1),r+=s.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function r1(e){let t=r$.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 s=o*i+n,a=t.map[s];if(o>0){let e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function r2(e,t){let n=[],r=r$.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){let i=e.child(s),a=[];for(let n=0;n<o;n++){let i=t[s][n];if(!i)continue;let o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;let c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function r5(e,t,n,r){let i,o=t[0]>n[0]?-1:1,s=e.splice(t[0],t.length),a=+(s.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,...s),e}function r3(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 r4(e,t){let n=r3(t.$from);if(!n)return;let r=r$.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 r6(e,t){let n=r3(t.$from);if(!n)return;let r=r$.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 r9(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r4(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=r4(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 s=[];for(let t=i;t<=o;t++){let n=r4(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r4(i,e.selection),l=r6(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r4(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r7(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r6(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=r6(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 s=[];for(let t=i;t<=o;t++){let n=r6(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r6(i,e.selection),l=r4(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r6(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r8(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function ie(e){let t=e.selection,n=rU(e),r=n.node(-1),i=n.start(-1),o=r$.get(r);return{...t instanceof rX?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function it(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=rH(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 s=0;s<t.height;s++){let a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,rG(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{let l=null==o?rH(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function ir(e,{map:t,tableStart:n,table:r},i){let o=n;for(let e=0;e<i;e++)o+=r.child(e).nodeSize;let s=[],a=i>0?-1:0;(function(e,t,n){var r;let i=rH(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if((null==(r=t.nodeAt(e.map[o+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+a)&&(a=0==i||i==t.height?null:0);for(let o=0,c=t.width*i;o<t.width;o++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],s=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...s,rowspan:s.rowspan+1}),o+=s.colspan-1}else{var l;let e=null==a?rH(r.type.schema).cell:null==(l=r.nodeAt(t.map[c+a*t.width]))?void 0:l.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(o,rH(r.type.schema).row.create(null,s)),e}function ii(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function io(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 is(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=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=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=io("row",i,r),a=io("column",i,r),l=+("column"===e?!!s:"row"===e&&!!a),c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?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}}is("row",{useDeprecatedLogic:!0}),is("column",{useDeprecatedLogic:!0});let ia=is("cell",{useDeprecatedLogic:!0});function il(e,t){let n=e.selection;if(!(n instanceof rX))return!1;if(t){let r=e.tr,i=rH(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 d(i,0,0))}),r.docChanged&&t(r)}return!0}function ic(e,t){let n=e.createAndFill();return new eP(n).replace(0,n.content.size,t).doc}function id(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){let i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!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:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function iu(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){let i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,rJ(i.attrs,s-d,i.attrs.colspan-(s-d))),e.insert(u+i.nodeSize,i.type.createAndFill(rJ(i.attrs,0,s-d))),c+=i.attrs.rowspan-1}}return l}function ih(e,t,n,r,o){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw Error("No table found");let a=r$.get(s),{top:l,left:c}=r,u=c+o.width,h=l+o.height,p=e.tr,f=0;function m(){if(!(s=n?p.doc.nodeAt(n-1):p.doc))throw Error("No table found");a=r$.get(s),f=p.mapping.maps.length}(function(e,t,n,r,o,s){let a,l,c=rH(e.doc.type.schema);if(o>t.width)for(let i=0,s=0;i<t.height;i++){let d,u=n.child(i);s+=u.nodeSize;let h=[];d=null==u.lastChild||u.lastChild.type==c.cell?a||(a=c.cell.createAndFill()):l||(l=c.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(d);e.insert(e.mapping.slice(0).map(s-1+r),h)}if(s>t.height){let d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==c.header_cell;d.push(i?l||(l=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}let u=c.row.create(null,i.from(d)),h=[];for(let e=t.height;e<s;e++)h.push(u);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),h)}return!!(a||l)})(p,a,s,n,u,h)&&m(),id(p,a,s,n,c,u,l,f)&&m(),id(p,a,s,n,c,u,h,f)&&m(),iu(p,a,s,n,l,h,c,f)&&m(),iu(p,a,s,n,l,h,u,f)&&m();for(let e=l;e<h;e++){let t=a.positionAt(e,c,s),r=a.positionAt(e,u,s);p.replace(p.mapping.slice(f).map(t+n),p.mapping.slice(f).map(r+n),new d(o.rows[e-l],0,0))}m(),p.setSelection(new rX(p.doc.resolve(n+a.positionAt(l,c,s)),p.doc.resolve(n+a.positionAt(h-1,u-1,s)))),t(p)}let ip=rz({ArrowLeft:ig("horiz",-1),ArrowRight:ig("horiz",1),ArrowUp:ig("vert",-1),ArrowDown:ig("vert",1),"Shift-ArrowLeft":iy("horiz",-1),"Shift-ArrowRight":iy("horiz",1),"Shift-ArrowUp":iy("vert",-1),"Shift-ArrowDown":iy("vert",1),Backspace:il,"Mod-Backspace":il,Delete:il,"Mod-Delete":il});function im(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function ig(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof rX)return im(n,r,ez.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let s=ix(i,e,t);if(null==s)return!1;if("horiz"==e)return im(n,r,ez.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(s),a=rK(o,e,t);return i=a?ez.near(a,1):t<0?ez.near(n.doc.resolve(o.before(-1)),-1):ez.near(n.doc.resolve(o.after(-1)),1),im(n,r,i)}}}function iy(e,t){return(n,r,i)=>{let o;if(!i)return!1;let s=n.selection;if(s instanceof rX)o=s;else{let r=ix(i,e,t);if(null==r)return!1;o=new rX(n.doc.resolve(r))}let a=rK(o.$headCell,e,t);return!!a&&im(n,r,new rX(o.$anchorCell,a))}}function ib(e,t){let n=rF(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new rX(n))),!0)}function iv(e,t,n){if(!rV(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 o=t.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==s)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=ic(rH(a).row,new d(i,o,s)).content),l.push(i)}else{if("cell"!=s&&"header_cell"!=s)return null;l.push(n||r?ic(rH(a).row,new d(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 o=0;o<n.length;o++)if(o>=t.length&&t.push(i.empty),n[o]<r){let s=rH(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(s);t[o]=t[o].append(i.from(a))}return{height:t.length,width:r,rows:t}}(a,l)}(n),o=e.state.selection;if(o instanceof rX){r||(r={width:1,height:1,rows:[i.from(ic(rH(e.state.schema).cell,n))]});let t=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=r$.get(t).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){let t=[],o=[];for(let e=0;e<n.length;e++){let s=n[e],a=[];for(let n=t[e]||0,i=0;n<r;i++){let o=s.child(i%s.childCount);n+o.attrs.colspan>r&&(o=o.type.createChecked(rJ(o.attrs,o.attrs.colspan,n+o.attrs.colspan-r),o.content)),a.push(o),n+=o.attrs.colspan;for(let n=1;n<o.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+o.attrs.colspan}o.push(i.from(a))}n=o,e=r}if(t!=o){let e=[];for(let r=0,s=0;r<o;r++,s++){let a=[],l=n[s%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(i.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}(r,a.right-a.left,a.bottom-a.top),ih(e.state,e.dispatch,s,a,r),!0}if(!r)return!1;{let t=rU(e.state),n=t.start(-1);return ih(e.state,e.dispatch,n,r$.get(t.node(-1)).findCell(t.pos-n),r),!0}}function iw(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=ik(e,t.target);if(t.shiftKey&&e.state.selection instanceof rX)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=rF(e.state.selection.$anchor))&&(null==(n=iS(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=iS(e,n),i=null==rB.getState(e.state);if(!r||!rq(t,r))if(!i)return;else r=t;let o=new rX(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(rB,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=rB.getState(e.state)&&e.dispatch(e.state.tr.setMeta(rB,-1))}function a(n){let r,a=rB.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(ik(e,n.target)!=i&&!(r=iS(e,t)))return s();r&&o(r,n)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function ix(e,t,n){if(!(e.state.selection instanceof eF))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),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function ik(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function iS(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&&rF(e.state.doc.resolve(r))||rF(e.state.doc.resolve(i))}var iC=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")),iE(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,iE(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function iE(e,t,n,r,i,o){let s=0,a=!0,l=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(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;let e=l.nextSibling;null==(d=l.parentNode)||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}let iM=new e4("tableColumnResizing");var iN=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(iM);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 rW(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function iA(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,s=rF(e.state.doc.resolve(o));if(!s)return -1;if("right"==n)return s.pos;let a=r$.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function iT(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function iR(e,t){e.dispatch(e.state.tr.setMeta(iM,{setHandle:t}))}function iO(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=r$.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&iE(o,l.firstChild,l,r,a,n)}e.s(["CellSelection",0,rX,"addColumnAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.right))}return!0},"addColumnBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.left))}return!0},"addRowAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.bottom))}return!0},"addRowBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.top))}return!0},"cellAround",0,rF,"columnResizing",0,function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=iC,lastColumnResizable:i=!0}={}){let o=new e2({key:iM,state:{init(e,t){var i;let s=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=rH(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new iN(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=iM.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=iM.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),s=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=iA(e,t,"left",n):i-t.clientX<=n&&(s=iA(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=r$.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}iR(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=iM.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&iR(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,s=iM.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=iM.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=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=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,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,iT(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(iM,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=iM.getState(e.state);if(i&&i.dragging){let o=iT(i.dragging,t,n);iO(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(iM,{setDragging:{startX:t.clientX,startWidth:l}})),iO(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=iM.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 n8.empty;let o=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+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 l;let t=o.map[r],a=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(l=iM.getState(e))?void 0:l.dragging)&&n.push(n6.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(n6.widget(a,c))}}return n8.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o},"deleteColumn",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(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 s=0;s<t.height;){let a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,rJ(d,i-t.colCount(l)));else{let t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=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=r$.get(e)}t(r)}return!0},"deleteRow",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(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 s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);let l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){let c=t.map[s];if(!l.has(c)){if(l.add(c),i>0&&c==t.map[s-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[s+t.width]){let s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=l.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=r$.get(n.table)}t(r)}return!0},"deleteTable",0,function(e,t){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},"fixTables",0,r0,"goToNextCell",0,function(e){return function(t,n){if(!rV(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}(rU(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(eF.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}},"isInTable",0,rV,"mergeCells",0,function(e,t){let n=e.selection;if(!(n instanceof rX)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=ie(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,a=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[a]==n[a+1])return!0;o+=e,a+=e}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}(o,r))return!1;if(t){let n,s,a=e.tr,l={},c=i.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let i=o.map[e*o.width+t],d=r.table.nodeAt(i);if(!l[i]&&d)if(l[i]=!0,null==n)n=i,s=d;else{ii(d)||(c=c.append(d.content));let e=a.mapping.map(i+r.tableStart);a.delete(e,e+d.nodeSize)}}if(null==n||null==s)return!0;if(a.setNodeMarkup(n+r.tableStart,null,{...rG(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){let e=n+1+s.content.size,t=ii(s)?n+1:e;a.replaceWith(t+r.tableStart,e+r.tableStart,c)}a.setSelection(new rX(a.doc.resolve(n+r.tableStart))),t(a)}return!0},"moveTableColumn",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r9(a,l))?void 0:t.indexes,f=null==(n=r9(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r8(r1(r)),r2(r,s=r8(s=r5(s,i,o,0))));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(g.height-1,c,m),v=a.doc.resolve(y+b),w=g.positionAt(0,c,m),x=a.doc.resolve(y+w);return a.setSelection(rX.colSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"moveTableRow",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r7(a,l))?void 0:t.indexes,f=null==(n=r7(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r1(r),r2(r,s=r5(s,i,o,0)));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(c,g.width-1,m),v=a.doc.resolve(y+b),w=g.positionAt(c,0,m),x=a.doc.resolve(y+w);return a.setSelection(rX.rowSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"selectedRect",0,ie,"setCellAttr",0,function(e,t){return function(n,r){if(!rV(n))return!1;let i=rU(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let o=n.tr;n.selection instanceof rX?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}},"splitCell",0,function(e,t){var n;let r=rH(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,o=e.selection;if(o instanceof rX){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from)))return!1;i=null==(s=rF(o.$from))?void 0:s.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let s,a=r.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=ie(e),u=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(c?{...a,colwidth:c&&c[e]?[c[e]]:null}:a);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=r.nodeSize);for(let i=d.left,o=0;i<d.right;i++,o++)(i!=d.left||e!=d.top)&&u.insert(s=u.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(l[o]))}u.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),l[0]),o instanceof rX&&u.setSelection(new rX(u.doc.resolve(o.$anchorCell.pos),s?u.doc.resolve(s):void 0)),t(u)}return!0})(e,t)},"tableEditing",0,function({allowTableNodeSelection:e=!1}={}){return new e2({key:rB,state:{init:()=>null,apply(e,t){let n=e.getMeta(rB);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:rY,handleDOMEvents:{mousedown:iw},createSelectionBetween:e=>null!=rB.getState(e.state)?e.state.selection:null,handleTripleClick:ib,handleKeyDown:ip,handlePaste:iv},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,o=(t||e).selection,s=(t||e).doc;if(o instanceof eU&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=rX.create(s,o.from);else if("row"==i){let e=s.resolve(o.from+1);r=rX.rowSelection(e,e)}else if(!n){let e=r$.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=rX.create(s,t+1,n)}}else o instanceof eF&&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=eF.create(s,o.from):o instanceof eF&&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=eF.create(s,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,r0(r,n),e)})},"toggleHeader",0,is,"toggleHeaderCell",0,ia],608926),e.s([],150663),e.i(335884);var iD=e.i(101685),ij=e.i(380560),iI=e.i(3909),iL=e.i(44501);let iP=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function i_(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let iz=(e,t,n)=>{let r=i_(e,n);if(!r)return!1;let i=iF(r);if(!i){let n=r.blockRange(),i=n&&em(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(iY(e,i,t,-1))return!0;if(0==r.parent.content.size&&(iH(o,"end")||eU.isSelectable(o)))for(let n=r.depth;;n--){let s=eE(e.doc,r.before(n),r.after(n),d.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(iH(o,"end")?ez.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):eU.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)};function i$(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,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=eE(e.doc,i,s,d.empty);if(!a||a.from!=i||a instanceof eu&&a.slice.size>=s-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(eF.create(t.doc,i)),n(t.scrollIntoView())}return!0}function iH(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 iB=(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=iF(r)}let s=o&&o.nodeBefore;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function iF(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 iV(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let iU=(e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iq(r);if(!i)return!1;let o=i.nodeAfter;if(iY(e,i,t,1))return!0;if(0==r.parent.content.size&&(iH(o,"start")||eU.isSelectable(o))){let n=eE(e.doc,r.before(),r.after(),d.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(iH(o,"start")?ez.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):eU.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)},iW=(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=iq(r)}let s=o&&o.nodeAfter;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos)).scrollIntoView()),!0)};function iq(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}let iK=(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)};function iJ(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 iG=(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),s=iJ(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(ez.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},iX=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof eq||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=iJ(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,s=e.tr.insert(n,o.createAndFill());s.setSelection(eF.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},iZ=(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(ew(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&em(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function iY(e,t,n,r){let o,s,a,l=t.nodeBefore,c=t.nodeAfter,u,h,p=l.type.spec.isolating||c.type.spec.isolating;if(!p&&(o=t.nodeBefore,s=t.nodeAfter,a=t.index(),o&&s&&o.type.compatibleContent(s.type)&&(!o.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(a,a+1)&&!!(s.isTextblock||ex(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let f=!p&&t.parent.canReplace(t.index(),t.index()+1);if(f&&(u=(h=l.contentMatchAt(l.childCount)).findWrapping(c.type))&&h.matchType(u[0]||c.type).validEnd){if(n){let r=t.pos+c.nodeSize,o=i.empty;for(let e=u.length-1;e>=0;e--)o=i.from(u[e].create(null,o));o=i.from(l.copy(o));let s=e.tr.step(new eh(t.pos-1,r,t.pos,r,new d(o,1,0),u.length,!0)),a=s.doc.resolve(r+2*u.length);a.nodeAfter&&a.nodeAfter.type==l.type&&ex(s.doc,a.pos)&&s.join(a.pos),n(s.scrollIntoView())}return!0}let m=c.type.spec.isolating||r>0&&p?null:ez.findFrom(t,1),g=m&&m.$from.blockRange(m.$to),y=g&&em(g);if(null!=y&&y>=t.depth)return n&&n(e.tr.lift(g,y).scrollIntoView()),!0;if(f&&iH(c,"start",!0)&&iH(l,"end")){let r=l,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=c,a=1;for(;!s.isTextblock;s=s.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=i.empty;for(let e=o.length-1;e>=0;e--)r=i.from(o[e].copy(r));n(e.tr.step(new eh(t.pos-o.length,t.pos+c.nodeSize,t.pos+a,t.pos+c.nodeSize-a,new d(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function iQ(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(eF.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let i0=iQ(-1),i1=iQ(1);function i2(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:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(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:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function i5(...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 i3=i5(iP,iz,iB),i4=i5(iP,iU,iW),i6={Enter:i5(iK,iX,iZ,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof eU&&e.selection.node.isBlock)return!!n.parentOffset&&!!ew(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),s=iJ(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof eF||e.selection instanceof eq)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=ew(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=ew(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":iG,Backspace:i3,"Mod-Backspace":i3,"Shift-Backspace":i3,Delete:i4,"Mod-Delete":i4,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new eq(e.doc))),!0)},i9={"Ctrl-h":i6.Backspace,"Alt-Backspace":i6["Mod-Backspace"],"Ctrl-d":i6.Delete,"Ctrl-Alt-Backspace":i6["Mod-Delete"],"Alt-Delete":i6["Mod-Delete"],"Alt-d":i6["Mod-Delete"],"Ctrl-a":i0,"Ctrl-e":i1};for(let e in i6)i9[e]=i6[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();var i7=Object.defineProperty,i8=(e,t)=>{for(var n in t)i7(e,n,{get:t[n],enumerable:!0})};function oe(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var ot=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!e,l=e||i.tr,c=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:oe({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},on={};i8(on,{blur:()=>or,clearContent:()=>oi,clearNodes:()=>oo,command:()=>oa,createParagraphNear:()=>ol,cut:()=>oc,deleteCurrentNode:()=>od,deleteNode:()=>oh,deleteRange:()=>op,deleteSelection:()=>om,enter:()=>og,exitCode:()=>oy,extendMarkRange:()=>oC,first:()=>oE,focus:()=>oO,forEach:()=>oD,insertContent:()=>oj,insertContentAt:()=>o_,joinBackward:()=>oH,joinDown:()=>o$,joinForward:()=>oB,joinItemBackward:()=>oF,joinItemForward:()=>oV,joinTextblockBackward:()=>oU,joinTextblockForward:()=>oW,joinUp:()=>oz,keyboardShortcut:()=>oK,lift:()=>oG,liftEmptyBlock:()=>oX,liftListItem:()=>oZ,newlineInCode:()=>oY,resetAttributes:()=>o1,scrollIntoView:()=>o2,selectAll:()=>o5,selectNodeBackward:()=>o3,selectNodeForward:()=>o4,selectParentNode:()=>o6,selectTextblockEnd:()=>o9,selectTextblockStart:()=>o7,setContent:()=>se,setMark:()=>sP,setMeta:()=>s_,setNode:()=>sz,setNodeSelection:()=>s$,setTextDirection:()=>sH,setTextSelection:()=>sB,sinkListItem:()=>sF,splitBlock:()=>sU,splitListItem:()=>sW,toggleList:()=>sJ,toggleMark:()=>sG,toggleNode:()=>sX,toggleWrap:()=>sZ,undoInputRule:()=>sY,unsetAllMarks:()=>sQ,unsetMark:()=>s0,unsetTextDirection:()=>s1,updateAttributes:()=>s2,wrapIn:()=>s5,wrapInList:()=>s3});var or=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),oi=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),oo=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),a=o.blockRange(s);if(!a)return;let l=em(a);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},oa=e=>t=>e(t),ol=()=>({state:e,dispatch:t})=>iX(e,t),oc=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new eF(r.doc.resolve(Math.max(s-1,0)))),!0},od=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ou(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var oh=e=>({tr:t,state:n,dispatch:r})=>{let i=ou(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},op=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},of=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},om=()=>({state:e,dispatch:t})=>{var n;let{$from:r,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:o,to:s}={from:of(r,n=e.schema,"left"),to:of(i,n,"right")};return t&&(e.tr.deleteRange(o,s).scrollIntoView(),t(e.tr)),!0},og=()=>({commands:e})=>e.keyboardShortcut("Enter"),oy=()=>({state:e,dispatch:t})=>iG(e,t);function ob(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ov(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:ob(t[r])?t[r].test(e[r]):t[r]===e[r])}function ow(e,t,n={}){return e.find(e=>e.type===t&&ov(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ox(e,t,n={}){return!!ow(e,t,n)}function ok(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!ow([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,a=o+r.node.nodeSize;for(;i>0&&ox([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&ox([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:a}}function oS(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var oC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=oS(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let e=ok(l,o,t);if(e&&e.from<=c&&e.to>=d){let t=eF.create(s,e.from,e.to);n.setSelection(t)}}return!0},oE=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function oM(e){return e instanceof eF}function oN(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function oA(e,t=null){if(!t)return null;let n=ez.atStart(e),r=ez.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?eF.create(e,oN(0,i,o),oN(e.content.size,i,o)):eF.create(e,oN(t,i,o),oN(t,i,o))}function oT(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function oR(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var oO=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(oR()||oT())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!oR()&&!oT()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!oM(n.state.selection))return s(),!0;let a=oA(i.doc,e)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},oD=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),oj=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),oI=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&oI(r)}return e};function oL(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return oI(new window.DOMParser().parseFromString(t,"text/html").body)}function oP(e,t,n){if(e instanceof S||e instanceof i)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return i.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),oP("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,i="",o=new z({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?H.fromSchema(o).parseSlice(oL(e),n.parseOptions):H.fromSchema(o).parse(oL(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=H.fromSchema(t);return n.slice?r.parseSlice(oL(e),n.parseOptions).content:r.parse(oL(e),n.parseOptions)}return oP("",t,n)}var o_=(e,t,n)=>({tr:r,dispatch:o,editor:s})=>{var a;if(o){let o,l;n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{oP(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(e){c(e)}try{o=oP(t,s.schema,{parseOptions:d,errorOnInvalidContent:null!=(a=n.errorOnInvalidContent)?a:s.options.enableContentCheck})}catch(e){return c(e),!1}let{from:u,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if((!("type"in o)?o:[o]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),u===h&&f){let{parent:e}=r.doc.resolve(u);!e.isTextblock||e.type.spec.code||e.childCount||(u-=1,h+=1)}if(p){if(Array.isArray(t))l=t.map(e=>e.text||"").join("");else if(t instanceof i){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),l=e}else l="object"==typeof t&&t&&t.text?t.text:t;r.insertText(l,u,h)}else{l=o;let e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,h,l)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof eu||r instanceof eh))return;let i=e.mapping.maps[n],o=0;i.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(ez.near(e.doc.resolve(o),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:l})}return!0},oz=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof eU,i;if(r){if(n.node.isTextblock||!ex(e.doc,n.from))return!1;i=n.from}else if(null==(i=eS(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(eU.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),o$=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof eU){if(n.node.isTextblock||!ex(e.doc,n.to))return!1;r=n.to}else if(null==(r=eS(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),oH=()=>({state:e,dispatch:t})=>iz(e,t),oB=()=>({state:e,dispatch:t})=>iU(e,t),oF=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oV=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oU=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=i_(e,n);if(!r)return!1;let i=iF(r);return!!i&&i$(e,i,t)})(e,t),oW=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iq(r);return!!i&&i$(e,i,t)})(e,t);function oq(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var oK=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))oR()||oq()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function oJ(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?ou(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>ov(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var oG=(e,t={})=>({state:n,dispatch:r})=>{let i=ou(e,n.schema);return!!oJ(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&em(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},oX=()=>({state:e,dispatch:t})=>iZ(e,t),oZ=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!s&&(!t||(n.node(s.depth-1).type==r?function(e,t,n,r){let o=e.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new eh(s-1,a,s,a,new d(i.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new x(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));let l=em(r);if(null==l)return!1;o.lift(r,l);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return ex(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),t(o.scrollIntoView()),!0}(e,t,r,s):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,u=s.node(-1),h=s.index(-1);if(!u.canReplace(h+ +!l,h+1,a.content.append(c?i.empty:i.from(o))))return!1;let p=s.pos,f=p+a.nodeSize;return r.step(new eh(p-!!l,f+ +!!c,p+1,f-1,new d((l?i.empty:i.from(o.copy(i.empty))).append(c?i.empty:i.from(o.copy(i.empty))),+!l,+!c),+!l)),t(r.scrollIntoView()),!0}(e,t,s)))})(t,n)},oY=()=>({state:e,dispatch:t})=>iK(e,t);function oQ(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function o0(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var o1=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,o0(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,s.create(o0(o.attrs,t))))})})}),l},o2=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),o5=()=>({tr:e,dispatch:t})=>{if(t){let t=new eq(e.doc);e.setSelection(t)}return!0},o3=()=>({state:e,dispatch:t})=>iB(e,t),o4=()=>({state:e,dispatch:t})=>iW(e,t),o6=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(eU.create(e.doc,i))),!0)})(e,t),o9=()=>({state:e,dispatch:t})=>i1(e,t),o7=()=>({state:e,dispatch:t})=>i0(e,t);function o8(e,t,n={},r={}){return oP(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var se=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if("full"!==r.preserveWhitespace){let a=o8(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function st(e,t){let n=oS(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function sn(e,t){let n=new eP(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function sr(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function si(e){return t=>sr(t.$from,e)}function so(e,t,n){return void 0===e.config[t]&&e.parent?so(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?so(e.parent,t,n):null}):e.config[t]}function ss(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=so(e,"addExtensions",t);return n?[e,...ss(n())]:e}).flat(10)}function sa(e,t){let n=G.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function sl(e){return"function"==typeof e}function sc(e,t,...n){return sl(e)?t?e.bind(t)(...n):e(...n):e}function sd(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function su(e){let t=[],{nodeExtensions:n,markExtensions:r}=sd(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=so(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=so(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sh(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let a=0;a<s;a+=1){let s=e[a];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function sp(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...sh(n[e]),...sh(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function sf(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>sp(e,t),{})}function sm(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function sg(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function sy(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function sb(e){return e.sort((e,t)=>{let n=so(e,"priority")||100,r=so(t,"priority")||100;return n>r?-1:+(n<r)})}function sv(e){var t;let n=sb(ss(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function sw(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=o);let u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),a}function sx(e,t){let n={from:0,to:e.content.size};return sw(e,n,t)}function sk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function sS(e,t){let n=oQ("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=ou(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?st(e,t):{}}function sC(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),a=n.invert().map(o,-1),l=n.invert().map(s);i.push({oldRange:{from:a,to:l},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function sE(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=ok(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function sM(e,t){return t.nodes[e]||t.marks[e]||null}function sN(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function sA(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?oS(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>ov(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>ov(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function sT(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function sR(e,t){let{nodeExtensions:n}=sd(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=sc(so(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function sO(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(sO(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function sD({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:o}=e;return!!(i<=t&&o>=t+n||r&&oM(e)&&i>t&&o<t+n)}var sj=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function sI(e,t){let n=t.mapping.mapResult(e.position);return{position:new sj(n.pos),mapResult:n}}function sL(e){return new sj(e)}var sP=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=oS(e,r.schema);if(i)if(s){let e=st(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(oM(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},s_=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sz=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=ou(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!i2(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>i2(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},s$=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=oN(e,0,n.content.size),i=eU.create(n,r);t.setSelection(i)}return!0},sH=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:a}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},sB=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=eF.atStart(n).from,s=eF.atEnd(n).to,a=oN(r,o,s),l=oN(i,o,s),c=eF.create(n,a,l);t.setSelection(c)}return!0},sF=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);if(!s)return!1;let a=s.startIndex;if(0==a)return!1;let l=s.parent,c=l.child(a-1);if(c.type!=r)return!1;if(t){let n=c.lastChild&&c.lastChild.type==l.type,o=i.from(n?r.create():null),a=new d(i.from(r.create(null,i.from(l.type.create(null,o)))),n?3:1,0),u=s.start,h=s.end;t(e.tr.step(new eh(u-(n?3:1),h,u,h,a,1,!0)).scrollIntoView())}return!0})(t,n)};function sV(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var sU=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:a,$to:l}=o,c=sN(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(o instanceof eU&&o.node.isBlock)return!!a.parentOffset&&!!ew(s,a.pos)&&(r&&(e&&sV(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1))),h=d&&u?[{type:u,attrs:c}]:void 0,p=ew(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!p&&ew(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(o instanceof eF&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),u&&!d&&!a.parentOffset&&a.parent.type!==u)){let e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&sV(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},sW=(e,t={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var a;let l=ou(e,r.schema),{$from:c,$to:u}=r.selection,h=r.selection.node;if(h&&h.isBlock||c.depth<2||!c.sameParent(u))return!1;let p=c.node(-1);if(p.type!==l)return!1;let f=s.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let e=i.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;t-=1)e=i.from(c.node(t).copy(e));let o=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,s={...sN(f,c.node().type.name,c.node().attrs),...t},u=(null==(a=l.contentMatch.defaultType)?void 0:a.createAndFill(s))||void 0;e=e.append(i.from(l.createAndFill(null,u)||void 0));let h=c.before(c.depth-(r-1));n.replace(h,c.after(-o),new d(e,4-r,0));let p=-1;n.doc.nodesBetween(h,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(eF.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}let m=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,g={...sN(f,p.type.name,p.attrs),...t},y={...sN(f,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,u.pos);let b=m?[{type:l,attrs:g},{type:m,attrs:y}]:[{type:l,attrs:g}];if(!ew(n.doc,c.pos,2))return!1;if(o){let{selection:e,storedMarks:t}=r,{splittableMarks:i}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!a||!o)return!0;let l=a.filter(e=>i.includes(e.type.name));n.ensureMarks(l)}return!0},sq=(e,t)=>{let n=si(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,n.pos))||(e.join(n.pos),!0)},sK=(e,t)=>{let n=si(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,r))||(e.join(r),!0)},sJ=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:h}=i.extensionManager,p=ou(e,s.schema),f=ou(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;let x=si(e=>sR(e.type.name,u))(m),k=0===m.from&&m.to===s.doc.content.size,S=s.doc.content.content,C=1===S.length?S[0]:null,E=k&&C&&sR(C.type.name,u)?{node:C,pos:0,depth:0}:null,M=null!=x?x:E,N=!!x&&v.depth>=1&&v.depth-x.depth<=1,A=!!E;if((N||A)&&M){if(M.node.type===p)return k&&A?l().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return eF.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(sR(M.node.type.name,u)&&p.validContent(M.node.content))return l().command(()=>(o.setNodeMarkup(M.pos,p),!0)).command(()=>sq(o,p)).command(()=>sK(o,p)).run()}return n&&w&&a?l().command(()=>{let e=d().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>sq(o,p)).command(()=>sK(o,p)).run():l().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>sq(o,p)).command(()=>sK(o,p)).run()},sG=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=oS(e,r.schema);return sA(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},sX=(e,t,n={})=>({state:r,commands:i})=>{let o,s=ou(e,r.schema),a=ou(t,r.schema),l=oJ(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),l)?i.setNode(a,o):i.setNode(s,{...o,...n})},sZ=(e,t={})=>({state:n,commands:r})=>{let i=ou(e,n.schema);return oJ(n,i,t)?r.lift(i):r.wrapIn(i,t)},sY=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},sQ=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},s0=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=oS(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:e,to:t}=a,r=null==(o=c.marks().find(e=>e.type===l))?void 0:o.attrs,i=ok(c,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},s1=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},s2=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,c,d,u,h=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(h,p,(e,t)=>{o&&o===e.type&&(l=!0,d=Math.max(t,h),u=Math.min(t+e.nodeSize,p),a=t,c=e)}):r.doc.nodesBetween(h,p,(e,r)=>{r<h&&o&&o===e.type&&(l=!0,d=Math.max(r,h),u=Math.min(r+e.nodeSize,p),a=r,c=e),r>=h&&r<=p&&(o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(l=!0,i)){let i=Math.max(r,h),a=Math.min(r+e.nodeSize,p);n.addMark(i,a,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,u,s.create({...e.attrs,...t}))}))}),l},s5=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&eg(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s3=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,s=t,a=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=a.resolve(t.start-2);s=new x(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new x(t.$from,a.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=eg(s,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let s=i.empty;for(let e=n.length-1;e>=0;e--)s=i.from(n[e].type.create(n[e].attrs,s));e.step(new eh(t.start-2*!!r,t.end,t.start,t.end,new d(s,0,0),n.length,!0));let a=0;for(let e=0;e<n.length;e++)n[e].type==o&&(a=e+1);let l=n.length-a,c=t.start+n.length-2*!!r,u=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ew(e.doc,c,l)&&(e.split(c,l),c+=2*l),c+=u.child(n).nodeSize}(e,t,l,o,n),!0)}(l,a,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s4=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},s6=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function s9(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(ob(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let s=l.state.tr,c=oe({state:l.state,transaction:s}),h={from:r-(t[0].length-o.length),to:i},{commands:p,chain:f,can:m}=new ot({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),d=!0)}),d}function s7(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var s8=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...sc(so(this,"addOptions",{name:this.name}))}}get storage(){return{...sc(so(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return s7(t)&&s7(n)&&Object.keys(n).forEach(i=>{s7(n[i])&&s7(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},ae=class e extends s8{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},at=class{constructor(e){this.find=e.find,this.handler=e.handler}},an=null,ar=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=sv(e),this.schema=function(e,t){var n;let r=su(e),{nodeExtensions:i,markExtensions:o}=sd(e),s=null==(n=i.find(e=>so(e,"topNode")))?void 0:n.name;return new z({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:sc(so(n,"content",o)),marks:sc(so(n,"marks",o)),group:sc(so(n,"group",o)),inline:sc(so(n,"inline",o)),atom:sc(so(n,"atom",o)),selectable:sc(so(n,"selectable",o)),draggable:sc(so(n,"draggable",o)),code:sc(so(n,"code",o)),whitespace:sc(so(n,"whitespace",o)),linebreakReplacement:sc(so(n,"linebreakReplacement",o)),defining:sc(so(n,"defining",o)),isolating:sc(so(n,"isolating",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:sf(e,i)}));let c=so(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:sc(so(n,"inclusive",o)),excludes:sc(so(n,"excludes",o)),group:sc(so(n,"group",o)),spanning:sc(so(n,"spanning",o)),code:sc(so(n,"code",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:sf(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:sM(t.name,this.schema)},r=so(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return sb([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sM(t.name,this.schema)},r=[],o=so(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&so(t,"exitable",n)&&(s.ArrowRight=()=>ae.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let a=r_(s);r.push(a);let l=so(t,"addInputRules",n);if(sT(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new e2({state:{init:()=>null,apply(e,o,s){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=sa(i.from(e),s.schema));let{from:o}=l,a=o+e.length;s9({editor:t,from:o,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,i,o,s)=>s9({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&s9({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&s9({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}let c=so(t,"addPasteRules",n);if(sT(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,o=null,s=!1,a=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new ot({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(i,t+y);b>=v||((e,t,n)=>{if(ob(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=b+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(h)})}),u.every(e=>null!==e)}({editor:n,state:oe({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new e2({view(e){let t=t=>{var r;(o=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(an=n)},r=()=>{an&&(an=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(a=o===e.dom.parentElement,t=n,!a){let e=an;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],d="paste"===o.getMeta("uiEvent")&&!s,u="drop"===o.getMeta("uiEvent")&&!a,h=o.getMeta("applyPasteRules"),p=!!h;if(!d&&!u&&!p)return;if(p){var f,m;let t,{text:n}=h;"string"==typeof n||(n=sa(i.from(n),r.schema));let{from:o}=h,s=o+n.length;return c({rule:e,state:r,from:o,to:{b:s},pasteEvt:(f=n,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let d=so(t,"addProseMirrorPlugins",n);if(d){let e=d();r.push(...e)}return r})}get attributes(){return su(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ou(t.name,this.schema)},i=so(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,a,l)=>{let c=sf(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return sb([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return sb([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:oS(t.name,this.schema)},i=so(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let a=sf(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{aT(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sM(e.name,this.schema)};"mark"===e.type&&(null==(t=sc(so(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=so(e,"onBeforeCreate",n),i=so(e,"onCreate",n),o=so(e,"onUpdate",n),s=so(e,"onSelectionUpdate",n),a=so(e,"onTransaction",n),l=so(e,"onFocus",n),c=so(e,"onBlur",n),d=so(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};ar.resolve=sv,ar.sort=sb,ar.flatten=ss,i8({},{ClipboardTextSerializer:()=>ao,Commands:()=>as,Delete:()=>aa,Drop:()=>al,Editable:()=>ac,FocusEvents:()=>au,Keymap:()=>ah,Paste:()=>ap,Tabindex:()=>af,TextDirection:()=>am,focusEventsPluginKey:()=>ad});var ai=class e extends s8{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},ao=ai.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=sk(n);return sw(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),as=ai.create({name:"commands",addCommands:()=>({...on})}),aa=ai.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let s=sn(e.before,[e,...t]);sC(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let a=s.mapping;s.steps.forEach((t,n)=>{var r,i;if(t instanceof el){let o=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(o,-1),d=a.invert().map(l),u=o>0&&(null==(r=s.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),h=null==(i=s.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:o,to:l},partial:!!(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),al=ai.create({name:"drop",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ac=ai.create({name:"editable",addProseMirrorPlugins(){return[new e2({key:new e4("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ad=new e4("focusEvents"),au=ai.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new e2({key:ad,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),ah=ai.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:a}=o,l=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=l.parent.type.spec.isolating,d=o.pos-o.parentOffset,u=c&&1===l.parent.childCount?d===o.pos:ez.atStart(r).from===s;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return oR()||oq()?i:r},addProseMirrorPlugins(){return[new e2({key:new e4("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=t.selection,l=ez.atStart(t.doc).from,c=ez.atEnd(t.doc).to;if(o||s!==l||a!==c||!sO(n.doc))return;let d=n.tr,u=oe({state:n,transaction:d}),{commands:h}=new ot({editor:this.editor,state:u});if(h.clearNodes(),d.steps.length)return d}})]}}),ap=ai.create({name:"paste",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),af=ai.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),am=ai.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=sd(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new e2({key:new e4("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),ag=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+ +!o;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;let c=new e(l,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},ay=`.ProseMirror {
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,425732,e=>{"use strict";let t=(0,e.i(605993).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],425732)},301138,e=>{"use strict";let t=(0,e.i(605993).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",0,t],301138)},567776,e=>{"use strict";let t=(0,e.i(605993).default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);e.s(["Lock",0,t],567776)},764143,e=>{"use strict";let t=(0,e.i(605993).default)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,t],764143)},391548,e=>{"use strict";let t=(0,e.i(605993).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],391548)},43240,367092,e=>{"use strict";var t=e.i(605993);let n=(0,t.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,n],43240);let r=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,r],367092)},702166,e=>{"use strict";let t=(0,e.i(605993).default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);e.s(["Link",0,t],702166)},406347,e=>{"use strict";let t=(0,e.i(605993).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,t],406347)},793479,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,type:n,...i},o)=>(0,t.jsx)("input",{type:n,className:(0,r.cn)("flex h-9 w-full rounded-sm border border-input bg-secondary px-3 py-1 text-sm shadow-e-1 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-normal placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...i}));i.displayName="Input",e.s(["Input",0,i])},515288,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("rounded-md border border-border bg-card text-card-foreground shadow-e-2",e),...n}));i.displayName="Card",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",e),...n})).displayName="CardHeader",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-lg font-normal leading-none tracking-tight",e),...n})).displayName="CardTitle",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-sm text-muted-foreground",e),...n})).displayName="CardDescription",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("p-6 pt-0",e),...n})).displayName="CardContent",e.s(["Card",0,i])},291967,543250,672687,e=>{"use strict";"u">typeof window&&window.document&&window.document.createElement,e.s(["composeEventHandlers",0,function(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}],291967);var t=e.i(101685),n=e.i(44501);e.s(["createContext",0,function(e,r){let i=t.createContext(r),o=e=>{let{children:r,...o}=e,s=t.useMemo(()=>o,Object.values(o));return(0,n.jsx)(i.Provider,{value:s,children:r})};return o.displayName=e+"Provider",[o,function(n){let o=t.useContext(i);if(o)return o;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${e}\``)}]},"createContextScope",0,function(e,r=[]){let i=[],o=()=>{let n=i.map(e=>t.createContext(e));return function(r){let i=r?.[e]||n;return t.useMemo(()=>({[`__scope${e}`]:{...r,[e]:i}}),[r,i])}};return o.scopeName=e,[function(r,o){let s=t.createContext(o),a=i.length;i=[...i,o];let l=r=>{let{scope:i,children:o,...l}=r,c=i?.[e]?.[a]||s,d=t.useMemo(()=>l,Object.values(l));return(0,n.jsx)(c.Provider,{value:d,children:o})};return l.displayName=r+"Provider",[l,function(n,i){let l=i?.[e]?.[a]||s,c=t.useContext(l);if(c)return c;if(void 0!==o)return o;throw Error(`\`${n}\` must be used within \`${r}\``)}]},function(...e){let n=e[0];if(1===e.length)return n;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=r.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return t.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return r.scopeName=n.scopeName,r}(o,...r)]}],543250);var r=globalThis?.document?t.useLayoutEffect:()=>{};e.s(["useLayoutEffect",0,r],672687)},417256,652053,980939,e=>{"use strict";var t=e.i(101685),n=e.i(672687);t[" useEffectEvent ".trim().toString()],t[" useInsertionEffect ".trim().toString()];var r=t[" useInsertionEffect ".trim().toString()]||n.useLayoutEffect;Symbol("RADIX:SYNC_STATE"),e.s(["useControllableState",0,function({prop:e,defaultProp:n,onChange:i=()=>{},caller:o}){let[s,a,l]=function({defaultProp:e,onChange:n}){let[i,o]=t.useState(e),s=t.useRef(i),a=t.useRef(n);return r(()=>{a.current=n},[n]),t.useEffect(()=>{s.current!==i&&(a.current?.(i),s.current=i)},[i,s]),[i,o,a]}({defaultProp:n,onChange:i}),c=void 0!==e,d=c?e:s;{let n=t.useRef(void 0!==e);t.useEffect(()=>{let e=n.current;if(e!==c){let t=c?"controlled":"uncontrolled";console.warn(`${o} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}n.current=c},[c,o])}return[d,t.useCallback(t=>{if(c){let n="function"==typeof t?t(e):t;n!==e&&l.current?.(n)}else a(t)},[c,e,a,l])]}],417256);var i=e.i(380560),o=e.i(967928),s=e.i(44501);function a(e){var n;let r,i=(n=e,(r=t.forwardRef((e,n)=>{let{children:r,...i}=e;if(t.isValidElement(r)){var s;let e,a,l=(s=r,(a=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(a=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),c=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==t.Fragment&&(c.ref=n?(0,o.composeRefs)(n,l):l),t.cloneElement(r,c)}return t.Children.count(r)>1?t.Children.only(null):null})).displayName=`${n}.SlotClone`,r),a=t.forwardRef((e,n)=>{let{children:r,...o}=e,a=t.Children.toArray(r),l=a.find(c);if(l){let e=l.props.children,r=a.map(n=>n!==l?n:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,s.jsx)(i,{...o,ref:n,children:t.isValidElement(e)?t.cloneElement(e,void 0,r):null})}return(0,s.jsx)(i,{...o,ref:n,children:r})});return a.displayName=`${e}.Slot`,a}var l=Symbol("radix.slottable");function c(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===l}e.s(["createSlot",0,a],652053);var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{let r=a(`Primitive.${n}`),i=t.forwardRef((e,t)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(i?r:n,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});e.s(["Primitive",0,d,"dispatchDiscreteCustomEvent",0,function(e,t){e&&i.flushSync(()=>e.dispatchEvent(t))}],980939)},41986,25486,e=>{"use strict";var t=e.i(101685),n=e.i(543250),r=e.i(967928),i=e.i(652053),o=e.i(44501),s=new WeakMap;function a(e,t){var n,r;let i,o,s;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(n=e,r=t,i=n.length,(s=(o=l(r))>=0?o:i+o)<0||s>=i?-1:s);return -1===a?void 0:e[a]}function l(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],s.set(this,!0)}set(e,t){return s.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,i=this.has(t),o=this.#e.length,s=l(e),a=s>=0?s:o+s,c=a<0||a>=o?-1:a;if(c===this.size||i&&c===this.size-1||-1===c)return this.set(t,n),this;let d=this.size+ +!i;s<0&&a++;let u=[...this.#e],h=!1;for(let e=a;e<d;e++)if(a===e){let o=u[e];u[e]===t&&(o=u[e+1]),i&&this.delete(t),r=this.get(o),this.set(t,n)}else{h||u[e-1]!==t||(h=!0);let n=u[h?e:e-1],i=r;r=this.get(n),this.delete(n),this.set(n,i)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=a(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=a(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return a(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=0===r&&1===e.length?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&1===e.length?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}}),e.s(["createCollection",0,function(e){let s=e+"CollectionProvider",[a,l]=(0,n.createContextScope)(s),[c,d]=a(s,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:n,children:r}=e,i=t.default.useRef(null),s=t.default.useRef(new Map).current;return(0,o.jsx)(c,{scope:n,itemMap:s,collectionRef:i,children:r})};u.displayName=s;let h=e+"CollectionSlot",p=(0,i.createSlot)(h),f=t.default.forwardRef((e,t)=>{let{scope:n,children:i}=e,s=d(h,n),a=(0,r.useComposedRefs)(t,s.collectionRef);return(0,o.jsx)(p,{ref:a,children:i})});f.displayName=h;let m=e+"CollectionItemSlot",g="data-radix-collection-item",y=(0,i.createSlot)(m),b=t.default.forwardRef((e,n)=>{let{scope:i,children:s,...a}=e,l=t.default.useRef(null),c=(0,r.useComposedRefs)(n,l),u=d(m,i);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,o.jsx)(y,{...{[g]:""},ref:c,children:s})});return b.displayName=m,[{Provider:u,Slot:f,ItemSlot:b},function(n){let r=d(e+"CollectionConsumer",n);return t.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},l]}],41986);var c=t.createContext(void 0);e.s(["useDirection",0,function(e){let n=t.useContext(c);return e||n||"ltr"}],25486)},348989,136131,e=>{"use strict";var t,n=e.i(101685),r=e.i(291967),i=e.i(980939),o=e.i(967928);function s(e){let t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}e.s(["useCallbackRef",0,s],136131);var a=e.i(44501),l="dismissableLayer.update",c=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),d=n.forwardRef((e,d)=>{let{disableOutsidePointerEvents:p=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:y,onDismiss:b,...v}=e,w=n.useContext(c),[x,k]=n.useState(null),S=x?.ownerDocument??globalThis?.document,[,C]=n.useState({}),E=(0,o.useComposedRefs)(d,e=>k(e)),M=Array.from(w.layers),[N]=[...w.layersWithOutsidePointerEventsDisabled].slice(-1),A=M.indexOf(N),T=x?M.indexOf(x):-1,R=w.layersWithOutsidePointerEventsDisabled.size>0,O=T>=A,D=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{let e=e=>{if(e.target&&!i.current){let n=function(){h("dismissableLayer.pointerDownOutside",r,i,{discrete:!0})},i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);i.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{let t=e.target,n=[...w.branches].some(e=>e.contains(t));O&&!n&&(m?.(e),y?.(e),e.defaultPrevented||b?.())},S),j=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1);return n.useEffect(()=>{let e=e=>{e.target&&!i.current&&h("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{let t=e.target;![...w.branches].some(e=>e.contains(t))&&(g?.(e),y?.(e),e.defaultPrevented||b?.())},S);return!function(e,t=globalThis?.document){let r=s(e);n.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{T===w.layers.size-1&&(f?.(e),!e.defaultPrevented&&b&&(e.preventDefault(),b()))},S),n.useEffect(()=>{if(x)return p&&(0===w.layersWithOutsidePointerEventsDisabled.size&&(t=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),w.layersWithOutsidePointerEventsDisabled.add(x)),w.layers.add(x),u(),()=>{p&&1===w.layersWithOutsidePointerEventsDisabled.size&&(S.body.style.pointerEvents=t)}},[x,S,p,w]),n.useEffect(()=>()=>{x&&(w.layers.delete(x),w.layersWithOutsidePointerEventsDisabled.delete(x),u())},[x,w]),n.useEffect(()=>{let e=()=>C({});return document.addEventListener(l,e),()=>document.removeEventListener(l,e)},[]),(0,a.jsx)(i.Primitive.div,{...v,ref:E,style:{pointerEvents:R?O?"auto":"none":void 0,...e.style},onFocusCapture:(0,r.composeEventHandlers)(e.onFocusCapture,j.onFocusCapture),onBlurCapture:(0,r.composeEventHandlers)(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:(0,r.composeEventHandlers)(e.onPointerDownCapture,D.onPointerDownCapture)})});function u(){let e=new CustomEvent(l);document.dispatchEvent(e)}function h(e,t,n,{discrete:r}){let o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?(0,i.dispatchDiscreteCustomEvent)(o,s):o.dispatchEvent(s)}d.displayName="DismissableLayer",n.forwardRef((e,t)=>{let r=n.useContext(c),s=n.useRef(null),l=(0,o.useComposedRefs)(t,s);return n.useEffect(()=>{let e=s.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,a.jsx)(i.Primitive.div,{...e,ref:l})}).displayName="DismissableLayerBranch",e.s(["DismissableLayer",0,d],348989)},539340,e=>{"use strict";var t=e.i(101685),n=0;function r(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}e.s(["useFocusGuards",0,function(){t.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??r()),document.body.insertAdjacentElement("beforeend",e[1]??r()),n++,()=>{1===n&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),n--}},[])}])},445424,e=>{"use strict";let t;var n=e.i(101685),r=e.i(967928),i=e.i(980939),o=e.i(136131),s=e.i(44501),a="focusScope.autoFocusOnMount",l="focusScope.autoFocusOnUnmount",c={bubbles:!1,cancelable:!0},d=n.forwardRef((e,t)=>{let{loop:d=!1,trapped:m=!1,onMountAutoFocus:g,onUnmountAutoFocus:y,...b}=e,[v,w]=n.useState(null),x=(0,o.useCallbackRef)(g),k=(0,o.useCallbackRef)(y),S=n.useRef(null),C=(0,r.useComposedRefs)(t,e=>w(e)),E=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(m){let e=function(e){if(E.paused||!v)return;let t=e.target;v.contains(t)?S.current=t:p(S.current,{select:!0})},t=function(e){if(E.paused||!v)return;let t=e.relatedTarget;null!==t&&(v.contains(t)||p(S.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&p(v)});return v&&n.observe(v,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[m,v,E.paused]),n.useEffect(()=>{if(v){f.add(E);let e=document.activeElement;if(!v.contains(e)){let t=new CustomEvent(a,c);v.addEventListener(a,x),v.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(p(r,{select:t}),document.activeElement!==n)return}(u(v).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&p(v))}return()=>{v.removeEventListener(a,x),setTimeout(()=>{let t=new CustomEvent(l,c);v.addEventListener(l,k),v.dispatchEvent(t),t.defaultPrevented||p(e??document.body,{select:!0}),v.removeEventListener(l,k),f.remove(E)},0)}}},[v,x,k,E]);let M=n.useCallback(e=>{if(!d&&!m||E.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){var r;let t,i=e.currentTarget,[o,s]=[h(t=u(r=i),r),h(t.reverse(),r)];o&&s?e.shiftKey||n!==s?e.shiftKey&&n===o&&(e.preventDefault(),d&&p(s,{select:!0})):(e.preventDefault(),d&&p(o,{select:!0})):n===i&&e.preventDefault()}},[d,m,E.paused]);return(0,s.jsx)(i.Primitive.div,{tabIndex:-1,...b,ref:C,onKeyDown:M})});function u(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function p(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}d.displayName="FocusScope";var f=(t=[],{add(e){let n=t[0];e!==n&&n?.pause(),(t=m(t,e)).unshift(e)},remove(e){t=m(t,e),t[0]?.resume()}});function m(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}e.s(["FocusScope",0,d])},433616,e=>{"use strict";var t=e.i(101685),n=e.i(672687),r=t[" useId ".trim().toString()]||(()=>void 0),i=0;e.s(["useId",0,function(e){let[o,s]=t.useState(r());return(0,n.useLayoutEffect)(()=>{e||s(e=>e??String(i++))},[e]),e||(o?`radix-${o}`:"")}])},278928,e=>{"use strict";let t,n=["top","right","bottom","left"],r=n.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),i=Math.min,o=Math.max,s=Math.round,a=Math.floor,l=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"};function d(e,t){return"function"==typeof e?e(t):e}function u(e){return e.split("-")[0]}function h(e){return e.split("-")[1]}function p(e){return"x"===e?"y":"x"}function f(e){return"y"===e?"height":"width"}function m(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function g(e,t,n){void 0===n&&(n=!1);let r=h(e),i=p(m(e)),o=f(i),s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=k(s)),[s,k(s)]}function y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let b=["left","right"],v=["right","left"],w=["top","bottom"],x=["bottom","top"];function k(e){let t=u(e);return c[t]+e.slice(t.length)}function S(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function C(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function E(e,t,n){let r,{reference:i,floating:o}=e,s=m(t),a=p(m(t)),l=f(a),c=u(t),d="y"===s,g=i.x+i.width/2-o.width/2,y=i.y+i.height/2-o.height/2,b=i[l]/2-o[l]/2;switch(c){case"top":r={x:g,y:i.y-o.height};break;case"bottom":r={x:g,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:y};break;case"left":r={x:i.x-o.width,y:y};break;default:r={x:i.x,y:i.y}}switch(h(t)){case"start":r[a]-=b*(n&&d?-1:1);break;case"end":r[a]+=b*(n&&d?-1:1)}return r}async function M(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=d(t,e),m=S(f),g=a[p?"floating"===h?"reference":"floating":h],y=C(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(g)))||n?g:g.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),w=await (null==o.isElement?void 0:o.isElement(v))&&await (null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},x=C(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:l}):b);return{top:(y.top-x.top+m.top)/w.y,bottom:(x.bottom-y.bottom+m.bottom)/w.y,left:(y.left-x.left+m.left)/w.x,right:(x.right-y.right+m.right)/w.x}}let N=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:M},l=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=E(c,r,l),h=r,p=0,f={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:y}=m,{x:b,y:v,data:w,reset:x}=await y({x:d,y:u,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=v?v:u,f[g]={...f[g],...w},x&&p<50&&(p++,"object"==typeof x&&(x.placement&&(h=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:u}=E(c,h,l)),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:f}};function A(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function T(e){return n.some(t=>e[t]>=0)}function R(e){let t=i(...e.map(e=>e.left)),n=i(...e.map(e=>e.top));return{x:t,y:n,width:o(...e.map(e=>e.right))-t,height:o(...e.map(e=>e.bottom))-n}}let O=new Set(["left","top"]);async function D(e,t){let{placement:n,platform:r,elements:i}=e,o=await (null==r.isRTL?void 0:r.isRTL(i.floating)),s=u(n),a=h(n),l="y"===m(n),c=O.has(s)?-1:1,p=o&&l?-1:1,f=d(t,e),{mainAxis:g,crossAxis:y,alignmentAxis:b}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&"number"==typeof b&&(y="end"===a?-1*b:b),l?{x:y*p,y:g*c}:{x:g*c,y:y*p}}function j(){return"u">typeof window}function I(e){return _(e)?(e.nodeName||"").toLowerCase():"#document"}function L(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){var t;return null==(t=(_(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function _(e){return!!j()&&(e instanceof Node||e instanceof L(e).Node)}function z(e){return!!j()&&(e instanceof Element||e instanceof L(e).Element)}function $(e){return!!j()&&(e instanceof HTMLElement||e instanceof L(e).HTMLElement)}function H(e){return!(!j()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof L(e).ShadowRoot)}function B(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function F(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let V=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,W=e=>!!e&&"none"!==e;function q(e){let t=z(e)?G(e):e;return W(t.transform)||W(t.translate)||W(t.scale)||W(t.rotate)||W(t.perspective)||!K()&&(W(t.backdropFilter)||W(t.filter))||V.test(t.willChange||"")||U.test(t.contain||"")}function K(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function J(e){return/^(html|body|#document)$/.test(I(e))}function G(e){return L(e).getComputedStyle(e)}function X(e){return z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if("html"===I(e))return e;let t=e.assignedSlot||e.parentNode||H(e)&&e.host||P(e);return H(t)?t.host:t}function Y(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=Z(t);return J(n)?t.ownerDocument?t.ownerDocument.body:t.body:$(n)&&B(n)?n:e(n)}(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=L(i);if(!o)return t.concat(i,Y(i,[],n));{let e=Q(s);return t.concat(s,s.visualViewport||[],B(i)?i:[],e&&n?Y(e):[])}}function Q(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ee(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=s(n)!==o||s(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function et(e){return z(e)?e:e.contextElement}function en(e){let t=et(e);if(!$(t))return l(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=ee(t),a=(o?s(n.width):n.width)/r,c=(o?s(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}let er=l(0);function ei(e){let t=L(e);return K()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:er}function eo(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),s=et(e),a=l(1);t&&(r?z(r)&&(a=en(r)):a=en(e));let c=(void 0===(i=n)&&(i=!1),r&&(!i||r===L(s))&&i)?ei(s):l(0),d=(o.left+c.x)/a.x,u=(o.top+c.y)/a.y,h=o.width/a.x,p=o.height/a.y;if(s){let e=L(s),t=r&&z(r)?L(r):r,n=e,i=Q(n);for(;i&&r&&t!==n;){let e=en(i),t=i.getBoundingClientRect(),r=G(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;d*=e.x,u*=e.y,h*=e.x,p*=e.y,d+=o,u+=s,i=Q(n=L(i))}}return C({width:h,height:p,x:d,y:u})}function es(e,t){let n=X(e).scrollLeft;return t?t.left+n:eo(P(e)).left+n}function ea(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-es(e,n),y:n.top+t.scrollTop}}function el(e,t,n){var r;let i;if("viewport"===t)i=function(e,t){let n=L(e),r=P(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let e=K();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let c=es(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t){let t,n,s,a,l,c,d;r=P(e),t=P(r),n=X(r),s=r.ownerDocument.body,a=o(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=o(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),c=-n.scrollLeft+es(r),d=-n.scrollTop,"rtl"===G(s).direction&&(c+=o(t.clientWidth,s.clientWidth)-a),i={width:a,height:l,x:c,y:d}}else if(z(t)){let e,r,o,s,a,c;r=(e=eo(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,s=$(t)?en(t):l(1),a=t.clientWidth*s.x,c=t.clientHeight*s.y,i={width:a,height:c,x:o*s.x,y:r*s.y}}else{let n=ei(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return C(i)}function ec(e){return"static"===G(e).position}function ed(e,t){if(!$(e)||"fixed"===G(e).position)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function eu(e,t){var n;let r=L(e);if(F(e))return r;if(!$(e)){let t=Z(e);for(;t&&!J(t);){if(z(t)&&!ec(t))return t;t=Z(t)}return r}let i=ed(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(I(n)))&&ec(i);)i=ed(i,t);return i&&J(i)&&ec(i)&&!q(i)?r:i||function(e){let t=Z(e);for(;$(t)&&!J(t);){if(q(t))return t;if(F(t))break;t=Z(t)}return null}(e)||r}let eh=async function(e){let t=this.getOffsetParent||eu,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=$(t),i=P(t),o="fixed"===n,s=eo(e,!0,o,t),a={scrollLeft:0,scrollTop:0},c=l(0);if(r||!r&&!o)if(("body"!==I(t)||B(i))&&(a=X(t)),r){let e=eo(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=es(i));o&&!r&&i&&(c.x=es(i));let d=!i||r||o?l(0):ea(i,a);return{x:s.left+a.scrollLeft-c.x-d.x,y:s.top+a.scrollTop-c.y-d.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},ep={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,s=P(r),a=!!t&&F(t.floating);if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},d=l(1),u=l(0),h=$(r);if((h||!h&&!o)&&(("body"!==I(r)||B(s))&&(c=X(r)),h)){let e=eo(r);d=en(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let p=!s||h||o?l(0):ea(s,c);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}},getDocumentElement:P,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e,a=[..."clippingAncestors"===n?F(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=Y(e,[],!1).filter(e=>z(e)&&"body"!==I(e)),i=null,o="fixed"===G(e).position,s=o?Z(e):e;for(;z(s)&&!J(s);){let t=G(s),n=q(s);n||"fixed"!==t.position||(i=null),(o?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||B(s)&&!n&&function e(t,n){let r=Z(t);return!(r===n||!z(r)||J(r))&&("fixed"===G(r).position||e(r,n))}(e,s)))?i=t:r=r.filter(e=>e!==s),s=Z(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=el(t,a[0],s),c=l.top,d=l.right,u=l.bottom,h=l.left;for(let e=1;e<a.length;e++){let n=el(t,a[e],s);c=o(n.top,c),d=i(n.right,d),u=i(n.bottom,u),h=o(n.left,h)}return{width:d-h,height:u-c,x:h,y:c}},getOffsetParent:eu,getElementRects:eh,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=ee(e);return{width:t,height:n}},getScale:en,isElement:z,isRTL:function(e){return"rtl"===G(e).direction}};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}e.s(["arrow",0,e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:s,rects:a,platform:l,elements:c,middlewareData:u}=t,{element:g,padding:y=0}=d(e,t)||{};if(null==g)return{};let b=S(y),v={x:n,y:r},w=p(m(s)),x=f(w),k=await l.getDimensions(g),C="y"===w,E=C?"clientHeight":"clientWidth",M=a.reference[x]+a.reference[w]-v[w]-a.floating[x],N=v[w]-a.reference[w],A=await (null==l.getOffsetParent?void 0:l.getOffsetParent(g)),T=A?A[E]:0;T&&await (null==l.isElement?void 0:l.isElement(A))||(T=c.floating[E]||a.floating[x]);let R=T/2-k[x]/2-1,O=i(b[C?"top":"left"],R),D=i(b[C?"bottom":"right"],R),j=T-k[x]-D,I=T/2-k[x]/2+(M/2-N/2),L=o(O,i(I,j)),P=!u.arrow&&null!=h(s)&&I!==L&&a.reference[x]/2-(I<O?O:D)-k[x]/2<0,_=P?I<O?I-O:I-j:0;return{[w]:v[w]+_,data:{[w]:L,centerOffset:I-L-_,...P&&{alignmentOffset:_}},reset:P}}}),"autoPlacement",0,function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,o,s;let{rects:a,middlewareData:l,placement:c,platform:p,elements:f}=t,{crossAxis:m=!1,alignment:b,allowedPlacements:v=r,autoAlignment:w=!0,...x}=d(e,t),k=void 0!==b||v===r?((s=b||null)?[...v.filter(e=>h(e)===s),...v.filter(e=>h(e)!==s)]:v.filter(e=>u(e)===e)).filter(e=>!s||h(e)===s||!!w&&y(e)!==e):v,S=await p.detectOverflow(t,x),C=(null==(n=l.autoPlacement)?void 0:n.index)||0,E=k[C];if(null==E)return{};let M=g(E,a,await (null==p.isRTL?void 0:p.isRTL(f.floating)));if(c!==E)return{reset:{placement:k[0]}};let N=[S[u(E)],S[M[0]],S[M[1]]],A=[...(null==(i=l.autoPlacement)?void 0:i.overflows)||[],{placement:E,overflows:N}],T=k[C+1];if(T)return{data:{index:C+1,overflows:A},reset:{placement:T}};let R=A.map(e=>{let t=h(e.placement);return[e.placement,t&&m?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,h(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:C+1,overflows:A},reset:{placement:O}}:{}}}},"autoUpdate",0,function(e,t,n,r){let s;void 0===r&&(r={});let{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d="function"==typeof ResizeObserver,layoutShift:u="function"==typeof IntersectionObserver,animationFrame:h=!1}=r,p=et(e),f=l||c?[...p?Y(p):[],...t?Y(t):[]]:[];f.forEach(e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)});let m=p&&u?function(e,t){let n,r=null,s=P(e);function l(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function c(d,u){void 0===d&&(d=!1),void 0===u&&(u=1),l();let h=e.getBoundingClientRect(),{left:p,top:f,width:m,height:g}=h;if(d||t(),!m||!g)return;let y={rootMargin:-a(f)+"px "+-a(s.clientWidth-(p+m))+"px "+-a(s.clientHeight-(f+g))+"px "+-a(p)+"px",threshold:o(0,i(1,u))||1},b=!0;function v(t){let r=t[0].intersectionRatio;if(r!==u){if(!b)return c();r?c(!1,r):n=setTimeout(()=>{c(!1,1e-7)},1e3)}1!==r||ef(h,e.getBoundingClientRect())||c(),b=!1}try{r=new IntersectionObserver(v,{...y,root:s.ownerDocument})}catch(e){r=new IntersectionObserver(v,y)}r.observe(e)}(!0),l}(p,n):null,g=-1,y=null;d&&(y=new ResizeObserver(e=>{let[r]=e;r&&r.target===p&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=y)||e.observe(t)})),n()}),p&&!h&&y.observe(p),t&&y.observe(t));let b=h?eo(e):null;return h&&function t(){let r=eo(e);b&&!ef(b,r)&&n(),b=r,s=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=y)||e.disconnect(),y=null,h&&cancelAnimationFrame(s)}},"computePosition",0,(e,t,n)=>{let r=new Map,i={platform:ep,...n},o={...i.platform,_c:r};return N(e,t,{...i,platform:o})},"flip",0,function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,o,s;let a,l,c,{placement:p,middlewareData:f,rects:S,initialPlacement:C,platform:E,elements:M}=t,{mainAxis:N=!0,crossAxis:A=!0,fallbackPlacements:T,fallbackStrategy:R="bestFit",fallbackAxisSideDirection:O="none",flipAlignment:D=!0,...j}=d(e,t);if(null!=(n=f.arrow)&&n.alignmentOffset)return{};let I=u(p),L=m(C),P=u(C)===C,_=await (null==E.isRTL?void 0:E.isRTL(M.floating)),z=T||(P||!D?[k(C)]:(a=k(C),[y(C),a,y(a)])),$="none"!==O;!T&&$&&z.push(...(l=h(C),c=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?v:b;return t?b:v;case"left":case"right":return t?w:x;default:return[]}}(u(C),"start"===O,_),l&&(c=c.map(e=>e+"-"+l),D&&(c=c.concat(c.map(y)))),c));let H=[C,...z],B=await E.detectOverflow(t,j),F=[],V=(null==(r=f.flip)?void 0:r.overflows)||[];if(N&&F.push(B[I]),A){let e=g(p,S,_);F.push(B[e[0]],B[e[1]])}if(V=[...V,{placement:p,overflows:F}],!F.every(e=>e<=0)){let e=((null==(i=f.flip)?void 0:i.index)||0)+1,t=H[e];if(t&&("alignment"!==A||L===m(t)||V.every(e=>m(e.placement)!==L||e.overflows[0]>0)))return{data:{index:e,overflows:V},reset:{placement:t}};let n=null==(o=V.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(R){case"bestFit":{let e=null==(s=V.filter(e=>{if($){let t=m(e.placement);return t===L||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=C}if(p!==n)return{reset:{placement:n}}}return{}}}},"hide",0,function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=d(e,t);switch(i){case"referenceHidden":{let e=A(await r.detectOverflow(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:T(e)}}}case"escaped":{let e=A(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:T(e)}}}default:return{}}}}},"inline",0,function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:n,elements:r,rects:s,platform:a,strategy:l}=t,{padding:c=2,x:h,y:p}=d(e,t),f=Array.from(await (null==a.getClientRects?void 0:a.getClientRects(r.reference))||[]),g=function(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>C(R(e)))}(f),y=C(R(f)),b=S(c),v=await a.getElementRects({reference:{getBoundingClientRect:function(){if(2===g.length&&g[0].left>g[1].right&&null!=h&&null!=p)return g.find(e=>h>e.left-b.left&&h<e.right+b.right&&p>e.top-b.top&&p<e.bottom+b.bottom)||y;if(g.length>=2){if("y"===m(n)){let e=g[0],t=g[g.length-1],r="top"===u(n),i=e.top,o=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:i,bottom:o,left:s,right:a,width:a-s,height:o-i,x:s,y:i}}let e="left"===u(n),t=o(...g.map(e=>e.right)),r=i(...g.map(e=>e.left)),s=g.filter(n=>e?n.left===r:n.right===t),a=s[0].top,l=s[s.length-1].bottom;return{top:a,bottom:l,left:r,right:t,width:t-r,height:l-a,x:r,y:a}}return y}},floating:r.floating,strategy:l});return s.reference.x!==v.reference.x||s.reference.y!==v.reference.y||s.reference.width!==v.reference.width||s.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},"limitShift",0,function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=d(e,t),h={x:n,y:r},f=m(i),g=p(f),y=h[g],b=h[f],v=d(a,t),w="number"==typeof v?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){let e="y"===g?"height":"width",t=o.reference[g]-o.floating[e]+w.mainAxis,n=o.reference[g]+o.reference[e]-w.mainAxis;y<t?y=t:y>n&&(y=n)}if(c){var x,k;let e="y"===g?"width":"height",t=O.has(u(i)),n=o.reference[f]-o.floating[e]+(t&&(null==(x=s.offset)?void 0:x[f])||0)+(t?0:w.crossAxis),r=o.reference[f]+o.reference[e]+(t?0:(null==(k=s.offset)?void 0:k[f])||0)-(t?w.crossAxis:0);b<n?b=n:b>r&&(b=r)}return{[g]:y,[f]:b}}}},"offset",0,function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=t,l=await D(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},"shift",0,function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=d(e,t),g={x:n,y:r},y=await a.detectOverflow(t,f),b=m(u(s)),v=p(b),w=g[v],x=g[b];if(l){let e="y"===v?"top":"left",t="y"===v?"bottom":"right",n=w+y[e],r=w-y[t];w=o(n,i(w,r))}if(c){let e="y"===b?"top":"left",t="y"===b?"bottom":"right",n=x+y[e],r=x-y[t];x=o(n,i(x,r))}let k=h.fn({...t,[v]:w,[b]:x});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[v]:l,[b]:c}}}}}},"size",0,function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let s,a,{placement:l,rects:c,platform:p,elements:f}=t,{apply:g=()=>{},...y}=d(e,t),b=await p.detectOverflow(t,y),v=u(l),w=h(l),x="y"===m(l),{width:k,height:S}=c.floating;"top"===v||"bottom"===v?(s=v,a=w===(await (null==p.isRTL?void 0:p.isRTL(f.floating))?"start":"end")?"left":"right"):(a=v,s="end"===w?"top":"bottom");let C=S-b.top-b.bottom,E=k-b.left-b.right,M=i(S-b[s],C),N=i(k-b[a],E),A=!t.middlewareData.shift,T=M,R=N;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(R=E),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(T=C),A&&!w){let e=o(b.left,0),t=o(b.right,0),n=o(b.top,0),r=o(b.bottom,0);x?R=k-2*(0!==e||0!==t?e+t:o(b.left,b.right)):T=S-2*(0!==n||0!==r?n+r:o(b.top,b.bottom))}await g({...t,availableWidth:R,availableHeight:T});let O=await p.getDimensions(f.floating);return k!==O.width||S!==O.height?{reset:{rects:!0}}:{}}}}],278928)},638154,461614,e=>{"use strict";var t=e.i(101685),n=e.i(278928),r=e.i(380560),i="u">typeof document?t.useLayoutEffect:function(){};function o(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!o(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!o(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function s(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function a(e,t){let n=s(e);return Math.round(t*n)/n}function l(e){let n=t.useRef(e);return i(()=>{n.current=e}),n}var c=e.i(980939),d=e.i(44501),u=t.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,d.jsx)(c.Primitive.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,d.jsx)("polygon",{points:"0,0 30,0 15,10"})})});u.displayName="Arrow";var h=e.i(967928),p=e.i(543250),f=e.i(136131),m=e.i(672687);function g(e){let[n,r]=t.useState(void 0);return(0,m.useLayoutEffect)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}e.s(["useSize",0,g],461614);var y="Popper",[b,v]=(0,p.createContextScope)(y),[w,x]=b(y),k=e=>{let{__scopePopper:n,children:r}=e,[i,o]=t.useState(null);return(0,d.jsx)(w,{scope:n,anchor:i,onAnchorChange:o,children:r})};k.displayName=y;var S="PopperAnchor",C=t.forwardRef((e,n)=>{let{__scopePopper:r,virtualRef:i,...o}=e,s=x(S,r),a=t.useRef(null),l=(0,h.useComposedRefs)(n,a),u=t.useRef(null);return t.useEffect(()=>{let e=u.current;u.current=i?.current||a.current,e!==u.current&&s.onAnchorChange(u.current)}),i?null:(0,d.jsx)(c.Primitive.div,{...o,ref:l})});C.displayName=S;var E="PopperContent",[M,N]=b(E),A=t.forwardRef((e,u)=>{var p,y,b,v,w,k,S,C,N,A,T,R,O,L,P;let _,z,$,H,B,F,{__scopePopper:V,side:U="bottom",sideOffset:W=0,align:q="center",alignOffset:K=0,arrowPadding:J=0,avoidCollisions:G=!0,collisionBoundary:X=[],collisionPadding:Z=0,sticky:Y="partial",hideWhenDetached:Q=!1,updatePositionStrategy:ee="optimized",onPlaced:et,...en}=e,er=x(E,V),[ei,eo]=t.useState(null),es=(0,h.useComposedRefs)(u,e=>eo(e)),[ea,el]=t.useState(null),ec=g(ea),ed=ec?.width??0,eu=ec?.height??0,eh="number"==typeof Z?Z:{top:0,right:0,bottom:0,left:0,...Z},ep=Array.isArray(X)?X:[X],ef=ep.length>0,em={padding:eh,boundary:ep.filter(D),altBoundary:ef},{refs:eg,floatingStyles:ey,placement:eb,isPositioned:ev,middlewareData:ew}=function(e){void 0===e&&(e={});let{placement:c="bottom",strategy:d="absolute",middleware:u=[],platform:h,elements:{reference:p,floating:f}={},transform:m=!0,whileElementsMounted:g,open:y}=e,[b,v]=t.useState({x:0,y:0,strategy:d,placement:c,middlewareData:{},isPositioned:!1}),[w,x]=t.useState(u);o(w,u)||x(u);let[k,S]=t.useState(null),[C,E]=t.useState(null),M=t.useCallback(e=>{e!==R.current&&(R.current=e,S(e))},[]),N=t.useCallback(e=>{e!==O.current&&(O.current=e,E(e))},[]),A=p||k,T=f||C,R=t.useRef(null),O=t.useRef(null),D=t.useRef(b),j=null!=g,I=l(g),L=l(h),P=l(y),_=t.useCallback(()=>{if(!R.current||!O.current)return;let e={placement:c,strategy:d,middleware:w};L.current&&(e.platform=L.current),(0,n.computePosition)(R.current,O.current,e).then(e=>{let t={...e,isPositioned:!1!==P.current};z.current&&!o(D.current,t)&&(D.current=t,r.flushSync(()=>{v(t)}))})},[w,c,d,L,P]);i(()=>{!1===y&&D.current.isPositioned&&(D.current.isPositioned=!1,v(e=>({...e,isPositioned:!1})))},[y]);let z=t.useRef(!1);i(()=>(z.current=!0,()=>{z.current=!1}),[]),i(()=>{if(A&&(R.current=A),T&&(O.current=T),A&&T){if(I.current)return I.current(A,T,_);_()}},[A,T,_,I,j]);let $=t.useMemo(()=>({reference:R,floating:O,setReference:M,setFloating:N}),[M,N]),H=t.useMemo(()=>({reference:A,floating:T}),[A,T]),B=t.useMemo(()=>{let e={position:d,left:0,top:0};if(!H.floating)return e;let t=a(H.floating,b.x),n=a(H.floating,b.y);return m?{...e,transform:"translate("+t+"px, "+n+"px)",...s(H.floating)>=1.5&&{willChange:"transform"}}:{position:d,left:t,top:n}},[d,m,H.floating,b.x,b.y]);return t.useMemo(()=>({...b,update:_,refs:$,elements:H,floatingStyles:B}),[b,_,$,H,B])}({strategy:"fixed",placement:U+("center"!==q?"-"+q:""),whileElementsMounted:(...e)=>(0,n.autoUpdate)(...e,{animationFrame:"always"===ee}),elements:{reference:er.anchor},middleware:[(p={mainAxis:W+eu,alignmentAxis:K},{name:(_=(0,n.offset)(p)).name,fn:_.fn,options:[p,y]}),G&&(w={mainAxis:!0,crossAxis:!1,limiter:"partial"===Y?{fn:(0,n.limitShift)(b).fn,options:[b,v]}:void 0,...em},{name:(z=(0,n.shift)(w)).name,fn:z.fn,options:[w,k]}),G&&(S={...em},{name:($=(0,n.flip)(S)).name,fn:$.fn,options:[S,C]}),(N={...em,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}},{name:(H=(0,n.size)(N)).name,fn:H.fn,options:[N,A]}),ea&&{name:(B={name:"arrow",options:O=T={element:ea,padding:J},fn(e){let{element:t,padding:r}="function"==typeof O?O(e):O;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?(0,n.arrow)({element:t.current,padding:r}).fn(e):{}:t?(0,n.arrow)({element:t,padding:r}).fn(e):{}}}).name,fn:B.fn,options:[T,R]},j({arrowWidth:ed,arrowHeight:eu}),Q&&(L={strategy:"referenceHidden",...em},{name:(F=(0,n.hide)(L)).name,fn:F.fn,options:[L,P]})]}),[ex,ek]=I(eb),eS=(0,f.useCallbackRef)(et);(0,m.useLayoutEffect)(()=>{ev&&eS?.()},[ev,eS]);let eC=ew.arrow?.x,eE=ew.arrow?.y,eM=ew.arrow?.centerOffset!==0,[eN,eA]=t.useState();return(0,m.useLayoutEffect)(()=>{ei&&eA(window.getComputedStyle(ei).zIndex)},[ei]),(0,d.jsx)("div",{ref:eg.setFloating,"data-radix-popper-content-wrapper":"",style:{...ey,transform:ev?ey.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eN,"--radix-popper-transform-origin":[ew.transformOrigin?.x,ew.transformOrigin?.y].join(" "),...ew.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,d.jsx)(M,{scope:V,placedSide:ex,onArrowChange:el,arrowX:eC,arrowY:eE,shouldHideArrow:eM,children:(0,d.jsx)(c.Primitive.div,{"data-side":ex,"data-align":ek,...en,ref:es,style:{...en.style,animation:ev?void 0:"none"}})})})});A.displayName=E;var T="PopperArrow",R={top:"bottom",right:"left",bottom:"top",left:"right"},O=t.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=N(T,n),o=R[i.placedSide];return(0,d.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,d.jsx)(u,{...r,ref:t,style:{...r.style,display:"block"}})})});function D(e){return null!==e}O.displayName=T;var j=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=I(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,h=(i.arrow?.y??0)+a/2,p="",f="";return"bottom"===l?(p=o?d:`${u}px`,f=`${-a}px`):"top"===l?(p=o?d:`${u}px`,f=`${r.floating.height+a}px`):"right"===l?(p=`${-a}px`,f=o?d:`${h}px`):"left"===l&&(p=`${r.floating.width+a}px`,f=o?d:`${h}px`),{data:{x:p,y:f}}}});function I(e){let[t,n="center"]=e.split("-");return[t,n]}e.s(["Anchor",0,C,"Arrow",0,O,"Content",0,A,"Root",0,k,"createPopperScope",0,v],638154)},332374,190088,e=>{"use strict";var t=e.i(101685),n=e.i(380560),r=e.i(980939),i=e.i(672687),o=e.i(44501),s=t.forwardRef((e,s)=>{let{container:a,...l}=e,[c,d]=t.useState(!1);(0,i.useLayoutEffect)(()=>d(!0),[]);let u=a||c&&globalThis?.document?.body;return u?n.default.createPortal((0,o.jsx)(r.Primitive.div,{...l,ref:s}),u):null});s.displayName="Portal",e.s(["Portal",0,s],332374);var a=e.i(967928),l=e=>{var n;let r,o,{present:s,children:l}=e,d=function(e){var n,r;let[o,s]=t.useState(),a=t.useRef(null),l=t.useRef(e),d=t.useRef("none"),[u,h]=(n=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},t.useReducer((e,t)=>r[e][t]??e,n));return t.useEffect(()=>{let e=c(a.current);d.current="mounted"===u?e:"none"},[u]),(0,i.useLayoutEffect)(()=>{let t=a.current,n=l.current;if(n!==e){let r=d.current,i=c(t);e?h("MOUNT"):"none"===i||t?.display==="none"?h("UNMOUNT"):n&&r!==i?h("ANIMATION_OUT"):h("UNMOUNT"),l.current=e}},[e,h]),(0,i.useLayoutEffect)(()=>{if(o){let e,t=o.ownerDocument.defaultView??window,n=n=>{let r=c(a.current).includes(CSS.escape(n.animationName));if(n.target===o&&r&&(h("ANIMATION_END"),!l.current)){let n=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=n)})}},r=e=>{e.target===o&&(d.current=c(a.current))};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",n),o.addEventListener("animationend",n),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",n),o.removeEventListener("animationend",n)}}h("ANIMATION_END")},[o,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:t.useCallback(e=>{a.current=e?getComputedStyle(e):null,s(e)},[])}}(s),u="function"==typeof l?l({present:d.isPresent}):t.Children.only(l),h=(0,a.useComposedRefs)(d.ref,(n=u,(o=(r=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.ref:(o=(r=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.props.ref:n.props.ref||n.ref));return"function"==typeof l||d.isPresent?t.cloneElement(u,{ref:h}):null};function c(e){return e?.animationName||"none"}l.displayName="Presence",e.s(["Presence",0,l],190088)},677275,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(41986),i=e.i(967928),o=e.i(543250),s=e.i(433616),a=e.i(980939),l=e.i(136131),c=e.i(417256),d=e.i(25486),u=e.i(44501),h="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},f="RovingFocusGroup",[m,g,y]=(0,r.createCollection)(f),[b,v]=(0,o.createContextScope)(f,[y]),[w,x]=b(f),k=t.forwardRef((e,t)=>(0,u.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(S,{...e,ref:t})})}));k.displayName=f;var S=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:o,orientation:s,loop:m=!1,dir:y,currentTabStopId:b,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:x,onEntryFocus:k,preventScrollOnEntryFocus:S=!1,...C}=e,E=t.useRef(null),M=(0,i.useComposedRefs)(r,E),A=(0,d.useDirection)(y),[T,R]=(0,c.useControllableState)({prop:b,defaultProp:v??null,onChange:x,caller:f}),[O,D]=t.useState(!1),j=(0,l.useCallbackRef)(k),I=g(o),L=t.useRef(!1),[P,_]=t.useState(0);return t.useEffect(()=>{let e=E.current;if(e)return e.addEventListener(h,j),()=>e.removeEventListener(h,j)},[j]),(0,u.jsx)(w,{scope:o,orientation:s,dir:A,loop:m,currentTabStopId:T,onItemFocus:t.useCallback(e=>R(e),[R]),onItemShiftTab:t.useCallback(()=>D(!0),[]),onFocusableItemAdd:t.useCallback(()=>_(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>_(e=>e-1),[]),children:(0,u.jsx)(a.Primitive.div,{tabIndex:O||0===P?-1:0,"data-orientation":s,...C,ref:M,style:{outline:"none",...e.style},onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,()=>{L.current=!0}),onFocus:(0,n.composeEventHandlers)(e.onFocus,e=>{let t=!L.current;if(e.target===e.currentTarget&&t&&!O){let t=new CustomEvent(h,p);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=I().filter(e=>e.focusable);N([e.find(e=>e.active),e.find(e=>e.id===T),...e].filter(Boolean).map(e=>e.ref.current),S)}}L.current=!1}),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>D(!1))})})}),C="RovingFocusGroupItem",E=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:i,focusable:o=!0,active:l=!1,tabStopId:c,children:d,...h}=e,p=(0,s.useId)(),f=c||p,y=x(C,i),b=y.currentTabStopId===f,v=g(i),{onFocusableItemAdd:w,onFocusableItemRemove:k,currentTabStopId:S}=y;return t.useEffect(()=>{if(o)return w(),()=>k()},[o,w,k]),(0,u.jsx)(m.ItemSlot,{scope:i,id:f,focusable:o,active:l,children:(0,u.jsx)(a.Primitive.span,{tabIndex:b?0:-1,"data-orientation":y.orientation,...h,ref:r,onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,e=>{o?y.onItemFocus(f):e.preventDefault()}),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>y.onItemFocus(f)),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void y.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return M[i]}(e,y.orientation,y.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=v().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=y.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>N(i))}}),children:"function"==typeof d?d({isCurrentTabStop:b,hasTabStop:null!=S}):d})})});E.displayName=C;var M={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function N(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}e.s(["Item",0,E,"Root",0,k,"createRovingFocusGroupScope",0,v])},73772,e=>{"use strict";var t=new WeakMap,n=new WeakMap,r={},i=0,o=function(e){return e&&(e.host||o(e.parentNode))},s=function(e,s,a,l){var c=(Array.isArray(e)?e:[e]).map(function(e){if(s.contains(e))return e;var t=o(e);return t&&s.contains(t)?t:(console.error("aria-hidden",e,"in not contained inside",s,". Doing nothing"),null)}).filter(function(e){return!!e});r[a]||(r[a]=new WeakMap);var d=r[a],u=[],h=new Set,p=new Set(c),f=function(e){!e||h.has(e)||(h.add(e),f(e.parentNode))};c.forEach(f);var m=function(e){!e||p.has(e)||Array.prototype.forEach.call(e.children,function(e){if(h.has(e))m(e);else try{var r=e.getAttribute(l),i=null!==r&&"false"!==r,o=(t.get(e)||0)+1,s=(d.get(e)||0)+1;t.set(e,o),d.set(e,s),u.push(e),1===o&&i&&n.set(e,!0),1===s&&e.setAttribute(a,"true"),i||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return m(s),h.clear(),i++,function(){u.forEach(function(e){var r=t.get(e)-1,i=d.get(e)-1;t.set(e,r),d.set(e,i),r||(n.has(e)||e.removeAttribute(l),n.delete(e)),i||e.removeAttribute(a)}),--i||(t=new WeakMap,t=new WeakMap,n=new WeakMap,r={})}};e.s(["hideOthers",0,function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),s(r,i,n,"aria-hidden")):function(){return null}}])},206500,e=>{"use strict";var t,n,r,i,o,s,a,l=e.i(824627),c=e.i(101685),d="right-scroll-bar-position",u="width-before-scroll-bar";function h(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var p="u">typeof window?c.useLayoutEffect:c.useEffect,f=new WeakMap,m=(void 0===t&&(t={}),(void 0===n&&(n=function(e){return e}),r=[],i=!1,o={read:function(){if(i)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var t=n(e,i);return r.push(t),function(){r=r.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(i=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){i=!0;var t=[];if(r.length){var n=r;r=[],n.forEach(e),t=r}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}).options=(0,l.__assign)({async:!0,ssr:!1},t),o),g=function(){},y=c.forwardRef(function(e,t){var n,r,i,o,s=c.useRef(null),a=c.useState({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:g}),d=a[0],u=a[1],y=e.forwardProps,b=e.children,v=e.className,w=e.removeScrollBar,x=e.enabled,k=e.shards,S=e.sideCar,C=e.noRelative,E=e.noIsolation,M=e.inert,N=e.allowPinchZoom,A=e.as,T=e.gapMode,R=(0,l.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=(n=[s,t],r=function(e){return n.forEach(function(t){return h(t,e)})},(i=(0,c.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,p(function(){var e=f.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||h(e,null)}),r.forEach(function(e){t.has(e)||h(e,i)})}f.set(o,n)},[n]),o),D=(0,l.__assign)((0,l.__assign)({},R),d);return c.createElement(c.Fragment,null,x&&c.createElement(S,{sideCar:m,removeScrollBar:w,shards:k,noRelative:C,noIsolation:E,inert:M,setCallbacks:u,allowPinchZoom:!!N,lockRef:s,gapMode:T}),y?c.cloneElement(c.Children.only(b),(0,l.__assign)((0,l.__assign)({},D),{ref:O})):c.createElement(void 0===A?"div":A,(0,l.__assign)({},D,{className:v,ref:O}),b))});y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},y.classNames={fullWidth:u,zeroRight:d};var b=function(e){var t=e.sideCar,n=(0,l.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return c.createElement(r,(0,l.__assign)({},n))};b.isSideCarExport=!0;var v=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=a||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,i;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},w=function(){var e=v();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},x=function(){var e=w();return function(t){return e(t.styles,t.dynamic),null}},k={left:0,top:0,right:0,gap:0},S=function(e){return parseInt(e||"",10)||0},C=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[S(n),S(r),S(i)]},E=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return k;var t=C(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M=x(),N="data-scroll-locked",A=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(N,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(d," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(u," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(d," .").concat(d," {\n right: 0 ").concat(r,";\n }\n \n .").concat(u," .").concat(u," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(N,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},T=function(){var e=parseInt(document.body.getAttribute(N)||"0",10);return isFinite(e)?e:0},R=function(){c.useEffect(function(){return document.body.setAttribute(N,(T()+1).toString()),function(){var e=T()-1;e<=0?document.body.removeAttribute(N):document.body.setAttribute(N,e.toString())}},[])},O=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;R();var o=c.useMemo(function(){return E(i)},[i]);return c.createElement(M,{styles:A(o,!t,i,n?"":"!important")})},D=!1;if("u">typeof window)try{var j=Object.defineProperty({},"passive",{get:function(){return D=!0,!0}});window.addEventListener("test",j,j),window.removeEventListener("test",j,j)}catch(e){D=!1}var I=!!D&&{passive:!1},L=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},P=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),_(e,r)){var i=z(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},_=function(e,t){return"v"===e?L(t,"overflowY"):L(t,"overflowX")},z=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},$=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,c=t.contains(l),d=!1,u=a>0,h=0,p=0;do{if(!l)break;var f=z(e,l),m=f[0],g=f[1]-f[2]-s*m;(m||g)&&_(e,l)&&(h+=g,p+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(h)||!i&&a>h)?d=!0:!u&&(i&&1>Math.abs(p)||!i&&-a>p)&&(d=!0),d},H=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B=function(e){return[e.deltaX,e.deltaY]},F=function(e){return e&&"current"in e?e.current:e},V=0,U=[];let W=(s=function(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),i=c.useState(V++)[0],o=c.useState(x)[0],s=c.useRef(e);c.useEffect(function(){s.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,l.__spreadArray)([e.lockRef.current],(e.shards||[]).map(F),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=c.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=H(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var f=P(u,d);if(!f)return!0;if(f?i=u:(i="v"===u?"h":"v",f=P(u,d)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=i),!i)return!0;var m=r.current||i;return $(m,t,e,"h"===m?l:c,!0)},[]),d=c.useCallback(function(e){if(U.length&&U[U.length-1]===o){var n="deltaY"in e?B(e):H(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(F).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),h=c.useCallback(function(e){n.current=H(e),r.current=void 0},[]),p=c.useCallback(function(t){u(t.type,B(t),t.target,a(t,e.lockRef.current))},[]),f=c.useCallback(function(t){u(t.type,H(t),t.target,a(t,e.lockRef.current))},[]);c.useEffect(function(){return U.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",d,I),document.addEventListener("touchmove",d,I),document.addEventListener("touchstart",h,I),function(){U=U.filter(function(e){return e!==o}),document.removeEventListener("wheel",d,I),document.removeEventListener("touchmove",d,I),document.removeEventListener("touchstart",h,I)}},[]);var m=e.removeScrollBar,g=e.inert;return c.createElement(c.Fragment,null,g?c.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,m?c.createElement(O,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},m.useMedium(s),b);var q=c.forwardRef(function(e,t){return c.createElement(y,(0,l.__assign)({},e,{ref:t,sideCar:W}))});q.classNames=y.classNames,e.s(["RemoveScroll",0,q],206500)},996702,918552,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(967928),i=e.i(543250),o=e.i(417256),s=e.i(980939),a=e.i(41986),l=e.i(25486),c=e.i(348989),d=e.i(539340),u=e.i(445424),h=e.i(433616),p=e.i(638154),f=e.i(332374),m=e.i(190088),g=e.i(677275),y=e.i(652053),b=e.i(136131),v=e.i(73772),w=e.i(206500),x=e.i(44501),k=["Enter"," "],S=["ArrowUp","PageDown","End"],C=["ArrowDown","PageUp","Home",...S],E={ltr:[...k,"ArrowRight"],rtl:[...k,"ArrowLeft"]},M={ltr:["ArrowLeft"],rtl:["ArrowRight"]},N="Menu",[A,T,R]=(0,a.createCollection)(N),[O,D]=(0,i.createContextScope)(N,[R,p.createPopperScope,g.createRovingFocusGroupScope]),j=(0,p.createPopperScope)(),I=(0,g.createRovingFocusGroupScope)(),[L,P]=O(N),[_,z]=O(N),$=e=>{let{__scopeMenu:n,open:r=!1,children:i,dir:o,onOpenChange:s,modal:a=!0}=e,c=j(n),[d,u]=t.useState(null),h=t.useRef(!1),f=(0,b.useCallbackRef)(s),m=(0,l.useDirection)(o);return t.useEffect(()=>{let e=()=>{h.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>h.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,x.jsx)(p.Root,{...c,children:(0,x.jsx)(L,{scope:n,open:r,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(_,{scope:n,onClose:t.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:a,children:i})})})};$.displayName=N;var H=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Anchor,{...i,...r,ref:t})});H.displayName="MenuAnchor";var B="MenuPortal",[F,V]=O(B,{forceMount:void 0}),U=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=P(B,t);return(0,x.jsx)(F,{scope:t,forceMount:n,children:(0,x.jsx)(m.Presence,{present:n||o.open,children:(0,x.jsx)(f.Portal,{asChild:!0,container:i,children:r})})})};U.displayName=B;var W="MenuContent",[q,K]=O(W),J=t.forwardRef((e,t)=>{let n=V(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=P(W,e.__scopeMenu),s=z(W,e.__scopeMenu);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:r||o.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:s.modal?(0,x.jsx)(G,{...i,ref:t}):(0,x.jsx)(X,{...i,ref:t})})})})}),G=t.forwardRef((e,i)=>{let o=P(W,e.__scopeMenu),s=t.useRef(null),a=(0,r.useComposedRefs)(i,s);return t.useEffect(()=>{let e=s.current;if(e)return(0,v.hideOthers)(e)},[]),(0,x.jsx)(Y,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),X=t.forwardRef((e,t)=>{let n=P(W,e.__scopeMenu);return(0,x.jsx)(Y,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Z=(0,y.createSlot)("MenuContent.ScrollLock"),Y=t.forwardRef((e,i)=>{let{__scopeMenu:o,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:h,disableOutsidePointerEvents:f,onEntryFocus:m,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,disableOutsideScroll:M,...N}=e,A=P(W,o),R=z(W,o),O=j(o),D=I(o),L=T(o),[_,$]=t.useState(null),H=t.useRef(null),B=(0,r.useComposedRefs)(i,H,A.onContentChange),F=t.useRef(0),V=t.useRef(""),U=t.useRef(0),K=t.useRef(null),J=t.useRef("right"),G=t.useRef(0),X=M?w.RemoveScroll:t.Fragment;t.useEffect(()=>()=>window.clearTimeout(F.current),[]),(0,d.useFocusGuards)();let Y=t.useCallback(e=>{var t,n;return J.current===K.current?.side&&(t=e,!!(n=K.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,c=s.y,d=a.x,u=a.y;c>r!=u>r&&n<(d-l)*(r-c)/(u-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,x.jsx)(q,{scope:o,searchRef:V,onItemEnter:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),onItemLeave:t.useCallback(e=>{Y(e)||(H.current?.focus(),$(null))},[Y]),onTriggerLeave:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),pointerGraceTimerRef:U,onPointerGraceIntentChange:t.useCallback(e=>{K.current=e},[]),children:(0,x.jsx)(X,{...M?{as:Z,allowPinchZoom:!0}:void 0,children:(0,x.jsx)(u.FocusScope,{asChild:!0,trapped:a,onMountAutoFocus:(0,n.composeEventHandlers)(l,e=>{e.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:h,children:(0,x.jsx)(c.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,children:(0,x.jsx)(g.Root,{asChild:!0,...D,dir:R.dir,orientation:"vertical",loop:s,currentTabStopId:_,onCurrentTabStopIdChange:$,onEntryFocus:(0,n.composeEventHandlers)(m,e=>{R.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,x.jsx)(p.Content,{role:"menu","aria-orientation":"vertical","data-state":eM(A.open),"data-radix-menu-content":"",dir:R.dir,...O,...N,ref:B,style:{outline:"none",...N.style},onKeyDown:(0,n.composeEventHandlers)(N.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=V.current+i,o=L().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),c=o.find(e=>e.textValue===l)?.ref.current,function e(t){V.current=t,window.clearTimeout(F.current),""!==t&&(F.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let o=H.current;if(e.target!==o||!C.includes(e.key))return;e.preventDefault();let s=L().filter(e=>!e.disabled).map(e=>e.ref.current);S.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,n.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),V.current="")}),onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{let t=e.target,n=G.current!==e.clientX;e.currentTarget.contains(t)&&n&&(J.current=e.clientX>G.current?"right":"left",G.current=e.clientX)}))})})})})})})});J.displayName=W;var Q=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"group",...r,ref:t})});Q.displayName="MenuGroup";var ee=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{...r,ref:t})});ee.displayName="MenuLabel";var et="MenuItem",en="menu.itemSelect",er=t.forwardRef((e,i)=>{let{disabled:o=!1,onSelect:a,...l}=e,c=t.useRef(null),d=z(et,e.__scopeMenu),u=K(et,e.__scopeMenu),h=(0,r.useComposedRefs)(i,c),p=t.useRef(!1);return(0,x.jsx)(ei,{...l,ref:h,disabled:o,onClick:(0,n.composeEventHandlers)(e.onClick,()=>{let e=c.current;if(!o&&e){let t=new CustomEvent(en,{bubbles:!0,cancelable:!0});e.addEventListener(en,e=>a?.(e),{once:!0}),(0,s.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?p.current=!1:d.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),p.current=!0},onPointerUp:(0,n.composeEventHandlers)(e.onPointerUp,e=>{p.current||e.currentTarget?.click()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==u.searchRef.current;o||t&&" "===e.key||k.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});er.displayName=et;var ei=t.forwardRef((e,i)=>{let{__scopeMenu:o,disabled:a=!1,textValue:l,...c}=e,d=K(et,o),u=I(o),h=t.useRef(null),p=(0,r.useComposedRefs)(i,h),[f,m]=t.useState(!1),[y,b]=t.useState("");return t.useEffect(()=>{let e=h.current;e&&b((e.textContent??"").trim())},[c.children]),(0,x.jsx)(A.ItemSlot,{scope:o,disabled:a,textValue:l??y,children:(0,x.jsx)(g.Item,{asChild:!0,...u,focusable:!a,children:(0,x.jsx)(s.Primitive.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:p,onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{a?d.onItemLeave(e):(d.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>d.onItemLeave(e))),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>m(!0)),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>m(!1))})})})}),eo=t.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:i,...o}=e;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:r,children:(0,x.jsx)(er,{role:"menuitemcheckbox","aria-checked":eN(r)?"mixed":r,...o,ref:t,"data-state":eA(r),onSelect:(0,n.composeEventHandlers)(o.onSelect,()=>i?.(!!eN(r)||!r),{checkForDefaultPrevented:!1})})})});eo.displayName="MenuCheckboxItem";var es="MenuRadioGroup",[ea,el]=O(es,{value:void 0,onValueChange:()=>{}}),ec=t.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=(0,b.useCallbackRef)(r);return(0,x.jsx)(ea,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,x.jsx)(Q,{...i,ref:t})})});ec.displayName=es;var ed="MenuRadioItem",eu=t.forwardRef((e,t)=>{let{value:r,...i}=e,o=el(ed,e.__scopeMenu),s=r===o.value;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:s,children:(0,x.jsx)(er,{role:"menuitemradio","aria-checked":s,...i,ref:t,"data-state":eA(s),onSelect:(0,n.composeEventHandlers)(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});eu.displayName=ed;var eh="MenuItemIndicator",[ep,ef]=O(eh,{checked:!1}),em=t.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=ef(eh,n);return(0,x.jsx)(m.Presence,{present:r||eN(o.checked)||!0===o.checked,children:(0,x.jsx)(s.Primitive.span,{...i,ref:t,"data-state":eA(o.checked)})})});em.displayName=eh;var eg=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});eg.displayName="MenuSeparator";var ey=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Arrow,{...i,...r,ref:t})});ey.displayName="MenuArrow";var eb="MenuSub",[ev,ew]=O(eb),ex=e=>{let{__scopeMenu:n,children:r,open:i=!1,onOpenChange:o}=e,s=P(eb,n),a=j(n),[l,c]=t.useState(null),[d,u]=t.useState(null),f=(0,b.useCallbackRef)(o);return t.useEffect(()=>(!1===s.open&&f(!1),()=>f(!1)),[s.open,f]),(0,x.jsx)(p.Root,{...a,children:(0,x.jsx)(L,{scope:n,open:i,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(ev,{scope:n,contentId:(0,h.useId)(),triggerId:(0,h.useId)(),trigger:l,onTriggerChange:c,children:r})})})};ex.displayName=eb;var ek="MenuSubTrigger",eS=t.forwardRef((e,i)=>{let o=P(ek,e.__scopeMenu),s=z(ek,e.__scopeMenu),a=ew(ek,e.__scopeMenu),l=K(ek,e.__scopeMenu),c=t.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:u}=l,h={__scopeMenu:e.__scopeMenu},p=t.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return t.useEffect(()=>p,[p]),t.useEffect(()=>{let e=d.current;return()=>{window.clearTimeout(e),u(null)}},[d,u]),(0,x.jsx)(H,{asChild:!0,...h,children:(0,x.jsx)(ei,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":a.contentId,"data-state":eM(o.open),...e,ref:(0,r.composeRefs)(i,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(t=>{l.onItemEnter(t),!t.defaultPrevented&&(e.disabled||o.open||c.current||(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{o.onOpenChange(!0),p()},100)))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>{p();let t=o.content?.getBoundingClientRect();if(t){let n=o.content?.dataset.side,r="right"===n,i=t[r?"left":"right"],s=t[r?"right":"left"];l.onPointerGraceIntentChange({area:[{x:e.clientX+(r?-5:5),y:e.clientY},{x:i,y:t.top},{x:s,y:t.top},{x:s,y:t.bottom},{x:i,y:t.bottom}],side:n}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(e),e.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,t=>{let n=""!==l.searchRef.current;e.disabled||n&&" "===t.key||E[s.dir].includes(t.key)&&(o.onOpenChange(!0),o.content?.focus(),t.preventDefault())})})})});eS.displayName=ek;var eC="MenuSubContent",eE=t.forwardRef((e,i)=>{let o=V(W,e.__scopeMenu),{forceMount:s=o.forceMount,...a}=e,l=P(W,e.__scopeMenu),c=z(W,e.__scopeMenu),d=ew(eC,e.__scopeMenu),u=t.useRef(null),h=(0,r.useComposedRefs)(i,u);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:s||l.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:(0,x.jsx)(Y,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:h,align:"start",side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:(0,n.composeEventHandlers)(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=M[c.dir].includes(e.key);t&&n&&(l.onOpenChange(!1),d.trigger?.focus(),e.preventDefault())})})})})})});function eM(e){return e?"open":"closed"}function eN(e){return"indeterminate"===e}function eA(e){return eN(e)?"indeterminate":e?"checked":"unchecked"}function eT(e){return t=>"mouse"===t.pointerType?e(t):void 0}eE.displayName=eC,e.s(["Anchor",0,H,"Arrow",0,ey,"CheckboxItem",0,eo,"Content",0,J,"Group",0,Q,"Item",0,er,"ItemIndicator",0,em,"Label",0,ee,"Portal",0,U,"RadioGroup",0,ec,"RadioItem",0,eu,"Root",0,$,"Separator",0,eg,"Sub",0,ex,"SubContent",0,eE,"SubTrigger",0,eS,"createMenuScope",0,D],918552);var eR="DropdownMenu",[eO,eD]=(0,i.createContextScope)(eR,[D]),ej=D(),[eI,eL]=eO(eR),eP=e=>{let{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,d=ej(n),u=t.useRef(null),[p,f]=(0,o.useControllableState)({prop:s,defaultProp:a??!1,onChange:l,caller:eR});return(0,x.jsx)(eI,{scope:n,triggerId:(0,h.useId)(),triggerRef:u,contentId:(0,h.useId)(),open:p,onOpenChange:f,onOpenToggle:t.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,x.jsx)($,{...d,open:p,onOpenChange:f,dir:i,modal:c,children:r})})};eP.displayName=eR;var e_="DropdownMenuTrigger",ez=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,disabled:o=!1,...a}=e,l=eL(e_,i),c=ej(i);return(0,x.jsx)(H,{asChild:!0,...c,children:(0,x.jsx)(s.Primitive.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...a,ref:(0,r.composeRefs)(t,l.triggerRef),onPointerDown:(0,n.composeEventHandlers)(e.onPointerDown,e=>{!o&&0===e.button&&!1===e.ctrlKey&&(l.onOpenToggle(),l.open||e.preventDefault())}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{!o&&(["Enter"," "].includes(e.key)&&l.onOpenToggle(),"ArrowDown"===e.key&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});ez.displayName=e_;var e$=e=>{let{__scopeDropdownMenu:t,...n}=e,r=ej(t);return(0,x.jsx)(U,{...r,...n})};e$.displayName="DropdownMenuPortal";var eH="DropdownMenuContent",eB=t.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...o}=e,s=eL(eH,i),a=ej(i),l=t.useRef(!1);return(0,x.jsx)(J,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...o,ref:r,onCloseAutoFocus:(0,n.composeEventHandlers)(e.onCloseAutoFocus,e=>{l.current||s.triggerRef.current?.focus(),l.current=!1,e.preventDefault()}),onInteractOutside:(0,n.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!s.modal||r)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eB.displayName=eH;var eF=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(Q,{...i,...r,ref:t})});eF.displayName="DropdownMenuGroup";var eV=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ee,{...i,...r,ref:t})});eV.displayName="DropdownMenuLabel";var eU=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(er,{...i,...r,ref:t})});eU.displayName="DropdownMenuItem";var eW=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eo,{...i,...r,ref:t})});eW.displayName="DropdownMenuCheckboxItem";var eq=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ec,{...i,...r,ref:t})});eq.displayName="DropdownMenuRadioGroup";var eK=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eu,{...i,...r,ref:t})});eK.displayName="DropdownMenuRadioItem";var eJ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(em,{...i,...r,ref:t})});eJ.displayName="DropdownMenuItemIndicator";var eG=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eg,{...i,...r,ref:t})});eG.displayName="DropdownMenuSeparator",t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ey,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var eX=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eS,{...i,...r,ref:t})});eX.displayName="DropdownMenuSubTrigger";var eZ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eE,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eZ.displayName="DropdownMenuSubContent",e.s(["CheckboxItem",0,eW,"Content",0,eB,"Group",0,eF,"Item",0,eU,"ItemIndicator",0,eJ,"Label",0,eV,"Portal",0,e$,"RadioGroup",0,eq,"RadioItem",0,eK,"Root",0,eP,"Separator",0,eG,"Sub",0,e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,a=ej(t),[l,c]=(0,o.useControllableState)({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return(0,x.jsx)(ex,{...a,open:l,onOpenChange:c,children:n})},"SubContent",0,eZ,"SubTrigger",0,eX,"Trigger",0,ez],996702)},10137,e=>{"use strict";let t=(0,e.i(605993).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],10137)},755146,149427,e=>{"use strict";var t=e.i(44501),n=e.i(996702),r=e.i(43240),i=e.i(10137);let o=(0,e.i(605993).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",0,o],149427);var s=e.i(101685),a=e.i(975157);let l=n.Root,c=n.Trigger;n.Group,n.Portal,n.Sub,n.RadioGroup,s.forwardRef(({className:e,inset:r,children:o,...s},l)=>(0,t.jsxs)(n.SubTrigger,{ref:l,className:(0,a.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...s,children:[o,(0,t.jsx)(i.ChevronRight,{className:"ml-auto h-4 w-4"})]})).displayName=n.SubTrigger.displayName,s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.SubContent,{ref:i,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})).displayName=n.SubContent.displayName;let d=s.forwardRef(({className:e,sideOffset:r=4,...i},o)=>(0,t.jsx)(n.Portal,{children:(0,t.jsx)(n.Content,{ref:o,sideOffset:r,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));d.displayName=n.Content.displayName;let u=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Item,{ref:o,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",e),...i}));u.displayName=n.Item.displayName,s.forwardRef(({className:e,children:i,checked:o,...s},l)=>(0,t.jsxs)(n.CheckboxItem,{ref:l,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...s,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(r.Check,{className:"h-4 w-4"})})}),i]})).displayName=n.CheckboxItem.displayName,s.forwardRef(({className:e,children:r,...i},s)=>(0,t.jsxs)(n.RadioItem,{ref:s,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(o,{className:"h-2 w-2 fill-current"})})}),r]})).displayName=n.RadioItem.displayName;let h=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Label,{ref:o,className:(0,a.cn)("px-2 py-1.5 text-sm font-normal",r&&"pl-8",e),...i}));h.displayName=n.Label.displayName;let p=s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Separator,{ref:i,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",e),...r}));p.displayName=n.Separator.displayName,e.s(["DropdownMenu",0,l,"DropdownMenuContent",0,d,"DropdownMenuItem",0,u,"DropdownMenuLabel",0,h,"DropdownMenuSeparator",0,p,"DropdownMenuTrigger",0,c],755146)},804150,(e,t,n)=>{"use strict";var r=e.r(101685),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,d=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&d({inst:i})},[e,n,t]),s(function(){return c(i)&&d({inst:i}),e(function(){c(i)&&d({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d},3909,(e,t,n)=>{"use strict";t.exports=e.r(804150)},757890,(e,t,n)=>{"use strict";var r=e.r(101685),i=e.r(3909),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,d=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var u=a(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;var p=s(e,(u=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],u[1]);return l(function(){h.hasValue=!0,h.value=p},[p]),d(p),p}},383835,(e,t,n)=>{"use strict";t.exports=e.r(757890)},150663,644575,605842,111092,362615,202008,608926,343603,885047,e=>{"use strict";let t,n;function r(e){this.content=e}r.prototype={constructor:r,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var i=n&&n!=e?this.remove(n):this,o=i.find(e),s=i.content.slice();return -1==o?s.push(n||e,t):(s[o+1]=t,n&&(s[o]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var i=this.remove(t),o=i.content.slice(),s=i.find(e);return o.splice(-1==s?o.length:s,0,t,n),new r(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};class i{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],a=o+s.nodeSize;a>e&&((o<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=a}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let a=t.child(--o),l=n.child(--s),c=a.nodeSize;if(a==l){r-=c,i-=c;continue}if(!a.sameMarkup(l))return{a:r,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return s(0,e);if(e==this.size)return s(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return s(t+1,r);return s(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);let o={index:0,offset:0};function s(e,t){return o.index=e,o.offset=t,o}function a(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!a(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!a(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class l{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&a(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return l.none;if(e instanceof l)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}l.none=[];class c extends Error{}class d{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:a,offset:l}=t.findIndex(n),c=t.maybeChild(a);if(l==n||c.isText)return s&&i<=0&&o<=0&&!s.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-l-1,r,0==a?i-1:0,a==t.childCount-1?o-1:0,c);return d&&t.replaceChild(a,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new d(n,this.openStart,this.openEnd)}removeBetween(e,t){return new d(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(o==n||s.isText){if(l!=r&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return d.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new d(i.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new d(e,n,r)}}function u(e,t){if(!t.type.compatibleContent(e.type))throw new c("Cannot join "+t.type.name+" onto "+e.type.name)}function h(e,t,n){let r=e.node(n);return u(r,t.node(n)),r}function p(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function f(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(p(e.nodeAfter,r),o++));for(let e=o;e<s;e++)p(i.child(e),r);t&&t.depth==n&&t.textOffset&&p(t.nodeBefore,r)}function m(e,t){return e.type.checkContent(t),e.copy(t)}function g(e,t,n){let r=[];return f(null,e,n,r),e.depth>n&&p(m(h(e,t,n+1),g(e,t,n+1)),r),f(t,null,n,r),new i(r)}d.empty=new d(i.empty,0,0);class y{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return l.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new x(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new y(t,n,i)}static resolveCached(e,t){let n=w.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else w.set(e,n=new b);let r=n.elts[n.i]=y.resolve(e,t);return n.i=(n.i+1)%v,r}}class b{constructor(){this.elts=[],this.i=0}}let v=12,w=new WeakMap;class x{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let k=Object.create(null);class S{constructor(e,t,n,r=l.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&a(this.attrs,t||e.defaultAttrs||k)&&l.sameSet(this.marks,n||l.none)}copy(e=null){return e==this.content?this:new S(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new S(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return d.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new d(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),o=this.resolve(t);if(n.openStart>r.depth)throw new c("Inserted content deeper than insertion position");if(r.depth-n.openStart!=o.depth-n.openEnd)throw new c("Inconsistent open depths");return function e(t,n,r,o){let s=t.index(o),a=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){let i=e(t,n,r,o+1);return a.copy(a.content.replaceChild(s,i))}if(!r.content.size)return m(a,g(t,n,o));if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){let{start:e,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return m(a,function e(t,n,r,o,s){let a=t.depth>s&&h(t,n,s+1),l=o.depth>s&&h(r,o,s+1),c=[];return f(null,t,s,c),a&&l&&n.index(s)==r.index(s)?(u(a,l),p(m(a,e(t,n,r,o,s+1)),c)):(a&&p(m(a,g(t,n,s+1)),c),f(n,r,s,c),l&&p(m(l,g(r,o,s+1)),c)),f(o,null,s,c),new i(c)}(t,e,s,n,o))}{let e=t.parent,i=e.content;return m(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,o,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return y.resolveCached(this,e)}resolveNoCache(e){return y.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),E(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=i.empty,r=0,o=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=l.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!l.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}S.prototype.text=void 0;class C extends S{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):E(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new C(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new C(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function E(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class M{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new N(e,t);if(null==i.next)return M.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=A(e),r=n;return e.eat(",")&&(r="}"!=e.next?A(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);R(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new M(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(T);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(R(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(s,a){let l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return i.from(a.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=o(n,a.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}M.empty=new M(!0);class N{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function A(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function T(e,t){return t-e}function R(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(T)}function O(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function D(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function j(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function I(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new P(e,r,t[r]);return n}class L{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=I(e,n.attrs),this.defaultAttrs=O(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:D(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new S(this,this.computeAttrs(e),i.from(t),l.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new S(this,this.computeAttrs(e),t,l.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(i.empty,!0);return o?new S(this,e,t.append(o),l.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){j(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:l.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new L(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class P{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=I(e,r.attrs),this.excluded=null;let i=O(this.attrs);this.instance=i?new l(this,i):null}create(e=null){return!e&&this.instance?this.instance:new l(this,D(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new _(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){j(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class z{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=r.from(e.nodes),t.marks=r.from(e.marks||{}),this.nodes=L.compile(this.spec.nodes,this),this.marks=_.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=M.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?$(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:$(this,n.split(" "))}this.nodeFromJSON=e=>S.fromJSON(this,e),this.markFromJSON=e=>l.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof L){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new C(n,n.defaultAttrs,e,l.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function $(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class H{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new q(this,t,!1);return n.addAll(e,l.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new q(this,t,!0);return n.addAll(e,l.none,t.from,t.to),d.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new H(e,H.schemaRules(e)))}}let B={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},F={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V={ol:!0,ul:!0};function U(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class W{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=l.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!B.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class q{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=U(null,t.preserveWhitespace,0)|4*!!n;i=r?new W(r.type,r.attrs,l.none,!0,t.topMatch||r.type.contentMatch,o):n?new W(null,null,l.none,!0,null,o):new W(e.schema.topNodeType,null,l.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;V.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&V.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(a?a.ignore:F.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(B.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=l.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):J(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=U(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=l.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!J(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new W(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function K(e){let t={};for(let n in e)t[n]=e[n];return t}function J(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class G{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Z(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Z(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Q(Z(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Q(Z(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:Q(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new G(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=X(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return X(e.marks)}}function X(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Z(e){return e.document||window.document}let Y=new WeakMap;function Q(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=Y.get(r))&&Y.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),l=o)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=a.indexOf(" ");c>0&&(n=a.slice(0,c),a=a.slice(c+1));let d=n?e.createElementNS(n,a):e.createElement(a),u=t[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in h=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof s)d.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=Q(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}e.s(["DOMParser",0,H,"DOMSerializer",0,G,"Fragment",0,i,"Mark",0,l,"MarkType",0,_,"Node",0,S,"NodeRange",0,x,"ReplaceError",0,c,"Schema",0,z,"Slice",0,d],644575);class ee{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class et{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&et.empty)return et.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,o=a+r+(i<0?0:c);if(n)return o;let u=e==(t<0?a:d)?null:s/3+(e-a)*65536,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new ee(o,h,u)}r+=c-l}return n?e+r:new ee(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new et(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?et.empty:new et(e<0?[0,-e,0]:[0,0,e])}}et.empty=new et([]);class en{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new en(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new en;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ee(e,r,null)}}let er=Object.create(null);class ei{getMap(){return et.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=er[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in er)throw RangeError("Duplicate use of step JSON ID "+e);return er[e]=t,t.prototype.jsonID=e,t}}class eo{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new eo(e,null)}static fail(e){return new eo(null,e)}static fromReplace(e,t,n,r){try{return eo.ok(e.replace(t,n,r))}catch(e){if(e instanceof c)return eo.fail(e.message);throw e}}}function es(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(es(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return i.fromArray(r)}class ea extends ei{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new d(es(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,i)}invert(){return new el(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ea(t.pos,n.pos,this.mark)}merge(e){return e instanceof ea&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ea(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new ea(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("addMark",ea);class el extends ei{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new d(es(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,n)}invert(){return new ea(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new el(t.pos,n.pos,this.mark)}merge(e){return e instanceof el&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new el(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new el(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("removeMark",el);class ec extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ec(this.pos,t.marks[n]);return new ec(this.pos,this.mark)}}return new ed(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ec(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ec(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("addNodeMark",ec);class ed extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ec(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ed(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ed(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("removeNodeMark",ed);class eu extends ei{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ep(e,this.from,this.to)?eo.fail("Structure replace would overwrite content"):eo.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new et([this.from,this.to-this.from,this.slice.size])}invert(e){return new eu(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&eu.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new eu(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eu)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?d.empty:new d(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eu(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?d.empty:new d(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eu(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eu(t.from,t.to,d.fromJSON(e,t.slice),!!t.structure)}}eu.MAP_BIAS=1,ei.jsonID("replace",eu);class eh extends ei{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(ep(e,this.from,this.gapFrom)||ep(e,this.gapTo,this.to)))return eo.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return eo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?eo.fromReplace(e,this.from,this.to,n):eo.fail("Content does not fit in gap")}getMap(){return new et([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eh(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eh(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eh(t.from,t.to,t.gapFrom,t.gapTo,d.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ep(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ef(e,t,n,r=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),a=[],l=t+1;for(let t=0;t<s.childCount;t++){let c=s.child(t),u=l+c.nodeSize,h=r.matchType(c.type);if(h){r=h;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new el(l,u,c.marks[t]));if(o&&c.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||(r=new d(i.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new eu(l+e.index,l+e.index+e[0].length,r))}}else a.push(new eu(l,u,d.empty));l=u}if(!r.validEnd){let t=r.fillBefore(i.empty,!0);e.replace(l,l,new d(t,0,0))}for(let t=a.length-1;t>=0;t--)e.step(a[t])}function em(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function eg(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(ey).concat({type:t,attrs:n}).concat(o.map(ey)):null}function ey(e){return{type:e,attrs:null}}function eb(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ev(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function ew(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function ex(e,t){let n=e.resolve(t),r=n.index();return ek(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ek(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function eS(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&ek(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eC(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function eE(e,t,n=t,r=d.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eM(i,o,r)?new eu(t,n,r):new eN(i,o,r).fit()}function eM(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ei.jsonID("replaceAround",eh);class eN{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=i.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new d(i,o,s);return e>-1?new eh(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new eu(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=eR(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:a}=this.frontier[o],l,c=null;if(1==t&&(r?a.matchType(r.type)||(c=a.fillBefore(i.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:c};if(2==t&&r&&(l=a.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eR(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new d(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eR(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new d(eA(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new d(eA(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:h,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)u.push(r.child(e));h=h.matchFragment(r)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=h.matchType(e.type);if(!t)break;(++c>1||0==l||e.content.size)&&(h=t,u.push(function e(t,n,r){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?r-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),r<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(i.empty,!0)))),t.copy(o)}(e.mark(p.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=eT(this.placed,t,i.from(u)),this.frontier[t].match=h,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?d.empty:new d(eA(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new d(eA(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eO(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=eO(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eO(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eT(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=eT(this.placed,this.depth,i.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i.empty,!0);e.childCount&&(this.placed=eT(this.placed,this.frontier.length,e))}}function eA(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eA(e.firstChild.content,t-1,n)))}function eT(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eT(e.lastChild.content,t-1,n)))}function eR(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eO(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function eD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class ej extends ei{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(r),0,+!t.isLeaf))}getMap(){return et.empty}invert(e){return new ej(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ej(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new ej(t.pos,t.attr,t.value)}}ei.jsonID("attr",ej);class eI extends ei{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return eo.ok(n)}getMap(){return et.empty}invert(e){return new eI(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eI(t.attr,t.value)}}ei.jsonID("docAttr",eI);let eL=class extends Error{};(eL=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eL.prototype.constructor=eL,eL.prototype.name="TransformError";class eP{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new en}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eL(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=d.empty){let r=eE(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new d(i.from(n),0,0))}delete(e,t){return this.replace(e,t,d.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(eM(o,s,r))return e.step(new eu(t,n,r));let a=eD(o,s);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:o.before(e)==t&&a.splice(1,0,-e)}let c=a.indexOf(l),u=[],h=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var p;let t=u[e],n=(p=t.type).spec.defining||p.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+h+1)%(r.openStart+1),p=u[l];if(p)for(let t=0;t<a.length;t++){let u=a[(t+c)%a.length],h=!0;u<0&&(h=!1,u=-u);let f=o.node(u-1),m=o.index(u-1);if(f.canReplaceWith(m,m,p.type,p.marks))return e.replace(o.before(u),h?s.after(u):n,new d(function e(t,n,r,o,s){if(n<r){let i=t.firstChild;t=t.replaceChild(0,i.copy(e(i.content,n+1,r,o,i)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let f=e.steps.length;for(let i=a.length-1;i>=0&&(e.replace(t,n,r),!(e.steps.length>f));i--){let e=a[i];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,o=t;if(!n.isInline&&r==o&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=o=e)}return this.replaceRange(r,o,new d(i.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=eD(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:o,depth:s}=t,a=r.before(s+1),l=o.after(s+1),c=a,u=l,h=i.empty,p=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,h=i.from(r.node(e).copy(h)),p++):c--;let f=i.empty,m=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=i.from(o.node(e).copy(f)),m++):u++;e.step(new eh(c,u,a,l,new d(h.append(f),p,m),h.size-p,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);ev(e,r.node(),r.before(),a)}s.inlineContent&&ef(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new eu(c,l.map(t+n,-1),d.empty,!0)),!0===r){let t=e.doc.resolve(c);eb(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=i.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=i.from(n[e].type.create(n[e].attrs,r))}let o=t.start,s=t.end;e.step(new eh(o,s,o,s,new d(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var a,l,c;let u,h,p="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,p)&&(a=o.doc,l=o.mapping.slice(s).map(t),c=n,h=(u=a.resolve(l)).index(),u.parent.canReplaceWith(h,h+1,c))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&ev(o,e,t,s),ef(o,o.mapping.slice(s).map(t,1),n,void 0,null===r);let a=o.mapping.slice(s),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return o.step(new eh(l,c,l+1,c-1,new d(i.from(n.create(p,null,e.marks)),0,0),1,!0)),!0===r&&eb(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new eh(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new d(i.from(a),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new ej(e,t,n)),this}setDocAttribute(e,t){return this.step(new eI(e,t)),this}addNodeMark(e,t){return this.step(new ec(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof l)t.isInSet(n.marks)&&this.step(new ed(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ed(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let o=e.doc.resolve(t),s=i.empty,a=i.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){s=i.from(o.node(e).copy(s));let t=r&&r[l];a=i.from(t?t.type.create(t.attrs,a):o.node(e).copy(a))}e.step(new eu(t,t,new d(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,e),u=Math.min(l+r.nodeSize,t),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new el(c,u,d[e])));o&&o.to==c?o.to=u:a.push(o=new ea(c,u,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let a=null;if(n instanceof _){let e=r.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<a.length;t++){let r=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new el(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return ef(this,e,t,n),this}}e.s(["Mapping",0,en,"RemoveMarkStep",0,el,"ReplaceAroundStep",0,eh,"ReplaceStep",0,eu,"Transform",0,eP,"canJoin",0,ex,"canSplit",0,ew,"dropPoint",0,eC,"findWrapping",0,eg,"joinPoint",0,eS,"liftTarget",0,em,"replaceStep",0,eE],605842);let e_=Object.create(null);class ez{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e$(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=d.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?d.empty:t),0==s&&eG(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),eG(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new eF(e):eJ(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?eJ(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):eJ(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new eq(e.node(0))}static atStart(e){return eJ(e,e,0,0,1)||new eq(e)}static atEnd(e){return eJ(e,e,e.content.size,e.childCount,-1)||new eq(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=e_[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in e_)throw RangeError("Duplicate use of selection JSON ID "+e);return e_[e]=t,t.prototype.jsonID=e,t}getBookmark(){return eF.between(this.$anchor,this.$head).getBookmark()}}ez.prototype.visible=!0;class e${constructor(e,t){this.$from=e,this.$to=t}}let eH=!1;function eB(e){eH||e.parent.inlineContent||(eH=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eF extends ez{constructor(e,t=e){eB(e),eB(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return ez.near(n);let r=e.resolve(t.map(this.anchor));return new eF(r.parent.inlineContent?r:n,n)}replace(e,t=d.empty){if(super.replace(e,t),t==d.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof eF&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eV(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new eF(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=ez.findFrom(t,n,!0)||ez.findFrom(t,-n,!0);if(!e)return ez.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(ez.findFrom(e,-n,!0)||ez.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new eF(e,t)}}ez.jsonID("text",eF);class eV{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eV(e.map(this.anchor),e.map(this.head))}resolve(e){return eF.between(e.resolve(this.anchor),e.resolve(this.head))}}class eU extends ez{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?ez.near(i):new eU(i)}content(){return new d(i.from(this.node),0,0)}eq(e){return e instanceof eU&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eW(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new eU(e.resolve(t.anchor))}static create(e,t){return new eU(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}eU.prototype.visible=!1,ez.jsonID("node",eU);class eW{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new eV(n,n):new eW(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&eU.isSelectable(n)?new eU(t):ez.near(t)}}class eq extends ez{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=d.empty){if(t==d.empty){e.delete(0,e.doc.content.size);let t=ez.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new eq(e)}map(e){return new eq(e)}eq(e){return e instanceof eq}getBookmark(){return eK}}ez.jsonID("all",eq);let eK={map(){return this},resolve:e=>new eq(e)};function eJ(e,t,n,r,i,o=!1){if(t.inlineContent)return eF.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&eU.isSelectable(r))return eU.create(e,n-(i<0?r.nodeSize:0))}else{let t=eJ(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function eG(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof eu||o instanceof eh)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(ez.near(e.doc.resolve(r),n)))}class eX extends eP{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return l.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||l.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(ez.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function eZ(e,t){return t&&e?e.bind(t):e}class eY{constructor(e,t,n){this.name=e,this.init=eZ(t.init,n),this.apply=eZ(t.apply,n)}}let eQ=[new eY("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eY("selection",{init:(e,t)=>e.selection||ez.atStart(t.doc),apply:e=>e.selection}),new eY("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eY("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class e0{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=eQ.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new eY(e.key,e.spec.state,e))})}}class e1{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new e1(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new eX(this)}static create(e){let t=new e0(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new e1(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new e0(this.schema,e.plugins),n=t.fields,r=new e1(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new e0(e.schema,e.plugins),i=new e1(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=S.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=ez.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=a.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class e2{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:e3("plugin")}getState(e){return e[this.key]}}let e5=Object.create(null);function e3(e){return e in e5?e+"$"+ ++e5[e]:(e5[e]=0,e+"$")}class e4{constructor(e="key"){this.key=e3(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}e.s(["AllSelection",0,eq,"EditorState",0,e1,"NodeSelection",0,eU,"Plugin",0,e2,"PluginKey",0,e4,"Selection",0,ez,"SelectionRange",0,e$,"TextSelection",0,eF],111092);let e6=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},e9=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},e7=null,e8=function(e,t,n){let r=e7||(e7=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},te=function(){e7=null},tt=function(e,t,n,r){return n&&(tr(e,t,n,r,-1)||tr(e,t,n,r,1))},tn=/^(img|br|input|textarea|hr)$/i;function tr(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ti(e))){let n=e.parentNode;if(!n||1!=n.nodeType||to(e)||tn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=e6(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?ti(e):0}}}function ti(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function to(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let ts=function(e){return e.focusNode&&tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ta(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let tl="u">typeof navigator?navigator:null,tc="u">typeof document?document:null,td=tl&&tl.userAgent||"",tu=/Edge\/(\d+)/.exec(td),th=/MSIE \d/.exec(td),tp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(td),tf=!!(th||tp||tu),tm=th?document.documentMode:tp?+tp[1]:tu?+tu[1]:0,tg=!tf&&/gecko\/(\d+)/i.test(td);tg&&(/Firefox\/(\d+)/.exec(td)||[0,0])[1];let ty=!tf&&/Chrome\/(\d+)/.exec(td),tb=!!ty,tv=ty?+ty[1]:0,tw=!tf&&!!tl&&/Apple Computer/.test(tl.vendor),tx=tw&&(/Mobile\/\w+/.test(td)||!!tl&&tl.maxTouchPoints>2),tk=tx||!!tl&&/Mac/.test(tl.platform),tS=!!tl&&/Win/.test(tl.platform),tC=/Android \d/.test(td),tE=!!tc&&"webkitFontSmoothing"in tc.documentElement.style,tM=tE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tN(e,t){return"number"==typeof e?e:e[t]}function tA(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=e9(s);continue}let e=s,n=e==o.body,a=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),l=0,c=0;if(t.top<a.top+tN(r,"top")?c=-(a.top-t.top+tN(i,"top")):t.bottom>a.bottom-tN(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+tN(i,"top")-a.top:t.bottom-a.bottom+tN(i,"bottom")),t.left<a.left+tN(r,"left")?l=-(a.left-t.left+tN(i,"left")):t.right>a.right-tN(r,"right")&&(l=t.right-a.right+tN(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:e9(s)}}function tT(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=e9(r));return t}function tR(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tO=null;function tD(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tj(e){return e.top<e.bottom||e.left<e.right}function tI(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(tj(e))return e}return Array.prototype.find.call(n,tj)||e.getBoundingClientRect()}let tL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tP(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=tE||tg;if(3==r.nodeType)if(s&&(tL.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=tI(e8(r,i,i),n);if(tg&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=tI(e8(r,i-1,i-1),-1);if(t.top==e.top){let n=tI(e8(r,i,i+1),-1);if(n.top!=e.top)return t_(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,t_(tI(e8(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return tz(e.getBoundingClientRect(),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];if(1==e.nodeType)return tz(e.getBoundingClientRect(),!0)}return tz(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1],t=3==e.nodeType?e8(e,ti(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return t_(tI(t,1),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?e8(e,0,+!s):1==e.nodeType?e:null:null;if(t)return t_(tI(t,-1),!0)}return t_(tI(3==r.nodeType?e8(r):r,-n),n>=0)}function t_(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function tz(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function t$(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let tH=/[\u0590-\u08ac]/,tB=null,tF=null,tV=!1;class tU{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>e6(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof tZ){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof tW&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?e6(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?e6(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=e6(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=e6(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((tg||tw)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:e6(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(tg&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&tw)&&tt(s.node,s.offset,c.anchorNode,c.anchorOffset)&&tt(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&tg)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class tW extends tU{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class tq extends tU{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class tK extends tU{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=G.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new tK(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=tK.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=t7(i,t,o,n)),e>0&&(i=t7(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class tJ extends tU{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],a,l=s&&s(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:o,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=G.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=t5(c,n,t),l)?a=new tY(e,t,n,r,c,d||null,u,l,i,o+1):t.isText?new tX(e,t,n,r,c,u,i):new tJ(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>i.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&t3(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new t6(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(t9);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?l.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,d,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=t4(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(a instanceof tK){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=t4(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),tx&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof eF)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new tq(this,i,t,r);e.input.compositionNodes.push(o),this.children=t7(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(t3(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=t2(this.dom,this.nodeDOM,t1(this.outerDeco,this.node,t),t1(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function tG(e,t,n,r,i){t5(r,t,e);let o=new tJ(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class tX extends tJ{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new tX(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tZ extends tU{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class tY extends tJ{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let tQ=function(e){e&&(this.nodeName=e)};tQ.prototype=Object.create(null);let t0=[new tQ];function t1(e,t,n){if(0==e.length)return t0;let r=n?t0[0]:new tQ,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new tQ(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new tQ(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function t2(e,t,n,r){if(n==t0&&r==t0)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=t0[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||t0[0],o)}return i}function t5(e,t,n){return t2(e,e,t0,t1(t,n,1!=e.nodeType))}function t3(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function t4(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class t6{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof tK)n=e,r=e.children.length;else{a=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=tK.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof tJ){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c=a.dom,d,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&t3(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!t3(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=tJ.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=tJ.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new tW(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof tK;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof tX)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((tw||tb)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new tZ(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function t9(e,t){return e.type.side-t.type.side}function t7(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function t8(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(ts(n)){for(l=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&eU.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==ti(e);r||i;){if(e==n)return!0;let t=e6(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==ti(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new eU(s==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[l,s]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let n="pointer"==t||e.state.selection.head<a.pos&&!o?1:-1;c=nl(e,d,a,n)}return c}function ne(e){return e.editable?e.hasFocus():nd(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nt(e,t=!1){let n=e.state.selection;if(ns(e,n),ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&tb){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tt(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,e6(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&tf&&tm<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,a,{anchor:l,head:c}=n,d,u;nn&&!(n instanceof eF)&&(n.$from.parent.inlineContent||(d=nr(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=nr(e,n.to))),e.docView.setSelection(l,c,e,t),nn&&(d&&no(d),u&&no(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,a=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!ne(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let nn=tw||tb&&tv<63;function nr(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(tw&&i&&"false"==i.contentEditable)return ni(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return ni(i);else if(o)return ni(o)}}function ni(e){return e.contentEditable="true",tw&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function no(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ns(e,t){if(t instanceof eU){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(na(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else na(e)}function na(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function nl(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||eF.between(t,n,r)}function nc(e){return(!e.editable||!!e.hasFocus())&&nd(e)}function nd(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nu(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&ez.findFrom(o,t)}function nh(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function np(e,t,n){let r=e.state.selection;if(r instanceof eF){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return nh(e,new eF(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nu(e.state,t);return!!n&&n instanceof eU&&nh(e,n)}else if(!(tk&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(eU.isSelectable(i)?nh(e,new eU(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!tE&&nh(e,new eF(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof eU&&r.node.isInline)return nh(e,new eF(t>0?r.$to:r.$from));let n=nu(e.state,t);return!!n&&nh(e,n)}}function nf(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function nm(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ng(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(tg&&1==n.nodeType&&r<nf(n)&&nm(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(nm(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(ny(n))break;else{let t=n.previousSibling;for(;t&&nm(t,-1);)i=n.parentNode,o=e6(t),t=t.previousSibling;if(t)r=nf(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?nb(e,n,r):i&&nb(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=nf(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(nm(i.childNodes[o],1))t=i,n=++o;else break}else if(ny(i))break;else{let r=i.nextSibling;for(;r&&nm(r,1);)t=r.parentNode,n=e6(r)+1,r=r.nextSibling;if(r)o=0,s=nf(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&nb(e,t,n)}(e)}function ny(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function nb(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!to(e);)t=e6(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!to(e);)t=e6(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ts(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&nt(e)},50)}function nv(e,t){let n=e.state.doc.resolve(t);if(!(tb||tS)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function nw(e,t,n){let r=e.state.selection;if(r instanceof eF&&!r.empty||n.indexOf("s")>-1||tk&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nu(e.state,t);if(n&&n instanceof eU)return nh(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof eq?ez.near(n,t):ez.findFrom(n,t);return!!s&&nh(e,s)}return!1}function nx(e,t){if(!(e.state.selection instanceof eF))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function nk(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nS(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||G.fromSchema(e.state.schema),a=nO(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=nT[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function nC(e,t,n,r,o){let s,a,l=o.parent.type.spec.code;if(!n&&!t)return null;let c=!!t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return a=new d(i.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{a=t(a,e,!0)}),a;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)a=n;else{let n=o.marks(),{schema:r}=e.state,i=G.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(i.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=nO().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&nT[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(nD||(nD=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),nD.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),tE&&function(e){let t=e.querySelectorAll(tb?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||H.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||h),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||nE.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)a=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:o,openStart:s,openEnd:a}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;o=i.from(t.create(r[e+1],o)),s++,a++}return new d(o,s,a)}(nA(a,+h[1],+h[2]),h[4]);else if((a=d.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),o,s=[];if(e.forEach(e=>{if(!s)return;let t=r.findWrapping(e.type),n;if(!t)return s=null;if(n=s.length&&o.length&&function e(t,n,r,o,s){if(s<t.length&&s<n.length&&t[s]==n[s]){let a=e(t,n,r,o.lastChild,s+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(s==t.length-1?r.type:t[s+1]))return o.copy(o.content.append(i.from(nM(r,t,s+1))))}}(t,o,e,s[s.length-1],0))s[s.length-1]=n;else{s.length&&(s[s.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),o=t.contentMatchAt(t.childCount).fillBefore(i.empty,!0);return t.copy(r.append(o))}(s[s.length-1],o.length));let n=nM(e,t);s.push(n),r=r.matchType(n.type),o=t}}),s)return i.from(s)}return e}(a.content,o),!0)).openStart||a.openEnd){let e=0,t=0;for(let t=a.content.firstChild;e<a.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=a.content.lastChild;t<a.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);a=nA(a,e,t)}return e.someProp("transformPasted",t=>{a=t(a,e,c)}),a}let nE=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function nM(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,i.from(e));return e}function nN(e,t,n,r,o,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(s=0),o<r-1&&(l=nN(l,t,n,r,o+1,s)),o>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function nA(e,t,n){return t<e.openStart&&(e=new d(nN(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new d(nN(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let nT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nR=null;function nO(){return nR||(nR=document.implementation.createHTMLDocument("title"))}let nD=null,nj={},nI={},nL={touchstart:!0,touchmove:!0};class nP{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function n_(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function nz(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>n$(e,t))})}function n$(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function nH(e){return{left:e.clientX,top:e.clientY}}function nB(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function nF(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}nI.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!nW(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!tC||!tb||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!tx||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||tk&&72==r&&"c"==i)return nx(e,-1)||ng(e,-1);if(46==r&&!t.shiftKey||tk&&68==r&&"c"==i)return nx(e,1)||ng(e,1);if(13==r||27==r)return!0;if(37==r||tk&&66==r&&"c"==i){let t=37==r?"ltr"==nv(e,e.state.selection.from)?-1:1:-1;return np(e,t,i)||ng(e,t)}if(39==r||tk&&70==r&&"c"==i){let t=39==r?"ltr"==nv(e,e.state.selection.from)?1:-1:1;return np(e,t,i)||ng(e,t)}else if(38==r||tk&&80==r&&"c"==i)return nw(e,-1,i)||ng(e,-1);else if(40==r||tk&&78==r&&"c"==i)return function(e){if(!tw||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;nk(e,n,"true"),setTimeout(()=>nk(e,n,"false"),20)}return!1}(e)||nw(e,1,i)||ng(e,1);else if(i==(tk?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():n_(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},nI.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},nI.keypress=(e,t)=>{if(nW(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||tk&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof eF)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let nV=tk?"metaKey":"ctrlKey";nj.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=nG(e),s=Date.now(),a="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[nV]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(nH(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new nU(e,l,t,!!o)):("doubleClick"==a?function(e,t,n,r){return nB(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return nB(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(nF(e,eF.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)nF(e,eF.create(r,o+1,o+1+n.content.size),"pointer");else{if(!eU.isSelectable(n))continue;nF(e,eU.create(r,o),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():n_(e,"pointer"))};class nU{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[nV],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof eU&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&tg&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),n_(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nH(e))),this.updateAllowDefault(e),this.allowDefault||!t)n_(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,nB(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof eU&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(eU.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(nF(e,eU.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&eU.isSelectable(r))&&(nF(e,new eU(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||tw&&this.mightDrag&&!this.mightDrag.node.isAtom||tb&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(nF(this.view,ez.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):n_(this.view,"pointer")}}move(e){this.updateAllowDefault(e),n_(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function nW(e,t){return!!e.composing||!!(tw&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}nj.touchstart=e=>{e.input.lastTouch=Date.now(),nG(e),n_(e,"pointer")},nj.touchmove=e=>{e.input.lastTouch=Date.now(),n_(e,"pointer")},nj.contextmenu=e=>nG(e);let nq=tC?5e3:-1;function nK(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>nG(e),t))}function nJ(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function nG(e,t=!1){if(!tC||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nJ(e),t||e.docView&&e.docView.dirty){let n=t8(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}nI.compositionstart=nI.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof eF&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||tb&&tS&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),nG(e,!0),e.markCursor=null;else if(nG(e,!t.selection.empty),tg&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}nK(e,nq)},nI.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,nK(e,20))};let nX=tf&&tm<15||tx&&tM<604;function nZ(e,t,n,r,i){let o=nC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||d.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nY(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nj.copy=nI.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=nX?null:t.clipboardData,{dom:o,text:s}=nS(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},nI.paste=(e,t)=>{if(e.composing&&!tC)return;let n=nX?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&nZ(e,nY(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nZ(e,r.value,null,i,t):nZ(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class nQ{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let n0=tk?"altKey":"ctrlKey";function n1(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[n0]}for(let e in nj.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(nH(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof eU?i.to-1:i.to));else if(r&&r.mightDrag)n=eU.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=eU.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=nS(e,s);t.dataTransfer.files.length&&tb&&!(tv>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(nX?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",nX||t.dataTransfer.setData("text/plain",l),e.dragging=new nQ(c,n1(e,t),n)},nj.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},nI.dragover=nI.dragenter=(e,t)=>t.preventDefault(),nI.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(nH(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=nC(e,nY(t.dataTransfer),nX?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&n1(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||d.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let a=o?eC(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(h))return;let p=l.doc.resolve(c);if(u&&eU.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new eU(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(nl(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},nj.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&nt(e)},20))},nj.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},nj.beforeinput=(e,t)=>{if(tb&&tC&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,ta(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},nI)nj[e]=nI[e];function n2(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class n5{constructor(e,t){this.toDOM=e,this.spec=t||n7,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new n6(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof n5&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&n2(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class n3{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new n6(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n3&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}static is(e){return e.type instanceof n3}destroy(){}}class n4{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new n6(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof n4&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}destroy(){}}class n6{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new n6(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new n6(e,e,new n5(t,n))}static inline(e,t,n,r){return new n6(e,t,new n3(n,r))}static node(e,t,n,r){return new n6(e,t,new n4(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof n3}get widget(){return this.type instanceof n5}}let n9=[],n7={};class n8{constructor(e,t){this.local=e.length?e:n9,this.children=t.length?t:n9}static create(e,t){return t.length?ro(t,e,0,n7):re}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==re||0==e.maps.length?this:this.mapInner(e,t,0,0,n||n7)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=re?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=ro(function(e,t,n,r,i,o,s){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,o);a?n.push(a):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[a+2],t[a]+o+1);return n}(a,e,t,n,i,o,s),r,0,s);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new n8(t.sort(rs),a)}(this.children,o||[],e,t,n,r,i):o?new n8(o.sort(rs),n9):re}add(e,t){return t.length?this==re?n8.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,a;if(a=rr(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,a,s+1):r.splice(i,0,o,o+e.nodeSize,ro(a,e,s+1,n7)),i+=3}});let o=rn(i?ri(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new n8(o.length?this.local.concat(o).sort(rs):this.local,r||this.children)}remove(e){return 0==e.length||this==re?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=re?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new n8(r,n):re}forChild(e,t){let n,r;if(this==re)return this;if(t.isLeaf)return n8.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof n3){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new n8(r.sort(rs),n9);return n?new rt([e,n]):e}return n||re}eq(e){if(this==e)return!0;if(!(e instanceof n8)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ra(this.localsInner(e))}localsInner(e){if(this==re)return n9;if(e.inlineContent||!this.local.some(n3.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof n3||t.push(this.local[e]);return t}forEachSet(e){e(this)}}n8.empty=new n8([],[]),n8.removeOverlap=ra;let re=n8.empty;class rt{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,n7));return rt.from(n)}forChild(e,t){if(t.isLeaf)return n8.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=re&&(i instanceof rt?n=n.concat(i.members):n.push(i))}return rt.from(n)}eq(e){if(!(e instanceof rt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ra(n?t:t.sort(rs)):n9}static from(e){switch(e.length){case 0:return re;case 1:return e[0];default:return new rt(e.every(e=>e instanceof n8)?e:e.reduce((e,t)=>e.concat(t instanceof n8?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function rn(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new n6(i.from+t,i.to+t,i.type))}return n}function rr(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function ri(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ro(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=rr(e,t,s+n);if(a){o=!0;let e=ro(a,t,n+s+1,r);e!=re&&i.push(s,s+t.nodeSize,e)}});let s=rn(o?ri(e):e,-n).sort(rs);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new n8(s,i):re}function rs(e,t){return e.from-t.from||e.to-t.to}function ra(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),rl(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),rl(t,i,r.copy(o.from,r.to)));break}}return t}function rl(e,t,n){for(;t<e.length&&rs(n,e[t])>0;)t++;e.splice(t,0,n)}function rc(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=re&&t.push(r)}),e.cursorWrapper&&t.push(n8.create(e.state.doc,[e.cursorWrapper.deco])),rt.from(t)}let rd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ru=tf&&tm<=11;class rh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class rp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);tf&&tm<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():tw&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),ru&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nc(this.view)){if(this.suppressingSelectionUpdates)return nt(this.view);if(tf&&tm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=e9(n))t.add(n);for(let r=e.anchorNode;r;r=e9(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nc(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(tg&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&ts(r)&&(c=t8(t))&&c.eq(ez.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nt(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!rf.has(e)&&(rf.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=tg,rm||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),rm=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,l)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nt(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(tf&&tm<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?e6(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?e6(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let rf=new WeakMap,rm=!1;function rg(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return tt(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function ry(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(tw&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||tw&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let rb=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rv(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nl(e,t.resolve(n.anchor),t.resolve(n.head))}function rw(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function rx(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class rk{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new nP,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rE(this),rC(this),this.nodeViews=rM(this),this.docView=tG(this.state.doc,rS(this),rc(this),this.dom,this),this.domObserver=new rp(this,(e,t,n,r)=>(function(e,t,n,r,o){let s,a,l,c=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=t8(e,t);if(n&&!e.state.selection.eq(n)){if(tb&&tC&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let d=e.state.doc.resolve(t),u=d.sharedDepth(n);t=d.before(u+1),n=e.state.doc.resolve(n).after(u+1);let h=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],ts(c)||r.push({node:c.focusNode,offset:c.focusOffset})),tb&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,h=e.someProp("domParser")||H.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:ry,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),f=e.state.doc,m=f.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,a="end"):(s=e.state.selection.from,a="start"),e.input.lastKeyCode=null;let g=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,a));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&rx(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;(o-=t)&&o<e.size&&rx(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(m.content,p.doc.content,p.from,s,a);if(g&&e.input.domChangeCount++,(tx&&e.input.lastIOSEnter>Date.now()-225||tC)&&o.some(e=>1==e.nodeType&&!rb.test(e.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(r&&h instanceof eF&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))g={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let t=rv(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eF&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),tf&&tm<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let y=p.doc.resolveNoCache(g.start-p.from),b=p.doc.resolveNoCache(g.endB-p.from),v=f.resolve(g.start),w=y.sameParent(b)&&y.parent.inlineContent&&v.end()>=g.endA;if((tx&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!w&&y.pos<p.doc.content.size&&(!y.sameParent(b)||!y.parent.inlineContent)&&y.pos<b.pos&&!/\S/.test(p.doc.textBetween(y.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||rw(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(rw(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||rw(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,g.start,g.endA,y,b)&&e.someProp("handleKeyDown",t=>t(e,ta(8,"Backspace")))){tC&&tb&&e.domObserver.suppressSelectionUpdates();return}tb&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),tC&&!w&&y.start()!=b.start()&&0==b.parentOffset&&y.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,b=p.doc.resolveNoCache(g.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,ta(13,"Enter"))})},20));let x=g.start,k=g.endA,S=t=>{let n=t||e.state.tr.replace(x,k,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let t=rv(e,n.doc,p.sel);t&&!(tb&&e.composing&&t.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==n.mapping.map(k)-1)||tf&&t.empty&&t.head==x)&&n.setSelection(t)}return c&&n.setMeta("composition",c),n.scrollIntoView()};if(w)if(y.pos==b.pos){tf&&tm<=11&&0==y.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>nt(e),20));let t=S(e.state.tr.delete(x,k)),n=f.resolve(g.start).marksAcross(f.resolve(g.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(g.endA==g.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,s=r,a,l,c;for(let e=0;e<r.length;e++)o=r[e].removeFromSet(o);for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);if(1==o.length&&0==s.length)l=o[0],a="add",c=e=>e.mark(l.addToSet(e.marks));else{if(0!=o.length||1!=s.length)return null;l=s[0],a="remove",c=e=>e.mark(l.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(c(t.child(e)));if(i.from(d).eq(e))return{mark:l,type:a}}(y.parent.content.cut(y.parentOffset,b.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){let t=S(e.state.tr);"add"==l.type?t.addMark(x,k,l.mark):t.removeMark(x,k,l.mark),e.dispatch(t)}else if(y.parent.child(y.index()).isText&&y.index()==b.index()-!b.textOffset){let t=y.parent.textBetween(y.parentOffset,b.parentOffset),n=()=>S(e.state.tr.insertText(t,x,k));e.someProp("handleTextInput",r=>r(e,x,k,t,n))||e.dispatch(n())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in nj){let n=nj[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||n$(e,t)||!e.editable&&t.type in nI||n(e,t)},nL[t]?{passive:!0}:void 0)}tw&&e.dom.addEventListener("input",()=>null),nz(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nz(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rN),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(nJ(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rM(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&nz(this),this.editable=rE(this),rC(this);let c=rc(this),d=rS(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(o.selection))&&(a=!0);let p="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:tT(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=h&&(tf||tb)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(a)!=i.$anchor.start(a));if(h){let t=tb?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=ti(e=e.childNodes[t-1])}else{if(!e.parentNode||to(e))return null;t=e6(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||to(e))return null;t=e6(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=tG(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),tt(t.node,t.offset,n.anchorNode,n.anchorOffset)))?nt(this,l):(ns(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;tR(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof eU){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&tA(this,t.getBoundingClientRect(),e)}else tA(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new nQ(e.slice,e.move,r<0?void 0:eU.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(tf){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(tO)return e.focus(tO);let t=tT(e);e.focus(null==tO?{get preventScroll(){return tO={preventScroll:!0},!0}}:void 0),tO||(tO=!1,tR(t,0))}(this.dom),nt(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ti(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ti(r.startContainer),r.startOffset)}}}(o,t.left,t.top);l&&({node:s,offset:a}=l);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!tD(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(tD(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(tw)for(let e=c;s&&e;e=e9(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(tg&&1==s.nodeType&&(a=Math.min(a,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}tE&&a&&1==s.nodeType&&1==(n=s.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=s.nodeType||"BR"!=s.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,l=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,a=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(l=u+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=tI(r,1);if(n.top!=n.bottom&&tD(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:l}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return tP(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return tB==t&&tF==n?tV:(tB=t,tF=n,tV="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,t$(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=tP(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?tH.test(r.parent.textContent)&&s.modify?t$(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:a}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,a),t&&(t!=o||i!=a)&&s.extend&&s.extend(t,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return nZ(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return nZ(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nS(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,te()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!n$(this,e)&&nj[e.type]&&(this.editable||!(e.type in nI))&&nj[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?tw&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return rg(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?rg(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function rS(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[n6.node(0,e.state.doc.content.size,t)]}function rC(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:n6.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function rE(e){return!e.someProp("editable",t=>!1===t(e.state))}function rM(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function rN(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}rk.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},e.s(["Decoration",0,n6,"DecorationSet",0,n8,"EditorView",0,rk],362615);for(var rA={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},rT={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rR="u">typeof navigator&&/Mac/.test(navigator.platform),rO="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rD=0;rD<10;rD++)rA[48+rD]=rA[96+rD]=String(rD);for(var rD=1;rD<=24;rD++)rA[rD+111]="F"+rD;for(var rD=65;rD<=90;rD++)rA[rD]=String.fromCharCode(rD+32),rT[rD]=String.fromCharCode(rD);for(var rj in rA)rT.hasOwnProperty(rj)||(rT[rj]=rA[rj]);let rI="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),rL="u">typeof navigator&&/Win/.test(navigator.platform);function rP(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 r_(e){return new e2({props:{handleKeyDown:rz(e)}})}function rz(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(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))rI?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(rR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||rO&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?rT:rA)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[rP(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[rP(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(rL&&n.ctrlKey&&n.altKey)&&(o=rA[n.keyCode])&&o!=i){let r=t[rP(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}if(e.s(["keydownHandler",0,rz,"keymap",0,r_],202008),"u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var r$=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,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}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:s}=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:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),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,s=this.map[o];!n[s]&&(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}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 t(e)||n(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,s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){let c=e.child(a);l++;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:l,n:h-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=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}),l++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new r$(t,n,r,o),l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&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 s=n.nodeAt(o);if(!s)throw RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let n=0;n<l.colspan;n++){let r=t[(i+n)%e.width*2];null==r||l.colwidth&&l.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}(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e),a}(e))}};function rH(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 rB=new e4("selectingCells");function rF(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 rV(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 rU(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=rF(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 rW(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function rq(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function rK(e,t,n){let r=e.node(-1),i=r$.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function rJ(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}function rG(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}var rX=class e extends ez{constructor(e,t=e){const n=e.node(-1),r=r$.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=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 e$(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),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(rW(r)&&rW(i)&&rq(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 eF.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=r$.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let n=r.top;n<r.bottom;n++){let a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){let n=t.map[i];if(o[n])continue;o[n]=!0;let s=t.findCell(n),l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);let c=r.left-s.left,d=s.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=rJ(e,0,c)),d>0&&(e=rJ(e,e.colspan-d,d)),s.left<r.left){if(!(l=l.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}s.push(e.child(n).copy(i.from(a)))}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new d(i.from(a),1,1)}replace(e,t=d.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?d.empty:t)}let i=ez.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new d(i.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=r$.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=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=r$.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=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.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 rZ(this.$anchorCell.pos,this.$headCell.pos)}};rX.prototype.visible=!1,ez.jsonID("cell",rX);var rZ=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&&rq(t,n)?new rX(t,n):ez.near(n,1)}};function rY(e){if(!(e.selection instanceof rX))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(n6.node(n,n+e.nodeSize,{class:"selectedCell"}))}),n8.create(e.doc,t)}let rQ=new e4("fix-tables");function r0(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,o,s=r$.get(t);if(!s.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<s.height;e++)a.push(0);for(let e=0;e<s.problems.length;e++){let i=s.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,rJ(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 l=0,c=n+1;l<s.height;l++){let n=t.child(l),s=c+n.nodeSize,d=a[l];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=rH(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==l||i==l-1)&&o==l?c+1:s-1;r.insert(r.mapping.map(u),a)}c=s}return r.setMeta(rQ,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let o=t.childCount,s=n.childCount;n:for(let a=0,l=0;a<s;a++){let s=n.child(a);for(let e=l,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==s){l=e+1,r+=s.nodeSize;continue n}i(s,r),l<o&&t.child(l).sameMarkup(s)?e(t.child(l),s,r+1,i):s.nodesBetween(0,s.content.size,i,r+1),r+=s.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function r1(e){let t=r$.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 s=o*i+n,a=t.map[s];if(o>0){let e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function r2(e,t){let n=[],r=r$.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){let i=e.child(s),a=[];for(let n=0;n<o;n++){let i=t[s][n];if(!i)continue;let o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;let c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function r5(e,t,n,r){let i,o=t[0]>n[0]?-1:1,s=e.splice(t[0],t.length),a=+(s.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,...s),e}function r3(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 r4(e,t){let n=r3(t.$from);if(!n)return;let r=r$.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 r6(e,t){let n=r3(t.$from);if(!n)return;let r=r$.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 r9(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r4(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=r4(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 s=[];for(let t=i;t<=o;t++){let n=r4(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r4(i,e.selection),l=r6(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r4(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r7(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r6(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=r6(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 s=[];for(let t=i;t<=o;t++){let n=r6(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r6(i,e.selection),l=r4(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r6(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r8(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function ie(e){let t=e.selection,n=rU(e),r=n.node(-1),i=n.start(-1),o=r$.get(r);return{...t instanceof rX?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function it(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=rH(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 s=0;s<t.height;s++){let a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,rG(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{let l=null==o?rH(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function ir(e,{map:t,tableStart:n,table:r},i){let o=n;for(let e=0;e<i;e++)o+=r.child(e).nodeSize;let s=[],a=i>0?-1:0;(function(e,t,n){var r;let i=rH(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if((null==(r=t.nodeAt(e.map[o+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+a)&&(a=0==i||i==t.height?null:0);for(let o=0,c=t.width*i;o<t.width;o++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],s=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...s,rowspan:s.rowspan+1}),o+=s.colspan-1}else{var l;let e=null==a?rH(r.type.schema).cell:null==(l=r.nodeAt(t.map[c+a*t.width]))?void 0:l.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(o,rH(r.type.schema).row.create(null,s)),e}function ii(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function io(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 is(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=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=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=io("row",i,r),a=io("column",i,r),l=+("column"===e?!!s:"row"===e&&!!a),c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?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}}is("row",{useDeprecatedLogic:!0}),is("column",{useDeprecatedLogic:!0});let ia=is("cell",{useDeprecatedLogic:!0});function il(e,t){let n=e.selection;if(!(n instanceof rX))return!1;if(t){let r=e.tr,i=rH(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 d(i,0,0))}),r.docChanged&&t(r)}return!0}function ic(e,t){let n=e.createAndFill();return new eP(n).replace(0,n.content.size,t).doc}function id(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){let i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!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:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function iu(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){let i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,rJ(i.attrs,s-d,i.attrs.colspan-(s-d))),e.insert(u+i.nodeSize,i.type.createAndFill(rJ(i.attrs,0,s-d))),c+=i.attrs.rowspan-1}}return l}function ih(e,t,n,r,o){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw Error("No table found");let a=r$.get(s),{top:l,left:c}=r,u=c+o.width,h=l+o.height,p=e.tr,f=0;function m(){if(!(s=n?p.doc.nodeAt(n-1):p.doc))throw Error("No table found");a=r$.get(s),f=p.mapping.maps.length}(function(e,t,n,r,o,s){let a,l,c=rH(e.doc.type.schema);if(o>t.width)for(let i=0,s=0;i<t.height;i++){let d,u=n.child(i);s+=u.nodeSize;let h=[];d=null==u.lastChild||u.lastChild.type==c.cell?a||(a=c.cell.createAndFill()):l||(l=c.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(d);e.insert(e.mapping.slice(0).map(s-1+r),h)}if(s>t.height){let d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==c.header_cell;d.push(i?l||(l=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}let u=c.row.create(null,i.from(d)),h=[];for(let e=t.height;e<s;e++)h.push(u);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),h)}return!!(a||l)})(p,a,s,n,u,h)&&m(),id(p,a,s,n,c,u,l,f)&&m(),id(p,a,s,n,c,u,h,f)&&m(),iu(p,a,s,n,l,h,c,f)&&m(),iu(p,a,s,n,l,h,u,f)&&m();for(let e=l;e<h;e++){let t=a.positionAt(e,c,s),r=a.positionAt(e,u,s);p.replace(p.mapping.slice(f).map(t+n),p.mapping.slice(f).map(r+n),new d(o.rows[e-l],0,0))}m(),p.setSelection(new rX(p.doc.resolve(n+a.positionAt(l,c,s)),p.doc.resolve(n+a.positionAt(h-1,u-1,s)))),t(p)}let ip=rz({ArrowLeft:ig("horiz",-1),ArrowRight:ig("horiz",1),ArrowUp:ig("vert",-1),ArrowDown:ig("vert",1),"Shift-ArrowLeft":iy("horiz",-1),"Shift-ArrowRight":iy("horiz",1),"Shift-ArrowUp":iy("vert",-1),"Shift-ArrowDown":iy("vert",1),Backspace:il,"Mod-Backspace":il,Delete:il,"Mod-Delete":il});function im(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function ig(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof rX)return im(n,r,ez.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let s=ix(i,e,t);if(null==s)return!1;if("horiz"==e)return im(n,r,ez.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(s),a=rK(o,e,t);return i=a?ez.near(a,1):t<0?ez.near(n.doc.resolve(o.before(-1)),-1):ez.near(n.doc.resolve(o.after(-1)),1),im(n,r,i)}}}function iy(e,t){return(n,r,i)=>{let o;if(!i)return!1;let s=n.selection;if(s instanceof rX)o=s;else{let r=ix(i,e,t);if(null==r)return!1;o=new rX(n.doc.resolve(r))}let a=rK(o.$headCell,e,t);return!!a&&im(n,r,new rX(o.$anchorCell,a))}}function ib(e,t){let n=rF(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new rX(n))),!0)}function iv(e,t,n){if(!rV(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 o=t.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==s)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=ic(rH(a).row,new d(i,o,s)).content),l.push(i)}else{if("cell"!=s&&"header_cell"!=s)return null;l.push(n||r?ic(rH(a).row,new d(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 o=0;o<n.length;o++)if(o>=t.length&&t.push(i.empty),n[o]<r){let s=rH(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(s);t[o]=t[o].append(i.from(a))}return{height:t.length,width:r,rows:t}}(a,l)}(n),o=e.state.selection;if(o instanceof rX){r||(r={width:1,height:1,rows:[i.from(ic(rH(e.state.schema).cell,n))]});let t=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=r$.get(t).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){let t=[],o=[];for(let e=0;e<n.length;e++){let s=n[e],a=[];for(let n=t[e]||0,i=0;n<r;i++){let o=s.child(i%s.childCount);n+o.attrs.colspan>r&&(o=o.type.createChecked(rJ(o.attrs,o.attrs.colspan,n+o.attrs.colspan-r),o.content)),a.push(o),n+=o.attrs.colspan;for(let n=1;n<o.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+o.attrs.colspan}o.push(i.from(a))}n=o,e=r}if(t!=o){let e=[];for(let r=0,s=0;r<o;r++,s++){let a=[],l=n[s%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(i.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}(r,a.right-a.left,a.bottom-a.top),ih(e.state,e.dispatch,s,a,r),!0}if(!r)return!1;{let t=rU(e.state),n=t.start(-1);return ih(e.state,e.dispatch,n,r$.get(t.node(-1)).findCell(t.pos-n),r),!0}}function iw(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=ik(e,t.target);if(t.shiftKey&&e.state.selection instanceof rX)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=rF(e.state.selection.$anchor))&&(null==(n=iS(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=iS(e,n),i=null==rB.getState(e.state);if(!r||!rq(t,r))if(!i)return;else r=t;let o=new rX(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(rB,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=rB.getState(e.state)&&e.dispatch(e.state.tr.setMeta(rB,-1))}function a(n){let r,a=rB.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(ik(e,n.target)!=i&&!(r=iS(e,t)))return s();r&&o(r,n)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function ix(e,t,n){if(!(e.state.selection instanceof eF))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),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function ik(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function iS(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&&rF(e.state.doc.resolve(r))||rF(e.state.doc.resolve(i))}var iC=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")),iE(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,iE(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function iE(e,t,n,r,i,o){let s=0,a=!0,l=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(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;let e=l.nextSibling;null==(d=l.parentNode)||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}let iM=new e4("tableColumnResizing");var iN=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(iM);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 rW(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function iA(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,s=rF(e.state.doc.resolve(o));if(!s)return -1;if("right"==n)return s.pos;let a=r$.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function iT(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function iR(e,t){e.dispatch(e.state.tr.setMeta(iM,{setHandle:t}))}function iO(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=r$.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&iE(o,l.firstChild,l,r,a,n)}e.s(["CellSelection",0,rX,"addColumnAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.right))}return!0},"addColumnBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.left))}return!0},"addRowAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.bottom))}return!0},"addRowBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.top))}return!0},"cellAround",0,rF,"columnResizing",0,function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=iC,lastColumnResizable:i=!0}={}){let o=new e2({key:iM,state:{init(e,t){var i;let s=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=rH(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new iN(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=iM.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=iM.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),s=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=iA(e,t,"left",n):i-t.clientX<=n&&(s=iA(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=r$.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}iR(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=iM.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&iR(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,s=iM.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=iM.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=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=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,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,iT(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(iM,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=iM.getState(e.state);if(i&&i.dragging){let o=iT(i.dragging,t,n);iO(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(iM,{setDragging:{startX:t.clientX,startWidth:l}})),iO(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=iM.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 n8.empty;let o=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+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 l;let t=o.map[r],a=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(l=iM.getState(e))?void 0:l.dragging)&&n.push(n6.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(n6.widget(a,c))}}return n8.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o},"deleteColumn",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(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 s=0;s<t.height;){let a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,rJ(d,i-t.colCount(l)));else{let t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=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=r$.get(e)}t(r)}return!0},"deleteRow",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(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 s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);let l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){let c=t.map[s];if(!l.has(c)){if(l.add(c),i>0&&c==t.map[s-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[s+t.width]){let s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=l.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=r$.get(n.table)}t(r)}return!0},"deleteTable",0,function(e,t){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},"fixTables",0,r0,"goToNextCell",0,function(e){return function(t,n){if(!rV(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}(rU(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(eF.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}},"isInTable",0,rV,"mergeCells",0,function(e,t){let n=e.selection;if(!(n instanceof rX)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=ie(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,a=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[a]==n[a+1])return!0;o+=e,a+=e}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}(o,r))return!1;if(t){let n,s,a=e.tr,l={},c=i.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let i=o.map[e*o.width+t],d=r.table.nodeAt(i);if(!l[i]&&d)if(l[i]=!0,null==n)n=i,s=d;else{ii(d)||(c=c.append(d.content));let e=a.mapping.map(i+r.tableStart);a.delete(e,e+d.nodeSize)}}if(null==n||null==s)return!0;if(a.setNodeMarkup(n+r.tableStart,null,{...rG(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){let e=n+1+s.content.size,t=ii(s)?n+1:e;a.replaceWith(t+r.tableStart,e+r.tableStart,c)}a.setSelection(new rX(a.doc.resolve(n+r.tableStart))),t(a)}return!0},"moveTableColumn",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r9(a,l))?void 0:t.indexes,f=null==(n=r9(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r8(r1(r)),r2(r,s=r8(s=r5(s,i,o,0))));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(g.height-1,c,m),v=a.doc.resolve(y+b),w=g.positionAt(0,c,m),x=a.doc.resolve(y+w);return a.setSelection(rX.colSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"moveTableRow",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r7(a,l))?void 0:t.indexes,f=null==(n=r7(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r1(r),r2(r,s=r5(s,i,o,0)));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(c,g.width-1,m),v=a.doc.resolve(y+b),w=g.positionAt(c,0,m),x=a.doc.resolve(y+w);return a.setSelection(rX.rowSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"selectedRect",0,ie,"setCellAttr",0,function(e,t){return function(n,r){if(!rV(n))return!1;let i=rU(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let o=n.tr;n.selection instanceof rX?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}},"splitCell",0,function(e,t){var n;let r=rH(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,o=e.selection;if(o instanceof rX){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from)))return!1;i=null==(s=rF(o.$from))?void 0:s.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let s,a=r.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=ie(e),u=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(c?{...a,colwidth:c&&c[e]?[c[e]]:null}:a);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=r.nodeSize);for(let i=d.left,o=0;i<d.right;i++,o++)(i!=d.left||e!=d.top)&&u.insert(s=u.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(l[o]))}u.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),l[0]),o instanceof rX&&u.setSelection(new rX(u.doc.resolve(o.$anchorCell.pos),s?u.doc.resolve(s):void 0)),t(u)}return!0})(e,t)},"tableEditing",0,function({allowTableNodeSelection:e=!1}={}){return new e2({key:rB,state:{init:()=>null,apply(e,t){let n=e.getMeta(rB);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:rY,handleDOMEvents:{mousedown:iw},createSelectionBetween:e=>null!=rB.getState(e.state)?e.state.selection:null,handleTripleClick:ib,handleKeyDown:ip,handlePaste:iv},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,o=(t||e).selection,s=(t||e).doc;if(o instanceof eU&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=rX.create(s,o.from);else if("row"==i){let e=s.resolve(o.from+1);r=rX.rowSelection(e,e)}else if(!n){let e=r$.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=rX.create(s,t+1,n)}}else o instanceof eF&&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=eF.create(s,o.from):o instanceof eF&&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=eF.create(s,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,r0(r,n),e)})},"toggleHeader",0,is,"toggleHeaderCell",0,ia],608926),e.s([],150663),e.i(335884);var iD=e.i(101685),ij=e.i(380560),iI=e.i(3909),iL=e.i(44501);let iP=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function i_(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let iz=(e,t,n)=>{let r=i_(e,n);if(!r)return!1;let i=iF(r);if(!i){let n=r.blockRange(),i=n&&em(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(iY(e,i,t,-1))return!0;if(0==r.parent.content.size&&(iH(o,"end")||eU.isSelectable(o)))for(let n=r.depth;;n--){let s=eE(e.doc,r.before(n),r.after(n),d.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(iH(o,"end")?ez.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):eU.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)};function i$(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,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=eE(e.doc,i,s,d.empty);if(!a||a.from!=i||a instanceof eu&&a.slice.size>=s-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(eF.create(t.doc,i)),n(t.scrollIntoView())}return!0}function iH(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 iB=(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=iF(r)}let s=o&&o.nodeBefore;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function iF(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 iV(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let iU=(e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iq(r);if(!i)return!1;let o=i.nodeAfter;if(iY(e,i,t,1))return!0;if(0==r.parent.content.size&&(iH(o,"start")||eU.isSelectable(o))){let n=eE(e.doc,r.before(),r.after(),d.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(iH(o,"start")?ez.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):eU.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)},iW=(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=iq(r)}let s=o&&o.nodeAfter;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos)).scrollIntoView()),!0)};function iq(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}let iK=(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)};function iJ(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 iG=(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),s=iJ(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(ez.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},iX=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof eq||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=iJ(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,s=e.tr.insert(n,o.createAndFill());s.setSelection(eF.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},iZ=(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(ew(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&em(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function iY(e,t,n,r){let o,s,a,l=t.nodeBefore,c=t.nodeAfter,u,h,p=l.type.spec.isolating||c.type.spec.isolating;if(!p&&(o=t.nodeBefore,s=t.nodeAfter,a=t.index(),o&&s&&o.type.compatibleContent(s.type)&&(!o.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(a,a+1)&&!!(s.isTextblock||ex(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let f=!p&&t.parent.canReplace(t.index(),t.index()+1);if(f&&(u=(h=l.contentMatchAt(l.childCount)).findWrapping(c.type))&&h.matchType(u[0]||c.type).validEnd){if(n){let r=t.pos+c.nodeSize,o=i.empty;for(let e=u.length-1;e>=0;e--)o=i.from(u[e].create(null,o));o=i.from(l.copy(o));let s=e.tr.step(new eh(t.pos-1,r,t.pos,r,new d(o,1,0),u.length,!0)),a=s.doc.resolve(r+2*u.length);a.nodeAfter&&a.nodeAfter.type==l.type&&ex(s.doc,a.pos)&&s.join(a.pos),n(s.scrollIntoView())}return!0}let m=c.type.spec.isolating||r>0&&p?null:ez.findFrom(t,1),g=m&&m.$from.blockRange(m.$to),y=g&&em(g);if(null!=y&&y>=t.depth)return n&&n(e.tr.lift(g,y).scrollIntoView()),!0;if(f&&iH(c,"start",!0)&&iH(l,"end")){let r=l,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=c,a=1;for(;!s.isTextblock;s=s.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=i.empty;for(let e=o.length-1;e>=0;e--)r=i.from(o[e].copy(r));n(e.tr.step(new eh(t.pos-o.length,t.pos+c.nodeSize,t.pos+a,t.pos+c.nodeSize-a,new d(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function iQ(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(eF.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let i0=iQ(-1),i1=iQ(1);function i2(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:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(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:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function i5(...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 i3=i5(iP,iz,iB),i4=i5(iP,iU,iW),i6={Enter:i5(iK,iX,iZ,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof eU&&e.selection.node.isBlock)return!!n.parentOffset&&!!ew(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),s=iJ(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof eF||e.selection instanceof eq)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=ew(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=ew(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":iG,Backspace:i3,"Mod-Backspace":i3,"Shift-Backspace":i3,Delete:i4,"Mod-Delete":i4,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new eq(e.doc))),!0)},i9={"Ctrl-h":i6.Backspace,"Alt-Backspace":i6["Mod-Backspace"],"Ctrl-d":i6.Delete,"Ctrl-Alt-Backspace":i6["Mod-Delete"],"Alt-Delete":i6["Mod-Delete"],"Alt-d":i6["Mod-Delete"],"Ctrl-a":i0,"Ctrl-e":i1};for(let e in i6)i9[e]=i6[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();var i7=Object.defineProperty,i8=(e,t)=>{for(var n in t)i7(e,n,{get:t[n],enumerable:!0})};function oe(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var ot=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!e,l=e||i.tr,c=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:oe({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},on={};i8(on,{blur:()=>or,clearContent:()=>oi,clearNodes:()=>oo,command:()=>oa,createParagraphNear:()=>ol,cut:()=>oc,deleteCurrentNode:()=>od,deleteNode:()=>oh,deleteRange:()=>op,deleteSelection:()=>om,enter:()=>og,exitCode:()=>oy,extendMarkRange:()=>oC,first:()=>oE,focus:()=>oO,forEach:()=>oD,insertContent:()=>oj,insertContentAt:()=>o_,joinBackward:()=>oH,joinDown:()=>o$,joinForward:()=>oB,joinItemBackward:()=>oF,joinItemForward:()=>oV,joinTextblockBackward:()=>oU,joinTextblockForward:()=>oW,joinUp:()=>oz,keyboardShortcut:()=>oK,lift:()=>oG,liftEmptyBlock:()=>oX,liftListItem:()=>oZ,newlineInCode:()=>oY,resetAttributes:()=>o1,scrollIntoView:()=>o2,selectAll:()=>o5,selectNodeBackward:()=>o3,selectNodeForward:()=>o4,selectParentNode:()=>o6,selectTextblockEnd:()=>o9,selectTextblockStart:()=>o7,setContent:()=>se,setMark:()=>sP,setMeta:()=>s_,setNode:()=>sz,setNodeSelection:()=>s$,setTextDirection:()=>sH,setTextSelection:()=>sB,sinkListItem:()=>sF,splitBlock:()=>sU,splitListItem:()=>sW,toggleList:()=>sJ,toggleMark:()=>sG,toggleNode:()=>sX,toggleWrap:()=>sZ,undoInputRule:()=>sY,unsetAllMarks:()=>sQ,unsetMark:()=>s0,unsetTextDirection:()=>s1,updateAttributes:()=>s2,wrapIn:()=>s5,wrapInList:()=>s3});var or=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),oi=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),oo=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),a=o.blockRange(s);if(!a)return;let l=em(a);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},oa=e=>t=>e(t),ol=()=>({state:e,dispatch:t})=>iX(e,t),oc=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new eF(r.doc.resolve(Math.max(s-1,0)))),!0},od=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ou(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var oh=e=>({tr:t,state:n,dispatch:r})=>{let i=ou(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},op=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},of=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},om=()=>({state:e,dispatch:t})=>{var n;let{$from:r,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:o,to:s}={from:of(r,n=e.schema,"left"),to:of(i,n,"right")};return t&&(e.tr.deleteRange(o,s).scrollIntoView(),t(e.tr)),!0},og=()=>({commands:e})=>e.keyboardShortcut("Enter"),oy=()=>({state:e,dispatch:t})=>iG(e,t);function ob(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ov(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:ob(t[r])?t[r].test(e[r]):t[r]===e[r])}function ow(e,t,n={}){return e.find(e=>e.type===t&&ov(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ox(e,t,n={}){return!!ow(e,t,n)}function ok(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!ow([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,a=o+r.node.nodeSize;for(;i>0&&ox([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&ox([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:a}}function oS(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var oC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=oS(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let e=ok(l,o,t);if(e&&e.from<=c&&e.to>=d){let t=eF.create(s,e.from,e.to);n.setSelection(t)}}return!0},oE=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function oM(e){return e instanceof eF}function oN(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function oA(e,t=null){if(!t)return null;let n=ez.atStart(e),r=ez.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?eF.create(e,oN(0,i,o),oN(e.content.size,i,o)):eF.create(e,oN(t,i,o),oN(t,i,o))}function oT(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function oR(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var oO=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(oR()||oT())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!oR()&&!oT()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!oM(n.state.selection))return s(),!0;let a=oA(i.doc,e)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},oD=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),oj=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),oI=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&oI(r)}return e};function oL(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return oI(new window.DOMParser().parseFromString(t,"text/html").body)}function oP(e,t,n){if(e instanceof S||e instanceof i)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return i.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),oP("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,i="",o=new z({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?H.fromSchema(o).parseSlice(oL(e),n.parseOptions):H.fromSchema(o).parse(oL(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=H.fromSchema(t);return n.slice?r.parseSlice(oL(e),n.parseOptions).content:r.parse(oL(e),n.parseOptions)}return oP("",t,n)}var o_=(e,t,n)=>({tr:r,dispatch:o,editor:s})=>{var a;if(o){let o,l;n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{oP(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(e){c(e)}try{o=oP(t,s.schema,{parseOptions:d,errorOnInvalidContent:null!=(a=n.errorOnInvalidContent)?a:s.options.enableContentCheck})}catch(e){return c(e),!1}let{from:u,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if((!("type"in o)?o:[o]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),u===h&&f){let{parent:e}=r.doc.resolve(u);!e.isTextblock||e.type.spec.code||e.childCount||(u-=1,h+=1)}if(p){if(Array.isArray(t))l=t.map(e=>e.text||"").join("");else if(t instanceof i){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),l=e}else l="object"==typeof t&&t&&t.text?t.text:t;r.insertText(l,u,h)}else{l=o;let e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,h,l)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof eu||r instanceof eh))return;let i=e.mapping.maps[n],o=0;i.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(ez.near(e.doc.resolve(o),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:l})}return!0},oz=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof eU,i;if(r){if(n.node.isTextblock||!ex(e.doc,n.from))return!1;i=n.from}else if(null==(i=eS(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(eU.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),o$=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof eU){if(n.node.isTextblock||!ex(e.doc,n.to))return!1;r=n.to}else if(null==(r=eS(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),oH=()=>({state:e,dispatch:t})=>iz(e,t),oB=()=>({state:e,dispatch:t})=>iU(e,t),oF=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oV=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oU=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=i_(e,n);if(!r)return!1;let i=iF(r);return!!i&&i$(e,i,t)})(e,t),oW=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iq(r);return!!i&&i$(e,i,t)})(e,t);function oq(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var oK=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))oR()||oq()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function oJ(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?ou(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>ov(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var oG=(e,t={})=>({state:n,dispatch:r})=>{let i=ou(e,n.schema);return!!oJ(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&em(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},oX=()=>({state:e,dispatch:t})=>iZ(e,t),oZ=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!s&&(!t||(n.node(s.depth-1).type==r?function(e,t,n,r){let o=e.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new eh(s-1,a,s,a,new d(i.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new x(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));let l=em(r);if(null==l)return!1;o.lift(r,l);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return ex(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),t(o.scrollIntoView()),!0}(e,t,r,s):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,u=s.node(-1),h=s.index(-1);if(!u.canReplace(h+ +!l,h+1,a.content.append(c?i.empty:i.from(o))))return!1;let p=s.pos,f=p+a.nodeSize;return r.step(new eh(p-!!l,f+ +!!c,p+1,f-1,new d((l?i.empty:i.from(o.copy(i.empty))).append(c?i.empty:i.from(o.copy(i.empty))),+!l,+!c),+!l)),t(r.scrollIntoView()),!0}(e,t,s)))})(t,n)},oY=()=>({state:e,dispatch:t})=>iK(e,t);function oQ(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function o0(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var o1=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,o0(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,s.create(o0(o.attrs,t))))})})}),l},o2=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),o5=()=>({tr:e,dispatch:t})=>{if(t){let t=new eq(e.doc);e.setSelection(t)}return!0},o3=()=>({state:e,dispatch:t})=>iB(e,t),o4=()=>({state:e,dispatch:t})=>iW(e,t),o6=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(eU.create(e.doc,i))),!0)})(e,t),o9=()=>({state:e,dispatch:t})=>i1(e,t),o7=()=>({state:e,dispatch:t})=>i0(e,t);function o8(e,t,n={},r={}){return oP(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var se=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if("full"!==r.preserveWhitespace){let a=o8(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function st(e,t){let n=oS(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function sn(e,t){let n=new eP(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function sr(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function si(e){return t=>sr(t.$from,e)}function so(e,t,n){return void 0===e.config[t]&&e.parent?so(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?so(e.parent,t,n):null}):e.config[t]}function ss(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=so(e,"addExtensions",t);return n?[e,...ss(n())]:e}).flat(10)}function sa(e,t){let n=G.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function sl(e){return"function"==typeof e}function sc(e,t,...n){return sl(e)?t?e.bind(t)(...n):e(...n):e}function sd(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function su(e){let t=[],{nodeExtensions:n,markExtensions:r}=sd(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=so(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=so(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sh(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let a=0;a<s;a+=1){let s=e[a];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function sp(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...sh(n[e]),...sh(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function sf(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>sp(e,t),{})}function sm(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function sg(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function sy(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function sb(e){return e.sort((e,t)=>{let n=so(e,"priority")||100,r=so(t,"priority")||100;return n>r?-1:+(n<r)})}function sv(e){var t;let n=sb(ss(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function sw(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=o);let u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),a}function sx(e,t){let n={from:0,to:e.content.size};return sw(e,n,t)}function sk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function sS(e,t){let n=oQ("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=ou(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?st(e,t):{}}function sC(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),a=n.invert().map(o,-1),l=n.invert().map(s);i.push({oldRange:{from:a,to:l},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function sE(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=ok(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function sM(e,t){return t.nodes[e]||t.marks[e]||null}function sN(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function sA(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?oS(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>ov(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>ov(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function sT(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function sR(e,t){let{nodeExtensions:n}=sd(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=sc(so(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function sO(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(sO(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function sD({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:o}=e;return!!(i<=t&&o>=t+n||r&&oM(e)&&i>t&&o<t+n)}var sj=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function sI(e,t){let n=t.mapping.mapResult(e.position);return{position:new sj(n.pos),mapResult:n}}function sL(e){return new sj(e)}var sP=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=oS(e,r.schema);if(i)if(s){let e=st(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(oM(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},s_=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sz=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=ou(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!i2(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>i2(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},s$=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=oN(e,0,n.content.size),i=eU.create(n,r);t.setSelection(i)}return!0},sH=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:a}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},sB=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=eF.atStart(n).from,s=eF.atEnd(n).to,a=oN(r,o,s),l=oN(i,o,s),c=eF.create(n,a,l);t.setSelection(c)}return!0},sF=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);if(!s)return!1;let a=s.startIndex;if(0==a)return!1;let l=s.parent,c=l.child(a-1);if(c.type!=r)return!1;if(t){let n=c.lastChild&&c.lastChild.type==l.type,o=i.from(n?r.create():null),a=new d(i.from(r.create(null,i.from(l.type.create(null,o)))),n?3:1,0),u=s.start,h=s.end;t(e.tr.step(new eh(u-(n?3:1),h,u,h,a,1,!0)).scrollIntoView())}return!0})(t,n)};function sV(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var sU=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:a,$to:l}=o,c=sN(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(o instanceof eU&&o.node.isBlock)return!!a.parentOffset&&!!ew(s,a.pos)&&(r&&(e&&sV(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1))),h=d&&u?[{type:u,attrs:c}]:void 0,p=ew(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!p&&ew(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(o instanceof eF&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),u&&!d&&!a.parentOffset&&a.parent.type!==u)){let e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&sV(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},sW=(e,t={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var a;let l=ou(e,r.schema),{$from:c,$to:u}=r.selection,h=r.selection.node;if(h&&h.isBlock||c.depth<2||!c.sameParent(u))return!1;let p=c.node(-1);if(p.type!==l)return!1;let f=s.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let e=i.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;t-=1)e=i.from(c.node(t).copy(e));let o=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,s={...sN(f,c.node().type.name,c.node().attrs),...t},u=(null==(a=l.contentMatch.defaultType)?void 0:a.createAndFill(s))||void 0;e=e.append(i.from(l.createAndFill(null,u)||void 0));let h=c.before(c.depth-(r-1));n.replace(h,c.after(-o),new d(e,4-r,0));let p=-1;n.doc.nodesBetween(h,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(eF.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}let m=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,g={...sN(f,p.type.name,p.attrs),...t},y={...sN(f,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,u.pos);let b=m?[{type:l,attrs:g},{type:m,attrs:y}]:[{type:l,attrs:g}];if(!ew(n.doc,c.pos,2))return!1;if(o){let{selection:e,storedMarks:t}=r,{splittableMarks:i}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!a||!o)return!0;let l=a.filter(e=>i.includes(e.type.name));n.ensureMarks(l)}return!0},sq=(e,t)=>{let n=si(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,n.pos))||(e.join(n.pos),!0)},sK=(e,t)=>{let n=si(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,r))||(e.join(r),!0)},sJ=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:h}=i.extensionManager,p=ou(e,s.schema),f=ou(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;let x=si(e=>sR(e.type.name,u))(m),k=0===m.from&&m.to===s.doc.content.size,S=s.doc.content.content,C=1===S.length?S[0]:null,E=k&&C&&sR(C.type.name,u)?{node:C,pos:0,depth:0}:null,M=null!=x?x:E,N=!!x&&v.depth>=1&&v.depth-x.depth<=1,A=!!E;if((N||A)&&M){if(M.node.type===p)return k&&A?l().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return eF.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(sR(M.node.type.name,u)&&p.validContent(M.node.content))return l().command(()=>(o.setNodeMarkup(M.pos,p),!0)).command(()=>sq(o,p)).command(()=>sK(o,p)).run()}return n&&w&&a?l().command(()=>{let e=d().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>sq(o,p)).command(()=>sK(o,p)).run():l().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>sq(o,p)).command(()=>sK(o,p)).run()},sG=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=oS(e,r.schema);return sA(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},sX=(e,t,n={})=>({state:r,commands:i})=>{let o,s=ou(e,r.schema),a=ou(t,r.schema),l=oJ(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),l)?i.setNode(a,o):i.setNode(s,{...o,...n})},sZ=(e,t={})=>({state:n,commands:r})=>{let i=ou(e,n.schema);return oJ(n,i,t)?r.lift(i):r.wrapIn(i,t)},sY=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},sQ=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},s0=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=oS(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:e,to:t}=a,r=null==(o=c.marks().find(e=>e.type===l))?void 0:o.attrs,i=ok(c,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},s1=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},s2=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,c,d,u,h=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(h,p,(e,t)=>{o&&o===e.type&&(l=!0,d=Math.max(t,h),u=Math.min(t+e.nodeSize,p),a=t,c=e)}):r.doc.nodesBetween(h,p,(e,r)=>{r<h&&o&&o===e.type&&(l=!0,d=Math.max(r,h),u=Math.min(r+e.nodeSize,p),a=r,c=e),r>=h&&r<=p&&(o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(l=!0,i)){let i=Math.max(r,h),a=Math.min(r+e.nodeSize,p);n.addMark(i,a,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,u,s.create({...e.attrs,...t}))}))}),l},s5=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&eg(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s3=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,s=t,a=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=a.resolve(t.start-2);s=new x(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new x(t.$from,a.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=eg(s,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let s=i.empty;for(let e=n.length-1;e>=0;e--)s=i.from(n[e].type.create(n[e].attrs,s));e.step(new eh(t.start-2*!!r,t.end,t.start,t.end,new d(s,0,0),n.length,!0));let a=0;for(let e=0;e<n.length;e++)n[e].type==o&&(a=e+1);let l=n.length-a,c=t.start+n.length-2*!!r,u=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ew(e.doc,c,l)&&(e.split(c,l),c+=2*l),c+=u.child(n).nodeSize}(e,t,l,o,n),!0)}(l,a,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s4=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},s6=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function s9(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(ob(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let s=l.state.tr,c=oe({state:l.state,transaction:s}),h={from:r-(t[0].length-o.length),to:i},{commands:p,chain:f,can:m}=new ot({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),d=!0)}),d}function s7(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var s8=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...sc(so(this,"addOptions",{name:this.name}))}}get storage(){return{...sc(so(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return s7(t)&&s7(n)&&Object.keys(n).forEach(i=>{s7(n[i])&&s7(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},ae=class e extends s8{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},at=class{constructor(e){this.find=e.find,this.handler=e.handler}},an=null,ar=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=sv(e),this.schema=function(e,t){var n;let r=su(e),{nodeExtensions:i,markExtensions:o}=sd(e),s=null==(n=i.find(e=>so(e,"topNode")))?void 0:n.name;return new z({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:sc(so(n,"content",o)),marks:sc(so(n,"marks",o)),group:sc(so(n,"group",o)),inline:sc(so(n,"inline",o)),atom:sc(so(n,"atom",o)),selectable:sc(so(n,"selectable",o)),draggable:sc(so(n,"draggable",o)),code:sc(so(n,"code",o)),whitespace:sc(so(n,"whitespace",o)),linebreakReplacement:sc(so(n,"linebreakReplacement",o)),defining:sc(so(n,"defining",o)),isolating:sc(so(n,"isolating",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:sf(e,i)}));let c=so(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:sc(so(n,"inclusive",o)),excludes:sc(so(n,"excludes",o)),group:sc(so(n,"group",o)),spanning:sc(so(n,"spanning",o)),code:sc(so(n,"code",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:sf(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:sM(t.name,this.schema)},r=so(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return sb([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sM(t.name,this.schema)},r=[],o=so(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&so(t,"exitable",n)&&(s.ArrowRight=()=>ae.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let a=r_(s);r.push(a);let l=so(t,"addInputRules",n);if(sT(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new e2({state:{init:()=>null,apply(e,o,s){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=sa(i.from(e),s.schema));let{from:o}=l,a=o+e.length;s9({editor:t,from:o,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,i,o,s)=>s9({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&s9({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&s9({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}let c=so(t,"addPasteRules",n);if(sT(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,o=null,s=!1,a=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new ot({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(i,t+y);b>=v||((e,t,n)=>{if(ob(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=b+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(h)})}),u.every(e=>null!==e)}({editor:n,state:oe({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new e2({view(e){let t=t=>{var r;(o=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(an=n)},r=()=>{an&&(an=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(a=o===e.dom.parentElement,t=n,!a){let e=an;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],d="paste"===o.getMeta("uiEvent")&&!s,u="drop"===o.getMeta("uiEvent")&&!a,h=o.getMeta("applyPasteRules"),p=!!h;if(!d&&!u&&!p)return;if(p){var f,m;let t,{text:n}=h;"string"==typeof n||(n=sa(i.from(n),r.schema));let{from:o}=h,s=o+n.length;return c({rule:e,state:r,from:o,to:{b:s},pasteEvt:(f=n,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let d=so(t,"addProseMirrorPlugins",n);if(d){let e=d();r.push(...e)}return r})}get attributes(){return su(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ou(t.name,this.schema)},i=so(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,a,l)=>{let c=sf(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return sb([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return sb([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:oS(t.name,this.schema)},i=so(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let a=sf(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{aT(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sM(e.name,this.schema)};"mark"===e.type&&(null==(t=sc(so(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=so(e,"onBeforeCreate",n),i=so(e,"onCreate",n),o=so(e,"onUpdate",n),s=so(e,"onSelectionUpdate",n),a=so(e,"onTransaction",n),l=so(e,"onFocus",n),c=so(e,"onBlur",n),d=so(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};ar.resolve=sv,ar.sort=sb,ar.flatten=ss,i8({},{ClipboardTextSerializer:()=>ao,Commands:()=>as,Delete:()=>aa,Drop:()=>al,Editable:()=>ac,FocusEvents:()=>au,Keymap:()=>ah,Paste:()=>ap,Tabindex:()=>af,TextDirection:()=>am,focusEventsPluginKey:()=>ad});var ai=class e extends s8{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},ao=ai.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=sk(n);return sw(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),as=ai.create({name:"commands",addCommands:()=>({...on})}),aa=ai.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let s=sn(e.before,[e,...t]);sC(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let a=s.mapping;s.steps.forEach((t,n)=>{var r,i;if(t instanceof el){let o=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(o,-1),d=a.invert().map(l),u=o>0&&(null==(r=s.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),h=null==(i=s.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:o,to:l},partial:!!(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),al=ai.create({name:"drop",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ac=ai.create({name:"editable",addProseMirrorPlugins(){return[new e2({key:new e4("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ad=new e4("focusEvents"),au=ai.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new e2({key:ad,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),ah=ai.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:a}=o,l=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=l.parent.type.spec.isolating,d=o.pos-o.parentOffset,u=c&&1===l.parent.childCount?d===o.pos:ez.atStart(r).from===s;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return oR()||oq()?i:r},addProseMirrorPlugins(){return[new e2({key:new e4("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=t.selection,l=ez.atStart(t.doc).from,c=ez.atEnd(t.doc).to;if(o||s!==l||a!==c||!sO(n.doc))return;let d=n.tr,u=oe({state:n,transaction:d}),{commands:h}=new ot({editor:this.editor,state:u});if(h.clearNodes(),d.steps.length)return d}})]}}),ap=ai.create({name:"paste",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),af=ai.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),am=ai.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=sd(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new e2({key:new e4("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),ag=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+ +!o;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;let c=new e(l,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},ay=`.ProseMirror {
2
2
  position: relative;
3
3
  }
4
4