@decocms/mesh 2.113.0 → 2.114.0

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 (209) hide show
  1. package/dist/client/assets/{AlertCircle-CooHa8Dx.js → AlertCircle-FL98lGLa.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-Dbg9uZyB.js → AlertOctagon-B33KdaLi.js} +1 -1
  3. package/dist/client/assets/{AlertTriangle-Ca8IB5bL.js → AlertTriangle-DteHmOG1.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-DIF2VO2W.js → ArrowLeft-CMuGBwkE.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DgvOdNkG.js → ArrowUp-xougxkbC.js} +1 -1
  6. package/dist/client/assets/{Check-DGXJXTap.js → Check-BY-DCpO_.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DDajcDWB.js → CheckCircle-CpXx2avT.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-CnxPjvi4.js → CheckDone01-DJLuFHxJ.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-Iy-LVhoI.js → CheckVerified02-Cqu-AawR.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-Di42C1UO.js → ChevronDown-FdgQzkaa.js} +1 -1
  11. package/dist/client/assets/{ChevronRight-BNn59ko7.js → ChevronRight-DYxU3E_q.js} +1 -1
  12. package/dist/client/assets/{Clock-BLkZwDYw.js → Clock-Drw10Mc_.js} +1 -1
  13. package/dist/client/assets/{Code01-DooPA--K.js → Code01-CowHxp14.js} +1 -1
  14. package/dist/client/assets/{Container-C1CLnDNL.js → Container-B7qKC3EI.js} +1 -1
  15. package/dist/client/assets/{Copy01-rucQ3PSp.js → Copy01-B_7d0dwb.js} +1 -1
  16. package/dist/client/assets/{Dataflow03-DY9MPHye.js → Dataflow03-Cf4yDkKR.js} +1 -1
  17. package/dist/client/assets/{DotsHorizontal-CxkCXGJv.js → DotsHorizontal-CqtaWGEh.js} +1 -1
  18. package/dist/client/assets/{DotsVertical-NXfqoXCN.js → DotsVertical-qEJ2g9HJ.js} +1 -1
  19. package/dist/client/assets/{Download01-f5vnFohs.js → Download01-IPqVm26W.js} +1 -1
  20. package/dist/client/assets/{Edit01-CxGjhFGJ.js → Edit01-CUcmwNxC.js} +1 -1
  21. package/dist/client/assets/{Eye-CmK33jvc.js → Eye-Rq15dwoo.js} +1 -1
  22. package/dist/client/assets/{File02-Bs24RCQ6.js → File02-DPSlzBxh.js} +1 -1
  23. package/dist/client/assets/{File06-XfbhoM8r.js → File06-xsY7vCFb.js} +1 -1
  24. package/dist/client/assets/{FilterLines-Gpro-d22.js → FilterLines-CJgE2bmA.js} +1 -1
  25. package/dist/client/assets/{Globe01-CspKYhQJ.js → Globe01-BuKzbzrx.js} +1 -1
  26. package/dist/client/assets/{Globe02-DcNEoN4R.js → Globe02-BIRPCTiD.js} +1 -1
  27. package/dist/client/assets/{Grid01-DkGxNKPL.js → Grid01-CcUd9dpu.js} +1 -1
  28. package/dist/client/assets/{Hash02-DFSzHnWN.js → Hash02-BAkYwsUS.js} +1 -1
  29. package/dist/client/assets/{Home02-CccWHOVS.js → Home02-CyX62jfB.js} +1 -1
  30. package/dist/client/assets/{Image01-F0dDnjWb.js → Image01-CiGMIZf1.js} +1 -1
  31. package/dist/client/assets/{Inbox01-rhXjoTLG.js → Inbox01-CxlDy_Yy.js} +1 -1
  32. package/dist/client/assets/{InfoCircle-DDMndy6f.js → InfoCircle-BBQwzN3e.js} +1 -1
  33. package/dist/client/assets/{Key01-BoEk45CQ.js → Key01-CcfhRF0P.js} +1 -1
  34. package/dist/client/assets/{LinkExternal01-6fiITYn6.js → LinkExternal01-CHfE9mil.js} +1 -1
  35. package/dist/client/assets/{List-DLWOvAOP.js → List-BkcTlONj.js} +1 -1
  36. package/dist/client/assets/{Loading01-BGpLDRYx.js → Loading01-CWwskqmx.js} +1 -1
  37. package/dist/client/assets/{Lock01-CkEZCQ8T.js → Lock01-C-e30A69.js} +1 -1
  38. package/dist/client/assets/{Pin01-CSZOSQvf.js → Pin01-DNrhTTs3.js} +1 -1
  39. package/dist/client/assets/{Play-Ck339o9D.js → Play-sMJsBLST.js} +1 -1
  40. package/dist/client/assets/{Plus-BB0XqcsP.js → Plus-7gpDbhJy.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-BlblCD0d.js → RefreshCcw01-BzY8N8T3.js} +1 -1
  42. package/dist/client/assets/{RefreshCw01-C2HUNviY.js → RefreshCw01-dI5kYugT.js} +1 -1
  43. package/dist/client/assets/{Save01-j7EMqYuR.js → Save01-C9jVAZgo.js} +1 -1
  44. package/dist/client/assets/{SearchMd-CguhhQVb.js → SearchMd-BMO4jqwv.js} +1 -1
  45. package/dist/client/assets/{Settings01-jz5w4e3w.js → Settings01-CRoxTuTO.js} +1 -1
  46. package/dist/client/assets/{Share07-DA5hMI-c.js → Share07-DFdDYoqj.js} +1 -1
  47. package/dist/client/assets/Shield01-DymehiLu.js +1 -0
  48. package/dist/client/assets/{Terminal-B6KzedA2.js → Terminal-zi42zfXM.js} +1 -1
  49. package/dist/client/assets/{Tool01-BPh57jnm.js → Tool01-lC4M_AmN.js} +1 -1
  50. package/dist/client/assets/{Trash01-DGjvH5rG.js → Trash01-BKhksYCP.js} +1 -1
  51. package/dist/client/assets/{Upload01-BWKtoN2l.js → Upload01-CorstXj2.js} +1 -1
  52. package/dist/client/assets/{Users03-DWNrz1Vr.js → Users03-B6oew679.js} +1 -1
  53. package/dist/client/assets/{XCircle-VzD2IKvZ.js → XCircle-WTPrrNWD.js} +1 -1
  54. package/dist/client/assets/{XClose-quksRQbf.js → XClose-DoKE29TG.js} +1 -1
  55. package/dist/client/assets/{agent-connections-preview-DO3HZtWQ.js → agent-connections-preview-DybZ18X5.js} +1 -1
  56. package/dist/client/assets/agent-detail-DncXhd81.js +1 -0
  57. package/dist/client/assets/agents-D-4jcSt1.js +1 -0
  58. package/dist/client/assets/{alert-dialog-BobozgbA.js → alert-dialog-Dm7Md3Yk.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-Bg2u42FQ.js → auth-catchall-DHQTu60x.js} +1 -1
  60. package/dist/client/assets/avatar-B-mPVtLH.js +1 -0
  61. package/dist/client/assets/{badge-Ba42zrft.js → badge-Bt6C7wEJ.js} +1 -1
  62. package/dist/client/assets/{binder-XSlHh33G.js → binder-BvXUsKRF.js} +1 -1
  63. package/dist/client/assets/breadcrumb-Cipoy1eR.js +1 -0
  64. package/dist/client/assets/button-Bl7hMmCe.js +1 -0
  65. package/dist/client/assets/card-BMQBEGUR.js +1 -0
  66. package/dist/client/assets/{checkbox-BgqFPCG8.js → checkbox-C-nrBu1T.js} +1 -1
  67. package/dist/client/assets/{circle-alert-D1V0DFvr.js → circle-alert-DYoRV5F7.js} +1 -1
  68. package/dist/client/assets/{collection-detail-tuOZUkEg.js → collection-detail-x0pDfnG2.js} +3 -3
  69. package/dist/client/assets/{collection-tab-DpQw4w-_.js → collection-tab-CMJJpUjs.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-Dwsrv-is.js → collection-table-wrapper-DS44ibQ8.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BxPjmpup.js → collection-tabs-Dyc14WST.js} +1 -1
  72. package/dist/client/assets/{command-eII6FM4T.js → command-DGGP5Edh.js} +1 -1
  73. package/dist/client/assets/{connect-CjbgNw43.js → connect-BqPwKrDp.js} +1 -1
  74. package/dist/client/assets/{connection-card-B-vaA7In.js → connection-card-B_yTVrCB.js} +1 -1
  75. package/dist/client/assets/connection-detail-BHwcydrH.js +1 -0
  76. package/dist/client/assets/connections-C2FniOCy.js +1 -0
  77. package/dist/client/assets/constants-B9b2QjkO.js +1 -0
  78. package/dist/client/assets/{constants-DTZgxhQr.js → constants-DY_BU6PR.js} +1 -1
  79. package/dist/client/assets/{create-organization-dialog-_ENRfzh2.js → create-organization-dialog-BmtVHISe.js} +1 -1
  80. package/dist/client/assets/{create-project-dialog-CkoSW_Yw.js → create-project-dialog-DFYOBIMM.js} +1 -1
  81. package/dist/client/assets/dialog-BTs7spED.js +1 -0
  82. package/dist/client/assets/{dropdown-menu-DwhvTSoj.js → dropdown-menu-Dk3PdiLq.js} +1 -1
  83. package/dist/client/assets/dynamic-plugin-layout-C8tDNw7E.js +1 -0
  84. package/dist/client/assets/empty-state-BrrA9jzc.js +1 -0
  85. package/dist/client/assets/{empty-state-CUSdR_G_.js → empty-state-yzpNvfA-.js} +1 -1
  86. package/dist/client/assets/{env-vars-editor-CX-fJfxt.js → env-vars-editor-CxFtbjNH.js} +1 -1
  87. package/dist/client/assets/{error-boundary-Di0tQXdv.js → error-boundary-GB3TovJQ.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Dd3BvcTW.js → extract-connection-data-Cjm6QMzJ.js} +1 -1
  89. package/dist/client/assets/{file-browser-CyYYn3HQ.js → file-browser-CeBgj9Bh.js} +2 -2
  90. package/dist/client/assets/{form-DIsigMsk.js → form-Dxe8J4dP.js} +1 -1
  91. package/dist/client/assets/{grid-view-BsAPFz5e.js → grid-view-qfkYjNIX.js} +1 -1
  92. package/dist/client/assets/{home-DoBwFvBu.js → home-C39nGjR7.js} +1 -1
  93. package/dist/client/assets/index-48TFsA2Q.css +1 -0
  94. package/dist/client/assets/{index-BVrm4rGn.js → index-B2KxLjHq.js} +1 -1
  95. package/dist/client/assets/{index-CMu5spRk.js → index-BOlMuTYA.js} +6 -6
  96. package/dist/client/assets/index-BrH9wXxf.js +1 -0
  97. package/dist/client/assets/{index-qSvnMMX3.js → index-BuPkfOh7.js} +1 -1
  98. package/dist/client/assets/{index-Cs0vYfu9.js → index-CLUeNS9F.js} +1 -1
  99. package/dist/client/assets/{index-DeBwK236.js → index-CSf23Q8F.js} +5 -5
  100. package/dist/client/assets/index-CzSiUwwv.js +218 -0
  101. package/dist/client/assets/{index-NEbz2HQu.js → index-DVHOzh7f.js} +1 -1
  102. package/dist/client/assets/{index-CDwFwb7Q.js → index-Dps5khDb.js} +1 -1
  103. package/dist/client/assets/{infiniteQueryObserver-DbZCUgr5.js → infiniteQueryObserver-Ctmp4byY.js} +1 -1
  104. package/dist/client/assets/{input-Cw77piS4.js → input-CAPxG1rh.js} +1 -1
  105. package/dist/client/assets/{integration-icon-D3fWRQzh.js → integration-icon-jbm4PmZt.js} +1 -1
  106. package/dist/client/assets/{label-CUy1x9Fc.js → label-A7ibpcPd.js} +1 -1
  107. package/dist/client/assets/{layout-BPYuOiPI.js → layout-DHncYg0M.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-DRPmjZks.js → localstorage-keys-Cc9e53sU.js} +1 -1
  109. package/dist/client/assets/{login-CUcM51_h.js → login-C4VFa6jD.js} +1 -1
  110. package/dist/client/assets/{markdown-BUX5ABnz.js → markdown-DTO-ngpn.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-Da77-kcD.js → mcp-oauth-lMxJpMMH.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-DcZS4AhS.js → mcp-server-card-C-sPhXVX.js} +1 -1
  113. package/dist/client/assets/mcp-server-detail-BtO9BwQ6.js +2 -0
  114. package/dist/client/assets/members-Dh31vMll.js +3 -0
  115. package/dist/client/assets/{monitoring-DINJ4pYy.js → monitoring-D0DgTEcy.js} +1 -1
  116. package/dist/client/assets/monitoring-dashboard-edit-DCcFalwQ.js +1 -0
  117. package/dist/client/assets/{monitoring-dashboard-view-B53vWJlZ.js → monitoring-dashboard-view-CuFcYaD_.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-Dsqe_oXS.js → oauth-callback-DKWROL5U.js} +1 -1
  119. package/dist/client/assets/{page-BKBuf2HE.js → page-BpCfHp43.js} +1 -1
  120. package/dist/client/assets/page-CoIEp87I.js +1 -0
  121. package/dist/client/assets/{plugin-empty-state-D_Z6xsRD.js → plugin-empty-state-DMdw5AKa.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-Cdi0lxlF.js → plugin-empty-state-DfPCNHNV.js} +1 -1
  123. package/dist/client/assets/{plugin-header-D_XJF06t.js → plugin-header-CVaBr8-j.js} +1 -1
  124. package/dist/client/assets/{plugin-header-DGLeYRv9.js → plugin-header-DqwJE7vc.js} +1 -1
  125. package/dist/client/assets/{popover-C8z2ljXJ.js → popover-Ca9Cyzf7.js} +1 -1
  126. package/dist/client/assets/{project-layout-gRYIrnzO.js → project-layout-F2YJOnzp.js} +1 -1
  127. package/dist/client/assets/project-settings-DwtLH_vq.js +1 -0
  128. package/dist/client/assets/projects-list-DPMlGsBe.js +1 -0
  129. package/dist/client/assets/{readme-viewer-DSTuLgLE.js → readme-viewer-D5RieYNW.js} +1 -1
  130. package/dist/client/assets/registry-layout-BrhYm9Dr.js +5 -0
  131. package/dist/client/assets/{registry-utils-D8FLO1oI.js → registry-utils--fif7P3x.js} +1 -1
  132. package/dist/client/assets/{reports-layout-NWBpDTNI.js → reports-layout-9yNTvI9o.js} +1 -1
  133. package/dist/client/assets/{reset-password-BEvAUHxp.js → reset-password-FRWYt8ap.js} +1 -1
  134. package/dist/client/assets/{resizable-Q_6VrAvM.js → resizable-DKtpdeB3.js} +1 -1
  135. package/dist/client/assets/{save-actions-DnatwzCI.js → save-actions-DH-J_-0b.js} +1 -1
  136. package/dist/client/assets/{scroll-area--Dl42eG7.js → scroll-area-BfJ2ZkbI.js} +1 -1
  137. package/dist/client/assets/{select-DmOdy-_2.js → select-CKDoCTJO.js} +1 -1
  138. package/dist/client/assets/shell-layout-DkuDKL8p.js +3 -0
  139. package/dist/client/assets/{spinner-BFe5KsON.js → spinner-B-FWJ8nx.js} +1 -1
  140. package/dist/client/assets/{store-invite-B6QzkY9D.js → store-invite-1HxdtnDC.js} +1 -1
  141. package/dist/client/assets/{switch-BTNdX6uT.js → switch-ySGmS6Zx.js} +1 -1
  142. package/dist/client/assets/{table-m7xKes0i.js → table-DGDNn7mH.js} +1 -1
  143. package/dist/client/assets/tasks-BuxJd7k9.js +1 -0
  144. package/dist/client/assets/{textarea-1ZAkAqPs.js → textarea-COGwSIgK.js} +1 -1
  145. package/dist/client/assets/{time-range-picker-S5DXdK6J.js → time-range-picker-hBuoR0m0.js} +1 -1
  146. package/dist/client/assets/{toggle-group-B4gd2g4g.js → toggle-group-RO8j2kDd.js} +1 -1
  147. package/dist/client/assets/{tools-list-BYJP7wdj.js → tools-list-CBpacE22.js} +1 -1
  148. package/dist/client/assets/tooltip-CLbmwjfd.js +1 -0
  149. package/dist/client/assets/topbar-portal-BHxVS8Tl.js +1 -0
  150. package/dist/client/assets/typewriter-title-C4OcGX3b.js +16 -0
  151. package/dist/client/assets/{use-binding-CAtjL1rr.js → use-binding-D36c91MK.js} +1 -1
  152. package/dist/client/assets/{use-connection-BRwTI0xk.js → use-connection-CdIwTzRh.js} +1 -1
  153. package/dist/client/assets/{use-copy-BnGNgGbL.js → use-copy-BZqI2HfR.js} +1 -1
  154. package/dist/client/assets/{use-create-virtual-mcp-BIn6DTPa.js → use-create-virtual-mcp-DKrayFIg.js} +1 -1
  155. package/dist/client/assets/{use-deco-chat-open-CWPuucLF.js → use-deco-chat-open-BuMsTBnv.js} +3 -3
  156. package/dist/client/assets/{use-install-from-registry-GZkHb-J_.js → use-install-from-registry-kn39eg4d.js} +1 -1
  157. package/dist/client/assets/{use-list-state-CLqJqhda.js → use-list-state-CYucxtoX.js} +1 -1
  158. package/dist/client/assets/{use-llm-BToIG9lg.js → use-llm-CX9QGbjZ.js} +1 -1
  159. package/dist/client/assets/{use-mcp-prompts-C28zFdyF.js → use-mcp-prompts-DMC1gnwj.js} +1 -1
  160. package/dist/client/assets/{use-mcp-tools-CnGq7c_h.js → use-mcp-tools-SZ1hgrkZ.js} +1 -1
  161. package/dist/client/assets/{use-organization-settings-BVsgnOKP.js → use-organization-settings-1mU06z41.js} +1 -1
  162. package/dist/client/assets/{use-project-pPGjnPtH.js → use-project-CsuhSK50.js} +1 -1
  163. package/dist/client/assets/use-view-mode-CVN4cPaD.js +1 -0
  164. package/dist/client/assets/{use-virtual-mcp-C67SrK4s.js → use-virtual-mcp-CqdRLJoL.js} +1 -1
  165. package/dist/client/assets/useInfiniteQuery-Bd_PpC7_.js +1 -0
  166. package/dist/client/assets/{useMutation-BLWSoXAi.js → useMutation-BYl8vvsl.js} +1 -1
  167. package/dist/client/assets/useQuery-CTct6gOY.js +1 -0
  168. package/dist/client/assets/useSuspenseInfiniteQuery-DJZPFUMY.js +1 -0
  169. package/dist/client/assets/workflow-CMJomw9A.js +1 -0
  170. package/dist/client/index.html +2 -2
  171. package/dist/server/cli.js +3 -3
  172. package/dist/server/migrate.js +3 -3
  173. package/dist/server/server.js +3 -3
  174. package/package.json +1 -1
  175. package/dist/client/assets/Settings02-BEGJoXOf.js +0 -1
  176. package/dist/client/assets/X-hlRWRdLd.js +0 -1
  177. package/dist/client/assets/agent-detail-Dm90C1dq.js +0 -1
  178. package/dist/client/assets/agents-Dp1lzRWx.js +0 -1
  179. package/dist/client/assets/avatar-DzNBuwvQ.js +0 -1
  180. package/dist/client/assets/breadcrumb-DVboj9hZ.js +0 -1
  181. package/dist/client/assets/button-BvpGJmwj.js +0 -1
  182. package/dist/client/assets/card-DUyr2anf.js +0 -1
  183. package/dist/client/assets/connection-detail-1_ZQMYvG.js +0 -1
  184. package/dist/client/assets/connections-DSsqgW7V.js +0 -1
  185. package/dist/client/assets/constants-BXsR0e2f.js +0 -1
  186. package/dist/client/assets/dialog-Djb2_yQ3.js +0 -1
  187. package/dist/client/assets/dynamic-plugin-layout-gS11xmZg.js +0 -1
  188. package/dist/client/assets/empty-state-CfAcFJ3T.js +0 -1
  189. package/dist/client/assets/index-hmLeN6Cx.css +0 -1
  190. package/dist/client/assets/index-p5ek_T2U.js +0 -218
  191. package/dist/client/assets/index-r3RmHcg-.js +0 -1
  192. package/dist/client/assets/mcp-server-detail-BsuSFuH9.js +0 -2
  193. package/dist/client/assets/members-Dt-WMWXs.js +0 -3
  194. package/dist/client/assets/monitoring-dashboard-edit-ViuWKC7f.js +0 -1
  195. package/dist/client/assets/page-BLmopBsr.js +0 -1
  196. package/dist/client/assets/project-settings-iakvSAMp.js +0 -1
  197. package/dist/client/assets/projects-list-BTf0o0Dw.js +0 -1
  198. package/dist/client/assets/registry-layout-D0ZI3R-w.js +0 -5
  199. package/dist/client/assets/shell-layout-DaVrqTvl.js +0 -12
  200. package/dist/client/assets/tasks-B817iTsv.js +0 -1
  201. package/dist/client/assets/tooltip-w4nyO9EM.js +0 -1
  202. package/dist/client/assets/topbar-portal-DFijBXBE.js +0 -1
  203. package/dist/client/assets/typewriter-title-fwTbDCyQ.js +0 -16
  204. package/dist/client/assets/use-mobile-Dl83qL71.js +0 -1
  205. package/dist/client/assets/use-view-mode-BC3VVzlU.js +0 -1
  206. package/dist/client/assets/useInfiniteQuery-CL1DQ1B_.js +0 -1
  207. package/dist/client/assets/useQuery-CoMTdc_B.js +0 -1
  208. package/dist/client/assets/useSuspenseInfiniteQuery-BEcP523_.js +0 -1
  209. package/dist/client/assets/workflow-D3d1tCTr.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as O,c as K,o as Ar,k as w1,l as O1,j as E,s as si,bW as L1,bX as vC,bm as Ke,bY as _C,H as D1,u as Nr,t as Gt,am as CC,bZ as IC,b5 as M1,b_ as RC,b$ as kt,c0 as $s,c1 as kC,c2 as qs,c3 as xC,c4 as wC,c5 as OC,c6 as LC,n as DC,K as th,c7 as MC,c8 as PC,c9 as FC,ca as BC,z as P1,b as F1,O as Xa,cb as oi,bs as UC,d as HC}from"./index-p5ek_T2U.js";import{B as Ee,c as re}from"./button-BvpGJmwj.js";import{u as En,S as Em,c as $C,b as qC,d as jC,i as zC,n as B1,M as GC,f as U1,j as H1,C as $1,t as q1,e as VC,o as WC}from"./use-deco-chat-open-CWPuucLF.js";import{b as vr,P as _r,a as Cr}from"./popover-C8z2ljXJ.js";import{S as rs}from"./spinner-BFe5KsON.js";import{T as bt,a as Et,b as Tt,c as as}from"./tooltip-w4nyO9EM.js";import{d as j1,u as nh,i as dr,f as YC}from"./constants-DTZgxhQr.js";import{u as KC,g as z1,l as Tm,a as ym,r as XC}from"./use-mcp-prompts-C28zFdyF.js";import{E as ZC}from"./error-boundary-Di0tQXdv.js";import{c as QC,b as JC,e as eI,a as tI,D as nI}from"./dialog-Djb2_yQ3.js";import{a as of,F as is,b as ss,c as rI,d as ls,f as us}from"./form-DIsigMsk.js";import{I as G1}from"./input-Cw77piS4.js";import{I as cs}from"./integration-icon-D3fWRQzh.js";import{c as aI,a as iI,e as sI}from"./usage-B8eRkRZY.js";import{i as oI}from"./ArrowUp-DgvOdNkG.js";import{t as lf}from"./ChevronDown-Di42C1UO.js";import{i as lI}from"./Edit01-CxGjhFGJ.js";import{t as pr}from"./Users03-DWNrz1Vr.js";import{i as uI}from"./XCircle-VzD2IKvZ.js";import{i as cI}from"./AlertCircle-CooHa8Dx.js";import{i as dI}from"./AlertTriangle-Ca8IB5bL.js";import{i as V1}from"./X-hlRWRdLd.js";import{i as pI}from"./ArrowLeft-DIF2VO2W.js";import{i as fI,t as W1,u as Y1}from"./use-copy-BnGNgGbL.js";import{B as hI}from"./badge-Ba42zrft.js";import{i as Gn}from"./Check-DGXJXTap.js";import{i as mI}from"./Code01-DooPA--K.js";import{b as gI}from"./use-virtual-mcp-C67SrK4s.js";import{i as K1}from"./SearchMd-CguhhQVb.js";import{u as bI}from"./use-create-virtual-mcp-BIn6DTPa.js";import{i as X1}from"./ChevronRight-BNn59ko7.js";import{m as EI}from"./marked.esm-BaswSlok.js";import{f as rh,p as Sm,a as Am,n as Nm,h as ds,s as va,o as uf,b as TI,c as yI,d as Vn,v as SI,e as Z1,g as vm,m as AI,i as NI,r as vI}from"./markdown-BUX5ABnz.js";import{a as ps}from"./Copy01-rucQ3PSp.js";import{T as _I}from"./tools-list-BYJP7wdj.js";import{E as CI}from"./empty-state-CUSdR_G_.js";import{g as II,h as RI}from"./use-connection-BRwTI0xk.js";import{g as kI}from"./generate-id-Dyweu44Y.js";import{s as _m}from"./Clock-BLkZwDYw.js";import{s as xI}from"./Trash01-DGjvH5rG.js";const Q1=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"}));Q1.displayName="Activity";const J1=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));J1.displayName="Atom02";const eA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));eA.displayName="Attachment01";const tA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));tA.displayName="Coins01";const ah=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));ah.displayName="Edit02";const nA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));nA.displayName="Lightbulb01";const rA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));rA.displayName="Stop";const aA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));aA.displayName="Target04";const Cm={}.hasOwnProperty;function iA(t,e){const n=e||{};function r(a,...i){let s=r.invalid;const o=r.handlers;if(a&&Cm.call(a,t)){const l=String(a[t]);s=Cm.call(o,l)?o[l]:r.unknown}if(s)return s.call(this,a,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function wI(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?si().min(1,"Required"):si();return Ar(e)}function OI(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function sA(t){const e=K.c(64),{prompt:n,setPrompt:r,onSubmit:a}=t,i=O.useId();let s;if(e[0]!==n){const M=n?wI(n):Ar({});s=w1(M),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?OI(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=O1(c);let p;e[7]!==n?.arguments?(p=n?.arguments??[],e[7]=n?.arguments,e[8]=p):p=e[8];const f=p;let m;e[9]!==d||e[10]!==a||e[11]!==r?(m=async M=>{await a(M),r(null),d.reset()},e[9]=d,e[10]=a,e[11]=r,e[12]=m):m=e[12];const g=m;let b;e[13]!==d||e[14]!==r?(b=M=>{M||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const y=b;if(!n)return null;let T;e[16]!==n.name||e[17]!==n.title?(T=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=T):T=e[18];let S;e[19]!==T?(S=E.jsx(QC,{children:T}),e[19]=T,e[20]=S):S=e[20];let A;e[21]!==n.description?(A=n.description&&E.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=A):A=e[22];let v;e[23]!==A||e[24]!==S?(v=E.jsxs(JC,{children:[S,A]}),e[23]=A,e[24]=S,e[25]=v):v=e[25];let N;e[26]!==d||e[27]!==g?(N=M=>{M.stopPropagation(),d.handleSubmit(g)(M)},e[26]=d,e[27]=g,e[28]=N):N=e[28];let C;if(e[29]!==f||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let M;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(M=Y=>E.jsx(is,{control:d.control,name:Y.name,render:X=>{const{field:W}=X;return E.jsxs(ss,{children:[E.jsxs(rI,{className:"text-xs",children:[Y.name,Y.required?null:E.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),E.jsx(ls,{children:E.jsx(G1,{...W,value:W.value??"",required:Y.required,placeholder:Y.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),E.jsx(us,{})]})}},Y.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=M):M=e[35],C=f.map(M),e[29]=f,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=C}else C=e[32];let k;e[36]!==y?(k=()=>y(!1),e[36]=y,e[37]=k):k=e[37];let R;e[38]!==d.formState.isSubmitting||e[39]!==k?(R=E.jsx(Ee,{type:"button",variant:"ghost",onClick:k,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=k,e[40]=R):R=e[40];const D=!d.formState.isValid||d.formState.isSubmitting;let w;e[41]!==d.formState.isSubmitting?(w=d.formState.isSubmitting?E.jsxs("span",{className:"flex items-center gap-2",children:[E.jsx(rs,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=w):w=e[42];let P;e[43]!==i||e[44]!==D||e[45]!==w?(P=E.jsx(Ee,{type:"submit",form:i,disabled:D,children:w}),e[43]=i,e[44]=D,e[45]=w,e[46]=P):P=e[46];let $;e[47]!==R||e[48]!==P?($=E.jsxs(eI,{children:[R,P]}),e[47]=R,e[48]=P,e[49]=$):$=e[49];let B;e[50]!==i||e[51]!==N||e[52]!==C||e[53]!==$?(B=E.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:N,children:[C,$]}),e[50]=i,e[51]=N,e[52]=C,e[53]=$,e[54]=B):B=e[54];let G;e[55]!==d||e[56]!==B?(G=E.jsx(of,{...d,children:B}),e[55]=d,e[56]=B,e[57]=G):G=e[57];let U;e[58]!==v||e[59]!==G?(U=E.jsxs(tI,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,G]}),e[58]=v,e[59]=G,e[60]=U):U=e[60];let z;return e[61]!==y||e[62]!==U?(z=E.jsx(nI,{open:!0,onOpenChange:y,children:U}),e[61]=y,e[62]=U,e[63]=z):z=e[63],z}function Be(t){this.content=t}Be.prototype={constructor:Be,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,a=r.find(t),i=r.content.slice();return a==-1?i.push(n||t,e):(i[a+1]=e,n&&(i[a]=n)),new Be(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Be(n)},addToStart:function(t,e){return new Be([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Be(n)},addBefore:function(t,e,n){var r=this.remove(e),a=r.content.slice(),i=r.find(t);return a.splice(i==-1?a.length:i,0,e,n),new Be(a)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Be.from(t),t.size?new Be(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Be.from(t),t.size?new Be(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Be.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Be.from=function(t){if(t instanceof Be)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Be(e)};function oA(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let s=0;a.text[s]==i.text[s];s++)n++;return n}if(a.content.size||i.content.size){let s=oA(a.content,i.content,n+1);if(s!=null)return s}n+=a.nodeSize}}function lA(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let s=t.child(--a),o=e.child(--i),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=lA(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class q{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,a=0,i){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,a+o,i||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,a+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?a?typeof a=="function"?a(o):a:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)a.push(e.content[i]);return new q(a,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],a=0;if(n>e)for(let i=0,s=0;s<n;i++){let o=this.content[i],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),a+=o.nodeSize),s=l}return new q(r,a)}cutByIndex(e,n){return e==n?q.empty:e==0&&n==this.content.length?this:new q(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new q(a,i)}addToStart(e){return new q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let a=this.content[n];e(a,r,n),r+=a.nodeSize}}findDiffStart(e,n=0){return oA(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lA(this,e,n,r)}findIndex(e){if(e==0)return Da(0,e);if(e==this.size)return Da(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Da(n+1,i):Da(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return q.empty;let n,r=0;for(let a=0;a<e.length;a++){let i=e[a];r+=i.nodeSize,a&&i.isText&&e[a-1].sameMarkup(i)?(n||(n=e.slice(0,a)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new q(n||e,r)}static from(e){if(!e)return q.empty;if(e instanceof q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const js={index:0,offset:0};function Da(t,e){return js.index=t,js.offset=e,js}function li(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!li(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!li(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let pe=class cf{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let a=0;a<e.length;a++){let i=e[a];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,a));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&li(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let a=r.create(n.attrs);return r.checkAttrs(a.attrs),a}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return cf.none;if(e instanceof cf)return[e];let n=e.slice();return n.sort((r,a)=>r.type.rank-a.type.rank),n}};pe.none=[];class ui extends Error{}class Z{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cA(this.content,e+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Z(uA(this.content,e+this.openStart,n+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,n){if(!n)return Z.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(q.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Z(e,r,a)}}Z.empty=new Z(q.empty,0,0);function uA(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(a==e||i.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(uA(i.content,e-a-1,n-a-1)))}function cA(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),s=t.maybeChild(a);if(i==e||s.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=cA(s.content,e-i-1,n,s);return o&&t.replaceChild(a,s.copy(o))}function LI(t,e,n){if(n.openStart>t.depth)throw new ui("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ui("Inconsistent open depths");return dA(t,e,n,0)}function dA(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r<t.depth-n.openStart){let s=dA(t,e,n,r+1);return i.copy(i.content.replaceChild(a,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Dn(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=DI(n,t);return Dn(i,fA(t,s,o,e,r))}else return Dn(i,ci(t,e,r))}function pA(t,e){if(!e.type.compatibleContent(t.type))throw new ui("Cannot join "+e.type.name+" onto "+t.type.name)}function df(t,e,n){let r=t.node(n);return pA(r,e.node(n)),r}function Ln(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Wr(t,e,n,r){let a=(e||t).node(n),i=0,s=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ln(t.nodeAfter,r),i++));for(let o=i;o<s;o++)Ln(a.child(o),r);e&&e.depth==n&&e.textOffset&&Ln(e.nodeBefore,r)}function Dn(t,e){return t.type.checkContent(e),t.copy(e)}function fA(t,e,n,r,a){let i=t.depth>a&&df(t,e,a+1),s=r.depth>a&&df(n,r,a+1),o=[];return Wr(null,t,a,o),i&&s&&e.index(a)==n.index(a)?(pA(i,s),Ln(Dn(i,fA(t,e,n,r,a+1)),o)):(i&&Ln(Dn(i,ci(t,e,a+1)),o),Wr(e,n,a,o),s&&Ln(Dn(s,ci(n,r,a+1)),o)),Wr(r,null,a,o),new q(o)}function ci(t,e,n){let r=[];if(Wr(null,t,n,r),t.depth>n){let a=df(t,e,n+1);Ln(Dn(a,ci(t,e,n+1)),r)}return Wr(e,null,n,r),new q(r)}function DI(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(q.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ua{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)a+=r.child(i).nodeSize;return a}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return pe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),a=e.maybeChild(n);if(!r){let o=r;r=a,a=o}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!a||!i[s].isInSet(a.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,a=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!a||!r[i].isInSet(a.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new di(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,o,a+l),!u||(s=s.child(o),s.isText))break;i=u-1,a+=l+1}return new ua(n,r,i)}static resolveCached(e,n){let r=Im.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Im.set(e,r=new MI);let a=r.elts[r.i]=ua.resolve(e,n);return r.i=(r.i+1)%PI,a}}class MI{constructor(){this.elts=[],this.i=0}}const PI=12,Im=new WeakMap;class di{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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)}}const FI=Object.create(null);let dn=class pf{constructor(e,n,r,a=pe.none){this.type=e,this.attrs=n,this.marks=a,this.content=r||q.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,n,r,a=0){this.content.nodesBetween(e,n,r,a,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,n,r,a){return this.content.textBetween(e,n,r,a)}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,n,r){return this.type==e&&li(this.attrs,n||e.defaultAttrs||FI)&&pe.sameSet(this.marks,r||pe.none)}copy(e=null){return e==this.content?this:new pf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pf(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Z.empty;let a=this.resolve(e),i=this.resolve(n),s=r?0:a.sharedDepth(n),o=a.start(s),u=a.node(s).content.cut(a.pos-o,i.pos-o);return new Z(u,a.depth-s,i.depth-s)}replace(e,n,r){return LI(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:a}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(a==e||n.isText)return n;e-=a+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let a=this.content.child(n-1);return{node:a,index:n-1,offset:r-a.nodeSize}}resolve(e){return ua.resolveCached(this,e)}resolveNoCache(e){return ua.resolve(this,e)}rangeHasMark(e,n,r){let a=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}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()+")"),hA(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=q.empty,a=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,a,i),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=a;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,a){if(a&&!this.type.allowsMarks(a))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}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=pe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=q.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};dn.prototype.text=void 0;class pi extends dn{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new pi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pi(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function hA(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new BI(e,n);if(r.next==null)return Hn.empty;let a=mA(r);r.next&&r.err("Unexpected trailing text");let i=GI(zI(a));return VI(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let a=this;for(let i=n;a&&i<r;i++)a=a.matchType(e.child(i).type);return a}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let a=[this];function i(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return q.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&a.indexOf(d)==-1){a.push(d);let p=i(d,o.concat(c));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let a=r.shift(),i=a.match;if(i.matchType(e)){let s=[];for(let o=a;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:o,next:l}=i.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!a.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:a}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a<r.next.length;a++)e.indexOf(r.next[a].next)==-1&&n(r.next[a].next)}return n(this),e.map((r,a)=>{let i=a+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
1
+ import{r as O,c as K,o as Ar,k as w1,l as O1,j as E,s as si,bU as L1,bV as vC,bm as Ke,bW as _C,H as D1,u as Nr,t as Gt,am as CC,bX as IC,b5 as M1,bY as RC,bZ as kt,b_ as $s,b$ as kC,c0 as qs,c1 as xC,c2 as wC,c3 as OC,c4 as LC,n as DC,K as th,c5 as MC,c6 as PC,c7 as FC,c8 as BC,z as P1,b as F1,O as Xa,c9 as oi,bs as UC,d as HC}from"./index-CzSiUwwv.js";import{B as Ee,c as re}from"./button-Bl7hMmCe.js";import{u as En,S as Em,c as $C,b as qC,d as jC,i as zC,n as B1,M as GC,f as U1,j as H1,C as $1,t as q1,e as VC,o as WC}from"./use-deco-chat-open-BuMsTBnv.js";import{b as vr,P as _r,a as Cr}from"./popover-Ca9Cyzf7.js";import{S as rs}from"./spinner-B-FWJ8nx.js";import{T as bt,a as Et,b as Tt,c as as,i as j1}from"./tooltip-CLbmwjfd.js";import{d as z1,u as nh,i as dr,f as YC}from"./constants-DY_BU6PR.js";import{u as KC,g as G1,l as Tm,a as ym,r as XC}from"./use-mcp-prompts-DMC1gnwj.js";import{E as ZC}from"./error-boundary-GB3TovJQ.js";import{c as QC,b as JC,e as eI,a as tI,D as nI}from"./dialog-BTs7spED.js";import{a as of,F as is,b as ss,c as rI,d as ls,f as us}from"./form-Dxe8J4dP.js";import{I as V1}from"./input-CAPxG1rh.js";import{I as cs}from"./integration-icon-jbm4PmZt.js";import{c as aI,a as iI,e as sI}from"./usage-B8eRkRZY.js";import{i as oI}from"./ArrowUp-xougxkbC.js";import{t as lf}from"./ChevronDown-FdgQzkaa.js";import{i as lI}from"./Edit01-CUcmwNxC.js";import{t as pr}from"./Users03-B6oew679.js";import{i as uI}from"./XCircle-WTPrrNWD.js";import{i as cI}from"./AlertCircle-FL98lGLa.js";import{i as dI}from"./AlertTriangle-DteHmOG1.js";import{i as pI}from"./ArrowLeft-CMuGBwkE.js";import{i as fI,t as W1,u as Y1}from"./use-copy-BZqI2HfR.js";import{B as hI}from"./badge-Bt6C7wEJ.js";import{i as Gn}from"./Check-BY-DCpO_.js";import{i as mI}from"./Code01-CowHxp14.js";import{b as gI}from"./use-virtual-mcp-CqdRLJoL.js";import{i as K1}from"./SearchMd-BMO4jqwv.js";import{u as bI}from"./use-create-virtual-mcp-DKrayFIg.js";import{i as X1}from"./ChevronRight-DYxU3E_q.js";import{m as EI}from"./marked.esm-BaswSlok.js";import{f as rh,p as Sm,a as Am,n as Nm,h as ds,s as va,o as uf,b as TI,c as yI,d as Vn,v as SI,e as Z1,g as vm,m as AI,i as NI,r as vI}from"./markdown-DTO-ngpn.js";import{a as ps}from"./Copy01-B_7d0dwb.js";import{T as _I}from"./tools-list-CBpacE22.js";import{E as CI}from"./empty-state-yzpNvfA-.js";import{g as II,h as RI}from"./use-connection-CdIwTzRh.js";import{g as kI}from"./generate-id-Dyweu44Y.js";import{s as _m}from"./Clock-Drw10Mc_.js";import{s as xI}from"./Trash01-BKhksYCP.js";const Q1=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"}));Q1.displayName="Activity";const J1=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));J1.displayName="Atom02";const eA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));eA.displayName="Attachment01";const tA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));tA.displayName="Coins01";const ah=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));ah.displayName="Edit02";const nA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));nA.displayName="Lightbulb01";const rA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));rA.displayName="Stop";const aA=({size:t=24,color:e="currentColor",...n})=>O.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},O.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));aA.displayName="Target04";const Cm={}.hasOwnProperty;function iA(t,e){const n=e||{};function r(a,...i){let s=r.invalid;const o=r.handlers;if(a&&Cm.call(a,t)){const l=String(a[t]);s=Cm.call(o,l)?o[l]:r.unknown}if(s)return s.call(this,a,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function wI(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?si().min(1,"Required"):si();return Ar(e)}function OI(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function sA(t){const e=K.c(64),{prompt:n,setPrompt:r,onSubmit:a}=t,i=O.useId();let s;if(e[0]!==n){const M=n?wI(n):Ar({});s=w1(M),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?OI(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=O1(c);let p;e[7]!==n?.arguments?(p=n?.arguments??[],e[7]=n?.arguments,e[8]=p):p=e[8];const f=p;let m;e[9]!==d||e[10]!==a||e[11]!==r?(m=async M=>{await a(M),r(null),d.reset()},e[9]=d,e[10]=a,e[11]=r,e[12]=m):m=e[12];const g=m;let b;e[13]!==d||e[14]!==r?(b=M=>{M||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const y=b;if(!n)return null;let T;e[16]!==n.name||e[17]!==n.title?(T=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=T):T=e[18];let S;e[19]!==T?(S=E.jsx(QC,{children:T}),e[19]=T,e[20]=S):S=e[20];let A;e[21]!==n.description?(A=n.description&&E.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=A):A=e[22];let v;e[23]!==A||e[24]!==S?(v=E.jsxs(JC,{children:[S,A]}),e[23]=A,e[24]=S,e[25]=v):v=e[25];let N;e[26]!==d||e[27]!==g?(N=M=>{M.stopPropagation(),d.handleSubmit(g)(M)},e[26]=d,e[27]=g,e[28]=N):N=e[28];let C;if(e[29]!==f||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let M;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(M=Y=>E.jsx(is,{control:d.control,name:Y.name,render:X=>{const{field:W}=X;return E.jsxs(ss,{children:[E.jsxs(rI,{className:"text-xs",children:[Y.name,Y.required?null:E.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),E.jsx(ls,{children:E.jsx(V1,{...W,value:W.value??"",required:Y.required,placeholder:Y.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),E.jsx(us,{})]})}},Y.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=M):M=e[35],C=f.map(M),e[29]=f,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=C}else C=e[32];let k;e[36]!==y?(k=()=>y(!1),e[36]=y,e[37]=k):k=e[37];let R;e[38]!==d.formState.isSubmitting||e[39]!==k?(R=E.jsx(Ee,{type:"button",variant:"ghost",onClick:k,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=k,e[40]=R):R=e[40];const D=!d.formState.isValid||d.formState.isSubmitting;let w;e[41]!==d.formState.isSubmitting?(w=d.formState.isSubmitting?E.jsxs("span",{className:"flex items-center gap-2",children:[E.jsx(rs,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=w):w=e[42];let P;e[43]!==i||e[44]!==D||e[45]!==w?(P=E.jsx(Ee,{type:"submit",form:i,disabled:D,children:w}),e[43]=i,e[44]=D,e[45]=w,e[46]=P):P=e[46];let $;e[47]!==R||e[48]!==P?($=E.jsxs(eI,{children:[R,P]}),e[47]=R,e[48]=P,e[49]=$):$=e[49];let B;e[50]!==i||e[51]!==N||e[52]!==C||e[53]!==$?(B=E.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:N,children:[C,$]}),e[50]=i,e[51]=N,e[52]=C,e[53]=$,e[54]=B):B=e[54];let G;e[55]!==d||e[56]!==B?(G=E.jsx(of,{...d,children:B}),e[55]=d,e[56]=B,e[57]=G):G=e[57];let U;e[58]!==v||e[59]!==G?(U=E.jsxs(tI,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,G]}),e[58]=v,e[59]=G,e[60]=U):U=e[60];let z;return e[61]!==y||e[62]!==U?(z=E.jsx(nI,{open:!0,onOpenChange:y,children:U}),e[61]=y,e[62]=U,e[63]=z):z=e[63],z}function Be(t){this.content=t}Be.prototype={constructor:Be,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,a=r.find(t),i=r.content.slice();return a==-1?i.push(n||t,e):(i[a+1]=e,n&&(i[a]=n)),new Be(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Be(n)},addToStart:function(t,e){return new Be([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Be(n)},addBefore:function(t,e,n){var r=this.remove(e),a=r.content.slice(),i=r.find(t);return a.splice(i==-1?a.length:i,0,e,n),new Be(a)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Be.from(t),t.size?new Be(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Be.from(t),t.size?new Be(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Be.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Be.from=function(t){if(t instanceof Be)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Be(e)};function oA(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let s=0;a.text[s]==i.text[s];s++)n++;return n}if(a.content.size||i.content.size){let s=oA(a.content,i.content,n+1);if(s!=null)return s}n+=a.nodeSize}}function lA(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let s=t.child(--a),o=e.child(--i),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=lA(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class q{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,a=0,i){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,a+o,i||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,a+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?a?typeof a=="function"?a(o):a:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)a.push(e.content[i]);return new q(a,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],a=0;if(n>e)for(let i=0,s=0;s<n;i++){let o=this.content[i],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),a+=o.nodeSize),s=l}return new q(r,a)}cutByIndex(e,n){return e==n?q.empty:e==0&&n==this.content.length?this:new q(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new q(a,i)}addToStart(e){return new q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let a=this.content[n];e(a,r,n),r+=a.nodeSize}}findDiffStart(e,n=0){return oA(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lA(this,e,n,r)}findIndex(e){if(e==0)return Da(0,e);if(e==this.size)return Da(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Da(n+1,i):Da(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return q.empty;let n,r=0;for(let a=0;a<e.length;a++){let i=e[a];r+=i.nodeSize,a&&i.isText&&e[a-1].sameMarkup(i)?(n||(n=e.slice(0,a)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new q(n||e,r)}static from(e){if(!e)return q.empty;if(e instanceof q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const js={index:0,offset:0};function Da(t,e){return js.index=t,js.offset=e,js}function li(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!li(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!li(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let pe=class cf{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let a=0;a<e.length;a++){let i=e[a];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,a));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&li(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let a=r.create(n.attrs);return r.checkAttrs(a.attrs),a}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return cf.none;if(e instanceof cf)return[e];let n=e.slice();return n.sort((r,a)=>r.type.rank-a.type.rank),n}};pe.none=[];class ui extends Error{}class Z{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cA(this.content,e+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Z(uA(this.content,e+this.openStart,n+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,n){if(!n)return Z.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(q.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Z(e,r,a)}}Z.empty=new Z(q.empty,0,0);function uA(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(a==e||i.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(uA(i.content,e-a-1,n-a-1)))}function cA(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),s=t.maybeChild(a);if(i==e||s.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=cA(s.content,e-i-1,n,s);return o&&t.replaceChild(a,s.copy(o))}function LI(t,e,n){if(n.openStart>t.depth)throw new ui("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ui("Inconsistent open depths");return dA(t,e,n,0)}function dA(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r<t.depth-n.openStart){let s=dA(t,e,n,r+1);return i.copy(i.content.replaceChild(a,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Dn(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=DI(n,t);return Dn(i,fA(t,s,o,e,r))}else return Dn(i,ci(t,e,r))}function pA(t,e){if(!e.type.compatibleContent(t.type))throw new ui("Cannot join "+e.type.name+" onto "+t.type.name)}function df(t,e,n){let r=t.node(n);return pA(r,e.node(n)),r}function Ln(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Wr(t,e,n,r){let a=(e||t).node(n),i=0,s=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ln(t.nodeAfter,r),i++));for(let o=i;o<s;o++)Ln(a.child(o),r);e&&e.depth==n&&e.textOffset&&Ln(e.nodeBefore,r)}function Dn(t,e){return t.type.checkContent(e),t.copy(e)}function fA(t,e,n,r,a){let i=t.depth>a&&df(t,e,a+1),s=r.depth>a&&df(n,r,a+1),o=[];return Wr(null,t,a,o),i&&s&&e.index(a)==n.index(a)?(pA(i,s),Ln(Dn(i,fA(t,e,n,r,a+1)),o)):(i&&Ln(Dn(i,ci(t,e,a+1)),o),Wr(e,n,a,o),s&&Ln(Dn(s,ci(n,r,a+1)),o)),Wr(r,null,a,o),new q(o)}function ci(t,e,n){let r=[];if(Wr(null,t,n,r),t.depth>n){let a=df(t,e,n+1);Ln(Dn(a,ci(t,e,n+1)),r)}return Wr(e,null,n,r),new q(r)}function DI(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(q.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ua{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)a+=r.child(i).nodeSize;return a}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return pe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),a=e.maybeChild(n);if(!r){let o=r;r=a,a=o}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!a||!i[s].isInSet(a.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,a=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!a||!r[i].isInSet(a.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new di(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,o,a+l),!u||(s=s.child(o),s.isText))break;i=u-1,a+=l+1}return new ua(n,r,i)}static resolveCached(e,n){let r=Im.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Im.set(e,r=new MI);let a=r.elts[r.i]=ua.resolve(e,n);return r.i=(r.i+1)%PI,a}}class MI{constructor(){this.elts=[],this.i=0}}const PI=12,Im=new WeakMap;class di{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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)}}const FI=Object.create(null);let dn=class pf{constructor(e,n,r,a=pe.none){this.type=e,this.attrs=n,this.marks=a,this.content=r||q.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,n,r,a=0){this.content.nodesBetween(e,n,r,a,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,n,r,a){return this.content.textBetween(e,n,r,a)}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,n,r){return this.type==e&&li(this.attrs,n||e.defaultAttrs||FI)&&pe.sameSet(this.marks,r||pe.none)}copy(e=null){return e==this.content?this:new pf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pf(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Z.empty;let a=this.resolve(e),i=this.resolve(n),s=r?0:a.sharedDepth(n),o=a.start(s),u=a.node(s).content.cut(a.pos-o,i.pos-o);return new Z(u,a.depth-s,i.depth-s)}replace(e,n,r){return LI(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:a}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(a==e||n.isText)return n;e-=a+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let a=this.content.child(n-1);return{node:a,index:n-1,offset:r-a.nodeSize}}resolve(e){return ua.resolveCached(this,e)}resolveNoCache(e){return ua.resolve(this,e)}rangeHasMark(e,n,r){let a=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}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()+")"),hA(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=q.empty,a=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,a,i),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=a;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,a){if(a&&!this.type.allowsMarks(a))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}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=pe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=q.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};dn.prototype.text=void 0;class pi extends dn{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new pi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pi(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function hA(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new BI(e,n);if(r.next==null)return Hn.empty;let a=mA(r);r.next&&r.err("Unexpected trailing text");let i=GI(zI(a));return VI(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let a=this;for(let i=n;a&&i<r;i++)a=a.matchType(e.child(i).type);return a}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let a=[this];function i(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return q.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&a.indexOf(d)==-1){a.push(d);let p=i(d,o.concat(c));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let a=r.shift(),i=a.match;if(i.matchType(e)){let s=[];for(let o=a;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:o,next:l}=i.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!a.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:a}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a<r.next.length;a++)e.indexOf(r.next[a].next)==-1&&n(r.next[a].next)}return n(this),e.map((r,a)=>{let i=a+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
2
2
  `)}}Hn.empty=new Hn(!0);class BI{constructor(e,n){this.string=e,this.nodeTypes=n,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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function mA(t){let e=[];do e.push(UI(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function UI(t){let e=[];do e.push(HI(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function HI(t){let e=jI(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=$I(t,e);else break;return e}function Rm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function $I(t,e){let n=Rm(t),r=n;return t.eat(",")&&(t.next!="}"?r=Rm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function qI(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let s=n[i];s.isInGroup(e)&&a.push(s)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function jI(t){if(t.eat("(")){let e=mA(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=qI(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function zI(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let u={term:l,to:o};return e[s].push(u),u}function a(s,o){s.forEach(l=>l.to=o)}function i(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(i(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=i(s.exprs[l],o);if(l==s.exprs.length-1)return u;a(u,o=n())}else if(s.type=="star"){let l=n();return r(o,l),a(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return a(i(s.expr,o),l),a(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(i(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u<s.min;u++){let c=n();a(i(s.expr,l),c),l=c}if(s.max==-1)a(i(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),a(i(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function gA(t,e){return e-t}function km(t,e){let n=[];return r(e),n.sort(gA);function r(a){let i=t[a];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(a);for(let s=0;s<i.length;s++){let{term:o,to:l}=i[s];!o&&n.indexOf(l)==-1&&r(l)}}}function GI(t){let e=Object.create(null);return n(km(t,0));function n(r){let a=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let c=0;c<a.length;c++)a[c][0]==o&&(u=a[c][1]);km(t,l).forEach(c=>{u||a.push([o,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=e[r.join(",")]=new Hn(r.indexOf(t.length-1)>-1);for(let s=0;s<a.length;s++){let o=a[s][1].sort(gA);i.next.push({type:a[s][0],next:e[o.join(",")]||n(o)})}return i}}function VI(t,e){for(let n=0,r=[t];n<r.length;n++){let a=r[n],i=!a.validEnd,s=[];for(let o=0;o<a.next.length;o++){let{type:l,next:u}=a.next[o];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function bA(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function EA(t,e){let n=Object.create(null);for(let r in t){let a=e&&e[r];if(a===void 0){let i=t[r];if(i.hasDefault)a=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=a}return n}function TA(t,e,n,r){for(let a in e)if(!(a in t))throw new RangeError(`Unsupported attribute ${a} for ${n} of type ${a}`);for(let a in t){let i=t[a];i.validate&&i.validate(e[a])}}function yA(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new YI(t,r,e[r]);return n}let xm=class SA{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=yA(e,r.attrs),this.defaultAttrs=bA(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Hn.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:EA(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dn(this,this.computeAttrs(e),q.from(n),pe.setFrom(r))}createChecked(e=null,n,r){return n=q.from(n),this.checkContent(n),new dn(this,this.computeAttrs(e),n,pe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=q.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(q.empty,!0);return i?new dn(this,e,n.append(i),pe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){TA(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:pe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new SA(i,n,s));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function WI(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class YI{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?WI(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class fs{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=yA(e,a.attrs),this.excluded=null;let i=bA(this.attrs);this.instance=i?new pe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new pe(this,EA(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,s)=>r[i]=new fs(i,a++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){TA(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class AA{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Be.from(e.nodes),n.marks=Be.from(e.marks||{}),this.nodes=xm.compile(this.spec.nodes,this),this.marks=fs.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],s=i.spec.content||"",o=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Hn.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=o=="_"?null:o?wm(this,o.split(" ")):o==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:wm(this,s.split(" "))}this.nodeFromJSON=a=>dn.fromJSON(this,a),this.markFromJSON=a=>pe.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,a)}text(e,n){let r=this.nodes.text;return new pi(r,r.defaultAttrs,e,pe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function wm(t,e){let n=[];for(let r=0;r<e.length;r++){let a=e[r],i=t.marks[a],s=i;if(i)n.push(i);else for(let o in t.marks){let l=t.marks[o];(a=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(a)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function KI(t){return t.tag!=null}function XI(t){return t.style!=null}class pn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(KI(a))this.tags.push(a);else if(XI(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Lm(this,n,!1);return r.addAll(e,pe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Lm(this,n,!0);return r.addAll(e,pe.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;a<this.tags.length;a++){let i=this.tags[a];if(JI(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,a){for(let i=a?this.styles.indexOf(a)+1:0;i<this.styles.length;i++){let s=this.styles[i],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(a){let i=a.priority==null?50:a.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<i)break}n.splice(s,0,a)}for(let a in e.marks){let i=e.marks[a].spec.parseDOM;i&&i.forEach(s=>{r(s=Dm(s)),s.mark||s.ignore||s.clearMark||(s.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(s=>{r(s=Dm(s)),s.node||s.ignore||s.mark||(s.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new pn(e,pn.schemaRules(e)))}}const NA={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},ZI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vA={ol:!0,ul:!0},ca=1,ff=2,Yr=4;function Om(t,e,n){return e!=null?(e?ca:0)|(e==="full"?ff:0):t&&t.whitespace=="pre"?ca|ff:n&~Yr}class Ma{constructor(e,n,r,a,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=s,this.content=[],this.activeMarks=pe.none,this.match=i||(s&Yr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(q.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ca)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=q.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!NA.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Lm{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,s=Om(null,n.preserveWhitespace,0)|(r?Yr:0);a?i=new Ma(a.type,a.attrs,pe.none,!0,n.topMatch||a.type.contentMatch,s):r?i=new Ma(null,null,pe.none,!0,null,s):i=new Ma(e.schema.topNodeType,null,pe.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&ff?"full":this.localPreserveWS||(a.options&ca)>0,{schema:s}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=a.content[a.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let a=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;vA.hasOwnProperty(s)&&this.parser.normalizeLists&&QI(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:ZI.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(NA.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(i),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=a}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let a=0;a<this.parser.matchedStyles.length;a++){let i=this.parser.matchedStyles[a],s=r.getPropertyValue(i);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(i,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,a){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(a)this.addElement(e,r,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(o)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=a==null?null:e.childNodes[a];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!a||a.length>u.length+o)&&(a=u,i=l,!u.length))break;if(l.solid){if(r)break;o+=2}}if(!a)return null;this.sync(i);for(let s=0;s<a.length;s++)n=this.enterInner(a[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let a=this.findPlace(e,n,r);if(a){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=pe.none;for(let o of a.concat(e.marks))(i.type?i.type.allowsMarkType(o.type):Mm(o.type,e.type))&&(s=o.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,a){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,a)),i}enterInner(e,n,r,a=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=Om(e,i,s.options);s.options&Yr&&s.content.length==0&&(o|=Yr);let l=pe.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):Mm(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Ma(e,n,l,a,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ca)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let a=0;a<this.find.length;a++)this.find[a].pos==null&&e.nodeType==1&&e.contains(this.find[a].node)&&n.compareDocumentPosition(this.find[a].node)&(r?2:4)&&(this.find[a].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?0:1),s=(o,l)=>{for(;o>=0;o--){let u=n[o];if(u==""){if(o==n.length-1||o==0)continue;for(;l>=i;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&a?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function QI(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&vA.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JI(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Dm(t){let e={};for(let n in t)e[n]=t[n];return e}function Mm(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],s=o=>{i.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:c}=o.edge(l);if(u==e||i.indexOf(c)<0&&s(c))return!0}};if(s(a.contentMatch))return!0}}class Wn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=zs(n).createDocumentFragment());let a=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let o=0,l=0;for(;o<i.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(i[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<i.length;)a=i.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(i.push([u,a]),a.appendChild(c.dom),a=c.contentDOM||c.dom)}}a.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:a}=Za(zs(n),this.nodes[e.type.name](e),null,e.attrs);if(a){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,a)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let a=e.marks.length-1;a>=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&Za(zs(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return Za(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Pm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Pm(e.marks)}}function Pm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zs(t){return t.document||window.document}const Fm=new WeakMap;function eR(t){let e=Fm.get(t);return e===void 0&&Fm.set(t,e=tR(t)),e}function tR(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a<r.length;a++)n(r[a]);else for(let a in r)n(r[a])}return n(t),e}function Za(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let a=e[0],i;if(typeof a!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=eR(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=a.indexOf(" ");s>0&&(n=a.slice(0,s),a=a.slice(s+1));let o,l=n?t.createElementNS(n,a):t.createElement(a),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:m}=Za(t,p,n,r);if(l.appendChild(f),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:l,contentDOM:o}}const _A=65535,CA=Math.pow(2,16);function nR(t,e){return t+e*CA}function Bm(t){return t&_A}function rR(t){return(t-(t&_A))/CA}const IA=1,RA=2,Qa=4,kA=8;class hf{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&kA)>0}get deletedBefore(){return(this.delInfo&(IA|Qa))>0}get deletedAfter(){return(this.delInfo&(RA|Qa))>0}get deletedAcross(){return(this.delInfo&Qa)>0}}class it{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&it.empty)return it.empty}recover(e){let n=0,r=Bm(e);if(!this.inverted)for(let a=0;a<r;a++)n+=this.ranges[a*3+2]-this.ranges[a*3+1];return this.ranges[r*3]+n+rR(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let a=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?a:0);if(l>e)break;let u=this.ranges[o+i],c=this.ranges[o+s],d=l+u;if(e<=d){let p=u?e==l?-1:e==d?1:n:n,f=l+a+(p<0?0:c);if(r)return f;let m=e==(n<0?l:d)?null:nR(o/3,e-l),g=e==l?RA:e==d?IA:Qa;return(n<0?e!=l:e!=d)&&(g|=kA),new hf(f,g,m)}a+=c-u}return r?e+a:new hf(e+a,0,null)}touches(e,n){let r=0,a=Bm(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[o+i],c=l+u;if(e<=c&&o==a*3)return!0;r+=this.ranges[o+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let a=0,i=0;a<this.ranges.length;a+=3){let s=this.ranges[a],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),u=this.ranges[a+n],c=this.ranges[a+r];e(o,o+u,l,l+c),i+=c-u}}invert(){return new it(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?it.empty:new it(e<0?[0,-e,0]:[0,0,e])}}it.empty=new it([]);class da{constructor(e,n,r=0,a=e?e.length:0){this.mirror=n,this.from=r,this.to=a,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new da(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let a=e.getMirror(n);this.appendMap(e._maps[n],a!=null&&a<n?r+a:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new da;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let a=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(o.recover);continue}}a|=o.delInfo,e=o.pos}return r?e:new hf(e,a,null)}}const Gs=Object.create(null);class Ve{getMap(){return it.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Gs[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Gs)throw new RangeError("Duplicate use of step JSON ID "+e);return Gs[e]=n,n.prototype.jsonID=e,n}}class Ce{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ce(e,null)}static fail(e){return new Ce(null,e)}static fromReplace(e,n,r,a){try{return Ce.ok(e.replace(n,r,a))}catch(i){if(i instanceof ui)return Ce.fail(i.message);throw i}}}function ih(t,e,n){let r=[];for(let a=0;a<t.childCount;a++){let i=t.child(a);i.content.size&&(i=i.copy(ih(i.content,e,i))),i.isInline&&(i=e(i,n,a)),r.push(i)}return q.fromArray(r)}class sn extends Ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),a=r.node(r.sharedDepth(this.to)),i=new Z(ih(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),a),n.openStart,n.openEnd);return Ce.fromReplace(e,this.from,this.to,i)}invert(){return new gt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sn(n.pos,r.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}Ve.jsonID("addMark",sn);class gt extends Ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Z(ih(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Ce.fromReplace(e,this.from,this.to,r)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gt(n.pos,r.pos,this.mark)}merge(e){return e instanceof gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new gt(n.from,n.to,e.markFromJSON(n.mark))}}Ve.jsonID("removeMark",gt);class on extends Ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ce.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new Z(q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;a<n.marks.length;a++)if(!n.marks[a].isInSet(r))return new on(this.pos,n.marks[a]);return new on(this.pos,this.mark)}}return new $n(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new on(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new on(n.pos,e.markFromJSON(n.mark))}}Ve.jsonID("addNodeMark",on);class $n extends Ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ce.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new Z(q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new on(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $n(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new $n(n.pos,e.markFromJSON(n.mark))}}Ve.jsonID("removeNodeMark",$n);class Le extends Ve{constructor(e,n,r,a=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=a}apply(e){return this.structure&&mf(e,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new it([this.from,this.to-this.from,this.slice.size])}invert(e){return new Le(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Le(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Le)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Le(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Le(e.from,this.to,n,this.structure)}else return null}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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Le(n.from,n.to,Z.fromJSON(e,n.slice),!!n.structure)}}Ve.jsonID("replace",Le);class Me extends Ve{constructor(e,n,r,a,i,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=a,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(mf(e,this.from,this.gapFrom)||mf(e,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ce.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ce.fromReplace(e,this.from,this.to,r):Ce.fail("Content does not fit in gap")}getMap(){return new it([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Me(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),a=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||a<n.pos||i>r.pos?null:new Me(n.pos,r.pos,a,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Me(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ve.jsonID("replaceAround",Me);function mf(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,a--}}return!1}function aR(t,e,n,r){let a=[],i=[],s,o;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let p=Math.max(u,e),f=Math.min(u+l.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(d[g])?s.to=f:a.push(s=new gt(p,f,d[g])));o&&o.to==p?o.to=f:i.push(o=new sn(p,f,r))}}),a.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function iR(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof fs){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],p;for(let f=0;f<a.length;f++){let m=a[f];m.step==i-1&&d.eq(a[f].style)&&(p=m)}p?(p.to=u,p.step=i):a.push({style:d,from:Math.max(o,e),to:u,step:i})}}}),a.forEach(s=>t.step(new gt(s.from,s.to,s.style)))}function sh(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let u=i.child(l),c=o+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new Le(o,c,Z.empty));else{r=d;for(let p=0;p<u.marks.length;p++)n.allowsMarkType(u.marks[p].type)||t.step(new gt(o,c,u.marks[p]));if(a&&u.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,m;for(;p=f.exec(u.text);)m||(m=new Z(q.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Le(o+p.index,o+p.index+p[0].length,m))}}o=c}if(!r.validEnd){let l=r.fillBefore(q.empty,!0);t.replace(o,o,new Z(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function sR(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ir(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+a,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!sR(s,o,l))break;o&&(a=1),l<s.childCount&&(i=1)}return null}function oR(t,e,n){let{$from:r,$to:a,depth:i}=e,s=r.before(i+1),o=a.after(i+1),l=s,u=o,c=q.empty,d=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,c=q.from(r.node(m).copy(c)),d++):l--;let p=q.empty,f=0;for(let m=i,g=!1;m>n;m--)g||a.after(m+1)<a.end(m)?(g=!0,p=q.from(a.node(m).copy(p)),f++):u++;t.step(new Me(l,u,s,o,new Z(c.append(p),d,f),c.size-d,!0))}function oh(t,e,n=null,r=t){let a=lR(t,e),i=a&&uR(r,e);return i?a.map(Um).concat({type:e,attrs:n}).concat(i.map(Um)):null}function Um(t){return{type:t,attrs:null}}function lR(t,e){let{parent:n,startIndex:r,endIndex:a}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,a,s)?i:null}function uR(t,e){let{parent:n,startIndex:r,endIndex:a}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<a;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function cR(t,e,n){let r=q.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(n[s].type.create(n[s].attrs,r))}let a=e.start,i=e.end;t.step(new Me(a,i,a,i,new Z(r,0,0),n.length,!0))}function dR(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof a=="function"?a(s):a;if(s.isTextblock&&!s.hasMarkup(r,l)&&pR(t.doc,t.mapping.slice(i).map(o),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!m?u=!1:!f&&m&&(u=!0)}u===!1&&wA(t,s,o,i),sh(t,t.mapping.slice(i).map(o,1),r,void 0,u===null);let c=t.mapping.slice(i),d=c.map(o,1),p=c.map(o+s.nodeSize,1);return t.step(new Me(d,p,d+1,p-1,new Z(q.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&xA(t,s,o,i),!1}})}function xA(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(a.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function wA(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -97,7 +97,7 @@ ${b}
97
97
  `);v.trim()&&(e.customNestedParser?T=e.customNestedParser(v):T=n.blockTokens(v))}const A=e.createToken(m,T);l.push(A)}if(l.length!==0)return{items:l,raw:u}}function Oh(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...s]=t.content,o=e.renderChildren([i]),l=[`${a}${o}`];return s&&s.length>0&&s.forEach(u=>{const c=e.renderChildren([u]);if(c){const d=c.split(`
98
98
  `).map(p=>p?e.indent(p):"").join(`
99
99
  `);l.push(d)}}),l.join(`
100
- `)}function BO(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,s=t;a.descendants((o,l)=>{const u=i.mapping.map(l),c=i.mapping.map(l)+o.nodeSize;let d=null;if(o.marks.forEach(f=>{if(f!==s)return!1;d=f}),!d)return;let p=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(p=!0)}),p){const f=t.type.create({...t.attrs,...n});i.removeMark(u,c,t.type),i.addMark(u,c,f)}}),i.docChanged&&e.view.dispatch(i)}var Qe=class fv extends kh{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new fv(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},UO=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,a,i,s,o;const{view:l}=this.editor,u=t.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(u)||!c)return;let d=0,p=0;if(this.dom!==c){const T=this.dom.getBoundingClientRect(),S=c.getBoundingClientRect(),A=(a=t.offsetX)!=null?a:(r=t.nativeEvent)==null?void 0:r.offsetX,v=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=S.x-T.x+A,p=S.y-T.y+v}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),(o=t.dataTransfer)==null||o.setDragImage(f,d,p)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=te.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const a=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!a)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=te.isSelectable(this.node),d=t.type==="copy",p=t.type==="paste",f=t.type==="cut",m=t.type==="mousedown";if(!u&&c&&a&&t.target===this.dom&&t.preventDefault(),u&&a&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(u&&o&&!l&&m){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(l||i||d||p||f||m&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(ga()||Cf())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function zn(t){return new TO({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=de(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];let u=n.to;if(o){const c=l.search(/\S/),d=n.from+l.indexOf(o),p=d+o.length;if(Rh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+o.length,s.addMark(n.from+c,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:HO,getOwnPropertySymbols:$O}=Object,{hasOwnProperty:qO}=Object.prototype;function so(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function $a(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,s=i.get(n),o=i.get(r);if(s&&o)return s===r&&o===n;i.set(n,r),i.set(r,n);const l=t(n,r,a);return i.delete(n),i.delete(r),l}}function jO(t){return t?.[Symbol.toStringTag]}function Dg(t){return HO(t).concat($O(t))}const zO=Object.hasOwn||((t,e)=>qO.call(t,e));function Kn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const GO="__v",VO="__o",WO="_owner",{getOwnPropertyDescriptor:Mg,keys:Pg}=Object;function YO(t,e){return t.byteLength===e.byteLength&&yi(new Uint8Array(t),new Uint8Array(e))}function KO(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function XO(t,e){return t.byteLength===e.byteLength&&yi(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ZO(t,e){return Kn(t.getTime(),e.getTime())}function QO(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function JO(t,e){return t===e}function Fg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let s,o,l=0;for(;(s=i.next())&&!s.done;){const u=e.entries();let c=!1,d=0;for(;(o=u.next())&&!o.done;){if(a[d]){d++;continue}const p=s.value,f=o.value;if(n.equals(p[0],f[0],l,d,t,e,n)&&n.equals(p[1],f[1],p[0],f[0],t,e,n)){c=a[d]=!0;break}d++}if(!c)return!1;l++}return!0}const e2=Kn;function t2(t,e,n){const r=Pg(t);let a=r.length;if(Pg(e).length!==a)return!1;for(;a-- >0;)if(!hv(t,e,n,r[a]))return!1;return!0}function Pr(t,e,n){const r=Dg(t);let a=r.length;if(Dg(e).length!==a)return!1;let i,s,o;for(;a-- >0;)if(i=r[a],!hv(t,e,n,i)||(s=Mg(t,i),o=Mg(e,i),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function n2(t,e){return Kn(t.valueOf(),e.valueOf())}function r2(t,e){return t.source===e.source&&t.flags===e.flags}function Bg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let s,o;for(;(s=i.next())&&!s.done;){const l=e.values();let u=!1,c=0;for(;(o=l.next())&&!o.done;){if(!a[c]&&n.equals(s.value,o.value,s.value,o.value,t,e,n)){u=a[c]=!0;break}c++}if(!u)return!1}return!0}function yi(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function a2(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function hv(t,e,n,r){return(r===WO||r===VO||r===GO)&&(t.$$typeof||e.$$typeof)?!0:zO(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const i2="[object ArrayBuffer]",s2="[object Arguments]",o2="[object Boolean]",l2="[object DataView]",u2="[object Date]",c2="[object Error]",d2="[object Map]",p2="[object Number]",f2="[object Object]",h2="[object RegExp]",m2="[object Set]",g2="[object String]",b2={"[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},E2="[object URL]",T2=Object.prototype.toString;function y2({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:p,areUrlsEqual:f,unknownTagComparators:m}){return function(b,y,T){if(b===y)return!0;if(b==null||y==null)return!1;const S=typeof b;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?o(b,y,T):S==="function"?i(b,y,T):!1;const A=b.constructor;if(A!==y.constructor)return!1;if(A===Object)return l(b,y,T);if(Array.isArray(b))return e(b,y,T);if(A===Date)return r(b,y,T);if(A===RegExp)return c(b,y,T);if(A===Map)return s(b,y,T);if(A===Set)return d(b,y,T);const v=T2.call(b);if(v===u2)return r(b,y,T);if(v===h2)return c(b,y,T);if(v===d2)return s(b,y,T);if(v===m2)return d(b,y,T);if(v===f2)return typeof b.then!="function"&&typeof y.then!="function"&&l(b,y,T);if(v===E2)return f(b,y,T);if(v===c2)return a(b,y,T);if(v===s2)return l(b,y,T);if(b2[v])return p(b,y,T);if(v===i2)return t(b,y,T);if(v===l2)return n(b,y,T);if(v===o2||v===p2||v===g2)return u(b,y,T);if(m){let N=m[v];if(!N){const C=jO(b);C&&(N=m[C])}if(N)return N(b,y,T)}return!1}}function S2({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:YO,areArraysEqual:n?Pr:KO,areDataViewsEqual:XO,areDatesEqual:ZO,areErrorsEqual:QO,areFunctionsEqual:JO,areMapsEqual:n?so(Fg,Pr):Fg,areNumbersEqual:e2,areObjectsEqual:n?Pr:t2,arePrimitiveWrappersEqual:n2,areRegExpsEqual:r2,areSetsEqual:n?so(Bg,Pr):Bg,areTypedArraysEqual:n?so(yi,Pr):yi,areUrlsEqual:a2,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=$a(r.areArraysEqual),i=$a(r.areMapsEqual),s=$a(r.areObjectsEqual),o=$a(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:o})}return r}function A2(t){return function(e,n,r,a,i,s,o){return t(e,n,o)}}function N2({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(o,l){const{cache:u=t?new WeakMap:void 0,meta:c}=n();return e(o,l,{cache:u,equals:r,meta:c,strict:a})};if(t)return function(o,l){return e(o,l,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(o,l){return e(o,l,i)}}const v2=Sn();Sn({strict:!0});Sn({circular:!0});Sn({circular:!0,strict:!0});Sn({createInternalComparator:()=>Kn});Sn({strict:!0,createInternalComparator:()=>Kn});Sn({circular:!0,createInternalComparator:()=>Kn});Sn({circular:!0,createInternalComparator:()=>Kn,strict:!0});function Sn(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=S2(t),s=y2(i),o=n?n(s):A2(s);return N2({circular:e,comparator:s,createState:r,equals:o,strict:a})}var _2=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},C2=({contentComponent:t})=>{const e=L1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(e)})};function I2(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:_C.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var R2=class extends Ke.Component{constructor(t){var e;super(t),this.editorContentRef=Ke.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=I2(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:_2(e,this.editorContentRef),...n}),t?.contentComponent&&E.jsx(C2,{contentComponent:t.contentComponent})]})}},k2=O.forwardRef((t,e)=>{const n=Ke.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ke.createElement(R2,{key:n,innerRef:e,...t})}),Lh=Ke.memo(k2),x2=typeof window<"u"?O.useLayoutEffect:O.useEffect,w2=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,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.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function O2(t){var e;const[n]=O.useState(()=>new w2(t.editor)),r=vC.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:v2);return x2(()=>n.watch(t.editor),[t.editor,n]),O.useDebugValue(r),r}var L2=!1,wf=typeof window>"u",D2=wf||!!(typeof window<"u"&&window.next),M2=class mv{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(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?wf||D2?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new RO(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var s;return a===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?mv.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function gv(t={},e=[]){const n=O.useRef(t);n.current=t;const[r]=O.useState(()=>new M2(n)),a=L1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(a),O.useEffect(r.onRender(e)),O2({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var Is=O.createContext({editor:null});Is.Consumer;var bv=()=>O.useContext(Is),Ev=O.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),P2=()=>O.useContext(Ev),Tv=Ke.forwardRef((t,e)=>{const{onDragStart:n}=P2(),r=t.as||"div";return E.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Ug(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Hg(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function F2(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function B2(t){if(Ug(t)||Hg(t))return!0;if(F2(t)){const e=t.type;if(e)return Ug(e)||Hg(e)}return!1}function U2(){try{if(O.version)return parseInt(O.version.split(".")[0],10)>=19}catch{}return!1}var H2=class{constructor(t,{editor:e,props:n={},as:r="div",className:a=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),a&&this.element.classList.add(...a.split(" ")),this.editor.isInitialized?D1.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,a=U2(),i=B2(e),s={...n};s.ref&&!(a||i)&&delete s.ref,!s.ref&&(a||i)&&(s.ref=o=>{this.ref=o}),this.reactElement=E.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ke.createContext({markViewContentRef:()=>{}});var $2=class extends UO{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,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 r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,a){var i;return r==="storage"?(i=t.storage[e.name])!=null?i:{}:Reflect.get(n,r,a)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={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:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:O.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},a=this.component,i=O.memo(l=>E.jsx(Ev.Provider,{value:r,children:O.createElement(a,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new H2(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.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;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=a=>{this.renderer.updateProps(a),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const a=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:a,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!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.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=Er(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function yv(t,e){return n=>n.editor.contentComponent?new $2(t,n,e):{}}var Dh=O.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Dh.displayName="TiptapContext";var q2=()=>O.useContext(Dh);function Sv({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=O.useMemo(()=>({editor:r}),[r]),i=O.useMemo(()=>({editor:r}),[r]);return E.jsx(Is.Provider,{value:i,children:E.jsx(Dh.Provider,{value:a,children:n})})}Sv.displayName="Tiptap";function Av({...t}){const{editor:e}=q2();return E.jsx(Lh,{editor:e,...t})}Av.displayName="Tiptap.Content";Object.assign(Sv,{Content:Av});function Nv(t,e,n){t.chain().focus().insertContentAt(e,[vv(n),{type:"text",text:" "}]).run()}function vv(t){return{type:"mention",attrs:t}}function j2(t){const e=K.c(7),{node:n,selected:r,view:a}=t,{name:i,char:s}=n.attrs,o=r&&a.editable,u=s==="@"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",c=o&&"outline-2 outline-blue-300 outline-offset-0";let d;e[0]!==u||e[1]!==c?(d=re("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light",u,c),e[0]=u,e[1]=c,e[2]=d):d=e[2];let p;return e[3]!==s||e[4]!==i||e[5]!==d?(p=E.jsxs(Tv,{className:d,children:[s,i]}),e[3]=s,e[4]=i,e[5]=d,e[6]=p):p=e[6],p}const _v=Qe.create({name:"mention",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"mention"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.char&&(n["data-char"]=t.attrs.char),t.attrs.metadata&&(n["data-metadata"]=JSON.stringify(t.attrs.metadata)),["span",{...e,...n}]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return yv(j2)}});function z2(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}function G2(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const $g=3;function V2(t){const e=K.c(23),{prompt:n,onSelect:r,isSelected:a,isDisabled:i,isLoading:s}=t,o=n.description??n.name;let l;e[0]!==r||e[1]!==n?(l=()=>r(n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const u=i||s,c=a&&"bg-accent/50 text-foreground",d=s&&"bg-accent/50 text-foreground",p=(i||s)&&"cursor-not-allowed hover:bg-accent/50";let f;e[3]!==c||e[4]!==d||e[5]!==p?(f=re("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer flex items-center gap-1.5",c,d,p),e[3]=c,e[4]=d,e[5]=p,e[6]=f):f=e[6];const m=n.title??n.name;let g;if(e[7]!==m){let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=/_/g,e[9]=A):A=e[9],g=m.replace(A," "),e[7]=m,e[8]=g}else g=e[8];let b;e[10]!==s?(b=s&&E.jsx(rs,{size:"xs"}),e[10]=s,e[11]=b):b=e[11];let y;e[12]!==l||e[13]!==u||e[14]!==f||e[15]!==g||e[16]!==b?(y=E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",onClick:l,disabled:u,className:f,children:[g,b]})}),e[12]=l,e[13]=u,e[14]=f,e[15]=g,e[16]=b,e[17]=y):y=e[17];let T;e[18]!==o?(T=E.jsx(Tt,{side:"bottom",className:"max-w-xs",children:E.jsx("p",{className:"text-xs",children:o})}),e[18]=o,e[19]=T):T=e[19];let S;return e[20]!==y||e[21]!==T?(S=E.jsxs(bt,{children:[y,T]}),e[20]=y,e[21]=T,e[22]=S):S=e[22],S}function W2(t){const e=K.c(23),{prompts:n,onSelect:r,loadingPrompt:a,className:i}=t;if(n.length===0)return null;let s,o,l,u,c;if(e[0]!==i||e[1]!==a||e[2]!==r||e[3]!==n){const f=n.slice(0,$g),m=n.slice($g),g=m.length>0,b=!!a;s=as,c=300,e[9]!==i?(o=re("flex flex-wrap items-center justify-center gap-2",i),e[9]=i,e[10]=o):o=e[10];let y;e[11]!==b||e[12]!==a?.name||e[13]!==r?(y=T=>E.jsx(V2,{prompt:T,onSelect:r,isLoading:a?.name===T.name,isDisabled:b&&a?.name!==T.name},T.name),e[11]=b,e[12]=a?.name,e[13]=r,e[14]=y):y=e[14],l=f.map(y),u=g&&E.jsxs(vr,{children:[E.jsx(_r,{asChild:!0,children:E.jsxs("button",{type:"button",disabled:b,className:re("size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",b&&"opacity-60 cursor-not-allowed"),children:["+",m.length]})}),E.jsx(Cr,{side:"bottom",align:"center",className:"w-auto p-2",children:E.jsx("div",{className:"flex flex-col gap-1",children:m.map(T=>{const S=T.description??T.name,A=a?.name===T.name;return E.jsxs(bt,{children:[E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",onClick:()=>r(T),disabled:b&&!A,className:re("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left flex items-center gap-1.5",A&&"bg-accent/50 text-foreground",b&&!A&&"opacity-60 cursor-not-allowed"),children:[(T.title??T.name).replace(/_/g," "),A&&E.jsx(rs,{size:"xs"})]})}),E.jsx(Tt,{side:"right",className:"max-w-xs",children:E.jsx("p",{className:"text-xs",children:S})})]},T.name)})})})]}),e[0]=i,e[1]=a,e[2]=r,e[3]=n,e[4]=s,e[5]=o,e[6]=l,e[7]=u,e[8]=c}else s=e[4],o=e[5],l=e[6],u=e[7],c=e[8];let d;e[15]!==o||e[16]!==l||e[17]!==u?(d=E.jsxs("div",{className:o,children:[l,u]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d):d=e[18];let p;return e[19]!==s||e[20]!==c||e[21]!==d?(p=E.jsx(s,{delayDuration:c,children:d}),e[19]=s,e[20]=c,e[21]=d,e[22]=p):p=e[22],p}function Y2(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsxs(E.Fragment,{children:[E.jsx(Em,{className:"h-6 w-20 rounded-full border border-border"}),E.jsx(Em,{className:"h-6 w-24 rounded-full border border-border"})]}),t[0]=e):e=t[0],e}function K2(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function X2(t){const e=K.c(28),{connectionId:n}=t,{tiptapDoc:r,sendMessage:a}=En(),{org:i}=Nr();let s;e[0]!==n||e[1]!==i.id?(s={connectionId:n,orgId:i.id},e[0]=n,e[1]=i.id,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==o?(l={client:o,staleTime:6e4},e[3]=o,e[4]=l):l=e[4];const{data:u}=KC(l);let c;e[5]!==u?.prompts?(c=u?.prompts??[],e[5]=u?.prompts,e[6]=c):c=e[6];const d=c;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[7]=p):p=e[7];const[f,m]=O.useReducer(K2,p),[g,b]=O.useState(null);let y;e[8]!==o||e[9]!==a||e[10]!==r?(y=async(P,$)=>{if(!o){Gt.error("MCP client not available"),m({type:"RESET"});return}try{const B=await z1(o,P.name,$);m({type:"RESET"});const G=G2(r,{type:"paragraph",content:[vv({id:P.name,name:P.name,metadata:B.messages,char:"/"})]});await a(G)}catch(B){console.error("[ice-breakers] Failed to fetch prompt:",B),Gt.error("Failed to load prompt. Please try again."),m({type:"RESET"})}},e[8]=o,e[9]=a,e[10]=r,e[11]=y):y=e[11];const T=y;let S;e[12]!==T?(S=async P=>{if(P.arguments&&P.arguments.length>0){m({type:"SELECT_PROMPT",prompt:P}),b(P);return}m({type:"START_LOADING",prompt:P}),await T(P)},e[12]=T,e[13]=S):S=e[13];const A=S;let v;e[14]!==g||e[15]!==T?(v=async P=>{g&&(m({type:"START_LOADING",prompt:g,arguments:P}),b(null),await T(g,P))},e[14]=g,e[15]=T,e[16]=v):v=e[16];const N=v;if(d.length===0)return null;const C=f.stage==="loading"?f.prompt:null;let k;e[17]!==A||e[18]!==d||e[19]!==C?(k=E.jsx(W2,{prompts:d,onSelect:A,loadingPrompt:C}),e[17]=A,e[18]=d,e[19]=C,e[20]=k):k=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{b(null),m({type:"RESET"})},e[21]=R):R=e[21];let D;e[22]!==g||e[23]!==N?(D=E.jsx(sA,{prompt:g,setPrompt:R,onSubmit:N}),e[22]=g,e[23]=N,e[24]=D):D=e[24];let w;return e[25]!==D||e[26]!==k?(w=E.jsxs("div",{className:"relative w-full",children:[k,D]}),e[25]=D,e[26]=k,e[27]=w):w=e[27],w}function Z2(t){const e=K.c(14),{className:n}=t,{selectedVirtualMcp:r}=En(),{org:a}=Nr();let i;e[0]!==a.id?(i=j1(a.id),e[0]=a.id,e[1]=i):i=e[1];const s=i.id,o=r?.id??s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={minHeight:"32px"},e[2]=l):l=e[2];let u;e[3]!==n?(u=re("flex flex-wrap items-center justify-center gap-2",n),e[3]=n,e[4]=u):u=e[4];const c=o??"default";let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx(Y2,{}),e[5]=d):d=e[5];let p;e[6]!==o?(p=E.jsx(X2,{connectionId:o}),e[6]=o,e[7]=p):p=e[7];let f;e[8]!==c||e[9]!==p?(f=E.jsx(ZC,{fallback:null,children:E.jsx(O.Suspense,{fallback:d,children:p},c)}),e[8]=c,e[9]=p,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=E.jsx("div",{style:l,className:u,children:f}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const qg=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function Q2(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e)}function Cv(t){if(t==null)return null;const n=Q2(t)%qg.length;return qg[n]}const jg=Ar({response:si().min(1,"Response is required")}),J2=Ar({response:si().min(1,"Please select or enter an option")}),eL=Ar({response:CC(["yes","no"])});function tL(t){switch(t.type){case"text":return jg;case"choice":return J2;case"confirm":return eL;default:return jg}}function nL(t){const e={};for(const n of t)e[n.toolCallId]=tL(n.input);return Ar(e)}function rL(t){const e=K.c(6),{control:n,name:r,placeholder:a}=t;let i;e[0]!==a?(i=o=>{const{field:l}=o;return E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsx("div",{className:"px-2",children:E.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[E.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:E.jsx(ah,{size:16,className:"text-muted-foreground"})}),E.jsx("input",{...l,type:"text",placeholder:a||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),E.jsx(us,{})]})},e[0]=a,e[1]=i):i=e[1];let s;return e[2]!==n||e[3]!==r||e[4]!==i?(s=E.jsx(is,{control:n,name:r,render:i}),e[2]=n,e[3]=r,e[4]=i,e[5]=s):s=e[5],s}function aL(t){const e=K.c(10),{control:n,name:r,options:a}=t,[i,s]=O.useState(!1),o=O.useRef(null),l=O.useRef(null);let u,c;if(e[0]!==a?(u=()=>{const f=m=>{const g=m.target.tagName;if(g==="INPUT"||g==="TEXTAREA")return;const b=Number.parseInt(m.key,10);b>=1&&b<=a.length&&l.current&&(m.preventDefault(),l.current.onChange(a[b-1]??""),s(!1))};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},c=[a],e[0]=a,e[1]=u,e[2]=c):(u=e[1],c=e[2]),O.useEffect(u,c),a.length===0)return null;let d;e[3]!==i||e[4]!==a?(d=f=>{const{field:m}=f;l.current=m;const g=i||!!m.value&&!a.includes(m.value);return E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[a.map((b,y)=>{const T=m.value===b;return E.jsxs("button",{type:"button",onClick:()=>{m.onChange(b??""),s(!1)},className:re("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",T&&"bg-accent/50",!T&&"hover:bg-accent/30"),"aria-label":`Select ${b}`,children:[E.jsx("span",{className:re("flex items-center justify-center size-6 rounded-md text-sm shrink-0",T?"bg-chart-1 text-white":"bg-muted text-foreground"),children:y+1}),E.jsx("span",{className:"text-sm text-foreground truncate",children:b})]},`${y}-${b}`)}),E.jsxs("div",{className:re("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",g&&"bg-accent/50",!g&&"hover:bg-accent/30"),onClick:()=>{s(!0),a.includes(m.value)&&m.onChange(""),setTimeout(()=>o.current?.focus(),0)},children:[E.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:E.jsx(ah,{size:16,className:"text-muted-foreground"})}),g?E.jsx("input",{ref:o,type:"text",value:m.value,onChange:b=>m.onChange(b.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):E.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),E.jsx(us,{})]})},e[3]=i,e[4]=a,e[5]=d):d=e[5];let p;return e[6]!==n||e[7]!==r||e[8]!==d?(p=E.jsx(is,{control:n,name:r,render:d}),e[6]=n,e[7]=r,e[8]=d,e[9]=p):p=e[9],p}function iL(t){const e=K.c(7),{control:n,name:r}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["yes","no"],e[0]=a):a=e[0];const i=a,s=O.useRef(null);let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{const d=p=>{const f=p.target.tagName;f==="INPUT"||f==="TEXTAREA"||(p.key==="1"&&s.current?(p.preventDefault(),s.current.onChange("yes")):p.key==="2"&&s.current&&(p.preventDefault(),s.current.onChange("no")))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},l=[],e[1]=o,e[2]=l):(o=e[1],l=e[2]),O.useEffect(o,l);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:p}=d;return s.current=p,E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:i.map(f=>{const m=p.value===f;return E.jsxs("button",{type:"button",onClick:()=>p.onChange(f),className:re("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":`Confirm ${f}`,children:[E.jsx("span",{className:re("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),E.jsx("span",{className:"text-sm text-foreground capitalize",children:f})]},f)})})}),E.jsx(us,{})]})},e[3]=u):u=e[3];let c;return e[4]!==n||e[5]!==r?(c=E.jsx(is,{control:n,name:r,render:u}),e[4]=n,e[5]=r,e[6]=c):c=e[6],c}function zg(t){const e=K.c(13),{input:n,control:r,name:a}=t;switch(n.type){case"text":{let i;return e[0]!==r||e[1]!==n.default||e[2]!==a?(i=E.jsx(rL,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=i):i=e[3],i}case"choice":{let i;e[4]!==n.options?(i=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=i):i=e[5];const s=i;let o;return e[6]!==r||e[7]!==a||e[8]!==s?(o=E.jsx(aL,{control:r,name:a,options:s}),e[6]=r,e[7]=a,e[8]=s,e[9]=o):o=e[9],o}case"confirm":{let i;return e[10]!==r||e[11]!==a?(i=E.jsx(iL,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=i):i=e[12],i}default:return null}}function sL(t){const e=K.c(21),{current:n,total:r,onPrev:a,onNext:i}=t;if(r<=1)return null;const s=n===0,o=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==o?(l=re("p-0.5 rounded transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx(pI,{size:14}),e[2]=u):u=e[2];let c;e[3]!==a||e[4]!==s||e[5]!==l?(c=E.jsx("button",{type:"button",onClick:a,disabled:s,className:l,"aria-label":"Previous question",children:u}),e[3]=a,e[4]=s,e[5]=l,e[6]=c):c=e[6];const d=n+1;let p;e[7]!==d||e[8]!==r?(p=E.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",r]}),e[7]=d,e[8]=r,e[9]=p):p=e[9];const f=n===r-1,m=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==m?(g=re("p-0.5 rounded transition-colors",m),e[10]=m,e[11]=g):g=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=E.jsx(fI,{size:14}),e[12]=b):b=e[12];let y;e[13]!==i||e[14]!==g||e[15]!==f?(y=E.jsx("button",{type:"button",onClick:i,disabled:f,className:g,"aria-label":"Next question",children:b}),e[13]=i,e[14]=g,e[15]=f,e[16]=y):y=e[16];let T;return e[17]!==y||e[18]!==c||e[19]!==p?(T=E.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c,p,y]}),e[17]=y,e[18]=c,e[19]=p,e[20]=T):T=e[20],T}function Gg(t){const e=K.c(15),{title:n,children:r,footerLeft:a,footerRight:i}=t;let s;e[0]!==n?(s=E.jsx("div",{className:"flex items-center gap-2 p-4",children:E.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=E.jsx("div",{className:"overflow-clip pb-4",children:r}),e[2]=r,e[3]=o):o=e[3];let l;e[4]!==a?(l=E.jsx("div",{children:a}),e[4]=a,e[5]=l):l=e[5];let u;e[6]!==i?(u=E.jsx("div",{className:"flex items-center gap-2",children:i}),e[6]=i,e[7]=u):u=e[7];let c;e[8]!==l||e[9]!==u?(c=E.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:E.jsxs("div",{className:"flex items-center justify-between",children:[l,u]})}),e[8]=l,e[9]=u,e[10]=c):c=e[10];let d;return e[11]!==s||e[12]!==o||e[13]!==c?(d=E.jsxs("div",{className:"flex flex-col rounded-xl bg-background border border-border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",children:[s,o,c]}),e[11]=s,e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function oL({parts:t,onSubmit:e}){const[n,r]=O.useState(t[0]?.toolCallId??""),a=nL(t.map(T=>({toolCallId:T.toolCallId,input:T.input}))),i=O1({resolver:w1(a),defaultValues:Object.fromEntries(t.map(T=>[T.toolCallId,{response:""}]))}),s=i.watch(),o=t.findIndex(T=>T.toolCallId===n),l=!!s[n]?.response,u=t.every(T=>!!s[T.toolCallId]?.response),c=T=>{for(const S of t){const A=T[S.toolCallId]?.response;A&&e(S,A)}},d=T=>t.find(S=>!T[S.toolCallId]?.response&&S.toolCallId!==n)??null,p=()=>{const T=i.getValues();if(t.every(A=>!!T[A.toolCallId]?.response))i.handleSubmit(c)();else{const A=d(T);A&&r(A.toolCallId)}},f=()=>{i.setValue(`${n}.response`,"user has skip this question"),p()},m=()=>{if(o>0){const T=t[o-1];T&&r(T.toolCallId)}},g=()=>{if(o<t.length-1){const T=t[o+1];T&&r(T.toolCallId)}},b=E.jsxs(E.Fragment,{children:[E.jsx(Ee,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),E.jsx(Ee,{type:"button",size:"sm",disabled:!l,onClick:p,className:re("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),y=E.jsx(sL,{current:o,total:t.length,onPrev:m,onNext:g});if(t.length===1){const T=t[0];return T?.input?E.jsx(of,{...i,children:E.jsx("form",{onSubmit:i.handleSubmit(c),autoComplete:"off",children:E.jsx(Gg,{title:T.input?.prompt??"Question",footerRight:b,children:E.jsx(zg,{input:T.input,control:i.control,name:`${T.toolCallId}.response`})})})}):null}return E.jsx(of,{...i,children:E.jsx("form",{onSubmit:i.handleSubmit(c),autoComplete:"off",children:E.jsx($C,{value:n,onValueChange:r,children:t.map(T=>E.jsx(qC,{value:T.toolCallId,className:"mt-0",children:E.jsx(Gg,{title:T.input?.prompt??"Question",footerLeft:y,footerRight:b,children:E.jsx(zg,{input:T.input,control:i.control,name:`${T.toolCallId}.response`})})},T.toolCallId))})})})}function lL(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[E.jsx(W1,{className:"size-5 text-muted-foreground shimmer"}),E.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function Iv(t){const e=K.c(6),{userAskParts:n,isStreaming:r,onSubmit:a}=t;let i;e[0]!==n?(i=n.filter(uL),e[0]=n,e[1]=i):i=e[1];const s=i;if(r){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx(lL,{}),e[2]=l):l=e[2],l}if(s.length===0)return null;let o;return e[3]!==a||e[4]!==s?(o=E.jsx(oL,{parts:s,onSubmit:a}),e[3]=a,e[4]=s,e[5]=o):o=e[5],o}function uL(t){return t.state==="input-available"}const cL={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Si(t){const e=K.c(32),{variant:n,onDismiss:r}=t,a=n==="error",i=a?"Error occurred":"Response incomplete",s=a?t.error.message:cL[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,o=a?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",l=a?"text-destructive":"text-amber-600 dark:text-amber-500",u=a?cI:dI;let c;e[0]!==o?(c=re("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2 shadow",o),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==l?(d=re("mt-0.5 shrink-0",l),e[2]=l,e[3]=d):d=e[3];let p;e[4]!==u?(p=E.jsx(u,{size:16}),e[4]=u,e[5]=p):p=e[5];let f;e[6]!==d||e[7]!==p?(f=E.jsx("div",{className:d,children:p}),e[6]=d,e[7]=p,e[8]=f):f=e[8];let m;e[9]!==l?(m=re("text-xs mb-1 font-medium",l),e[9]=l,e[10]=m):m=e[10];let g;e[11]!==m||e[12]!==i?(g=E.jsx("div",{className:m,children:i}),e[11]=m,e[12]=i,e[13]=g):g=e[13];let b;e[14]!==s?(b=E.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:s}),e[14]=s,e[15]=b):b=e[15];let y;e[16]!==a||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(y=E.jsx("div",{className:"flex gap-2",children:a?E.jsxs(E.Fragment,{children:[E.jsx(Ee,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),E.jsx(Ee,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):E.jsx(Ee,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=a,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=y):y=e[19];let T;e[20]!==g||e[21]!==b||e[22]!==y?(T=E.jsxs("div",{className:"flex-1 min-w-0",children:[g,b,y]}),e[20]=g,e[21]=b,e[22]=y,e[23]=T):T=e[23];let S;e[24]===Symbol.for("react.memo_cache_sentinel")?(S=E.jsx(V1,{size:14}),e[24]=S):S=e[24];let A;e[25]!==r?(A=E.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:S}),e[25]=r,e[26]=A):A=e[26];let v;return e[27]!==c||e[28]!==A||e[29]!==f||e[30]!==T?(v=E.jsx("div",{className:"px-0.5",children:E.jsxs("div",{className:c,children:[f,T,A]})}),e[27]=c,e[28]=A,e[29]=f,e[30]=T,e[31]=v):v=e[31],v}function Rs(){const t=K.c(23),{error:e,clearError:n,finishReason:r,clearFinishReason:a,messages:i,isStreaming:s,addToolOutput:o,sendMessage:l}=En();let u,c,d;if(t[0]!==i){const S=i.at(-1);d=S?.role==="assistant"?S.parts.filter(fL):null,u=d?.filter(pL)?.length,c=S?.role==="assistant"?S.parts.some(dL):!1,t[0]=i,t[1]=u,t[2]=c,t[3]=d}else u=t[1],c=t[2],d=t[3];const p=c;let f;t[4]!==e||t[5]!==l?(f=()=>{if(e){const A={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};l(A)}},t[4]=e,t[5]=l,t[6]=f):f=t[6];const m=f;let g;t[7]!==l?(g=()=>{l({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[7]=l,t[8]=g):g=t[8];const b=g;let y;t[9]!==o?(y=(S,A)=>{o({tool:"user_ask",toolCallId:S.toolCallId,output:{response:A}})},t[9]=o,t[10]=y):y=t[10];const T=y;if(u){let S;return t[11]!==T||t[12]!==s||t[13]!==d?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0",children:E.jsx(Iv,{userAskParts:d,isStreaming:s,onSubmit:T})}),t[11]=T,t[12]=s,t[13]=d,t[14]=S):S=t[14],S}if(!s&&e){let S;return t[15]!==n||t[16]!==e||t[17]!==m?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:E.jsx(Si,{variant:"error",error:e,onDismiss:n,onFixInChat:m})}),t[15]=n,t[16]=e,t[17]=m,t[18]=S):S=t[18],S}if(!s&&r&&r!=="stop"&&!p){let S;return t[19]!==a||t[20]!==r||t[21]!==b?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:E.jsx(Si,{variant:"warning",finishReason:r,onDismiss:a,onContinue:b})}),t[19]=a,t[20]=r,t[21]=b,t[22]=S):S=t[22],S}return null}function dL(t){return"state"in t&&t.state==="approval-requested"}function pL(t){return t.state!=="output-available"}function fL(t){return t.type==="tool-user_ask"}Rs.Error=function(e){return E.jsx(Si,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Rs.Warning=function(e){return E.jsx(Si,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Rs.UserAskQuestion=Iv;const Ai={passthrough:{label:"Direct access",description:"Best for small teams or when you need predictable behavior",icon:zC},smart_tool_selection:{label:"Smart discovery",description:"Ideal for large teams with many tools - AI finds what it needs",icon:jC},code_execution:{label:"Smart execution",description:"Maximum flexibility - AI can write code to orchestrate tools",icon:mI,recommended:!0}};function hL(t){const e=K.c(24),{mode:n,isSelected:r,onSelect:a}=t,i=Ai[n],s=i.icon,o=r&&"bg-accent";let l;e[0]!==o?(l=re("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==s?(u=E.jsx("div",{className:"p-1.5 shrink-0 rounded-md bg-muted",children:E.jsx(s,{className:"size-4 text-muted-foreground"})}),e[2]=s,e[3]=u):u=e[3];let c;e[4]!==i.label?(c=E.jsx("span",{className:"text-sm font-medium text-foreground",children:i.label}),e[4]=i.label,e[5]=c):c=e[5];let d;e[6]!==i.recommended?(d=i.recommended&&E.jsx(hI,{variant:"outline",className:"text-xs",children:"Recommended"}),e[6]=i.recommended,e[7]=d):d=e[7];let p;e[8]!==r?(p=r&&E.jsx(Gn,{size:16,className:"text-foreground shrink-0 ml-auto"}),e[8]=r,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==d||e[12]!==p?(f=E.jsxs("div",{className:"flex items-center gap-2",children:[c,d,p]}),e[10]=c,e[11]=d,e[12]=p,e[13]=f):f=e[13];let m;e[14]!==i.description?(m=E.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:i.description}),e[14]=i.description,e[15]=m):m=e[15];let g;e[16]!==f||e[17]!==m?(g=E.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,m]}),e[16]=f,e[17]=m,e[18]=g):g=e[18];let b;return e[19]!==a||e[20]!==l||e[21]!==u||e[22]!==g?(b=E.jsxs("div",{onClick:a,className:l,children:[u,g]}),e[19]=a,e[20]=l,e[21]=u,e[22]=g,e[23]=b):b=e[23],b}function mL(t){const e=K.c(13),{mode:n,placeholder:r}=t,a=r===void 0?"Select mode":r;if(!n){let d;e[0]!==a?(d=E.jsx("span",{className:"text-sm text-muted-foreground",children:a}),e[0]=a,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=E.jsx(lf,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=p):p=e[2];let f;return e[3]!==d?(f=E.jsxs("div",{className:"flex items-center gap-1.5",children:[d,p]}),e[3]=d,e[4]=f):f=e[4],f}const i=Ai[n],s=i.icon;let o;e[5]!==s?(o=E.jsx(s,{className:"size-4 text-muted-foreground shrink-0"}),e[5]=s,e[6]=o):o=e[6];let l;e[7]!==i.label?(l=E.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:i.label}),e[7]=i.label,e[8]=l):l=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx(lf,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[9]=u):u=e[9];let c;return e[10]!==o||e[11]!==l?(c=E.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,l,u]}),e[10]=o,e[11]=l,e[12]=c):c=e[12],c}function gL(t){const e=K.c(28),{selectedMode:n,onModeChange:r,variant:a,className:i,placeholder:s,disabled:o}=t,l=a===void 0?"borderless":a,u=s===void 0?"Mode":s,c=o===void 0?!1:o,[d,p]=O.useState(!1);let f;e[0]!==r?(f=$=>{r($),p(!1)},e[0]=r,e[1]=f):f=e[1];const m=f,g=c?!1:d,b=l==="borderless"?"ghost":"outline",y=l==="borderless"&&"md:border-none",T=c&&"cursor-not-allowed opacity-50";let S;e[2]!==i||e[3]!==y||e[4]!==T?(S=re("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",y,T,i),e[2]=i,e[3]=y,e[4]=T,e[5]=S):S=e[5];const A=d?"open":"closed";let v;e[6]!==u||e[7]!==n?(v=E.jsx(mL,{mode:n,placeholder:u}),e[6]=u,e[7]=n,e[8]=v):v=e[8];let N;e[9]!==c||e[10]!==A||e[11]!==v||e[12]!==b||e[13]!==S?(N=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx(Ee,{variant:b,size:"sm",className:S,disabled:c,"data-state":A,children:v})})}),e[9]=c,e[10]=A,e[11]=v,e[12]=b,e[13]=S,e[14]=N):N=e[14];const C=Ai[n]?.description??"Choose agent mode";let k;e[15]!==C?(k=E.jsx(Tt,{side:"top",className:"text-xs",children:C}),e[15]=C,e[16]=k):k=e[16];let R;e[17]!==N||e[18]!==k?(R=E.jsx(as,{children:E.jsxs(bt,{children:[N,k]})}),e[17]=N,e[18]=k,e[19]=R):R=e[19];let D;e[20]===Symbol.for("react.memo_cache_sentinel")?(D=Object.keys(Ai),e[20]=D):D=e[20];let w;e[21]!==m||e[22]!==n?(w=E.jsx(Cr,{className:"w-[350px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx("div",{className:"flex flex-col p-1",children:D.map($=>E.jsx(hL,{mode:$,isSelected:$===n,onSelect:()=>m($)},$))})}),e[21]=m,e[22]=n,e[23]=w):w=e[23];let P;return e[24]!==R||e[25]!==w||e[26]!==g?(P=E.jsxs(vr,{open:g,onOpenChange:p,children:[R,w]}),e[24]=R,e[25]=w,e[26]=g,e[27]=P):P=e[27],P}function bL(t){const e=K.c(24),{virtualMcp:n,isSelected:r}=t,a=r&&"bg-accent";let i;e[0]!==a?(i=re("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",a),e[0]=a,e[1]=i):i=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??E.jsx(pr,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let o;e[4]!==s||e[5]!==n.icon||e[6]!==n.title?(o=E.jsx(cs,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"rounded-xl border border-border shadow-sm shrink-0 aspect-square"}),e[4]=s,e[5]=n.icon,e[6]=n.title,e[7]=o):o=e[7];let l;e[8]!==n.title?(l=E.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]!==r?(u=r&&E.jsx(Gn,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=u):u=e[11];let c;e[12]!==l||e[13]!==u?(c=E.jsxs("div",{className:"flex items-center justify-between",children:[l,u]}),e[12]=l,e[13]=u,e[14]=c):c=e[14];let d;e[15]!==n.description?(d=n.description&&E.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let p;e[17]!==c||e[18]!==d?(p=E.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[c,d]}),e[17]=c,e[18]=d,e[19]=p):p=e[19];let f;return e[20]!==i||e[21]!==o||e[22]!==p?(f=E.jsxs("div",{className:i,children:[o,p]}),e[20]=i,e[21]=o,e[22]=p,e[23]=f):f=e[23],f}function Mh(t){const e=K.c(33),{virtualMcps:n,selectedVirtualMcpId:r,onVirtualMcpChange:a,searchInputRef:i}=t,[s,o]=O.useState(""),l=O.useRef(null),u=i??l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={navigateOnCreate:!0},e[0]=c):c=e[0];const{createVirtualMCP:d,isCreating:p}=bI(c);let f,m,g,b;if(e[1]!==d||e[2]!==u||e[3]!==p||e[4]!==a||e[5]!==s||e[6]!==r||e[7]!==n){let S;e:{const P=n.filter(EL);if(!s.trim()){S=P;break e}const $=s.toLowerCase();S=P.filter(B=>B.title.toLowerCase().includes($)||B.description?.toLowerCase().includes($))}const A=S;let v;e[12]!==a?(v=P=>{a(P),o("")},e[12]=a,e[13]=v):v=e[13];const N=v;g="flex flex-col max-h-[400px]";let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=E.jsx(K1,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=C):C=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=P=>o(P.target.value),e[15]=k):k=e[15];let R;e[16]!==u||e[17]!==s?(R=E.jsx(G1,{ref:u,type:"text",placeholder:"Search for an agent...",value:s,onChange:k,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=u,e[17]=s,e[18]=R):R=e[18];const D=p?"Creating...":"Create Agent";let w;e[19]!==d||e[20]!==p||e[21]!==D?(w=E.jsx(Ee,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:p,children:D}),e[19]=d,e[20]=p,e[21]=D,e[22]=w):w=e[22],e[23]!==R||e[24]!==w?(b=E.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:E.jsxs("div",{className:"relative flex items-center gap-2",children:[C,R,w]})}),e[23]=R,e[24]=w,e[25]=b):b=e[25],f="overflow-y-auto p-1.5",m=A.length>0?E.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:A.map(P=>E.jsx("div",{role:"button",tabIndex:0,onClick:()=>N(P.id),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),N(P.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:E.jsx(bL,{virtualMcp:P,isSelected:P.id===r})},P.id))}):E.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=d,e[2]=u,e[3]=p,e[4]=a,e[5]=s,e[6]=r,e[7]=n,e[8]=f,e[9]=m,e[10]=g,e[11]=b}else f=e[8],m=e[9],g=e[10],b=e[11];let y;e[26]!==f||e[27]!==m?(y=E.jsx("div",{className:f,children:m}),e[26]=f,e[27]=m,e[28]=y):y=e[28];let T;return e[29]!==g||e[30]!==b||e[31]!==y?(T=E.jsxs("div",{className:g,children:[b,y]}),e[29]=g,e[30]=b,e[31]=y,e[32]=T):T=e[32],T}function EL(t){return!t.id||!dr(t.id)}function TL(t){const e=K.c(37),{selectedVirtualMcpId:n,onVirtualMcpChange:r,virtualMcps:a,className:i,placeholder:s,showTooltip:o,disabled:l}=t,u=s===void 0?"Select Agent":s,c=o===void 0?!0:o,d=l===void 0?!1:l,[p,f]=O.useState(!1),m=O.useRef(null),g=gI(),b=a??g;let y;e[0]!==b?(y=b.filter(yL),e[0]=b,e[1]=y):y=e[1];const T=y;let S;e[2]!==b||e[3]!==n?(S=n?b.find(W=>W.id===n):null,e[2]=b,e[3]=n,e[4]=S):S=e[4];const A=S;let v;e[5]!==r?(v=W=>{r(W),f(!1)},e[5]=r,e[6]=v):v=e[6];const N=v;let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=W=>{f(W)},e[7]=C):C=e[7];const k=C;let R,D;e[8]!==p?(R=()=>{p&&setTimeout(()=>{m.current?.focus()},0)},D=[p],e[8]=p,e[9]=R,e[10]=D):(R=e[9],D=e[10]),O.useEffect(R,D);const w=d?!1:p,P=d?void 0:k,$=d?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let B;e[11]!==i||e[12]!==$?(B=re("flex items-center justify-center size-8 rounded-full transition-colors shrink-0",$,i),e[11]=i,e[12]=$,e[13]=B):B=e[13];let G;e[14]!==A?(G=A?E.jsx(cs,{icon:A.icon,name:A.title,size:"xs",fallbackIcon:E.jsx(pr,{size:16}),className:"rounded-md shrink-0 aspect-square"}):E.jsx(pr,{size:16}),e[14]=A,e[15]=G):G=e[15];let U;e[16]!==d||e[17]!==u||e[18]!==B||e[19]!==G?(U=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx("button",{type:"button",disabled:d,className:B,"aria-label":u,children:G})})}),e[16]=d,e[17]=u,e[18]=B,e[19]=G,e[20]=U):U=e[20];let z;e[21]!==p||e[22]!==A?.title||e[23]!==c?(z=c&&!p&&E.jsx(Tt,{side:"top",className:"text-xs",children:A?.title??"Choose an agent to chat with"}),e[21]=p,e[22]=A?.title,e[23]=c,e[24]=z):z=e[24];let M;e[25]!==U||e[26]!==z?(M=E.jsx(as,{children:E.jsxs(bt,{children:[U,z]})}),e[25]=U,e[26]=z,e[27]=M):M=e[27];let Y;e[28]!==N||e[29]!==n||e[30]!==T?(Y=E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:T,selectedVirtualMcpId:n,onVirtualMcpChange:N,searchInputRef:m})}),e[28]=N,e[29]=n,e[30]=T,e[31]=Y):Y=e[31];let X;return e[32]!==w||e[33]!==P||e[34]!==M||e[35]!==Y?(X=E.jsxs(vr,{open:w,onOpenChange:P,children:[M,Y]}),e[32]=w,e[33]=P,e[34]=M,e[35]=Y,e[36]=X):X=e[36],X}function yL(t){return!t.id||!dr(t.id)}function SL(t,e,n){t.chain().focus().insertContentAt(e,[AL(n),{type:"text",text:" "}]).run()}function AL(t){return{type:"file",attrs:t}}function NL(t){const e=K.c(17),{node:n,selected:r,view:a}=t,{name:i,mimeType:s,data:o}=n.attrs,l=r&&a.editable;let u;e[0]!==s?(u=s.startsWith("image/"),e[0]=s,e[1]=u):u=e[1];const c=u,d=l&&"outline-2 outline-blue-300 outline-offset-0";let p;e[2]!==d?(p=re("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",d),e[2]=d,e[3]=p):p=e[3];let f;e[4]!==i?(f=E.jsx(Et,{asChild:!0,children:E.jsx("span",{children:i})}),e[4]=i,e[5]=f):f=e[5];let m;e[6]!==o||e[7]!==c||e[8]!==s||e[9]!==i?(m=E.jsx(Tt,{side:"top",className:"max-w-sm",children:c?E.jsx("img",{src:`data:${s};base64,${o}`,alt:i,className:"max-w-full max-h-64 object-contain rounded"}):E.jsxs("div",{className:"text-xs",children:[E.jsx("div",{className:"font-medium",children:i}),E.jsx("div",{className:"text-muted-foreground mt-1",children:s})]})}),e[6]=o,e[7]=c,e[8]=s,e[9]=i,e[10]=m):m=e[10];let g;e[11]!==f||e[12]!==m?(g=E.jsxs(bt,{children:[f,m]}),e[11]=f,e[12]=m,e[13]=g):g=e[13];let b;return e[14]!==p||e[15]!==g?(b=E.jsx(Tv,{className:p,children:g}),e[14]=p,e[15]=g,e[16]=b):b=e[16],b}const Rv=Qe.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return yv(NL)}});async function kv(t,e,n,r){if(!B1(e)){Gt.error("Selected model does not support file uploads");return}const a=10*1024*1024;if(n.size>a){Gt.error(`File "${n.name}" exceeds 10MB limit`);return}try{const i=new FileReader,s=new Promise((u,c)=>{i.onload=()=>{const d=i.result;if(typeof d!="string"){c(new Error("Failed to read file as data URL"));return}const p=d.includes(",")?d.split(",")[1]??d:d;u(p)},i.onerror=c});i.readAsDataURL(n);const o=await s,l={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:o};SL(t,{from:r,to:r},l)}catch(i){console.error("Failed to process file:",i),Gt.error(`Failed to load file "${n.name}"`)}}function vL(t){const e=K.c(7),{editor:n,selectedModel:r}=t,a=O.useRef(_L);let i,s;e[0]!==n||e[1]!==r?(i=()=>{a.current=async(u,c)=>{await kv(n,r,u,c)}},s=[n,r],e[0]=n,e[1]=r,e[2]=i,e[3]=s):(i=e[2],s=e[3]),O.useEffect(i,s);let o,l;return e[4]!==n?(o=()=>{if(n?.isDestroyed)return;const u=new Te("fileDropHandler");n.state.plugins.find(p=>p.spec.key===u)&&n.unregisterPlugin(u);const d=new he({key:u,props:{handleDrop:(p,f,m,g)=>{if(g)return!1;const b=f.dataTransfer?.files;if(!b||b.length===0)return!1;f.preventDefault();const y=p.posAtCoords({left:f.clientX,top:f.clientY});if(!y)return!1;const T=Array.from(b),S=y.pos;for(const A of T)a.current?.(A,S);return!0}}});return n.registerPlugin(d),()=>{n?.isDestroyed||n.unregisterPlugin(u)}},l=[n],e[4]=n,e[5]=o,e[6]=l):(o=e[5],l=e[6]),O.useEffect(o,l),null}function _L(){return Promise.resolve()}function CL(t){const e=K.c(20),{selectedModel:n,isStreaming:r}=t,{editor:a}=bv(),i=O.useRef(null);let s;e[0]!==n?(s=B1(n),e[0]=n,e[1]=s):s=e[1];const o=s;let l;e[2]!==a||e[3]!==n?(l=async A=>{const v=A.target.files;if(!v||v.length===0||!a)return;const N=Array.from(v),{from:C}=a.state.selection,k=C;for(const R of N)await kv(a,n,R,k);i.current&&(i.current.value="")},e[2]=a,e[3]=n,e[4]=l):l=e[4];const u=l;if(!a)return null;const c=r||!o;let d;e[5]!==u||e[6]!==c?(d=E.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:u,disabled:c}),e[5]=u,e[6]=c,e[7]=d):d=e[7];const p=r||!o;let f,m;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=()=>i.current?.click(),m=E.jsx(eA,{size:16}),e[8]=f,e[9]=m):(f=e[8],m=e[9]);let g;e[10]!==p?(g=E.jsx(Et,{asChild:!0,children:E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:p,onClick:f,children:m})}),e[10]=p,e[11]=g):g=e[11];const b=o?"Add file":"Selected model does not support files";let y;e[12]!==b?(y=E.jsx(Tt,{side:"top",children:b}),e[12]=b,e[13]=y):y=e[13];let T;e[14]!==y||e[15]!==g?(T=E.jsxs(bt,{children:[g,y]}),e[14]=y,e[15]=g,e[16]=T):T=e[16];let S;return e[17]!==T||e[18]!==d?(S=E.jsxs(E.Fragment,{children:[d,T]}),e[17]=T,e[18]=d,e[19]=S):S=e[19],S}function IL(t={}){return new he({view(e){return new RL(e,t)}})}class RL{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=s=>{this[a](s)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),s=i.width/a.offsetWidth,o=i.height/a.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),g=d?m.bottom:m.top;d&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*o;r={left:m.left,right:m.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;u=d.left-l.scrollLeft*p,c=d.top-l.scrollTop*f}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/o+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=LA(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Se extends oe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Se.valid(r)?new Se(r):oe.near(r)}content(){return Z.empty}eq(e){return e instanceof Se&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Se(e.resolve(n.pos))}getBookmark(){return new Ph(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!kL(e)||!xL(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Se.valid(e))return e;let a=e.pos,i=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){i=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;a+=n;let l=e.doc.resolve(a);if(Se.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!te.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=s,a+=n;let o=e.doc.resolve(a);if(Se.valid(o))return o}return null}}}Se.prototype.visible=!1;Se.findFrom=Se.findGapCursorFrom;oe.jsonID("gapcursor",Se);class Ph{constructor(e){this.pos=e}map(e){return new Ph(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Se.valid(n)?new Se(n):oe.near(n)}}function xv(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function kL(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||xv(a.type))return!0;if(a.inlineContent)return!1}}return!0}function xL(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||xv(a.type))return!0;if(a.inlineContent)return!1}}return!0}function wL(){return new he({props:{decorations:ML,createSelectionBetween(t,e,n){return e.pos==n.pos&&Se.valid(n)?new Se(n):null},handleClick:LL,handleKeyDown:OL,handleDOMEvents:{beforeinput:DL}}})}const OL=DN({ArrowLeft:qa("horiz",-1),ArrowRight:qa("horiz",1),ArrowUp:qa("vert",-1),ArrowDown:qa("vert",1)});function qa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let s=r.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ie){if(!i.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=r.doc.resolve(e>0?o.after():o.before())}let u=Se.findGapCursorFrom(o,e,l);return u?(a&&a(r.tr.setSelection(new Se(u))),!0):!1}}function LL(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Se.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&te.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Se(r))),!0)}function DL(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Se))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=q.empty;for(let s=r.length-1;s>=0;s--)a=q.from(r[s].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Z(a,0,0));return i.setSelection(ie.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ML(t){if(!(t.selection instanceof Se))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ge.create(t.doc,[ze.widget(t.selection.head,e,{key:"gapcursor"})])}var Ni=200,Pe=function(){};Pe.prototype.append=function(e){return e.length?(e=Pe.from(e),!this.length&&e||e.length<Ni&&this.leafAppend(e)||this.length<Ni&&e.leafPrepend(this)||this.appendInner(e)):this};Pe.prototype.prepend=function(e){return e.length?Pe.from(e).append(this):this};Pe.prototype.appendInner=function(e){return new PL(this,e)};Pe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Pe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,s){return a.push(e(i,s))},n,r),a};Pe.from=function(e){return e instanceof Pe?e:e&&e.length?new wv(e):Pe.empty};var wv=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,s,o){for(var l=i;l<s;l++)if(a(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(a,i,s,o){for(var l=i-1;l>=s;l--)if(a(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=Ni)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Ni)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Pe);Pe.empty=new wv([]);var PL=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,a,i,s){var o=this.left.length;if(a<o&&this.left.forEachInner(r,a,Math.min(i,o),s)===!1||i>o&&this.right.forEachInner(r,Math.max(a-o,0),Math.min(this.length,i)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,s){var o=this.left.length;if(a>o&&this.right.forEachInvertedInner(r,a-o,Math.max(i,o)-o,s+o)===!1||i<o&&this.left.forEachInvertedInner(r,Math.min(a,o),i,s)===!1)return!1},e.prototype.sliceInner=function(r,a){if(r==0&&a==this.length)return this;var i=this.left.length;return a<=i?this.left.slice(r,a):r>=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Pe);const FL=500;class mt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let s=e.tr,o,l,u=[],c=[];return this.items.forEach((d,p)=>{if(!d.step){a||(a=this.remapping(r,p+1),i=a.maps.length),i--,c.push(d);return}if(a){c.push(new Ct(d.map));let f=d.step.map(a.slice(i)),m;f&&s.maybeStep(f).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new Ct(m,void 0,void 0,u.length+c.length))),i--,m&&a.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return o=a?d.selection.map(a.slice(i)):d.selection,l=new mt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,a){let i=[],s=this.eventCount,o=this.items,l=!a&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),p=new Ct(e.mapping.maps[c],d,n),f;(f=l&&l.merge(p))&&(p=f,c?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(s++,n=void 0),a||(l=p)}let u=s-r.depth;return u>UL&&(o=BL(o,u),s-=u),new mt(o.append(i),s)}remapping(e,n){let r=new da;return this.items.forEach((a,i)=>{let s=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new mt(this.items.append(e.map(n=>new Ct(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},a);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;s=Math.min(s,f);let m=i.maps[f];if(p.step){let g=e.steps[f].invert(e.docs[f]),b=p.selection&&p.selection.map(i.slice(l+1,f));b&&o++,r.push(new Ct(m,g,b))}else r.push(new Ct(m))},a);let u=[];for(let p=n;p<s;p++)u.push(new Ct(i.maps[p]));let c=this.items.slice(0,a).append(u).append(r),d=new mt(c,o);return d.emptyItemCount()>FL&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)a.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let d=new Ct(u.invert(),l,c),p,f=a.length-1;(p=a.length&&a[f].merge(d))?a[f]=p:a.push(d)}}else s.map&&r--},this.items.length,0),new mt(Pe.from(a.reverse()),i)}}mt.empty=new mt(Pe.empty,0);function BL(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}class Ct{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ct(n.getMap().invert(),n,this.selection)}}}class tn{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const UL=20;function HL(t,e,n,r){let a=n.getMeta(Fn),i;if(a)return a.historyState;n.getMeta(jL)&&(t=new tn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Fn))return s.getMeta(Fn).redo?new tn(t.done.addTransform(n,void 0,r,ei(e)),t.undone,Vg(n.mapping.maps),t.prevTime,t.prevComposition):new tn(t.done,t.undone.addTransform(n,void 0,r,ei(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!$L(n,t.prevRanges)),u=s?oo(t.prevRanges,n.mapping):Vg(n.mapping.maps);return new tn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ei(e)),mt.empty,u,n.time,o??t.prevComposition)}else return(i=n.getMeta("rebased"))?new tn(t.done.rebased(n,i),t.undone.rebased(n,i),oo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new tn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),oo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function $L(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&a>=e[i]&&(n=!0)}),n}function Vg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,s)=>e.push(i,s));return e}function oo(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let a=e.map(t[r],1),i=e.map(t[r+1],-1);a<=i&&n.push(a,i)}return n}function qL(t,e,n){let r=ei(e),a=Fn.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),o=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),a,r),l=new tn(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(s).setMeta(Fn,{redo:n,historyState:l})}let lo=!1,Wg=null;function ei(t){let e=t.plugins;if(Wg!=e){lo=!1,Wg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lo=!0;break}}return lo}const Fn=new Te("history"),jL=new Te("closeHistory");function zL(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new he({key:Fn,state:{init(){return new tn(mt.empty,mt.empty,null,0,-1)},apply(e,n,r){return HL(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,a=r=="historyUndo"?Lv:r=="historyRedo"?Dv:null;return!a||!e.editable?!1:(n.preventDefault(),a(e.state,e.dispatch))}}}})}function Ov(t,e){return(n,r)=>{let a=Fn.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=qL(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Lv=Ov(!1,!0),Dv=Ov(!0,!0);Ne.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new he({key:new Te("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const s=i-a,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(o,l);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=i-r,u=o-l,c=o;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});var GL=Ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[IL(this.options)]}});Ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new he({key:new Te("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return ge.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,u)=>{if(l.isText)return;if(!(a>=u&&a<=u+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,u)=>{if(l.isText||!(a>=u&&a<=u+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";i.push(ze.node(u,u+l.nodeSize,{class:this.options.className}))}),ge.create(t,i)}}})]}});var VL=Ne.create({name:"gapCursor",addProseMirrorPlugins(){return[wL()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=de(ee(t,"allowGapCursor",n)))!=null?e:null}}}),Yg="placeholder";function WL(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var YL=Ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Yg,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${WL(this.options.dataAttribute)}`:`data-${Yg}`;return[new he({key:new Te("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const u=a>=l&&a<=l+o.nodeSize,c=!o.isLeaf&&vs(o);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const p=ze.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:u}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),ge.create(e,i)}}})]}});Ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new he({key:new Te("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||XN(n.selection)||t.view.dragging?null:ge.create(n.doc,[ze.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Kg({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var KL=Ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Te(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new he({key:e,appendTransaction:(a,i,s)=>{const{doc:o,tr:l,schema:u}=s,c=e.getState(s),d=o.content.size,p=u.nodes[n];if(c)return l.insert(d,p.create())},state:{init:(a,i)=>{const s=i.tr.doc.lastChild;return!Kg({node:s,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const s=a.doc.lastChild;return!Kg({node:s,types:r})}}})]}}),XL=Ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Lv(t,e),redo:()=>({state:t,dispatch:e})=>Dv(t,e)}},addProseMirrorPlugins(){return[zL(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()}}}),ZL=YL,vi=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},QL=/^\s*>\s$/,JL=Qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return vi("blockquote",{...Re(this.options.HTMLAttributes,t),children:vi("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const o=e.renderChildren([a]).split(`
100
+ `)}function BO(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,s=t;a.descendants((o,l)=>{const u=i.mapping.map(l),c=i.mapping.map(l)+o.nodeSize;let d=null;if(o.marks.forEach(f=>{if(f!==s)return!1;d=f}),!d)return;let p=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(p=!0)}),p){const f=t.type.create({...t.attrs,...n});i.removeMark(u,c,t.type),i.addMark(u,c,f)}}),i.docChanged&&e.view.dispatch(i)}var Qe=class fv extends kh{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new fv(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},UO=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,a,i,s,o;const{view:l}=this.editor,u=t.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(u)||!c)return;let d=0,p=0;if(this.dom!==c){const T=this.dom.getBoundingClientRect(),S=c.getBoundingClientRect(),A=(a=t.offsetX)!=null?a:(r=t.nativeEvent)==null?void 0:r.offsetX,v=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=S.x-T.x+A,p=S.y-T.y+v}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),(o=t.dataTransfer)==null||o.setDragImage(f,d,p)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=te.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const a=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!a)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=te.isSelectable(this.node),d=t.type==="copy",p=t.type==="paste",f=t.type==="cut",m=t.type==="mousedown";if(!u&&c&&a&&t.target===this.dom&&t.preventDefault(),u&&a&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(u&&o&&!l&&m){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(l||i||d||p||f||m&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(ga()||Cf())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function zn(t){return new TO({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=de(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];let u=n.to;if(o){const c=l.search(/\S/),d=n.from+l.indexOf(o),p=d+o.length;if(Rh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+o.length,s.addMark(n.from+c,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:HO,getOwnPropertySymbols:$O}=Object,{hasOwnProperty:qO}=Object.prototype;function so(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function $a(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,s=i.get(n),o=i.get(r);if(s&&o)return s===r&&o===n;i.set(n,r),i.set(r,n);const l=t(n,r,a);return i.delete(n),i.delete(r),l}}function jO(t){return t?.[Symbol.toStringTag]}function Dg(t){return HO(t).concat($O(t))}const zO=Object.hasOwn||((t,e)=>qO.call(t,e));function Kn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const GO="__v",VO="__o",WO="_owner",{getOwnPropertyDescriptor:Mg,keys:Pg}=Object;function YO(t,e){return t.byteLength===e.byteLength&&yi(new Uint8Array(t),new Uint8Array(e))}function KO(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function XO(t,e){return t.byteLength===e.byteLength&&yi(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ZO(t,e){return Kn(t.getTime(),e.getTime())}function QO(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function JO(t,e){return t===e}function Fg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let s,o,l=0;for(;(s=i.next())&&!s.done;){const u=e.entries();let c=!1,d=0;for(;(o=u.next())&&!o.done;){if(a[d]){d++;continue}const p=s.value,f=o.value;if(n.equals(p[0],f[0],l,d,t,e,n)&&n.equals(p[1],f[1],p[0],f[0],t,e,n)){c=a[d]=!0;break}d++}if(!c)return!1;l++}return!0}const e2=Kn;function t2(t,e,n){const r=Pg(t);let a=r.length;if(Pg(e).length!==a)return!1;for(;a-- >0;)if(!hv(t,e,n,r[a]))return!1;return!0}function Pr(t,e,n){const r=Dg(t);let a=r.length;if(Dg(e).length!==a)return!1;let i,s,o;for(;a-- >0;)if(i=r[a],!hv(t,e,n,i)||(s=Mg(t,i),o=Mg(e,i),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function n2(t,e){return Kn(t.valueOf(),e.valueOf())}function r2(t,e){return t.source===e.source&&t.flags===e.flags}function Bg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let s,o;for(;(s=i.next())&&!s.done;){const l=e.values();let u=!1,c=0;for(;(o=l.next())&&!o.done;){if(!a[c]&&n.equals(s.value,o.value,s.value,o.value,t,e,n)){u=a[c]=!0;break}c++}if(!u)return!1}return!0}function yi(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function a2(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function hv(t,e,n,r){return(r===WO||r===VO||r===GO)&&(t.$$typeof||e.$$typeof)?!0:zO(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const i2="[object ArrayBuffer]",s2="[object Arguments]",o2="[object Boolean]",l2="[object DataView]",u2="[object Date]",c2="[object Error]",d2="[object Map]",p2="[object Number]",f2="[object Object]",h2="[object RegExp]",m2="[object Set]",g2="[object String]",b2={"[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},E2="[object URL]",T2=Object.prototype.toString;function y2({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:p,areUrlsEqual:f,unknownTagComparators:m}){return function(b,y,T){if(b===y)return!0;if(b==null||y==null)return!1;const S=typeof b;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?o(b,y,T):S==="function"?i(b,y,T):!1;const A=b.constructor;if(A!==y.constructor)return!1;if(A===Object)return l(b,y,T);if(Array.isArray(b))return e(b,y,T);if(A===Date)return r(b,y,T);if(A===RegExp)return c(b,y,T);if(A===Map)return s(b,y,T);if(A===Set)return d(b,y,T);const v=T2.call(b);if(v===u2)return r(b,y,T);if(v===h2)return c(b,y,T);if(v===d2)return s(b,y,T);if(v===m2)return d(b,y,T);if(v===f2)return typeof b.then!="function"&&typeof y.then!="function"&&l(b,y,T);if(v===E2)return f(b,y,T);if(v===c2)return a(b,y,T);if(v===s2)return l(b,y,T);if(b2[v])return p(b,y,T);if(v===i2)return t(b,y,T);if(v===l2)return n(b,y,T);if(v===o2||v===p2||v===g2)return u(b,y,T);if(m){let N=m[v];if(!N){const C=jO(b);C&&(N=m[C])}if(N)return N(b,y,T)}return!1}}function S2({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:YO,areArraysEqual:n?Pr:KO,areDataViewsEqual:XO,areDatesEqual:ZO,areErrorsEqual:QO,areFunctionsEqual:JO,areMapsEqual:n?so(Fg,Pr):Fg,areNumbersEqual:e2,areObjectsEqual:n?Pr:t2,arePrimitiveWrappersEqual:n2,areRegExpsEqual:r2,areSetsEqual:n?so(Bg,Pr):Bg,areTypedArraysEqual:n?so(yi,Pr):yi,areUrlsEqual:a2,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=$a(r.areArraysEqual),i=$a(r.areMapsEqual),s=$a(r.areObjectsEqual),o=$a(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:o})}return r}function A2(t){return function(e,n,r,a,i,s,o){return t(e,n,o)}}function N2({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(o,l){const{cache:u=t?new WeakMap:void 0,meta:c}=n();return e(o,l,{cache:u,equals:r,meta:c,strict:a})};if(t)return function(o,l){return e(o,l,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(o,l){return e(o,l,i)}}const v2=Sn();Sn({strict:!0});Sn({circular:!0});Sn({circular:!0,strict:!0});Sn({createInternalComparator:()=>Kn});Sn({strict:!0,createInternalComparator:()=>Kn});Sn({circular:!0,createInternalComparator:()=>Kn});Sn({circular:!0,createInternalComparator:()=>Kn,strict:!0});function Sn(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=S2(t),s=y2(i),o=n?n(s):A2(s);return N2({circular:e,comparator:s,createState:r,equals:o,strict:a})}var _2=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},C2=({contentComponent:t})=>{const e=L1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(e)})};function I2(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:_C.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var R2=class extends Ke.Component{constructor(t){var e;super(t),this.editorContentRef=Ke.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=I2(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:_2(e,this.editorContentRef),...n}),t?.contentComponent&&E.jsx(C2,{contentComponent:t.contentComponent})]})}},k2=O.forwardRef((t,e)=>{const n=Ke.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ke.createElement(R2,{key:n,innerRef:e,...t})}),Lh=Ke.memo(k2),x2=typeof window<"u"?O.useLayoutEffect:O.useEffect,w2=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,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.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function O2(t){var e;const[n]=O.useState(()=>new w2(t.editor)),r=vC.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:v2);return x2(()=>n.watch(t.editor),[t.editor,n]),O.useDebugValue(r),r}var L2=!1,wf=typeof window>"u",D2=wf||!!(typeof window<"u"&&window.next),M2=class mv{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(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?wf||D2?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new RO(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var s;return a===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?mv.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function gv(t={},e=[]){const n=O.useRef(t);n.current=t;const[r]=O.useState(()=>new M2(n)),a=L1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(a),O.useEffect(r.onRender(e)),O2({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var Is=O.createContext({editor:null});Is.Consumer;var bv=()=>O.useContext(Is),Ev=O.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),P2=()=>O.useContext(Ev),Tv=Ke.forwardRef((t,e)=>{const{onDragStart:n}=P2(),r=t.as||"div";return E.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Ug(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Hg(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function F2(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function B2(t){if(Ug(t)||Hg(t))return!0;if(F2(t)){const e=t.type;if(e)return Ug(e)||Hg(e)}return!1}function U2(){try{if(O.version)return parseInt(O.version.split(".")[0],10)>=19}catch{}return!1}var H2=class{constructor(t,{editor:e,props:n={},as:r="div",className:a=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),a&&this.element.classList.add(...a.split(" ")),this.editor.isInitialized?D1.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,a=U2(),i=B2(e),s={...n};s.ref&&!(a||i)&&delete s.ref,!s.ref&&(a||i)&&(s.ref=o=>{this.ref=o}),this.reactElement=E.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ke.createContext({markViewContentRef:()=>{}});var $2=class extends UO{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,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 r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,a){var i;return r==="storage"?(i=t.storage[e.name])!=null?i:{}:Reflect.get(n,r,a)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={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:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:O.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},a=this.component,i=O.memo(l=>E.jsx(Ev.Provider,{value:r,children:O.createElement(a,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new H2(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.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;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=a=>{this.renderer.updateProps(a),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const a=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:a,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!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.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=Er(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function yv(t,e){return n=>n.editor.contentComponent?new $2(t,n,e):{}}var Dh=O.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Dh.displayName="TiptapContext";var q2=()=>O.useContext(Dh);function Sv({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=O.useMemo(()=>({editor:r}),[r]),i=O.useMemo(()=>({editor:r}),[r]);return E.jsx(Is.Provider,{value:i,children:E.jsx(Dh.Provider,{value:a,children:n})})}Sv.displayName="Tiptap";function Av({...t}){const{editor:e}=q2();return E.jsx(Lh,{editor:e,...t})}Av.displayName="Tiptap.Content";Object.assign(Sv,{Content:Av});function Nv(t,e,n){t.chain().focus().insertContentAt(e,[vv(n),{type:"text",text:" "}]).run()}function vv(t){return{type:"mention",attrs:t}}function j2(t){const e=K.c(7),{node:n,selected:r,view:a}=t,{name:i,char:s}=n.attrs,o=r&&a.editable,u=s==="@"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",c=o&&"outline-2 outline-blue-300 outline-offset-0";let d;e[0]!==u||e[1]!==c?(d=re("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light",u,c),e[0]=u,e[1]=c,e[2]=d):d=e[2];let p;return e[3]!==s||e[4]!==i||e[5]!==d?(p=E.jsxs(Tv,{className:d,children:[s,i]}),e[3]=s,e[4]=i,e[5]=d,e[6]=p):p=e[6],p}const _v=Qe.create({name:"mention",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"mention"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.char&&(n["data-char"]=t.attrs.char),t.attrs.metadata&&(n["data-metadata"]=JSON.stringify(t.attrs.metadata)),["span",{...e,...n}]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return yv(j2)}});function z2(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}function G2(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const $g=3;function V2(t){const e=K.c(23),{prompt:n,onSelect:r,isSelected:a,isDisabled:i,isLoading:s}=t,o=n.description??n.name;let l;e[0]!==r||e[1]!==n?(l=()=>r(n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const u=i||s,c=a&&"bg-accent/50 text-foreground",d=s&&"bg-accent/50 text-foreground",p=(i||s)&&"cursor-not-allowed hover:bg-accent/50";let f;e[3]!==c||e[4]!==d||e[5]!==p?(f=re("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer flex items-center gap-1.5",c,d,p),e[3]=c,e[4]=d,e[5]=p,e[6]=f):f=e[6];const m=n.title??n.name;let g;if(e[7]!==m){let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=/_/g,e[9]=A):A=e[9],g=m.replace(A," "),e[7]=m,e[8]=g}else g=e[8];let b;e[10]!==s?(b=s&&E.jsx(rs,{size:"xs"}),e[10]=s,e[11]=b):b=e[11];let y;e[12]!==l||e[13]!==u||e[14]!==f||e[15]!==g||e[16]!==b?(y=E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",onClick:l,disabled:u,className:f,children:[g,b]})}),e[12]=l,e[13]=u,e[14]=f,e[15]=g,e[16]=b,e[17]=y):y=e[17];let T;e[18]!==o?(T=E.jsx(Tt,{side:"bottom",className:"max-w-xs",children:E.jsx("p",{className:"text-xs",children:o})}),e[18]=o,e[19]=T):T=e[19];let S;return e[20]!==y||e[21]!==T?(S=E.jsxs(bt,{children:[y,T]}),e[20]=y,e[21]=T,e[22]=S):S=e[22],S}function W2(t){const e=K.c(23),{prompts:n,onSelect:r,loadingPrompt:a,className:i}=t;if(n.length===0)return null;let s,o,l,u,c;if(e[0]!==i||e[1]!==a||e[2]!==r||e[3]!==n){const f=n.slice(0,$g),m=n.slice($g),g=m.length>0,b=!!a;s=as,c=300,e[9]!==i?(o=re("flex flex-wrap items-center justify-center gap-2",i),e[9]=i,e[10]=o):o=e[10];let y;e[11]!==b||e[12]!==a?.name||e[13]!==r?(y=T=>E.jsx(V2,{prompt:T,onSelect:r,isLoading:a?.name===T.name,isDisabled:b&&a?.name!==T.name},T.name),e[11]=b,e[12]=a?.name,e[13]=r,e[14]=y):y=e[14],l=f.map(y),u=g&&E.jsxs(vr,{children:[E.jsx(_r,{asChild:!0,children:E.jsxs("button",{type:"button",disabled:b,className:re("size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",b&&"opacity-60 cursor-not-allowed"),children:["+",m.length]})}),E.jsx(Cr,{side:"bottom",align:"center",className:"w-auto p-2",children:E.jsx("div",{className:"flex flex-col gap-1",children:m.map(T=>{const S=T.description??T.name,A=a?.name===T.name;return E.jsxs(bt,{children:[E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",onClick:()=>r(T),disabled:b&&!A,className:re("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left flex items-center gap-1.5",A&&"bg-accent/50 text-foreground",b&&!A&&"opacity-60 cursor-not-allowed"),children:[(T.title??T.name).replace(/_/g," "),A&&E.jsx(rs,{size:"xs"})]})}),E.jsx(Tt,{side:"right",className:"max-w-xs",children:E.jsx("p",{className:"text-xs",children:S})})]},T.name)})})})]}),e[0]=i,e[1]=a,e[2]=r,e[3]=n,e[4]=s,e[5]=o,e[6]=l,e[7]=u,e[8]=c}else s=e[4],o=e[5],l=e[6],u=e[7],c=e[8];let d;e[15]!==o||e[16]!==l||e[17]!==u?(d=E.jsxs("div",{className:o,children:[l,u]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d):d=e[18];let p;return e[19]!==s||e[20]!==c||e[21]!==d?(p=E.jsx(s,{delayDuration:c,children:d}),e[19]=s,e[20]=c,e[21]=d,e[22]=p):p=e[22],p}function Y2(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsxs(E.Fragment,{children:[E.jsx(Em,{className:"h-6 w-20 rounded-full border border-border"}),E.jsx(Em,{className:"h-6 w-24 rounded-full border border-border"})]}),t[0]=e):e=t[0],e}function K2(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function X2(t){const e=K.c(28),{connectionId:n}=t,{tiptapDoc:r,sendMessage:a}=En(),{org:i}=Nr();let s;e[0]!==n||e[1]!==i.id?(s={connectionId:n,orgId:i.id},e[0]=n,e[1]=i.id,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==o?(l={client:o,staleTime:6e4},e[3]=o,e[4]=l):l=e[4];const{data:u}=KC(l);let c;e[5]!==u?.prompts?(c=u?.prompts??[],e[5]=u?.prompts,e[6]=c):c=e[6];const d=c;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[7]=p):p=e[7];const[f,m]=O.useReducer(K2,p),[g,b]=O.useState(null);let y;e[8]!==o||e[9]!==a||e[10]!==r?(y=async(P,$)=>{if(!o){Gt.error("MCP client not available"),m({type:"RESET"});return}try{const B=await G1(o,P.name,$);m({type:"RESET"});const G=G2(r,{type:"paragraph",content:[vv({id:P.name,name:P.name,metadata:B.messages,char:"/"})]});await a(G)}catch(B){console.error("[ice-breakers] Failed to fetch prompt:",B),Gt.error("Failed to load prompt. Please try again."),m({type:"RESET"})}},e[8]=o,e[9]=a,e[10]=r,e[11]=y):y=e[11];const T=y;let S;e[12]!==T?(S=async P=>{if(P.arguments&&P.arguments.length>0){m({type:"SELECT_PROMPT",prompt:P}),b(P);return}m({type:"START_LOADING",prompt:P}),await T(P)},e[12]=T,e[13]=S):S=e[13];const A=S;let v;e[14]!==g||e[15]!==T?(v=async P=>{g&&(m({type:"START_LOADING",prompt:g,arguments:P}),b(null),await T(g,P))},e[14]=g,e[15]=T,e[16]=v):v=e[16];const N=v;if(d.length===0)return null;const C=f.stage==="loading"?f.prompt:null;let k;e[17]!==A||e[18]!==d||e[19]!==C?(k=E.jsx(W2,{prompts:d,onSelect:A,loadingPrompt:C}),e[17]=A,e[18]=d,e[19]=C,e[20]=k):k=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{b(null),m({type:"RESET"})},e[21]=R):R=e[21];let D;e[22]!==g||e[23]!==N?(D=E.jsx(sA,{prompt:g,setPrompt:R,onSubmit:N}),e[22]=g,e[23]=N,e[24]=D):D=e[24];let w;return e[25]!==D||e[26]!==k?(w=E.jsxs("div",{className:"relative w-full",children:[k,D]}),e[25]=D,e[26]=k,e[27]=w):w=e[27],w}function Z2(t){const e=K.c(14),{className:n}=t,{selectedVirtualMcp:r}=En(),{org:a}=Nr();let i;e[0]!==a.id?(i=z1(a.id),e[0]=a.id,e[1]=i):i=e[1];const s=i.id,o=r?.id??s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={minHeight:"32px"},e[2]=l):l=e[2];let u;e[3]!==n?(u=re("flex flex-wrap items-center justify-center gap-2",n),e[3]=n,e[4]=u):u=e[4];const c=o??"default";let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx(Y2,{}),e[5]=d):d=e[5];let p;e[6]!==o?(p=E.jsx(X2,{connectionId:o}),e[6]=o,e[7]=p):p=e[7];let f;e[8]!==c||e[9]!==p?(f=E.jsx(ZC,{fallback:null,children:E.jsx(O.Suspense,{fallback:d,children:p},c)}),e[8]=c,e[9]=p,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=E.jsx("div",{style:l,className:u,children:f}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const qg=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function Q2(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e)}function Cv(t){if(t==null)return null;const n=Q2(t)%qg.length;return qg[n]}const jg=Ar({response:si().min(1,"Response is required")}),J2=Ar({response:si().min(1,"Please select or enter an option")}),eL=Ar({response:CC(["yes","no"])});function tL(t){switch(t.type){case"text":return jg;case"choice":return J2;case"confirm":return eL;default:return jg}}function nL(t){const e={};for(const n of t)e[n.toolCallId]=tL(n.input);return Ar(e)}function rL(t){const e=K.c(6),{control:n,name:r,placeholder:a}=t;let i;e[0]!==a?(i=o=>{const{field:l}=o;return E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsx("div",{className:"px-2",children:E.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[E.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:E.jsx(ah,{size:16,className:"text-muted-foreground"})}),E.jsx("input",{...l,type:"text",placeholder:a||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),E.jsx(us,{})]})},e[0]=a,e[1]=i):i=e[1];let s;return e[2]!==n||e[3]!==r||e[4]!==i?(s=E.jsx(is,{control:n,name:r,render:i}),e[2]=n,e[3]=r,e[4]=i,e[5]=s):s=e[5],s}function aL(t){const e=K.c(10),{control:n,name:r,options:a}=t,[i,s]=O.useState(!1),o=O.useRef(null),l=O.useRef(null);let u,c;if(e[0]!==a?(u=()=>{const f=m=>{const g=m.target.tagName;if(g==="INPUT"||g==="TEXTAREA")return;const b=Number.parseInt(m.key,10);b>=1&&b<=a.length&&l.current&&(m.preventDefault(),l.current.onChange(a[b-1]??""),s(!1))};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},c=[a],e[0]=a,e[1]=u,e[2]=c):(u=e[1],c=e[2]),O.useEffect(u,c),a.length===0)return null;let d;e[3]!==i||e[4]!==a?(d=f=>{const{field:m}=f;l.current=m;const g=i||!!m.value&&!a.includes(m.value);return E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[a.map((b,y)=>{const T=m.value===b;return E.jsxs("button",{type:"button",onClick:()=>{m.onChange(b??""),s(!1)},className:re("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",T&&"bg-accent/50",!T&&"hover:bg-accent/30"),"aria-label":`Select ${b}`,children:[E.jsx("span",{className:re("flex items-center justify-center size-6 rounded-md text-sm shrink-0",T?"bg-chart-1 text-white":"bg-muted text-foreground"),children:y+1}),E.jsx("span",{className:"text-sm text-foreground truncate",children:b})]},`${y}-${b}`)}),E.jsxs("div",{className:re("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",g&&"bg-accent/50",!g&&"hover:bg-accent/30"),onClick:()=>{s(!0),a.includes(m.value)&&m.onChange(""),setTimeout(()=>o.current?.focus(),0)},children:[E.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:E.jsx(ah,{size:16,className:"text-muted-foreground"})}),g?E.jsx("input",{ref:o,type:"text",value:m.value,onChange:b=>m.onChange(b.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):E.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),E.jsx(us,{})]})},e[3]=i,e[4]=a,e[5]=d):d=e[5];let p;return e[6]!==n||e[7]!==r||e[8]!==d?(p=E.jsx(is,{control:n,name:r,render:d}),e[6]=n,e[7]=r,e[8]=d,e[9]=p):p=e[9],p}function iL(t){const e=K.c(7),{control:n,name:r}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["yes","no"],e[0]=a):a=e[0];const i=a,s=O.useRef(null);let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{const d=p=>{const f=p.target.tagName;f==="INPUT"||f==="TEXTAREA"||(p.key==="1"&&s.current?(p.preventDefault(),s.current.onChange("yes")):p.key==="2"&&s.current&&(p.preventDefault(),s.current.onChange("no")))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},l=[],e[1]=o,e[2]=l):(o=e[1],l=e[2]),O.useEffect(o,l);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:p}=d;return s.current=p,E.jsxs(ss,{children:[E.jsx(ls,{children:E.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:i.map(f=>{const m=p.value===f;return E.jsxs("button",{type:"button",onClick:()=>p.onChange(f),className:re("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":`Confirm ${f}`,children:[E.jsx("span",{className:re("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),E.jsx("span",{className:"text-sm text-foreground capitalize",children:f})]},f)})})}),E.jsx(us,{})]})},e[3]=u):u=e[3];let c;return e[4]!==n||e[5]!==r?(c=E.jsx(is,{control:n,name:r,render:u}),e[4]=n,e[5]=r,e[6]=c):c=e[6],c}function zg(t){const e=K.c(13),{input:n,control:r,name:a}=t;switch(n.type){case"text":{let i;return e[0]!==r||e[1]!==n.default||e[2]!==a?(i=E.jsx(rL,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=i):i=e[3],i}case"choice":{let i;e[4]!==n.options?(i=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=i):i=e[5];const s=i;let o;return e[6]!==r||e[7]!==a||e[8]!==s?(o=E.jsx(aL,{control:r,name:a,options:s}),e[6]=r,e[7]=a,e[8]=s,e[9]=o):o=e[9],o}case"confirm":{let i;return e[10]!==r||e[11]!==a?(i=E.jsx(iL,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=i):i=e[12],i}default:return null}}function sL(t){const e=K.c(21),{current:n,total:r,onPrev:a,onNext:i}=t;if(r<=1)return null;const s=n===0,o=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==o?(l=re("p-0.5 rounded transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx(pI,{size:14}),e[2]=u):u=e[2];let c;e[3]!==a||e[4]!==s||e[5]!==l?(c=E.jsx("button",{type:"button",onClick:a,disabled:s,className:l,"aria-label":"Previous question",children:u}),e[3]=a,e[4]=s,e[5]=l,e[6]=c):c=e[6];const d=n+1;let p;e[7]!==d||e[8]!==r?(p=E.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",r]}),e[7]=d,e[8]=r,e[9]=p):p=e[9];const f=n===r-1,m=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==m?(g=re("p-0.5 rounded transition-colors",m),e[10]=m,e[11]=g):g=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=E.jsx(fI,{size:14}),e[12]=b):b=e[12];let y;e[13]!==i||e[14]!==g||e[15]!==f?(y=E.jsx("button",{type:"button",onClick:i,disabled:f,className:g,"aria-label":"Next question",children:b}),e[13]=i,e[14]=g,e[15]=f,e[16]=y):y=e[16];let T;return e[17]!==y||e[18]!==c||e[19]!==p?(T=E.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c,p,y]}),e[17]=y,e[18]=c,e[19]=p,e[20]=T):T=e[20],T}function Gg(t){const e=K.c(15),{title:n,children:r,footerLeft:a,footerRight:i}=t;let s;e[0]!==n?(s=E.jsx("div",{className:"flex items-center gap-2 p-4",children:E.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=E.jsx("div",{className:"overflow-clip pb-4",children:r}),e[2]=r,e[3]=o):o=e[3];let l;e[4]!==a?(l=E.jsx("div",{children:a}),e[4]=a,e[5]=l):l=e[5];let u;e[6]!==i?(u=E.jsx("div",{className:"flex items-center gap-2",children:i}),e[6]=i,e[7]=u):u=e[7];let c;e[8]!==l||e[9]!==u?(c=E.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:E.jsxs("div",{className:"flex items-center justify-between",children:[l,u]})}),e[8]=l,e[9]=u,e[10]=c):c=e[10];let d;return e[11]!==s||e[12]!==o||e[13]!==c?(d=E.jsxs("div",{className:"flex flex-col rounded-xl bg-background border border-border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",children:[s,o,c]}),e[11]=s,e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function oL({parts:t,onSubmit:e}){const[n,r]=O.useState(t[0]?.toolCallId??""),a=nL(t.map(T=>({toolCallId:T.toolCallId,input:T.input}))),i=O1({resolver:w1(a),defaultValues:Object.fromEntries(t.map(T=>[T.toolCallId,{response:""}]))}),s=i.watch(),o=t.findIndex(T=>T.toolCallId===n),l=!!s[n]?.response,u=t.every(T=>!!s[T.toolCallId]?.response),c=T=>{for(const S of t){const A=T[S.toolCallId]?.response;A&&e(S,A)}},d=T=>t.find(S=>!T[S.toolCallId]?.response&&S.toolCallId!==n)??null,p=()=>{const T=i.getValues();if(t.every(A=>!!T[A.toolCallId]?.response))i.handleSubmit(c)();else{const A=d(T);A&&r(A.toolCallId)}},f=()=>{i.setValue(`${n}.response`,"user has skip this question"),p()},m=()=>{if(o>0){const T=t[o-1];T&&r(T.toolCallId)}},g=()=>{if(o<t.length-1){const T=t[o+1];T&&r(T.toolCallId)}},b=E.jsxs(E.Fragment,{children:[E.jsx(Ee,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-7",children:"Skip"}),E.jsx(Ee,{type:"button",size:"sm",disabled:!l,onClick:p,className:re("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),y=E.jsx(sL,{current:o,total:t.length,onPrev:m,onNext:g});if(t.length===1){const T=t[0];return T?.input?E.jsx(of,{...i,children:E.jsx("form",{onSubmit:i.handleSubmit(c),autoComplete:"off",children:E.jsx(Gg,{title:T.input?.prompt??"Question",footerRight:b,children:E.jsx(zg,{input:T.input,control:i.control,name:`${T.toolCallId}.response`})})})}):null}return E.jsx(of,{...i,children:E.jsx("form",{onSubmit:i.handleSubmit(c),autoComplete:"off",children:E.jsx($C,{value:n,onValueChange:r,children:t.map(T=>E.jsx(qC,{value:T.toolCallId,className:"mt-0",children:E.jsx(Gg,{title:T.input?.prompt??"Question",footerLeft:y,footerRight:b,children:E.jsx(zg,{input:T.input,control:i.control,name:`${T.toolCallId}.response`})})},T.toolCallId))})})})}function lL(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[E.jsx(W1,{className:"size-5 text-muted-foreground shimmer"}),E.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function Iv(t){const e=K.c(6),{userAskParts:n,isStreaming:r,onSubmit:a}=t;let i;e[0]!==n?(i=n.filter(uL),e[0]=n,e[1]=i):i=e[1];const s=i;if(r){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx(lL,{}),e[2]=l):l=e[2],l}if(s.length===0)return null;let o;return e[3]!==a||e[4]!==s?(o=E.jsx(oL,{parts:s,onSubmit:a}),e[3]=a,e[4]=s,e[5]=o):o=e[5],o}function uL(t){return t.state==="input-available"}const cL={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Si(t){const e=K.c(32),{variant:n,onDismiss:r}=t,a=n==="error",i=a?"Error occurred":"Response incomplete",s=a?t.error.message:cL[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,o=a?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",l=a?"text-destructive":"text-amber-600 dark:text-amber-500",u=a?cI:dI;let c;e[0]!==o?(c=re("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2 shadow",o),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==l?(d=re("mt-0.5 shrink-0",l),e[2]=l,e[3]=d):d=e[3];let p;e[4]!==u?(p=E.jsx(u,{size:16}),e[4]=u,e[5]=p):p=e[5];let f;e[6]!==d||e[7]!==p?(f=E.jsx("div",{className:d,children:p}),e[6]=d,e[7]=p,e[8]=f):f=e[8];let m;e[9]!==l?(m=re("text-xs mb-1 font-medium",l),e[9]=l,e[10]=m):m=e[10];let g;e[11]!==m||e[12]!==i?(g=E.jsx("div",{className:m,children:i}),e[11]=m,e[12]=i,e[13]=g):g=e[13];let b;e[14]!==s?(b=E.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:s}),e[14]=s,e[15]=b):b=e[15];let y;e[16]!==a||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(y=E.jsx("div",{className:"flex gap-2",children:a?E.jsxs(E.Fragment,{children:[E.jsx(Ee,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),E.jsx(Ee,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):E.jsx(Ee,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=a,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=y):y=e[19];let T;e[20]!==g||e[21]!==b||e[22]!==y?(T=E.jsxs("div",{className:"flex-1 min-w-0",children:[g,b,y]}),e[20]=g,e[21]=b,e[22]=y,e[23]=T):T=e[23];let S;e[24]===Symbol.for("react.memo_cache_sentinel")?(S=E.jsx(j1,{size:14}),e[24]=S):S=e[24];let A;e[25]!==r?(A=E.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:S}),e[25]=r,e[26]=A):A=e[26];let v;return e[27]!==c||e[28]!==A||e[29]!==f||e[30]!==T?(v=E.jsx("div",{className:"px-0.5",children:E.jsxs("div",{className:c,children:[f,T,A]})}),e[27]=c,e[28]=A,e[29]=f,e[30]=T,e[31]=v):v=e[31],v}function Rs(){const t=K.c(23),{error:e,clearError:n,finishReason:r,clearFinishReason:a,messages:i,isStreaming:s,addToolOutput:o,sendMessage:l}=En();let u,c,d;if(t[0]!==i){const S=i.at(-1);d=S?.role==="assistant"?S.parts.filter(fL):null,u=d?.filter(pL)?.length,c=S?.role==="assistant"?S.parts.some(dL):!1,t[0]=i,t[1]=u,t[2]=c,t[3]=d}else u=t[1],c=t[2],d=t[3];const p=c;let f;t[4]!==e||t[5]!==l?(f=()=>{if(e){const A={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};l(A)}},t[4]=e,t[5]=l,t[6]=f):f=t[6];const m=f;let g;t[7]!==l?(g=()=>{l({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[7]=l,t[8]=g):g=t[8];const b=g;let y;t[9]!==o?(y=(S,A)=>{o({tool:"user_ask",toolCallId:S.toolCallId,output:{response:A}})},t[9]=o,t[10]=y):y=t[10];const T=y;if(u){let S;return t[11]!==T||t[12]!==s||t[13]!==d?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0",children:E.jsx(Iv,{userAskParts:d,isStreaming:s,onSubmit:T})}),t[11]=T,t[12]=s,t[13]=d,t[14]=S):S=t[14],S}if(!s&&e){let S;return t[15]!==n||t[16]!==e||t[17]!==m?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:E.jsx(Si,{variant:"error",error:e,onDismiss:n,onFixInChat:m})}),t[15]=n,t[16]=e,t[17]=m,t[18]=S):S=t[18],S}if(!s&&r&&r!=="stop"&&!p){let S;return t[19]!==a||t[20]!==r||t[21]!==b?(S=E.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:E.jsx(Si,{variant:"warning",finishReason:r,onDismiss:a,onContinue:b})}),t[19]=a,t[20]=r,t[21]=b,t[22]=S):S=t[22],S}return null}function dL(t){return"state"in t&&t.state==="approval-requested"}function pL(t){return t.state!=="output-available"}function fL(t){return t.type==="tool-user_ask"}Rs.Error=function(e){return E.jsx(Si,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Rs.Warning=function(e){return E.jsx(Si,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Rs.UserAskQuestion=Iv;const Ai={passthrough:{label:"Direct access",description:"Best for small teams or when you need predictable behavior",icon:zC},smart_tool_selection:{label:"Smart discovery",description:"Ideal for large teams with many tools - AI finds what it needs",icon:jC},code_execution:{label:"Smart execution",description:"Maximum flexibility - AI can write code to orchestrate tools",icon:mI,recommended:!0}};function hL(t){const e=K.c(24),{mode:n,isSelected:r,onSelect:a}=t,i=Ai[n],s=i.icon,o=r&&"bg-accent";let l;e[0]!==o?(l=re("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==s?(u=E.jsx("div",{className:"p-1.5 shrink-0 rounded-md bg-muted",children:E.jsx(s,{className:"size-4 text-muted-foreground"})}),e[2]=s,e[3]=u):u=e[3];let c;e[4]!==i.label?(c=E.jsx("span",{className:"text-sm font-medium text-foreground",children:i.label}),e[4]=i.label,e[5]=c):c=e[5];let d;e[6]!==i.recommended?(d=i.recommended&&E.jsx(hI,{variant:"outline",className:"text-xs",children:"Recommended"}),e[6]=i.recommended,e[7]=d):d=e[7];let p;e[8]!==r?(p=r&&E.jsx(Gn,{size:16,className:"text-foreground shrink-0 ml-auto"}),e[8]=r,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==d||e[12]!==p?(f=E.jsxs("div",{className:"flex items-center gap-2",children:[c,d,p]}),e[10]=c,e[11]=d,e[12]=p,e[13]=f):f=e[13];let m;e[14]!==i.description?(m=E.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:i.description}),e[14]=i.description,e[15]=m):m=e[15];let g;e[16]!==f||e[17]!==m?(g=E.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,m]}),e[16]=f,e[17]=m,e[18]=g):g=e[18];let b;return e[19]!==a||e[20]!==l||e[21]!==u||e[22]!==g?(b=E.jsxs("div",{onClick:a,className:l,children:[u,g]}),e[19]=a,e[20]=l,e[21]=u,e[22]=g,e[23]=b):b=e[23],b}function mL(t){const e=K.c(13),{mode:n,placeholder:r}=t,a=r===void 0?"Select mode":r;if(!n){let d;e[0]!==a?(d=E.jsx("span",{className:"text-sm text-muted-foreground",children:a}),e[0]=a,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=E.jsx(lf,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=p):p=e[2];let f;return e[3]!==d?(f=E.jsxs("div",{className:"flex items-center gap-1.5",children:[d,p]}),e[3]=d,e[4]=f):f=e[4],f}const i=Ai[n],s=i.icon;let o;e[5]!==s?(o=E.jsx(s,{className:"size-4 text-muted-foreground shrink-0"}),e[5]=s,e[6]=o):o=e[6];let l;e[7]!==i.label?(l=E.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:i.label}),e[7]=i.label,e[8]=l):l=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx(lf,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[9]=u):u=e[9];let c;return e[10]!==o||e[11]!==l?(c=E.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,l,u]}),e[10]=o,e[11]=l,e[12]=c):c=e[12],c}function gL(t){const e=K.c(28),{selectedMode:n,onModeChange:r,variant:a,className:i,placeholder:s,disabled:o}=t,l=a===void 0?"borderless":a,u=s===void 0?"Mode":s,c=o===void 0?!1:o,[d,p]=O.useState(!1);let f;e[0]!==r?(f=$=>{r($),p(!1)},e[0]=r,e[1]=f):f=e[1];const m=f,g=c?!1:d,b=l==="borderless"?"ghost":"outline",y=l==="borderless"&&"md:border-none",T=c&&"cursor-not-allowed opacity-50";let S;e[2]!==i||e[3]!==y||e[4]!==T?(S=re("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",y,T,i),e[2]=i,e[3]=y,e[4]=T,e[5]=S):S=e[5];const A=d?"open":"closed";let v;e[6]!==u||e[7]!==n?(v=E.jsx(mL,{mode:n,placeholder:u}),e[6]=u,e[7]=n,e[8]=v):v=e[8];let N;e[9]!==c||e[10]!==A||e[11]!==v||e[12]!==b||e[13]!==S?(N=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx(Ee,{variant:b,size:"sm",className:S,disabled:c,"data-state":A,children:v})})}),e[9]=c,e[10]=A,e[11]=v,e[12]=b,e[13]=S,e[14]=N):N=e[14];const C=Ai[n]?.description??"Choose agent mode";let k;e[15]!==C?(k=E.jsx(Tt,{side:"top",className:"text-xs",children:C}),e[15]=C,e[16]=k):k=e[16];let R;e[17]!==N||e[18]!==k?(R=E.jsx(as,{children:E.jsxs(bt,{children:[N,k]})}),e[17]=N,e[18]=k,e[19]=R):R=e[19];let D;e[20]===Symbol.for("react.memo_cache_sentinel")?(D=Object.keys(Ai),e[20]=D):D=e[20];let w;e[21]!==m||e[22]!==n?(w=E.jsx(Cr,{className:"w-[350px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx("div",{className:"flex flex-col p-1",children:D.map($=>E.jsx(hL,{mode:$,isSelected:$===n,onSelect:()=>m($)},$))})}),e[21]=m,e[22]=n,e[23]=w):w=e[23];let P;return e[24]!==R||e[25]!==w||e[26]!==g?(P=E.jsxs(vr,{open:g,onOpenChange:p,children:[R,w]}),e[24]=R,e[25]=w,e[26]=g,e[27]=P):P=e[27],P}function bL(t){const e=K.c(24),{virtualMcp:n,isSelected:r}=t,a=r&&"bg-accent";let i;e[0]!==a?(i=re("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",a),e[0]=a,e[1]=i):i=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??E.jsx(pr,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let o;e[4]!==s||e[5]!==n.icon||e[6]!==n.title?(o=E.jsx(cs,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"rounded-xl border border-border shadow-sm shrink-0 aspect-square"}),e[4]=s,e[5]=n.icon,e[6]=n.title,e[7]=o):o=e[7];let l;e[8]!==n.title?(l=E.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]!==r?(u=r&&E.jsx(Gn,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=u):u=e[11];let c;e[12]!==l||e[13]!==u?(c=E.jsxs("div",{className:"flex items-center justify-between",children:[l,u]}),e[12]=l,e[13]=u,e[14]=c):c=e[14];let d;e[15]!==n.description?(d=n.description&&E.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let p;e[17]!==c||e[18]!==d?(p=E.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[c,d]}),e[17]=c,e[18]=d,e[19]=p):p=e[19];let f;return e[20]!==i||e[21]!==o||e[22]!==p?(f=E.jsxs("div",{className:i,children:[o,p]}),e[20]=i,e[21]=o,e[22]=p,e[23]=f):f=e[23],f}function Mh(t){const e=K.c(33),{virtualMcps:n,selectedVirtualMcpId:r,onVirtualMcpChange:a,searchInputRef:i}=t,[s,o]=O.useState(""),l=O.useRef(null),u=i??l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={navigateOnCreate:!0},e[0]=c):c=e[0];const{createVirtualMCP:d,isCreating:p}=bI(c);let f,m,g,b;if(e[1]!==d||e[2]!==u||e[3]!==p||e[4]!==a||e[5]!==s||e[6]!==r||e[7]!==n){let S;e:{const P=n.filter(EL);if(!s.trim()){S=P;break e}const $=s.toLowerCase();S=P.filter(B=>B.title.toLowerCase().includes($)||B.description?.toLowerCase().includes($))}const A=S;let v;e[12]!==a?(v=P=>{a(P),o("")},e[12]=a,e[13]=v):v=e[13];const N=v;g="flex flex-col max-h-[400px]";let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=E.jsx(K1,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=C):C=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=P=>o(P.target.value),e[15]=k):k=e[15];let R;e[16]!==u||e[17]!==s?(R=E.jsx(V1,{ref:u,type:"text",placeholder:"Search for an agent...",value:s,onChange:k,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=u,e[17]=s,e[18]=R):R=e[18];const D=p?"Creating...":"Create Agent";let w;e[19]!==d||e[20]!==p||e[21]!==D?(w=E.jsx(Ee,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:p,children:D}),e[19]=d,e[20]=p,e[21]=D,e[22]=w):w=e[22],e[23]!==R||e[24]!==w?(b=E.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:E.jsxs("div",{className:"relative flex items-center gap-2",children:[C,R,w]})}),e[23]=R,e[24]=w,e[25]=b):b=e[25],f="overflow-y-auto p-1.5",m=A.length>0?E.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:A.map(P=>E.jsx("div",{role:"button",tabIndex:0,onClick:()=>N(P.id),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),N(P.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:E.jsx(bL,{virtualMcp:P,isSelected:P.id===r})},P.id))}):E.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=d,e[2]=u,e[3]=p,e[4]=a,e[5]=s,e[6]=r,e[7]=n,e[8]=f,e[9]=m,e[10]=g,e[11]=b}else f=e[8],m=e[9],g=e[10],b=e[11];let y;e[26]!==f||e[27]!==m?(y=E.jsx("div",{className:f,children:m}),e[26]=f,e[27]=m,e[28]=y):y=e[28];let T;return e[29]!==g||e[30]!==b||e[31]!==y?(T=E.jsxs("div",{className:g,children:[b,y]}),e[29]=g,e[30]=b,e[31]=y,e[32]=T):T=e[32],T}function EL(t){return!t.id||!dr(t.id)}function TL(t){const e=K.c(37),{selectedVirtualMcpId:n,onVirtualMcpChange:r,virtualMcps:a,className:i,placeholder:s,showTooltip:o,disabled:l}=t,u=s===void 0?"Select Agent":s,c=o===void 0?!0:o,d=l===void 0?!1:l,[p,f]=O.useState(!1),m=O.useRef(null),g=gI(),b=a??g;let y;e[0]!==b?(y=b.filter(yL),e[0]=b,e[1]=y):y=e[1];const T=y;let S;e[2]!==b||e[3]!==n?(S=n?b.find(W=>W.id===n):null,e[2]=b,e[3]=n,e[4]=S):S=e[4];const A=S;let v;e[5]!==r?(v=W=>{r(W),f(!1)},e[5]=r,e[6]=v):v=e[6];const N=v;let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=W=>{f(W)},e[7]=C):C=e[7];const k=C;let R,D;e[8]!==p?(R=()=>{p&&setTimeout(()=>{m.current?.focus()},0)},D=[p],e[8]=p,e[9]=R,e[10]=D):(R=e[9],D=e[10]),O.useEffect(R,D);const w=d?!1:p,P=d?void 0:k,$=d?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let B;e[11]!==i||e[12]!==$?(B=re("flex items-center justify-center size-8 rounded-full transition-colors shrink-0",$,i),e[11]=i,e[12]=$,e[13]=B):B=e[13];let G;e[14]!==A?(G=A?E.jsx(cs,{icon:A.icon,name:A.title,size:"xs",fallbackIcon:E.jsx(pr,{size:16}),className:"rounded-md shrink-0 aspect-square"}):E.jsx(pr,{size:16}),e[14]=A,e[15]=G):G=e[15];let U;e[16]!==d||e[17]!==u||e[18]!==B||e[19]!==G?(U=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx("button",{type:"button",disabled:d,className:B,"aria-label":u,children:G})})}),e[16]=d,e[17]=u,e[18]=B,e[19]=G,e[20]=U):U=e[20];let z;e[21]!==p||e[22]!==A?.title||e[23]!==c?(z=c&&!p&&E.jsx(Tt,{side:"top",className:"text-xs",children:A?.title??"Choose an agent to chat with"}),e[21]=p,e[22]=A?.title,e[23]=c,e[24]=z):z=e[24];let M;e[25]!==U||e[26]!==z?(M=E.jsx(as,{children:E.jsxs(bt,{children:[U,z]})}),e[25]=U,e[26]=z,e[27]=M):M=e[27];let Y;e[28]!==N||e[29]!==n||e[30]!==T?(Y=E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:T,selectedVirtualMcpId:n,onVirtualMcpChange:N,searchInputRef:m})}),e[28]=N,e[29]=n,e[30]=T,e[31]=Y):Y=e[31];let X;return e[32]!==w||e[33]!==P||e[34]!==M||e[35]!==Y?(X=E.jsxs(vr,{open:w,onOpenChange:P,children:[M,Y]}),e[32]=w,e[33]=P,e[34]=M,e[35]=Y,e[36]=X):X=e[36],X}function yL(t){return!t.id||!dr(t.id)}function SL(t,e,n){t.chain().focus().insertContentAt(e,[AL(n),{type:"text",text:" "}]).run()}function AL(t){return{type:"file",attrs:t}}function NL(t){const e=K.c(17),{node:n,selected:r,view:a}=t,{name:i,mimeType:s,data:o}=n.attrs,l=r&&a.editable;let u;e[0]!==s?(u=s.startsWith("image/"),e[0]=s,e[1]=u):u=e[1];const c=u,d=l&&"outline-2 outline-blue-300 outline-offset-0";let p;e[2]!==d?(p=re("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",d),e[2]=d,e[3]=p):p=e[3];let f;e[4]!==i?(f=E.jsx(Et,{asChild:!0,children:E.jsx("span",{children:i})}),e[4]=i,e[5]=f):f=e[5];let m;e[6]!==o||e[7]!==c||e[8]!==s||e[9]!==i?(m=E.jsx(Tt,{side:"top",className:"max-w-sm",children:c?E.jsx("img",{src:`data:${s};base64,${o}`,alt:i,className:"max-w-full max-h-64 object-contain rounded"}):E.jsxs("div",{className:"text-xs",children:[E.jsx("div",{className:"font-medium",children:i}),E.jsx("div",{className:"text-muted-foreground mt-1",children:s})]})}),e[6]=o,e[7]=c,e[8]=s,e[9]=i,e[10]=m):m=e[10];let g;e[11]!==f||e[12]!==m?(g=E.jsxs(bt,{children:[f,m]}),e[11]=f,e[12]=m,e[13]=g):g=e[13];let b;return e[14]!==p||e[15]!==g?(b=E.jsx(Tv,{className:p,children:g}),e[14]=p,e[15]=g,e[16]=b):b=e[16],b}const Rv=Qe.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return yv(NL)}});async function kv(t,e,n,r){if(!B1(e)){Gt.error("Selected model does not support file uploads");return}const a=10*1024*1024;if(n.size>a){Gt.error(`File "${n.name}" exceeds 10MB limit`);return}try{const i=new FileReader,s=new Promise((u,c)=>{i.onload=()=>{const d=i.result;if(typeof d!="string"){c(new Error("Failed to read file as data URL"));return}const p=d.includes(",")?d.split(",")[1]??d:d;u(p)},i.onerror=c});i.readAsDataURL(n);const o=await s,l={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:o};SL(t,{from:r,to:r},l)}catch(i){console.error("Failed to process file:",i),Gt.error(`Failed to load file "${n.name}"`)}}function vL(t){const e=K.c(7),{editor:n,selectedModel:r}=t,a=O.useRef(_L);let i,s;e[0]!==n||e[1]!==r?(i=()=>{a.current=async(u,c)=>{await kv(n,r,u,c)}},s=[n,r],e[0]=n,e[1]=r,e[2]=i,e[3]=s):(i=e[2],s=e[3]),O.useEffect(i,s);let o,l;return e[4]!==n?(o=()=>{if(n?.isDestroyed)return;const u=new Te("fileDropHandler");n.state.plugins.find(p=>p.spec.key===u)&&n.unregisterPlugin(u);const d=new he({key:u,props:{handleDrop:(p,f,m,g)=>{if(g)return!1;const b=f.dataTransfer?.files;if(!b||b.length===0)return!1;f.preventDefault();const y=p.posAtCoords({left:f.clientX,top:f.clientY});if(!y)return!1;const T=Array.from(b),S=y.pos;for(const A of T)a.current?.(A,S);return!0}}});return n.registerPlugin(d),()=>{n?.isDestroyed||n.unregisterPlugin(u)}},l=[n],e[4]=n,e[5]=o,e[6]=l):(o=e[5],l=e[6]),O.useEffect(o,l),null}function _L(){return Promise.resolve()}function CL(t){const e=K.c(20),{selectedModel:n,isStreaming:r}=t,{editor:a}=bv(),i=O.useRef(null);let s;e[0]!==n?(s=B1(n),e[0]=n,e[1]=s):s=e[1];const o=s;let l;e[2]!==a||e[3]!==n?(l=async A=>{const v=A.target.files;if(!v||v.length===0||!a)return;const N=Array.from(v),{from:C}=a.state.selection,k=C;for(const R of N)await kv(a,n,R,k);i.current&&(i.current.value="")},e[2]=a,e[3]=n,e[4]=l):l=e[4];const u=l;if(!a)return null;const c=r||!o;let d;e[5]!==u||e[6]!==c?(d=E.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:u,disabled:c}),e[5]=u,e[6]=c,e[7]=d):d=e[7];const p=r||!o;let f,m;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=()=>i.current?.click(),m=E.jsx(eA,{size:16}),e[8]=f,e[9]=m):(f=e[8],m=e[9]);let g;e[10]!==p?(g=E.jsx(Et,{asChild:!0,children:E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:p,onClick:f,children:m})}),e[10]=p,e[11]=g):g=e[11];const b=o?"Add file":"Selected model does not support files";let y;e[12]!==b?(y=E.jsx(Tt,{side:"top",children:b}),e[12]=b,e[13]=y):y=e[13];let T;e[14]!==y||e[15]!==g?(T=E.jsxs(bt,{children:[g,y]}),e[14]=y,e[15]=g,e[16]=T):T=e[16];let S;return e[17]!==T||e[18]!==d?(S=E.jsxs(E.Fragment,{children:[d,T]}),e[17]=T,e[18]=d,e[19]=S):S=e[19],S}function IL(t={}){return new he({view(e){return new RL(e,t)}})}class RL{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=s=>{this[a](s)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),s=i.width/a.offsetWidth,o=i.height/a.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),g=d?m.bottom:m.top;d&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*o;r={left:m.left,right:m.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;u=d.left-l.scrollLeft*p,c=d.top-l.scrollTop*f}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/o+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=LA(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Se extends oe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Se.valid(r)?new Se(r):oe.near(r)}content(){return Z.empty}eq(e){return e instanceof Se&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Se(e.resolve(n.pos))}getBookmark(){return new Ph(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!kL(e)||!xL(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Se.valid(e))return e;let a=e.pos,i=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){i=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;a+=n;let l=e.doc.resolve(a);if(Se.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!te.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=s,a+=n;let o=e.doc.resolve(a);if(Se.valid(o))return o}return null}}}Se.prototype.visible=!1;Se.findFrom=Se.findGapCursorFrom;oe.jsonID("gapcursor",Se);class Ph{constructor(e){this.pos=e}map(e){return new Ph(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Se.valid(n)?new Se(n):oe.near(n)}}function xv(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function kL(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||xv(a.type))return!0;if(a.inlineContent)return!1}}return!0}function xL(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||xv(a.type))return!0;if(a.inlineContent)return!1}}return!0}function wL(){return new he({props:{decorations:ML,createSelectionBetween(t,e,n){return e.pos==n.pos&&Se.valid(n)?new Se(n):null},handleClick:LL,handleKeyDown:OL,handleDOMEvents:{beforeinput:DL}}})}const OL=DN({ArrowLeft:qa("horiz",-1),ArrowRight:qa("horiz",1),ArrowUp:qa("vert",-1),ArrowDown:qa("vert",1)});function qa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let s=r.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ie){if(!i.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=r.doc.resolve(e>0?o.after():o.before())}let u=Se.findGapCursorFrom(o,e,l);return u?(a&&a(r.tr.setSelection(new Se(u))),!0):!1}}function LL(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Se.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&te.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Se(r))),!0)}function DL(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Se))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=q.empty;for(let s=r.length-1;s>=0;s--)a=q.from(r[s].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Z(a,0,0));return i.setSelection(ie.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ML(t){if(!(t.selection instanceof Se))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ge.create(t.doc,[ze.widget(t.selection.head,e,{key:"gapcursor"})])}var Ni=200,Pe=function(){};Pe.prototype.append=function(e){return e.length?(e=Pe.from(e),!this.length&&e||e.length<Ni&&this.leafAppend(e)||this.length<Ni&&e.leafPrepend(this)||this.appendInner(e)):this};Pe.prototype.prepend=function(e){return e.length?Pe.from(e).append(this):this};Pe.prototype.appendInner=function(e){return new PL(this,e)};Pe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pe.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Pe.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,s){return a.push(e(i,s))},n,r),a};Pe.from=function(e){return e instanceof Pe?e:e&&e.length?new wv(e):Pe.empty};var wv=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,s,o){for(var l=i;l<s;l++)if(a(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(a,i,s,o){for(var l=i-1;l>=s;l--)if(a(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=Ni)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Ni)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Pe);Pe.empty=new wv([]);var PL=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,a,i,s){var o=this.left.length;if(a<o&&this.left.forEachInner(r,a,Math.min(i,o),s)===!1||i>o&&this.right.forEachInner(r,Math.max(a-o,0),Math.min(this.length,i)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,s){var o=this.left.length;if(a>o&&this.right.forEachInvertedInner(r,a-o,Math.max(i,o)-o,s+o)===!1||i<o&&this.left.forEachInvertedInner(r,Math.min(a,o),i,s)===!1)return!1},e.prototype.sliceInner=function(r,a){if(r==0&&a==this.length)return this;var i=this.left.length;return a<=i?this.left.slice(r,a):r>=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Pe);const FL=500;class mt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let s=e.tr,o,l,u=[],c=[];return this.items.forEach((d,p)=>{if(!d.step){a||(a=this.remapping(r,p+1),i=a.maps.length),i--,c.push(d);return}if(a){c.push(new Ct(d.map));let f=d.step.map(a.slice(i)),m;f&&s.maybeStep(f).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new Ct(m,void 0,void 0,u.length+c.length))),i--,m&&a.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return o=a?d.selection.map(a.slice(i)):d.selection,l=new mt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,a){let i=[],s=this.eventCount,o=this.items,l=!a&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),p=new Ct(e.mapping.maps[c],d,n),f;(f=l&&l.merge(p))&&(p=f,c?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(s++,n=void 0),a||(l=p)}let u=s-r.depth;return u>UL&&(o=BL(o,u),s-=u),new mt(o.append(i),s)}remapping(e,n){let r=new da;return this.items.forEach((a,i)=>{let s=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new mt(this.items.append(e.map(n=>new Ct(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},a);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;s=Math.min(s,f);let m=i.maps[f];if(p.step){let g=e.steps[f].invert(e.docs[f]),b=p.selection&&p.selection.map(i.slice(l+1,f));b&&o++,r.push(new Ct(m,g,b))}else r.push(new Ct(m))},a);let u=[];for(let p=n;p<s;p++)u.push(new Ct(i.maps[p]));let c=this.items.slice(0,a).append(u).append(r),d=new mt(c,o);return d.emptyItemCount()>FL&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((s,o)=>{if(o>=e)a.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let d=new Ct(u.invert(),l,c),p,f=a.length-1;(p=a.length&&a[f].merge(d))?a[f]=p:a.push(d)}}else s.map&&r--},this.items.length,0),new mt(Pe.from(a.reverse()),i)}}mt.empty=new mt(Pe.empty,0);function BL(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}class Ct{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ct(n.getMap().invert(),n,this.selection)}}}class tn{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const UL=20;function HL(t,e,n,r){let a=n.getMeta(Fn),i;if(a)return a.historyState;n.getMeta(jL)&&(t=new tn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Fn))return s.getMeta(Fn).redo?new tn(t.done.addTransform(n,void 0,r,ei(e)),t.undone,Vg(n.mapping.maps),t.prevTime,t.prevComposition):new tn(t.done,t.undone.addTransform(n,void 0,r,ei(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!$L(n,t.prevRanges)),u=s?oo(t.prevRanges,n.mapping):Vg(n.mapping.maps);return new tn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ei(e)),mt.empty,u,n.time,o??t.prevComposition)}else return(i=n.getMeta("rebased"))?new tn(t.done.rebased(n,i),t.undone.rebased(n,i),oo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new tn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),oo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function $L(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&a>=e[i]&&(n=!0)}),n}function Vg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,s)=>e.push(i,s));return e}function oo(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let a=e.map(t[r],1),i=e.map(t[r+1],-1);a<=i&&n.push(a,i)}return n}function qL(t,e,n){let r=ei(e),a=Fn.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),o=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),a,r),l=new tn(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(s).setMeta(Fn,{redo:n,historyState:l})}let lo=!1,Wg=null;function ei(t){let e=t.plugins;if(Wg!=e){lo=!1,Wg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lo=!0;break}}return lo}const Fn=new Te("history"),jL=new Te("closeHistory");function zL(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new he({key:Fn,state:{init(){return new tn(mt.empty,mt.empty,null,0,-1)},apply(e,n,r){return HL(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,a=r=="historyUndo"?Lv:r=="historyRedo"?Dv:null;return!a||!e.editable?!1:(n.preventDefault(),a(e.state,e.dispatch))}}}})}function Ov(t,e){return(n,r)=>{let a=Fn.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=qL(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Lv=Ov(!1,!0),Dv=Ov(!0,!0);Ne.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new he({key:new Te("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const s=i-a,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(o,l);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=i-r,u=o-l,c=o;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});var GL=Ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[IL(this.options)]}});Ne.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new he({key:new Te("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return ge.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,u)=>{if(l.isText)return;if(!(a>=u&&a<=u+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,u)=>{if(l.isText||!(a>=u&&a<=u+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";i.push(ze.node(u,u+l.nodeSize,{class:this.options.className}))}),ge.create(t,i)}}})]}});var VL=Ne.create({name:"gapCursor",addProseMirrorPlugins(){return[wL()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=de(ee(t,"allowGapCursor",n)))!=null?e:null}}}),Yg="placeholder";function WL(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var YL=Ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Yg,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${WL(this.options.dataAttribute)}`:`data-${Yg}`;return[new he({key:new Te("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const u=a>=l&&a<=l+o.nodeSize,c=!o.isLeaf&&vs(o);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const p=ze.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:u}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),ge.create(e,i)}}})]}});Ne.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new he({key:new Te("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||XN(n.selection)||t.view.dragging?null:ge.create(n.doc,[ze.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Kg({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var KL=Ne.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Te(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new he({key:e,appendTransaction:(a,i,s)=>{const{doc:o,tr:l,schema:u}=s,c=e.getState(s),d=o.content.size,p=u.nodes[n];if(c)return l.insert(d,p.create())},state:{init:(a,i)=>{const s=i.tr.doc.lastChild;return!Kg({node:s,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const s=a.doc.lastChild;return!Kg({node:s,types:r})}}})]}}),XL=Ne.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Lv(t,e),redo:()=>({state:t,dispatch:e})=>Dv(t,e)}},addProseMirrorPlugins(){return[zL(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()}}}),ZL=YL,vi=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},QL=/^\s*>\s$/,JL=Qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return vi("blockquote",{...Re(this.options.HTMLAttributes,t),children:vi("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const o=e.renderChildren([a]).split(`
101
101
  `).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(o.join(`
102
102
  `))}),r.join(`
103
103
  ${n}
@@ -137,7 +137,7 @@ ${f.slice(u+2)}`,d+=1;else break}e.push({indent:u,number:parseInt(o,10),content:
137
137
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(`
138
138
  `),[i,s]=ZD(a);if(i.length===0)return;const o=Qv(i,0,n);return o.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:o,raw:a.slice(0,s).join(`
139
139
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(JD,this.editor.getAttributes(sb)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=yr({find:ob,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=yr({find:ob,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(sb)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),eM=/^\s*(\[([( |x])?\])\s$/,tM=Qe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Re(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Oh(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),o=document.createElement("input"),l=document.createElement("div"),u=d=>{var p,f;o.ariaLabel=((f=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:f.call(p,d,o.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};u(t),i.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",d=>d.preventDefault()),o.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}const{checked:p}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const m=n();if(typeof m!="number")return!1;const g=f.doc.nodeAt(m);return f.setNodeMarkup(m,void 0,{...g?.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,p])=>{a.setAttribute(d,p)}),a.dataset.checked=t.attrs.checked,o.checked=t.attrs.checked,i.append(o,s),a.append(i,l),Object.entries(e).forEach(([d,p])=>{a.setAttribute(d,p)});let c=new Set(Object.keys(e));return{dom:a,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;a.dataset.checked=d.attrs.checked,o.checked=d.attrs.checked,u(d);const p=r.extensionManager.attributes,f=Er(d,p),m=new Set(Object.keys(f)),g=this.options.HTMLAttributes;return c.forEach(b=>{m.has(b)||(b in g?a.setAttribute(b,g[b]):a.removeAttribute(b))}),Object.entries(f).forEach(([b,y])=>{y==null?b in g?a.setAttribute(b,g[b]):a.removeAttribute(b):a.setAttribute(b,y)}),c=m,!0}}}},addInputRules(){return[yr({find:eM,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),nM=Qe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Re(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
140
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=xf(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},a=xf(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ne.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zv.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Gv.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zv.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Jv.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(tM.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(nM.configure(this.options.taskList)),t}});var lb="&nbsp;",rM=" ",aM=Qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===lb||r[0].text===rM)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?lb:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oM=Yn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Tr({find:iM,type:this.type})]},addPasteRules(){return[zn({find:sM,type:this.type})]}}),lM=Qe.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),uM=Yn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cM=Ne.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(aD.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(JL.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(zv.configure(this.options.bulletList)),this.options.code!==!1&&a.push(oD.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(cD.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(dD.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(GL.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(VL.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(pD.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(fD.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(XL.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(hD.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(TD.configure(this.options.italic)),this.options.listItem!==!1&&a.push(Gv.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(Zv.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(zD.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(Jv.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(aM.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(oM.configure(this.options.strike)),this.options.text!==!1&&a.push(lM.configure(this.options.text)),this.options.underline!==!1&&a.push(uM.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(KL.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),e_=cM;var dM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],qf=dM.join(","),t_=typeof Element>"u",ya=t_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Qi=!t_&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ji=function(e,n){var r;n===void 0&&(n=!0);var a=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=a===""||a==="true",s=i||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Ji(e.parentNode));return s},pM=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},fM=function(e,n,r){if(Ji(e))return[];var a=Array.prototype.slice.apply(e.querySelectorAll(qf));return n&&ya.call(e,qf)&&a.unshift(e),a=a.filter(r),a},jf=function(e,n,r){for(var a=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ji(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=jf(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=ya.call(s,qf);c&&r.filter(s)&&(n||!e.includes(s))&&a.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Ji(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&p){var f=jf(d===!0?s.children:d.children,!0,r);r.flatten?a.push.apply(a,f):a.push({scopeParent:s,candidates:f})}else i.unshift.apply(i,s.children)}}return a},n_=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},r_=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||pM(e))&&!n_(e)?0:e.tabIndex},hM=function(e,n){var r=r_(e);return r<0&&n&&!n_(e)?0:r},mM=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},a_=function(e){return e.tagName==="INPUT"},gM=function(e){return a_(e)&&e.type==="hidden"},bM=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},EM=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},TM=function(e){if(!e.name)return!0;var n=e.form||Qi(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(e.name));else try{a=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=EM(a,e.form);return!i||i===e},yM=function(e){return a_(e)&&e.type==="radio"},SM=function(e){return yM(e)&&!TM(e)},AM=function(e){var n,r=e&&Qi(e),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&a;){var u,c,d;r=Qi(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(a))}}return i},ub=function(e){var n=e.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},NM=function(e,n){var r=n.displayCheck,a=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=ya.call(e,"details>summary:first-of-type"),o=s?e.parentElement:e;if(ya.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof a=="function"){for(var l=e;e;){var u=e.parentElement,c=Qi(e);if(u&&!u.shadowRoot&&a(u)===!0)return ub(e);e.assignedSlot?e=e.assignedSlot:!u&&c!==e.ownerDocument?e=c.host:e=u}e=l}if(AM(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ub(e);return!1},vM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return ya.call(n,"fieldset[disabled] *")?!0:!a.contains(e)}return!0}n=n.parentElement}return!1},_M=function(e,n){return!(n.disabled||gM(n)||NM(n,e)||bM(n)||vM(n))},cb=function(e,n){return!(SM(n)||r_(n)<0||!_M(e,n))},CM=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},i_=function(e){var n=[],r=[];return e.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=hM(o,s),u=s?i_(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(mM).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},s_=function(e,n){n=n||{};var r;return n.getShadowRoot?r=jf([e],n.includeContainer,{filter:cb.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:CM}):r=fM(e,n.includeContainer,cb.bind(null,n)),i_(r)};function IM(){return/apple/i.test(navigator.vendor)}const db="data-floating-ui-focusable";function RM(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function zf(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&IC(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Br(t){return"composedPath"in t?t.composedPath()[0]:t.target}function bo(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function kM(t){return t.matches("html,body")}function Sa(t){return t?.ownerDocument||document}function xM(t){return t?t.hasAttribute(db)?t:t.querySelector("["+db+"]")||t:null}function ni(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var i;return a.parentId===e&&(!n||((i=a.context)==null?void 0:i.open))}).flatMap(a=>[a,...ni(t,a.id,n)])}function wM(t){return"nativeEvent"in t}var OM=typeof document<"u",LM=function(){},Bn=OM?O.useLayoutEffect:LM;const DM={...M1},MM=DM.useInsertionEffect,PM=MM||(t=>t());function ar(t){const e=O.useRef(()=>{});return PM(()=>{e.current=t}),O.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e.current==null?void 0:e.current(...r)},[])}const o_=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function l_(t,e){const n=s_(t,o_()),r=n.length;if(r===0)return;const a=RM(Sa(t)),i=n.indexOf(a),s=i===-1?e===1?0:r-1:i+e;return n[s]}function FM(t){return l_(Sa(t).body,1)||t}function BM(t){return l_(Sa(t).body,-1)||t}function Eo(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!zf(n,r)}function UM(t){s_(t,o_()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function pb(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const HM="data-floating-ui-focusable",fb="active",hb="selected",$M={...M1};let mb=!1,qM=0;const gb=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+qM++;function jM(){const[t,e]=O.useState(()=>mb?gb():void 0);return Bn(()=>{t==null&&e(gb())},[]),O.useEffect(()=>{mb=!0},[]),t}const zM=$M.useId,Wh=zM||jM;function GM(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const VM=O.createContext(null),WM=O.createContext(null),u_=()=>{var t;return((t=O.useContext(VM))==null?void 0:t.id)||null},c_=()=>O.useContext(WM);function Yh(t){return"data-floating-ui-"+t}const YM={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},bb=O.forwardRef(function(e,n){const[r,a]=O.useState();Bn(()=>{IM()&&a("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Yh("focus-guard")]:"",style:YM};return E.jsx("span",{...e,...i})}),KM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},d_=O.createContext(null),Eb=Yh("portal");function XM(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Wh(),a=QM(),[i,s]=O.useState(null),o=O.useRef(null);return Bn(()=>()=>{i?.remove(),queueMicrotask(()=>{o.current=null})},[i]),Bn(()=>{if(!r||o.current)return;const l=e?document.getElementById(e):null;if(!l)return;const u=document.createElement("div");u.id=r,u.setAttribute(Eb,""),l.appendChild(u),o.current=u,s(u)},[e,r]),Bn(()=>{if(n===null||!r||o.current)return;let l=n||a?.portalNode;l&&!LC(l)&&(l=l.current),l=l||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,l.appendChild(u));const c=document.createElement("div");c.id=r,c.setAttribute(Eb,""),l=u||l,l.appendChild(c),o.current=c,s(c)},[e,n,r,a]),i}function ZM(t){const{children:e,id:n,root:r,preserveTabOrder:a=!0}=t,i=XM({id:n,root:r}),[s,o]=O.useState(null),l=O.useRef(null),u=O.useRef(null),c=O.useRef(null),d=O.useRef(null),p=s?.modal,f=s?.open,m=!!s&&!s.modal&&s.open&&a&&!!(r||i);return O.useEffect(()=>{if(!i||!a||p)return;function g(b){i&&Eo(b)&&(b.type==="focusin"?pb:UM)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,a,p]),O.useEffect(()=>{i&&(f||pb(i))},[f,i]),E.jsxs(d_.Provider,{value:O.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:o}),[a,i]),children:[m&&i&&E.jsx(bb,{"data-type":"outside",ref:l,onFocus:g=>{if(Eo(g,i)){var b;(b=c.current)==null||b.focus()}else{const y=s?s.domReference:null,T=BM(y);T?.focus()}}}),m&&i&&E.jsx("span",{"aria-owns":i.id,style:KM}),i&&D1.createPortal(e,i),m&&i&&E.jsx(bb,{"data-type":"outside",ref:u,onFocus:g=>{if(Eo(g,i)){var b;(b=d.current)==null||b.focus()}else{const y=s?s.domReference:null,T=FM(y);T?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const QM=()=>O.useContext(d_),JM={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},e3={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Tb=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function t3(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:a,dataRef:i}=t,{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:m}=e,g=c_(),b=ar(typeof l=="function"?l:()=>!1),y=typeof l=="function"?b:l,T=O.useRef(!1),{escapeKey:S,outsidePress:A}=Tb(f),{escapeKey:v,outsidePress:N}=Tb(m),C=O.useRef(!1),k=ar(B=>{var G;if(!n||!s||!o||B.key!=="Escape"||C.current)return;const U=(G=i.current.floatingContext)==null?void 0:G.nodeId,z=g?ni(g.nodesRef.current,U):[];if(!S&&(B.stopPropagation(),z.length>0)){let M=!0;if(z.forEach(Y=>{var X;if((X=Y.context)!=null&&X.open&&!Y.context.dataRef.current.__escapeKeyBubbles){M=!1;return}}),!M)return}r(!1,wM(B)?B.nativeEvent:B,"escape-key")}),R=ar(B=>{var G;const U=()=>{var z;k(B),(z=Br(B))==null||z.removeEventListener("keydown",U)};(G=Br(B))==null||G.addEventListener("keydown",U)}),D=ar(B=>{var G;const U=i.current.insideReactTree;i.current.insideReactTree=!1;const z=T.current;if(T.current=!1,u==="click"&&z||U||typeof y=="function"&&!y(B))return;const M=Br(B),Y="["+Yh("inert")+"]",X=Sa(a.floating).querySelectorAll(Y);let W=kt(M)?M:null;for(;W&&!qs(W);){const J=xC(W);if(qs(J)||!kt(J))break;W=J}if(X.length&&kt(M)&&!kM(M)&&!zf(M,a.floating)&&Array.from(X).every(J=>!zf(W,J)))return;if(wC(M)&&$){const J=qs(M),le=OC(M),ce=/auto|scroll/,be=J||ce.test(le.overflowX),ve=J||ce.test(le.overflowY),ke=be&&M.clientWidth>0&&M.scrollWidth>M.clientWidth,Fe=ve&&M.clientHeight>0&&M.scrollHeight>M.clientHeight,Lt=le.direction==="rtl",qe=Fe&&(Lt?B.offsetX<=M.offsetWidth-M.clientWidth:B.offsetX>M.clientWidth),St=ke&&B.offsetY>M.clientHeight;if(qe||St)return}const ae=(G=i.current.floatingContext)==null?void 0:G.nodeId,Q=g&&ni(g.nodesRef.current,ae).some(J=>{var le;return bo(B,(le=J.context)==null?void 0:le.elements.floating)});if(bo(B,a.floating)||bo(B,a.domReference)||Q)return;const ne=g?ni(g.nodesRef.current,ae):[];if(ne.length>0){let J=!0;if(ne.forEach(le=>{var ce;if((ce=le.context)!=null&&ce.open&&!le.context.dataRef.current.__outsidePressBubbles){J=!1;return}}),!J)return}r(!1,B,"outside-press")}),w=ar(B=>{var G;const U=()=>{var z;D(B),(z=Br(B))==null||z.removeEventListener(u,U)};(G=Br(B))==null||G.addEventListener(u,U)});O.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=S,i.current.__outsidePressBubbles=A;let B=-1;function G(X){r(!1,X,"ancestor-scroll")}function U(){window.clearTimeout(B),C.current=!0}function z(){B=window.setTimeout(()=>{C.current=!1},kC()?5:0)}const M=Sa(a.floating);o&&(M.addEventListener("keydown",v?R:k,v),M.addEventListener("compositionstart",U),M.addEventListener("compositionend",z)),y&&M.addEventListener(u,N?w:D,N);let Y=[];return p&&(kt(a.domReference)&&(Y=$s(a.domReference)),kt(a.floating)&&(Y=Y.concat($s(a.floating))),!kt(a.reference)&&a.reference&&a.reference.contextElement&&(Y=Y.concat($s(a.reference.contextElement)))),Y=Y.filter(X=>{var W;return X!==((W=M.defaultView)==null?void 0:W.visualViewport)}),Y.forEach(X=>{X.addEventListener("scroll",G,{passive:!0})}),()=>{o&&(M.removeEventListener("keydown",v?R:k,v),M.removeEventListener("compositionstart",U),M.removeEventListener("compositionend",z)),y&&M.removeEventListener(u,N?w:D,N),Y.forEach(X=>{X.removeEventListener("scroll",G)}),window.clearTimeout(B)}},[i,a,o,y,u,n,r,p,s,S,A,k,v,R,D,N,w]),O.useEffect(()=>{i.current.insideReactTree=!1},[i,y,u]);const P=O.useMemo(()=>({onKeyDown:k,...c&&{[JM[d]]:B=>{r(!1,B.nativeEvent,"reference-press")},...d!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[k,r,c,d]),$=O.useMemo(()=>({onKeyDown:k,onMouseDown(){T.current=!0},onMouseUp(){T.current=!0},[e3[u]]:()=>{i.current.insideReactTree=!0}}),[k,u,i]);return O.useMemo(()=>s?{reference:P,floating:$}:{},[s,P,$])}function n3(t){const{open:e=!1,onOpenChange:n,elements:r}=t,a=Wh(),i=O.useRef({}),[s]=O.useState(()=>GM()),o=u_()!=null,[l,u]=O.useState(r.reference),c=ar((f,m,g)=>{i.current.openEvent=f?m:void 0,s.emit("openchange",{open:f,event:m,reason:g,nested:o}),n?.(f,m,g)}),d=O.useMemo(()=>({setPositionReference:u}),[]),p=O.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return O.useMemo(()=>({dataRef:i,open:e,onOpenChange:c,elements:p,events:s,floatingId:a,refs:d}),[e,c,p,s,a,d])}function r3(t){t===void 0&&(t={});const{nodeId:e}=t,n=n3({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,a=r.elements,[i,s]=O.useState(null),[o,l]=O.useState(null),c=a?.domReference||i,d=O.useRef(null),p=c_();Bn(()=>{c&&(d.current=c)},[c]);const f=RC({...t,elements:{...a,...o&&{reference:o}}}),m=O.useCallback(S=>{const A=kt(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;l(A),f.refs.setReference(A)},[f.refs]),g=O.useCallback(S=>{(kt(S)||S===null)&&(d.current=S,s(S)),(kt(f.refs.reference.current)||f.refs.reference.current===null||S!==null&&!kt(S))&&f.refs.setReference(S)},[f.refs]),b=O.useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:d}),[f.refs,g,m]),y=O.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),T=O.useMemo(()=>({...f,...r,refs:b,elements:y,nodeId:e}),[f,b,y,e,r]);return Bn(()=>{r.dataRef.current.floatingContext=T;const S=p?.nodesRef.current.find(A=>A.id===e);S&&(S.context=T)}),O.useMemo(()=>({...f,context:T,refs:b,elements:y}),[f,b,y,T])}function To(t,e,n){const r=new Map,a=n==="item";let i=t;if(a&&t){const{[fb]:s,[hb]:o,...l}=t;i=l}return{...n==="floating"&&{tabIndex:-1,[HM]:""},...i,...e.map(s=>{const o=s?s[n]:null;return typeof o=="function"?t?o(t):null:o}).concat(t).reduce((s,o)=>(o&&Object.entries(o).forEach(l=>{let[u,c]=l;if(!(a&&[fb,hb].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof c=="function"){var d;(d=r.get(u))==null||d.push(c),s[u]=function(){for(var p,f=arguments.length,m=new Array(f),g=0;g<f;g++)m[g]=arguments[g];return(p=r.get(u))==null?void 0:p.map(b=>b(...m)).find(b=>b!==void 0)}}}else s[u]=c}),s),{})}}function a3(t){t===void 0&&(t=[]);const e=t.map(o=>o?.reference),n=t.map(o=>o?.floating),r=t.map(o=>o?.item),a=O.useCallback(o=>To(o,t,"reference"),e),i=O.useCallback(o=>To(o,t,"floating"),n),s=O.useCallback(o=>To(o,t,"item"),r);return O.useMemo(()=>({getReferenceProps:a,getFloatingProps:i,getItemProps:s}),[a,i,s])}const i3=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function s3(t,e){var n,r;e===void 0&&(e={});const{open:a,elements:i,floatingId:s}=t,{enabled:o=!0,role:l="dialog"}=e,u=Wh(),c=((n=i.domReference)==null?void 0:n.id)||u,d=O.useMemo(()=>{var T;return((T=xM(i.floating))==null?void 0:T.id)||s},[i.floating,s]),p=(r=i3.get(l))!=null?r:l,m=u_()!=null,g=O.useMemo(()=>p==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:a?d:void 0}:{"aria-expanded":a?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":a?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:c},...p==="menu"&&m&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[p,d,m,a,c,l]),b=O.useMemo(()=>{const T={id:d,...p&&{role:p}};return p==="tooltip"||l==="label"?T:{...T,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,l]),y=O.useCallback(T=>{let{active:S,selected:A}=T;const v={role:"option",...S&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...v,"aria-selected":A}}return{}},[d,l]);return O.useMemo(()=>o?{reference:g,floating:b,item:y}:{},[o,g,b,y])}function o3(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:s,$position:o}=t,l=r&&!a,u=wO(n),c=new RegExp(`\\s${u}$`),d=s?"^":"",p=a?"":u,f=l?new RegExp(`${d}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=o.nodeBefore)==null?void 0:e.isText)&&o.nodeBefore.text;if(!m)return null;const g=o.pos-m.length,b=Array.from(m.matchAll(f)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),T=new RegExp(`^[${i?.join("")}\0]?$`).test(y);if(i!==null&&!T)return null;const S=g+b.index;let A=S+b[0].length;return l&&c.test(m.slice(A-1,A+1))&&(b[0]+=" ",A+=1),S<o.pos&&A>=o.pos?{range:{from:S,to:A},query:b[0].slice(n.length),text:b[0]}:null}var l3=new Te("suggestion");function u3({pluginKey:t=l3,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:c="is-empty",command:d=()=>null,items:p=()=>[],render:f=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=o3,shouldShow:b}){let y;const T=f?.(),S=()=>{const C=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(C),{top:R,right:D,bottom:w,left:P}=k;try{return new DOMRect(P,R,D-P,w-R)}catch{return null}},A=(C,k)=>k?()=>{const R=t.getState(e.state),D=R?.decorationId,w=C.dom.querySelector(`[data-decoration-id="${D}"]`);return w?.getBoundingClientRect()||null}:S;function v(C,k){var R;try{const w=t.getState(C.state),P=w?.decorationId?C.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`):null,$={editor:e,range:w?.range||{from:0,to:0},query:w?.query||null,text:w?.text||null,items:[],command:B=>d({editor:e,range:w?.range||{from:0,to:0},props:B}),decorationNode:P,clientRect:A(C,P)};(R=T?.onExit)==null||R.call(T,$)}catch{}const D=C.state.tr.setMeta(k,{exit:!0});C.dispatch(D)}const N=new he({key:t,view(){return{update:async(C,k)=>{var R,D,w,P,$,B,G;const U=(R=this.key)==null?void 0:R.getState(k),z=(D=this.key)==null?void 0:D.getState(C.state),M=U.active&&z.active&&U.range.from!==z.range.from,Y=!U.active&&z.active,X=U.active&&!z.active,W=!Y&&!X&&U.query!==z.query,ae=Y||M&&W,Q=W||M,ne=X||M&&W;if(!ae&&!Q&&!ne)return;const J=ne&&!ae?U:z,le=C.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);y={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ce=>d({editor:e,range:J.range,props:ce}),decorationNode:le,clientRect:A(C,le)},ae&&((w=T?.onBeforeStart)==null||w.call(T,y)),Q&&((P=T?.onBeforeUpdate)==null||P.call(T,y)),(Q||ae)&&(y.items=await p({editor:e,query:J.query})),ne&&(($=T?.onExit)==null||$.call(T,y)),Q&&((B=T?.onUpdate)==null||B.call(T,y)),ae&&((G=T?.onStart)==null||G.call(T,y))},destroy:()=>{var C;y&&((C=T?.onExit)==null||C.call(T,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,k,R,D){const{isEditable:w}=e,{composing:P}=e.view,{selection:$}=C,{empty:B,from:G}=$,U={...k},z=C.getMeta(t);if(z&&z.exit)return U.active=!1,U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null,U;if(U.composing=P,w&&(B||e.view.composing)){(G<k.range.from||G>k.range.to)&&!P&&!k.composing&&(U.active=!1);const M=g({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:s,$position:$.$from}),Y=`id_${Math.floor(Math.random()*4294967295)}`;M&&m({editor:e,state:D,range:M.range,isActive:k.active})&&(!b||b({editor:e,range:M.range,query:M.query,text:M.text,transaction:C}))?(U.active=!0,U.decorationId=k.decorationId?k.decorationId:Y,U.range=M.range,U.query=M.query,U.text=M.text):U.active=!1}else U.active=!1;return U.active||(U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null),U}},props:{handleKeyDown(C,k){var R,D,w,P;const{active:$,range:B}=N.getState(C.state);if(!$)return!1;if(k.key==="Escape"||k.key==="Esc"){const U=N.getState(C.state),z=(R=y?.decorationNode)!=null?R:null,M=z??(U?.decorationId?C.dom.querySelector(`[data-decoration-id="${U.decorationId}"]`):null);if(((D=T?.onKeyDown)==null?void 0:D.call(T,{view:C,event:k,range:U.range}))||!1)return!0;const X={editor:e,range:U.range,query:U.query,text:U.text,items:[],command:W=>d({editor:e,range:U.range,props:W}),decorationNode:M,clientRect:M?()=>M.getBoundingClientRect()||null:null};return(w=T?.onExit)==null||w.call(T,X),v(C,t),!0}return((P=T?.onKeyDown)==null?void 0:P.call(T,{view:C,event:k,range:B}))||!1},decorations(C){const{active:k,range:R,decorationId:D,query:w}=N.getState(C);if(!k)return null;const P=!w?.length,$=[l];return P&&$.push(c),ge.create(C.doc,[ze.inline(R.from,R.to,{nodeName:o,class:$.join(" "),"data-decoration-id":D,"data-decoration-content":u})])}}});return N}function c3(t){const e=K.c(26),{editor:n,query:r,items:a,onSelect:i,onClose:s}=t,[o,l]=O.useState(0),u=O.useRef(a),c=O.useRef(o),d=O.useRef(i),p=O.useRef(s),f=O.useDeferredValue(r);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{l(0)},e[0]=m):m=e[0];let g;e[1]!==f?(g=[f],e[1]=f,e[2]=g):g=e[2],O.useEffect(m,g);let b,y;e[3]!==a.length||e[4]!==o?(b=()=>{o>=a.length&&a.length>0&&l(0)},y=[a.length,o],e[3]=a.length,e[4]=o,e[5]=b,e[6]=y):(b=e[5],y=e[6]),O.useEffect(b,y);let T,S;e[7]!==a?(T=()=>{u.current=a},S=[a],e[7]=a,e[8]=T,e[9]=S):(T=e[8],S=e[9]),O.useEffect(T,S);let A,v;e[10]!==o?(A=()=>{c.current=o},v=[o],e[10]=o,e[11]=A,e[12]=v):(A=e[11],v=e[12]),O.useEffect(A,v);let N,C;e[13]!==i?(C=()=>{d.current=i},N=[i],e[13]=i,e[14]=N,e[15]=C):(N=e[14],C=e[15]),O.useEffect(C,N);let k,R;e[16]!==s?(k=()=>{p.current=s},R=[s],e[16]=s,e[17]=k,e[18]=R):(k=e[17],R=e[18]),O.useEffect(k,R);let D;e[19]!==n.isDestroyed||e[20]!==n.view.dom?(D=()=>{const B=n.view.dom;if(n?.isDestroyed||!B)return;const G=z=>{const M=u.current;if(!M.length)return!1;const Y=()=>l(W=>(W+1)%M.length),X=()=>l(W=>(W-1+M.length)%M.length);switch(z.key){case"ArrowUp":return z.preventDefault(),X(),!0;case"ArrowDown":return z.preventDefault(),Y(),!0;case"Tab":return z.preventDefault(),z.shiftKey?X():Y(),!0;case"Home":return z.preventDefault(),l(0),!0;case"End":return z.preventDefault(),l(M.length-1),!0;case"Enter":{if(z.isComposing)return!1;z.preventDefault();const W=c.current;return W!==-1&&M[W]&&d.current?.(M[W],W),!0}case"Escape":return z.preventDefault(),p.current?.(),!0;default:return!1}},U=z=>{G(z)};return B.addEventListener("keydown",U,!0),()=>{B?.removeEventListener("keydown",U,!0)}},e[19]=n.isDestroyed,e[20]=n.view.dom,e[21]=D):D=e[21];let w;e[22]!==n?(w=[n],e[22]=n,e[23]=w):w=e[23],O.useEffect(D,w);const P=a.length?o:void 0;let $;return e[24]!==P?($={selectedIndex:P,setSelectedIndex:l},e[24]=P,e[25]=$):$=e[25],$}function d3(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const p_=O.createContext(void 0);function f_(){const t=O.useContext(p_);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function p3(t){const e=K.c(8),{editor:n,char:r,pluginKey:a}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=i):i=e[0];const[s,o]=O.useReducer(d3,i);let l,u;e[1]!==r||e[2]!==n||e[3]!==a?(l=()=>{if(n?.isDestroyed)return;const d=a instanceof Te?a:new Te(a);n.state.plugins.find(m=>m.spec.key===d)&&n.unregisterPlugin(d);const f=u3({pluginKey:d,editor:n,char:r,allow(m){const g=n.state.doc.resolve(m.range.from);for(let b=g.depth;b>0;b--)if(g.node(b).type.name==="image")return!1;return!0},command(){},render:()=>({onStart:m=>{o({type:"ON_START",payload:{element:m.decorationNode??null,query:m.query,range:m.range}})},onUpdate:m=>{o({type:"ON_UPDATE",payload:{element:m.decorationNode??null,query:m.query,range:m.range}})},onKeyDown:m=>m.event.key==="Escape"?(o({type:"ON_EXIT"}),!0):!1,onExit:()=>{o({type:"ON_EXIT"})}}),items:f3});return n.registerPlugin(f),()=>{n?.isDestroyed||n.unregisterPlugin(d)}},u=[n,a,r,o],e[1]=r,e[2]=n,e[3]=a,e[4]=l,e[5]=u):(l=e[4],u=e[5]),O.useEffect(l,u);let c;return e[6]!==s?(c={state:s,dispatch:o},e[6]=s,e[7]=c):c=e[7],c}function f3(){return[]}function h3({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:a,dispatch:i}=f_(),s=O.useDeferredValue(a.query),{data:o}=DC({queryKey:th.suggestionItems(e,a.open,s),queryFn:()=>a.open?n({query:s}):[]}),l=()=>{i({type:"ON_EXIT"})},u=async(d,p)=>{if(!(a.selectedItem!==null||!a.range)){i({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,g=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),b=a.range?{...a.range}:{from:0,to:0};g&&a.range&&(b.to+=1),await r({range:b,item:d})}finally{l()}}},{selectedIndex:c}=c3({editor:t,query:s,items:o,onSelect:u,onClose:l});return{selectedItem:a.selectedItem,items:o,selectedIndex:c,close:l,onSelect:u}}function m3({children:t}){const{state:e,dispatch:n}=f_(),{open:r,element:a}=e,i=()=>{n({type:"ON_EXIT"})},{refs:s,floatingStyles:o,context:l}=r3({placement:"bottom-start",open:r,onOpenChange:p=>{p||i()},elements:{reference:a},middleware:[MC(10),PC(),FC()],whileElementsMounted:BC}),u=t3(l,{outsidePress:p=>!(p.target instanceof Element&&p.target.closest(".ProseMirror"))}),c=s3(l,{role:"listbox"}),{getFloatingProps:d}=a3([u,c]);return r?E.jsx(ZM,{children:E.jsx("div",{ref:s.setFloating,style:o,...d(),className:"z-50 w-auto min-w-[280px] max-w-[400px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const g3=t=>{const e=K.c(23),{item:n,isSelected:r,onSelect:a,isLoading:i,ref:s}=t,o=r&&"bg-accent text-accent-foreground",l=i&&"pointer-events-none opacity-50";let u;e[0]!==o||e[1]!==l?(u=re("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",o,l),e[0]=o,e[1]=l,e[2]=u):u=e[2];let c;e[3]!==n.name||e[4]!==n.title?(c=n.title||n.name.replace(/_/g," "),e[3]=n.name,e[4]=n.title,e[5]=c):c=e[5];let d;e[6]!==c?(d=E.jsx("span",{className:"font-medium flex items-center truncate",children:c}),e[6]=c,e[7]=d):d=e[7];let p;e[8]!==i?(p=i&&E.jsx(rs,{size:"xs"}),e[8]=i,e[9]=p):p=e[9];let f;e[10]!==d||e[11]!==p?(f=E.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d,p]}),e[10]=d,e[11]=p,e[12]=f):f=e[12];let m;e[13]!==n.description?(m=n.description&&E.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:n.description}),e[13]=n.description,e[14]=m):m=e[14];let g;e[15]!==f||e[16]!==m?(g=E.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[f,m]}),e[15]=f,e[16]=m,e[17]=g):g=e[17];let b;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==g?(b=E.jsx("div",{ref:s,onClick:a,className:u,children:g}),e[18]=a,e[19]=s,e[20]=u,e[21]=g,e[22]=b):b=e[22],b},b3=t=>{const e=K.c(18),{editor:n,queryKey:r,queryFn:a,onSelect:i}=t;let s;e[0]!==n||e[1]!==i||e[2]!==a||e[3]!==r?(s={editor:n,queryKey:r,queryFn:a,onSelect:i},e[0]=n,e[1]=i,e[2]=a,e[3]=r,e[4]=s):s=e[4];const{items:o,selectedIndex:l,onSelect:u,selectedItem:c}=h3(s);if(!o.length){let m;return e[5]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("div",{className:"min-w-[280px] max-w-[400px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=m):m=e[5],m}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d={maxHeight:"min(217px, var(--radix-popover-content-available-height, 217px))"},e[6]=d):d=e[6];let p;if(e[7]!==u||e[8]!==o||e[9]!==l||e[10]!==c?.name){let m;e[12]!==u||e[13]!==l||e[14]!==c?.name?(m=(g,b)=>E.jsx(g3,{item:g,isSelected:b===l,ref:b===l?y3:void 0,onSelect:()=>u(g,b),isLoading:c?.name===g.name},g.name),e[12]=u,e[13]=l,e[14]=c?.name,e[15]=m):m=e[15],p=o.map(m),e[7]=u,e[8]=o,e[9]=l,e[10]=c?.name,e[11]=p}else p=e[11];let f;return e[16]!==p?(f=E.jsx("div",{className:"min-w-[280px] max-w-[400px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:d,children:E.jsx("div",{className:"p-1",children:p})}),e[16]=p,e[17]=f):f=e[17],f};function E3(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsx("div",{className:"p-1",children:[...Array(3)].map(T3)}),t[0]=e):e=t[0],e}function T3(t,e){return E.jsxs("div",{className:"px-2 py-1.5 h-[44px] animate-pulse",children:[E.jsx("div",{className:"h-4 w-24 bg-muted rounded mb-1"}),E.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function h_(t){const e=K.c(16),{editor:n,char:r,pluginKey:a,queryKey:i,queryFn:s,onSelect:o}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a?(l={editor:n,char:r,pluginKey:a},e[0]=r,e[1]=n,e[2]=a,e[3]=l):l=e[3];const{state:u,dispatch:c}=p3(l);let d;e[4]!==c||e[5]!==u?(d={state:u,dispatch:c},e[4]=c,e[5]=u,e[6]=d):d=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=E.jsx(E3,{}),e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==o||e[10]!==s||e[11]!==i?(f=E.jsx(m3,{children:E.jsx(O.Suspense,{fallback:p,children:E.jsx(b3,{editor:n,queryKey:i,queryFn:s,onSelect:o})})}),e[8]=n,e[9]=o,e[10]=s,e[11]=i,e[12]=f):f=e[12];let m;return e[13]!==d||e[14]!==f?(m=E.jsx(p_.Provider,{value:d,children:f}),e[13]=d,e[14]=f,e[15]=m):m=e[15],m}function y3(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}async function yb(t,e,n,r,a){try{const i=await z1(n,r,a);Nv(t,e,{id:r,name:r,metadata:i.messages,char:"/"})}catch(i){console.error("[prompt] Failed to fetch prompt:",i),Gt.error("Failed to load prompt. Please try again.")}}const S3=t=>{const e=K.c(29),{editor:n,virtualMcpId:r}=t,a=P1(),{org:i}=Nr();let s;e[0]!==i.id||e[1]!==r?(s={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==i.id||e[4]!==r?(l=th.virtualMcpPrompts(r,i.id),e[3]=i.id,e[4]=r,e[5]=l):l=e[5];const u=l,[c,d]=O.useState(null);let p;e[6]!==o||e[7]!==n?(p=async C=>{const{item:k,range:R}=C;if(k.arguments&&k.arguments.length>0){d({range:R,item:k});return}o&&await yb(n,R,o,k.name)},e[6]=o,e[7]=n,e[8]=p):p=e[8];const f=p;let m;e[9]!==c||e[10]!==o||e[11]!==n?(m=async C=>{if(!c||!o)return;const{range:k,item:R}=c;await yb(n,k,o,R.name,C),d(null)},e[9]=c,e[10]=o,e[11]=n,e[12]=m):m=e[12];const g=m;let b;e[13]!==o||e[14]!==a||e[15]!==u?(b=async C=>{const{query:k}=C;if(!o)return[];let R=a.getQueryData(u);if(R?a.fetchQuery({queryKey:u,queryFn:()=>Tm(o),staleTime:6e4}).catch(A3):R=await a.fetchQuery({queryKey:u,queryFn:()=>Tm(o),staleTime:6e4}),!R.prompts)return[];let D=R.prompts;if(k.trim()){const w=k.toLowerCase();D=R.prompts.filter(P=>P.name.toLowerCase().includes(w)||P.title?.toLowerCase().includes(w)||P.description?.toLowerCase().includes(w))}return D},e[13]=o,e[14]=a,e[15]=u,e[16]=b):b=e[16];const y=b;let T;e[17]!==n||e[18]!==y||e[19]!==f||e[20]!==u?(T=E.jsx(h_,{editor:n,char:"/",pluginKey:"promptsDropdownMenu",queryKey:u,queryFn:y,onSelect:f}),e[17]=n,e[18]=y,e[19]=f,e[20]=u,e[21]=T):T=e[21];const S=c?.item??null;let A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=()=>d(null),e[22]=A):A=e[22];let v;e[23]!==g||e[24]!==S?(v=E.jsx(sA,{prompt:S,setPrompt:A,onSubmit:g}),e[23]=g,e[24]=S,e[25]=v):v=e[25];let N;return e[26]!==T||e[27]!==v?(N=E.jsxs(E.Fragment,{children:[T,v]}),e[26]=T,e[27]=v,e[28]=N):N=e[28],N};function A3(){}async function N3(t,e,n,r){try{const a=await XC(n,r);Nv(t,e,{id:r,name:r,metadata:a.contents,char:"@"})}catch(a){console.error("[resource] Failed to fetch resource:",a),Gt.error("Failed to load resource. Please try again.")}}const v3=t=>{const e=K.c(18),{editor:n,virtualMcpId:r}=t,a=P1(),{org:i}=Nr();let s;e[0]!==i.id||e[1]!==r?(s={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==i.id||e[4]!==r?(l=th.virtualMcpResources(r,i.id),e[3]=i.id,e[4]=r,e[5]=l):l=e[5];const u=l;let c;e[6]!==o||e[7]!==n?(c=async g=>{const{item:b,range:y}=g;o&&await N3(n,y,o,b.uri)},e[6]=o,e[7]=n,e[8]=c):c=e[8];const d=c;let p;e[9]!==o||e[10]!==a||e[11]!==u?(p=async g=>{const{query:b}=g;if(!o)return[];let y=a.getQueryData(u);if(y?a.fetchQuery({queryKey:u,queryFn:()=>ym(o),staleTime:6e4}).catch(_3):y=await a.fetchQuery({queryKey:u,queryFn:()=>ym(o),staleTime:6e4}),!y.resources)return[];let T=y.resources;if(b.trim()){const S=b.toLowerCase();T=y.resources.filter(A=>A.uri.toLowerCase().includes(S)||A.name?.toLowerCase().includes(S)||A.description?.toLowerCase().includes(S))}return T.map(C3)},e[9]=o,e[10]=a,e[11]=u,e[12]=p):p=e[12];const f=p;let m;return e[13]!==n||e[14]!==f||e[15]!==d||e[16]!==u?(m=E.jsx(h_,{editor:n,char:"@",pluginKey:"resourcesDropdownMenu",queryKey:u,queryFn:f,onSelect:d}),e[13]=n,e[14]=f,e[15]=d,e[16]=u,e[17]=m):m=e[17],m};function _3(){}function C3(t){return{name:t.name??t.uri,title:t.name,description:t.description,uri:t.uri}}const I3=[e_.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),ZL.configure({placeholder:"Ask anything, / for prompts, @ for resources...",showOnlyWhenEditable:!1}),_v,Rv];function R3(t){const e=K.c(22),{tiptapDoc:n,setTiptapDoc:r,selectedModel:a,isStreaming:i,onSubmit:s,children:o}=t,l=i||!a,u=O.useRef(s),c=O.useRef(r),d=n||"",p=!l;let f,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(D,w)=>w.key==="Enter"&&!w.shiftKey?(w.preventDefault(),u.current?.(),!0):!1},m=D=>{const{editor:w}=D;c.current(w?.getJSON())},e[0]=f,e[1]=m):(f=e[0],m=e[1]);let g;e[2]!==d||e[3]!==p?(g={extensions:I3,content:d,editable:p,editorProps:f,onUpdate:m},e[2]=d,e[3]=p,e[4]=g):g=e[4];let b;e[5]!==l?(b=[l],e[5]=l,e[6]=b):b=e[6];const y=gv(g,b);let T,S;e[7]!==s?(T=()=>{u.current=s},S=[s],e[7]=s,e[8]=T,e[9]=S):(T=e[8],S=e[9]),O.useEffect(T,S);let A,v;e[10]!==r?(v=()=>{c.current=r},A=[r],e[10]=r,e[11]=A,e[12]=v):(A=e[11],v=e[12]),O.useEffect(v,A);let N,C;e[13]!==y||e[14]!==n?(N=()=>{if(y?.isDestroyed)return;const D=JSON.stringify(y?.getJSON()),w=JSON.stringify(n||{type:"doc",content:[]});D!==w&&y.commands.setContent(n||{type:"doc",content:[]})},C=[y,n],e[13]=y,e[14]=n,e[15]=N,e[16]=C):(N=e[15],C=e[16]),O.useEffect(N,C);let k;e[17]!==y?(k={editor:y},e[17]=y,e[18]=k):k=e[18];let R;return e[19]!==o||e[20]!==k?(R=E.jsx(Is.Provider,{value:k,children:o}),e[19]=o,e[20]=k,e[21]=R):R=e[21],R}function k3(t){const e=K.c(24),{selectedModel:n,isStreaming:r,selectedVirtualMcp:a,ref:i}=t,{editor:s}=bv(),o=a?.id??null,l=r||!n;let u;e[0]!==s?.commands?(u=()=>({focus:()=>{s?.commands.focus()},clear:()=>{s?.commands.clearContent(!0)}}),e[0]=s?.commands,e[1]=u):u=e[1];let c;if(e[2]!==s?(c=[s],e[2]=s,e[3]=c):c=e[3],O.useImperativeHandle(i??null,u,c),!s)return null;const d=l&&"cursor-not-allowed opacity-70",p=l&&"[&_.ProseMirror]:cursor-not-allowed";let f;e[4]!==d||e[5]!==p?(f=re("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col","[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",d,p),e[4]=d,e[5]=p,e[6]=f):f=e[6];let m;e[7]!==s||e[8]!==f?(m=E.jsx(Lh,{editor:s,className:f}),e[7]=s,e[8]=f,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==o?(g=E.jsx(O.Suspense,{fallback:null,children:E.jsx(S3,{editor:s,virtualMcpId:o})}),e[10]=s,e[11]=o,e[12]=g):g=e[12];let b;e[13]!==s||e[14]!==o?(b=E.jsx(O.Suspense,{fallback:null,children:E.jsx(v3,{editor:s,virtualMcpId:o})}),e[13]=s,e[14]=o,e[15]=b):b=e[15];let y;e[16]!==s||e[17]!==n?(y=E.jsx(vL,{editor:s,selectedModel:n}),e[16]=s,e[17]=n,e[18]=y):y=e[18];let T;return e[19]!==m||e[20]!==g||e[21]!==b||e[22]!==y?(T=E.jsxs(E.Fragment,{children:[m,g,b,y]}),e[19]=m,e[20]=g,e[21]=b,e[22]=y,e[23]=T):T=e[23],T}function m_(t){const e=K.c(25),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:a,outputTokens:i,cost:s}=n;if(!r&&!a&&!i)return null;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx(Q1,{size:12}),e[0]=o):o=e[0];let l;e[1]!==r?(l=r.toLocaleString(),e[1]=r,e[2]=l):l=e[2];let u;e[3]!==l?(u=E.jsx(Et,{asChild:!0,children:E.jsxs(Ee,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap shrink-0",children:[o,E.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:l})]})}),e[3]=l,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("span",{className:"text-muted",children:"in"}),e[6]=d):d=e[6];let p;e[7]!==a?(p=a.toLocaleString(),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==p?(f=E.jsx("span",{className:"text-right tabular-nums",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"out"}),e[11]=m):m=e[11];const g=i-(n.reasoningTokens??0);let b;e[12]!==g?(b=g.toLocaleString(),e[12]=g,e[13]=b):b=e[13];let y;e[14]!==b?(y=E.jsx("span",{className:"text-right tabular-nums",children:b}),e[14]=b,e[15]=y):y=e[15];let T;e[16]!==s?(T=s>0&&E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"text-muted",children:"cost"}),E.jsxs("span",{className:"text-right tabular-nums",children:["$",s.toFixed(4)]})]}),e[16]=s,e[17]=T):T=e[17];let S;e[18]!==y||e[19]!==T||e[20]!==f?(S=E.jsxs(Tt,{side:"top",className:"font-mono text-[11px]",children:[c,E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,f,m,y,T]})]}),e[18]=y,e[19]=T,e[20]=f,e[21]=S):S=e[21];let A;return e[22]!==S||e[23]!==u?(A=E.jsxs(bt,{children:[u,S]}),e[22]=S,e[23]=u,e[24]=A):A=e[24],A}function x3(t){const e=K.c(22),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:a,outputTokens:i,cost:s}=n;if(!r&&!a&&!i||s<=0)return null;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx(tA,{size:12}),e[0]=o):o=e[0];let l;e[1]!==s?(l=s.toFixed(4),e[1]=s,e[2]=l):l=e[2];let u;e[3]!==l?(u=E.jsx(Et,{asChild:!0,children:E.jsxs(Ee,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap shrink-0",children:[o,E.jsxs("span",{className:"text-[10px] font-mono tabular-nums",children:["$",l]})]})}),e[3]=l,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("span",{className:"text-muted",children:"in"}),e[6]=d):d=e[6];let p;e[7]!==a?(p=a.toLocaleString(),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==p?(f=E.jsx("span",{className:"text-right tabular-nums",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"out"}),e[11]=m):m=e[11];let g;e[12]!==i?(g=i.toLocaleString(),e[12]=i,e[13]=g):g=e[13];let b;e[14]!==g?(b=E.jsx("span",{className:"text-right tabular-nums",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==f?(y=E.jsxs(Tt,{side:"top",className:"font-mono text-[11px]",children:[c,E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,f,m,b]})]}),e[16]=b,e[17]=f,e[18]=y):y=e[18];let T;return e[19]!==y||e[20]!==u?(T=E.jsxs(bt,{children:[u,y]}),e[19]=y,e[20]=u,e[21]=T):T=e[21],T}function w3(t){const e=K.c(25),{onVirtualMcpChange:n,virtualMcps:r,disabled:a}=t,i=a===void 0?!1:a,[s,o]=O.useState(!1),l=O.useRef(null),{org:u}=Nr();let c;e[0]!==u.id?(c=j1(u.id),e[0]=u.id,e[1]=c):c=e[1];const d=c;let p;e[2]!==r?(p=r.filter(O3),e[2]=r,e[3]=p):p=e[3];const f=p;let m,g;e[4]!==s?(m=()=>{s&&setTimeout(()=>{l.current?.focus()},0)},g=[s],e[4]=s,e[5]=m,e[6]=g):(m=e[5],g=e[6]),O.useEffect(m,g);let b;e[7]!==n?(b=k=>{n(k),o(!1)},e[7]=n,e[8]=b):b=e[8];const y=b;let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=E.jsx(pr,{size:16}),e[9]=T):T=e[9];let S;e[10]!==i?(S=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:i,children:T})})}),e[10]=i,e[11]=S):S=e[11];let A;e[12]!==s?(A=!s&&E.jsx(Tt,{side:"top",children:"Decopilot"}),e[12]=s,e[13]=A):A=e[13];let v;e[14]!==S||e[15]!==A?(v=E.jsxs(bt,{children:[S,A]}),e[14]=S,e[15]=A,e[16]=v):v=e[16];let N;e[17]!==d.id||e[18]!==f||e[19]!==y?(N=E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:f,selectedVirtualMcpId:d.id,onVirtualMcpChange:y,searchInputRef:l})}),e[17]=d.id,e[18]=f,e[19]=y,e[20]=N):N=e[20];let C;return e[21]!==s||e[22]!==v||e[23]!==N?(C=E.jsxs(vr,{open:s,onOpenChange:o,children:[v,N]}),e[21]=s,e[22]=v,e[23]=N,e[24]=C):C=e[24],C}function O3(t){return!t.id||!dr(t.id)}function L3({virtualMcpId:t,virtualMcps:e,onVirtualMcpChange:n,disabled:r=!1}){const[a,i]=O.useState(!1),s=O.useRef(null),o=F1(),{org:l}=Nr(),u=e.find(m=>m.id===t);if(!u||dr(t))return null;O.useEffect(()=>{a&&setTimeout(()=>{s.current?.focus()},0)},[a]);const c=Cv(t),d=m=>{m.stopPropagation(),n(null)},p=m=>{m.stopPropagation(),o({to:"/$org/$project/agents/$agentId",params:{org:l.slug,project:Xa,agentId:t}})},f=m=>{n(m),i(!1)};return E.jsxs("div",{className:re("flex items-center justify-between px-3 py-1.5 rounded-t-xl z-10",c?.bg),children:[E.jsxs(vr,{open:a,onOpenChange:i,children:[E.jsx(_r,{asChild:!0,children:E.jsxs("button",{type:"button",disabled:r,className:re("flex items-center gap-1.5 hover:opacity-80 transition-opacity",r?"cursor-not-allowed opacity-50":"cursor-pointer"),children:[E.jsx(cs,{icon:u.icon,name:u.title,size:"2xs",className:"bg-background rounded-sm",fallbackIcon:u.fallbackIcon??E.jsx(pr,{size:10})}),E.jsx("span",{className:"text-xs text-white font-normal",children:u.title}),E.jsx(lf,{size:14,className:"text-white/50"})]})}),E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:e,selectedVirtualMcpId:t,onVirtualMcpChange:f,searchInputRef:s})})]}),E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("button",{type:"button",onClick:p,disabled:r,className:re("flex items-center justify-center p-1 rounded-full transition-colors",r?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10"),"aria-label":"Edit agent",children:E.jsx(lI,{size:14,className:"text-white"})}),E.jsx("button",{type:"button",onClick:d,disabled:r,className:re("flex items-center justify-center p-1 rounded-full transition-colors",r?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10"),"aria-label":"Reset to default",children:E.jsx(uI,{size:14,className:"text-white"})})]})]})}function D3(){const t=K.c(97),{activeThreadId:e,tiptapDoc:n,setTiptapDoc:r,virtualMcps:a,selectedVirtualMcp:i,setVirtualMcpId:s,modelsConnections:o,selectedModel:l,setSelectedModel:u,selectedMode:c,setSelectedMode:d,messages:p,isStreaming:f,sendMessage:m,stop:g}=En(),b=l?.thinking.limits?.contextWindow,y=O.useRef(null);let T;t[0]!==p?(T=aI(p),t[0]=p,t[1]=T):T=t[1];const S=T;let A;t[2]!==p?(A=[...p].reverse().find(M3)?.metadata?.usage,t[2]=p,t[3]=A):A=t[3];const v=A,N=(v?.totalTokens??0)-(v?.reasoningTokens??0);let C;t[4]!==f||t[5]!==l||t[6]!==n?(C=!f&&!!l&&!z2(n),t[4]=f,t[5]=l,t[6]=n,t[7]=C):C=t[7];const k=C;let R;t[8]!==k||t[9]!==f||t[10]!==m||t[11]!==g||t[12]!==n?(R=Nt=>{Nt?.preventDefault(),f?g():k&&n&&m(n)},t[8]=k,t[9]=f,t[10]=m,t[11]=g,t[12]=n,t[13]=R):R=t[13];const D=R;let w,P;if(t[14]!==i){const Nt=i?Cv(i.id):null;P="flex flex-col w-full min-h-42 justify-end",w=re("relative rounded-xl w-full flex flex-col",i&&"shadow-sm",Nt?.bg),t[14]=i,t[15]=w,t[16]=P}else w=t[15],P=t[16];let $;t[17]===Symbol.for("react.memo_cache_sentinel")?($=E.jsx(Rs,{}),t[17]=$):$=t[17];let B;t[18]!==f||t[19]!==i||t[20]!==s||t[21]!==a?(B=i?.id&&!dr(i.id)&&E.jsx(L3,{onVirtualMcpChange:s,virtualMcpId:i.id,virtualMcps:a,disabled:f}),t[18]=f,t[19]=i,t[20]=s,t[21]=a,t[22]=B):B=t[22];const G=!i&&"shadow-sm";let U;t[23]!==G?(U=re("w-full relative rounded-xl min-h-[130px] flex flex-col border border-border bg-background",G),t[23]=G,t[24]=U):U=t[24];let z;t[25]!==f||t[26]!==l||t[27]!==i?(z=E.jsx("div",{className:"relative flex flex-col gap-2 flex-1",children:E.jsx(k3,{ref:y,selectedModel:l,isStreaming:f,selectedVirtualMcp:i})}),t[25]=f,t[26]=l,t[27]=i,t[28]=z):z=t[28];let M;t[29]!==f||t[30]!==i||t[31]!==s||t[32]!==a?(M=i&&dr(i.id)?E.jsx(w3,{onVirtualMcpChange:s,virtualMcps:a,disabled:f}):E.jsx(TL,{selectedVirtualMcpId:i?.id??null,onVirtualMcpChange:s,virtualMcps:a,placeholder:"Agent",disabled:f}),t[29]=f,t[30]=i,t[31]=s,t[32]=a,t[33]=M):M=t[33];let Y;t[34]!==S?(Y=E.jsx(x3,{usage:S}),t[34]=S,t[35]=Y):Y=t[35];let X;t[36]!==b||t[37]!==N?(X=b&&N>0&&E.jsx(P3,{totalTokens:N,contextWindow:b}),t[36]=b,t[37]=N,t[38]=X):X=t[38];let W;t[39]!==M||t[40]!==Y||t[41]!==X?(W=E.jsxs("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[M,Y,X]}),t[39]=M,t[40]=Y,t[41]=X,t[42]=W):W=t[42];const ae=l??void 0;let Q;t[43]!==o||t[44]!==u||t[45]!==ae?(Q=E.jsx(GC,{selectedModel:ae,onModelChange:u,modelsConnections:o,placeholder:"Model",variant:"borderless"}),t[43]=o,t[44]=u,t[45]=ae,t[46]=Q):Q=t[46];let ne;t[47]!==f||t[48]!==c||t[49]!==d?(ne=E.jsx(gL,{selectedMode:c,onModeChange:d,placeholder:"Mode",variant:"borderless",disabled:f}),t[47]=f,t[48]=c,t[49]=d,t[50]=ne):ne=t[50];let J;t[51]!==f||t[52]!==l?(J=E.jsx(CL,{selectedModel:l,isStreaming:f}),t[51]=f,t[52]=l,t[53]=J):J=t[53];const le=f?"button":"submit";let ce;t[54]!==f||t[55]!==g?(ce=Nt=>{f&&(Nt.preventDefault(),Nt.stopPropagation(),g())},t[54]=f,t[55]=g,t[56]=ce):ce=t[56];const be=k||f?"default":"ghost",ve=!k&&!f,ke=!k&&!f&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let Fe;t[57]!==ke?(Fe=re("size-8 rounded-full transition-all",ke),t[57]=ke,t[58]=Fe):Fe=t[58];const Lt=f?"Stop generating":"Send message (Enter)";let qe;t[59]!==f?(qe=f?E.jsx(rA,{size:20}):E.jsx(oI,{size:20}),t[59]=f,t[60]=qe):qe=t[60];let St;t[61]!==le||t[62]!==ce||t[63]!==be||t[64]!==ve||t[65]!==Fe||t[66]!==Lt||t[67]!==qe?(St=E.jsx(Ee,{type:le,onClick:ce,variant:be,size:"icon",disabled:ve,className:Fe,title:Lt,children:qe}),t[61]=le,t[62]=ce,t[63]=be,t[64]=ve,t[65]=Fe,t[66]=Lt,t[67]=qe,t[68]=St):St=t[68];let At;t[69]!==Q||t[70]!==ne||t[71]!==J||t[72]!==St?(At=E.jsxs("div",{className:"flex items-center gap-1",children:[Q,ne,J,St]}),t[69]=Q,t[70]=ne,t[71]=J,t[72]=St,t[73]=At):At=t[73];let Ye;t[74]!==W||t[75]!==At?(Ye=E.jsxs("div",{className:"flex items-center justify-between p-2.5",children:[W,At]}),t[74]=W,t[75]=At,t[76]=Ye):Ye=t[76];let Dt;t[77]!==D||t[78]!==z||t[79]!==Ye||t[80]!==U?(Dt=E.jsxs("form",{onSubmit:D,className:U,children:[z,Ye]}),t[77]=D,t[78]=z,t[79]=Ye,t[80]=U,t[81]=Dt):Dt=t[81];let Je;t[82]!==e||t[83]!==D||t[84]!==f||t[85]!==l||t[86]!==r||t[87]!==Dt||t[88]!==n?(Je=E.jsx("div",{className:"p-0.5",children:E.jsx(R3,{tiptapDoc:n,setTiptapDoc:r,selectedModel:l,isStreaming:f,onSubmit:D,children:Dt},e)}),t[82]=e,t[83]=D,t[84]=f,t[85]=l,t[86]=r,t[87]=Dt,t[88]=n,t[89]=Je):Je=t[89];let Mt;t[90]!==Je||t[91]!==w||t[92]!==B?(Mt=E.jsxs("div",{className:w,children:[$,B,Je]}),t[90]=Je,t[91]=w,t[92]=B,t[93]=Mt):Mt=t[93];let ot;return t[94]!==Mt||t[95]!==P?(ot=E.jsx("div",{className:P,children:Mt}),t[94]=Mt,t[95]=P,t[96]=ot):ot=t[96],ot}function M3(t){return t.role==="assistant"&&t.metadata?.usage}function Sb(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(0)}k`:t.toLocaleString()}const Cn=16,Gf=2.5,Vf=(Cn-Gf)/2,yo=2*Math.PI*Vf;function P3(t){const e=K.c(38),{totalTokens:n,contextWindow:r}=t,a=Math.min(n/r*100,100),i=yo-a/100*yo;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=E.jsx("circle",{cx:Cn/2,cy:Cn/2,r:Vf,fill:"none",stroke:"currentColor",strokeWidth:Gf,className:"opacity-15"}),e[0]=s):s=e[0];const o=a>90?"text-destructive":a>70?"text-warning":"text-muted-foreground";let l;e[1]!==o?(l=re(o),e[1]=o,e[2]=l):l=e[2];let u;e[3]!==i||e[4]!==l?(u=E.jsxs("svg",{width:Cn,height:Cn,className:"-rotate-90",children:[s,E.jsx("circle",{cx:Cn/2,cy:Cn/2,r:Vf,fill:"none",stroke:"currentColor",strokeWidth:Gf,strokeDasharray:yo,strokeDashoffset:i,strokeLinecap:"round",className:l})]}),e[3]=i,e[4]=l,e[5]=u):u=e[5];let c;e[6]!==n?(c=Sb(n),e[6]=n,e[7]=c):c=e[7];let d;e[8]!==r?(d=Sb(r),e[8]=r,e[9]=d):d=e[9];let p;e[10]!==c||e[11]!==d?(p=E.jsxs("span",{className:"text-[10px] font-mono tabular-nums",children:[c,"/",d]}),e[10]=c,e[11]=d,e[12]=p):p=e[12];let f;e[13]!==u||e[14]!==p?(f=E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0 cursor-default",children:[u,p]})}),e[13]=u,e[14]=p,e[15]=f):f=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"tokens"}),e[16]=m):m=e[16];let g;e[17]!==n?(g=n.toLocaleString(),e[17]=n,e[18]=g):g=e[18];let b;e[19]!==g?(b=E.jsx("span",{children:g}),e[19]=g,e[20]=b):b=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y=E.jsx("span",{className:"text-muted",children:"context"}),e[21]=y):y=e[21];let T;e[22]!==r?(T=r.toLocaleString(),e[22]=r,e[23]=T):T=e[23];let S;e[24]!==T?(S=E.jsx("span",{children:T}),e[24]=T,e[25]=S):S=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=E.jsx("span",{className:"text-muted",children:"used"}),e[26]=A):A=e[26];let v;e[27]!==a?(v=a.toFixed(1),e[27]=a,e[28]=v):v=e[28];let N;e[29]!==v?(N=E.jsxs("span",{children:[v,"%"]}),e[29]=v,e[30]=N):N=e[30];let C;e[31]!==b||e[32]!==S||e[33]!==N?(C=E.jsx(Tt,{side:"top",className:"font-mono text-[11px]",children:E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[m,b,y,S,A,N]})}),e[31]=b,e[32]=S,e[33]=N,e[34]=C):C=e[34];let k;return e[35]!==C||e[36]!==f?(k=E.jsxs(bt,{children:[f,C]}),e[35]=C,e[36]=f,e[37]=k):k=e[37],k}const Ab=/[#.]/g;function F3(t,e){const n=t||"",r={};let a=0,i,s;for(;a<n.length;){Ab.lastIndex=a;const o=Ab.exec(n),l=n.slice(a,o?o.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:s=l,a+=l.length),o&&(i=o[0],a++)}return{type:"element",tagName:s||e||"div",properties:r,children:[]}}function g_(t,e,n){const r=n?$3(n):void 0;function a(i,s,...o){let l;if(i==null){l={type:"root",children:[]};const u=s;o.unshift(u)}else{l=F3(i,e);const u=l.tagName.toLowerCase(),c=r?r.get(u):void 0;if(l.tagName=c||u,B3(s))o.unshift(s);else for(const[d,p]of Object.entries(s))U3(t,l.properties,d,p)}for(const u of o)Wf(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return a}function B3(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const a=e[r];if(a&&typeof a=="object"){if(!Array.isArray(a))return!0;const i=a;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function U3(t,e,n,r){const a=rh(t,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?a.spaceSeparated?i=Sm(r):a.commaSeparated?i=Am(r):a.commaOrSpaceSeparated?i=Sm(Am(r).join(" ")):i=Nb(a,a.property,r):Array.isArray(r)?i=[...r]:i=a.property==="style"?H3(r):String(r);if(Array.isArray(i)){const s=[];for(const o of i)s.push(Nb(a,a.property,o));i=s}a.property==="className"&&Array.isArray(e.className)&&(i=e.className.concat(i)),e[a.property]=i}}function Wf(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Wf(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Wf(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function Nb(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Nm(n)===Nm(e)))return!0}return n}function H3(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function $3(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const q3=["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"],j3=g_(ds,"div"),z3=g_(va,"g",q3);function G3(t){const e=String(t),n=[];return{toOffset:a,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=e.length){let s=0;for(;;){let o=n[s];if(o===void 0){const l=vb(e,n[s-1]);o=l===-1?e.length+1:l+1,n[s]=o}if(o>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function a(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const o=n[n.length-1],l=vb(e,o),u=l===-1?e.length+1:l+1;if(o===u)break;n.push(u)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function vb(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
140
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=xf(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},a=xf(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ne.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zv.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Gv.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zv.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Jv.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(tM.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(nM.configure(this.options.taskList)),t}});var lb="&nbsp;",rM=" ",aM=Qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===lb||r[0].text===rM)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?lb:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oM=Yn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Tr({find:iM,type:this.type})]},addPasteRules(){return[zn({find:sM,type:this.type})]}}),lM=Qe.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),uM=Yn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cM=Ne.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(aD.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(JL.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(zv.configure(this.options.bulletList)),this.options.code!==!1&&a.push(oD.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(cD.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(dD.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(GL.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(VL.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(pD.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(fD.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(XL.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(hD.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(TD.configure(this.options.italic)),this.options.listItem!==!1&&a.push(Gv.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(Zv.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(zD.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(Jv.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(aM.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(oM.configure(this.options.strike)),this.options.text!==!1&&a.push(lM.configure(this.options.text)),this.options.underline!==!1&&a.push(uM.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(KL.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),e_=cM;var dM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],qf=dM.join(","),t_=typeof Element>"u",ya=t_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Qi=!t_&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ji=function(e,n){var r;n===void 0&&(n=!0);var a=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=a===""||a==="true",s=i||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Ji(e.parentNode));return s},pM=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},fM=function(e,n,r){if(Ji(e))return[];var a=Array.prototype.slice.apply(e.querySelectorAll(qf));return n&&ya.call(e,qf)&&a.unshift(e),a=a.filter(r),a},jf=function(e,n,r){for(var a=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ji(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=jf(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=ya.call(s,qf);c&&r.filter(s)&&(n||!e.includes(s))&&a.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Ji(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&p){var f=jf(d===!0?s.children:d.children,!0,r);r.flatten?a.push.apply(a,f):a.push({scopeParent:s,candidates:f})}else i.unshift.apply(i,s.children)}}return a},n_=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},r_=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||pM(e))&&!n_(e)?0:e.tabIndex},hM=function(e,n){var r=r_(e);return r<0&&n&&!n_(e)?0:r},mM=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},a_=function(e){return e.tagName==="INPUT"},gM=function(e){return a_(e)&&e.type==="hidden"},bM=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},EM=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},TM=function(e){if(!e.name)return!0;var n=e.form||Qi(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(e.name));else try{a=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=EM(a,e.form);return!i||i===e},yM=function(e){return a_(e)&&e.type==="radio"},SM=function(e){return yM(e)&&!TM(e)},AM=function(e){var n,r=e&&Qi(e),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&a;){var u,c,d;r=Qi(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(a))}}return i},ub=function(e){var n=e.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},NM=function(e,n){var r=n.displayCheck,a=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=ya.call(e,"details>summary:first-of-type"),o=s?e.parentElement:e;if(ya.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof a=="function"){for(var l=e;e;){var u=e.parentElement,c=Qi(e);if(u&&!u.shadowRoot&&a(u)===!0)return ub(e);e.assignedSlot?e=e.assignedSlot:!u&&c!==e.ownerDocument?e=c.host:e=u}e=l}if(AM(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ub(e);return!1},vM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return ya.call(n,"fieldset[disabled] *")?!0:!a.contains(e)}return!0}n=n.parentElement}return!1},_M=function(e,n){return!(n.disabled||gM(n)||NM(n,e)||bM(n)||vM(n))},cb=function(e,n){return!(SM(n)||r_(n)<0||!_M(e,n))},CM=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},i_=function(e){var n=[],r=[];return e.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=hM(o,s),u=s?i_(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(mM).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},s_=function(e,n){n=n||{};var r;return n.getShadowRoot?r=jf([e],n.includeContainer,{filter:cb.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:CM}):r=fM(e,n.includeContainer,cb.bind(null,n)),i_(r)};function IM(){return/apple/i.test(navigator.vendor)}const db="data-floating-ui-focusable";function RM(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function zf(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&IC(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Br(t){return"composedPath"in t?t.composedPath()[0]:t.target}function bo(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function kM(t){return t.matches("html,body")}function Sa(t){return t?.ownerDocument||document}function xM(t){return t?t.hasAttribute(db)?t:t.querySelector("["+db+"]")||t:null}function ni(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var i;return a.parentId===e&&(!n||((i=a.context)==null?void 0:i.open))}).flatMap(a=>[a,...ni(t,a.id,n)])}function wM(t){return"nativeEvent"in t}var OM=typeof document<"u",LM=function(){},Bn=OM?O.useLayoutEffect:LM;const DM={...M1},MM=DM.useInsertionEffect,PM=MM||(t=>t());function ar(t){const e=O.useRef(()=>{});return PM(()=>{e.current=t}),O.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e.current==null?void 0:e.current(...r)},[])}const o_=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function l_(t,e){const n=s_(t,o_()),r=n.length;if(r===0)return;const a=RM(Sa(t)),i=n.indexOf(a),s=i===-1?e===1?0:r-1:i+e;return n[s]}function FM(t){return l_(Sa(t).body,1)||t}function BM(t){return l_(Sa(t).body,-1)||t}function Eo(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!zf(n,r)}function UM(t){s_(t,o_()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function pb(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const HM="data-floating-ui-focusable",fb="active",hb="selected",$M={...M1};let mb=!1,qM=0;const gb=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+qM++;function jM(){const[t,e]=O.useState(()=>mb?gb():void 0);return Bn(()=>{t==null&&e(gb())},[]),O.useEffect(()=>{mb=!0},[]),t}const zM=$M.useId,Wh=zM||jM;function GM(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const VM=O.createContext(null),WM=O.createContext(null),u_=()=>{var t;return((t=O.useContext(VM))==null?void 0:t.id)||null},c_=()=>O.useContext(WM);function Yh(t){return"data-floating-ui-"+t}const YM={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},bb=O.forwardRef(function(e,n){const[r,a]=O.useState();Bn(()=>{IM()&&a("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Yh("focus-guard")]:"",style:YM};return E.jsx("span",{...e,...i})}),KM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},d_=O.createContext(null),Eb=Yh("portal");function XM(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Wh(),a=QM(),[i,s]=O.useState(null),o=O.useRef(null);return Bn(()=>()=>{i?.remove(),queueMicrotask(()=>{o.current=null})},[i]),Bn(()=>{if(!r||o.current)return;const l=e?document.getElementById(e):null;if(!l)return;const u=document.createElement("div");u.id=r,u.setAttribute(Eb,""),l.appendChild(u),o.current=u,s(u)},[e,r]),Bn(()=>{if(n===null||!r||o.current)return;let l=n||a?.portalNode;l&&!LC(l)&&(l=l.current),l=l||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,l.appendChild(u));const c=document.createElement("div");c.id=r,c.setAttribute(Eb,""),l=u||l,l.appendChild(c),o.current=c,s(c)},[e,n,r,a]),i}function ZM(t){const{children:e,id:n,root:r,preserveTabOrder:a=!0}=t,i=XM({id:n,root:r}),[s,o]=O.useState(null),l=O.useRef(null),u=O.useRef(null),c=O.useRef(null),d=O.useRef(null),p=s?.modal,f=s?.open,m=!!s&&!s.modal&&s.open&&a&&!!(r||i);return O.useEffect(()=>{if(!i||!a||p)return;function g(b){i&&Eo(b)&&(b.type==="focusin"?pb:UM)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,a,p]),O.useEffect(()=>{i&&(f||pb(i))},[f,i]),E.jsxs(d_.Provider,{value:O.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:o}),[a,i]),children:[m&&i&&E.jsx(bb,{"data-type":"outside",ref:l,onFocus:g=>{if(Eo(g,i)){var b;(b=c.current)==null||b.focus()}else{const y=s?s.domReference:null,T=BM(y);T?.focus()}}}),m&&i&&E.jsx("span",{"aria-owns":i.id,style:KM}),i&&D1.createPortal(e,i),m&&i&&E.jsx(bb,{"data-type":"outside",ref:u,onFocus:g=>{if(Eo(g,i)){var b;(b=d.current)==null||b.focus()}else{const y=s?s.domReference:null,T=FM(y);T?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const QM=()=>O.useContext(d_),JM={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},e3={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Tb=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function t3(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:a,dataRef:i}=t,{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:m}=e,g=c_(),b=ar(typeof l=="function"?l:()=>!1),y=typeof l=="function"?b:l,T=O.useRef(!1),{escapeKey:S,outsidePress:A}=Tb(f),{escapeKey:v,outsidePress:N}=Tb(m),C=O.useRef(!1),k=ar(B=>{var G;if(!n||!s||!o||B.key!=="Escape"||C.current)return;const U=(G=i.current.floatingContext)==null?void 0:G.nodeId,z=g?ni(g.nodesRef.current,U):[];if(!S&&(B.stopPropagation(),z.length>0)){let M=!0;if(z.forEach(Y=>{var X;if((X=Y.context)!=null&&X.open&&!Y.context.dataRef.current.__escapeKeyBubbles){M=!1;return}}),!M)return}r(!1,wM(B)?B.nativeEvent:B,"escape-key")}),R=ar(B=>{var G;const U=()=>{var z;k(B),(z=Br(B))==null||z.removeEventListener("keydown",U)};(G=Br(B))==null||G.addEventListener("keydown",U)}),D=ar(B=>{var G;const U=i.current.insideReactTree;i.current.insideReactTree=!1;const z=T.current;if(T.current=!1,u==="click"&&z||U||typeof y=="function"&&!y(B))return;const M=Br(B),Y="["+Yh("inert")+"]",X=Sa(a.floating).querySelectorAll(Y);let W=kt(M)?M:null;for(;W&&!qs(W);){const J=xC(W);if(qs(J)||!kt(J))break;W=J}if(X.length&&kt(M)&&!kM(M)&&!zf(M,a.floating)&&Array.from(X).every(J=>!zf(W,J)))return;if(wC(M)&&$){const J=qs(M),le=OC(M),ce=/auto|scroll/,be=J||ce.test(le.overflowX),ve=J||ce.test(le.overflowY),ke=be&&M.clientWidth>0&&M.scrollWidth>M.clientWidth,Fe=ve&&M.clientHeight>0&&M.scrollHeight>M.clientHeight,Lt=le.direction==="rtl",qe=Fe&&(Lt?B.offsetX<=M.offsetWidth-M.clientWidth:B.offsetX>M.clientWidth),St=ke&&B.offsetY>M.clientHeight;if(qe||St)return}const ae=(G=i.current.floatingContext)==null?void 0:G.nodeId,Q=g&&ni(g.nodesRef.current,ae).some(J=>{var le;return bo(B,(le=J.context)==null?void 0:le.elements.floating)});if(bo(B,a.floating)||bo(B,a.domReference)||Q)return;const ne=g?ni(g.nodesRef.current,ae):[];if(ne.length>0){let J=!0;if(ne.forEach(le=>{var ce;if((ce=le.context)!=null&&ce.open&&!le.context.dataRef.current.__outsidePressBubbles){J=!1;return}}),!J)return}r(!1,B,"outside-press")}),w=ar(B=>{var G;const U=()=>{var z;D(B),(z=Br(B))==null||z.removeEventListener(u,U)};(G=Br(B))==null||G.addEventListener(u,U)});O.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=S,i.current.__outsidePressBubbles=A;let B=-1;function G(X){r(!1,X,"ancestor-scroll")}function U(){window.clearTimeout(B),C.current=!0}function z(){B=window.setTimeout(()=>{C.current=!1},kC()?5:0)}const M=Sa(a.floating);o&&(M.addEventListener("keydown",v?R:k,v),M.addEventListener("compositionstart",U),M.addEventListener("compositionend",z)),y&&M.addEventListener(u,N?w:D,N);let Y=[];return p&&(kt(a.domReference)&&(Y=$s(a.domReference)),kt(a.floating)&&(Y=Y.concat($s(a.floating))),!kt(a.reference)&&a.reference&&a.reference.contextElement&&(Y=Y.concat($s(a.reference.contextElement)))),Y=Y.filter(X=>{var W;return X!==((W=M.defaultView)==null?void 0:W.visualViewport)}),Y.forEach(X=>{X.addEventListener("scroll",G,{passive:!0})}),()=>{o&&(M.removeEventListener("keydown",v?R:k,v),M.removeEventListener("compositionstart",U),M.removeEventListener("compositionend",z)),y&&M.removeEventListener(u,N?w:D,N),Y.forEach(X=>{X.removeEventListener("scroll",G)}),window.clearTimeout(B)}},[i,a,o,y,u,n,r,p,s,S,A,k,v,R,D,N,w]),O.useEffect(()=>{i.current.insideReactTree=!1},[i,y,u]);const P=O.useMemo(()=>({onKeyDown:k,...c&&{[JM[d]]:B=>{r(!1,B.nativeEvent,"reference-press")},...d!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[k,r,c,d]),$=O.useMemo(()=>({onKeyDown:k,onMouseDown(){T.current=!0},onMouseUp(){T.current=!0},[e3[u]]:()=>{i.current.insideReactTree=!0}}),[k,u,i]);return O.useMemo(()=>s?{reference:P,floating:$}:{},[s,P,$])}function n3(t){const{open:e=!1,onOpenChange:n,elements:r}=t,a=Wh(),i=O.useRef({}),[s]=O.useState(()=>GM()),o=u_()!=null,[l,u]=O.useState(r.reference),c=ar((f,m,g)=>{i.current.openEvent=f?m:void 0,s.emit("openchange",{open:f,event:m,reason:g,nested:o}),n?.(f,m,g)}),d=O.useMemo(()=>({setPositionReference:u}),[]),p=O.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return O.useMemo(()=>({dataRef:i,open:e,onOpenChange:c,elements:p,events:s,floatingId:a,refs:d}),[e,c,p,s,a,d])}function r3(t){t===void 0&&(t={});const{nodeId:e}=t,n=n3({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,a=r.elements,[i,s]=O.useState(null),[o,l]=O.useState(null),c=a?.domReference||i,d=O.useRef(null),p=c_();Bn(()=>{c&&(d.current=c)},[c]);const f=RC({...t,elements:{...a,...o&&{reference:o}}}),m=O.useCallback(S=>{const A=kt(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;l(A),f.refs.setReference(A)},[f.refs]),g=O.useCallback(S=>{(kt(S)||S===null)&&(d.current=S,s(S)),(kt(f.refs.reference.current)||f.refs.reference.current===null||S!==null&&!kt(S))&&f.refs.setReference(S)},[f.refs]),b=O.useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:d}),[f.refs,g,m]),y=O.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),T=O.useMemo(()=>({...f,...r,refs:b,elements:y,nodeId:e}),[f,b,y,e,r]);return Bn(()=>{r.dataRef.current.floatingContext=T;const S=p?.nodesRef.current.find(A=>A.id===e);S&&(S.context=T)}),O.useMemo(()=>({...f,context:T,refs:b,elements:y}),[f,b,y,T])}function To(t,e,n){const r=new Map,a=n==="item";let i=t;if(a&&t){const{[fb]:s,[hb]:o,...l}=t;i=l}return{...n==="floating"&&{tabIndex:-1,[HM]:""},...i,...e.map(s=>{const o=s?s[n]:null;return typeof o=="function"?t?o(t):null:o}).concat(t).reduce((s,o)=>(o&&Object.entries(o).forEach(l=>{let[u,c]=l;if(!(a&&[fb,hb].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof c=="function"){var d;(d=r.get(u))==null||d.push(c),s[u]=function(){for(var p,f=arguments.length,m=new Array(f),g=0;g<f;g++)m[g]=arguments[g];return(p=r.get(u))==null?void 0:p.map(b=>b(...m)).find(b=>b!==void 0)}}}else s[u]=c}),s),{})}}function a3(t){t===void 0&&(t=[]);const e=t.map(o=>o?.reference),n=t.map(o=>o?.floating),r=t.map(o=>o?.item),a=O.useCallback(o=>To(o,t,"reference"),e),i=O.useCallback(o=>To(o,t,"floating"),n),s=O.useCallback(o=>To(o,t,"item"),r);return O.useMemo(()=>({getReferenceProps:a,getFloatingProps:i,getItemProps:s}),[a,i,s])}const i3=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function s3(t,e){var n,r;e===void 0&&(e={});const{open:a,elements:i,floatingId:s}=t,{enabled:o=!0,role:l="dialog"}=e,u=Wh(),c=((n=i.domReference)==null?void 0:n.id)||u,d=O.useMemo(()=>{var T;return((T=xM(i.floating))==null?void 0:T.id)||s},[i.floating,s]),p=(r=i3.get(l))!=null?r:l,m=u_()!=null,g=O.useMemo(()=>p==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:a?d:void 0}:{"aria-expanded":a?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":a?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:c},...p==="menu"&&m&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[p,d,m,a,c,l]),b=O.useMemo(()=>{const T={id:d,...p&&{role:p}};return p==="tooltip"||l==="label"?T:{...T,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,l]),y=O.useCallback(T=>{let{active:S,selected:A}=T;const v={role:"option",...S&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...v,"aria-selected":A}}return{}},[d,l]);return O.useMemo(()=>o?{reference:g,floating:b,item:y}:{},[o,g,b,y])}function o3(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:s,$position:o}=t,l=r&&!a,u=wO(n),c=new RegExp(`\\s${u}$`),d=s?"^":"",p=a?"":u,f=l?new RegExp(`${d}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=o.nodeBefore)==null?void 0:e.isText)&&o.nodeBefore.text;if(!m)return null;const g=o.pos-m.length,b=Array.from(m.matchAll(f)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),T=new RegExp(`^[${i?.join("")}\0]?$`).test(y);if(i!==null&&!T)return null;const S=g+b.index;let A=S+b[0].length;return l&&c.test(m.slice(A-1,A+1))&&(b[0]+=" ",A+=1),S<o.pos&&A>=o.pos?{range:{from:S,to:A},query:b[0].slice(n.length),text:b[0]}:null}var l3=new Te("suggestion");function u3({pluginKey:t=l3,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:c="is-empty",command:d=()=>null,items:p=()=>[],render:f=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=o3,shouldShow:b}){let y;const T=f?.(),S=()=>{const C=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(C),{top:R,right:D,bottom:w,left:P}=k;try{return new DOMRect(P,R,D-P,w-R)}catch{return null}},A=(C,k)=>k?()=>{const R=t.getState(e.state),D=R?.decorationId,w=C.dom.querySelector(`[data-decoration-id="${D}"]`);return w?.getBoundingClientRect()||null}:S;function v(C,k){var R;try{const w=t.getState(C.state),P=w?.decorationId?C.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`):null,$={editor:e,range:w?.range||{from:0,to:0},query:w?.query||null,text:w?.text||null,items:[],command:B=>d({editor:e,range:w?.range||{from:0,to:0},props:B}),decorationNode:P,clientRect:A(C,P)};(R=T?.onExit)==null||R.call(T,$)}catch{}const D=C.state.tr.setMeta(k,{exit:!0});C.dispatch(D)}const N=new he({key:t,view(){return{update:async(C,k)=>{var R,D,w,P,$,B,G;const U=(R=this.key)==null?void 0:R.getState(k),z=(D=this.key)==null?void 0:D.getState(C.state),M=U.active&&z.active&&U.range.from!==z.range.from,Y=!U.active&&z.active,X=U.active&&!z.active,W=!Y&&!X&&U.query!==z.query,ae=Y||M&&W,Q=W||M,ne=X||M&&W;if(!ae&&!Q&&!ne)return;const J=ne&&!ae?U:z,le=C.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);y={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ce=>d({editor:e,range:J.range,props:ce}),decorationNode:le,clientRect:A(C,le)},ae&&((w=T?.onBeforeStart)==null||w.call(T,y)),Q&&((P=T?.onBeforeUpdate)==null||P.call(T,y)),(Q||ae)&&(y.items=await p({editor:e,query:J.query})),ne&&(($=T?.onExit)==null||$.call(T,y)),Q&&((B=T?.onUpdate)==null||B.call(T,y)),ae&&((G=T?.onStart)==null||G.call(T,y))},destroy:()=>{var C;y&&((C=T?.onExit)==null||C.call(T,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,k,R,D){const{isEditable:w}=e,{composing:P}=e.view,{selection:$}=C,{empty:B,from:G}=$,U={...k},z=C.getMeta(t);if(z&&z.exit)return U.active=!1,U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null,U;if(U.composing=P,w&&(B||e.view.composing)){(G<k.range.from||G>k.range.to)&&!P&&!k.composing&&(U.active=!1);const M=g({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:s,$position:$.$from}),Y=`id_${Math.floor(Math.random()*4294967295)}`;M&&m({editor:e,state:D,range:M.range,isActive:k.active})&&(!b||b({editor:e,range:M.range,query:M.query,text:M.text,transaction:C}))?(U.active=!0,U.decorationId=k.decorationId?k.decorationId:Y,U.range=M.range,U.query=M.query,U.text=M.text):U.active=!1}else U.active=!1;return U.active||(U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null),U}},props:{handleKeyDown(C,k){var R,D,w,P;const{active:$,range:B}=N.getState(C.state);if(!$)return!1;if(k.key==="Escape"||k.key==="Esc"){const U=N.getState(C.state),z=(R=y?.decorationNode)!=null?R:null,M=z??(U?.decorationId?C.dom.querySelector(`[data-decoration-id="${U.decorationId}"]`):null);if(((D=T?.onKeyDown)==null?void 0:D.call(T,{view:C,event:k,range:U.range}))||!1)return!0;const X={editor:e,range:U.range,query:U.query,text:U.text,items:[],command:W=>d({editor:e,range:U.range,props:W}),decorationNode:M,clientRect:M?()=>M.getBoundingClientRect()||null:null};return(w=T?.onExit)==null||w.call(T,X),v(C,t),!0}return((P=T?.onKeyDown)==null?void 0:P.call(T,{view:C,event:k,range:B}))||!1},decorations(C){const{active:k,range:R,decorationId:D,query:w}=N.getState(C);if(!k)return null;const P=!w?.length,$=[l];return P&&$.push(c),ge.create(C.doc,[ze.inline(R.from,R.to,{nodeName:o,class:$.join(" "),"data-decoration-id":D,"data-decoration-content":u})])}}});return N}function c3(t){const e=K.c(26),{editor:n,query:r,items:a,onSelect:i,onClose:s}=t,[o,l]=O.useState(0),u=O.useRef(a),c=O.useRef(o),d=O.useRef(i),p=O.useRef(s),f=O.useDeferredValue(r);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{l(0)},e[0]=m):m=e[0];let g;e[1]!==f?(g=[f],e[1]=f,e[2]=g):g=e[2],O.useEffect(m,g);let b,y;e[3]!==a.length||e[4]!==o?(b=()=>{o>=a.length&&a.length>0&&l(0)},y=[a.length,o],e[3]=a.length,e[4]=o,e[5]=b,e[6]=y):(b=e[5],y=e[6]),O.useEffect(b,y);let T,S;e[7]!==a?(T=()=>{u.current=a},S=[a],e[7]=a,e[8]=T,e[9]=S):(T=e[8],S=e[9]),O.useEffect(T,S);let A,v;e[10]!==o?(A=()=>{c.current=o},v=[o],e[10]=o,e[11]=A,e[12]=v):(A=e[11],v=e[12]),O.useEffect(A,v);let N,C;e[13]!==i?(C=()=>{d.current=i},N=[i],e[13]=i,e[14]=N,e[15]=C):(N=e[14],C=e[15]),O.useEffect(C,N);let k,R;e[16]!==s?(k=()=>{p.current=s},R=[s],e[16]=s,e[17]=k,e[18]=R):(k=e[17],R=e[18]),O.useEffect(k,R);let D;e[19]!==n.isDestroyed||e[20]!==n.view.dom?(D=()=>{const B=n.view.dom;if(n?.isDestroyed||!B)return;const G=z=>{const M=u.current;if(!M.length)return!1;const Y=()=>l(W=>(W+1)%M.length),X=()=>l(W=>(W-1+M.length)%M.length);switch(z.key){case"ArrowUp":return z.preventDefault(),X(),!0;case"ArrowDown":return z.preventDefault(),Y(),!0;case"Tab":return z.preventDefault(),z.shiftKey?X():Y(),!0;case"Home":return z.preventDefault(),l(0),!0;case"End":return z.preventDefault(),l(M.length-1),!0;case"Enter":{if(z.isComposing)return!1;z.preventDefault();const W=c.current;return W!==-1&&M[W]&&d.current?.(M[W],W),!0}case"Escape":return z.preventDefault(),p.current?.(),!0;default:return!1}},U=z=>{G(z)};return B.addEventListener("keydown",U,!0),()=>{B?.removeEventListener("keydown",U,!0)}},e[19]=n.isDestroyed,e[20]=n.view.dom,e[21]=D):D=e[21];let w;e[22]!==n?(w=[n],e[22]=n,e[23]=w):w=e[23],O.useEffect(D,w);const P=a.length?o:void 0;let $;return e[24]!==P?($={selectedIndex:P,setSelectedIndex:l},e[24]=P,e[25]=$):$=e[25],$}function d3(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const p_=O.createContext(void 0);function f_(){const t=O.useContext(p_);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function p3(t){const e=K.c(8),{editor:n,char:r,pluginKey:a}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=i):i=e[0];const[s,o]=O.useReducer(d3,i);let l,u;e[1]!==r||e[2]!==n||e[3]!==a?(l=()=>{if(n?.isDestroyed)return;const d=a instanceof Te?a:new Te(a);n.state.plugins.find(m=>m.spec.key===d)&&n.unregisterPlugin(d);const f=u3({pluginKey:d,editor:n,char:r,allow(m){const g=n.state.doc.resolve(m.range.from);for(let b=g.depth;b>0;b--)if(g.node(b).type.name==="image")return!1;return!0},command(){},render:()=>({onStart:m=>{o({type:"ON_START",payload:{element:m.decorationNode??null,query:m.query,range:m.range}})},onUpdate:m=>{o({type:"ON_UPDATE",payload:{element:m.decorationNode??null,query:m.query,range:m.range}})},onKeyDown:m=>m.event.key==="Escape"?(o({type:"ON_EXIT"}),!0):!1,onExit:()=>{o({type:"ON_EXIT"})}}),items:f3});return n.registerPlugin(f),()=>{n?.isDestroyed||n.unregisterPlugin(d)}},u=[n,a,r,o],e[1]=r,e[2]=n,e[3]=a,e[4]=l,e[5]=u):(l=e[4],u=e[5]),O.useEffect(l,u);let c;return e[6]!==s?(c={state:s,dispatch:o},e[6]=s,e[7]=c):c=e[7],c}function f3(){return[]}function h3({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:a,dispatch:i}=f_(),s=O.useDeferredValue(a.query),{data:o}=DC({queryKey:th.suggestionItems(e,a.open,s),queryFn:()=>a.open?n({query:s}):[]}),l=()=>{i({type:"ON_EXIT"})},u=async(d,p)=>{if(!(a.selectedItem!==null||!a.range)){i({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,g=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),b=a.range?{...a.range}:{from:0,to:0};g&&a.range&&(b.to+=1),await r({range:b,item:d})}finally{l()}}},{selectedIndex:c}=c3({editor:t,query:s,items:o,onSelect:u,onClose:l});return{selectedItem:a.selectedItem,items:o,selectedIndex:c,close:l,onSelect:u}}function m3({children:t}){const{state:e,dispatch:n}=f_(),{open:r,element:a}=e,i=()=>{n({type:"ON_EXIT"})},{refs:s,floatingStyles:o,context:l}=r3({placement:"bottom-start",open:r,onOpenChange:p=>{p||i()},elements:{reference:a},middleware:[MC(10),PC(),FC()],whileElementsMounted:BC}),u=t3(l,{outsidePress:p=>!(p.target instanceof Element&&p.target.closest(".ProseMirror"))}),c=s3(l,{role:"listbox"}),{getFloatingProps:d}=a3([u,c]);return r?E.jsx(ZM,{children:E.jsx("div",{ref:s.setFloating,style:o,...d(),className:"z-50 w-auto min-w-[280px] max-w-[400px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const g3=t=>{const e=K.c(23),{item:n,isSelected:r,onSelect:a,isLoading:i,ref:s}=t,o=r&&"bg-accent text-accent-foreground",l=i&&"pointer-events-none opacity-50";let u;e[0]!==o||e[1]!==l?(u=re("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",o,l),e[0]=o,e[1]=l,e[2]=u):u=e[2];let c;e[3]!==n.name||e[4]!==n.title?(c=n.title||n.name.replace(/_/g," "),e[3]=n.name,e[4]=n.title,e[5]=c):c=e[5];let d;e[6]!==c?(d=E.jsx("span",{className:"font-medium flex items-center truncate",children:c}),e[6]=c,e[7]=d):d=e[7];let p;e[8]!==i?(p=i&&E.jsx(rs,{size:"xs"}),e[8]=i,e[9]=p):p=e[9];let f;e[10]!==d||e[11]!==p?(f=E.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d,p]}),e[10]=d,e[11]=p,e[12]=f):f=e[12];let m;e[13]!==n.description?(m=n.description&&E.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:n.description}),e[13]=n.description,e[14]=m):m=e[14];let g;e[15]!==f||e[16]!==m?(g=E.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[f,m]}),e[15]=f,e[16]=m,e[17]=g):g=e[17];let b;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==g?(b=E.jsx("div",{ref:s,onClick:a,className:u,children:g}),e[18]=a,e[19]=s,e[20]=u,e[21]=g,e[22]=b):b=e[22],b},b3=t=>{const e=K.c(18),{editor:n,queryKey:r,queryFn:a,onSelect:i}=t;let s;e[0]!==n||e[1]!==i||e[2]!==a||e[3]!==r?(s={editor:n,queryKey:r,queryFn:a,onSelect:i},e[0]=n,e[1]=i,e[2]=a,e[3]=r,e[4]=s):s=e[4];const{items:o,selectedIndex:l,onSelect:u,selectedItem:c}=h3(s);if(!o.length){let m;return e[5]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("div",{className:"min-w-[280px] max-w-[400px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=m):m=e[5],m}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d={maxHeight:"min(217px, var(--radix-popover-content-available-height, 217px))"},e[6]=d):d=e[6];let p;if(e[7]!==u||e[8]!==o||e[9]!==l||e[10]!==c?.name){let m;e[12]!==u||e[13]!==l||e[14]!==c?.name?(m=(g,b)=>E.jsx(g3,{item:g,isSelected:b===l,ref:b===l?y3:void 0,onSelect:()=>u(g,b),isLoading:c?.name===g.name},g.name),e[12]=u,e[13]=l,e[14]=c?.name,e[15]=m):m=e[15],p=o.map(m),e[7]=u,e[8]=o,e[9]=l,e[10]=c?.name,e[11]=p}else p=e[11];let f;return e[16]!==p?(f=E.jsx("div",{className:"min-w-[280px] max-w-[400px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:d,children:E.jsx("div",{className:"p-1",children:p})}),e[16]=p,e[17]=f):f=e[17],f};function E3(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsx("div",{className:"p-1",children:[...Array(3)].map(T3)}),t[0]=e):e=t[0],e}function T3(t,e){return E.jsxs("div",{className:"px-2 py-1.5 h-[44px] animate-pulse",children:[E.jsx("div",{className:"h-4 w-24 bg-muted rounded mb-1"}),E.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function h_(t){const e=K.c(16),{editor:n,char:r,pluginKey:a,queryKey:i,queryFn:s,onSelect:o}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a?(l={editor:n,char:r,pluginKey:a},e[0]=r,e[1]=n,e[2]=a,e[3]=l):l=e[3];const{state:u,dispatch:c}=p3(l);let d;e[4]!==c||e[5]!==u?(d={state:u,dispatch:c},e[4]=c,e[5]=u,e[6]=d):d=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=E.jsx(E3,{}),e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==o||e[10]!==s||e[11]!==i?(f=E.jsx(m3,{children:E.jsx(O.Suspense,{fallback:p,children:E.jsx(b3,{editor:n,queryKey:i,queryFn:s,onSelect:o})})}),e[8]=n,e[9]=o,e[10]=s,e[11]=i,e[12]=f):f=e[12];let m;return e[13]!==d||e[14]!==f?(m=E.jsx(p_.Provider,{value:d,children:f}),e[13]=d,e[14]=f,e[15]=m):m=e[15],m}function y3(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}async function yb(t,e,n,r,a){try{const i=await G1(n,r,a);Nv(t,e,{id:r,name:r,metadata:i.messages,char:"/"})}catch(i){console.error("[prompt] Failed to fetch prompt:",i),Gt.error("Failed to load prompt. Please try again.")}}const S3=t=>{const e=K.c(29),{editor:n,virtualMcpId:r}=t,a=P1(),{org:i}=Nr();let s;e[0]!==i.id||e[1]!==r?(s={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==i.id||e[4]!==r?(l=th.virtualMcpPrompts(r,i.id),e[3]=i.id,e[4]=r,e[5]=l):l=e[5];const u=l,[c,d]=O.useState(null);let p;e[6]!==o||e[7]!==n?(p=async C=>{const{item:k,range:R}=C;if(k.arguments&&k.arguments.length>0){d({range:R,item:k});return}o&&await yb(n,R,o,k.name)},e[6]=o,e[7]=n,e[8]=p):p=e[8];const f=p;let m;e[9]!==c||e[10]!==o||e[11]!==n?(m=async C=>{if(!c||!o)return;const{range:k,item:R}=c;await yb(n,k,o,R.name,C),d(null)},e[9]=c,e[10]=o,e[11]=n,e[12]=m):m=e[12];const g=m;let b;e[13]!==o||e[14]!==a||e[15]!==u?(b=async C=>{const{query:k}=C;if(!o)return[];let R=a.getQueryData(u);if(R?a.fetchQuery({queryKey:u,queryFn:()=>Tm(o),staleTime:6e4}).catch(A3):R=await a.fetchQuery({queryKey:u,queryFn:()=>Tm(o),staleTime:6e4}),!R.prompts)return[];let D=R.prompts;if(k.trim()){const w=k.toLowerCase();D=R.prompts.filter(P=>P.name.toLowerCase().includes(w)||P.title?.toLowerCase().includes(w)||P.description?.toLowerCase().includes(w))}return D},e[13]=o,e[14]=a,e[15]=u,e[16]=b):b=e[16];const y=b;let T;e[17]!==n||e[18]!==y||e[19]!==f||e[20]!==u?(T=E.jsx(h_,{editor:n,char:"/",pluginKey:"promptsDropdownMenu",queryKey:u,queryFn:y,onSelect:f}),e[17]=n,e[18]=y,e[19]=f,e[20]=u,e[21]=T):T=e[21];const S=c?.item??null;let A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=()=>d(null),e[22]=A):A=e[22];let v;e[23]!==g||e[24]!==S?(v=E.jsx(sA,{prompt:S,setPrompt:A,onSubmit:g}),e[23]=g,e[24]=S,e[25]=v):v=e[25];let N;return e[26]!==T||e[27]!==v?(N=E.jsxs(E.Fragment,{children:[T,v]}),e[26]=T,e[27]=v,e[28]=N):N=e[28],N};function A3(){}async function N3(t,e,n,r){try{const a=await XC(n,r);Nv(t,e,{id:r,name:r,metadata:a.contents,char:"@"})}catch(a){console.error("[resource] Failed to fetch resource:",a),Gt.error("Failed to load resource. Please try again.")}}const v3=t=>{const e=K.c(18),{editor:n,virtualMcpId:r}=t,a=P1(),{org:i}=Nr();let s;e[0]!==i.id||e[1]!==r?(s={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=s):s=e[2];const o=nh(s);let l;e[3]!==i.id||e[4]!==r?(l=th.virtualMcpResources(r,i.id),e[3]=i.id,e[4]=r,e[5]=l):l=e[5];const u=l;let c;e[6]!==o||e[7]!==n?(c=async g=>{const{item:b,range:y}=g;o&&await N3(n,y,o,b.uri)},e[6]=o,e[7]=n,e[8]=c):c=e[8];const d=c;let p;e[9]!==o||e[10]!==a||e[11]!==u?(p=async g=>{const{query:b}=g;if(!o)return[];let y=a.getQueryData(u);if(y?a.fetchQuery({queryKey:u,queryFn:()=>ym(o),staleTime:6e4}).catch(_3):y=await a.fetchQuery({queryKey:u,queryFn:()=>ym(o),staleTime:6e4}),!y.resources)return[];let T=y.resources;if(b.trim()){const S=b.toLowerCase();T=y.resources.filter(A=>A.uri.toLowerCase().includes(S)||A.name?.toLowerCase().includes(S)||A.description?.toLowerCase().includes(S))}return T.map(C3)},e[9]=o,e[10]=a,e[11]=u,e[12]=p):p=e[12];const f=p;let m;return e[13]!==n||e[14]!==f||e[15]!==d||e[16]!==u?(m=E.jsx(h_,{editor:n,char:"@",pluginKey:"resourcesDropdownMenu",queryKey:u,queryFn:f,onSelect:d}),e[13]=n,e[14]=f,e[15]=d,e[16]=u,e[17]=m):m=e[17],m};function _3(){}function C3(t){return{name:t.name??t.uri,title:t.name,description:t.description,uri:t.uri}}const I3=[e_.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),ZL.configure({placeholder:"Ask anything, / for prompts, @ for resources...",showOnlyWhenEditable:!1}),_v,Rv];function R3(t){const e=K.c(22),{tiptapDoc:n,setTiptapDoc:r,selectedModel:a,isStreaming:i,onSubmit:s,children:o}=t,l=i||!a,u=O.useRef(s),c=O.useRef(r),d=n||"",p=!l;let f,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(D,w)=>w.key==="Enter"&&!w.shiftKey?(w.preventDefault(),u.current?.(),!0):!1},m=D=>{const{editor:w}=D;c.current(w?.getJSON())},e[0]=f,e[1]=m):(f=e[0],m=e[1]);let g;e[2]!==d||e[3]!==p?(g={extensions:I3,content:d,editable:p,editorProps:f,onUpdate:m},e[2]=d,e[3]=p,e[4]=g):g=e[4];let b;e[5]!==l?(b=[l],e[5]=l,e[6]=b):b=e[6];const y=gv(g,b);let T,S;e[7]!==s?(T=()=>{u.current=s},S=[s],e[7]=s,e[8]=T,e[9]=S):(T=e[8],S=e[9]),O.useEffect(T,S);let A,v;e[10]!==r?(v=()=>{c.current=r},A=[r],e[10]=r,e[11]=A,e[12]=v):(A=e[11],v=e[12]),O.useEffect(v,A);let N,C;e[13]!==y||e[14]!==n?(N=()=>{if(y?.isDestroyed)return;const D=JSON.stringify(y?.getJSON()),w=JSON.stringify(n||{type:"doc",content:[]});D!==w&&y.commands.setContent(n||{type:"doc",content:[]})},C=[y,n],e[13]=y,e[14]=n,e[15]=N,e[16]=C):(N=e[15],C=e[16]),O.useEffect(N,C);let k;e[17]!==y?(k={editor:y},e[17]=y,e[18]=k):k=e[18];let R;return e[19]!==o||e[20]!==k?(R=E.jsx(Is.Provider,{value:k,children:o}),e[19]=o,e[20]=k,e[21]=R):R=e[21],R}function k3(t){const e=K.c(24),{selectedModel:n,isStreaming:r,selectedVirtualMcp:a,ref:i}=t,{editor:s}=bv(),o=a?.id??null,l=r||!n;let u;e[0]!==s?.commands?(u=()=>({focus:()=>{s?.commands.focus()},clear:()=>{s?.commands.clearContent(!0)}}),e[0]=s?.commands,e[1]=u):u=e[1];let c;if(e[2]!==s?(c=[s],e[2]=s,e[3]=c):c=e[3],O.useImperativeHandle(i??null,u,c),!s)return null;const d=l&&"cursor-not-allowed opacity-70",p=l&&"[&_.ProseMirror]:cursor-not-allowed";let f;e[4]!==d||e[5]!==p?(f=re("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col","[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",d,p),e[4]=d,e[5]=p,e[6]=f):f=e[6];let m;e[7]!==s||e[8]!==f?(m=E.jsx(Lh,{editor:s,className:f}),e[7]=s,e[8]=f,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==o?(g=E.jsx(O.Suspense,{fallback:null,children:E.jsx(S3,{editor:s,virtualMcpId:o})}),e[10]=s,e[11]=o,e[12]=g):g=e[12];let b;e[13]!==s||e[14]!==o?(b=E.jsx(O.Suspense,{fallback:null,children:E.jsx(v3,{editor:s,virtualMcpId:o})}),e[13]=s,e[14]=o,e[15]=b):b=e[15];let y;e[16]!==s||e[17]!==n?(y=E.jsx(vL,{editor:s,selectedModel:n}),e[16]=s,e[17]=n,e[18]=y):y=e[18];let T;return e[19]!==m||e[20]!==g||e[21]!==b||e[22]!==y?(T=E.jsxs(E.Fragment,{children:[m,g,b,y]}),e[19]=m,e[20]=g,e[21]=b,e[22]=y,e[23]=T):T=e[23],T}function m_(t){const e=K.c(25),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:a,outputTokens:i,cost:s}=n;if(!r&&!a&&!i)return null;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx(Q1,{size:12}),e[0]=o):o=e[0];let l;e[1]!==r?(l=r.toLocaleString(),e[1]=r,e[2]=l):l=e[2];let u;e[3]!==l?(u=E.jsx(Et,{asChild:!0,children:E.jsxs(Ee,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap shrink-0",children:[o,E.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:l})]})}),e[3]=l,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("span",{className:"text-muted",children:"in"}),e[6]=d):d=e[6];let p;e[7]!==a?(p=a.toLocaleString(),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==p?(f=E.jsx("span",{className:"text-right tabular-nums",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"out"}),e[11]=m):m=e[11];const g=i-(n.reasoningTokens??0);let b;e[12]!==g?(b=g.toLocaleString(),e[12]=g,e[13]=b):b=e[13];let y;e[14]!==b?(y=E.jsx("span",{className:"text-right tabular-nums",children:b}),e[14]=b,e[15]=y):y=e[15];let T;e[16]!==s?(T=s>0&&E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"text-muted",children:"cost"}),E.jsxs("span",{className:"text-right tabular-nums",children:["$",s.toFixed(4)]})]}),e[16]=s,e[17]=T):T=e[17];let S;e[18]!==y||e[19]!==T||e[20]!==f?(S=E.jsxs(Tt,{side:"top",className:"font-mono text-[11px]",children:[c,E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,f,m,y,T]})]}),e[18]=y,e[19]=T,e[20]=f,e[21]=S):S=e[21];let A;return e[22]!==S||e[23]!==u?(A=E.jsxs(bt,{children:[u,S]}),e[22]=S,e[23]=u,e[24]=A):A=e[24],A}function x3(t){const e=K.c(22),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:a,outputTokens:i,cost:s}=n;if(!r&&!a&&!i||s<=0)return null;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx(tA,{size:12}),e[0]=o):o=e[0];let l;e[1]!==s?(l=s.toFixed(4),e[1]=s,e[2]=l):l=e[2];let u;e[3]!==l?(u=E.jsx(Et,{asChild:!0,children:E.jsxs(Ee,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap shrink-0",children:[o,E.jsxs("span",{className:"text-[10px] font-mono tabular-nums",children:["$",l]})]})}),e[3]=l,e[4]=u):u=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("span",{className:"text-muted",children:"in"}),e[6]=d):d=e[6];let p;e[7]!==a?(p=a.toLocaleString(),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==p?(f=E.jsx("span",{className:"text-right tabular-nums",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"out"}),e[11]=m):m=e[11];let g;e[12]!==i?(g=i.toLocaleString(),e[12]=i,e[13]=g):g=e[13];let b;e[14]!==g?(b=E.jsx("span",{className:"text-right tabular-nums",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==f?(y=E.jsxs(Tt,{side:"top",className:"font-mono text-[11px]",children:[c,E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,f,m,b]})]}),e[16]=b,e[17]=f,e[18]=y):y=e[18];let T;return e[19]!==y||e[20]!==u?(T=E.jsxs(bt,{children:[u,y]}),e[19]=y,e[20]=u,e[21]=T):T=e[21],T}function w3(t){const e=K.c(25),{onVirtualMcpChange:n,virtualMcps:r,disabled:a}=t,i=a===void 0?!1:a,[s,o]=O.useState(!1),l=O.useRef(null),{org:u}=Nr();let c;e[0]!==u.id?(c=z1(u.id),e[0]=u.id,e[1]=c):c=e[1];const d=c;let p;e[2]!==r?(p=r.filter(O3),e[2]=r,e[3]=p):p=e[3];const f=p;let m,g;e[4]!==s?(m=()=>{s&&setTimeout(()=>{l.current?.focus()},0)},g=[s],e[4]=s,e[5]=m,e[6]=g):(m=e[5],g=e[6]),O.useEffect(m,g);let b;e[7]!==n?(b=k=>{n(k),o(!1)},e[7]=n,e[8]=b):b=e[8];const y=b;let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=E.jsx(pr,{size:16}),e[9]=T):T=e[9];let S;e[10]!==i?(S=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:i,children:T})})}),e[10]=i,e[11]=S):S=e[11];let A;e[12]!==s?(A=!s&&E.jsx(Tt,{side:"top",children:"Decopilot"}),e[12]=s,e[13]=A):A=e[13];let v;e[14]!==S||e[15]!==A?(v=E.jsxs(bt,{children:[S,A]}),e[14]=S,e[15]=A,e[16]=v):v=e[16];let N;e[17]!==d.id||e[18]!==f||e[19]!==y?(N=E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:f,selectedVirtualMcpId:d.id,onVirtualMcpChange:y,searchInputRef:l})}),e[17]=d.id,e[18]=f,e[19]=y,e[20]=N):N=e[20];let C;return e[21]!==s||e[22]!==v||e[23]!==N?(C=E.jsxs(vr,{open:s,onOpenChange:o,children:[v,N]}),e[21]=s,e[22]=v,e[23]=N,e[24]=C):C=e[24],C}function O3(t){return!t.id||!dr(t.id)}function L3({virtualMcpId:t,virtualMcps:e,onVirtualMcpChange:n,disabled:r=!1}){const[a,i]=O.useState(!1),s=O.useRef(null),o=F1(),{org:l}=Nr(),u=e.find(m=>m.id===t);if(!u||dr(t))return null;O.useEffect(()=>{a&&setTimeout(()=>{s.current?.focus()},0)},[a]);const c=Cv(t),d=m=>{m.stopPropagation(),n(null)},p=m=>{m.stopPropagation(),o({to:"/$org/$project/agents/$agentId",params:{org:l.slug,project:Xa,agentId:t}})},f=m=>{n(m),i(!1)};return E.jsxs("div",{className:re("flex items-center justify-between px-3 py-1.5 rounded-t-xl z-10",c?.bg),children:[E.jsxs(vr,{open:a,onOpenChange:i,children:[E.jsx(_r,{asChild:!0,children:E.jsxs("button",{type:"button",disabled:r,className:re("flex items-center gap-1.5 hover:opacity-80 transition-opacity",r?"cursor-not-allowed opacity-50":"cursor-pointer"),children:[E.jsx(cs,{icon:u.icon,name:u.title,size:"2xs",className:"bg-background rounded-sm",fallbackIcon:u.fallbackIcon??E.jsx(pr,{size:10})}),E.jsx("span",{className:"text-xs text-white font-normal",children:u.title}),E.jsx(lf,{size:14,className:"text-white/50"})]})}),E.jsx(Cr,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:E.jsx(Mh,{virtualMcps:e,selectedVirtualMcpId:t,onVirtualMcpChange:f,searchInputRef:s})})]}),E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("button",{type:"button",onClick:p,disabled:r,className:re("flex items-center justify-center p-1 rounded-full transition-colors",r?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10"),"aria-label":"Edit agent",children:E.jsx(lI,{size:14,className:"text-white"})}),E.jsx("button",{type:"button",onClick:d,disabled:r,className:re("flex items-center justify-center p-1 rounded-full transition-colors",r?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10"),"aria-label":"Reset to default",children:E.jsx(uI,{size:14,className:"text-white"})})]})]})}function D3(){const t=K.c(97),{activeThreadId:e,tiptapDoc:n,setTiptapDoc:r,virtualMcps:a,selectedVirtualMcp:i,setVirtualMcpId:s,modelsConnections:o,selectedModel:l,setSelectedModel:u,selectedMode:c,setSelectedMode:d,messages:p,isStreaming:f,sendMessage:m,stop:g}=En(),b=l?.thinking.limits?.contextWindow,y=O.useRef(null);let T;t[0]!==p?(T=aI(p),t[0]=p,t[1]=T):T=t[1];const S=T;let A;t[2]!==p?(A=[...p].reverse().find(M3)?.metadata?.usage,t[2]=p,t[3]=A):A=t[3];const v=A,N=(v?.totalTokens??0)-(v?.reasoningTokens??0);let C;t[4]!==f||t[5]!==l||t[6]!==n?(C=!f&&!!l&&!z2(n),t[4]=f,t[5]=l,t[6]=n,t[7]=C):C=t[7];const k=C;let R;t[8]!==k||t[9]!==f||t[10]!==m||t[11]!==g||t[12]!==n?(R=Nt=>{Nt?.preventDefault(),f?g():k&&n&&m(n)},t[8]=k,t[9]=f,t[10]=m,t[11]=g,t[12]=n,t[13]=R):R=t[13];const D=R;let w,P;if(t[14]!==i){const Nt=i?Cv(i.id):null;P="flex flex-col w-full min-h-42 justify-end",w=re("relative rounded-xl w-full flex flex-col",i&&"shadow-sm",Nt?.bg),t[14]=i,t[15]=w,t[16]=P}else w=t[15],P=t[16];let $;t[17]===Symbol.for("react.memo_cache_sentinel")?($=E.jsx(Rs,{}),t[17]=$):$=t[17];let B;t[18]!==f||t[19]!==i||t[20]!==s||t[21]!==a?(B=i?.id&&!dr(i.id)&&E.jsx(L3,{onVirtualMcpChange:s,virtualMcpId:i.id,virtualMcps:a,disabled:f}),t[18]=f,t[19]=i,t[20]=s,t[21]=a,t[22]=B):B=t[22];const G=!i&&"shadow-sm";let U;t[23]!==G?(U=re("w-full relative rounded-xl min-h-[130px] flex flex-col border border-border bg-background",G),t[23]=G,t[24]=U):U=t[24];let z;t[25]!==f||t[26]!==l||t[27]!==i?(z=E.jsx("div",{className:"relative flex flex-col gap-2 flex-1",children:E.jsx(k3,{ref:y,selectedModel:l,isStreaming:f,selectedVirtualMcp:i})}),t[25]=f,t[26]=l,t[27]=i,t[28]=z):z=t[28];let M;t[29]!==f||t[30]!==i||t[31]!==s||t[32]!==a?(M=i&&dr(i.id)?E.jsx(w3,{onVirtualMcpChange:s,virtualMcps:a,disabled:f}):E.jsx(TL,{selectedVirtualMcpId:i?.id??null,onVirtualMcpChange:s,virtualMcps:a,placeholder:"Agent",disabled:f}),t[29]=f,t[30]=i,t[31]=s,t[32]=a,t[33]=M):M=t[33];let Y;t[34]!==S?(Y=E.jsx(x3,{usage:S}),t[34]=S,t[35]=Y):Y=t[35];let X;t[36]!==b||t[37]!==N?(X=b&&N>0&&E.jsx(P3,{totalTokens:N,contextWindow:b}),t[36]=b,t[37]=N,t[38]=X):X=t[38];let W;t[39]!==M||t[40]!==Y||t[41]!==X?(W=E.jsxs("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[M,Y,X]}),t[39]=M,t[40]=Y,t[41]=X,t[42]=W):W=t[42];const ae=l??void 0;let Q;t[43]!==o||t[44]!==u||t[45]!==ae?(Q=E.jsx(GC,{selectedModel:ae,onModelChange:u,modelsConnections:o,placeholder:"Model",variant:"borderless"}),t[43]=o,t[44]=u,t[45]=ae,t[46]=Q):Q=t[46];let ne;t[47]!==f||t[48]!==c||t[49]!==d?(ne=E.jsx(gL,{selectedMode:c,onModeChange:d,placeholder:"Mode",variant:"borderless",disabled:f}),t[47]=f,t[48]=c,t[49]=d,t[50]=ne):ne=t[50];let J;t[51]!==f||t[52]!==l?(J=E.jsx(CL,{selectedModel:l,isStreaming:f}),t[51]=f,t[52]=l,t[53]=J):J=t[53];const le=f?"button":"submit";let ce;t[54]!==f||t[55]!==g?(ce=Nt=>{f&&(Nt.preventDefault(),Nt.stopPropagation(),g())},t[54]=f,t[55]=g,t[56]=ce):ce=t[56];const be=k||f?"default":"ghost",ve=!k&&!f,ke=!k&&!f&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let Fe;t[57]!==ke?(Fe=re("size-8 rounded-full transition-all",ke),t[57]=ke,t[58]=Fe):Fe=t[58];const Lt=f?"Stop generating":"Send message (Enter)";let qe;t[59]!==f?(qe=f?E.jsx(rA,{size:20}):E.jsx(oI,{size:20}),t[59]=f,t[60]=qe):qe=t[60];let St;t[61]!==le||t[62]!==ce||t[63]!==be||t[64]!==ve||t[65]!==Fe||t[66]!==Lt||t[67]!==qe?(St=E.jsx(Ee,{type:le,onClick:ce,variant:be,size:"icon",disabled:ve,className:Fe,title:Lt,children:qe}),t[61]=le,t[62]=ce,t[63]=be,t[64]=ve,t[65]=Fe,t[66]=Lt,t[67]=qe,t[68]=St):St=t[68];let At;t[69]!==Q||t[70]!==ne||t[71]!==J||t[72]!==St?(At=E.jsxs("div",{className:"flex items-center gap-1",children:[Q,ne,J,St]}),t[69]=Q,t[70]=ne,t[71]=J,t[72]=St,t[73]=At):At=t[73];let Ye;t[74]!==W||t[75]!==At?(Ye=E.jsxs("div",{className:"flex items-center justify-between p-2.5",children:[W,At]}),t[74]=W,t[75]=At,t[76]=Ye):Ye=t[76];let Dt;t[77]!==D||t[78]!==z||t[79]!==Ye||t[80]!==U?(Dt=E.jsxs("form",{onSubmit:D,className:U,children:[z,Ye]}),t[77]=D,t[78]=z,t[79]=Ye,t[80]=U,t[81]=Dt):Dt=t[81];let Je;t[82]!==e||t[83]!==D||t[84]!==f||t[85]!==l||t[86]!==r||t[87]!==Dt||t[88]!==n?(Je=E.jsx("div",{className:"p-0.5",children:E.jsx(R3,{tiptapDoc:n,setTiptapDoc:r,selectedModel:l,isStreaming:f,onSubmit:D,children:Dt},e)}),t[82]=e,t[83]=D,t[84]=f,t[85]=l,t[86]=r,t[87]=Dt,t[88]=n,t[89]=Je):Je=t[89];let Mt;t[90]!==Je||t[91]!==w||t[92]!==B?(Mt=E.jsxs("div",{className:w,children:[$,B,Je]}),t[90]=Je,t[91]=w,t[92]=B,t[93]=Mt):Mt=t[93];let ot;return t[94]!==Mt||t[95]!==P?(ot=E.jsx("div",{className:P,children:Mt}),t[94]=Mt,t[95]=P,t[96]=ot):ot=t[96],ot}function M3(t){return t.role==="assistant"&&t.metadata?.usage}function Sb(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(0)}k`:t.toLocaleString()}const Cn=16,Gf=2.5,Vf=(Cn-Gf)/2,yo=2*Math.PI*Vf;function P3(t){const e=K.c(38),{totalTokens:n,contextWindow:r}=t,a=Math.min(n/r*100,100),i=yo-a/100*yo;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=E.jsx("circle",{cx:Cn/2,cy:Cn/2,r:Vf,fill:"none",stroke:"currentColor",strokeWidth:Gf,className:"opacity-15"}),e[0]=s):s=e[0];const o=a>90?"text-destructive":a>70?"text-warning":"text-muted-foreground";let l;e[1]!==o?(l=re(o),e[1]=o,e[2]=l):l=e[2];let u;e[3]!==i||e[4]!==l?(u=E.jsxs("svg",{width:Cn,height:Cn,className:"-rotate-90",children:[s,E.jsx("circle",{cx:Cn/2,cy:Cn/2,r:Vf,fill:"none",stroke:"currentColor",strokeWidth:Gf,strokeDasharray:yo,strokeDashoffset:i,strokeLinecap:"round",className:l})]}),e[3]=i,e[4]=l,e[5]=u):u=e[5];let c;e[6]!==n?(c=Sb(n),e[6]=n,e[7]=c):c=e[7];let d;e[8]!==r?(d=Sb(r),e[8]=r,e[9]=d):d=e[9];let p;e[10]!==c||e[11]!==d?(p=E.jsxs("span",{className:"text-[10px] font-mono tabular-nums",children:[c,"/",d]}),e[10]=c,e[11]=d,e[12]=p):p=e[12];let f;e[13]!==u||e[14]!==p?(f=E.jsx(Et,{asChild:!0,children:E.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0 cursor-default",children:[u,p]})}),e[13]=u,e[14]=p,e[15]=f):f=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=E.jsx("span",{className:"text-muted",children:"tokens"}),e[16]=m):m=e[16];let g;e[17]!==n?(g=n.toLocaleString(),e[17]=n,e[18]=g):g=e[18];let b;e[19]!==g?(b=E.jsx("span",{children:g}),e[19]=g,e[20]=b):b=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y=E.jsx("span",{className:"text-muted",children:"context"}),e[21]=y):y=e[21];let T;e[22]!==r?(T=r.toLocaleString(),e[22]=r,e[23]=T):T=e[23];let S;e[24]!==T?(S=E.jsx("span",{children:T}),e[24]=T,e[25]=S):S=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=E.jsx("span",{className:"text-muted",children:"used"}),e[26]=A):A=e[26];let v;e[27]!==a?(v=a.toFixed(1),e[27]=a,e[28]=v):v=e[28];let N;e[29]!==v?(N=E.jsxs("span",{children:[v,"%"]}),e[29]=v,e[30]=N):N=e[30];let C;e[31]!==b||e[32]!==S||e[33]!==N?(C=E.jsx(Tt,{side:"top",className:"font-mono text-[11px]",children:E.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[m,b,y,S,A,N]})}),e[31]=b,e[32]=S,e[33]=N,e[34]=C):C=e[34];let k;return e[35]!==C||e[36]!==f?(k=E.jsxs(bt,{children:[f,C]}),e[35]=C,e[36]=f,e[37]=k):k=e[37],k}const Ab=/[#.]/g;function F3(t,e){const n=t||"",r={};let a=0,i,s;for(;a<n.length;){Ab.lastIndex=a;const o=Ab.exec(n),l=n.slice(a,o?o.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:s=l,a+=l.length),o&&(i=o[0],a++)}return{type:"element",tagName:s||e||"div",properties:r,children:[]}}function g_(t,e,n){const r=n?$3(n):void 0;function a(i,s,...o){let l;if(i==null){l={type:"root",children:[]};const u=s;o.unshift(u)}else{l=F3(i,e);const u=l.tagName.toLowerCase(),c=r?r.get(u):void 0;if(l.tagName=c||u,B3(s))o.unshift(s);else for(const[d,p]of Object.entries(s))U3(t,l.properties,d,p)}for(const u of o)Wf(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return a}function B3(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const a=e[r];if(a&&typeof a=="object"){if(!Array.isArray(a))return!0;const i=a;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function U3(t,e,n,r){const a=rh(t,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?a.spaceSeparated?i=Sm(r):a.commaSeparated?i=Am(r):a.commaOrSpaceSeparated?i=Sm(Am(r).join(" ")):i=Nb(a,a.property,r):Array.isArray(r)?i=[...r]:i=a.property==="style"?H3(r):String(r);if(Array.isArray(i)){const s=[];for(const o of i)s.push(Nb(a,a.property,o));i=s}a.property==="className"&&Array.isArray(e.className)&&(i=e.className.concat(i)),e[a.property]=i}}function Wf(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Wf(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Wf(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function Nb(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Nm(n)===Nm(e)))return!0}return n}function H3(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function $3(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const q3=["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"],j3=g_(ds,"div"),z3=g_(va,"g",q3);function G3(t){const e=String(t),n=[];return{toOffset:a,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=e.length){let s=0;for(;;){let o=n[s];if(o===void 0){const l=vb(e,n[s-1]);o=l===-1?e.length+1:l+1,n[s]=o}if(o>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function a(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const o=n[n.length-1],l=vb(e,o),u=l===-1?e.length+1:l+1;if(o===u)break;n.push(u)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function vb(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
141
141
  `,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const On={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/"},b_={}.hasOwnProperty,V3=Object.prototype;function W3(t,e){const n=e||{};return Kh({file:n.file||void 0,location:!1,schema:n.space==="svg"?va:ds,verbose:n.verbose||!1},t)}function Kh(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},ri(t,r,n),n}case"#document":case"#document-fragment":{const r=e,a="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:E_(t,e.childNodes),data:{quirksMode:a}},t.file&&t.location){const i=String(t.file),s=G3(i),o=s.toPoint(0),l=s.toPoint(i.length);n.position={start:o,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},ri(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},ri(t,r,n),n}default:return n=Y3(t,e),n}}function E_(t,e){let n=-1;const r=[];for(;++n<e.length;){const a=Kh(t,e[n]);r.push(a)}return r}function Y3(t,e){const n=t.schema;t.schema=e.namespaceURI===On.svg?va:ds;let r=-1;const a={};for(;++r<e.attrs.length;){const o=e.attrs[r],l=(o.prefix?o.prefix+":":"")+o.name;b_.call(V3,l)||(a[l]=o.value)}const s=(t.schema.space==="svg"?z3:j3)(e.tagName,a,E_(t,e.childNodes));if(ri(t,e,s),s.tagName==="template"){const o=e,l=o.sourceCodeLocation,u=l&&l.startTag&&or(l.startTag),c=l&&l.endTag&&or(l.endTag),d=Kh(t,o.content);u&&c&&t.file&&(d.position={start:u.end,end:c.start}),s.content=d}return t.schema=n,s}function ri(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=K3(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function K3(t,e,n){const r=or(n);if(e.type==="element"){const a=e.children[e.children.length-1];if(r&&!n.endTag&&a&&a.position&&a.position.end&&(r.end=Object.assign({},a.position.end)),t.verbose){const i={};let s;if(n.attrs)for(s in n.attrs)b_.call(n.attrs,s)&&(i[rh(t.schema,s).property]=or(n.attrs[s]));uf(n.startTag);const o=or(n.startTag),l=n.endTag?or(n.endTag):void 0,u={opening:o};l&&(u.closing=l),u.properties=i,e.data={position:u}}}return r}function or(t){const e=_b({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=_b({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function _b(t){return t.line&&t.column?t:void 0}const X3={},Z3={}.hasOwnProperty,T_=iA("type",{handlers:{root:J3,element:aP,text:nP,comment:rP,doctype:tP}});function Q3(t,e){const r=(e||X3).space;return T_(t,r==="svg"?va:ds)}function J3(t,e){const n={nodeName:"#document",mode:(t.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=Xh(t.children,n,e),Rr(t,n),n}function eP(t,e){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=Xh(t.children,n,e),Rr(t,n),n}function tP(t){const e={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Rr(t,e),e}function nP(t){const e={nodeName:"#text",value:t.value,parentNode:null};return Rr(t,e),e}function rP(t){const e={nodeName:"#comment",data:t.value,parentNode:null};return Rr(t,e),e}function aP(t,e){const n=e;let r=n;t.type==="element"&&t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=va);const a=[];let i;if(t.properties){for(i in t.properties)if(i!=="children"&&Z3.call(t.properties,i)){const l=iP(r,i,t.properties[i]);l&&a.push(l)}}const s=r.space,o={nodeName:t.tagName,tagName:t.tagName,attrs:a,namespaceURI:On[s],childNodes:[],parentNode:null};return o.childNodes=Xh(t.children,o,r),Rr(t,o),t.tagName==="template"&&t.content&&(o.content=eP(t.content,r)),o}function iP(t,e,n){const r=rh(t,e);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?TI(n):yI(n));const a={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const i=a.name.indexOf(":");i<0?a.prefix="":(a.name=a.name.slice(i+1),a.prefix=r.attribute.slice(0,i)),a.namespace=On[r.space]}return a}function Xh(t,e,n){let r=-1;const a=[];if(t)for(;++r<t.length;){const i=T_(t[r],n);i.parentNode=e,a.push(i)}return a}function Rr(t,e){const n=t.position;n&&n.start&&n.end&&(uf(typeof n.start.offset=="number"),uf(typeof n.end.offset=="number"),e.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})}const sP=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],oP=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]),me="�";var _;(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(_||(_={}));const et={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function y_(t){return t>=55296&&t<=57343}function lP(t){return t>=56320&&t<=57343}function uP(t,e){return(t-55296)*1024+9216+e}function S_(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function A_(t){return t>=64976&&t<=65007||oP.has(t)}var F;(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(F||(F={}));const cP=65536;class dP{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=cP,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){const{line:r,col:a,offset:i}=this,s=a+n,o=i+n;return{code:e,startLine:r,endLine:r,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){const n=this.html.charCodeAt(this.pos+1);if(lP(n))return this.pos++,this._addGap(),uP(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,_.EOF;return this._err(F.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,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const n=this.pos+e;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,_.EOF;const r=this.html.charCodeAt(n);return r===_.CARRIAGE_RETURN?_.LINE_FEED:r}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,_.EOF;let e=this.html.charCodeAt(this.pos);return e===_.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,_.LINE_FEED):e===_.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,y_(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===_.LINE_FEED||e===_.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){S_(e)?this._err(F.controlCharacterInInputStream):A_(e)&&this._err(F.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var ue;(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(ue||(ue={}));function N_(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}const pP=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(t=>t.charCodeAt(0))),fP=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 hP(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=fP.get(t))!==null&&e!==void 0?e:t}var De;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(De||(De={}));const mP=32;var un;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(un||(un={}));function Yf(t){return t>=De.ZERO&&t<=De.NINE}function gP(t){return t>=De.UPPER_A&&t<=De.UPPER_F||t>=De.LOWER_A&&t<=De.LOWER_F}function bP(t){return t>=De.UPPER_A&&t<=De.UPPER_Z||t>=De.LOWER_A&&t<=De.LOWER_Z||Yf(t)}function EP(t){return t===De.EQUALS||bP(t)}var Oe;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Oe||(Oe={}));var jt;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(jt||(jt={}));class TP{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Oe.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=jt.Strict}startEntity(e){this.decodeMode=e,this.state=Oe.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Oe.EntityStart:return e.charCodeAt(n)===De.NUM?(this.state=Oe.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Oe.NamedEntity,this.stateNamedEntity(e,n));case Oe.NumericStart:return this.stateNumericStart(e,n);case Oe.NumericDecimal:return this.stateNumericDecimal(e,n);case Oe.NumericHex:return this.stateNumericHex(e,n);case Oe.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|mP)===De.LOWER_X?(this.state=Oe.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Oe.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,a){if(n!==r){const i=r-n;this.result=this.result*Math.pow(a,i)+Number.parseInt(e.substr(n,i),a),this.consumed+=i}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const a=e.charCodeAt(n);if(Yf(a)||gP(a))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(a,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const a=e.charCodeAt(n);if(Yf(a))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(a,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===De.SEMI)this.consumed+=1;else if(this.decodeMode===jt.Strict)return 0;return this.emitCodePoint(hP(this.result),this.consumed),this.errors&&(e!==De.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let a=r[this.treeIndex],i=(a&un.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const s=e.charCodeAt(n);if(this.treeIndex=yP(r,a,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===jt.Attribute&&(i===0||EP(s))?0:this.emitNotTerminatedNamedEntity();if(a=r[this.treeIndex],i=(a&un.VALUE_LENGTH)>>14,i!==0){if(s===De.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==jt.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,a=(r[n]&un.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,a,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:a}=this;return this.emitCodePoint(n===1?a[e]&~un.VALUE_LENGTH:a[e+1],r),n===3&&this.emitCodePoint(a[e+2],r),r}end(){var e;switch(this.state){case Oe.NamedEntity:return this.result!==0&&(this.decodeMode!==jt.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Oe.NumericDecimal:return this.emitNumericEntity(0,2);case Oe.NumericHex:return this.emitNumericEntity(0,3);case Oe.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Oe.EntityStart:return 0}}}function yP(t,e,n,r){const a=(e&un.BRANCH_LENGTH)>>7,i=e&un.JUMP_TABLE;if(a===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=a?-1:t[n+l]-1}let s=n,o=s+a-1;for(;s<=o;){const l=s+o>>>1,u=t[l];if(u<r)s=l+1;else if(u>r)o=l-1;else return t[l+a]}return-1}var H;(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(H||(H={}));var Un;(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(Un||(Un={}));var dt;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(dt||(dt={}));var L;(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(L||(L={}));var h;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(h||(h={}));const SP=new Map([[L.A,h.A],[L.ADDRESS,h.ADDRESS],[L.ANNOTATION_XML,h.ANNOTATION_XML],[L.APPLET,h.APPLET],[L.AREA,h.AREA],[L.ARTICLE,h.ARTICLE],[L.ASIDE,h.ASIDE],[L.B,h.B],[L.BASE,h.BASE],[L.BASEFONT,h.BASEFONT],[L.BGSOUND,h.BGSOUND],[L.BIG,h.BIG],[L.BLOCKQUOTE,h.BLOCKQUOTE],[L.BODY,h.BODY],[L.BR,h.BR],[L.BUTTON,h.BUTTON],[L.CAPTION,h.CAPTION],[L.CENTER,h.CENTER],[L.CODE,h.CODE],[L.COL,h.COL],[L.COLGROUP,h.COLGROUP],[L.DD,h.DD],[L.DESC,h.DESC],[L.DETAILS,h.DETAILS],[L.DIALOG,h.DIALOG],[L.DIR,h.DIR],[L.DIV,h.DIV],[L.DL,h.DL],[L.DT,h.DT],[L.EM,h.EM],[L.EMBED,h.EMBED],[L.FIELDSET,h.FIELDSET],[L.FIGCAPTION,h.FIGCAPTION],[L.FIGURE,h.FIGURE],[L.FONT,h.FONT],[L.FOOTER,h.FOOTER],[L.FOREIGN_OBJECT,h.FOREIGN_OBJECT],[L.FORM,h.FORM],[L.FRAME,h.FRAME],[L.FRAMESET,h.FRAMESET],[L.H1,h.H1],[L.H2,h.H2],[L.H3,h.H3],[L.H4,h.H4],[L.H5,h.H5],[L.H6,h.H6],[L.HEAD,h.HEAD],[L.HEADER,h.HEADER],[L.HGROUP,h.HGROUP],[L.HR,h.HR],[L.HTML,h.HTML],[L.I,h.I],[L.IMG,h.IMG],[L.IMAGE,h.IMAGE],[L.INPUT,h.INPUT],[L.IFRAME,h.IFRAME],[L.KEYGEN,h.KEYGEN],[L.LABEL,h.LABEL],[L.LI,h.LI],[L.LINK,h.LINK],[L.LISTING,h.LISTING],[L.MAIN,h.MAIN],[L.MALIGNMARK,h.MALIGNMARK],[L.MARQUEE,h.MARQUEE],[L.MATH,h.MATH],[L.MENU,h.MENU],[L.META,h.META],[L.MGLYPH,h.MGLYPH],[L.MI,h.MI],[L.MO,h.MO],[L.MN,h.MN],[L.MS,h.MS],[L.MTEXT,h.MTEXT],[L.NAV,h.NAV],[L.NOBR,h.NOBR],[L.NOFRAMES,h.NOFRAMES],[L.NOEMBED,h.NOEMBED],[L.NOSCRIPT,h.NOSCRIPT],[L.OBJECT,h.OBJECT],[L.OL,h.OL],[L.OPTGROUP,h.OPTGROUP],[L.OPTION,h.OPTION],[L.P,h.P],[L.PARAM,h.PARAM],[L.PLAINTEXT,h.PLAINTEXT],[L.PRE,h.PRE],[L.RB,h.RB],[L.RP,h.RP],[L.RT,h.RT],[L.RTC,h.RTC],[L.RUBY,h.RUBY],[L.S,h.S],[L.SCRIPT,h.SCRIPT],[L.SEARCH,h.SEARCH],[L.SECTION,h.SECTION],[L.SELECT,h.SELECT],[L.SOURCE,h.SOURCE],[L.SMALL,h.SMALL],[L.SPAN,h.SPAN],[L.STRIKE,h.STRIKE],[L.STRONG,h.STRONG],[L.STYLE,h.STYLE],[L.SUB,h.SUB],[L.SUMMARY,h.SUMMARY],[L.SUP,h.SUP],[L.TABLE,h.TABLE],[L.TBODY,h.TBODY],[L.TEMPLATE,h.TEMPLATE],[L.TEXTAREA,h.TEXTAREA],[L.TFOOT,h.TFOOT],[L.TD,h.TD],[L.TH,h.TH],[L.THEAD,h.THEAD],[L.TITLE,h.TITLE],[L.TR,h.TR],[L.TRACK,h.TRACK],[L.TT,h.TT],[L.U,h.U],[L.UL,h.UL],[L.SVG,h.SVG],[L.VAR,h.VAR],[L.WBR,h.WBR],[L.XMP,h.XMP]]);function kr(t){var e;return(e=SP.get(t))!==null&&e!==void 0?e:h.UNKNOWN}const j=h,AP={[H.HTML]:new Set([j.ADDRESS,j.APPLET,j.AREA,j.ARTICLE,j.ASIDE,j.BASE,j.BASEFONT,j.BGSOUND,j.BLOCKQUOTE,j.BODY,j.BR,j.BUTTON,j.CAPTION,j.CENTER,j.COL,j.COLGROUP,j.DD,j.DETAILS,j.DIR,j.DIV,j.DL,j.DT,j.EMBED,j.FIELDSET,j.FIGCAPTION,j.FIGURE,j.FOOTER,j.FORM,j.FRAME,j.FRAMESET,j.H1,j.H2,j.H3,j.H4,j.H5,j.H6,j.HEAD,j.HEADER,j.HGROUP,j.HR,j.HTML,j.IFRAME,j.IMG,j.INPUT,j.LI,j.LINK,j.LISTING,j.MAIN,j.MARQUEE,j.MENU,j.META,j.NAV,j.NOEMBED,j.NOFRAMES,j.NOSCRIPT,j.OBJECT,j.OL,j.P,j.PARAM,j.PLAINTEXT,j.PRE,j.SCRIPT,j.SECTION,j.SELECT,j.SOURCE,j.STYLE,j.SUMMARY,j.TABLE,j.TBODY,j.TD,j.TEMPLATE,j.TEXTAREA,j.TFOOT,j.TH,j.THEAD,j.TITLE,j.TR,j.TRACK,j.UL,j.WBR,j.XMP]),[H.MATHML]:new Set([j.MI,j.MO,j.MN,j.MS,j.MTEXT,j.ANNOTATION_XML]),[H.SVG]:new Set([j.TITLE,j.FOREIGN_OBJECT,j.DESC]),[H.XLINK]:new Set,[H.XML]:new Set,[H.XMLNS]:new Set},Kf=new Set([j.H1,j.H2,j.H3,j.H4,j.H5,j.H6]);L.STYLE,L.SCRIPT,L.XMP,L.IFRAME,L.NOEMBED,L.NOFRAMES,L.PLAINTEXT;var I;(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(I||(I={}));const Ae={DATA:I.DATA,RCDATA:I.RCDATA,RAWTEXT:I.RAWTEXT,SCRIPT_DATA:I.SCRIPT_DATA,PLAINTEXT:I.PLAINTEXT,CDATA_SECTION:I.CDATA_SECTION};function NP(t){return t>=_.DIGIT_0&&t<=_.DIGIT_9}function Vr(t){return t>=_.LATIN_CAPITAL_A&&t<=_.LATIN_CAPITAL_Z}function vP(t){return t>=_.LATIN_SMALL_A&&t<=_.LATIN_SMALL_Z}function Qt(t){return vP(t)||Vr(t)}function Cb(t){return Qt(t)||NP(t)}function Va(t){return t+32}function v_(t){return t===_.SPACE||t===_.LINE_FEED||t===_.TABULATION||t===_.FORM_FEED}function Ib(t){return v_(t)||t===_.SOLIDUS||t===_.GREATER_THAN_SIGN}function _P(t){return t===_.NULL?F.nullCharacterReference:t>1114111?F.characterReferenceOutsideUnicodeRange:y_(t)?F.surrogateCharacterReference:A_(t)?F.noncharacterCharacterReference:S_(t)||t===_.CARRIAGE_RETURN?F.controlCharacterReference:null}class CP{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=I.DATA,this.returnState=I.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new dP(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new TP(pP,(r,a)=>{this.preprocessor.pos=this.entityStartPos+a-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(F.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(F.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const a=_P(r);a&&this._err(a,1)}}:void 0)}_err(e,n=0){var r,a;(a=(r=this.handler).onParseError)===null||a===void 0||a.call(r,this.preprocessor.getError(e,n))}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;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r?.()}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):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n<e;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,n){return this.preprocessor.startsWith(e,n)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:ue.START_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:ue.END_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:ue.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:ue.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,n){this.currentCharacterToken={type:e,chars:n,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,n;const r=this.currentToken;if(N_(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const a=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);a[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(F.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(){const e=this.currentToken;this.prepareToken(e),e.tagID=kr(e.tagName),e.type===ue.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(F.endTagWithAttributes),e.selfClosing&&this._err(F.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 ue.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case ue.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case ue.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:ue.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){const n=v_(e)?ue.WHITESPACE_CHARACTER:e===_.NULL?ue.NULL_CHARACTER:ue.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(ue.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=I.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?jt.Attribute:jt.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===I.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===I.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===I.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case I.DATA:{this._stateData(e);break}case I.RCDATA:{this._stateRcdata(e);break}case I.RAWTEXT:{this._stateRawtext(e);break}case I.SCRIPT_DATA:{this._stateScriptData(e);break}case I.PLAINTEXT:{this._statePlaintext(e);break}case I.TAG_OPEN:{this._stateTagOpen(e);break}case I.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case I.TAG_NAME:{this._stateTagName(e);break}case I.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case I.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case I.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case I.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case I.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case I.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case I.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case I.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case I.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case I.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case I.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case I.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case I.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case I.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case I.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case I.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case I.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case I.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case I.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case I.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case I.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case I.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case I.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case I.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case I.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case I.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case I.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case I.BOGUS_COMMENT:{this._stateBogusComment(e);break}case I.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case I.COMMENT_START:{this._stateCommentStart(e);break}case I.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case I.COMMENT:{this._stateComment(e);break}case I.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case I.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case I.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case I.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case I.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case I.COMMENT_END:{this._stateCommentEnd(e);break}case I.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case I.DOCTYPE:{this._stateDoctype(e);break}case I.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case I.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case I.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case I.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case I.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case I.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case I.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case I.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case I.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case I.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case I.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case I.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case I.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case I.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case I.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case I.CDATA_SECTION:{this._stateCdataSection(e);break}case I.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case I.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case I.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case I.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case _.LESS_THAN_SIGN:{this.state=I.TAG_OPEN;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitCodePoint(e);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case _.AMPERSAND:{this._startCharacterReference();break}case _.LESS_THAN_SIGN:{this.state=I.RCDATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case _.LESS_THAN_SIGN:{this.state=I.RAWTEXT_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Qt(e))this._createStartTagToken(),this.state=I.TAG_NAME,this._stateTagName(e);else switch(e){case _.EXCLAMATION_MARK:{this.state=I.MARKUP_DECLARATION_OPEN;break}case _.SOLIDUS:{this.state=I.END_TAG_OPEN;break}case _.QUESTION_MARK:{this._err(F.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=I.BOGUS_COMMENT,this._stateBogusComment(e);break}case _.EOF:{this._err(F.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(F.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=I.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Qt(e))this._createEndTagToken(),this.state=I.TAG_NAME,this._stateTagName(e);else switch(e){case _.GREATER_THAN_SIGN:{this._err(F.missingEndTagName),this.state=I.DATA;break}case _.EOF:{this._err(F.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(F.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=I.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.BEFORE_ATTRIBUTE_NAME;break}case _.SOLIDUS:{this.state=I.SELF_CLOSING_START_TAG;break}case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentTagToken();break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.tagName+=me;break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Vr(e)?Va(e):e)}}_stateRcdataLessThanSign(e){e===_.SOLIDUS?this.state=I.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=I.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Qt(e)?(this.state=I.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=I.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=I.BEFORE_ATTRIBUTE_NAME,!1;case _.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=I.SELF_CLOSING_START_TAG,!1;case _.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=I.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=I.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===_.SOLIDUS?this.state=I.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=I.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Qt(e)?(this.state=I.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=I.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=I.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case _.SOLIDUS:{this.state=I.SCRIPT_DATA_END_TAG_OPEN;break}case _.EXCLAMATION_MARK:{this.state=I.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=I.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Qt(e)?(this.state=I.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=I.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=I.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===_.HYPHEN_MINUS?(this.state=I.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=I.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===_.HYPHEN_MINUS?(this.state=I.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=I.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case _.HYPHEN_MINUS:{this.state=I.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case _.HYPHEN_MINUS:{this.state=I.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.state=I.SCRIPT_DATA_ESCAPED,this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=I.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case _.HYPHEN_MINUS:{this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case _.GREATER_THAN_SIGN:{this.state=I.SCRIPT_DATA,this._emitChars(">");break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.state=I.SCRIPT_DATA_ESCAPED,this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=I.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===_.SOLIDUS?this.state=I.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Qt(e)?(this._emitChars("<"),this.state=I.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=I.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Qt(e)?(this.state=I.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=I.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=I.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(et.SCRIPT,!1)&&Ib(this.preprocessor.peek(et.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<et.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=I.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case _.HYPHEN_MINUS:{this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case _.NULL:{this._err(F.unexpectedNullCharacter),this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case _.HYPHEN_MINUS:{this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case _.HYPHEN_MINUS:{this._emitChars("-");break}case _.LESS_THAN_SIGN:{this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case _.GREATER_THAN_SIGN:{this.state=I.SCRIPT_DATA,this._emitChars(">");break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(me);break}case _.EOF:{this._err(F.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===_.SOLIDUS?(this.state=I.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(et.SCRIPT,!1)&&Ib(this.preprocessor.peek(et.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<et.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=I.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=I.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.SOLIDUS:case _.GREATER_THAN_SIGN:case _.EOF:{this.state=I.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case _.EQUALS_SIGN:{this._err(F.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=I.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=I.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:case _.SOLIDUS:case _.GREATER_THAN_SIGN:case _.EOF:{this._leaveAttrName(),this.state=I.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case _.EQUALS_SIGN:{this._leaveAttrName(),this.state=I.BEFORE_ATTRIBUTE_VALUE;break}case _.QUOTATION_MARK:case _.APOSTROPHE:case _.LESS_THAN_SIGN:{this._err(F.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.currentAttr.name+=me;break}default:this.currentAttr.name+=String.fromCodePoint(Vr(e)?Va(e):e)}}_stateAfterAttributeName(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.SOLIDUS:{this.state=I.SELF_CLOSING_START_TAG;break}case _.EQUALS_SIGN:{this.state=I.BEFORE_ATTRIBUTE_VALUE;break}case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentTagToken();break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=I.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.QUOTATION_MARK:{this.state=I.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case _.APOSTROPHE:{this.state=I.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case _.GREATER_THAN_SIGN:{this._err(F.missingAttributeValue),this.state=I.DATA,this.emitCurrentTagToken();break}default:this.state=I.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case _.QUOTATION_MARK:{this.state=I.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.currentAttr.value+=me;break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case _.APOSTROPHE:{this.state=I.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.currentAttr.value+=me;break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this._leaveAttrValue(),this.state=I.BEFORE_ATTRIBUTE_NAME;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=I.DATA,this.emitCurrentTagToken();break}case _.NULL:{this._err(F.unexpectedNullCharacter),this.currentAttr.value+=me;break}case _.QUOTATION_MARK:case _.APOSTROPHE:case _.LESS_THAN_SIGN:case _.EQUALS_SIGN:case _.GRAVE_ACCENT:{this._err(F.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this._leaveAttrValue(),this.state=I.BEFORE_ATTRIBUTE_NAME;break}case _.SOLIDUS:{this._leaveAttrValue(),this.state=I.SELF_CLOSING_START_TAG;break}case _.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=I.DATA,this.emitCurrentTagToken();break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this._err(F.missingWhitespaceBetweenAttributes),this.state=I.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case _.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=I.DATA,this.emitCurrentTagToken();break}case _.EOF:{this._err(F.eofInTag),this._emitEOFToken();break}default:this._err(F.unexpectedSolidusInTag),this.state=I.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentComment(n);break}case _.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.data+=me;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(et.DASH_DASH,!0)?(this._createCommentToken(et.DASH_DASH.length+1),this.state=I.COMMENT_START):this._consumeSequenceIfMatch(et.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(et.DOCTYPE.length+1),this.state=I.DOCTYPE):this._consumeSequenceIfMatch(et.CDATA_START,!0)?this.inForeignNode?this.state=I.CDATA_SECTION:(this._err(F.cdataInHtmlContent),this._createCommentToken(et.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=I.BOGUS_COMMENT):this._ensureHibernation()||(this._err(F.incorrectlyOpenedComment),this._createCommentToken(2),this.state=I.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case _.HYPHEN_MINUS:{this.state=I.COMMENT_START_DASH;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptClosingOfEmptyComment),this.state=I.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=I.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case _.HYPHEN_MINUS:{this.state=I.COMMENT_END;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptClosingOfEmptyComment),this.state=I.DATA,this.emitCurrentComment(n);break}case _.EOF:{this._err(F.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=I.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case _.HYPHEN_MINUS:{this.state=I.COMMENT_END_DASH;break}case _.LESS_THAN_SIGN:{n.data+="<",this.state=I.COMMENT_LESS_THAN_SIGN;break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.data+=me;break}case _.EOF:{this._err(F.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case _.EXCLAMATION_MARK:{n.data+="!",this.state=I.COMMENT_LESS_THAN_SIGN_BANG;break}case _.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=I.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===_.HYPHEN_MINUS?this.state=I.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=I.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===_.HYPHEN_MINUS?this.state=I.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=I.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==_.GREATER_THAN_SIGN&&e!==_.EOF&&this._err(F.nestedComment),this.state=I.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case _.HYPHEN_MINUS:{this.state=I.COMMENT_END;break}case _.EOF:{this._err(F.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=I.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentComment(n);break}case _.EXCLAMATION_MARK:{this.state=I.COMMENT_END_BANG;break}case _.HYPHEN_MINUS:{n.data+="-";break}case _.EOF:{this._err(F.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=I.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case _.HYPHEN_MINUS:{n.data+="--!",this.state=I.COMMENT_END_DASH;break}case _.GREATER_THAN_SIGN:{this._err(F.incorrectlyClosedComment),this.state=I.DATA,this.emitCurrentComment(n);break}case _.EOF:{this._err(F.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=I.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.BEFORE_DOCTYPE_NAME;break}case _.GREATER_THAN_SIGN:{this.state=I.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case _.EOF:{this._err(F.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingWhitespaceBeforeDoctypeName),this.state=I.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Vr(e))this._createDoctypeToken(String.fromCharCode(Va(e))),this.state=I.DOCTYPE_NAME;else switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.NULL:{this._err(F.unexpectedNullCharacter),this._createDoctypeToken(me),this.state=I.DOCTYPE_NAME;break}case _.GREATER_THAN_SIGN:{this._err(F.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=I.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.AFTER_DOCTYPE_NAME;break}case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.name+=me;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Vr(e)?Va(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(et.PUBLIC,!1)?this.state=I.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(et.SYSTEM,!1)?this.state=I.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(F.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case _.QUOTATION_MARK:{this._err(F.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=I.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{this._err(F.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=I.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case _.GREATER_THAN_SIGN:{this._err(F.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.QUOTATION_MARK:{n.publicId="",this.state=I.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{n.publicId="",this.state=I.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case _.GREATER_THAN_SIGN:{this._err(F.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case _.QUOTATION_MARK:{this.state=I.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.publicId+=me;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case _.APOSTROPHE:{this.state=I.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.publicId+=me;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case _.GREATER_THAN_SIGN:{this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.QUOTATION_MARK:{this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.QUOTATION_MARK:{n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:{this.state=I.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case _.QUOTATION_MARK:{this._err(F.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{this._err(F.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case _.GREATER_THAN_SIGN:{this._err(F.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.QUOTATION_MARK:{n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case _.APOSTROPHE:{n.systemId="",this.state=I.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case _.GREATER_THAN_SIGN:{this._err(F.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.DATA,this.emitCurrentDoctype(n);break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case _.QUOTATION_MARK:{this.state=I.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.systemId+=me;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case _.APOSTROPHE:{this.state=I.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case _.NULL:{this._err(F.unexpectedNullCharacter),n.systemId+=me;break}case _.GREATER_THAN_SIGN:{this._err(F.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case _.SPACE:case _.LINE_FEED:case _.TABULATION:case _.FORM_FEED:break;case _.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.EOF:{this._err(F.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(F.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=I.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case _.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=I.DATA;break}case _.NULL:{this._err(F.unexpectedNullCharacter);break}case _.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case _.RIGHT_SQUARE_BRACKET:{this.state=I.CDATA_SECTION_BRACKET;break}case _.EOF:{this._err(F.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===_.RIGHT_SQUARE_BRACKET?this.state=I.CDATA_SECTION_END:(this._emitChars("]"),this.state=I.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case _.GREATER_THAN_SIGN:{this.state=I.DATA;break}case _.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=I.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}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(_.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Cb(this.preprocessor.peek(1))?I.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Cb(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===_.SEMICOLON&&this._err(F.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const __=new Set([h.DD,h.DT,h.LI,h.OPTGROUP,h.OPTION,h.P,h.RB,h.RP,h.RT,h.RTC]),Rb=new Set([...__,h.CAPTION,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]),es=new Set([h.APPLET,h.CAPTION,h.HTML,h.MARQUEE,h.OBJECT,h.TABLE,h.TD,h.TEMPLATE,h.TH]),IP=new Set([...es,h.OL,h.UL]),RP=new Set([...es,h.BUTTON]),kb=new Set([h.ANNOTATION_XML,h.MI,h.MN,h.MO,h.MS,h.MTEXT]),xb=new Set([h.DESC,h.FOREIGN_OBJECT,h.TITLE]),kP=new Set([h.TR,h.TEMPLATE,h.HTML]),xP=new Set([h.TBODY,h.TFOOT,h.THEAD,h.TEMPLATE,h.HTML]),wP=new Set([h.TABLE,h.TEMPLATE,h.HTML]),OP=new Set([h.TD,h.TH]);class LP{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=h.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===h.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===H.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){const r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){const a=this._indexOf(e)+1;this.items.splice(a,0,n),this.tagIDs.splice(a,0,r),this.stackTop++,a===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,a===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==H.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(e){for(;this.stackTop>=e;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<e)}}popUntilElementPopped(e){const n=this._indexOf(e);this.shortenToLength(Math.max(n,0))}popUntilPopped(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Kf,H.HTML)}popUntilTableCellPopped(){this.popUntilPopped(OP,H.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,n){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(wP,H.HTML)}clearBackToTableBodyContext(){this.clearBackTo(xP,H.HTML)}clearBackToTableRowContext(){this.clearBackTo(kP,H.HTML)}remove(e){const n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===h.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===h.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){const a=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case H.HTML:{if(a===e)return!0;if(n.has(a))return!1;break}case H.SVG:{if(xb.has(a))return!1;break}case H.MATHML:{if(kb.has(a))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,es)}hasInListItemScope(e){return this.hasInDynamicScope(e,IP)}hasInButtonScope(e){return this.hasInDynamicScope(e,RP)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case H.HTML:{if(Kf.has(n))return!0;if(es.has(n))return!1;break}case H.SVG:{if(xb.has(n))return!1;break}case H.MATHML:{if(kb.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===H.HTML)switch(this.tagIDs[n]){case e:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===H.HTML)switch(this.tagIDs[e]){case h.TBODY:case h.THEAD:case h.TFOOT:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===H.HTML)switch(this.tagIDs[n]){case e:return!0;case h.OPTION:case h.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&__.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Rb.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Rb.has(this.currentTagId);)this.pop()}}const So=3;var xt;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(xt||(xt={}));const wb={type:xt.Marker};class DP{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],a=n.length,i=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===xt.Marker)break;const{element:u}=l;if(this.treeAdapter.getTagName(u)===i&&this.treeAdapter.getNamespaceURI(u)===s){const c=this.treeAdapter.getAttrList(u);c.length===a&&r.push({idx:o,attrs:c})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<So)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<So)return;const a=new Map(n.map(s=>[s.name,s.value]));let i=0;for(let s=0;s<r.length;s++){const o=r[s];o.attrs.every(l=>a.get(l.name)===l.value)&&(i+=1,i>=So&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(wb)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:xt.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:xt.Element,element:e,token:n})}removeEntry(e){const n=this.entries.indexOf(e);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const e=this.entries.indexOf(wb);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===xt.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===xt.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===xt.Element&&n.element===e)}}const Jt={createDocument(){return{nodeName:"#document",mode:dt.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){const a=t.childNodes.find(i=>i.nodeName==="#documentType");if(a)a.name=e,a.publicId=n,a.systemId=r;else{const i={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};Jt.appendChild(t,i)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(Jt.isTextNode(n)){n.value+=e;return}}Jt.appendChild(t,Jt.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&Jt.isTextNode(r)?r.value+=e:Jt.insertBefore(t,Jt.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild(t){return t.childNodes[0]},getChildNodes(t){return t.childNodes},getParentNode(t){return t.parentNode},getAttrList(t){return t.attrs},getTagName(t){return t.tagName},getNamespaceURI(t){return t.namespaceURI},getTextNodeContent(t){return t.value},getCommentNodeContent(t){return t.data},getDocumentTypeNodeName(t){return t.name},getDocumentTypeNodePublicId(t){return t.publicId},getDocumentTypeNodeSystemId(t){return t.systemId},isTextNode(t){return t.nodeName==="#text"},isCommentNode(t){return t.nodeName==="#comment"},isDocumentTypeNode(t){return t.nodeName==="#documentType"},isElementNode(t){return Object.prototype.hasOwnProperty.call(t,"tagName")},setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation(t){return t.sourceCodeLocation},updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},C_="html",MP="about:legacy-compat",PP="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",I_=["+//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//"],FP=[...I_,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],BP=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),R_=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],UP=[...R_,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Ob(t,e){return e.some(n=>t.startsWith(n))}function HP(t){return t.name===C_&&t.publicId===null&&(t.systemId===null||t.systemId===MP)}function $P(t){if(t.name!==C_)return dt.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===PP)return dt.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),BP.has(n))return dt.QUIRKS;let r=e===null?FP:I_;if(Ob(n,r))return dt.QUIRKS;if(r=e===null?R_:UP,Ob(n,r))return dt.LIMITED_QUIRKS}return dt.NO_QUIRKS}const Lb={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},qP="definitionurl",jP="definitionURL",zP=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(t=>[t.toLowerCase(),t])),GP=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:H.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:H.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:H.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:H.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:H.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:H.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:H.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:H.XML}],["xml:space",{prefix:"xml",name:"space",namespace:H.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:H.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:H.XMLNS}]]),VP=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(t=>[t.toLowerCase(),t])),WP=new Set([h.B,h.BIG,h.BLOCKQUOTE,h.BODY,h.BR,h.CENTER,h.CODE,h.DD,h.DIV,h.DL,h.DT,h.EM,h.EMBED,h.H1,h.H2,h.H3,h.H4,h.H5,h.H6,h.HEAD,h.HR,h.I,h.IMG,h.LI,h.LISTING,h.MENU,h.META,h.NOBR,h.OL,h.P,h.PRE,h.RUBY,h.S,h.SMALL,h.SPAN,h.STRONG,h.STRIKE,h.SUB,h.SUP,h.TABLE,h.TT,h.U,h.UL,h.VAR]);function YP(t){const e=t.tagID;return e===h.FONT&&t.attrs.some(({name:r})=>r===Un.COLOR||r===Un.SIZE||r===Un.FACE)||WP.has(e)}function k_(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===qP){t.attrs[e].name=jP;break}}function x_(t){for(let e=0;e<t.attrs.length;e++){const n=zP.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function Zh(t){for(let e=0;e<t.attrs.length;e++){const n=GP.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function KP(t){const e=VP.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=kr(t.tagName))}function XP(t,e){return e===H.MATHML&&(t===h.MI||t===h.MO||t===h.MN||t===h.MS||t===h.MTEXT)}function ZP(t,e,n){if(e===H.MATHML&&t===h.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Un.ENCODING){const a=n[r].value.toLowerCase();return a===Lb.TEXT_HTML||a===Lb.APPLICATION_XML}}return e===H.SVG&&(t===h.FOREIGN_OBJECT||t===h.DESC||t===h.TITLE)}function QP(t,e,n,r){return(!r||r===H.HTML)&&ZP(t,e,n)||(!r||r===H.MATHML)&&XP(t,e)}const JP="hidden",eF=8,tF=3;var x;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(x||(x={}));const nF={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},w_=new Set([h.TABLE,h.TBODY,h.TFOOT,h.THEAD,h.TR]),Db={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Jt,onParseError:null};class Mb{constructor(e,n,r=null,a=null){this.fragmentContext=r,this.scriptHandler=a,this.currentToken=null,this.stopped=!1,this.insertionMode=x.INITIAL,this.originalInsertionMode=x.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={...Db,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new CP(this.options,this),this.activeFormattingElements=new DP(this.treeAdapter),this.fragmentContextID=r?kr(this.treeAdapter.getTagName(r)):h.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new LP(this.document,this.treeAdapter,this)}static parse(e,n){const r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){const r={...Db,...n};e??(e=r.treeAdapter.createElement(L.TEMPLATE,H.HTML,[]));const a=r.treeAdapter.createElement("documentmock",H.HTML,[]),i=new this(r,a,e);return i.fragmentContextID===h.TEMPLATE&&i.tmplInsertionModeStack.unshift(x.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var a;if(!this.onParseError)return;const i=(a=e.location)!==null&&a!==void 0?a:nF,s={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(s)}onItemPush(e,n,r){var a,i;(i=(a=this.treeAdapter).onItemPush)===null||i===void 0||i.call(a,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,a;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(a=(r=this.treeAdapter).onItemPop)===null||a===void 0||a.call(r,e,this.openElements.current),n){let i,s;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,s=this.fragmentContextID):{current:i,currentTagId:s}=this.openElements,this._setContextModes(i,s)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===H.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,H.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=x.TEXT}switchToPlaintextParsing(){this.insertionMode=x.TEXT,this.originalInsertionMode=x.IN_BODY,this.tokenizer.state=Ae.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===L.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==H.HTML))switch(this.fragmentContextID){case h.TITLE:case h.TEXTAREA:{this.tokenizer.state=Ae.RCDATA;break}case h.STYLE:case h.XMP:case h.IFRAME:case h.NOEMBED:case h.NOFRAMES:case h.NOSCRIPT:{this.tokenizer.state=Ae.RAWTEXT;break}case h.SCRIPT:{this.tokenizer.state=Ae.SCRIPT_DATA;break}case h.PLAINTEXT:{this.tokenizer.state=Ae.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",a=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,a),e.location){const s=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));s&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,e)}}_appendElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){const r=this.treeAdapter.createElement(e,H.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,H.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(L.HTML,H.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,h.HTML)}_appendCommentNode(e,n){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;const a=this.treeAdapter.getChildNodes(n),i=r?a.lastIndexOf(r):a.length,s=a[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:l,endCol:u,endOffset:c}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){const r=n.location,a=this.treeAdapter.getTagName(e),i=n.type===ue.END_TAG&&a===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===h.SVG&&this.treeAdapter.getTagName(n)===L.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===H.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===h.MGLYPH||e.tagID===h.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,H.HTML)}_processToken(e){switch(e.type){case ue.CHARACTER:{this.onCharacter(e);break}case ue.NULL_CHARACTER:{this.onNullCharacter(e);break}case ue.COMMENT:{this.onComment(e);break}case ue.DOCTYPE:{this.onDoctype(e);break}case ue.START_TAG:{this._processStartTag(e);break}case ue.END_TAG:{this.onEndTag(e);break}case ue.EOF:{this.onEof(e);break}case ue.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){const a=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return QP(e,a,i,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(a=>a.type===xt.Marker||this.openElements.contains(a.element)),r=n===-1?e-1:n-1;for(let a=r;a>=0;a--){const i=this.activeFormattingElements.entries[a];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=x.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(h.P),this.openElements.popUntilTagNamePopped(h.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case h.TR:{this.insertionMode=x.IN_ROW;return}case h.TBODY:case h.THEAD:case h.TFOOT:{this.insertionMode=x.IN_TABLE_BODY;return}case h.CAPTION:{this.insertionMode=x.IN_CAPTION;return}case h.COLGROUP:{this.insertionMode=x.IN_COLUMN_GROUP;return}case h.TABLE:{this.insertionMode=x.IN_TABLE;return}case h.BODY:{this.insertionMode=x.IN_BODY;return}case h.FRAMESET:{this.insertionMode=x.IN_FRAMESET;return}case h.SELECT:{this._resetInsertionModeForSelect(e);return}case h.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case h.HTML:{this.insertionMode=this.headElement?x.AFTER_HEAD:x.BEFORE_HEAD;return}case h.TD:case h.TH:{if(e>0){this.insertionMode=x.IN_CELL;return}break}case h.HEAD:{if(e>0){this.insertionMode=x.IN_HEAD;return}break}}this.insertionMode=x.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===h.TEMPLATE)break;if(r===h.TABLE){this.insertionMode=x.IN_SELECT_IN_TABLE;return}}this.insertionMode=x.IN_SELECT}_isElementCausesFosterParenting(e){return w_.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case h.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===H.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case h.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){const r=this.treeAdapter.getNamespaceURI(e);return AP[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){OB(this,e);return}switch(this.insertionMode){case x.INITIAL:{Ur(this,e);break}case x.BEFORE_HTML:{aa(this,e);break}case x.BEFORE_HEAD:{ia(this,e);break}case x.IN_HEAD:{sa(this,e);break}case x.IN_HEAD_NO_SCRIPT:{oa(this,e);break}case x.AFTER_HEAD:{la(this,e);break}case x.IN_BODY:case x.IN_CAPTION:case x.IN_CELL:case x.IN_TEMPLATE:{L_(this,e);break}case x.TEXT:case x.IN_SELECT:case x.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case x.IN_TABLE:case x.IN_TABLE_BODY:case x.IN_ROW:{Ao(this,e);break}case x.IN_TABLE_TEXT:{U_(this,e);break}case x.IN_COLUMN_GROUP:{ts(this,e);break}case x.AFTER_BODY:{ns(this,e);break}case x.AFTER_AFTER_BODY:{ai(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){wB(this,e);return}switch(this.insertionMode){case x.INITIAL:{Ur(this,e);break}case x.BEFORE_HTML:{aa(this,e);break}case x.BEFORE_HEAD:{ia(this,e);break}case x.IN_HEAD:{sa(this,e);break}case x.IN_HEAD_NO_SCRIPT:{oa(this,e);break}case x.AFTER_HEAD:{la(this,e);break}case x.TEXT:{this._insertCharacters(e);break}case x.IN_TABLE:case x.IN_TABLE_BODY:case x.IN_ROW:{Ao(this,e);break}case x.IN_COLUMN_GROUP:{ts(this,e);break}case x.AFTER_BODY:{ns(this,e);break}case x.AFTER_AFTER_BODY:{ai(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Xf(this,e);return}switch(this.insertionMode){case x.INITIAL:case x.BEFORE_HTML:case x.BEFORE_HEAD:case x.IN_HEAD:case x.IN_HEAD_NO_SCRIPT:case x.AFTER_HEAD:case x.IN_BODY:case x.IN_TABLE:case x.IN_CAPTION:case x.IN_COLUMN_GROUP:case x.IN_TABLE_BODY:case x.IN_ROW:case x.IN_CELL:case x.IN_SELECT:case x.IN_SELECT_IN_TABLE:case x.IN_TEMPLATE:case x.IN_FRAMESET:case x.AFTER_FRAMESET:{Xf(this,e);break}case x.IN_TABLE_TEXT:{Hr(this,e);break}case x.AFTER_BODY:{uF(this,e);break}case x.AFTER_AFTER_BODY:case x.AFTER_AFTER_FRAMESET:{cF(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case x.INITIAL:{dF(this,e);break}case x.BEFORE_HEAD:case x.IN_HEAD:case x.IN_HEAD_NO_SCRIPT:case x.AFTER_HEAD:{this._err(e,F.misplacedDoctype);break}case x.IN_TABLE_TEXT:{Hr(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,F.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?LB(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case x.INITIAL:{Ur(this,e);break}case x.BEFORE_HTML:{pF(this,e);break}case x.BEFORE_HEAD:{hF(this,e);break}case x.IN_HEAD:{yt(this,e);break}case x.IN_HEAD_NO_SCRIPT:{bF(this,e);break}case x.AFTER_HEAD:{TF(this,e);break}case x.IN_BODY:{We(this,e);break}case x.IN_TABLE:{Sr(this,e);break}case x.IN_TABLE_TEXT:{Hr(this,e);break}case x.IN_CAPTION:{mB(this,e);break}case x.IN_COLUMN_GROUP:{em(this,e);break}case x.IN_TABLE_BODY:{Os(this,e);break}case x.IN_ROW:{Ls(this,e);break}case x.IN_CELL:{EB(this,e);break}case x.IN_SELECT:{q_(this,e);break}case x.IN_SELECT_IN_TABLE:{yB(this,e);break}case x.IN_TEMPLATE:{AB(this,e);break}case x.AFTER_BODY:{vB(this,e);break}case x.IN_FRAMESET:{_B(this,e);break}case x.AFTER_FRAMESET:{IB(this,e);break}case x.AFTER_AFTER_BODY:{kB(this,e);break}case x.AFTER_AFTER_FRAMESET:{xB(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?DB(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case x.INITIAL:{Ur(this,e);break}case x.BEFORE_HTML:{fF(this,e);break}case x.BEFORE_HEAD:{mF(this,e);break}case x.IN_HEAD:{gF(this,e);break}case x.IN_HEAD_NO_SCRIPT:{EF(this,e);break}case x.AFTER_HEAD:{yF(this,e);break}case x.IN_BODY:{ws(this,e);break}case x.TEXT:{iB(this,e);break}case x.IN_TABLE:{Aa(this,e);break}case x.IN_TABLE_TEXT:{Hr(this,e);break}case x.IN_CAPTION:{gB(this,e);break}case x.IN_COLUMN_GROUP:{bB(this,e);break}case x.IN_TABLE_BODY:{Zf(this,e);break}case x.IN_ROW:{$_(this,e);break}case x.IN_CELL:{TB(this,e);break}case x.IN_SELECT:{j_(this,e);break}case x.IN_SELECT_IN_TABLE:{SB(this,e);break}case x.IN_TEMPLATE:{NB(this,e);break}case x.AFTER_BODY:{G_(this,e);break}case x.IN_FRAMESET:{CB(this,e);break}case x.AFTER_FRAMESET:{RB(this,e);break}case x.AFTER_AFTER_BODY:{ai(this,e);break}}}onEof(e){switch(this.insertionMode){case x.INITIAL:{Ur(this,e);break}case x.BEFORE_HTML:{aa(this,e);break}case x.BEFORE_HEAD:{ia(this,e);break}case x.IN_HEAD:{sa(this,e);break}case x.IN_HEAD_NO_SCRIPT:{oa(this,e);break}case x.AFTER_HEAD:{la(this,e);break}case x.IN_BODY:case x.IN_TABLE:case x.IN_CAPTION:case x.IN_COLUMN_GROUP:case x.IN_TABLE_BODY:case x.IN_ROW:case x.IN_CELL:case x.IN_SELECT:case x.IN_SELECT_IN_TABLE:{F_(this,e);break}case x.TEXT:{sB(this,e);break}case x.IN_TABLE_TEXT:{Hr(this,e);break}case x.IN_TEMPLATE:{z_(this,e);break}case x.AFTER_BODY:case x.IN_FRAMESET:case x.AFTER_FRAMESET:case x.AFTER_AFTER_BODY:case x.AFTER_AFTER_FRAMESET:{Jh(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===_.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case x.IN_HEAD:case x.IN_HEAD_NO_SCRIPT:case x.AFTER_HEAD:case x.TEXT:case x.IN_COLUMN_GROUP:case x.IN_SELECT:case x.IN_SELECT_IN_TABLE:case x.IN_FRAMESET:case x.AFTER_FRAMESET:{this._insertCharacters(e);break}case x.IN_BODY:case x.IN_CAPTION:case x.IN_CELL:case x.IN_TEMPLATE:case x.AFTER_BODY:case x.AFTER_AFTER_BODY:case x.AFTER_AFTER_FRAMESET:{O_(this,e);break}case x.IN_TABLE:case x.IN_TABLE_BODY:case x.IN_ROW:{Ao(this,e);break}case x.IN_TABLE_TEXT:{B_(this,e);break}}}}function rF(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):P_(t,e),n}function aF(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const a=t.openElements.items[r];if(a===e.element)break;t._isSpecialElement(a,t.openElements.tagIDs[r])&&(n=a)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function iF(t,e,n){let r=e,a=t.openElements.getCommonAncestor(e);for(let i=0,s=a;s!==n;i++,s=a){a=t.openElements.getCommonAncestor(s);const o=t.activeFormattingElements.getElementEntry(s),l=o&&i>=tF;!o||l?(l&&t.activeFormattingElements.removeEntry(o),t.openElements.remove(s)):(s=sF(t,o),r===e&&(t.activeFormattingElements.bookmark=o),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(s,r),r=s)}return r}function sF(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function oF(t,e,n){const r=t.treeAdapter.getTagName(e),a=kr(r);if(t._isElementCausesFosterParenting(a))t._fosterParentElement(n);else{const i=t.treeAdapter.getNamespaceURI(e);a===h.TEMPLATE&&i===H.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function lF(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:a}=n,i=t.treeAdapter.createElement(a.tagName,r,a.attrs);t._adoptNodes(e,i),t.treeAdapter.appendChild(e,i),t.activeFormattingElements.insertElementAfterBookmark(i,a),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,i,a.tagID)}function Qh(t,e){for(let n=0;n<eF;n++){const r=rF(t,e);if(!r)break;const a=aF(t,r);if(!a)break;t.activeFormattingElements.bookmark=r;const i=iF(t,a,r.element),s=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(i),s&&oF(t,s,i),lF(t,a,r)}}function Xf(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function uF(t,e){t._appendCommentNode(e,t.openElements.items[0])}function cF(t,e){t._appendCommentNode(e,t.document)}function Jh(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const r=t.openElements.items[0],a=t.treeAdapter.getNodeSourceCodeLocation(r);if(a&&!a.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const i=t.openElements.items[1],s=t.treeAdapter.getNodeSourceCodeLocation(i);s&&!s.endTag&&t._setEndLocation(i,e)}}}}function dF(t,e){t._setDocumentType(e);const n=e.forceQuirks?dt.QUIRKS:$P(e);HP(e)||t._err(e,F.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=x.BEFORE_HTML}function Ur(t,e){t._err(e,F.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,dt.QUIRKS),t.insertionMode=x.BEFORE_HTML,t._processToken(e)}function pF(t,e){e.tagID===h.HTML?(t._insertElement(e,H.HTML),t.insertionMode=x.BEFORE_HEAD):aa(t,e)}function fF(t,e){const n=e.tagID;(n===h.HTML||n===h.HEAD||n===h.BODY||n===h.BR)&&aa(t,e)}function aa(t,e){t._insertFakeRootElement(),t.insertionMode=x.BEFORE_HEAD,t._processToken(e)}function hF(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.HEAD:{t._insertElement(e,H.HTML),t.headElement=t.openElements.current,t.insertionMode=x.IN_HEAD;break}default:ia(t,e)}}function mF(t,e){const n=e.tagID;n===h.HEAD||n===h.BODY||n===h.HTML||n===h.BR?ia(t,e):t._err(e,F.endTagWithoutMatchingOpenElement)}function ia(t,e){t._insertFakeElement(L.HEAD,h.HEAD),t.headElement=t.openElements.current,t.insertionMode=x.IN_HEAD,t._processToken(e)}function yt(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:{t._appendElement(e,H.HTML),e.ackSelfClosing=!0;break}case h.TITLE:{t._switchToTextParsing(e,Ae.RCDATA);break}case h.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,Ae.RAWTEXT):(t._insertElement(e,H.HTML),t.insertionMode=x.IN_HEAD_NO_SCRIPT);break}case h.NOFRAMES:case h.STYLE:{t._switchToTextParsing(e,Ae.RAWTEXT);break}case h.SCRIPT:{t._switchToTextParsing(e,Ae.SCRIPT_DATA);break}case h.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=x.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(x.IN_TEMPLATE);break}case h.HEAD:{t._err(e,F.misplacedStartTagForHeadElement);break}default:sa(t,e)}}function gF(t,e){switch(e.tagID){case h.HEAD:{t.openElements.pop(),t.insertionMode=x.AFTER_HEAD;break}case h.BODY:case h.BR:case h.HTML:{sa(t,e);break}case h.TEMPLATE:{Xn(t,e);break}default:t._err(e,F.endTagWithoutMatchingOpenElement)}}function Xn(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==h.TEMPLATE&&t._err(e,F.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(h.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,F.endTagWithoutMatchingOpenElement)}function sa(t,e){t.openElements.pop(),t.insertionMode=x.AFTER_HEAD,t._processToken(e)}function bF(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.BASEFONT:case h.BGSOUND:case h.HEAD:case h.LINK:case h.META:case h.NOFRAMES:case h.STYLE:{yt(t,e);break}case h.NOSCRIPT:{t._err(e,F.nestedNoscriptInHead);break}default:oa(t,e)}}function EF(t,e){switch(e.tagID){case h.NOSCRIPT:{t.openElements.pop(),t.insertionMode=x.IN_HEAD;break}case h.BR:{oa(t,e);break}default:t._err(e,F.endTagWithoutMatchingOpenElement)}}function oa(t,e){const n=e.type===ue.EOF?F.openElementsLeftAfterEof:F.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=x.IN_HEAD,t._processToken(e)}function TF(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.BODY:{t._insertElement(e,H.HTML),t.framesetOk=!1,t.insertionMode=x.IN_BODY;break}case h.FRAMESET:{t._insertElement(e,H.HTML),t.insertionMode=x.IN_FRAMESET;break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{t._err(e,F.abandonedHeadElementChild),t.openElements.push(t.headElement,h.HEAD),yt(t,e),t.openElements.remove(t.headElement);break}case h.HEAD:{t._err(e,F.misplacedStartTagForHeadElement);break}default:la(t,e)}}function yF(t,e){switch(e.tagID){case h.BODY:case h.HTML:case h.BR:{la(t,e);break}case h.TEMPLATE:{Xn(t,e);break}default:t._err(e,F.endTagWithoutMatchingOpenElement)}}function la(t,e){t._insertFakeElement(L.BODY,h.BODY),t.insertionMode=x.IN_BODY,xs(t,e)}function xs(t,e){switch(e.type){case ue.CHARACTER:{L_(t,e);break}case ue.WHITESPACE_CHARACTER:{O_(t,e);break}case ue.COMMENT:{Xf(t,e);break}case ue.START_TAG:{We(t,e);break}case ue.END_TAG:{ws(t,e);break}case ue.EOF:{F_(t,e);break}}}function O_(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function L_(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function SF(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function AF(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function NF(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_FRAMESET)}function vF(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML)}function _F(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&Kf.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,H.HTML)}function CF(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function IF(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML),n||(t.formElement=t.openElements.current))}function RF(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const a=t.openElements.tagIDs[r];if(n===h.LI&&a===h.LI||(n===h.DD||n===h.DT)&&(a===h.DD||a===h.DT)){t.openElements.generateImpliedEndTagsWithExclusion(a),t.openElements.popUntilTagNamePopped(a);break}if(a!==h.ADDRESS&&a!==h.DIV&&a!==h.P&&t._isSpecialElement(t.openElements.items[r],a))break}t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML)}function kF(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML),t.tokenizer.state=Ae.PLAINTEXT}function xF(t,e){t.openElements.hasInScope(h.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(h.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML),t.framesetOk=!1}function wF(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(L.A);n&&(Qh(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function OF(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function LF(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(h.NOBR)&&(Qh(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,H.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function DF(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function MF(t,e){t.treeAdapter.getDocumentMode(t.document)!==dt.QUIRKS&&t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._insertElement(e,H.HTML),t.framesetOk=!1,t.insertionMode=x.IN_TABLE}function D_(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,H.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function M_(t){const e=N_(t,Un.TYPE);return e!=null&&e.toLowerCase()===JP}function PF(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,H.HTML),M_(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function FF(t,e){t._appendElement(e,H.HTML),e.ackSelfClosing=!0}function BF(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._appendElement(e,H.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function UF(t,e){e.tagName=L.IMG,e.tagID=h.IMG,D_(t,e)}function HF(t,e){t._insertElement(e,H.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Ae.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=x.TEXT}function $F(t,e){t.openElements.hasInButtonScope(h.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Ae.RAWTEXT)}function qF(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Ae.RAWTEXT)}function Pb(t,e){t._switchToTextParsing(e,Ae.RAWTEXT)}function jF(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===x.IN_TABLE||t.insertionMode===x.IN_CAPTION||t.insertionMode===x.IN_TABLE_BODY||t.insertionMode===x.IN_ROW||t.insertionMode===x.IN_CELL?x.IN_SELECT_IN_TABLE:x.IN_SELECT}function zF(t,e){t.openElements.currentTagId===h.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML)}function GF(t,e){t.openElements.hasInScope(h.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,H.HTML)}function VF(t,e){t.openElements.hasInScope(h.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(h.RTC),t._insertElement(e,H.HTML)}function WF(t,e){t._reconstructActiveFormattingElements(),k_(e),Zh(e),e.selfClosing?t._appendElement(e,H.MATHML):t._insertElement(e,H.MATHML),e.ackSelfClosing=!0}function YF(t,e){t._reconstructActiveFormattingElements(),x_(e),Zh(e),e.selfClosing?t._appendElement(e,H.SVG):t._insertElement(e,H.SVG),e.ackSelfClosing=!0}function Fb(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,H.HTML)}function We(t,e){switch(e.tagID){case h.I:case h.S:case h.B:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.SMALL:case h.STRIKE:case h.STRONG:{OF(t,e);break}case h.A:{wF(t,e);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{_F(t,e);break}case h.P:case h.DL:case h.OL:case h.UL:case h.DIV:case h.DIR:case h.NAV:case h.MAIN:case h.MENU:case h.ASIDE:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.DETAILS:case h.ADDRESS:case h.ARTICLE:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{vF(t,e);break}case h.LI:case h.DD:case h.DT:{RF(t,e);break}case h.BR:case h.IMG:case h.WBR:case h.AREA:case h.EMBED:case h.KEYGEN:{D_(t,e);break}case h.HR:{BF(t,e);break}case h.RB:case h.RTC:{GF(t,e);break}case h.RT:case h.RP:{VF(t,e);break}case h.PRE:case h.LISTING:{CF(t,e);break}case h.XMP:{$F(t,e);break}case h.SVG:{YF(t,e);break}case h.HTML:{SF(t,e);break}case h.BASE:case h.LINK:case h.META:case h.STYLE:case h.TITLE:case h.SCRIPT:case h.BGSOUND:case h.BASEFONT:case h.TEMPLATE:{yt(t,e);break}case h.BODY:{AF(t,e);break}case h.FORM:{IF(t,e);break}case h.NOBR:{LF(t,e);break}case h.MATH:{WF(t,e);break}case h.TABLE:{MF(t,e);break}case h.INPUT:{PF(t,e);break}case h.PARAM:case h.TRACK:case h.SOURCE:{FF(t,e);break}case h.IMAGE:{UF(t,e);break}case h.BUTTON:{xF(t,e);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{DF(t,e);break}case h.IFRAME:{qF(t,e);break}case h.SELECT:{jF(t,e);break}case h.OPTION:case h.OPTGROUP:{zF(t,e);break}case h.NOEMBED:case h.NOFRAMES:{Pb(t,e);break}case h.FRAMESET:{NF(t,e);break}case h.TEXTAREA:{HF(t,e);break}case h.NOSCRIPT:{t.options.scriptingEnabled?Pb(t,e):Fb(t,e);break}case h.PLAINTEXT:{kF(t,e);break}case h.COL:case h.TH:case h.TD:case h.TR:case h.HEAD:case h.FRAME:case h.TBODY:case h.TFOOT:case h.THEAD:case h.CAPTION:case h.COLGROUP:break;default:Fb(t,e)}}function KF(t,e){if(t.openElements.hasInScope(h.BODY)&&(t.insertionMode=x.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function XF(t,e){t.openElements.hasInScope(h.BODY)&&(t.insertionMode=x.AFTER_BODY,G_(t,e))}function ZF(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function QF(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(h.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(h.FORM):n&&t.openElements.remove(n))}function JF(t){t.openElements.hasInButtonScope(h.P)||t._insertFakeElement(L.P,h.P),t._closePElement()}function eB(t){t.openElements.hasInListItemScope(h.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(h.LI),t.openElements.popUntilTagNamePopped(h.LI))}function tB(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function nB(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function rB(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function aB(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(L.BR,h.BR),t.openElements.pop(),t.framesetOk=!1}function P_(t,e){const n=e.tagName,r=e.tagID;for(let a=t.openElements.stackTop;a>0;a--){const i=t.openElements.items[a],s=t.openElements.tagIDs[a];if(r===s&&(r!==h.UNKNOWN||t.treeAdapter.getTagName(i)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=a&&t.openElements.shortenToLength(a);break}if(t._isSpecialElement(i,s))break}}function ws(t,e){switch(e.tagID){case h.A:case h.B:case h.I:case h.S:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.NOBR:case h.SMALL:case h.STRIKE:case h.STRONG:{Qh(t,e);break}case h.P:{JF(t);break}case h.DL:case h.UL:case h.OL:case h.DIR:case h.DIV:case h.NAV:case h.PRE:case h.MAIN:case h.MENU:case h.ASIDE:case h.BUTTON:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.ADDRESS:case h.ARTICLE:case h.DETAILS:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.LISTING:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{ZF(t,e);break}case h.LI:{eB(t);break}case h.DD:case h.DT:{tB(t,e);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{nB(t);break}case h.BR:{aB(t);break}case h.BODY:{KF(t,e);break}case h.HTML:{XF(t,e);break}case h.FORM:{QF(t);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{rB(t,e);break}case h.TEMPLATE:{Xn(t,e);break}default:P_(t,e)}}function F_(t,e){t.tmplInsertionModeStack.length>0?z_(t,e):Jh(t,e)}function iB(t,e){var n;e.tagID===h.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function sB(t,e){t._err(e,F.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function Ao(t,e){if(t.openElements.currentTagId!==void 0&&w_.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=x.IN_TABLE_TEXT,e.type){case ue.CHARACTER:{U_(t,e);break}case ue.WHITESPACE_CHARACTER:{B_(t,e);break}}else ka(t,e)}function oB(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_CAPTION}function lB(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_COLUMN_GROUP}function uB(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.COLGROUP,h.COLGROUP),t.insertionMode=x.IN_COLUMN_GROUP,em(t,e)}function cB(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_TABLE_BODY}function dB(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.TBODY,h.TBODY),t.insertionMode=x.IN_TABLE_BODY,Os(t,e)}function pB(t,e){t.openElements.hasInTableScope(h.TABLE)&&(t.openElements.popUntilTagNamePopped(h.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function fB(t,e){M_(e)?t._appendElement(e,H.HTML):ka(t,e),e.ackSelfClosing=!0}function hB(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,H.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function Sr(t,e){switch(e.tagID){case h.TD:case h.TH:case h.TR:{dB(t,e);break}case h.STYLE:case h.SCRIPT:case h.TEMPLATE:{yt(t,e);break}case h.COL:{uB(t,e);break}case h.FORM:{hB(t,e);break}case h.TABLE:{pB(t,e);break}case h.TBODY:case h.TFOOT:case h.THEAD:{cB(t,e);break}case h.INPUT:{fB(t,e);break}case h.CAPTION:{oB(t,e);break}case h.COLGROUP:{lB(t,e);break}default:ka(t,e)}}function Aa(t,e){switch(e.tagID){case h.TABLE:{t.openElements.hasInTableScope(h.TABLE)&&(t.openElements.popUntilTagNamePopped(h.TABLE),t._resetInsertionMode());break}case h.TEMPLATE:{Xn(t,e);break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:ka(t,e)}}function ka(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,xs(t,e),t.fosterParentingEnabled=n}function B_(t,e){t.pendingCharacterTokens.push(e)}function U_(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function Hr(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)ka(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const H_=new Set([h.CAPTION,h.COL,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]);function mB(t,e){const n=e.tagID;H_.has(n)?t.openElements.hasInTableScope(h.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(h.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=x.IN_TABLE,Sr(t,e)):We(t,e)}function gB(t,e){const n=e.tagID;switch(n){case h.CAPTION:case h.TABLE:{t.openElements.hasInTableScope(h.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(h.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=x.IN_TABLE,n===h.TABLE&&Aa(t,e));break}case h.BODY:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:ws(t,e)}}function em(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.COL:{t._appendElement(e,H.HTML),e.ackSelfClosing=!0;break}case h.TEMPLATE:{yt(t,e);break}default:ts(t,e)}}function bB(t,e){switch(e.tagID){case h.COLGROUP:{t.openElements.currentTagId===h.COLGROUP&&(t.openElements.pop(),t.insertionMode=x.IN_TABLE);break}case h.TEMPLATE:{Xn(t,e);break}case h.COL:break;default:ts(t,e)}}function ts(t,e){t.openElements.currentTagId===h.COLGROUP&&(t.openElements.pop(),t.insertionMode=x.IN_TABLE,t._processToken(e))}function Os(t,e){switch(e.tagID){case h.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_ROW;break}case h.TH:case h.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(L.TR,h.TR),t.insertionMode=x.IN_ROW,Ls(t,e);break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE,Sr(t,e));break}default:Sr(t,e)}}function Zf(t,e){const n=e.tagID;switch(e.tagID){case h.TBODY:case h.TFOOT:case h.THEAD:{t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE);break}case h.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE,Aa(t,e));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:case h.TR:break;default:Aa(t,e)}}function Ls(t,e){switch(e.tagID){case h.TH:case h.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,H.HTML),t.insertionMode=x.IN_CELL,t.activeFormattingElements.insertMarker();break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{t.openElements.hasInTableScope(h.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE_BODY,Os(t,e));break}default:Sr(t,e)}}function $_(t,e){switch(e.tagID){case h.TR:{t.openElements.hasInTableScope(h.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE_BODY);break}case h.TABLE:{t.openElements.hasInTableScope(h.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE_BODY,Zf(t,e));break}case h.TBODY:case h.TFOOT:case h.THEAD:{(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(h.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=x.IN_TABLE_BODY,Zf(t,e));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:break;default:Aa(t,e)}}function EB(t,e){const n=e.tagID;H_.has(n)?(t.openElements.hasInTableScope(h.TD)||t.openElements.hasInTableScope(h.TH))&&(t._closeTableCell(),Ls(t,e)):We(t,e)}function TB(t,e){const n=e.tagID;switch(n){case h.TD:case h.TH:{t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=x.IN_ROW);break}case h.TABLE:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),$_(t,e));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:break;default:ws(t,e)}}function q_(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.OPTION:{t.openElements.currentTagId===h.OPTION&&t.openElements.pop(),t._insertElement(e,H.HTML);break}case h.OPTGROUP:{t.openElements.currentTagId===h.OPTION&&t.openElements.pop(),t.openElements.currentTagId===h.OPTGROUP&&t.openElements.pop(),t._insertElement(e,H.HTML);break}case h.HR:{t.openElements.currentTagId===h.OPTION&&t.openElements.pop(),t.openElements.currentTagId===h.OPTGROUP&&t.openElements.pop(),t._appendElement(e,H.HTML),e.ackSelfClosing=!0;break}case h.INPUT:case h.KEYGEN:case h.TEXTAREA:case h.SELECT:{t.openElements.hasInSelectScope(h.SELECT)&&(t.openElements.popUntilTagNamePopped(h.SELECT),t._resetInsertionMode(),e.tagID!==h.SELECT&&t._processStartTag(e));break}case h.SCRIPT:case h.TEMPLATE:{yt(t,e);break}}}function j_(t,e){switch(e.tagID){case h.OPTGROUP:{t.openElements.stackTop>0&&t.openElements.currentTagId===h.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===h.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===h.OPTGROUP&&t.openElements.pop();break}case h.OPTION:{t.openElements.currentTagId===h.OPTION&&t.openElements.pop();break}case h.SELECT:{t.openElements.hasInSelectScope(h.SELECT)&&(t.openElements.popUntilTagNamePopped(h.SELECT),t._resetInsertionMode());break}case h.TEMPLATE:{Xn(t,e);break}}}function yB(t,e){const n=e.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?(t.openElements.popUntilTagNamePopped(h.SELECT),t._resetInsertionMode(),t._processStartTag(e)):q_(t,e)}function SB(t,e){const n=e.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(h.SELECT),t._resetInsertionMode(),t.onEndTag(e)):j_(t,e)}function AB(t,e){switch(e.tagID){case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{yt(t,e);break}case h.CAPTION:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{t.tmplInsertionModeStack[0]=x.IN_TABLE,t.insertionMode=x.IN_TABLE,Sr(t,e);break}case h.COL:{t.tmplInsertionModeStack[0]=x.IN_COLUMN_GROUP,t.insertionMode=x.IN_COLUMN_GROUP,em(t,e);break}case h.TR:{t.tmplInsertionModeStack[0]=x.IN_TABLE_BODY,t.insertionMode=x.IN_TABLE_BODY,Os(t,e);break}case h.TD:case h.TH:{t.tmplInsertionModeStack[0]=x.IN_ROW,t.insertionMode=x.IN_ROW,Ls(t,e);break}default:t.tmplInsertionModeStack[0]=x.IN_BODY,t.insertionMode=x.IN_BODY,We(t,e)}}function NB(t,e){e.tagID===h.TEMPLATE&&Xn(t,e)}function z_(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(h.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):Jh(t,e)}function vB(t,e){e.tagID===h.HTML?We(t,e):ns(t,e)}function G_(t,e){var n;if(e.tagID===h.HTML){if(t.fragmentContext||(t.insertionMode=x.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===h.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&t._setEndLocation(r,e)}}else ns(t,e)}function ns(t,e){t.insertionMode=x.IN_BODY,xs(t,e)}function _B(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.FRAMESET:{t._insertElement(e,H.HTML);break}case h.FRAME:{t._appendElement(e,H.HTML),e.ackSelfClosing=!0;break}case h.NOFRAMES:{yt(t,e);break}}}function CB(t,e){e.tagID===h.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==h.FRAMESET&&(t.insertionMode=x.AFTER_FRAMESET))}function IB(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.NOFRAMES:{yt(t,e);break}}}function RB(t,e){e.tagID===h.HTML&&(t.insertionMode=x.AFTER_AFTER_FRAMESET)}function kB(t,e){e.tagID===h.HTML?We(t,e):ai(t,e)}function ai(t,e){t.insertionMode=x.IN_BODY,xs(t,e)}function xB(t,e){switch(e.tagID){case h.HTML:{We(t,e);break}case h.NOFRAMES:{yt(t,e);break}}}function wB(t,e){e.chars=me,t._insertCharacters(e)}function OB(t,e){t._insertCharacters(e),t.framesetOk=!1}function V_(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==H.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function LB(t,e){if(YP(e))V_(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===H.MATHML?k_(e):r===H.SVG&&(KP(e),x_(e)),Zh(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function DB(t,e){if(e.tagID===h.P||e.tagID===h.BR){V_(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===H.HTML){t._endTagOutsideForeignContent(e);break}const a=t.treeAdapter.getTagName(r);if(a.toLowerCase()===e.tagName){e.tagName=a,t.openElements.shortenToLength(n);break}}}L.AREA,L.BASE,L.BASEFONT,L.BGSOUND,L.BR,L.COL,L.EMBED,L.FRAME,L.HR,L.IMG,L.INPUT,L.KEYGEN,L.LINK,L.META,L.PARAM,L.SOURCE,L.TRACK,L.WBR;const MB=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,PB=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Bb={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function W_(t,e){const n=VB(t),r=iA("type",{handlers:{root:FB,element:BB,text:UB,comment:K_,doctype:HB,raw:qB},unknown:jB}),a={parser:n?new Mb(Bb):Mb.getFragmentParser(void 0,Bb),handle(o){r(o,a)},stitches:!1,options:e||{}};r(t,a),xr(a,Vn());const i=n?a.parser.document:a.parser.getFragment(),s=W3(i,{file:a.options.file});return a.stitches&&SI(s,"comment",function(o,l,u){const c=o;if(c.value.stitch&&u&&l!==void 0){const d=u.children;return d[l]=c.value.stitch,l}}),s.type==="root"&&s.children.length===1&&s.children[0].type===t.type?s.children[0]:s}function Y_(t,e){let n=-1;if(t)for(;++n<t.length;)e.handle(t[n])}function FB(t,e){Y_(t.children,e)}function BB(t,e){zB(t,e),Y_(t.children,e),GB(t,e)}function UB(t,e){e.parser.tokenizer.state>4&&(e.parser.tokenizer.state=0);const n={type:ue.CHARACTER,chars:t.value,location:xa(t)};xr(e,Vn(t)),e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)}function HB(t,e){const n={type:ue.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:xa(t)};xr(e,Vn(t)),e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)}function $B(t,e){e.stitches=!0;const n=WB(t);if("children"in t&&"children"in n){const r=W_({type:"root",children:t.children},e.options);n.children=r.children}K_({type:"comment",value:{stitch:n}},e)}function K_(t,e){const n=t.value,r={type:ue.COMMENT,data:n,location:xa(t)};xr(e,Vn(t)),e.parser.currentToken=r,e.parser._processToken(e.parser.currentToken)}function qB(t,e){if(e.parser.tokenizer.preprocessor.html="",e.parser.tokenizer.preprocessor.pos=-1,e.parser.tokenizer.preprocessor.lastGapPos=-2,e.parser.tokenizer.preprocessor.gapStack=[],e.parser.tokenizer.preprocessor.skipNextNewLine=!1,e.parser.tokenizer.preprocessor.lastChunkWritten=!1,e.parser.tokenizer.preprocessor.endOfChunkHit=!1,e.parser.tokenizer.preprocessor.isEol=!1,X_(e,Vn(t)),e.parser.tokenizer.write(e.options.tagfilter?t.value.replace(MB,"&lt;$1$2"):t.value,!1),e.parser.tokenizer._runParsingLoop(),e.parser.tokenizer.state===72||e.parser.tokenizer.state===78){e.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=e.parser.tokenizer._consume();e.parser.tokenizer._callState(n)}}function jB(t,e){const n=t;if(e.options.passThrough&&e.options.passThrough.includes(n.type))$B(n,e);else{let r="";throw PB.has(n.type)&&(r=". 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"),new Error("Cannot compile `"+n.type+"` node"+r)}}function xr(t,e){X_(t,e);const n=t.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=t.parser.tokenizer.preprocessor.line,n.location.endCol=t.parser.tokenizer.preprocessor.col+1,n.location.endOffset=t.parser.tokenizer.preprocessor.offset+1,t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)),t.parser.tokenizer.paused=!1,t.parser.tokenizer.inLoop=!1,t.parser.tokenizer.active=!1,t.parser.tokenizer.returnState=Ae.DATA,t.parser.tokenizer.charRefCode=-1,t.parser.tokenizer.consumedAfterSnapshot=-1,t.parser.tokenizer.currentLocation=null,t.parser.tokenizer.currentCharacterToken=null,t.parser.tokenizer.currentToken=null,t.parser.tokenizer.currentAttr={name:"",value:""}}function X_(t,e){if(e&&e.offset!==void 0){const n={startLine:e.line,startCol:e.column,startOffset:e.offset,endLine:-1,endCol:-1,endOffset:-1};t.parser.tokenizer.preprocessor.lineStartPos=-e.column+1,t.parser.tokenizer.preprocessor.droppedBufferSize=e.offset,t.parser.tokenizer.preprocessor.line=e.line,t.parser.tokenizer.currentLocation=n}}function zB(t,e){const n=t.tagName.toLowerCase();if(e.parser.tokenizer.state===Ae.PLAINTEXT)return;xr(e,Vn(t));const r=e.parser.openElements.current;let a="namespaceURI"in r?r.namespaceURI:On.html;a===On.html&&n==="svg"&&(a=On.svg);const i=Q3({...t,children:[]},{space:a===On.svg?"svg":"html"}),s={type:ue.START_TAG,tagName:n,tagID:kr(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:xa(t)};e.parser.currentToken=s,e.parser._processToken(e.parser.currentToken),e.parser.tokenizer.lastStartTagName=n}function GB(t,e){const n=t.tagName.toLowerCase();if(!e.parser.tokenizer.inForeignNode&&sP.includes(n)||e.parser.tokenizer.state===Ae.PLAINTEXT)return;xr(e,Z1(t));const r={type:ue.END_TAG,tagName:n,tagID:kr(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:xa(t)};e.parser.currentToken=r,e.parser._processToken(e.parser.currentToken),n===e.parser.tokenizer.lastStartTagName&&(e.parser.tokenizer.state===Ae.RCDATA||e.parser.tokenizer.state===Ae.RAWTEXT||e.parser.tokenizer.state===Ae.SCRIPT_DATA)&&(e.parser.tokenizer.state=Ae.DATA)}function VB(t){const e=t.type==="root"?t.children[0]:t;return!!(e&&(e.type==="doctype"||e.type==="element"&&e.tagName.toLowerCase()==="html"))}function xa(t){const e=Vn(t)||{line:void 0,column:void 0,offset:void 0},n=Z1(t)||{line:void 0,column:void 0,offset:void 0};return{startLine:e.line,startCol:e.column,startOffset:e.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function WB(t){return"children"in t?vm({...t,children:[]}):vm(t)}function YB(t){return function(e,n){return W_(e,{...t,file:n})}}function KB(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function XB(t,e){if(t==null)return{};var n,r,a=KB(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Qf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ZB(t){if(Array.isArray(t))return Qf(t)}function QB(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function JB(t,e){if(t){if(typeof t=="string")return Qf(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qf(t,e):void 0}}function e4(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
142
142
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jf(t){return ZB(t)||QB(t)||JB(t)||e4()}function Na(t){"@babel/helpers - typeof";return Na=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Na(t)}function t4(t,e){if(Na(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Na(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function n4(t){var e=t4(t,"string");return Na(e)=="symbol"?e:e+""}function Z_(t,e,n){return(e=n4(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eh(){return eh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},eh.apply(null,arguments)}function Ub(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function lr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ub(Object(n),!0).forEach(function(r){Z_(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ub(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function r4(t){var e=t.length;if(e===0||e===1)return t;if(e===2)return[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])];if(e===3)return[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])];if(e>=4)return[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]}var No={};function a4(t){if(t.length===0||t.length===1)return t;var e=t.join(".");return No[e]||(No[e]=r4(t)),No[e]}function i4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t.filter(function(i){return i!=="token"}),a=a4(r);return a.reduce(function(i,s){return lr(lr({},i),n[s])},e)}function Hb(t){return t.join(" ")}function s4(t,e){var n=0;return function(r){return n+=1,r.map(function(a,i){return Q_({node:a,stylesheet:t,useInlineStyles:e,key:"code-segment-".concat(n,"-").concat(i)})})}}function Q_(t){var e=t.node,n=t.stylesheet,r=t.style,a=r===void 0?{}:r,i=t.useInlineStyles,s=t.key,o=e.properties,l=e.type,u=e.tagName,c=e.value;if(l==="text")return c;if(u){var d=s4(n,i),p;if(!i)p=lr(lr({},o),{},{className:Hb(o.className)});else{var f=Object.keys(n).reduce(function(y,T){return T.split(".").forEach(function(S){y.includes(S)||y.push(S)}),y},[]),m=o.className&&o.className.includes("token")?["token"]:[],g=o.className&&m.concat(o.className.filter(function(y){return!f.includes(y)}));p=lr(lr({},o),{},{className:Hb(g)||void 0,style:i4(o.className,Object.assign({},o.style,a),n)})}var b=d(e.children);return Ke.createElement(u,eh({key:s},p),b)}}const o4=(function(t,e){var n=t.listLanguages();return n.indexOf(e)!==-1});var l4=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function $b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function cn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$b(Object(n),!0).forEach(function(r){Z_(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$b(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var u4=/\n/g;function c4(t){return t.match(u4)}function d4(t){var e=t.lines,n=t.startingLineNumber,r=t.style;return e.map(function(a,i){var s=i+n;return Ke.createElement("span",{key:"line-".concat(i),className:"react-syntax-highlighter-line-number",style:typeof r=="function"?r(s):r},"".concat(s,`
143
143
  `))})}function p4(t){var e=t.codeString,n=t.codeStyle,r=t.containerStyle,a=r===void 0?{float:"left",paddingRight:"10px"}:r,i=t.numberStyle,s=i===void 0?{}:i,o=t.startingLineNumber;return Ke.createElement("code",{style:Object.assign({},n,a)},d4({lines:e.replace(/\n$/,"").split(`
@@ -168,7 +168,7 @@ Error: Tool responded with an error`)}else if(r.state==="output-denied"){const i
168
168
  Input: ${i||"[No input]"}...
169
169
  Output: Tool execution was denied`)}}}return n.length>0?n.join(`
170
170
 
171
- `):null}const G9="User denied this tool call, give other alternatives.";function AC(t){const e=K.c(15),{approvalId:n}=t,{addToolApprovalResponse:r}=En();let a;e[0]!==r||e[1]!==n?(a=d=>{d.stopPropagation(),r({id:n,approved:!1,reason:G9})},e[0]=r,e[1]=n,e[2]=a):a=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=E.jsx(V1,{className:"size-4"}),e[3]=i):i=e[3];let s;e[4]!==a?(s=E.jsxs(Ee,{type:"button",variant:"outline",onClick:a,children:[i,"Deny"]}),e[4]=a,e[5]=s):s=e[5];let o;e[6]!==r||e[7]!==n?(o=d=>{d.stopPropagation(),r({id:n,approved:!0})},e[6]=r,e[7]=n,e[8]=o):o=e[8];let l;e[9]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx(Gn,{className:"size-4"}),e[9]=l):l=e[9];let u;e[10]!==o?(u=E.jsxs(Ee,{type:"button",variant:"default",className:"text-muted-foreground",onClick:o,children:[l,"Approve"]}),e[10]=o,e[11]=u):u=e[11];let c;return e[12]!==s||e[13]!==u?(c=E.jsxs("div",{className:"flex items-center gap-2",children:[s,u]}),e[12]=s,e[13]=u,e[14]=c):c=e[14],c}function I1(t){const e=ir(t);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function V9(t,e){switch(t){case"input-streaming":case"input-available":return`Calling ${e}...`;case"approval-requested":return`Approve ${e}`;case"output-denied":return`Denied ${e}`;case"output-available":return`Called ${e}`;case"output-error":return`Error calling ${e}`;default:return`Calling ${e}...`}}function W9(t){switch(t){case"input-streaming":case"input-available":return"Generating input";case"approval-requested":return"Waiting for approval";case"output-denied":return"Execution denied";case"output-available":return"Tool answered";case"output-error":return"Tool failed";default:return"Calling tool"}}function R1(t){const e=K.c(19),{part:n,annotations:r,latency:a}=t;let i;if(e[0]!==n){const S="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type==="dynamic-tool"?"Dynamic Tool":n.type.replace("tool-","")||"Tool",A=q9(S);i=V9(n.state,A),e[0]=n,e[1]=i}else i=e[1];const s=i;let o;e[2]!==n.state?(o=W9(n.state),e[2]=n.state,e[3]=o):o=e[3];const l=o;let u;e[4]!==n.state?(u=SC(n.state),e[4]=n.state,e[5]=u):u=e[5];const c=u;let d="";if(n.input!==void 0&&(d=`# Input
171
+ `):null}const G9="User denied this tool call, give other alternatives.";function AC(t){const e=K.c(15),{approvalId:n}=t,{addToolApprovalResponse:r}=En();let a;e[0]!==r||e[1]!==n?(a=d=>{d.stopPropagation(),r({id:n,approved:!1,reason:G9})},e[0]=r,e[1]=n,e[2]=a):a=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=E.jsx(j1,{className:"size-4"}),e[3]=i):i=e[3];let s;e[4]!==a?(s=E.jsxs(Ee,{type:"button",variant:"outline",onClick:a,children:[i,"Deny"]}),e[4]=a,e[5]=s):s=e[5];let o;e[6]!==r||e[7]!==n?(o=d=>{d.stopPropagation(),r({id:n,approved:!0})},e[6]=r,e[7]=n,e[8]=o):o=e[8];let l;e[9]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx(Gn,{className:"size-4"}),e[9]=l):l=e[9];let u;e[10]!==o?(u=E.jsxs(Ee,{type:"button",variant:"default",className:"text-muted-foreground",onClick:o,children:[l,"Approve"]}),e[10]=o,e[11]=u):u=e[11];let c;return e[12]!==s||e[13]!==u?(c=E.jsxs("div",{className:"flex items-center gap-2",children:[s,u]}),e[12]=s,e[13]=u,e[14]=c):c=e[14],c}function I1(t){const e=ir(t);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function V9(t,e){switch(t){case"input-streaming":case"input-available":return`Calling ${e}...`;case"approval-requested":return`Approve ${e}`;case"output-denied":return`Denied ${e}`;case"output-available":return`Called ${e}`;case"output-error":return`Error calling ${e}`;default:return`Calling ${e}...`}}function W9(t){switch(t){case"input-streaming":case"input-available":return"Generating input";case"approval-requested":return"Waiting for approval";case"output-denied":return"Execution denied";case"output-available":return"Tool answered";case"output-error":return"Tool failed";default:return"Calling tool"}}function R1(t){const e=K.c(19),{part:n,annotations:r,latency:a}=t;let i;if(e[0]!==n){const S="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type==="dynamic-tool"?"Dynamic Tool":n.type.replace("tool-","")||"Tool",A=q9(S);i=V9(n.state,A),e[0]=n,e[1]=i}else i=e[1];const s=i;let o;e[2]!==n.state?(o=W9(n.state),e[2]=n.state,e[3]=o):o=e[3];const l=o;let u;e[4]!==n.state?(u=SC(n.state),e[4]=n.state,e[5]=u):u=e[5];const c=u;let d="";if(n.input!==void 0&&(d=`# Input
172
172
  `+I1(n.input)),n.state==="output-error"){const S=fm(n);d&&(d=d+`
173
173
 
174
174
  `),d=d+(`# Error
@@ -183,4 +183,4 @@ ${o}`;let d;return e[5]!==l||e[6]!==r||e[7]!==o||e[8]!==c||e[9]!==i?(d=E.jsx("di
183
183
  ${n.input?.prompt??"No prompt provided"}
184
184
 
185
185
  # ${c?"Error":"Execution"}
186
- ${v}`,C=b?.icon,k=b?.title??"Subtask";let R;e[9]===Symbol.for("react.memo_cache_sentinel")?(R=E.jsx(pr,{}),e[9]=R):R=e[9];let D;e[10]!==C||e[11]!==k?(D=E.jsx(cs,{icon:C,name:k,size:"2xs",fallbackIcon:R}),e[10]=C,e[11]=k,e[12]=D):D=e[12];const w=D;let P;e[13]!==n?(P=yC(n),e[13]=n,e[14]=P):P=e[14];const $=P;let B;e[15]!==$?(B=$?E.jsx(AC,{approvalId:$}):void 0,e[15]=$,e[16]=B):B=e[16];const G=B;let U;return e[17]!==G||e[18]!==a||e[19]!==N||e[20]!==f||e[21]!==w||e[22]!==i||e[23]!==S||e[24]!==T||e[25]!==y?(U=E.jsx("div",{className:"my-2",children:E.jsx(pm,{icon:w,title:T,summary:S,usage:y,latency:i,detail:N,annotations:a,state:f,actions:G})}),e[17]=G,e[18]=a,e[19]=N,e[20]=f,e[21]=w,e[22]=i,e[23]=S,e[24]=T,e[25]=y,e[26]=U):U=e[26],U}function X9(t){const e=K.c(5),{parts:n}=t,r=n?.length,a=n?.[n.length-1];let i;e[0]!==a||e[1]!==r?(i={enabled:!0,contentDeps:[r,a]},e[0]=a,e[1]=r,e[2]=i):i=e[2];const{sentinelRef:s}=TC(i);let o;return e[3]!==s?(o=E.jsx("div",{ref:s,className:"h-0"}),e[3]=s,e[4]=o):o=e[4],o}function Z9(t){return t.type==="reasoning"}function Q9(t){const e=[],n=new Map,r=new Map;if(t)for(const a of t.parts){if(Z9(a)){e.push(a);continue}if(a.type==="data-tool-metadata"&&"id"in a&&"data"in a){const i=a.data,s={};i.annotations&&(s.annotations=i.annotations),typeof i.latencyMs=="number"&&Number.isFinite(i.latencyMs)&&(s.latencySeconds=i.latencyMs/1e3),n.set(a.id,s);continue}a.type==="data-tool-subtask-metadata"&&"id"in a&&r.set(a.id,a.data)}return{reasoningParts:e,dataParts:{toolMetadata:n,toolSubtaskMetadata:r}}}const J9={planning:{icon:E.jsx(aA,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:E.jsx(q1,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},eq=1200;function tq(){const t=K.c(7),[e,n]=O.useState("planning");let r,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const l=setTimeout(()=>{n("thinking")},eq);return()=>{clearTimeout(l)}},a=[],t[0]=r,t[1]=a):(r=t[0],a=t[1]),O.useEffect(r,a);const i=J9[e];let s;t[2]!==i.label?(s=E.jsxs("span",{className:"text-[15px] text-muted-foreground shimmer",children:[i.label,"..."]}),t[2]=i.label,t[3]=s):s=t[3];let o;return t[4]!==i.icon||t[5]!==s?(o=E.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:E.jsxs("span",{className:"flex items-center gap-1.5",children:[i.icon,s]})}),t[4]=i.icon,t[5]=s,t[6]=o):o=t[6],o}function k1(t){const e=K.c(16),{isStreaming:n,thoughtMessage:r,isExpanded:a,reasoningTokens:i}=t;let s;e[0]!==a||e[1]!==n?(s=n?E.jsx(q1,{className:"text-muted-foreground shrink-0 shimmer",size:14}):E.jsxs("span",{className:"relative w-[14px] h-[14px] shrink-0",children:[E.jsx(X1,{className:re("absolute inset-0 text-muted-foreground transition-transform",a&&"rotate-90","opacity-0 group-hover/thought-summary:opacity-100"),size:14}),E.jsx(nA,{className:"absolute inset-0 text-muted-foreground shrink-0 opacity-100 group-hover/thought-summary:opacity-0 transition-opacity",size:14})]}),e[0]=a,e[1]=n,e[2]=s):s=e[2];const o=n&&"shimmer";let l;e[3]!==o?(l=re("text-[15px] text-muted-foreground",o),e[3]=o,e[4]=l):l=e[4];const u=n?"Thinking...":r;let c;e[5]!==l||e[6]!==u?(c=E.jsx("span",{className:l,children:u}),e[5]=l,e[6]=u,e[7]=c):c=e[7];let d;e[8]!==i?(d=i.toLocaleString(),e[8]=i,e[9]=d):d=e[9];let p;e[10]!==d?(p=E.jsxs("span",{className:"text-[10px] font-mono tabular-nums text-muted-foreground/50 ml-2 mt-px",children:[d," tokens"]}),e[10]=d,e[11]=p):p=e[11];let f;return e[12]!==s||e[13]!==c||e[14]!==p?(f=E.jsxs("span",{className:"flex items-center gap-1.5",children:[s,c,p]}),e[12]=s,e[13]=c,e[14]=p,e[15]=f):f=e[15],f}function nq(t){const e=K.c(40),{duration:n,parts:r,reasoningTokens:a,id:i,isStreaming:s}=t,[o,l]=O.useState(!1),u=O.useRef(null);let c;e[0]!==s?(c=()=>{s&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},e[0]=s,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==r?(d=[r,s],e[2]=s,e[3]=r,e[4]=d):d=e[4],O.useEffect(c,d);let p;e[5]!==n?(p=n&&n/1e3>1?`Thought for ${(n/1e3).toFixed(1)}s`:"Thought",e[5]=n,e[6]=p):p=e[6];const f=p;if(r.every(rq)){let w;return e[7]!==o||e[8]!==s||e[9]!==a||e[10]!==f?(w=E.jsx("div",{className:"mb-2",children:E.jsx(k1,{isStreaming:s,thoughtMessage:f,isExpanded:o,reasoningTokens:a})}),e[7]=o,e[8]=s,e[9]=a,e[10]=f,e[11]=w):w=e[11],w}const g=s||o,b=s?void 0:l,y=!s&&"cursor-pointer hover:opacity-100",T=s&&"cursor-default";let S;e[12]!==y||e[13]!==T?(S=re("group/thought-summary flex items-center gap-1.5 py-2 opacity-60 transition-opacity",y,T),e[12]=y,e[13]=T,e[14]=S):S=e[14];let A;e[15]!==o||e[16]!==s||e[17]!==a||e[18]!==f?(A=E.jsx(k1,{isStreaming:s,thoughtMessage:f,isExpanded:o,reasoningTokens:a}),e[15]=o,e[16]=s,e[17]=a,e[18]=f,e[19]=A):A=e[19];let v;e[20]!==S||e[21]!==A?(v=E.jsx(U1,{asChild:!0,children:E.jsx("button",{type:"button",className:S,children:A})}),e[20]=S,e[21]=A,e[22]=v):v=e[22];let N;e[23]!==s?(N=s&&E.jsx("div",{className:"absolute top-0 left-0 right-0 h-16 bg-linear-to-b from-background to-transparent pointer-events-none z-10"}),e[23]=s,e[24]=N):N=e[24];let C;if(e[25]!==i||e[26]!==r){let w;e[28]!==i?(w=(P,$)=>E.jsx("div",{className:"text-muted-foreground markdown-sm pb-2",children:E.jsx(dm,{id:`${i}-reasoning-${$}`,text:P.text})},`${i}-reasoning-${$}`),e[28]=i,e[29]=w):w=e[29],C=r.map(w),e[25]=i,e[26]=r,e[27]=C}else C=e[27];let k;e[30]!==C?(k=E.jsx("div",{ref:u,className:"ml-[6px] border-l-2 pl-4 mt-1 mb-2 h-[100px] overflow-y-auto",children:C}),e[30]=C,e[31]=k):k=e[31];let R;e[32]!==N||e[33]!==k?(R=E.jsx(H1,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:E.jsxs("div",{className:"relative",children:[N,k]})}),e[32]=N,e[33]=k,e[34]=R):R=e[34];let D;return e[35]!==v||e[36]!==R||e[37]!==g||e[38]!==b?(D=E.jsx("div",{className:"flex flex-col mb-2",children:E.jsxs($1,{open:g,onOpenChange:b,children:[v,R]})}),e[35]=v,e[36]=R,e[37]=g,e[38]=b,e[39]=D):D=e[39],D}function rq(t){return t.text?.includes("REDACTED")}function aq(t){const e=K.c(45),{part:n,id:r,usageStats:a,dataParts:i}=t;let s;e[0]!==i.toolMetadata?(s=c=>i.toolMetadata.get(c),e[0]=i.toolMetadata,e[1]=s):s=e[1];const o=s;let l;e[2]!==i.toolSubtaskMetadata?(l=c=>i.toolSubtaskMetadata.get(c),e[2]=i.toolSubtaskMetadata,e[3]=l):l=e[3];const u=l;switch(n.type){case"dynamic-tool":{let c;e[4]!==o||e[5]!==n.toolCallId?(c=o(n.toolCallId)?.annotations,e[4]=o,e[5]=n.toolCallId,e[6]=c):c=e[6];let d;e[7]!==o||e[8]!==n.toolCallId?(d=o(n.toolCallId)?.latencySeconds,e[7]=o,e[8]=n.toolCallId,e[9]=d):d=e[9];let p;return e[10]!==n||e[11]!==c||e[12]!==d?(p=E.jsx(R1,{part:n,annotations:c,latency:d}),e[10]=n,e[11]=c,e[12]=d,e[13]=p):p=e[13],p}case"tool-user_ask":{let c;e[14]!==o||e[15]!==n.toolCallId?(c=o(n.toolCallId)?.latencySeconds,e[14]=o,e[15]=n.toolCallId,e[16]=c):c=e[16];let d;return e[17]!==n||e[18]!==c?(d=E.jsx(Y9,{part:n,latency:c}),e[17]=n,e[18]=c,e[19]=d):d=e[19],d}case"tool-subtask":{let c;e[20]!==u||e[21]!==n.toolCallId?(c=u(n.toolCallId),e[20]=u,e[21]=n.toolCallId,e[22]=c):c=e[22];let d;e[23]!==o||e[24]!==n.toolCallId?(d=o(n.toolCallId)?.annotations,e[23]=o,e[24]=n.toolCallId,e[25]=d):d=e[25];let p;e[26]!==o||e[27]!==n.toolCallId?(p=o(n.toolCallId)?.latencySeconds,e[26]=o,e[27]=n.toolCallId,e[28]=p):p=e[28];let f;return e[29]!==n||e[30]!==c||e[31]!==d||e[32]!==p?(f=E.jsx(K9,{part:n,subtaskMeta:c,annotations:d,latency:p}),e[29]=n,e[30]=c,e[31]=d,e[32]=p,e[33]=f):f=e[33],f}case"text":{let c;return e[34]!==r||e[35]!==n||e[36]!==a?(c=E.jsx(EC,{id:r,part:n,extraActions:a,copyable:!0}),e[34]=r,e[35]=n,e[36]=a,e[37]=c):c=e[37],c}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":return null;default:{const c=n;if(c.type.startsWith("tool-")){const d=c.toolCallId;let p;e[38]!==i.toolMetadata||e[39]!==d?(p=i.toolMetadata.get(d),e[38]=i.toolMetadata,e[39]=d,e[40]=p):p=e[40];const f=p,m=f?.annotations,g=f?.latencySeconds;let b;return e[41]!==c||e[42]!==m||e[43]!==g?(b=E.jsx(R1,{part:c,annotations:m,latency:g}),e[41]=c,e[42]=m,e[43]=g,e[44]=b):b=e[44],b}if(c.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${c.type}`)}}}function iq(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsx("div",{className:"text-[15px] text-muted-foreground/60 py-2",children:"No response was generated"}),t[0]=e):e=t[0],e}function sq(t){const e=K.c(7),{className:n,children:r}=t;let a;e[0]!==n?(a=re("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=a):a=e[1];let i;e[2]!==r?(i=E.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:E.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[15px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=i):i=e[3];let s;return e[4]!==a||e[5]!==i?(s=E.jsx("div",{className:a,children:i}),e[4]=a,e[5]=i,e[6]=s):s=e[6],s}function oq(t){const e=K.c(19),{message:n,status:r,className:a,isLast:i}=t,s=i===void 0?!1:i,o=r==="streaming",u=o||r==="submitted",c=n!==null&&n.parts.length>0,{reasoningParts:d,dataParts:p}=Q9(n),f=d.length>0;let m;if(e[0]!==n){const S=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,A=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;m=S!==null?A.getTime()-S.getTime():null,e[0]=n,e[1]=m}else m=e[1];const g=m;let b;e[2]!==p||e[3]!==g||e[4]!==c||e[5]!==f||e[6]!==u||e[7]!==o||e[8]!==n||e[9]!==d?(b=c?E.jsxs(E.Fragment,{children:[f&&E.jsx(nq,{duration:g,parts:d,id:n.id,isStreaming:o,reasoningTokens:n.metadata?.usage?.reasoningTokens??0}),n.parts.map((S,A)=>{const v=A===n.parts.length-1,N=v?iI(sI(),n.metadata?.usage):null;return E.jsx(aq,{part:S,id:n.id,usageStats:v&&E.jsx(m_,{usage:N}),dataParts:p},`${n.id}-${A}`)})]}):u?E.jsx(tq,{}):E.jsx(iq,{}),e[2]=p,e[3]=g,e[4]=c,e[5]=f,e[6]=u,e[7]=o,e[8]=n,e[9]=d,e[10]=b):b=e[10];let y;e[11]!==s||e[12]!==o||e[13]!==n?.parts?(y=s&&o&&E.jsx(X9,{parts:n?.parts}),e[11]=s,e[12]=o,e[13]=n?.parts,e[14]=y):y=e[14];let T;return e[15]!==a||e[16]!==b||e[17]!==y?(T=E.jsxs(sq,{className:a,children:[b,y]}),e[15]=a,e[16]=b,e[17]=y,e[18]=T):T=e[18],T}const lq=[e_.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),_v,Rv];function uq(t){const e=K.c(5),{tiptapDoc:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let a;e[1]!==n?(a={extensions:lq,content:n,editable:!1,editorProps:r},e[1]=n,e[2]=a):a=e[2];const i=gv(a);if(!i)return null;let s;return e[3]!==i?(s=E.jsx(Lh,{editor:i,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=i,e[4]=s):s=e[4],s}function cq(t){const e=K.c(24),{message:n,className:r,onScrollToPair:a}=t,{id:i,parts:s,metadata:o}=n,[l,u]=O.useState(!1);if(!s||s.length===0)return null;let c;e[0]!==a?(c=()=>{u(!0),a?.()},e[0]=a,e[1]=c):c=e[1];const d=c,p=o?.tiptapDoc;let f;e[2]!==r?(f=re("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[2]=r,e[3]=f):f=e[3];let m,g;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=()=>u(!0),g=()=>u(!1),e[4]=m,e[5]=g):(m=e[4],g=e[5]);const b=l?"overflow-auto opacity-100":"overflow-hidden opacity-99 mask-b-from-1%";let y;e[6]!==b?(y=re("z-10 px-4 py-2 transition-opacity max-h-[120px] flex-1",b),e[6]=b,e[7]=y):y=e[7];let T;e[8]!==p||e[9]!==i||e[10]!==o||e[11]!==s?(T=p?E.jsx(uq,{tiptapDoc:o.tiptapDoc}):s.map((C,k)=>C.type==="text"?E.jsx(EC,{id:i,part:C},`${i}-${k}`):null),e[8]=p,e[9]=i,e[10]=o,e[11]=s,e[12]=T):T=e[12];let S;e[13]!==T?(S=E.jsx("div",{children:T}),e[13]=T,e[14]=S):S=e[14];let A;e[15]!==y||e[16]!==S?(A=E.jsx("div",{className:y,children:S}),e[15]=y,e[16]=S,e[17]=A):A=e[17];let v;e[18]!==d||e[19]!==A?(v=E.jsx("div",{tabIndex:0,onClick:d,onFocus:m,onBlur:g,className:"w-full border min-w-0 shadow-xs rounded-lg text-[0.9375rem] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:A}),e[18]=d,e[19]=A,e[20]=v):v=e[20];let N;return e[21]!==v||e[22]!==f?(N=E.jsx(E.Fragment,{children:E.jsx("div",{className:f,children:v})}),e[21]=v,e[22]=f,e[23]=N):N=e[23],N}function dq(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(r&&r.role==="user"){const a=t[n+1];a&&a.role==="assistant"?(e.push({user:r,assistant:a}),n++):e.push({user:r,assistant:null})}}return e}function x1(t){const e=K.c(14),{pair:n,isLastPair:r,status:a}=t,i=O.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i.current&&i.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=s):s=e[0];const o=s;let l;e[1]!==r?(l=m=>{i.current=m,r&&m?.scrollIntoView({behavior:"smooth",block:"start"})},e[1]=r,e[2]=l):l=e[2];const u=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("div",{className:"sticky top-0 z-50 w-full h-4",style:{backgroundColor:"var(--chat-surface)"}}),e[3]=c):c=e[3];let d;e[4]!==n.user?(d=E.jsx("div",{className:"sticky mb-3 top-4 z-50",children:E.jsx(cq,{message:n.user,onScrollToPair:o})}),e[4]=n.user,e[5]=d):d=e[5];let p;e[6]!==r||e[7]!==n.assistant||e[8]!==a?(p=E.jsx(oq,{message:n.assistant,status:a,isLast:r}),e[6]=r,e[7]=n.assistant,e[8]=a,e[9]=p):p=e[9];let f;return e[10]!==u||e[11]!==d||e[12]!==p?(f=E.jsxs("div",{ref:u,className:"flex flex-col pb-2",children:[c,d,p]}),e[10]=u,e[11]=d,e[12]=p,e[13]=f):f=e[13],f}const pq="https://sites-openrouter.decocache.com/mcp",fq="https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg";function hq({title:t="No model provider connected",description:e="Connect to a model provider to unlock AI-powered features.",org:n}){const r=II(),[,a]=VC(),i=F1(),{data:s}=HC.useSession(),o=RI(),l=s?.user?.id??"",u=()=>{i({to:"/$org/$project/mcps",params:{org:n.slug,project:Xa},search:{action:"create"}})},c=async()=>{if(!n.id||!l){Gt.error("Not authenticated");return}try{const d=o?.find(m=>m.connection_url===pq);if(d){a(!1),i({to:"/$org/$project/mcps/$connectionId",params:{org:n.slug,project:Xa,connectionId:d.id}});return}const p=YC({id:kI("conn")}),f=await r.create.mutateAsync(p);a(!1),i({to:"/$org/$project/mcps/$connectionId",params:{org:n.slug,project:Xa,connectionId:f.id}})}catch(d){Gt.error(`Failed to connect OpenRouter: ${d instanceof Error?d.message:String(d)}`)}};return E.jsx(CI,{image:E.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),title:t,description:e,actions:E.jsxs(E.Fragment,{children:[E.jsxs(Ee,{variant:"outline",onClick:c,disabled:r.create.isPending,children:[E.jsx("img",{src:fq,alt:"OpenRouter",className:"size-4"}),r.create.isPending?"Installing...":"Install OpenRouter"]}),E.jsx(Ee,{variant:"outline",onClick:u,children:"Install Connection"})]})})}function mq(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),a=Math.floor(r/6e4),i=Math.floor(r/36e5);return a<1?"now":a<60?`${a}m`:`${i}h`}function gq(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(n.getTime()-864e5),a=new Date(n.getTime()-7*864e5),i=new Date(n.getTime()-30*864e5),s=[],o=[],l=[],u=[],c=[];for(const p of t){const f=new Date(p.updated_at);f>=n?s.push(p):f>=r?o.push(p):f>=a?l.push(p):f>=i?u.push(p):c.push(p)}const d=[];return s.length>0&&d.push({label:"Today",threads:s,showRelativeTime:!0}),o.length>0&&d.push({label:"Yesterday",threads:o,showRelativeTime:!1}),l.length>0&&d.push({label:"7 days ago",threads:l,showRelativeTime:!1}),u.length>0&&d.push({label:"30 days ago",threads:u,showRelativeTime:!1}),c.length>0&&d.push({label:"Older",threads:c,showRelativeTime:!1}),d}function bq(t){const e=K.c(51),{variant:n}=t,r=n===void 0?"icon":n,[a,i]=O.useState(""),{activeThreadId:s,switchToThread:o,threads:l,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d,hideThread:p}=En(),f=O.useRef(null),m=O.useRef(null);let g;e[0]!==d||e[1]!==u||e[2]!==c?(g=z=>{m.current&&m.current.disconnect(),z&&u&&!c&&d&&(m.current=new IntersectionObserver(M=>{M[0]?.isIntersecting&&u&&!c&&d&&d()},{rootMargin:"100px"}),m.current.observe(z)),f.current=z},e[0]=d,e[1]=u,e[2]=c,e[3]=g):g=e[3];const b=g;let y,T,S,A,v,N,C,k,R,D,w;if(e[4]!==s||e[5]!==u||e[6]!==p||e[7]!==c||e[8]!==a||e[9]!==b||e[10]!==o||e[11]!==l||e[12]!==r){const z=a.trim()?l.filter(W=>W.title.toLowerCase().includes(a.toLowerCase())):l,M=gq(z);A=as,S=bt,T=vr,e[24]!==r?(D=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:r==="outline"?E.jsx(Ee,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:E.jsx(_m,{size:16})}):E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:E.jsx(_m,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[24]=r,e[25]=D):D=e[25],e[26]===Symbol.for("react.memo_cache_sentinel")?(w=E.jsx(Tt,{children:"Chat history"}),e[26]=w):w=e[26],y=Cr,C="end",k="w-80 p-0";let Y;e[27]===Symbol.for("react.memo_cache_sentinel")?(Y=E.jsx(K1,{size:16,className:"text-muted-foreground shrink-0"}),e[27]=Y):Y=e[27];let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=W=>i(W.target.value),e[28]=X):X=e[28],e[29]!==a?(R=E.jsx("div",{className:"border-b",children:E.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[Y,E.jsx("input",{type:"text",placeholder:"Search chats...",value:a,onChange:X,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=a,e[30]=R):R=e[30],v="max-h-[300px] overflow-y-auto",N=z.length===0?E.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:a.trim()?"No chats found":"No chats yet"}):E.jsxs(E.Fragment,{children:[M.map((W,ae)=>E.jsxs("div",{children:[ae>0&&E.jsx("div",{className:"border-t mx-3"}),E.jsx("div",{className:"px-3 py-1",children:E.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:W.label})}),W.threads.map(Q=>{const ne=Q.id===s;return E.jsxs("div",{className:re("flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group",ne&&"bg-accent/50"),onClick:()=>o(Q.id),children:[E.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[E.jsx("span",{className:"text-sm truncate",children:Q.title||"New chat"}),E.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:ne?"current":W.showRelativeTime?mq(Q.updated_at):null})]}),E.jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),p(Q.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:E.jsx(xI,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},Q.id)})]},W.label)),!a.trim()&&u&&E.jsx("div",{ref:b,className:"h-4"}),c&&E.jsx("div",{className:"p-3 text-center text-xs text-muted-foreground",children:"Loading more chats..."})]}),e[4]=s,e[5]=u,e[6]=p,e[7]=c,e[8]=a,e[9]=b,e[10]=o,e[11]=l,e[12]=r,e[13]=y,e[14]=T,e[15]=S,e[16]=A,e[17]=v,e[18]=N,e[19]=C,e[20]=k,e[21]=R,e[22]=D,e[23]=w}else y=e[13],T=e[14],S=e[15],A=e[16],v=e[17],N=e[18],C=e[19],k=e[20],R=e[21],D=e[22],w=e[23];let P;e[31]!==v||e[32]!==N?(P=E.jsx("div",{className:v,children:N}),e[31]=v,e[32]=N,e[33]=P):P=e[33];let $;e[34]!==y||e[35]!==P||e[36]!==C||e[37]!==k||e[38]!==R?($=E.jsxs(y,{align:C,className:k,children:[R,P]}),e[34]=y,e[35]=P,e[36]=C,e[37]=k,e[38]=R,e[39]=$):$=e[39];let B;e[40]!==T||e[41]!==$||e[42]!==D||e[43]!==w?(B=E.jsxs(T,{children:[D,w,$]}),e[40]=T,e[41]=$,e[42]=D,e[43]=w,e[44]=B):B=e[44];let G;e[45]!==S||e[46]!==B?(G=E.jsx(S,{children:B}),e[45]=S,e[46]=B,e[47]=G):G=e[47];let U;return e[48]!==A||e[49]!==G?(U=E.jsx(A,{children:G}),e[48]=A,e[49]=G,e[50]=U):U=e[50],U}function Eq(t){const e=K.c(11),{className:n}=t;let r;e[0]!==n?(r=re("flex h-full w-full flex-col bg-muted",n),e[0]=n,e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=E.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=a):a=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=E.jsxs("div",{className:"flex items-center gap-3",children:[a,E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),E.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=i):i=e[3];let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s=E.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:E.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[i,E.jsxs("div",{className:"flex items-end gap-2",children:[E.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),E.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=s):s=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:E.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[E.jsx(Ka,{align:"right",width:"w-3/4"}),E.jsx(Ka,{align:"left",width:"w-full",lines:3}),E.jsx(Ka,{align:"right",width:"w-2/3"}),E.jsx(Ka,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:E.jsx("div",{className:"relative flex-1",children:E.jsxs("div",{className:"space-y-2 p-2",children:[E.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),E.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx("div",{className:"flex items-center gap-1",children:E.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("div",{className:"px-4 py-4",children:E.jsx("div",{className:"mx-auto w-full max-w-2xl",children:E.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[l,E.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),E.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=c):c=e[8];let d;return e[9]!==r?(d=E.jsxs("div",{className:r,children:[s,o,c]}),e[9]=r,e[10]=d):d=e[10],d}function Ka(t){const e=K.c(22),{align:n,width:r,lines:a}=t,i=r===void 0?"w-full":r,s=a===void 0?1:a,o=n==="right"?"flex-row-reverse":"flex-row";let l;e[0]!==o?(l=re("flex w-full gap-4 px-4 py-2",o),e[0]=o,e[1]=l):l=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let c;e[2]!==u?(c=re("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==p||e[6]!==i?(f=re("min-w-0 rounded-2xl p-4",p,i),e[5]=p,e[6]=i,e[7]=f):f=e[7];let m;e[8]!==s?(m=Array.from({length:s}),e[8]=s,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==m?(g=E.jsx("div",{className:"space-y-2",children:m.map((S,A)=>E.jsx("div",{className:re("h-3 rounded bg-muted-foreground/20 animate-pulse",A===s-1?"w-3/4":"w-full"),style:{animationDelay:`${A*.1}s`}},A))}),e[10]=s,e[11]=m,e[12]=g):g=e[12];let b;e[13]!==g||e[14]!==f?(b=E.jsx("div",{className:f,children:g}),e[13]=g,e[14]=f,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==c?(y=E.jsxs("div",{className:c,children:[d,b]}),e[16]=b,e[17]=c,e[18]=y):y=e[18];let T;return e[19]!==y||e[20]!==l?(T=E.jsx("div",{className:l,children:y}),e[19]=y,e[20]=l,e[21]=T):T=e[21],T}function Tq(t){const e=K.c(8),{className:n,children:r}=t,i=n?.includes("bg-background")?"var(--background)":"var(--muted)";let s;e[0]!==n?(s=re("flex flex-col h-full w-full bg-muted transform-[translateZ(0)]",n),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==i?(o={"--chat-surface":i},e[2]=i,e[3]=o):o=e[3];const l=o;let u;return e[4]!==r||e[5]!==s||e[6]!==l?(u=E.jsx("div",{className:s,style:l,children:r}),e[4]=r,e[5]=s,e[6]=l,e[7]=u):u=e[7],u}function yq(t){const e=K.c(5),{children:n,className:r}=t;let a;e[0]!==r?(a=re("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=a):a=e[1];let i;return e[2]!==n||e[3]!==a?(i=E.jsx("div",{className:a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i}function Sq(t){const e=K.c(2),{children:n}=t;let r;return e[0]!==n?(r=E.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Aq(){const t=K.c(16),{messages:e,status:n}=En(),r=dq(e);let a;t[0]!==r?(a=r.at(-1),t[0]=r,t[1]=a):a=t[1];const i=a,s=n==="submitted"||n==="streaming";let o;if(t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==e||t[6]!==n){const l=e.at(-1),u=!s&&l?.role==="assistant"&&l.parts.filter(vq).some(Nq);let c;if(t[8]!==r||t[9]!==n){let p;t[11]!==r.length||t[12]!==n?(p=(f,m)=>E.jsx(x1,{pair:f,isLastPair:!1,status:m===r.length-1?n:void 0},`pair-${f.user.id}`),t[11]=r.length,t[12]=n,t[13]=p):p=t[13],c=r.slice(0,-1).map(p),t[8]=r,t[9]=n,t[10]=c}else c=t[10];let d;t[14]!==c?(d=E.jsx("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:c}),t[14]=c,t[15]=d):d=t[15],o=E.jsxs("div",{className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",children:[d,i&&E.jsx("div",{className:re("min-h-full min-w-0 max-w-2xl mx-auto w-full",u&&"pb-60"),children:E.jsx(x1,{pair:i,isLastPair:!0,status:n},`pair-${i?.user.id}`)})]}),t[2]=s,t[3]=i,t[4]=r,t[5]=e,t[6]=n,t[7]=o}else o=t[7];return o}function Nq(t){return t.state==="input-available"}function vq(t){return t.type==="tool-user_ask"}function _q(t){const e=K.c(5),{children:n,className:r}=t;let a;e[0]!==r?(a=re("flex-none w-full mx-auto p-2","max-w-2xl min-w-0",r),e[0]=r,e[1]=a):a=e[1];let i;return e[2]!==n||e[3]!==a?(i=E.jsx("div",{className:a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i}const pj=Object.assign(Tq,{Main:yq,Messages:Aq,EmptyState:Sq,Footer:_q,Input:D3,Provider:WC,Skeleton:Eq,IceBreakers:Z2,NoLlmBindingEmptyState:hq,ThreadHistoryPopover:bq});export{pj as C,Lh as E,Qe as N,Te as P,yv as R,u3 as S,Mh as V,dn as a,e_ as b,FO as c,H2 as d,Tv as e,rA as f,TL as g,aA as i,Re as m,gv as u};
186
+ ${v}`,C=b?.icon,k=b?.title??"Subtask";let R;e[9]===Symbol.for("react.memo_cache_sentinel")?(R=E.jsx(pr,{}),e[9]=R):R=e[9];let D;e[10]!==C||e[11]!==k?(D=E.jsx(cs,{icon:C,name:k,size:"2xs",fallbackIcon:R}),e[10]=C,e[11]=k,e[12]=D):D=e[12];const w=D;let P;e[13]!==n?(P=yC(n),e[13]=n,e[14]=P):P=e[14];const $=P;let B;e[15]!==$?(B=$?E.jsx(AC,{approvalId:$}):void 0,e[15]=$,e[16]=B):B=e[16];const G=B;let U;return e[17]!==G||e[18]!==a||e[19]!==N||e[20]!==f||e[21]!==w||e[22]!==i||e[23]!==S||e[24]!==T||e[25]!==y?(U=E.jsx("div",{className:"my-2",children:E.jsx(pm,{icon:w,title:T,summary:S,usage:y,latency:i,detail:N,annotations:a,state:f,actions:G})}),e[17]=G,e[18]=a,e[19]=N,e[20]=f,e[21]=w,e[22]=i,e[23]=S,e[24]=T,e[25]=y,e[26]=U):U=e[26],U}function X9(t){const e=K.c(5),{parts:n}=t,r=n?.length,a=n?.[n.length-1];let i;e[0]!==a||e[1]!==r?(i={enabled:!0,contentDeps:[r,a]},e[0]=a,e[1]=r,e[2]=i):i=e[2];const{sentinelRef:s}=TC(i);let o;return e[3]!==s?(o=E.jsx("div",{ref:s,className:"h-0"}),e[3]=s,e[4]=o):o=e[4],o}function Z9(t){return t.type==="reasoning"}function Q9(t){const e=[],n=new Map,r=new Map;if(t)for(const a of t.parts){if(Z9(a)){e.push(a);continue}if(a.type==="data-tool-metadata"&&"id"in a&&"data"in a){const i=a.data,s={};i.annotations&&(s.annotations=i.annotations),typeof i.latencyMs=="number"&&Number.isFinite(i.latencyMs)&&(s.latencySeconds=i.latencyMs/1e3),n.set(a.id,s);continue}a.type==="data-tool-subtask-metadata"&&"id"in a&&r.set(a.id,a.data)}return{reasoningParts:e,dataParts:{toolMetadata:n,toolSubtaskMetadata:r}}}const J9={planning:{icon:E.jsx(aA,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:E.jsx(q1,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},eq=1200;function tq(){const t=K.c(7),[e,n]=O.useState("planning");let r,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const l=setTimeout(()=>{n("thinking")},eq);return()=>{clearTimeout(l)}},a=[],t[0]=r,t[1]=a):(r=t[0],a=t[1]),O.useEffect(r,a);const i=J9[e];let s;t[2]!==i.label?(s=E.jsxs("span",{className:"text-[15px] text-muted-foreground shimmer",children:[i.label,"..."]}),t[2]=i.label,t[3]=s):s=t[3];let o;return t[4]!==i.icon||t[5]!==s?(o=E.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:E.jsxs("span",{className:"flex items-center gap-1.5",children:[i.icon,s]})}),t[4]=i.icon,t[5]=s,t[6]=o):o=t[6],o}function k1(t){const e=K.c(16),{isStreaming:n,thoughtMessage:r,isExpanded:a,reasoningTokens:i}=t;let s;e[0]!==a||e[1]!==n?(s=n?E.jsx(q1,{className:"text-muted-foreground shrink-0 shimmer",size:14}):E.jsxs("span",{className:"relative w-[14px] h-[14px] shrink-0",children:[E.jsx(X1,{className:re("absolute inset-0 text-muted-foreground transition-transform",a&&"rotate-90","opacity-0 group-hover/thought-summary:opacity-100"),size:14}),E.jsx(nA,{className:"absolute inset-0 text-muted-foreground shrink-0 opacity-100 group-hover/thought-summary:opacity-0 transition-opacity",size:14})]}),e[0]=a,e[1]=n,e[2]=s):s=e[2];const o=n&&"shimmer";let l;e[3]!==o?(l=re("text-[15px] text-muted-foreground",o),e[3]=o,e[4]=l):l=e[4];const u=n?"Thinking...":r;let c;e[5]!==l||e[6]!==u?(c=E.jsx("span",{className:l,children:u}),e[5]=l,e[6]=u,e[7]=c):c=e[7];let d;e[8]!==i?(d=i.toLocaleString(),e[8]=i,e[9]=d):d=e[9];let p;e[10]!==d?(p=E.jsxs("span",{className:"text-[10px] font-mono tabular-nums text-muted-foreground/50 ml-2 mt-px",children:[d," tokens"]}),e[10]=d,e[11]=p):p=e[11];let f;return e[12]!==s||e[13]!==c||e[14]!==p?(f=E.jsxs("span",{className:"flex items-center gap-1.5",children:[s,c,p]}),e[12]=s,e[13]=c,e[14]=p,e[15]=f):f=e[15],f}function nq(t){const e=K.c(40),{duration:n,parts:r,reasoningTokens:a,id:i,isStreaming:s}=t,[o,l]=O.useState(!1),u=O.useRef(null);let c;e[0]!==s?(c=()=>{s&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},e[0]=s,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==r?(d=[r,s],e[2]=s,e[3]=r,e[4]=d):d=e[4],O.useEffect(c,d);let p;e[5]!==n?(p=n&&n/1e3>1?`Thought for ${(n/1e3).toFixed(1)}s`:"Thought",e[5]=n,e[6]=p):p=e[6];const f=p;if(r.every(rq)){let w;return e[7]!==o||e[8]!==s||e[9]!==a||e[10]!==f?(w=E.jsx("div",{className:"mb-2",children:E.jsx(k1,{isStreaming:s,thoughtMessage:f,isExpanded:o,reasoningTokens:a})}),e[7]=o,e[8]=s,e[9]=a,e[10]=f,e[11]=w):w=e[11],w}const g=s||o,b=s?void 0:l,y=!s&&"cursor-pointer hover:opacity-100",T=s&&"cursor-default";let S;e[12]!==y||e[13]!==T?(S=re("group/thought-summary flex items-center gap-1.5 py-2 opacity-60 transition-opacity",y,T),e[12]=y,e[13]=T,e[14]=S):S=e[14];let A;e[15]!==o||e[16]!==s||e[17]!==a||e[18]!==f?(A=E.jsx(k1,{isStreaming:s,thoughtMessage:f,isExpanded:o,reasoningTokens:a}),e[15]=o,e[16]=s,e[17]=a,e[18]=f,e[19]=A):A=e[19];let v;e[20]!==S||e[21]!==A?(v=E.jsx(U1,{asChild:!0,children:E.jsx("button",{type:"button",className:S,children:A})}),e[20]=S,e[21]=A,e[22]=v):v=e[22];let N;e[23]!==s?(N=s&&E.jsx("div",{className:"absolute top-0 left-0 right-0 h-16 bg-linear-to-b from-background to-transparent pointer-events-none z-10"}),e[23]=s,e[24]=N):N=e[24];let C;if(e[25]!==i||e[26]!==r){let w;e[28]!==i?(w=(P,$)=>E.jsx("div",{className:"text-muted-foreground markdown-sm pb-2",children:E.jsx(dm,{id:`${i}-reasoning-${$}`,text:P.text})},`${i}-reasoning-${$}`),e[28]=i,e[29]=w):w=e[29],C=r.map(w),e[25]=i,e[26]=r,e[27]=C}else C=e[27];let k;e[30]!==C?(k=E.jsx("div",{ref:u,className:"ml-[6px] border-l-2 pl-4 mt-1 mb-2 h-[100px] overflow-y-auto",children:C}),e[30]=C,e[31]=k):k=e[31];let R;e[32]!==N||e[33]!==k?(R=E.jsx(H1,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:E.jsxs("div",{className:"relative",children:[N,k]})}),e[32]=N,e[33]=k,e[34]=R):R=e[34];let D;return e[35]!==v||e[36]!==R||e[37]!==g||e[38]!==b?(D=E.jsx("div",{className:"flex flex-col mb-2",children:E.jsxs($1,{open:g,onOpenChange:b,children:[v,R]})}),e[35]=v,e[36]=R,e[37]=g,e[38]=b,e[39]=D):D=e[39],D}function rq(t){return t.text?.includes("REDACTED")}function aq(t){const e=K.c(45),{part:n,id:r,usageStats:a,dataParts:i}=t;let s;e[0]!==i.toolMetadata?(s=c=>i.toolMetadata.get(c),e[0]=i.toolMetadata,e[1]=s):s=e[1];const o=s;let l;e[2]!==i.toolSubtaskMetadata?(l=c=>i.toolSubtaskMetadata.get(c),e[2]=i.toolSubtaskMetadata,e[3]=l):l=e[3];const u=l;switch(n.type){case"dynamic-tool":{let c;e[4]!==o||e[5]!==n.toolCallId?(c=o(n.toolCallId)?.annotations,e[4]=o,e[5]=n.toolCallId,e[6]=c):c=e[6];let d;e[7]!==o||e[8]!==n.toolCallId?(d=o(n.toolCallId)?.latencySeconds,e[7]=o,e[8]=n.toolCallId,e[9]=d):d=e[9];let p;return e[10]!==n||e[11]!==c||e[12]!==d?(p=E.jsx(R1,{part:n,annotations:c,latency:d}),e[10]=n,e[11]=c,e[12]=d,e[13]=p):p=e[13],p}case"tool-user_ask":{let c;e[14]!==o||e[15]!==n.toolCallId?(c=o(n.toolCallId)?.latencySeconds,e[14]=o,e[15]=n.toolCallId,e[16]=c):c=e[16];let d;return e[17]!==n||e[18]!==c?(d=E.jsx(Y9,{part:n,latency:c}),e[17]=n,e[18]=c,e[19]=d):d=e[19],d}case"tool-subtask":{let c;e[20]!==u||e[21]!==n.toolCallId?(c=u(n.toolCallId),e[20]=u,e[21]=n.toolCallId,e[22]=c):c=e[22];let d;e[23]!==o||e[24]!==n.toolCallId?(d=o(n.toolCallId)?.annotations,e[23]=o,e[24]=n.toolCallId,e[25]=d):d=e[25];let p;e[26]!==o||e[27]!==n.toolCallId?(p=o(n.toolCallId)?.latencySeconds,e[26]=o,e[27]=n.toolCallId,e[28]=p):p=e[28];let f;return e[29]!==n||e[30]!==c||e[31]!==d||e[32]!==p?(f=E.jsx(K9,{part:n,subtaskMeta:c,annotations:d,latency:p}),e[29]=n,e[30]=c,e[31]=d,e[32]=p,e[33]=f):f=e[33],f}case"text":{let c;return e[34]!==r||e[35]!==n||e[36]!==a?(c=E.jsx(EC,{id:r,part:n,extraActions:a,copyable:!0}),e[34]=r,e[35]=n,e[36]=a,e[37]=c):c=e[37],c}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":return null;default:{const c=n;if(c.type.startsWith("tool-")){const d=c.toolCallId;let p;e[38]!==i.toolMetadata||e[39]!==d?(p=i.toolMetadata.get(d),e[38]=i.toolMetadata,e[39]=d,e[40]=p):p=e[40];const f=p,m=f?.annotations,g=f?.latencySeconds;let b;return e[41]!==c||e[42]!==m||e[43]!==g?(b=E.jsx(R1,{part:c,annotations:m,latency:g}),e[41]=c,e[42]=m,e[43]=g,e[44]=b):b=e[44],b}if(c.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${c.type}`)}}}function iq(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=E.jsx("div",{className:"text-[15px] text-muted-foreground/60 py-2",children:"No response was generated"}),t[0]=e):e=t[0],e}function sq(t){const e=K.c(7),{className:n,children:r}=t;let a;e[0]!==n?(a=re("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=a):a=e[1];let i;e[2]!==r?(i=E.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:E.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[15px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=i):i=e[3];let s;return e[4]!==a||e[5]!==i?(s=E.jsx("div",{className:a,children:i}),e[4]=a,e[5]=i,e[6]=s):s=e[6],s}function oq(t){const e=K.c(19),{message:n,status:r,className:a,isLast:i}=t,s=i===void 0?!1:i,o=r==="streaming",u=o||r==="submitted",c=n!==null&&n.parts.length>0,{reasoningParts:d,dataParts:p}=Q9(n),f=d.length>0;let m;if(e[0]!==n){const S=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,A=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;m=S!==null?A.getTime()-S.getTime():null,e[0]=n,e[1]=m}else m=e[1];const g=m;let b;e[2]!==p||e[3]!==g||e[4]!==c||e[5]!==f||e[6]!==u||e[7]!==o||e[8]!==n||e[9]!==d?(b=c?E.jsxs(E.Fragment,{children:[f&&E.jsx(nq,{duration:g,parts:d,id:n.id,isStreaming:o,reasoningTokens:n.metadata?.usage?.reasoningTokens??0}),n.parts.map((S,A)=>{const v=A===n.parts.length-1,N=v?iI(sI(),n.metadata?.usage):null;return E.jsx(aq,{part:S,id:n.id,usageStats:v&&E.jsx(m_,{usage:N}),dataParts:p},`${n.id}-${A}`)})]}):u?E.jsx(tq,{}):E.jsx(iq,{}),e[2]=p,e[3]=g,e[4]=c,e[5]=f,e[6]=u,e[7]=o,e[8]=n,e[9]=d,e[10]=b):b=e[10];let y;e[11]!==s||e[12]!==o||e[13]!==n?.parts?(y=s&&o&&E.jsx(X9,{parts:n?.parts}),e[11]=s,e[12]=o,e[13]=n?.parts,e[14]=y):y=e[14];let T;return e[15]!==a||e[16]!==b||e[17]!==y?(T=E.jsxs(sq,{className:a,children:[b,y]}),e[15]=a,e[16]=b,e[17]=y,e[18]=T):T=e[18],T}const lq=[e_.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),_v,Rv];function uq(t){const e=K.c(5),{tiptapDoc:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let a;e[1]!==n?(a={extensions:lq,content:n,editable:!1,editorProps:r},e[1]=n,e[2]=a):a=e[2];const i=gv(a);if(!i)return null;let s;return e[3]!==i?(s=E.jsx(Lh,{editor:i,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=i,e[4]=s):s=e[4],s}function cq(t){const e=K.c(24),{message:n,className:r,onScrollToPair:a}=t,{id:i,parts:s,metadata:o}=n,[l,u]=O.useState(!1);if(!s||s.length===0)return null;let c;e[0]!==a?(c=()=>{u(!0),a?.()},e[0]=a,e[1]=c):c=e[1];const d=c,p=o?.tiptapDoc;let f;e[2]!==r?(f=re("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[2]=r,e[3]=f):f=e[3];let m,g;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=()=>u(!0),g=()=>u(!1),e[4]=m,e[5]=g):(m=e[4],g=e[5]);const b=l?"overflow-auto opacity-100":"overflow-hidden opacity-99 mask-b-from-1%";let y;e[6]!==b?(y=re("z-10 px-4 py-2 transition-opacity max-h-[120px] flex-1",b),e[6]=b,e[7]=y):y=e[7];let T;e[8]!==p||e[9]!==i||e[10]!==o||e[11]!==s?(T=p?E.jsx(uq,{tiptapDoc:o.tiptapDoc}):s.map((C,k)=>C.type==="text"?E.jsx(EC,{id:i,part:C},`${i}-${k}`):null),e[8]=p,e[9]=i,e[10]=o,e[11]=s,e[12]=T):T=e[12];let S;e[13]!==T?(S=E.jsx("div",{children:T}),e[13]=T,e[14]=S):S=e[14];let A;e[15]!==y||e[16]!==S?(A=E.jsx("div",{className:y,children:S}),e[15]=y,e[16]=S,e[17]=A):A=e[17];let v;e[18]!==d||e[19]!==A?(v=E.jsx("div",{tabIndex:0,onClick:d,onFocus:m,onBlur:g,className:"w-full border min-w-0 shadow-xs rounded-lg text-[0.9375rem] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:A}),e[18]=d,e[19]=A,e[20]=v):v=e[20];let N;return e[21]!==v||e[22]!==f?(N=E.jsx(E.Fragment,{children:E.jsx("div",{className:f,children:v})}),e[21]=v,e[22]=f,e[23]=N):N=e[23],N}function dq(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(r&&r.role==="user"){const a=t[n+1];a&&a.role==="assistant"?(e.push({user:r,assistant:a}),n++):e.push({user:r,assistant:null})}}return e}function x1(t){const e=K.c(14),{pair:n,isLastPair:r,status:a}=t,i=O.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i.current&&i.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=s):s=e[0];const o=s;let l;e[1]!==r?(l=m=>{i.current=m,r&&m?.scrollIntoView({behavior:"smooth",block:"start"})},e[1]=r,e[2]=l):l=e[2];const u=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),e[3]=c):c=e[3];let d;e[4]!==n.user?(d=E.jsx("div",{className:"sticky mb-3 top-4 z-50",children:E.jsx(cq,{message:n.user,onScrollToPair:o})}),e[4]=n.user,e[5]=d):d=e[5];let p;e[6]!==r||e[7]!==n.assistant||e[8]!==a?(p=E.jsx(oq,{message:n.assistant,status:a,isLast:r}),e[6]=r,e[7]=n.assistant,e[8]=a,e[9]=p):p=e[9];let f;return e[10]!==u||e[11]!==d||e[12]!==p?(f=E.jsxs("div",{ref:u,className:"flex flex-col pb-2",children:[c,d,p]}),e[10]=u,e[11]=d,e[12]=p,e[13]=f):f=e[13],f}const pq="https://sites-openrouter.decocache.com/mcp",fq="https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg";function hq({title:t="No model provider connected",description:e="Connect to a model provider to unlock AI-powered features.",org:n}){const r=II(),[,a]=VC(),i=F1(),{data:s}=HC.useSession(),o=RI(),l=s?.user?.id??"",u=()=>{i({to:"/$org/$project/mcps",params:{org:n.slug,project:Xa},search:{action:"create"}})},c=async()=>{if(!n.id||!l){Gt.error("Not authenticated");return}try{const d=o?.find(m=>m.connection_url===pq);if(d){a(!1),i({to:"/$org/$project/mcps/$connectionId",params:{org:n.slug,project:Xa,connectionId:d.id}});return}const p=YC({id:kI("conn")}),f=await r.create.mutateAsync(p);a(!1),i({to:"/$org/$project/mcps/$connectionId",params:{org:n.slug,project:Xa,connectionId:f.id}})}catch(d){Gt.error(`Failed to connect OpenRouter: ${d instanceof Error?d.message:String(d)}`)}};return E.jsx(CI,{image:E.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),title:t,description:e,actions:E.jsxs(E.Fragment,{children:[E.jsxs(Ee,{variant:"outline",onClick:c,disabled:r.create.isPending,children:[E.jsx("img",{src:fq,alt:"OpenRouter",className:"size-4"}),r.create.isPending?"Installing...":"Install OpenRouter"]}),E.jsx(Ee,{variant:"outline",onClick:u,children:"Install Connection"})]})})}function mq(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),a=Math.floor(r/6e4),i=Math.floor(r/36e5);return a<1?"now":a<60?`${a}m`:`${i}h`}function gq(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(n.getTime()-864e5),a=new Date(n.getTime()-7*864e5),i=new Date(n.getTime()-30*864e5),s=[],o=[],l=[],u=[],c=[];for(const p of t){const f=new Date(p.updated_at);f>=n?s.push(p):f>=r?o.push(p):f>=a?l.push(p):f>=i?u.push(p):c.push(p)}const d=[];return s.length>0&&d.push({label:"Today",threads:s,showRelativeTime:!0}),o.length>0&&d.push({label:"Yesterday",threads:o,showRelativeTime:!1}),l.length>0&&d.push({label:"7 days ago",threads:l,showRelativeTime:!1}),u.length>0&&d.push({label:"30 days ago",threads:u,showRelativeTime:!1}),c.length>0&&d.push({label:"Older",threads:c,showRelativeTime:!1}),d}function bq(t){const e=K.c(51),{variant:n}=t,r=n===void 0?"icon":n,[a,i]=O.useState(""),{activeThreadId:s,switchToThread:o,threads:l,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d,hideThread:p}=En(),f=O.useRef(null),m=O.useRef(null);let g;e[0]!==d||e[1]!==u||e[2]!==c?(g=z=>{m.current&&m.current.disconnect(),z&&u&&!c&&d&&(m.current=new IntersectionObserver(M=>{M[0]?.isIntersecting&&u&&!c&&d&&d()},{rootMargin:"100px"}),m.current.observe(z)),f.current=z},e[0]=d,e[1]=u,e[2]=c,e[3]=g):g=e[3];const b=g;let y,T,S,A,v,N,C,k,R,D,w;if(e[4]!==s||e[5]!==u||e[6]!==p||e[7]!==c||e[8]!==a||e[9]!==b||e[10]!==o||e[11]!==l||e[12]!==r){const z=a.trim()?l.filter(W=>W.title.toLowerCase().includes(a.toLowerCase())):l,M=gq(z);A=as,S=bt,T=vr,e[24]!==r?(D=E.jsx(Et,{asChild:!0,children:E.jsx(_r,{asChild:!0,children:r==="outline"?E.jsx(Ee,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:E.jsx(_m,{size:16})}):E.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:E.jsx(_m,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[24]=r,e[25]=D):D=e[25],e[26]===Symbol.for("react.memo_cache_sentinel")?(w=E.jsx(Tt,{children:"Chat history"}),e[26]=w):w=e[26],y=Cr,C="end",k="w-80 p-0";let Y;e[27]===Symbol.for("react.memo_cache_sentinel")?(Y=E.jsx(K1,{size:16,className:"text-muted-foreground shrink-0"}),e[27]=Y):Y=e[27];let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=W=>i(W.target.value),e[28]=X):X=e[28],e[29]!==a?(R=E.jsx("div",{className:"border-b",children:E.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[Y,E.jsx("input",{type:"text",placeholder:"Search chats...",value:a,onChange:X,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=a,e[30]=R):R=e[30],v="max-h-[300px] overflow-y-auto",N=z.length===0?E.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:a.trim()?"No chats found":"No chats yet"}):E.jsxs(E.Fragment,{children:[M.map((W,ae)=>E.jsxs("div",{children:[ae>0&&E.jsx("div",{className:"border-t mx-3"}),E.jsx("div",{className:"px-3 py-1",children:E.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:W.label})}),W.threads.map(Q=>{const ne=Q.id===s;return E.jsxs("div",{className:re("flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group",ne&&"bg-accent/50"),onClick:()=>o(Q.id),children:[E.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[E.jsx("span",{className:"text-sm truncate",children:Q.title||"New chat"}),E.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:ne?"current":W.showRelativeTime?mq(Q.updated_at):null})]}),E.jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),p(Q.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:E.jsx(xI,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},Q.id)})]},W.label)),!a.trim()&&u&&E.jsx("div",{ref:b,className:"h-4"}),c&&E.jsx("div",{className:"p-3 text-center text-xs text-muted-foreground",children:"Loading more chats..."})]}),e[4]=s,e[5]=u,e[6]=p,e[7]=c,e[8]=a,e[9]=b,e[10]=o,e[11]=l,e[12]=r,e[13]=y,e[14]=T,e[15]=S,e[16]=A,e[17]=v,e[18]=N,e[19]=C,e[20]=k,e[21]=R,e[22]=D,e[23]=w}else y=e[13],T=e[14],S=e[15],A=e[16],v=e[17],N=e[18],C=e[19],k=e[20],R=e[21],D=e[22],w=e[23];let P;e[31]!==v||e[32]!==N?(P=E.jsx("div",{className:v,children:N}),e[31]=v,e[32]=N,e[33]=P):P=e[33];let $;e[34]!==y||e[35]!==P||e[36]!==C||e[37]!==k||e[38]!==R?($=E.jsxs(y,{align:C,className:k,children:[R,P]}),e[34]=y,e[35]=P,e[36]=C,e[37]=k,e[38]=R,e[39]=$):$=e[39];let B;e[40]!==T||e[41]!==$||e[42]!==D||e[43]!==w?(B=E.jsxs(T,{children:[D,w,$]}),e[40]=T,e[41]=$,e[42]=D,e[43]=w,e[44]=B):B=e[44];let G;e[45]!==S||e[46]!==B?(G=E.jsx(S,{children:B}),e[45]=S,e[46]=B,e[47]=G):G=e[47];let U;return e[48]!==A||e[49]!==G?(U=E.jsx(A,{children:G}),e[48]=A,e[49]=G,e[50]=U):U=e[50],U}function Eq(t){const e=K.c(11),{className:n}=t;let r;e[0]!==n?(r=re("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=E.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=a):a=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=E.jsxs("div",{className:"flex items-center gap-3",children:[a,E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),E.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=i):i=e[3];let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s=E.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:E.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[i,E.jsxs("div",{className:"flex items-end gap-2",children:[E.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),E.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=s):s=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=E.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:E.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[E.jsx(Ka,{align:"right",width:"w-3/4"}),E.jsx(Ka,{align:"left",width:"w-full",lines:3}),E.jsx(Ka,{align:"right",width:"w-2/3"}),E.jsx(Ka,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:E.jsx("div",{className:"relative flex-1",children:E.jsxs("div",{className:"space-y-2 p-2",children:[E.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),E.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=E.jsx("div",{className:"flex items-center gap-1",children:E.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=E.jsx("div",{className:"px-4 py-4",children:E.jsx("div",{className:"mx-auto w-full max-w-2xl",children:E.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[l,E.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),E.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=c):c=e[8];let d;return e[9]!==r?(d=E.jsxs("div",{className:r,children:[s,o,c]}),e[9]=r,e[10]=d):d=e[10],d}function Ka(t){const e=K.c(22),{align:n,width:r,lines:a}=t,i=r===void 0?"w-full":r,s=a===void 0?1:a,o=n==="right"?"flex-row-reverse":"flex-row";let l;e[0]!==o?(l=re("flex w-full gap-4 px-4 py-2",o),e[0]=o,e[1]=l):l=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let c;e[2]!==u?(c=re("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=E.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==p||e[6]!==i?(f=re("min-w-0 rounded-2xl p-4",p,i),e[5]=p,e[6]=i,e[7]=f):f=e[7];let m;e[8]!==s?(m=Array.from({length:s}),e[8]=s,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==m?(g=E.jsx("div",{className:"space-y-2",children:m.map((S,A)=>E.jsx("div",{className:re("h-3 rounded bg-muted-foreground/20 animate-pulse",A===s-1?"w-3/4":"w-full"),style:{animationDelay:`${A*.1}s`}},A))}),e[10]=s,e[11]=m,e[12]=g):g=e[12];let b;e[13]!==g||e[14]!==f?(b=E.jsx("div",{className:f,children:g}),e[13]=g,e[14]=f,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==c?(y=E.jsxs("div",{className:c,children:[d,b]}),e[16]=b,e[17]=c,e[18]=y):y=e[18];let T;return e[19]!==y||e[20]!==l?(T=E.jsx("div",{className:l,children:y}),e[19]=y,e[20]=l,e[21]=T):T=e[21],T}function Tq(t){const e=K.c(5),{className:n,children:r}=t;let a;e[0]!==n?(a=re("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=a):a=e[1];let i;return e[2]!==r||e[3]!==a?(i=E.jsx("div",{className:a,children:r}),e[2]=r,e[3]=a,e[4]=i):i=e[4],i}function yq(t){const e=K.c(5),{children:n,className:r}=t;let a;e[0]!==r?(a=re("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=a):a=e[1];let i;return e[2]!==n||e[3]!==a?(i=E.jsx("div",{className:a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i}function Sq(t){const e=K.c(2),{children:n}=t;let r;return e[0]!==n?(r=E.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Aq(){const t=K.c(16),{messages:e,status:n}=En(),r=dq(e);let a;t[0]!==r?(a=r.at(-1),t[0]=r,t[1]=a):a=t[1];const i=a,s=n==="submitted"||n==="streaming";let o;if(t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==e||t[6]!==n){const l=e.at(-1),u=!s&&l?.role==="assistant"&&l.parts.filter(vq).some(Nq);let c;if(t[8]!==r||t[9]!==n){let p;t[11]!==r.length||t[12]!==n?(p=(f,m)=>E.jsx(x1,{pair:f,isLastPair:!1,status:m===r.length-1?n:void 0},`pair-${f.user.id}`),t[11]=r.length,t[12]=n,t[13]=p):p=t[13],c=r.slice(0,-1).map(p),t[8]=r,t[9]=n,t[10]=c}else c=t[10];let d;t[14]!==c?(d=E.jsx("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:c}),t[14]=c,t[15]=d):d=t[15],o=E.jsxs("div",{className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",children:[d,i&&E.jsx("div",{className:re("min-h-full min-w-0 max-w-2xl mx-auto w-full",u&&"pb-60"),children:E.jsx(x1,{pair:i,isLastPair:!0,status:n},`pair-${i?.user.id}`)})]}),t[2]=s,t[3]=i,t[4]=r,t[5]=e,t[6]=n,t[7]=o}else o=t[7];return o}function Nq(t){return t.state==="input-available"}function vq(t){return t.type==="tool-user_ask"}function _q(t){const e=K.c(5),{children:n,className:r}=t;let a;e[0]!==r?(a=re("flex-none w-full mx-auto p-2","max-w-2xl min-w-0",r),e[0]=r,e[1]=a):a=e[1];let i;return e[2]!==n||e[3]!==a?(i=E.jsx("div",{className:a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i}const dj=Object.assign(Tq,{Main:yq,Messages:Aq,EmptyState:Sq,Footer:_q,Input:D3,Provider:WC,Skeleton:Eq,IceBreakers:Z2,NoLlmBindingEmptyState:hq,ThreadHistoryPopover:bq});export{dj as C,Lh as E,Qe as N,Te as P,yv as R,u3 as S,Mh as V,dn as a,e_ as b,FO as c,H2 as d,Tv as e,rA as f,TL as g,aA as i,Re as m,gv as u};