decocms 2.302.2 → 2.302.3

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 (199) hide show
  1. package/dist/client/assets/{AlertCircle-BkX4HzbS.js → AlertCircle-BptNXaSw.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-BebHkn1X.js → ArrowNarrowLeft-C9BqYGqa.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-uszsF274.js → ArrowUpRight-Dx8OyXJJ.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Boq6G01L.js → CheckCircle-BJH_Faer.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-ByP-e484.js → ChevronDown-AFfzS9Fd.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-BUfZMnd9.js → ChevronRight-DCTFzP_v.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-TwiYbtUW.js → ChevronUp-Vi7GtFBv.js} +1 -1
  8. package/dist/client/assets/{Container-DzkLD13G.js → Container-DNCiFX-u.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BrUfBHwt.js → DotsVertical-uwZMGC-k.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-gfL-Fk4b.js → LinkExternal01-Bia8wPa4.js} +1 -1
  11. package/dist/client/assets/{Lock01-CI-miN4g.js → Lock01-Yik0Dryf.js} +1 -1
  12. package/dist/client/assets/{Palette-1HvN4NnC.js → Palette-jQWe009s.js} +1 -1
  13. package/dist/client/assets/{Play-O7ldNAxa.js → Play-DRYhRmoj.js} +1 -1
  14. package/dist/client/assets/{Plus-Bihyskqy.js → Plus--8V8C-wH.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-BzT-xyrO.js → RefreshCcw01-Dkvc9_WI.js} +1 -1
  16. package/dist/client/assets/{SearchMd-vBRV-l3E.js → SearchMd-CX1-PTYv.js} +1 -1
  17. package/dist/client/assets/{Settings02-eiwWD3s7.js → Settings02-BB9KNyr0.js} +1 -1
  18. package/dist/client/assets/{Shield01-D7ml37xT.js → Shield01-DmqRtciA.js} +1 -1
  19. package/dist/client/assets/{Star01-ByzmPd4J.js → Star01-B98NJUiy.js} +1 -1
  20. package/dist/client/assets/{Sun-xA_CdWAJ.js → Sun-B-U9j0qH.js} +1 -1
  21. package/dist/client/assets/{Tool01-Dqyo2VjJ.js → Tool01-Bx-eFA4e.js} +1 -1
  22. package/dist/client/assets/{Trash01-f4CvhuWB.js → Trash01-LNBC98cZ.js} +1 -1
  23. package/dist/client/assets/{User01-lDhxACAV.js → User01-nWV_walc.js} +1 -1
  24. package/dist/client/assets/{Users03-IortA-KV.js → Users03-Bjiog5sl.js} +1 -1
  25. package/dist/client/assets/{X-BiphajNJ.js → X-DuAzorTa.js} +1 -1
  26. package/dist/client/assets/{XCircle-Dp1Lqd1t.js → XCircle-zfE3hdKz.js} +1 -1
  27. package/dist/client/assets/{XClose-lRlzG-cb.js → XClose-B3J1bUSM.js} +1 -1
  28. package/dist/client/assets/{Zap-ebWdIwXf.js → Zap-D0QVNb5R.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-_fsDSSOX.js → ZapSquare-rAJexnnQ.js} +1 -1
  30. package/dist/client/assets/{accordion-D3c87Mh0.js → accordion-BoK92gPa.js} +1 -1
  31. package/dist/client/assets/{agent-icon-Be_PnRh0.js → agent-icon-C-x4n6CJ.js} +1 -1
  32. package/dist/client/assets/{agents-list-45a0yQhW.js → agents-list-DfhnQOt-.js} +1 -1
  33. package/dist/client/assets/ai-providers-BF29zhuW.js +1 -0
  34. package/dist/client/assets/{alert-dialog-BUApN05b.js → alert-dialog-DAYJ8Pv5.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-DH0bWyBT.js → auth-catchall-ldYToNDs.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-DETQBuFK.js → automation-list-row-CNea-O4y.js} +1 -1
  37. package/dist/client/assets/{automations-DvIFzGM7.js → automations-DWhqJ0ka.js} +1 -1
  38. package/dist/client/assets/{avatar-BBnvw18x.js → avatar-Cmh5AQXg.js} +1 -1
  39. package/dist/client/assets/{badge-CRHmlYav.js → badge-DNOR1-Ec.js} +1 -1
  40. package/dist/client/assets/{brand-context-CH2SSDlY.js → brand-context-BQymYCXk.js} +1 -1
  41. package/dist/client/assets/{card-DoqftRz7.js → card-Po-cYdLK.js} +1 -1
  42. package/dist/client/assets/{chat-context-JbYHex_O.js → chat-context-BYrL3EkF.js} +1 -1
  43. package/dist/client/assets/{checkbox-CHYA_sQZ.js → checkbox-BrI9Ksua.js} +1 -1
  44. package/dist/client/assets/{collection-detail-Bb5ojn6D.js → collection-detail-TRSI4X8Y.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-C2ECPv0_.js → collection-display-button-BsfwI3ub.js} +1 -1
  46. package/dist/client/assets/{collection-search-C-2UZGyD.js → collection-search-B1m_HjcE.js} +1 -1
  47. package/dist/client/assets/{collection-search-B8mdZm7u.js → collection-search-B1nlgO0n.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-pDRU_Alr.js → collection-table-wrapper-B-8Kj-5C.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-Bj7BShdC.js → collection-tabs-CY6Bf75C.js} +1 -1
  50. package/dist/client/assets/{collections-CjrHbdtT.js → collections-D2htjE9G.js} +1 -1
  51. package/dist/client/assets/{command-CZWy1buB.js → command-CNtIgq0F.js} +1 -1
  52. package/dist/client/assets/{connection-card-HM9ImVMm.js → connection-card-BEVGFXND.js} +1 -1
  53. package/dist/client/assets/{connection-detail-CWdb5LvI.js → connection-detail-DWvLndm9.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-Cr0s3TXQ.js → connection-form-helpers-yUAHpH2r.js} +1 -1
  55. package/dist/client/assets/{connections-CpsKPW6X.js → connections-BPd8FGPo.js} +1 -1
  56. package/dist/client/assets/{constants-DE2tzNng.js → constants-BIs5QB0D.js} +1 -1
  57. package/dist/client/assets/{constants-Cj0U39_n.js → constants-LMWkDYwt.js} +1 -1
  58. package/dist/client/assets/{dialog-BdVY7mqq.js → dialog-BDbHlLyI.js} +1 -1
  59. package/dist/client/assets/{domain-settings-DALXcXKA.js → domain-settings-CKoWBLNs.js} +1 -1
  60. package/dist/client/assets/{drawer-0C4xllAB.js → drawer-CZBkzpCr.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-Bq-aRZ_r.js → dropdown-menu-C4EY44xH.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-CXa5_dk-.js → dynamic-plugin-layout-BJRUQSsI.js} +1 -1
  63. package/dist/client/assets/{empty-state-Cw5GxS3i.js → empty-state-CbpDBVKq.js} +1 -1
  64. package/dist/client/assets/{empty-state-S_EjXlZP.js → empty-state-Cy6vpOm1.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-DN-EBamj.js → extract-connection-data-DUTmlwgd.js} +1 -1
  66. package/dist/client/assets/{features-CZe-SpPx.js → features-BZeCR5pR.js} +1 -1
  67. package/dist/client/assets/{form-Stkhqjoi.js → form-BhMcn426.js} +1 -1
  68. package/dist/client/assets/{general-aMP5BKAQ.js → general-NxDgjjeP.js} +1 -1
  69. package/dist/client/assets/{index-Crkc58Yb.js → index-9LJebD4k.js} +1 -1
  70. package/dist/client/assets/{index-DCOURowK.js → index-B4CjjxeQ.js} +1 -1
  71. package/dist/client/assets/{index-BZhxvvXQ.js → index-BBbvJ269.js} +1 -1
  72. package/dist/client/assets/{index-BP0vNLKa.js → index-BI1isstj.js} +1 -1
  73. package/dist/client/assets/index-Bq822nJW.js +1 -0
  74. package/dist/client/assets/{index-ClNUcJ8s.js → index-C2_tPdnv.js} +1 -1
  75. package/dist/client/assets/{index-C--avMTn.js → index-CFy1HhlL.js} +1 -1
  76. package/dist/client/assets/{index-ZmvI6xf3.js → index-Cgp_c7tW.js} +1 -1
  77. package/dist/client/assets/{index-y9YjpvN-.js → index-CzcBbEI8.js} +1 -1
  78. package/dist/client/assets/{index-DhThG5rF.js → index-D98XeMPC.js} +3 -3
  79. package/dist/client/assets/{index-B7sUvMqz.js → index-DVhu6vyO.js} +1 -1
  80. package/dist/client/assets/{index-D58bzP3p.js → index-DxpKDFQM.js} +1 -1
  81. package/dist/client/assets/{index-BY8F27EB.js → index-IgcAKuQ2.js} +1 -1
  82. package/dist/client/assets/{index-CAum6J1D.js → index-JmAWXIyD.js} +1 -1
  83. package/dist/client/assets/{index-b_n-uXmh.js → index-ZX5QMr5P.js} +2 -2
  84. package/dist/client/assets/{index-pdnGjAa-.js → index-m7g5E96J.js} +1 -1
  85. package/dist/client/assets/{infiniteQueryObserver-DMFjl81X.js → infiniteQueryObserver-CN1qz-tT.js} +1 -1
  86. package/dist/client/assets/{input-C80VzPpQ.js → input-BP7nCP6h.js} +1 -1
  87. package/dist/client/assets/{integration-icon-LX1nChXa.js → integration-icon-BkL7x5yc.js} +1 -1
  88. package/dist/client/assets/{label-2a4WSF52.js → label-C5PYuLC_.js} +1 -1
  89. package/dist/client/assets/{layout-BAy6nHY2.js → layout-BfrWqBYK.js} +1 -1
  90. package/dist/client/assets/{lean-canvas-recruit-modal-C1vNRy0q.js → lean-canvas-recruit-modal-BA2zXgWK.js} +1 -1
  91. package/dist/client/assets/{login-BwOZspJc.js → login-CAFTkpUR.js} +1 -1
  92. package/dist/client/assets/{members-BxmUMFwY.js → members-BbC2zCXn.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-BY6pRUNM.js → monaco-editor-BUSmOT7P.js} +1 -1
  94. package/dist/client/assets/{monitoring-stats-row-BPKt_N1O.js → monitoring-stats-row-CTX5zI99.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-Dkjb5tCM.js → oauth-callback-B7CxvFLu.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-ai-provider-mujJmFGt.js → oauth-callback-ai-provider-Brm9lVni.js} +1 -1
  97. package/dist/client/assets/{onboarding-C1DRaGue.js → onboarding-CixwRwdD.js} +1 -1
  98. package/dist/client/assets/{org-layout-DioVArtE.js → org-layout-C_WhliuX.js} +1 -1
  99. package/dist/client/assets/{org-plugin-layout-BZoT2SIg.js → org-plugin-layout-DtNPlf-G.js} +1 -1
  100. package/dist/client/assets/{pair-CBvrXYZC.js → pair-BiYYtxTt.js} +1 -1
  101. package/dist/client/assets/{plugin-empty-state-DRAuC0gx.js → plugin-empty-state-DVjP-Rnh.js} +1 -1
  102. package/dist/client/assets/{plugin-header-Y35bsPBd.js → plugin-header-BdoNK1XH.js} +1 -1
  103. package/dist/client/assets/{plugin-layout-BM2m7Nsv.js → plugin-layout-MuJgZDC5.js} +1 -1
  104. package/dist/client/assets/{popover-CALdcEX7.js → popover-D6debZb9.js} +1 -1
  105. package/dist/client/assets/{profile-Cz2Ymv3u.js → profile-Bk87fXbc.js} +1 -1
  106. package/dist/client/assets/{project-app-view-BJIaTnR2.js → project-app-view-CoOHX_Lz.js} +1 -1
  107. package/dist/client/assets/registry-UJ0uJ7Vn.js +2 -0
  108. package/dist/client/assets/{registry-layout-Bg8yl9if.js → registry-layout-BDnTuu0d.js} +1 -1
  109. package/dist/client/assets/{required-auth-layout-CnSE-XLF.js → required-auth-layout-DY0oCaUA.js} +1 -1
  110. package/dist/client/assets/{reset-password-BEfzUzVH.js → reset-password-Bc4vD2TS.js} +1 -1
  111. package/dist/client/assets/{roles-CFSaKkJP.js → roles-B5CBX92p.js} +1 -1
  112. package/dist/client/assets/{scroll-area-18YOEnqD.js → scroll-area-_40Z84a3.js} +1 -1
  113. package/dist/client/assets/{search-input-6INcGAwd.js → search-input-5x6a4ZOP.js} +1 -1
  114. package/dist/client/assets/{select-CaDZpVbI.js → select-IOJ1NROY.js} +1 -1
  115. package/dist/client/assets/{select-model-S5cFobu5.js → select-model-D4-AQ-d0.js} +1 -1
  116. package/dist/client/assets/{settings-layout-jEkhhHU3.js → settings-layout-CoUwUB_u.js} +1 -1
  117. package/dist/client/assets/{settings-section-e84UGEbx.js → settings-section-CnmwdBGZ.js} +1 -1
  118. package/dist/client/assets/{shell-layout-Cdsgdqci.js → shell-layout--_qoatmg.js} +1 -1
  119. package/dist/client/assets/{skeleton-DCXc9Mjl.js → skeleton-CgTiHNyE.js} +1 -1
  120. package/dist/client/assets/{sso-DTC2FHjx.js → sso-WsfGyd84.js} +1 -1
  121. package/dist/client/assets/{store-pc-wftmt.js → store-Dcg4ejbD.js} +1 -1
  122. package/dist/client/assets/store-registry-CaLdFlkC.js +2 -0
  123. package/dist/client/assets/{switch-BUxRExf5.js → switch-CjxzycvO.js} +1 -1
  124. package/dist/client/assets/{table-CT5HWSPV.js → table-OrYO3Bzv.js} +1 -1
  125. package/dist/client/assets/{tabs-Cge-9ZTd.js → tabs-cdUPCCcY.js} +1 -1
  126. package/dist/client/assets/{task-status-tGA8S8H-.js → task-status-CHDtbBBE.js} +1 -1
  127. package/dist/client/assets/{textarea-Dx8hdqfA.js → textarea-B3fwCl7r.js} +1 -1
  128. package/dist/client/assets/{toggle-group-psHBbDPI.js → toggle-group-BjEYUnoX.js} +1 -1
  129. package/dist/client/assets/{tools-list-tDufGw9O.js → tools-list-NvozBHeM.js} +1 -1
  130. package/dist/client/assets/{tooltip-B-nRvfy-.js → tooltip-Bw3OrKLc.js} +1 -1
  131. package/dist/client/assets/{types-hw9no7At.js → types-BhugUgY-.js} +1 -1
  132. package/dist/client/assets/{use-ai-providers-Bc_Jl0e6.js → use-ai-providers-CuAPNurr.js} +1 -1
  133. package/dist/client/assets/{use-collections-CqIGWKSp.js → use-collections-BINoTxiO.js} +1 -1
  134. package/dist/client/assets/{use-connection-DuXPSqwF.js → use-connection-CUwpr33T.js} +1 -1
  135. package/dist/client/assets/{use-copy-CJlR4d5Y.js → use-copy-BgXwbgmv.js} +1 -1
  136. package/dist/client/assets/{use-create-virtual-mcp-B-gULvH7.js → use-create-virtual-mcp-BOwt89Zn.js} +1 -1
  137. package/dist/client/assets/{use-decopilot-events-CWIgEPKA.js → use-decopilot-events-CZEQkDgz.js} +1 -1
  138. package/dist/client/assets/{use-delete-connection-mOKpqJ4Z.js → use-delete-connection-Cd6eQXca.js} +1 -1
  139. package/dist/client/assets/{use-infinite-scroll-HGu4x7ZU.js → use-infinite-scroll-DSXLyALF.js} +1 -1
  140. package/dist/client/assets/{use-list-state-Dlljnhsv.js → use-list-state-BN00buoy.js} +1 -1
  141. package/dist/client/assets/{use-mcp-tools-BkDSNv3W.js → use-mcp-tools-wHT7E3kx.js} +1 -1
  142. package/dist/client/assets/{use-members-8sha4K9R.js → use-members-k9Ulx9NZ.js} +1 -1
  143. package/dist/client/assets/{use-navigate-to-agent-B5j-9-p3.js → use-navigate-to-agent-6pQqUuko.js} +1 -1
  144. package/dist/client/assets/{use-org-auth-client-Ev284uyK.js → use-org-auth-client-CBWdYW0V.js} +1 -1
  145. package/dist/client/assets/{use-org-sso-CD6laYaL.js → use-org-sso-B8sHBE7m.js} +1 -1
  146. package/dist/client/assets/{use-organization-roles-CN53ZUes.js → use-organization-roles-BoFuyqv3.js} +1 -1
  147. package/dist/client/assets/{use-organization-settings-DFNDQvXK.js → use-organization-settings-CKBs_-6H.js} +1 -1
  148. package/dist/client/assets/{use-registry-connections-D1xCWobU.js → use-registry-connections-nuSfHTmJ.js} +1 -1
  149. package/dist/client/assets/{use-status-sounds-ojr3d2EQ.js → use-status-sounds-Zlpm2y7B.js} +1 -1
  150. package/dist/client/assets/{use-tasks-DFEEn9nC.js → use-tasks-BNIrwitI.js} +1 -1
  151. package/dist/client/assets/{use-view-mode-BjLGHFfJ.js → use-view-mode-DN_piLH_.js} +1 -1
  152. package/dist/client/assets/{use-virtual-mcp-Qy5dDA1Q.js → use-virtual-mcp-DK2HDA8s.js} +1 -1
  153. package/dist/client/assets/useInfiniteQuery-DhGaAFoF.js +1 -0
  154. package/dist/client/assets/useSuspenseInfiniteQuery-CsxWE14j.js +1 -0
  155. package/dist/client/assets/{user-ysfLNnXi.js → user-DilxC-j3.js} +1 -1
  156. package/dist/client/assets/{view-mode-toggle-C5L447if.js → view-mode-toggle-BUlKNj6a.js} +1 -1
  157. package/dist/client/assets/{workflow-CWouU_7K.js → workflow-CXAfxdgV.js} +1 -1
  158. package/dist/client/assets/workflow-detail-ekqeRgxB.js +1 -0
  159. package/dist/client/index.html +1 -1
  160. package/dist/server/cli.js +11 -1
  161. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  162. package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
  163. package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
  164. package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
  165. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
  166. package/dist/server/node_modules/mimic-fn/index.d.ts +54 -0
  167. package/dist/server/node_modules/mimic-fn/index.js +13 -0
  168. package/dist/server/node_modules/mimic-fn/license +9 -0
  169. package/dist/server/node_modules/mimic-fn/package.json +42 -0
  170. package/dist/server/node_modules/mimic-fn/readme.md +69 -0
  171. package/dist/server/node_modules/postgres-bytea/index.js +33 -0
  172. package/dist/server/node_modules/postgres-bytea/license +21 -0
  173. package/dist/server/node_modules/postgres-bytea/package.json +34 -0
  174. package/dist/server/node_modules/postgres-bytea/readme.md +34 -0
  175. package/dist/server/node_modules/postgres-date/index.js +116 -0
  176. package/dist/server/node_modules/postgres-date/license +21 -0
  177. package/dist/server/node_modules/postgres-date/package.json +33 -0
  178. package/dist/server/node_modules/postgres-date/readme.md +49 -0
  179. package/dist/server/node_modules/postgres-interval/index.d.ts +20 -0
  180. package/dist/server/node_modules/postgres-interval/index.js +125 -0
  181. package/dist/server/node_modules/postgres-interval/license +21 -0
  182. package/dist/server/node_modules/postgres-interval/package.json +36 -0
  183. package/dist/server/node_modules/postgres-interval/readme.md +48 -0
  184. package/dist/server/node_modules/xtend/.jshintrc +30 -0
  185. package/dist/server/node_modules/xtend/LICENSE +20 -0
  186. package/dist/server/node_modules/xtend/README.md +32 -0
  187. package/dist/server/node_modules/xtend/immutable.js +19 -0
  188. package/dist/server/node_modules/xtend/mutable.js +17 -0
  189. package/dist/server/node_modules/xtend/package.json +55 -0
  190. package/dist/server/node_modules/xtend/test.js +103 -0
  191. package/dist/server/server.js +10 -0
  192. package/package.json +1 -1
  193. package/dist/client/assets/ai-providers-BzCSRpkV.js +0 -1
  194. package/dist/client/assets/index-D2fHFr2F.js +0 -1
  195. package/dist/client/assets/registry-Bm6dPwQv.js +0 -2
  196. package/dist/client/assets/store-registry-BCuueIrr.js +0 -2
  197. package/dist/client/assets/useInfiniteQuery-B82zG1fE.js +0 -1
  198. package/dist/client/assets/useSuspenseInfiniteQuery-4BiVmPoE.js +0 -1
  199. package/dist/client/assets/workflow-detail-rg2LspQv.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e as uu,c as du,aX as fu,j as F,r as R,cF as wl,bg as hu,ao as pu,bc as mt,cG as mu,a7 as Zs,a8 as gu,aW as yu,aT as bu,aU as ku,b6 as xu,cE as Su,ae as Cu}from"./index-b_n-uXmh.js";const wu=fu("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function C0(n){const e=uu.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=du(wu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=F.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=F.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=F.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=F.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=F.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function X(n){this.content=n}X.prototype={constructor:X,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new X(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new X(t)},addToStart:function(n,e){return new X([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new X(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new X(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=X.from(n),n.size?new X(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=X.from(n),n.size?new X(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=X.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};X.from=function(n){if(n instanceof X)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new X(e)};function Ml(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ml(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function El(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=El(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ml(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return El(this,e,t,r)}findIndex(e){if(e==0)return Tn(0,e);if(e==this.size)return Tn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Tn(t+1,i):Tn(t,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,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Jr={index:0,offset:0};function Tn(n,e){return Jr.index=n,Jr.offset=e,Jr}function Wn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Wn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Wn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let B=class Cs{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Wn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cs.none;if(e instanceof Cs)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};B.none=[];class qn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Tl(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new w(e,r,s)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(vl(i.content,e-s-1,t-s-1)))}function Tl(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Tl(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Mu(n,e,t){if(t.openStart>n.depth)throw new qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qn("Inconsistent open depths");return Al(n,e,t,0)}function Al(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Al(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return dt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Eu(t,n);return dt(i,Ol(n,o,l,e,r))}else return dt(i,Un(n,e,r))}function Nl(n,e){if(!e.type.compatibleContent(n.type))throw new qn("Cannot join "+e.type.name+" onto "+n.type.name)}function ws(n,e,t){let r=n.node(t);return Nl(r,e.node(t)),r}function ut(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function en(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ut(n.nodeAfter,r),i++));for(let l=i;l<o;l++)ut(s.child(l),r);e&&e.depth==t&&e.textOffset&&ut(e.nodeBefore,r)}function dt(n,e){return n.type.checkContent(e),n.copy(e)}function Ol(n,e,t,r,s){let i=n.depth>s&&ws(n,e,s+1),o=r.depth>s&&ws(t,r,s+1),l=[];return en(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Nl(i,o),ut(dt(i,Ol(n,e,t,r,s+1)),l)):(i&&ut(dt(i,Un(n,e,s+1)),l),en(e,t,s,l),o&&ut(dt(o,Un(t,r,s+1)),l)),en(r,null,s,l),new k(l)}function Un(n,e,t){let r=[];if(en(null,n,t,r),n.depth>t){let s=ws(n,e,t+1);ut(dt(s,Un(n,e,t+1)),r)}return en(e,null,t,r),new k(r)}function Eu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class fn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Kn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new fn(t,r,i)}static resolveCached(e,t){let r=Wi.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Wi.set(e,r=new vu);let s=r.elts[r.i]=fn.resolve(e,t);return r.i=(r.i+1)%Tu,s}}class vu{constructor(){this.elts=[],this.i=0}}const Tu=12,Wi=new WeakMap;class Kn{constructor(e,t,r){this.$from=e,this.$to=t,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 Au=Object.create(null);class we{constructor(e,t,r,s=B.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Wn(this.attrs,t||e.defaultAttrs||Au)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new we(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new we(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new w(c,s.depth-o,i.depth-o)}replace(e,t,r){return Mu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return fn.resolveCached(this,e)}resolveNoCache(e){return fn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Dl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=B.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!B.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}we.prototype.text=void 0;class Jn extends we{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Dl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nu(e,t);if(r.next==null)return gt.empty;let s=Il(r);r.next&&r.err("Unexpected trailing text");let i=Bu(Lu(s));return zu(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}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 t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{e as uu,c as du,aX as fu,j as F,r as R,cF as wl,bg as hu,ao as pu,bc as mt,cG as mu,a7 as Zs,a8 as gu,aW as yu,aT as bu,aU as ku,b6 as xu,cE as Su,ae as Cu}from"./index-ZX5QMr5P.js";const wu=fu("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function C0(n){const e=uu.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=du(wu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=F.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=F.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=F.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=F.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=F.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function X(n){this.content=n}X.prototype={constructor:X,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new X(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new X(t)},addToStart:function(n,e){return new X([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new X(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new X(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=X.from(n),n.size?new X(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=X.from(n),n.size?new X(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=X.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};X.from=function(n){if(n instanceof X)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new X(e)};function Ml(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ml(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function El(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=El(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ml(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return El(this,e,t,r)}findIndex(e){if(e==0)return Tn(0,e);if(e==this.size)return Tn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Tn(t+1,i):Tn(t,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,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Jr={index:0,offset:0};function Tn(n,e){return Jr.index=n,Jr.offset=e,Jr}function Wn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Wn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Wn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let B=class Cs{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Wn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cs.none;if(e instanceof Cs)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};B.none=[];class qn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Tl(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new w(e,r,s)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(vl(i.content,e-s-1,t-s-1)))}function Tl(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Tl(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Mu(n,e,t){if(t.openStart>n.depth)throw new qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qn("Inconsistent open depths");return Al(n,e,t,0)}function Al(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Al(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return dt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Eu(t,n);return dt(i,Ol(n,o,l,e,r))}else return dt(i,Un(n,e,r))}function Nl(n,e){if(!e.type.compatibleContent(n.type))throw new qn("Cannot join "+e.type.name+" onto "+n.type.name)}function ws(n,e,t){let r=n.node(t);return Nl(r,e.node(t)),r}function ut(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function en(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ut(n.nodeAfter,r),i++));for(let l=i;l<o;l++)ut(s.child(l),r);e&&e.depth==t&&e.textOffset&&ut(e.nodeBefore,r)}function dt(n,e){return n.type.checkContent(e),n.copy(e)}function Ol(n,e,t,r,s){let i=n.depth>s&&ws(n,e,s+1),o=r.depth>s&&ws(t,r,s+1),l=[];return en(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Nl(i,o),ut(dt(i,Ol(n,e,t,r,s+1)),l)):(i&&ut(dt(i,Un(n,e,s+1)),l),en(e,t,s,l),o&&ut(dt(o,Un(t,r,s+1)),l)),en(r,null,s,l),new k(l)}function Un(n,e,t){let r=[];if(en(null,n,t,r),n.depth>t){let s=ws(n,e,t+1);ut(dt(s,Un(n,e,t+1)),r)}return en(e,null,t,r),new k(r)}function Eu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class fn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Kn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new fn(t,r,i)}static resolveCached(e,t){let r=Wi.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Wi.set(e,r=new vu);let s=r.elts[r.i]=fn.resolve(e,t);return r.i=(r.i+1)%Tu,s}}class vu{constructor(){this.elts=[],this.i=0}}const Tu=12,Wi=new WeakMap;class Kn{constructor(e,t,r){this.$from=e,this.$to=t,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 Au=Object.create(null);class we{constructor(e,t,r,s=B.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Wn(this.attrs,t||e.defaultAttrs||Au)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new we(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new we(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new w(c,s.depth-o,i.depth-o)}replace(e,t,r){return Mu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return fn.resolveCached(this,e)}resolveNoCache(e){return fn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),Dl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=B.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!B.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}we.prototype.text=void 0;class Jn extends we{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Dl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nu(e,t);if(r.next==null)return gt.empty;let s=Il(r);r.next&&r.err("Unexpected trailing text");let i=Bu(Lu(s));return zu(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}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 t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}gt.empty=new gt(!0);class Nu{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Il(n){let e=[];do e.push(Ou(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ou(n){let e=[];do e.push(Du(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Du(n){let e=Pu(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Iu(n,e);else break;return e}function qi(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Iu(n,e){let t=qi(n),r=t;return n.eat(",")&&(n.next!="}"?r=qi(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ru(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Pu(n){if(n.eat("(")){let e=Il(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ru(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Lu(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Rl(n,e){return e-n}function Ui(n,e){let t=[];return r(e),t.sort(Rl);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Bu(n){let e=Object.create(null);return t(Ui(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ui(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new gt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Rl);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function zu(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ll(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Bl(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function zl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Fu(n,r,e[r]);return t}let Ki=class $l{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=zl(e,r.attrs),this.defaultAttrs=Pl(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==gt.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:Ll(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new we(this,this.computeAttrs(e),k.from(t),B.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new we(this,this.computeAttrs(e),t,B.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(k.empty,!0);return i?new we(this,e,t.append(i),B.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Bl(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:B.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new $l(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");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 $u(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Fu{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$u(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ir{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=zl(e,s.attrs),this.excluded=null;let i=Pl(this.attrs);this.instance=i?new B(this,i):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Ll(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ir(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Bl(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Fl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=X.from(e.nodes),t.marks=X.from(e.marks||{}),this.nodes=Ki.compile(this.spec.nodes,this),this.marks=Ir.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=gt.parse(o,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=l=="_"?null:l?Ji(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Ji(this,o.split(" "))}this.nodeFromJSON=s=>we.fromJSON(this,s),this.markFromJSON=s=>B.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ki){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(t,r,s)}text(e,t){let r=this.nodes.text;return new Jn(r,r.defaultAttrs,e,B.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ji(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Vu(n){return n.tag!=null}function _u(n){return n.style!=null}class Ge{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Vu(s))this.tags.push(s);else if(_u(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Yi(this,t,!1);return r.addAll(e,B.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Yi(this,t,!0);return r.addAll(e,B.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Wu(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Xi(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Xi(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ge(e,Ge.schemaRules(e)))}}const Vl={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},Hu={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},_l={ol:!0,ul:!0},hn=1,Ms=2,tn=4;function Gi(n,e,t){return e!=null?(e?hn:0)|(e==="full"?Ms:0):n&&n.whitespace=="pre"?hn|Ms:t&~tn}class An{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=B.none,this.match=i||(o&tn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&hn)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Yi{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Gi(null,t.preserveWhitespace,0)|(r?tn:0);s?i=new An(s.type,s.attrs,B.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new An(null,null,B.none,!0,null,o):i=new An(e.schema.topNodeType,null,B.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Ms?"full":this.localPreserveWS||(s.options&hn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));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 l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;_l.hasOwnProperty(o)&&this.parser.normalizeLists&&ju(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Hu.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Vl.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=B.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Qi(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Gi(e,i,o.options);o.options&tn&&o.content.length==0&&(l|=tn);let a=B.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Qi(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new An(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=hn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function ju(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&_l.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Wu(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Xi(n){let e={};for(let t in n)e[t]=n[t];return e}function Qi(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class St{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Gr(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Fn(Gr(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Fn(Gr(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Fn(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new St(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Zi(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Zi(e.marks)}}function Zi(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Gr(n){return n.document||window.document}const eo=new WeakMap;function qu(n){let e=eo.get(n);return e===void 0&&eo.set(n,e=Uu(n)),e}function Uu(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Fn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=qu(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 o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Fn(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Hl=65535,jl=Math.pow(2,16);function Ku(n,e){return n+e*jl}function to(n){return n&Hl}function Ju(n){return(n-(n&Hl))/jl}const Wl=1,ql=2,Vn=4,Ul=8;class Es{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ul)>0}get deletedBefore(){return(this.delInfo&(Wl|Vn))>0}get deletedAfter(){return(this.delInfo&(ql|Vn))>0}get deletedAcross(){return(this.delInfo&Vn)>0}}class de{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&de.empty)return de.empty}recover(e){let t=0,r=to(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Ju(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Ku(l/3,e-a),m=e==a?ql:e==d?Wl:Vn;return(t<0?e!=a:e!=d)&&(m|=Ul),new Es(h,m,p)}s+=u-c}return r?e+s:new Es(e+s,0,null)}touches(e,t){let r=0,s=to(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new de(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?de.empty:new de(e<0?[0,-e,0]:[0,0,e])}}de.empty=new de([]);class pn{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new pn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new pn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Es(e,s,null)}}const Yr=Object.create(null);class re{getMap(){return de.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Yr[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Yr)throw new RangeError("Duplicate use of step JSON ID "+e);return Yr[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,r,s){try{return q.ok(e.replace(t,r,s))}catch(i){if(i instanceof qn)return q.fail(i.message);throw i}}}function ei(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(ei(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class Ue extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new w(ei(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,i)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ue(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ue&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ue(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ue(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("addMark",Ue);class Ce extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(ei(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ue(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ce(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("removeMark",Ce);class Ke extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new w(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Ke(this.pos,t.marks[s]);return new Ke(this.pos,this.mark)}}return new yt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ke(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ke(t.pos,e.markFromJSON(t.mark))}}re.jsonID("addNodeMark",Ke);class yt extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new w(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ke(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yt(t.pos,e.markFromJSON(t.mark))}}re.jsonID("removeNodeMark",yt);class W extends re{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&vs(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new de([this.from,this.to-this.from,this.slice.size])}invert(e){return new W(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&W.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new W(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof W)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new W(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new W(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new W(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}W.MAP_BIAS=1;re.jsonID("replace",W);class G extends re{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(vs(e,this.from,this.gapFrom)||vs(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new de([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new G(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new G(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new G(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}re.jsonID("replaceAround",G);function vs(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Gu(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new Ce(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Ue(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Yu(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Ir){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ce(o.from,o.to,o.style)))}function ti(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new W(l,u,w.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ce(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new w(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new W(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);n.replace(l,l,new w(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function Xu(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function jt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!Xu(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Qu(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=k.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=k.from(s.node(p).copy(f)),h++):c++;n.step(new G(a,c,o,l,new w(u.append(f),d,h),u.size-d,!0))}function ni(n,e,t=null,r=n){let s=Zu(n,e),i=s&&ed(r,e);return i?s.map(no).concat({type:e,attrs:t}).concat(i.map(no)):null}function no(n){return{type:n,attrs:null}}function Zu(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function ed(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function td(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new G(s,i,s,i,new w(r,0,0),t.length,!0))}function nd(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&rd(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Jl(n,o,l,i),ti(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new G(d,f,d+1,f-1,new w(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Kl(n,o,l,i),!1}})}function Kl(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jl(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{dw as d,dx as f,dy as v,dz as x}from"./index-b_n-uXmh.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
1
+ import{dw as d,dx as f,dy as v,dz as x}from"./index-ZX5QMr5P.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
@@ -1 +1 @@
1
- import{e as s,c as a,j as d}from"./index-b_n-uXmh.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
1
+ import{e as s,c as a,j as d}from"./index-ZX5QMr5P.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
@@ -1 +1 @@
1
- import{e as A,j as h,r as z,c as _}from"./index-b_n-uXmh.js";import{n as L}from"./Container-DzkLD13G.js";import{A as k}from"./agent-icon-Be_PnRh0.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
1
+ import{e as A,j as h,r as z,c as _}from"./index-ZX5QMr5P.js";import{n as L}from"./Container-DNCiFX-u.js";import{A as k}from"./agent-icon-C-x4n6CJ.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
@@ -1 +1 @@
1
- import{e as n,c as r,j as i,b5 as p}from"./index-b_n-uXmh.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
1
+ import{e as n,c as r,j as i,b5 as p}from"./index-ZX5QMr5P.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
@@ -1 +1 @@
1
- import{e as C,r as i,c as A,j as a,ao as V}from"./index-b_n-uXmh.js";import{P as E}from"./index-BZhxvvXQ.js";const H=i.createContext(null);function z(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const B=D;function F(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{F as V,B as a,z as b};
1
+ import{e as C,r as i,c as A,j as a,ao as V}from"./index-ZX5QMr5P.js";import{P as E}from"./index-BBbvJ269.js";const H=i.createContext(null);function z(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const B=D;function F(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{F as V,B as a,z as b};
@@ -1,4 +1,4 @@
1
- import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-b_n-uXmh.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-Cj0U39_n.js";import{a as _e}from"./use-navigate-to-agent-B5j-9-p3.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-BdVY7mqq.js";import{i as Ae}from"./RefreshCcw01-BzT-xyrO.js";import{C as Qe}from"./collection-search-B8mdZm7u.js";import{C as st}from"./checkbox-CHYA_sQZ.js";import{b as Ee,u as it}from"./use-connection-DuXPSqwF.js";import{i as ot}from"./Lock01-CI-miN4g.js";import{n as at}from"./agent-icon-Be_PnRh0.js";import{e as rt}from"./extract-connection-data-DN-EBamj.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-0C4xllAB.js";import{u as ke}from"./tooltip-B-nRvfy-.js";import{I as Ue}from"./integration-icon-LX1nChXa.js";import{u as ct,d as Ye}from"./use-mcp-tools-BkDSNv3W.js";import{a as Pe,b as lt}from"./use-virtual-mcp-Qy5dDA1Q.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,agent:{id:i},messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
1
+ import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-ZX5QMr5P.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-LMWkDYwt.js";import{a as _e}from"./use-navigate-to-agent-6pQqUuko.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-BDbHlLyI.js";import{i as Ae}from"./RefreshCcw01-Dkvc9_WI.js";import{C as Qe}from"./collection-search-B1nlgO0n.js";import{C as st}from"./checkbox-BrI9Ksua.js";import{b as Ee,u as it}from"./use-connection-CUwpr33T.js";import{i as ot}from"./Lock01-Yik0Dryf.js";import{n as at}from"./agent-icon-C-x4n6CJ.js";import{e as rt}from"./extract-connection-data-DUTmlwgd.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-CZBkzpCr.js";import{u as ke}from"./tooltip-Bw3OrKLc.js";import{I as Ue}from"./integration-icon-BkL7x5yc.js";import{u as ct,d as Ye}from"./use-mcp-tools-wHT7E3kx.js";import{a as Pe,b as lt}from"./use-virtual-mcp-DK2HDA8s.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,agent:{id:i},messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
2
2
  You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
3
3
  </role>
4
4
 
@@ -1 +1 @@
1
- import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-b_n-uXmh.js";import{I}from"./input-C80VzPpQ.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
1
+ import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-ZX5QMr5P.js";import{I}from"./input-BP7nCP6h.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};