wiki-viewer 1.9.0 → 1.10.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 (236) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +3 -0
  3. package/.next/standalone/.next/build-manifest.json +5 -5
  4. package/.next/standalone/.next/routes-manifest.json +22 -0
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  16. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  21. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  22. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  27. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +3 -4
  33. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +10 -11
  35. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +4 -5
  37. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +3 -4
  40. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +3 -4
  44. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +3 -4
  47. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +1 -1
  49. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js +1 -1
  52. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/share/[token]/route/app-paths-manifest.json +3 -0
  54. package/.next/standalone/.next/server/app/api/share/[token]/route/build-manifest.json +9 -0
  55. package/.next/standalone/.next/server/app/api/share/[token]/route/server-reference-manifest.json +4 -0
  56. package/.next/standalone/.next/server/app/api/share/[token]/route.js +14 -0
  57. package/.next/standalone/.next/server/app/api/share/[token]/route.js.map +5 -0
  58. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -0
  59. package/.next/standalone/.next/server/app/api/share/[token]/route_client-reference-manifest.js +3 -0
  60. package/.next/standalone/.next/server/app/api/share/route/app-paths-manifest.json +3 -0
  61. package/.next/standalone/.next/server/app/api/share/route/build-manifest.json +9 -0
  62. package/.next/standalone/.next/server/app/api/share/route/server-reference-manifest.json +4 -0
  63. package/.next/standalone/.next/server/app/api/share/route.js +14 -0
  64. package/.next/standalone/.next/server/app/api/share/route.js.map +5 -0
  65. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -0
  66. package/.next/standalone/.next/server/app/api/share/route_client-reference-manifest.js +3 -0
  67. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/system/set-root/route.js +2 -2
  72. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/api/wiki/watch/route.js +1 -1
  91. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/index.html +1 -1
  93. package/.next/standalone/.next/server/app/index.rsc +3 -3
  94. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  95. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  96. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  97. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  98. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  99. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  100. package/.next/standalone/.next/server/app/page.js +1 -1
  101. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/s/[token]/page/app-paths-manifest.json +3 -0
  104. package/.next/standalone/.next/server/app/s/[token]/page/build-manifest.json +16 -0
  105. package/.next/standalone/.next/server/app/s/[token]/page/next-font-manifest.json +10 -0
  106. package/.next/standalone/.next/server/app/s/[token]/page/react-loadable-manifest.json +1 -0
  107. package/.next/standalone/.next/server/app/s/[token]/page/server-reference-manifest.json +4 -0
  108. package/.next/standalone/.next/server/app/s/[token]/page.js +14 -0
  109. package/.next/standalone/.next/server/app/s/[token]/page.js.map +5 -0
  110. package/.next/standalone/.next/server/app/s/[token]/page.js.nft.json +1 -0
  111. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +3 -0
  112. package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
  113. package/.next/standalone/.next/server/app/signin/page.js +2 -2
  114. package/.next/standalone/.next/server/app/signin/page.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app-paths-manifest.json +3 -0
  117. package/.next/standalone/.next/server/chunks/0dti_kysely_dist_esm_0u.fq2l._.js +1 -1
  118. package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0d2jbo5.js +1 -1
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01hp8ax._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02scxiu._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07nnfjx._.js +16 -0
  122. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12q8ch8._.js → [root-of-the-server]__08n~vj1._.js} +2 -2
  123. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09s9qkd._.js +1 -1
  124. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12ee_s6._.js → [root-of-the-server]__0bfl4v7._.js} +2 -2
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n3i3vu._.js +16 -0
  126. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ncjv3e._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s8ovh5._.js +3 -0
  128. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~.-3yk._.js → [root-of-the-server]__0x3m4up._.js} +2 -2
  129. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yzle76._.js +20 -0
  130. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z.pwwj._.js +20 -0
  131. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zgb.q2._.js +3 -0
  132. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__00qu86p._.js → [root-of-the-server]__0zq0rlw._.js} +2 -2
  133. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-inabx._.js → [root-of-the-server]__12y5z5j._.js} +2 -2
  134. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_share_[token]_route_actions_0~m-o26.js +3 -0
  135. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_share_route_actions_0gz4h.j.js +3 -0
  136. package/.next/standalone/.next/server/chunks/node_modules__pnpm_0aj5g-w._.js +1 -1
  137. package/.next/standalone/.next/server/chunks/src_lib_auth_admin_ts_0g4i6v_._.js +3 -0
  138. package/.next/standalone/.next/server/chunks/ssr/08s9_dagre-d3-es_src_dagre_index_0iwjukf.js +1 -1
  139. package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0p1dt3f.js +4 -0
  140. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_0hyln.b._.js → 0~w0_katex_dist_katex_mjs_03gdxkb._.js} +1 -1
  141. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_diagram-OG6HWLK6_mjs_0t5sus6._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_erDiagram-TEJ5UH35_mjs_0v6rnqy._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_sankeyDiagram-5OEKKPKP_mjs_11ifrnu._.js +1 -1
  144. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_mermaid_core_mjs_0hj_n-~._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00lk0r~._.js → [root-of-the-server]__06mzg2t._.js} +2 -2
  146. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oh...2._.js +3 -0
  147. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0osa2xb._.js +3 -0
  148. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02twzph._.js → [root-of-the-server]__0xwdc44._.js} +2 -2
  149. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0du58sw._.js → [root-of-the-server]__0~2q.a0._.js} +2 -2
  150. package/.next/standalone/.next/server/chunks/ssr/_0r9zg10._.js +115 -0
  151. package/.next/standalone/.next/server/chunks/ssr/_0wmhtx3._.js +3 -0
  152. package/.next/standalone/.next/server/chunks/ssr/_0~a9dyk._.js +115 -0
  153. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_s_[token]_page_actions_0bubzp7.js +3 -0
  154. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s4yn43._.js → node_modules__pnpm_0-w6~h.._.js} +1 -1
  155. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0fh.6ir._.js → node_modules__pnpm_0.eeqiu._.js} +2 -2
  156. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0d~ida~._.js → node_modules__pnpm_016w5te._.js} +1 -1
  157. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0iikbcy._.js → node_modules__pnpm_04o4n28._.js} +1 -1
  158. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0elpfsb._.js → node_modules__pnpm_05bngu6._.js} +2 -2
  159. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xa.ko1._.js → node_modules__pnpm_05cs0sp._.js} +1 -1
  160. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_05~w-ok._.js → node_modules__pnpm_05w~588._.js} +1 -1
  161. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_00y7foi._.js → node_modules__pnpm_05~bobn._.js} +2 -2
  162. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0arbjru._.js → node_modules__pnpm_07jyfax._.js} +1 -1
  163. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s8fvbn._.js → node_modules__pnpm_07s54yb._.js} +1 -1
  164. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c7u76a._.js → node_modules__pnpm_09ygxyg._.js} +2 -2
  165. package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0aq-myi._.js +1 -1
  166. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_12.ymhl._.js → node_modules__pnpm_0dx-.0x._.js} +1 -1
  167. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0beormu._.js → node_modules__pnpm_0e.k7ds._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_03.1jli._.js → node_modules__pnpm_0fvoxey._.js} +1 -1
  169. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.kyqfq._.js → node_modules__pnpm_0klv8-e._.js} +1 -1
  170. package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0lzb-n~._.js +1 -1
  171. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.~goq~._.js → node_modules__pnpm_0m4c6iy._.js} +2 -2
  172. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0dbr7c2._.js → node_modules__pnpm_0ms-2au._.js} +1 -1
  173. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0vyv.lz._.js → node_modules__pnpm_0nni9e7._.js} +1 -1
  174. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09d5yyu._.js → node_modules__pnpm_0oihvhk._.js} +1 -1
  175. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b5fla7._.js → node_modules__pnpm_0q0mf37._.js} +2 -2
  176. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_03z3na-._.js → node_modules__pnpm_0q2jvgv._.js} +1 -1
  177. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0mvih7b._.js → node_modules__pnpm_0qy4lz-._.js} +2 -2
  178. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09eo8jh._.js → node_modules__pnpm_0uea699._.js} +2 -2
  179. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0qd2ovj._.js → node_modules__pnpm_0xxpa5a._.js} +2 -2
  180. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0adm8h6._.js → node_modules__pnpm_0z4ojf1._.js} +1 -1
  181. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0tq8zs6._.js → node_modules__pnpm_11u67yf._.js} +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0fm6wcx._.js → node_modules__pnpm_13fk5i4._.js} +1 -1
  183. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +19 -0
  184. package/.next/standalone/.next/server/edge/chunks/0p91_next_dist_0nh.6nc._.js +1 -1
  185. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  186. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  187. package/.next/standalone/.next/server/next-font-manifest.js +1 -1
  188. package/.next/standalone/.next/server/next-font-manifest.json +3 -0
  189. package/.next/standalone/.next/server/pages/404.html +1 -1
  190. package/.next/standalone/.next/server/pages/500.html +1 -1
  191. package/.next/standalone/.next/static/chunks/03zepg.10g9nk.js +21 -0
  192. package/.next/standalone/.next/static/chunks/07pa3l2g0aoxc.css +2 -0
  193. package/.next/standalone/.next/static/chunks/07rj172u~.3lw.js +113 -0
  194. package/.next/standalone/.next/static/chunks/0cre2g95gqnc_.js +1 -0
  195. package/.next/standalone/.next/static/chunks/{144e01xuvhx~x.js → 0g5dv59skfo1z.js} +1 -1
  196. package/.next/standalone/.next/static/chunks/0l794ei7~55us.js +17 -0
  197. package/.next/standalone/.next/static/chunks/{14n5cp8rr-k_b.js → 0qiz7kkyaxa93.js} +1 -1
  198. package/.next/standalone/.next/static/chunks/0r9y0mkr29ns6.js +113 -0
  199. package/.next/standalone/.next/static/chunks/0vhw1us0pjfdy.js +1 -0
  200. package/.next/standalone/.next/static/chunks/{06iw_iy5e90d4.js → 0vp-ahhagxptc.js} +1 -1
  201. package/.next/standalone/.next/static/chunks/0xpx9ekm-~h19.js +1 -0
  202. package/.next/standalone/.next/static/chunks/{0b84.439zffwm.js → 0yhis._5rr6tc.js} +1 -1
  203. package/.next/standalone/.next/static/chunks/139g2hzko-flp.js +1 -0
  204. package/.next/standalone/.next/static/chunks/{turbopack-0lf4~b-ofzbm6.js → turbopack-12~z-mr7b9b50.js} +1 -1
  205. package/.next/standalone/README.md +1 -0
  206. package/.next/standalone/bin/wiki-viewer.js +7 -0
  207. package/.next/standalone/package.json +1 -1
  208. package/.next/standalone/src/app/api/share/[token]/route.ts +269 -0
  209. package/.next/standalone/src/app/api/share/route.ts +127 -0
  210. package/.next/standalone/src/app/globals.css +2 -0
  211. package/.next/standalone/src/app/page.tsx +21 -0
  212. package/.next/standalone/src/app/s/[token]/page.tsx +357 -0
  213. package/.next/standalone/src/components/share-dialog.tsx +307 -0
  214. package/.next/standalone/src/components/ui/switch.tsx +1 -1
  215. package/.next/standalone/src/lib/shared-docs/db.ts +177 -0
  216. package/.next/standalone/src/middleware.ts +1 -0
  217. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  218. package/README.md +1 -0
  219. package/bin/wiki-viewer.js +7 -0
  220. package/package.json +1 -1
  221. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-244bv._.js +0 -16
  222. package/.next/standalone/.next/server/chunks/[root-of-the-server]__012753j._.js +0 -3
  223. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03p0ob1._.js +0 -16
  224. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gda_iu._.js +0 -3
  225. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk1uf4._.js +0 -3
  226. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nd.b_c._.js +0 -3
  227. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13aid91._.js +0 -3
  228. package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +0 -131
  229. package/.next/standalone/.next/static/chunks/09-jtayuhrq~b.js +0 -1
  230. package/.next/standalone/.next/static/chunks/0vp2gi~fq70je.js +0 -21
  231. package/.next/standalone/.next/static/chunks/125_k3o0s4cid.js +0 -129
  232. package/.next/standalone/.next/static/chunks/135c~rq_ux73w.js +0 -1
  233. package/.next/standalone/.next/static/chunks/167ph4xws_-61.css +0 -2
  234. /package/.next/standalone/.next/static/{YQHDns_jLqFd_bbnLafs0 → 30WI22NYlyxn2Cei0x9Om}/_buildManifest.js +0 -0
  235. /package/.next/standalone/.next/static/{YQHDns_jLqFd_bbnLafs0 → 30WI22NYlyxn2Cei0x9Om}/_clientMiddlewareManifest.js +0 -0
  236. /package/.next/standalone/.next/static/{YQHDns_jLqFd_bbnLafs0 → 30WI22NYlyxn2Cei0x9Om}/_ssgManifest.js +0 -0
@@ -1,129 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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},s=r.useState,o=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=s({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]),o(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),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=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 p={hasValue:!1,value:null};u.current=p}else p=u.current;var h=o(e,(u=c(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&p.hasValue){var t=p.value;if(i(t,e))return a=t}return a=e}if(t=a,s(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,a=n)}var o,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(){p.hasValue=!0,p.value=h},[h]),d(h),h}},383835,(e,t,n)=>{"use strict";t.exports=e.r(757890)},975609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,s,o,u=arguments[0],p=1,h=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},p=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});p<h;++p)if(t=arguments[p],null!=t)for(n in t)r=d(u,n),u!==(i=d(t,n))&&(f&&i&&(l(i)||(s=a(i)))?(s?(s=!1,o=r&&a(r)?r:[]):o=r&&l(r)?r:{},c(u,{name:n,newValue:e(f,o,i)})):void 0!==i&&c(u,{name:n,newValue:i}));return u}},112479,(e,t,n)=>{class r{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function s(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}class o{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!e.scope)return;let t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){e.scope&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}let a=(e={})=>{let t={children:[]};return Object.assign(t,e),t};class l{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=a({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"==typeof e||e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{l._collapse(e)}))}}class c extends l{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new o(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(e){return e?"string"==typeof e?e:e.source:null}function u(e){return f("(?=",e,")")}function p(e){return f("(?:",e,")*")}function h(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function g(e){return RegExp(e.toString()+"|").exec("").length-1}let b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function y(e,{joinWith:t}){let n=0;return e.map(e=>{let t=n+=1,r=d(e),i="";for(;r.length>0;){let e=b.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}let x="[a-zA-Z]\\w*",v="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",E="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",k="\\b(0b[01]+)",T={begin:"\\\\[\\s\\S]",relevance:0},N=function(e,t,n={}){let r=s({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:f(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},A=N("//","$"),S=N("/\\*","\\*/"),C=N("#","$");var _=Object.freeze({__proto__:null,APOS_STRING_MODE:{scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[T]},BACKSLASH_ESCAPE:T,BINARY_NUMBER_MODE:{scope:"number",begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:N,C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:A,C_NUMBER_MODE:{scope:"number",begin:E,relevance:0},C_NUMBER_RE:E,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:C,IDENT_RE:x,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+v,relevance:0},NUMBER_MODE:{scope:"number",begin:w,relevance:0},NUMBER_RE:w,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:{scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[T]},REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[T,{begin:/\[/,end:/\]/,relevance:0,contains:[T]}]},RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),s({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:{scope:"title",begin:x,relevance:0},UNDERSCORE_IDENT_RE:v,UNDERSCORE_TITLE_MODE:{scope:"title",begin:v,relevance:0}});function M(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function O(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function I(e,t){!t||e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=M,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function D(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function R(e,t){if(e.match){if(e.begin||e.end)throw Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function L(e,t){void 0===e.relevance&&(e.relevance=1)}let j=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,u(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},P=["of","and","for","in","not","or","if","then","parent","list","value"],B={},F=e=>{console.error(e)},H=(e,...t)=>{console.log(`WARN: ${e}`,...t)},U=(e,t)=>{B[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),B[`${e}/${t}`]=!0)},z=Error();function $(e,t,{key:n}){let r=0,i=e[n],s={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],s[e+r]=!0,r+=g(t[e-1]);e[n]=o,e[n]._emit=s,e[n]._multi=!0}function G(e){if(e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw F("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),z;if("object"!=typeof e.beginScope||null===e.beginScope)throw F("beginScope must be object"),z;$(e,e.begin,{key:"beginScope"}),e.begin=y(e.begin,{joinWith:""})}if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw F("skip, excludeEnd, returnEnd not compatible with endScope: {}"),z;if("object"!=typeof e.endScope||null===e.endScope)throw F("endScope must be object"),z;$(e,e.end,{key:"endScope"}),e.end=y(e.end,{joinWith:""})}}class q extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}let V=Symbol("nomatch"),W=function(e){let t=Object.create(null),n=Object.create(null),o=[],a=!0,l="Could not find the language '{}', did you forget to load/include a language module?",b={disableAutodetect:!0,name:"Plain text",contains:[]},x={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function v(e){return x.noHighlightRe.test(e)}function w(e,t,n){let r="",i="";"object"==typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(U("10.7.0","highlight(lang, code, ...args) has been deprecated."),U("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);let s={code:r,language:i};B("before:highlight",s);let o=s.result?s.result:E(s.language,s.code,n);return o.code=s.code,B("after:highlight",o),o}function E(e,n,o,c){let u=Object.create(null);function p(){if(!C.keywords)return void M.addText(H);let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(H),n="";for(;t;){n+=H.substring(e,t.index);let r=T.case_insensitive?t[0].toLowerCase():t[0],i=C.keywords[r];if(i){let[e,s]=i;if(M.addText(n),n="",u[r]=(u[r]||0)+1,u[r]<=7&&(U+=s),e.startsWith("_"))n+=t[0];else{let n=T.classNameAliases[e]||e;f(t[0],n)}}else n+=t[0];e=C.keywordPatternRe.lastIndex,t=C.keywordPatternRe.exec(H)}n+=H.substring(e),M.addText(n)}function h(){null!=C.subLanguage?function(){if(""===H)return;let e=null;if("string"==typeof C.subLanguage){if(!t[C.subLanguage])return M.addText(H);e=E(C.subLanguage,H,!0,_[C.subLanguage]),_[C.subLanguage]=e._top}else e=k(H,C.subLanguage.length?C.subLanguage:null);C.relevance>0&&(U+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():p(),H=""}function f(e,t){""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function m(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=T.classNameAliases[e[n]]||e[n],i=t[n];r?f(i,r):(H=i,p(),H=""),n++}}function b(e,t){return e.scope&&"string"==typeof e.scope&&M.openNode(T.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(f(H,T.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),H=""):e.beginScope._multi&&(m(e.beginScope,t),H="")),C=Object.create(e,{parent:{value:C}})}let v={};function w(t,i){let s=i&&i[0];if(H+=t,null==s)return h(),0;if("begin"===v.type&&"end"===i.type&&v.index===i.index&&""===s){if(H+=n.slice(i.index,i.index+1),!a){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=v.rule,t}return 1}if(v=i,"begin"===i.type){let e=i[0],t=i.rule,n=new r(t);for(let r of[t.__beforeBegin,t["on:begin"]])if(r&&(r(i,n),n.isMatchIgnored))return 0===C.matcher.regexIndex?(H+=e[0],1):(q=!0,0);return t.skip?H+=e:(t.excludeBegin&&(H+=e),h(),t.returnBegin||t.excludeBegin||(H=e)),b(t,i),t.returnBegin?0:e.length}if("illegal"!==i.type||o){if("end"===i.type){let e=function(e){let t=e[0],i=n.substring(e.index),s=function e(t,n,i){var s;let o,a=(s=t.endRe,(o=s&&s.exec(i))&&0===o.index);if(a){if(t["on:end"]){let e=new r(t);t["on:end"](n,e),e.isMatchIgnored&&(a=!1)}if(a){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,n,i)}(C,e,i);if(!s)return V;let o=C;C.endScope&&C.endScope._wrap?(h(),f(t,C.endScope._wrap)):C.endScope&&C.endScope._multi?(h(),m(C.endScope,e)):o.skip?H+=t:(o.returnEnd||o.excludeEnd||(H+=t),h(),o.excludeEnd&&(H=t));do C.scope&&M.closeNode(),C.skip||C.subLanguage||(U+=C.relevance),C=C.parent;while(C!==s.parent)return s.starts&&b(s.starts,e),o.returnEnd?0:t.length}(i);if(e!==V)return e}}else{let e=Error('Illegal lexeme "'+s+'" for mode "'+(C.scope||"<unnamed>")+'"');throw e.mode=C,e}if("illegal"===i.type&&""===s)return H+="\n",1;if($>1e5&&$>3*i.index)throw Error("potential infinite loop, way more iterations than matches");return H+=s,s.length}let T=S(e);if(!T)throw F(l.replace("{}",e)),Error('Unknown language: "'+e+'"');let N=function(e){function t(t,n){return RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=g(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(y(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=s(e.classNameAliases||{}),function n(i,o){let a;if(i.isCompiled)return i;[O,R,G,j].forEach(e=>e(i,o)),e.compilerExtensions.forEach(e=>e(i,o)),i.__beforeBegin=null,[I,D,L].forEach(e=>e(i,o)),i.isCompiled=!0;let l=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),l=i.keywords.$pattern,delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=function e(t,n,r="keyword"){let i=Object.create(null);return"string"==typeof t?s(r,t.split(" ")):Array.isArray(t)?s(r,t):Object.keys(t).forEach(function(r){Object.assign(i,e(t[r],n,r))}),i;function s(e,t){n&&(t=t.map(e=>e.toLowerCase())),t.forEach(function(t){var n,r,s;let o=t.split("|");i[o[0]]=[e,(n=o[0],(r=o[1])?Number(r):+(s=n,!P.includes(s.toLowerCase())))]})}}(i.keywords,e.case_insensitive)),i.keywordPatternRe=t(l,!0),o&&(i.begin||(i.begin=/\B|\b/),i.beginRe=t(i.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(i.endRe=t(i.end)),i.terminatorEnd=d(i.end)||"",i.endsWithParent&&o.terminatorEnd&&(i.terminatorEnd+=(i.end?"|":"")+o.terminatorEnd)),i.illegal&&(i.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map(function(e){var t;return((t="self"===e?i:e).variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return s(t,{variants:null},e)})),t.cachedVariants)?t.cachedVariants:!function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(t)?Object.isFrozen(t)?s(t):t:s(t,{starts:t.starts?s(t.starts):null})})),i.contains.forEach(function(e){n(e,i)}),i.starts&&n(i.starts,o),a=new r,i.contains.forEach(e=>a.addRule(e.begin,{rule:e,type:"begin"})),i.terminatorEnd&&a.addRule(i.terminatorEnd,{type:"end"}),i.illegal&&a.addRule(i.illegal,{type:"illegal"}),i.matcher=a,i}(e)}(T),A="",C=c||N,_={},M=new x.__emitter(x),B=[];for(let e=C;e!==T;e=e.parent)e.scope&&B.unshift(e.scope);B.forEach(e=>M.openNode(e));let H="",U=0,z=0,$=0,q=!1;try{if(T.__emitTokens)T.__emitTokens(n,M);else{for(C.matcher.considerAll();;){$++,q?q=!1:C.matcher.considerAll(),C.matcher.lastIndex=z;let e=C.matcher.exec(n);if(!e)break;let t=n.substring(z,e.index),r=w(t,e);z=e.index+r}w(n.substring(z))}return M.finalize(),A=M.toHTML(),{language:e,value:A,relevance:U,illegal:!1,_emitter:M,_top:C}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:i(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:z,context:n.slice(z-100,z+100),mode:t.mode,resultSoFar:A},_emitter:M};if(a)return{language:e,value:i(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:C};throw t}}function k(e,n){let r;n=n||x.languages||Object.keys(t);let s=((r={value:i(e),illegal:!1,relevance:0,_top:b,_emitter:new x.__emitter(x)})._emitter.addText(e),r),o=n.filter(S).filter(M).map(t=>E(t,e,!1));o.unshift(s);let[a,l]=o.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(S(e.language).supersetOf===t.language)return 1;else if(S(t.language).supersetOf===e.language)return -1}return 0});return a.secondBest=l,a}function T(e){var t;let r,i=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";let n=x.languageDetectRe.exec(t);if(n){let t=S(n[1]);return t||(H(l.replace("{}",n[1])),H("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>v(e)||S(e))}(e);if(v(i))return;if(B("before:highlightElement",{el:e,language:i}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(x.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),x.throwUnescapedHTML))throw new q("One of your code blocks includes unescaped HTML.",e.innerHTML);let s=e.textContent,o=i?w(s,{language:i,ignoreIllegals:!0}):k(s);e.innerHTML=o.value,e.dataset.highlighted="yes",t=o.language,r=i&&n[i]||t,e.classList.add("hljs"),e.classList.add(`language-${r}`),e.result={language:o.language,re:o.relevance,relevance:o.relevance},o.secondBest&&(e.secondBest={language:o.secondBest.language,relevance:o.secondBest.relevance}),B("after:highlightElement",{el:e,result:o,text:s})}let N=!1;function A(){if("loading"===document.readyState){N||window.addEventListener("DOMContentLoaded",function(){A()},!1),N=!0;return}document.querySelectorAll(x.cssSelector).forEach(T)}function S(e){return t[e=(e||"").toLowerCase()]||t[n[e]]}function C(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function M(e){let t=S(e);return t&&!t.disableAutodetect}function B(e,t){o.forEach(function(n){n[e]&&n[e](t)})}for(let r in Object.assign(e,{highlight:w,highlightAuto:k,highlightAll:A,highlightElement:T,highlightBlock:function(e){return U("10.7.0","highlightBlock will be removed entirely in v12.0"),U("10.7.0","Please use highlightElement now."),T(e)},configure:function(e){x=s(x,e)},initHighlighting:()=>{A(),U("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){A(),U("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,r){let i=null;try{i=r(e)}catch(e){if(F("Language definition for '{}' could not be registered.".replace("{}",n)),a)F(e);else throw e;i=b}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&C(i.aliases,{languageName:n})},unregisterLanguage:function(e){for(let r of(delete t[e],Object.keys(n)))n[r]===e&&delete n[r]},listLanguages:function(){return Object.keys(t)},getLanguage:S,registerAliases:C,autoDetection:M,inherit:s,addPlugin:function(e){var t;(t=e)["before:highlightBlock"]&&!t["before:highlightElement"]&&(t["before:highlightElement"]=e=>{t["before:highlightBlock"](Object.assign({block:e.el},e))}),t["after:highlightBlock"]&&!t["after:highlightElement"]&&(t["after:highlightElement"]=e=>{t["after:highlightBlock"](Object.assign({block:e.el},e))}),o.push(e)},removePlugin:function(e){let t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:u,either:m,optional:h,anyNumberOfTimes:p},_)"object"==typeof _[r]&&function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(n=>{let r=t[n],i=typeof r;"object"!==i&&"function"!==i||Object.isFrozen(r)||e(r)}),t}(_[r]);return Object.assign(e,_),e},K=W({});K.newInstance=()=>W({}),t.exports=K,K.HighlightJS=K,K.default=K},952683,e=>{"use strict";let t,n,r,i,s,o,a;var l,c,d,u,p,h,f,m,g,b,y,x,v,w,E,k,T,N,A,S,C,_,M,O,I,D,R,L,j,P,B,F,H,U,z,$,G,q,V,W,K,Y,X=e.i(44501),Q=e.i(101685);let J=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},Z=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim();var ee={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let et=(0,Q.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>(0,Q.createElement)("svg",{ref:l,...ee,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:Z("lucide",i),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(a)&&{"aria-hidden":"true"},...a},[...o.map(([e,t])=>(0,Q.createElement)(e,t)),...Array.isArray(s)?s:[s]])),en=(e,t)=>{let n=(0,Q.forwardRef)(({className:n,...r},i)=>(0,Q.createElement)(et,{ref:i,iconNode:t,className:Z(`lucide-${J(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r}));return n.displayName=J(e),n},er=en("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"}]]),ei=en("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),es=en("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),eo=en("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ea=en("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),el=en("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"}]]),ec=en("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"}]]),ed=en("file",[["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"}]]),eu=en("file-plus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),ep=en("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"}]]),eh=en("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),ef=en("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),em=en("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),eg=en("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),eb=en("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),ey=en("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"}]]),ex=en("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ev=en("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),ew=en("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),eE=en("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),ek=en("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),eT=en("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),eN=en("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),eA=en("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),eS=en("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),eC=en("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),e_=en("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),eM=en("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),eO=en("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),eI=en("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),eD=en("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function eR(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function eL(...e){return t=>{let n=!1,r=e.map(e=>{let r=eR(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():eR(e[t],null)}}}}function ej(...e){return Q.useCallback(eL(...e),e)}var eP=Symbol.for("react.lazy"),eB=Q[" use ".trim().toString()];function eF(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===eP&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function eH(e){var t;let n,r=(t=e,(n=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(eF(n)&&"function"==typeof eB&&(n=eB(n._payload)),Q.isValidElement(n)){var i;let e,s,o=(i=n,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...s}:"className"===r&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==Q.Fragment&&(a.ref=t?eL(t,o):o),Q.cloneElement(n,a)}return Q.Children.count(n)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=Q.forwardRef((e,t)=>{let{children:n,...i}=e;eF(n)&&"function"==typeof eB&&(n=eB(n._payload));let s=Q.Children.toArray(n),o=s.find(e$);if(o){let e=o.props.children,n=s.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,X.jsx)(r,{...i,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,n):null})}return(0,X.jsx)(r,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var eU=eH("Slot"),ez=Symbol("radix.slottable");function e$(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ez}function eG(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(n=0;n<s;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r}let eq=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,eV=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return eG(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(e=>{let t=null==n?void 0:n[e],r=null==s?void 0:s[e];if(null===t)return null;let o=eq(t)||eq(r);return i[e][o]}),a=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return eG(e,o,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...s,...a}[t]):({...s,...a})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)},eW=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),eK=[],eY=(e,t,n)=>{if(0==e.length-t)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=eY(e,t+1,i);if(n)return n}let s=n.validators;if(null===s)return;let o=0===t?e.join("-"):e.slice(t).join("-"),a=s.length;for(let e=0;e<a;e++){let t=s[e];if(t.validator(o))return t.classGroupId}},eX=(e,t)=>{let n=eW();for(let r in e)eQ(e[r],n,r,t);return n},eQ=(e,t,n,r)=>{let i=e.length;for(let s=0;s<i;s++)eJ(e[s],t,n,r)},eJ=(e,t,n,r)=>{"string"==typeof e?eZ(e,t,n):"function"==typeof e?e0(e,t,n,r):e1(e,t,n,r)},eZ=(e,t,n)=>{(""===e?t:e2(t,e)).classGroupId=n},e0=(e,t,n,r)=>{e3(e)?eQ(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:n,validator:e}))},e1=(e,t,n,r)=>{let i=Object.entries(e),s=i.length;for(let e=0;e<s;e++){let[s,o]=i[e];eQ(o,e2(t,s),n,r)}},e2=(e,t)=>{let n=e,r=t.split("-"),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=eW(),n.nextPart.set(t,i)),n=i}return n},e3=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,e5=[],e4=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),e6=/\s+/,e9=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=e9(e[r]))&&(n&&(n+=" "),n+=t);return n},e7=[],e8=e=>{let t=t=>t[e]||e7;return t.isThemeGetter=!0,t},te=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ti=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ts=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,to=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ta=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tl=e=>tn.test(e),tc=e=>!!e&&!Number.isNaN(Number(e)),td=e=>!!e&&Number.isInteger(Number(e)),tu=e=>e.endsWith("%")&&tc(e.slice(0,-1)),tp=e=>tr.test(e),th=()=>!0,tf=e=>ti.test(e)&&!ts.test(e),tm=()=>!1,tg=e=>to.test(e),tb=e=>ta.test(e),ty=e=>!tw(e)&&!t_(e),tx=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),tv=e=>tP(e,tU,tm),tw=e=>te.test(e),tE=e=>tP(e,tz,tf),tk=e=>tP(e,t$,tc),tT=e=>tP(e,tq,th),tN=e=>tP(e,tG,tm),tA=e=>tP(e,tF,tm),tS=e=>tP(e,tH,tb),tC=e=>tP(e,tV,tg),t_=e=>tt.test(e),tM=e=>tB(e,tz),tO=e=>tB(e,tG),tI=e=>tB(e,tF),tD=e=>tB(e,tU),tR=e=>tB(e,tH),tL=e=>tB(e,tV,!0),tj=e=>tB(e,tq,!0),tP=(e,t,n)=>{let r=te.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},tB=(e,t,n=!1)=>{let r=tt.exec(e);return!!r&&(r[1]?t(r[1]):n)},tF=e=>"position"===e||"percentage"===e,tH=e=>"image"===e||"url"===e,tU=e=>"length"===e||"size"===e||"bg-size"===e,tz=e=>"length"===e,t$=e=>"number"===e,tG=e=>"family-name"===e,tq=e=>"number"===e||"weight"===e,tV=e=>"shadow"===e,tW=((e,...t)=>{let n,r,i,s,o=e=>{let t=r(e);if(t)return t;let s=((e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=t,a=[],l=e.trim().split(e6),c="";for(let e=l.length-1;e>=0;e-=1){let t,d=l[e],{isExternal:u,modifiers:p,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:m}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=r(f.substring(0,m)))&&o[t]?r(f):void 0;e&&e!==t&&(t=e,g=!1)}else t=r(f);if(!t){if(!g||!(t=r(f))){c=d+(c.length>0?" "+c:c);continue}g=!1}let b=0===p.length?"":1===p.length?p[0]:s(p).join(":"),y=h?b+"!":b,x=y+t;if(a.indexOf(x)>-1)continue;a.push(x);let v=i(t,g);for(let e=0;e<v.length;++e){let t=v[e];a.push(y+t)}c=d+(c.length>0?" "+c:c)}return c})(e,n);return i(e,s),s};return s=a=>{var l;let c;return r=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,s)=>{n[i]=s,++t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t,n=[],r=0,i=0,s=0,o=e.length;for(let a=0;a<o;a++){let o=e[a];if(0===r&&0===i){if(":"===o){n.push(e.slice(s,a)),s=a+1;continue}if("/"===o){t=a;continue}}"["===o?r++:"]"===o?r--:"("===o?i++:")"===o&&i--}let a=0===n.length?e:e.slice(s),l=a,c=!1;return a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0),e4(n,c,l,t&&t>s?t-s:void 0)};if(t){let e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):e4(e5,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r})(l),sortModifiers:(c=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r],s="["===i[0],o=c.has(i);s||o?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(i)):n.push(i)}return n.length>0&&(n.sort(),t.push(...n)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t})(l),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e;return eX(n,t)})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var n;let t,r,i;return -1===(n=e).slice(1,-1).indexOf(":")?void 0:(r=(t=n.slice(1,-1)).indexOf(":"),(i=t.slice(0,r))?"arbitrary.."+i:void 0)}let r=e.split("-"),i=+(""===r[0]&&r.length>1);return eY(r,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let n=0;n<t.length;n++)e[i.length+n]=t[n];return e}return t}return i||eK}return n[e]||eK}}})(l)}).cache.get,i=n.cache.set,s=o,o(a)},(...e)=>s(((...e)=>{let t,n,r=0,i="";for(;r<e.length;)(t=e[r++])&&(n=e9(t))&&(i&&(i+=" "),i+=n);return i})(...e))})(()=>{let e=e8("color"),t=e8("font"),n=e8("text"),r=e8("font-weight"),i=e8("tracking"),s=e8("leading"),o=e8("breakpoint"),a=e8("container"),l=e8("spacing"),c=e8("radius"),d=e8("shadow"),u=e8("inset-shadow"),p=e8("text-shadow"),h=e8("drop-shadow"),f=e8("blur"),m=e8("perspective"),g=e8("aspect"),b=e8("ease"),y=e8("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...v(),t_,tw],E=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],T=()=>[t_,tw,l],N=()=>[tl,"full","auto",...T()],A=()=>[td,"none","subgrid",t_,tw],S=()=>["auto",{span:["full",td,t_,tw]},td,t_,tw],C=()=>[td,"auto",t_,tw],_=()=>["auto","min","max","fr",t_,tw],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...T()],D=()=>[tl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],R=()=>[tl,"screen","full","dvw","lvw","svw","min","max","fit",...T()],L=()=>[tl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],j=()=>[e,t_,tw],P=()=>[...v(),tI,tA,{position:[t_,tw]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",tD,tv,{size:[t_,tw]}],H=()=>[tu,tM,tE],U=()=>["","none","full",c,t_,tw],z=()=>["",tc,tM,tE],$=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[tc,tu,tI,tA],V=()=>["","none",f,t_,tw],W=()=>["none",tc,t_,tw],K=()=>["none",tc,t_,tw],Y=()=>[tc,t_,tw],X=()=>[tl,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tp],breakpoint:[tp],color:[th],container:[tp],"drop-shadow":[tp],ease:["in","out","in-out"],font:[ty],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tp],shadow:[tp],spacing:["px",tc],text:[tp],"text-shadow":[tp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tl,tw,t_,g]}],container:["container"],"container-type":[{"@container":["","normal","size",t_,tw]}],"container-named":[tx],columns:[{columns:[tc,tw,t_,a]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[td,"auto",t_,tw]}],basis:[{basis:[tl,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tc,tl,"auto","initial","none",tw]}],grow:[{grow:["",tc,t_,tw]}],shrink:[{shrink:["",tc,t_,tw]}],order:[{order:[td,"first","last","none",t_,tw]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,tM,tE]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tj,tT]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tu,tw]}],"font-family":[{font:[tO,tN,t]}],"font-features":[{"font-features":[tw]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,t_,tw]}],"line-clamp":[{"line-clamp":[tc,"none",t_,tk]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",t_,tw]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",t_,tw]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[tc,"from-font","auto",t_,tE]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[tc,"auto",t_,tw]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[td,t_,tw]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",t_,tw]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",t_,tw]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},td,t_,tw],radial:["",t_,tw],conic:[td,t_,tw]},tR,tS]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tc,t_,tw]}],"outline-w":[{outline:["",tc,tM,tE]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","none",d,tL,tC]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",u,tL,tC]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[tc,tE]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",p,tL,tC]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[tc,t_,tw]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tc]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[t_,tw]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[tc]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",t_,tw]}],filter:[{filter:["","none",t_,tw]}],blur:[{blur:V()}],brightness:[{brightness:[tc,t_,tw]}],contrast:[{contrast:[tc,t_,tw]}],"drop-shadow":[{"drop-shadow":["","none",h,tL,tC]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",tc,t_,tw]}],"hue-rotate":[{"hue-rotate":[tc,t_,tw]}],invert:[{invert:["",tc,t_,tw]}],saturate:[{saturate:[tc,t_,tw]}],sepia:[{sepia:["",tc,t_,tw]}],"backdrop-filter":[{"backdrop-filter":["","none",t_,tw]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[tc,t_,tw]}],"backdrop-contrast":[{"backdrop-contrast":[tc,t_,tw]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tc,t_,tw]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tc,t_,tw]}],"backdrop-invert":[{"backdrop-invert":["",tc,t_,tw]}],"backdrop-opacity":[{"backdrop-opacity":[tc,t_,tw]}],"backdrop-saturate":[{"backdrop-saturate":[tc,t_,tw]}],"backdrop-sepia":[{"backdrop-sepia":["",tc,t_,tw]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",t_,tw]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tc,"initial",t_,tw]}],ease:[{ease:["linear","initial",b,t_,tw]}],delay:[{delay:[tc,t_,tw]}],animate:[{animate:["none",y,t_,tw]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,t_,tw]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:Y()}],"skew-x":[{"skew-x":Y()}],"skew-y":[{"skew-y":Y()}],transform:[{transform:[t_,tw,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],zoom:[{zoom:[td,t_,tw]}],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",t_,tw]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":j()}],"scrollbar-track-color":[{"scrollbar-track":j()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",t_,tw]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[tc,tM,tE,tk]}],stroke:[{stroke:["none",...j()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function tK(...e){return tW(eG(e))}let tY=eV("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium normal-case transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-e-1 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-e-1 hover:bg-destructive/90",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-e-1 hover:bg-secondary/80",ghost:"bg-transparent hover:bg-accent/10 text-foreground",link:"text-foreground underline underline-offset-4 hover:text-accent"},size:{default:"h-10 p-3 rounded-full",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),tX=Q.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>(0,X.jsx)(r?eU:"button",{className:tK(tY({variant:t,size:n,className:e})),ref:s,...i}));function tQ(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function tJ(e,t=[]){let n=[],r=()=>{let t=n.map(e=>Q.createContext(e));return function(n){let r=n?.[e]||t;return Q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){let i=Q.createContext(r),s=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,a=n?.[e]?.[s]||i,l=Q.useMemo(()=>o,Object.values(o));return(0,X.jsx)(a.Provider,{value:l,children:r})};return o.displayName=t+"Provider",[o,function(n,o){let a=o?.[e]?.[s]||i,l=Q.useContext(a);if(l)return l;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}(r,...t)]}tX.displayName="Button","u">typeof window&&window.document&&window.document.createElement;var tZ=globalThis?.document?Q.useLayoutEffect:()=>{},t0=Q[" useId ".trim().toString()]||(()=>void 0),t1=0;function t2(e){let[t,n]=Q.useState(t0());return tZ(()=>{e||n(e=>e??String(t1++))},[e]),e||(t?`radix-${t}`:"")}Q[" useEffectEvent ".trim().toString()],Q[" useInsertionEffect ".trim().toString()];var t3=Q[" useInsertionEffect ".trim().toString()]||tZ;function t5({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,s,o]=function({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),s=Q.useRef(t);return t3(()=>{s.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}({defaultProp:t,onChange:n}),a=void 0!==e,l=a?e:i;{let t=Q.useRef(void 0!==e);Q.useEffect(()=>{let e=t.current;if(e!==a){let t=a?"controlled":"uncontrolled";console.warn(`${r} 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.`)}t.current=a},[a,r])}return[l,Q.useCallback(t=>{if(a){let n="function"==typeof t?t(e):t;n!==e&&o.current?.(n)}else s(t)},[a,e,s,o])]}Symbol("RADIX:SYNC_STATE");var t4=e.i(380560);function t6(e){var t;let n,r=(t=e,(n=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(Q.isValidElement(n)){var i;let e,s,o=(i=n,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...s}:"className"===r&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==Q.Fragment&&(a.ref=t?eL(t,o):o),Q.cloneElement(n,a)}return Q.Children.count(n)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=Q.forwardRef((e,t)=>{let{children:n,...i}=e,s=Q.Children.toArray(n),o=s.find(t7);if(o){let e=o.props.children,n=s.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,X.jsx)(r,{...i,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,n):null})}return(0,X.jsx)(r,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var t9=Symbol("radix.slottable");function t7(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===t9}var t8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=t6(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,X.jsx)(i?n:t,{...s,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ne(e,t){e&&t4.flushSync(()=>e.dispatchEvent(t))}function nt(e){let t=Q.useRef(e);return Q.useEffect(()=>{t.current=e}),Q.useMemo(()=>(...e)=>t.current?.(...e),[])}var nn="dismissableLayer.update",nr=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ni=Q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=Q.useContext(nr),[d,u]=Q.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=Q.useState({}),f=ej(t,e=>u(e)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(g),y=d?m.indexOf(d):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,v=y>=b,w=function(e,t=globalThis?.document){let n=nt(e),r=Q.useRef(!1),i=Q.useRef(()=>{});return Q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){no("dismissableLayer.pointerDownOutside",n,s,{discrete:!0})},s={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{let t=e.target,n=[...c.branches].some(e=>e.contains(t));v&&!n&&(i?.(e),o?.(e),e.defaultPrevented||a?.())},p),E=function(e,t=globalThis?.document){let n=nt(e),r=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{e.target&&!r.current&&no("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{let t=e.target;![...c.branches].some(e=>e.contains(t))&&(s?.(e),o?.(e),e.defaultPrevented||a?.())},p);return!function(e,t=globalThis?.document){let n=nt(e);Q.useEffect(()=>{let e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===c.layers.size-1&&(r?.(e),!e.defaultPrevented&&a&&(e.preventDefault(),a()))},p),Q.useEffect(()=>{if(d)return n&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(O=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),ns(),()=>{n&&1===c.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=O)}},[d,p,n,c]),Q.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),ns())},[d,c]),Q.useEffect(()=>{let e=()=>h({});return document.addEventListener(nn,e),()=>document.removeEventListener(nn,e)},[]),(0,X.jsx)(t8.div,{...l,ref:f,style:{pointerEvents:x?v?"auto":"none":void 0,...e.style},onFocusCapture:tQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:tQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:tQ(e.onPointerDownCapture,w.onPointerDownCapture)})});function ns(){let e=new CustomEvent(nn);document.dispatchEvent(e)}function no(e,t,n,{discrete:r}){let i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ne(i,s):i.dispatchEvent(s)}ni.displayName="DismissableLayer",Q.forwardRef((e,t)=>{let n=Q.useContext(nr),r=Q.useRef(null),i=ej(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,X.jsx)(t8.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var na="focusScope.autoFocusOnMount",nl="focusScope.autoFocusOnUnmount",nc={bubbles:!1,cancelable:!0},nd=Q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=Q.useState(null),c=nt(i),d=nt(s),u=Q.useRef(null),p=ej(t,e=>l(e)),h=Q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Q.useEffect(()=>{if(r){let e=function(e){if(h.paused||!a)return;let t=e.target;a.contains(t)?u.current=t:nh(u.current,{select:!0})},t=function(e){if(h.paused||!a)return;let t=e.relatedTarget;null!==t&&(a.contains(t)||nh(u.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&&nh(a)});return a&&n.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[r,a,h.paused]),Q.useEffect(()=>{if(a){nf.add(h);let e=document.activeElement;if(!a.contains(e)){let t=new CustomEvent(na,nc);a.addEventListener(na,c),a.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nh(r,{select:t}),document.activeElement!==n)return}(nu(a).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&nh(a))}return()=>{a.removeEventListener(na,c),setTimeout(()=>{let t=new CustomEvent(nl,nc);a.addEventListener(nl,d),a.dispatchEvent(t),t.defaultPrevented||nh(e??document.body,{select:!0}),a.removeEventListener(nl,d),nf.remove(h)},0)}}},[a,c,d,h]);let f=Q.useCallback(e=>{if(!n&&!r||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var s;let t,r=e.currentTarget,[o,a]=[np(t=nu(s=r),s),np(t.reverse(),s)];o&&a?e.shiftKey||i!==a?e.shiftKey&&i===o&&(e.preventDefault(),n&&nh(a,{select:!0})):(e.preventDefault(),n&&nh(o,{select:!0})):i===r&&e.preventDefault()}},[n,r,h.paused]);return(0,X.jsx)(t8.div,{tabIndex:-1,...o,ref:p,onKeyDown:f})});function nu(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 np(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 nh(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()}}nd.displayName="FocusScope";var nf=(a=[],{add(e){let t=a[0];e!==t&&t?.pause(),(a=nm(a,e)).unshift(e)},remove(e){a=nm(a,e),a[0]?.resume()}});function nm(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}var ng=Q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,s]=Q.useState(!1);tZ(()=>s(!0),[]);let o=n||i&&globalThis?.document?.body;return o?t4.default.createPortal((0,X.jsx)(t8.div,{...r,ref:t}),o):null});ng.displayName="Portal";var nb=e=>{var t;let n,r,{present:i,children:s}=e,o=function(e){var t,n;let[r,i]=Q.useState(),s=Q.useRef(null),o=Q.useRef(e),a=Q.useRef("none"),[l,c]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},Q.useReducer((e,t)=>n[e][t]??e,t));return Q.useEffect(()=>{let e=ny(s.current);a.current="mounted"===l?e:"none"},[l]),tZ(()=>{let t=s.current,n=o.current;if(n!==e){let r=a.current,i=ny(t);e?c("MOUNT"):"none"===i||t?.display==="none"?c("UNMOUNT"):n&&r!==i?c("ANIMATION_OUT"):c("UNMOUNT"),o.current=e}},[e,c]),tZ(()=>{if(r){let e,t=r.ownerDocument.defaultView??window,n=n=>{let i=ny(s.current).includes(CSS.escape(n.animationName));if(n.target===r&&i&&(c("ANIMATION_END"),!o.current)){let n=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=n)})}},i=e=>{e.target===r&&(a.current=ny(s.current))};return r.addEventListener("animationstart",i),r.addEventListener("animationcancel",n),r.addEventListener("animationend",n),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",i),r.removeEventListener("animationcancel",n),r.removeEventListener("animationend",n)}}c("ANIMATION_END")},[r,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:Q.useCallback(e=>{s.current=e?getComputedStyle(e):null,i(e)},[])}}(i),a="function"==typeof s?s({present:o.isPresent}):Q.Children.only(s),l=ej(o.ref,(t=a,(r=(n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.ref:(r=(n=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof s||o.isPresent?Q.cloneElement(a,{ref:l}):null};function ny(e){return e?.animationName||"none"}nb.displayName="Presence";var nx=0;function nv(){Q.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nw()),document.body.insertAdjacentElement("beforeend",e[1]??nw()),nx++,()=>{1===nx&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nx--}},[])}function nw(){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}var nE=e.i(824627),nk="right-scroll-bar-position",nT="width-before-scroll-bar";function nN(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var nA="u">typeof window?Q.useLayoutEffect:Q.useEffect,nS=new WeakMap,nC=(void 0===l&&(l={}),(void 0===c&&(c=function(e){return e}),d=[],u=!1,p={read:function(){if(u)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return d.length?d[d.length-1]:null},useMedium:function(e){var t=c(e,u);return d.push(t),function(){d=d.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(u=!0;d.length;){var t=d;d=[],t.forEach(e)}d={push:function(t){return e(t)},filter:function(){return d}}},assignMedium:function(e){u=!0;var t=[];if(d.length){var n=d;d=[],n.forEach(e),t=d}var r=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(r)};i(),d={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),d}}}}).options=(0,nE.__assign)({async:!0,ssr:!1},l),p),n_=function(){},nM=Q.forwardRef(function(e,t){var n,r,i,s,o=Q.useRef(null),a=Q.useState({onScrollCapture:n_,onWheelCapture:n_,onTouchMoveCapture:n_}),l=a[0],c=a[1],d=e.forwardProps,u=e.children,p=e.className,h=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,b=e.noRelative,y=e.noIsolation,x=e.inert,v=e.allowPinchZoom,w=e.as,E=e.gapMode,k=(0,nE.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=(n=[o,t],r=function(e){return n.forEach(function(t){return nN(t,e)})},(i=(0,Q.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,s=i.facade,nA(function(){var e=nS.get(s);if(e){var t=new Set(e),r=new Set(n),i=s.current;t.forEach(function(e){r.has(e)||nN(e,null)}),r.forEach(function(e){t.has(e)||nN(e,i)})}nS.set(s,n)},[n]),s),N=(0,nE.__assign)((0,nE.__assign)({},k),l);return Q.createElement(Q.Fragment,null,f&&Q.createElement(g,{sideCar:nC,removeScrollBar:h,shards:m,noRelative:b,noIsolation:y,inert:x,setCallbacks:c,allowPinchZoom:!!v,lockRef:o,gapMode:E}),d?Q.cloneElement(Q.Children.only(u),(0,nE.__assign)((0,nE.__assign)({},N),{ref:T})):Q.createElement(void 0===w?"div":w,(0,nE.__assign)({},N,{className:p,ref:T}),u))});nM.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nM.classNames={fullWidth:nT,zeroRight:nk};var nO=function(e){var t=e.sideCar,n=(0,nE.__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 Q.createElement(r,(0,nE.__assign)({},n))};nO.isSideCarExport=!0;var nI=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=I||("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)}}},nD=function(){var e=nI();return function(t,n){Q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},nR=function(){var e=nD();return function(t){return e(t.styles,t.dynamic),null}},nL={left:0,top:0,right:0,gap:0},nj=function(e){return parseInt(e||"",10)||0},nP=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[nj(n),nj(r),nj(i)]},nB=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return nL;var t=nP(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])}},nF=nR(),nH="data-scroll-locked",nU=function(e,t,n,r){var i=e.left,s=e.top,o=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(nH,"] {\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(s,"px;\n padding-right: ").concat(o,"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(nk," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(nT," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(nk," .").concat(nk," {\n right: 0 ").concat(r,";\n }\n \n .").concat(nT," .").concat(nT," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(nH,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},nz=function(){var e=parseInt(document.body.getAttribute(nH)||"0",10);return isFinite(e)?e:0},n$=function(){Q.useEffect(function(){return document.body.setAttribute(nH,(nz()+1).toString()),function(){var e=nz()-1;e<=0?document.body.removeAttribute(nH):document.body.setAttribute(nH,e.toString())}},[])},nG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;n$();var s=Q.useMemo(function(){return nB(i)},[i]);return Q.createElement(nF,{styles:nU(s,!t,i,n?"":"!important")})},nq=!1;if("u">typeof window)try{var nV=Object.defineProperty({},"passive",{get:function(){return nq=!0,!0}});window.addEventListener("test",nV,nV),window.removeEventListener("test",nV,nV)}catch(e){nq=!1}var nW=!!nq&&{passive:!1},nK=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])},nY=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),nX(e,r)){var i=nQ(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},nX=function(e,t){return"v"===e?nK(t,"overflowY"):nK(t,"overflowX")},nQ=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},nJ=function(e,t,n,r,i){var s,o=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),a=o*r,l=n.target,c=t.contains(l),d=!1,u=a>0,p=0,h=0;do{if(!l)break;var f=nQ(e,l),m=f[0],g=f[1]-f[2]-o*m;(m||g)&&nX(e,l)&&(p+=g,h+=m);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(p)||!i&&a>p)?d=!0:!u&&(i&&1>Math.abs(h)||!i&&-a>h)&&(d=!0),d},nZ=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},n0=function(e){return[e.deltaX,e.deltaY]},n1=function(e){return e&&"current"in e?e.current:e},n2=0,n3=[];let n5=(h=function(e){var t=Q.useRef([]),n=Q.useRef([0,0]),r=Q.useRef(),i=Q.useState(n2++)[0],s=Q.useState(nR)[0],o=Q.useRef(e);Q.useEffect(function(){o.current=e},[e]),Q.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,nE.__spreadArray)([e.lockRef.current],(e.shards||[]).map(n1),!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=Q.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var i,s=nZ(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-s[0],c="deltaY"in e?e.deltaY:a[1]-s[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 p=window.getSelection(),h=p&&p.anchorNode;if(h&&(h===d||h.contains(d)))return!1;var f=nY(u,d);if(!f)return!0;if(f?i=u:(i="v"===u?"h":"v",f=nY(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 nJ(m,t,e,"h"===m?l:c,!0)},[]),l=Q.useCallback(function(e){if(n3.length&&n3[n3.length-1]===s){var n="deltaY"in e?n0(e):nZ(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=(o.current.shards||[]).map(n1).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=Q.useCallback(function(e,n,r,i){var s={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(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),d=Q.useCallback(function(e){n.current=nZ(e),r.current=void 0},[]),u=Q.useCallback(function(t){c(t.type,n0(t),t.target,a(t,e.lockRef.current))},[]),p=Q.useCallback(function(t){c(t.type,nZ(t),t.target,a(t,e.lockRef.current))},[]);Q.useEffect(function(){return n3.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",l,nW),document.addEventListener("touchmove",l,nW),document.addEventListener("touchstart",d,nW),function(){n3=n3.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,nW),document.removeEventListener("touchmove",l,nW),document.removeEventListener("touchstart",d,nW)}},[]);var h=e.removeScrollBar,f=e.inert;return Q.createElement(Q.Fragment,null,f?Q.createElement(s,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,h?Q.createElement(nG,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nC.useMedium(h),nO);var n4=Q.forwardRef(function(e,t){return Q.createElement(nM,(0,nE.__assign)({},e,{ref:t,sideCar:n5}))});n4.classNames=nM.classNames;var n6=new WeakMap,n9=new WeakMap,n7={},n8=0,re=function(e){return e&&(e.host||re(e.parentNode))},rt=function(e,t,n,r){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=re(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});n7[n]||(n7[n]=new WeakMap);var s=n7[n],o=[],a=new Set,l=new Set(i),c=function(e){!e||a.has(e)||(a.add(e),c(e.parentNode))};i.forEach(c);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(a.has(e))d(e);else try{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(n6.get(e)||0)+1,c=(s.get(e)||0)+1;n6.set(e,l),s.set(e,c),o.push(e),1===l&&i&&n9.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),a.clear(),n8++,function(){o.forEach(function(e){var t=n6.get(e)-1,i=s.get(e)-1;n6.set(e,t),s.set(e,i),t||(n9.has(e)||e.removeAttribute(r),n9.delete(e)),i||e.removeAttribute(n)}),--n8||(n6=new WeakMap,n6=new WeakMap,n9=new WeakMap,n7={})}},rn=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"))),rt(r,i,n,"aria-hidden")):function(){return null}},rr="Dialog",[ri,rs]=tJ(rr),[ro,ra]=ri(rr),rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=Q.useRef(null),l=Q.useRef(null),[c,d]=t5({prop:r,defaultProp:i??!1,onChange:s,caller:rr});return(0,X.jsx)(ro,{scope:t,triggerRef:a,contentRef:l,contentId:t2(),titleId:t2(),descriptionId:t2(),open:c,onOpenChange:d,onOpenToggle:Q.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};rl.displayName=rr;var rc="DialogTrigger";Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ra(rc,n),s=ej(t,i.triggerRef);return(0,X.jsx)(t8.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":r_(i.open),...r,ref:s,onClick:tQ(e.onClick,i.onOpenToggle)})}).displayName=rc;var rd="DialogPortal",[ru,rp]=ri(rd,{forceMount:void 0}),rh=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=ra(rd,t);return(0,X.jsx)(ru,{scope:t,forceMount:n,children:Q.Children.map(r,e=>(0,X.jsx)(nb,{present:n||s.open,children:(0,X.jsx)(ng,{asChild:!0,container:i,children:e})}))})};rh.displayName=rd;var rf="DialogOverlay",rm=Q.forwardRef((e,t)=>{let n=rp(rf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ra(rf,e.__scopeDialog);return s.modal?(0,X.jsx)(nb,{present:r||s.open,children:(0,X.jsx)(rb,{...i,ref:t})}):null});rm.displayName=rf;var rg=t6("DialogOverlay.RemoveScroll"),rb=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ra(rf,n);return(0,X.jsx)(n4,{as:rg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,X.jsx)(t8.div,{"data-state":r_(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ry="DialogContent",rx=Q.forwardRef((e,t)=>{let n=rp(ry,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ra(ry,e.__scopeDialog);return(0,X.jsx)(nb,{present:r||s.open,children:s.modal?(0,X.jsx)(rv,{...i,ref:t}):(0,X.jsx)(rw,{...i,ref:t})})});rx.displayName=ry;var rv=Q.forwardRef((e,t)=>{let n=ra(ry,e.__scopeDialog),r=Q.useRef(null),i=ej(t,n.contentRef,r);return Q.useEffect(()=>{let e=r.current;if(e)return rn(e)},[]),(0,X.jsx)(rE,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tQ(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:tQ(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:tQ(e.onFocusOutside,e=>e.preventDefault())})}),rw=Q.forwardRef((e,t)=>{let n=ra(ry,e.__scopeDialog),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(rE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let s=t.target;n.triggerRef.current?.contains(s)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),rE=Q.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=ra(ry,n),l=Q.useRef(null),c=ej(t,l);return nv(),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:(0,X.jsx)(ni,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":r_(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rD,{titleId:a.titleId}),(0,X.jsx)(rR,{contentRef:l,descriptionId:a.descriptionId})]})]})}),rk="DialogTitle",rT=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ra(rk,n);return(0,X.jsx)(t8.h2,{id:i.titleId,...r,ref:t})});rT.displayName=rk;var rN="DialogDescription",rA=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ra(rN,n);return(0,X.jsx)(t8.p,{id:i.descriptionId,...r,ref:t})});rA.displayName=rN;var rS="DialogClose",rC=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ra(rS,n);return(0,X.jsx)(t8.button,{type:"button",...r,ref:t,onClick:tQ(e.onClick,()=>i.onOpenChange(!1))})});function r_(e){return e?"open":"closed"}rC.displayName=rS;var rM="DialogTitleWarning",[rO,rI]=(f={contentName:ry,titleName:rk,docsSlug:"dialog"},s=Q.createContext(f),(o=e=>{let{children:t,...n}=e,r=Q.useMemo(()=>n,Object.values(n));return(0,X.jsx)(s.Provider,{value:r,children:t})}).displayName=rM+"Provider",[o,function(e){let t=Q.useContext(s);if(t)return t;if(void 0!==f)return f;throw Error(`\`${e}\` must be used within \`${rM}\``)}]),rD=({titleId:e})=>{let t=rI(rM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},rR=({contentRef:e,descriptionId:t})=>{let n=rI("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return Q.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null};let rL=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rm,{ref:n,className:tK("fixed inset-0 z-40 bg-[#0c0a09]/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rL.displayName=rm.displayName;let rj=Q.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(rh,{children:[(0,X.jsx)(rL,{}),(0,X.jsxs)(rx,{ref:r,className:tK("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 shadow-golden rounded-sm 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,(0,X.jsxs)(rC,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,X.jsx)(eD,{className:"h-4 w-4"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));function rP({className:e,...t}){return(0,X.jsx)("div",{className:tK("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function rB({className:e,...t}){return(0,X.jsx)("div",{className:tK("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}rj.displayName=rx.displayName,rP.displayName="DialogHeader",rB.displayName="DialogFooter";let rF=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rT,{ref:n,className:tK("text-lg font-normal leading-none tracking-tight",e),...t}));rF.displayName=rT.displayName;let rH=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rA,{ref:n,className:tK("text-sm text-muted-foreground",e),...t}));function rU({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i="Delete",onConfirm:s,variant:o="destructive"}){return(0,X.jsx)(rl,{open:e,onOpenChange:t,children:(0,X.jsxs)(rj,{className:"sm:max-w-sm",children:[(0,X.jsxs)(rP,{children:[(0,X.jsx)(rF,{children:n}),(0,X.jsx)(rH,{children:r})]}),(0,X.jsxs)(rB,{className:"gap-2 sm:gap-0",children:[(0,X.jsx)(tX,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,X.jsx)(tX,{variant:o,onClick:()=>{s(),t(!1)},children:i})]})]})})}rH.displayName=rA.displayName;let rz=en("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),r$=en("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),rG=["/api/wiki","/api/assets/","/api/upload/","/api/system/reveal"],rq=["/api/agent/admin","/api/agent/register","/api/agents"];function rV(){return new URLSearchParams(window.location.search).get("ws")}function rW(e){let t=rV();if(!t)return e;let n=e.indexOf("?"),r=-1===n?e:e.slice(0,n),i=-1===n?"":e.slice(n+1);if(!function(e){for(let t of rq)if(e===t||e.startsWith(t+"/"))return!1;if(e.startsWith("/api/agent/"))return!0;for(let t of rG)if(e.startsWith(t))return!0;return!1}(r))return e;let s=new URLSearchParams(i);return s.has("ws")?e:(s.set("ws",t),`${r}?${s.toString()}`)}function rK(e,t){return fetch(rW(e),t)}function rY({path:e,badge:t,sublabel:n,showBreadcrumb:r=!0,leading:i,children:s,className:o}){return(0,X.jsxs)("div",{className:tK("flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2",o),children:[(0,X.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i,e&&(0,X.jsx)("span",{className:"text-xs text-muted-foreground truncate",title:e,children:e.split("/").pop()??e}),t&&(0,X.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground/50",children:t}),n&&(0,X.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground/40",children:n})]}),(0,X.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:s})]})}function rX(e){let t=[],n="",r=!1,i=[];for(let s=0;s<e.length;s++){let o=e[s],a=e[s+1];r?'"'===o&&'"'===a?(n+='"',s++):'"'===o?r=!1:n+=o:'"'===o?r=!0:","===o?(i.push(n),n=""):"\n"===o||"\r"===o&&"\n"===a?(i.push(n),n="",i.length>0&&t.push(i),i=[],"\r"===o&&s++):n+=o}return i.push(n),i.some(e=>""!==e)&&t.push(i),t}function rQ(e){return e.map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n")}function rJ({path:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(""),[s,o]=(0,Q.useState)(!1),[a,l]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(null),h=`/api/assets/${e}`;(0,Q.useEffect)(()=>{rK(h).then(e=>e.text()).then(e=>{i(e),n(rX(e)),l(!1)})},[h]);let f=(0,Q.useCallback)((e,t,r)=>{n(n=>{let i=n.map(e=>[...e]);for(;i.length<=e;)i.push([]);for(;i[e].length<=t;)i[e].push("");return i[e][t]=r,i}),l(!0)},[]),m=async()=>{d(!0);let o=s?r:rQ(t);try{await rK(`/api/assets/${e}`,{method:"PUT",headers:{"Content-Type":"text/plain"},body:o}),s?n(rX(r)):i(o),l(!1)}catch(e){console.error("Failed to save CSV:",e)}d(!1)},g=t[0]||[],b=t.slice(1);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:`CSV${t.length>0?` (${t.length-1} rows)`:""}`,children:[a&&(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:m,disabled:c,children:[(0,X.jsx)(r$,{className:"h-3.5 w-3.5"}),c?"Saving...":"Save"]}),(0,X.jsxs)("button",{onClick:()=>{s?n(rX(r)):i(rQ(t)),o(!s)},className:`flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded-md transition-colors border border-border ${s?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,X.jsx)(rz,{className:"h-3 w-3"}),s?"Table":"Source"]}),(0,X.jsx)("button",{onClick:()=>window.open(h,"_blank"),className:"inline-flex items-center justify-center rounded-md h-8 w-8 hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",title:"Download CSV",children:(0,X.jsx)(ec,{className:"h-4 w-4"})})]}),s?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,X.jsx)("textarea",{value:r,onChange:e=>{i(e.target.value),l(!0)},className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,X.jsxs)("div",{className:"flex-1 overflow-auto",children:[(0,X.jsxs)("table",{className:"w-full border-collapse text-[13px]",children:[(0,X.jsx)("thead",{className:"sticky top-0 z-10",children:(0,X.jsxs)("tr",{className:"bg-muted/80 backdrop-blur-sm",children:[(0,X.jsx)("th",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground w-8",children:"#"}),g.map((e,t)=>(0,X.jsx)("th",{className:"border border-border px-3 py-1.5 text-left font-medium text-foreground min-w-[100px]",children:u?.r===0&&u?.c===t?(0,X.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:e,onChange:e=>f(0,t,e.target.value),onBlur:()=>p(null),onKeyDown:e=>{("Enter"===e.key||"Escape"===e.key)&&p(null),"Tab"===e.key&&(e.preventDefault(),p({r:0,c:t+1<g.length?t+1:0}))}}):(0,X.jsx)("span",{className:"cursor-text",onDoubleClick:()=>p({r:0,c:t}),children:e||" "})},t))]})}),(0,X.jsx)("tbody",{children:b.map((e,t)=>{let r=t+1;return(0,X.jsxs)("tr",{className:"hover:bg-accent/30 transition-colors group",children:[(0,X.jsxs)("td",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground/50",children:[(0,X.jsx)("span",{className:"group-hover:hidden",children:t+1}),(0,X.jsx)("button",{className:"hidden group-hover:inline text-red-400 hover:text-red-300 text-[10px]",onClick:()=>{n(e=>e.filter((e,t)=>t!==r)),l(!0)},title:"Delete row",children:"×"})]}),g.map((t,n)=>{let i=e[n]??"",s=u?.r===r&&u?.c===n;return(0,X.jsx)("td",{className:"border border-border px-3 py-1.5",children:s?(0,X.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:i,onChange:e=>f(r,n,e.target.value),onBlur:()=>p(null),onKeyDown:e=>{"Escape"===e.key&&p(null),"Enter"===e.key&&p({r:r+1,c:n}),"Tab"===e.key&&(e.preventDefault(),e.shiftKey?p({r,c:Math.max(0,n-1)}):p({r:n+1>=g.length?r+1:r,c:n+1>=g.length?0:n+1}))}}):(0,X.jsx)("span",{className:"cursor-text",onDoubleClick:()=>p({r,c:n}),children:i||" "})},n)})]},t)})})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-t border-border",children:[(0,X.jsx)("button",{onClick:()=>{let e=t[0]?.length||1;n(t=>[...t,Array(e).fill("")]),l(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add row"}),(0,X.jsx)("button",{onClick:()=>{n(e=>e.map(e=>[...e,""])),l(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add column"})]})]})]})}function rZ(e){this.content=e}rZ.prototype={constructor:rZ,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 r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return -1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new rZ(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 rZ(n)},addToStart:function(e,t){return new rZ([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new rZ(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(-1==s?i.length:s,0,t,n),new rZ(i)},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=rZ.from(e)).size?new rZ(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=rZ.from(e)).size?new rZ(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=rZ.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}},rZ.from=function(e){if(e instanceof rZ)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new rZ(t)};class r0{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 s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;if(l>e&&!1!==n(a,r+o,i||null,s)&&a.content.size){let i=o+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",s=!0;return this.nodesBetween(e,t,(o,a)=>{let l=o.isText?o.text.slice(Math.max(e,a)-a,t-a):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&n&&(s?s=!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(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new r0(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,s=0;s<t;i++){let o=this.content[i],a=s+o.nodeSize;a>e&&((s<e||a>t)&&(o=o.isText?o.cut(Math.max(0,e-s),Math.min(o.text.length,t-s)):o.cut(Math.max(0,e-s-1),Math.min(o.content.size,t-s-1))),n.push(o),r+=o.nodeSize),s=a}return new r0(n,r)}cutByIndex(e,t){return e==t?r0.empty:0==e&&t==this.content.length?this:new r0(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new r0(r,i)}addToStart(e){return new r0([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new r0(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 s=t.child(i),o=n.child(i);if(s==o){r+=s.nodeSize;continue}if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let e=0;s.text[e]==o.text[e];e++)r++;return r}if(s.content.size||o.content.size){let t=e(s.content,o.content,r+1);if(null!=t)return t}r+=s.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let s=t.childCount,o=n.childCount;;){if(0==s||0==o)return s==o?null:{a:r,b:i};let a=t.child(--s),l=n.child(--o),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 r2(0,e);if(e==this.size)return r2(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 r2(t+1,r);return r2(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 r0.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return r0.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return r0.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 r0(t||e,n)}static from(e){if(!e)return r0.empty;if(e instanceof r0)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new r0([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}r0.empty=new r0([],0);let r1={index:0,offset:0};function r2(e,t){return r1.index=e,r1.offset=t,r1}function r3(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(!r3(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!r3(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class r5{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&&r3(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 r5.none;if(e instanceof r5)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}r5.none=[];class r4 extends Error{}class r6{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,s,o){let{index:a,offset:l}=t.findIndex(n),c=t.maybeChild(a);if(l==n||c.isText)return o&&i<=0&&s<=0&&!o.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?s-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 r6(n,this.openStart,this.openEnd)}removeBetween(e,t){return new r6(function e(t,n,r){let{index:i,offset:s}=t.findIndex(n),o=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(s==n||o.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,o.copy(e(o.content,n-s-1,r-s-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 r6.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 r6(r0.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 r6(e,n,r)}}function r9(e,t){if(!t.type.compatibleContent(e.type))throw new r4("Cannot join "+t.type.name+" onto "+e.type.name)}function r7(e,t,n){let r=e.node(n);return r9(r,t.node(n)),r}function r8(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 ie(e,t,n,r){let i=(t||e).node(n),s=0,o=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(r8(e.nodeAfter,r),s++));for(let e=s;e<o;e++)r8(i.child(e),r);t&&t.depth==n&&t.textOffset&&r8(t.nodeBefore,r)}function it(e,t){return e.type.checkContent(t),e.copy(t)}function ir(e,t,n){let r=[];return ie(null,e,n,r),e.depth>n&&r8(it(r7(e,t,n+1),ir(e,t,n+1)),r),ie(t,null,n,r),new r0(r)}r6.empty=new r6(r0.empty,0,0);class ii{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 r5.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 s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].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 il(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:s}=t.content.findIndex(i),o=i-s;if(n.push(t,e,r+s),!o||(t=t.child(e)).isText)break;i=o-1,r+=s+1}return new ii(t,n,i)}static resolveCached(e,t){let n=ia.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 ia.set(e,n=new is);let r=n.elts[n.i]=ii.resolve(e,t);return n.i=(n.i+1)%io,r}}class is{constructor(){this.elts=[],this.i=0}}let io=12,ia=new WeakMap;class il{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 ic=Object.create(null);class id{constructor(e,t,n,r=r5.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||r0.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&&r3(this.attrs,t||e.defaultAttrs||ic)&&r5.sameSet(this.marks,n||r5.none)}copy(e=null){return e==this.content?this:new id(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new id(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 r6.empty;let r=this.resolve(e),i=this.resolve(t),s=n?0:r.sharedDepth(t),o=r.start(s);return new r6(r.node(s).content.cut(r.pos-o,i.pos-o),r.depth-s,i.depth-s)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new r4("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new r4("Inconsistent open depths");return function e(t,n,r,i){let s=t.index(i),o=t.node(i);if(s==n.index(i)&&i<t.depth-r.openStart){let a=e(t,n,r,i+1);return o.copy(o.content.replaceChild(s,a))}if(!r.content.size)return it(o,ir(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){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(r0.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return it(o,function e(t,n,r,i,s){let o=t.depth>s&&r7(t,n,s+1),a=i.depth>s&&r7(r,i,s+1),l=[];return ie(null,t,s,l),o&&a&&n.index(s)==r.index(s)?(r9(o,a),r8(it(o,e(t,n,r,i,s+1)),l)):(o&&r8(it(o,ir(t,n,s+1)),l),ie(n,r,s,l),a&&r8(it(a,ir(r,i,s+1)),l)),ie(i,null,s,l),new r0(l)}(t,e,s,n,i))}{let e=t.parent,i=e.content;return it(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,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 ii.resolveCached(this,e)}resolveNoCache(e){return ii.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()+")"),ip(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=r0.empty,r=0,i=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;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),s=i&&i.matchFragment(this.content,t);return!!s&&s.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=r5.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(!r5.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=r0.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}id.prototype.text=void 0;class iu extends id{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):ip(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 iu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new iu(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 ip(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ih{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new im(e,t);if(null==i.next)return ih.empty;let s=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=ig(e),r=n;return e.eat(",")&&(r="}"!=e.next?ig(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 o=(n=function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,s)),[]);if("seq"==t.type)for(let r=0;;r++){let o=e(t.exprs[r],s);if(r==t.exprs.length-1)return o;i(o,s=n())}else if("star"==t.type){let o=n();return r(s,o),i(e(t.expr,o),o),[r(o)]}else if("plus"==t.type){let o=n();return i(e(t.expr,s),o),i(e(t.expr,o),o),[r(o)]}else if("opt"==t.type)return[r(s)].concat(e(t.expr,s));else if("range"==t.type){let o=s;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,o),r),o=r}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=n();r(o,s),i(e(t.expr,o),s),o=s}return[r(o)]}else if("name"==t.type)return[r(s,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)}}(s),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]);iy(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let s=r[t.join(",")]=new ih(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(ib);s.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return s}(iy(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];s.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,i),o}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 i(s,o){let a=s.matchFragment(e,n);if(a&&(!t||a.validEnd))return r0.from(o.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=i(n,o.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:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),t[s.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")}}ih.empty=new ih(!0);class im{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 ig(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function ib(e,t){return t-e}function iy(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:s}=i[e];r||-1!=n.indexOf(s)||t(s)}}(t),n.sort(ib)}function ix(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 iv(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 iw(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 iE(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new iT(e,r,t[r]);return n}class ik{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=iE(e,n.attrs),this.defaultAttrs=ix(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==ih.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:iv(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new id(this,this.computeAttrs(e),r0.from(t),r5.setFrom(n))}createChecked(e=null,t,n){return t=r0.from(t),this.checkContent(t),new id(this,this.computeAttrs(e),t,r5.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=r0.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(r0.empty,!0);return i?new id(this,e,t.append(i),r5.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){iw(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:r5.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new ik(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 iT{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 iN{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=iE(e,r.attrs),this.excluded=null;let i=ix(this.attrs);this.instance=i?new r5(this,i):null}create(e=null){return!e&&this.instance?this.instance:new r5(this,iv(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new iN(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){iw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class iA{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=rZ.from(e.nodes),t.marks=rZ.from(e.marks||{}),this.nodes=ik.compile(this.spec.nodes,this),this.marks=iN.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]=ih.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?iS(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?[]:iS(this,n.split(" "))}this.nodeFromJSON=e=>id.fromJSON(this,e),this.markFromJSON=e=>r5.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 ik){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 iu(n,n.defaultAttrs,e,r5.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 iS(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],o=s;if(s)n.push(s);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(o=r)}if(!o)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class iC{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 iR(this,t,!1);return n.addAll(e,r5.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new iR(this,t,!0);return n.addAll(e,r5.none,t.from,t.to),r6.maxOpen(n.finish())}matchTag(e,t,n){for(let s=n?this.tags.indexOf(n)+1:0;s<this.tags.length;s++){var r,i;let n=this.tags[s];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],s=r.style;if(0==s.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(s.length>e.length)||61==s.charCodeAt(e.length)&&s.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=iL(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=iL(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new iC(e,iC.schemaRules(e)))}}let i_={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},iM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iO={ol:!0,ul:!0};function iI(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class iD{constructor(e,t,n,r,i,s){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=r5.none,this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(r0.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=r0.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(r0.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&&!i_.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class iR{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=iI(null,t.preserveWhitespace,0)|4*!!n;i=r?new iD(r.type,r.attrs,r5.none,!0,t.topMatch||r.type.contentMatch,s):n?new iD(null,null,r5.none,!0,null,s):new iD(e.schema.topNodeType,null,r5.none,!0,null,s),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:s}=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(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(s.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(s.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(s.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 s=e.nodeName.toLowerCase(),o;iO.hasOwnProperty(s)&&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&&iO.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)||(o=this.parser.matchTag(e,this,n));e:if(a?a.ignore:iM.hasOwnProperty(s))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(i_.hasOwnProperty(s))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 o=a&&a.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?o: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,s;if(t.node)if((s=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(s.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(s,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 o=this.top;if(s&&s.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(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let s=n?e.childNodes[n]:e.firstChild,o=null==r?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,s=0;t>=0;t--){let o=this.nodes[t],a=o.findWrapping(e);if(a&&(!r||r.length>a.length+s)&&(r=a,i=o,!a.length))break;if(o.solid){if(n)break;s+=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=r5.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):ij(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 s=this.top;s.match=s.match&&s.match.matchType(e);let o=iI(e,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let a=r5.none;return n=n.filter(t=>(s.type?!s.type.allowsMarkType(t.type):!ij(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new iD(e,t,a,r,null,o)),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,s=(e,o)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(s(e-1,o))return!0;return!1}{let e=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;o--}}return!0};return s(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 iL(e){let t={};for(let n in e)t[n]=e[n];return t}function ij(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let s=[],o=e=>{s.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>s.indexOf(i)&&o(i))return!0}};if(o(i.contentMatch))return!0}}class iP{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=iF(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,s=0;for(;n<i.length&&s<e.marks.length;){let t=e.marks[s];if(!this.marks[t.type.name]){s++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,s++}for(;n<i.length;)r=i.pop()[1];for(;s<e.marks.length;){let n=e.marks[s++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return iF(t).createTextNode(e.text);let{dom:n,contentDOM:r}=iU(iF(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&&iU(iF(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:iU(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new iP(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=iB(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return iB(e.marks)}}function iB(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function iF(e){return e.document||window.document}let iH=new WeakMap;function iU(e,t,n,r){let i,s,o;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===(s=iH.get(r))&&iH.set(r,(o=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])o||(o=[]),o.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),s=o)),l=s)&&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],p=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in p=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 s=p;s<t.length;s++){let o=t[s];if(0===o){if(s<t.length-1||s>p)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof o)d.appendChild(e.createTextNode(o));else{let{dom:t,contentDOM:s}=iU(e,o,n,r);if(d.appendChild(t),s){if(i)throw RangeError("Multiple content holes");i=s}}}return{dom:d,contentDOM:i}}class iz{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 i${constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&i$.empty)return i$.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,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[o+i],c=this.ranges[o+s],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,s=a+r+(i<0?0:c);if(n)return s;let u=e==(t<0?a:d)?null:o/3+(e-a)*65536,p=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(p|=8),new iz(s,p,u)}r+=c-l}return n?e+r:new iz(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let a=this.ranges[t+i];if(e<=o+a&&t==3*r)return!0;n+=this.ranges[t+s]-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 s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(o,o+l,a,a+c),i+=c-l}}invert(){return new i$(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?i$.empty:new i$(e<0?[0,-e,0]:[0,0,e])}}i$.empty=new i$([]);class iG{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 iG(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 iG;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 iz(e,r,null)}}let iq=Object.create(null);class iV{getMap(){return i$.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=iq[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in iq)throw RangeError("Duplicate use of step JSON ID "+e);return iq[e]=t,t.prototype.jsonID=e,t}}class iW{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new iW(e,null)}static fail(e){return new iW(null,e)}static fromReplace(e,t,n,r){try{return iW.ok(e.replace(t,n,r))}catch(e){if(e instanceof r4)return iW.fail(e.message);throw e}}}function iK(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(iK(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return r0.fromArray(r)}class iY extends iV{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 r6(iK(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 iW.fromReplace(e,this.from,this.to,i)}invert(){return new iX(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 iY(t.pos,n.pos,this.mark)}merge(e){return e instanceof iY&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new iY(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 iY(t.from,t.to,e.markFromJSON(t.mark))}}iV.jsonID("addMark",iY);class iX extends iV{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 r6(iK(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return iW.fromReplace(e,this.from,this.to,n)}invert(){return new iY(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 iX(t.pos,n.pos,this.mark)}merge(e){return e instanceof iX&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new iX(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 iX(t.from,t.to,e.markFromJSON(t.mark))}}iV.jsonID("removeMark",iX);class iQ extends iV{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iW.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return iW.fromReplace(e,this.pos,this.pos+1,new r6(r0.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 iQ(this.pos,t.marks[n]);return new iQ(this.pos,this.mark)}}return new iJ(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new iQ(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 iQ(t.pos,e.markFromJSON(t.mark))}}iV.jsonID("addNodeMark",iQ);class iJ extends iV{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iW.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return iW.fromReplace(e,this.pos,this.pos+1,new r6(r0.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new iQ(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new iJ(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 iJ(t.pos,e.markFromJSON(t.mark))}}iV.jsonID("removeNodeMark",iJ);class iZ extends iV{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&i1(e,this.from,this.to)?iW.fail("Structure replace would overwrite content"):iW.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new i$([this.from,this.to-this.from,this.slice.size])}invert(e){return new iZ(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&&iZ.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new iZ(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof iZ)||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?r6.empty:new r6(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new iZ(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?r6.empty:new r6(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new iZ(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 iZ(t.from,t.to,r6.fromJSON(e,t.slice),!!t.structure)}}iZ.MAP_BIAS=1,iV.jsonID("replace",iZ);class i0 extends iV{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(i1(e,this.from,this.gapFrom)||i1(e,this.gapTo,this.to)))return iW.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return iW.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?iW.fromReplace(e,this.from,this.to,n):iW.fail("Content does not fit in gap")}getMap(){return new i$([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 i0(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 i0(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 i0(t.from,t.to,t.gapFrom,t.gapTo,r6.fromJSON(e,t.slice),t.insert,!!t.structure)}}function i1(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function i2(e,t,n,r=n.contentMatch,i=!0){let s=e.doc.nodeAt(t),o=[],a=t+1;for(let t=0;t<s.childCount;t++){let l=s.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new iX(a,c,l.marks[t]));if(i&&l.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(l.text);)r||(r=new r6(r0.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),o.push(new iZ(a+e.index,a+e.index+e[0].length,r))}}else o.push(new iZ(a,c,r6.empty));a=c}if(!r.validEnd){let t=r.fillBefore(r0.empty,!0);e.replace(a,a,new r6(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function i3(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let s=e.$from.node(n),o=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&s.canReplace(o,a,t))return n;if(0==n||s.type.spec.isolating||!((0==o||s.canReplace(o,s.childCount))&&(a==s.childCount||s.canReplace(0,a))))break;o&&(r=1),a<s.childCount&&(i=1)}return null}function i5(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.contentMatchAt(r).findWrapping(t);if(!s)return null;let o=s.length?s[0]:t;return n.canReplaceWith(r,i,o)?s:null}(e,t),s=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,s=n.child(r),o=t.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?o:null}(r,t);return s?i.map(i4).concat({type:t,attrs:n}).concat(s.map(i4)):null}function i4(e){return{type:e,attrs:null}}function i6(e,t,n,r){t.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+s+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function i9(e,t,n,r){t.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+s);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function i7(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>s;e--,t--){let n=i.node(e),s=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(s,n.childCount),a=r&&r[t+1];a&&(o=o.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(s+1,n.childCount)||!l.type.validContent(o))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function i8(e,t){let n=e.resolve(t),r=n.index();return se(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function se(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 s=t.child(i),o=s.type==r?e.type.schema.nodes.text:s.type;if(!(n=n.matchType(o))||!e.type.allowsMarks(s.marks))return!1}return n.validEnd}(e,t))}function st(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,s,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(e+1),o++,s=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),s=r.node(e+1)),i&&!i.isTextblock&&se(i,s)&&r.node(e).canReplace(o,o+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function sn(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,s=r.index(t)+ +(n>0),o=r.node(t),a=!1;if(1==e)a=o.canReplace(s,s,i);else{let e=o.contentMatchAt(s).findWrapping(i.firstChild.type);a=e&&o.canReplaceWith(s,s,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function sr(e,t,n=t,r=r6.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return si(i,s,r)?new iZ(t,n,r):new ss(i,s,r).fit()}function si(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}iV.jsonID("replaceAround",i0);class ss{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r0.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=r0.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,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new r6(i,s,o);return e>-1?new i0(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new iZ(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=sl(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:s,match:o}=this.frontier[i],a,l=null;if(1==t&&(r?o.matchType(r.type)||(l=o.fillBefore(r0.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:l};if(2==t&&r&&(a=o.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:a};if(e&&o.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=sl(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new r6(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=sl(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new r6(so(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r6(so(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let s=this.unplaced,o=n?n.content:s.content,a=s.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let p=o.size+e-(s.content.size-s.openEnd);for(;l<o.childCount;){let e=o.child(l),t=d.matchType(e.type);if(!t)break;(++l>1||0==a||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(r0.empty,!0)))),t.copy(i)}(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==o.childCount?p:-1)))}let h=l==o.childCount;h||(p=-1),this.placed=sa(this.placed,t,r0.from(c)),this.frontier[t].match=d,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?r6.empty:new r6(so(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r6(so(s.content,e,l),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!sc(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)),s=sc(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=sc(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:s,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=sa(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=sa(this.placed,this.depth,r0.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r0.empty,!0);e.childCount&&(this.placed=sa(this.placed,this.frontier.length,e))}}function so(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(so(e.firstChild.content,t-1,n)))}function sa(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(sa(e.lastChild.content,t-1,n)))}function sl(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function sc(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);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,s.content,o)?a:null}function sd(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 su extends iV{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 iW.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 iW.fromReplace(e,this.pos,this.pos+1,new r6(r0.from(r),0,+!t.isLeaf))}getMap(){return i$.empty}invert(e){return new su(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 su(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 su(t.pos,t.attr,t.value)}}iV.jsonID("attr",su);class sp extends iV{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 iW.ok(n)}getMap(){return i$.empty}invert(e){return new sp(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 sp(t.attr,t.value)}}iV.jsonID("docAttr",sp);let sh=class extends Error{};(sh=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),sh.prototype.constructor=sh,sh.prototype.name="TransformError";class sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new iG}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new sh(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,s)=>{e=Math.min(e,i),t=Math.max(t,s)})}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=r6.empty){let r=sr(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new r6(r0.from(n),0,0))}delete(e,t){return this.replace(e,t,r6.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 i=e.doc.resolve(t),s=e.doc.resolve(n);if(si(i,s,r))return e.step(new iZ(t,n,r));let o=sd(i,s);0==o[o.length-1]&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?a=e:i.before(e)==t&&o.splice(1,0,-e)}let l=o.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<o.length;t++){let c=o[(t+l)%o.length],d=!0;c<0&&(d=!1,c=-c);let p=i.node(c-1),h=i.index(c-1);if(p.canReplaceWith(h,h,u.type,u.marks))return e.replace(i.before(c),d?s.after(c):n,new r6(function e(t,n,r,i,s){if(n<r){let s=t.firstChild;t=t.replaceChild(0,s.copy(e(s.content,n+1,r,i,s)))}if(n>i){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(r0.empty,!0))}return t}(r.content,0,r.openStart,a),a,r.openEnd))}}let p=e.steps.length;for(let a=o.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>p));a--){let e=o[a];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&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=i=e)}return this.replaceRange(r,i,new r6(r0.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 s=r.sharedDepth(n),o=!1;for(let e=r.depth;e>s;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>s;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){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 s=sd(r,i);for(let t=0;t<s.length;t++){let n=s[t],o=t==s.length-1;if(o&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:s}=t,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=r0.empty,u=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=r0.from(r.node(e).copy(d)),u++):l--;let p=r0.empty,h=0;for(let e=s,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=r0.from(i.node(e).copy(p)),h++):c++;e.step(new i0(l,c,o,a,new r6(d.append(p),u,h),d.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,s=e.doc.resolve(t-n),o=s.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,t=!!o.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);i9(e,r.node(),r.before(),a)}o.inlineContent&&i2(e,t+n-1,o,s.node().contentMatchAt(s.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new iZ(c,l.map(t+n,-1),r6.empty,!0)),!0===r){let t=e.doc.resolve(c);i6(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=r0.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=r0.from(n[e].type.create(n[e].attrs,r))}let i=t.start,s=t.end;e.step(new i0(i,s,i,s,new r6(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var o,a,l;let c,d,u="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,u)&&(o=i.doc,a=i.mapping.slice(s).map(t),l=n,d=(c=o.resolve(a)).index(),c.parent.canReplaceWith(d,d+1,l))){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&&i9(i,e,t,s),i2(i,i.mapping.slice(s).map(t,1),n,void 0,null===r);let o=i.mapping.slice(s),a=o.map(t,1),l=o.map(t+e.nodeSize,1);return i.step(new i0(a,l,a+1,l-1,new r6(r0.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===r&&i6(i,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,o);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new i0(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r6(r0.from(o),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new su(e,t,n)),this}setDocAttribute(e,t){return this.step(new sp(e,t)),this}addNodeMark(e,t){return this.step(new iQ(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof r5)t.isInSet(n.marks)&&this.step(new iJ(e,t));else{let r=n.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new iJ(e,i)),r=i.removeFromSet(r);for(let e=s.length-1;e>=0;e--)this.step(s[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),s=r0.empty,o=r0.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){s=r0.from(i.node(e).copy(s));let t=r&&r[a];o=r0.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new iZ(t,t,new r6(s.append(o),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,s,o,a;return r=this,o=[],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),p=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(p)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:o.push(i=new iX(c,u,d[e])));s&&s.to==c?s.to=u:a.push(s=new iY(c,u,n))}}),o.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,s;return r=this,i=[],s=0,r.doc.nodesBetween(e,t,(r,o)=>{if(!r.isInline)return;s++;let a=null;if(n instanceof iN){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(o+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==s-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=s):i.push({style:r,from:Math.max(o,e),to:n,step:s})}}}),i.forEach(e=>r.step(new iX(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return i2(this,e,t,n),this}}let sm=Object.create(null);class sg{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new sb(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=r6.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,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),o?r6.empty:t),0==o&&sS(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:s,$to:o}=r[i],a=e.mapping.slice(n),l=a.map(s.pos),c=a.map(o.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),sS(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new sv(e):sA(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?sA(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):sA(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 sT(e.node(0))}static atStart(e){return sA(e,e,0,0,1)||new sT(e)}static atEnd(e){return sA(e,e,e.content.size,e.childCount,-1)||new sT(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=sm[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sm)throw RangeError("Duplicate use of selection JSON ID "+e);return sm[e]=t,t.prototype.jsonID=e,t}getBookmark(){return sv.between(this.$anchor,this.$head).getBookmark()}}sg.prototype.visible=!0;class sb{constructor(e,t){this.$from=e,this.$to=t}}let sy=!1;function sx(e){sy||e.parent.inlineContent||(sy=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class sv extends sg{constructor(e,t=e){sx(e),sx(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 sg.near(n);let r=e.resolve(t.map(this.anchor));return new sv(r.parent.inlineContent?r:n,n)}replace(e,t=r6.empty){if(super.replace(e,t),t==r6.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof sv&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sw(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 sv(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=sg.findFrom(t,n,!0)||sg.findFrom(t,-n,!0);if(!e)return sg.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(sg.findFrom(e,-n,!0)||sg.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new sv(e,t)}}sg.jsonID("text",sv);class sw{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sw(e.map(this.anchor),e.map(this.head))}resolve(e){return sv.between(e.resolve(this.anchor),e.resolve(this.head))}}class sE extends sg{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?sg.near(i):new sE(i)}content(){return new r6(r0.from(this.node),0,0)}eq(e){return e instanceof sE&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new sk(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new sE(e.resolve(t.anchor))}static create(e,t){return new sE(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}sE.prototype.visible=!1,sg.jsonID("node",sE);class sk{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new sw(n,n):new sk(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&sE.isSelectable(n)?new sE(t):sg.near(t)}}class sT extends sg{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r6.empty){if(t==r6.empty){e.delete(0,e.doc.content.size);let t=sg.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new sT(e)}map(e){return new sT(e)}eq(e){return e instanceof sT}getBookmark(){return sN}}sg.jsonID("all",sT);let sN={map(){return this},resolve:e=>new sT(e)};function sA(e,t,n,r,i,s=!1){if(t.inlineContent)return sv.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(r.isAtom){if(!s&&sE.isSelectable(r))return sE.create(e,n-(i<0?r.nodeSize:0))}else{let t=sA(e,r,n+i,i<0?r.childCount:0,i,s);if(t)return t}n+=r.nodeSize*i}return null}function sS(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let s=e.steps[i];(s instanceof iZ||s instanceof i0)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(sg.near(e.doc.resolve(r),n)))}class sC extends sf{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 r5.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)||r5.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(sg.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 s_(e,t){return t&&e?e.bind(t):e}class sM{constructor(e,t,n){this.name=e,this.init=s_(t.init,n),this.apply=s_(t.apply,n)}}let sO=[new sM("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new sM("selection",{init:(e,t)=>e.selection||sg.atStart(t.doc),apply:e=>e.selection}),new sM("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new sM("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class sI{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=sO.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 sM(e.key,e.spec.state,e))})}}class sD{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 s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let a=r?r[s].n:0,l=r?r[s].state:this,c=a<t.length&&o.spec.appendTransaction.call(o,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<s?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[s]={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 sD(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 sC(this)}static create(e){let t=new sI(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new sD(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 sI(this.schema,e.plugins),n=t.fields,r=new sD(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 sI(e.schema,e.plugins),i=new sD(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=id.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=sg.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 s in n){let o=n[s],a=o.spec.state;if(o.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,s)){i[r.name]=a.fromJSON.call(o,e,t[s],i);return}}i[r.name]=r.init(e,i)}}),i}}class sR{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let s=t[i];s instanceof Function?s=s.bind(n):"handleDOMEvents"==i&&(s=e(s,n,{})),r[i]=s}return r}(e.props,this,this.props),this.key=e.key?e.key.key:sj("plugin")}getState(e){return e[this.key]}}let sL=Object.create(null);function sj(e){return e in sL?e+"$"+ ++sL[e]:(sL[e]=0,e+"$")}class sP{constructor(e="key"){this.key=sj(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let sB=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},sF=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},sH=null,sU=function(e,t,n){let r=sH||(sH=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},sz=function(){sH=null},s$=function(e,t,n,r){return n&&(sq(e,t,n,r,-1)||sq(e,t,n,r,1))},sG=/^(img|br|input|textarea|hr)$/i;function sq(e,t,n,r,i){for(var s;;){if(e==n&&t==r)return!0;if(t==(i<0?0:sV(e))){let n=e.parentNode;if(!n||1!=n.nodeType||sW(e)||sG.test(e.nodeName)||"false"==e.contentEditable)return!1;t=sB(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==(s=n.pmViewDesc)||!s.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?sV(e):0}}}function sV(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function sW(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 sK=function(e){return e.focusNode&&s$(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function sY(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let sX="u">typeof navigator?navigator:null,sQ="u">typeof document?document:null,sJ=sX&&sX.userAgent||"",sZ=/Edge\/(\d+)/.exec(sJ),s0=/MSIE \d/.exec(sJ),s1=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sJ),s2=!!(s0||s1||sZ),s3=s0?document.documentMode:s1?+s1[1]:sZ?+sZ[1]:0,s5=!s2&&/gecko\/(\d+)/i.test(sJ);s5&&(/Firefox\/(\d+)/.exec(sJ)||[0,0])[1];let s4=!s2&&/Chrome\/(\d+)/.exec(sJ),s6=!!s4,s9=s4?+s4[1]:0,s7=!s2&&!!sX&&/Apple Computer/.test(sX.vendor),s8=s7&&(/Mobile\/\w+/.test(sJ)||!!sX&&sX.maxTouchPoints>2),oe=s8||!!sX&&/Mac/.test(sX.platform),ot=!!sX&&/Win/.test(sX.platform),on=/Android \d/.test(sJ),or=!!sQ&&"webkitFontSmoothing"in sQ.documentElement.style,oi=or?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oo(e,t){return"number"==typeof e?e:e[t]}function oa(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(1!=o.nodeType){o=sF(o);continue}let e=o,n=e==s.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}}(s):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+oo(r,"top")?c=-(a.top-t.top+oo(i,"top")):t.bottom>a.bottom-oo(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+oo(i,"top")-a.top:t.bottom-a.bottom+oo(i,"bottom")),t.left<a.left+oo(r,"left")?l=-(a.left-t.left+oo(i,"left")):t.right>a.right-oo(r,"right")&&(l=t.right-a.right+oo(i,"right")),l||c)if(n)s.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,s=e.scrollTop-r;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}let d=n?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(d))break;o="absolute"==d?o.offsetParent:sF(o)}}function ol(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=sF(r));return t}function oc(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let od=null;function ou(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function op(e){return e.top<e.bottom||e.left<e.right}function oh(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(op(e))return e}return Array.prototype.find.call(n,op)||e.getBoundingClientRect()}let of=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function om(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),o=or||s5;if(3==r.nodeType)if(o&&(of.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=oh(sU(r,i,i),n);if(s5&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=oh(sU(r,i-1,i-1),-1);if(t.top==e.top){let n=oh(sU(r,i,i+1),-1);if(n.top!=e.top)return og(n,n.left<t.left)}}return e}else{let e=i,t=i,s=n<0?1:-1;return n<0&&!i?(t++,s=-1):n>=0&&i==r.nodeValue.length?(e--,s=1):n<0?e--:t++,og(oh(sU(r,e,t),s),s<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==sV(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return ob(e.getBoundingClientRect(),!1)}if(null==s&&i<sV(r)){let e=r.childNodes[i];if(1==e.nodeType)return ob(e.getBoundingClientRect(),!0)}return ob(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==sV(r))){let e=r.childNodes[i-1],t=3==e.nodeType?sU(e,sV(e)-!o):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return og(oh(t,1),!1)}if(null==s&&i<sV(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?sU(e,0,+!o):1==e.nodeType?e:null:null;if(t)return og(oh(t,-1),!0)}return og(oh(3==r.nodeType?sU(r):r,-n),n>=0)}function og(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 ob(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 oy(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 ox=/[\u0590-\u08ac]/,ov=null,ow=null,oE=!1;class ok{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>sB(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),s;if(i&&(!t||i.node))if(!n||!(s=i.nodeDOM)||(1==s.nodeType?s.contains(1==e.nodeType?e:e.parentNode):s==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],s=t+i.size;if(s>e||i instanceof oM){r=e-t;break}t=s}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 oT&&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?sB(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?sB(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 s=n,o=0;;o++){let n=this.children[o],a=s+n.size;if(-1==r&&e<=a){let i=s+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=s;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=sB(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||o==this.children.length-1)){t=a;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=sB(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=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),s=Math.max(e,t);for(let o=0,a=0;o<this.children.length;o++){let l=this.children[o],c=a+l.size;if(i>a&&s<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let o=this.domFromPos(e,e?-1:1),a=t==e?o:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((s5||s7)&&e==t){let{node:e,offset:t}=o;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&&(o=a={node:n.parentNode,offset:sB(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(s5&&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&&s7)&&s$(o.node,o.offset,c.anchorNode,c.anchorOffset)&&s$(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&s5)){l.collapse(o.node,o.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=o;o=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(o.node,o.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],s=n+i.size;if(n==s?e<=s&&t>=n:e<s&&t>n){let r=n+i.border,o=s-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==s?2:1,e==r&&t==o&&(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=s}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 oT extends ok{constructor(e,t,n,r){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,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 oN extends ok{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 oA extends ok{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],s=i&&i(t,r,n);return s&&s.dom||(s=iP.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new oA(e,t,s.dom,s.contentDOM||s.dom,s)}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=oA.create(this.parent,this.mark,!0,n),i=this.children,s=this.size;t<s&&(i=oU(i,t,s,n)),e>0&&(i=oU(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 oS extends ok{constructor(e,t,n,r,i,s,o,a,l){super(e,[],i,s),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(e,t,n,r,i,s){let o=i.nodeViews[t.type.name],a,l=o&&o(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,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=iP.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=oj(c,n,t),l)?a=new oO(e,t,n,r,c,d||null,u,l,i,s+1):t.isText?new o_(e,t,n,r,c,u,i):new oS(e,t,n,r,c,d||null,u,i,s+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=()=>r0.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)&&oP(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,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,a=new oF(this,s&&s.node,e);(function(e,t,n,r){let i=t.locals(e),s=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(s,o),n),s+=o.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u,p,h;for(;o<i.length&&i[o].to==s;){let e=i[o++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(oH);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)h=-1,p=l,l=null;else if(c<e.childCount)h=c,p=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=s&&a.splice(e--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let f=s+p.nodeSize;if(p.isText){let e=f;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=p.cut(e-s),p=p.cut(0,e-s),f=e,h=-1)}else for(;o<i.length&&i[o].to<f;)o++;let m=p.isInline&&!p.isLeaf?a.filter(e=>!e.inline):a.slice();r(p,m,t.forChild(s,p),h),s=f}})(this.node,this.innerDeco,(t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?r5.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,s,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,s,l,c)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,s,l,d,e)||a.updateNextNode(t,s,l,e,c,r)||a.addNode(t,s,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),function e(t,n,r){let i=t.firstChild,s=!1;for(let o=0;o<n.length;o++){let a=n[o],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=oB(i),s=!0;i=i.nextSibling}else s=!0,t.insertBefore(l,i);if(a instanceof oA){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=oB(i),s=!0;s&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),s8&&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 sv)||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,s=function(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let o=e.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;l+=t.text}if(s>=n){if(s>=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 s<0?null:{node:i,pos:s,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 s=new oN(this,i,t,r);e.input.compositionNodes.push(s),this.children=oU(this.children,n,n+r.length,e,s)}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(oP(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=oL(this.dom,this.nodeDOM,oR(this.outerDeco,this.node,t),oR(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 oC(e,t,n,r,i){oj(r,t,e);let s=new oS(void 0,e,t,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class o_ extends oS{constructor(e,t,n,r,i,s,o){super(e,t,n,r,i,null,s,o,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 o_(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 oM extends ok{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 oO extends oS{constructor(e,t,n,r,i,s,o,a,l,c){super(e,t,n,r,i,s,o,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 oI=function(e){e&&(this.nodeName=e)};oI.prototype=Object.create(null);let oD=[new oI];function oR(e,t,n){if(0==e.length)return oD;let r=n?oD[0]:new oI,i=[r];for(let s=0;s<e.length;s++){let o=e[s].type.attrs;if(o)for(let e in o.nodeName&&i.push(r=new oI(o.nodeName)),o){let s=o[e];null!=s&&(n&&1==i.length&&i.push(r=new oI(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+s:"style"==e?r.style=(r.style?r.style+";":"")+s:"nodeName"!=e&&(r[e]=s))}}return i}function oL(e,t,n,r){if(n==oD&&r==oD)return t;let i=t;for(let t=0;t<r.length;t++){let s=r[t],o=n[t];if(t){let t;o&&o.nodeName==s.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==s.nodeName||((t=document.createElement(s.nodeName)).pmIsDeco=!0,t.appendChild(i),o=oD[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,o||oD[0],s)}return i}function oj(e,t,n){return oL(e,e,oD,oR(t,n,1!=e.nodeType))}function oP(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 oB(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class oF{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,s=new Map,o=[];n:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof oA)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,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.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,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[s])&&!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=oA.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,n))i=this.top.children.indexOf(s,this.index);else for(let r=this.index,s=Math.min(this.top.children.length,r+5);r<s;r++){let s=this.top.children[r];if(s.matchesNode(e,t,n)&&!this.preMatch.matched.has(s)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.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,s){for(let o=this.index;o<this.top.children.length;o++){let a=this.top.children[o];if(a instanceof oS){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&&oP(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,s+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!oP(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=oS.create(this.top,t,n,r,i,s);if(o.contentDOM)for(let t of(o.children=e.children,e.children=[],o.children))t.parent=o;return e.destroy(),o}addNode(e,t,n,r,i){let s=oS.create(this.top,e,t,n,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),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 oT(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 oA;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof o_)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((s7||s6)&&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 oM(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 oH(e,t){return e.type.side-t.type.side}function oU(e,t,n,r,i){let s=[];for(let o=0,a=0;o<e.length;o++){let l=e[o],c=a,d=a+=l.size;c>=n||d<=t?s.push(l):(c<t&&s.push(l.slice(0,t-c,r)),i&&(s.push(i),i=void 0),d>n&&s.push(l.slice(n-c,l.size,r)))}return s}function oz(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(sK(n)){for(l=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&sE.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==sV(e);r||i;){if(e==n)return!0;let t=sB(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==sV(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new sE(o==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let s=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[l,o]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(o)}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&&!s?1:-1;c=oQ(e,d,a,n)}return c}function o$(e){return e.editable?e.hasFocus():oZ(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function oG(e,t=!1){let n=e.state.selection;if(oY(e,n),o$(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&s6){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&s$(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,sB(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&s2&&s3<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,s,o,a,{anchor:l,head:c}=n,d,u;oq&&!(n instanceof sv)&&(n.$from.parent.inlineContent||(d=oV(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=oV(e,n.to))),e.docView.setSelection(l,c,e,t),oq&&(d&&oK(d),u&&oK(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),o=(s=r.domSelectionRange()).anchorNode,a=s.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(s.anchorNode!=o||s.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!o$(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let oq=s7||s6&&s9<63;function oV(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(s7&&i&&"false"==i.contentEditable)return oW(i);if((!i||"false"==i.contentEditable)&&(!s||"false"==s.contentEditable)){if(i)return oW(i);else if(s)return oW(s)}}function oW(e){return e.contentEditable="true",s7&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function oK(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function oY(e,t){if(t instanceof sE){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(oX(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else oX(e)}function oX(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function oQ(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||sv.between(t,n,r)}function oJ(e){return(!e.editable||!!e.hasFocus())&&oZ(e)}function oZ(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 o0(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&sg.findFrom(s,t)}function o1(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function o2(e,t,n){let r=e.state.selection;if(r instanceof sv){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 s=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return o1(e,new sv(r.$anchor,s))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=o0(e.state,t);return!!n&&n instanceof sE&&o1(e,n)}else if(!(oe&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,s;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(s=e.docView.descAt(o))&&!s.contentDOM)&&(sE.isSelectable(i)?o1(e,new sE(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!or&&o1(e,new sv(e.state.doc.resolve(t<0?o:o+i.nodeSize))))}}else{if(r instanceof sE&&r.node.isInline)return o1(e,new sv(t>0?r.$to:r.$from));let n=o0(e.state,t);return!!n&&o1(e,n)}}function o3(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function o5(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function o4(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=!1;for(s5&&1==n.nodeType&&r<o3(n)&&o5(n.childNodes[r],-1)&&(o=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(o5(e,-1))i=n,s=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(o6(n))break;else{let t=n.previousSibling;for(;t&&o5(t,-1);)i=n.parentNode,s=sB(t),t=t.previousSibling;if(t)r=o3(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}o?o9(e,n,r):i&&o9(e,i,s)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,s=r.focusOffset;if(!i)return;let o=o3(i);for(;;)if(s<o){if(1!=i.nodeType)break;if(o5(i.childNodes[s],1))t=i,n=++s;else break}else if(o6(i))break;else{let r=i.nextSibling;for(;r&&o5(r,1);)t=r.parentNode,n=sB(r)+1,r=r.nextSibling;if(r)s=0,o=o3(i=r);else{if((i=i.parentNode)==e.dom)break;s=o=0}}t&&o9(e,t,n)}(e)}function o6(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function o9(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!sW(e);)t=sB(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&&!sW(e);)t=sB(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(sK(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&&oG(e)},50)}function o7(e,t){let n=e.state.doc.resolve(t);if(!(s6||ot)&&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 o8(e,t,n){let r=e.state.selection;if(r instanceof sv&&!r.empty||n.indexOf("s")>-1||oe&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=o0(e.state,t);if(n&&n instanceof sE)return o1(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,o=r instanceof sT?sg.near(n,t):sg.findFrom(n,t);return!!o&&o1(e,o)}return!1}function ae(e,t){if(!(e.state.selection instanceof sv))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 s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function at(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function an(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let o=e.someProp("clipboardSerializer")||iP.fromSchema(e.state.schema),a=ad(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=al[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} ${s}${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 ar(e,t,n,r,i){let s,o,a=i.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return o=new r6(r0.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{o=t(o,e,!0)}),o;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)o=n;else{let n=i.marks(),{schema:r}=e.state,o=iP.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(o.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=ad().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),o;if((o=s&&al[s[1].toLowerCase()])&&(e=o.map(e=>"<"+e+">").join("")+e+o.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(au||(au=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),au.createHTML(t)):t),o)for(let e=0;e<o.length;e++)i=i.querySelector(o[e])||i;return i}(n),or&&function(e){let t=e.querySelectorAll(s6?"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 c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||iC.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ai.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)o=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:i,openStart:s,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=r0.from(t.create(r[e+1],i)),s++,o++}return new r6(i,s,o)}(aa(o,+d[1],+d[2]),d[4]);else if((o=r6.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)),i,s=[];if(e.forEach(e=>{if(!s)return;let t=r.findWrapping(e.type),n;if(!t)return s=null;if(n=s.length&&i.length&&function e(t,n,r,i,s){if(s<t.length&&s<n.length&&t[s]==n[s]){let o=e(t,n,r,i.lastChild,s+1);if(o)return i.copy(i.content.replaceChild(i.childCount-1,o));if(i.contentMatchAt(i.childCount).matchType(s==t.length-1?r.type:t[s+1]))return i.copy(i.content.append(r0.from(as(r,t,s+1))))}}(t,i,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)),i=t.contentMatchAt(t.childCount).fillBefore(r0.empty,!0);return t.copy(r.append(i))}(s[s.length-1],i.length));let n=as(e,t);s.push(n),r=r.matchType(n.type),i=t}}),s)return r0.from(s)}return e}(o.content,i),!0)).openStart||o.openEnd){let e=0,t=0;for(let t=o.content.firstChild;e<o.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=o.content.lastChild;t<o.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);o=aa(o,e,t)}return e.someProp("transformPasted",t=>{o=t(o,e,l)}),o}let ai=/^(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 as(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,r0.from(e));return e}function ao(e,t,n,r,i,s){let o=t<0?e.firstChild:e.lastChild,a=o.content;return e.childCount>1&&(s=0),i<r-1&&(a=ao(a,t,n,r,i+1,s)),i>=n&&(a=t<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(r0.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(a))}function aa(e,t,n){return t<e.openStart&&(e=new r6(ao(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new r6(ao(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let al={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},ac=null;function ad(){return ac||(ac=document.implementation.createHTMLDocument("title"))}let au=null,ap={},ah={},af={touchstart:!0,touchmove:!0};class am{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 ag(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ab(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ay(e,t))})}function ay(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function ax(e){return{left:e.clientX,top:e.clientY}}function av(e,t,n,r,i){if(-1==r)return!1;let s=e.state.doc.resolve(r);for(let r=s.depth+1;r>0;r--)if(e.someProp(t,t=>r>s.depth?t(e,n,s.nodeAfter,s.before(r),i,!0):t(e,n,s.node(r),s.before(r),i,!1)))return!0;return!1}function aw(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)}ah.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!aT(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!on||!s6||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!s8||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||oe&&72==r&&"c"==i)return ae(e,-1)||o4(e,-1);if(46==r&&!t.shiftKey||oe&&68==r&&"c"==i)return ae(e,1)||o4(e,1);if(13==r||27==r)return!0;if(37==r||oe&&66==r&&"c"==i){let t=37==r?"ltr"==o7(e,e.state.selection.from)?-1:1:-1;return o2(e,t,i)||o4(e,t)}if(39==r||oe&&70==r&&"c"==i){let t=39==r?"ltr"==o7(e,e.state.selection.from)?1:-1:1;return o2(e,t,i)||o4(e,t)}else if(38==r||oe&&80==r&&"c"==i)return o8(e,-1,i)||o4(e,-1);else if(40==r||oe&&78==r&&"c"==i)return function(e){if(!s7||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;at(e,n,"true"),setTimeout(()=>at(e,n,"false"),20)}return!1}(e)||o8(e,1,i)||o4(e,1);else if(i==(oe?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():ag(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,sY(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},ah.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},ah.keypress=(e,t)=>{if(aT(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||oe&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof sv)||!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 aE=oe?"metaKey":"ctrlKey";ap.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let s=aC(e),o=Date.now(),a="singleClick";o-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[aE]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(ax(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ak(e,l,t,!!s)):("doubleClick"==a?function(e,t,n,r){return av(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return av(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&&(aw(e,sv.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),s=i.before(t);if(n.inlineContent)aw(e,sv.create(r,s+1,s+1+n.content.size),"pointer");else{if(!sE.isSelectable(n))continue;aw(e,sE.create(r,s),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():ag(e,"pointer"))};class ak{constructor(e,t,n,r){let i,s;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[aE],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const o=r?null:n.target,a=o?e.docView.nearestDesc(o,!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 sE&&l.from<=s&&l.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&s5&&!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)),ag(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(()=>oG(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(ax(e))),this.updateAllowDefault(e),this.allowDefault||!t)ag(this.view,"pointer");else{var n,r,i,s;(n=this.view,r=t.pos,i=t.inside,s=this.selectNode,av(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(s?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof sE&&(r=n.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(sE.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?s.before(n.$from.depth):s.before(e);break}}return null!=i&&(aw(e,sE.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&&sE.isSelectable(r))&&(aw(e,new sE(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||s7&&this.mightDrag&&!this.mightDrag.node.isAtom||s6&&!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)))?(aw(this.view,sg.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):ag(this.view,"pointer")}}move(e){this.updateAllowDefault(e),ag(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 aT(e,t){return!!e.composing||!!(s7&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}ap.touchstart=e=>{e.input.lastTouch=Date.now(),aC(e),ag(e,"pointer")},ap.touchmove=e=>{e.input.lastTouch=Date.now(),ag(e,"pointer")},ap.contextmenu=e=>aC(e);let aN=on?5e3:-1;function aA(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>aC(e),t))}function aS(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 aC(e,t=!1){if(!on||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),aS(e),t||e.docView&&e.docView.dirty){let n=oz(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}}ah.compositionstart=ah.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof sv&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||s6&&ot&&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(),aC(e,!0),e.markCursor=null;else if(aC(e,!t.selection.empty),s5&&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}aA(e,aN)},ah.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++,aA(e,20))};let a_=s2&&s3<15||s8&&oi<604;function aM(e,t,n,r,i){let s=ar(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,s||r6.empty)))return!0;if(!s)return!1;let o=0==s.openStart&&0==s.openEnd&&1==s.content.childCount?s.content.firstChild:null,a=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aO(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," "):""}ap.copy=ah.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=a_?null:t.clipboardData,{dom:s,text:o}=an(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",o)):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,s),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ah.paste=(e,t)=>{if(e.composing&&!on)return;let n=a_?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&aM(e,aO(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?aM(e,r.value,null,i,t):aM(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class aI{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let aD=oe?"altKey":"ctrlKey";function aR(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[aD]}for(let e in ap.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(ax(t));if(s&&s.pos>=i.from&&s.pos<=(i instanceof sE?i.to-1:i.to));else if(r&&r.mightDrag)n=sE.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=sE.create(e.state.doc,r.posBefore))}let o=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=an(e,o);t.dataTransfer.files.length&&s6&&!(s9>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(a_?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",a_||t.dataTransfer.setData("text/plain",l),e.dragging=new aI(c,aR(e,t),n)},ap.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},ah.dragover=ah.dragenter=(e,t)=>t.preventDefault(),ah.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(ax(t));if(!r)return;let i=e.state.doc.resolve(r.pos),s=n&&n.slice;s?e.someProp("transformPasted",t=>{s=t(s,e,!1)}):s=ar(e,aO(t.dataTransfer),a_?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&aR(e,t));if(e.someProp("handleDrop",n=>n(e,t,s||r6.empty,o)))return t.preventDefault();if(!s)return;t.preventDefault();let a=s?sn(e.state.doc,i.pos,s):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(o){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(u))return;let p=l.doc.resolve(c);if(d&&sE.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new sE(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(oQ(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},ap.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())&&oG(e)},20))},ap.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)},ap.beforeinput=(e,t)=>{if(s6&&on&&"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,sY(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)}},ah)ap[e]=ah[e];function aL(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 aj{constructor(e,t){this.toDOM=e,this.spec=t||aU,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new aF(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof aj&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&aL(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class aP{constructor(e,t){this.attrs=e,this.spec=t||aU}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new aF(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof aP&&aL(this.attrs,e.attrs)&&aL(this.spec,e.spec)}static is(e){return e.type instanceof aP}destroy(){}}class aB{constructor(e,t){this.attrs=e,this.spec=t||aU}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new aF(i.pos-n,s.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 aB&&aL(this.attrs,e.attrs)&&aL(this.spec,e.spec)}destroy(){}}class aF{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new aF(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 aF(e,e,new aj(t,n))}static inline(e,t,n,r){return new aF(e,t,new aP(n,r))}static node(e,t,n,r){return new aF(e,t,new aB(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof aP}get widget(){return this.type instanceof aj}}let aH=[],aU={};class az{constructor(e,t){this.local=e.length?e:aH,this.children=t.length?t:aH}static create(e,t){return t.length?aK(t,e,0,aU):a$}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 s=0;s<this.local.length;s++){let o=this.local[s];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==a$||0==e.maps.length?this:this.mapInner(e,t,0,0,n||aU)}mapInner(e,t,n,r,i){let s;for(let o=0;o<this.local.length;o++){let a=this.local[o].map(e,n,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,n,r,i,s,o){let a=e.slice();for(let e=0,t=s;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,s)=>{let o=s-i-(n-e);for(let i=0;i<a.length;i+=3){let s=a[i+1];if(s<0||e>s+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&o&&(a[i]+=o,a[i+1]+=o)}r+=o}),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]+s),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+s,-1)-i,{index:p,offset:h}=r.content.findIndex(d),f=r.maybeChild(p);if(f&&h==d&&h+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+s+1,o);r!=a$?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=aK(function(e,t,n,r,i,s,o){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,s){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,s);a?n.push(a):o.onRemove&&o.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+s+1)}(e[a+2],t[a]+s+1);return n}(a,e,t,n,i,s,o),r,0,o);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 az(t.sort(aY),a)}(this.children,s||[],e,t,n,r,i):s?new az(s.sort(aY),aH):a$}add(e,t){return t.length?this==a$?az.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,s)=>{let o=s+n,a;if(a=aV(t,e,o)){for(r||(r=this.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(e,a,o+1):r.splice(i,0,s,s+e.nodeSize,aK(a,e,o+1,aU)),i+=3}});let s=aq(i?aW(t):t,-n);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||s.splice(t--,1);return new az(s.length?this.local.concat(s).sort(aY):this.local,r||this.children)}remove(e){return 0==e.length||this==a$?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,s=n[r]+t,o=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>s&&n.to<o&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,s+1);a!=a$?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 az(r,n):a$}forChild(e,t){let n,r;if(this==a$)return this;if(t.isLeaf)return az.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,s=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<s&&t.to>i&&t.type instanceof aP){let e=Math.max(i,t.from)-i,n=Math.min(s,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new az(r.sort(aY),aH);return n?new aG([e,n]):e}return n||a$}eq(e){if(this==e)return!0;if(!(e instanceof az)||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 aX(this.localsInner(e))}localsInner(e){if(this==a$)return aH;if(e.inlineContent||!this.local.some(aP.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof aP||t.push(this.local[e]);return t}forEachSet(e){e(this)}}az.empty=new az([],[]),az.removeOverlap=aX;let a$=az.empty;class aG{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,aU));return aG.from(n)}forChild(e,t){if(t.isLeaf)return az.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=a$&&(i instanceof aG?n=n.concat(i.members):n.push(i))}return aG.from(n)}eq(e){if(!(e instanceof aG)||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?aX(n?t:t.sort(aY)):aH}static from(e){switch(e.length){case 0:return a$;case 1:return e[0];default:return new aG(e.every(e=>e instanceof az)?e:e.reduce((e,t)=>e.concat(t instanceof az?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function aq(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 aF(i.from+t,i.to+t,i.type))}return n}function aV(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,s;t<e.length;t++)(s=e[t])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),e[t]=null);return i}function aW(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function aK(e,t,n,r){let i=[],s=!1;t.forEach((t,o)=>{let a=aV(e,t,o+n);if(a){s=!0;let e=aK(a,t,n+o+1,r);e!=a$&&i.push(o,o+t.nodeSize,e)}});let o=aq(s?aW(e):e,-n).sort(aY);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new az(o,i):a$}function aY(e,t){return e.from-t.from||e.to-t.to}function aX(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 s=t[i];if(s.from==r.from){s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),aQ(t,i+1,s.copy(r.to,s.to)));continue}s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),aQ(t,i,r.copy(s.from,r.to)));break}}return t}function aQ(e,t,n){for(;t<e.length&&aY(n,e[t])>0;)t++;e.splice(t,0,n)}function aJ(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=a$&&t.push(r)}),e.cursorWrapper&&t.push(az.create(e.state.doc,[e.cursorWrapper.deco])),aG.from(t)}let aZ={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},a0=s2&&s3<=11;class a1{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 a2{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new a1,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]);s2&&s3<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():s7&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),a0&&(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,aZ)),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(oJ(this.view)){if(this.suppressingSelectionUpdates)return oG(this.view);if(s2&&s3<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&s$(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=sF(n))t.add(n);for(let r=e.anchorNode;r;r=sF(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)&&oJ(t)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(s=s<0?t.from:Math.min(t.from,s),o=o<0?t.to:Math.max(t.to,o),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(s5&&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;s<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&sK(r)&&(c=oz(t))&&c.eq(sg.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,oG(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||i)&&(s>-1&&(t.docView.markDirty(s,o),e=t,!a3.has(e)&&(a3.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=s5,a5||(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."),a5=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let s of t)if((null==(n=s.parentNode)?void 0:n.nodeName)=="TR"){let t=s.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(s,n.firstChild),r==s&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}(t,l)),this.handleDOMChange(s,o,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||oG(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(s2&&s3<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:s}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!s||0>Array.prototype.indexOf.call(e.addedNodes,s))&&(i=s)}let s=r&&r.parentNode==e.target?sB(r)+1:0,o=n.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?sB(i):e.target.childNodes.length;return{from:o,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 a3=new WeakMap,a5=!1;function a4(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return s$(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function a6(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(s7&&/^(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||s7&&/^(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 a9=/^(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 a7(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:oQ(e,t.resolve(n.anchor),t.resolve(n.head))}function a8(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 le(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 lt{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 am,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(lo),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=li(this),lr(this),this.nodeViews=ls(this),this.docView=oC(this.state.doc,ln(this),aJ(this),this.dom,this),this.domObserver=new a2(this,(e,t,n,r)=>(function(e,t,n,r,i){let s,o,a,l=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=oz(e,t);if(n&&!e.state.selection.eq(n)){if(s6&&on&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,sY(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),l&&r.setMeta("composition",l),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let u=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:o,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}],sK(c)||r.push({node:c.focusNode,offset:c.focusOffset})),s6&&8===e.input.lastKeyCode)for(let e=o;e>s;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){o=e;break}if(!n||n.size)break}let u=e.state.doc,p=e.someProp("domParser")||iC.fromSchema(e.state.schema),h=u.resolve(a),f=null,m=p.parse(i,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:o,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:a6,context:h});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),h=e.state.doc,f=h.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,o="end"):(s=e.state.selection.from,o="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let s=e.findDiffStart(t,n);if(null==s)return null;let{a:o,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,s-Math.min(o,a));r-=o+e-s}if(o<s&&e.size<t.size){let e=r<=s&&r>=o?s-r:0;(s-=e)&&s<t.size&&le(t.textBetween(s-1,s+1))&&(s+=e?1:-1),a=s+(a-o),o=s}else if(a<s){let t=r<=s&&r>=a?s-r:0;(s-=t)&&s<e.size&&le(e.textBetween(s-1,s+1))&&(s+=t?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}(f.content,p.doc.content,p.from,s,o);if(m&&e.input.domChangeCount++,(s8&&e.input.lastIOSEnter>Date.now()-225||on)&&i.some(e=>1==e.nodeType&&!a9.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,sY(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&u instanceof sv&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))m={start:u.from,endA:u.to,endB:u.to};else{if(p.sel){let t=a7(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);l&&n.setMeta("composition",l),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof sv&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),s2&&s3<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>p.from&&"  "==p.doc.textBetween(m.start-p.from-1,m.start-p.from+1)&&(m.start--,m.endA--,m.endB--);let g=p.doc.resolveNoCache(m.start-p.from),b=p.doc.resolveNoCache(m.endB-p.from),y=h.resolve(m.start),x=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA;if((s8&&e.input.lastIOSEnter>Date.now()-225&&(!x||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!x&&g.pos<p.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(p.doc.textBetween(g.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,sY(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||a8(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!r.parent.isTextblock){let e=s.nodeAfter;return null!=e&&n==t+e.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=e.resolve(a8(s,!0,!0));return!(!o.parent.isTextblock||o.pos>n||a8(o,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(o.parent.content)}(h,m.start,m.endA,g,b)&&e.someProp("handleKeyDown",t=>t(e,sY(8,"Backspace")))){on&&s6&&e.domObserver.suppressSelectionUpdates();return}s6&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),on&&!x&&g.start()!=b.start()&&0==b.parentOffset&&g.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==m.endA&&(m.endB-=2,b=p.doc.resolveNoCache(m.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,sY(13,"Enter"))})},20));let v=m.start,w=m.endA,E=t=>{let n=t||e.state.tr.replace(v,w,p.doc.slice(m.start-p.from,m.endB-p.from));if(p.sel){let t=a7(e,n.doc,p.sel);t&&!(s6&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==v||t.head==n.mapping.map(w)-1)||s2&&t.empty&&t.head==v)&&n.setSelection(t)}return l&&n.setMeta("composition",l),n.scrollIntoView()};if(x)if(g.pos==b.pos){s2&&s3<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>oG(e),20));let t=E(e.state.tr.delete(v,w)),n=h.resolve(m.start).marksAcross(h.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(a=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,s=r,o,a,l;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);if(1==i.length&&0==s.length)a=i[0],o="add",l=e=>e.mark(a.addToSet(e.marks));else{if(0!=i.length||1!=s.length)return null;a=s[0],o="remove",l=e=>e.mark(a.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(l(t.child(e)));if(r0.from(c).eq(e))return{mark:a,type:o}}(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let t=E(e.state.tr);"add"==a.type?t.addMark(v,w,a.mark):t.removeMark(v,w,a.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-!b.textOffset){let t=g.parent.textBetween(g.parentOffset,b.parentOffset),n=()=>E(e.state.tr.insertText(t,v,w));e.someProp("handleTextInput",r=>r(e,v,w,t,n))||e.dispatch(n())}else e.dispatch(E());else e.dispatch(E())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in ap){let n=ap[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)||ay(e,t)||!e.editable&&t.type in ah||n(e,t)},af[t]?{passive:!0}:void 0)}s7&&e.dom.addEventListener("input",()=>null),ab(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&&ab(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lo),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 s=this.state,o=!1,a=!1;e.storedMarks&&this.composing&&(aS(this),a=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ls(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,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ab(this),this.editable=li(this),lr(this);let c=aJ(this),d=ln(this),u=s.plugins==e.plugins||s.doc.eq(e.doc)?e.scrollToSelection>s.scrollToSelection?"to selection":"preserve":"reset",p=o||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(s.selection))&&(a=!0);let h="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 s=(r.left+r.right)/2,o=i+1;o<Math.min(innerHeight,r.bottom);o+=5){let r=e.root.elementFromPoint(s,o);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:ol(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=p&&(s2||s6)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&(r=s.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(p){let t=s6?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=sV(e=e.childNodes[t-1])}else{if(!e.parentNode||sW(e))return null;t=sB(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||sW(e))return null;t=sB(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)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=oC(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(),s$(t.node,t.offset,n.anchorNode,n.anchorOffset)))?oG(this,l):(oY(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),(null==(n=this.dragging)?void 0:n.node)&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;oc(n,0==r?0:r-t)}(h)}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 sE){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&oa(this,t.getBoundingClientRect(),e)}else oa(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 aI(e.slice,e.move,r<0?void 0:sE.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 s=i[n].props[e];if(null!=s&&(r=t?t(s):s))return r}}hasFocus(){if(s2){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(od)return e.focus(od);let t=ol(e);e.focus(null==od?{get preventScroll(){return od={preventScroll:!0},!0}}:void 0),od||(od=!1,oc(t,0))}(this.dom),oG(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,s=e.dom.ownerDocument,o,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(sV(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(sV(r.startContainer),r.startOffset)}}}(s,t.left,t.top);l&&({node:o,offset:a}=l);let c=(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!ou(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let s=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),o=s;;){let r=t.childNodes[o];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let s=t[i];if(ou(n,s))return e(r,n,s)}}if((o=(o+1)%i)==s)break}return t}(e.dom,t,n)))return null}if(s7)for(let e=c;o&&e;e=sF(e))e.draggable&&(o=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,o){let n;if(s5&&1==o.nodeType&&(a=Math.min(a,o.childNodes.length))<o.childNodes.length){let e=o.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}or&&a&&1==o.nodeType&&1==(n=o.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,o==e.dom&&a==o.childNodes.length-1&&1==o.lastChild.nodeType&&t.top>o.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=o.nodeType||"BR"!=o.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,s=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!s&&o.left>r.left||o.top>r.top?i=t.posBefore:(!s&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),s=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,o,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,s,o=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=sU(e).getClientRects()}for(let p=0;p<t.length;p++){let h=t[p];if(h.top<=c&&h.bottom>=d){c=Math.max(h.bottom,c),d=Math.min(h.top,d);let t=h.left>n.left?h.left-n.left:h.right<n.left?n.left-h.right:0;if(t<o){s=e,o=t,a=t&&3==s.nodeType?{left:h.right<n.left?h.right:h.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(h.left+h.right)/2));continue}}else h.top>n.top&&!r&&h.left<=n.left&&h.right>=n.left&&(r=e,i={left:Math.max(h.left,Math.min(h.right,n.left)),top:h.top});!s&&(n.left>=h.right&&n.top>=h.top||n.left>=h.left&&n.top>=h.bottom)&&(l=u+1)}}return(!s&&r&&(s=r,a=i,o=0),s&&3==s.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let n=oh(r,1);if(n.top!=n.bottom&&ou(t,n)){i={node:e,offset:s+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(s,a):!s||o&&1==s.nodeType?{node:t,offset:l}:e(s,a)}(t,n),s=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();s=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}(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 om(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 ov==t&&ow==n?oE:(ov=t,ow=n,oE="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,oy(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=om(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=sU(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,s=i==r.parent.content.size,o=e.domSelection();return o?ox.test(r.parent.textContent)&&o.modify?oy(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:a}=e.domSelectionRange(),l=o.caretBidiLevel;o.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),p=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{o.collapse(s,a),t&&(t!=s||i!=a)&&o.extend&&o.extend(t,i)}catch(e){}return null!=l&&(o.caretBidiLevel=l),p}):"left"==n||"backward"==n?!i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return aM(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return aM(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return an(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,[],aJ(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,sz()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!ay(this,e)&&ap[e.type]&&(this.editable||!(e.type in ah))&&ap[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?s7&&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 a4(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?a4(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ln(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"),[aF.node(0,e.state.doc.content.size,t)]}function lr(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:aF.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function li(e){return!e.someProp("editable",t=>!1===t(e.state))}function ls(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 lo(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")}lt.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var la={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:"'"},ll={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},lc="u">typeof navigator&&/Mac/.test(navigator.platform),ld="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),lu=0;lu<10;lu++)la[48+lu]=la[96+lu]=String(lu);for(var lu=1;lu<=24;lu++)la[lu+111]="F"+lu;for(var lu=65;lu<=90;lu++)la[lu]=String.fromCharCode(lu+32),ll[lu]=String.fromCharCode(lu);for(var lp in la)ll.hasOwnProperty(lp)||(ll[lp]=la[lp]);let lh="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lf="u">typeof navigator&&/Win/.test(navigator.platform);function lm(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 lg(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let e=0;e<s.length-1;e++){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))r=!0;else if(/^mod$/i.test(o))lh?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+o)}return t&&(o="Alt-"+o),n&&(o="Ctrl-"+o),i&&(o="Meta-"+o),r&&(o="Shift-"+o),o}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(lc&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ld&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?ll:la)[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),s,o=t[lm(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[lm(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(lf&&n.ctrlKey&&n.altKey)&&(s=la[n.keyCode])&&s!=i){let r=t[lm(s,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}if("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 lb=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,s=r+1,o=i+1;for(let e=1;s<this.width&&this.map[t+e]==n;e++)s++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:s,bottom:o}}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:s,bottom:o}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?0==s:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:s}=this.findCell(e),{left:o,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(s,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 s=r*this.width+i,o=this.map[s];!n[o]&&(n[o]=!0,i==e.left&&i&&this.map[s-1]==o||r==e.top&&r&&this.map[s-this.width]==o||t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let s=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?s-1:this.map[n]}i=s}}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),s=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&&(s+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);s+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=s:t!=s&&(t=Math.max(t,s))}return t}(e),n=e.childCount,r=[],i=0,s=null,o=[];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:p,colwidth:h}=d.attrs;for(let e=0;e<p;e++){if(e+a>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:l,n:p-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(s||(s=[])).push({type:"collision",row:a,pos:l,n:u-e});let n=h&&h[e];if(n){let r=(c+e)%t*2,i=o[r];null==i||i!=n&&1==o[r+1]?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=u,l+=d.nodeSize}let d=(a+1)*t,u=0;for(;i<d;)0==r[i++]&&u++;u&&(s||(s=[])).push({type:"missing",row:a,n:u}),l++}(0===t||0===n)&&(s||(s=[])).push({type:"zero_sized"});let a=new lb(t,n,r,s),l=!1;for(let e=0;!l&&e<o.length;e+=2)null!=o[e]&&o[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 s=e.map[i];if(r[s])continue;r[s]=!0;let o=n.nodeAt(s);if(!o)throw RangeError(`No cell with offset ${s} found`);let a=null,l=o.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:s,colwidth:a})}}(a,o,e),a}(e))}};function ly(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 lx=new sP("selectingCells");function lv(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 lw(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 lE(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=lv(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 lk(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function lT(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function lN(e,t,n){let r=e.node(-1),i=lb.get(r),s=e.start(-1),o=i.nextCell(e.pos-s,t,n);return null==o?null:e.node(0).resolve(s+o)}function lA(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 lS(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 lC=class e extends sg{constructor(e,t=e){const n=e.node(-1),r=lb.get(n),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),a=r.cellsInRect(s).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 sb(o.resolve(r),o.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(lk(r)&&lk(i)&&lT(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 sv.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=lb.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},s=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let s=n*t.width+r.left,a=r.left;a<r.right;a++,s++){let n=t.map[s];if(i[n])continue;i[n]=!0;let a=t.findCell(n),l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);let c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=lA(e,0,c)),d>0&&(e=lA(e,e.colspan-d,d)),a.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(a.top<r.top||a.bottom>r.bottom){let e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}o.push(l)}s.push(e.child(n).copy(r0.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:s;return new r6(r0.from(o),1,1)}replace(e,t=r6.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],a=e.mapping.slice(n);e.replace(a.map(s.pos),a.map(o.pos),i?r6.empty:t)}let i=sg.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new r6(r0.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=lb.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=lb.get(r),s=t.start(-1),o=i.findCell(t.pos-s),a=i.findCell(n.pos-s),l=t.node(0);return o.top<=a.top?(o.top>0&&(t=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=lb.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=lb.get(r),s=t.start(-1),o=i.findCell(t.pos-s),a=i.findCell(n.pos-s),l=t.node(0);return o.left<=a.left?(o.left>0&&(t=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(t=l.resolve(s+i.map[i.width*(o.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 l_(this.$anchorCell.pos,this.$headCell.pos)}};lC.prototype.visible=!1,sg.jsonID("cell",lC);var l_=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&&lT(t,n)?new lC(t,n):sg.near(n,1)}};function lM(e){if(!(e.selection instanceof lC))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(aF.node(n,n+e.nodeSize,{class:"selectedCell"}))}),az.create(e.doc,t)}let lO=new sP("fix-tables");function lI(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,s,o=lb.get(t);if(!o.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<o.height;e++)a.push(0);for(let e=0;e<o.problems.length;e++){let i=o.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let s=e.attrs;for(let e=0;e<s.rowspan;e++)a[i.row+e]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,lA(s,s.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),s=e);for(let l=0,c=n+1;l<o.height;l++){let n=t.child(l),o=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=ly(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==l||i==l-1)&&s==l?c+1:o-1;r.insert(r.mapping.map(u),a)}c=o}return r.setMeta(lO,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let s=t.childCount,o=n.childCount;n:for(let a=0,l=0;a<o;a++){let o=n.child(a);for(let e=l,n=Math.min(s,a+3);e<n;e++)if(t.child(e)==o){l=e+1,r+=o.nodeSize;continue n}i(o,r),l<s&&t.child(l).sameMarkup(o)?e(t.child(l),o,r+1,i):o.nodesBetween(0,o.content.size,i,r+1),r+=o.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function lD(e){let t=lb.get(e),n=[],r=t.height,i=t.width;for(let s=0;s<r;s++){let r=[];for(let n=0;n<i;n++){let o=s*i+n,a=t.map[o];if(s>0){let e=o-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=o-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function lR(e,t){let n=[],r=lb.get(e),i=r.height,s=r.width;for(let o=0;o<i;o++){let i=e.child(o),a=[];for(let n=0;n<s;n++){let i=t[o][n];if(!i)continue;let s=r.map[o*r.width+n],l=e.nodeAt(s);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 lL(e,t,n,r){let i,s=t[0]>n[0]?-1:1,o=e.splice(t[0],t.length),a=+(o.length%2==0);return i=-1===r&&1===s?n[0]-1:1===r&&-1===s?n[n.length-1]-a+1:-1===s?n[0]:n[n.length-1]-a,e.splice(i,0,...o),e}function lj(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 lP(e,t){let n=lj(t.$from);if(!n)return;let r=lb.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 lB(e,t){let n=lj(t.$from);if(!n)return;let r=lb.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 lF(e,t,n=t){let r,i=t,s=n;for(let n=t;n>=0;n--){let t=lP(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=i&&(i=n),t>s&&(s=t)})}for(let n=t;n<=s;n++){let t=lP(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>s&&(s=t)})}let o=[];for(let t=i;t<=s;t++){let n=lP(t,e.selection);n&&n.length>0&&o.push(t)}i=o[0],s=o[o.length-1];let a=lP(i,e.selection),l=lB(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=s;t>=i;t--){let n=lP(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:o}}function lH(e,t,n=t){let r,i=t,s=n;for(let n=t;n>=0;n--){let t=lB(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=i&&(i=n),t>s&&(s=t)})}for(let n=t;n<=s;n++){let t=lB(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>s&&(s=t)})}let o=[];for(let t=i;t<=s;t++){let n=lB(t,e.selection);n&&n.length>0&&o.push(t)}i=o[0],s=o[o.length-1];let a=lB(i,e.selection),l=lP(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=s;t>=i;t--){let n=lB(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:o}}function lU(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function lz(e){let t=e.selection,n=lE(e),r=n.node(-1),i=n.start(-1),s=lb.get(r);return{...t instanceof lC?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function l$(e,{map:t,tableStart:n,table:r},i){let s=i>0?-1:0;(function(e,t,n){let r=ly(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+s)&&(s=0==i||i==t.width?null:0);for(let o=0;o<t.height;o++){let a=o*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let s=t.map[a],l=r.nodeAt(s);e.setNodeMarkup(e.mapping.map(n+s),null,lS(l.attrs,i-t.colCount(s))),o+=l.attrs.rowspan-1}else{let l=null==s?ly(r.type.schema).cell:r.nodeAt(t.map[a+s]).type,c=t.positionAt(o,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function lG(e,{map:t,tableStart:n,table:r},i){let s=n;for(let e=0;e<i;e++)s+=r.child(e).nodeSize;let o=[],a=i>0?-1:0;(function(e,t,n){var r;let i=ly(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if((null==(r=t.nodeAt(e.map[s+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 s=0,c=t.width*i;s<t.width;s++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),s+=o.colspan-1}else{var l;let e=null==a?ly(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&&o.push(n)}return e.insert(s,ly(r.type.schema).row.create(null,o)),e}function lq(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function lV(e,t){let n=e.selection;if(!(n instanceof lC)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=lz(e),{map:i}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,s=i,o=(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[s]==n[s-1]||r.right<e&&n[a]==n[a+1])return!0;s+=e,a+=e}for(let s=r.left;s<r.right;s++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}(i,r))return!1;if(t){let n,s,o=e.tr,a={},l=r0.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let c=i.map[e*i.width+t],d=r.table.nodeAt(c);if(!a[c]&&d)if(a[c]=!0,null==n)n=c,s=d;else{lq(d)||(l=l.append(d.content));let e=o.mapping.map(c+r.tableStart);o.delete(e,e+d.nodeSize)}}if(null==n||null==s)return!0;if(o.setNodeMarkup(n+r.tableStart,null,{...lS(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let e=n+1+s.content.size,t=lq(s)?n+1:e;o.replaceWith(t+r.tableStart,e+r.tableStart,l)}o.setSelection(new lC(o.doc.resolve(n+r.tableStart))),t(o)}return!0}function lW(e,t){var n;let r=ly(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,s=e.selection;if(s instanceof lC){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;r=s.$anchorCell.nodeAfter,i=s.$anchorCell.pos}else{var o;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}(s.$from)))return!1;i=null==(o=lv(s.$from))?void 0:o.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let o,a=r.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=lz(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,s=0;i<d.right;i++,s++)(i!=d.left||e!=d.top)&&u.insert(o=u.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(l[s]))}u.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),l[0]),s instanceof lC&&u.setSelection(new lC(u.doc.resolve(s.$anchorCell.pos),o?u.doc.resolve(o):void 0)),t(u)}return!0})(e,t)}function lK(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 lY(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!lw(t))return!1;if(n){let r=ly(t.schema),i=lz(t),s=t.tr,o=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=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)a[e].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[e],r.cell,a[e].attrs);if(0===s.steps.length)for(let e=0;e<o.length;e++)s.setNodeMarkup(i.tableStart+o[e],r.header_cell,a[e].attrs);n(s)}return!0};return function(t,n){if(!lw(t))return!1;if(n){let r=ly(t.schema),i=lz(t),s=t.tr,o=lK("row",i,r),a=lK("column",i,r),l=+("column"===e?!!o:"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?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=s.doc.nodeAt(t);n&&s.setNodeMarkup(t,d,n.attrs)}),n(s)}return!0}}lY("row",{useDeprecatedLogic:!0}),lY("column",{useDeprecatedLogic:!0});let lX=lY("cell",{useDeprecatedLogic:!0});function lQ(e){return function(t,n){if(!lw(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}(lE(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(sv.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function lJ(e,t){let n=e.selection;if(!(n instanceof lC))return!1;if(t){let r=e.tr,i=ly(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 r6(i,0,0))}),r.docChanged&&t(r)}return!0}function lZ(e,t){let n=e.createAndFill();return new sf(n).replace(0,n.content.size,t).doc}function l0(e,t,n,r,i,s,o,a){if(0==o||o==t.height)return!1;let l=!1;for(let c=i;c<s;c++){let i=o*t.width+c,s=t.map[i];if(t.map[i-t.width]==s){l=!0;let i=n.nodeAt(s),{top:d,left:u}=t.findCell(s);e.setNodeMarkup(e.mapping.slice(a).map(s+r),null,{...i.attrs,rowspan:o-d}),e.insert(e.mapping.slice(a).map(t.positionAt(o,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-o})),c+=i.attrs.colspan-1}}return l}function l1(e,t,n,r,i,s,o,a){if(0==o||o==t.width)return!1;let l=!1;for(let c=i;c<s;c++){let i=c*t.width+o,s=t.map[i];if(t.map[i-1]==s){l=!0;let i=n.nodeAt(s),d=t.colCount(s),u=e.mapping.slice(a).map(s+r);e.setNodeMarkup(u,null,lA(i.attrs,o-d,i.attrs.colspan-(o-d))),e.insert(u+i.nodeSize,i.type.createAndFill(lA(i.attrs,0,o-d))),c+=i.attrs.rowspan-1}}return l}function l2(e,t,n,r,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw Error("No table found");let o=lb.get(s),{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=e.tr,p=0;function h(){if(!(s=n?u.doc.nodeAt(n-1):u.doc))throw Error("No table found");o=lb.get(s),p=u.mapping.maps.length}(function(e,t,n,r,i,s){let o,a,l=ly(e.doc.type.schema);if(i>t.width)for(let s=0,c=0;s<t.height;s++){let d,u=n.child(s);c+=u.nodeSize;let p=[];d=null==u.lastChild||u.lastChild.type==l.cell?o||(o=l.cell.createAndFill()):a||(a=l.header_cell.createAndFill());for(let e=t.width;e<i;e++)p.push(d);e.insert(e.mapping.slice(0).map(c-1+r),p)}if(s>t.height){let c=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;c.push(i?a||(a=l.header_cell.createAndFill()):o||(o=l.cell.createAndFill()))}let d=l.row.create(null,r0.from(c)),u=[];for(let e=t.height;e<s;e++)u.push(d);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),u)}return!!(o||a)})(u,o,s,n,c,d)&&h(),l0(u,o,s,n,l,c,a,p)&&h(),l0(u,o,s,n,l,c,d,p)&&h(),l1(u,o,s,n,a,d,l,p)&&h(),l1(u,o,s,n,a,d,c,p)&&h();for(let e=a;e<d;e++){let t=o.positionAt(e,l,s),r=o.positionAt(e,c,s);u.replace(u.mapping.slice(p).map(t+n),u.mapping.slice(p).map(r+n),new r6(i.rows[e-a],0,0))}h(),u.setSelection(new lC(u.doc.resolve(n+o.positionAt(a,l,s)),u.doc.resolve(n+o.positionAt(d-1,c-1,s)))),t(u)}let l3=lg({ArrowLeft:l4("horiz",-1),ArrowRight:l4("horiz",1),ArrowUp:l4("vert",-1),ArrowDown:l4("vert",1),"Shift-ArrowLeft":l6("horiz",-1),"Shift-ArrowRight":l6("horiz",1),"Shift-ArrowUp":l6("vert",-1),"Shift-ArrowDown":l6("vert",1),Backspace:lJ,"Mod-Backspace":lJ,Delete:lJ,"Mod-Delete":lJ});function l5(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function l4(e,t){return(n,r,i)=>{if(!i)return!1;let s=n.selection;if(s instanceof lC)return l5(n,r,sg.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;let o=ce(i,e,t);if(null==o)return!1;if("horiz"==e)return l5(n,r,sg.near(n.doc.resolve(s.head+t),t));{let i,s=n.doc.resolve(o),a=lN(s,e,t);return i=a?sg.near(a,1):t<0?sg.near(n.doc.resolve(s.before(-1)),-1):sg.near(n.doc.resolve(s.after(-1)),1),l5(n,r,i)}}}function l6(e,t){return(n,r,i)=>{let s;if(!i)return!1;let o=n.selection;if(o instanceof lC)s=o;else{let r=ce(i,e,t);if(null==r)return!1;s=new lC(n.doc.resolve(r))}let a=lN(s.$headCell,e,t);return!!a&&l5(n,r,new lC(s.$anchorCell,a))}}function l9(e,t){let n=lv(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new lC(n))),!0)}function l7(e,t,n){if(!lw(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if("row"==s)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,s=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(s||l)&&(i=lZ(ly(o).row,new r6(i,s,l)).content),a.push(i)}else{if("cell"!=s&&"header_cell"!=s)return null;a.push(n||r?lZ(ly(o).row,new r6(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:s}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+s}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(r0.empty),n[i]<r){let s=ly(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(s);t[i]=t[i].append(r0.from(o))}return{height:t.length,width:r,rows:t}}(o,a)}(n),i=e.state.selection;if(i instanceof lC){r||(r={width:1,height:1,rows:[r0.from(lZ(ly(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),o=lb.get(t).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let s=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let a=s.child(i%s.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(lA(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),o.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(r0.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,s=0;r<i;r++,s++){let o=[],a=n[s%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(r0.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}(r,o.right-o.left,o.bottom-o.top),l2(e.state,e.dispatch,s,o,r),!0}if(!r)return!1;{let t=lE(e.state),n=t.start(-1);return l2(e.state,e.dispatch,n,lb.get(t.node(-1)).findCell(t.pos-n),r),!0}}function l8(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=ct(e,t.target);if(t.shiftKey&&e.state.selection instanceof lC)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=lv(e.state.selection.$anchor))&&(null==(n=cn(e,t))?void 0:n.pos)!=r.pos)s(r,t),t.preventDefault();else if(!i)return;function s(t,n){let r=cn(e,n),i=null==lx.getState(e.state);if(!r||!lT(t,r))if(!i)return;else r=t;let s=new lC(t,r);if(i||!e.state.selection.eq(s)){let n=e.state.tr.setSelection(s);i&&n.setMeta(lx,t.pos),e.dispatch(n)}}function o(){e.root.removeEventListener("mouseup",o),e.root.removeEventListener("dragstart",o),e.root.removeEventListener("mousemove",a),null!=lx.getState(e.state)&&e.dispatch(e.state.tr.setMeta(lx,-1))}function a(n){let r,a=lx.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(ct(e,n.target)!=i&&!(r=cn(e,t)))return o();r&&s(r,n)}e.root.addEventListener("mouseup",o),e.root.addEventListener("dragstart",o),e.root.addEventListener("mousemove",a)}function ce(e,t,n){if(!(e.state.selection instanceof sv))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))break;if("cell"==s.type.spec.tableRole||"header_cell"==s.type.spec.tableRole){let s=r.before(i),o="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(o)?s:null}}return null}function ct(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function cn(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&&lv(e.state.doc.resolve(r))||lv(e.state.doc.resolve(i))}var cr=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")),ci(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,ci(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function ci(e,t,n,r,i,s){let o=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?s:u&&u[e],d=c?c+"px":"";if(o+=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=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}let cs=new sP("tableColumnResizing");var co=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(cs);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 lk(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function ca(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:s}=i,o=lv(e.state.doc.resolve(s));if(!o)return -1;if("right"==n)return o.pos;let a=lb.get(o.node(-1)),l=o.start(-1),c=a.map.indexOf(o.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function cl(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function cc(e,t){e.dispatch(e.state.tr.setMeta(cs,{setHandle:t}))}function cd(e,t,n,r){let i=e.state.doc.resolve(t),s=i.node(-1),o=i.start(-1),a=lb.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&ci(s,l.firstChild,l,r,a,n)}e.i(335884);var cu=Q,cp=e.i(3909);let ch=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function cf(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let cm=(e,t,n)=>{let r=cf(e,n);if(!r)return!1;let i=cx(r);if(!i){let n=r.blockRange(),i=n&&i3(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let s=i.nodeBefore;if(c_(e,i,t,-1))return!0;if(0==r.parent.content.size&&(cb(s,"end")||sE.isSelectable(s)))for(let n=r.depth;;n--){let o=sr(e.doc,r.before(n),r.after(n),r6.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(cb(s,"end")?sg.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):sE.create(n.doc,i.pos-s.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!s.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0)};function cg(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 s=t.nodeAfter,o=t.pos+1;for(;!s.isTextblock;o++){if(s.type.spec.isolating)return!1;let e=s.firstChild;if(!e)return!1;s=e}let a=sr(e.doc,i,o,r6.empty);if(!a||a.from!=i||a instanceof iZ&&a.slice.size>=o-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(sv.create(t.doc,i)),n(t.scrollIntoView())}return!0}function cb(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 cy=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=cx(r)}let o=s&&s.nodeBefore;return!!o&&!!sE.isSelectable(o)&&(t&&t(e.tr.setSelection(sE.create(e.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function cx(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 cv(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let cw=(e,t,n)=>{let r=cv(e,n);if(!r)return!1;let i=ck(r);if(!i)return!1;let s=i.nodeAfter;if(c_(e,i,t,1))return!0;if(0==r.parent.content.size&&(cb(s,"start")||sE.isSelectable(s))){let n=sr(e.doc,r.before(),r.after(),r6.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cb(s,"start")?sg.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):sE.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!s.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0)},cE=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=ck(r)}let o=s&&s.nodeAfter;return!!o&&!!sE.isSelectable(o)&&(t&&t(e.tr.setSelection(sE.create(e.doc,s.pos)).scrollIntoView()),!0)};function ck(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 cT=(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 cN(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 cA=(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),s=n.indexAfter(-1),o=cN(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(sg.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},cS=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof sT||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=cN(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,s.createAndFill());o.setSelection(sv.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},cC=(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(i7(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&i3(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function c_(e,t,n,r){let i,s,o,a=t.nodeBefore,l=t.nodeAfter,c,d,u=a.type.spec.isolating||l.type.spec.isolating;if(!u&&(i=t.nodeBefore,s=t.nodeAfter,o=t.index(),i&&s&&i.type.compatibleContent(s.type)&&(!i.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(o,o+1)&&!!(s.isTextblock||i8(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let p=!u&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(c=(d=a.contentMatchAt(a.childCount)).findWrapping(l.type))&&d.matchType(c[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=r0.empty;for(let e=c.length-1;e>=0;e--)i=r0.from(c[e].create(null,i));i=r0.from(a.copy(i));let s=e.tr.step(new i0(t.pos-1,r,t.pos,r,new r6(i,1,0),c.length,!0)),o=s.doc.resolve(r+2*c.length);o.nodeAfter&&o.nodeAfter.type==a.type&&i8(s.doc,o.pos)&&s.join(o.pos),n(s.scrollIntoView())}return!0}let h=l.type.spec.isolating||r>0&&u?null:sg.findFrom(t,1),f=h&&h.$from.blockRange(h.$to),m=f&&i3(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(p&&cb(l,"start",!0)&&cb(a,"end")){let r=a,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let s=l,o=1;for(;!s.isTextblock;s=s.firstChild)o++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=r0.empty;for(let e=i.length-1;e>=0;e--)r=r0.from(i[e].copy(r));n(e.tr.step(new i0(t.pos-i.length,t.pos+l.nodeSize,t.pos+o,t.pos+l.nodeSize-o,new r6(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cM(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(sv.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}let cO=cM(-1),cI=cM(1);function cD(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(s,o,(r,s)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(s),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:s},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(s,o,e,t)}r(i.scrollIntoView())}return!0}}function cR(...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 cL=cR(ch,cm,cy),cj=cR(ch,cw,cE),cP={Enter:cR(cT,cS,cC,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof sE&&e.selection.node.isBlock)return!!n.parentOffset&&!!i7(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],s,o,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),o=cN(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&o?{type:o}:null)),s=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof sv||e.selection instanceof sT)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=i7(c.doc,d,i.length,i);if(u||(i[0]=o?{type:o}:null,u=i7(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(s).type!=o){let e=c.mapping.map(n.before(s)),t=c.doc.resolve(e);o&&n.node(s-1).canReplaceWith(t.index(),t.index()+1,o)&&c.setNodeMarkup(c.mapping.map(n.before(s)),o)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":cA,Backspace:cL,"Mod-Backspace":cL,"Shift-Backspace":cL,Delete:cj,"Mod-Delete":cj,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new sT(e.doc))),!0)},cB={"Ctrl-h":cP.Backspace,"Alt-Backspace":cP["Mod-Backspace"],"Ctrl-d":cP.Delete,"Ctrl-Alt-Backspace":cP["Mod-Delete"],"Alt-Delete":cP["Mod-Delete"],"Alt-d":cP["Mod-Delete"],"Ctrl-a":cO,"Ctrl-e":cI};for(let e in cP)cB[e]=cP[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();var cF=Object.defineProperty,cH=(e,t)=>{for(var n in t)cF(e,n,{get:t[n],enumerable:!0})};function cU(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var cz=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,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(s);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:s}=r,o=[],a=!!e,l=e||i.tr,c=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(l),o.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 o.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:s}=r,o={tr:e,editor:r,view:s,state:cU({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)(o)]))}};return o}},c$={};cH(c$,{blur:()=>cG,clearContent:()=>cq,clearNodes:()=>cV,command:()=>cW,createParagraphNear:()=>cK,cut:()=>cY,deleteCurrentNode:()=>cX,deleteNode:()=>cJ,deleteRange:()=>cZ,deleteSelection:()=>c1,enter:()=>c2,exitCode:()=>c3,extendMarkRange:()=>de,first:()=>dt,focus:()=>dl,forEach:()=>dc,insertContent:()=>dd,insertContentAt:()=>df,joinBackward:()=>db,joinDown:()=>dg,joinForward:()=>dy,joinItemBackward:()=>dx,joinItemForward:()=>dv,joinTextblockBackward:()=>dw,joinTextblockForward:()=>dE,joinUp:()=>dm,keyboardShortcut:()=>dT,lift:()=>dA,liftEmptyBlock:()=>dS,liftListItem:()=>dC,newlineInCode:()=>d_,resetAttributes:()=>dI,scrollIntoView:()=>dD,selectAll:()=>dR,selectNodeBackward:()=>dL,selectNodeForward:()=>dj,selectParentNode:()=>dP,selectTextblockEnd:()=>dB,selectTextblockStart:()=>dF,setContent:()=>dU,setMark:()=>um,setMeta:()=>ug,setNode:()=>ub,setNodeSelection:()=>uy,setTextDirection:()=>ux,setTextSelection:()=>uv,sinkListItem:()=>uw,splitBlock:()=>uk,splitListItem:()=>uT,toggleList:()=>uS,toggleMark:()=>uC,toggleNode:()=>u_,toggleWrap:()=>uM,undoInputRule:()=>uO,unsetAllMarks:()=>uI,unsetMark:()=>uD,unsetTextDirection:()=>uR,updateAttributes:()=>uL,wrapIn:()=>uj,wrapInList:()=>uP});var cG=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),cq=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),cV=()=>({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,s=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),a=s.blockRange(o);if(!a)return;let l=i3(a);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},cW=e=>t=>e(t),cK=()=>({state:e,dispatch:t})=>cS(e,t),cY=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,s=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,s.content),r.setSelection(new sv(r.doc.resolve(Math.max(o-1,0)))),!0},cX=()=>({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 cQ(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 cJ=e=>({tr:t,state:n,dispatch:r})=>{let i=cQ(e,n.schema),s=t.selection.$anchor;for(let e=s.depth;e>0;e-=1)if(s.node(e).type===i){if(r){let n=s.before(e),r=s.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},cZ=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},c0=(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},c1=()=>({state:e,dispatch:t})=>{var n;let{$from:r,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:s,to:o}={from:c0(r,n=e.schema,"left"),to:c0(i,n,"right")};return t&&(e.tr.deleteRange(s,o).scrollIntoView(),t(e.tr)),!0},c2=()=>({commands:e})=>e.keyboardShortcut("Enter"),c3=()=>({state:e,dispatch:t})=>cA(e,t);function c5(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function c4(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:c5(t[r])?t[r].test(e[r]):t[r]===e[r])}function c6(e,t,n={}){return e.find(e=>e.type===t&&c4(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function c9(e,t,n={}){return!!c6(e,t,n)}function c7(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(!c6([...r.node.marks],t,n))return;let i=r.index,s=e.start()+r.offset,o=i+1,a=s+r.node.nodeSize;for(;i>0&&c9([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&c9([...e.parent.child(o).marks],t,n);)a+=e.parent.child(o).nodeSize,o+=1;return{from:s,to:a}}function c8(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 de=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=c8(e,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let e=c7(l,s,t);if(e&&e.from<=c&&e.to>=d){let t=sv.create(o,e.from,e.to);n.setSelection(t)}}return!0},dt=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 dn(e){return e instanceof sv}function dr(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function di(e,t=null){if(!t)return null;let n=sg.atStart(e),r=sg.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,s=r.to;return"all"===t?sv.create(e,dr(0,i,s),dr(e.content.size,i,s)):sv.create(e,dr(t,i,s),dr(t,i,s))}function ds(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function da(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var dl=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:s})=>{t={scrollIntoView:!0,...t};let o=()=>{(da()||ds())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!da()&&!ds()&&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(s&&null===e&&!dn(n.state.selection))return o(),!0;let a=di(i.doc,e)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},dc=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),dd=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),du=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&&du(r)}return e};function dp(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 du(new window.DOMParser().parseFromString(t,"text/html").body)}function dh(e,t,n){if(e instanceof id||e instanceof r0)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return r0.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),dh("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",s=new iA({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?iC.fromSchema(s).parseSlice(dp(e),n.parseOptions):iC.fromSchema(s).parse(dp(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=iC.fromSchema(t);return n.slice?r.parseSlice(dp(e),n.parseOptions).content:r.parse(dp(e),n.parseOptions)}return dh("",t,n)}var df=(e,t,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){let i,a;n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l=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)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{dh(t,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){l(e)}try{i=dh(t,s.schema,{parseOptions:c,errorOnInvalidContent:null!=(o=n.errorOnInvalidContent)?o:s.options.enableContentCheck})}catch(e){return l(e),!1}let{from:d,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,h=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),d===u&&h){let{parent:e}=r.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,u+=1)}if(p){if(Array.isArray(t))a=t.map(e=>e.text||"").join("");else if(t instanceof r0){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),a=e}else a="object"==typeof t&&t&&t.text?t.text:t;r.insertText(a,d,u)}else{a=i;let e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,s=t.isText||t.isTextblock,o=t.content.size>0;n&&s&&o&&h&&(d=Math.max(0,d-1)),r.replaceWith(d,u,a)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof iZ||r instanceof i0))return;let i=e.mapping.maps[n],s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(sg.near(e.doc.resolve(s),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:a}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:a})}return!0},dm=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof sE,i;if(r){if(n.node.isTextblock||!i8(e.doc,n.from))return!1;i=n.from}else if(null==(i=st(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(sE.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),dg=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof sE){if(n.node.isTextblock||!i8(e.doc,n.to))return!1;r=n.to}else if(null==(r=st(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),db=()=>({state:e,dispatch:t})=>cm(e,t),dy=()=>({state:e,dispatch:t})=>cw(e,t),dx=()=>({state:e,dispatch:t,tr:n})=>{try{let r=st(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dv=()=>({state:e,dispatch:t,tr:n})=>{try{let r=st(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dw=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=cf(e,n);if(!r)return!1;let i=cx(r);return!!i&&cg(e,i,t)})(e,t),dE=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=cv(e,n);if(!r)return!1;let i=ck(r);return!!i&&cg(e,i,t)})(e,t);function dk(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var dT=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let s=(function(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"===o&&(o=" ");for(let e=0;e<s.length-1;e+=1){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))r=!0;else if(/^mod$/i.test(o))da()||dk()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${o}`)}return t&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),i&&(o=`Meta-${o}`),r&&(o=`Shift-${o}`),o})(e).split(/-(?!$)/),o=s.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.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 dN(e,t,n={}){let{from:r,to:i,empty:s}=e.selection,o=t?cQ(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),s=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:s})});let l=i-r,c=a.filter(e=>!o||o.name===e.node.type.name).filter(e=>c4(e.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var dA=(e,t={})=>({state:n,dispatch:r})=>{let i=cQ(e,n.schema);return!!dN(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),s=i&&i3(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)})(n,r)},dS=()=>({state:e,dispatch:t})=>cC(e,t),dC=e=>({state:t,dispatch:n})=>{var r;return(r=cQ(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!s&&(!t||(n.node(s.depth-1).type==r?function(e,t,n,r){let i=e.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new i0(s-1,o,s,o,new r6(r0.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new il(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let a=i3(r);if(null==a)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return i8(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}(e,t,r,s):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,s=n.startIndex;t>s;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+ +!a,d+1,o.content.append(l?r0.empty:r0.from(i))))return!1;let u=s.pos,p=u+o.nodeSize;return r.step(new i0(u-!!a,p+ +!!l,u+1,p-1,new r6((a?r0.empty:r0.from(i.copy(r0.empty))).append(l?r0.empty:r0.from(i.copy(r0.empty))),+!a,+!l),+!a)),t(r.scrollIntoView()),!0}(e,t,s)))})(t,n)},d_=()=>({state:e,dispatch:t})=>cT(e,t);function dM(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function dO(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 dI=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null,a=dM("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(s=cQ(e,r.schema)),"mark"===a&&(o=c8(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{s&&s===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,dO(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(s=>{o===s.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,o.create(dO(s.attrs,t))))})})}),l},dD=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),dR=()=>({tr:e,dispatch:t})=>{if(t){let t=new sT(e.doc);e.setSelection(t)}return!0},dL=()=>({state:e,dispatch:t})=>cy(e,t),dj=()=>({state:e,dispatch:t})=>cE(e,t),dP=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,s=n.sharedDepth(r);return 0!=s&&(i=n.before(s),t&&t(e.tr.setSelection(sE.create(e.doc,i))),!0)})(e,t),dB=()=>({state:e,dispatch:t})=>cI(e,t),dF=()=>({state:e,dispatch:t})=>cO(e,t);function dH(e,t,n={},r={}){return dh(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var dU=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{let{doc:l}=s;if("full"!==r.preserveWhitespace){let a=dH(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function dz(e,t){let n=c8(t,e.schema),{from:r,to:i,empty:s}=e.selection,o=[];s?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let a=o.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function d$(e,t){let n=new sf(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function dG(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function dq(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 dV(e){return t=>dq(t.$from,e)}function dW(e,t,n){return void 0===e.config[t]&&e.parent?dW(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?dW(e.parent,t,n):null}):e.config[t]}function dK(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=dW(e,"addExtensions",t);return n?[e,...dK(n())]:e}).flat(10)}function dY(e,t){let n=iP.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function dX(e){return"function"==typeof e}function dQ(e,t,...n){return dX(e)?t?e.bind(t)(...n):e(...n):e}function dJ(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 dZ(e){let t=[],{nodeExtensions:n,markExtensions:r}=dJ(e),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...o,...a];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=dW(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?o:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...s,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=dW(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...s,...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 d0(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,s=0,o=e.length;for(let a=0;a<o;a+=1){let o=e[a];if("'"===o&&!i){r=!r,n+=o;continue}if('"'===o&&!r){i=!i,n+=o;continue}if(!r&&!i){if("("===o){s+=1,n+=o;continue}if(")"===o&&s>0){s-=1,n+=o;continue}if(";"===o&&0===s){t.push(n),n="";continue}}n+=o}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 s=r.slice(0,i).trim(),o=r.slice(i+1).trim();s&&o&&t.push([s,o])}return t}function d1(...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(" "):[],s=r.filter(e=>!i.includes(e));n[e]=[...i,...s].join(" ")}else if("style"===e){let r=new Map([...d0(n[e]),...d0(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function d2(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)=>d1(e,t),{})}function d3(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 d5(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 d4(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 d6(e){return e.sort((e,t)=>{let n=dW(e,"priority")||100,r=dW(t,"priority")||100;return n>r?-1:+(n<r)})}function d9(e){var t;let n=d6(dK(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 d7(e,t,n){let{from:r,to:i}=t,{blockSeparator:s="\n\n",textSerializers:o={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=s);let u=null==o?void 0:o[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 d8(e,t){let n={from:0,to:e.content.size};return d7(e,n,t)}function ue(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ut(e,t){let n=dM("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=cQ(t,e.schema),{from:r,to:i}=e.selection,s=[];e.doc.nodesBetween(r,i,e=>{s.push(e)});let o=s.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}(e,t):"mark"===n?dz(e,t):{}}function un(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let s=[];if(e.ranges.length)e.forEach((e,t)=>{s.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;s.push({from:e,to:n})}s.forEach(({from:e,to:r})=>{let s=n.slice(t).map(e,-1),o=n.slice(t).map(r),a=n.invert().map(s,-1),l=n.invert().map(o);i.push({oldRange:{from:a,to:l},newRange:{from:s,to:o}})})}),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 ur(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=c7(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 ui(e,t){return t.nodes[e]||t.marks[e]||null}function us(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 uo(e,t,n={}){let{empty:r,ranges:i}=e.selection,s=t?c8(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!s||s.name===e.type.name).find(e=>c4(e.attrs,n,{strict:!1}));let o=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(s&&e.inlineContent&&!e.type.allowsMarkType(s))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);o+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===o)return!1;let l=a.filter(e=>!s||s.name===e.mark.type.name).filter(e=>c4(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!s||e.mark.type!==s&&e.mark.type.excludes(s)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=o}function ua(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function ul(e,t){let{nodeExtensions:n}=dJ(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},s=dQ(dW(r,"group",i));return"string"==typeof s&&s.split(" ").includes("list")}function uc(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&&(uc(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function ud(e){return e instanceof sE}var uu=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function up(e,t){let n=t.mapping.mapResult(e.position);return{position:new uu(n.pos),mapResult:n}}function uh(e){return new uu(e)}function uf(e,t,n){let r=e.state.doc.content.size,i=dr(t,0,r),s=dr(n,0,r),o=e.coordsAtPos(i),a=e.coordsAtPos(s,-1),l=Math.min(o.top,a.top),c=Math.max(o.bottom,a.bottom),d=Math.min(o.left,a.left),u=Math.max(o.right,a.right),p={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return{...p,toJSON:()=>p}}var um=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:s}=n,{empty:o,ranges:a}=s,l=c8(e,r.schema);if(i)if(o){let e=dz(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,s=e.$to.pos;r.doc.nodesBetween(i,s,(e,r)=>{let o=Math.max(r,i),a=Math.min(r+e.nodeSize,s);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(o,a,l.create({...e.attrs,...t}))}):n.addMark(o,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,s=null;if(dn(i)&&(s=i.$cursor),s){let t=null!=(r=e.storedMarks)?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:o}=i;return o.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),s=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&s}return!i}),i})}(r,n,l)},ug=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),ub=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let s,o=cQ(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock)?i().command(({commands:e})=>!!cD(o,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>cD(o,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},uy=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=dr(e,0,n.content.size),i=sE.create(n,r);t.setSelection(i)}return!0},ux=(e,t)=>({tr:n,state:r,dispatch:i})=>{let s,o,{selection:a}=r;return"number"==typeof t?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=a.from,o=a.to),i&&n.doc.nodesBetween(s,o,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},uv=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,s=sv.atStart(n).from,o=sv.atEnd(n).to,a=dr(r,s,o),l=dr(i,s,o),c=sv.create(n,a,l);t.setSelection(c)}return!0},uw=e=>({state:t,dispatch:n})=>{var r;return(r=cQ(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(0==o)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,i=r0.from(n?r.create():null),o=new r6(r0.from(r.create(null,r0.from(a.type.create(null,i)))),n?3:1,0),c=s.start,d=s.end;t(e.tr.step(new i0(c-(n?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(t,n)};function uE(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 uk=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:s,doc:o}=t,{$from:a,$to:l}=s,c=us(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(s instanceof sE&&s.node.isBlock)return!!a.parentOffset&&!!i7(o,a.pos)&&(r&&(e&&uE(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))),p=d&&u?[{type:u,attrs:c}]:void 0,h=i7(t.doc,t.mapping.map(a.pos),1,p);if(!p&&!h&&i7(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(h=!0,p=u?[{type:u,attrs:c}]:void 0),r){if(h&&(s instanceof sv&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,p),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&&uE(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return h},uT=(e,t={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;let a=cQ(e,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;let u=l.node(-1);if(u.type!==a)return!1;let p=s.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=r0.empty,r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=r0.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,s={...us(p,l.node().type.name,l.node().attrs),...t},c=(null==(o=a.contentMatch.defaultType)?void 0:o.createAndFill(s))||void 0;e=e.append(r0.from(a.createAndFill(null,c)||void 0));let d=l.before(l.depth-(r-1));n.replace(d,l.after(-i),new r6(e,4-r,0));let u=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&n.setSelection(sv.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let h=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,f={...us(p,u.type.name,u.attrs),...t},m={...us(p,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);let g=h?[{type:a,attrs:f},{type:h,attrs:m}]:[{type:a,attrs:f}];if(!i7(n.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!i)return!0;let c=a.filter(e=>o.includes(e.type.name));n.ensureMarks(c)}return!0},uN=(e,t)=>{let n=dV(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)&&i8(e.doc,n.pos))||(e.join(n.pos),!0)},uA=(e,t)=>{let n=dV(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)&&i8(e.doc,r))||(e.join(r),!0)},uS=(e,t,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:p}=i.extensionManager,h=cQ(e,o.schema),f=cQ(t,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:y}=m,x=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;let w=dV(e=>ul(e.type.name,u))(m),E=0===m.from&&m.to===o.doc.content.size,k=o.doc.content.content,T=1===k.length?k[0]:null,N=E&&T&&ul(T.type.name,u)?{node:T,pos:0,depth:0}:null,A=null!=w?w:N,S=!!w&&x.depth>=1&&x.depth-w.depth<=1,C=!!N;if((S||C)&&A){if(A.node.type===h)return E&&C?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 sv.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(ul(A.node.type.name,u)&&h.validContent(A.node.content))return l().command(()=>(s.setNodeMarkup(A.pos,h),!0)).command(()=>uN(s,h)).command(()=>uA(s,h)).run()}return n&&v&&a?l().command(()=>{let e=d().wrapInList(h,r),t=v.filter(e=>p.includes(e.type.name));return s.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(h,r).command(()=>uN(s,h)).command(()=>uA(s,h)).run():l().command(()=>!!d().wrapInList(h,r)||c.clearNodes()).wrapInList(h,r).command(()=>uN(s,h)).command(()=>uA(s,h)).run()},uC=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:s=!1}=n,o=c8(e,r.schema);return uo(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,t)},u_=(e,t,n={})=>({state:r,commands:i})=>{let s,o=cQ(e,r.schema),a=cQ(t,r.schema),l=dN(r,o,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(s=r.selection.$anchor.parent.attrs),l)?i.setNode(a,s):i.setNode(o,{...s,...n})},uM=(e,t={})=>({state:n,commands:r})=>{let i=cQ(e,n.schema);return dN(n,i,t)?r.lift(i):r.wrapIn(i,t)},uO=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,s=n[r];if(s.spec.isInputRules&&(i=s.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},uI=()=>({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)},uD=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var s;let{extendEmptyMarkRange:o=!1}=t,{selection:a}=n,l=c8(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:e,to:t}=a,r=null==(s=c.marks().find(e=>e.type===l))?void 0:s.attrs,i=c7(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},uR=e=>({tr:t,state:n,dispatch:r})=>{let i,s,{selection:o}=n;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},uL=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null,a=dM("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(s=cQ(e,r.schema)),"mark"===a&&(o=c8(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,c,d,u,p=e.$from.pos,h=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,h,(e,t)=>{s&&s===e.type&&(l=!0,d=Math.max(t,p),u=Math.min(t+e.nodeSize,h),a=t,c=e)}):r.doc.nodesBetween(p,h,(e,r)=>{r<p&&s&&s===e.type&&(l=!0,d=Math.max(r,p),u=Math.min(r+e.nodeSize,h),a=r,c=e),r>=p&&r<=h&&(s&&s===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(s=>{if(o===s.type&&(l=!0,i)){let i=Math.max(r,p),a=Math.min(r+e.nodeSize,h);n.addMark(i,a,o.create({...s.attrs,...t}))}}))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),o&&c.marks.length&&c.marks.forEach(e=>{o===e.type&&i&&n.addMark(d,u,o.create({...e.attrs,...t}))}))}),l},uj=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&i5(o,e,t);return!!a&&(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0)}})(cQ(e,n.schema),t)(n,r),uP=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,s=t,o=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=o.resolve(t.start-2);s=new il(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new il(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let a=i5(s,n,r,t);return!!a&&(e&&function(e,t,n,r,i){let s=r0.empty;for(let e=n.length-1;e>=0;e--)s=r0.from(n[e].type.create(n[e].attrs,s));e.step(new i0(t.start-2*!!r,t.end,t.start,t.end,new r6(s,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let a=n.length-o,l=t.start+n.length-2*!!r,c=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&i7(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(n).nodeSize}(e,t,a,i,n),!0)}(a,o,e,t)&&(r&&r(a.scrollIntoView()),!0)}})(cQ(e,n.schema),t)(n,r),uB=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={}}},uF=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function uH(e){var t;let{editor:n,from:r,to:i,text:s,rules:o,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,s)=>{var o,a;let l=(null==(a=(o=e.type.spec).toText)?void 0:a.call(o,{node:e,pos:t,parent:i,index:s}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+s;return o.forEach(e=>{if(d)return;let t=((e,t)=>{if(c5(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 o=l.state.tr,c=cU({state:l.state,transaction:o}),p={from:r-(t[0].length-s.length),to:i},{commands:h,chain:f,can:m}=new cz({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:h,chain:f,can:m})&&o.steps.length&&(e.undoable&&o.setMeta(a,{transform:o,from:r,to:i,text:s}),l.dispatch(o),d=!0)}),d}function uU(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var uz=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{...dQ(dW(this,"addOptions",{name:this.name}))}}get storage(){return{...dQ(dW(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 uU(t)&&uU(n)&&Object.keys(n).forEach(i=>{uU(n[i])&&uU(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}},u$=class e extends uz{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 s=i.find(e=>(null==e?void 0:e.type.name)===t.name);return s&&n.removeStoredMark(s),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)}},uG=class{constructor(e){this.find=e.find,this.handler=e.handler}},uq=null,uV=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=d9(e),this.schema=function(e,t){var n;let r=dZ(e),{nodeExtensions:i,markExtensions:s}=dJ(e),o=null==(n=i.find(e=>dW(e,"topNode")))?void 0:n.name;return new iA({topNode:o,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},o=d5({...e.reduce((e,t)=>{let r=dW(t,"extendNodeSchema",s);return{...e,...r?r(n):{}}},{}),content:dQ(dW(n,"content",s)),marks:dQ(dW(n,"marks",s)),group:dQ(dW(n,"group",s)),inline:dQ(dW(n,"inline",s)),atom:dQ(dW(n,"atom",s)),selectable:dQ(dW(n,"selectable",s)),draggable:dQ(dW(n,"draggable",s)),code:dQ(dW(n,"code",s)),whitespace:dQ(dW(n,"whitespace",s)),linebreakReplacement:dQ(dW(n,"linebreakReplacement",s)),defining:dQ(dW(n,"defining",s)),isolating:dQ(dW(n,"isolating",s)),attrs:Object.fromEntries(i.map(d4))}),a=dQ(dW(n,"parseHTML",s));a&&(o.parseDOM=a.map(e=>d3(e,i)));let l=dW(n,"renderHTML",s);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:d2(e,i)}));let c=dW(n,"renderText",s);return c&&(o.toText=c),[n.name,o]})),marks:Object.fromEntries(s.map(n=>{let i=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},o=d5({...e.reduce((e,t)=>{let r=dW(t,"extendMarkSchema",s);return{...e,...r?r(n):{}}},{}),inclusive:dQ(dW(n,"inclusive",s)),excludes:dQ(dW(n,"excludes",s)),group:dQ(dW(n,"group",s)),spanning:dQ(dW(n,"spanning",s)),code:dQ(dW(n,"code",s)),attrs:Object.fromEntries(i.map(d4))}),a=dQ(dW(n,"parseHTML",s));a&&(o.parseDOM=a.map(e=>d3(e,i)));let l=dW(n,"renderHTML",s);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:d2(e,i)})),[n.name,o]}))})}(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:ui(t.name,this.schema)},r=dW(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return d6([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ui(t.name,this.schema)},r=[],i=dW(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&dW(t,"exitable",n)&&(s.ArrowRight=()=>u$.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let o=new sR({props:{handleKeyDown:lg(s)}});r.push(o);let a=dW(t,"addInputRules",n);if(ua(t,e.options.enableInputRules)&&a){let t=a();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new sR({state:{init:()=>null,apply(e,i,s){let o=e.getMeta(r);if(o)return o;let a=e.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=dY(r0.from(e),s.schema));let{from:i}=a,o=i+e.length;uH({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,s,o)=>uH({editor:t,from:i,to:s,text:o,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&uH({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:s}=e.state.selection;return!!s&&uH({editor:t,from:s.pos,to:s.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let l=dW(t,"addPasteRules",n);if(ua(t,e.options.enablePasteRules)&&l){let t=l();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,s=!1,o=!1,a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let l=({state:e,from:r,to:i,rule:s,pasteEvt:o})=>{let l=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=e,{commands:l,chain:c,can:d}=new cz({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var p,h,f,m,g;if((null==(h=null==(p=e.type)?void 0:p.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;let b=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,y=Math.max(r,t),x=Math.min(i,t+b);y>=x||((e,t,n)=>{if(c5(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(y-t,x-t,void 0,""),s.find,o).forEach(e=>{if(void 0===e.index)return;let t=y+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=s.handler({state:n,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:cU({state:e,transaction:l}),from:Math.max(r-1,0),to:i.b-1,rule:s,pasteEvent:o,dropEvent:t})&&l.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return r.map(e=>new sR({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(uq=n)},r=()=>{uq&&(uq=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(o=i===e.dom.parentElement,t=n,!o){let e=uq;(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 a=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],c="paste"===i.getMeta("uiEvent")&&!s,d="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),p=!!u;if(!c&&!d&&!p)return;if(p){var h,f;let t,{text:n}=u;"string"==typeof n||(n=dY(r0.from(n),r.schema));let{from:i}=u,s=i+n.length;return l({rule:e,state:r,from:i,to:{b:s},pasteEvt:(h=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",h),t)})}let m=n.doc.content.findDiffStart(r.doc.content),g=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&g&&m!==g.b)return l({rule:e,state:r,from:m,to:g,pasteEvt:a})}}))}({editor:e,rules:t});r.push(...n)}}let c=dW(t,"addProseMirrorPlugins",n);if(c){let e=c();r.push(...e)}return r})}get attributes(){return dZ(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=dJ(this.extensions);return Object.fromEntries(t.filter(e=>!!dW(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:cQ(t.name,this.schema)},i=dW(t,"addNodeView",r);if(!i)return[];let s=i();return s?[t.name,(r,i,o,a,l)=>{let c=d2(r,n);return s({node:r,view:i,getPos:o,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return d6([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ui(n.name,this.schema)},i=dW(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return d6([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ui(n.name,this.schema)},i=dW(n,"transformPastedHTML",r);return i?(t,n)=>{let s=e(t,n);return i.call(r,s)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=dJ(this.extensions);return Object.fromEntries(t.filter(e=>!!dW(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:c8(t.name,this.schema)},i=dW(t,"addMarkView",r);return i?[t.name,(r,s,o)=>{let a=d2(r,n);return i()({mark:r,view:s,inline:o,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:i,tr:s}=r;i.descendants((t,r)=>{let i=s.mapping.map(r),o=s.mapping.map(r)+t.nodeSize,a=null;if(t.marks.forEach(t=>{if(t!==e)return!1;a=t}),!a)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==a.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});s.removeMark(i,o,e.type),s.addMark(i,o,t)}}),s.docChanged&&t.view.dispatch(s)}(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:ui(e.name,this.schema)};"mark"===e.type&&(null==(t=dQ(dW(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=dW(e,"onBeforeCreate",n),i=dW(e,"onCreate",n),s=dW(e,"onUpdate",n),o=dW(e,"onSelectionUpdate",n),a=dW(e,"onTransaction",n),l=dW(e,"onFocus",n),c=dW(e,"onBlur",n),d=dW(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),o&&this.editor.on("selectionUpdate",o),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};uV.resolve=d9,uV.sort=d6,uV.flatten=dK,cH({},{ClipboardTextSerializer:()=>uK,Commands:()=>uY,Delete:()=>uX,Drop:()=>uQ,Editable:()=>uJ,FocusEvents:()=>u0,Keymap:()=>u1,Paste:()=>u2,Tabindex:()=>u3,TextDirection:()=>u5,focusEventsPluginKey:()=>uZ});var uW=class e extends uz{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)}},uK=uW.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new sR({key:new sP("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:s}=i,o=Math.min(...s.map(e=>e.$from.pos)),a=Math.max(...s.map(e=>e.$to.pos)),l=ue(n);return d7(r,{from:o,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uY=uW.create({name:"commands",addCommands:()=>({...c$})}),uX=uW.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let s=()=>{var n,r,i,s;if(null!=(s=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?s:e.getMeta("y-sync$"))return;let o=d$(e.before,[e,...t]);un(o).forEach(t=>{o.mapping.mapResult(t.oldRange.from).deletedAfter&&o.mapping.mapResult(t.oldRange.to).deletedBefore&&o.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,s=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:o.mapping.map(r),newTo:o.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!s,editor:this.editor,transaction:e,combinedTransform:o})})});let a=o.mapping;o.steps.forEach((t,n)=>{var r,i;if(t instanceof iX){let s=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(s,-1),d=a.invert().map(l),u=s>0&&(null==(r=o.doc.nodeAt(s-1))?void 0:r.marks.some(e=>e.eq(t.mark))),p=null==(i=o.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:s,to:l},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:o})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(s,0):s()}}),uQ=uW.create({name:"drop",addProseMirrorPlugins(){return[new sR({key:new sP("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),uJ=uW.create({name:"editable",addProseMirrorPlugins(){return[new sR({key:new sP("editable"),props:{editable:()=>this.editor.options.editable}})]}}),uZ=new sP("focusEvents"),u0=uW.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new sR({key:uZ,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}}}})]}}),u1=uW.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:s}=n,{pos:o,parent:a}=s,l=s.parent.isTextblock&&o>0?t.doc.resolve(o-1):s,c=l.parent.type.spec.isolating,d=s.pos-s.parentOffset,u=c&&1===l.parent.childCount?d===s.pos:sg.atStart(r).from===o;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==s.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 da()||dk()?i:r},addProseMirrorPlugins(){return[new sR({key:new sP("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:s,from:o,to:a}=t.selection,l=sg.atStart(t.doc).from,c=sg.atEnd(t.doc).to;if(s||o!==l||a!==c||!uc(n.doc))return;let d=n.tr,u=cU({state:n,transaction:d}),{commands:p}=new cz({editor:this.editor,state:u});if(p.clearNodes(),d.steps.length)return d}})]}}),u2=uW.create({name:"paste",addProseMirrorPlugins(){return[new sR({key:new sP("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),u3=uW.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new sR({key:new sP("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),u5=uW.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=dJ(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 sR({key:new sP("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),u4=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,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+ +!s;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;let c=new e(l,this.editor,i,i||o?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(s=>{n&&r.length>0||(s.node.type.name===e&&i.every(e=>t[e]===s.node.attrs[e])&&r.push(s),n&&r.length>0||(r=r.concat(s.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)}},u6=`.ProseMirror {
6
- position: relative;
7
- }
8
-
9
- .ProseMirror {
10
- word-wrap: break-word;
11
- white-space: pre-wrap;
12
- white-space: break-spaces;
13
- -webkit-font-variant-ligatures: none;
14
- font-variant-ligatures: none;
15
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
16
- }
17
-
18
- .ProseMirror [contenteditable="false"] {
19
- white-space: normal;
20
- }
21
-
22
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
23
- white-space: pre-wrap;
24
- }
25
-
26
- .ProseMirror pre {
27
- white-space: pre-wrap;
28
- }
29
-
30
- img.ProseMirror-separator {
31
- display: inline !important;
32
- border: none !important;
33
- margin: 0 !important;
34
- width: 0 !important;
35
- height: 0 !important;
36
- }
37
-
38
- .ProseMirror-gapcursor {
39
- display: none;
40
- pointer-events: none;
41
- position: absolute;
42
- margin: 0;
43
- }
44
-
45
- .ProseMirror-gapcursor:after {
46
- content: "";
47
- display: block;
48
- position: absolute;
49
- top: -2px;
50
- width: 20px;
51
- border-top: 1px solid black;
52
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
53
- }
54
-
55
- @keyframes ProseMirror-cursor-blink {
56
- to {
57
- visibility: hidden;
58
- }
59
- }
60
-
61
- .ProseMirror-hideselection *::selection {
62
- background: transparent;
63
- }
64
-
65
- .ProseMirror-hideselection *::-moz-selection {
66
- background: transparent;
67
- }
68
-
69
- .ProseMirror-hideselection * {
70
- caret-color: transparent;
71
- }
72
-
73
- .ProseMirror-focused .ProseMirror-gapcursor {
74
- display: block;
75
- }`,u9=class extends uB{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:up,createMappablePosition:uh},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=di(t,this.options.autofocus);this.editorState=sD.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(u6,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=dX(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t,n,r;let i=[...this.options.enableCoreExtensions?[uJ,uK.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),uY,u0,u1,u3.configure({value:null==(r=null==(n=this.options.coreExtensionOptions)?void 0:n.tabindex)?void 0:r.value}),uQ,u2,uX,u5.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new uV(i,this)}createCommandManager(){this.commandManager=new cz({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=dH(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=dH(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new lt(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==o?void 0:o.getMeta("focus"),l=null==o?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||s.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return ut(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return dN(e,null,n)||uo(e,null,n);let r=dM(t,e.schema);return"node"===r?dN(e,t,n):"mark"===r&&uo(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dY(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return d8(this.state.doc,{blockSeparator:t,textSerializers:{...ue(this.schema),...n}})}get isEmpty(){return uc(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new u4(t,this,!1,n)}get $doc(){return this.$pos(0)}};function u7(e){return new uF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dQ(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:s}=t,o=r[r.length-1],a=r[0];if(o){let r=a.search(/\S/),l=n.from+a.indexOf(o),c=l+o.length;if(ur(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&s.delete(c,n.to),l>n.from&&s.delete(n.from+r,l);let d=n.from+r+o.length;s.addMark(n.from+r,d,e.type.create(i||{})),s.removeStoredMark(e.type)}},undoable:e.undoable})}function u8(e){return new uF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dQ(e.getAttributes,void 0,r)||{},{tr:s}=t,o=n.from,a=n.to,l=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;let t=r[0][r[0].length-1];s.insertText(t,o+r[0].length-1),s.replaceWith(e,a,l)}else if(r[0]){let t=e.type.isInline?o:o-1;s.insert(t,e.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:e.undoable})}function pe(e){return new uF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),s=dQ(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,s)},undoable:e.undoable})}function pt(e){return new uF({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let s=dQ(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),l=a&&i5(a,e.type,s);if(!l)return null;if(o.wrap(a,l),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,s=r||n.$to.parentOffset&&n.$from.marks();if(s){let e=s.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,s).run()}let c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&i8(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&o.join(n.from-1)},undoable:e.undoable})}var pn=class{constructor(e){var t,n,r,i,s,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(s=e.options)?void 0:s.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(o=e.options)?void 0:o.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),s=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),s&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,s=e.includes("right"),o=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return(s?r=this.startWidth+t:o&&(r=this.startWidth-t),a?i=this.startHeight+n:l&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(s?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,s,o;if(!n){let n=Math.max(this.minSize.width,e),s=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(i=this.maxSize)?void 0:i.height)&&(s=Math.min(this.maxSize.height,s)),{width:n,height:s}}let a=e,l=t;return a<this.minSize.width&&(l=(a=this.minSize.width)/this.aspectRatio),l<this.minSize.height&&(a=(l=this.minSize.height)*this.aspectRatio),(null==(s=this.maxSize)?void 0:s.width)&&a>this.maxSize.width&&(l=(a=this.maxSize.width)/this.aspectRatio),(null==(o=this.maxSize)?void 0:o.height)&&l>this.maxSize.height&&(a=(l=this.maxSize.height)*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function pr(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(t.id=s[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let s=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];s&&(t[e]=s.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function pi(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function ps(e){let{nodeName:t,name:n,parseAttributes:r=pr,serializeAttributes:i=pi,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{let r={...s,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let s=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(s);if(!a)return;let c=r(a[1]||"");if(!o.find(e=>!(e in c)))return{type:t,raw:a[0],attributes:c}}},renderMarkdown:e=>{let t=i((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${l}${n} :::`}}}function po(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=pr,serializeAttributes:s=pi,defaultAttributes:o={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let s={...o,...e.attributes};return n.createNode(t,s,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var s;let o=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(o);if(!l)return;let[d,u=""]=l,p=i(u),h=1,f=d.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,b=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(b);if(null===n)break;let i=n.index,o=n[1];if(null==(s=n[2])||!s.endsWith(":::")){if(o)h+=1;else if(0==(h-=1)){let s=b.slice(0,i);m=s.trim();let o=e.slice(0,f+i+n[0].length),l=[];if(m)if("block"===a)for((l=r.blockTokens(s)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:o,attributes:p,content:m,tokens:l}}}}}},renderMarkdown:(e,t)=>{let n=s((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${c}${r}
76
-
77
- ${i}
78
-
79
- :::`}}}function pa(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,s,o]=r;t[i]=s||o,r=n.exec(e)}return t}function pl(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function pc(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=pa,serializeAttributes:s=pl,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(a)return n.createNode(t,i);let s=r?r(e):e.content||"";return s?n.createNode(t,i,[n.createTextNode(s)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=a?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let s=a?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(s);if(!o)return;let l="",c="";if(a){let[,e]=o;c=e}else{let[,e,t]=o;c=e,l=t||""}let u=i(c.trim());return{type:t,raw:o[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=s((e=>{if(!l)return e;let t={};return l.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return a?`[${c}${i}]`:`[${c}${i}]${t}[/${c}]`}}}function pd(e,t,n){var r,i,s,o;let a=e.split("\n"),l=[],c="",d=0,u=t.baseIndentSize||2;for(;d<a.length;){let e,p=a[d],h=p.match(t.itemPattern);if(!h)if(l.length>0)break;else{if(""!==p.trim())return;d+=1,c=`${c}${p}
80
- `;continue}let f=t.extractItemData(h),{indentLevel:m,mainContent:g}=f;c=`${c}${p}
81
- `;let b=[g];for(d+=1;d<a.length;){let e=a[d];if(""===e.trim()){let t=a.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(i=null==(r=a[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){b.push(e),c=`${c}${e}
82
- `,d+=1;continue}break}if(((null==(o=null==(s=e.match(/^(\s*)/))?void 0:s[1])?void 0:o.length)||0)>m)b.push(e),c=`${c}${e}
83
- `,d+=1;else break}let y=b.slice(1);if(y.length>0){let r=y.map(e=>e.slice(m+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let x=t.createToken(f,e);l.push(x)}if(0!==l.length)return{items:l,raw:c}}function pu(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[s,...o]=e.content,a=t.renderChildren([s]),l=`${i}${a}`;return o&&o.length>0&&o.forEach((e,n)=>{var r,i;let s=null!=(i=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?i:t.renderChildren([e]);if(null!=s){let n=s.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?`
84
-
85
- ${n}`:`
86
- ${n}`}}),l}cH({},{createAtomBlockMarkdownSpec:()=>ps,createBlockMarkdownSpec:()=>po,createInlineMarkdownSpec:()=>pc,parseAttributes:()=>pr,parseIndentedBlocks:()=>pd,renderNestedMarkdownContent:()=>pu,serializeAttributes:()=>pi});var pp=class e extends uz{constructor(){super(...arguments),this.type="node"}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)}},ph=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,i,s,o,a;let{view:l}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let u=0,p=0;if(this.dom!==d){let t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),a=null!=(i=e.offsetX)?i:null==(r=e.nativeEvent)?void 0:r.offsetX,l=null!=(o=e.offsetY)?o:null==(s=e.nativeEvent)?void 0:s.offsetY;u=n.x-t.x+a,p=n.y-t.y+l}let h=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();h.style.width=`${Math.round(e.width)}px`,h.style.height=`${Math.round(e.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let f=null;try{(f=document.createElement("div")).style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(h),document.body.appendChild(f),null==(a=e.dataTransfer)||a.setDragImage(h,u,p)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}let m=this.getPos();if("number"!=typeof m)return;let g=sE.create(l.state.doc,m),b=l.state.tr.setSelection(g);l.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,s="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!r)return!0;let{isEditable:o}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=sE.isSelectable(this.node),d="copy"===e.type,u="paste"===e.type,p="cut"===e.type,h="mousedown"===e.type;if(!l&&c&&r&&e.target===this.dom&&e.preventDefault(),l&&r&&!a&&e.target===this.dom)return e.preventDefault(),!1;if(l&&o&&!a&&h){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!a&&!i&&!s&&!d&&!u&&!p&&(!h||!c)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(da()||ds())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function pf(e){return new uG({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let s=dQ(e.getAttributes,void 0,r,i);if(!1===s||null===s)return null;let{tr:o}=t,a=r[r.length-1],l=r[0],c=n.to;if(a){let i=l.search(/\S/),d=n.from+l.indexOf(a),u=d+a.length;if(ur(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>d).length)return null;u<n.to&&o.delete(u,n.to),d>n.from&&o.delete(n.from+i,d),c=n.from+i+a.length,o.addMark(n.from+i,c,e.type.create(s||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:pm,getOwnPropertySymbols:pg}=Object,{hasOwnProperty:pb}=Object.prototype;function py(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function px(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,s=i.get(t),o=i.get(n);if(s&&o)return s===n&&o===t;i.set(t,n),i.set(n,t);let a=e(t,n,r);return i.delete(t),i.delete(n),a}}function pv(e){return pm(e).concat(pg(e))}let pw=Object.hasOwn||((e,t)=>pb.call(e,t));function pE(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:pk,keys:pT}=Object;function pN(e,t){return e.byteLength===t.byteLength&&pP(new Uint8Array(e),new Uint8Array(t))}function pA(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function pS(e,t){return e.byteLength===t.byteLength&&pP(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function pC(e,t){return pE(e.getTime(),t.getTime())}function p_(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function pM(e,t){return e===t}function pO(e,t,n){let r,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),a=e.entries(),l=0;for(;(r=a.next())&&!r.done;){let s=t.entries(),a=!1,c=0;for(;(i=s.next())&&!i.done;){if(o[c]){c++;continue}let s=r.value,d=i.value;if(n.equals(s[0],d[0],l,c,e,t,n)&&n.equals(s[1],d[1],s[0],d[0],e,t,n)){a=o[c]=!0;break}c++}if(!a)return!1;l++}return!0}function pI(e,t,n){let r=pT(e),i=r.length;if(pT(t).length!==i)return!1;for(;i-- >0;)if(!pF(e,t,n,r[i]))return!1;return!0}function pD(e,t,n){let r,i,s,o=pv(e),a=o.length;if(pv(t).length!==a)return!1;for(;a-- >0;)if(!pF(e,t,n,r=o[a])||(i=pk(e,r),s=pk(t,r),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable)))return!1;return!0}function pR(e,t){return pE(e.valueOf(),t.valueOf())}function pL(e,t){return e.source===t.source&&e.flags===t.flags}function pj(e,t,n){let r,i,s=e.size;if(s!==t.size)return!1;if(!s)return!0;let o=Array(s),a=e.values();for(;(r=a.next())&&!r.done;){let s=t.values(),a=!1,l=0;for(;(i=s.next())&&!i.done;){if(!o[l]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){a=o[l]=!0;break}l++}if(!a)return!1}return!0}function pP(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function pB(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function pF(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||pw(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let pH={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},pU=Object.prototype.toString,pz=p$();function p$(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:f}){return function(m,g,b){if(m===g)return!0;if(null==m||null==g)return!1;let y=typeof m;if(y!==typeof g)return!1;if("object"!==y)return"number"===y?a(m,g,b):"function"===y&&s(m,g,b);let x=m.constructor;if(x!==g.constructor)return!1;if(x===Object)return l(m,g,b);if(Array.isArray(m))return t(m,g,b);if(x===Date)return r(m,g,b);if(x===RegExp)return d(m,g,b);if(x===Map)return o(m,g,b);if(x===Set)return u(m,g,b);let v=pU.call(m);if("[object Date]"===v)return r(m,g,b);if("[object RegExp]"===v)return d(m,g,b);if("[object Map]"===v)return o(m,g,b);if("[object Set]"===v)return u(m,g,b);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,b);if("[object URL]"===v)return h(m,g,b);if("[object Error]"===v)return i(m,g,b);if("[object Arguments]"===v)return l(m,g,b);if(pH[v])return p(m,g,b);if("[object ArrayBuffer]"===v)return e(m,g,b);if("[object DataView]"===v)return n(m,g,b);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return c(m,g,b);if(f){let e=f[v];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,b)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:pN,areArraysEqual:n?pD:pA,areDataViewsEqual:pS,areDatesEqual:pC,areErrorsEqual:p_,areFunctionsEqual:pM,areMapsEqual:n?py(pO,pD):pO,areNumbersEqual:pE,areObjectsEqual:n?pD:pI,arePrimitiveWrappersEqual:pR,areRegExpsEqual:pL,areSetsEqual:n?py(pj,pD):pj,areTypedArraysEqual:n?py(pP,pD):pP,areUrlsEqual:pB,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=px(r.areArraysEqual),t=px(r.areMapsEqual),n=px(r.areObjectsEqual),i=px(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),o=n?n(s):function(e,t,n,r,i,o,a){return s(e,t,a)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(s,o){let{cache:a=e?new WeakMap:void 0,meta:l}=n();return t(s,o,{cache:a,equals:r,meta:l,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let s={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,s)}}({circular:t,comparator:s,createState:r,equals:o,strict:i})}p$({strict:!0}),p$({circular:!0}),p$({circular:!0,strict:!0}),p$({createInternalComparator:()=>pE}),p$({strict:!0,createInternalComparator:()=>pE}),p$({circular:!0,createInternalComparator:()=>pE}),p$({circular:!0,createInternalComparator:()=>pE,strict:!0});var pG=e.i(383835),pq=({contentComponent:e})=>{let t=(0,cp.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,X.jsx)(X.Fragment,{children:Object.values(t)})},pV=class extends cu.default.Component{constructor(e){super(e),this.editorContentRef=cu.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n;if(t.contentComponent)return;let r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),e=new Set,n={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(t,r){n={...n,[t]:t4.default.createPortal(r.reactElement,r.element,t)},e.forEach(e=>e())},removeRenderer(t){let r={...n};delete r[t],n=r,e.forEach(e=>e())}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,X.jsx)(pq,{contentComponent:e.contentComponent})]})}},pW=(0,cu.forwardRef)((e,t)=>{let n=cu.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return cu.default.createElement(pV,{key:n,innerRef:t,...e})}),pK=cu.default.memo(pW),pY="u">typeof window?cu.useLayoutEffect:cu.useEffect,pX=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},pQ="u"<typeof window,pJ=pQ||!!("u">typeof window&&window.next),pZ=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return pQ?t=!1:pJ&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new u9({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}},p0=(0,cu.createContext)({editor:null});p0.Consumer;var p1=()=>(0,cu.useContext)(p0),p2=(0,cu.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),p3=cu.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,cu.useContext)(p2),r=e.as||"div";return(0,X.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function p5(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function p4(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var p6=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?(0,t4.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=function(){try{if(cu.version)return parseInt(cu.version.split(".")[0],10)>=19}catch{}return!1}(),s=function(e){if(p5(e)||p4(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return p5(t)||p4(t)}return!1}(t),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,X.jsx)(t,{...o}),null==(e=null==r?void 0:r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};cu.default.createContext({markViewContentRef:()=>{}});var p9=class extends ph{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){var s;return"storage"===r?null!=(s=e.storage[t.name])?s:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,cu.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,cu.memo)(e=>(0,X.jsx)(p2.Provider,{value:t,children:(0,cu.createElement)(n,e)}));r.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:s=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new p6(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${s}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if("number"==typeof e)if(function({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:s}=e;return!!(i<=t&&s>=t+n||r&&dn(e)&&i>t&&s<t+n)}({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let s={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),r(s),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=d2(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}},p7=(0,cu.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function p8({editor:e,instance:t,children:n}){let r=null!=e?e:t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,cu.useMemo)(()=>({editor:r}),[r]),s=(0,cu.useMemo)(()=>({editor:r}),[r]);return(0,X.jsx)(p0.Provider,{value:s,children:(0,X.jsx)(p7.Provider,{value:i,children:n})})}function he({...e}){let{editor:t}=(0,cu.useContext)(p7);return(0,X.jsx)(pK,{editor:t,...e})}p7.displayName="TiptapContext",p8.displayName="Tiptap",he.displayName="Tiptap.Content",Object.assign(p8,{Content:he});let ht=en("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);function hn(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=hn(n.children,t);if(e)return e}}return null}function hr(){}class hi{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function hs(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new hi(n,r,t)}function ho(e){return e.toLowerCase()}hi.prototype.normal={},hi.prototype.property={},hi.prototype.space=void 0;class ha{constructor(e,t){this.attribute=t,this.property=e}}ha.prototype.attribute="",ha.prototype.booleanish=!1,ha.prototype.boolean=!1,ha.prototype.commaOrSpaceSeparated=!1,ha.prototype.commaSeparated=!1,ha.prototype.defined=!1,ha.prototype.mustUseProperty=!1,ha.prototype.number=!1,ha.prototype.overloadedBoolean=!1,ha.prototype.property="",ha.prototype.spaceSeparated=!1,ha.prototype.space=void 0;let hl=0,hc=hg(),hd=hg(),hu=hg(),hp=hg(),hh=hg(),hf=hg(),hm=hg();function hg(){return 2**++hl}e.s(["boolean",0,hc,"booleanish",0,hd,"commaOrSpaceSeparated",0,hm,"commaSeparated",0,hf,"number",0,hp,"overloadedBoolean",0,hu,"spaceSeparated",0,hh],383954);var hb=e.i(383954);let hy=Object.keys(hb);class hx extends ha{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<hy.length;){const e=hy[i];!function(e,t,n){n&&(e[t]=n)}(this,hy[i],(n&hb[e])===hb[e])}}}function hv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let s=new hx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[ho(r)]=r,n[ho(s.attribute)]=r}return new hi(t,n,e.space)}hx.prototype.defined=!0;let hw=hv({properties:{ariaActiveDescendant:null,ariaAtomic:hd,ariaAutoComplete:null,ariaBusy:hd,ariaChecked:hd,ariaColCount:hp,ariaColIndex:hp,ariaColSpan:hp,ariaControls:hh,ariaCurrent:null,ariaDescribedBy:hh,ariaDetails:null,ariaDisabled:hd,ariaDropEffect:hh,ariaErrorMessage:null,ariaExpanded:hd,ariaFlowTo:hh,ariaGrabbed:hd,ariaHasPopup:null,ariaHidden:hd,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:hh,ariaLevel:hp,ariaLive:null,ariaModal:hd,ariaMultiLine:hd,ariaMultiSelectable:hd,ariaOrientation:null,ariaOwns:hh,ariaPlaceholder:null,ariaPosInSet:hp,ariaPressed:hd,ariaReadOnly:hd,ariaRelevant:null,ariaRequired:hd,ariaRoleDescription:hh,ariaRowCount:hp,ariaRowIndex:hp,ariaRowSpan:hp,ariaSelected:hd,ariaSetSize:hp,ariaSort:null,ariaValueMax:hp,ariaValueMin:hp,ariaValueNow:hp,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function hE(e,t){return t in e?e[t]:t}function hk(e,t){return hE(e,t.toLowerCase())}let hT=hv({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hf,acceptCharset:hh,accessKey:hh,action:null,allow:null,allowFullScreen:hc,allowPaymentRequest:hc,allowUserMedia:hc,alt:null,as:null,async:hc,autoCapitalize:null,autoComplete:hh,autoFocus:hc,autoPlay:hc,blocking:hh,capture:null,charSet:null,checked:hc,cite:null,className:hh,cols:hp,colSpan:null,content:null,contentEditable:hd,controls:hc,controlsList:hh,coords:hp|hf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:hc,defer:hc,dir:null,dirName:null,disabled:hc,download:hu,draggable:hd,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:hc,formTarget:null,headers:hh,height:hp,hidden:hu,high:hp,href:null,hrefLang:null,htmlFor:hh,httpEquiv:hh,id:null,imageSizes:null,imageSrcSet:null,inert:hc,inputMode:null,integrity:null,is:null,isMap:hc,itemId:null,itemProp:hh,itemRef:hh,itemScope:hc,itemType:hh,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:hc,low:hp,manifest:null,max:null,maxLength:hp,media:null,method:null,min:null,minLength:hp,multiple:hc,muted:hc,name:null,nonce:null,noModule:hc,noValidate:hc,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:hc,optimum:hp,pattern:null,ping:hh,placeholder:null,playsInline:hc,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:hc,referrerPolicy:null,rel:hh,required:hc,reversed:hc,rows:hp,rowSpan:hp,sandbox:hh,scope:null,scoped:hc,seamless:hc,selected:hc,shadowRootClonable:hc,shadowRootDelegatesFocus:hc,shadowRootMode:null,shape:null,size:hp,sizes:null,slot:null,span:hp,spellCheck:hd,src:null,srcDoc:null,srcLang:null,srcSet:null,start:hp,step:null,style:null,tabIndex:hp,target:null,title:null,translate:null,type:null,typeMustMatch:hc,useMap:null,value:hd,width:hp,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:hh,axis:null,background:null,bgColor:null,border:hp,borderColor:null,bottomMargin:hp,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:hc,declare:hc,event:null,face:null,frame:null,frameBorder:null,hSpace:hp,leftMargin:hp,link:null,longDesc:null,lowSrc:null,marginHeight:hp,marginWidth:hp,noResize:hc,noHref:hc,noShade:hc,noWrap:hc,object:null,profile:null,prompt:null,rev:null,rightMargin:hp,rules:null,scheme:null,scrolling:hd,standby:null,summary:null,text:null,topMargin:hp,valueType:null,version:null,vAlign:null,vLink:null,vSpace:hp,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:hc,disableRemotePlayback:hc,prefix:null,property:null,results:hp,security:null,unselectable:null},space:"html",transform:hk}),hN=hv({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:hm,accentHeight:hp,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:hp,amplitude:hp,arabicForm:null,ascent:hp,attributeName:null,attributeType:null,azimuth:hp,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:hp,by:null,calcMode:null,capHeight:hp,className:hh,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:hp,diffuseConstant:hp,direction:null,display:null,dur:null,divisor:hp,dominantBaseline:null,download:hc,dx:null,dy:null,edgeMode:null,editable:null,elevation:hp,enableBackground:null,end:null,event:null,exponent:hp,externalResourcesRequired:null,fill:null,fillOpacity:hp,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hf,g2:hf,glyphName:hf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:hp,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:hp,horizOriginX:hp,horizOriginY:hp,id:null,ideographic:hp,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:hp,k:hp,k1:hp,k2:hp,k3:hp,k4:hp,kernelMatrix:hm,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:hp,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:hp,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:hp,overlineThickness:hp,paintOrder:null,panose1:null,path:null,pathLength:hp,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:hh,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:hp,pointsAtY:hp,pointsAtZ:hp,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hm,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hm,rev:hm,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hm,requiredFeatures:hm,requiredFonts:hm,requiredFormats:hm,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:hp,specularExponent:hp,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:hp,strikethroughThickness:hp,string:null,stroke:null,strokeDashArray:hm,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:hp,strokeOpacity:hp,strokeWidth:null,style:null,surfaceScale:hp,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hm,tabIndex:hp,tableValues:null,target:null,targetX:hp,targetY:hp,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hm,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:hp,underlineThickness:hp,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:hp,values:null,vAlphabetic:hp,vMathematical:hp,vectorEffect:null,vHanging:hp,vIdeographic:hp,version:null,vertAdvY:hp,vertOriginX:hp,vertOriginY:hp,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:hp,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hE}),hA=hv({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),hS=hv({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hk}),hC=hv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),h_=hs([hw,hT,hA,hS,hC],"html"),hM=hs([hw,hN,hA,hS,hC],"svg");function hO(e){let t=[],n=String(e||""),r=n.indexOf(","),i=0,s=!1;for(;!s;){-1===r&&(r=n.length,s=!0);let e=n.slice(i,r).trim();(e||!s)&&t.push(e),i=r+1,r=n.indexOf(",",i)}return t}function hI(e,t){let n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}let hD=/[#.]/g,hR=/[A-Z]/g,hL=/-[a-z]/g,hj=/^data[-\w.:]+$/i;function hP(e,t){let n=ho(t),r=t,i=ha;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&hj.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(hL,hF);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!hL.test(e)){let n=e.replace(hR,hB);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=hx}return new i(r,t)}function hB(e){return"-"+e.toLowerCase()}function hF(e){return e.charAt(1).toUpperCase()}function hH(e){let t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function hU(e){return e.join(" ").trim()}function hz(e,t,n){let r=n?function(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}(n):void 0;return function(n,i,...s){let o;if(null==n)o={type:"root",children:[]},s.unshift(i);else{let a=(o=function(e,t){let n,r,i=e||"",s={},o=0;for(;o<i.length;){hD.lastIndex=o;let e=hD.exec(i),t=i.slice(o,e?e.index:i.length);t&&(n?"#"===n?s.id=t:Array.isArray(s.className)?s.className.push(t):s.className=[t]:r=t,o+=t.length),e&&(n=e[0],o++)}return{type:"element",tagName:r||t||"div",properties:s,children:[]}}(n,t)).tagName.toLowerCase(),l=r?r.get(a):void 0;if(o.tagName=l||a,function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!0;if("string"!=typeof e.type)return!1;for(let t of Object.keys(e)){let n=e[t];if(n&&"object"==typeof n){if(!Array.isArray(n))return!0;for(let e of n)if("number"!=typeof e&&"string"!=typeof e)return!0}}return!!("children"in e&&Array.isArray(e.children))}(i))s.unshift(i);else for(let[t,n]of Object.entries(i))!function(e,t,n,r){let i,s=hP(e,n);if(null!=r){if("number"==typeof r){if(Number.isNaN(r))return;i=r}else i="boolean"==typeof r?r:"string"==typeof r?s.spaceSeparated?hH(r):s.commaSeparated?hO(r):s.commaOrSpaceSeparated?hH(hO(r).join(" ")):h$(s,s.property,r):Array.isArray(r)?[...r]:"style"===s.property?function(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}(r):String(r);if(Array.isArray(i)){let e=[];for(let t of i)e.push(h$(s,s.property,t));i=e}"className"===s.property&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}(e,o.properties,t,n)}for(let e of s)!function e(t,n){if(null==n);else if("number"==typeof n||"string"==typeof n)t.push({type:"text",value:String(n)});else if(Array.isArray(n))for(let r of n)e(t,r);else if("object"==typeof n&&"type"in n)"root"===n.type?e(t,n.children):t.push(n);else throw Error("Expected node, nodes, or string, got `"+n+"`")}(o.children,e);return"element"===o.type&&"template"===o.tagName&&(o.content={type:"root",children:o.children},o.children=[]),o}}function h$(e,t,n){if("string"==typeof n){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(""===n||ho(n)===ho(t)))return!0}return n}let hG=hz(h_,"div"),hq=hz(hM,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]);function hV(e,t){let n=e.indexOf("\r",t),r=e.indexOf("\n",t);return -1===r?n:-1===n||n+1===r?r:n<r?n:r}let hW={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},hK={}.hasOwnProperty,hY=Object.prototype;function hX(e,t){let n=t||{};return hQ({file:n.file||void 0,location:!1,schema:"svg"===n.space?hM:h_,verbose:n.verbose||!1},e)}function hQ(e,t){let n;switch(t.nodeName){case"#comment":return n={type:"comment",value:t.data},hZ(e,t,n),n;case"#document":case"#document-fragment":{let r="mode"in t&&("quirks"===t.mode||"limited-quirks"===t.mode);if(n={type:"root",children:hJ(e,t.childNodes),data:{quirksMode:r}},e.file&&e.location){let t,r,i=String(e.file),s=(t=String(i),r=[],{toOffset:function(e){if(e&&"number"==typeof e.line&&"number"==typeof e.column&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;r.length<e.line;){let e=r[r.length-1],n=hV(t,e),i=-1===n?t.length+1:n+1;if(e===i)break;r.push(i)}let n=(e.line>1?r[e.line-2]:0)+e.column-1;if(n<r[e.line-1])return n}},toPoint:function(e){if("number"==typeof e&&e>-1&&e<=t.length){let n=0;for(;;){let i=r[n];if(void 0===i){let e=hV(t,r[n-1]);i=-1===e?t.length+1:e+1,r[n]=i}if(i>e)return{line:n+1,column:e-(n>0?r[n-1]:0)+1,offset:e};n++}}}}),o=s.toPoint(0),a=s.toPoint(i.length);hr(o,"expected `start`"),hr(a,"expected `end`"),n.position={start:o,end:a}}return n}case"#documentType":return hZ(e,t,n={type:"doctype"}),n;case"#text":return n={type:"text",value:t.value},hZ(e,t,n),n;default:return function(e,t){let n=e.schema;e.schema=t.namespaceURI===hW.svg?hM:h_;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+":":"")+e.name;hK.call(hY,n)||(i[n]=e.value)}let s=("svg"===e.schema.space?hq:hG)(t.tagName,i,hJ(e,t.childNodes));if(hZ(e,t,s),"template"===s.tagName){let n=t.sourceCodeLocation,r=n&&n.startTag&&h0(n.startTag),i=n&&n.endTag&&h0(n.endTag),o=hQ(e,t.content);r&&i&&e.file&&(o.position={start:r.end,end:i.start}),s.content=o}return e.schema=n,s}(e,t)}}function hJ(e,t){let n=-1,r=[];for(;++n<t.length;){let i=hQ(e,t[n]);r.push(i)}return r}function hZ(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){let r=function(e,t,n){let r=h0(n);if("element"===t.type){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r,i={};if(n.attrs)for(r in n.attrs)hK.call(n.attrs,r)&&(i[hP(e.schema,r).property]=h0(n.attrs[r]));hr(n.startTag,"a start tag should exist");let s=h0(n.startTag),o=n.endTag?h0(n.endTag):void 0,a={opening:s};o&&(a.closing=o),a.properties=i,t.data={position:a}}}return r}(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function h0(e){let t=h1({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=h1({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function h1(e){return e.line&&e.column?e:void 0}let h2=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]);(m=D||(D={}))[m.EOF=-1]="EOF",m[m.NULL=0]="NULL",m[m.TABULATION=9]="TABULATION",m[m.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",m[m.LINE_FEED=10]="LINE_FEED",m[m.FORM_FEED=12]="FORM_FEED",m[m.SPACE=32]="SPACE",m[m.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",m[m.QUOTATION_MARK=34]="QUOTATION_MARK",m[m.AMPERSAND=38]="AMPERSAND",m[m.APOSTROPHE=39]="APOSTROPHE",m[m.HYPHEN_MINUS=45]="HYPHEN_MINUS",m[m.SOLIDUS=47]="SOLIDUS",m[m.DIGIT_0=48]="DIGIT_0",m[m.DIGIT_9=57]="DIGIT_9",m[m.SEMICOLON=59]="SEMICOLON",m[m.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",m[m.EQUALS_SIGN=61]="EQUALS_SIGN",m[m.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",m[m.QUESTION_MARK=63]="QUESTION_MARK",m[m.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",m[m.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",m[m.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",m[m.GRAVE_ACCENT=96]="GRAVE_ACCENT",m[m.LATIN_SMALL_A=97]="LATIN_SMALL_A",m[m.LATIN_SMALL_Z=122]="LATIN_SMALL_Z";let h3="[CDATA[",h5="doctype",h4="script";function h6(e){return e>=55296&&e<=57343}function h9(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159}function h7(e){return e>=64976&&e<=65007||h2.has(e)}(g=R||(R={})).controlCharacterInInputStream="control-character-in-input-stream",g.noncharacterInInputStream="noncharacter-in-input-stream",g.surrogateInInputStream="surrogate-in-input-stream",g.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",g.endTagWithAttributes="end-tag-with-attributes",g.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",g.unexpectedSolidusInTag="unexpected-solidus-in-tag",g.unexpectedNullCharacter="unexpected-null-character",g.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",g.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",g.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",g.missingEndTagName="missing-end-tag-name",g.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",g.unknownNamedCharacterReference="unknown-named-character-reference",g.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",g.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",g.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",g.eofBeforeTagName="eof-before-tag-name",g.eofInTag="eof-in-tag",g.missingAttributeValue="missing-attribute-value",g.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",g.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",g.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",g.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",g.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",g.missingDoctypePublicIdentifier="missing-doctype-public-identifier",g.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",g.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",g.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",g.cdataInHtmlContent="cdata-in-html-content",g.incorrectlyOpenedComment="incorrectly-opened-comment",g.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",g.eofInDoctype="eof-in-doctype",g.nestedComment="nested-comment",g.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",g.eofInComment="eof-in-comment",g.incorrectlyClosedComment="incorrectly-closed-comment",g.eofInCdata="eof-in-cdata",g.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",g.nullCharacterReference="null-character-reference",g.surrogateCharacterReference="surrogate-character-reference",g.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",g.controlCharacterReference="control-character-reference",g.noncharacterCharacterReference="noncharacter-character-reference",g.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",g.missingDoctypeName="missing-doctype-name",g.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",g.duplicateAttribute="duplicate-attribute",g.nonConformingDoctype="non-conforming-doctype",g.missingDoctype="missing-doctype",g.misplacedDoctype="misplaced-doctype",g.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",g.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",g.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",g.openElementsLeftAfterEof="open-elements-left-after-eof",g.abandonedHeadElementChild="abandoned-head-element-child",g.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",g.nestedNoscriptInHead="nested-noscript-in-head",g.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text";class h8{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,s=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:s,endCol:s,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(t>=56320&&t<=57343)return this.pos++,this._addGap(),(e-55296)*1024+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,D.EOF;return this._err(R.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((32|this.html.charCodeAt(this.pos+t))!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,D.EOF;let n=this.html.charCodeAt(t);return n===D.CARRIAGE_RETURN?D.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,D.EOF;let e=this.html.charCodeAt(this.pos);return e===D.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,D.LINE_FEED):e===D.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,h6(e)&&(e=this._processSurrogate(e)),null===this.handler.onParseError||e>31&&e<127||e===D.LINE_FEED||e===D.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){h9(e)?this._err(R.controlCharacterInInputStream):h7(e)&&this._err(R.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}function fe(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}(b=L||(L={}))[b.CHARACTER=0]="CHARACTER",b[b.NULL_CHARACTER=1]="NULL_CHARACTER",b[b.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",b[b.START_TAG=3]="START_TAG",b[b.END_TAG=4]="END_TAG",b[b.COMMENT=5]="COMMENT",b[b.DOCTYPE=6]="DOCTYPE",b[b.EOF=7]="EOF",b[b.HIBERNATION=8]="HIBERNATION",e.s(["TokenType",0,L,"getTokenAttr",0,fe],743820);let ft=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),fn=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function fr(e){return e>=P.ZERO&&e<=P.NINE}j=String.fromCodePoint,(y=P||(P={}))[y.NUM=35]="NUM",y[y.SEMI=59]="SEMI",y[y.EQUALS=61]="EQUALS",y[y.ZERO=48]="ZERO",y[y.NINE=57]="NINE",y[y.LOWER_A=97]="LOWER_A",y[y.LOWER_F=102]="LOWER_F",y[y.LOWER_X=120]="LOWER_X",y[y.LOWER_Z=122]="LOWER_Z",y[y.UPPER_A=65]="UPPER_A",y[y.UPPER_F=70]="UPPER_F",y[y.UPPER_Z=90]="UPPER_Z",(x=B||(B={}))[x.VALUE_LENGTH=49152]="VALUE_LENGTH",x[x.BRANCH_LENGTH=16256]="BRANCH_LENGTH",x[x.JUMP_TABLE=127]="JUMP_TABLE",(v=F||(F={}))[v.EntityStart=0]="EntityStart",v[v.NumericStart=1]="NumericStart",v[v.NumericDecimal=2]="NumericDecimal",v[v.NumericHex=3]="NumericHex",v[v.NamedEntity=4]="NamedEntity",(w=H||(H={}))[w.Legacy=0]="Legacy",w[w.Strict=1]="Strict",w[w.Attribute=2]="Attribute";class fi{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=F.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=H.Strict}startEntity(e){this.decodeMode=e,this.state=F.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case F.EntityStart:if(e.charCodeAt(t)===P.NUM)return this.state=F.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1);return this.state=F.NamedEntity,this.stateNamedEntity(e,t);case F.NumericStart:return this.stateNumericStart(e,t);case F.NumericDecimal:return this.stateNumericDecimal(e,t);case F.NumericHex:return this.stateNumericHex(e,t);case F.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===P.LOWER_X?(this.state=F.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=F.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*Math.pow(r,i)+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){var r;let i=e.charCodeAt(t);if(!fr(i)&&(!((r=i)>=P.UPPER_A)||!(r<=P.UPPER_F))&&(!(r>=P.LOWER_A)||!(r<=P.LOWER_F)))return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(i,3);t+=1}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(!fr(r))return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2);t+=1}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n,r,i;if(this.consumed<=t)return null==(n=this.errors)||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===P.SEMI)this.consumed+=1;else if(this.decodeMode===H.Strict)return 0;return this.emitCodePoint((r=this.result)>=55296&&r<=57343||r>1114111?65533:null!=(i=fn.get(r))?i:r,this.consumed),this.errors&&(e!==P.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&B.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let s=e.charCodeAt(t);if(this.treeIndex=function(e,t,n,r){let i=(t&B.BRANCH_LENGTH)>>7,s=t&B.JUMP_TABLE;if(0===i)return 0!==s&&r===s?n:-1;if(s){let t=r-s;return t<0||t>=i?-1:e[n+t]-1}let o=n,a=o+i-1;for(;o<=a;){let t=o+a>>>1,n=e[t];if(n<r)o=t+1;else{if(!(n>r))return e[t+i];a=t-1}}return -1}(n,r,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return 0===this.result||this.decodeMode===H.Attribute&&(0===i||function(e){var t;return e===P.EQUALS||(t=e)>=P.UPPER_A&&t<=P.UPPER_Z||t>=P.LOWER_A&&t<=P.LOWER_Z||fr(t)}(s))?0:this.emitNotTerminatedNamedEntity();if(0!=(i=((r=n[this.treeIndex])&B.VALUE_LENGTH)>>14)){if(s===P.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==H.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return -1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&B.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),null==(e=this.errors)||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(1===t?r[e]&~B.VALUE_LENGTH:r[e+1],n),3===t&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case F.NamedEntity:return 0!==this.result&&(this.decodeMode!==H.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case F.NumericDecimal:return this.emitNumericEntity(0,2);case F.NumericHex:return this.emitNumericEntity(0,3);case F.NumericStart:return null==(e=this.errors)||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case F.EntityStart:return 0}}}(E=U||(U={})).HTML="http://www.w3.org/1999/xhtml",E.MATHML="http://www.w3.org/1998/Math/MathML",E.SVG="http://www.w3.org/2000/svg",E.XLINK="http://www.w3.org/1999/xlink",E.XML="http://www.w3.org/XML/1998/namespace",E.XMLNS="http://www.w3.org/2000/xmlns/",(k=z||(z={})).TYPE="type",k.ACTION="action",k.ENCODING="encoding",k.PROMPT="prompt",k.NAME="name",k.COLOR="color",k.FACE="face",k.SIZE="size",(T=$||($={})).NO_QUIRKS="no-quirks",T.QUIRKS="quirks",T.LIMITED_QUIRKS="limited-quirks",(N=G||(G={})).A="a",N.ADDRESS="address",N.ANNOTATION_XML="annotation-xml",N.APPLET="applet",N.AREA="area",N.ARTICLE="article",N.ASIDE="aside",N.B="b",N.BASE="base",N.BASEFONT="basefont",N.BGSOUND="bgsound",N.BIG="big",N.BLOCKQUOTE="blockquote",N.BODY="body",N.BR="br",N.BUTTON="button",N.CAPTION="caption",N.CENTER="center",N.CODE="code",N.COL="col",N.COLGROUP="colgroup",N.DD="dd",N.DESC="desc",N.DETAILS="details",N.DIALOG="dialog",N.DIR="dir",N.DIV="div",N.DL="dl",N.DT="dt",N.EM="em",N.EMBED="embed",N.FIELDSET="fieldset",N.FIGCAPTION="figcaption",N.FIGURE="figure",N.FONT="font",N.FOOTER="footer",N.FOREIGN_OBJECT="foreignObject",N.FORM="form",N.FRAME="frame",N.FRAMESET="frameset",N.H1="h1",N.H2="h2",N.H3="h3",N.H4="h4",N.H5="h5",N.H6="h6",N.HEAD="head",N.HEADER="header",N.HGROUP="hgroup",N.HR="hr",N.HTML="html",N.I="i",N.IMG="img",N.IMAGE="image",N.INPUT="input",N.IFRAME="iframe",N.KEYGEN="keygen",N.LABEL="label",N.LI="li",N.LINK="link",N.LISTING="listing",N.MAIN="main",N.MALIGNMARK="malignmark",N.MARQUEE="marquee",N.MATH="math",N.MENU="menu",N.META="meta",N.MGLYPH="mglyph",N.MI="mi",N.MO="mo",N.MN="mn",N.MS="ms",N.MTEXT="mtext",N.NAV="nav",N.NOBR="nobr",N.NOFRAMES="noframes",N.NOEMBED="noembed",N.NOSCRIPT="noscript",N.OBJECT="object",N.OL="ol",N.OPTGROUP="optgroup",N.OPTION="option",N.P="p",N.PARAM="param",N.PLAINTEXT="plaintext",N.PRE="pre",N.RB="rb",N.RP="rp",N.RT="rt",N.RTC="rtc",N.RUBY="ruby",N.S="s",N.SCRIPT="script",N.SEARCH="search",N.SECTION="section",N.SELECT="select",N.SOURCE="source",N.SMALL="small",N.SPAN="span",N.STRIKE="strike",N.STRONG="strong",N.STYLE="style",N.SUB="sub",N.SUMMARY="summary",N.SUP="sup",N.TABLE="table",N.TBODY="tbody",N.TEMPLATE="template",N.TEXTAREA="textarea",N.TFOOT="tfoot",N.TD="td",N.TH="th",N.THEAD="thead",N.TITLE="title",N.TR="tr",N.TRACK="track",N.TT="tt",N.U="u",N.UL="ul",N.SVG="svg",N.VAR="var",N.WBR="wbr",N.XMP="xmp",(A=q||(q={}))[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP";let fs=new Map([[G.A,q.A],[G.ADDRESS,q.ADDRESS],[G.ANNOTATION_XML,q.ANNOTATION_XML],[G.APPLET,q.APPLET],[G.AREA,q.AREA],[G.ARTICLE,q.ARTICLE],[G.ASIDE,q.ASIDE],[G.B,q.B],[G.BASE,q.BASE],[G.BASEFONT,q.BASEFONT],[G.BGSOUND,q.BGSOUND],[G.BIG,q.BIG],[G.BLOCKQUOTE,q.BLOCKQUOTE],[G.BODY,q.BODY],[G.BR,q.BR],[G.BUTTON,q.BUTTON],[G.CAPTION,q.CAPTION],[G.CENTER,q.CENTER],[G.CODE,q.CODE],[G.COL,q.COL],[G.COLGROUP,q.COLGROUP],[G.DD,q.DD],[G.DESC,q.DESC],[G.DETAILS,q.DETAILS],[G.DIALOG,q.DIALOG],[G.DIR,q.DIR],[G.DIV,q.DIV],[G.DL,q.DL],[G.DT,q.DT],[G.EM,q.EM],[G.EMBED,q.EMBED],[G.FIELDSET,q.FIELDSET],[G.FIGCAPTION,q.FIGCAPTION],[G.FIGURE,q.FIGURE],[G.FONT,q.FONT],[G.FOOTER,q.FOOTER],[G.FOREIGN_OBJECT,q.FOREIGN_OBJECT],[G.FORM,q.FORM],[G.FRAME,q.FRAME],[G.FRAMESET,q.FRAMESET],[G.H1,q.H1],[G.H2,q.H2],[G.H3,q.H3],[G.H4,q.H4],[G.H5,q.H5],[G.H6,q.H6],[G.HEAD,q.HEAD],[G.HEADER,q.HEADER],[G.HGROUP,q.HGROUP],[G.HR,q.HR],[G.HTML,q.HTML],[G.I,q.I],[G.IMG,q.IMG],[G.IMAGE,q.IMAGE],[G.INPUT,q.INPUT],[G.IFRAME,q.IFRAME],[G.KEYGEN,q.KEYGEN],[G.LABEL,q.LABEL],[G.LI,q.LI],[G.LINK,q.LINK],[G.LISTING,q.LISTING],[G.MAIN,q.MAIN],[G.MALIGNMARK,q.MALIGNMARK],[G.MARQUEE,q.MARQUEE],[G.MATH,q.MATH],[G.MENU,q.MENU],[G.META,q.META],[G.MGLYPH,q.MGLYPH],[G.MI,q.MI],[G.MO,q.MO],[G.MN,q.MN],[G.MS,q.MS],[G.MTEXT,q.MTEXT],[G.NAV,q.NAV],[G.NOBR,q.NOBR],[G.NOFRAMES,q.NOFRAMES],[G.NOEMBED,q.NOEMBED],[G.NOSCRIPT,q.NOSCRIPT],[G.OBJECT,q.OBJECT],[G.OL,q.OL],[G.OPTGROUP,q.OPTGROUP],[G.OPTION,q.OPTION],[G.P,q.P],[G.PARAM,q.PARAM],[G.PLAINTEXT,q.PLAINTEXT],[G.PRE,q.PRE],[G.RB,q.RB],[G.RP,q.RP],[G.RT,q.RT],[G.RTC,q.RTC],[G.RUBY,q.RUBY],[G.S,q.S],[G.SCRIPT,q.SCRIPT],[G.SEARCH,q.SEARCH],[G.SECTION,q.SECTION],[G.SELECT,q.SELECT],[G.SOURCE,q.SOURCE],[G.SMALL,q.SMALL],[G.SPAN,q.SPAN],[G.STRIKE,q.STRIKE],[G.STRONG,q.STRONG],[G.STYLE,q.STYLE],[G.SUB,q.SUB],[G.SUMMARY,q.SUMMARY],[G.SUP,q.SUP],[G.TABLE,q.TABLE],[G.TBODY,q.TBODY],[G.TEMPLATE,q.TEMPLATE],[G.TEXTAREA,q.TEXTAREA],[G.TFOOT,q.TFOOT],[G.TD,q.TD],[G.TH,q.TH],[G.THEAD,q.THEAD],[G.TITLE,q.TITLE],[G.TR,q.TR],[G.TRACK,q.TRACK],[G.TT,q.TT],[G.U,q.U],[G.UL,q.UL],[G.SVG,q.SVG],[G.VAR,q.VAR],[G.WBR,q.WBR],[G.XMP,q.XMP]]);function fo(e){var t;return null!=(t=fs.get(e))?t:q.UNKNOWN}let fa=q,fl={[U.HTML]:new Set([fa.ADDRESS,fa.APPLET,fa.AREA,fa.ARTICLE,fa.ASIDE,fa.BASE,fa.BASEFONT,fa.BGSOUND,fa.BLOCKQUOTE,fa.BODY,fa.BR,fa.BUTTON,fa.CAPTION,fa.CENTER,fa.COL,fa.COLGROUP,fa.DD,fa.DETAILS,fa.DIR,fa.DIV,fa.DL,fa.DT,fa.EMBED,fa.FIELDSET,fa.FIGCAPTION,fa.FIGURE,fa.FOOTER,fa.FORM,fa.FRAME,fa.FRAMESET,fa.H1,fa.H2,fa.H3,fa.H4,fa.H5,fa.H6,fa.HEAD,fa.HEADER,fa.HGROUP,fa.HR,fa.HTML,fa.IFRAME,fa.IMG,fa.INPUT,fa.LI,fa.LINK,fa.LISTING,fa.MAIN,fa.MARQUEE,fa.MENU,fa.META,fa.NAV,fa.NOEMBED,fa.NOFRAMES,fa.NOSCRIPT,fa.OBJECT,fa.OL,fa.P,fa.PARAM,fa.PLAINTEXT,fa.PRE,fa.SCRIPT,fa.SECTION,fa.SELECT,fa.SOURCE,fa.STYLE,fa.SUMMARY,fa.TABLE,fa.TBODY,fa.TD,fa.TEMPLATE,fa.TEXTAREA,fa.TFOOT,fa.TH,fa.THEAD,fa.TITLE,fa.TR,fa.TRACK,fa.UL,fa.WBR,fa.XMP]),[U.MATHML]:new Set([fa.MI,fa.MO,fa.MN,fa.MS,fa.MTEXT,fa.ANNOTATION_XML]),[U.SVG]:new Set([fa.TITLE,fa.FOREIGN_OBJECT,fa.DESC]),[U.XLINK]:new Set,[U.XML]:new Set,[U.XMLNS]:new Set},fc=new Set([fa.H1,fa.H2,fa.H3,fa.H4,fa.H5,fa.H6]),fd=new Set([G.STYLE,G.SCRIPT,G.XMP,G.IFRAME,G.NOEMBED,G.NOFRAMES,G.PLAINTEXT]);e.s(["ATTRS",0,z,"DOCUMENT_MODE",0,$,"NS",0,U,"NUMBERED_HEADERS",0,fc,"SPECIAL_ELEMENTS",0,fl,"TAG_ID",0,q,"TAG_NAMES",0,G,"getTagID",0,fo,"hasUnescapedText",0,function(e,t){return fd.has(e)||t&&e===G.NOSCRIPT}],113515),(S=V||(V={}))[S.DATA=0]="DATA",S[S.RCDATA=1]="RCDATA",S[S.RAWTEXT=2]="RAWTEXT",S[S.SCRIPT_DATA=3]="SCRIPT_DATA",S[S.PLAINTEXT=4]="PLAINTEXT",S[S.TAG_OPEN=5]="TAG_OPEN",S[S.END_TAG_OPEN=6]="END_TAG_OPEN",S[S.TAG_NAME=7]="TAG_NAME",S[S.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",S[S.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",S[S.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",S[S.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",S[S.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",S[S.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",S[S.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",S[S.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",S[S.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",S[S.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",S[S.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",S[S.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",S[S.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",S[S.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",S[S.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",S[S.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",S[S.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",S[S.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",S[S.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",S[S.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",S[S.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",S[S.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",S[S.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",S[S.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",S[S.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",S[S.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",S[S.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",S[S.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",S[S.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",S[S.BOGUS_COMMENT=40]="BOGUS_COMMENT",S[S.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",S[S.COMMENT_START=42]="COMMENT_START",S[S.COMMENT_START_DASH=43]="COMMENT_START_DASH",S[S.COMMENT=44]="COMMENT",S[S.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",S[S.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",S[S.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",S[S.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",S[S.COMMENT_END_DASH=49]="COMMENT_END_DASH",S[S.COMMENT_END=50]="COMMENT_END",S[S.COMMENT_END_BANG=51]="COMMENT_END_BANG",S[S.DOCTYPE=52]="DOCTYPE",S[S.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",S[S.DOCTYPE_NAME=54]="DOCTYPE_NAME",S[S.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",S[S.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",S[S.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",S[S.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",S[S.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",S[S.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",S[S.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",S[S.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",S[S.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",S[S.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",S[S.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",S[S.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",S[S.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",S[S.CDATA_SECTION=68]="CDATA_SECTION",S[S.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",S[S.CDATA_SECTION_END=70]="CDATA_SECTION_END",S[S.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",S[S.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND";let fu={DATA:V.DATA,RCDATA:V.RCDATA,RAWTEXT:V.RAWTEXT,SCRIPT_DATA:V.SCRIPT_DATA,PLAINTEXT:V.PLAINTEXT,CDATA_SECTION:V.CDATA_SECTION};function fp(e){return e>=D.LATIN_CAPITAL_A&&e<=D.LATIN_CAPITAL_Z}function fh(e){return e>=D.LATIN_SMALL_A&&e<=D.LATIN_SMALL_Z||fp(e)}function ff(e){return fh(e)||e>=D.DIGIT_0&&e<=D.DIGIT_9}function fm(e){return e===D.SPACE||e===D.LINE_FEED||e===D.TABULATION||e===D.FORM_FEED}function fg(e){return fm(e)||e===D.SOLIDUS||e===D.GREATER_THAN_SIGN}class fb{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=V.DATA,this.returnState=V.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new h8(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new fi(ft,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(R.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(R.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=function(e){if(e===D.NULL)return R.nullCharacterReference;if(e>1114111)return R.characterReferenceOutsideUnicodeRange;if(h6(e))return R.surrogateCharacterReference;if(h7(e))return R.noncharacterCharacterReference;if(h9(e)||e===D.CARRIAGE_RETURN)return R.controlCharacterReference;return null}(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;null==(r=(n=this.handler).onParseError)||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||null==e||e())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return!!this.preprocessor.startsWith(e,t)&&(this._advanceBy(e.length-1),!0)}_createStartTagToken(){this.currentToken={type:L.START_TAG,tagName:"",tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:L.END_TAG,tagName:"",tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:L.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:L.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;let n=this.currentToken;null===fe(n,this.currentAttr.name)?(n.attrs.push(this.currentAttr),n.location&&this.currentLocation&&((null!=(e=(t=n.location).attrs)?e:t.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue())):this._err(R.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=fo(e.tagName),e.type===L.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(R.endTagWithAttributes),e.selfClosing&&this._err(R.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case L.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case L.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case L.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:L.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=fm(e)?L.WHITESPACE_CHARACTER:e===D.NULL?L.NULL_CHARACTER:L.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(L.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=V.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?H.Attribute:H.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===V.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case V.DATA:this._stateData(e);break;case V.RCDATA:this._stateRcdata(e);break;case V.RAWTEXT:this._stateRawtext(e);break;case V.SCRIPT_DATA:this._stateScriptData(e);break;case V.PLAINTEXT:this._statePlaintext(e);break;case V.TAG_OPEN:this._stateTagOpen(e);break;case V.END_TAG_OPEN:this._stateEndTagOpen(e);break;case V.TAG_NAME:this._stateTagName(e);break;case V.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case V.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case V.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case V.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case V.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case V.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case V.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case V.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case V.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case V.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case V.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case V.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case V.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case V.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case V.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case V.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case V.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case V.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case V.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case V.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case V.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case V.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case V.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case V.BOGUS_COMMENT:this._stateBogusComment(e);break;case V.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case V.COMMENT_START:this._stateCommentStart(e);break;case V.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case V.COMMENT:this._stateComment(e);break;case V.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case V.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case V.COMMENT_END:this._stateCommentEnd(e);break;case V.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case V.DOCTYPE:this._stateDoctype(e);break;case V.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case V.DOCTYPE_NAME:this._stateDoctypeName(e);break;case V.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case V.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case V.CDATA_SECTION:this._stateCdataSection(e);break;case V.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case V.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case V.CHARACTER_REFERENCE:this._stateCharacterReference();break;case V.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error("Unknown state")}}_stateData(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.TAG_OPEN;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitCodePoint(e);break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case D.AMPERSAND:this._startCharacterReference();break;case D.LESS_THAN_SIGN:this.state=V.RCDATA_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.RAWTEXT_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(fh(e))this._createStartTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case D.EXCLAMATION_MARK:this.state=V.MARKUP_DECLARATION_OPEN;break;case D.SOLIDUS:this.state=V.END_TAG_OPEN;break;case D.QUESTION_MARK:this._err(R.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e);break;case D.EOF:this._err(R.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(R.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=V.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(fh(e))this._createEndTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case D.GREATER_THAN_SIGN:this._err(R.missingEndTagName),this.state=V.DATA;break;case D.EOF:this._err(R.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(R.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),t.tagName+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(fp(e)?e+32:e)}}_stateRcdataLessThanSign(e){e===D.SOLIDUS?this.state=V.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=V.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){fh(e)?(this.state=V.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=V.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();switch(this._createEndTagToken(),this.currentToken.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=V.BEFORE_ATTRIBUTE_NAME,!1;case D.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=V.SELF_CLOSING_START_TAG,!1;case D.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=V.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===D.SOLIDUS?this.state=V.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){fh(e)?(this.state=V.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case D.SOLIDUS:this.state=V.SCRIPT_DATA_END_TAG_OPEN;break;case D.EXCLAMATION_MARK:this.state=V.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=V.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){fh(e)?(this.state=V.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===D.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===D.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case D.HYPHEN_MINUS:this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(">");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===D.SOLIDUS?this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:fh(e)?(this._emitChars("<"),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){fh(e)?(this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(h4,!1)&&fg(this.preprocessor.peek(h4.length))){this._emitCodePoint(e);for(let e=0;e<h4.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case D.HYPHEN_MINUS:this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(">");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===D.SOLIDUS?(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(h4,!1)&&fg(this.preprocessor.peek(h4.length))){this._emitCodePoint(e);for(let e=0;e<h4.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.SOLIDUS:case D.GREATER_THAN_SIGN:case D.EOF:this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case D.EQUALS_SIGN:this._err(R.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=V.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:case D.SOLIDUS:case D.GREATER_THAN_SIGN:case D.EOF:this._leaveAttrName(),this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case D.EQUALS_SIGN:this._leaveAttrName(),this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case D.QUOTATION_MARK:case D.APOSTROPHE:case D.LESS_THAN_SIGN:this._err(R.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.name+="�";break;default:this.currentAttr.name+=String.fromCodePoint(fp(e)?e+32:e)}}_stateAfterAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case D.EQUALS_SIGN:this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:this.state=V.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case D.APOSTROPHE:this.state=V.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingAttributeValue),this.state=V.DATA,this.emitCurrentTagToken();break;default:this.state=V.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case D.APOSTROPHE:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.AMPERSAND:this._startCharacterReference();break;case D.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.QUOTATION_MARK:case D.APOSTROPHE:case D.LESS_THAN_SIGN:case D.EQUALS_SIGN:case D.GRAVE_ACCENT:this._err(R.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.SOLIDUS:this._leaveAttrValue(),this.state=V.SELF_CLOSING_START_TAG;break;case D.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._err(R.missingWhitespaceBetweenAttributes),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case D.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._err(R.unexpectedSolidusInTag),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),t.data+="�";break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch("--",!0)?(this._createCommentToken(3),this.state=V.COMMENT_START):this._consumeSequenceIfMatch(h5,!1)?(this.currentLocation=this.getCurrentLocation(h5.length+1),this.state=V.DOCTYPE):this._consumeSequenceIfMatch(h3,!0)?this.inForeignNode?this.state=V.CDATA_SECTION:(this._err(R.cdataInHtmlContent),this._createCommentToken(h3.length+1),this.currentToken.data="[CDATA[",this.state=V.BOGUS_COMMENT):this._ensureHibernation()||(this._err(R.incorrectlyOpenedComment),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_START_DASH;break;case D.GREATER_THAN_SIGN:{this._err(R.abruptClosingOfEmptyComment),this.state=V.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case D.GREATER_THAN_SIGN:this._err(R.abruptClosingOfEmptyComment),this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=V.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END_DASH;break;case D.LESS_THAN_SIGN:t.data+="<",this.state=V.COMMENT_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.data+="�";break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case D.EXCLAMATION_MARK:t.data+="!",this.state=V.COMMENT_LESS_THAN_SIGN_BANG;break;case D.LESS_THAN_SIGN:t.data+="<";break;default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===D.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=V.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===D.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=V.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==D.GREATER_THAN_SIGN&&e!==D.EOF&&this._err(R.nestedComment),this.state=V.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case D.EXCLAMATION_MARK:this.state=V.COMMENT_END_BANG;break;case D.HYPHEN_MINUS:t.data+="-";break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--",this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:t.data+="--!",this.state=V.COMMENT_END_DASH;break;case D.GREATER_THAN_SIGN:this._err(R.incorrectlyClosedComment),this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--!",this.state=V.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case D.EOF:{this._err(R.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(R.missingWhitespaceBeforeDoctypeName),this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(fp(e))this._createDoctypeToken(String.fromCharCode(e+32)),this.state=V.DOCTYPE_NAME;else switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.NULL:this._err(R.unexpectedNullCharacter),this._createDoctypeToken("�"),this.state=V.DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:{this._err(R.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=V.DATA;break}case D.EOF:{this._err(R.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=V.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.AFTER_DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.NULL:this._err(R.unexpectedNullCharacter),t.name+="�";break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(fp(e)?e+32:e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch("public",!1)?this.state=V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch("system",!1)?this.state=V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(R.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.publicId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case D.APOSTROPHE:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.publicId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.QUOTATION_MARK:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.systemId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case D.APOSTROPHE:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.systemId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.NULL:this._err(R.unexpectedNullCharacter);break;case D.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case D.RIGHT_SQUARE_BRACKET:this.state=V.CDATA_SECTION_BRACKET;break;case D.EOF:this._err(R.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===D.RIGHT_SQUARE_BRACKET?this.state=V.CDATA_SECTION_END:(this._emitChars("]"),this.state=V.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA;break;case D.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=V.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}0===e?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(D.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&ff(this.preprocessor.peek(1))?V.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){ff(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===D.SEMICOLON&&this._err(R.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}let fy=new Set([q.DD,q.DT,q.LI,q.OPTGROUP,q.OPTION,q.P,q.RB,q.RP,q.RT,q.RTC]),fx=new Set([...fy,q.CAPTION,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]),fv=new Set([q.APPLET,q.CAPTION,q.HTML,q.MARQUEE,q.OBJECT,q.TABLE,q.TD,q.TEMPLATE,q.TH]),fw=new Set([...fv,q.OL,q.UL]),fE=new Set([...fv,q.BUTTON]),fk=new Set([q.ANNOTATION_XML,q.MI,q.MN,q.MO,q.MS,q.MTEXT]),fT=new Set([q.DESC,q.FOREIGN_OBJECT,q.TITLE]),fN=new Set([q.TR,q.TEMPLATE,q.HTML]),fA=new Set([q.TBODY,q.TFOOT,q.THEAD,q.TEMPLATE,q.HTML]),fS=new Set([q.TABLE,q.TEMPLATE,q.HTML]),fC=new Set([q.TD,q.TH]);class f_{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=q.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===q.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===U.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==U.HTML)this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(fc,U.HTML)}popUntilTableCellPopped(){this.popUntilPopped(fC,U.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return -1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(fS,U.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fA,U.HTML)}clearBackToTableRowContext(){this.clearBackTo(fN,U.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===q.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===q.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case U.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case U.SVG:if(fT.has(r))return!1;break;case U.MATHML:if(fk.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,fv)}hasInListItemScope(e){return this.hasInDynamicScope(e,fw)}hasInButtonScope(e){return this.hasInDynamicScope(e,fE)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case U.HTML:if(fc.has(t))return!0;if(fv.has(t))return!1;break;case U.SVG:if(fT.has(t))return!1;break;case U.MATHML:if(fk.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===U.HTML)switch(this.tagIDs[t]){case e:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===U.HTML)switch(this.tagIDs[e]){case q.TBODY:case q.THEAD:case q.TFOOT:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===U.HTML)switch(this.tagIDs[t]){case e:return!0;case q.OPTION:case q.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&fy.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&fx.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;void 0!==this.currentTagId&&this.currentTagId!==e&&fx.has(this.currentTagId);)this.pop()}}(C=W||(W={}))[C.Marker=0]="Marker",C[C.Element=1]="Element";let fM={type:W.Marker};class fO{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===W.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===s){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<3)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<3)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1)>=3&&this.entries.splice(t.idx,1)}}insertMarker(){this.entries.unshift(fM)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:W.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:W.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);-1!==t&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(fM);-1===e?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===W.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===W.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===W.Element&&t.element===e)}}let fI={createDocument:()=>({nodeName:"#document",mode:$.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(e,t,n)=>({nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}),createCommentNode:e=>({nodeName:"#comment",data:e,parentNode:null}),createTextNode:e=>({nodeName:"#text",value:e,parentNode:null}),appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent:e=>e.content,setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>"#documentType"===e.nodeName);i?(i.name=t,i.publicId=n,i.systemId=r):fI.appendChild(e,{nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null})},setDocumentMode(e,t){e.mode=t},getDocumentMode:e=>e.mode,detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(fI.isTextNode(n)){n.value+=t;return}}fI.appendChild(e,fI.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&fI.isTextNode(r)?r.value+=t:fI.insertBefore(e,fI.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild:e=>e.childNodes[0],getChildNodes:e=>e.childNodes,getParentNode:e=>e.parentNode,getAttrList:e=>e.attrs,getTagName:e=>e.tagName,getNamespaceURI:e=>e.namespaceURI,getTextNodeContent:e=>e.value,getCommentNodeContent:e=>e.data,getDocumentTypeNodeName:e=>e.name,getDocumentTypeNodePublicId:e=>e.publicId,getDocumentTypeNodeSystemId:e=>e.systemId,isTextNode:e=>"#text"===e.nodeName,isCommentNode:e=>"#comment"===e.nodeName,isDocumentTypeNode:e=>"#documentType"===e.nodeName,isElementNode:e=>Object.prototype.hasOwnProperty.call(e,"tagName"),setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation:e=>e.sourceCodeLocation,updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},fD="html",fR=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],fL=[...fR,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],fj=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),fP=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],fB=[...fP,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function fF(e,t){return t.some(t=>e.startsWith(t))}let fH=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),fU=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:U.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:U.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:U.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:U.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:U.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:U.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:U.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:U.XML}],["xml:space",{prefix:"xml",name:"space",namespace:U.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:U.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:U.XMLNS}]]),fz=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),f$=new Set([q.B,q.BIG,q.BLOCKQUOTE,q.BODY,q.BR,q.CENTER,q.CODE,q.DD,q.DIV,q.DL,q.DT,q.EM,q.EMBED,q.H1,q.H2,q.H3,q.H4,q.H5,q.H6,q.HEAD,q.HR,q.I,q.IMG,q.LI,q.LISTING,q.MENU,q.META,q.NOBR,q.OL,q.P,q.PRE,q.RUBY,q.S,q.SMALL,q.SPAN,q.STRONG,q.STRIKE,q.SUB,q.SUP,q.TABLE,q.TT,q.U,q.UL,q.VAR]);function fG(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}}function fq(e){for(let t=0;t<e.attrs.length;t++){let n=fH.get(e.attrs[t].name);null!=n&&(e.attrs[t].name=n)}}function fV(e){for(let t=0;t<e.attrs.length;t++){let n=fU.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}(_=K||(K={}))[_.INITIAL=0]="INITIAL",_[_.BEFORE_HTML=1]="BEFORE_HTML",_[_.BEFORE_HEAD=2]="BEFORE_HEAD",_[_.IN_HEAD=3]="IN_HEAD",_[_.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",_[_.AFTER_HEAD=5]="AFTER_HEAD",_[_.IN_BODY=6]="IN_BODY",_[_.TEXT=7]="TEXT",_[_.IN_TABLE=8]="IN_TABLE",_[_.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",_[_.IN_CAPTION=10]="IN_CAPTION",_[_.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",_[_.IN_TABLE_BODY=12]="IN_TABLE_BODY",_[_.IN_ROW=13]="IN_ROW",_[_.IN_CELL=14]="IN_CELL",_[_.IN_SELECT=15]="IN_SELECT",_[_.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",_[_.IN_TEMPLATE=17]="IN_TEMPLATE",_[_.AFTER_BODY=18]="AFTER_BODY",_[_.IN_FRAMESET=19]="IN_FRAMESET",_[_.AFTER_FRAMESET=20]="AFTER_FRAMESET",_[_.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",_[_.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET";let fW={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},fK=new Set([q.TABLE,q.TBODY,q.TFOOT,q.THEAD,q.TR]),fY={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:fI,onParseError:null};class fX{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=K.INITIAL,this.originalInsertionMode=K.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...fY,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=t?t:this.treeAdapter.createDocument(),this.tokenizer=new fb(this.options,this),this.activeFormattingElements=new fO(this.treeAdapter),this.fragmentContextID=n?fo(this.treeAdapter.getTagName(n)):q.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new f_(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...fY,...t};null!=e||(e=n.treeAdapter.createElement(G.TEMPLATE,U.HTML,[]));let r=n.treeAdapter.createElement("documentmock",U.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===q.TEMPLATE&&i.tmplInsertionModeStack.unshift(K.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){var r;if(!this.onParseError)return;let i=null!=(r=e.location)?r:fW,s={code:t,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:n?i.startLine:i.endLine,endCol:n?i.startCol:i.endCol,endOffset:n?i.startOffset:i.endOffset};this.onParseError(s)}onItemPush(e,t,n){var r,i;null==(i=(r=this.treeAdapter).onItemPush)||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),null==(r=(n=this.treeAdapter).onItemPop)||r.call(n,e,this.openElements.current),t){let e,t;0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===U.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==e&&void 0!==t&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,U.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=K.TEXT}switchToPlaintextParsing(){this.insertionMode=K.TEXT,this.originalInsertionMode=K.IN_BODY,this.tokenizer.state=fu.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===G.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===U.HTML)switch(this.fragmentContextID){case q.TITLE:case q.TEXTAREA:this.tokenizer.state=fu.RCDATA;break;case q.STYLE:case q.XMP:case q.IFRAME:case q.NOEMBED:case q.NOFRAMES:case q.NOSCRIPT:this.tokenizer.state=fu.RAWTEXT;break;case q.SCRIPT:this.tokenizer.state=fu.SCRIPT_DATA;break;case q.PLAINTEXT:this.tokenizer.state=fu.PLAINTEXT}}_setDocumentType(e){let t=e.name||"",n=e.publicId||"",r=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=t?t:this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,U.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,U.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(G.HTML,U.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,q.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=n?r.lastIndexOf(n):r.length,s=r[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===L.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){let t,n;return!!this.currentNotInHTML&&(0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,(e.tagID!==q.SVG||this.treeAdapter.getTagName(t)!==G.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(t)!==U.MATHML)&&(this.tokenizer.inForeignNode||(e.tagID===q.MGLYPH||e.tagID===q.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,t,U.HTML)))}_processToken(e){switch(e.type){case L.CHARACTER:this.onCharacter(e);break;case L.NULL_CHARACTER:this.onNullCharacter(e);break;case L.COMMENT:this.onComment(e);break;case L.DOCTYPE:this.onDoctype(e);break;case L.START_TAG:this._processStartTag(e);break;case L.END_TAG:this.onEndTag(e);break;case L.EOF:this.onEof(e);break;case L.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){let r=this.treeAdapter.getNamespaceURI(t),i=this.treeAdapter.getAttrList(t);return(!n||n===U.HTML)&&function(e,t,n){if(t===U.MATHML&&e===q.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===z.ENCODING){let t=n[e].value.toLowerCase();return"text/html"===t||"application/xhtml+xml"===t}}return t===U.SVG&&(e===q.FOREIGN_OBJECT||e===q.DESC||e===q.TITLE)}(e,r,i)||(!n||n===U.MATHML)&&r===U.MATHML&&(e===q.MI||e===q.MO||e===q.MN||e===q.MS||e===q.MTEXT)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===W.Marker||this.openElements.contains(e.element)),n=-1===t?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=K.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(q.P),this.openElements.popUntilTagNamePopped(q.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(0===e&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case q.TR:this.insertionMode=K.IN_ROW;return;case q.TBODY:case q.THEAD:case q.TFOOT:this.insertionMode=K.IN_TABLE_BODY;return;case q.CAPTION:this.insertionMode=K.IN_CAPTION;return;case q.COLGROUP:this.insertionMode=K.IN_COLUMN_GROUP;return;case q.TABLE:this.insertionMode=K.IN_TABLE;return;case q.BODY:this.insertionMode=K.IN_BODY;return;case q.FRAMESET:this.insertionMode=K.IN_FRAMESET;return;case q.SELECT:return void this._resetInsertionModeForSelect(e);case q.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case q.HTML:this.insertionMode=this.headElement?K.AFTER_HEAD:K.BEFORE_HEAD;return;case q.TD:case q.TH:if(e>0){this.insertionMode=K.IN_CELL;return}break;case q.HEAD:if(e>0){this.insertionMode=K.IN_HEAD;return}}this.insertionMode=K.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===q.TEMPLATE)break;if(e===q.TABLE){this.insertionMode=K.IN_SELECT_IN_TABLE;return}}this.insertionMode=K.IN_SELECT}_isElementCausesFosterParenting(e){return fK.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case q.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===U.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case q.TABLE:{let n=this.treeAdapter.getParentNode(t);if(n)return{parent:n,beforeElement:t};return{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return fl[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var t,n;return void(t=this,n=e,t._insertCharacters(n),t.framesetOk=!1)}switch(this.insertionMode){case K.INITIAL:f0(this,e);break;case K.BEFORE_HTML:f1(this,e);break;case K.BEFORE_HEAD:f2(this,e);break;case K.IN_HEAD:f4(this,e);break;case K.IN_HEAD_NO_SCRIPT:f6(this,e);break;case K.AFTER_HEAD:f9(this,e);break;case K.IN_BODY:case K.IN_CAPTION:case K.IN_CELL:case K.IN_TEMPLATE:me(this,e);break;case K.TEXT:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mc(this,e);break;case K.IN_TABLE_TEXT:mf(this,e);break;case K.IN_COLUMN_GROUP:my(this,e);break;case K.AFTER_BODY:mS(this,e);break;case K.AFTER_AFTER_BODY:mC(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var t,n;return void(t=this,(n=e).chars="�",t._insertCharacters(n))}switch(this.insertionMode){case K.INITIAL:f0(this,e);break;case K.BEFORE_HTML:f1(this,e);break;case K.BEFORE_HEAD:f2(this,e);break;case K.IN_HEAD:f4(this,e);break;case K.IN_HEAD_NO_SCRIPT:f6(this,e);break;case K.AFTER_HEAD:f9(this,e);break;case K.TEXT:this._insertCharacters(e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mc(this,e);break;case K.IN_COLUMN_GROUP:my(this,e);break;case K.AFTER_BODY:mS(this,e);break;case K.AFTER_AFTER_BODY:mC(this,e)}}onComment(e){var t,n,r,i;if(this.skipNextNewLine=!1,this.currentNotInHTML)return void fJ(this,e);switch(this.insertionMode){case K.INITIAL:case K.BEFORE_HTML:case K.BEFORE_HEAD:case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:case K.IN_BODY:case K.IN_TABLE:case K.IN_CAPTION:case K.IN_COLUMN_GROUP:case K.IN_TABLE_BODY:case K.IN_ROW:case K.IN_CELL:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:case K.IN_TEMPLATE:case K.IN_FRAMESET:case K.AFTER_FRAMESET:fJ(this,e);break;case K.IN_TABLE_TEXT:mm(this,e);break;case K.AFTER_BODY:t=this,n=e,t._appendCommentNode(n,t.openElements.items[0]);break;case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:r=this,i=e,r._appendCommentNode(i,r.document)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case K.INITIAL:!function(e,t){e._setDocumentType(t);let n=t.forceQuirks?$.QUIRKS:function(e){if(e.name!==fD)return $.QUIRKS;let{systemId:t}=e;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return $.QUIRKS;let{publicId:n}=e;if(null!==n){if(n=n.toLowerCase(),fj.has(n))return $.QUIRKS;let e=null===t?fL:fR;if(fF(n,e))return $.QUIRKS;if(fF(n,e=null===t?fP:fB))return $.LIMITED_QUIRKS}return $.NO_QUIRKS}(t);(t.name!==fD||null!==t.publicId||null!==t.systemId&&"about:legacy-compat"!==t.systemId)&&e._err(t,R.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=K.BEFORE_HTML}(this,e);break;case K.BEFORE_HEAD:case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:this._err(e,R.misplacedDoctype);break;case K.IN_TABLE_TEXT:mm(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,R.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?function(e,t){let n;if((n=t.tagID)===q.FONT&&t.attrs.some(({name:e})=>e===z.COLOR||e===z.SIZE||e===z.FACE)||f$.has(n))m_(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);if(r===U.MATHML)fG(t);else if(r===U.SVG){let e;null!=(e=fz.get(t.tagName))&&(t.tagName=e,t.tagID=fo(t.tagName)),fq(t)}fV(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case K.INITIAL:f0(this,e);break;case K.BEFORE_HTML:t=this,(n=e).tagID===q.HTML?(t._insertElement(n,U.HTML),t.insertionMode=K.BEFORE_HEAD):f1(t,n);break;case K.BEFORE_HEAD:var t,n,r,i,s,o,a,l,c,d,u,p,h=this,f=e;switch(f.tagID){case q.HTML:ms(h,f);break;case q.HEAD:h._insertElement(f,U.HTML),h.headElement=h.openElements.current,h.insertionMode=K.IN_HEAD;break;default:f2(h,f)}break;case K.IN_HEAD:f3(this,e);break;case K.IN_HEAD_NO_SCRIPT:var m=this,g=e;switch(g.tagID){case q.HTML:ms(m,g);break;case q.BASEFONT:case q.BGSOUND:case q.HEAD:case q.LINK:case q.META:case q.NOFRAMES:case q.STYLE:f3(m,g);break;case q.NOSCRIPT:m._err(g,R.nestedNoscriptInHead);break;default:f6(m,g)}break;case K.AFTER_HEAD:var b=this,y=e;switch(y.tagID){case q.HTML:ms(b,y);break;case q.BODY:b._insertElement(y,U.HTML),b.framesetOk=!1,b.insertionMode=K.IN_BODY;break;case q.FRAMESET:b._insertElement(y,U.HTML),b.insertionMode=K.IN_FRAMESET;break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:b._err(y,R.abandonedHeadElementChild),b.openElements.push(b.headElement,q.HEAD),f3(b,y),b.openElements.remove(b.headElement);break;case q.HEAD:b._err(y,R.misplacedStartTagForHeadElement);break;default:f9(b,y)}break;case K.IN_BODY:ms(this,e);break;case K.IN_TABLE:md(this,e);break;case K.IN_TABLE_TEXT:mm(this,e);break;case K.IN_CAPTION:let x;r=this,x=(i=e).tagID,mg.has(x)?r.openElements.hasInTableScope(q.CAPTION)&&(r.openElements.generateImpliedEndTags(),r.openElements.popUntilTagNamePopped(q.CAPTION),r.activeFormattingElements.clearToLastMarker(),r.insertionMode=K.IN_TABLE,md(r,i)):ms(r,i);break;case K.IN_COLUMN_GROUP:mb(this,e);break;case K.IN_TABLE_BODY:mx(this,e);break;case K.IN_ROW:mw(this,e);break;case K.IN_CELL:let v;s=this,v=(o=e).tagID,mg.has(v)?(s.openElements.hasInTableScope(q.TD)||s.openElements.hasInTableScope(q.TH))&&(s._closeTableCell(),mw(s,o)):ms(s,o);break;case K.IN_SELECT:mk(this,e);break;case K.IN_SELECT_IN_TABLE:let w;a=this,(w=(l=e).tagID)===q.CAPTION||w===q.TABLE||w===q.TBODY||w===q.TFOOT||w===q.THEAD||w===q.TR||w===q.TD||w===q.TH?(a.openElements.popUntilTagNamePopped(q.SELECT),a._resetInsertionMode(),a._processStartTag(l)):mk(a,l);break;case K.IN_TEMPLATE:var E=this,k=e;switch(k.tagID){case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:f3(E,k);break;case q.CAPTION:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:E.tmplInsertionModeStack[0]=K.IN_TABLE,E.insertionMode=K.IN_TABLE,md(E,k);break;case q.COL:E.tmplInsertionModeStack[0]=K.IN_COLUMN_GROUP,E.insertionMode=K.IN_COLUMN_GROUP,mb(E,k);break;case q.TR:E.tmplInsertionModeStack[0]=K.IN_TABLE_BODY,E.insertionMode=K.IN_TABLE_BODY,mx(E,k);break;case q.TD:case q.TH:E.tmplInsertionModeStack[0]=K.IN_ROW,E.insertionMode=K.IN_ROW,mw(E,k);break;default:E.tmplInsertionModeStack[0]=K.IN_BODY,E.insertionMode=K.IN_BODY,ms(E,k)}break;case K.AFTER_BODY:c=this,(d=e).tagID===q.HTML?ms(c,d):mS(c,d);break;case K.IN_FRAMESET:var T=this,N=e;switch(N.tagID){case q.HTML:ms(T,N);break;case q.FRAMESET:T._insertElement(N,U.HTML);break;case q.FRAME:T._appendElement(N,U.HTML),N.ackSelfClosing=!0;break;case q.NOFRAMES:f3(T,N)}break;case K.AFTER_FRAMESET:var A=this,S=e;switch(S.tagID){case q.HTML:ms(A,S);break;case q.NOFRAMES:f3(A,S)}break;case K.AFTER_AFTER_BODY:u=this,(p=e).tagID===q.HTML?ms(u,p):mC(u,p);break;case K.AFTER_AFTER_FRAMESET:var C=this,_=e;switch(_.tagID){case q.HTML:ms(C,_);break;case q.NOFRAMES:f3(C,_)}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?function(e,t){if(t.tagID===q.P||t.tagID===q.BR){m_(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===U.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case K.INITIAL:f0(this,e);break;case K.BEFORE_HTML:let t;r=this,((t=(i=e).tagID)===q.HTML||t===q.HEAD||t===q.BODY||t===q.BR)&&f1(r,i);break;case K.BEFORE_HEAD:let n;s=this,(n=(o=e).tagID)===q.HEAD||n===q.BODY||n===q.HTML||n===q.BR?f2(s,o):s._err(o,R.endTagWithoutMatchingOpenElement);break;case K.IN_HEAD:var r,i,s,o,a,l,c,d,u,p,h,f,m=this,g=e;switch(g.tagID){case q.HEAD:m.openElements.pop(),m.insertionMode=K.AFTER_HEAD;break;case q.BODY:case q.BR:case q.HTML:f4(m,g);break;case q.TEMPLATE:f5(m,g);break;default:m._err(g,R.endTagWithoutMatchingOpenElement)}break;case K.IN_HEAD_NO_SCRIPT:var b=this,y=e;switch(y.tagID){case q.NOSCRIPT:b.openElements.pop(),b.insertionMode=K.IN_HEAD;break;case q.BR:f6(b,y);break;default:b._err(y,R.endTagWithoutMatchingOpenElement)}break;case K.AFTER_HEAD:var x=this,v=e;switch(v.tagID){case q.BODY:case q.HTML:case q.BR:f9(x,v);break;case q.TEMPLATE:f5(x,v);break;default:x._err(v,R.endTagWithoutMatchingOpenElement)}break;case K.IN_BODY:ma(this,e);break;case K.TEXT:a=this,e.tagID===q.SCRIPT&&(null==(l=a.scriptHandler)||l.call(a,a.openElements.current)),a.openElements.pop(),a.insertionMode=a.originalInsertionMode;break;case K.IN_TABLE:mu(this,e);break;case K.IN_TABLE_TEXT:mm(this,e);break;case K.IN_CAPTION:var w=this,E=e;let k=E.tagID;switch(k){case q.CAPTION:case q.TABLE:w.openElements.hasInTableScope(q.CAPTION)&&(w.openElements.generateImpliedEndTags(),w.openElements.popUntilTagNamePopped(q.CAPTION),w.activeFormattingElements.clearToLastMarker(),w.insertionMode=K.IN_TABLE,k===q.TABLE&&mu(w,E));break;case q.BODY:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:ma(w,E)}break;case K.IN_COLUMN_GROUP:var T=this,N=e;switch(N.tagID){case q.COLGROUP:T.openElements.currentTagId===q.COLGROUP&&(T.openElements.pop(),T.insertionMode=K.IN_TABLE);break;case q.TEMPLATE:f5(T,N);break;case q.COL:break;default:my(T,N)}break;case K.IN_TABLE_BODY:mv(this,e);break;case K.IN_ROW:mE(this,e);break;case K.IN_CELL:var A=this,S=e;let C=S.tagID;switch(C){case q.TD:case q.TH:A.openElements.hasInTableScope(C)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(C),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=K.IN_ROW);break;case q.TABLE:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:A.openElements.hasInTableScope(C)&&(A._closeTableCell(),mE(A,S));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:break;default:ma(A,S)}break;case K.IN_SELECT:mT(this,e);break;case K.IN_SELECT_IN_TABLE:let _;c=this,(_=(d=e).tagID)===q.CAPTION||_===q.TABLE||_===q.TBODY||_===q.TFOOT||_===q.THEAD||_===q.TR||_===q.TD||_===q.TH?c.openElements.hasInTableScope(_)&&(c.openElements.popUntilTagNamePopped(q.SELECT),c._resetInsertionMode(),c.onEndTag(d)):mT(c,d);break;case K.IN_TEMPLATE:u=this,(p=e).tagID===q.TEMPLATE&&f5(u,p);break;case K.AFTER_BODY:mA(this,e);break;case K.IN_FRAMESET:h=this,e.tagID===q.FRAMESET&&!h.openElements.isRootHtmlElementCurrent()&&(h.openElements.pop(),h.fragmentContext||h.openElements.currentTagId===q.FRAMESET||(h.insertionMode=K.AFTER_FRAMESET));break;case K.AFTER_FRAMESET:f=this,e.tagID===q.HTML&&(f.insertionMode=K.AFTER_AFTER_FRAMESET);break;case K.AFTER_AFTER_BODY:mC(this,e)}}onEof(e){switch(this.insertionMode){case K.INITIAL:f0(this,e);break;case K.BEFORE_HTML:f1(this,e);break;case K.BEFORE_HEAD:f2(this,e);break;case K.IN_HEAD:f4(this,e);break;case K.IN_HEAD_NO_SCRIPT:f6(this,e);break;case K.AFTER_HEAD:f9(this,e);break;case K.IN_BODY:case K.IN_TABLE:case K.IN_CAPTION:case K.IN_COLUMN_GROUP:case K.IN_TABLE_BODY:case K.IN_ROW:case K.IN_CELL:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:ml(this,e);break;case K.TEXT:var t,n;t=this,n=e,t._err(n,R.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(n);break;case K.IN_TABLE_TEXT:mm(this,e);break;case K.IN_TEMPLATE:mN(this,e);break;case K.AFTER_BODY:case K.IN_FRAMESET:case K.AFTER_FRAMESET:case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:fZ(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===D.LINE_FEED)){if(1===e.chars.length)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)return void this._insertCharacters(e);switch(this.insertionMode){case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:case K.TEXT:case K.IN_COLUMN_GROUP:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:case K.IN_FRAMESET:case K.AFTER_FRAMESET:this._insertCharacters(e);break;case K.IN_BODY:case K.IN_CAPTION:case K.IN_CELL:case K.IN_TEMPLATE:case K.AFTER_BODY:case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:f8(this,e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mc(this,e);break;case K.IN_TABLE_TEXT:mh(this,e)}}}function fQ(e,t){for(let n=0;n<8;n++){let n=function(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):mo(e,t),n}(e,t);if(!n)break;let r=function(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=function(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,o=i;o!==n;s++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),a=n&&s>=3;!n||a?(a&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=function(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}(e,r,n.element),s=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),s&&function(e,t,n){let r=fo(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===q.TEMPLATE&&i===U.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}(e,s,i),function(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}(e,r,n)}}function fJ(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function fZ(e,t){if(e.stopped=!0,t.location){let n=2*!e.fragmentContext;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function f0(e,t){e._err(t,R.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,$.QUIRKS),e.insertionMode=K.BEFORE_HTML,e._processToken(t)}function f1(e,t){e._insertFakeRootElement(),e.insertionMode=K.BEFORE_HEAD,e._processToken(t)}function f2(e,t){e._insertFakeElement(G.HEAD,q.HEAD),e.headElement=e.openElements.current,e.insertionMode=K.IN_HEAD,e._processToken(t)}function f3(e,t){switch(t.tagID){case q.HTML:ms(e,t);break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.TITLE:e._switchToTextParsing(t,fu.RCDATA);break;case q.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,fu.RAWTEXT):(e._insertElement(t,U.HTML),e.insertionMode=K.IN_HEAD_NO_SCRIPT);break;case q.NOFRAMES:case q.STYLE:e._switchToTextParsing(t,fu.RAWTEXT);break;case q.SCRIPT:e._switchToTextParsing(t,fu.SCRIPT_DATA);break;case q.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=K.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(K.IN_TEMPLATE);break;case q.HEAD:e._err(t,R.misplacedStartTagForHeadElement);break;default:f4(e,t)}}function f5(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==q.TEMPLATE&&e._err(t,R.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,R.endTagWithoutMatchingOpenElement)}function f4(e,t){e.openElements.pop(),e.insertionMode=K.AFTER_HEAD,e._processToken(t)}function f6(e,t){let n=t.type===L.EOF?R.openElementsLeftAfterEof:R.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=K.IN_HEAD,e._processToken(t)}function f9(e,t){e._insertFakeElement(G.BODY,q.BODY),e.insertionMode=K.IN_BODY,f7(e,t)}function f7(e,t){switch(t.type){case L.CHARACTER:me(e,t);break;case L.WHITESPACE_CHARACTER:f8(e,t);break;case L.COMMENT:fJ(e,t);break;case L.START_TAG:ms(e,t);break;case L.END_TAG:ma(e,t);break;case L.EOF:ml(e,t)}}function f8(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function me(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function mt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,U.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mn(e){let t=fe(e,z.TYPE);return null!=t&&"hidden"===t.toLowerCase()}function mr(e,t){e._switchToTextParsing(t,fu.RAWTEXT)}function mi(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML)}function ms(e,t){switch(t.tagID){case q.I:case q.S:case q.B:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.SMALL:case q.STRIKE:case q.STRONG:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.A:let n;(n=e.activeFormattingElements.getElementEntryInScopeWithTagName(G.A))&&(fQ(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),void 0!==e.openElements.currentTagId&&fc.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.P:case q.DL:case q.OL:case q.UL:case q.DIV:case q.DIR:case q.NAV:case q.MAIN:case q.MENU:case q.ASIDE:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.DETAILS:case q.ADDRESS:case q.ARTICLE:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML);break;case q.LI:case q.DD:case q.DT:e.framesetOk=!1;let r=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let n=e.openElements.tagIDs[t];if(r===q.LI&&n===q.LI||(r===q.DD||r===q.DT)&&(n===q.DD||n===q.DT)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n);break}if(n!==q.ADDRESS&&n!==q.DIV&&n!==q.P&&e._isSpecialElement(e.openElements.items[t],n))break}e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML);break;case q.BR:case q.IMG:case q.WBR:case q.AREA:case q.EMBED:case q.KEYGEN:mt(e,t);break;case q.HR:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._appendElement(t,U.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;break;case q.RB:case q.RTC:e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,U.HTML);break;case q.RT:case q.RP:e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(q.RTC),e._insertElement(t,U.HTML);break;case q.PRE:case q.LISTING:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.skipNextNewLine=!0,e.framesetOk=!1;break;case q.XMP:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,fu.RAWTEXT);break;case q.SVG:e._reconstructActiveFormattingElements(),fq(t),fV(t),t.selfClosing?e._appendElement(t,U.SVG):e._insertElement(t,U.SVG),t.ackSelfClosing=!0;break;case q.HTML:0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs);break;case q.BASE:case q.LINK:case q.META:case q.STYLE:case q.TITLE:case q.SCRIPT:case q.BGSOUND:case q.BASEFONT:case q.TEMPLATE:f3(e,t);break;case q.BODY:let i;(i=e.openElements.tryPeekProperlyNestedBodyElement())&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(i,t.attrs));break;case q.FORM:let s;s=e.openElements.tmplCount>0,(!e.formElement||s)&&(e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),s||(e.formElement=e.openElements.current));break;case q.NOBR:e._reconstructActiveFormattingElements(),e.openElements.hasInScope(q.NOBR)&&(fQ(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.MATH:e._reconstructActiveFormattingElements(),fG(t),fV(t),t.selfClosing?e._appendElement(t,U.MATHML):e._insertElement(t,U.MATHML),t.ackSelfClosing=!0;break;case q.TABLE:e.treeAdapter.getDocumentMode(e.document)!==$.QUIRKS&&e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.framesetOk=!1,e.insertionMode=K.IN_TABLE;break;case q.INPUT:e._reconstructActiveFormattingElements(),e._appendElement(t,U.HTML),mn(t)||(e.framesetOk=!1),t.ackSelfClosing=!0;break;case q.PARAM:case q.TRACK:case q.SOURCE:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.IMAGE:t.tagName=G.IMG,t.tagID=q.IMG,mt(e,t);break;case q.BUTTON:e.openElements.hasInScope(q.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.framesetOk=!1;break;case q.APPLET:case q.OBJECT:case q.MARQUEE:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1;break;case q.IFRAME:e.framesetOk=!1,e._switchToTextParsing(t,fu.RAWTEXT);break;case q.SELECT:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===K.IN_TABLE||e.insertionMode===K.IN_CAPTION||e.insertionMode===K.IN_TABLE_BODY||e.insertionMode===K.IN_ROW||e.insertionMode===K.IN_CELL?K.IN_SELECT_IN_TABLE:K.IN_SELECT;break;case q.OPTION:case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML);break;case q.NOEMBED:case q.NOFRAMES:mr(e,t);break;case q.FRAMESET:let o;o=e.openElements.tryPeekProperlyNestedBodyElement(),e.framesetOk&&o&&(e.treeAdapter.detachNode(o),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_FRAMESET);break;case q.TEXTAREA:e._insertElement(t,U.HTML),e.skipNextNewLine=!0,e.tokenizer.state=fu.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=K.TEXT;break;case q.NOSCRIPT:e.options.scriptingEnabled?mr(e,t):mi(e,t);break;case q.PLAINTEXT:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.tokenizer.state=fu.PLAINTEXT;break;case q.COL:case q.TH:case q.TD:case q.TR:case q.HEAD:case q.FRAME:case q.TBODY:case q.TFOOT:case q.THEAD:case q.CAPTION:case q.COLGROUP:break;default:mi(e,t)}}function mo(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],s=e.openElements.tagIDs[t];if(r===s&&(r!==q.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,s))break}}function ma(e,t){switch(t.tagID){case q.A:case q.B:case q.I:case q.S:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.NOBR:case q.SMALL:case q.STRIKE:case q.STRONG:fQ(e,t);break;case q.P:e.openElements.hasInButtonScope(q.P)||e._insertFakeElement(G.P,q.P),e._closePElement();break;case q.DL:case q.UL:case q.OL:case q.DIR:case q.DIV:case q.NAV:case q.PRE:case q.MAIN:case q.MENU:case q.ASIDE:case q.BUTTON:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.ADDRESS:case q.ARTICLE:case q.DETAILS:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.LISTING:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:let n;n=t.tagID,e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n));break;case q.LI:e.openElements.hasInListItemScope(q.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(q.LI),e.openElements.popUntilTagNamePopped(q.LI));break;case q.DD:case q.DT:let r;r=t.tagID,e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r));break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped());break;case q.BR:e._reconstructActiveFormattingElements(),e._insertFakeElement(G.BR,q.BR),e.openElements.pop(),e.framesetOk=!1;break;case q.BODY:if(e.openElements.hasInScope(q.BODY)&&(e.insertionMode=K.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}break;case q.HTML:e.openElements.hasInScope(q.BODY)&&(e.insertionMode=K.AFTER_BODY,mA(e,t));break;case q.FORM:!function(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(q.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(q.FORM):n&&e.openElements.remove(n))}(e);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:let i;i=t.tagID,e.openElements.hasInScope(i)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i),e.activeFormattingElements.clearToLastMarker());break;case q.TEMPLATE:f5(e,t);break;default:mo(e,t)}}function ml(e,t){e.tmplInsertionModeStack.length>0?mN(e,t):fZ(e,t)}function mc(e,t){if(void 0!==e.openElements.currentTagId&&fK.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=K.IN_TABLE_TEXT,t.type){case L.CHARACTER:mf(e,t);break;case L.WHITESPACE_CHARACTER:mh(e,t)}else mp(e,t)}function md(e,t){switch(t.tagID){case q.TD:case q.TH:case q.TR:e.openElements.clearBackToTableContext(),e._insertFakeElement(G.TBODY,q.TBODY),e.insertionMode=K.IN_TABLE_BODY,mx(e,t);break;case q.STYLE:case q.SCRIPT:case q.TEMPLATE:f3(e,t);break;case q.COL:e.openElements.clearBackToTableContext(),e._insertFakeElement(G.COLGROUP,q.COLGROUP),e.insertionMode=K.IN_COLUMN_GROUP,mb(e,t);break;case q.FORM:e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,U.HTML),e.formElement=e.openElements.current,e.openElements.pop());break;case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode(),e._processStartTag(t));break;case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.clearBackToTableContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_TABLE_BODY;break;case q.INPUT:mn(t)?e._appendElement(t,U.HTML):mp(e,t),t.ackSelfClosing=!0;break;case q.CAPTION:e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_CAPTION;break;case q.COLGROUP:e.openElements.clearBackToTableContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_COLUMN_GROUP;break;default:mp(e,t)}}function mu(e,t){switch(t.tagID){case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode());break;case q.TEMPLATE:f5(e,t);break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:mp(e,t)}}function mp(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,f7(e,t),e.fosterParentingEnabled=n}function mh(e,t){e.pendingCharacterTokens.push(t)}function mf(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function mm(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)mp(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}let mg=new Set([q.CAPTION,q.COL,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]);function mb(e,t){switch(t.tagID){case q.HTML:ms(e,t);break;case q.COL:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.TEMPLATE:f3(e,t);break;default:my(e,t)}}function my(e,t){e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=K.IN_TABLE,e._processToken(t))}function mx(e,t){switch(t.tagID){case q.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_ROW;break;case q.TH:case q.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(G.TR,q.TR),e.insertionMode=K.IN_ROW,mw(e,t);break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE,md(e,t));break;default:md(e,t)}}function mv(e,t){let n=t.tagID;switch(t.tagID){case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE);break;case q.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE,mu(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:case q.TR:break;default:mu(e,t)}}function mw(e,t){switch(t.tagID){case q.TH:case q.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_CELL,e.activeFormattingElements.insertMarker();break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mx(e,t));break;default:md(e,t)}}function mE(e,t){switch(t.tagID){case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY);break;case q.TABLE:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mv(e,t));break;case q.TBODY:case q.TFOOT:case q.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(q.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mv(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:break;default:mu(e,t)}}function mk(e,t){switch(t.tagID){case q.HTML:ms(e,t);break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.HR:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.INPUT:case q.KEYGEN:case q.TEXTAREA:case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),t.tagID!==q.SELECT&&e._processStartTag(t));break;case q.SCRIPT:case q.TEMPLATE:f3(e,t)}}function mT(e,t){switch(t.tagID){case q.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===q.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===q.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop();break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop();break;case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode());break;case q.TEMPLATE:f5(e,t)}}function mN(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):fZ(e,t)}function mA(e,t){var n;if(t.tagID===q.HTML){if(e.fragmentContext||(e.insertionMode=K.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===q.HTML){e._setEndLocation(e.openElements.items[0],t);let r=e.openElements.items[1];!r||(null==(n=e.treeAdapter.getNodeSourceCodeLocation(r))?void 0:n.endTag)||e._setEndLocation(r,t)}}else mS(e,t)}function mS(e,t){e.insertionMode=K.IN_BODY,f7(e,t)}function mC(e,t){e.insertionMode=K.IN_BODY,f7(e,t)}function m_(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==U.HTML&&void 0!==e.openElements.currentTagId&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function mM(e,t){return fX.parse(e,t)}function mO(e,t,n){"string"==typeof e&&(n=t,t=e,e=null);let r=fX.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}function mI(e){return e&&"object"==typeof e?"position"in e||"type"in e?mR(e.position):"start"in e||"end"in e?mR(e):"line"in e||"column"in e?mD(e):"":""}function mD(e){return mL(e&&e.line)+":"+mL(e&&e.column)}function mR(e){return mD(e&&e.start)+"-"+mD(e&&e.end)}function mL(e){return e&&"number"==typeof e?e:1}G.AREA,G.BASE,G.BASEFONT,G.BGSOUND,G.BR,G.COL,G.EMBED,G.FRAME,G.HR,G.IMG,G.INPUT,G.KEYGEN,G.LINK,G.META,G.PARAM,G.SOURCE,G.TRACK,G.WBR;class mj extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},s=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(s=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=mI(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mj.prototype.file="",mj.prototype.name="",mj.prototype.reason="",mj.prototype.message="",mj.prototype.stack="",mj.prototype.column=void 0,mj.prototype.line=void 0,mj.prototype.ancestors=void 0,mj.prototype.cause=void 0,mj.prototype.fatal=void 0,mj.prototype.place=void 0,mj.prototype.ruleId=void 0,mj.prototype.source=void 0;let mP=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');mU(e);let r=0,i=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else i<0&&(n=!0,i=s+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(i=s):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},mB=function(e){let t;if(mU(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},mF=function(e){let t;mU(e);let n=e.length,r=-1,i=0,s=-1,o=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1)}return s<0||r<0||0===o||1===o&&s===r-1&&s===i+1?"":e.slice(s,r)},mH=function(...e){var t;let n,r,i,s=-1;for(;++s<e.length;)mU(e[s]),e[s]&&(i=void 0===i?e[s]:i+"/"+e[s]);return void 0===i?".":(mU(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",s=0,o=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===a);else if(o!==l-1&&2===a){if(i.length<2||2!==s||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",s=0):s=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,a=0;continue}}else if(i.length>0){i="",s=0,o=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),s=l-o-1;o=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function mU(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function mz(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let m$=["history","path","basename","stem","extname","dirname"];class mG{constructor(e){let t,n;t=e?mz(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<m$.length;){const e=m$[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)m$.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?mP(this.path):void 0}set basename(e){mV(e,"basename"),mq(e,"basename"),this.path=mH(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?mB(this.path):void 0}set dirname(e){mW(this.basename,"dirname"),this.path=mH(e||"",this.basename)}get extname(){return"string"==typeof this.path?mF(this.path):void 0}set extname(e){if(mq(e,"extname"),mW(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=mH(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){mz(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!mz(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),mV(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?mP(this.path,this.extname):void 0}set stem(e){mV(e,"stem"),mq(e,"stem"),this.path=mH(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new mj(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function mq(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function mV(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function mW(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let mK={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},mY=/-[a-z]/g,mX=/%c(?:([-+])(\d+))?/g,mQ=/%x/g,mJ={2:!0,1:!1,0:null};function mZ(e){return e.charAt(1).toUpperCase()}let m0="object"==typeof self?self:globalThis,m1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new m0[e](t)},m2=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[s,o]=e[i];switch(s){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(m1(e,t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(m1(s,o),i)})(0)},{toString:m3}={},{keys:m5}=Object,m4=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=m3.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},m6=([e,t])=>0===e&&("function"===t||"symbol"===t),m9=(e,{json:t,lossy:n}={})=>{var r,i,s;let o,a,l=[];return(r=!(t||n),i=!!t,s=new Map,o=(e,t)=>{let n=l.push(e)-1;return s.set(t,n),n},a=e=>{if(s.has(e))return s.get(e);let[t,n]=m4(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let s=[],l=o([t,s],e);for(let t of m5(e))(r||!m6(m4(e[t])))&&s.push([a(t),a(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(m6(m4(t))||m6(m4(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!m6(m4(t)))&&n.push(a(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},m7="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?m2(m9(e,t)):structuredClone(e):(e,t)=>m2(m9(e,t)),m8={}.hasOwnProperty;function ge(e,t){let n=t||{};function r(t,...n){let i=r.invalid,s=r.handlers;if(t&&m8.call(t,e)){let n=String(t[e]);i=m8.call(s,n)?s[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}let gt={}.hasOwnProperty,gn=ge("type",{handlers:{root:function(e,t){let n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=gr(e.children,n,t),gi(e,n),n},element:function(e,t){var n,r;let i,s,o=t;"element"===e.type&&"svg"===e.tagName.toLowerCase()&&"html"===t.space&&(o=hM);let a=[];if(e.properties){for(i in e.properties)if("children"!==i&&gt.call(e.properties,i)){let t=function(e,t,n){let r=hP(e,t);if(!1===n||null==n||"number"==typeof n&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?hI(n):hU(n));let i={name:r.attribute,value:!0===n?"":String(n)};if(r.space&&"html"!==r.space&&"svg"!==r.space){let e=i.name.indexOf(":");e<0?i.prefix="":(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=hW[r.space]}return i}(o,i,e.properties[i]);t&&a.push(t)}}let l=o.space;hr(l);let c={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:hW[l],childNodes:[],parentNode:null};return c.childNodes=gr(e.children,c,o),gi(e,c),"template"===e.tagName&&e.content&&(n=e.content,r=o,(s={nodeName:"#document-fragment",childNodes:[]}).childNodes=gr(n.children,s,r),gi(n,s),c.content=s),c},text:function(e){let t={nodeName:"#text",value:e.value,parentNode:null};return gi(e,t),t},comment:function(e){let t={nodeName:"#comment",data:e.value,parentNode:null};return gi(e,t),t},doctype:function(e){let t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return gi(e,t),t}}});function gr(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let s=gn(e[r],n);s.parentNode=t,i.push(s)}return i}function gi(e,t){let n=e.position;n&&n.start&&n.end&&(hr("number"==typeof n.start.offset),hr("number"==typeof n.end.offset),t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}let gs=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var go=e.i(743820),go=go,ga=e.i(113515),ga=ga;let gl=gd("end"),gc=gd("start");function gd(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function gu(e){let t=gc(e),n=gl(e);if(t&&n)return{start:t,end:n}}let gp=function(e){var t,n;if(null==e)return gf;if("function"==typeof e)return gh(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=gp(e[n]);return gh(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,gh(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,gh(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function gh(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function gf(){return!0}let gm=[];function gg(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let s=gp(i),o=r?-1:1;(function e(i,a,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var c;let d,u,p,h=gm;if((!t||s(i,a,l[l.length-1]||void 0))&&!1===(h=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?gm:[c])[0])return h;if("children"in i&&i.children&&i.children&&"skip"!==h[0])for(u=(r?i.children.length:-1)+o,p=l.concat(i);u>-1&&u<i.children.length;){if(!1===(d=e(i.children[u],u,p)())[0])return d;u="number"==typeof d[1]?d[1]:u+o}return h}})(e,void 0,[])()}function gb(e,t,n,r){let i,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,i=n):(s=t,o=n,i=r),gg(e,s,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}let gy=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,gx=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),gv={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function gw(e,t){var n;let r,i=!!((r="root"===(n=e).type?n.children[0]:n)&&("doctype"===r.type||"element"===r.type&&"html"===r.tagName.toLowerCase())),s=ge("type",{handlers:{root:gk,element:gT,text:gN,comment:gS,doctype:gA,raw:gC},unknown:g_}),o={parser:i?new fX(gv):fX.getFragmentParser(void 0,gv),handle(e){s(e,o)},stitches:!1,options:t||{}};s(e,o),gM(o,gc());let a=hX(i?o.parser.document:o.parser.getFragment(),{file:o.options.file});return(o.stitches&&gb(a,"comment",function(e,t,n){if(e.value.stitch&&n&&void 0!==t)return n.children[t]=e.value.stitch,t}),"root"===a.type&&1===a.children.length&&a.children[0].type===e.type)?a.children[0]:a}function gE(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function gk(e,t){gE(e.children,t)}function gT(e,t){(function(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===fu.PLAINTEXT)return;gM(t,gc(e));let r=t.parser.openElements.current,i="namespaceURI"in r?r.namespaceURI:hW.html;i===hW.html&&"svg"===n&&(i=hW.svg);let s=gn({...e,children:[]},"svg"===({space:i===hW.svg?"svg":"html"}).space?hM:h_),o={type:go.TokenType.START_TAG,tagName:n,tagID:ga.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:gI(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n})(e,t),gE(e.children,t),function(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&gs.includes(n)||t.parser.tokenizer.state===fu.PLAINTEXT)return;gM(t,gl(e));let r={type:go.TokenType.END_TAG,tagName:n,tagID:ga.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:gI(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===fu.RCDATA||t.parser.tokenizer.state===fu.RAWTEXT||t.parser.tokenizer.state===fu.SCRIPT_DATA)&&(t.parser.tokenizer.state=fu.DATA)}(e,t)}function gN(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:go.TokenType.CHARACTER,chars:e.value,location:gI(e)};gM(t,gc(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gA(e,t){let n={type:go.TokenType.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:gI(e)};gM(t,gc(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gS(e,t){let n=e.value,r={type:go.TokenType.COMMENT,data:n,location:gI(e)};gM(t,gc(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function gC(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,gO(t,gc(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(gy,"&lt;$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),72===t.parser.tokenizer.state||78===t.parser.tokenizer.state){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function g_(e,t){if(t.options.passThrough&&t.options.passThrough.includes(e.type)){var n;let r;t.stitches=!0,r="children"in(n=e)?m7({...n,children:[]}):m7(n),"children"in e&&"children"in r&&(r.children=gw({type:"root",children:e.children},t.options).children),gS({type:"comment",value:{stitch:r}},t)}else{let t="";throw gx.has(e.type)&&(t=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+e.type+"` node"+t)}}function gM(e,t){gO(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=fu.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function gO(e,t){if(t&&void 0!==t.offset){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function gI(e){let t=gc(e)||{line:void 0,column:void 0,offset:void 0},n=gl(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}let gD=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],gR={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...gD,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...gD],h2:[["className","sr-only"]],img:[...gD,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...gD,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...gD],table:[...gD],ul:[...gD,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},gL={}.hasOwnProperty;function gj(e,t){if(t&&"object"==typeof t)switch("string"==typeof t.type?t.type:""){case"comment":var n,r,i=e,s=t;if(i.schema.allowComments){let e="string"==typeof s.value?s.value:"",t=e.indexOf("-->"),n={type:"comment",value:t<0?e:e.slice(0,t)};return gH(n,s),n}return;case"doctype":var o=e,a=t;if(o.schema.allowDoctypes){let e={type:"doctype"};return gH(e,a),e}return;case"element":return function(e,t){let n="string"==typeof t.tagName?t.tagName:"";e.stack.push(n);let r=gP(e,t.children),i=function(e,t){let n,r=e.stack[e.stack.length-1],i=e.schema.attributes,s=e.schema.required,o=i&&gL.call(i,r)?i[r]:void 0,a=i&&gL.call(i,"*")?i["*"]:void 0,l=t&&"object"==typeof t?t:{},c={};for(n in l)if(gL.call(l,n)){let t=l[n],r=gB(e,gU(o,n),n,t);null==r&&(r=gB(e,gU(a,n),n,t)),null!=r&&(c[n]=r)}if(s&&gL.call(s,r)){let e=s[r];for(n in e)gL.call(e,n)&&!gL.call(c,n)&&(c[n]=e[n])}return c}(e,t.properties);e.stack.pop();let s=!1;if(n&&"*"!==n&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(s=!0,e.schema.ancestors&&gL.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(s=!1;++r<t.length;)e.stack.includes(t[r])&&(s=!0)}if(!s)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:"element",tagName:n,properties:i,children:r};return gH(o,t),o}(e,t);case"root":let l;return gH(l={type:"root",children:gP(e,(n=t).children)},n),l;case"text":let c;return gH(c={type:"text",value:"string"==typeof(r=t).value?r.value:""},r),c}}function gP(e,t){let n=[];if(Array.isArray(t)){let r=-1;for(;++r<t.length;){let i=gj(e,t[r]);i&&(Array.isArray(i)?n.push(...i):n.push(i))}}return n}function gB(e,t,n,r){return t?Array.isArray(r)?function(e,t,n,r){let i=-1,s=[];for(;++i<r.length;){let o=gF(e,t,n,r[i]);("number"==typeof o||"string"==typeof o)&&s.push(o)}return s}(e,t,n,r):gF(e,t,n,r):void 0}function gF(e,t,n,r){if(("boolean"==typeof r||"number"==typeof r||"string"==typeof r)&&function(e,t,n){let r=e.schema.protocols&&gL.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||0===r.length)return!0;let i=String(n),s=i.indexOf(":"),o=i.indexOf("?"),a=i.indexOf("#"),l=i.indexOf("/");if(s<0||l>-1&&s>l||o>-1&&s>o||a>-1&&s>a)return!0;let c=-1;for(;++c<r.length;){let e=r[c];if(s===e.length&&i.slice(0,e.length)===e)return!0}return!1}(e,n,r)){if("object"==typeof t&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&"object"==typeof i&&"flags"in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function gH(e,t){let n=gu(t);t.data&&(e.data=m7(t.data)),n&&(e.position=n)}function gU(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],s="string"==typeof i?i:i[0];if(s===t)return i;"data*"===s&&(n=i)}if(t.length>4&&"data"===t.slice(0,4).toLowerCase())return n}let gz=/["&'<>`]/g,g$=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,gG=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,gq=/[|\\{}()[\]^$+*?.]/g,gV=new WeakMap,gW=/[\dA-Fa-f]/,gK=/\d/,gY=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],gX={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},gQ=["cent","copy","divide","gt","lt","not","para","times"],gJ={}.hasOwnProperty,gZ={};for(r in gX)gJ.call(gX,r)&&(gZ[gX[r]]=r);let g0=/[^\dA-Za-z]/;function g1(e,t,n){var r,i;let s,o,a=(r=n.omitOptionalSemicolons,s="&#x"+e.toString(16).toUpperCase(),r&&t&&!gW.test(String.fromCharCode(t))?s:s+";");if((n.useNamedReferences||n.useShortestReferences)&&(o=function(e,t,n,r){let i=String.fromCharCode(e);if(gJ.call(gZ,i)){let e=gZ[i],s="&"+e;return n&&gY.includes(e)&&!gQ.includes(e)&&(!r||t&&61!==t&&g0.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){let r,s=(i=n.omitOptionalSemicolons,r="&#"+String(e),i&&t&&!gK.test(String.fromCharCode(t))?r:r+";");s.length<a.length&&(a=s)}return o&&(!n.useShortestReferences||o.length<a.length)?o:a}function g2(e,t){let n;var r,i=e,s=Object.assign({format:g1},t);if(i=i.replace(s.subset?(r=s.subset,(n=gV.get(r))||(n=function(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(gq,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(r),gV.set(r,n)),n):gz,o),s.subset||s.escapeOnly)return i;return i.replace(g$,function(e,t,n){return s.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,n.charCodeAt(t+2),s)}).replace(gG,o);function o(e,t,n){return s.format(e.charCodeAt(0),n.charCodeAt(t+1),s)}}let g3=/^>|^->|<!--|-->|--!>|<!-$/g,g5=[">"],g4=["<",">"];function g6(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}let g9=/[ \t\n\f\r]/g;function g7(e){return"object"==typeof e?"text"===e.type&&g8(e.value):g8(e)}function g8(e){return""===e.replace(g9,"")}let be=br(1),bt=br(-1),bn=[];function br(e){return function(t,n,r){let i=t?t.children:bn,s=(n||0)+e,o=i[s];if(!r)for(;o&&g7(o);)s+=e,o=i[s];return o}}let bi={}.hasOwnProperty;function bs(e){return function(t,n,r){return bi.call(e,t.tagName)&&e[t.tagName](t,n,r)}}let bo=bs({body:function(e,t,n){let r=be(n,t);return!r||"comment"!==r.type},caption:ba,colgroup:ba,dd:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){let r=be(n,t);return!!(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:ba,html:function(e,t,n){let r=be(n,t);return!r||"comment"!==r.type},li:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){let r=be(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||"element"!==n.type||"a"!==n.tagName&&"audio"!==n.tagName&&"del"!==n.tagName&&"ins"!==n.tagName&&"map"!==n.tagName&&"noscript"!==n.tagName&&"video"!==n.tagName},rp:bl,rt:bl,tbody:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:bc,tfoot:function(e,t,n){return!be(n,t)},th:bc,thead:function(e,t,n){let r=be(n,t);return!!(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){let r=be(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function ba(e,t,n){let r=be(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&g7(r.value.charAt(0)))}function bl(e,t,n){let r=be(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function bc(e,t,n){let r=be(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}let bd=bs({body:function(e){let t=be(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&g7(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,n){let r=bt(n,t),i=be(e,-1,!0);return!(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&bo(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"col"===i.tagName)},head:function(e){let t=new Set;for(let n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||"element"===n.type},html:function(e){let t=be(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){let r=bt(n,t),i=be(e,-1);return!(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&bo(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),bu={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},bp=["<","&"];function bh(e,t,n,r){return n&&"element"===n.type&&("script"===n.tagName||"style"===n.tagName)?e.value:g2(e.value,Object.assign({},r.settings.characterReferences,{subset:bp}))}let bf=ge("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+g2(e.value,Object.assign({},r.settings.characterReferences,{subset:g5}))+">":"<!--"+e.value.replace(g3,function(e){return g2(e,Object.assign({},r.settings.characterReferences,{subset:g4}))})+"-->"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){let i,s=r.schema,o="svg"!==s.space&&r.settings.omitOptionalTags,a="svg"===s.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===s.space&&"svg"===e.tagName&&(r.schema=hM);let c=function(e,t){let n,r=[],i=-1;if(t){for(n in t)if(null!==t[n]&&void 0!==t[n]){let i=function(e,t,n){let r,i=hP(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,o=+!e.settings.allowDangerousCharacters,a=e.quote;if(i.overloadedBoolean&&(n===i.attribute||""===n)?n=!0:(i.boolean||i.overloadedBoolean)&&("string"!=typeof n||n===i.attribute||""===n)&&(n=!!n),null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";let l=g2(i.attribute,Object.assign({},e.settings.characterReferences,{subset:bu.name[s][o]}));return!0===n||(n=Array.isArray(n)?(i.commaSeparated?hI:hU)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(r=g2(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:bu.unquoted[s][o]}))),r!==n&&(e.settings.quoteSmart&&g6(n,a)>g6(n,e.alternative)&&(a=e.alternative),r=a+g2(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?bu.single:bu.double)[s][o],attribute:!0}))+a),l+(r?"="+r:r))}(e,n,t[n]);i&&r.push(i)}}for(;++i<r.length;){let t=e.settings.tightAttributes?r[i].charAt(r[i].length-1):void 0;i!==r.length-1&&'"'!==t&&"'"!==t&&(r[i]+=" ")}return r.join("")}(r,e.properties),d=r.all("html"===s.space&&"template"===e.tagName?e.content:e);return r.schema=s,d&&(a=!1),!c&&o&&bd(e,t,n)||(l.push("<",e.tagName,c?" "+c:""),a&&("svg"===s.space||r.settings.closeSelfClosing)&&(i=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(d),a||o&&bo(e,t,n)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:bh(e,t,n,r)},root:function(e,t,n,r){return r.all(e)},text:bh}}),bm={},bg={},bb=[];function by(e,t){let n=t||bm,r=n.quote||'"';if('"'!==r&&"'"!==r)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return({one:bx,all:bv,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||gs,characterReferences:n.characterReferences||bg,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?hM:h_,quote:r,alternative:'"'===r?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function bx(e,t,n){return bf(e,t,n,this)}function bv(e){let t=[],n=e&&e.children||bb,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function bw(e){let t={...this.data("settings"),...e};this.compiler=function(e){return by(e,t)}}let bE=bR(/[A-Za-z]/),bk=bR(/[\dA-Za-z]/),bT=bR(/[#-'*+\--9=?A-Z^-~]/);function bN(e){return null!==e&&(e<32||127===e)}let bA=bR(/\d/),bS=bR(/[\dA-Fa-f]/),bC=bR(/[!-/:-@[-`{-~]/);function b_(e){return null!==e&&e<-2}function bM(e){return null!==e&&(e<0||32===e)}function bO(e){return -2===e||-1===e||32===e}let bI=bR(/\p{P}|\p{S}/u),bD=bR(/\s/);function bR(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bL="phrasing",bj=["autolink","link","image","label"];function bP(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bB(e){this.config.enter.autolinkProtocol.call(this,e)}function bF(e){this.config.exit.autolinkProtocol.call(this,e)}function bH(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];hr("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function bU(e){this.config.exit.autolinkEmail.call(this,e)}function bz(e){this.exit(e)}function b$(e){!function(e,t,n){let r=gp((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),s=-1;for(;++s<i.length;)gg(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[s][0],o=i[s][1],a=0,l=n.children.indexOf(e),c=!1,d=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){let n=u.index,i={index:u.index,input:u.input,stack:[...t,e]},s=o(...u,i);if("string"==typeof s&&(s=s.length>0?{type:"text",value:s}:void 0),!1===s?r.lastIndex=n+1:(a!==n&&d.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(s)?d.push(...s):s&&d.push(s),a=n+u[0].length,c=!0),!r.global)break;u=r.exec(e.value)}return c?(a<e.value.length&&d.push({type:"text",value:e.value.slice(a)}),n.children.splice(l,1,...d)):d=[e],l+d.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bG],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bq]],{ignore:["link","linkReference"]})}function bG(e,t,n,r,i){let s,o="";if(!bV(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(s=n.split(".")).length<2||s[s.length-1]&&(/_/.test(s[s.length-1])||!/[a-zA-Z\d]/.test(s[s.length-1]))||s[s.length-2]&&(/_/.test(s[s.length-2])||!/[a-zA-Z\d]/.test(s[s.length-2])))return!1;let a=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=g6(e,"("),s=g6(e,")");for(;-1!==r&&i>s;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),s++;return[e,n]}(n+r);if(!a[0])return!1;let l={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function bq(e,t,n,r){return!(!bV(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bV(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bD(n)||bI(n))&&(!t||47!==n)}function bW(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function bK(){this.buffer()}function bY(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bX(){this.buffer()}function bQ(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bJ(e){let t=this.resume(),n=this.stack[this.stack.length-1];hr("footnoteReference"===n.type),n.identifier=bW(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bZ(e){this.exit(e)}function b0(e){let t=this.resume(),n=this.stack[this.stack.length-1];hr("footnoteDefinition"===n.type),n.identifier=bW(this.sliceSerialize(e)).toLowerCase(),n.label=t}function b1(e){this.exit(e)}function b2(e,t,n,r){let i=n.createTracker(r),s=i.move("[^"),o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]")}function b3(e,t,n){return 0===t?e:b5(e,t,n)}function b5(e,t,n){return(n?"":" ")+e}b2.peek=function(){return"["};let b4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function b6(e){this.enter({type:"delete",children:[]},e)}function b9(e){this.exit(e)}function b7(e,t,n,r){let i=n.createTracker(r),s=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function b8(e){return e.length}function ye(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}b7.peek=function(){return"~"};function yt(e){return null===e||bM(e)||bD(e)?1:bI(e)?2:void 0}let yn={};function yr(e,t){let n=t||yn;return yi(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function yi(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ys(e.children,t,n)}return Array.isArray(e)?ys(e,t,n):""}function ys(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=yi(e[i],t,n);return r.join("")}function yo(e,t,n){let r=e.value||"",i="`",s=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){let e,t=n.unsafe[s],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}yo.peek=function(){return"`"};gp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let ya=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),s=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?s:s+" ".repeat(o-s.length))+e});return l(),c};function yl(e){let t=e._align;hr(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function yc(e){this.exit(e),this.data.inTable=void 0}function yd(e){this.enter({type:"tableRow",children:[]},e)}function yu(e){this.exit(e)}function yp(e){this.enter({type:"tableCell",children:[]},e)}function yh(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yf));let n=this.stack[this.stack.length-1];hr("inlineCode"===n.type),n.value=t,this.exit(e)}function yf(e,t){return"|"===t?t:e}function ym(e){let t=this.stack[this.stack.length-2];hr("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function yg(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];hr("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,s=-1;for(;++s<i.length;){let e=i[s];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function yb(e,t,n,r){let i=e.children[0],s="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=ya(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}function yy(e,t,n,r){let i,s=e.length,o=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function yx(e,t){return e.length>0?(yy(e,e.length,0,t),e):t}let yv={}.hasOwnProperty;function yw(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(yv.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];if(s)for(r in s){yv.call(i,r)||(i[r]=[]);let e=s[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);yy(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}let yE={tokenize:function(e,t,n){let r=0;return function t(s){return(87===s||119===s)&&r<3?(r++,e.consume(s),t):46===s&&3===r?(e.consume(s),i):n(s)};function i(e){return null===e?n(e):t(e)}},partial:!0},yk={tokenize:function(e,t,n){let r,i,s;return o;function o(t){return 46===t||95===t?e.check(yN,l,a)(t):null===t||bM(t)||bD(t)||45!==t&&bI(t)?l(t):(s=!0,e.consume(t),o)}function a(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!s?n(e):t(e)}},partial:!0},yT={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?s(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(yN,t,s)(o):null===o||bM(o)||bD(o)?t(o):(e.consume(o),i)}function s(t){return 41===t&&r++,e.consume(t),i}},partial:!0},yN={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),s):93===o?(e.consume(o),i):60===o||null===o||bM(o)||bD(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||bM(e)||bD(e)?t(e):r(e)}function s(t){return bE(t)?function t(i){return 59===i?(e.consume(i),r):bE(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},yA={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return bk(e)?n(e):t(e)}},partial:!0},yS={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!yI.call(r,r.previous)||yj(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(yE,e.attempt(yk,e.attempt(yT,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:yI},yC={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",s=!1;return function(t){return(72===t||104===t)&&yD.call(r,r.previous)&&!yj(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(bE(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),s)?l:(s=!0,a):n(t)}function l(t){return null===t||bN(t)||bM(t)||bD(t)||bI(t)?n(t):e.attempt(yk,e.attempt(yT,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:yD},y_={name:"emailAutolink",tokenize:function(e,t,n){let r,i,s=this;return function(t){return!yL(t)||!yR.call(s,s.previous)||yj(s.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return yL(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(yA,l,a)(t):45===t||95===t||bk(t)?(i=!0,e.consume(t),o):l(t)}function a(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&bE(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:yR},yM={},yO=48;for(;yO<123;)yM[yO]=y_,58==++yO?yO=65:91===yO&&(yO=97);function yI(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||bM(e)}function yD(e){return!bE(e)}function yR(e){return!(47===e||yL(e))}function yL(e){return 43===e||45===e||46===e||95===e||bk(e)}function yj(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function yP(e,t,n,r){let i=r?r-1:1/0,s=0;return function(r){return bO(r)?(e.enter(n),function r(o){return bO(o)&&s++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}yM[43]=y_,yM[45]=y_,yM[46]=y_,yM[95]=y_,yM[72]=[y_,yC],yM[104]=[y_,yC],yM[87]=[y_,yS],yM[119]=[y_,yS];let yB={partial:!0,tokenize:function(e,t,n){return function(t){return bO(t)?yP(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||b_(e)?t(e):n(e)}}},yF={tokenize:function(e,t,n){let r=this;return yP(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function yH(e,t,n){let r,i=this,s=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;s--;){let e=i.events[s][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(s){if(!r||!r._balanced)return n(s);let a=bW(i.sliceSerialize({start:r.end,end:i.now()}));return 94===a.codePointAt(0)&&o.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s)):n(s)}}function yU(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function yz(e,t,n){let r,i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(o>999||93===a&&!r||null===a||91===a||bM(a))return n(a);if(93===a){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return s.includes(bW(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return bM(a)||(r=!0),o++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function y$(e,t,n){let r,i,s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!i||null===t||91===t||bM(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=bW(s.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return bM(t)||(i=!0),a++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function u(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),yP(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function yG(e,t,n){return e.check(yB,t,e.attempt(yF,t,n))}function yq(e){e.exit("gfmFootnoteDefinition")}function yV(e,t,n){let r=[],i=-1;for(;++i<e.length;){let s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}class yW{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function yK(e,t,n){let r,i=this,s=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,s="tableHead"===r||"tableRow"===r?y:a;return s===y&&i.parser.lazy[i.now().line]?n(e):s(e)};function a(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):b_(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),u):n(t):bO(t)?yP(e,l,"whitespace")(t):(o+=1,r&&(r=!1,s+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||bM(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function u(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,bO(t))?yP(e,p,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?f(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),h):n(t)}function h(t){return bO(t)?yP(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(o+=1,m(t)):null===t||b_(t)?b(t):n(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(n))}(t)):n(t)}function g(t){return bO(t)?yP(e,b,"whitespace")(t):b(t)}function b(i){if(124===i)return p(i);if(null===i||b_(i))return r&&s===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||b_(n)?(e.exit("tableRow"),t(n)):bO(n)?yP(e,x,"whitespace")(n):(e.enter("data"),v(n))}function v(t){return null===t||124===t||bM(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?w:v)}function w(t){return 92===t||124===t?(e.consume(t),v):v(t)}}function yY(e,t){let n,r,i,s=-1,o=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,u=0,p=new yW;for(;++s<e.length;){let h=e[s],f=h[1];"enter"===h[0]?"tableHead"===f.type?(d=!1,0!==u&&(yQ(p,t,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(s,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,s+1,0,0],d&&(d=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(s,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=yX(p,t,l,a,void 0,i),l=[0,0,0,0]),c[2]=s)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=yX(p,t,l,a,void 0,i)),c=[(l=c)[1],s,0,0])):"tableHead"===f.type?(d=!0,u=s):"tableRow"===f.type||"tableDelimiterRow"===f.type?(u=s,0!==l[1]?(c[0]=c[1],i=yX(p,t,l,a,s,i)):0!==c[1]&&(i=yX(p,t,c,a,s,i)),a=0):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(c[3]=s)}for(0!==u&&yQ(p,t,u,n,r),p.consume(t.events),s=-1;++s<t.events.length;){let e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,s))}return e}function yX(e,t,n,r,i,s){0!==n[0]&&(s.end=Object.assign({},yJ(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));let o=yJ(t.events,n[1]);if(s={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){let i=yJ(t.events,n[2]),s=yJ(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(s.end=Object.assign({},yJ(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function yQ(e,t,n,r,i){let s=[],o=yJ(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function yJ(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let yZ={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return bM(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),s):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),s):n(t)}function s(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return b_(r)?t(r):bO(r)?e.check({tokenize:y0},t,n)(r):n(r)}}};function y0(e,t,n){return yP(e,function(e){return null===e?n(e):t(e)},"whitespace")}let y1={},y2={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yP(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return b_(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},y3={tokenize:function(e){let t,n,r,i=this,s=[],o=0;return a;function a(t){if(o<s.length){let n=s[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&b();let r=i.events.length,s=r;for(;s--;)if("exit"===i.events[s][0]&&"chunkFlow"===i.events[s][1].type){n=i.events[s][1].end;break}g(o);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return yy(i.events,s+1,0,i.events.slice(r)),i.events.length=a,c(e)}return a(e)}function c(n){if(o===s.length){if(!t)return p(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(y5,d,u)(n)}function d(e){return t&&b(),g(o),p(e)}function u(e){return i.parser.lazy[i.now().line]=o!==s.length,r=i.now().offset,f(e)}function p(t){return i.containerState={},e.attempt(y5,h,f)(t)}function h(e){return o++,s.push([i.currentConstruct,i.containerState]),p(e)}function f(r){if(null===r){t&&b(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return b_(n)?(e.consume(n),m(e.exit("chunkFlow")),o=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,s){let a=i.sliceStream(e);if(s&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,s=t.events.length;for(;s--;)if(t.events[s][1].start.offset<r&&(!t.events[s][1].end||t.events[s][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(o),s=a;s<i.events.length;)i.events[s][1].end={...n},s++;yy(i.events,l+1,0,i.events.slice(a)),i.events.length=s}}function g(t){let n=s.length;for(;n-- >t;){let t=s[n];i.containerState=t[1],t[0].exit.call(i,e)}s.length=t}function b(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},y5={tokenize:function(e,t,n){return yP(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};class y4{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&y6(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),y6(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),y6(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);y6(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);y6(this.left,t.reverse())}}}function y6(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function y9(e){let t,n,r,i,s,o,a,l={},c=-1,d=new y4(e);for(;++c<d.length;){for(;c in l;)c=l[c];if(t=d.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],s=e.get(t)[2],o=t-1,a=[],l=i._tokenizer;!l&&(l=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,d=[],u={},p=-1,h=i,f=0,m=0,g=[0];for(;h;){for(;e.get(++o)[1]!==h;);a.push(o),!h._tokenizer&&(n=s.sliceStream(h),h.next||n.push(null),r&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=h,h=h.next}for(h=i;++p<c.length;)"exit"===c[p][0]&&"enter"===c[p-1][0]&&c[p][1].type===c[p-1][1].type&&c[p][1].start.line!==c[p][1].end.line&&(m=p+1,g.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):g.pop(),p=g.length;p--;){let t=c.slice(g[p],g[p+1]),n=a.pop();d.push([n,n+t.length-1]),e.splice(n,2,t)}for(d.reverse(),p=-1;++p<d.length;)u[f+d[p][0]]=f+d[p][1],f+=d[p][1]-d[p][0]-1;return u}(d,c)),c=l[c],a=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=d.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(d.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...d.get(n)[1].start},(s=d.slice(n,c)).unshift(t),d.splice(n,c-n+1,s))}}return yy(e,0,1/0,d.slice(0)),!a}let y7={resolve:function(e){return y9(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):b_(t)?e.check(y8,s,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},y8={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yP(e,i,"linePrefix")};function i(i){if(null===i||b_(i))return n(i);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},xe={tokenize:function(e){let t=this,n=e.attempt(yB,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,yP(e,e.attempt(this.parser.constructs.flow,r,e.attempt(y7,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},xt={resolveAll:xs()},xn=xi("string"),xr=xi("text");function xi(e){return{resolveAll:xs("text"===e?xo:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,s,o);return s;function s(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function xs(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],s=t.sliceStream(i),o=s.length,a=-1,l=0;for(;o--;){let e=s[o];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let s={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:i.start._bufferIndex+a,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...s.start},i.start.offset===i.end.offset?Object.assign(i,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}let xa={name:"attention",resolveAll:function(e,t){let n,r,i,s,o,a,l,c,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let u={...e[n][1].end},p={...e[d][1].start};xl(u,-a),xl(p,a),s={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},o={type:a>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:p},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[d][1].start}},r={type:a>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[d][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=yx(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=yx(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=yx(l,yV(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),l=yx(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[d][1].end.offset-e[d][1].start.offset?(c=2,l=yx(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):c=0,yy(e,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=yt(i);return function(o){return n=o,e.enter("attentionSequence"),function o(a){if(a===n)return e.consume(a),o;let l=e.exit("attentionSequence"),c=yt(a),d=!c||2===c&&s||r.includes(a),u=!s||2===s&&c||r.includes(i);return l._open=!!(42===n?d:d&&(s||!u)),l._close=!!(42===n?u:u&&(c||!d)),t(a)}(o)}}};function xl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xc={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return bO(t)?yP(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xc,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return bO(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},xd={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return bC(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},xu=document.createElement("i");function xp(e){let t="&"+e+";";xu.innerHTML=t;let n=xu.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xh={name:"characterReference",tokenize:function(e,t,n){let r,i,s=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=bk,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=bS,c):(e.enter("characterReferenceValue"),r=7,i=bA,c(t))}function c(a){if(59===a&&o){let r=e.exit("characterReferenceValue");return i!==bk||xp(s.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&o++<r?(e.consume(a),c):n(a)}}},xf={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xm={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,s={partial:!0,tokenize:function(e,t,n){let s=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),bO(t)?yP(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s>=a?(e.exit("codeFencedFenceSequence"),bO(i)?yP(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||b_(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,a=0;return function(t){var s;let c;return s=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=s,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),bO(i)?yP(e,l,"whitespace")(i):l(i))}(s)};function l(s){return null===s||b_(s)?(e.exit("codeFencedFence"),i.interrupt?t(s):e.check(xf,d,f)(s)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||b_(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):bO(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yP(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(s))}function c(t){return null===t||b_(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||b_(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(s,f,u)(t)}function u(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&bO(t)?yP(e,h,"linePrefix",o+1)(t):h(t)}function h(t){return null===t||b_(t)?e.check(xf,d,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||b_(n)?(e.exit("codeFlowValue"),h(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},xg={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),yP(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?s(n):b_(n)?e.attempt(xb,t,s)(n):(e.enter("codeFlowValue"),function n(r){return null===r||b_(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function s(n){return e.exit("codeIndented"),t(n)}}},xb={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):b_(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):yP(e,s,"linePrefix",5)(t)}function s(e){let s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):b_(e)?i(e):n(e)}}};function xy(e,t,n,r,i,s,o,a,l){let c=l||1/0,d=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(s),e.consume(t),e.exit(s),u):null===t||32===t||41===t||bN(t)?n(t):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function u(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(a),u(t)):null===t||60===t||b_(t)?n(t):(e.consume(t),92===t?h:p)}function h(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(i){return!d&&(null===i||41===i||bM(i))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(i)):d<c&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||bN(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function xx(e,t,n,r,i,s){let o,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(s),c};function c(u){return l>999||null===u||91===u||93===u&&!o||94===u&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):93===u?(e.exit(s),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):b_(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(u))}function d(t){return null===t||91===t||93===t||b_(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=!bO(t)),92===t?u:d)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function xv(e,t,n,r,i,s){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,a):n(t)};function a(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),a(o)):null===t?n(t):b_(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yP(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===o||null===t||b_(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return t===o||92===t?(e.consume(t),c):c(t)}}function xw(e,t){let n;return function r(i){return b_(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):bO(i)?yP(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}let xE={partial:!0,tokenize:function(e,t,n){return function(t){return bM(t)?xw(e,r)(t):n(t)};function r(t){return xv(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return bO(t)?yP(e,s,"whitespace")(t):s(t)}function s(e){return null===e||b_(e)?t(e):n(e)}}},xk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xT=["pre","script","style","textarea"],xN={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(yB,t,n)}}},xA={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return b_(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xS={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&yy(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,s,o=e.length,a=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return s=yx(s=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+a+3)),s=yx(s,[["enter",d,t]]),s=yx(s,yV(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),s=yx(s,[["exit",d,t],e[i-2],e[i-1],["exit",c,t]]),s=yx(s,e.slice(i+1)),s=yx(s,[["exit",l,t]]),yy(e,r,e.length,s),e},tokenize:function(e,t,n){let r,i,s=this,o=s.events.length;for(;o--;)if(("labelImage"===s.events[o][1].type||"labelLink"===s.events[o][1].type)&&!s.events[o][1]._balanced){r=s.events[o][1];break}return function(t){return r?r._inactive?d(t):(i=s.parser.defined.includes(bW(s.sliceSerialize({start:r.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(xC,c,i?c:d)(t):91===t?e.attempt(x_,c,i?l:d)(t):i?c(t):d(t)}function l(t){return e.attempt(xM,c,d)(t)}function c(e){return t(e)}function d(e){return r._balanced=!0,n(e)}}},xC={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return bM(t)?xw(e,i)(t):i(t)}function i(t){return 41===t?c(t):xy(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return bM(t)?xw(e,a)(t):c(t)}function o(e){return n(e)}function a(t){return 34===t||39===t||40===t?xv(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return bM(t)?xw(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},x_={tokenize:function(e,t,n){let r=this;return function(t){return xx.call(r,e,i,s,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(bW(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},xM={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},xO={name:"labelStartImage",resolveAll:xS.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},xI={name:"labelStartLink",resolveAll:xS.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},xD={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),yP(e,t,"linePrefix")}}},xR={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(s){var o;return e.enter("thematicBreak"),r=o=s,function s(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),bO(n)?yP(e,s,"whitespace")(n):s(n))}(o)):i>=3&&(null===o||b_(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},xL={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(yB,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yP(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!bO(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xP,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,yP(e,e.attempt(xL,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:bA(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(xR,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return bA(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(yB,r.interrupt?n:l,e.attempt(xj,d,c))}function l(e){return r.containerState.initialBlankLine=!0,s++,d(e)}function c(t){return bO(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},xj={partial:!0,tokenize:function(e,t,n){let r=this;return yP(e,function(e){let i=r.events[r.events.length-1];return!bO(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},xP={partial:!0,tokenize:function(e,t,n){let r=this;return yP(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},xB={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),i||"definition"!==e[s][1].type||(i=s);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),bO(n)?yP(e,s,"lineSuffix")(n):s(n))}(o)):n(t)};function s(r){return null===r||b_(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xx.call(i,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function s(t){return(r=bW(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return bM(t)?xw(e,a)(t):a(t)}function a(t){return xy(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(xE,c,c)(t)}function c(t){return bO(t)?yP(e,d,"whitespace")(t):d(t)}function d(s){return null===s||b_(s)?(e.exit("definition"),i.parser.defined.push(r),t(s)):n(s)}}}},"disable",0,{null:[]},"document",0,{42:xL,43:xL,45:xL,48:xL,49:xL,50:xL,51:xL,52:xL,53:xL,54:xL,55:xL,56:xL,57:xL,62:xc},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,s=3;return"whitespace"===e[3][1].type&&(s+=2),i-2>s&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(s===i-1||i-4>s&&"whitespace"===e[i-2][1].type)&&(i-=s+1===i?2:4),i>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},r={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},yy(e,s,i-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var s;return e.enter("atxHeading"),s=i,e.enter("atxHeadingSequence"),function i(s){return 35===s&&r++<6?(e.consume(s),i):null===s||bM(s)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||b_(r)?(e.exit("atxHeading"),t(r)):bO(r)?yP(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||bM(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(s)):n(s)}(s)}}},42:xR,45:[xB,xR],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,s,o,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),d):47===o?(e.consume(o),i=!0,h):63===o?(e.consume(o),r=3,l.interrupt?t:I):bE(o)?(e.consume(o),s=String.fromCharCode(o),f):n(o)}function d(i){return 45===i?(e.consume(i),r=2,u):91===i?(e.consume(i),r=5,o=0,p):bE(i)?(e.consume(i),r=4,l.interrupt?t:I):n(i)}function u(r){return 45===r?(e.consume(r),l.interrupt?t:I):n(r)}function p(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:T:p:n(r)}function h(t){return bE(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(o){if(null===o||47===o||62===o||bM(o)){let a=47===o,c=s.toLowerCase();return!a&&!i&&xT.includes(c)?(r=1,l.interrupt?t(o):T(o)):xk.includes(s.toLowerCase())?(r=6,a)?(e.consume(o),m):l.interrupt?t(o):T(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return bO(n)?(e.consume(n),t):E(n)}(o):g(o))}return 45===o||bk(o)?(e.consume(o),s+=String.fromCharCode(o),f):n(o)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:T):n(r)}function g(t){return 47===t?(e.consume(t),E):58===t||95===t||bE(t)?(e.consume(t),b):bO(t)?(e.consume(t),g):E(t)}function b(t){return 45===t||46===t||58===t||95===t||bk(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),x):bO(t)?(e.consume(t),y):g(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,v):bO(t)?(e.consume(t),x):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||bM(n)?y(n):(e.consume(n),t)}(t)}function v(t){return t===a?(e.consume(t),a=null,w):null===t||b_(t)?n(t):(e.consume(t),v)}function w(e){return 47===e||62===e||bO(e)?g(e):n(e)}function E(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||b_(t)?T(t):bO(t)?(e.consume(t),k):n(t)}function T(t){return 45===t&&2===r?(e.consume(t),C):60===t&&1===r?(e.consume(t),_):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),I):93===t&&5===r?(e.consume(t),O):b_(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(xN,R,N)(t)):null===t||b_(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),T)}function N(t){return e.check(xA,A,R)(t)}function A(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||b_(t)?N(t):(e.enter("htmlFlowData"),T(t))}function C(t){return 45===t?(e.consume(t),I):T(t)}function _(t){return 47===t?(e.consume(t),s="",M):T(t)}function M(t){if(62===t){let n=s.toLowerCase();return xT.includes(n)?(e.consume(t),D):T(t)}return bE(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),M):T(t)}function O(t){return 93===t?(e.consume(t),I):T(t)}function I(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),I):T(t)}function D(t){return null===t||b_(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),D)}function R(n){return e.exit("htmlFlow"),t(n)}}},61:xB,95:xR,96:xm,126:xm},"flowInitial",0,{[-2]:xg,[-1]:xg,32:xg},"insideSpan",0,{null:[xa,xt]},"string",0,{38:xh,92:xd},"text",0,{[-5]:xD,[-4]:xD,[-3]:xD,33:xO,38:xh,42:xa,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return bE(t)?(e.consume(t),s):64===t?n(t):a(t)}function s(t){return 43===t||45===t||46===t||bk(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||bk(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||bN(r)?n(r):(e.consume(r),o)}function a(t){return 64===t?(e.consume(t),l):bT(t)?(e.consume(t),a):n(t)}function l(i){return bk(i)?function i(s){return 46===s?(e.consume(s),r=0,l):62===s?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(s){if((45===s||bk(s))&&r++<63){let n=45===s?t:i;return e.consume(s),n}return n(s)}(s)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,s,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),y):bE(t)?(e.consume(t),E):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,h):bE(t)?(e.consume(t),b):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function d(t){return null===t?n(t):45===t?(e.consume(t),u):b_(t)?(s=d,M(t)):(e.consume(t),d)}function u(t){return 45===t?(e.consume(t),p):d(t)}function p(e){return 62===e?_(e):45===e?u(e):d(e)}function h(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:h):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):b_(t)?(s=f,M(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?_(t):93===t?(e.consume(t),g):f(t)}function b(t){return null===t||62===t?_(t):b_(t)?(s=b,M(t)):(e.consume(t),b)}function y(t){return null===t?n(t):63===t?(e.consume(t),x):b_(t)?(s=y,M(t)):(e.consume(t),y)}function x(e){return 62===e?_(e):y(e)}function v(t){return bE(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||bk(t)?(e.consume(t),w):function t(n){return b_(n)?(s=t,M(n)):bO(n)?(e.consume(n),t):_(n)}(t)}function E(t){return 45===t||bk(t)?(e.consume(t),E):47===t||62===t||bM(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),_):58===t||95===t||bE(t)?(e.consume(t),T):b_(t)?(s=k,M(t)):bO(t)?(e.consume(t),k):_(t)}function T(t){return 45===t||46===t||58===t||95===t||bk(t)?(e.consume(t),T):function t(n){return 61===n?(e.consume(n),N):b_(n)?(s=t,M(n)):bO(n)?(e.consume(n),t):k(n)}(t)}function N(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,A):b_(t)?(s=N,M(t)):bO(t)?(e.consume(t),N):(e.consume(t),S)}function A(t){return t===r?(e.consume(t),r=void 0,C):null===t?n(t):b_(t)?(s=A,M(t)):(e.consume(t),A)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||bM(t)?k(t):(e.consume(t),S)}function C(e){return 47===e||62===e||bM(e)?k(e):n(e)}function _(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function M(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),O}function O(t){return bO(t)?yP(e,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):I(t)}function I(t){return e.enter("htmlTextData"),s(t)}}}],91:xI,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return b_(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},xd],93:xS,95:xa,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),s++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",a(o))}(l)):b_(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||b_(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),a)}}}}],119210);var xF=e.i(119210);let xH=/[\0\t\n\r]/g;function xU(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let xz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function x$(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return xU(n.slice(t?2:1),t?16:10)}return xp(n)||e}let xG={}.hasOwnProperty;function xq(e){return{line:e.line,column:e.column,offset:e.offset}}function xV(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+mI({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+mI({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+mI({start:t.start,end:t.end})+") is still open")}function xW(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let s=e.charCodeAt(n),o="";if(37===s&&bk(e.charCodeAt(n+1))&&bk(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){let t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function xK(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function xY(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function xX(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),s=i[0];s&&"text"===s.type?s.value="["+s.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function xQ(e){let t=e.spread;return null==t?e.children.length>1:t}function xJ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let xZ={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s={type:"element",tagName:"pre",properties:{},children:[s=e.applyData(t,s)]},e.patch(t,s),s},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=xW(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xX(e,t);let i={src:xW(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){let n={src:xW(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xX(e,t);let i={href:xW(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){let n={href:xW(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=xQ(n[r])}return t}(n):xQ(t),s={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=gc(t.children[1]),o=gl(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),i.push(r)}let s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length,a=-1,l=[];for(;++a<o;){let n=t.children[a],r={},o=s?s[a]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,s=[];for(;r;)s.push(xJ(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(xJ(t.slice(i),i>0,!1)),s.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:x0,yaml:x0,definition:x0,footnoteDefinition:x0};function x0(){}let x1={}.hasOwnProperty,x2={};function x3(e,t){e.position&&(t.position=gu(e))}function x5(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,m7(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function x4(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function x6(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function x9(e,t){let n,r,i,s,o=(n=t||x2,r=new Map,i=new Map,s={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=s.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=x6(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=x6(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:x5,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...xZ,...n.handlers},one:function(e,t){let n=e.type,r=s.handlers[n];if(x1.call(s.handlers,n)&&r)return r(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=m7(n);return r.children=s.all(e),r}return m7(e)}return(s.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(x1.call(n,"hProperties")||x1.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(s,e,t)},options:n,patch:x3,wrap:x4},gb(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),s),a=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xK,r=e.options.footnoteBackLabel||xY,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let s=e.all(i),o=String(i.identifier).toUpperCase(),c=xW(o.toLowerCase()),d=0,u=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++d<=p;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,d);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let h=s[s.length-1];if(h&&"element"===h.type&&"p"===h.tagName){let e=h.children[h.children.length-1];e&&"text"===e.type?e.value+=" ":h.children.push({type:"text",value:" "}),h.children.push(...u)}else s.push(...u);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(s,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...m7(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&(hr("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function x7(e){if(e)throw e}var x8=e.i(975609);function ve(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let vt=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},vn={}.hasOwnProperty;class vr extends vt{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(s,...o){let a=e[++n],l=-1;if(s)return void r(s);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,a?(function(e,t){let n;return function(...t){let s,o=e.length>t.length;o&&t.push(r);try{s=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(s&&s.then&&"function"==typeof s.then?s.then(i,r):s instanceof Error?r(s):i(s))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new vr,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,x8.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(va("data",this.frozen),this.namespace[e]=t,this):vn.call(this.namespace,e)&&this.namespace[e]||void 0:e?(va("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=vd(e),n=this.parser||this.Parser;return vs("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),vs("process",this.parser||this.Parser),vo("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let s=vd(e),o=n.parse(s);function a(e,n){e||!n?i(e):r?r(n):(hr(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,s,function(e,t,r){var i,s;if(e||!t||!r)return a(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(s=i)&&"object"==typeof s&&"byteLength"in s&&"byteOffset"in s?r.value=o:r.result=o,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),vs("processSync",this.parser||this.Parser),vo("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,x7(e),t=r}),vc("processSync","process",n),hr(t,"we either bailed on an error or have a tree"),t}run(e,t,n){vl(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,s){hr("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=vd(t);r.run(e,o,function(t,r,o){let a=r||e;t?s(t):i?i(a):(hr(n,"`done` is defined if `resolve` is not"),n(void 0,a,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){x7(e),n=t,r=!0}),vc("runSync","run",r),hr(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=vd(t),r=this.compiler||this.Compiler;return vo("stringify",r),vl(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(va("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?s(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,x8.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...s]=t,o=n[i][1];ve(o)&&ve(r)&&(r=(0,x8.default)(!0,o,r)),n[i]=[e,r,...s]}}}}let vi=new vr().freeze();function vs(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function vo(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function va(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vl(e){if(!ve(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function vc(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function vd(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new mG(e)}let vu=/(?:youtube\.com\/(?:watch\?v=|shorts\/|embed\/|v\/)|youtu\.be\/)([A-Za-z0-9_-]{6,})/,vp=/vimeo\.com\/(?:video\/)?(\d+)/,vh=/loom\.com\/share\/([A-Za-z0-9]+)/,vf=/^https?:\/\/(?:twitter\.com|x\.com)\/[^/]+\/status\/(\d+)/,vm=/^https?:\/\/(?:www\.)?facebook\.com\/.+/,vg=/^https?:\/\/(?:www\.)?instagram\.com\/(?:p|reel|tv)\/([^/?#]+)/,vb=/^https?:\/\/(?:www\.)?tiktok\.com\/@[^/]+\/video\/(\d+)/,vy=/^https?:\/\/open\.spotify\.com\/(track|album|playlist|episode|show)\/([A-Za-z0-9]+)/,vx=/\.(mp4|webm|ogg|mov|m4v)(\?|$)/i;function vv(e){let t=e.trim();if(!t)return null;let n=t.match(vu);if(n)return{provider:"youtube",embedUrl:`https://www.youtube.com/embed/${n[1]}`,originalUrl:t,aspectRatio:16/9};let r=t.match(vp);if(r)return{provider:"vimeo",embedUrl:`https://player.vimeo.com/video/${r[1]}`,originalUrl:t,aspectRatio:16/9};let i=t.match(vh);if(i)return{provider:"loom",embedUrl:`https://www.loom.com/embed/${i[1]}`,originalUrl:t,aspectRatio:16/9};if(vf.test(t))return{provider:"twitter",embedUrl:t,originalUrl:t};if(vg.test(t))return{provider:"instagram",embedUrl:t.replace(/\/?(\?.*)?$/,"/embed"),originalUrl:t};let s=t.match(vb);if(s)return{provider:"tiktok",embedUrl:`https://www.tiktok.com/embed/v2/${s[1]}`,originalUrl:t,aspectRatio:9/16};let o=t.match(vy);return o?{provider:"spotify",embedUrl:`https://open.spotify.com/embed/${o[1]}/${o[2]}`,originalUrl:t}:vm.test(t)?{provider:"facebook",embedUrl:`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true`,originalUrl:t}:vx.test(t)||t.startsWith("/api/assets/")?{provider:"video",embedUrl:t,originalUrl:t}:/^https?:\/\//.test(t)?{provider:"iframe",embedUrl:t,originalUrl:t}:null}let vw={...gR,tagNames:Array.from(new Set([...gR.tagNames??[],"table","thead","tbody","tfoot","tr","th","td","colgroup","col","label","iframe","video"])),attributes:{...gR.attributes,table:[...gR.attributes?.table??[],"className","style"],th:[...gR.attributes?.th??[],"colSpan","rowSpan","style","className"],td:[...gR.attributes?.td??[],"colSpan","rowSpan","style","className"],col:["span","style","className"],colgroup:["span","style","className"],tr:["style","className"],a:[...gR.attributes?.a??[],"className",["dataWikiLink","true"],"dataSlug","dataAlias","dataAnchor",["dataBroken","true"],["dataPdfLink","true"]],input:["type","checked","disabled"],label:["className"],iframe:["src","allow","allowFullScreen","frameBorder","loading","referrerPolicy","dataEmbedProvider"],div:[...gR.attributes?.div??[],"className",["dataEmbed","true"],"dataProvider","dataSrc","dataOriginalUrl","dataAspectRatio"],li:[...gR.attributes?.li??[],"className","dataType","dataChecked"],ul:[...gR.attributes?.ul??[],"className","dataType"],"*":[...gR.attributes?.["*"]??[],"className","id"]},protocols:{...gR.protocols,src:[...gR.protocols?.src??[],"https"]}},vE=/\[\[([^\]|#]+)(?:\|([^\]]*)|#([^\]]*))?\]\]/g,vk=/^[a-z0-9-]+$/,vT=vi().use(function(e){let t=this;t.parser=function(n){var r,i;let s,o,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(b),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(h),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(h,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:c,htmlText:r(g,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(b),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=xU(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xp(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=xq(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=bW(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(u),hardBreakTrailing:o(u),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(xz,x$),n.identifier=bW(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=xq(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),d.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=bW(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(xG.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:s,exit:a,buffer:i,resume:l,data:n},c=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?c.push(d):d=function(e,t,n){let r,i,s,o,a=t-1,l=-1,c=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=a),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=a;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}s&&(!i||s<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,s=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];xG.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||xV).call(o,void 0,e[0])}for(r.position={start:xq(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:xq(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r};function r(e,t){return function(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:xq(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||xV).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+mI({start:e.start,end:e.end})+"): it’s not open");n.position.end=xq(e.end)}function l(){return yr(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:xq(e.start),end:void 0},t.push(n)),this.stack.push(n)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=xq(e.end)}function u(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function h(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!y9(e););return e}((function(e){let t={constructs:yw([xF,...(e||{}).extensions||[]]),content:n(y2),defined:[],document:n(y3),flow:n(xe),lazy:{},string:n(xn),text:n(xr)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},s=[],o=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(h),consume:function(e){b_(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=p(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=p(),c.events.push(["exit",t,c]),t},interrupt:f(h,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let s,o=e[r];if("string"==typeof o)s=o;else switch(o){case -5:s="\r";break;case -4:s="\n";break;case -3:s="\r\n";break;case -2:s=t?" ":" ";break;case -1:if(!t&&n)continue;s=" ";break;default:s=String.fromCharCode(o)}n=-2===o,i.push(s)}return i.join("")}(u(e),t)},sliceStream:u,write:function(e){return(o=yx(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),d=d(t)}else d=d(n)}}(),null!==o[o.length-1])?[]:(m(t,0),c.events=yV(s,c.events,c),c.events)}},d=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function u(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;if(r===s)n=[e[r].slice(i,o)];else{if(n=e.slice(r,s),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[s].slice(0,o))}return n}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:s}}function h(e,t){t.restore()}function f(e,t){return function(n,i,s){var o;let d,u,h,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(d=e,u=0,0===e.length)?s:b(e[u])}function b(e){return function(n){let i,s,o,d,u;return(i=p(),s=c.previous,o=c.currentConstruct,d=c.events.length,u=Array.from(a),f={from:d,restore:function(){r=i,c.previous=s,c.currentConstruct=o,c.events.length=d,a=u,g()}},h=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?x(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,x)(n)}}function y(t){return e(h,f),i}function x(e){return(f.restore(),++u<d.length)?b(d[u]):s}}}function m(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&yy(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,a="",l=!0,function(e,t,n){let r,i,c,d,u,p=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,a="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(xH.lastIndex=c,d=(r=xH.exec(e))&&void 0!==r.index?r.index:e.length,u=e.charCodeAt(d),!r){a=e.slice(c);break}if(10===u&&c===d&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),c<d&&(p.push(e.slice(c,d)),o+=d-c),u){case 0:p.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),p.push(-2);o++<i;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:s=!0,o=1}c=d+1}return n&&(s&&p.push(-5),a&&p.push(a),p.push(null)),p})(n,r,!0))))}}).use(function(e){let t,n,r,i=e||y1,s=this.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),a=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),l=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(yw([{text:yM},{document:{91:{name:"gfmFootnoteDefinition",tokenize:y$,continuation:{tokenize:yG},exit:yq}},text:{91:{name:"gfmFootnoteCall",tokenize:yz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yH,resolveTo:yU}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,s=this.events,o=0;return function(a){return 126===i&&"characterEscape"!==s[s.length-1][1].type?r(a):(e.enter("strikethroughSequenceTemporary"),function s(a){let l=yt(i);if(126===a)return o>1?r(a):(e.consume(a),o++,s);if(o<2&&!t)return r(a);let c=e.exit("strikethroughSequenceTemporary"),d=yt(a);return c._open=!d||2===d&&!!l,c._close=!l||2===l&&!!d,n(a)}(a))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],a=t.parser.constructs.insideSpan.null;a&&yy(o,o.length,0,yV(a,e.slice(r+1,n),t)),yy(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),yy(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:yK,resolveAll:yY}}},{text:{91:yZ}}])),a.push([{transforms:[b$],enter:{literalAutolink:bP,literalAutolinkEmail:bB,literalAutolinkHttp:bB,literalAutolinkWww:bB},exit:{literalAutolink:bz,literalAutolinkEmail:bU,literalAutolinkHttp:bF,literalAutolinkWww:bH}},{enter:{gfmFootnoteCallString:bK,gfmFootnoteCall:bY,gfmFootnoteDefinitionLabelString:bX,gfmFootnoteDefinition:bQ},exit:{gfmFootnoteCallString:bJ,gfmFootnoteCall:bZ,gfmFootnoteDefinitionLabelString:b0,gfmFootnoteDefinition:b1}},{canContainEols:["delete"],enter:{strikethrough:b6},exit:{strikethrough:b9}},{enter:{table:yl,tableData:yp,tableHeader:yp,tableRow:yd},exit:{codeText:yh,table:yc,tableData:yu,tableHeader:yu,tableRow:yu}},{exit:{taskListCheckValueChecked:ym,taskListCheckValueUnchecked:ym,paragraph:yg}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bL,notInConstruct:bj},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bL,notInConstruct:bj},{character:":",before:"[ps]",after:"\\/",inConstruct:bL,notInConstruct:bj}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let s=n.createTracker(i),o=s.move("[^"),a=n.enter("footnoteDefinition"),l=n.enter("label");return o+=s.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,s.current()),r?b5:b3))),a(),o},footnoteReference:b2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:b4}],handlers:{delete:b7}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=yo(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return a(function(e,t,n){let r=e.children,i=-1,s=[],o=t.enter("table");for(;++i<r.length;)s[i]=l(r[i],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:s,after:s});return o(),i(),a}function a(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||b8,s=[],o=[],a=[],l=[],c=0,d=-1;for(;++d<e.length;){let t=[],r=[],s=-1;for(e[d].length>c&&(c=e[d].length);++s<e[d].length;){var u;let o=null==(u=e[d][s])?"":String(u);if(!1!==n.alignDelimiters){let e=i(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[d]=t,a[d]=r}let p=-1;if("object"==typeof r&&"length"in r)for(;++p<c;)s[p]=ye(r[p]);else{let e=ye(r);for(;++p<c;)s[p]=e}p=-1;let h=[],f=[];for(;++p<c;){let e=s[p],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[p]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[p]&&(l[p]=i),f[p]=i),h[p]=o}o.splice(1,0,h),a.splice(1,0,f),d=-1;let m=[];for(;++d<o.length;){let e=o[d],t=a[d];p=-1;let r=[];for(;++p<c;){let i=e[p]||"",o="",a="";if(!1!==n.alignDelimiters){let e=l[p]-(t[p]||0),n=s[p];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):a=o=" ".repeat(e/2):a=" ".repeat(e)}!1===n.delimiterStart||p||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||p)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||p!==c-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,s=[],a=t.enter("tableRow");for(;++i<r.length;)s[i]=o(r[i],e,t,n);return a(),s}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:yb}}]})}).use(function(e,t){return e&&"run"in e?async function(n,r){let i=x9(n,{file:r,...t});await e.run(i,r)}:function(n,r){return x9(n,{file:r,...e||t})}},{allowDangerousHtml:!0}).use(bw,{allowDangerousHtml:!0}).freeze(),vN=vi().use(function(e){let{emitParseErrors:t,...n}={...this.data("settings"),...e};this.parser=function(e,r){let i,s,o,a,l;return s=(i={...n,onerror:t?function(e){r.path&&(e.name=r.path+":"+e.name,e.file=r.path),r.messages.push(e)}:void 0}).onerror,o=e instanceof mG?e:new mG(e),a=i.fragment?mO:mM,hX(a(l=String(o),{sourceCodeLocationInfo:!0,onParseError:i.onerror?function(e){let t=e.code,n=t.replace(mY,mZ),r=i[n],a=null==r||r,c="number"==typeof a?a:+!!a;if(c){let r=mK[n];hr(r,"expected known error from `parse5`");let i=new mj(d(r.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:"hast-util-from-html"});o.path&&(i.file=o.path,i.name=o.path+":"+i.name),i.fatal=mJ[c],i.note=d(r.description),i.url=!1===r.url?void 0:"https://html.spec.whatwg.org/multipage/parsing.html#parse-error-"+t,hr(s,"`internalOnerror` is not passed if `onerror` is not set"),s(i)}function d(t){return t.replace(mX,function(t,n,r){var i;let s=(r?Number.parseInt(r,10):0)*("-"===n?-1:1);return"`"===(i=l.charAt(e.startOffset+s))?"` ` `":i}).replace(mQ,function(){return"0x"+l.charCodeAt(e.startOffset).toString(16).toUpperCase()})}}:null,scriptingEnabled:!1}),{file:o,space:i.space,verbose:i.verbose})}},{fragment:!0}).use(function(e){return function(t,n){return gw(t,{...e,file:n})}}).use(function(e){return function(t){let n,r;return n={type:"root",children:[]},(r=gj({schema:e?{...gR,...e}:gR,stack:[]},t))&&(Array.isArray(r)?1===r.length?n=r[0]:n.children=r:n=r),n}},vw).use(bw).freeze();async function vA(e,t){var n,r;let i="string"==typeof t?{pagePath:t}:t??{},s=e.replace(vE,(e,t,n,r)=>{let i=t.trim();if(!vk.test(i))return e;let s=n??(r?`${i}#${r}`:i),o=r?`#wiki:${i}#${r}`:`#wiki:${i}`,a=void 0!==n?` data-alias="${n}"`:"",l=void 0!==r?` data-anchor="${r}"`:"";return`<a data-wiki-link="true" data-slug="${i}"${a}${l} href="${o}" class="wiki-link">${s}</a>`}),o=String(await vT.process(s));return o=(o=o.replace(/<ul class="contains-task-list">/g,'<ul data-type="taskList" class="task-list">').replace(/<li class="task-list-item">\s*<input type="checkbox"([^>]*)>\s*([\s\S]*?)(?=<\/li>)/g,(e,t,n)=>{let r=t.includes("checked"),i=n.trim();return`<li data-type="taskItem" data-checked="${r}"><label><input type="checkbox"${r?" checked":""}></label><div><p>${i}</p></div>`})).replace(/<video\b([^>]*)\bsrc="([^"]+)"([^>]*)><\/video>/gi,(e,t,n,r)=>{let i=vv(n);if(!i||"video"===i.provider)return e;let s=i.aspectRatio?` data-aspect-ratio="${i.aspectRatio}"`:"";return`<div data-embed="true" data-provider="${i.provider}" data-src="${i.embedUrl}" data-original-url="${i.originalUrl}"${s}><iframe src="${i.embedUrl}" data-embed-provider="${i.provider}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>`}),i.pagePath&&(n=o,r=i.pagePath,o=n=(n=(n=(n=n.replace(/href="\.\/([^"]+)"/g,(e,t)=>`href="/api/assets/${r}/${t}"`)).replace(/src="\.\/([^"]+)"/g,(e,t)=>`src="/api/assets/${r}/${t}"`)).replace(/data-src="\.\/([^"]+)"/g,(e,t)=>`data-src="/api/assets/${r}/${t}"`)).replace(/<a([^>]*?)href="(\/api\/assets\/[^"]+\.pdf)"([^>]*?)>/gi,(e,t,n,r)=>`<a${t}href="${n}"${r} data-pdf-link="true">`)),i.sanitize&&(o=String(await vN.process(o))),o}function vS(e,t){return Array(t+1).join(e)}function vC(e){return e.replace(/^\n*/,"")}function v_(e){for(var t=e.length;t>0&&"\n"===e[t-1];)t--;return e.substring(0,t)}var vM=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function vO(e){return vL(e,vM)}var vI=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function vD(e){return vL(e,vI)}var vR=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function vL(e,t){return t.indexOf(e.nodeName)>=0}function vj(e,t){return e.getElementsByTagName&&t.some(function(t){return e.getElementsByTagName(t).length})}var vP=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function vB(e){return vP.reduce(function(e,t){return e.replace(t[0],t[1])},e)}var vF={};function vH(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function vU(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function vz(e){return e.replace(/"/g,'\\"')}function v$(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}function vG(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(function(e,t,n){var r=e.filter;if("string"==typeof r){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if("function"==typeof r){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}(i,t,n))return i}}function vq(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function vV(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}vF.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},vF.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+"\n"}},vF.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if("setext"!==n.headingStyle||!(r<3))return"\n\n"+vS("#",r)+" "+e+"\n\n";var i=vS(1===r?"=":"-",e.length);return"\n\n"+e+"\n"+i+"\n\n"}},vF.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=v_(vC(e)).replace(/^/gm,"> "))+"\n\n"}},vF.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return"LI"===n.nodeName&&n.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}},vF.listItem={filter:"li",replacement:function(e,t,n){var r=n.bulletListMarker+" ",i=t.parentNode;if("OL"===i.nodeName){var s=i.getAttribute("start"),o=Array.prototype.indexOf.call(i.children,t);r=(s?Number(s)+o:o+1)+". "}var a=/\n$/.test(e);return e=(e=v_(vC(e))+(a?"\n":"")).replace(/\n/gm,"\n"+" ".repeat(r.length)),r+e+(t.nextSibling?"\n":"")}},vF.indentedCodeBlock={filter:function(e,t){return"indented"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){return"\n\n "+t.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},vF.fencedCodeBlock={filter:function(e,t){return"fenced"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){for(var r,i=((t.firstChild.getAttribute("class")||"").match(/language-(\S+)/)||[null,""])[1],s=t.firstChild.textContent,o=n.fence.charAt(0),a=3,l=RegExp("^"+o+"{3,}","gm");r=l.exec(s);)r[0].length>=a&&(a=r[0].length+1);var c=vS(o,a);return"\n\n"+c+i+"\n"+s.replace(/\n$/,"")+"\n"+c+"\n\n"}},vF.horizontalRule={filter:"hr",replacement:function(e,t,n){return"\n\n"+n.hr+"\n\n"}},vF.inlineLink={filter:function(e,t){return"inlined"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t){var n=vU(t.getAttribute("href")),r=vz(vH(t.getAttribute("title")));return"["+e+"]("+n+(r?' "'+r+'"':"")+")"}},vF.referenceLink={filter:function(e,t){return"referenced"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t,n){var r,i,s=vU(t.getAttribute("href")),o=vH(t.getAttribute("title"));switch(o&&(o=' "'+vz(o)+'"'),n.linkReferenceStyle){case"collapsed":r="["+e+"][]",i="["+e+"]: "+s+o;break;case"shortcut":r="["+e+"]",i="["+e+"]: "+s+o;break;default:var a=this.references.length+1;r="["+e+"]["+a+"]",i="["+a+"]: "+s+o}return this.references.push(i),r},references:[],append:function(e){var t="";return this.references.length&&(t="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),t}},vF.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}},vF.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}},vF.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n="PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];-1!==r.indexOf(n);)n+="`";return n+t+e+t+n}},vF.image={filter:"img",replacement:function(e,t){var n=vB(vH(t.getAttribute("alt"))),r=vU(t.getAttribute("src")||""),i=vH(t.getAttribute("title")),s=i?' "'+vz(i)+'"':"";return r?"!["+n+"]("+r+s+")":""}},v$.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){var t;return e.isBlank?this.blankRule:(t=vG(this.array,e,this.options))||(t=vG(this._keep,e,this.options))||(t=vG(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};var vW="u">typeof window?window:{},vK=!function(){var e=vW.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}()?(M=function(){},!function(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){vW.ActiveXObject&&(e=!0)}return e}()?M.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t}:M.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t},M):vW.DOMParser;function vY(e,t){var n;return!function(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return"PRE"===e.nodeName};if(!(!t.firstChild||i(t))){for(var s=null,o=!1,a=null,l=vV(null,t,i);l!==t;){if(3===l.nodeType||4===l.nodeType){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!o&&" "===c[0]&&(c=c.substr(1)),!c){l=vq(l);continue}l.data=c,s=l}else if(1===l.nodeType)n(l)||"BR"===l.nodeName?(s&&(s.data=s.data.replace(/ $/,"")),s=null,o=!1):r(l)||i(l)?(s=null,o=!0):s&&(o=!1);else{l=vq(l);continue}var d=vV(a,l,i);a=l,l=d}s&&(s.data=s.data.replace(/ $/,""),s.data||vq(s))}}({element:n="string"==typeof e?(Y=Y||new vK).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):e.cloneNode(!0),isBlock:vO,isVoid:vD,isPre:t.preformattedCode?vX:null}),n}function vX(e){return"PRE"===e.nodeName||"CODE"===e.nodeName}function vQ(e,t){var n;return e.isBlock=vO(e),e.isCode="CODE"===e.nodeName||e.parentNode.isCode,e.isBlank=!vD(n=e)&&!vL(n,vR)&&/^\s*$/i.test(n.textContent)&&!vj(n,vI)&&!vj(n,vR),e.flankingWhitespace=function(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n,r={leading:(n=e.textContent.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/))[1],leadingAscii:n[2],leadingNonAscii:n[3],trailing:n[4],trailingNonAscii:n[5],trailingAscii:n[6]};return r.leadingAscii&&vJ("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&vJ("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}(e,t),e}function vJ(e,t,n){var r,i,s;return"left"===e?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(3===r.nodeType?s=i.test(r.nodeValue):n.preformattedCode&&"CODE"===r.nodeName?s=!1:1!==r.nodeType||vO(r)||(s=i.test(r.textContent))),s}var vZ=Array.prototype.reduce;function v0(e){if(!(this instanceof v0))return new v0(e);this.options=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}({},{rules:vF,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?"\n\n":""},keepReplacement:function(e,t){return t.isBlock?"\n\n"+t.outerHTML+"\n\n":t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?"\n\n"+e+"\n\n":e}},e),this.rules=new v$(this.options)}function v1(e){var t=this;return vZ.call(e.childNodes,function(e,n){n=new vQ(n,t.options);var r="";return 3===n.nodeType?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):1===n.nodeType&&(r=v3.call(t,n)),v5(e,r)},"")}function v2(e){var t=this;return this.rules.forEach(function(n){"function"==typeof n.append&&(e=v5(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function v3(e){var t=this.rules.forNode(e),n=v1.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function v5(e,t){var n=v_(e),r=vC(t),i=Math.max(e.length-n.length,t.length-r.length);return n+"\n\n".substring(0,i)+r}v0.prototype={turndown:function(e){var t;if(!(null!=(t=e)&&("string"==typeof t||t.nodeType&&(1===t.nodeType||9===t.nodeType||11===t.nodeType))))throw TypeError(e+" is not a string, or an element/document/fragment node.");return""===e?"":v2.call(this,v1.call(this,new vY(e,this.options)))},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if("function"==typeof e)e(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return vB(e)}};var v4=/highlight-(?:text|source)-([a-z0-9]+)/;function v6(e){e.addRule("highlightedCodeBlock",{filter:function(e){var t=e.firstChild;return"DIV"===e.nodeName&&v4.test(e.className)&&t&&"PRE"===t.nodeName},replacement:function(e,t,n){var r=((t.className||"").match(v4)||[null,""])[1];return"\n\n"+n.fence+r+"\n"+t.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function v9(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var v7=Array.prototype.indexOf,v8=Array.prototype.every,we={};function wt(e){var t,n,r=e.parentNode;return"THEAD"===r.nodeName||r.firstChild===e&&("TABLE"===r.nodeName||(n=(t=r).previousSibling,"TBODY"===t.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&v8.call(e.childNodes,function(e){return"TH"===e.nodeName})}function wn(e,t){var n=v7.call(t.parentNode.childNodes,t),r=" ";return 0===n&&(r="| "),r+e+" |"}function wr(e){for(var t in e.keep(function(e){return"TABLE"===e.nodeName&&!wt(e.rows[0])}),we)e.addRule(t,we[t])}function wi(e){e.addRule("taskListItems",{filter:function(e){return"checkbox"===e.type&&"LI"===e.parentNode.nodeName},replacement:function(e,t){return(t.checked?"[x]":"[ ]")+" "}})}we.tableCell={filter:["th","td"],replacement:function(e,t){return wn(e,t)}},we.tableRow={filter:"tr",replacement:function(e,t){var n="",r={left:":--",right:"--:",center:":-:"};if(wt(t))for(var i=0;i<t.childNodes.length;i++){var s="---",o=(t.childNodes[i].getAttribute("align")||"").toLowerCase();o&&(s=r[o]||s),n+=wn(s,t.childNodes[i])}return"\n"+e+(n?"\n"+n:"")}},we.table={filter:function(e){return"TABLE"===e.nodeName&&wt(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}},we.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};let ws=new v0({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**"});for(let e of(ws.use(function(e){e.use([v6,v9,wr,wi])}),ws.addRule("codeBlock",{filter:e=>"PRE"===e.nodeName&&null!==e.firstChild&&"CODE"===e.firstChild.nodeName,replacement:(e,t)=>{let n=t.firstChild,r=n.getAttribute("class")?.replace("language-","")||"",i=n.textContent||"";return`
87
- \`\`\`${r}
88
- ${i}
89
- \`\`\`
90
- `}}),ws.addRule("wikiLink",{filter:e=>"A"===e.nodeName&&"true"===e.getAttribute("data-wiki-link"),replacement:(e,t)=>{let n=t.getAttribute("data-slug")??"",r=t.getAttribute("data-alias"),i=t.getAttribute("data-anchor");return r?`[[${n}|${r}]]`:i?`[[${n}#${i}]]`:`[[${n}]]`}}),ws.addRule("proofSpan",{filter:e=>"PROOF-SPAN"===e.nodeName,replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<proof-span${n.length?" "+n.join(" "):""}>${e}</proof-span>`}}),ws.addRule("styledSpan",{filter:e=>"SPAN"===e.nodeName&&!!e.getAttribute("style"),replacement:(e,t)=>{let n=t.getAttribute("style")??"";return`<span style="${n}">${e}</span>`}}),ws.addRule("lucideIcon",{filter:e=>"SPAN"===e.nodeName&&e.hasAttribute("data-lucide"),replacement:(e,t)=>{let n=t.getAttribute("data-lucide")??"file",r=t.getAttribute("data-color")??"gray";return`<span data-lucide="${n}" data-color="${r}">&nbsp;</span>`}}),ws.addRule("mark",{filter:"mark",replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<mark${n.length?` ${n.join(" ")}`:""}>${e}</mark>`}}),["u","sub","sup"]))ws.addRule(e,{filter:e,replacement:t=>`<${e}>${t}</${e}>`});function wo(e){return ws.turndown(e)}ws.addRule("video",{filter:"video",replacement:(e,t)=>{let n=t.getAttribute("src")??"",r=n?vv(n):null;if(r&&"video"!==r.provider){let e=r.aspectRatio?` data-aspect-ratio="${r.aspectRatio}"`:"";return`
91
- <div data-embed="true" data-provider="${r.provider}" data-src="${r.embedUrl}" data-original-url="${r.originalUrl}"${e}><iframe src="${r.embedUrl}" data-embed-provider="${r.provider}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
92
- `}let i=[];for(let e of Array.from(t.attributes))i.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<video${i.length?` ${i.join(" ")}`:""}></video>`}}),ws.addRule("embedBlock",{filter:e=>"DIV"===e.nodeName&&"true"===e.getAttribute("data-embed"),replacement:(e,t)=>{let n=t.getAttribute("data-provider")??"iframe",r=t.getAttribute("data-src")??"",i=t.getAttribute("data-original-url")??"",s=t.getAttribute("data-aspect-ratio")??"";if("video"===n)return`
93
- <video src="${r}" controls></video>
94
- `;let o=['data-embed="true"',`data-provider="${n}"`,`data-src="${r}"`,i?`data-original-url="${i}"`:"",s?`data-aspect-ratio="${s}"`:""].filter(Boolean).join(" ");return`
95
- <div ${o}><iframe src="${r}" data-embed-provider="${n}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
96
- `}}),ws.addRule("twitterEmbed",{filter:e=>"BLOCKQUOTE"===e.nodeName&&e.classList.contains("twitter-tweet"),replacement:(e,t)=>{let n=t.querySelector("a"),r=n?.getAttribute("href")??"";return`
97
- <blockquote class="twitter-tweet" data-theme="auto"><a href="${r}">${r}</a></blockquote>
98
- `}}),ws.addRule("sizedImage",{filter:e=>{if("IMG"!==e.nodeName)return!1;let t=e.getAttribute("width")??e.style.width,n=e.getAttribute("data-align");return!!(t||n)},replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<img ${n.join(" ")} />`}}),ws.addRule("resizableImageWrapper",{filter:e=>"DIV"===e.nodeName&&e.classList.contains("resizable-image"),replacement:e=>e}),ws.addRule("inlineMath",{filter:e=>{if("SPAN"!==e.nodeName)return!1;let t=e.getAttribute("data-type");return"inline-math"===t||"inlineMath"===t},replacement:(e,t)=>{let n=t.getAttribute("data-latex")??"";return`$${n}$`}}),ws.addRule("alignedBlock",{filter:e=>{if(!["P","H1","H2","H3","H4","H5","H6"].includes(e.nodeName))return!1;let t=e.getAttribute("style")??"";return/text-align:\s*(center|right|justify)/.test(t)},replacement:(e,t)=>{let n=t.nodeName.toLowerCase(),r=t.getAttribute("style")??"";return`
99
- <${n} style="${r}">${e}</${n}>
100
- `}});let wa=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;function wl(e){let t=e.trim();if(""===t)return"";if("true"===t)return!0;if("false"===t)return!1;if("null"===t||"~"===t)return null;if(/^-?\d+$/.test(t)||/^-?\d*\.\d+$/.test(t))return Number(t);if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]")){let e=t.slice(1,-1).trim();return""===e?[]:e.split(",").map(e=>wl(e))}return t}let wc=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,s={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,s);return s},wd=e=>{let t=e?wc(e):wc,n=e=>(function(e,t=e=>e){let n=Q.default.useSyncExternalStore(e.subscribe,Q.default.useCallback(()=>t(e.getState()),[e,t]),Q.default.useCallback(()=>t(e.getInitialState()),[e,t]));return Q.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},wu=e=>e?wd(e):wd,wp=wu(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(e=>({isOpen:!e.isOpen})),clearMessages:()=>{},activity:[],connections:[],hasToken:!1,pollIntervalMs:1e4,rateLimit:null,loadActivity:async()=>{let t=localStorage.getItem("wiki-agent-token")??null,n=!!(t&&t.trim());try{let t=await rK("/api/agent/activity?limit=50",{headers:{}});if(!t.ok)return void e({hasToken:n});let r=(await t.json()).events??[],i=function(e){let t=new Date(Date.now()-3e5).toISOString(),n=new Map;for(let r of e){if(r.at<t)continue;let e=n.get(r.by);e?n.set(r.by,{opCount:e.opCount+1,lastSeen:r.at>e.lastSeen?r.at:e.lastSeen}):n.set(r.by,{opCount:1,lastSeen:r.at})}return Array.from(n.entries()).map(([e,t])=>({by:e,...t})).sort((e,t)=>e.lastSeen<t.lastSeen?1:-1)}(r),s=null;try{let e=await rK("/api/agent/settings",{headers:{}});e.ok&&(s=(await e.json()).rateLimit??null)}catch{}e({activity:r,connections:i,hasToken:n,rateLimit:s})}catch{e({hasToken:n})}}}));class wh extends Error{status;constructor(e,t){super(e),this.status=t,this.name="FetchPageError"}}async function wf(e){let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw new wh(`Failed to fetch page: ${e}`,t.status);let n=await t.json(),r=t.headers.get("X-Wiki-Revision"),i=null!==r?Number(r):null;return{path:e,content:n.content,frontmatter:null,revision:i}}class wm extends Error{currentRevision;serverContent;constructor(e,t){super("File was modified externally. Reloaded with latest content."),this.currentRevision=e,this.serverContent=t,this.name="StaleRevisionError"}}async function wg(e,t,n){let r={path:e,content:t};null!==n&&(r.baseRevision=n);let i=await rK("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(409===i.status){let n=await i.json(),r=await rK(`/api/wiki/content?path=${encodeURIComponent(e)}`),s=r.ok?(await r.json()).content:t;throw new wm(n.currentRevision??0,s)}if(!i.ok)throw Error("Failed to save page");return{revision:(await i.json()).revision??null}}async function wb(e,t=""){await wg(e,t,null)}let wy="kb-page-cache";function wx(e){try{localStorage.setItem(wy,JSON.stringify(e))}catch{}}let wv="kb-edit-mode",ww=null,wE=null,wk=wu((e,t)=>({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null,editMode:"suggesting"===localStorage.getItem(wv)?"suggesting":"editing",setEditMode:t=>{localStorage.setItem(wv,t),e({editMode:t})},loadPage:async n=>{let r=t();r.isDirty&&r.currentPath&&r.currentPath!==n&&await t().save(),e({currentPath:n,isLoading:!0,loadStatus:"loading",isDirty:!1,content:"",currentRevision:null});let i=function(e){try{let t=localStorage.getItem(wy);if(!t)return null;let n=JSON.parse(t);if(n.path!==e)return null;return n}catch{return null}}(n);i&&e({content:i.content,frontmatter:i.frontmatter,isLoading:!1,loadStatus:"ok"});try{let r=await wf(n);if(t().currentPath!==n)return;e({content:r.content,frontmatter:r.frontmatter,isLoading:!1,loadStatus:"ok",currentRevision:r.revision}),wx({path:n,content:r.content,frontmatter:r.frontmatter})}catch(r){if(t().currentPath!==n)return;r instanceof wh&&404===r.status?e({isLoading:!1,loadStatus:"missing",content:""}):e({isLoading:!1,loadStatus:"error"})}},updateContent:n=>{"suggesting"===t().editMode?e({content:n}):(e({content:n,isDirty:!0}),ww&&clearTimeout(ww),ww=setTimeout(()=>{t().save()},500))},updateFrontmatter:n=>{e({frontmatter:{...t().frontmatter,...n},isDirty:!0}),ww&&clearTimeout(ww),ww=setTimeout(()=>{t().save()},500)},save:async()=>{let{currentPath:n,content:r,isDirty:i,currentRevision:s,editMode:o}=t();if(n&&i&&"suggesting"!==o){e({saveStatus:"saving"});try{let i=await wg(n,r,s);e({saveStatus:"saved",isDirty:!1,lastSavedAt:Date.now(),currentRevision:i.revision??s}),wx({path:n,content:r,frontmatter:t().frontmatter}),wE&&clearTimeout(wE),wE=setTimeout(()=>{"saved"===t().saveStatus&&e({saveStatus:"idle"})},2e3)}catch(r){r instanceof wm?(e({content:r.serverContent,isDirty:!1,saveStatus:"error",currentRevision:r.currentRevision}),wx({path:n,content:r.serverContent,frontmatter:t().frontmatter})):e({saveStatus:"error"})}}},createMissingPage:async n=>{let{currentPath:r}=t();if(!r)return;let i=`# ${n}
101
-
102
- `;try{await wb(`${r}/index.md`,i),e({content:i,isDirty:!1,loadStatus:"ok"}),wx({path:r,content:i,frontmatter:null})}catch{}},clear:()=>{ww&&clearTimeout(ww),wE&&clearTimeout(wE),e({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null})},syncRevision:t=>{e({currentRevision:t})}})),wT=wu((e,t)=>({nodes:[],selectedPath:null,expandedPaths:new Set,loadTree:async()=>{},selectPage:t=>{e({selectedPath:t})},expandPath:n=>{let{expandedPaths:r}=t();if(!r.has(n)){let t=new Set(r);t.add(n),e({expandedPaths:t})}},focusPath:n=>{let{expandedPaths:r}=t(),i=new Set(r),s=n.split("/");for(let e=1;e<s.length;e++)i.add(s.slice(0,e).join("/"));e({selectedPath:n,expandedPaths:i})}})),wN="wiki-view-width",wA={narrow:"max-w-2xl",normal:"max-w-4xl",wide:"max-w-screen-xl"},wS={narrow:"42rem",normal:"56rem",wide:"80rem"},wC={narrow:"Narrow",normal:"Normal",wide:"Wide"},w_=["narrow","normal","wide"],wM=wu(e=>{let t;return{width:"narrow"===(t=localStorage.getItem(wN))||"normal"===t||"wide"===t?t:"normal",setWidth:t=>{localStorage.setItem(wN,t),e({width:t})},cycle:()=>e(e=>{let t=w_.indexOf(e.width),n=w_[(t+1)%w_.length];return localStorage.setItem(wN,n),{width:n}})}}),wO=wu((e,t)=>({slugs:new Set,slugDir:new Map,loadedAt:null,loading:!1,load:async()=>{let{loadedAt:n,loading:r}=t();if(!r&&!(null!==n&&Date.now()-n<1e4)){e({loading:!0});try{let t=await rK("/api/wiki/slugs");if(!t.ok)throw Error("Failed to fetch wiki slugs");let n=await t.json(),r=new Set,i=new Map;for(let e of["entities","concepts","comparisons","root"])for(let t of n[e])r.add(t),i.has(t)||i.set(t,e);e({slugs:r,slugDir:i,loadedAt:Date.now(),loading:!1})}catch{e({loading:!1})}}},has:e=>t().slugs.has(e),getDir:e=>t().slugDir.get(e)??null,invalidate(){e({loadedAt:null})}}));function wI(){return{sidecar:null,snapshotRevision:0,lastEventId:0,snapshotBlocks:[]}}let wD=wu((e,t)=>({byPath:{},loadSidecar:async t=>{let n=encodeURIComponent(t).replace(/%2F/g,"/");try{let r=await rK(`/api/agent/sidecar/${n}`,{headers:{}});if(!r.ok)return;let i=await r.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??wI(),sidecar:i,snapshotRevision:i.revision,lastEventId:i.nextEventId-1}}}))}catch{}},loadSnapshot:async t=>{let n=encodeURIComponent(t).replace(/%2F/g,"/");try{let r=await rK(`/api/agent/files/${n}`,{headers:{}});if(!r.ok)return;let i=await r.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??wI(),snapshotBlocks:i.blocks,snapshotRevision:i.revision}}}));let s=wk.getState();s.currentPath===t&&s.syncRevision(i.revision)}catch{}},pollEvents:async e=>{let n=t().byPath[e]??wI(),r=encodeURIComponent(e).replace(/%2F/g,"/");try{let i=await rK(`/api/agent/events/${r}?after=${n.lastEventId}`,{headers:{}});if(!i.ok)return;for(let n of(await i.json()).events)t().applyEvent(e,n)}catch{}},applyEvent:(t,n)=>{e(e=>{let r=e.byPath[t]??wI();return{byPath:{...e.byPath,[t]:{...r,lastEventId:Math.max(r.lastEventId,n.id)}}}})},reset:t=>{e(e=>{let n={...e.byPath};return delete n[t],{byPath:n}})}}));async function wR(e,t,n){let r=encodeURIComponent(e).replace(/%2F/g,"/"),i=await fetch(`/api/agent/files/${r}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:[n]})});if(409===i.status){let e=await i.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return{ok:i.ok,stale:!1}}async function wL(e){let{path:t,ref:n,kind:r,markdown:i,basisDetail:s,getRevision:o,refresh:a}=e,l={type:"suggestion.add",ref:n,kind:r,basis:"suggested"};"delete"!==r&&(l.markdown=i??""),s&&(l.basisDetail=s);let c=await wR(t,o(),l);return!c.ok&&c.stale&&void 0!==c.newRevision&&(await a(),c=await wR(t,c.newRevision,l)),c.ok}var wj=e.i(187014);function wP(e,t){wj.toast.success(e,t)}function wB(e,t){wj.toast.error(e,t)}let wF=["top","right","bottom","left"],wH=wF.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),wU=Math.min,wz=Math.max,w$=Math.round,wG=Math.floor,wq=e=>({x:e,y:e}),wV={left:"right",right:"left",bottom:"top",top:"bottom"};function wW(e,t){return"function"==typeof e?e(t):e}function wK(e){return e.split("-")[0]}function wY(e){return e.split("-")[1]}function wX(e){return"x"===e?"y":"x"}function wQ(e){return"y"===e?"height":"width"}function wJ(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function wZ(e,t,n){void 0===n&&(n=!1);let r=wY(e),i=wX(wJ(e)),s=wQ(i),o="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=w4(o)),[o,w4(o)]}function w0(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let w1=["left","right"],w2=["right","left"],w3=["top","bottom"],w5=["bottom","top"];function w4(e){let t=wK(e);return wV[t]+e.slice(t.length)}function w6(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function w9(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 w7(e,t,n){let r,{reference:i,floating:s}=e,o=wJ(t),a=wX(wJ(t)),l=wQ(a),c=wK(t),d="y"===o,u=i.x+i.width/2-s.width/2,p=i.y+i.height/2-s.height/2,h=i[l]/2-s[l]/2;switch(c){case"top":r={x:u,y:i.y-s.height};break;case"bottom":r={x:u,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:p};break;case"left":r={x:i.x-s.width,y:p};break;default:r={x:i.x,y:i.y}}switch(wY(t)){case"start":r[a]-=h*(n&&d?-1:1);break;case"end":r[a]+=h*(n&&d?-1:1)}return r}async function w8(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=wW(t,e),f=w6(h),m=a[p?"floating"===u?"reference":"floating":u],g=w9(await s.getClippingRect({element:null==(n=await (null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=await (null==s.getOffsetParent?void 0:s.getOffsetParent(a.floating)),x=await (null==s.isElement?void 0:s.isElement(y))&&await (null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},v=w9(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-v.top+f.top)/x.y,bottom:(v.bottom-g.bottom+f.bottom)/x.y,left:(g.left-v.left+f.left)/x.x,right:(v.right-g.right+f.right)/x.x}}let Ee=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:w8},l=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=w7(c,r,l),p=r,h=0,f={};for(let n=0;n<s.length;n++){let m=s[n];if(!m)continue;let{name:g,fn:b}=m,{x:y,y:x,data:v,reset:w}=await b({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=y?y:d,u=null!=x?x:u,f[g]={...f[g],...v},w&&h<50&&(h++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:d,y:u}=w7(c,p,l)),n=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:f}};function Et(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function En(e){return wF.some(t=>e[t]>=0)}function Er(e){let t=wU(...e.map(e=>e.left)),n=wU(...e.map(e=>e.top));return{x:t,y:n,width:wz(...e.map(e=>e.right))-t,height:wz(...e.map(e=>e.bottom))-n}}let Ei=new Set(["left","top"]);async function Es(e,t){let{placement:n,platform:r,elements:i}=e,s=await (null==r.isRTL?void 0:r.isRTL(i.floating)),o=wK(n),a=wY(n),l="y"===wJ(n),c=Ei.has(o)?-1:1,d=s&&l?-1:1,u=wW(t,e),{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}function Eo(){return"u">typeof window}function Ea(e){return Ed(e)?(e.nodeName||"").toLowerCase():"#document"}function El(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ec(e){var t;return null==(t=(Ed(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Ed(e){return!!Eo()&&(e instanceof Node||e instanceof El(e).Node)}function Eu(e){return!!Eo()&&(e instanceof Element||e instanceof El(e).Element)}function Ep(e){return!!Eo()&&(e instanceof HTMLElement||e instanceof El(e).HTMLElement)}function Eh(e){return!(!Eo()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof El(e).ShadowRoot)}function Ef(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=EE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function Em(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let Eg=/transform|translate|scale|rotate|perspective|filter/,Eb=/paint|layout|strict|content/,Ey=e=>!!e&&"none"!==e;function Ex(e){let t=Eu(e)?EE(e):e;return Ey(t.transform)||Ey(t.translate)||Ey(t.scale)||Ey(t.rotate)||Ey(t.perspective)||!Ev()&&(Ey(t.backdropFilter)||Ey(t.filter))||Eg.test(t.willChange||"")||Eb.test(t.contain||"")}function Ev(){return null==i&&(i="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),i}function Ew(e){return/^(html|body|#document)$/.test(Ea(e))}function EE(e){return El(e).getComputedStyle(e)}function Ek(e){return Eu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ET(e){if("html"===Ea(e))return e;let t=e.assignedSlot||e.parentNode||Eh(e)&&e.host||Ec(e);return Eh(t)?t.host:t}function EN(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=ET(t);return Ew(n)?t.ownerDocument?t.ownerDocument.body:t.body:Ep(n)&&Ef(n)?n:e(n)}(e),s=i===(null==(r=e.ownerDocument)?void 0:r.body),o=El(i);if(!s)return t.concat(i,EN(i,[],n));{let e=EA(o);return t.concat(o,o.visualViewport||[],Ef(i)?i:[],e&&n?EN(e):[])}}function EA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ES(e){let t=EE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ep(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=w$(n)!==s||w$(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function EC(e){return Eu(e)?e:e.contextElement}function E_(e){let t=EC(e);if(!Ep(t))return wq(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:s}=ES(t),o=(s?w$(n.width):n.width)/r,a=(s?w$(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}let EM=wq(0);function EO(e){let t=El(e);return Ev()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:EM}function EI(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let s=e.getBoundingClientRect(),o=EC(e),a=wq(1);t&&(r?Eu(r)&&(a=E_(r)):a=E_(e));let l=(void 0===(i=n)&&(i=!1),r&&(!i||r===El(o))&&i)?EO(o):wq(0),c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,u=s.width/a.x,p=s.height/a.y;if(o){let e=El(o),t=r&&Eu(r)?El(r):r,n=e,i=EA(n);for(;i&&r&&t!==n;){let e=E_(i),t=i.getBoundingClientRect(),r=EE(i),s=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,p*=e.y,c+=s,d+=o,i=EA(n=El(i))}}return w9({width:u,height:p,x:c,y:d})}function ED(e,t){let n=Ek(e).scrollLeft;return t?t.left+n:EI(Ec(e)).left+n}function ER(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ED(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=El(e),r=Ec(e),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let e=Ev();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let c=ED(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,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(s-=o)}else c<=25&&(s+=c);return{width:s,height:o,x:a,y:l}}(e,n);else if("document"===t){let t,n,s,o,a,l,c;r=Ec(e),t=Ec(r),n=Ek(r),s=r.ownerDocument.body,o=wz(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=wz(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),l=-n.scrollLeft+ED(r),c=-n.scrollTop,"rtl"===EE(s).direction&&(l+=wz(t.clientWidth,s.clientWidth)-o),i={width:o,height:a,x:l,y:c}}else if(Eu(t)){let e,r,s,o,a,l;r=(e=EI(t,!0,"fixed"===n)).top+t.clientTop,s=e.left+t.clientLeft,o=Ep(t)?E_(t):wq(1),a=t.clientWidth*o.x,l=t.clientHeight*o.y,i={width:a,height:l,x:s*o.x,y:r*o.y}}else{let n=EO(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return w9(i)}function Ej(e){return"static"===EE(e).position}function EP(e,t){if(!Ep(e)||"fixed"===EE(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ec(e)===n&&(n=n.ownerDocument.body),n}function EB(e,t){var n;let r=El(e);if(Em(e))return r;if(!Ep(e)){let t=ET(e);for(;t&&!Ew(t);){if(Eu(t)&&!Ej(t))return t;t=ET(t)}return r}let i=EP(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(Ea(n)))&&Ej(i);)i=EP(i,t);return i&&Ew(i)&&Ej(i)&&!Ex(i)?r:i||function(e){let t=ET(e);for(;Ep(t)&&!Ew(t);){if(Ex(t))return t;if(Em(t))break;t=ET(t)}return null}(e)||r}let EF=async function(e){let t=this.getOffsetParent||EB,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=Ep(t),i=Ec(t),s="fixed"===n,o=EI(e,!0,s,t),a={scrollLeft:0,scrollTop:0},l=wq(0);if(r||!r&&!s)if(("body"!==Ea(t)||Ef(i))&&(a=Ek(t)),r){let e=EI(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=ED(i));s&&!r&&i&&(l.x=ED(i));let c=!i||r||s?wq(0):ER(i,a);return{x:o.left+a.scrollLeft-l.x-c.x,y:o.top+a.scrollTop-l.y-c.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},EH={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,s="fixed"===i,o=Ec(r),a=!!t&&Em(t.floating);if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=wq(1),d=wq(0),u=Ep(r);if((u||!u&&!s)&&(("body"!==Ea(r)||Ef(o))&&(l=Ek(r)),u)){let e=EI(r);c=E_(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=!o||u||s?wq(0):ER(o,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}},getDocumentElement:Ec,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,s=[..."clippingAncestors"===n?Em(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=EN(e,[],!1).filter(e=>Eu(e)&&"body"!==Ea(e)),i=null,s="fixed"===EE(e).position,o=s?ET(e):e;for(;Eu(o)&&!Ew(o);){let t=EE(o),n=Ex(o);n||"fixed"!==t.position||(i=null),(s?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||Ef(o)&&!n&&function e(t,n){let r=ET(t);return!(r===n||!Eu(r)||Ew(r))&&("fixed"===EE(r).position||e(r,n))}(e,o)))?i=t:r=r.filter(e=>e!==o),o=ET(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=EL(t,s[0],i),a=o.top,l=o.right,c=o.bottom,d=o.left;for(let e=1;e<s.length;e++){let n=EL(t,s[e],i);a=wz(n.top,a),l=wU(n.right,l),c=wU(n.bottom,c),d=wz(n.left,d)}return{width:l-d,height:c-a,x:d,y:a}},getOffsetParent:EB,getElementRects:EF,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=ES(e);return{width:t,height:n}},getScale:E_,isElement:Eu,isRTL:function(e){return"rtl"===EE(e).direction}};function EU(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let Ez=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:s,placement:o,middlewareData:a}=t,l=await Es(t,e);return o===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},E$=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i,s;let{rects:o,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:u=!1,alignment:p,allowedPlacements:h=wH,autoAlignment:f=!0,...m}=wW(e,t),g=void 0!==p||h===wH?((s=p||null)?[...h.filter(e=>wY(e)===s),...h.filter(e=>wY(e)!==s)]:h.filter(e=>wK(e)===e)).filter(e=>!s||wY(e)===s||!!f&&w0(e)!==e):h,b=await c.detectOverflow(t,m),y=(null==(n=a.autoPlacement)?void 0:n.index)||0,x=g[y];if(null==x)return{};let v=wZ(x,o,await (null==c.isRTL?void 0:c.isRTL(d.floating)));if(l!==x)return{reset:{placement:g[0]}};let w=[b[wK(x)],b[v[0]],b[v[1]]],E=[...(null==(r=a.autoPlacement)?void 0:r.overflows)||[],{placement:x,overflows:w}],k=g[y+1];if(k)return{data:{index:y+1,overflows:E},reset:{placement:k}};let T=E.map(e=>{let t=wY(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),N=(null==(i=T.filter(e=>e[2].slice(0,wY(e[0])?2:3).every(e=>e<=0))[0])?void 0:i[0])||T[0][0];return N!==l?{data:{index:y+1,overflows:E},reset:{placement:N}}:{}}}},EG=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=wW(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),p=wJ(wK(i)),h=wX(p),f=d[h],m=d[p];if(o){let e="y"===h?"top":"left",t="y"===h?"bottom":"right",n=f+u[e],r=f-u[t];f=wz(n,wU(f,r))}if(a){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=m+u[e],r=m-u[t];m=wz(n,wU(m,r))}let g=l.fn({...t,[h]:f,[p]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:o,[p]:a}}}}}},Eq=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,s,o;let a,l,c,{placement:d,middlewareData:u,rects:p,initialPlacement:h,platform:f,elements:m}=t,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:y,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...E}=wW(e,t);if(null!=(n=u.arrow)&&n.alignmentOffset)return{};let k=wK(d),T=wJ(h),N=wK(h)===h,A=await (null==f.isRTL?void 0:f.isRTL(m.floating)),S=y||(N||!w?[w4(h)]:(a=w4(h),[w0(h),a,w0(a)])),C="none"!==v;!y&&C&&S.push(...(l=wY(h),c=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?w2:w1;return t?w1:w2;case"left":case"right":return t?w3:w5;default:return[]}}(wK(h),"start"===v,A),l&&(c=c.map(e=>e+"-"+l),w&&(c=c.concat(c.map(w0)))),c));let _=[h,...S],M=await f.detectOverflow(t,E),O=[],I=(null==(r=u.flip)?void 0:r.overflows)||[];if(g&&O.push(M[k]),b){let e=wZ(d,p,A);O.push(M[e[0]],M[e[1]])}if(I=[...I,{placement:d,overflows:O}],!O.every(e=>e<=0)){let e=((null==(i=u.flip)?void 0:i.index)||0)+1,t=_[e];if(t&&("alignment"!==b||T===wJ(t)||I.every(e=>wJ(e.placement)!==T||e.overflows[0]>0)))return{data:{index:e,overflows:I},reset:{placement:t}};let n=null==(s=I.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:s.placement;if(!n)switch(x){case"bestFit":{let e=null==(o=I.filter(e=>{if(C){let t=wJ(e.placement);return t===T||"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:o[0];e&&(n=e);break}case"initialPlacement":n=h}if(d!==n)return{reset:{placement:n}}}return{}}}},EV=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let i,s,{placement:o,rects:a,platform:l,elements:c}=t,{apply:d=()=>{},...u}=wW(e,t),p=await l.detectOverflow(t,u),h=wK(o),f=wY(o),m="y"===wJ(o),{width:g,height:b}=a.floating;"top"===h||"bottom"===h?(i=h,s=f===(await (null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(s=h,i="end"===f?"top":"bottom");let y=b-p.top-p.bottom,x=g-p.left-p.right,v=wU(b-p[i],y),w=wU(g-p[s],x),E=!t.middlewareData.shift,k=v,T=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=x),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(k=y),E&&!f){let e=wz(p.left,0),t=wz(p.right,0),n=wz(p.top,0),r=wz(p.bottom,0);m?T=g-2*(0!==e||0!==t?e+t:wz(p.left,p.right)):k=b-2*(0!==n||0!==r?n+r:wz(p.top,p.bottom))}await d({...t,availableWidth:T,availableHeight:k});let N=await l.getDimensions(c.floating);return g!==N.width||b!==N.height?{reset:{rects:!0}}:{}}}},EW=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=wW(e,t);switch(i){case"referenceHidden":{let e=Et(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:En(e)}}}case"escaped":{let e=Et(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:En(e)}}}default:return{}}}}},EK=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=wW(e,t)||{};if(null==c)return{};let u=w6(d),p={x:n,y:r},h=wX(wJ(i)),f=wQ(h),m=await o.getDimensions(c),g="y"===h,b=g?"clientHeight":"clientWidth",y=s.reference[f]+s.reference[h]-p[h]-s.floating[f],x=p[h]-s.reference[h],v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(c)),w=v?v[b]:0;w&&await (null==o.isElement?void 0:o.isElement(v))||(w=a.floating[b]||s.floating[f]);let E=w/2-m[f]/2-1,k=wU(u[g?"top":"left"],E),T=wU(u[g?"bottom":"right"],E),N=w-m[f]-T,A=w/2-m[f]/2+(y/2-x/2),S=wz(k,wU(A,N)),C=!l.arrow&&null!=wY(i)&&A!==S&&s.reference[f]/2-(A<k?k:T)-m[f]/2<0,_=C?A<k?A-k:A-N:0;return{[h]:p[h]+_,data:{[h]:S,centerOffset:A-S-_,...C&&{alignmentOffset:_}},reset:C}}}),EY=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:s,strategy:o}=t,{padding:a=2,x:l,y:c}=wW(e,t),d=Array.from(await (null==s.getClientRects?void 0:s.getClientRects(r.reference))||[]),u=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=>w9(Er(e)))}(d),p=w9(Er(d)),h=w6(a),f=await s.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find(e=>l>e.left-h.left&&l<e.right+h.right&&c>e.top-h.top&&c<e.bottom+h.bottom)||p;if(u.length>=2){if("y"===wJ(n)){let e=u[0],t=u[u.length-1],r="top"===wK(n),i=e.top,s=t.bottom,o=r?e.left:t.left,a=r?e.right:t.right;return{top:i,bottom:s,left:o,right:a,width:a-o,height:s-i,x:o,y:i}}let e="left"===wK(n),t=wz(...u.map(e=>e.right)),r=wU(...u.map(e=>e.left)),i=u.filter(n=>e?n.left===r:n.right===t),s=i[0].top,o=i[i.length-1].bottom;return{top:s,bottom:o,left:r,right:t,width:t-r,height:o-s,x:r,y:s}}return p}},floating:r.floating,strategy:o});return i.reference.x!==f.reference.x||i.reference.y!==f.reference.y||i.reference.width!==f.reference.width||i.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},EX=(e,t,n)=>{let r=new Map,i={platform:EH,...n},s={...i.platform,_c:r};return Ee(e,t,{...i,platform:s})};var EQ=class{constructor({editor:e,element:t,view:n,pluginKey:r="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:o,appendTo:a,getReferencedVirtualElement:l,options:c}){var d;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:s}=t,{empty:o}=s,a=!i.textBetween(n,r).length&&dn(t.selection),l=this.element.contains(document.activeElement);return!!(e.hasFocus()||l)&&!o&&!a&&!!this.editor.isEditable},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.editor.isDestroyed)return void this.destroy();if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.show(),this.updatePosition()):this.hide())},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=a,this.scrollTarget=null!=(d=null==c?void 0:c.scrollTarget)?d:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Eq("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(EG("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Ez("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(EK(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(EV("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(E$("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(EW("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(EY("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n,r,i;let{selection:s}=this.editor.state,o=null==(e=this.getReferencedVirtualElement)?void 0:e.call(this);if(o)return o;if(!(null==(n=null==(t=this.view)?void 0:t.dom)?void 0:n.parentNode))return;let a=uf(this.view,s.from,s.to),l={getBoundingClientRect:()=>a,getClientRects:()=>[a]};if(s instanceof sE){let e=this.view.nodeDOM(s.from),t=e.dataset.nodeViewWrapper?e:e.querySelector("[data-node-view-wrapper]");t&&(e=t),e&&(l={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(s instanceof lC){let e,t,n,{$anchorCell:o,$headCell:a}=s,c=o?o.pos:a.pos,d=a?a.pos:o.pos,u=this.view.nodeDOM(c),p=this.view.nodeDOM(d);if(!u||!p)return;let h=u===p?u.getBoundingClientRect():(r=u.getBoundingClientRect(),i=p.getBoundingClientRect(),e=Math.min(r.top,i.top),t=Math.max(r.bottom,i.bottom),n=Math.min(r.left,i.left),new DOMRect(n,e,Math.max(r.right,i.right)-n,t-e));l={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return l}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&EX(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,s;if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(s=r.hide)?void 0:s.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r)return void this.handleDebouncedUpdate(e,t);let i=!(null==t?void 0:t.selection.eq(e.state.selection)),s=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,s=Math.min(...i.map(e=>e.$from.pos)),o=Math.max(...i.map(e=>e.$to.pos));return(null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:o}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.getReferencedVirtualElement&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},EJ=e=>new sR({key:"string"==typeof e.pluginKey?new sP(e.pluginKey):e.pluginKey,view:t=>new EQ({view:t,...e})});uW.create({name:"bubbleMenu",addOptions:()=>({element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[EJ({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var EZ=class{constructor({editor:e,element:t,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:o,appendTo:a,shouldShow:l}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,s=1===r.depth,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&0===r.parent.childCount&&!this.getTextContent(r.parent);return!!e.hasFocus()&&!!i&&!!s&&!!o&&!!this.editor.isEditable},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.updatePosition(),this.show()):this.hide())},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=a,this.scrollTarget=null!=(c=null==o?void 0:o.scrollTarget)?c:window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return d8(e,{textSerializers:ue(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Eq("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(EG("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Ez("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(EK(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(EV("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(E$("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(EW("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(EY("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,s=Math.min(...i.map(e=>e.$from.pos)),o=Math.max(...i.map(e=>e.$to.pos));return null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:o})}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e,t;if(!(null==(t=null==(e=this.view)?void 0:e.dom)?void 0:t.parentNode))return;let{selection:n}=this.editor.state,r=uf(this.view,n.from,n.to);EX({getBoundingClientRect:()=>r,getClientRects:()=>[r]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,s;if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(s=r.hide)?void 0:s.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},E0=e=>new sR({key:"string"==typeof e.pluginKey?new sP(e.pluginKey):e.pluginKey,view:t=>new EZ({view:t,...e})});function E1(e,t){return null!=e?e:new sP(t)}uW.create({name:"floatingMenu",addOptions:()=>({element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}),addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[E0({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var E2="u">typeof window?Q.useLayoutEffect:Q.useEffect,E3=new Set(["left","opacity","position","top","visibility","width"]),E5=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),E4=new Set(["children","className","style"]),E6=new Set(["tabIndex"]),E9=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),E7={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function E8(e,t){return/^on[A-Z]/.test(e)&&"function"==typeof t}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function kt(e,t,n){if("tabIndex"===t){e.tabIndex=Number(n);return}e[t]=n}function kn(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);E2(()=>{var i,s,o;let a,l,c,d=n.current;return!function(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}(e,d.className,t.className),i=d.style,s=t.style,a=null!=i?i:{},l=null!=s?s:{},new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{let n=a[t],r=l[t];if(n!==r){if(null==r)return void(!E3.has(t)&&e.style.removeProperty(ke(t)));E3.has(t)||e.style.setProperty(ke(t),"number"!=typeof r||0===r||t.startsWith("--")||E5.has(t)?String(r):`${r}px`)}}),new Set([...Object.keys(d),...Object.keys(t)]).forEach(n=>{if(E4.has(n)||!(n.startsWith("aria-")||n.startsWith("data-")||E9.has(n))||E8(n,d[n])||E8(n,t[n]))return;let r=d[n],i=t[n];if(r===i)return;let s=(n.startsWith("aria-")||n.startsWith("data-"),n);if(null==i||!1===i){E6.has(n)&&function(e,t){if("tabIndex"===t)return e.removeAttribute("tabindex");let n=e[t];if("boolean"==typeof n){e[t]=!1;return}if("number"==typeof n){e[t]=0;return}e[t]=""}(e,n),e.removeAttribute(s);return}if(!0===i){E6.has(n)&&kt(e,n,!0),e.setAttribute(s,"");return}E6.has(n)?kt(e,n,i):e.setAttribute(s,String(i))}),o=r.current,o.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),c=[],Object.entries(t).forEach(([t,n])=>{var r;let i,s;if(!E8(t,n))return;let{eventName:o,options:a}={eventName:null!=(r=E7[s=((i=t.endsWith("Capture"))?t.slice(0,-7):t).slice(2)])?r:s.toLowerCase(),options:i?{capture:!0}:void 0},l=t=>{let r,i,s;n((r=t.defaultPrevented,i=!1,Object.defineProperties(s=Object.create(t),{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>r},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{r=!0,t.preventDefault()}},stopPropagation:{value:()=>{i=!0,t.stopPropagation()}}}),s))};e.addEventListener(o,l,a),c.push({eventName:o,listener:l,options:a})}),r.current=c,n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var kr=Q.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:a,children:l,...c},d)=>{let u=(0,Q.useRef)(document.createElement("div")),p=(0,Q.useRef)(E1(e,"bubbleMenu")).current;kn(u.current,c),"function"==typeof d?d(u.current):d&&(d.current=u.current);let{editor:h}=p1(),f=t||h,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:p,shouldShow:s,getReferencedVirtualElement:o,options:a},g=(0,Q.useRef)(m);g.current=m;let[b,y]=(0,Q.useState)(!1),x=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(null==f?void 0:f.isDestroyed)return;if(!f)return void console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");let e=u.current;e.style.visibility="hidden",e.style.position="absolute";let t=EJ({...g.current,editor:f,element:e});f.registerPlugin(t);let n=g.current.pluginKey;return x.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[f]),(0,Q.useEffect)(()=>{if(b&&f&&!f.isDestroyed){if(x.current){x.current=!1;return}f.view.dispatch(f.state.tr.setMeta(p,{type:"updateOptions",options:g.current}))}},[b,f,n,r,s,a,i,o,p]),(0,t4.createPortal)(l,u.current)});Q.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:s=null,options:o,children:a,...l},c)=>{let d=(0,Q.useRef)(document.createElement("div")),u=(0,Q.useRef)(E1(e,"floatingMenu")).current;kn(d.current,l),"function"==typeof c?c(d.current):c&&(c.current=d.current);let{editor:p}=p1(),h=t||p,f={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:u,shouldShow:s,options:o},m=(0,Q.useRef)(f);m.current=f;let[g,b]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(null==h?void 0:h.isDestroyed)return;if(!h)return void console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");let e=d.current;e.style.visibility="hidden",e.style.position="absolute";let t=E0({...m.current,editor:h,element:e});h.registerPlugin(t);let n=m.current.pluginKey;return y.current=!0,b(!0),()=>{b(!1),h.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[h]),(0,Q.useEffect)(()=>{if(g&&h&&!h.isDestroyed){if(y.current){y.current=!1;return}h.view.dispatch(h.state.tr.setMeta(u,{type:"updateOptions",options:m.current}))}},[g,h,n,r,s,o,i,u]),(0,t4.createPortal)(a,d.current)});let ki=en("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),ks=en("align-justify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),ko=en("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),ka=en("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),kl=en("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),kc=en("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),kd=en("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),ku=en("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),kp=en("message-square-plus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),kh=en("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),kf=en("subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]),km=en("superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]),kg=en("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),kb=en("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function ky({anchor:e,initialUrl:t="",onCancel:n,onApply:r,onRemove:i}){let[s,o]=(0,Q.useState)(t);(0,Q.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);let a=()=>{let e=s.trim();e?r(e):n()};return(0,X.jsxs)("div",{className:"absolute z-50 w-[340px] bg-popover border border-border rounded-lg shadow-xl overflow-hidden",style:{top:e.top,left:e.left},onMouseDown:e=>e.stopPropagation(),children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[(0,X.jsx)(ey,{className:"w-3.5 h-3.5"}),t?"Edit link":"Add link"]}),(0,X.jsx)("button",{type:"button",onClick:n,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,X.jsxs)("div",{className:"p-3 space-y-2",children:[(0,X.jsx)("input",{type:"url",autoFocus:!0,value:s,placeholder:"https://example.com",onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),a())},className:"w-full bg-background border border-border rounded-md px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("button",{type:"button",onClick:a,disabled:!s.trim(),className:"flex-1 py-1.5 text-[12px] rounded-md bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:t?"Update":"Add link"}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"p-1.5 rounded-md border border-border hover:bg-accent text-muted-foreground hover:text-foreground",title:"Open link",children:(0,X.jsx)(kb,{className:"w-3.5 h-3.5"})}),i&&(0,X.jsx)("button",{type:"button",onClick:i,className:"p-1.5 rounded-md border border-border hover:bg-accent text-destructive",title:"Remove link",children:(0,X.jsx)(eO,{className:"w-3.5 h-3.5"})})]})]})]})]})}function kx({editor:e,onSuggestEdit:t,onComment:n}){let[r,i]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!r)return;let e=e=>{let t=e.target;t?.closest("[data-bubble-popover='true']")||i(null)},t=window.setTimeout(()=>window.addEventListener("mousedown",e),10);return()=>{window.clearTimeout(t),window.removeEventListener("mousedown",e)}},[r]),!e)return null;let s=()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}},o=t=>e.chain().focus().setTextSelection(t).run(),a=e=>t=>{t.preventDefault(),e()},l=t=>{r?.type==="align"&&(o(r.range),e.chain().focus().setTextAlign(t).run(),i(null))};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(kr,{editor:e,options:{placement:"top",offset:8},className:"flex items-center gap-0.5 px-1 py-1 bg-popover border border-border rounded-sm shadow-lg",children:[(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("bold")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleBold().run()),"aria-label":"Bold",children:(0,X.jsx)(kl,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("italic")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleItalic().run()),"aria-label":"Italic",children:(0,X.jsx)(kd,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("underline")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleUnderline().run()),"aria-label":"Underline",children:(0,X.jsx)(kg,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("strike")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleStrike().run()),"aria-label":"Strikethrough",children:(0,X.jsx)(kh,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("code")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleCode().run()),"aria-label":"Inline code",children:(0,X.jsx)(kc,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("superscript")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleSuperscript().run()),"aria-label":"Superscript",children:(0,X.jsx)(km,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("subscript")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleSubscript().run()),"aria-label":"Subscript",children:(0,X.jsx)(kf,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("link")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.preventDefault();let n=e.getAttributes("link")?.href??"",r=t.currentTarget.getBoundingClientRect();i({type:"link",range:s(),existing:n,anchor:{top:r.bottom+6,left:r.left}})},"aria-label":"Link",children:(0,X.jsx)(ey,{className:"w-3.5 h-3.5"})}),(t||n)&&(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),n&&(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),n()},"aria-label":"Comment",title:"Comment",children:(0,X.jsx)(ku,{className:"w-3.5 h-3.5"})}),t&&(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),t()},"aria-label":"Suggest edit",title:"Suggest edit",children:(0,X.jsx)(kp,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),i({type:"align",range:s()})},"aria-label":"Align",children:(0,X.jsx)(ko,{className:"w-3.5 h-3.5"})}),r?.type==="align"&&(0,X.jsxs)("div",{"data-bubble-popover":"true",className:"absolute top-full left-0 mt-1 z-50 bg-popover border border-border rounded-sm shadow-lg p-1 flex gap-0.5",children:[(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"left"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("left"),"aria-label":"Align left",children:(0,X.jsx)(ko,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"center"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("center"),"aria-label":"Align center",children:(0,X.jsx)(ki,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"right"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("right"),"aria-label":"Align right",children:(0,X.jsx)(ka,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:tK("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"justify"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("justify"),"aria-label":"Justify",children:(0,X.jsx)(ks,{className:"w-3.5 h-3.5"})})]})]})]}),r?.type==="link"&&(0,X.jsx)("div",{"data-bubble-popover":"true",style:{position:"fixed",top:r.anchor.top,left:r.anchor.left,zIndex:60},children:(0,X.jsx)(ky,{anchor:{top:0,left:0},initialUrl:r.existing,onCancel:()=>i(null),onApply:t=>{r?.type==="link"&&(o(r.range),e.chain().focus().extendMarkRange("link").setLink({href:t}).run(),i(null))},onRemove:r.existing?()=>{r?.type==="link"&&(o(r.range),e.chain().focus().unsetLink().run(),i(null))}:void 0})})]})}let kv=en("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),kw=en("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),kE=en("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),kk=en("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),kT=en("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),kN=en("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),kA=en("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),kS=en("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),kC=en("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),k_=en("pilcrow-left",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]),kM=en("pilcrow-right",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]),kO=en("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),kI=en("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]),kD=en("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),kR=en("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);var kL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=eH(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,X.jsx)(i?n:t,{...s,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),kj="horizontal",kP=["horizontal","vertical"],kB=Q.forwardRef((e,t)=>{var n;let{decorative:r,orientation:i=kj,...s}=e,o=(n=i,kP.includes(n))?i:kj;return(0,X.jsx)(kL.div,{"data-orientation":o,...r?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...s,ref:t})});kB.displayName="Separator";let kF=Q.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>(0,X.jsx)(kB,{ref:i,decorative:n,orientation:t,className:tK("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));kF.displayName=kB.displayName;let kH=en("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);async function kU(e,t){let n=new FormData;n.append("file",t);try{let t=await rK(`/api/upload/${e}`,{method:"POST",body:n});if(!t.ok)return null;let r=await t.json();return{url:r.url,filename:r.filename}}catch{return null}}function kz({kind:e,pagePath:t,onCancel:n,onInsert:r,anchor:i}){let[s,o]=(0,Q.useState)("upload"),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(null),h=(0,Q.useRef)(null),f=async e=>{if(e&&0!==e.length){d(!0),p(null);try{let n=e[0],i=await kU(t,n);if(!i)return void p("Upload failed.");r({url:i.url,alt:n.name,mimeType:n.type})}finally{d(!1)}}},m=()=>{let e=a.trim();e&&r({url:e})};return(0,X.jsxs)("div",{className:"absolute z-50 w-[360px] bg-popover border border-border rounded-xl shadow-e-4 overflow-hidden",style:{top:i.top,left:i.left},onMouseDown:e=>e.stopPropagation(),children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,X.jsx)("div",{className:"text-[12px] font-medium",children:"image"===e?"Insert image":"video"===e?"Insert video":"Attach file"}),(0,X.jsx)("button",{type:"button",onClick:n,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,X.jsxs)("div",{className:"flex border-b border-border bg-muted/30",children:[(0,X.jsxs)("button",{type:"button",onClick:()=>o("upload"),className:tK("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","upload"===s?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,X.jsx)(eI,{className:"w-3 h-3"})," Upload"]}),(0,X.jsxs)("button",{type:"button",onClick:()=>o("url"),className:tK("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","url"===s?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,X.jsx)(ey,{className:"w-3 h-3"})," From URL"]})]}),"upload"===s?(0,X.jsxs)("div",{className:"p-4",onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),f(e.dataTransfer.files)},children:[(0,X.jsxs)("button",{type:"button",onClick:()=>h.current?.click(),disabled:c,className:"w-full border-2 border-dashed border-border rounded-sm py-6 flex flex-col items-center justify-center text-muted-foreground hover:bg-accent/30 transition-colors",children:[(0,X.jsx)(eI,{className:"w-5 h-5 mb-1.5"}),(0,X.jsx)("span",{className:"text-[12px] font-medium",children:c?"Uploading…":`Click to upload ${e}`}),(0,X.jsx)("span",{className:"text-[10px] mt-0.5",children:"or drop a file here"})]}),(0,X.jsx)("input",{ref:h,type:"file",accept:"image"===e?"image/*":"video"===e?"video/*":"*/*",className:"hidden",onChange:e=>f(e.target.files)}),u&&(0,X.jsx)("div",{className:"mt-2 text-[11px] text-destructive",children:u})]}):(0,X.jsxs)("div",{className:"p-3 space-y-2",children:[(0,X.jsx)("input",{type:"url",autoFocus:!0,value:a,placeholder:"image"===e?"https://example.com/image.png":"video"===e?"https://example.com/video.mp4":"https://example.com/file",onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),m()):"Escape"===e.key&&n()},className:"w-full bg-background border border-border rounded-sm px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,X.jsx)("button",{type:"button",onClick:m,disabled:!a.trim(),className:"w-full py-1.5 text-[12px] rounded-sm bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:"Insert"})]}),(0,X.jsxs)("div",{className:"px-3 py-2 border-t border-border bg-muted/30 text-[10px] text-muted-foreground flex items-start gap-1.5",children:[(0,X.jsx)(kH,{className:"w-3 h-3 shrink-0 mt-[1px]"}),(0,X.jsxs)("span",{children:["Tip: you can also"," ",(0,X.jsx)("strong",{className:"text-foreground/80",children:"paste"})," or"," ",(0,X.jsx)("strong",{className:"text-foreground/80",children:"drag & drop"}),"files directly into the page — they'll be saved alongside this page automatically."]})]})]})}function k$({label:e,icon:t,active:n,disabled:r,style:i,onAction:s}){return(0,X.jsx)("button",{type:"button","aria-label":e,title:e,disabled:r,style:i,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),s(e)},className:tK("h-8 w-8 shrink-0 inline-flex items-center justify-center rounded-md text-foreground/80 hover:bg-accent hover:text-accent-foreground transition-colors disabled:opacity-40",n&&"bg-accent text-accent-foreground ring-1 ring-inset ring-foreground/15"),children:(0,X.jsx)(t,{className:"h-4 w-4"})})}function kG({editor:e}){let t=wk(e=>e.frontmatter),n=wk(e=>e.updateFrontmatter),r=wk(e=>e.currentPath),i=t?.dir==="rtl",[s,o]=(0,Q.useState)(null),a=(0,Q.useRef)(null),[l,c]=(0,Q.useState)(!1),[d,u]=(0,Q.useState)(!1),[,p]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!e)return;let t=()=>p(e=>e+1);return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e]);let h=(0,Q.useCallback)(()=>{let e=a.current;e&&(c(e.scrollLeft>4),u(e.scrollLeft+e.clientWidth<e.scrollWidth-4))},[]);(0,Q.useEffect)(()=>{if(!e)return;let t=a.current;if(!t)return;let n=requestAnimationFrame(h),r=()=>h();window.addEventListener("resize",r),t.addEventListener("scroll",h);let i=new ResizeObserver(()=>h());for(let e of(i.observe(t),Array.from(t.children)))i.observe(e);return()=>{cancelAnimationFrame(n),window.removeEventListener("resize",r),t.removeEventListener("scroll",h),i.disconnect()}},[e,h]);let f=e=>{let t=a.current;t&&t.scrollBy({left:e*Math.max(160,.6*t.clientWidth),behavior:"smooth"})};if(!e)return null;let m=(t,n)=>{e.chain().focus().setTextSelection(t).run(),n()},g=(t,n)=>{let r=t.currentTarget.getBoundingClientRect();o(n({top:r.bottom+6,left:r.left},(()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}})()))},b=[{icon:kk,action:()=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e.isActive("heading",{level:1}),label:"Heading 1"},{icon:kT,action:()=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e.isActive("heading",{level:2}),label:"Heading 2"},{icon:kN,action:()=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e.isActive("heading",{level:3}),label:"Heading 3"},{separator:!0},{icon:kl,action:()=>e.chain().focus().toggleBold().run(),isActive:e.isActive("bold"),label:"Bold"},{icon:kd,action:()=>e.chain().focus().toggleItalic().run(),isActive:e.isActive("italic"),label:"Italic"},{icon:kg,action:()=>e.chain().focus().toggleUnderline().run(),isActive:e.isActive("underline"),label:"Underline"},{icon:kh,action:()=>e.chain().focus().toggleStrike().run(),isActive:e.isActive("strike"),label:"Strikethrough"},{icon:kc,action:()=>e.chain().focus().toggleCode().run(),isActive:e.isActive("code"),label:"Inline code"},{icon:ey,action:t=>{let n=e.getAttributes("link")?.href??"";g(t,(e,t)=>({type:"link",anchor:e,range:t,existing:n}))},isActive:e.isActive("link"),label:"Link"},{separator:!0},{icon:kA,action:()=>e.chain().focus().toggleBulletList().run(),isActive:e.isActive("bulletList"),label:"Bullet list"},{icon:kS,action:()=>e.chain().focus().toggleOrderedList().run(),isActive:e.isActive("orderedList"),label:"Ordered list"},{icon:kO,action:()=>e.chain().focus().toggleBlockquote().run(),isActive:e.isActive("blockquote"),label:"Blockquote"},{icon:kv,action:()=>e.chain().focus().toggleTaskList().run(),isActive:e.isActive("taskList"),label:"Checklist"},{icon:kE,action:()=>e.chain().focus().toggleCodeBlock().run(),isActive:e.isActive("codeBlock"),label:"Code block"},{icon:kC,action:()=>e.chain().focus().setHorizontalRule().run(),isActive:!1,label:"Divider"}],y=[{icon:ko,action:()=>e.chain().focus().setTextAlign("left").run(),isActive:e.isActive({textAlign:"left"}),label:"Align left"},{icon:ki,action:()=>e.chain().focus().setTextAlign("center").run(),isActive:e.isActive({textAlign:"center"}),label:"Align center"},{icon:ka,action:()=>e.chain().focus().setTextAlign("right").run(),isActive:e.isActive({textAlign:"right"}),label:"Align right"},{icon:ks,action:()=>e.chain().focus().setTextAlign("justify").run(),isActive:e.isActive({textAlign:"justify"}),label:"Justify"},{separator:!0},{icon:km,action:()=>e.chain().focus().toggleSuperscript().run(),isActive:e.isActive("superscript"),label:"Superscript"},{icon:kf,action:()=>e.chain().focus().toggleSubscript().run(),isActive:e.isActive("subscript"),label:"Subscript"},{separator:!0},{icon:eb,action:e=>g(e,e=>({type:"media",kind:"image",anchor:e})),isActive:!1,label:"Insert image"},{icon:kR,action:e=>g(e,e=>({type:"media",kind:"video",anchor:e})),isActive:!1,label:"Insert video"},{separator:!0},{icon:kD,action:()=>e.chain().focus().undo().run(),isActive:!1,label:"Undo"},{icon:kI,action:()=>e.chain().focus().redo().run(),isActive:!1,label:"Redo"},{separator:!0},{icon:i?k_:kM,action:()=>n({dir:i?void 0:"rtl"}),isActive:i,label:i?"Switch to LTR":"Switch to RTL"}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"relative border-b border-border bg-background/50",children:[l&&(0,X.jsx)("button",{type:"button","aria-label":"Scroll toolbar left",onMouseDown:e=>e.preventDefault(),onClick:()=>f(-1),className:"absolute left-0 top-0 bottom-0 w-6 z-10 flex items-center justify-start pl-0.5 bg-gradient-to-r from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,X.jsx)(kw,{className:"h-4 w-4"})}),d&&(0,X.jsx)("button",{type:"button","aria-label":"Scroll toolbar right",onMouseDown:e=>e.preventDefault(),onClick:()=>f(1),className:"absolute right-0 top-0 bottom-0 w-6 z-10 flex items-center justify-end pr-0.5 bg-gradient-to-l from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,X.jsx)(ea,{className:"h-4 w-4"})}),(0,X.jsx)("div",{ref:a,onWheel:e=>{let t=a.current;t&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(t.scrollLeft+=e.deltaY)},className:"flex items-center gap-0.5 px-2 pt-1 pb-1.5 overflow-x-scroll overflow-y-hidden editor-toolbar-scroll",children:[...b,{separator:!0},...y].map((e,t)=>"separator"in e?(0,X.jsx)(kF,{orientation:"vertical",className:"mx-1 h-6 shrink-0"},t):(0,X.jsx)(k$,{label:e.label,icon:e.icon,active:e.isActive,style:e.style,onAction:e.action},t))})]}),s?.type==="link"&&(0,X.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:s.anchor.top,left:s.anchor.left,zIndex:60},children:(0,X.jsx)(ky,{anchor:{top:0,left:0},initialUrl:s.existing,onCancel:()=>o(null),onApply:t=>{s?.type==="link"&&(m(s.range,()=>{e.chain().focus().extendMarkRange("link").setLink({href:t}).run()}),o(null))},onRemove:s.existing?()=>{s?.type==="link"&&(m(s.range,()=>{e.chain().focus().unsetLink().run()}),o(null))}:void 0})}),s?.type==="media"&&r&&(0,X.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:s.anchor.top,left:s.anchor.left,zIndex:60},children:(0,X.jsx)(kz,{kind:s.kind,pagePath:r,anchor:{top:0,left:0},onCancel:()=>o(null),onInsert:t=>((t,n)=>{let{url:r,alt:i,mimeType:s}=n;"image"===t||(s??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),o(null)})(s.kind,t)})}),s&&(0,X.jsx)(kq,{onClose:()=>o(null)})]})}function kq({onClose:e}){return(0,Q.useEffect)(()=>{let t=window.setTimeout(()=>{let t=t=>{let n=t.target;n?.closest('[data-editor-popover="true"]')||e()};window.addEventListener("mousedown",t),window.__editorPopClose=()=>window.removeEventListener("mousedown",t)},10);return()=>{window.clearTimeout(t);let e=window;e.__editorPopClose&&(e.__editorPopClose(),e.__editorPopClose=void 0)}},[e]),null}var kV=/^```([a-z]+)?[\s\n]$/,kW=/^~~~([a-z]+)?[\s\n]$/,kK=pp.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",d1(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
103
-
104
- \`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;let a=" ".repeat(n);return o?e.commands.insertContent(a):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,s=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(s)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type===this.type&&(o?e.commands.command(({tr:e})=>{var t;let{pos:i}=s,o=s.start(),a=s.end(),l=r.doc.textBetween(o,a,"\n","\n").split("\n"),c=0,d=0,u=i-o;for(let e=0;e<l.length;e+=1){if(d+l[e].length>=u){c=e;break}d+=l[e].length+1}let p=Math.min(((null==(t=l[c].match(/^ */))?void 0:t[0])||"").length,n);if(0===p)return!0;let h=o;for(let e=0;e<c;e+=1)h+=l[e].length+1;return e.delete(h,h+p),i-h<=p&&e.setSelection(sv.create(e.doc,h)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:s}=i,o=r.doc.textBetween(t,s,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,s,r.schema.text(o)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith("\n\n");return!!s&&!!o&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return void 0!==o&&(r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(sg.near(r.resolve(o))),!0)):e.commands.exitCode())}}},addInputRules(){return[pe({find:kV,type:this.type,getAttributes:e=>({language:e[1]})}),pe({find:kW,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new sR({key:new sP("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=null==i?void 0:i.mode;if(!n||!s)return!1;let{tr:o,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(sv.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}});let kY=e.i(112479).default;function kX(e){return e.value||e.children||[]}function kQ({doc:e,name:t,lowlight:n,defaultLanguage:r}){let i=[];return dG(e,e=>e.type.name===t).forEach(e=>{var t;let s=e.pos+1,o=e.node.attrs.language||r,a=n.listLanguages();(function e(t,n=[]){return t.flatMap(t=>{let r=[...n,...t.properties?t.properties.className:[]];return t.children?e(t.children,r):{text:t.value,classes:r}})})(o&&(a.includes(o)||kY.getLanguage(o)||(null==(t=n.registered)?void 0:t.call(n,o)))?kX(n.highlight(o,e.node.textContent)):kX(n.highlightAuto(e.node.textContent))).forEach(e=>{let t=s+e.text.length;if(e.classes.length){let n=aF.inline(s,t,{class:e.classes.join(" ")});i.push(n)}s=t})}),az.create(e,i)}var kJ=kK.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],function({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new sR({key:new sP("lowlight"),state:{init:(r,{doc:i})=>kQ({doc:i,name:e,lowlight:t,defaultLanguage:n}),apply:(r,i,s,o)=>{let a=s.selection.$head.parent.type.name,l=o.selection.$head.parent.type.name,c=dG(s.doc,t=>t.type.name===e),d=dG(o.doc,t=>t.type.name===e);return r.docChanged&&([a,l].includes(e)||d.length!==c.length||r.steps.some(e=>void 0!==e.from&&void 0!==e.to&&c.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?kQ({doc:r.doc,name:e,lowlight:t,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations:e=>r.getState(e)}});return r}({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});let kZ="numeric",k0="ascii",k1="alpha",k2="asciinumeric",k3="alphanumeric",k5="domain",k4="emoji",k6="whitespace";function k9(e,t,n){for(let r in t[kZ]&&(t[k2]=!0,t[k3]=!0),t[k0]&&(t[k2]=!0,t[k1]=!0),t[k2]&&(t[k3]=!0),t[k1]&&(t[k3]=!0),t[k3]&&(t[k5]=!0),t[k4]&&(t[k5]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function k7(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}k7.groups={},k7.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||k7.groups,t&&t.j?i=t:(i=new k7(t),n&&r&&k9(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,s=e.length;if(!s)return i;for(let t=0;t<s-1;t++)i=i.tt(e[t]);return i.tt(e[s-1],t,n,r)},tt(e,t,n,r){if(r=r||k7.groups,t&&t.j)return this.j[e]=t,t;let i,s=this.go(e);return s?(Object.assign((i=new k7).j,s.j),i.jr.push.apply(i.jr,s.jr),i.jd=s.jd,i.t=s.t):i=new k7,t&&(r&&(i.t&&"string"==typeof i.t?k9(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&k9(t,n,r)),i.t=t),this.j[e]=i,i}};let k8=(e,t,n,r,i)=>e.ta(t,n,r,i),Te=(e,t,n,r,i)=>e.tr(t,n,r,i),Tt=(e,t,n,r,i)=>e.ts(t,n,r,i),Tn=(e,t,n,r,i)=>e.tt(t,n,r,i),Tr="WORD",Ti="UWORD",Ts="ASCIINUMERICAL",To="ALPHANUMERICAL",Ta="LOCALHOST",Tl="UTLD",Tc="SCHEME",Td="SLASH_SCHEME",Tu="OPENBRACE",Tp="CLOSEBRACE",Th="OPENBRACKET",Tf="CLOSEBRACKET",Tm="OPENPAREN",Tg="CLOSEPAREN",Tb="OPENANGLEBRACKET",Ty="CLOSEANGLEBRACKET",Tx="FULLWIDTHLEFTPAREN",Tv="FULLWIDTHRIGHTPAREN",Tw="LEFTCORNERBRACKET",TE="RIGHTCORNERBRACKET",Tk="LEFTWHITECORNERBRACKET",TT="RIGHTWHITECORNERBRACKET",TN="FULLWIDTHLESSTHAN",TA="FULLWIDTHGREATERTHAN",TS="AMPERSAND",TC="APOSTROPHE",T_="ASTERISK",TM="BACKSLASH",TO="BACKTICK",TI="CARET",TD="COLON",TR="COMMA",TL="DOLLAR",Tj="EQUALS",TP="EXCLAMATION",TB="HYPHEN",TF="PERCENT",TH="PIPE",TU="PLUS",Tz="POUND",T$="QUERY",TG="QUOTE",Tq="FULLWIDTHMIDDLEDOT",TV="SEMI",TW="SLASH",TK="TILDE",TY="UNDERSCORE",TX="EMOJI";var TQ=Object.freeze({__proto__:null,ALPHANUMERICAL:To,AMPERSAND:TS,APOSTROPHE:TC,ASCIINUMERICAL:Ts,ASTERISK:T_,AT:"AT",BACKSLASH:TM,BACKTICK:TO,CARET:TI,CLOSEANGLEBRACKET:Ty,CLOSEBRACE:Tp,CLOSEBRACKET:Tf,CLOSEPAREN:Tg,COLON:TD,COMMA:TR,DOLLAR:TL,DOT:"DOT",EMOJI:TX,EQUALS:Tj,EXCLAMATION:TP,FULLWIDTHGREATERTHAN:TA,FULLWIDTHLEFTPAREN:Tx,FULLWIDTHLESSTHAN:TN,FULLWIDTHMIDDLEDOT:Tq,FULLWIDTHRIGHTPAREN:Tv,HYPHEN:TB,LEFTCORNERBRACKET:Tw,LEFTWHITECORNERBRACKET:Tk,LOCALHOST:Ta,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:Tb,OPENBRACE:Tu,OPENBRACKET:Th,OPENPAREN:Tm,PERCENT:TF,PIPE:TH,PLUS:TU,POUND:Tz,QUERY:T$,QUOTE:TG,RIGHTCORNERBRACKET:TE,RIGHTWHITECORNERBRACKET:TT,SCHEME:Tc,SEMI:TV,SLASH:TW,SLASH_SCHEME:Td,SYM:"SYM",TILDE:TK,TLD:"TLD",UNDERSCORE:TY,UTLD:Tl,UWORD:Ti,WORD:Tr,WS:"WS"});let TJ=/[a-z]/,TZ=/\p{L}/u,T0=/\p{Emoji}/u,T1=/\d/,T2=/\s/,T3=null,T5=null;function T4(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,s=e.charCodeAt(r),o=s<55296||s>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],s=0,o=0;for(;o<r;){let a=e,l=null,c=0,d=null,u=-1,p=-1;for(;o<r&&(l=a.go(n[o]));)(a=l).accepts()?(u=0,p=0,d=a):u>=0&&(u+=n[o].length,p++),c+=n[o].length,s+=n[o].length,o++;s-=u,o-=p,c-=u,i.push({t:d.t,v:t.slice(s-c,s),s:s-c,e:s})}return i}function T6(e,t,n,r,i){let s,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?s=e.j[o]:((s=new k7(r)).jr=i.slice(),e.j[o]=s),e=s}return(s=new k7(n)).jr=i.slice(),e.j[t[o-1]]=s,s}function T9(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let T7={defaultProtocol:"http",events:null,format:Ne,formatHref:Ne,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function T8(e,t=null){let n=Object.assign({},T7);e&&(n=Object.assign(n,e instanceof T8?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function Ne(e){return e}function Nt(e,t){this.t="token",this.v=e,this.tk=t}function Nn(e,t){class n extends Nt{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}T8.prototype={o:T7,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:T7[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},Nt.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=T7.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),s={},o=e.get("className",t,this),a=e.get("target",t,this),l=e.get("rel",t,this),c=e.getObj("attributes",t,this),d=e.getObj("events",t,this);return s.href=n,o&&(s.class=o),a&&(s.target=a),l&&(s.rel=l),c&&Object.assign(s,c),{tagName:r,attributes:s,content:i,eventListeners:d}}};let Nr=Nn("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ni=Nn("text"),Ns=Nn("nl"),No=Nn("url",{isLink:!0,toHref(e=T7.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Ta&&e[1].t===TD}}),Na=e=>new k7(e);function Nl(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let Nc="u">typeof console&&console&&console.warn||(()=>{}),Nd={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Nu(e,t=!1){if(Nd.initialized&&Nc(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
105
- 1. Must only contain digits, lowercase ASCII letters or "-"
106
- 2. Cannot start or end with "-"
107
- 3. "-" cannot repeat`);Nd.customSchemes.push([e,t])}function Np(e){return Nd.initialized||function(){Nd.scanner=function(e=[]){let t={};k7.groups=t;let n=new k7;null==T3&&(T3=T9("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==T5&&(T5=T9("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Tn(n,"'",TC),Tn(n,"{",Tu),Tn(n,"}",Tp),Tn(n,"[",Th),Tn(n,"]",Tf),Tn(n,"(",Tm),Tn(n,")",Tg),Tn(n,"<",Tb),Tn(n,">",Ty),Tn(n,"(",Tx),Tn(n,")",Tv),Tn(n,"「",Tw),Tn(n,"」",TE),Tn(n,"『",Tk),Tn(n,"』",TT),Tn(n,"<",TN),Tn(n,">",TA),Tn(n,"&",TS),Tn(n,"*",T_),Tn(n,"@","AT"),Tn(n,"`",TO),Tn(n,"^",TI),Tn(n,":",TD),Tn(n,",",TR),Tn(n,"$",TL),Tn(n,".","DOT"),Tn(n,"=",Tj),Tn(n,"!",TP),Tn(n,"-",TB),Tn(n,"%",TF),Tn(n,"|",TH),Tn(n,"+",TU),Tn(n,"#",Tz),Tn(n,"?",T$),Tn(n,'"',TG),Tn(n,"/",TW),Tn(n,";",TV),Tn(n,"~",TK),Tn(n,"_",TY),Tn(n,"\\",TM),Tn(n,"・",Tq);let r=Te(n,T1,"NUM",{[kZ]:!0});Te(r,T1,r);let i=Te(r,TJ,Ts,{[k2]:!0}),s=Te(r,TZ,To,{[k3]:!0}),o=Te(n,TJ,Tr,{[k0]:!0});Te(o,T1,i),Te(o,TJ,o),Te(i,T1,i),Te(i,TJ,i);let a=Te(n,TZ,Ti,{[k1]:!0});Te(a,TJ),Te(a,T1,s),Te(a,TZ,a),Te(s,T1,s),Te(s,TJ),Te(s,TZ,s);let l=Tn(n,"\n","NL",{[k6]:!0}),c=Tn(n,"\r","WS",{[k6]:!0}),d=Te(n,T2,"WS",{[k6]:!0});Tn(n,"",d),Tn(c,"\n",l),Tn(c,"",d),Te(c,T2,d),Tn(d,"\r"),Tn(d,"\n"),Te(d,T2,d),Tn(d,"",d);let u=Te(n,T0,TX,{[k4]:!0});Tn(u,"#"),Te(u,T0,u),Tn(u,"️",u);let p=Tn(u,"‍");Tn(p,"#"),Te(p,T0,u);let h=[[TJ,o],[T1,i]],f=[[TJ,null],[TZ,a],[T1,s]];for(let e=0;e<T3.length;e++)T6(n,T3[e],"TLD",Tr,h);for(let e=0;e<T5.length;e++)T6(n,T5[e],Tl,Ti,f);k9("TLD",{tld:!0,ascii:!0},t),k9(Tl,{utld:!0,alpha:!0},t),T6(n,"file",Tc,Tr,h),T6(n,"mailto",Tc,Tr,h),T6(n,"http",Td,Tr,h),T6(n,"https",Td,Tr,h),T6(n,"ftp",Td,Tr,h),T6(n,"ftps",Td,Tr,h),k9(Tc,{scheme:!0,ascii:!0},t),k9(Td,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[k5]=!0:TJ.test(r)?T1.test(r)?i[k2]=!0:i[k0]=!0:i[kZ]=!0,Tt(n,r,r,i)}return Tt(n,"localhost",Ta,{ascii:!0}),n.jd=new k7("SYM"),{start:n,tokens:Object.assign({groups:t},TQ)}}(Nd.customSchemes);for(let e=0;e<Nd.tokenQueue.length;e++)Nd.tokenQueue[e][1]({scanner:Nd.scanner});Nd.parser=function({groups:e}){let t=e.domain.concat([TS,T_,"AT",TM,TO,TI,TL,Tj,TB,"NUM",TF,TH,TU,Tz,TW,"SYM",TK,TY]),n=[TC,TD,TR,"DOT",TP,TF,T$,TG,TV,Tb,Ty,Tu,Tp,Tf,Th,Tm,Tg,Tx,Tv,Tw,TE,Tk,TT,TN,TA],r=[TS,TC,T_,TM,TO,TI,TL,Tj,TB,Tu,Tp,TF,TH,TU,Tz,T$,TW,"SYM",TK,TY],i=Na(),s=Tn(i,TK);k8(s,r,s),k8(s,e.domain,s);let o=Na(),a=Na(),l=Na();k8(i,e.domain,o),k8(i,e.scheme,a),k8(i,e.slashscheme,l),k8(o,r,s),k8(o,e.domain,o);let c=Tn(o,"AT");Tn(s,"AT",c),Tn(a,"AT",c),Tn(l,"AT",c);let d=Tn(s,"DOT");k8(d,r,s),k8(d,e.domain,s);let u=Na();k8(c,e.domain,u),k8(u,e.domain,u);let p=Tn(u,"DOT");k8(p,e.domain,u);let h=Na(Nr);k8(p,e.tld,h),k8(p,e.utld,h),Tn(c,Ta,h);let f=Tn(u,TB);Tn(f,TB,f),k8(f,e.domain,u),k8(h,e.domain,u),Tn(h,"DOT",p),Tn(h,TB,f);let m=Tn(o,TB),g=Tn(o,"DOT");Tn(m,TB,m),k8(m,e.domain,o),k8(g,r,s),k8(g,e.domain,o);let b=Na(No);k8(g,e.tld,b),k8(g,e.utld,b),k8(b,e.domain,o),k8(b,r,s),Tn(b,"DOT",g),Tn(b,TB,m),Tn(b,"AT",c);let y=Tn(b,TD),x=Na(No);k8(y,e.numeric,x);let v=Na(No),w=Na();k8(v,t,v),k8(v,n,w),k8(w,t,v),k8(w,n,w),Tn(b,TW,v),Tn(x,TW,v);let E=Tn(a,TD),k=Tn(l,TD),T=Tn(k,TW),N=Tn(T,TW);k8(a,e.domain,o),Tn(a,"DOT",g),Tn(a,TB,m),k8(l,e.domain,o),Tn(l,"DOT",g),Tn(l,TB,m),k8(E,e.domain,v),Tn(E,TW,v),Tn(E,T$,v),k8(N,e.domain,v),k8(N,t,v),Tn(N,TW,v);let A=[[Tu,Tp],[Th,Tf],[Tm,Tg],[Tb,Ty],[Tx,Tv],[Tw,TE],[Tk,TT],[TN,TA]];for(let e=0;e<A.length;e++){let[r,i]=A[e],s=Tn(v,r);Tn(w,r,s);let o=Na(No);k8(s,t,o);let a=Na();k8(s,n,a),Tn(s,i,v),k8(o,t,o),k8(o,n,a),k8(a,t,o),k8(a,n,a),Tn(o,i,v),Tn(a,i,v)}return Tn(i,Ta,b),Tn(i,"NL",Ns),{start:i,tokens:TQ}}(Nd.scanner.tokens);for(let e=0;e<Nd.pluginQueue.length;e++)Nd.pluginQueue[e][1]({scanner:Nd.scanner,parser:Nd.parser});Nd.initialized=!0}(),function(e,t,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=e,l=null,c=null,d=0,u=null,p=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,(a=c).accepts()?(p=0,u=a):p>=0&&p++,i++,d++;if(p<0)(i-=d)<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Nl(Ni,t,o)),o=[]),i-=p,d-=p;let e=u.t,r=n.slice(i-d,i);s.push(Nl(e,t,r))}}return o.length>0&&s.push(Nl(Ni,t,o)),s}(Nd.parser.start,e,T4(Nd.scanner.start,e))}function Nh(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new T8(n),i=Np(e),s=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&s.push(n.toFormattedObject(r))}return s}Np.scan=T4;var Nf="[\0-   ᠎ -\u2029  ]",Nm=new RegExp(Nf),Ng=RegExp(`${Nf}$`),Nb=RegExp(Nf,"g");function Ny(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(Nb,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Nx=u$.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?Nu(e):Nu(e.scheme,e.optionalSlashes)})},onDestroy(){k7.groups={},Nd.scanner=null,Nd.parser=null,Nd.tokenQueue=[],Nd.pluginQueue=[],Nd.customSchemes=[],Nd.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Ny(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!Ny(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Ny(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",d1(this.options.HTMLAttributes,e),0]:["a",d1(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,s;let o=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(s=null==(i=e.attrs)?void 0:i.title)?s:"",l=t.renderChildren(e);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Ny(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Ny(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pf({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=Nh(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Ny(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:s}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Ny(e,i),protocols:i,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink},new sR({key:new sP("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),s=t.some(e=>e.getMeta("preventAutolink"));if(!i||s)return;let{tr:o}=r;if(un(d$(n.doc,[...t])).forEach(({newRange:t})=>{var n,i;let s,a,l,c=(n=r.doc,i=e=>e.isTextblock,l=[],n.nodesBetween(t.from,t.to,(e,t)=>{i(e)&&l.push({node:e,pos:t})}),l);if(c.length>1)s=c[0],a=r.doc.textBetween(s.pos,s.pos+s.node.nodeSize,void 0," ");else if(c.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!Ng.test(e))return;s=c[0],a=r.doc.textBetween(s.pos,t.to,void 0," ")}if(s&&a){let t=a.split(Nm).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],i=s.pos+a.lastIndexOf(n);if(!n)return!1;let l=Np(n).map(t=>t.toObject(e.defaultProtocol));if(!(1===l.length?l[0].isLink:3===l.length&&!!l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:i+e.start+1,to:i+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{ur(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new sR({key:new sP("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(0!==r.button||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(o=e.closest("a"))&&!n.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let n=ut(e.state,t.type.name),r=null!=(i=o.href)?i:n.href,l=null!=(s=o.target)?s:n.target;r&&(window.open(r,l),a=!0)}return a}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new sR({key:new sP("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});let c=Nh(l,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!!l&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}});class Nv{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,s=this.editorView.dom,o=s.getBoundingClientRect(),a=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),s=e?r.bottom:r.top;e&&t&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let o=this.width/2*l;i={left:r.left,right:r.right,top:s-o,bottom:s+o}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/a+"px",this.element.style.top=(i.top-t)/l+"px",this.element.style.width=(i.right-i.left)/a+"px",this.element.style.height=(i.bottom-i.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=sn(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Nw extends sg{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Nw.valid(n)?new Nw(n):sg.near(n)}content(){return r6.empty}eq(e){return e instanceof Nw&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new Nw(e.resolve(t.pos))}getBookmark(){return new NE(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||Nk(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||Nk(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&Nw.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let s=e.node(n);if(t>0?e.indexAfter(n)<s.childCount:e.index(n)>0){i=s.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let o=e.doc.resolve(r);if(Nw.valid(o))return o}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!sE.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=s,r+=t;let o=e.doc.resolve(r);if(Nw.valid(o))return o}return null}}}Nw.prototype.visible=!1,Nw.findFrom=Nw.findGapCursorFrom,sg.jsonID("gapcursor",Nw);class NE{constructor(e){this.pos=e}map(e){return new NE(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Nw.valid(t)?new Nw(t):sg.near(t)}}function Nk(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let NT=lg({ArrowLeft:NN("horiz",-1),ArrowRight:NN("horiz",1),ArrowUp:NN("vert",-1),ArrowDown:NN("vert",1)});function NN(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let s=e.selection,o=t>0?s.$to:s.$from,a=s.empty;if(s instanceof sv){if(!i.endOfTextblock(n)||0==o.depth)return!1;a=!1,o=e.doc.resolve(t>0?o.after():o.before())}let l=Nw.findGapCursorFrom(o,t,a);return!!l&&(r&&r(e.tr.setSelection(new Nw(l))),!0)}}function NA(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Nw.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&sE.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new Nw(r))),!0)}function NS(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Nw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=r0.empty;for(let e=r.length-1;e>=0;e--)i=r0.from(r[e].createAndFill(null,i));let s=e.state.tr.replace(n.pos,n.pos,new r6(i,0,0));return s.setSelection(sv.near(s.doc.resolve(n.pos+1))),e.dispatch(s),!1}function NC(e){if(!(e.selection instanceof Nw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",az.create(e.doc,[aF.widget(e.selection.head,t,{key:"gapcursor"})])}var N_=function(){};N_.prototype.append=function(e){return e.length?(e=N_.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},N_.prototype.prepend=function(e){return e.length?N_.from(e).append(this):this},N_.prototype.appendInner=function(e){return new NO(this,e)},N_.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?N_.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},N_.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},N_.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},N_.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},N_.from=function(e){return e instanceof N_?e:e&&e.length?new NM(e):N_.empty};var NM=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(N_);N_.empty=new NM([]);var NO=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(N_);class NI{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,s;if(0==this.eventCount)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(r=(n=this.remapping(o,this.items.length)).maps.length);let a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(o,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new ND(e.map));let t=e.step.map(n.slice(r)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],l.push(new ND(i,void 0,void 0,l.length+c.length))),r--,i&&n.appendMap(i,r)}else a.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,s=new NI(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){var i,s;let o,a=[],l=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),s=new ND(e.mapping.maps[n],i,t),o;(o=d&&d.merge(s))&&(s=o,n?a.pop():c=c.slice(0,c.length-1)),a.push(s),t&&(l++,t=void 0),r||(d=s)}let u=l-n.depth;return u>NL&&(i=c,s=u,i.forEach((e,t)=>{if(e.selection&&0==s--)return o=t,!1}),c=i.slice(o),l-=u),new NI(c.append(a),l)}remapping(e,t){let n=new iG;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new NI(this.items.append(e.map(e=>new ND(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(e=>{e.selection&&o--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;s=Math.min(s,r);let l=i.maps[r];if(t.step){let s=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&o++,n.push(new ND(l,s,c))}else n.push(new ND(l))},r);let l=[];for(let e=t;e<s;e++)l.push(new ND(i.maps[e]));let c=new NI(this.items.slice(0,r).append(l).append(n),o);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)r.push(s),s.selection&&i++;else if(s.step){let e=s.step.map(t.slice(n)),o=e&&e.getMap();if(n--,o&&t.appendMap(o,n),e){let a=s.selection&&s.selection.map(t.slice(n));a&&i++;let l=new ND(o.invert(),e,a),c,d=r.length-1;(c=r.length&&r[d].merge(l))?r[d]=c:r.push(l)}}else s.map&&n--},this.items.length,0),new NI(N_.from(r.reverse()),i)}}NI.empty=new NI(N_.empty,0);class ND{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ND(t.getMap().invert(),t,this.selection)}}}class NR{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let NL=20;function Nj(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function NP(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}let NB=!1,NF=null;function NH(e){let t=e.plugins;if(NF!=t){NB=!1,NF=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){NB=!0;break}}return NB}let NU=new sP("history"),Nz=new sP("closeHistory");function N$(e,t){return(n,r)=>{let i=NU.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let s=function(e,t,n){let r=NH(t),i=NU.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),l=new NR(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(NU,{redo:n,historyState:l})}(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}let NG=N$(!1,!0),Nq=N$(!0,!0);N$(!1,!1),N$(!0,!1),uW.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new sR({key:new sP("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,s=this.options.autoTrim;if(null==i||0===i||!1===s){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let s=e.selection.$head.pos;return e.deleteRange(s-(i-n),s),!(this.storage.characters({node:e.doc})>n)}})]}});var NV=uW.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new sR({view:t=>new Nv(t,e)})}(this.options)]}});uW.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new sR({key:new sP("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,s=[];if(!n||!r)return az.create(e,[]);let o=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let a=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((a+=1,"deepest"===this.options.mode&&o-a>0||"shallowest"===this.options.mode&&a>1)?"deepest"===this.options.mode:void s.push(aF.node(t,t+e.nodeSize,{class:this.options.className})))),az.create(e,s)}}})]}});var NW=uW.create({name:"gapCursor",addProseMirrorPlugins:()=>[new sR({props:{decorations:NC,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Nw.valid(n)?new Nw(n):null,handleClick:NA,handleKeyDown:NT,handleDOMEvents:{beforeinput:NS}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=dQ(dW(e,"allowGapCursor",n)))?t:null}}}),NK="placeholder",NY=new sP("tiptap__placeholder");function NX(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=e,d=[l];return o&&d.push(c),aF.node(i,i+s.nodeSize,{class:d.join(" "),[r]:"function"==typeof n?n({editor:t,node:s,pos:i,hasAnchor:a}):n})}var NQ={init:()=>({topPos:null,bottomPos:null}),apply(e,t){let n=e.getMeta(NY);return(null==n?void 0:n.positions)?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:null!==t.topPos?e.mapping.map(t.topPos):null,bottomPos:null!==t.bottomPos?e.mapping.map(t.bottomPos):null}:t}};function NJ(e){let t=function(e){let t=e;for(;t;){if(function(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}break}t=e}return window}(e.dom),n=()=>{let n=function({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect():{top:0,bottom:window.innerHeight},s=Math.max(r.top,i.top)-200,o=Math.min(r.bottom,i.bottom)+200;if(s>=o)return{top:0,bottom:e.content.size};let a="rtl"===getComputedStyle(t.dom).direction?Math.max(r.right-2,r.left+2):r.left+2,l=t.posAtCoords({left:a,top:s+2}),c=t.posAtCoords({left:a,top:o-2});return{top:l?l.pos:0,bottom:c?c.pos:e.content.size}}({view:e,doc:e.state.doc,scrollContainer:t}),r=NY.getState(e.state);if((null==r?void 0:r.topPos)===n.top&&(null==r?void 0:r.bottomPos)===n.bottom)return;let i=e.state.tr.setMeta(NY,{positions:n});e.dispatch(i)},r=null,i=0,s=()=>{null===r&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):s()}))};return t.addEventListener("scroll",s,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&s()},destroy:()=>{null!==r&&cancelAnimationFrame(r),t.removeEventListener("scroll",s)}}}var NZ=uW.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:NK,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${NK}`;return new sR({key:NY,state:NQ,view:NJ,props:{decorations:({doc:r,selection:i})=>(function({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){var s,o;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,l=[],c=e.isEmpty,d={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),s=i.depth>0?i.node(1):i.nodeAfter,o=i.depth>0?i.before(1):a;if(s&&s.type.isTextblock&&uc(s)){let r=a>=o&&a<=o+s.nodeSize;l.push(NX({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:d,node:s,pos:o}))}}else{let i=NY.getState(e.state),u=null!=(s=null==i?void 0:i.topPos)?s:0,p=null!=(o=null==i?void 0:i.bottomPos)?o:r.content.size;r.nodesBetween(u,p,(r,i)=>{let s=a>=i&&a<=i+r.nodeSize,o=!r.isLeaf&&uc(r);return r.type.isTextblock&&(s||!t.showOnlyCurrent)&&o&&l.push(NX({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:s,placeholder:t.placeholder,classes:d,node:r,pos:i})),t.includeChildren})}return az.create(r,l)})({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}({editor:this.editor,options:this.options})]}});function N0({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}uW.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new sR({key:new sP("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||ud(n.selection)||e.view.dragging?null:az.create(n.doc,[aF.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var N1=uW.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new sP(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new sR({key:t,appendTransaction:(e,r,i)=>{let{doc:s,tr:o,schema:a}=i,l=t.getState(i),c=s.content.size,d=a.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return o.insert(c,d.create())},state:{init:(e,t)=>!N0({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!N0({node:e.doc.lastChild,types:r})}})]}}),N2=uW.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>NG(e,t),redo:()=>({state:e,dispatch:t})=>Nq(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new sR({key:NU,state:{init:()=>new NR(NI.empty,NI.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(NU),s;if(i)return i.historyState;n.getMeta(Nz)&&(e=new NR(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(o&&o.getMeta(NU))if(o.getMeta(NU).redo)return new NR(e.done.addTransform(n,void 0,r,NH(t)),e.undone,Nj(n.mapping.maps),e.prevTime,e.prevComposition);else return new NR(e.done,e.undone.addTransform(n,void 0,r,NH(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))if(s=n.getMeta("rebased"))return new NR(e.done.rebased(n,s),e.undone.rebased(n,s),NP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new NR(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),NP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),s=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=o?NP(e.prevRanges,n.mapping):Nj(n.mapping.maps);return new NR(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,NH(t)),NI.empty,a,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?NG:"historyRedo"==n?Nq:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),N3=u$.create({name:"subscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sub"},{style:"vertical-align",getAttrs:e=>"sub"===e&&null}],renderHTML({HTMLAttributes:e}){return["sub",d1(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),N5=u$.create({name:"superscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:e=>"super"===e&&null}],renderHTML({HTMLAttributes:e}){return["sup",d1(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function N4(e){return"left"===e||"right"===e||"center"===e?e:null}function N6(){return{default:null,parseHTML:e=>{let t,n;return t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase(),N4(t||n)},renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var N9=pp.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;let r=e.getAttribute("colwidth"),i=r?r.split(",").map(e=>parseInt(e,10)):null;if(!i){let r=null==(t=e.closest("table"))?void 0:t.querySelectorAll("colgroup > col"),i=Array.from((null==(n=e.parentElement)?void 0:n.children)||[]).indexOf(e);if(i&&i>-1&&r&&r[i]){let e=r[i].getAttribute("width");return e?[parseInt(e,10)]:null}}return i}},align:N6()}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:e}){return["td",d1(this.options.HTMLAttributes,e),0]}}),N7=pp.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}},align:N6()}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th"}],renderHTML({HTMLAttributes:e}){return["th",d1(this.options.HTMLAttributes,e),0]}}),N8=pp.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",d1(this.options.HTMLAttributes,e),0]}});function Ae(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function At(e,t,n,r,i,s){var o;let a=0,l=!0,c=t.firstChild,d=e.firstChild;if(null!==d)for(let e=0,n=0;e<d.childCount;e+=1){let{colspan:o,colwidth:u}=d.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?s:u&&u[e],d=o?`${o}px`:"";if(a+=o||r,o||(l=!1),c){if(c.style.width!==d){let[e,t]=Ae(r,o);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement("col"),[n,i]=Ae(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){let e=c.nextSibling;null==(o=c.parentNode)||o.removeChild(c),c=e}let u=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var An=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),At(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,At(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!n&&!r&&("attributes"===e.type||"childList"===e.type||"characterData"===e.type)}};function Ar(e,t){return t?e.createChecked(null,t):e.createAndFill()}var Ai=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof lC))return!1;let n=0,r=dq(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)},As=function(e,t,n={}){var r;let i=null!=(r=n.cellLineSeparator)?r:"\x1f";if(!e||!e.content||0===e.content.length)return"";let s=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{var r;let s=((e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(i):e.content?t.renderChildren(e.content):"")||"").replace(/\s+/g," ").trim(),o="tableHeader"===e.type,a=N4(null==(r=e.attrs)?void 0:r.align);n.push({text:s,isHeader:o,align:a})}),s.push(n)});let o=s.reduce((e,t)=>Math.max(e,t.length),0);if(0===o)return"";let a=Array.from({length:o}).fill(0);s.forEach(e=>{var t;for(let n=0;n<o;n+=1){let r=((null==(t=e[n])?void 0:t.text)||"").length;r>a[n]&&(a[n]=r),a[n]<3&&(a[n]=3)}});let l=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),c=s[0],d=c.some(e=>e.isHeader),u=Array.from({length:o}).fill(null);s.forEach(e=>{var t;for(let n=0;n<o;n+=1)!u[n]&&(null==(t=e[n])?void 0:t.align)&&(u[n]=e[n].align)});let p="\n",h=Array.from({length:o}).map((e,t)=>d&&c[t]&&c[t].text||"");return p+=`| ${h.map((e,t)=>l(e,a[t])).join(" | ")} |
108
- | ${a.map((e,t)=>{let n=Math.max(3,e),r=u[t];return"left"===r?`:${"-".repeat(n)}`:"right"===r?`${"-".repeat(n)}:`:"center"===r?`:${"-".repeat(n)}:`:"-".repeat(n)}).join(" | ")} |
109
- `,(d?s.slice(1):s).forEach(e=>{p+=`| ${Array.from({length:o}).fill(0).map((t,n)=>l(e[n]&&e[n].text||"",a[n])).join(" | ")} |
110
- `}),p},Ao=pp.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:An,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=function(e,t){let n=0,r=!0,i=[],s=e.firstChild;if(!s)return{};for(let e=0,o=0;e<s.childCount;e+=1){let{colspan:a,colwidth:l}=s.child(e).attrs;for(let e=0;e<a;e+=1,o+=1){let s=void 0===o?void 0:l&&l[e];n+=s||t,s||(r=!1);let[a,c]=Ae(t,s);i.push(["col",{style:`${a}: ${c}`}])}}return{colgroup:["colgroup",{},...i],tableWidth:r?`${n}px`:"",tableMinWidth:r?"":`${n}px`}}(e,this.options.cellMinWidth),s=t.style,o=["table",d1(this.options.HTMLAttributes,t,{style:s||(r?`width: ${r}`:`min-width: ${i}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{var s;let o=N4(null!=(s=r[n])?s:e.align);i.push(t.createNode("tableHeader",o?{align:o}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{var s;let o=N4(null!=(s=r[n])?s:e.align);i.push(t.createNode("tableCell",o?{align:o}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>As(e,t),addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{let o=function(e,t,n,r){let i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),s=[],o=[];for(let e=0;e<n;e+=1){let e=Ar(i.cell,void 0);if(e&&o.push(e),r){let e=Ar(i.header_cell,void 0);e&&s.push(e)}}let a=[];for(let e=0;e<t;e+=1)a.push(i.row.createChecked(null,r&&0===e?s:o));return i.table.createChecked(null,a)}(s.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(sv.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(e);t(l$(e.tr,n,n.left))}return!0})(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(e);t(l$(e.tr,n,n.right))}return!0})(e,t),deleteColumn:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(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 s=e.mapping.maps.length;for(let o=0;o<t.height;){let a=o*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(s).map(r+l),null,lA(d,i-t.colCount(l)));else{let t=e.mapping.slice(s).map(r+l);e.delete(t,t+c.nodeSize)}o+=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=lb.get(e)}t(r)}return!0})(e,t),addRowBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(e);t(lG(e.tr,n,n.top))}return!0})(e,t),addRowAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(e);t(lG(e.tr,n,n.bottom))}return!0})(e,t),deleteRow:()=>({state:e,dispatch:t})=>(function(e,t){if(!lw(e))return!1;if(t){let n=lz(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 s=0;for(let e=0;e<i;e++)s+=n.child(e).nodeSize;let o=s+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(s+r,o+r);let l=new Set;for(let s=0,o=i*t.width;s<t.width;s++,o++){let c=t.map[o];if(!l.has(c)){if(l.add(c),i>0&&c==t.map[o-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),s+=t.colspan-1}else if(i<t.height&&c==t.map[o+t.width]){let o=n.nodeAt(c),l=o.attrs,d=o.type.create({...l,rowspan:o.attrs.rowspan-1},o.content),u=t.positionAt(i+1,s,n);e.insert(e.mapping.slice(a).map(r+u),d),s+=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=lb.get(n.table)}t(r)}return!0})(e,t),deleteTable:()=>({state:e,dispatch:t})=>(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})(e,t),mergeCells:()=>({state:e,dispatch:t})=>lV(e,t),splitCell:()=>({state:e,dispatch:t})=>lW(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>lY("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>lY("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>lX(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!lV(e,t)||lW(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>(function(n,r){if(!lw(n))return!1;let i=lE(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let s=n.tr;n.selection instanceof lC?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&s.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(s)}return!0})(n,r),goToNextCell:()=>({state:e,dispatch:t})=>lQ(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>lQ(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&lI(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=lC.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ai,"Mod-Backspace":Ai,Delete:Ai,"Mod-Delete":Ai}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=cr,lastColumnResizable:i=!0}={}){let s=new sR({key:cs,state:{init(e,t){var i;let o=null==(i=s.spec)||null==(i=i.props)?void 0:i.nodeViews,a=ly(t.schema).table.name;return r&&o&&(o[a]=(e,t)=>new r(e,n,t)),new co(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=cs.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=cs.getState(e.state);if(i&&!i.dragging){let s=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),o=-1;if(s){let{left:r,right:i}=s.getBoundingClientRect();t.clientX-r<=n?o=ca(e,t,"left",n):i-t.clientX<=n&&(o=ca(e,t,"right",n))}if(o!=i.activeHandle){if(!r&&-1!==o){let t=e.state.doc.resolve(o),n=t.node(-1),r=lb.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}cc(e,o)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=cs.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&cc(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let s=null!=(i=e.dom.ownerDocument.defaultView)?i:window,o=cs.getState(e.state);if(!o||-1==o.activeHandle||o.dragging)return;let a=e.state.doc.nodeAt(o.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let s=e.domAtPos(t),o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],a--);return o/a}(e,o.activeHandle,a.attrs);function c(t){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",d);let r=cs.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),s=lb.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<s.height;e++){let t=e*s.width+a;if(e&&s.map[t]==s.map[t-s.width])continue;let r=s.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:a-s.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(o+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,cl(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(cs,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=cs.getState(e.state);if(i&&i.dragging){let s=cl(i.dragging,t,n);cd(e,i.activeHandle,s,r)}}e.dispatch(e.state.tr.setMeta(cs,{setDragging:{startX:t.clientX,startWidth:l}})),cd(e,o.activeHandle,l,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=cs.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 az.empty;let s=lb.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<s.height;t++){let r=a+t*s.width;if((a==s.width-1||s.map[r]!=s.map[r+1])&&(0==t||s.map[r]!=s.map[r-s.width])){var l;let t=s.map[r],a=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(l=cs.getState(e))?void 0:l.dragging)&&n.push(aF.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(aF.widget(a,c))}}return az.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return s}({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],function({allowTableNodeSelection:e=!1}={}){return new sR({key:lx,state:{init:()=>null,apply(e,t){let n=e.getMeta(lx);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:lM,handleDOMEvents:{mousedown:l8},createSelectionBetween:e=>null!=lx.getState(e.state)?e.state.selection:null,handleTripleClick:l9,handleKeyDown:l3,handlePaste:l7},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,s=(t||e).selection,o=(t||e).doc;if(s instanceof sE&&(i=s.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=lC.create(o,s.from);else if("row"==i){let e=o.resolve(s.from+1);r=lC.rowSelection(e,e)}else if(!n){let e=lb.get(s.node),t=s.from+1,n=t+e.map[e.width*e.height-1];r=lC.create(o,t+1,n)}}else s instanceof sv&&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)}(s)?r=sv.create(o,s.from):s instanceof sv&&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}(s)&&(r=sv.create(o,s.$from.start(),s.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,lI(r,n),e)})}({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n})=>new t(e,this.options.cellMinWidth,n)},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:dQ(dW(e,"tableRole",t))}}});uW.create({name:"tableKit",addExtensions(){let e=[];return!1!==this.options.table&&e.push(Ao.configure(this.options.table)),!1!==this.options.tableCell&&e.push(N9.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(N7.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(N8.configure(this.options.tableRow)),e}});var Aa=Object.defineProperty,Al="textStyle",Ac=/^\s*([-+*])\s$/,Ad=pp.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Al)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=pt({find:Ac,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=pt({find:Ac,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Al),editor:this.editor})),[e]}}),Au=pp.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n,r,i,s;if("list_item"!==e.type)return[];let o=null!=(n=t.parseBlockChildren)?n:t.parseChildren,a=[];if(e.tokens&&e.tokens.length>0){let n;if(n=null==(r=e.tokens)?void 0:r[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==n?void 0:n.type)==="list"&&n.ordered&&n.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(s=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(s)):t.parseInline([{type:"text",raw:s,text:s}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))a=o(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(a=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=o(e.tokens.slice(1));a.push(...t)}}else a=o(e.tokens)}}return 0===a.length&&(a=[{type:"paragraph",content:[]}]),{type:"listItem",content:a}},renderMarkdown:(e,t,n)=>pu(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ap={},Ah={findListItemPos:()=>Am,getNextListDepth:()=>Ag,handleBackspace:()=>Av,handleDelete:()=>Ak,hasListBefore:()=>Ab,hasListItemAfter:()=>AT,hasListItemBefore:()=>Ay,listItemHasSubList:()=>Ax,nextListIsDeeper:()=>Aw,nextListIsHigher:()=>AE};for(var Af in Ah)Aa(Ap,Af,{get:Ah[Af],enumerable:!0});var Am=(e,t)=>{let{$from:n}=t.selection,r=cQ(e,t.schema),i=n.depth,s=n.pos,o=null;for(;i>0&&null===o;)n.node(i).type===r?o=i:(i-=1,s-=1);return null===o?null:{$pos:t.doc.resolve(s),depth:o}},Ag=(e,t)=>{let n=Am(e,t);if(!n)return!1;let[,r]=((e,t,n,r=20)=>{let i=e.doc.resolve(n),s=r,o=null;for(;s>0&&null===o;){let e=i.node(s);(null==e?void 0:e.type.name)===t?o=e:s-=1}return[o,s]})(t,e,n.$pos.pos+4);return r},Ab=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),s=e.doc.resolve(i).node();return!!s&&!!n.includes(s.type.name)},Ay=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===e},Ax=(e,t,n)=>{if(!n)return!1;let r=cQ(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},Av=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!dN(e.state,t)&&Ab(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let s=i.at(-1);if(!s)return!1;let o=e.state.doc.resolve(r.start()+s.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!dN(e.state,t)||!(e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos})(e.state))return!1;let r=Am(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Ax(t,e.state,i);return Ay(t,e.state)&&!s?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Aw=(e,t)=>{let n=Ag(e,t),r=Am(e,t);return!!r&&!!n&&n>r.depth},AE=(e,t)=>{let n=Ag(e,t),r=Am(e,t);return!!r&&!!n&&n<r.depth},Ak=(e,t)=>{if(!dN(e.state,t)||!((e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=dV(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos})(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(Aw(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():AE(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},AT=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===e},AN=uW.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ak(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ak(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Av(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Av(e,n,r)&&(t=!0)}),t}}}}),AA=/^(\s*)(\d+)\.\s+(.*)$/,AS=/^\s/,AC="textStyle",A_=/^(\d+)\.\s$/,AM=pp.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return 1===t?["ol",d1(this.options.HTMLAttributes,n),0]:["ol",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;let i=e.split("\n"),[s,o]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],s=i.match(AA);if(!s)break;let[,o,a,l]=s,c=o.length,d=[l],u=n+1,p=[i],h=!1;for(;u<e.length;){let t=e[u];if(t.match(AA))break;if(""===t.trim())p.push(t),d.push(""),h=!0,u+=1;else if(t.match(AS))p.push(t),d.push(t.slice(c+2)),u+=1;else{if(h)break;p.push(t),d.push(t),u+=1}}t.push({indent:c,number:parseInt(a,10),content:d.join("\n").trim(),contentLines:d,raw:p.join("\n")}),r=u,n=u}return[t,r]}(i);if(0===s.length)return;let a=function e(t,n,r){let i=[],s=0;for(;s<t.length;){let o=t[s];if(o.indent===n){let{paragraphLines:a,blockLines:l}=function(e){let t=[],n=[],r=!1;return e.forEach(e=>{let i;if(r)return void n.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),/^[-+*]\s+/.test(i)||/^\d+\.\s+/.test(i)||/^>\s?/.test(i)||/^```/.test(i)||/^~~~/.test(i))){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}(o.contentLines),c=a.join("\n").trim(),d=[];c&&d.push({type:"paragraph",raw:c,tokens:r.inlineTokens(c)});let u=l.join("\n").trim();if(u){let e=r.blockTokens(u);d.push(...e)}let p=s+1,h=[];for(;p<t.length&&t[p].indent>n;)h.push(t[p]),p+=1;if(h.length>0){let t=Math.min(...h.map(e=>e.indent)),n=e(h,t,r);d.push({type:"list",ordered:!0,start:h[0].number,items:n,raw:h.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:o.raw,tokens:d}),s=p}else s+=1}return i}(s,0,n);if(0!==a.length)return{type:"list",ordered:!0,start:(null==(r=s[0])?void 0:r.number)||1,items:a,raw:i.slice(0,o).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(AC)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=pt({find:A_,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=pt({find:A_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(AC)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),AO=/^\s*(\[([( |x])?\])\s$/,AI=pp.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",d1(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.checked)?"x":" ";return pu(e,t,`- [${r}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(a.checked=!a.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);let t=d2(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),s=this.options.HTMLAttributes;return d.forEach(e=>{n.has(e)||(e in s?i.setAttribute(e,s[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in s?i.setAttribute(e,s[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=n,!0}}}},addInputRules(){return[pt({find:AO,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),AD=pp.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",d1(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>{let t=pd(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},i=pd(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});uW.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(Ad.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Au.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(AN.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(AM.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(AI.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(AD.configure(this.options.taskList)),e}});var AR=uW.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),AL=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Aj=/^\s*>\s$/,AP=pp.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return AL("blockquote",{...d1(this.options.HTMLAttributes,e),children:AL("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,s;let o=(null!=(s=null==(i=t.renderChild)?void 0:i.call(t,e,r))?s:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(o.join("\n"))}),n.join(`
111
- >
112
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[pt({find:Aj,type:this.type})]}}),AB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,AF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,AH=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,AU=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Az=u$.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return AL("strong",{...d1(this.options.HTMLAttributes,e),children:AL("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[u7({find:AB,type:this.type}),u7({find:AH,type:this.type})]},addPasteRules(){return[pf({find:AF,type:this.type}),pf({find:AU,type:this.type})]}}),A$=/(^|[^`])`([^`]+)`(?!`)$/,AG=/(^|[^`])`([^`]+)`(?!`)/g,Aq=u$.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[u7({find:A$,type:this.type})]},addPasteRules(){return[pf({find:AG,type:this.type})]}}),AV=pp.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),AW=pp.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",d1(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`
113
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:o}=r.extensionManager,a=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&s){let t=a.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),AK=pp.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,d1(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>pe({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),AY=pp.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",d1(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof sE){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return ud(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(sv.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(sE.create(t.doc,n.pos)):t.setSelection(sv.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,s=null==i?void 0:i.create();s&&(t.insert(r,s),t.setSelection(sv.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[u8({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),AX=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,AQ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,AJ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,AZ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,A0=u$.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",d1(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[u7({find:AX,type:this.type}),u7({find:AJ,type:this.type})]},addPasteRules(){return[pf({find:AQ,type:this.type}),pf({find:AZ,type:this.type})]}}),A1="&nbsp;",A2=pp.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",d1(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===A1||n[0].text===A1||" "===n[0].raw||" "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===A1||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{var r,i;if(!e)return"";let s=Array.isArray(e.content)?e.content:[];if(0===s.length){let e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return(null==(i=null==n?void 0:n.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?A1:""}return t.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),A3=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,A5=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,A4=u$.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[u7({find:A3,type:this.type})]},addPasteRules(){return[pf({find:A5,type:this.type})]}}),A6=pp.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),A9=u$.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",d1(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),A7=uW.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(Az.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(AP.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(Ad.configure(this.options.bulletList)),!1!==this.options.code&&i.push(Aq.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(kK.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(AV.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(NV.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(NW.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(AW.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(AK.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(N2.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(AY.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(A0.configure(this.options.italic)),!1!==this.options.listItem&&i.push(Au.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(AN.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(Nx.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(AM.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(A2.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(A4.configure(this.options.strike)),!1!==this.options.text&&i.push(A6.configure(this.options.text)),!1!==this.options.underline&&i.push(A9.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(N1.configure(null==(r=this.options)?void 0:r.trailingNode)),i}});function A8(e){let t=e.regex,n={};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},{begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]}]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(o);let a={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[l,e.SHEBANG(),c,a,i,s,{match:/(\/[a-z._-]+)+/},o,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}}let Se=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],St=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Sn=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Sr=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Si=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Ss(e){let t=e.regex,n={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},r=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Sn.join("|")+")"},{begin:":(:)?("+Sr.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Si.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...r,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...r,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:St.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...r,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Se.join("|")+")\\b"}]}}function So(e){let t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}let Sa="[A-Za-z$_][0-9A-Za-z$_]*",Sl=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Sc=["true","false","null","undefined","NaN","Infinity"],Sd=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Su=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sp=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Sh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Sf=[].concat(Sp,Sd,Su);function Sm(e){var t;let n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,s={$pattern:Sa,keyword:Sl,literal:Sc,built_in:Sf,"variable.language":Sh},o="[0-9](_?[0-9])*",a=`\\.(${o})`,l="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",c={className:"number",variants:[{begin:`(\\b(${l})((${a})|\\.)?|(${a}))[eE][+-]?(${o})\\b`},{begin:`\\b(${l})\\b((${a})\\b|\\.)?|(${a})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},u={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},f={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},m={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:Sa+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,p,h,f,{match:/\$\d+/},c];d.contains=g.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(g)});let b=[].concat(m,d.contains),y=b.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(b)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:y},v={variants:[{match:[/class/,/\s+/,Sa,/\s+/,/extends/,/\s+/,n.concat(Sa,"(",n.concat(/\./,Sa),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,Sa],scope:{1:"keyword",3:"title.class"}}]},w={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Sd,...Su]}},E={match:n.concat(/\b/,(t=[...Sp,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),Sa,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},k={begin:n.concat(/\./,n.lookahead(n.concat(Sa,/(?![0-9A-Za-z$_(])/))),end:Sa,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",N={match:[/const|var|let/,/\s+/,Sa,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:y,CLASS_REFERENCE:w},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,p,h,f,m,{match:/\$\d+/},c,w,{scope:"attr",match:Sa+n.lookahead(":"),relevance:0},N,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:y}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let s=e.input.substring(r);if((n=s.match(/^\s*=/))||(n=s.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,Sa,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:Sa,className:"title.function"})]},{match:/\.\.\./,relevance:0},k,{match:"\\$"+Sa,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},E,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},v,{match:[/get|set/,/\s+/,Sa,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},{match:/\$[(.]/}]}}function Sg(e){let t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Sb(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},i={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},s={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},o=e.inherit(i,{contains:[]}),a=e.inherit(s,{contains:[]});i.contains.push(a),s.contains.push(o);let l=[n,r];return[i,s,o,a].forEach(e=>{e.contains=e.contains.concat(l)}),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:l=l.concat(i,s)},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:l}]}]},n,{className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i,s,{className:"quote",begin:"^>\\s+",contains:l,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},r,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Sy(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},s={className:"meta",begin:/^(>>>|\.\.\.) /},o={className:"subst",begin:/\{/,end:/\}/,keywords:i,illegal:/#/},a={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,s],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,s],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,s,a,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,s,a,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,a,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u=`\\b|${r.join("|")}`,p={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},h={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},f={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:["self",s,p,l,e.HASH_COMMENT_MODE]}]};return o.contains=[l,p,s],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[s,p,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},l,h,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[f]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[p,f,l]}]}}function Sx(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],l=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:l,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:a},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:a,type:l}},{className:"punctuation",begin:"->"},s]}}function Sv(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Sw(e){let t=e.regex,n=e.COMMENT("--","$"),r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],i=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter(e=>!r.includes(e)),s={match:t.concat(/\b/,t.either(...r),/\s*\(/),relevance:0,keywords:{built_in:r}};function o(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,"\\s+"))),/\b/)}let a={scope:"keyword",match:o(["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"]),relevance:0};return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:function(e,{exceptions:t,when:n}={}){return t=t||[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:n(e)?`${e}|0`:e)}(i,{when:e=>e.length<3}),literal:["true","false","unknown"],type:["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]},contains:[{scope:"type",match:o(["double precision","large object","with timezone","without timezone"])},a,s,{scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},{scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},{begin:/"/,end:/"/,contains:[{match:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,{scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}let SE="[A-Za-z$_][0-9A-Za-z$_]*",Sk=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ST=["true","false","null","undefined","NaN","Infinity"],SN=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],SA=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],SS=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],SC=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],S_=[].concat(SS,SN,SA);function SM(e){var t;let n,r,i,s,o,a,l,c,d,u,p,h,f,m,g,b,y,x,v,w,E,k,T,N,A,S=e.regex,C=(n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,s=(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let s=e.input.substring(r);if((n=s.match(/^\s*=/))||(n=s.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},o={$pattern:SE,keyword:Sk,literal:ST,built_in:S_,"variable.language":SC},a="[0-9](_?[0-9])*",l=`\\.(${a})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${a})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},f={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:SE+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},u.contains=(b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,h,f,m,{match:/\$\d+/},d]).concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)}),x=(y=[].concat(g,u.contains)).concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(y)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:x},w={variants:[{match:[/class/,/\s+/,SE,/\s+/,/extends/,/\s+/,n.concat(SE,"(",n.concat(/\./,SE),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,SE],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...SN,...SA]}},k={match:n.concat(/\b/,(t=[...SS,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),SE,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},T={begin:n.concat(/\./,n.lookahead(n.concat(SE,/(?![0-9A-Za-z$_(])/))),end:SE,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,SE,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[v]},{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,h,f,m,g,{match:/\$\d+/},d,E,{scope:"attr",match:SE+n.lookahead(":"),relevance:0},A,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":s,end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,SE,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:SE,className:"title.function"})]},{match:/\.\.\./,relevance:0},T,{match:"\\$"+SE,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},w,{match:[/get|set/,/\s+/,SE,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},{match:/\$[(.]/}]}),_=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],M={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},O={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:_},contains:[C.exports.CLASS_REFERENCE]},I={$pattern:SE,keyword:Sk.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:ST,built_in:S_.concat(_),"variable.language":SC},D={className:"meta",begin:"@"+SE},R=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(-1===r)throw Error("can not find mode to replace");e.contains.splice(r,1,n)};Object.assign(C.keywords,I),C.exports.PARAMS_CONTAINS.push(D);let L=C.contains.find(e=>"attr"===e.scope),j=Object.assign({},L,{match:S.concat(SE,S.lookahead(/\s*\?:/))});return C.exports.PARAMS_CONTAINS.push([C.exports.CLASS_REFERENCE,L,j]),C.contains=C.contains.concat([D,M,O,j]),R(C,"shebang",e.SHEBANG()),R(C,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),C.contains.find(e=>"func.def"===e.label).relevance=0,Object.assign(C,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),C}function SO(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),a=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,o,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,a,o]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function SI(e){let t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(r,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},o=[{className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},{begin:/\{/,end:/\}/,contains:[s],illegal:"\\n",relevance:0},{begin:"\\[",end:"\\]",contains:[s],illegal:"\\n",relevance:0},{className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},r],a=[...o];return a.pop(),a.push(i),s.contains=a,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:o}}let SD={};function SR(e){let t=kY.newInstance();return e&&i(e),{highlight:n,highlightAuto:function(e,i){let s;hr("string"==typeof e,"expected `string` as `value`");let o=(i||SD).subset||r(),a=-1,l=0;for(;++a<o.length;){let r=o[a];if(!t.getLanguage(r))continue;let c=n(r,e,i);c.data&&void 0!==c.data.relevance&&c.data.relevance>l&&(l=c.data.relevance,s=c)}return s||{type:"root",children:[],data:{language:void 0,relevance:l}}},listLanguages:r,register:i,registerAlias:function(e,n){if("string"==typeof e)hr(void 0!==n),t.registerAliases("string"==typeof n?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases("string"==typeof r?r:[...r],{languageName:n})}}},registered:function(e){return!!t.getLanguage(e)}};function n(e,n,r){hr("string"==typeof e,"expected `string` as `name`"),hr("string"==typeof n,"expected `string` as `value`");let i=r||SD,s="string"==typeof i.prefix?i.prefix:"hljs-";if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:SL,classPrefix:s});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let a=o._emitter.root,l=a.data;return l.language=o.language,l.relevance=o.relevance,a}function r(){return t.listLanguages()}function i(e,n){if("string"==typeof e)hr(void 0!==n,"expected `grammar`"),t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}}class SL{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(""===e)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&"text"===n.type?n.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:"element",tagName:"span",properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(".").map(function(e,n){return n?e+"_".repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}let Sj=pp.create({name:"callout",group:"block",content:"block+",defining:!0,addAttributes:()=>({type:{default:"info",parseHTML:e=>e.getAttribute("data-callout-type")||"info",renderHTML:e=>({"data-callout-type":e.type})}}),parseHTML:()=>[{tag:'div[data-callout="true"]'}],renderHTML:({HTMLAttributes:e})=>["div",d1(e,{"data-callout":"true",class:`callout callout-${e["data-callout-type"]||"info"}`}),0]});function SP(e,t,n){let{selection:r,doc:i}=e,s=i.resolve(r.from);for(;s.depth>1;)s=i.resolve(s.before(s.depth));if(0===s.depth)return!1;let o=s.before(1),a=i.nodeAt(o);if(!a)return!1;let l=s.index(0),c="up"===n?l-1:l+1;if(c<0||c>=i.childCount)return!1;let d=i.child(c),u=e.tr,p=o+a.nodeSize,h="up"===n?o-d.nodeSize:p,f="up"===n?o:p+d.nodeSize;if("up"===n)u=(u=(u=u.delete(o,p)).insert(h,a)).setSelection(sE.create(u.doc,h));else{u=u.delete(o,p);let e=f-a.nodeSize;u=(u=u.insert(e,a)).setSelection(sE.create(u.doc,e))}return t&&t(u.scrollIntoView()),!0}let SB="cabinet-drag-handle",SF="cabinet-gutter-add",SH=uW.create({name:"dragHandle",addKeyboardShortcuts:()=>({"Mod-Alt-ArrowUp":({editor:e})=>SP(e.state,e.view.dispatch,"up"),"Mod-Alt-ArrowDown":({editor:e})=>SP(e.state,e.view.dispatch,"down"),"Alt-Shift-ArrowUp":({editor:e})=>SP(e.state,e.view.dispatch,"up"),"Alt-Shift-ArrowDown":({editor:e})=>SP(e.state,e.view.dispatch,"down")}),addProseMirrorPlugins(){let e,t,n=null,r="u">typeof document?((e=document.getElementById(SB))||((e=document.createElement("div")).id=SB,e.setAttribute("data-drag-handle","true"),e.draggable=!0,e.innerHTML='<svg width="10" height="16" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2.5" cy="3" r="1.2"/><circle cx="2.5" cy="8" r="1.2"/><circle cx="2.5" cy="13" r="1.2"/><circle cx="7.5" cy="3" r="1.2"/><circle cx="7.5" cy="8" r="1.2"/><circle cx="7.5" cy="13" r="1.2"/></svg>',Object.assign(e.style,{position:"absolute",display:"none",cursor:"grab",padding:"2px 4px",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",userSelect:"none",transition:"opacity 120ms ease"}),e.addEventListener("mouseenter",()=>{e&&(e.style.opacity="1")}),e.addEventListener("mouseleave",()=>{e&&(e.style.opacity="0.55")}),document.body.appendChild(e)),e):null,i="u">typeof document?((t=document.getElementById(SF))||((t=document.createElement("button")).id=SF,t.type="button",t.setAttribute("aria-label","Add block"),t.title="Add block",t.innerHTML='<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 1V9M1 5H9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',Object.assign(t.style,{position:"absolute",display:"none",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",cursor:"pointer",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",transition:"opacity 120ms ease, background 120ms ease",background:"transparent",border:"none",padding:"0"}),t.addEventListener("mouseenter",()=>{t&&(t.style.opacity="1",t.style.background="var(--muted)")}),t.addEventListener("mouseleave",()=>{t&&(t.style.opacity="0.55",t.style.background="transparent")}),document.body.appendChild(t)),t):null,s=()=>{r&&(r.style.display="none"),i&&(i.style.display="none"),n=null};return[new sR({key:new sP("cabinetDragHandle"),view:e=>{if(!r)return{destroy:()=>{}};let t=t=>{if(!e.editable)return;let o=e.dom.getBoundingClientRect();if(t.clientX<o.left-60||t.clientX>o.right+60||t.clientY<o.top||t.clientY>o.bottom)return void s();let a=function(e,t){let n=e.posAtCoords(t);if(!n)return null;let r=e.state.doc.resolve(n.inside>=0?n.inside:n.pos);for(;r.depth>0&&!r.parent.type.isBlock;)r=e.state.doc.resolve(r.before());let i=r.depth;for(;i>1&&"doc"!==e.state.doc.resolve(r.before(i)).parent.type.name;)i-=1;let s=0===i?0:r.before(Math.max(i,1)),o=e.state.doc.nodeAt(s);if(!o)return null;let a=e.nodeDOM(s);return{pos:s,node:o,dom:a}}(e,{left:Math.max(o.left+20,Math.min(o.right-20,t.clientX)),top:t.clientY});if(!a?.dom||!(a.dom instanceof HTMLElement))return void s();n=a;let l=a.dom.getBoundingClientRect();r.style.display="flex",r.style.top=`${window.scrollY+l.top+4}px`,r.style.left=`${window.scrollX+l.left-22}px`,i&&(i.style.display="flex",i.style.top=`${window.scrollY+l.top+4}px`,i.style.left=`${window.scrollX+l.left-44}px`)},o=()=>s(),a=()=>{if(!n)return;let t=n.pos+n.node.nodeSize,r=t<=e.state.doc.content.size,i=e.state.tr;if(r){let n=sv.create(e.state.doc,Math.min(t-1,e.state.doc.content.size));e.dispatch(i.setSelection(n))}e.focus();let s=e.state.tr.split(e.state.selection.from);e.dispatch(s),e.dom.dispatchEvent(new KeyboardEvent("keydown",{key:"/",bubbles:!0,cancelable:!0}))},l=t=>{if(!n||!t.dataTransfer)return;let{pos:r,dom:i}=n,s=e.state.tr.setSelection(sE.create(e.state.doc,r));e.dispatch(s);let o=e.state.selection.content(),a=document.createElement("div");a.appendChild(e.someProp("clipboardSerializer")?.serializeFragment(o.content)??document.createElement("div")),t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",a.innerHTML),t.dataTransfer.setData("text/plain",i.textContent??""),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage(i,0,0),e.dragging={slice:o,move:!0}};return window.addEventListener("mousemove",t),e.dom.addEventListener("mouseleave",o),r.addEventListener("dragstart",l),i&&i.addEventListener("click",a),{destroy(){window.removeEventListener("mousemove",t),e.dom.removeEventListener("mouseleave",o),r.removeEventListener("dragstart",l),i&&i.removeEventListener("click",a),s()}}}})]}}),SU=new sP("headingAnchors");function Sz(e){let t=[],n=new Map;return e.descendants((e,r)=>{if("heading"!==e.type.name)return;let i=e.textContent.toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-");if(!i)return;let s=n.get(i)??0;n.set(i,s+1);let o=0===s?i:`${i}-${s}`;t.push(aF.node(r,r+e.nodeSize,{id:o}))}),az.create(e,t)}let S$=uW.create({name:"headingAnchors",addProseMirrorPlugins:()=>[new sR({key:SU,state:{init:(e,{doc:t})=>Sz(t),apply:(e,t)=>e.docChanged?Sz(e.doc):t},props:{decorations:e=>SU.getState(e)}})]}),SG=u$.create({name:"proofSpan",priority:900,inclusive:!1,keepOnSplit:!1,addAttributes:()=>({spanId:{default:null,parseHTML:e=>e.getAttribute("id"),renderHTML:e=>({id:e.spanId})},origin:{default:"ai",parseHTML:e=>e.getAttribute("origin"),renderHTML:e=>({origin:e.origin})},basis:{default:null,parseHTML:e=>e.getAttribute("basis"),renderHTML:e=>({basis:e.basis})},basisDetail:{default:null,parseHTML:e=>e.getAttribute("basis-detail"),renderHTML:e=>({"basis-detail":e.basisDetail})},by:{default:null,parseHTML:e=>e.getAttribute("by"),renderHTML:e=>({by:e.by})},at:{default:null,parseHTML:e=>e.getAttribute("at"),renderHTML:e=>({at:e.at})},inResponseTo:{default:null,parseHTML:e=>e.getAttribute("in-response-to"),renderHTML:e=>({"in-response-to":e.inResponseTo})}}),parseHTML:()=>[{tag:"proof-span"}],renderHTML:({HTMLAttributes:e})=>["proof-span",d1(e,{class:"proof-span"}),0]});var Sq=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;function SV(e){let{node:t,updateAttributes:n,selected:r,editor:i}=e,s=t.attrs,o=(0,Q.useRef)(null),a=(0,Q.useRef)(null),[l,c]=(0,Q.useState)(null),d=s.align??"center",u=(0,Q.useCallback)((e,t)=>{if(!i.isEditable)return;e.preventDefault(),e.stopPropagation();let r=o.current,s=a.current;if(!r||!s)return;let l=e.clientX,d=r.getBoundingClientRect().width,u=s.parentElement?.getBoundingClientRect().width??800,p=e=>{c(Math.max(80,Math.min(u,d+("right"===t?e.clientX-l:l-e.clientX))))},h=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",h),c(e=>(null!=e&&n({width:Math.round(e)}),null))};window.addEventListener("pointermove",p),window.addEventListener("pointerup",h)},[i.isEditable,n]),p=null!=l?`${Math.round(l)}px`:"number"==typeof s.width?`${s.width}px`:"string"==typeof s.width&&s.width?s.width:void 0,h="left"===d?"mr-auto":"right"===d?"ml-auto":"mx-auto";return(0,X.jsx)(p3,{as:"div",className:`resizable-image my-3 ${h}`,"data-align":d,style:{width:p??"fit-content",maxWidth:"100%"},children:(0,X.jsxs)("div",{ref:a,className:`relative group inline-block max-w-full ${r?"ring-2 ring-primary rounded-md":""}`,contentEditable:!1,children:[(0,X.jsx)("img",{ref:o,src:s.src,alt:s.alt??"",title:s.title??void 0,className:"block rounded-md max-w-full h-auto",style:{width:p},draggable:!1}),i.isEditable&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{"aria-label":"Resize from left",onPointerDown:e=>u(e,"left"),className:"absolute left-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,X.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),(0,X.jsx)("div",{"aria-label":"Resize from right",onPointerDown:e=>u(e,"right"),className:"absolute right-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,X.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),null!=l&&(0,X.jsxs)("div",{className:"absolute top-1 right-1 text-[10px] px-1.5 py-0.5 rounded bg-primary/80 text-primary-foreground font-mono",children:[Math.round(l),"px"]})]})]})})}let SW=pp.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",d1(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,s,o;let a=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",l=null!=(i=null==(r=e.attrs)?void 0:r.alt)?i:"",c=null!=(o=null==(s=e.attrs)?void 0:s.title)?o:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:s,HTMLAttributes:o,editor:a})=>{let l=document.createElement("img");Object.entries(o).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:l.setAttribute(e,t)}}),l.src=o.src;let c=new pn({element:l,editor:a,node:i,getPos:s,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=s();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),d=c.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[u8({find:Sq,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}).extend({name:"image",draggable:!0,addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width")??e.style.width;if(!t)return null;let n=/^(\d+)(px)?$/.exec(t);return n?Number(n[1]):t},renderHTML:e=>{if(!e.width)return{};let t="number"==typeof e.width?`${e.width}px`:e.width;return{style:`width: ${t}`}}},align:{default:null,parseHTML:e=>e.getAttribute("data-align"),renderHTML:e=>e.align?{"data-align":e.align}:{}}}},addNodeView:()=>e=>e.editor.contentComponent?new p9(SV,e,void 0):{}}),SK=new sP("wikiLinkDecorator"),SY="wikiLinkDecorator:refresh";function SX(e){let{has:t}=wO.getState(),n=e.schema.marks.wikiLink;if(!n)return az.empty;let r=[];return e.doc.descendants((e,i)=>{if(!e.isText)return;let s=e.marks.find(e=>e.type===n);if(!s)return;let o=s.attrs.slug;!o||t(o)||r.push(aF.inline(i,i+e.nodeSize,{"data-broken":"true"}))}),az.create(e.doc,r)}let SQ=/\[\[([a-z0-9-]+)(?:\|([^\]#|]+)|#([a-z0-9-]+))?\]\]$/,SJ=u$.create({name:"wikiLink",priority:1e3,keepOnSplit:!1,inclusive:!1,addAttributes:()=>({slug:{default:null,parseHTML:e=>e.getAttribute("data-slug"),renderHTML:e=>({"data-slug":e.slug})},alias:{default:null,parseHTML:e=>e.getAttribute("data-alias"),renderHTML:e=>null!=e.alias?{"data-alias":e.alias}:{}},anchor:{default:null,parseHTML:e=>e.getAttribute("data-anchor"),renderHTML:e=>null!=e.anchor?{"data-anchor":e.anchor}:{}}}),parseHTML:()=>[{tag:'a[data-wiki-link="true"]'}],renderHTML({HTMLAttributes:e}){let t=String(e["data-slug"]??""),n=null!=e["data-anchor"]?String(e["data-anchor"]):null;return["a",d1(e,{"data-wiki-link":"true",href:n?`#wiki:${t}#${n}`:`#wiki:${t}`,class:"wiki-link"}),0]},addInputRules(){return[new uF({find:SQ,handler:({state:e,range:t,match:n})=>{let r=n[1]??"",i=n[2]??null,s=n[3]??null,o=i??(s?`${r}#${s}`:r),{tr:a}=e;a.replaceWith(t.from,t.to,e.schema.text(o,[this.type.create({slug:r,alias:i,anchor:s})]))}})]},addProseMirrorPlugins:()=>[new sR({key:SK,state:{init:(e,t)=>SX(t),apply:(e,t,n,r)=>e.getMeta(SY)||e.docChanged?SX(r):t.map(e.mapping,e.doc)},props:{decorations:e=>SK.getState(e)??az.empty},view(e){let t=wO.subscribe(()=>{let t=e.state.tr.setMeta(SY,!0);e.dispatch(t)});return{destroy(){t()}}}})],addCommands(){return{setWikiLink:e=>({commands:t})=>t.setMark(this.name,{slug:e.slug,alias:e.alias??null,anchor:e.anchor??null}),unsetWikiLink:()=>({commands:e})=>e.unsetMark(this.name)}}}),SZ=SR({bash:A8,css:Ss,go:So,javascript:Sm,json:Sg,markdown:Sb,python:Sy,rust:Sx,shell:Sv,sql:Sw,typescript:SM,xml:SO,yaml:SI}),S0=[A7.configure({heading:{levels:[1,2,3,4]},codeBlock:!1,link:!1,underline:!1}),kJ.configure({lowlight:SZ,HTMLAttributes:{class:"rounded-md bg-muted p-4 font-mono text-sm"}}),NZ.configure({placeholder:"Start writing, or press '/' for commands..."}),SW.configure({HTMLAttributes:{class:"rounded-lg max-w-full"},allowBase64:!1}),Ao.configure({resizable:!0,lastColumnResizable:!1,HTMLAttributes:{class:"border-collapse w-full"}}),N8,N9,N7,AD.configure({HTMLAttributes:{class:"task-list"}}),AI.configure({nested:!0}),Nx.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}}).extend({parseHTML:()=>[{tag:'a[href]:not([data-wiki-link="true"])'}],addKeyboardShortcuts(){return{"Mod-e":()=>{let{state:e}=this.editor,{from:t,to:n}=e.selection;if(t===n)return!1;let r=this.editor.getAttributes("link").href??"",i=window.prompt("Link URL",r);return null!==i&&(""===i?this.editor.chain().focus().extendMarkRange("link").unsetLink().run():this.editor.chain().focus().extendMarkRange("link").setLink({href:i}).run())}}}}),Sj,SG,AR.configure({types:["heading","paragraph"]}),N3,N5,SH,S$,SJ],S1=en("app-window",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]),S2=en("file-audio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]),S3=en("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]),S5=en("file-image",[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]),S4=en("file-spreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),S6=en("file-video",[["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 11 5 3-5 3v-6Z",key:"7ntvm4"}]]),S9=en("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),S7="kb-folder-view-mode";function S8(e){return"image"===e.type}function Ce(e){switch(e.type){case"directory":case"cabinet":return eh;case"image":return S5;case"video":return S6;case"audio":return S2;case"code":return S3;case"csv":case"xlsx":return S4;case"website":return eg;case"app":return S1;default:return ep}}function Ct(e){let{selectPage:t,expandPath:n}=wT.getState(),r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),wk.getState().loadPage(e)}function Cn({folderPath:e,entries:t}){let n=(0,Q.useMemo)(()=>(function(e){if(0===e.length)return!1;let t=e.filter(S8).length;return t>=4&&t/e.length>=.6})(t),[t]),[r,i]=(0,Q.useState)(()=>{let t=function(e){try{let t=localStorage.getItem(S7);if(!t)return null;return JSON.parse(t)[e]??null}catch{return null}}(e);return t||(n?"gallery":"list")}),s=t=>{i(t);try{let n=localStorage.getItem(S7),r=n?JSON.parse(n):{};r[e]=t,localStorage.setItem(S7,JSON.stringify(r))}catch{}},o=(0,Q.useMemo)(()=>{let e=[...t];return e.sort((e,t)=>{let n="directory"===e.type||"cabinet"===e.type;return n!==("directory"===t.type||"cabinet"===t.type)?n?-1:1:e.name.localeCompare(t.name)}),e},[t]);return(0,X.jsxs)("div",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsxs)("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground/70",children:[o.length," ",1===o.length?"item":"items"]}),(0,X.jsxs)("div",{className:"inline-flex items-center rounded-md border border-border p-0.5 text-[11px]",children:[(0,X.jsxs)("button",{onClick:()=>s("list"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"list"===r?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"list"===r,title:"List view",children:[(0,X.jsx)(kA,{className:"h-3 w-3"}),"List"]}),(0,X.jsxs)("button",{onClick:()=>s("gallery"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"gallery"===r?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"gallery"===r,title:"Gallery view",children:[(0,X.jsx)(S9,{className:"h-3 w-3"}),"Gallery"]})]})]}),"list"===r?(0,X.jsx)("ul",{className:"divide-y divide-border rounded-md border border-border overflow-hidden",children:o.map(e=>{let t=Ce(e),n=e.frontmatter?.title||e.name;return(0,X.jsx)("li",{children:(0,X.jsxs)("button",{onClick:()=>Ct(e.path),className:"w-full flex items-center gap-3 px-3 py-2 text-left text-sm hover:bg-accent/50 transition-colors",children:[(0,X.jsx)(t,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"flex-1 truncate",children:n}),(0,X.jsx)("span",{className:"text-[11px] text-muted-foreground/60 capitalize",children:e.type})]})},e.path)})}):(0,X.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:o.map(e=>{let t=e.frontmatter?.title||e.name;if(S8(e))return(0,X.jsxs)("button",{onClick:()=>Ct(e.path),className:"group flex flex-col gap-1.5 text-left",title:t,children:[(0,X.jsx)("div",{className:"aspect-square w-full overflow-hidden rounded-md border border-border bg-muted",children:(0,X.jsx)("img",{src:rW(`/api/assets/${e.path}`),alt:t,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-[1.02]"})}),(0,X.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:t})]},e.path);let n=Ce(e);return(0,X.jsxs)("button",{onClick:()=>Ct(e.path),className:"group flex flex-col gap-1.5 text-left",title:t,children:[(0,X.jsx)("div",{className:"aspect-square w-full flex items-center justify-center rounded-md border border-border bg-muted/40 group-hover:bg-muted transition-colors",children:(0,X.jsx)(n,{className:"h-8 w-8 text-muted-foreground/60"})}),(0,X.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:t})]},e.path)})})]})}let Cr=en("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);function Ci({blockRef:e,comments:t,top:n,left:r,onClick:i}){let s;if(0===t.length)return null;let o=t.filter(e=>!e.resolved);if(0===o.length)s="check";else{let e=o[0].turns.at(-1);s=e?.by.startsWith("ai:")?"dot-ai":"ring-human"}return(0,X.jsxs)("button",{type:"button",onClick:i,style:{position:"absolute",top:n,left:r,transform:"translateY(2px)"},className:"z-10 p-2 sm:p-0.5 -m-1.5 sm:m-0 rounded transition-colors hover:bg-accent focus:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":`Comment thread for block ${e}`,children:["check"===s&&(0,X.jsx)(Cr,{className:"h-3.5 w-3.5 text-muted-foreground/30"}),"dot-ai"===s&&(0,X.jsx)(ku,{className:"h-3.5 w-3.5 fill-primary text-primary"}),"ring-human"===s&&(0,X.jsx)(ku,{className:"h-3.5 w-3.5 text-muted-foreground/70"})]})}var Cs="u">typeof document?Q.useLayoutEffect:function(){};function Co(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(!Co(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)&&!Co(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ca(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cl(e,t){let n=Ca(e);return Math.round(t*n)/n}function Cc(e){let t=Q.useRef(e);return Cs(()=>{t.current=e}),t}var Cd=Q.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...s}=e;return(0,X.jsx)(t8.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,X.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Cd.displayName="Arrow";var Cu="Popper",[Cp,Ch]=tJ(Cu),[Cf,Cm]=Cp(Cu),Cg=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Q.useState(null);return(0,X.jsx)(Cf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Cg.displayName=Cu;var Cb="PopperAnchor",Cy=Q.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,s=Cm(Cb,n),o=Q.useRef(null),a=ej(t,o),l=Q.useRef(null);return Q.useEffect(()=>{let e=l.current;l.current=r?.current||o.current,e!==l.current&&s.onAnchorChange(l.current)}),r?null:(0,X.jsx)(t8.div,{...i,ref:a})});Cy.displayName=Cb;var Cx="PopperContent",[Cv,Cw]=Cp(Cx),CE=Q.forwardRef((e,t)=>{var n,r,i,s,o,a,l,c,d,u,p,h,f,m,g,b;let y,x,v,w,E,k,{__scopePopper:T,side:N="bottom",sideOffset:A=0,align:S="center",alignOffset:C=0,arrowPadding:_=0,avoidCollisions:M=!0,collisionBoundary:O=[],collisionPadding:I=0,sticky:D="partial",hideWhenDetached:R=!1,updatePositionStrategy:L="optimized",onPlaced:j,...P}=e,B=Cm(Cx,T),[F,H]=Q.useState(null),U=ej(t,e=>H(e)),[z,$]=Q.useState(null),G=function(e){let[t,n]=Q.useState(void 0);return tZ(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,i;if(!Array.isArray(t)||!t.length)return;let s=t[0];if("borderBoxSize"in s){let e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(z),q=G?.width??0,V=G?.height??0,W="number"==typeof I?I:{top:0,right:0,bottom:0,left:0,...I},K=Array.isArray(O)?O:[O],Y=K.length>0,J={padding:W,boundary:K.filter(CA),altBoundary:Y},{refs:Z,floatingStyles:ee,placement:et,isPositioned:en,middlewareData:er}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,u]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=Q.useState(r);Co(p,r)||h(r);let[f,m]=Q.useState(null),[g,b]=Q.useState(null),y=Q.useCallback(e=>{e!==E.current&&(E.current=e,m(e))},[]),x=Q.useCallback(e=>{e!==k.current&&(k.current=e,b(e))},[]),v=s||f,w=o||g,E=Q.useRef(null),k=Q.useRef(null),T=Q.useRef(d),N=null!=l,A=Cc(l),S=Cc(i),C=Cc(c),_=Q.useCallback(()=>{if(!E.current||!k.current)return;let e={placement:t,strategy:n,middleware:p};S.current&&(e.platform=S.current),EX(E.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==C.current};M.current&&!Co(T.current,t)&&(T.current=t,t4.flushSync(()=>{u(t)}))})},[p,t,n,S,C]);Cs(()=>{!1===c&&T.current.isPositioned&&(T.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[c]);let M=Q.useRef(!1);Cs(()=>(M.current=!0,()=>{M.current=!1}),[]),Cs(()=>{if(v&&(E.current=v),w&&(k.current=w),v&&w){if(A.current)return A.current(v,w,_);_()}},[v,w,_,A,N]);let O=Q.useMemo(()=>({reference:E,floating:k,setReference:y,setFloating:x}),[y,x]),I=Q.useMemo(()=>({reference:v,floating:w}),[v,w]),D=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!I.floating)return e;let t=Cl(I.floating,d.x),r=Cl(I.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...Ca(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,a,I.floating,d.x,d.y]);return Q.useMemo(()=>({...d,update:_,refs:O,elements:I,floatingStyles:D}),[d,_,O,I,D])}({strategy:"fixed",placement:N+("center"!==S?"-"+S:""),whileElementsMounted:(...e)=>(function(e,t,n,r){let i;void 0===r&&(r={});let{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,d=EC(e),u=s||o?[...d?EN(d):[],...t?EN(t):[]]:[];u.forEach(e=>{s&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});let p=d&&l?function(e,t){let n,r=null,i=Ec(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function o(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),s();let c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:h}=c;if(a||t(),!p||!h)return;let f={rootMargin:-wG(u)+"px "+-wG(i.clientWidth-(d+p))+"px "+-wG(i.clientHeight-(u+h))+"px "+-wG(d)+"px",threshold:wz(0,wU(1,l))||1},m=!0;function g(t){let r=t[0].intersectionRatio;if(r!==l){if(!m)return o();r?o(!1,r):n=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==r||EU(c,e.getBoundingClientRect())||o(),m=!1}try{r=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,f)}r.observe(e)}(!0),s}(d,n):null,h=-1,f=null;a&&(f=new ResizeObserver(e=>{let[r]=e;r&&r.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),d&&!c&&f.observe(d),t&&f.observe(t));let m=c?EI(e):null;return c&&function t(){let r=EI(e);m&&!EU(m,r)&&n(),m=r,i=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{s&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==p||p(),null==(e=f)||e.disconnect(),f=null,c&&cancelAnimationFrame(i)}})(...e,{animationFrame:"always"===L}),elements:{reference:B.anchor},middleware:[{name:(y=Ez(n={mainAxis:A+V,alignmentAxis:C})).name,fn:y.fn,options:[n,r]},M&&{name:(x=EG(a={mainAxis:!0,crossAxis:!1,limiter:"partial"===D?{fn:(void 0===(o=i)&&(o={}),{options:o,fn(e){let{x:t,y:n,placement:r,rects:i,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=wW(o,e),d={x:t,y:n},u=wJ(r),p=wX(u),h=d[p],f=d[u],m=wW(a,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){let e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+g.mainAxis,n=i.reference[p]+i.reference[e]-g.mainAxis;h<t?h=t:h>n&&(h=n)}if(c){var b,y;let e="y"===p?"width":"height",t=Ei.has(wK(r)),n=i.reference[u]-i.floating[e]+(t&&(null==(b=s.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),o=i.reference[u]+i.reference[e]+(t?0:(null==(y=s.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);f<n?f=n:f>o&&(f=o)}return{[p]:h,[u]:f}}}).fn,options:[i,s]}:void 0,...J})).name,fn:x.fn,options:[a,l]},M&&{name:(v=Eq(c={...J})).name,fn:v.fn,options:[c,d]},{name:(w=EV(u={...J,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${n}px`),o.setProperty("--radix-popper-available-height",`${r}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}})).name,fn:w.fn,options:[u,p]},z&&{name:(E={name:"arrow",options:m=h={element:z,padding:_},fn(e){let{element:t,padding:n}="function"==typeof m?m(e):m;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?EK({element:t.current,padding:n}).fn(e):{}:t?EK({element:t,padding:n}).fn(e):{}}}).name,fn:E.fn,options:[h,f]},CS({arrowWidth:q,arrowHeight:V}),R&&{name:(k=EW(g={strategy:"referenceHidden",...J})).name,fn:k.fn,options:[g,b]}]}),[ei,es]=CC(et),eo=nt(j);tZ(()=>{en&&eo?.()},[en,eo]);let ea=er.arrow?.x,el=er.arrow?.y,ec=er.arrow?.centerOffset!==0,[ed,eu]=Q.useState();return tZ(()=>{F&&eu(window.getComputedStyle(F).zIndex)},[F]),(0,X.jsx)("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:en?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ed,"--radix-popper-transform-origin":[er.transformOrigin?.x,er.transformOrigin?.y].join(" "),...er.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,X.jsx)(Cv,{scope:T,placedSide:ei,onArrowChange:$,arrowX:ea,arrowY:el,shouldHideArrow:ec,children:(0,X.jsx)(t8.div,{"data-side":ei,"data-align":es,...P,ref:U,style:{...P.style,animation:en?void 0:"none"}})})})});CE.displayName=Cx;var Ck="PopperArrow",CT={top:"bottom",right:"left",bottom:"top",left:"right"},CN=Q.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Cw(Ck,n),s=CT[i.placedSide];return(0,X.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]: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,X.jsx)(Cd,{...r,ref:t,style:{...r.style,display:"block"}})})});function CA(e){return null!==e}CN.displayName=Ck;var CS=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,o=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[l,c]=CC(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+o/2,p=(i.arrow?.y??0)+a/2,h="",f="";return"bottom"===l?(h=s?d:`${u}px`,f=`${-a}px`):"top"===l?(h=s?d:`${u}px`,f=`${r.floating.height+a}px`):"right"===l?(h=`${-a}px`,f=s?d:`${p}px`):"left"===l&&(h=`${r.floating.width+a}px`,f=s?d:`${p}px`),{data:{x:h,y:f}}}});function CC(e){let[t,n="center"]=e.split("-");return[t,n]}var C_="Popover",[CM,CO]=tJ(C_,[Ch]),CI=Ch(),[CD,CR]=CM(C_),CL=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=CI(t),l=Q.useRef(null),[c,d]=Q.useState(!1),[u,p]=t5({prop:r,defaultProp:i??!1,onChange:s,caller:C_});return(0,X.jsx)(Cg,{...a,children:(0,X.jsx)(CD,{scope:t,contentId:t2(),triggerRef:l,open:u,onOpenChange:p,onOpenToggle:Q.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:c,onCustomAnchorAdd:Q.useCallback(()=>d(!0),[]),onCustomAnchorRemove:Q.useCallback(()=>d(!1),[]),modal:o,children:n})})};CL.displayName=C_;var Cj="PopoverAnchor",CP=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CR(Cj,n),s=CI(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return Q.useEffect(()=>(o(),()=>a()),[o,a]),(0,X.jsx)(Cy,{...s,...r,ref:t})});CP.displayName=Cj;var CB="PopoverTrigger";Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CR(CB,n),s=CI(n),o=ej(t,i.triggerRef),a=(0,X.jsx)(t8.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":CQ(i.open),...r,ref:o,onClick:tQ(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:(0,X.jsx)(Cy,{asChild:!0,...s,children:a})}).displayName=CB;var CF="PopoverPortal",[CH,CU]=CM(CF,{forceMount:void 0}),Cz=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=CR(CF,t);return(0,X.jsx)(CH,{scope:t,forceMount:n,children:(0,X.jsx)(nb,{present:n||s.open,children:(0,X.jsx)(ng,{asChild:!0,container:i,children:r})})})};Cz.displayName=CF;var C$="PopoverContent",CG=Q.forwardRef((e,t)=>{let n=CU(C$,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=CR(C$,e.__scopePopover);return(0,X.jsx)(nb,{present:r||s.open,children:s.modal?(0,X.jsx)(CV,{...i,ref:t}):(0,X.jsx)(CW,{...i,ref:t})})});CG.displayName=C$;var Cq=t6("PopoverContent.RemoveScroll"),CV=Q.forwardRef((e,t)=>{let n=CR(C$,e.__scopePopover),r=Q.useRef(null),i=ej(t,r),s=Q.useRef(!1);return Q.useEffect(()=>{let e=r.current;if(e)return rn(e)},[]),(0,X.jsx)(n4,{as:Cq,allowPinchZoom:!0,children:(0,X.jsx)(CK,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tQ(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:tQ(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;s.current=2===t.button||n},{checkForDefaultPrevented:!1}),onFocusOutside:tQ(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),CW=Q.forwardRef((e,t)=>{let n=CR(C$,e.__scopePopover),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(CK,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let s=t.target;n.triggerRef.current?.contains(s)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),CK=Q.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,p=CR(C$,n),h=CI(n);return nv(),(0,X.jsx)(nd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:(0,X.jsx)(ni,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:(0,X.jsx)(CE,{"data-state":CQ(p.open),role:"dialog",id:p.contentId,...h,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CY="PopoverClose";Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CR(CY,n);return(0,X.jsx)(t8.button,{type:"button",...r,ref:t,onClick:tQ(e.onClick,()=>i.onOpenChange(!1))})}).displayName=CY;var CX=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CI(n);return(0,X.jsx)(CN,{...i,...r,ref:t})});function CQ(e){return e?"open":"closed"}CX.displayName="PopoverArrow";let CJ=new Intl.RelativeTimeFormat("en",{numeric:"auto"});async function CZ(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),s=await rK(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:n,ops:r})});if(409===s.status){let e=await s.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return s.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}function C0({path:e,blockRef:t,comments:n,anchorEl:r,onClose:i}){let[s,o]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),p=n.filter(e=>!e.resolved),h=p.length>0,f=p[0]??n[0]??null;if((0,Q.useEffect)(()=>{if(!r)return void o(null);let e=r.getBoundingClientRect();o({top:e.bottom+4,left:e.left})},[r]),(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,i]),(0,Q.useEffect)(()=>{s&&setTimeout(()=>u.current?.focus(),50)},[s]),!r||!s)return null;function m(){let t=wD.getState().byPath[e];return t?.snapshotRevision??0}async function g(){if(a.trim()&&!c){d(!0);try{let n=f?{type:"comment.reply",commentId:f.id,text:a.trim()}:{type:"comment.add",ref:t,text:a.trim()},r=m(),s=await CZ(e,r,"human",[n]);!s.ok&&s.stale&&void 0!==s.newRevision&&(await wD.getState().loadSidecar(e),r=s.newRevision,s=await CZ(e,r,"human",[n])),s.ok&&(await wD.getState().loadSidecar(e),l(""),i())}finally{d(!1)}}}async function b(){if(f&&!c){d(!0);try{let t=f.resolved?"comment.reopen":"comment.resolve",n=m(),r=await CZ(e,n,"human",[{type:t,commentId:f.id}]);!r.ok&&r.stale&&void 0!==r.newRevision&&(await wD.getState().loadSidecar(e),n=r.newRevision,r=await CZ(e,n,"human",[{type:t,commentId:f.id}])),r.ok&&(await wD.getState().loadSidecar(e),i())}finally{d(!1)}}}let y=n.flatMap(e=>e.turns.map(t=>({...t,resolved:e.resolved,commentId:e.id})));return(0,X.jsxs)(CL,{open:!0,children:[(0,X.jsx)(CP,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:s.top,left:s.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(Cz,{children:(0,X.jsxs)(CG,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:i,className:"z-50 w-[min(18rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate",children:t}),f&&(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void b(),className:"ml-2 shrink-0 text-[10px] px-1.5 py-0.5 rounded border border-border hover:bg-accent disabled:opacity-50 transition-colors",children:f.resolved?"Reopen":"Resolve"})]}),y.length>0&&(0,X.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1",children:y.map((e,t)=>(0,X.jsxs)("div",{className:"space-y-0.5",children:[(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:[e.by," · ",function(e){let t=Math.round((Date.now()-new Date(e).getTime())/1e3);if(60>Math.abs(t))return CJ.format(-t,"second");let n=Math.round(t/60);if(60>Math.abs(n))return CJ.format(-n,"minute");let r=Math.round(n/60);return 24>Math.abs(r)?CJ.format(-r,"hour"):CJ.format(-Math.round(r/24),"day")}(e.at)]}),(0,X.jsx)("p",{className:"text-foreground leading-snug whitespace-pre-wrap",children:e.text})]},t))}),(!f?.resolved||0===n.length)&&(0,X.jsxs)("div",{className:"space-y-1.5 pt-1",children:[(0,X.jsx)("textarea",{ref:u,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&g()},placeholder:h?"Reply…":"Add a comment…",rows:2,className:"w-full resize-none rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ send"}),(0,X.jsx)("button",{type:"button",disabled:c||!a.trim(),onClick:()=>void g(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Send"})]})]}),(0,X.jsx)(CX,{className:"fill-border"})]})})]})}function C1({targetEl:e,path:t,onClose:n,onComment:r}){let[i,s]=(0,Q.useState)(null),[o,a]=(0,Q.useState)(null),[l,c]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{if(!e){s(null),a(null);return}let t=e.getBoundingClientRect();s({top:t.bottom+window.scrollY+4,left:t.left+window.scrollX}),a({spanId:e.getAttribute("id")??"",origin:e.getAttribute("origin"),basis:e.getAttribute("basis"),basisDetail:e.getAttribute("basis-detail"),by:e.getAttribute("by"),at:e.getAttribute("at")})},[e]),(0,Q.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,n]),!e||!i||!o)return null;async function d(e){if(!l&&o){c(!0);try{await rK("/api/agent/internal/span",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,spanId:o.spanId,action:e,idempotencyKey:crypto.randomUUID()})})}finally{c(!1),n()}}}return(0,X.jsxs)(CL,{open:!0,children:[(0,X.jsx)(CP,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:i.top,left:i.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(Cz,{children:(0,X.jsxs)(CG,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:n,className:"z-50 w-[min(16rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"space-y-0.5",children:[(0,X.jsxs)("p",{className:"font-medium text-foreground truncate",children:[o.by??"unknown"," · ",o.basis??"—"," · ",function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}(o.at)]}),o.basisDetail&&(0,X.jsxs)("p",{className:"text-muted-foreground italic truncate",children:["“",o.basisDetail,"”"]}),o.origin&&(0,X.jsxs)("p",{className:"text-muted-foreground/60",children:["origin: ",o.origin]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1.5 pt-1",children:[(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>void d("accept"),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>void d("revert"),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Revert"}),(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>{r?.(),n()},className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Comment"})]}),(0,X.jsx)(CX,{className:"fill-border"})]})})]})}async function C2(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),s=await rK(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:[{type:n,suggestionId:r}]})});return{ok:s.ok,status:s.status}}function C3({suggestion:e,currentMarkdown:t,path:n,baseRevision:r,getLatestRevision:i,top:s,left:o,width:a,onSettled:l}){let[c,d]=(0,Q.useState)(!1);async function u(){if(!c){d(!0);try{let t=await C2(n,r,"suggestion.accept",e.id);t.ok||409!==t.status||(t=await C2(n,i(),"suggestion.accept",e.id))}finally{d(!1),l()}}}async function p(){if(!c){d(!0);try{await C2(n,r,"suggestion.reject",e.id)}finally{d(!1),l()}}}let h="delete"===e.kind,f="insertAfter"===e.kind||"insertBefore"===e.kind;return(0,X.jsxs)("div",{style:{position:"absolute",top:s,left:o,width:a>0?a:void 0,zIndex:30},className:"my-1 rounded-lg border border-border bg-card shadow-md text-[12px] overflow-hidden",role:"region","aria-label":`Suggestion by ${e.by}`,children:[(0,X.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b border-border",children:(0,X.jsxs)("span",{className:"font-medium text-foreground",children:[(0,X.jsx)("span",{className:"text-primary",children:e.by})," suggests ",(0,X.jsx)("span",{className:"text-muted-foreground",children:function(e){switch(e){case"replace":return"replacing this block";case"insertAfter":return"inserting content after this block";case"insertBefore":return"inserting content before this block";case"delete":return"deleting this block"}}(e.kind)})]})}),(0,X.jsxs)("div",{className:"p-3 space-y-2",children:["replace"===e.kind&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ current ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground bg-destructive/5 rounded px-2 py-1",children:t||"(empty)"})]}),(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ proposed ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]})]}),f&&(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be inserted ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]}),h&&(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be deleted ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1",children:t||"(empty)"})]}),e.basisDetail&&(0,X.jsxs)("p",{className:"italic text-muted-foreground/70 text-[11px]",children:["Reason: ",e.basisDetail]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-t border-border bg-muted/30",children:[(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void u(),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void p(),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Reject"})]})]})}async function C5(e,t,n){let r=encodeURIComponent(e).replace(/%2F/g,"/"),i=await rK(`/api/agent/files/${r}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:n})});if(409===i.status){let e=await i.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return i.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}let C4={replace:"Replace block",insertAfter:"Insert after",insertBefore:"Insert before",delete:"Delete block"};function C6({path:e,blockRef:t,currentMarkdown:n,anchor:r,onClose:i}){let[s,o]=(0,Q.useState)("replace"),[a,l]=(0,Q.useState)(n),[c,d]=(0,Q.useState)(""),[u,p]=(0,Q.useState)(!1),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{"replace"===s?l(n):l("")},[s,n]),(0,Q.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i]),(0,Q.useEffect)(()=>{setTimeout(()=>h.current?.focus(),50)},[]);let f="delete"!==s,m=!u&&(!f||a.trim().length>0);async function g(){if(m){p(!0);try{let n={type:"suggestion.add",ref:t,kind:s,basis:"suggested"};f&&(n.markdown=a),c.trim()&&(n.basisDetail=c.trim());let r=wD.getState().byPath[e]?.snapshotRevision??0,o=await C5(e,r,[n]);!o.ok&&o.stale&&void 0!==o.newRevision&&(await wD.getState().loadSidecar(e),r=o.newRevision,o=await C5(e,r,[n])),o.ok&&(await wD.getState().loadSidecar(e),await wD.getState().loadSnapshot(e),i())}finally{p(!1)}}}return(0,X.jsxs)(CL,{open:!0,children:[(0,X.jsx)(CP,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:r.top,left:r.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(Cz,{children:(0,X.jsxs)(CG,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:i,className:"z-50 w-[min(20rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2.5 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"font-medium text-foreground",children:"Suggest an edit"}),(0,X.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate ml-2",children:t})]}),(0,X.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.keys(C4).map(e=>(0,X.jsx)("button",{type:"button",onClick:()=>o(e),className:`px-2 py-0.5 rounded-md text-[10.5px] border transition-colors ${s===e?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:bg-accent"}`,children:C4[e]},e))}),"delete"===s&&(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1 max-h-32 overflow-y-auto",children:n||"(empty)"}),f&&(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60",children:"replace"===s?"proposed content":"content to insert"}),(0,X.jsx)("textarea",{ref:h,value:a,onChange:e=>l(e.target.value),rows:4,placeholder:"Markdown…",className:"w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"})]}),(0,X.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&g()},placeholder:"Reason (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,X.jsxs)("div",{className:"flex items-center justify-between pt-0.5",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ submit"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("button",{type:"button",disabled:u,onClick:i,className:"px-2.5 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),(0,X.jsx)("button",{type:"button",disabled:!m,onClick:()=>void g(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Suggest"})]})]}),(0,X.jsx)(CX,{className:"fill-border"})]})})]})}let C9=en("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),C7=en("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),C8=en("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),_e=en("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),_t=[{label:"Text",icon:en("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]),description:"Start writing plain text",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setParagraph().run()}},{label:"Heading 1",icon:kk,description:"Large section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:1}).run()}},{label:"Heading 2",icon:kT,description:"Medium section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:2}).run()}},{label:"Heading 3",icon:kN,description:"Small section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:3}).run()}},{label:"Bullet List",icon:kA,description:"Create a bullet list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBulletList().run()}},{label:"Numbered List",icon:kS,description:"Create a numbered list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleOrderedList().run()}},{label:"Checklist",icon:kv,description:"Create a task checklist",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleTaskList().run()}},{label:"Code Block",icon:kc,description:"Insert a code block",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleCodeBlock().run()}},{label:"Blockquote",icon:kO,description:"Insert a blockquote",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBlockquote().run()}},{label:"Divider",icon:kC,description:"Insert a horizontal rule",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setHorizontalRule().run()}},{label:"Table",icon:_e,description:"Insert a 3x3 table",category:"basic",action:{type:"direct",run:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{label:"Image",icon:eb,description:"Upload, paste URL, or drop an image",category:"media",action:{type:"popover",kind:{type:"media",kind:"image"}}},{label:"Video",icon:kR,description:"Upload or paste a video URL",category:"media",action:{type:"popover",kind:{type:"media",kind:"video"}}},{label:"File",icon:ed,description:"Attach any file to this page",category:"media",action:{type:"popover",kind:{type:"media",kind:"file"}}},{label:"Callout",icon:C7,description:"Insert an info callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"info"}).run()}},{label:"Warning",icon:C9,description:"Insert a warning callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"warning"}).run()}},{label:"Math",icon:C8,description:"Insert a LaTeX math expression",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().insertContent("$x=y$").run()}}];function _n({cmd:e}){switch(e.label){case"Heading 1":return(0,X.jsx)("p",{className:"font-bold text-[18px] leading-tight text-foreground/80 truncate",children:"Heading 1"});case"Heading 2":return(0,X.jsx)("p",{className:"font-semibold text-[14px] leading-tight text-foreground/80 truncate",children:"Heading 2"});case"Heading 3":return(0,X.jsx)("p",{className:"font-medium text-[12px] leading-tight text-foreground/80 truncate",children:"Heading 3"});case"Text":return(0,X.jsx)("p",{className:"text-[11px] text-foreground/60 leading-snug",children:"The quick brown fox jumps over the lazy dog."});case"Bullet List":return(0,X.jsxs)("ul",{className:"list-disc pl-4 text-[10px] text-foreground/60 space-y-0.5",children:[(0,X.jsx)("li",{children:"First item"}),(0,X.jsx)("li",{children:"Second item"}),(0,X.jsx)("li",{children:"Third item"})]});case"Numbered List":return(0,X.jsxs)("ol",{className:"list-decimal pl-4 text-[10px] text-foreground/60 space-y-0.5",children:[(0,X.jsx)("li",{children:"First item"}),(0,X.jsx)("li",{children:"Second item"}),(0,X.jsx)("li",{children:"Third item"})]});case"Checklist":return(0,X.jsxs)("div",{className:"space-y-0.5 text-[10px] text-foreground/60",children:[(0,X.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,X.jsx)("span",{className:"w-3 h-3 border border-foreground/30 rounded-sm inline-block shrink-0"}),"Pending task"]}),(0,X.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,X.jsx)("span",{className:"w-3 h-3 border border-foreground/30 rounded-sm bg-foreground/20 inline-block shrink-0"}),"Done task"]})]});case"Code Block":return(0,X.jsx)("pre",{className:"bg-muted rounded px-2 py-1 text-[10px] font-mono text-foreground/70 leading-snug",children:(0,X.jsx)("code",{children:"const x = 42;"})});case"Blockquote":return(0,X.jsx)("div",{className:"border-l-2 border-foreground/30 pl-2 text-[10px] text-foreground/60 italic",children:"A thought worth quoting."});case"Divider":return(0,X.jsx)("hr",{className:"border-foreground/20 w-full"});case"Table":return(0,X.jsxs)("table",{className:"text-[9px] border-collapse w-full",children:[(0,X.jsx)("thead",{children:(0,X.jsx)("tr",{children:["Col A","Col B","Col C"].map(e=>(0,X.jsx)("th",{className:"border border-foreground/20 px-1.5 py-0.5 text-left font-semibold bg-muted/50 text-foreground/70",children:e},e))})}),(0,X.jsx)("tbody",{children:[["1","2","3"],["4","5","6"]].map((e,t)=>(0,X.jsx)("tr",{children:e.map((e,t)=>(0,X.jsx)("td",{className:"border border-foreground/20 px-1.5 py-0.5 text-foreground/50",children:e},t))},t))})]});case"Image":return(0,X.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,X.jsx)(eb,{className:"h-8 w-8 text-foreground/20"}),(0,X.jsx)("span",{className:"text-[10px]",children:"image.png"})]});case"Video":return(0,X.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,X.jsx)(kR,{className:"h-8 w-8 text-foreground/20"}),(0,X.jsx)("span",{className:"text-[10px]",children:"video.mp4"})]});case"File":return(0,X.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,X.jsx)(ed,{className:"h-8 w-8 text-foreground/20"}),(0,X.jsx)("span",{className:"text-[10px]",children:"attachment.pdf"})]});case"Callout":return(0,X.jsxs)("div",{className:"flex items-start gap-1.5 bg-blue-500/10 border border-blue-500/20 rounded px-2 py-1",children:[(0,X.jsx)(C7,{className:"h-3 w-3 text-blue-500 shrink-0 mt-0.5"}),(0,X.jsx)("span",{className:"text-[10px] text-foreground/60",children:"Info callout"})]});case"Warning":return(0,X.jsxs)("div",{className:"flex items-start gap-1.5 bg-yellow-500/10 border border-yellow-500/20 rounded px-2 py-1",children:[(0,X.jsx)(C9,{className:"h-3 w-3 text-yellow-500 shrink-0 mt-0.5"}),(0,X.jsx)("span",{className:"text-[10px] text-foreground/60",children:"Warning callout"})]});case"Math":return(0,X.jsx)("p",{className:"font-mono text-[13px] text-foreground/70",children:"E = mc²"});default:return(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground",children:e.description})}}function _r({editor:e}){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(""),[s,o]=(0,Q.useState)(0),[a,l]=(0,Q.useState)({top:0,left:0}),[c,d]=(0,Q.useState)(null),u=(0,Q.useRef)(null),p=wk(e=>e.currentPath),h=_t.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())||e.description.toLowerCase().includes(r.toLowerCase())),f=(0,Q.useCallback)(()=>{n(!1),i(""),o(0)},[]),m=(0,Q.useCallback)(t=>{if(!e)return;let{from:s}=e.state.selection,o=s-r.length-1;e.chain().focus().deleteRange({from:o,to:s}).run(),"direct"===t.action.type?(t.action.run(e),f()):(d(t.action.kind),n(!1),i(""))},[e,r,f]);if((0,Q.useEffect)(()=>{if(!e)return;let a=a=>{if(!t){if("/"===a.key){let{from:t}=e.state.selection,r=e.state.doc.textBetween(Math.max(0,t-1),t);if(1===t||""===r||"\n"===r||" "===r){let r=e.view.coordsAtPos(t),s=e.view.dom.getBoundingClientRect();l({top:r.bottom-s.top+4,left:r.left-s.left}),n(!0),i(""),o(0)}}return}"Escape"===a.key?(a.preventDefault(),f()):"ArrowDown"===a.key?(a.preventDefault(),o(e=>Math.min(e+1,h.length-1))):"ArrowUp"===a.key?(a.preventDefault(),o(e=>Math.max(e-1,0))):"Enter"===a.key?(a.preventDefault(),h[s]&&m(h[s])):"Backspace"===a.key?0===r.length?f():(i(e=>e.slice(0,-1)),o(0)):" "===a.key?f():1!==a.key.length||a.metaKey||a.ctrlKey||(i(e=>e+a.key),o(0))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[e,t,r,s,h,f,m]),(0,Q.useEffect)(()=>{if(!t)return;let e=e=>{u.current&&!u.current.contains(e.target)&&f()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[t,f]),(!t||0===h.length)&&!c)return null;let g=new Map;for(let e of h){let t=g.get(e.category)??[];t.push(e),g.set(e.category,t)}let b=h[s]??null;return(0,X.jsxs)(X.Fragment,{children:[t&&h.length>0&&(0,X.jsxs)("div",{ref:u,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg overflow-hidden",style:{top:a.top,left:a.left},children:[(0,X.jsx)("div",{className:"max-h-[300px] overflow-y-auto py-1",children:[{key:"basic",title:"Basic"},{key:"media",title:"Media"},{key:"advanced",title:"Advanced"}].map(e=>{let t=g.get(e.key);return t&&0!==t.length?(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-muted-foreground px-3 pt-2 pb-1",children:e.title}),t.map(e=>{let t=h.indexOf(e),n=e.icon,r=t===s;return(0,X.jsxs)("button",{onMouseDown:t=>{t.preventDefault(),m(e)},onMouseEnter:()=>o(t),className:tK("flex items-center gap-3 w-full px-3 py-1.5 text-left transition-colors",r?"bg-accent text-accent-foreground ring-1 ring-inset ring-accent-foreground/10":"hover:bg-accent/50"),children:[(0,X.jsx)(n,{className:tK("h-4 w-4 shrink-0 transition-colors",r?"text-accent-foreground":"text-muted-foreground")}),(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-[12px] font-medium truncate",children:e.label}),(0,X.jsx)("p",{className:tK("text-[10px] truncate transition-colors",r?"text-accent-foreground/70":"text-muted-foreground"),children:e.description})]})]},e.label)})]},e.key):null})}),b&&(0,X.jsx)("div",{className:"border-t border-border bg-muted/30 px-3 py-2 min-h-[52px] flex items-center",children:(0,X.jsx)(_n,{cmd:b})})]}),c&&e?"media"===c.type?p?(0,X.jsx)(kz,{kind:c.kind,pagePath:p,anchor:a,onCancel:()=>d(null),onInsert:t=>((t,n)=>{if(!e)return;let{url:r,alt:i,mimeType:s}=n;"image"===t||(s??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),d(null)})(c.kind,t)}):null:null:null]})}function _i({editor:e,scrollContainerRef:t}){let[n,r]=(0,Q.useState)([]),[i,s]=(0,Q.useState)(null),[o,a]=(0,Q.useState)(!1),[l,c]=(0,Q.useState)(0),d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!e)return;let t=()=>{let t,n;return r((t=[],n=new Map,e.state.doc.forEach((e,r)=>{if("heading"===e.type.name){let i=e.textContent,s=e.attrs.level,o=i.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"")||"heading",a=(n.get(o)??0)+1;n.set(o,a);let l=1===a?o:`${o}-${a}`;t.push({level:s,text:i,pos:r,uid:l})}}),t))};return e.on("update",t),t(),()=>{e.off("update",t)}},[e]),(0,Q.useEffect)(()=>{let e=t.current;if(!e)return;let n=0,r=()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>{let t=e.scrollHeight-e.clientHeight;c(t>0?Math.min(1,e.scrollTop/t):0)})};return e.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",r),cancelAnimationFrame(n)}},[t]),(0,Q.useEffect)(()=>{d.current?.disconnect();let r=t.current;if(!r||!e||0===n.length)return;let i=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){let e=t.target.dataset.outlineId;e&&s(e)}},{root:r,rootMargin:"-8% 0px -72% 0px",threshold:0});for(let t of n)try{let{node:n}=e.view.domAtPos(t.pos+1),r=n.nodeType===Node.ELEMENT_NODE?n.closest("h1,h2,h3,h4,h5,h6")??n:n.parentElement?.closest("h1,h2,h3,h4,h5,h6")??null;r&&(r.dataset.outlineId=t.uid,i.observe(r))}catch{}return d.current=i,()=>{i.disconnect()}},[n,e,t]);let u=(0,Q.useCallback)(t=>{if(e)try{let{node:n}=e.view.domAtPos(t.pos+1),r=n.nodeType===Node.ELEMENT_NODE?n.closest("h1,h2,h3,h4,h5,h6")??n:n.parentElement?.closest("h1,h2,h3,h4,h5,h6")??null;r?.scrollIntoView({behavior:"smooth",block:"start"})}catch{}},[e]),p=n.length>=2,[h,f]=(0,Q.useState)(!1),m=(0,X.jsx)(X.Fragment,{children:n.map((e,t)=>(0,X.jsx)("button",{onClick:()=>{u(e),f(!1)},title:e.text,className:tK("text-left text-[10.5px] leading-snug py-0.5 rounded truncate transition-colors",i===e.uid?"text-primary bg-primary/10 font-medium":"text-muted-foreground/60 hover:text-foreground hover:bg-accent"),style:{paddingLeft:`${(e.level-1)*8+4}px`},children:e.text},`${e.uid}-${t}`))});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{"aria-hidden":!0,className:"absolute top-0 left-0 right-0 h-0.5 z-30 pointer-events-none",children:(0,X.jsx)("div",{className:"h-full bg-primary/35 transition-[width] duration-100 ease-out",style:{width:`${100*l}%`}})}),p&&(0,X.jsxs)("div",{className:"absolute right-1 top-4 z-20 hidden xl:block w-40",children:[(0,X.jsxs)("button",{onClick:()=>a(e=>!e),className:"flex items-center gap-1 mb-1.5 px-1 py-0.5 rounded text-muted-foreground/40 hover:text-muted-foreground hover:bg-accent transition-colors text-[10px]","aria-label":o?"Expand outline":"Collapse outline",children:[(0,X.jsx)(kA,{className:"h-3 w-3"}),!o&&(0,X.jsx)("span",{children:"Outline"})]}),!o&&(0,X.jsx)("nav",{"aria-label":"Document outline",className:"flex flex-col gap-px max-h-[50vh] overflow-y-auto pr-1",children:m})]}),p&&(0,X.jsxs)("div",{className:"absolute right-2 top-2 z-30 xl:hidden",children:[(0,X.jsx)("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-1 px-1.5 py-1 rounded bg-background/80 backdrop-blur border border-border/60 text-muted-foreground/60 hover:text-foreground hover:bg-accent transition-colors text-[10px] shadow-sm","aria-label":"Document outline","aria-expanded":h,children:(0,X.jsx)(kA,{className:"h-3.5 w-3.5"})}),h&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("button",{"aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-0 cursor-default",onClick:()=>f(!1)}),(0,X.jsx)("nav",{"aria-label":"Document outline",className:"absolute right-0 top-9 z-10 w-52 max-h-[60vh] overflow-y-auto flex flex-col gap-px rounded-lg border border-border bg-popover p-2 shadow-lg",children:m})]})]})]})}let _s=en("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);function _o({currentPath:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!1),[s,o]=(0,Q.useState)(!1),a=(e.split("/").pop()??e).replace(/\.md$/i,"");return((0,Q.useEffect)(()=>{if(!a)return;let t=!1;return i(!0),n([]),(async()=>{try{let r=await rK("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a,limit:50})}),i=((r.ok?await r.json():{matches:[]}).matches??[]).filter(t=>t.path!==e&&/\.md$/i.test(t.path)),s=await Promise.all(i.map(async e=>{try{let t,n=await rK(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(!n.ok)return null;let{content:r}=await n.json();if(t=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),!RegExp(`\\[\\[${t}(?:\\|[^\\]#|]+|#[a-z0-9-]+)?\\]\\]`,"i").test(r))return null;return{path:e.path,snippet:e.snippet}}catch{return null}}));if(t)return;n(s.filter(e=>null!==e))}catch{t||n([])}finally{t||i(!1)}})(),()=>{t=!0}},[e,a]),r||0!==t.length)?(0,X.jsx)("div",{className:"max-w-[var(--editor-max-w,48rem)] mx-auto px-4 sm:px-8 pb-8 pt-1",children:(0,X.jsxs)("div",{className:"border-t border-border/60 pt-4",children:[(0,X.jsxs)("button",{onClick:()=>o(e=>!e),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60 hover:text-muted-foreground transition-colors mb-2","aria-expanded":!s,children:[s?(0,X.jsx)(ea,{className:"h-3 w-3 shrink-0"}):(0,X.jsx)(eo,{className:"h-3 w-3 shrink-0"}),(0,X.jsx)(_s,{className:"h-3 w-3 shrink-0"}),(0,X.jsx)("span",{className:"font-medium",children:"Linked from"}),t.length>0&&(0,X.jsxs)("span",{className:"opacity-50 tabular-nums",children:["(",t.length,")"]}),r&&(0,X.jsx)("span",{className:"opacity-40 ml-1",children:"…"})]}),!s&&t.length>0&&(0,X.jsx)("ul",{className:"flex flex-col gap-1.5",children:t.map(e=>{var t;let n;return(0,X.jsxs)("li",{className:"flex flex-col",children:[(0,X.jsx)("button",{onClick:()=>wk.getState().loadPage(e.path),className:"text-left text-[12px] text-primary/70 hover:text-primary hover:underline underline-offset-2 truncate transition-colors",title:e.path,children:(n=(t=e.path).replace(/\.md$/i,"").split("/")).length>1?n.slice(-2).join(" / "):n[0]??t}),e.snippet&&(0,X.jsx)("p",{className:"text-[10.5px] text-muted-foreground/50 line-clamp-1 mt-0.5",children:e.snippet})]},e.path)})})]})}):null}let _a=en("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),_l=en("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),_c=en("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),_d=en("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),_u=en("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),_p=en("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),_h=en("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),_f=en("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);function _m({label:e,icon:t,disabled:n,active:r,danger:i,onAction:s}){return(0,X.jsx)("button",{type:"button","aria-label":e,title:e,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),s()},className:tK("h-7 w-7 inline-flex items-center justify-center rounded text-foreground/80 hover:bg-accent transition-colors disabled:pointer-events-none disabled:opacity-35",r&&"bg-accent text-foreground",i&&"text-destructive hover:bg-destructive/10"),children:(0,X.jsx)(t,{className:"h-3.5 w-3.5"})})}function _g(){return(0,X.jsx)("div",{className:"mx-1 h-5 w-px bg-border"})}function _b({editor:e}){if(!e)return null;let t=()=>{if(!lw(e.state))return null;try{return lz(e.state)}catch{return null}},n=t=>{t()&&(e.commands.focus(),e.commands.fixTables())},r=n=>{let r=t();if(!r)return;let i=r.top,s=i+n;if(!(s<0)&&!(s>=r.map.height)){var o;(o={from:i,to:s},(e,t)=>{let{from:n,to:r,select:i=!0,pos:s=e.selection.from}=o,a=e.tr;return!!function(e){var t,n,r,i,s;let o,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,p=lj(a.doc.resolve(u));if(!p)return!1;let h=null==(t=lH(a,l))?void 0:t.indexes,f=null==(n=lH(a,c))?void 0:n.indexes;if(!h||!f||h.includes(c))return!1;let m=(r=p.node,i=h,s=f,o=lD(r),lR(r,o=lL(o,i,s,0)));if(a.replaceWith(p.pos,p.pos+p.node.nodeSize,m),!d)return!0;let g=lb.get(m),b=p.start,y=g.positionAt(c,g.width-1,m),x=a.doc.resolve(b+y),v=g.positionAt(c,0,m),w=a.doc.resolve(b+v);return a.setSelection(lC.rowSelection(x,w)),!0}({tr:a,originIndex:n,targetIndex:r,select:i,pos:s})&&(null==t||t(a),!0)})(e.state,e.view.dispatch),e.commands.focus()}},i=n=>{let r=t();if(!r)return;let i=r.left,s=i+n;if(!(s<0)&&!(s>=r.map.width)){var o;(o={from:i,to:s},(e,t)=>{let{from:n,to:r,select:i=!0,pos:s=e.selection.from}=o,a=e.tr;return!!function(e){var t,n,r,i,s;let o,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,p=lj(a.doc.resolve(u));if(!p)return!1;let h=null==(t=lF(a,l))?void 0:t.indexes,f=null==(n=lF(a,c))?void 0:n.indexes;if(!h||!f||h.includes(c))return!1;let m=(r=p.node,i=h,s=f,o=lU(lD(r)),lR(r,o=lU(o=lL(o,i,s,0))));if(a.replaceWith(p.pos,p.pos+p.node.nodeSize,m),!d)return!0;let g=lb.get(m),b=p.start,y=g.positionAt(g.height-1,c,m),x=a.doc.resolve(b+y),v=g.positionAt(0,c,m),w=a.doc.resolve(b+v);return a.setSelection(lC.colSelection(x,w)),!0}({tr:a,originIndex:n,targetIndex:r,select:i,pos:s})&&(null==t||t(a),!0)})(e.state,e.view.dispatch),e.commands.focus()}},s=t(),o=!!s&&s.top>0,a=!!s&&s.top<s.map.height-1,l=!!s&&s.left>0,c=!!s&&s.left<s.map.width-1;return(0,X.jsxs)(kr,{editor:e,pluginKey:"tableMenu",options:{placement:"top",offset:10},shouldShow:({editor:e})=>e.isActive("table"),className:"flex items-center gap-0.5 rounded-md border border-border bg-popover px-1 py-1 shadow-lg",children:[(0,X.jsx)(_m,{label:"Select cell text",icon:_e,onAction:()=>{let t=lv(e.state.selection.$from),n=t?.nodeAfter;t&&n&&e.chain().focus().setTextSelection({from:t.pos+1,to:t.pos+n.nodeSize-1}).run()}}),(0,X.jsx)(_g,{}),(0,X.jsx)(_m,{label:"Add row above",icon:_f,onAction:()=>n(()=>e.chain().focus().addRowBefore().run())}),(0,X.jsx)(_m,{label:"Add row below",icon:_a,onAction:()=>n(()=>e.chain().focus().addRowAfter().run())}),(0,X.jsx)(_m,{label:"Move row up",icon:_d,disabled:!o,onAction:()=>r(-1)}),(0,X.jsx)(_m,{label:"Move row down",icon:_a,disabled:!a,onAction:()=>r(1)}),(0,X.jsx)(_m,{label:"Delete row",icon:eO,danger:!0,onAction:()=>n(()=>e.chain().focus().deleteRow().run())}),(0,X.jsx)(_g,{}),(0,X.jsx)(_m,{label:"Add column before",icon:_u,onAction:()=>n(()=>e.chain().focus().addColumnBefore().run())}),(0,X.jsx)(_m,{label:"Add column after",icon:_c,onAction:()=>n(()=>e.chain().focus().addColumnAfter().run())}),(0,X.jsx)(_m,{label:"Move column left",icon:_l,disabled:!l,onAction:()=>i(-1)}),(0,X.jsx)(_m,{label:"Move column right",icon:_c,disabled:!c,onAction:()=>i(1)}),(0,X.jsx)(_m,{label:"Delete column",icon:eO,danger:!0,onAction:()=>n(()=>e.chain().focus().deleteColumn().run())}),(0,X.jsx)(_g,{}),(0,X.jsx)(_m,{label:"Toggle header row",icon:_h,onAction:()=>n(()=>e.chain().focus().toggleHeaderRow().run())}),(0,X.jsx)(_m,{label:"Toggle header column",icon:_p,onAction:()=>n(()=>e.chain().focus().toggleHeaderColumn().run())}),(0,X.jsx)(_g,{}),(0,X.jsx)(_m,{label:"Delete table",icon:eO,danger:!0,onAction:()=>e.chain().focus().deleteTable().run()})]})}let _y=Q.forwardRef(({className:e,type:t,...n},r)=>(0,X.jsx)("input",{type:t,className:tK("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:r,...n}));_y.displayName="Input";var _x=Q.forwardRef((e,t)=>(0,X.jsx)(kL.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));_x.displayName="Label";let _v=eV("text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50"),_w=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(_x,{ref:n,className:tK(_v(),e),...t}));_w.displayName=_x.displayName;let _E=["entities","concepts","comparisons"],_k=/^[a-z0-9-]+$/;function _T({editor:e,onCreateRequest:t}){let[n,r]=(0,Q.useState)(!1),[i,s]=(0,Q.useState)(""),[o,a]=(0,Q.useState)(0),[l,c]=(0,Q.useState)({top:0,left:0}),d=(0,Q.useRef)(null),u=(0,Q.useRef)(0),p=wO(e=>e.slugs),h=wO(e=>e.slugDir),f=wO(e=>e.has),m=Array.from(p).sort().filter(e=>!i||e.includes(i.toLowerCase())).slice(0,20),g=i.length>0&&_k.test(i)&&!f(i),b=m.length+ +!!g,y=(0,Q.useCallback)(()=>{r(!1),s(""),a(0)},[]),x=(0,Q.useCallback)(t=>{if(!e)return;let{from:n}=e.state.selection,r=u.current-2,i=e.state.schema.marks.wikiLink;if(!i)return;let s=i.create({slug:t,alias:null,anchor:null}),o=e.state.schema.text(t,[s]),a=e.state.tr.replaceWith(r,n,o);e.view.dispatch(a),e.commands.focus(),y()},[e,y]),v=(0,Q.useCallback)(async n=>{if(e){if(n<m.length)x(m[n]??"");else if(g){let e=await t(i);e.ok?x(e.slug):y()}}},[e,m,g,i,x,t,y]);return((0,Q.useEffect)(()=>{if(!e)return;let t=t=>{if(!n){if("["===t.key){let{from:t}=e.state.selection;if("["!==e.state.doc.textBetween(Math.max(0,t-1),t)||e.state.doc.resolve(t).marks().some(e=>"wikiLink"===e.type.name))return;let n=e.view.coordsAtPos(t),i=e.view.dom.getBoundingClientRect();c({top:n.bottom-i.top+4,left:n.left-i.left}),u.current=t+1,r(!0),s(""),a(0)}return}"ArrowDown"===t.key?(t.preventDefault(),a(e=>b>0?(e+1)%b:0)):"ArrowUp"===t.key?(t.preventDefault(),a(e=>b>0?(e-1+b)%b:0)):"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),b>0&&v(o)):"Escape"===t.key||"]"===t.key?y():"Backspace"===t.key?0===i.length?y():(s(e=>e.slice(0,-1)),a(0)):1!==t.key.length||t.metaKey||t.ctrlKey||(s(e=>e+t.key),a(0))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,n,i,o,b,y,v]),(0,Q.useEffect)(()=>{if(!n)return;let e=e=>{d.current&&!d.current.contains(e.target)&&y()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[n,y]),n&&0!==b)?(0,X.jsxs)("div",{ref:d,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg py-1 overflow-hidden max-h-[300px] overflow-y-auto",style:{top:l.top,left:l.left},children:[m.map((e,t)=>{let n=h.get(e);return(0,X.jsxs)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),v(t)},onMouseEnter:()=>a(t),className:tK("flex items-center justify-between w-full px-3 py-1.5 text-left text-sm transition-colors",t===o?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[(0,X.jsx)("span",{className:"truncate",children:e}),n&&(0,X.jsx)("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:n})]},e)}),g&&(0,X.jsx)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),v(m.length)},onMouseEnter:()=>a(m.length),className:tK("flex items-center w-full px-3 py-1.5 text-left text-sm transition-colors",m.length===o?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:(0,X.jsxs)("span",{className:"text-muted-foreground",children:["+ Create new “",i,"”"]})})]}):null}let _N=eV("inline-flex items-center rounded-sm border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-e-1",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-e-1",outline:"text-foreground",accent:"border-transparent bg-accent text-accent-foreground"}},defaultVariants:{variant:"default"}});function _A({className:e,variant:t,...n}){return(0,X.jsx)("div",{className:tK(_N({variant:t}),e),...n})}let _S=new Set(["title","type","status","created","updated","date","tags","sources","private","supersedes","superseded_by"]);function _C({data:e}){let[t,n]=(0,Q.useState)(!1),r=Object.keys(e);if(0===r.length)return null;let i="string"==typeof e.title?e.title:null,s="string"==typeof e.type?e.type:null,o="string"==typeof e.status?e.status:null,a="string"==typeof e.created?e.created:null,l="string"==typeof e.updated?e.updated:null,c=!0===e.private,d=Array.isArray(e.tags)?e.tags:[],u=Array.isArray(e.sources)?e.sources:[],p="string"==typeof e.superseded_by?e.superseded_by:null,h=r.filter(e=>!_S.has(e));return(0,X.jsxs)("div",{className:"mb-6 rounded-sm border bg-card/40 px-4 py-3 text-xs",children:[i&&(0,X.jsx)("div",{className:"mb-2 text-base font-normal text-foreground",children:i}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-muted-foreground",children:[s&&(0,X.jsx)(_A,{variant:"outline",className:"font-normal",children:s}),o&&(0,X.jsx)(_A,{variant:"outline",className:"font-normal",children:o}),c&&(0,X.jsx)(_A,{variant:"outline",className:"border-warning-ink/40 font-normal text-warning-ink",children:"private"}),p&&(0,X.jsxs)(_A,{variant:"outline",className:"border-destructive/40 font-normal text-destructive",children:["superseded → ",p]}),a&&(0,X.jsxs)("span",{children:[(0,X.jsx)("span",{className:"opacity-60",children:"created"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:a})]}),l&&l!==a&&(0,X.jsxs)("span",{children:[(0,X.jsx)("span",{className:"opacity-60",children:"updated"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:l})]})]}),d.length>0&&(0,X.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:d.map(e=>(0,X.jsxs)(_A,{variant:"secondary",className:"font-normal text-[11px]",children:["#",e]},e))}),u.length>0&&(0,X.jsxs)("div",{className:"mt-2",children:[(0,X.jsx)("span",{className:"opacity-60",children:"sources:"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:u.join(", ")})]}),h.length>0&&(0,X.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,X.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[t?(0,X.jsx)(eo,{className:"h-3 w-3"}):(0,X.jsx)(ea,{className:"h-3 w-3"}),(0,X.jsxs)("span",{children:[h.length," more field",1===h.length?"":"s"]})]}),t&&(0,X.jsx)("dl",{className:"mt-1.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5",children:h.map(t=>(0,X.jsxs)(Q.Fragment,{children:[(0,X.jsx)("dt",{className:"opacity-60",children:t}),(0,X.jsx)("dd",{className:"text-foreground/80 break-words",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(e).join(", ");try{return JSON.stringify(t)}catch{return String(t)}}(e[t])})]},t))})]})]})}async function __(e,t){let n=new FormData;n.append("file",t);try{let r=await rK(`/api/upload/${e}`,{method:"POST",body:n});if(!r.ok)return wB(`Upload failed: ${t.name}`),null;return(await r.json()).url}catch{return wB(`Upload failed: ${t.name}`),null}}function _M(e){let t=[];for(let n of e)t.push({path:n.path,name:n.name}),n.children&&t.push(..._M(n.children));return t}function _O(e,t,n){let r=_M(n).filter(t=>t.name===e||t.path.endsWith(`/${e}`));if(0===r.length)return null;if(1===r.length)return r[0].path;if(t){let n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",i=r.find(t=>t.path===(n?`${n}/${e}`:e));if(i)return i.path}return r[0].path}function _I(e,t,n){let r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),wk.getState().loadPage(e),setTimeout(()=>{document.querySelector("[data-editor-scroll]")?.scrollTo(0,0)},0)}function _D({mode:e}={}){let{currentPath:t,content:n,saveStatus:r,frontmatter:i,isLoading:s,loadStatus:o,createMissingPage:a,editMode:l,setEditMode:c}=wk(),d=e??l,u="viewing"===d,p="suggesting"===d,h=(0,Q.useMemo)(()=>u?function(e){let t=wa.exec(e);if(!t)return{data:{},body:e};let n=t[1],r=e.slice(t[0].length),i=n.split(/\r?\n/).find(e=>""!==e.trim())??"";if(/^\s*(#{1,6}\s|<|>|-\s|\*\s|\d+\.\s)/.test(i))return{data:{},body:e};let s={},o=n.split(/\r?\n/),a=0;for(;a<o.length;){let e=o[a];if(!e||/^\s*#/.test(e)){a+=1;continue}let t=/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(e);if(!t){a+=1;continue}let n=t[1],r=t[2];if(""===r.trim()){let e=[],t=a+1;for(;t<o.length&&/^\s+-\s+/.test(o[t]);){let n=/^\s+-\s+(.*)$/.exec(o[t]);n&&e.push(wl(n[1])),t+=1}if(e.length>0){s[n]=e,a=t;continue}s[n]="",a+=1;continue}s[n]=wl(r),a+=1}return 0===Object.keys(s).length?{data:{},body:e}:{data:s,body:r}}(n):{data:{},body:n},[n,u]),f=wT(e=>e.nodes),m=wM(e=>wS[e.width]),g=u?"rtl"===h.data.dir:i?.dir==="rtl",{open:b,clearMessages:y}=wp(),{open:x,Dialog:v}=function(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)({slug:"",dir:"entities",title:""}),[i,s]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),a=(0,Q.useCallback)(e=>(r({slug:e,dir:"entities",title:e.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}),t(!0),new Promise(e=>{o.current=e})),[]),l=(0,Q.useCallback)(()=>{t(!1),o.current?.({ok:!1,slug:n.slug}),o.current=null},[n.slug]),c=(0,Q.useCallback)(async()=>{let{slug:e,dir:r,title:i}=n;s(!0);try{let n=await rK("/api/wiki/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,dir:r,title:i.trim()||void 0})});if(n.ok||409===n.status){let n=wO.getState();n.invalidate(),n.load(),t(!1),o.current?.({ok:!0,slug:e,dir:r}),o.current=null}else{let e=await n.json().catch(()=>({})),t=null!==e&&"object"==typeof e&&"error"in e&&"string"==typeof e.error?e.error:"Failed to create page";wB(t)}}catch{wB("Failed to create page")}finally{s(!1)}},[n]);return{open:a,Dialog:(0,X.jsx)(rl,{open:e,onOpenChange:e=>{e||l()},children:(0,X.jsxs)(rj,{children:[(0,X.jsx)(rP,{children:(0,X.jsx)(rF,{children:"Create wiki page"})}),(0,X.jsxs)("div",{className:"space-y-4 py-2",children:[(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_w,{htmlFor:"wiki-create-slug",children:"Slug"}),(0,X.jsx)(_y,{id:"wiki-create-slug",value:n.slug,readOnly:!0,className:"bg-muted cursor-default select-all"})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_w,{children:"Directory"}),(0,X.jsx)("div",{className:"flex gap-4",children:_E.map(e=>(0,X.jsxs)("label",{className:"flex items-center gap-1.5 text-sm cursor-pointer",children:[(0,X.jsx)("input",{type:"radio",name:"wiki-create-dir",value:e,checked:n.dir===e,onChange:()=>r(t=>({...t,dir:e})),className:"accent-primary"}),e]},e))})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_w,{htmlFor:"wiki-create-title",children:"Title (optional)"}),(0,X.jsx)(_y,{id:"wiki-create-title",value:n.title,onChange:e=>r(t=>({...t,title:e.target.value})),placeholder:"Humanized title..."})]})]}),(0,X.jsxs)(rB,{children:[(0,X.jsx)(tX,{variant:"outline",onClick:l,disabled:i,children:"Cancel"}),(0,X.jsx)(tX,{onClick:()=>void c(),disabled:i,children:i?"Creating...":"Create"})]})]})})}}(),w=(0,Q.useRef)(x);w.current=x;let E=(0,Q.useRef)(!1),k=(0,Q.useRef)(u);k.current=u;let[T,N]=(0,Q.useState)(!1),[A,S]=(0,Q.useState)(""),[C,_]=(0,Q.useState)("page");(0,Q.useEffect)(()=>{_("page")},[]),(0,Q.useEffect)(()=>{wO.getState().load()},[]),(0,Q.useEffect)(()=>{t&&wD.getState().loadSidecar(t)},[t]),(0,Q.useEffect)(()=>{if(!t||u||!/\.(md|markdown)$/i.test(t))return;let e=e=>{rK("/api/wiki/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,action:e}),keepalive:"close"===e}).catch(()=>{})};e("open");let n=setInterval(()=>e("heartbeat"),3e4),r=()=>{"hidden"===document.visibilityState&&e("heartbeat")};return document.addEventListener("visibilitychange",r),()=>{clearInterval(n),document.removeEventListener("visibilitychange",r),e("close")}},[t,u]),(0,Q.useEffect)(()=>{let e=new EventSource(rW("/api/wiki/watch"));return e.onmessage=e=>{try{let t=JSON.parse(e.data),n=wk.getState().currentPath;("change"===t.type||"add"===t.type)&&n&&t.path===n&&(wD.getState().loadSnapshot(n).then(()=>wD.getState().loadSidecar(n)),k.current&&wk.getState().loadPage(n))}catch{}},()=>{e.close()}},[]);let[M,O]=(0,Q.useState)(null),I=(0,Q.useRef)(null),[D,R]=(0,Q.useState)(new Map),L=wD(e=>t?e.byPath[t]?.snapshotBlocks:void 0),j=wD(e=>t?e.byPath[t]?.sidecar?.suggestions:void 0),P=wD(e=>t?e.byPath[t]?.snapshotRevision??0:0),B=wD(e=>t?e.byPath[t]?.sidecar?.comments:void 0),F=(0,Q.useMemo)(()=>L??[],[L]),H=(0,Q.useMemo)(()=>B??[],[B]),U=(0,Q.useMemo)(()=>j?.filter(e=>"pending"===e.status)??[],[j]),z=(0,Q.useMemo)(()=>{let e={};for(let t of H)(e[t.ref]??=[]).push(t);return e},[H]),[$,G]=(0,Q.useState)(null),[q,V]=(0,Q.useState)(null),W=(0,Q.useCallback)(()=>{if(!eo.current)return null;let e=eo.current.view,{from:t}=e.state.selection,n=wk.getState().currentPath??"",r=wD.getState().byPath[n]?.snapshotBlocks??[],i=e.state.doc.resolve(t),s=i.depth>0?i.index(0):0,o=I.current?.querySelector(".ProseMirror"),a=(o?Array.from(o.children):[])[s]??null,l=r[s],c=l?.ref??a?.getAttribute("data-block-ref")??null,d=l?.markdown??"";if(!c&&a){let n=e.domAtPos(t),r=n.node.nodeType===Node.ELEMENT_NODE?n.node:n.node.parentElement,i=r?.closest("[data-block-ref]")??null;c=i?.getAttribute("data-block-ref")??null}return c&&a?{blockRef:c,blockEl:a,markdown:d}:null},[]),K=(0,Q.useCallback)(()=>{let e=W();if(!e)return;let t=e.blockEl.getBoundingClientRect();V({blockRef:e.blockRef,markdown:e.markdown,anchor:{top:t.bottom+4,left:t.left}})},[W]),Y=(0,Q.useCallback)(()=>{let e=W();e&&G({blockRef:e.blockRef,el:e.blockEl})},[W]),J=(0,Q.useRef)(!1),Z=(0,Q.useRef)(!1),ee=(0,Q.useRef)(null),et=e=>e.replace(/\s+$/g,"").trimStart(),en=(0,Q.useCallback)(async()=>{if(Z.current||k.current||"suggesting"!==wk.getState().editMode||!J.current)return;let e=eo.current,t=wk.getState().currentPath;if(!e||!t)return;let n=I.current?.querySelector(".ProseMirror");if(!n)return;let r=Array.from(n.children),i=wD.getState().byPath[t]?.snapshotBlocks??[];if(0!==i.length){Z.current=!0,J.current=!1;try{let n=()=>wD.getState().byPath[t]?.snapshotRevision??0,s=async()=>{await wD.getState().loadSnapshot(t),await wD.getState().loadSidecar(t)},o=Math.max(r.length,i.length),a=!1;for(let e=0;e<o;e++){let o=r[e],l=i[e],c=o?wo(o.outerHTML).trim():null;if(l&&null!==c){if(et(c)!==et(l.markdown)){let e=await wL({path:t,ref:l.ref,kind:"replace",markdown:c,getRevision:n,refresh:s});a=a||e}}else if(l&&null===c){let e=await wL({path:t,ref:l.ref,kind:"delete",getRevision:n,refresh:s});a=a||e}else if(!l&&null!==c&&c.length>0){let e=i[i.length-1]?.ref;if(e){let r=await wL({path:t,ref:e,kind:"insertAfter",markdown:c,getRevision:n,refresh:s});a=a||r}}}if(a){await s();let n=(wD.getState().byPath[t]?.snapshotBlocks??i).map(e=>e.markdown).join("\n\n");E.current=!0;let r=await vA(n,t);e.commands.setContent(r),setTimeout(()=>{E.current=!1},50)}}finally{Z.current=!1}}},[]);(0,Q.useEffect)(()=>{t&&wD.getState().loadSnapshot(t)},[t]),(0,Q.useEffect)(()=>{if(!t||0===F.length||!I.current)return;let e=I.current,n=e.querySelector(".ProseMirror");if(!n)return;let r=Array.from(n.children),i=e.getBoundingClientRect(),s=new Map;for(let t=0;t<Math.min(r.length,F.length);t++){let n=r[t],o=F[t];n.setAttribute("data-block-ref",o.ref);let a=n.getBoundingClientRect();s.set(o.ref,{top:a.top-i.top+e.scrollTop,left:a.left-i.left,width:a.width,bottom:a.bottom-i.top+e.scrollTop})}R(s)},[t,F]);let ei=function(e={},t=[]){let n=(0,cu.useRef)(e);n.current=e;let[r]=(0,cu.useState)(()=>new pZ(n)),i=(0,cp.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,cu.useDebugValue)(i),(0,cu.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,cu.useState)(()=>new pX(e.editor)),r=(0,pG.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:pz);pY(()=>n.watch(e.editor),[e.editor,n]),(0,cu.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({extensions:S0,content:"",editable:!u,onUpdate:(0,Q.useCallback)(({editor:e})=>{if(E.current||k.current||!e)return;"suggesting"===wk.getState().editMode&&(J.current=!0);let t=wo(e.getHTML());wk.getState().updateContent(t)},[]),onBlur:()=>{en()},onSelectionUpdate:({editor:e})=>{if("suggesting"!==wk.getState().editMode)return;let{from:t}=e.state.selection,n=e.state.doc.resolve(t),r=n.depth>0?n.index(0):0,i=ee.current;ee.current=r,null!==i&&i!==r&&J.current&&en()},editorProps:{attributes:{class:"focus:outline-none min-h-[calc(100vh-12rem)] px-4 sm:px-8 py-6 max-w-[var(--editor-max-w,48rem)] mx-auto"},handleKeyDown:(e,t)=>{if((t.metaKey||t.ctrlKey)&&"a"===t.key.toLowerCase()&&lw(e.state)){let n=lv(e.state.selection.$from),r=n?.nodeAfter;if(!n||!r)return!1;let i=n.pos+1,s=n.pos+r.nodeSize-1;return(e.state.selection.from!==i||e.state.selection.to!==s)&&(t.preventDefault(),ei?.chain().focus().setTextSelection({from:i,to:s}).run(),!0)}return!1},handleClick:(e,t,n)=>{let r=n.target.closest("a");if(!r)return!1;let i=r.getAttribute("href");if(!i)return!1;if("true"===r.dataset.wikiLink){n.preventDefault(),n.stopPropagation();let e=r.dataset.slug??"",t=r.dataset.anchor??null;if(!e)return!0;let i=wO.getState();if(i.has(e)){let n=i.getDir(e),r=null===n||"root"===n?`${e}.md`:`${n}/${e}.md`;wk.getState().loadPage(r),t&&setTimeout(()=>{document.querySelector(`[id="${t}"]`)?.scrollIntoView({behavior:"smooth"})},200)}else{if(k.current)return!0;w.current(e).then(e=>{if(e.ok){let t=e.dir??"entities",n=`${t}/${e.slug}.md`;wk.getState().loadPage(n)}})}return!0}if(i.startsWith("#page:")){n.preventDefault(),n.stopPropagation();let e=i.replace("#page:",""),{nodes:t,selectPage:r,expandPath:s}=wT.getState(),o=_O(e,wk.getState().currentPath,t);return o&&_I(o,r,s),!0}if(/^https?:\/\//.test(i)||i.startsWith("/api/")||i.startsWith("mailto:")||i.startsWith("tel:"))return!1;n.preventDefault(),n.stopPropagation();let{nodes:s,selectPage:o,expandPath:a}=wT.getState(),l=function(e,t,n){let r=_M(n),i=e.replace(/\.md$/,"").replace(/^\.\//,"").replace(/^\//,""),s=r.find(e=>e.path===i);if(s)return s.path;if(t){let e=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",n=e?`${e}/${i}`:i,s=r.find(e=>e.path===n);if(s)return s.path}return _O(i.includes("/")?i.split("/").pop():i,t,n)}(i,wk.getState().currentPath,s);return l&&_I(l,o,a),!0},handlePaste:(e,t)=>{if(k.current)return!1;let n=t.clipboardData?.files,r=wk.getState().currentPath;if(n&&n.length>0&&r){for(let e of Array.from(n))__(r,e).then(t=>{t&&ei&&(e.type.startsWith("image/")?ei.chain().focus().setImage({src:t,alt:e.name}).run():ei.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}return!1},handleDrop:(e,t)=>{if(k.current)return!1;let n=t.dataTransfer?.files;if(!n||0===n.length)return!1;let r=wk.getState().currentPath;if(!r)return!1;for(let e of(t.preventDefault(),Array.from(n)))__(r,e).then(t=>{t&&ei&&(e.type.startsWith("image/")?ei.chain().focus().setImage({src:t,alt:e.name}).run():ei.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}},immediatelyRender:!1}),eo=(0,Q.useRef)(ei);eo.current=ei,(0,Q.useEffect)(()=>{ei?.setEditable(!u),u&&N(!1)},[ei,u]);let ea=(0,Q.useRef)(null),el=(0,Q.useRef)(null),[ec,ed]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!ei||null===t||wk.getState().isDirty&&t===ea.current||s&&""===n)return;let e=h.body,r=`${t} ${e}`;if(el.current===r){ec!==t&&ed(t);return}ea.current=t,(async()=>{E.current=!0;let n=await vA(e,u?{pagePath:t,sanitize:!0}:t);ei.commands.setContent(n),el.current=r,ed(t),setTimeout(()=>{E.current=!1},50)})()},[ei,n,t,s,ec,h.body,u]),(0,Q.useEffect)(()=>{if(!u||!ec)return;let e=I.current;e&&e.querySelectorAll('input[type="checkbox"]').forEach(e=>{e.disabled=!0})},[u,ec,h.body]);let ep=null!==t&&(s||ec!==t);if(null===t)return(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,X.jsxs)("div",{className:"text-center space-y-3",children:[(0,X.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em]",children:"No page selected"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground/70",children:"Select a page from the sidebar or create a new one"})]})});if("missing"===o){let e=(t.split("/").pop()||t).replace(/[-_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),n=hn(f,t),r=n?.children??[],i=r.length>0;return(0,X.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,X.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-10 space-y-6",children:[(0,X.jsxs)("div",{className:"space-y-3",children:[(0,X.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em] text-foreground",children:e}),(0,X.jsxs)("p",{className:"text-sm text-muted-foreground/80",children:["This folder doesn't have an"," ",(0,X.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-[12px]",children:"index.md"}),i?" yet — its contents are listed below.":" yet."]}),(0,X.jsxs)("button",{onClick:()=>void a(e),className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[13px] font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[(0,X.jsx)(eu,{className:"h-3.5 w-3.5"}),"Create page"]})]}),i&&(0,X.jsx)(Cn,{folderPath:t,entries:r},t)]})})}let eh=async()=>{if(T){if(wk.getState().updateContent(A),ei){E.current=!0;let e=await vA(A,t??void 0);ei.commands.setContent(e),setTimeout(()=>{E.current=!1},50)}N(!1)}else S(wk.getState().content),N(!0)},ef=hn(f,t),em=ef?.type==="directory"||ef?.type==="cabinet"?ef.children??[]:[],eg=em.length>0,eb=eg&&"files"===C;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[eg&&(0,X.jsxs)("div",{className:"flex items-center gap-1 px-3 pt-2 border-b border-border",children:[(0,X.jsx)("button",{onClick:()=>_("page"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"page"===C?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"page"===C,children:"Page"}),(0,X.jsxs)("button",{onClick:()=>_("files"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"files"===C?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"files"===C,children:["Files",(0,X.jsx)("span",{className:"ml-1.5 text-muted-foreground/60",children:em.length})]})]}),eb?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,X.jsx)("div",{className:"max-w-3xl mx-auto px-6 py-6",children:(0,X.jsx)(Cn,{folderPath:t,entries:em},t)})}):(0,X.jsxs)(X.Fragment,{children:[!u&&(0,X.jsxs)("div",{className:"flex items-center min-w-0",children:[(0,X.jsx)("div",{className:"flex-1 min-w-0",children:!T&&(0,X.jsx)(kG,{editor:ei})}),(0,X.jsxs)("button",{onClick:eh,className:`flex items-center gap-1.5 px-3 py-1 mr-2 text-[11px] rounded-md transition-colors border border-border ${T?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,X.jsx)(rz,{className:"h-3 w-3"}),T?"Preview":"Markdown"]})]}),T?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto p-4",dir:g?"rtl":void 0,children:(0,X.jsx)("textarea",{value:A,onChange:e=>S(e.target.value),className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,X.jsxs)("div",{className:"flex-1 relative",dir:g?"rtl":void 0,children:[p&&(0,X.jsx)("div",{className:"absolute top-0 inset-x-0 z-20 flex items-center justify-center gap-2 px-3 py-1 bg-primary/10 border-b border-primary/20 text-[11px] text-primary pointer-events-none",children:"Suggesting mode · your edits become suggestions for review"}),(0,X.jsx)(_i,{editor:ei,scrollContainerRef:I}),(0,X.jsxs)("div",{ref:I,className:`absolute inset-0 overflow-y-auto ${p?"pt-7":""}`,style:{"--editor-max-w":m},"data-editor-scroll":!0,children:[(0,X.jsxs)("div",{"aria-hidden":"true",className:"relative pointer-events-none",style:{height:0},children:[Object.entries(z).map(([e,t])=>{let n=D.get(e);return n?(0,X.jsx)("div",{style:{pointerEvents:"auto"},children:(0,X.jsx)(Ci,{blockRef:e,comments:t,top:n.top+4,left:Math.max(0,n.left-20),onClick:()=>{let t=I.current?.querySelector(`[data-block-ref="${e}"]`);t&&G({blockRef:e,el:t})}})},`pip-${e}`):null}),t&&U.map(e=>{let n=D.get(e.ref),r=F.find(t=>t.ref===e.ref);if(!n||!r)return null;let i="insertAfter"===e.kind?n.bottom+4:"insertBefore"===e.kind?Math.max(0,n.top-80):n.top;return(0,X.jsx)("div",{style:{pointerEvents:"auto"},children:(0,X.jsx)(C3,{path:t,suggestion:e,currentMarkdown:r.markdown,baseRevision:P,getLatestRevision:()=>wD.getState().byPath[t]?.snapshotRevision??0,top:i,left:n.left,width:n.width,onSettled:()=>{wD.getState().loadSidecar(t),wD.getState().loadSnapshot(t)}})},`sug-${e.id}`)})]}),$&&t&&(0,X.jsx)(C0,{path:t,blockRef:$.blockRef,comments:z[$.blockRef]??[],anchorEl:$.el,onClose:()=>G(null)}),q&&t&&(0,X.jsx)(C6,{path:t,blockRef:q.blockRef,currentMarkdown:q.markdown,anchor:q.anchor,onClose:()=>V(null)}),u&&Object.keys(h.data).length>0&&(0,X.jsx)("div",{className:"max-w-[var(--editor-max-w,48rem)] mx-auto px-4 sm:px-8 pt-6",children:(0,X.jsx)(_C,{data:h.data})}),(0,X.jsx)(pK,{editor:ei}),t&&/\.(md|markdown)$/i.test(t)&&(0,X.jsx)(_o,{currentPath:t}),(0,X.jsx)("div",{"aria-hidden":"true",className:"contents",onMouseOver:e=>{let t=e.target.closest(".proof-span");t&&t!==M&&O(t)},onMouseOut:e=>{let t=e.relatedTarget;t?.closest(".proof-span")||O(null)}}),t&&(0,X.jsx)(C1,{targetEl:M,path:t,onClose:()=>O(null),onComment:()=>{if(!M)return;let e=M.closest("[data-block-ref]");if(!e)return;let t=e.getAttribute("data-block-ref");t&&G({blockRef:t,el:e})}}),!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(kx,{editor:ei,onSuggestEdit:K,onComment:Y}),(0,X.jsx)(_b,{editor:ei}),(0,X.jsx)(_r,{editor:ei}),(0,X.jsx)(_T,{editor:ei,onCreateRequest:w.current})]}),(0,X.jsxs)("div",{className:"max-w-[var(--editor-max-w,48rem)] mx-auto px-8 pb-8 flex items-center gap-4",children:[(0,X.jsxs)("button",{onClick:()=>{y(),b()},className:"group flex items-center gap-2 text-[13px] text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-pointer",children:[(0,X.jsx)(ht,{className:"h-3.5 w-3.5 group-hover:text-primary transition-colors"}),(0,X.jsx)("span",{children:"Edit with AI"})]}),!u&&(0,X.jsxs)("span",{className:"text-[11px] text-muted-foreground/30 select-none",children:[(0,X.jsx)("kbd",{className:"rounded px-1 py-0.5 font-mono text-[10px] ring-1 ring-foreground/10",children:"/"})," ","for commands"]})]})]}),ep&&(0,X.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-md z-20 pointer-events-none","aria-hidden":"true",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground/70"})})]}),!u&&(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-1 border-t border-border text-xs text-muted-foreground/60",children:[(0,X.jsxs)("span",{className:"text-[10.5px] text-muted-foreground/30 select-none hidden sm:block",children:[(0,X.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"⌘S"})," ","save",(0,X.jsx)("span",{className:"mx-1.5 opacity-40",children:"·"}),(0,X.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"/"})," ","commands"]}),(0,X.jsxs)("div",{className:"flex items-center gap-3",children:[(0,X.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-[10.5px]",role:"radiogroup","aria-label":"Edit mode",children:[(0,X.jsx)("button",{type:"button",role:"radio","aria-checked":"editing"===l,onClick:()=>c("editing"),className:`px-2 py-0.5 transition-colors ${"editing"===l?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Editing"}),(0,X.jsx)("button",{type:"button",role:"radio","aria-checked":"suggesting"===l,onClick:()=>c("suggesting"),className:`px-2 py-0.5 transition-colors ${"suggesting"===l?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Suggesting"})]}),(0,X.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10.5px] transition-all duration-300 ${"idle"===r?"opacity-0 pointer-events-none":"opacity-100"} ${"saving"===r?"bg-muted text-muted-foreground":"saved"===r?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r?"bg-destructive/10 text-destructive":""}`,children:["saving"===r&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ex,{className:"h-2.5 w-2.5 animate-spin"}),"Saving…"]}),"saved"===r&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-2.5 w-2.5"}),"Saved"]}),"error"===r&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(er,{className:"h-2.5 w-2.5"}),"Save failed"]})]})]})]})]})]}),v]})}function _R({path:e}){let t=rW(`/api/assets/${e}`),n=e.split("/").pop()||e,r=n.includes(".")?n.split(".").pop()?.toUpperCase():"",i=async()=>{try{await rK("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rY,{path:e,badge:r||void 0}),(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center max-w-sm",children:[(0,X.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-muted",children:(0,X.jsx)(ed,{className:"size-8 text-muted-foreground/50"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:n}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"This file type can't be previewed in Cabinet."})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsxs)(tX,{variant:"outline",size:"sm",className:"gap-2",onClick:i,children:[(0,X.jsx)(ef,{className:"h-4 w-4"}),"Open in Finder"]}),(0,X.jsxs)(tX,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>{let e=document.createElement("a");e.href=t,e.download=n,e.click()},children:[(0,X.jsx)(ec,{className:"h-4 w-4"}),"Download"]})]})]})})]})}function _L({path:e,title:t}){let n=rW(`/api/assets/${e}`),r=e.split("/").pop()||e,i=r.includes(".")?r.split(".").pop()?.toUpperCase():"IMG";return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:i,children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=r,e.click()},children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:(0,X.jsx)("img",{src:n,alt:t,className:"max-w-full max-h-full object-contain rounded-md shadow-lg",style:{imageRendering:"auto"}})})]})}function _j({path:e,type:t}){let n=rW(`/api/assets/${e}`),r=e.split("/").pop()||e,i=r.includes(".")?r.split(".").pop()?.toUpperCase():t.toUpperCase();return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:i,children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=r,e.click()},children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:"video"===t?(0,X.jsx)("video",{src:n,controls:!0,className:"max-w-full max-h-full rounded-md shadow-lg",children:"Your browser does not support the video element."}):(0,X.jsxs)("div",{className:"w-full max-w-lg space-y-4",children:[(0,X.jsx)("div",{className:"text-center text-muted-foreground text-sm",children:r}),(0,X.jsx)("audio",{src:n,controls:!0,className:"w-full",children:"Your browser does not support the audio element."})]})})]})}let _P=en("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"}]]),_B=en("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),_F=en("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),_H=en("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function _U({path:t,title:n}){let[r,i]=(0,Q.useState)(""),[s,o]=(0,Q.useState)(""),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!0),[u,p]=(0,Q.useState)(!1),[h,f]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(1),[b,y]=(0,Q.useState)({x:0,y:0}),[x,v]=(0,Q.useState)(!1),w=(0,Q.useRef)({x:0,y:0,panX:0,panY:0}),E=(0,Q.useRef)(null),k=(0,Q.useRef)(null),T=(0,Q.useRef)(0),N=(0,Q.useCallback)(e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-.25:.25;g(e=>Math.min(Math.max(e+t,.25),5))}},[]),A=(0,Q.useCallback)(e=>{0===e.button&&(v(!0),w.current={x:e.clientX,y:e.clientY,panX:b.x,panY:b.y},e.target.setPointerCapture(e.pointerId))},[b]),S=(0,Q.useCallback)(e=>{x&&y({x:w.current.panX+(e.clientX-w.current.x),y:w.current.panY+(e.clientY-w.current.y)})},[x]),C=(0,Q.useCallback)(()=>{v(!1)},[]),_=rW(`/api/assets/${t}`);t.split("/").pop();let M=(0,Q.useCallback)(async()=>{d(!0),l("");try{let t=await rK(_);if(!t.ok)throw Error("Failed to fetch file");let n=await t.text();i(n);let r=(await e.A(890793)).default;r.initialize({startOnLoad:!1,theme:document.documentElement.classList.contains("dark")?"dark":"default",securityLevel:"loose",suppressErrorRendering:!0}),await r.parse(n.trim());let s=`mermaid-${++T.current}`,{svg:a}=await r.render(s,n.trim());o(a)}catch(e){document.querySelectorAll('[id^="dmermaid-"], [id^="d"]:has(> .error-icon)').forEach(e=>e.remove()),l(e instanceof Error?e.message:"Failed to render diagram")}finally{d(!1)}},[_]);return(0,Q.useEffect)(()=>{M()},[M]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:t,badge:"MERMAID",children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${u?"bg-muted":""}`,onClick:()=>p(e=>!e),children:[u?(0,X.jsx)(_P,{className:"h-3.5 w-3.5"}):(0,X.jsx)(rz,{className:"h-3.5 w-3.5"}),u?"Diagram":"Code"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(r),f(!0),setTimeout(()=>f(!1),2e3)},children:[h?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),h?"Copied":"Copy"]}),s&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"}),(0,X.jsx)(tX,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>g(e=>Math.max(e-.25,.25)),title:"Zoom out",children:(0,X.jsx)(_H,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)("span",{className:"text-[11px] text-muted-foreground tabular-nums w-10 text-center select-none",children:[Math.round(100*m),"%"]}),(0,X.jsx)(tX,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>g(e=>Math.min(e+.25,5)),title:"Zoom in",children:(0,X.jsx)(_F,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{g(1),y({x:0,y:0})},title:"Reset view",children:(0,X.jsx)(_B,{className:"h-3.5 w-3.5"})}),(0,X.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"})]}),s&&(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{if(!s)return;let e=new Blob([s],{type:"image/svg+xml"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${n}.svg`,r.click(),URL.revokeObjectURL(t)},children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"SVG"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto",children:c?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Rendering diagram..."}):u?(0,X.jsx)("pre",{className:"p-4 text-[13px] leading-relaxed font-mono bg-[#1e1e1e]",children:(0,X.jsx)("code",{children:r.split("\n").map((e,t)=>(0,X.jsxs)("div",{className:"flex",children:[(0,X.jsx)("span",{className:"inline-block w-12 pr-4 text-right text-[#858585] select-none shrink-0",children:t+1}),(0,X.jsx)("span",{className:"text-[#d4d4d4] flex-1",children:e||"\n"})]},t))})}):a?(0,X.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-sm p-8",children:[(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,X.jsx)("div",{className:"h-10 w-10 rounded-full bg-red-500/10 flex items-center justify-center",children:(0,X.jsx)(rz,{className:"h-5 w-5 text-red-500"})}),(0,X.jsx)("p",{className:"text-red-500 font-medium",children:"Diagram syntax error"})]}),(0,X.jsx)("pre",{className:"text-muted-foreground text-xs max-w-lg text-left bg-muted rounded-md p-3 overflow-auto whitespace-pre-wrap",children:a}),(0,X.jsx)(tX,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"View source to fix"})]}):(0,X.jsx)("div",{ref:k,className:"relative w-full h-full overflow-hidden",style:{cursor:x?"grabbing":"grab"},onWheel:N,onPointerDown:A,onPointerMove:S,onPointerUp:C,children:(0,X.jsx)("div",{ref:E,className:"flex items-center justify-center p-8 min-h-full [&_svg]:max-w-full origin-center select-none",style:{transform:`translate(${b.x}px, ${b.y}px) scale(${m})`},dangerouslySetInnerHTML:{__html:s}})})})]})}var _z="[0-9](_*[0-9])*",_$=`\\.(${_z})`,_G="[0-9a-fA-F](_*[0-9a-fA-F])*",_q={className:"number",variants:[{begin:`(\\b(${_z})((${_$})|\\.)?|(${_$}))[eE][+-]?(${_z})[fFdD]?\\b`},{begin:`\\b(${_z})((${_$})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_$})[fFdD]?\\b`},{begin:`\\b(${_z})[fFdD]\\b`},{begin:`\\b0[xX]((${_G})\\.?|(${_G})?\\.(${_G}))[pP][+-]?(${_z})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${_G})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0},_V="[0-9](_*[0-9])*",_W=`\\.(${_V})`,_K="[0-9a-fA-F](_*[0-9a-fA-F])*",_Y={className:"number",variants:[{begin:`(\\b(${_V})((${_W})|\\.)?|(${_W}))[eE][+-]?(${_V})[fFdD]?\\b`},{begin:`\\b(${_V})((${_W})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_W})[fFdD]?\\b`},{begin:`\\b(${_V})[fFdD]\\b`},{begin:`\\b0[xX]((${_K})\\.?|(${_K})?\\.(${_K}))[pP][+-]?(${_V})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${_K})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};let _X=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_Q=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),_J=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_Z=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),_1=_J.concat(_Z).sort().reverse(),_2=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_3=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),_5=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_4=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_6=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _9(e){return e?"string"==typeof e?e:e.source:null}function _7(e){return _8("(?=",e,")")}function _8(...e){return e.map(e=>_9(e)).join("")}function Me(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>_9(e)).join("|")+")"}let Mt=e=>_8(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Mn=["Protocol","Type"].map(Mt),Mr=["init","self"].map(Mt),Mi=["Any","Self"],Ms=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Mo=["false","nil","true"],Ma=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ml=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Mc=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Md=Me(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Mu=Me(Md,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Mp=_8(Md,Mu,"*"),Mh=Me(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Mf=Me(Mh,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Mm=_8(Mh,Mf,"*"),Mg=_8(/[A-Z]/,Mf,"*"),Mb=["attached","autoclosure",_8(/convention\(/,Me("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",_8(/objc\(/,Mm,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],My=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"],Mx={arduino:function(e){let t,n,r,i,s,o,a,l,c,d,u,p,h,f,m,g,b=(t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="[a-zA-Z_]\\w*::",s="(?!struct)("+(r="decltype\\(auto\\)")+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",m={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},contains:(f=[h={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},c,o,n,e.C_BLOCK_COMMENT_MODE,l,a]).concat([{begin:/\(/,end:/\)/,keywords:p,contains:f.concat(["self"]),relevance:0}]),relevance:0},g={className:"function",begin:"("+s+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[a,l]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,o,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,c]},{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(m,g,h,f,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}),y=b.keywords;return y.type=[...y.type,"boolean","byte","word","String"],y.literal=[...y.literal,"DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"],y.built_in=[...y.built_in,"KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],y._hints=["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],b.name="Arduino",b.aliases=["ino"],b.supersetOf="cpp",b},bash:A8,c:function(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",p={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},h=[c,o,n,e.C_BLOCK_COMMENT_MODE,l,a],f={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:h.concat([{begin:/\(/,end:/\)/,keywords:p,contains:h.concat(["self"]),relevance:0}]),relevance:0},m={begin:"("+s+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,o,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:p,disableAutodetect:!0,illegal:"</",contains:[].concat(f,m,h,[c,{begin:e.IDENT_RE+"::",keywords:p},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:a,keywords:p}}},cpp:function(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},h={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},f=[h,c,o,n,e.C_BLOCK_COMMENT_MODE,l,a],m={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:f.concat([{begin:/\(/,end:/\)/,keywords:p,contains:f.concat(["self"]),relevance:0}]),relevance:0},g={className:"function",begin:"("+s+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[a,l]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,o,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(m,g,h,f,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}},csharp:function(e){let t={keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"]),built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],literal:["default","false","null","true"]},n=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),r={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},s=e.inherit(i,{illegal:/\n/}),o={className:"subst",begin:/\{/,end:/\}/,keywords:t},a=e.inherit(o,{illegal:/\n/}),l={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,a]},c={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]},d=e.inherit(c,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},a]});o.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.C_BLOCK_COMMENT_MODE],a.contains=[d,l,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let u={variants:[{className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p={begin:"<",end:">",contains:[{beginKeywords:"in out"},n]},h=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",f={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:t,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},u,r,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+h+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:t,contains:[{beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,p],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t,relevance:0,contains:[u,r,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},f]}},css:Ss,diff:function(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}},go:So,graphql:function(e){let t=e.regex;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}},ini:function(e){let t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:t.concat(a,"(\\s*\\.\\s*",a,")*",t.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[r,{begin:/\[/,end:/\]/,contains:[r,s,i,o,n,"self"],relevance:0},s,i,o,n]}}]}},java:function(e){let t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+function e(t,n,r){return -1===r?"":t.replace(n,i=>e(t,n,r-1))}("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),i={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},s={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},o={className:"params",begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,_q,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_q,s]}},javascript:Sm,json:Sg,kotlin:function(e){let t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,r]}]};r.contains.push(s);let o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},a={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(s,{className:"string"}),"self"]}]},l=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),c={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]};return c.variants[1].contains=[c],c.variants[1].contains=[c],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,l,{className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},n,o,a,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[c,e.C_LINE_COMMENT_MODE,l],relevance:0},e.C_LINE_COMMENT_MODE,l,o,a,s,e.C_NUMBER_MODE]},l]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,a]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:"\n"},_Y]}},less:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},n="[\\w-]+",r="("+n+"|@\\{"+n+"\\})",i=[],s=[],o=function(e){return{className:"string",begin:"~?"+e+".*?"+e}},a=function(e,t,n){return{className:e,begin:t,relevance:n}},l={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:_Q.join(" ")};s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,o("'"),o('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,{begin:"\\(",end:"\\)",contains:s,keywords:l,relevance:0},a("variable","@@?"+n,10),a("variable","@\\{"+n+"\\}"),a("built_in","~?`[^`]*?`"),{className:"attribute",begin:n+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let c=s.concat({begin:/\{/,end:/\}/,contains:i}),d={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(s)},u={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_0.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]},p={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,a("keyword","all\\b"),a("variable","@\\{"+n+"\\}"),{begin:"\\b("+_X.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,a("selector-tag",r,0),a("selector-id","#"+r),a("selector-class","\\."+r,0),a("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+_J.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+_Z.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:c},{begin:"!important"},t.FUNCTION_DISPATCH]},h={begin:n+":(:)?"+`(${_1.join("|")})`,returnBegin:!0,contains:[p]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:l,returnEnd:!0,contains:s,relevance:0}},{className:"variable",variants:[{begin:"@"+n+"\\s*:",relevance:15},{begin:"@"+n}],starts:{end:"[;}]",returnEnd:!0,contains:c}},h,u,p,d,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:i}},lua:function(e){let t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}},makefile:function(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,{className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},r,{className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},{className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]}]}},markdown:Sb,objectivec:function(e){let t=/[a-zA-Z@][a-zA-Z0-9_]*/,n={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:{"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},illegal:"</",contains:[{className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+n.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:n,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}},perl:function(e){let t=e.regex,n=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot class close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl field fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map method mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0"},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},s={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},a={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},l={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[e.BACKSLASH_ESCAPE,i,a],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],u=(e,r,i="\\1")=>{let s="\\1"===i?i:t.concat(i,r);return t.concat(t.concat("(?:",e,")"),r,/(?:\\.|[^\\\/])*?/,s,/(?:\\.|[^\\\/])*?/,i,n)},p=(e,r,i)=>t.concat(t.concat("(?:",e,")"),r,/(?:\\.|[^\\\/])*?/,i,n),h=[a,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},l,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:u("s|tr|y",t.either(...d,{capture:!0}))},{begin:u("s|tr|y","\\(","\\)")},{begin:u("s|tr|y","\\[","\\]")},{begin:u("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,l]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=h,s.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:h}},php:function(e){let t,n=e.regex,r=/(?![A-Za-z0-9])(?![$])/,i=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),s=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),o=n.concat(/[A-Z]+/,r),a={scope:"variable",match:"\\$+"+i},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h="[ \n]",f={scope:"string",variants:[d,c,u,p]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:b,literal:(t=[],g.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t),built_in:y},v=e=>e.map(e=>e.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,n.concat(h,"+"),n.concat("(?!",v(y).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},E=n.concat(i,"\\b(?!\\()"),k={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),E],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,n.concat(/::/,n.lookahead(/(?!class\b)/)),E],scope:{1:"title.class",3:"variable.constant"}},{match:[s,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:n.concat(i,n.lookahead(":"),n.lookahead(/(?!::)/))},N={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[T,a,k,e.C_BLOCK_COMMENT_MODE,f,m,w]},A={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",v(b).join("\\b|"),"|",v(y).join("\\b|"),"\\b)"),i,n.concat(h,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[N]};N.contains.push(A);let S=[T,k,e.C_BLOCK_COMMENT_MODE,f,m,w],C={begin:n.concat(/#\[\s*\\?/,n.either(s,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...S]},...S,{scope:"meta",variants:[{match:s},{match:o}]}]};return{case_insensitive:!1,keywords:x,contains:[C,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},a,A,k,{match:[/const/,/\s/,i],scope:{1:"keyword",3:"variable.constant"}},w,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",C,a,k,e.C_BLOCK_COMMENT_MODE,f,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},f,m]}},"php-template":function(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}},plaintext:function(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}},python:Sy,"python-repl":function(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}},r:function(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}},ruby:function(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},o={className:"doctag",begin:"@[A-Za-z]+"},a={begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:s},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},u="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${u}))?([eE][+-]?(${u})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},h={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},f=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[h]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(a,l),relevance:0}].concat(a,l);c.contains=f,h.contains=f;let m=[{begin:/^\s*=>/,starts:{end:"$",contains:f}},{className:"meta.prompt",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",starts:{end:"$",keywords:s,contains:f}}];return l.unshift(a),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(m).concat(l).concat(f)}},rust:Sx,scss:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},n="@[a-z-]+",r={className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+_2.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+_5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+_4.join("|")+")"},r,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_6.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,r,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:n,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:_3.join(" ")},contains:[{begin:n,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}},shell:Sv,sql:Sw,swift:function(e){let t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Me(...Mn,...Mr)],className:{2:"keyword"}},s={match:_8(/\./,Me(...Ms)),relevance:0},o=Ms.filter(e=>"string"==typeof e).concat(["_|0"]),a={variants:[{className:"keyword",match:Me(...Ms.filter(e=>"string"!=typeof e).concat(Mi).map(Mt),...Mr)}]},l={$pattern:Me(/\b\w+/,/#\w+/),keyword:o.concat(Ml),literal:Mo},c=[i,s,a],d=[{match:_8(/\./,Me(...Mc)),relevance:0},{className:"built_in",match:_8(/\b/,Me(...Mc),/(?=\()/)}],u={match:/->/,relevance:0},p=[u,{className:"operator",relevance:0,variants:[{match:Mp},{match:`\\.(\\.|${Mu})+`}]}],h="([0-9]_*)+",f="([0-9a-fA-F]_*)+",m={className:"number",relevance:0,variants:[{match:`\\b(${h})(\\.(${h}))?([eE][+-]?(${h}))?\\b`},{match:`\\b0x(${f})(\\.(${f}))?([pP][+-]?(${h}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e="")=>({className:"subst",variants:[{match:_8(/\\/,e,/[0\\tnr"']/)},{match:_8(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),b=(e="")=>({className:"subst",label:"interpol",begin:_8(/\\/,e,/\(/),end:/\)/}),y=(e="")=>({begin:_8(e,/"""/),end:_8(/"""/,e),contains:[g(e),((e="")=>({className:"subst",match:_8(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}))(e),b(e)]}),x=(e="")=>({begin:_8(e,/"/),end:_8(/"/,e),contains:[g(e),b(e)]}),v={className:"string",variants:[y(),y("#"),y("##"),y("###"),x(),x("#"),x("##"),x("###")]},w=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],E=e=>{let t=_8(e,/\//),n=_8(/\//,e);return{begin:t,end:n,contains:[...w,{scope:"comment",begin:`#(?!.*${n})`,end:/$/}]}},k={scope:"regexp",variants:[E("###"),E("##"),E("#"),{begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:w}]},T={match:_8(/`/,Mm,/`/)},N=[T,{className:"variable",match:/\$\d+/},{className:"variable",match:`\\$${Mf}+`}],A=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:My,contains:[...p,m,v]}]}},{scope:"keyword",match:_8(/@/,Me(...Mb),_7(Me(/\(/,/\s+/)))},{scope:"meta",match:_8(/@/,Mm)}],S={match:_7(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:_8(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Mf,"+")},{className:"type",match:Mg,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_8(/\s+&\s+/,_7(Mg)),relevance:0}]},C={begin:/</,end:/>/,keywords:l,contains:[...r,...c,...A,u,S]};S.contains.push(C);let _={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{match:_8(Mm,/\s*:/),keywords:"_|0",relevance:0},...r,k,...c,...d,...p,m,v,...N,...A,S]},M={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,S]},O={begin:/\(/,end:/\)/,keywords:l,contains:[{begin:Me(_7(_8(Mm,/\s*:/)),_7(_8(Mm,/\s+/,Mm,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Mm}]},...r,...c,...p,m,v,...A,S,_],endsParent:!0,illegal:/["']/},I={match:[/(func|macro)/,/\s+/,Me(T.match,Mm,Mp)],className:{1:"keyword",3:"title.function"},contains:[M,O,t],illegal:[/\[/,/%/]},D={begin:[/precedencegroup/,/\s+/,Mg],className:{1:"keyword",3:"title"},contains:[S],keywords:[...Ma,...Mo],end:/}/},R={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Mm,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:l,contains:[M,...c,{begin:/:/,end:/\{/,keywords:l,contains:[{scope:"title.class.inherited",match:Mg},...c],relevance:0}]};for(let e of v.variants){let t=e.contains.find(e=>"interpol"===e.label);t.keywords=l;let n=[...c,...d,...p,m,v,...N];t.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:l,contains:[...r,I,{match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[M,O,t],illegal:/\[|%/},{match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},{match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},R,{match:[/operator/,/\s+/,Mp],className:{1:"keyword",3:"title"}},D,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},k,...c,...d,...p,m,v,...N,...A,S,_]}},typescript:SM,vbnet:function(e){let t=e.regex,n=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,o={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,n),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,i,/ *#/)},{begin:t.concat(/# */,t.either(r,n),/ +/,t.either(i,s),/ *#/)}]},a=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o,{className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{className:"label",begin:/^\w+:/},a,l,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[l]}]}},wasm:function(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},{className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}},xml:SO,yaml:SI},Mv=SR(Mx);function Mw(e){return Array.isArray(e)?e.join(""):e??""}let ME=/\x1b\[[0-9;]*[A-Za-z]/g;function Mk(e){return e.replace(ME,"")}function MT({output:e}){if("stream"===e.output_type){let t=Mk(Mw(e.text)),n="stderr"===e.name;return(0,X.jsx)("pre",{className:`whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md ${n?"bg-[rgba(139,46,62,0.06)] text-[#8B2E3E]":"bg-[#F5EEDC] text-[#2A221B]"}`,children:t})}if("error"===e.output_type){let t=e.traceback.map(Mk).join("\n");return(0,X.jsxs)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[rgba(139,46,62,0.08)] text-[#8B2E3E] border border-[rgba(139,46,62,0.18)]",children:[(0,X.jsxs)("span",{className:"font-semibold",children:[e.ename,": ",e.evalue]}),t?`
114
-
115
- ${t}`:""]})}let t=e.data||{};if(t["image/png"]){let e=`data:image/png;base64,${Mw(t["image/png"]).replace(/\s/g,"")}`;return(0,X.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(t["image/jpeg"]){let e=`data:image/jpeg;base64,${Mw(t["image/jpeg"]).replace(/\s/g,"")}`;return(0,X.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(t["image/svg+xml"]){let e=Mw(t["image/svg+xml"]);return(0,X.jsx)("div",{className:"max-w-full rounded-md bg-card p-2 overflow-auto",dangerouslySetInnerHTML:{__html:e}})}if(t["text/html"]){let e=Mw(t["text/html"]);return(0,X.jsx)("iframe",{srcDoc:`<!doctype html><html><head><base target="_blank"><style>body{margin:0;padding:8px;font-family:-apple-system,BlinkMacSystemFont,Inter,system-ui,sans-serif;background:#FFF9E9;color:#2A221B;font-size:13px}table{border-collapse:collapse}th,td{border:1px solid #D4C4B0;padding:4px 8px;text-align:left}thead{background:#EFE5CC}</style></head><body>${e}</body></html>`,sandbox:"allow-scripts",className:"w-full bg-[#FFF9E9] rounded-md border border-[#E8DDC5]",style:{height:360}})}return t["text/plain"]?(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B]",children:Mk(Mw(t["text/plain"]))}):null}function MN({cell:e,language:t}){let n=Mw(e.source),r=(0,Q.useMemo)(()=>(function(e,t){try{let n=t?Mv.highlight(t,e):Mv.highlightAuto(e);return by(n)}catch{return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}})(n,t),[n,t]),i=e.execution_count??" ",s=(e.outputs?.length??0)>0;return(0,X.jsxs)("div",{className:"grid grid-cols-[60px_1fr] gap-3 mb-5",children:[(0,X.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B5E3C]",children:["In [",i,"]:"]}),(0,X.jsxs)("div",{children:[(0,X.jsx)("pre",{className:"whitespace-pre overflow-x-auto font-mono text-[13px] leading-relaxed px-4 py-3 rounded-md bg-[#FFF9E9] border border-[#E8DDC5] text-[#2A221B]",children:(0,X.jsx)("code",{dangerouslySetInnerHTML:{__html:r}})}),s&&(0,X.jsxs)("div",{className:"mt-2 grid grid-cols-[60px_1fr] gap-3",children:[(0,X.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B2E3E]",children:["Out[",i,"]:"]}),(0,X.jsx)("div",{className:"space-y-2",children:e.outputs?.map((e,t)=>(0,X.jsx)(MT,{output:e},t))})]})]})]})}function MA({cell:e}){let[t,n]=(0,Q.useState)("");return(0,Q.useEffect)(()=>{let t=!1;return vA(Mw(e.source)).then(e=>{t||n(e)}),()=>{t=!0}},[e.source]),(0,X.jsx)("div",{className:"prose prose-sm max-w-none mb-5 px-1 [&_h1]:font-serif [&_h2]:font-serif [&_h3]:font-serif [&_a]:text-[#8B5E3C] [&_a:hover]:underline [&_code]:bg-[#F5EEDC] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-[#8B2E3E]",dangerouslySetInnerHTML:{__html:t}})}function MS({cell:e}){return(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B] mb-5",children:Mw(e.source)})}function MC({path:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[s,o]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(!1),c=rW(`/api/assets/${e}`),d=e.split("/").pop()||e,u=(0,Q.useCallback)(async()=>{i(!0),o(null);try{let e=await rK(c);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();n(t)}catch(e){o(e instanceof Error?e.message:"Failed to load notebook")}finally{i(!1)}},[c]);(0,Q.useEffect)(()=>{u()},[u]);let p=t?.metadata?.language_info?.name||t?.metadata?.kernelspec?.name||"python",h=t?.cells?.length??0,f=t?.cells?.filter(e=>"code"===e.cell_type).length??0,m=t?.cells?.some(e=>"code"===e.cell_type&&(e.outputs?.length??0)>0)??!1;return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:"IPYNB",sublabel:`${h} cells \xb7 ${f} code \xb7 ${p}`,children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(`jupyter lab ${e}`),l(!0),setTimeout(()=>l(!1),2e3)},title:"Copy: jupyter lab <path>",children:[a?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),a?"Copied":"Copy run cmd"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=c,e.download=d,e.click()},children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(c,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Raw JSON"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto bg-[#F5EEDC]",children:r?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-[#7A6B5D] text-sm",children:"Loading notebook…"}):s?(0,X.jsxs)("div",{className:"flex items-center justify-center h-full text-[#8B2E3E] text-sm gap-2",children:[(0,X.jsx)(er,{className:"h-4 w-4"})," ",s]}):t?(0,X.jsxs)("div",{className:"max-w-[1100px] mx-auto py-8 px-6",children:[!m&&f>0&&(0,X.jsxs)("div",{className:"mb-6 rounded-md border border-[#E8DDC5] bg-[#FFF9E9] px-4 py-3 text-[13px] text-[#7A6B5D]",children:[(0,X.jsx)("span",{className:"font-semibold text-[#0c0a09]",children:"This notebook hasn't been run yet."})," ","Code and markdown cells display below; outputs appear once the author runs the notebook in Jupyter (or you do, then re-save)."]}),t.cells?.map((e,t)=>"markdown"===e.cell_type?(0,X.jsx)(MA,{cell:e},t):"raw"===e.cell_type?(0,X.jsx)(MS,{cell:e},t):(0,X.jsx)(MN,{cell:e,language:p},t))]}):null})]})}function M_({path:e,extLabel:t,external:n,hideFinder:r}){let i=rW(`/api/assets/${e}`),s=e.split("/").pop()||e,o=async()=>{try{await rK("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,X.jsxs)(rY,{path:e,badge:t||void 0,children:[n&&(0,X.jsxs)("a",{href:n.href,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-[11px] h-7 px-2.5 rounded-md border border-border hover:bg-accent transition-colors",children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),n.label]}),!r&&(0,X.jsxs)(tX,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:o,title:"Open in Finder",children:[(0,X.jsx)(ef,{className:"h-3.5 w-3.5"}),"Reveal"]}),!r&&(0,X.jsxs)(tX,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:()=>{let e=document.createElement("a");e.href=i,e.download=s,e.click()},title:"Download original",children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"Download"]})]})}function MM({path:t,title:n}){let r=(0,Q.useRef)(null),[i,s]=(0,Q.useState)(!0),[o,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let n=!1,i=r.current;if(i)return i.innerHTML="",(async()=>{s(!0),a(null);try{let[{renderAsync:r},o]=await Promise.all([e.A(410052),rK(`/api/assets/${t}`)]);if(n)return;if(!o.ok)throw Error(`Failed to load file (${o.status})`);let a=await o.blob();if(n)return;await r(a,i,void 0,{className:"docx-rendered",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,breakPages:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,experimental:!0,useBase64URL:!0}),n||s(!1)}catch(e){n||(a(e instanceof Error?e.message:"Failed to render document"),s(!1))}})(),()=>{n=!0}},[t]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(M_,{path:t,title:n,extLabel:"DOCX"}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto bg-muted/30",children:[i&&!o&&(0,X.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering document…"]}),o&&(0,X.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:o}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,X.jsx)("div",{ref:r,className:"docx-viewer-body mx-auto max-w-5xl py-6 px-4"})]})]})}function MO({path:t,title:n}){let r=(0,Q.useRef)(null),[i,s]=(0,Q.useState)(!0),[o,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let n=!1,i=r.current;if(!i)return;i.innerHTML="";let o=null;return(async()=>{s(!0),a(null);try{let[{init:r},a]=await Promise.all([e.A(355350),rK(`/api/assets/${t}`)]);if(n)return;if(!a.ok)throw Error(`Failed to load file (${a.status})`);let l=await a.arrayBuffer();if(n)return;let c=i.clientWidth||960,d=Math.round(9*c/16);o=r(i,{width:c,height:d,mode:"list"}),await o.preview(l),n||s(!1)}catch(e){n||(a(e instanceof Error?e.message:"Failed to render presentation"),s(!1))}})(),()=>{n=!0;try{o?.destroy?.()}catch{}}},[t]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(M_,{path:t,title:n,extLabel:"PPTX"}),(0,X.jsxs)("div",{className:"flex-1 overflow-auto bg-muted/30 py-4",children:[i&&!o&&(0,X.jsxs)("div",{className:"h-[60vh] flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering slides…"]}),o&&(0,X.jsx)("div",{className:"h-[60vh] flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:o}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,X.jsx)("div",{ref:r,className:"pptx-viewer-body mx-auto max-w-5xl px-4"})]})]})}function MI({path:t,title:n}){let[r,i]=(0,Q.useState)(null),[s,o]=(0,Q.useState)(0),[a,l]=(0,Q.useState)(!0),[c,d]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let n=!1;return l(!0),d(null),i(null),(async()=>{try{let[r,s]=await Promise.all([e.A(432302),rK(`/api/assets/${t}`)]);if(n)return;if(!s.ok)throw Error(`Failed to load file (${s.status})`);let a=await s.arrayBuffer();if(n)return;let c=r.read(a,{type:"array",cellDates:!0,cellStyles:!0}),d=c.SheetNames.map(e=>({name:e,html:r.utils.sheet_to_html(c.Sheets[e],{editable:!1})}));if(n)return;i(d),o(0),l(!1)}catch(e){n||(d(e instanceof Error?e.message:"Failed to parse spreadsheet"),l(!1))}})(),()=>{n=!0}},[t]);let u=(0,Q.useMemo)(()=>r?.[s]??null,[r,s]);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(M_,{path:t,title:n,extLabel:"XLSX"}),r&&r.length>1&&(0,X.jsx)("div",{className:"flex items-center gap-0.5 border-b border-border bg-muted/40 px-2 overflow-x-auto scrollbar-none",children:r.map((e,t)=>(0,X.jsx)("button",{type:"button",onClick:()=>o(t),className:tK("px-3 py-1.5 text-[12px] rounded-t whitespace-nowrap transition-colors",t===s?"bg-background text-foreground font-medium border-t border-x border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:e.name},e.name+t))}),(0,X.jsxs)("div",{className:"flex-1 overflow-auto",children:[a&&!c&&(0,X.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin mr-2"}),"Parsing spreadsheet…"]}),c&&(0,X.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:c}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),u&&(0,X.jsx)("div",{className:"xlsx-sheet p-3 text-[12px]",dangerouslySetInnerHTML:{__html:u.html}})]})]})}function MD({path:e,title:t}){let n=rW(`/api/assets/${e}`);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rY,{path:e,badge:"PDF",children:(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,X.jsx)("iframe",{src:n,className:"flex-1 w-full border-0",title:t})]})}let MR=en("wrap-text",[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),ML=SR(Mx),Mj={".js":"javascript",".cjs":"javascript",".mjs":"javascript",".ts":"typescript",".tsx":"typescript",".jsx":"javascript",".py":"python",".rb":"ruby",".php":"php",".sh":"bash",".bash":"bash",".zsh":"bash",".ps1":"powershell",".css":"css",".scss":"scss",".html":"xml",".json":"json",".jsonc":"json",".yaml":"yaml",".yml":"yaml",".toml":"ini",".ini":"ini",".xml":"xml",".sql":"sql",".graphql":"graphql",".gql":"graphql",".go":"go",".rs":"rust",".swift":"swift",".java":"java",".kt":"kotlin",".kts":"kotlin",".c":"c",".cpp":"cpp",".h":"c",".env":"bash",".txt":"",".text":"",".log":"",".rst":"",".mdx":"markdown"};function MP({path:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),[s,o]=(0,Q.useState)(!0),[a,l]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(!1),u=rW(`/api/assets/${e}`),p=e.split("/").pop()||e,h=Mj[p.includes(".")?`.${p.split(".").pop()?.toLowerCase()}`:""]??"",f=(0,Q.useCallback)(async()=>{o(!0);try{let e=await rK(u);if(e.ok){let t=new Uint8Array(await e.arrayBuffer());!function(e){let t=Math.min(e.length,8192);if(0===t)return!1;let n=0;for(let r=0;r<t;r++){let t=e[r];if(0===t)return!0;(t<9||t>13&&t<32)&&n++}return n/t>.3}(t)?n(new TextDecoder("utf-8").decode(t)):i(!0)}}catch{}finally{o(!1)}},[u]);(0,Q.useEffect)(()=>{f()},[f]);let m=(0,Q.useMemo)(()=>{if(!t)return[];try{let e=h?ML.highlight(h,t):ML.highlightAuto(t);return by(e).split("\n")}catch{return t.split("\n").map(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}},[t,h]);return r?(0,X.jsx)(_R,{path:e,title:p}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:p.includes(".")?p.split(".").pop()?.toUpperCase()??"TEXT":"TEXT",sublabel:h||void 0,children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${a?"bg-muted":""}`,onClick:()=>l(e=>!e),title:a?"Disable line wrap":"Enable line wrap",children:[(0,X.jsx)(MR,{className:"h-3.5 w-3.5"}),"Wrap"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{t&&(navigator.clipboard.writeText(t),d(!0),setTimeout(()=>d(!1),2e3))},title:"Copy file contents",children:[c?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),c?"Copied":"Copy"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=u,e.download=p,e.click()},title:"Download file",children:[(0,X.jsx)(ec,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(u,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Raw"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto source-viewer-code bg-[#1e1e1e]",children:s?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):(0,X.jsx)("table",{className:"w-full border-collapse text-[13px] leading-relaxed font-mono",children:(0,X.jsx)("tbody",{children:m.map((e,t)=>(0,X.jsxs)("tr",{className:"hover:bg-white/5",children:[(0,X.jsx)("td",{className:"w-12 pr-4 text-right text-[#858585] select-none align-top sticky left-0 bg-[#1e1e1e]",children:t+1}),(0,X.jsx)("td",{className:`text-[#d4d4d4] pl-2 ${a?"whitespace-pre-wrap break-all":"whitespace-pre"}`,dangerouslySetInnerHTML:{__html:e||" "}})]},t))})})})]})}function MB({path:e,title:t,src:n,fullscreen:r,onExit:i}){let s=rW(n??`/api/assets/${e}/index.html`),o=r&&i?(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:i,title:"Exit app",children:[(0,X.jsx)(_l,{className:"h-3.5 w-3.5"}),"Exit app"]}):null;return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rY,{path:e,badge:r?"App":void 0,showBreadcrumb:!r,leading:r?(0,X.jsxs)(X.Fragment,{children:[o,(0,X.jsx)("span",{className:"truncate text-[13px] font-medium text-foreground",children:t})]}):null,children:(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(s,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,X.jsx)("iframe",{src:s,className:"flex-1 w-full border-0 bg-card",title:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation"})]})}let MF=en("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),MH=en("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);function MU(e){let t=e+"CollectionProvider",[n,r]=tJ(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=Q.default.useRef(null),s=Q.default.useRef(new Map).current;return(0,X.jsx)(i,{scope:t,itemMap:s,collectionRef:r,children:n})};o.displayName=t;let a=e+"CollectionSlot",l=t6(a),c=Q.default.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ej(t,s(a,n).collectionRef);return(0,X.jsx)(l,{ref:i,children:r})});c.displayName=a;let d=e+"CollectionItemSlot",u="data-radix-collection-item",p=t6(d),h=Q.default.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=Q.default.useRef(null),a=ej(t,o),l=s(d,n);return Q.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,X.jsx)(p,{...{[u]:""},ref:a,children:r})});return h.displayName=d,[{Provider:o,Slot:c,ItemSlot:h},function(t){let n=s(e+"CollectionConsumer",t);return Q.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},r]}var Mz=new WeakMap;function M$(e,t){var n,r;let i,s,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(n=e,r=t,i=n.length,(o=(s=MG(r))>=0?s:i+s)<0||o>=i?-1:o);return -1===a?void 0:e[a]}function MG(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],Mz.set(this,!0)}set(e,t){return Mz.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),s=this.#e.length,o=MG(e),a=o>=0?o:s+o,l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,n),this;let c=this.size+ +!i;o<0&&a++;let d=[...this.#e],u=!1;for(let e=a;e<c;e++)if(a===e){let s=d[e];d[e]===t&&(s=d[e+1]),i&&this.delete(t),r=this.get(s),this.set(t,n)}else{u||d[e-1]!==t||(u=!0);let n=d[u?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=M$(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=M$(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return M$(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}});var Mq=Q.createContext(void 0);function MV(e){let t=Q.useContext(Mq);return e||t||"ltr"}var MW="rovingFocusGroup.onEntryFocus",MK={bubbles:!1,cancelable:!0},MY="RovingFocusGroup",[MX,MQ,MJ]=MU(MY),[MZ,M0]=tJ(MY,[MJ]),[M1,M2]=MZ(MY),M3=Q.forwardRef((e,t)=>(0,X.jsx)(MX.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(MX.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(M5,{...e,ref:t})})}));M3.displayName=MY;var M5=Q.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,p=Q.useRef(null),h=ej(t,p),f=MV(s),[m,g]=t5({prop:o,defaultProp:a??null,onChange:l,caller:MY}),[b,y]=Q.useState(!1),x=nt(c),v=MQ(n),w=Q.useRef(!1),[E,k]=Q.useState(0);return Q.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(MW,x),()=>e.removeEventListener(MW,x)},[x]),(0,X.jsx)(M1,{scope:n,orientation:r,dir:f,loop:i,currentTabStopId:m,onItemFocus:Q.useCallback(e=>g(e),[g]),onItemShiftTab:Q.useCallback(()=>y(!0),[]),onFocusableItemAdd:Q.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:Q.useCallback(()=>k(e=>e-1),[]),children:(0,X.jsx)(t8.div,{tabIndex:b||0===E?-1:0,"data-orientation":r,...u,ref:h,style:{outline:"none",...e.style},onMouseDown:tQ(e.onMouseDown,()=>{w.current=!0}),onFocus:tQ(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(MW,MK);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=v().filter(e=>e.focusable);M7([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:tQ(e.onBlur,()=>y(!1))})})}),M4="RovingFocusGroupItem",M6=Q.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=t2(),c=s||l,d=M2(M4,n),u=d.currentTabStopId===c,p=MQ(n),{onFocusableItemAdd:h,onFocusableItemRemove:f,currentTabStopId:m}=d;return Q.useEffect(()=>{if(r)return h(),()=>f()},[r,h,f]),(0,X.jsx)(MX.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:(0,X.jsx)(t8.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:tQ(e.onMouseDown,e=>{r?d.onItemFocus(c):e.preventDefault()}),onFocus:tQ(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:tQ(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.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 M9[i]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().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 s=i.indexOf(e.currentTarget);i=d.loop?(n=i,r=s+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(s+1)}setTimeout(()=>M7(i))}}),children:"function"==typeof o?o({isCurrentTabStop:u,hasTabStop:null!=m}):o})})});M6.displayName=M4;var M9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function M7(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}var M8=["Enter"," "],Oe=["ArrowUp","PageDown","End"],Ot=["ArrowDown","PageUp","Home",...Oe],On={ltr:[...M8,"ArrowRight"],rtl:[...M8,"ArrowLeft"]},Or={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Oi="Menu",[Os,Oo,Oa]=MU(Oi),[Ol,Oc]=tJ(Oi,[Oa,Ch,M0]),Od=Ch(),Ou=M0(),[Op,Oh]=Ol(Oi),[Of,Om]=Ol(Oi),Og=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Od(t),[l,c]=Q.useState(null),d=Q.useRef(!1),u=nt(s),p=MV(i);return Q.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.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)(Cg,{...a,children:(0,X.jsx)(Op,{scope:t,open:n,onOpenChange:u,content:l,onContentChange:c,children:(0,X.jsx)(Of,{scope:t,onClose:Q.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})};Og.displayName=Oi;var Ob=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Od(n);return(0,X.jsx)(Cy,{...i,...r,ref:t})});Ob.displayName="MenuAnchor";var Oy="MenuPortal",[Ox,Ov]=Ol(Oy,{forceMount:void 0}),Ow=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Oh(Oy,t);return(0,X.jsx)(Ox,{scope:t,forceMount:n,children:(0,X.jsx)(nb,{present:n||s.open,children:(0,X.jsx)(ng,{asChild:!0,container:i,children:r})})})};Ow.displayName=Oy;var OE="MenuContent",[Ok,OT]=Ol(OE),ON=Q.forwardRef((e,t)=>{let n=Ov(OE,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Oh(OE,e.__scopeMenu),o=Om(OE,e.__scopeMenu);return(0,X.jsx)(Os.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(nb,{present:r||s.open,children:(0,X.jsx)(Os.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(OA,{...i,ref:t}):(0,X.jsx)(OS,{...i,ref:t})})})})}),OA=Q.forwardRef((e,t)=>{let n=Oh(OE,e.__scopeMenu),r=Q.useRef(null),i=ej(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return rn(e)},[]),(0,X.jsx)(O_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:tQ(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),OS=Q.forwardRef((e,t)=>{let n=Oh(OE,e.__scopeMenu);return(0,X.jsx)(O_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),OC=t6("MenuContent.ScrollLock"),O_=Q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:p,onDismiss:h,disableOutsideScroll:f,...m}=e,g=Oh(OE,n),b=Om(OE,n),y=Od(n),x=Ou(n),v=Oo(n),[w,E]=Q.useState(null),k=Q.useRef(null),T=ej(t,k,g.onContentChange),N=Q.useRef(0),A=Q.useRef(""),S=Q.useRef(0),C=Q.useRef(null),_=Q.useRef("right"),M=Q.useRef(0),O=f?n4:Q.Fragment;Q.useEffect(()=>()=>window.clearTimeout(N.current),[]),nv();let I=Q.useCallback(e=>{var t,n;return _.current===C.current?.side&&(t=e,!!(n=C.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,s=t.length-1;e<t.length;s=e++){let o=t[e],a=t[s],l=o.x,c=o.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)(Ok,{scope:n,searchRef:A,onItemEnter:Q.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:Q.useCallback(e=>{I(e)||(k.current?.focus(),E(null))},[I]),onTriggerLeave:Q.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:S,onPointerGraceIntentChange:Q.useCallback(e=>{C.current=e},[]),children:(0,X.jsx)(O,{...f?{as:OC,allowPinchZoom:!0}:void 0,children:(0,X.jsx)(nd,{asChild:!0,trapped:i,onMountAutoFocus:tQ(s,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(ni,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:p,onDismiss:h,children:(0,X.jsx)(M3,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:E,onEntryFocus:tQ(l,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(CE,{role:"menu","aria-orientation":"vertical","data-state":O2(g.open),"data-radix-menu-content":"",dir:b.dir,...y,...m,ref:T,style:{outline:"none",...m.style},onKeyDown:tQ(m.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,s,o,a,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=A.current+i,s=v().filter(e=>!e.disabled),o=document.activeElement,a=s.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,s=n?e.indexOf(n):-1,o=(r=Math.max(s,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let a=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(s.map(e=>e.textValue),t,a),c=s.find(e=>e.textValue===l)?.ref.current,function e(t){A.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let s=k.current;if(e.target!==s||!Ot.includes(e.key))return;e.preventDefault();let o=v().filter(e=>!e.disabled).map(e=>e.ref.current);Oe.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:tQ(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),A.current="")}),onPointerMove:tQ(e.onPointerMove,O4(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(_.current=e.clientX>M.current?"right":"left",M.current=e.clientX)}))})})})})})})});ON.displayName=OE;var OM=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t8.div,{role:"group",...r,ref:t})});OM.displayName="MenuGroup";var OO=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t8.div,{...r,ref:t})});OO.displayName="MenuLabel";var OI="MenuItem",OD="menu.itemSelect",OR=Q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,s=Q.useRef(null),o=Om(OI,e.__scopeMenu),a=OT(OI,e.__scopeMenu),l=ej(t,s),c=Q.useRef(!1);return(0,X.jsx)(OL,{...i,ref:l,disabled:n,onClick:tQ(e.onClick,()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(OD,{bubbles:!0,cancelable:!0});e.addEventListener(OD,e=>r?.(e),{once:!0}),ne(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:tQ(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:tQ(e.onKeyDown,e=>{let t=""!==a.searchRef.current;n||t&&" "===e.key||M8.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});OR.displayName=OI;var OL=Q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=OT(OI,n),a=Ou(n),l=Q.useRef(null),c=ej(t,l),[d,u]=Q.useState(!1),[p,h]=Q.useState("");return Q.useEffect(()=>{let e=l.current;e&&h((e.textContent??"").trim())},[s.children]),(0,X.jsx)(Os.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,X.jsx)(M6,{asChild:!0,...a,focusable:!r,children:(0,X.jsx)(t8.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:tQ(e.onPointerMove,O4(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tQ(e.onPointerLeave,O4(e=>o.onItemLeave(e))),onFocus:tQ(e.onFocus,()=>u(!0)),onBlur:tQ(e.onBlur,()=>u(!1))})})})}),Oj=Q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(OG,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(OR,{role:"menuitemcheckbox","aria-checked":O3(n)?"mixed":n,...i,ref:t,"data-state":O5(n),onSelect:tQ(i.onSelect,()=>r?.(!!O3(n)||!n),{checkForDefaultPrevented:!1})})})});Oj.displayName="MenuCheckboxItem";var OP="MenuRadioGroup",[OB,OF]=Ol(OP,{value:void 0,onValueChange:()=>{}}),OH=Q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,s=nt(r);return(0,X.jsx)(OB,{scope:e.__scopeMenu,value:n,onValueChange:s,children:(0,X.jsx)(OM,{...i,ref:t})})});OH.displayName=OP;var OU="MenuRadioItem",Oz=Q.forwardRef((e,t)=>{let{value:n,...r}=e,i=OF(OU,e.__scopeMenu),s=n===i.value;return(0,X.jsx)(OG,{scope:e.__scopeMenu,checked:s,children:(0,X.jsx)(OR,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":O5(s),onSelect:tQ(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Oz.displayName=OU;var O$="MenuItemIndicator",[OG,Oq]=Ol(O$,{checked:!1}),OV=Q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,s=Oq(O$,n);return(0,X.jsx)(nb,{present:r||O3(s.checked)||!0===s.checked,children:(0,X.jsx)(t8.span,{...i,ref:t,"data-state":O5(s.checked)})})});OV.displayName=O$;var OW=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t8.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});OW.displayName="MenuSeparator";var OK=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Od(n);return(0,X.jsx)(CN,{...i,...r,ref:t})});OK.displayName="MenuArrow";var OY="MenuSub",[OX,OQ]=Ol(OY),OJ="MenuSubTrigger",OZ=Q.forwardRef((e,t)=>{let n=Oh(OJ,e.__scopeMenu),r=Om(OJ,e.__scopeMenu),i=OQ(OJ,e.__scopeMenu),s=OT(OJ,e.__scopeMenu),o=Q.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},d=Q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return Q.useEffect(()=>d,[d]),Q.useEffect(()=>{let e=a.current;return()=>{window.clearTimeout(e),l(null)}},[a,l]),(0,X.jsx)(Ob,{asChild:!0,...c,children:(0,X.jsx)(OL,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":O2(n.open),...e,ref:eL(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:tQ(e.onPointerMove,O4(t=>{s.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100)))})),onPointerLeave:tQ(e.onPointerLeave,O4(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tQ(e.onKeyDown,t=>{let i=""!==s.searchRef.current;e.disabled||i&&" "===t.key||On[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});OZ.displayName=OJ;var O0="MenuSubContent",O1=Q.forwardRef((e,t)=>{let n=Ov(OE,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Oh(OE,e.__scopeMenu),o=Om(OE,e.__scopeMenu),a=OQ(O0,e.__scopeMenu),l=Q.useRef(null),c=ej(t,l);return(0,X.jsx)(Os.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(nb,{present:r||s.open,children:(0,X.jsx)(Os.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(O_,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:tQ(e.onFocusOutside,e=>{e.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tQ(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:tQ(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Or[o.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),a.trigger?.focus(),e.preventDefault())})})})})})});function O2(e){return e?"open":"closed"}function O3(e){return"indeterminate"===e}function O5(e){return O3(e)?"indeterminate":e?"checked":"unchecked"}function O4(e){return t=>"mouse"===t.pointerType?e(t):void 0}O1.displayName=O0;var O6="DropdownMenu",[O9,O7]=tJ(O6,[Oc]),O8=Oc(),[Ie,It]=O9(O6),In=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=O8(t),c=Q.useRef(null),[d,u]=t5({prop:i,defaultProp:s??!1,onChange:o,caller:O6});return(0,X.jsx)(Ie,{scope:t,triggerId:t2(),triggerRef:c,contentId:t2(),open:d,onOpenChange:u,onOpenToggle:Q.useCallback(()=>u(e=>!e),[u]),modal:a,children:(0,X.jsx)(Og,{...l,open:d,onOpenChange:u,dir:r,modal:a,children:n})})};In.displayName=O6;var Ir="DropdownMenuTrigger",Ii=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=It(Ir,n),o=O8(n);return(0,X.jsx)(Ob,{asChild:!0,...o,children:(0,X.jsx)(t8.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:eL(t,s.triggerRef),onPointerDown:tQ(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:tQ(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&s.onOpenToggle(),"ArrowDown"===e.key&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});Ii.displayName=Ir;var Is=e=>{let{__scopeDropdownMenu:t,...n}=e,r=O8(t);return(0,X.jsx)(Ow,{...r,...n})};Is.displayName="DropdownMenuPortal";var Io="DropdownMenuContent",Ia=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=It(Io,n),s=O8(n),o=Q.useRef(!1);return(0,X.jsx)(ON,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:tQ(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:tQ(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.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)"}})});Ia.displayName=Io,Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OM,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var Il=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OO,{...i,...r,ref:t})});Il.displayName="DropdownMenuLabel";var Ic=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OR,{...i,...r,ref:t})});Ic.displayName="DropdownMenuItem";var Id=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(Oj,{...i,...r,ref:t})});Id.displayName="DropdownMenuCheckboxItem",Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OH,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var Iu=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(Oz,{...i,...r,ref:t})});Iu.displayName="DropdownMenuRadioItem";var Ip=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OV,{...i,...r,ref:t})});Ip.displayName="DropdownMenuItemIndicator";var Ih=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OW,{...i,...r,ref:t})});Ih.displayName="DropdownMenuSeparator",Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OK,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var If=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(OZ,{...i,...r,ref:t})});If.displayName="DropdownMenuSubTrigger";var Im=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O8(n);return(0,X.jsx)(O1,{...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)"}})});Im.displayName="DropdownMenuSubContent";let Ig=en("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);Q.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,X.jsxs)(If,{ref:i,className:tK("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",t&&"pl-8",e),...r,children:[n,(0,X.jsx)(ea,{className:"ml-auto h-4 w-4"})]})).displayName=If.displayName,Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Im,{ref:n,className:tK("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),...t})).displayName=Im.displayName;let Ib=Q.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,X.jsx)(Is,{children:(0,X.jsx)(Ia,{ref:r,sideOffset:t,className:tK("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),...n})}));Ib.displayName=Ia.displayName;let Iy=Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(Ic,{ref:r,className:tK("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",t&&"pl-8",e),...n}));Iy.displayName=Ic.displayName,Q.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,X.jsxs)(Id,{ref:i,className:tK("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:n,...r,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(Ip,{children:(0,X.jsx)(es,{className:"h-4 w-4"})})}),t]})).displayName=Id.displayName,Q.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(Iu,{ref:r,className:tK("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),...n,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(Ip,{children:(0,X.jsx)(Ig,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=Iu.displayName;let Ix=Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(Il,{ref:r,className:tK("px-2 py-1.5 text-sm font-normal",t&&"pl-8",e),...n}));Ix.displayName=Il.displayName;let Iv=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Ih,{ref:n,className:tK("-mx-1 my-1 h-px bg-muted",e),...t}));Iv.displayName=Ih.displayName;let Iw={stopped:"Stopped",installing:"Installing dependencies…",starting:"Starting…",running:"Running",error:"Error"};function IE({path:e,title:t}){let[n,r]=(0,Q.useState)("stopped"),[i,s]=(0,Q.useState)(null),[o,a]=(0,Q.useState)([]),[l,c]=(0,Q.useState)(null),[d,u]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(0),[f,m]=(0,Q.useState)([]),[g,b]=(0,Q.useState)(null),y=(0,Q.useRef)(null),x=(0,Q.useRef)(null),v=`/api/app-proxy/${e}/`,w=()=>{y.current&&(clearInterval(y.current),y.current=null)},E=(0,Q.useCallback)(async()=>{try{let t=await rK(`/api/wiki/app?path=${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json();r(n.status),a(n.logs??[]),n.scripts&&m(n.scripts),void 0!==n.defaultScript&&b(n.defaultScript),n.port&&s(n.port),n.error&&c(n.error),("running"===n.status||"stopped"===n.status||"error"===n.status)&&w()}catch{}},[e]);(0,Q.useEffect)(()=>("installing"===n||"starting"===n?y.current||(y.current=setInterval(E,800)):w(),w),[n,E]),(0,Q.useEffect)(()=>{x.current?.scrollIntoView({behavior:"smooth"})},[o]),(0,Q.useEffect)(()=>{E()},[E]);let k=async t=>{c(null),a([]),r("starting");try{let n=await rK("/api/wiki/app",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,script:t})}),i=await n.json();if(!n.ok||i.error){r("error"),c(i.error??"Failed to start");return}i.port&&s(i.port),await E()}catch(e){r("error"),c(String(e))}},T=async()=>{await rK("/api/wiki/app",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),r("stopped"),s(null)},N=async()=>{await T(),await k(),h(e=>e+1)},A=f.filter(e=>e!==g);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rY,{path:e,badge:"Node app",children:["running"===n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>h(e=>e+1),children:[(0,X.jsx)(eS,{className:"h-3.5 w-3.5"}),"Refresh"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(v,"_blank"),children:[(0,X.jsx)(kb,{className:"h-3.5 w-3.5"}),"Open in new tab"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:N,children:[(0,X.jsx)(eS,{className:"h-3.5 w-3.5"}),"Restart"]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs text-destructive hover:text-destructive",onClick:T,children:[(0,X.jsx)(MH,{className:"h-3.5 w-3.5"}),"Stop"]})]}),(0,X.jsxs)(tX,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>u(e=>!e),children:[(0,X.jsx)(eM,{className:"h-3.5 w-3.5"}),"Logs"]})]}),d&&(0,X.jsxs)("div",{className:"border-b bg-black/90 text-green-400 font-mono text-xs h-40 overflow-auto p-2 shrink-0",children:[0===o.length?(0,X.jsx)("span",{className:"text-muted-foreground",children:"No output yet."}):o.map((e,t)=>(0,X.jsx)("div",{className:"whitespace-pre-wrap leading-5",children:e},t)),(0,X.jsx)("div",{ref:x})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:["stopped"===n&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[(0,X.jsxs)("div",{className:"text-center space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:t}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Node.js app — will be started on a local port"})]}),(0,X.jsxs)("div",{className:"inline-flex items-stretch overflow-hidden rounded-full bg-primary text-primary-foreground shadow-e-1",children:[(0,X.jsxs)("button",{type:"button",onClick:()=>k(),className:"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors hover:bg-primary-foreground/10 focus-visible:outline-none",children:[(0,X.jsx)(MF,{className:"h-4 w-4"}),"Launch app",g&&(0,X.jsxs)("span",{className:"opacity-70",children:["(",g,")"]})]}),A.length>0&&(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)("button",{type:"button",className:"inline-flex items-center justify-center border-l border-l-primary-foreground/20 px-2 transition-colors hover:bg-primary-foreground/10 focus-visible:outline-none","aria-label":"Choose script to launch",children:(0,X.jsx)(eo,{className:"h-4 w-4"})})}),(0,X.jsxs)(Ib,{align:"end",children:[(0,X.jsx)(Ix,{children:"Run script"}),(0,X.jsx)(Iv,{}),f.map(e=>(0,X.jsxs)(Iy,{onSelect:()=>k(e),className:"gap-2 font-mono text-xs",children:[(0,X.jsx)(MF,{className:"h-3.5 w-3.5"}),e,e===g&&(0,X.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"default"})]},e))]})]})]})]}),("installing"===n||"starting"===n)&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",children:[(0,X.jsx)(ex,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:Iw[n]}),i&&(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["port ",i]})]}),"error"===n&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-6",children:[(0,X.jsx)(er,{className:"h-8 w-8 text-destructive"}),(0,X.jsxs)("div",{className:"text-center space-y-1 max-w-md",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Failed to start app"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:l??"Unknown error"})]}),(0,X.jsxs)(tX,{onClick:()=>k(),variant:"outline",className:"gap-2",children:[(0,X.jsx)(eS,{className:"h-4 w-4"}),"Try again"]})]}),"running"===n&&(0,X.jsx)("iframe",{src:v,className:"flex-1 w-full border-0 bg-card",title:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-top-navigation-by-user-activation"},p)]})]})}let Ik=en("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),IT=en("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),IN=en("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);function IA({onSelect:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[s,o]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)([]),[h,f]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),g=(0,Q.useRef)(null),b=(0,Q.useCallback)(async(e,t=!0)=>{g.current&&(clearTimeout(g.current),g.current=null),i(!0),o(null);try{let r=await fetch(`/api/system/browse?path=${encodeURIComponent(e)}`);if(!r.ok){let e=await r.json();o(e.error??"Cannot open directory");return}let i=await r.json();n(i),t&&l(i.path)}catch{o("Network error")}finally{i(!1)}},[]);(0,Q.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/system/config");if(t.ok&&!e){let e=await t.json();p(e.pinnedPaths??[]),await b(e.lastOpenedPath??"");return}}catch{}e||await b("")})(),()=>{e=!0}},[]);let y=async n=>{let r=n??t?.path;if(r){d(!0);try{let t=await fetch("/api/system/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rootDir:r})});if(!t.ok){let e=await t.json();o(e.message??e.error??"Cannot use that directory");return}let{workspace:n}=await t.json();e(n.id)}catch{o("Network error")}finally{d(!1)}}},x=!!t&&u.includes(t.path),v=async()=>{if(t){f(!0);try{let e=x?"unpin":"pin";(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,action:e})})).ok&&p(n=>"pin"===e?[...n,t.path]:n.filter(e=>e!==t.path))}catch{}finally{f(!1)}}},w=async e=>{try{(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,action:"unpin"})})).ok&&p(t=>t.filter(t=>t!==e))}catch{}},E=(t?.path??"").split(/[/\\]/).filter(Boolean).reduce((e,t)=>{let n=e[e.length-1]?.path??"/";return e.push({label:t,path:`${"/"===n?"":n}/${t}`}),e},[{label:"/",path:"/"}]);return(0,X.jsx)("div",{className:"flex flex-1 items-center justify-center bg-background p-4",children:(0,X.jsxs)("div",{className:"flex w-full max-w-xl flex-col gap-4",children:[(0,X.jsxs)("div",{className:"text-center space-y-1",children:[(0,X.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-1",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-8 w-8"}),(0,X.jsx)("span",{className:"text-xl font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)("h1",{className:"text-xl font-medium",children:"Choose a directory"}),(0,X.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select the folder wiki-viewer should serve.",(0,X.jsx)("br",{}),"This directory lives on the server — use the browser below."]})]}),(0,X.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,X.jsx)("div",{className:"flex items-center gap-2 border-b px-3 py-2 bg-muted",children:(0,X.jsx)("input",{ref:m,className:"flex-1 bg-transparent text-sm outline-none font-mono min-w-0",value:a,onChange:e=>{let t=e.target.value;l(t),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,b(t.trim(),!1)},500)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g.current&&(clearTimeout(g.current),g.current=null),b(a.trim())),"Escape"===e.key&&(g.current&&(clearTimeout(g.current),g.current=null),l(t?.path??""),m.current?.blur())},spellCheck:!1,placeholder:"Enter a path…"})}),(0,X.jsx)("div",{className:"flex items-center gap-1 border-b px-3 py-1.5 bg-muted/50 overflow-x-auto shrink-0 min-h-[32px]",children:E.map((e,t)=>(0,X.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[t>0&&(0,X.jsx)(ea,{className:"h-3 w-3 text-muted-foreground/50"}),(0,X.jsx)("button",{type:"button",className:"text-xs hover:text-foreground text-muted-foreground transition-colors rounded px-0.5",onClick:()=>b(e.path),children:0===t?(0,X.jsx)(Ik,{className:"h-3.5 w-3.5"}):e.label})]},e.path))}),(0,X.jsx)("div",{className:"max-h-60 overflow-y-auto",children:r?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):s?(0,X.jsx)("div",{className:"px-4 py-3 text-sm text-destructive",children:s}):(0,X.jsxs)(X.Fragment,{children:[t?.parent&&(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>b(t.parent),children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0"}),(0,X.jsx)("span",{className:"font-mono text-xs",children:".."})]}),t?.entries.length===0&&(0,X.jsx)("p",{className:"px-4 py-3 text-sm text-muted-foreground/60",children:"No subdirectories"}),t?.entries.map(e=>(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>b(e.path),children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("span",{className:"truncate",children:e.name})]},e.path))]})}),(0,X.jsxs)("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 bg-muted",children:[(0,X.jsxs)("button",{type:"button",className:tK("flex items-center gap-1.5 text-xs transition-colors rounded px-1.5 py-1",x?"text-foreground hover:text-destructive":"text-muted-foreground hover:text-foreground"),title:x?"Unpin this path":"Pin this path for quick access",onClick:v,disabled:h||!t,children:[h?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):x?(0,X.jsx)(IN,{className:"h-3.5 w-3.5"}):(0,X.jsx)(eN,{className:"h-3.5 w-3.5"}),x?"Unpin":"Pin"]}),(0,X.jsxs)(tX,{size:"sm",className:"shrink-0 gap-1.5",disabled:!t||c,onClick:()=>y(),children:[c?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ef,{className:"h-3.5 w-3.5"}),"Select"]})]})]}),u.length>0&&(0,X.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,X.jsx)("div",{className:"px-3 py-2 border-b bg-muted",children:(0,X.jsxs)("span",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[(0,X.jsx)(eN,{className:"h-3 w-3"})," Pinned"]})}),(0,X.jsx)("div",{className:"max-h-40 overflow-y-auto",children:u.map(e=>(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-accent group",children:[(0,X.jsxs)("button",{type:"button",className:"flex-1 flex items-center gap-2 text-sm text-left min-w-0",onClick:()=>b(e),children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:e})]}),(0,X.jsx)("button",{type:"button",className:"shrink-0 text-muted-foreground/50 hover:text-destructive opacity-0 group-hover:opacity-100 transition-all",onClick:()=>w(e),title:"Remove pin",children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]},e))})]}),t?.shortcuts&&t.shortcuts.length>0&&(0,X.jsx)("div",{className:"flex flex-wrap gap-1.5 justify-center",children:t.shortcuts.map(e=>(0,X.jsxs)(tX,{variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>b(e.path),children:["Home"===e.label?(0,X.jsx)(IT,{className:"h-3 w-3"}):(0,X.jsx)(Ik,{className:"h-3 w-3"}),e.label]},e.path))})]})})}let IS=en("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),IC=en("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var I_=e.i(917356);function IM({className:e}){let{resolvedTheme:t,setTheme:n}=(0,I_.useTheme)();return(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:"dark"===t?"Switch to light":"Switch to dark",onClick:()=>n("dark"===t?"light":"dark"),children:"dark"===t?(0,X.jsx)(IC,{className:"h-3.5 w-3.5"}):(0,X.jsx)(IS,{className:"h-3.5 w-3.5"})})}let IO=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rm,{ref:n,className:tK("fixed inset-0 z-40 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));IO.displayName="SheetOverlay";let II={bottom:"inset-x-0 bottom-0 data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom",top:"inset-x-0 top-0 data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top",left:"inset-y-0 left-0 data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left",right:"inset-y-0 right-0 data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right"},ID=Q.forwardRef(({side:e="bottom",showClose:t=!1,className:n,children:r,...i},s)=>(0,X.jsxs)(rh,{children:[(0,X.jsx)(IO,{}),(0,X.jsxs)(rx,{ref:s,className:tK("fixed z-50 bg-background shadow-golden transition-all ease-in-out","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",II[e],n),...i,children:[r,t&&(0,X.jsxs)(rC,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none",children:[(0,X.jsx)(eD,{className:"h-4 w-4"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));ID.displayName="SheetContent",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rT,{ref:n,className:tK("text-sm font-medium leading-none tracking-tight",e),...t})).displayName="SheetTitle",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rA,{ref:n,className:tK("text-sm text-muted-foreground",e),...t})).displayName="SheetDescription";var IR=e.i(199075);function IL(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function Ij({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(!1),[i,s]=(0,Q.useState)(!1),[o,a]=(0,Q.useState)(null),[l,c]=(0,Q.useState)("env"),[d,u]=(0,Q.useState)(""),[p,h]=(0,Q.useState)(""),[f,m]=(0,Q.useState)(null),{data:g}=IR.authClient.useSession(),[b,y]=(0,Q.useState)(!1),[x,v]=(0,Q.useState)([]),[w,E]=(0,Q.useState)([]),[k,T]=(0,Q.useState)(null),[N,A]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(""),[_,M]=(0,Q.useState)(""),[O,I]=(0,Q.useState)(!1),[D,R]=(0,Q.useState)(null),L=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/admins");if(!e.ok)return;let t=await e.json();y(!!t.isAdmin),v(t.admins??[]),E(t.users??[])}catch{}},[]),j=(0,Q.useCallback)(async()=>{r(!0),a(null);try{let e=await fetch("/api/system/auth-settings");if(!e.ok)throw Error("Failed to load settings");let t=await e.json();u(t.allowedEmails.join("\n")),h(t.allowedDomains.join("\n")),c(t.source),m("number"==typeof t.rateLimit?t.rateLimit:null)}catch(e){a(e instanceof Error?e.message:"Failed to load")}finally{r(!1)}},[]);async function P(){s(!0),a(null);try{let e=await fetch("/api/system/auth-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({allowedEmails:IL(d),allowedDomains:IL(p)})}),n=await e.json();if(!e.ok){a(n.error??"Save failed"),wB(n.error??"Save failed");return}n.source&&c(n.source),t(!1)}catch{a("Save failed")}finally{s(!1)}}(0,Q.useEffect)(()=>{e&&(j(),L())},[e,j,L]);let B=0===IL(d).length&&0===IL(p).length;return(0,X.jsx)(rl,{open:e,onOpenChange:t,children:(0,X.jsxs)(ID,{side:"right",className:"w-80 sm:max-w-md flex flex-col border-l border-border p-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsx)("span",{className:"text-sm font-semibold",children:"Settings"}),(0,X.jsxs)(rC,{className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,X.jsx)(eD,{className:"h-3.5 w-3.5"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]}),n?(0,X.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,X.jsxs)("div",{className:"flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[g?.user&&(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Account"}),(0,X.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border bg-muted/40 p-3",children:[(0,X.jsxs)("div",{className:"text-sm min-w-0",children:[(0,X.jsx)("div",{className:"font-medium truncate",children:g.user.name}),(0,X.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g.user.email})]}),(0,X.jsx)("button",{type:"button",onClick:async()=>{await IR.authClient.signOut(),window.location.href="/signin"},className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",children:"Sign out"})]})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Signup allowlist"}),(0,X.jsxs)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Control who can create an account. Leave both lists empty to allow any email. Saving here overrides the"," ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_EMAILS"})," ","and"," ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_DOMAIN"})," ","environment variables."]}),"env"===l&&(0,X.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,X.jsx)("span",{children:"Current values come from environment variables. Saving moves the allowlist into config and takes precedence going forward."})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)("label",{htmlFor:"allowed-emails",className:"text-sm font-medium",children:"Allowed emails"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Exact match, case-insensitive."}),(0,X.jsx)("textarea",{id:"allowed-emails",value:d,onChange:e=>u(e.target.value),spellCheck:!1,rows:5,placeholder:"alice@example.com bob@example.com",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)("label",{htmlFor:"allowed-domains",className:"text-sm font-medium",children:"Allowed domains"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Matches any email at that domain."}),(0,X.jsx)("textarea",{id:"allowed-domains",value:p,onChange:e=>h(e.target.value),spellCheck:!1,rows:4,placeholder:"example.com trusted.org",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),B&&(0,X.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-ink",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,X.jsx)("span",{children:"Both lists are empty. Anyone with the signup URL can create an account."})]}),o&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),o]})]}),b&&(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Admins"}),(0,X.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Admins can create workspaces, add users, and manage access."}),k&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),k]}),(0,X.jsxs)("div",{className:"space-y-2 rounded-md border border-border p-3",children:[(0,X.jsx)("div",{className:"text-xs font-medium",children:"Add user"}),D?(0,X.jsxs)("div",{className:"space-y-2",children:[(0,X.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Created ",(0,X.jsx)("span",{className:"font-medium text-foreground",children:D.email}),". Share this temporary password now, it will not be shown again."]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-sm select-all",children:D.tempPassword}),(0,X.jsx)("button",{type:"button",className:"shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",onClick:()=>void navigator.clipboard?.writeText(D.tempPassword),children:"Copy"})]}),(0,X.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:()=>{R(null),C(""),M(""),L()},children:"Done"})]}):(0,X.jsxs)("div",{className:"space-y-2",children:[(0,X.jsx)("input",{type:"email",value:S,onChange:e=>C(e.target.value),placeholder:"email@team.com",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,X.jsx)("input",{type:"text",value:_,onChange:e=>M(e.target.value),placeholder:"Name (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,X.jsxs)(tX,{size:"sm",className:"w-full gap-1.5",disabled:O||!S.trim(),onClick:async()=>{I(!0),T(null);try{let e=await fetch("/api/system/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:S.trim(),name:_.trim()})}),t=await e.json();e.ok&&t.tempPassword?R({email:t.email??S.trim(),tempPassword:t.tempPassword}):T(t.message??t.error??"Failed to create user")}catch{T("Network error")}finally{I(!1)}},children:[O&&(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}),"Create user"]})]})]}),(0,X.jsxs)("div",{className:"space-y-1 rounded-md border border-border overflow-hidden",children:[w.map(e=>{let t=x.includes(e.id);return(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/40 hover:bg-muted/60 transition-colors",children:[(0,X.jsxs)("div",{className:"text-sm min-w-0",children:[(0,X.jsx)("div",{className:"font-medium truncate",children:e.name}),(0,X.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.email})]}),(0,X.jsx)("button",{type:"button",disabled:N===e.id,className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent disabled:opacity-50",onClick:async()=>{A(e.id),T(null);try{let n=await fetch("/api/system/admins",{method:t?"DELETE":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.id})}),r=await n.json();n.ok?r.admins&&v(r.admins):T(r.message??r.error??"Failed")}catch{T("Network error")}finally{A(null)}},children:N===e.id?(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}):t?"Demote":"Promote"})]},e.id)}),0===w.length&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No users yet."})]})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agent rate limit"}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"text-muted-foreground",children:"Per agent"}),(0,X.jsx)("span",{className:"font-mono",children:null!==f?`${f} ops/min`:"--"})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:["Override with ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AGENT_RATE_LIMIT"})," env var."]})]})]})]}),(0,X.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3 shrink-0",children:[(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",onClick:P,disabled:i||n,className:"gap-1.5",children:[i&&(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}),"Save"]})]})]})})}let IP=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:tK("rounded-md border border-border bg-card text-card-foreground shadow-e-2",e),...t}));IP.displayName="Card",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:tK("flex flex-col space-y-1.5 p-6",e),...t})).displayName="CardHeader",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:tK("text-lg font-normal leading-none tracking-tight",e),...t})).displayName="CardTitle",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:tK("text-sm text-muted-foreground",e),...t})).displayName="CardDescription",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:tK("p-6 pt-0",e),...t})).displayName="CardContent";var IB="ContextMenu",[IF,IH]=tJ(IB,[Oc]),IU=Oc(),[Iz,I$]=IF(IB),IG=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,a]=Q.useState(!1),l=IU(t),c=nt(r),d=Q.useCallback(e=>{a(e),c(e)},[c]);return(0,X.jsx)(Iz,{scope:t,open:o,onOpenChange:d,modal:s,children:(0,X.jsx)(Og,{...l,dir:i,open:o,onOpenChange:d,modal:s,children:n})})};IG.displayName=IB;var Iq="ContextMenuTrigger",IV=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=I$(Iq,n),o=IU(n),a=Q.useRef({x:0,y:0}),l=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=Q.useRef(0),d=Q.useCallback(()=>window.clearTimeout(c.current),[]),u=e=>{a.current={x:e.clientX,y:e.clientY},s.onOpenChange(!0)};return Q.useEffect(()=>d,[d]),Q.useEffect(()=>void(r&&d()),[r,d]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ob,{...o,virtualRef:l}),(0,X.jsx)(t8.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:tQ(e.onContextMenu,e=>{d(),u(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:tQ(e.onPointerDown,I5(e=>{d(),c.current=window.setTimeout(()=>u(e),700)})),onPointerMove:r?e.onPointerMove:tQ(e.onPointerMove,I5(d)),onPointerCancel:r?e.onPointerCancel:tQ(e.onPointerCancel,I5(d)),onPointerUp:r?e.onPointerUp:tQ(e.onPointerUp,I5(d))})]})});IV.displayName=Iq;var IW=e=>{let{__scopeContextMenu:t,...n}=e,r=IU(t);return(0,X.jsx)(Ow,{...r,...n})};IW.displayName="ContextMenuPortal";var IK="ContextMenuContent",IY=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=I$(IK,n),s=IU(n),o=Q.useRef(!1);return(0,X.jsx)(ON,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||i.modal||(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});IY.displayName=IK,Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OM,{...i,...r,ref:t})}).displayName="ContextMenuGroup";var IX=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OO,{...i,...r,ref:t})});IX.displayName="ContextMenuLabel";var IQ=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OR,{...i,...r,ref:t})});IQ.displayName="ContextMenuItem";var IJ=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(Oj,{...i,...r,ref:t})});IJ.displayName="ContextMenuCheckboxItem",Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OH,{...i,...r,ref:t})}).displayName="ContextMenuRadioGroup";var IZ=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(Oz,{...i,...r,ref:t})});IZ.displayName="ContextMenuRadioItem";var I0=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OV,{...i,...r,ref:t})});I0.displayName="ContextMenuItemIndicator";var I1=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OW,{...i,...r,ref:t})});I1.displayName="ContextMenuSeparator",Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OK,{...i,...r,ref:t})}).displayName="ContextMenuArrow";var I2=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(OZ,{...i,...r,ref:t})});I2.displayName="ContextMenuSubTrigger";var I3=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=IU(n);return(0,X.jsx)(O1,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function I5(e){return t=>"mouse"!==t.pointerType?e(t):void 0}I3.displayName="ContextMenuSubContent",Q.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,X.jsxs)(I2,{ref:i,className:tK("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",t&&"pl-8",e),...r,children:[n,(0,X.jsx)(ea,{className:"ml-auto h-4 w-4"})]})).displayName=I2.displayName,Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(I3,{ref:n,className:tK("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),...t})).displayName=I3.displayName;let I4=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(IW,{children:(0,X.jsx)(IY,{ref:n,className:tK("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),...t})}));I4.displayName=IY.displayName;let I6=Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(IQ,{ref:r,className:tK("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",t&&"pl-8",e),...n}));I6.displayName=IQ.displayName,Q.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,X.jsxs)(IJ,{ref:i,className:tK("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:n,...r,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(I0,{children:(0,X.jsx)(es,{className:"h-4 w-4"})})}),t]})).displayName=IJ.displayName,Q.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(IZ,{ref:r,className:tK("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),...n,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(I0,{children:(0,X.jsx)(Ig,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=IZ.displayName,Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(IX,{ref:r,className:tK("px-2 py-1.5 text-sm font-normal",t&&"pl-8",e),...n})).displayName=IX.displayName;let I9=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(I1,{ref:n,className:tK("-mx-1 my-1 h-px bg-muted",e),...t}));function I7(e){return e?`wiki-recent-files-${e}`:"wiki-recent-files"}function I8(e){try{let t=localStorage.getItem(I7(e));return t?JSON.parse(t):[]}catch{return[]}}I9.displayName=I1.displayName;let De=wu(e=>({recents:[],loadForWorkspace:t=>{e({recents:I8(t)})},push:(t,n)=>{let r=I8(n).filter(e=>e.path!==t.path),i=[t,...r].slice(0,15);localStorage.setItem(I7(n),JSON.stringify(i)),e({recents:i})}}));function Dt(e){return e?`wiki-pinned-files-${e}`:"wiki-pinned-files"}function Dn(e){try{let t=localStorage.getItem(Dt(e));return t?JSON.parse(t):[]}catch{return[]}}let Dr=wu((e,t)=>({pins:[],loadForWorkspace:t=>{e({pins:Dn(t)})},toggle:(t,n)=>{let r=Dn(n),i=r.some(e=>e.path===t.path)?r.filter(e=>e.path!==t.path):[...r,t];localStorage.setItem(Dt(n),JSON.stringify(i)),e({pins:i})},isPinned:e=>t().pins.some(t=>t.path===e)})),Di=en("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),Ds=en("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),Do=en("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Da=en("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function Dl(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function Dc({scope:e}){return(0,X.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 font-mono",children:[e.paths.join(", ")," · ",e.ops.join(",")]})}function Dd({reg:e,onApprove:t,onDeny:n}){let[r,i]=(0,Q.useState)(!1);async function s(t){i(!0);try{await t(e.registrationId)}finally{i(!1)}}return(0,X.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.agentId}),(0,X.jsx)(Dc,{scope:e.requestedScope})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,X.jsxs)(tX,{size:"sm",variant:"default",className:"h-6 px-2 text-[10px]",disabled:r,onClick:()=>void s(t),title:"Approve",children:[(0,X.jsx)(Ds,{className:"h-3 w-3 mr-0.5"}),"Approve"]}),(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[10px] text-destructive hover:text-destructive",disabled:r,onClick:()=>void s(n),title:"Deny",children:[(0,X.jsx)(Do,{className:"h-3 w-3 mr-0.5"}),"Deny"]})]})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Requested ",Dl(e.requestedAt)]})]})}function Du({agent:e,onRevoke:t}){let[n,r]=(0,Q.useState)(!1);return(0,X.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.id}),(0,X.jsx)(Dc,{scope:e.scope})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0 text-destructive hover:text-destructive",disabled:n,onClick:async()=>{r(!0);try{await t(e.id)}finally{r(!1)}},title:"Revoke agent",children:(0,X.jsx)(eO,{className:"h-3 w-3"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Last seen ",Dl(e.lastSeen)]})]})}function Dp(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)([]),[i,s]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{fetch("/api/owner/init",{credentials:"same-origin"}).then(e=>{(e.ok||204===e.status)&&s(!0)}).catch(()=>{s(!0)})},[]);let o=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/registrations",{credentials:"same-origin"});if(!e.ok)return;let n=await e.json();t(n.pending)}catch{}},[]),a=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/agents",{credentials:"same-origin"});if(!e.ok)return;let t=await e.json();r(t.agents)}catch{}},[]);(0,Q.useEffect)(()=>{if(!i)return;o(),a();let e=setInterval(()=>void o(),5e3),t=setInterval(()=>void a(),3e4);return()=>{clearInterval(e),clearInterval(t)}},[i,o,a]);let l=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/approve`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"})).ok?(wj.toast.success("Agent approved"),await Promise.all([o(),a()])):wj.toast.error("Failed to approve agent")},[o,a]),c=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/deny`,{method:"POST",credentials:"same-origin"})).ok?(wj.toast.success("Registration denied"),await o()):wj.toast.error("Failed to deny registration")},[o]),d=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/agents/${encodeURIComponent(e)}/revoke`,{method:"POST",credentials:"same-origin"})).ok?(wj.toast.success("Agent revoked"),await a()):wj.toast.error("Failed to revoke agent")},[a]);return(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agents · approve & manage access"}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0",title:"Refresh",onClick:()=>void Promise.all([o(),a()]),children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),e.length>0&&(0,X.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-50/10 p-2",children:[(0,X.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-amber-600/80 mb-1 flex items-center gap-1",children:[(0,X.jsx)(Da,{className:"h-3 w-3"}),"Waiting for your approval (",e.length,")"]}),(0,X.jsx)("ul",{children:e.map(e=>(0,X.jsx)(Dd,{reg:e,onApprove:l,onDeny:c},e.registrationId))})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-2",children:0===n.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 py-1",children:["No assistants connected yet."," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"Connect one above; once it requests access it’ll appear here for you to approve."})]}):(0,X.jsx)("ul",{children:n.map(e=>(0,X.jsx)(Du,{agent:e,onRevoke:d},e.id))})}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 leading-relaxed",children:"Each assistant gets its own access that you can revoke anytime. New requests appear above for your approval before they can read or edit anything."})]})}function Dh({event:e}){var t;let n=e.path.split("/").pop()??e.path,r="string"==typeof e.ref?e.ref:"";return(0,X.jsxs)("div",{className:"flex flex-col gap-0.5 py-1.5 border-b border-border/50 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,X.jsx)("span",{className:"text-xs font-mono text-foreground/80 truncate",title:e.path,children:n}),(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:function(e){let t=Math.floor(Math.max(0,Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}(e.at)})]}),(0,X.jsxs)("p",{className:"text-[11px] text-muted-foreground truncate",children:[(0,X.jsx)("span",{className:"text-foreground/60",children:e.by})," ",{"block.replace":"replaced","block.insertAfter":"inserted after","block.insertBefore":"inserted before","block.delete":"deleted","block.append":"appended","block.prepend":"prepended","comment.add":"commented on","comment.reply":"replied to comment","comment.resolve":"resolved comment","comment.reopen":"reopened comment","suggestion.add":"suggested","suggestion.accept":"accepted suggestion","suggestion.reject":"rejected suggestion"}[t=e.type]??t,r&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground/60",children:r})]})]})]})}let Df="npx skills add anh-chu/wiki-viewer/agents/wiki-viewer-skill";function Dm(e){let[t,n]=(0,Q.useState)(!1);return{copied:t,copy:(0,Q.useCallback)(async()=>{await navigator.clipboard.writeText(e()),n(!0),setTimeout(()=>n(!1),1500)},[e])}}function Dg({currentPath:e}){let t=wp(e=>e.isOpen),n=wp(e=>e.close),r=wp(e=>e.activity),i=wp(e=>e.connections),s=wp(e=>e.loadActivity),{copied:o,copy:a}=function(e){let[t,n]=(0,Q.useState)(!1);return{copied:t,copy:(0,Q.useCallback)(async()=>{let t=window.location.origin,r=`# 1. Register
116
- REG=$(curl -s -X POST -H 'Content-Type: application/json' \\
117
- -d '{"id":"ai:claude","displayName":"Claude"}' \\
118
- ${t}/api/agent/register)
119
- REG_ID=$(echo $REG | jq -r .registrationId)
120
-
121
- # 2. Approve in AI Panel, then poll:
122
- curl -s ${t}/api/agent/register/$REG_ID
123
- # → {"status":"approved","token":"..."}
124
- TOKEN=<paste token here>
125
-
126
- # 3. Read snapshot
127
- curl -s -H "Authorization: Bearer $TOKEN" \\
128
- -H "X-Agent-Id: ai:claude" \\
129
- ${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,p=(0,Q.useCallback)(()=>Df,[]),h=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=Dm(p),b=Dm(h),y=Dm(f),x=Dm(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;s();let e=setInterval(()=>void s(),1e4);return()=>clearInterval(e)},[t,s]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:Df}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[o?(0,X.jsx)(es,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(el,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(Dp,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(Di,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(Dh,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}var Db=/[\\\/_+.#"@\[\(\{&]/,Dy=/[\\\/_+.#"@\[\(\{&]/g,Dx=/[\s-]/,Dv=/[\s-]/g;function Dw(e){return e.toLowerCase().replace(Dv," ")}var DE='[cmdk-group=""]',Dk='[cmdk-group-items=""]',DT='[cmdk-item=""]',DN=`${DT}:not([aria-disabled="true"])`,DA="cmdk-item-select",DS="data-value",DC=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,s,o,a){if(o===n.length)return s===t.length?1:.99;var l=`${s},${o}`;if(void 0!==a[l])return a[l];for(var c,d,u,p,h=i.charAt(o),f=r.indexOf(h,s),m=0;f>=0;)(c=e(t,n,r,i,f+1,o+1,a))>m&&(f===s?c*=1:Db.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(Dy))&&s>0&&(c*=Math.pow(.999,u.length))):Dx.test(t.charAt(f-1))?(c*=.9,(p=t.slice(s,f-1).match(Dv))&&s>0&&(c*=Math.pow(.999,p.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==n.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(f-1)===i.charAt(o+1)||i.charAt(o+1)===i.charAt(o)&&r.charAt(f-1)!==i.charAt(o))&&.1*(d=e(t,n,r,i,f+1,o+2,a))>c&&(c=.1*d),c>m&&(m=c),f=r.indexOf(h,f+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,Dw(r),Dw(t),0,0,{})},D_=Q.createContext(void 0),DM=Q.createContext(void 0),DO=Q.createContext(void 0),DI=Q.forwardRef((e,t)=>{let n=Dz(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Dz(()=>new Set),i=Dz(()=>new Map),s=Dz(()=>new Map),o=Dz(()=>new Set),a=DH(e),{label:l,children:c,value:d,onValueChange:u,filter:p,shouldFilter:h,loop:f,disablePointerSelection:m=!1,vimBindings:g=!0,...b}=e,y=t2(),x=t2(),v=t2(),w=Q.useRef(null),E=Dq();DU(()=>{if(void 0!==d){let e=d.trim();n.current.value=e,k.emit()}},[d]),DU(()=>{E(6,_)},[]);let k=Q.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,s,o,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)C(),A(),E(1,S);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(v);e?e.focus():null==(i=document.getElementById(y))||i.focus()}if(E(7,()=>{var e;n.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),r||E(5,_),(null==(s=a.current)?void 0:s.value)!==void 0){null==(l=(o=a.current).onValueChange)||l.call(o,null!=t?t:"");return}}k.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=Q.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=s.current.get(e))?void 0:i.value)&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,N(t,r)),E(2,()=>{A(),k.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),E(3,()=>{C(),A(),n.current.value||S(),k.emit()}),()=>{s.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();E(4,()=>{C(),(null==t?void 0:t.getAttribute("id"))===e&&S(),k.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{s.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:y,inputId:v,labelId:x,listInnerRef:w}),[]);function N(e,t){var r,i;let s=null!=(i=null==(r=a.current)?void 0:r.filter)?i:DC;return e?s(e,n.current.search,t):0}function A(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),s=0;r.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([n,s])});let r=w.current;O().sort((t,n)=>{var r,i;let s=t.getAttribute("id"),o=n.getAttribute("id");return(null!=(r=e.get(o))?r:0)-(null!=(i=e.get(s))?i:0)}).forEach(e=>{let t=e.closest(Dk);t?t.appendChild(e.parentElement===t?e:e.closest(`${Dk} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Dk} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=w.current)?void 0:t.querySelector(`${DE}[${DS}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function S(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(DS);k.setState("value",t||void 0)}function C(){var e,t,o,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let c=0;for(let i of r.current){let r=N(null!=(t=null==(e=s.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(o=s.current.get(i))?void 0:o.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&c++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=c}function _(){var e,t,n;let r=M();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(DE))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=w.current)?void 0:e.querySelector(`${DT}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(DN))||[])}function I(e){let t=O()[e];t&&k.setState("value",t.getAttribute(DS))}function D(e){var t;let n=M(),r=O(),i=r.findIndex(e=>e===n),s=r[i+e];null!=(t=a.current)&&t.loop&&(s=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),s&&k.setState("value",s.getAttribute(DS))}function R(e){let t=M(),n=null==t?void 0:t.closest(DE),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,DE):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,DE))?void 0:n.querySelector(DN);r?k.setState("value",r.getAttribute(DS)):D(e)}let L=()=>I(O().length-1),j=e=>{e.preventDefault(),e.metaKey?L():e.altKey?R(1):D(1)},P=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?R(-1):D(-1)};return Q.createElement(kL.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&j(e);break;case"ArrowDown":j(e);break;case"p":case"k":g&&e.ctrlKey&&P(e);break;case"ArrowUp":P(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=M();if(t){let e=new Event(DA);t.dispatchEvent(e)}}}}},Q.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:DW},l),DV(e,e=>Q.createElement(DM.Provider,{value:k},Q.createElement(D_.Provider,{value:T},e))))}),DD=Q.forwardRef((e,t)=>{var n,r;let i=t2(),s=Q.useRef(null),o=Q.useContext(DO),a=Q.useContext(D_),l=DH(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==o?void 0:o.forceMount;DU(()=>{if(!c)return a.item(i,null==o?void 0:o.id)},[c]);let d=DG(i,s,[e.value,e.children,s],e.keywords),u=Q.useContext(DM),p=D$(e=>e.value&&e.value===d.current),h=D$(e=>!!c||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function f(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function m(){u.setState("value",d.current,!0)}if(Q.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(DA,f),()=>t.removeEventListener(DA,f)},[h,e.onSelect,e.disabled]),!h)return null;let{disabled:g,value:b,onSelect:y,forceMount:x,keywords:v,...w}=e;return Q.createElement(kL.div,{ref:eL(s,t),...w,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!p,"data-disabled":!!g,"data-selected":!!p,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:f},e.children)}),DR=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...s}=e,o=t2(),a=Q.useRef(null),l=Q.useRef(null),c=t2(),d=Q.useContext(D_),u=D$(e=>!!i||!1===d.filter()||!e.search||e.filtered.groups.has(o));DU(()=>d.group(o),[]),DG(o,a,[e.value,e.heading,l]);let p=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(kL.div,{ref:eL(a,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},n&&Q.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),DV(e,e=>Q.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},Q.createElement(DO.Provider,{value:p},e))))}),DL=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),s=D$(e=>!e.search);return n||s?Q.createElement(kL.div,{ref:eL(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),Dj=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,s=Q.useContext(DM),o=D$(e=>e.search),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),Q.createElement(kL.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:o,onChange:e=>{i||s.setState("search",e.target.value),null==n||n(e.target.value)}})}),DP=Q.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,s=Q.useRef(null),o=Q.useRef(null),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{if(o.current&&s.current){let e=o.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(kL.div,{ref:eL(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},DV(e,e=>Q.createElement("div",{ref:eL(o,l.listInnerRef),"cmdk-list-sizer":""},e)))}),DB=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=e;return Q.createElement(rl,{open:n,onOpenChange:r},Q.createElement(rh,{container:o},Q.createElement(rm,{"cmdk-overlay":"",className:i}),Q.createElement(rx,{"aria-label":e.label,"cmdk-dialog":"",className:s},Q.createElement(DI,{ref:t,...a}))))}),DF=Object.assign(DI,{List:DP,Item:DD,Input:Dj,Group:DR,Separator:DL,Dialog:DB,Empty:Q.forwardRef((e,t)=>D$(e=>0===e.filtered.count)?Q.createElement(kL.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...s}=e;return Q.createElement(kL.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},DV(e,e=>Q.createElement("div",{"aria-hidden":!0},e)))})});function DH(e){let t=Q.useRef(e);return DU(()=>{t.current=e}),t}var DU="u"<typeof window?Q.useEffect:Q.useLayoutEffect;function Dz(e){let t=Q.useRef();return void 0===t.current&&(t.current=e()),t}function D$(e){let t=Q.useContext(DM),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function DG(e,t,n,r=[]){let i=Q.useRef(),s=Q.useContext(D_);return DU(()=>{var o;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());s.value(e,a,l),null==(o=t.current)||o.setAttribute(DS,a),i.current=a}),i}var Dq=()=>{let[e,t]=Q.useState(),n=Dz(()=>new Map);return DU(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function DV({asChild:e,children:t},n){let r;return e&&Q.isValidElement(t)?Q.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var DW={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let DK=en("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),DY=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF,{ref:n,className:tK("flex h-full w-full flex-col overflow-hidden rounded-sm bg-popover text-popover-foreground",e),...t}));function DX({children:e,shouldFilter:t,...n}){return(0,X.jsx)(rl,{...n,children:(0,X.jsxs)(rj,{className:"overflow-hidden p-0 shadow-golden max-w-lg",children:[(0,X.jsx)(rF,{className:"sr-only",children:"Search"}),(0,X.jsx)(DY,{shouldFilter:t,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})})}DY.displayName=DF.displayName;let DQ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,X.jsx)(DK,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,X.jsx)(DF.Input,{ref:n,className:tK("flex h-11 w-full rounded-sm bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));DQ.displayName=DF.Input.displayName;let DJ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.List,{ref:n,className:tK("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));DJ.displayName=DF.List.displayName;let DZ=Q.forwardRef((e,t)=>(0,X.jsx)(DF.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));DZ.displayName=DF.Empty.displayName;let D0=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Group,{ref:n,className:tK("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));D0.displayName=DF.Group.displayName;let D1=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Separator,{ref:n,className:tK("-mx-1 h-px bg-border",e),...t}));D1.displayName=DF.Separator.displayName;let D2=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Item,{ref:n,className:tK("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));D2.displayName=DF.Item.displayName;let D3=null,D5=wu(e=>({query:"",results:[],loading:!1,truncated:!1,open:!1,setQuery:t=>e({query:t}),setOpen:t=>e({open:t}),clear:()=>{D3?.abort(),e({query:"",results:[],loading:!1,truncated:!1})},search:async t=>{D3?.abort();let n=new AbortController;if(D3=n,!t.trim())return void e({results:[],loading:!1,truncated:!1});e({loading:!0});try{let r=await rK("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:30}),signal:n.signal});if(!r.ok)return void e({results:[],loading:!1,truncated:!1});let i=await r.json();if(n.signal.aborted)return;e({results:i.matches??[],truncated:!!i.truncated,loading:!1})}catch(t){"AbortError"!==t.name&&e({loading:!1})}}}));function D4({html:e}){let t=function(e){let t,n=[],r=/<mark>([\s\S]*?)<\/mark>/g,i=0;for(;null!==(t=r.exec(e));)t.index>i&&n.push({text:e.slice(i,t.index),mark:!1}),n.push({text:t[1]??"",mark:!0}),i=t.index+t[0].length;return i<e.length&&n.push({text:e.slice(i),mark:!1}),n}(e);return(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>e.mark?(0,X.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-700 rounded-[2px] px-[1px]",children:e.text},t):(0,X.jsx)("span",{children:e.text},t))})}function D6({onOpenFile:e,onToggleSidebar:t=()=>void 0,onNewFile:n=()=>void 0,onCopyPath:r=()=>void 0}){let i=D5(e=>e.open),s=D5(e=>e.setOpen),o=D5(e=>e.query),a=D5(e=>e.setQuery),l=D5(e=>e.results),c=D5(e=>e.loading),d=D5(e=>e.truncated),u=D5(e=>e.search),{resolvedTheme:p,setTheme:h}=(0,I_.useTheme)(),f=wp(e=>e.toggle),m=wM(e=>e.width),g=wM(e=>e.cycle),b=o.trimStart(),y=""===b||b.startsWith(">"),x=y?"":o;function v(e){e(),s(!1),a("")}(0,Q.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),s(!i))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,s]),(0,Q.useEffect)(()=>{if(!i||y)return;let e=setTimeout(()=>{u(x)},120);return()=>clearTimeout(e)},[x,y,i,u]);let w=(w_.indexOf(m)+1)%w_.length,E=wC[w_[w]];return(0,X.jsxs)(DX,{open:i,onOpenChange:e=>{s(e),e||a("")},shouldFilter:!1,children:[(0,X.jsx)(DQ,{placeholder:"Search files… ( > for actions )",value:o,onValueChange:a}),(0,X.jsxs)(DJ,{children:[y&&(0,X.jsxs)(D0,{heading:"Actions",children:[(0,X.jsxs)(D2,{value:"toggle-dark-mode",onSelect:()=>v(()=>h("dark"===p?"light":"dark")),children:["dark"===p?(0,X.jsx)(IC,{className:"mr-2 h-4 w-4"}):(0,X.jsx)(IS,{className:"mr-2 h-4 w-4"}),"dark"===p?"Switch to light mode":"Switch to dark mode"]}),(0,X.jsxs)(D2,{value:"toggle-ai-panel",onSelect:()=>v(f),children:[(0,X.jsx)(ei,{className:"mr-2 h-4 w-4"}),"Toggle AI panel"]}),(0,X.jsxs)(D2,{value:"toggle-sidebar",onSelect:()=>v(t),children:[(0,X.jsx)(_p,{className:"mr-2 h-4 w-4"}),"Toggle sidebar"]}),(0,X.jsxs)(D2,{value:"new-file",onSelect:()=>v(n),children:[(0,X.jsx)(eu,{className:"mr-2 h-4 w-4"}),"New file"]}),(0,X.jsxs)(D2,{value:"copy-path",onSelect:()=>v(r),children:[(0,X.jsx)(el,{className:"mr-2 h-4 w-4"}),"Copy current file path"]}),(0,X.jsxs)(D2,{value:"cycle-view-width",onSelect:()=>v(g),children:[(0,X.jsx)(ki,{className:"mr-2 h-4 w-4"}),(0,X.jsxs)("span",{children:["Change view width"," ",(0,X.jsxs)("span",{className:"text-muted-foreground",children:["(",wC[m]," → ",E,")"]})]})]})]}),!y&&(0,X.jsxs)(X.Fragment,{children:[c&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Searching…"}),!c&&""!==x.trim()&&0===l.length&&(0,X.jsx)(DZ,{children:"No matches."}),l.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D1,{}),(0,X.jsx)(D0,{heading:d?"Top results (refine query for more)":"Results",children:l.map(t=>(0,X.jsx)(D2,{value:t.path,onSelect:()=>{e(t.path),s(!1),a("")},children:(0,X.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:t.path}),t.snippet&&(0,X.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,X.jsx)(D4,{html:t.snippet})})]})},t.path))})]})]})]})]})}function D9({onOpenFile:e}){let t=D5(e=>e.query),n=D5(e=>e.setQuery),r=D5(e=>e.results),i=D5(e=>e.loading),s=D5(e=>e.search),o=D5(e=>e.clear),[a,l]=(0,Q.useState)(0),c=(0,Q.useRef)(null);function d(t){let n=r[t];n&&(e(n.path),o())}return(0,Q.useEffect)(()=>{l(0)},[r]),(0,Q.useEffect)(()=>{let e=c.current?.querySelector(`[data-idx="${a}"]`);e?.scrollIntoView({block:"nearest"})},[a]),(0,X.jsxs)("div",{className:"flex flex-col gap-1 px-2 py-1.5",children:[(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)(DK,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50"}),(0,X.jsx)("input",{type:"text",className:"w-full rounded-sm border bg-transparent py-1 pl-7 pr-2 text-xs outline-none focus:ring-1 focus:ring-ring",placeholder:"Search… (⌘K)",value:t,onChange:e=>{n(e.target.value),s(e.target.value)},onKeyDown:e=>{"Escape"===e.key?o():0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),l(e=>(e+1)%r.length)):"ArrowUp"===e.key?(e.preventDefault(),l(e=>(e-1+r.length)%r.length)):"Enter"===e.key&&(e.preventDefault(),d(a)))}})]}),""!==t.trim()&&(0,X.jsxs)("div",{ref:c,className:"max-h-64 overflow-y-auto rounded-sm border bg-popover",children:[i&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Searching…"}),!i&&0===r.length&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No matches"}),r.map((e,t)=>(0,X.jsxs)("button",{type:"button","data-idx":t,onClick:()=>d(t),onMouseEnter:()=>l(t),className:`block w-full px-2 py-1 text-left ${t===a?"bg-accent":"hover:bg-accent"}`,children:[(0,X.jsx)("div",{className:"truncate font-mono text-xs",children:e.path}),e.snippet&&(0,X.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:(0,X.jsx)(D4,{html:e.snippet})})]},e.path))]})]})}function D7({className:e}){let t=wM(e=>e.width),n=wM(e=>e.setWidth);return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${wC[t]}`,children:(0,X.jsx)(ks,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ib,{align:"end",className:"w-36",children:w_.map(e=>(0,X.jsxs)(Iy,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[wC[e],e===t&&(0,X.jsx)(es,{className:"h-3.5 w-3.5"})]},e))})]})}function D8(e){return e.split(".").pop()?.toLowerCase()??""}function Re(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=e.split("/").pop()??e;if(n.startsWith(".")&&-1===n.indexOf(".",1))return"source";let r=D8(e);return r?["md","markdown"].includes(r)?"editor":"txt"===r?"text":["csv","tsv"].includes(r)?"csv":"pdf"===r?"pdf":["mmd","mermaid"].includes(r)?"mermaid":"ipynb"===r?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(r)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(r)?"media":"docx"===r?"docx":["xlsx","xlsm"].includes(r)?"xlsx":"pptx"===r?"pptx":"html"===r?"html":(["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(r),"source"):"source"}let Rt=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function Rn(e){let t=Re(e,"file");return"editor"===t||"text"===t||Rt.has(D8(e))}function Rr(e){return["md","markdown"].includes(D8(e))}function Ri(e){return"image"===Re(e,"file")}async function Rs(e){let t=await rK(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function Ro(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:Ro(e.children,t,n)}:e)}e.s(["default",0,function(){let e;wO(e=>e.loadedAt),(0,Q.useEffect)(()=>{wO.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[s,o]=(0,Q.useState)(()=>rV()),[a,l]=(0,Q.useState)([]),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(!1),[h,f]=(0,Q.useState)(null),m=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/workspaces");if(!e.ok)throw Error("Failed");let t=await e.json();if(l(t.workspaces),d(t.isAdmin),t.workspaces.length>0){n(!0);let e=new URLSearchParams(window.location.search).get("ws"),r=e?t.workspaces.find(t=>t.id===e):null,s=r??[...t.workspaces].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];if(o(s.id),i(s.rootDir),!r){let e=new URL(location.href);e.searchParams.set("ws",s.id),history.replaceState(null,"",e.toString())}}else n(!1)}catch{n(!1)}},[]);(0,Q.useEffect)(()=>{m()},[m]);let g=wk(e=>e.currentPath),b=De(e=>e.recents),[y,x]=(0,Q.useState)(!1),[v,w]=(0,Q.useState)(!0),E=Dr(e=>e.pins),k=(0,Q.useRef)(null),T=wp(e=>e.activity),N=(0,Q.useMemo)(()=>{let e=new Date(Date.now()-6e4).toISOString(),t=new Set;for(let n of T)n.at>=e&&n.path&&n.by?.startsWith("ai:")&&t.add(n.path);return t},[T]);(0,Q.useEffect)(()=>{let e=()=>{wp.getState().loadActivity()};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),(0,Q.useEffect)(()=>{De.getState().loadForWorkspace(s),Dr.getState().loadForWorkspace(s)},[s]);let A=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),S=(0,Q.useRef)(!1),[C,_]=(0,Q.useState)([]),[M,O]=(0,Q.useState)(!1),[I,D]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),[L,j]=(0,Q.useState)(!1),[P,B]=(0,Q.useState)(!1),[F,H]=(0,Q.useState)(null),U=(0,Q.useRef)(null),z=(0,Q.useRef)(""),[$,G]=(0,Q.useState)(null),[q,V]=(0,Q.useState)(""),[W,K]=(0,Q.useState)(null),[Y,J]=(0,Q.useState)(null),[Z,ee]=(0,Q.useState)(""),[et,en]=(0,Q.useState)(null),[eR,eL]=(0,Q.useState)(null),[ej,eP]=(0,Q.useState)(!1),[eB,eF]=(0,Q.useState)(null),[eH,eU]=(0,Q.useState)(!1),[ez,e$]=(0,Q.useState)(0),[eG,eq]=(0,Q.useState)(!1),[eV,eW]=(0,Q.useState)(!1),[eK,eY]=(0,Q.useState)(null),[eX,eQ]=(0,Q.useState)(0),[eJ,eZ]=(0,Q.useState)(!1),[e0,e1]=(0,Q.useState)(!1),[e2,e3]=(0,Q.useState)(""),[e5,e4]=(0,Q.useState)(!1),[e6,e9]=(0,Q.useState)(null),e7=(0,Q.useRef)(null),[e8,te]=(0,Q.useState)(null),tt=(0,Q.useRef)(null),tn=(0,Q.useRef)(!1),tr=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{M||R.current||(R.current=!0,D(!0),Rs("").then(e=>{_(e),O(!0),D(!1)}).catch(()=>{R.current=!1,D(!1)}))},[M]);let ti=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await Rs(r)});_(e=>{let t=e;for(let{prefix:e,children:r}of n)t=Ro(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),ts=(0,Q.useCallback)(async e=>{let t=await Rs(e);""===e?_(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):_(n=>Ro(n,e,e=>({...e,children:t,expanded:!0})))},[]),to=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type||"node-app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...to(n.children)));return t},[]),ta=(0,Q.useCallback)(async()=>{j(!0);try{let e=to(C),t=await Rs("");for(let n of(_(t),e)){let e=await Rs(n);_(t=>Ro(t,n,t=>({...t,children:e,expanded:!0})))}}finally{j(!1)}},[C,to]),tl=(0,Q.useCallback)(async()=>{if(eB){if(Rr(eB.name)){eZ(!0);try{await wk.getState().loadPage(eB.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(eB.name,eB.nodeType))||Rn(eB.name)){eZ(!0);try{let e=await rK(`/api/wiki/content?path=${encodeURIComponent(eB.path)}`);if(e.ok){let t=await e.json();eY(t.content),eQ(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}},[eB]);async function tc(e){if("dir"===e.type||"app"===e.type||"node-app"===e.type)if(e.expanded)_(t=>Ro(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){_(t=>Ro(t,e.path,e=>({...e,loading:!0})));let t=await Rs(e.path);_(n=>Ro(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else _(t=>Ro(t,e.path,e=>({...e,expanded:!0})))}async function td(e){if("file"===e.type&&De.getState().push({path:e.path,name:e.name},s),eF({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),e1(!1),e9(null),eY(null),eQ(0),"file"===e.type&&Rr(e.name)){eZ(!0);try{await wk.getState().loadPage(e.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(e.name,e.type))||Rn(e.name)){eZ(!0);try{let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();eY(e.content),eQ(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}(0,Q.useEffect)(()=>{eB&&Rr(eB.name)&&wk.getState().currentPath!==eB.path&&wk.getState().loadPage(eB.path)},[eB]),(0,Q.useEffect)(()=>{tt.current=eB},[eB]),(0,Q.useEffect)(()=>{tn.current=e0},[e0]),(0,Q.useEffect)(()=>{tr.current=tl},[tl]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource(rW("/api/wiki/watch"));return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:s}=r,o=s.split("/");if(n=o.length>1?o.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),ts(n)},300)),"change"===i&&tt.current?.path===s&&!tn.current){let t=`__file__${s}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),tr.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,ts]),(0,Q.useEffect)(()=>{eU(!1)},[]);let tu=(0,Q.useCallback)(e=>{let t=e.split("/").pop()??e;ti(e),td({path:e,name:t,type:"file"})},[ti]);(0,Q.useEffect)(()=>{if(!g||eB&&eB.path===g)return;let e=g.split("/").pop()??g;td({path:g,name:e,type:"file"})},[g]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);eB?e.searchParams.set("path",eB.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[eB]),(0,Q.useEffect)(()=>{if(S.current||!M)return;let e=A.current;if(!e){S.current=!0;return}S.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await Rs(r)).find(t=>t.path===e);i&&(await ti(e),td({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[M,ti]);let tp=(0,Q.useCallback)(async e=>{if(e===s)return;try{await fetch(`/api/system/workspaces/${e}/open`,{method:"POST"})}catch{}let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.pushState(null,"",t.toString()),eF(null),eY(null),e1(!1),_([]),O(!1),R.current=!1,wO.getState().invalidate();let n=a.find(t=>t.id===e);n&&i(n.rootDir),o(e)},[s,a]),th=(0,Q.useCallback)(async()=>{if(h)try{if(!(await fetch(`/api/system/workspaces/${h}`,{method:"DELETE"})).ok)throw Error("Failed");if(h===s){let e=a.filter(e=>e.id!==h);if(e.length>0){let t=[...e].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];await tp(t.id)}else n(!1)}await m()}catch{}finally{f(null)}},[h,s,a,tp,m]);async function tf(){if(!eB)return;e4(!0),e9(null);let e=await rK("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eB.path,content:e2,baseRevision:eX})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&eQ(t.revision),eY(e2),e1(!1)}else e9((await e.json()).error??"Save failed");e4(!1)}let tm=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){B(!0),H(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await rK("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();H(e.error??"Upload failed"),wB(e.error??"Upload failed");break}}await ts(t)}catch{H("Upload failed.")}finally{B(!1),U.current&&(U.current.value="")}}},[ts]);function tg(e){z.current=e,U.current?.click()}async function tb(){let e=q.trim();if(!e||null===$)return;K(null);let t=$?`${$}/${e}`:e,n=await rK("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(G(null),V(""),await ts($),""!==$&&_(e=>Ro(e,$,e=>({...e,expanded:!0})))):K((await n.json()).error??"Failed")}async function ty(){let e=Z.trim();if(!e||null===Y)return;en(null);let t=e.includes(".")?e:`${e}.md`,n=Y?`${Y}/${t}`:t,r=await rK("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(J(null),ee(""),await ts(Y),""!==Y&&_(e=>Ro(e,Y,e=>({...e,expanded:!0}))),td({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):en((await r.json()).error??"Failed")}function tx(e){navigator.clipboard.writeText(e),wP("Path copied")}function tv(e){let t=e.replace(/\.(md|markdown)$/i,"");navigator.clipboard.writeText(`[[${t}]]`),wP("Wiki link copied")}function tw(e){let t=new URL(location.href);t.searchParams.set("path",e),s&&t.searchParams.set("ws",s),navigator.clipboard.writeText(t.toString()),wP("URL copied")}async function tE(e){if(eB?.path===e&&null!==eK)return eK;if(wk.getState().currentPath===e)return wk.getState().content;let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Cannot copy content");return(await t.json()).content}async function tk(e){try{let t=await tE(e);await navigator.clipboard.writeText(t),wP("Raw content copied")}catch{wB("Could not copy file content")}}async function tT(e,t){try{let n=await tE(e);if(!Rr(t)){await navigator.clipboard.writeText(n),wP("Content copied");return}let r=await vA(n,{pagePath:e,sanitize:!0});"ClipboardItem"in window&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})})]):await navigator.clipboard.writeText(n),wP("Formatted content copied")}catch{wB("Could not copy formatted content")}}function tN(e){return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 px-2 text-xs",title:"Copy path, wiki link, or URL",children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Copy",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"end",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(e.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(e.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>tw(e.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),Rn(e.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>void tk(e.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(e.path,e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]})]})]})}async function tA(){eR&&(await rK("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eR})}),(eB?.path===eR||eB?.path.startsWith(`${eR}/`))&&(eF(null),eY(null)),_(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,eR)),eL(null))}function tS(e,t,n){e.preventDefault(),e.stopPropagation();let r=e7.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",te("root"===n?"":t))}async function tC(e,t){e.preventDefault(),e.stopPropagation(),te(null);let n=e7.current;if(e7.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await rK("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await ts(e),t!==e&&await ts(t),eB?.path===n.path&&eF({path:r,name:n.name,nodeType:eB.nodeType})}}let t_=eB?Re(eB.name,eB.nodeType):null,tM=wM(e=>e.width),tO=null===t_||"editor"===t_||"text"===t_||"source"===t_||"notebook"===t_||"fallback"===t_,tI=tO?wA[tM]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(IA,{onSelect:e=>{let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.replaceState(null,"",t.toString()),O(!1),R.current=!1,o(e),n(!0),m()}}),!0===t&&u&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,X.jsx)("div",{className:"flex items-center justify-end border-b px-3 py-2 bg-muted shrink-0",children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>p(!1),children:[(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})," Cancel"]})}),(0,X.jsx)(IA,{onSelect:e=>{p(!1),m(),tp(e)}})]}),!0===t&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D6,{onOpenFile:tu,onToggleSidebar:()=>eq(e=>!e),onNewFile:()=>J(""),onCopyPath:()=>{eB&&navigator.clipboard.writeText(eB.path)}}),!eG&&(0,X.jsxs)(IP,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>eq(!0),children:(0,X.jsx)(eE,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eA,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>{J(""),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(""),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(""),disabled:P,children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:ta,disabled:L,children:L?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(IM,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>wp.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>eW(!0),children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]})]}),F&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),F]}),""===$&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),""===Y&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:"border-b",children:(0,X.jsx)(D9,{onOpenFile:tu})}),(0,X.jsxs)("div",{ref:k,className:tK("flex-1 overflow-auto py-1",""===e8&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>tS(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||te(null)},onDrop:e=>tC(e,""),children:[E.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>x(e=>!e),children:[y?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),(0,X.jsx)(eN,{className:"h-3 w-3"}),"Pinned",(0,X.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:E.length})]}),!y&&E.map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("group flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,X.jsx)(e_,{className:"h-3 w-3 shrink-0 fill-current text-amber-400"}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"max-w-[80px] truncate text-[10px] text-muted-foreground/60",children:e.path.split("/").slice(0,-1).join("/")}),(0,X.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground/50 opacity-0 transition-colors hover:bg-muted hover:text-amber-400 group-hover:opacity-100 focus:opacity-100",title:"Remove from pinned",onClick:t=>{t.stopPropagation(),Dr.getState().toggle({path:e.path,name:e.name},s)},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]},e.path))]}),b.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>w(e=>!e),children:[v?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),"Recent",(0,X.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:b.length})]}),!v&&b.slice(0,8).map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,X.jsx)(ep,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/60 truncate max-w-[80px]",children:e.path.split("/").slice(0,-1).join("/")})]},e.path))]}),I?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===C.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(ep,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tX,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>tg(""),disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eI,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>{let r=E.some(e=>e.path===t.path);return(0,X.jsxs)(IG,{children:[(0,X.jsx)(IV,{asChild:!0,children:(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{if("Enter"===e.key||" "===e.key)e.preventDefault(),"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t);else if("ArrowDown"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else if("ArrowUp"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r-1]?.focus()}else if("ArrowRight"===e.key){if(e.preventDefault(),"dir"===t.type||"app"===t.type||"node-app"===t.type)if(t.expanded){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else tc(t)}else if("ArrowLeft"===e.key){if(e.preventDefault(),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded)tc(t);else if(n>0){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=e.currentTarget,i=n.indexOf(r),s=Number.parseInt(r.style.paddingLeft??"0",10);for(let e=i-1;e>=0;e--)if(Number.parseInt(n[e].style.paddingLeft??"0",10)<s){n[e].focus();break}}}},onDragStart:e=>{e7.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?tS(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>te(null),onDrop:e=>"dir"===t.type?tC(e,t.path):e.preventDefault(),className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",eB?.path===t.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted",e8===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t)},children:["dir"===t.type||"app"===t.type||"node-app"===t.type?t.loading?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(ef,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):(0,X.jsx)(eh,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):"node-app"===t.type?(0,X.jsx)(eM,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-emerald-500")}):"html"===Re(t.name,"file")?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}):Ri(t.name)?(0,X.jsx)(eb,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-sunshine-700")}):Rn(t.name)?(0,X.jsx)(ep,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):(0,X.jsx)(ed,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),N.has(t.path)&&(0,X.jsx)("span",{className:"ml-0.5 h-1.5 w-1.5 rounded-full bg-emerald-400 shrink-0 animate-pulse",title:"Agent recently active"}),(0,X.jsx)("div",{className:"flex max-w-0 shrink-0 items-center overflow-hidden opacity-0 transition-all duration-150 group-hover:max-w-7 group-hover:opacity-100 focus-within:max-w-7 focus-within:opacity-100",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"File actions",children:(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})})}),(0,X.jsxs)(Ib,{align:"end",className:"w-48",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(t.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(t.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsxs)(Iy,{onClick:()=>tw(t.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:()=>void tk(t.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(t.path,t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]}),(0,X.jsx)(Iv,{}),"dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:async()=>{t.expanded||await tc(t),J(t.path),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file here"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(t.path),children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload here"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(t.path),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New subfolder"]}),(0,X.jsx)(Iv,{})]}),(0,X.jsxs)(Iy,{onClick:()=>{let e,n;return e=rW(`/api/wiki/download?path=${encodeURIComponent(t.path)}`),void((n=document.createElement("a")).href=e,n.download="file"===t.type?t.name:`${t.name}.zip`,document.body.appendChild(n),n.click(),n.remove())},children:[(0,X.jsx)(ec,{className:"mr-2 h-3.5 w-3.5"}),"file"===t.type?"Download":"Download as zip"]}),(0,X.jsxs)(Iy,{onClick:()=>Dr.getState().toggle({path:t.path,name:t.name,type:"dir"===t.type?"file":t.type},s),children:[(0,X.jsx)(e_,{className:tK("mr-2 h-3.5 w-3.5",r&&"fill-current text-amber-400")}),r?"Unpin":"Pin to top"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{className:"text-destructive focus:text-destructive",onClick:()=>{eL(t.path),eP("file"!==t.type)},children:[(0,X.jsx)(eO,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})})]}),$===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),Y===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]})}),(0,X.jsxs)(I4,{children:[(0,X.jsx)(I6,{onSelect:()=>tx(t.path),children:"Copy path"}),Rr(t.name)&&(0,X.jsx)(I6,{onSelect:()=>tv(t.name),children:"Copy wiki link"}),(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>tw(t.path),children:"Copy URL"}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>void tk(t.path),children:"Copy raw content"}),(0,X.jsx)(I6,{onSelect:()=>void tT(t.path,t.name),children:"Copy formatted content"})]})]})]},t.path)})}(C)]}),(0,X.jsx)("div",{className:"border-t px-2 py-2 bg-muted shrink-0",children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"w-full h-auto justify-between gap-2 px-2 py-1.5 text-left",title:r??"",children:[(0,X.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,X.jsx)("span",{className:"truncate text-xs font-medium",children:a.find(e=>e.id===s)?.name??"Workspace"}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:r??""})]}),(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-60",children:[a.map(e=>(0,X.jsxs)(Iy,{onClick:()=>void tp(e.id),className:tK("gap-2",e.id===s&&"font-medium"),children:[e.id===s?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,X.jsx)("span",{className:"truncate",children:e.name}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:e.rootDir})]}),c&&(0,X.jsx)("button",{className:"ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:"Delete workspace (does not delete files)",onClick:t=>{t.stopPropagation(),f(e.id)},children:(0,X.jsx)(eO,{className:"h-3.5 w-3.5"})})]},e.id)),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>p(!0),children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"Add workspace…"]})]})]})]})})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[eG&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>eq(!1),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),eB?"node-app"===t_?(0,X.jsx)(IE,{path:eB.path,title:eB.name}):"app"===t_||"html"===t_?(e="html"===t_?`/api/assets/${eB.path}`:void 0,eH?(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e,fullscreen:!0,onExit:()=>eU(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(eg,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),"html"===t_&&!e0&&null!==eK&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{e1(!0),e3(eK),e9(null)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>e$(e=>e+1),children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>eU(!0),children:[(0,X.jsx)(ev,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0&&"html"===t_?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e},ez)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[Ri(eB.name)?(0,X.jsx)(eb,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):Rn(eB.name)?(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{e1(!0),e3(eK??""),e9(null),Rr(eB.name)&&wk.getState().loadPage(eB.path)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:tl,disabled:eJ,children:eJ?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),tO&&(0,X.jsx)(D7,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),eY(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:Rr(eB.name)?(0,X.jsx)(_D,{}):(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):Rr(eB.name)?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,X.jsx)(_D,{mode:"viewing"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:tK("mx-auto w-full",tI),children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===t_?(0,X.jsx)(rJ,{path:eB.path,title:eB.name}):"pdf"===t_?(0,X.jsx)(MD,{path:eB.path,title:eB.name}):"mermaid"===t_?(0,X.jsx)(_U,{path:eB.path,title:eB.name}):"notebook"===t_?(0,X.jsx)(MC,{path:eB.path,title:eB.name}):"image"===t_?(0,X.jsx)(_L,{path:eB.path,title:eB.name}):"media"===t_?(0,X.jsx)(_j,{path:eB.path,title:eB.name,type:["mp4","webm","mov","m4v"].includes(D8(eB.name))?"video":"audio"}):"docx"===t_?(0,X.jsx)(MM,{path:eB.path,title:eB.name}):"xlsx"===t_?(0,X.jsx)(MI,{path:eB.path,title:eB.name}):"pptx"===t_?(0,X.jsx)(MO,{path:eB.path,title:eB.name}):"source"===t_?(0,X.jsx)(MP,{path:eB.path,title:eB.name}):"fallback"===t_?(0,X.jsx)(_R,{path:eB.path,title:eB.name}):null!==eK?(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:eK}):Rn(eB.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),e0&&!Rr(eB.name)&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(ep,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(Ij,{open:eV,onOpenChange:eW}),(0,X.jsx)(Dg,{currentPath:eB?.path}),(0,X.jsx)("input",{ref:U,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&tm(e.target.files,z.current)}}),(0,X.jsx)(rU,{open:!!eR,onOpenChange:e=>{e||eL(null)},title:ej?"Delete folder?":"Delete file?",description:ej?`"${eR?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${eR?.split("/").pop()}" will be permanently removed.`,onConfirm:tA}),(0,X.jsx)(rU,{open:!!h,onOpenChange:e=>{e||f(null)},title:"Delete workspace?",description:`"${a.find(e=>e.id===h)?.name??""}" will be removed from the workspace list. Files on disk are NOT deleted.`,onConfirm:th})]})]},s??"none")}],952683)}]);