decocms 2.295.0 → 2.296.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/client/assets/{AlertCircle-TmMuXcjl.js → AlertCircle-DGWwcoQZ.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-XQKT7KRo.js → ArrowNarrowLeft-6CbLfe6R.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-B1eJ8Zux.js → ArrowUpRight-DGFb4j2X.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CPpusm9-.js → CheckCircle-TABxOmV2.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-XsMPED_o.js → ChevronDown-YpILLXr3.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DvnZfu1J.js → ChevronRight-C5cwFzdi.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-g5JeXzsM.js → ChevronUp-D3ACbD1g.js} +1 -1
  8. package/dist/client/assets/{Container-D8zDQGz9.js → Container-CEV9uk-Z.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BOPp4_Zm.js → DotsVertical-uATdSTpl.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CGJf1W_Z.js → LinkExternal01-DRPBZiOD.js} +1 -1
  11. package/dist/client/assets/{Lock01-LdcfCIRL.js → Lock01-BwE9ru6U.js} +1 -1
  12. package/dist/client/assets/{Palette-BGUZxjCc.js → Palette-BXvnxfG9.js} +1 -1
  13. package/dist/client/assets/{Play-DADQfe47.js → Play-DgZHjcoJ.js} +1 -1
  14. package/dist/client/assets/{Plus-C7kl4UV6.js → Plus-CCywDmjg.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-CrQnDm5g.js → RefreshCcw01-CtjTkTf4.js} +1 -1
  16. package/dist/client/assets/{SearchMd-CE8VI9gC.js → SearchMd-OYsWp4RC.js} +1 -1
  17. package/dist/client/assets/{Settings02-_WxqBg1B.js → Settings02-DxdBNXj6.js} +1 -1
  18. package/dist/client/assets/{Shield01-CieEV22y.js → Shield01-Qjvq_pQT.js} +1 -1
  19. package/dist/client/assets/{Star01-CoecGSHu.js → Star01-BP3IsurF.js} +1 -1
  20. package/dist/client/assets/{Sun-D-OJyv5-.js → Sun-beuoApqH.js} +1 -1
  21. package/dist/client/assets/{Tool01-w4UQOYN_.js → Tool01-CB2DUdHU.js} +1 -1
  22. package/dist/client/assets/{Trash01-O1QoDagR.js → Trash01-Rux2RMYE.js} +1 -1
  23. package/dist/client/assets/{User01-C1foHOaz.js → User01-CKOZDyFQ.js} +1 -1
  24. package/dist/client/assets/{Users03-BhdZR1Z1.js → Users03-CrrZL9MY.js} +1 -1
  25. package/dist/client/assets/{X-DgFNaccu.js → X-Cg5jWZ6W.js} +1 -1
  26. package/dist/client/assets/{XCircle-D0VmL_m9.js → XCircle-m0QK52Tq.js} +1 -1
  27. package/dist/client/assets/{XClose-BkeTzjOp.js → XClose-N2VTvn-z.js} +1 -1
  28. package/dist/client/assets/{Zap-DUFASc4_.js → Zap-DHpdmH1S.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-CaSKDWHD.js → ZapSquare-CpCXmnKj.js} +1 -1
  30. package/dist/client/assets/{accordion-DRSjy726.js → accordion-CCTO7OqO.js} +1 -1
  31. package/dist/client/assets/{agent-icon-BhmyvzVy.js → agent-icon-BhGa08Fl.js} +1 -1
  32. package/dist/client/assets/{agents-list-LdRYJqAA.js → agents-list-BCvsLrk3.js} +1 -1
  33. package/dist/client/assets/ai-providers-CM3jlHKz.js +1 -0
  34. package/dist/client/assets/{alert-dialog-DTrs5R7J.js → alert-dialog-BvOLTTjL.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-CczzVYAx.js → auth-catchall-Clb5yvZc.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-CkuYa5Xq.js → automation-list-row-BP2xxw0G.js} +1 -1
  37. package/dist/client/assets/{automations-DzTmGwbV.js → automations-CMWGklob.js} +1 -1
  38. package/dist/client/assets/{avatar-DHedl4lM.js → avatar-Di9GD8dd.js} +1 -1
  39. package/dist/client/assets/{badge-CUROAd7Y.js → badge-mnYUd_xY.js} +1 -1
  40. package/dist/client/assets/{brand-context-MhkHZ_rd.js → brand-context-Lx9rMG-L.js} +1 -1
  41. package/dist/client/assets/{card-DRRYnLR5.js → card-DL6KKkK7.js} +1 -1
  42. package/dist/client/assets/{chat-context-BIEHgp18.js → chat-context-mYdLYubP.js} +1 -1
  43. package/dist/client/assets/{checkbox-BTh_K87_.js → checkbox-BYgqHfbE.js} +1 -1
  44. package/dist/client/assets/{collection-detail-DM6Y21iP.js → collection-detail-BCzBqbUR.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-BXsRpfWh.js → collection-display-button-CtGgHUwN.js} +1 -1
  46. package/dist/client/assets/{collection-search-BLwJ-m2r.js → collection-search-CS-ZVub-.js} +1 -1
  47. package/dist/client/assets/{collection-search-13gXcoNW.js → collection-search-D9AiUt0i.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-BooWJqsY.js → collection-table-wrapper-CuIF1tqK.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-C2kDDRsi.js → collection-tabs-CQzwJ8u9.js} +1 -1
  50. package/dist/client/assets/{collections-_hjyrDNM.js → collections-CxHTq2dT.js} +1 -1
  51. package/dist/client/assets/{command-vxtKK455.js → command-s71Khs6g.js} +1 -1
  52. package/dist/client/assets/{connection-card-BxYJJKnz.js → connection-card-ICJdFYlE.js} +1 -1
  53. package/dist/client/assets/{connection-detail-Bbwh3ZPp.js → connection-detail-C-LieaDQ.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-MZU_9Qmb.js → connection-form-helpers-BWfgsLZZ.js} +1 -1
  55. package/dist/client/assets/{connections-CdIKHQiA.js → connections-CNXnRXJ2.js} +1 -1
  56. package/dist/client/assets/{constants-Bwo9TbsB.js → constants-BJnjE8Tt.js} +1 -1
  57. package/dist/client/assets/{constants-CQ_wYHud.js → constants-ajN1Bhug.js} +1 -1
  58. package/dist/client/assets/{dialog-qUGJw8fC.js → dialog-YE4SL2S_.js} +1 -1
  59. package/dist/client/assets/{domain-settings-PW3cTWJG.js → domain-settings-DjkUX6V3.js} +1 -1
  60. package/dist/client/assets/{drawer-C92DFVm0.js → drawer-DoyG2yiq.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-SKNeSVuW.js → dropdown-menu-CT4y7aY2.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-BcIicEBf.js → dynamic-plugin-layout-ButDequ-.js} +1 -1
  63. package/dist/client/assets/{empty-state-LwBr5UHb.js → empty-state-8HZoUHAZ.js} +1 -1
  64. package/dist/client/assets/{empty-state-E0el_m_Z.js → empty-state-BSrKgguR.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-DoQ8Agh8.js → extract-connection-data-D_uDRowj.js} +1 -1
  66. package/dist/client/assets/{features-CFVyOGN4.js → features-DEPC_xpZ.js} +1 -1
  67. package/dist/client/assets/{form-DcpGmWEm.js → form-BbmPNrg3.js} +1 -1
  68. package/dist/client/assets/{general-CfMy1R6k.js → general-D6g4KKmC.js} +1 -1
  69. package/dist/client/assets/{index-16QTCuVi.js → index-B5pffmvD.js} +3 -3
  70. package/dist/client/assets/{index-Bei9_KoS.js → index-B7ZBAwSD.js} +1 -1
  71. package/dist/client/assets/index-BBkns99x.js +1 -0
  72. package/dist/client/assets/{index-Kp_u_eOI.js → index-BEJTb0Vw.js} +1 -1
  73. package/dist/client/assets/{index-DWP35Bmu.js → index-BMNXmL0A.js} +1 -1
  74. package/dist/client/assets/{index-Cf47l9oa.js → index-BjPD6k7-.js} +1 -1
  75. package/dist/client/assets/{index-6CBqUZKF.js → index-BoZfrZ34.js} +1 -1
  76. package/dist/client/assets/{index-BLaDEfeN.js → index-BqwQgnOI.js} +1 -1
  77. package/dist/client/assets/{index-DSFZ7nsY.js → index-C7tDpZrl.js} +1 -1
  78. package/dist/client/assets/{index-BAywNAd0.js → index-CariFzvs.js} +2 -2
  79. package/dist/client/assets/{index-_iFpWniT.js → index-DMby3CEd.js} +1 -1
  80. package/dist/client/assets/{index-CzqHZVv3.js → index-D_1AR6r3.js} +1 -1
  81. package/dist/client/assets/{index-Uxv9KeQf.js → index-Dcc7hO3D.js} +1 -1
  82. package/dist/client/assets/{index-CnMeIIuF.js → index-DfKVv3Jm.js} +1 -1
  83. package/dist/client/assets/{index-GLonPniQ.js → index-Duwc2HjF.js} +1 -1
  84. package/dist/client/assets/{index-CHNkGrWb.js → index-FEqdxfIc.js} +1 -1
  85. package/dist/client/assets/{infiniteQueryObserver-CsxksMd0.js → infiniteQueryObserver-B14O_xhx.js} +1 -1
  86. package/dist/client/assets/{input-BqrzTDvC.js → input-DHEAaYve.js} +1 -1
  87. package/dist/client/assets/{integration-icon-Cw-LLP9G.js → integration-icon-Ceb5m9KS.js} +1 -1
  88. package/dist/client/assets/{label-Cq6u2Lh-.js → label-BMzmJDQh.js} +1 -1
  89. package/dist/client/assets/{layout-CUERkpHe.js → layout-DOsauSuM.js} +1 -1
  90. package/dist/client/assets/{lean-canvas-recruit-modal-B99UeYIe.js → lean-canvas-recruit-modal-BkLS8u5W.js} +1 -1
  91. package/dist/client/assets/{login-CjZqIBoL.js → login-B-Yrcjhs.js} +1 -1
  92. package/dist/client/assets/{members-Bj8baHVz.js → members-C0mvo5fb.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-BXagKiI7.js → monaco-editor-BagFQ75t.js} +1 -1
  94. package/dist/client/assets/{monitoring-stats-row-BkU2srVh.js → monitoring-stats-row-DDPUNMkL.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-Cqf2XK5j.js → oauth-callback-DO6ysGop.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-ai-provider-DrfnGdmp.js → oauth-callback-ai-provider-BEuoh6UY.js} +1 -1
  97. package/dist/client/assets/{onboarding-D-Fll1Qd.js → onboarding-DKITn4vN.js} +1 -1
  98. package/dist/client/assets/{org-layout-Ctr8m-Xy.js → org-layout-Dk4WIIF4.js} +1 -1
  99. package/dist/client/assets/{org-plugin-layout-BhS0DGxL.js → org-plugin-layout-CLffcHJs.js} +1 -1
  100. package/dist/client/assets/{pair-D59ITUWs.js → pair-vGTs_zPg.js} +56 -56
  101. package/dist/client/assets/{plugin-empty-state-CqpHZZ90.js → plugin-empty-state-CmHCNawV.js} +1 -1
  102. package/dist/client/assets/{plugin-header-CfMDsQ5-.js → plugin-header-C9WSKk3D.js} +1 -1
  103. package/dist/client/assets/{plugin-layout-DApFJ0hx.js → plugin-layout-DOzo0-WT.js} +1 -1
  104. package/dist/client/assets/{popover-CIQ5nYbk.js → popover-5Qa5l709.js} +1 -1
  105. package/dist/client/assets/{profile--MuhnyFH.js → profile-CyjcpQTt.js} +1 -1
  106. package/dist/client/assets/{project-app-view-C6unfZ4i.js → project-app-view-BL-P3zUl.js} +1 -1
  107. package/dist/client/assets/registry-BlMP6ABP.js +2 -0
  108. package/dist/client/assets/{registry-layout-CdfbaMKP.js → registry-layout-CIMBhCba.js} +1 -1
  109. package/dist/client/assets/{required-auth-layout-DAS0oBtI.js → required-auth-layout-BOwcnbO9.js} +1 -1
  110. package/dist/client/assets/{reset-password-BI6L3oGg.js → reset-password-Cl6CDyqy.js} +1 -1
  111. package/dist/client/assets/{roles-C20gcBRH.js → roles-DTF2ANjI.js} +1 -1
  112. package/dist/client/assets/{scroll-area-CwefWQJz.js → scroll-area-HNGrspxG.js} +1 -1
  113. package/dist/client/assets/{search-input-Cw7qsY4D.js → search-input-BvZNM2RM.js} +1 -1
  114. package/dist/client/assets/{select-BsqOoRjy.js → select-C5MYEBtM.js} +1 -1
  115. package/dist/client/assets/{select-model-2XCyUhYh.js → select-model-_j0smQSE.js} +1 -1
  116. package/dist/client/assets/{settings-layout-CInduq_4.js → settings-layout-Dq4UX_n_.js} +1 -1
  117. package/dist/client/assets/{settings-section-a70NRysW.js → settings-section-COnpJzJz.js} +1 -1
  118. package/dist/client/assets/{shell-layout-vlCxg3wp.js → shell-layout-BnsXbGf-.js} +1 -1
  119. package/dist/client/assets/{skeleton-ut2Fjnfc.js → skeleton-BzKJgxvw.js} +1 -1
  120. package/dist/client/assets/{sso-DWQtkeci.js → sso-Dl81_azC.js} +1 -1
  121. package/dist/client/assets/{store-DzJ4uPv_.js → store-IYIgp3qV.js} +1 -1
  122. package/dist/client/assets/store-registry-BJ9XvOV4.js +2 -0
  123. package/dist/client/assets/{switch-BOLNOz2b.js → switch-HROyTNdj.js} +1 -1
  124. package/dist/client/assets/{table-DP_npJUh.js → table-IqV9GNGa.js} +1 -1
  125. package/dist/client/assets/{tabs-C14WE3bq.js → tabs-BPvd4P0n.js} +1 -1
  126. package/dist/client/assets/{task-status-FilXySGc.js → task-status-DZKELKFJ.js} +1 -1
  127. package/dist/client/assets/{textarea-CmJMc5JU.js → textarea-KDZuzqvR.js} +1 -1
  128. package/dist/client/assets/{toggle-group-Cw56io9g.js → toggle-group-DM97u04F.js} +1 -1
  129. package/dist/client/assets/{tools-list-BQ35DR0s.js → tools-list-kpR-DdJQ.js} +1 -1
  130. package/dist/client/assets/{tooltip-iWA8tsOt.js → tooltip-Dr3uY9D4.js} +1 -1
  131. package/dist/client/assets/{types-D1-bFUi0.js → types-mFMyaEXB.js} +1 -1
  132. package/dist/client/assets/{use-ai-providers-O6PDM1es.js → use-ai-providers-D5NHg2Ru.js} +1 -1
  133. package/dist/client/assets/{use-collections-CB-s1Fe8.js → use-collections-B9qAfcJY.js} +1 -1
  134. package/dist/client/assets/{use-connection-BRDOgzI9.js → use-connection-Dw3HjptL.js} +1 -1
  135. package/dist/client/assets/{use-copy-D_tdIgNn.js → use-copy-CpV0fKqM.js} +1 -1
  136. package/dist/client/assets/{use-create-virtual-mcp-SQq_0wwz.js → use-create-virtual-mcp-GSBx9joR.js} +1 -1
  137. package/dist/client/assets/{use-decopilot-events-gWQ7TcNv.js → use-decopilot-events-Lyv24iLh.js} +1 -1
  138. package/dist/client/assets/{use-delete-connection-BoFquqB-.js → use-delete-connection-DJQOIuEz.js} +1 -1
  139. package/dist/client/assets/{use-infinite-scroll-CXsf__mT.js → use-infinite-scroll-C-7Y6eBv.js} +1 -1
  140. package/dist/client/assets/{use-list-state-vDn3VfBt.js → use-list-state-CuoLDS8v.js} +1 -1
  141. package/dist/client/assets/{use-mcp-tools-Cqhx2HL6.js → use-mcp-tools-C2NC0OB_.js} +1 -1
  142. package/dist/client/assets/{use-members-CUqwI0-t.js → use-members-DLx75xut.js} +1 -1
  143. package/dist/client/assets/{use-navigate-to-agent-CnLUwuJt.js → use-navigate-to-agent-CxjZQ1fq.js} +1 -1
  144. package/dist/client/assets/{use-org-auth-client-CEEu3RoZ.js → use-org-auth-client-CBU51XQa.js} +1 -1
  145. package/dist/client/assets/{use-org-sso-2VDp-rZw.js → use-org-sso-B61uYZKs.js} +1 -1
  146. package/dist/client/assets/{use-organization-roles-BPmOA_FM.js → use-organization-roles-DMz4JpGH.js} +1 -1
  147. package/dist/client/assets/{use-organization-settings-Bm3oyYWt.js → use-organization-settings-B81E2rNE.js} +1 -1
  148. package/dist/client/assets/{use-registry-connections-GaolpGHd.js → use-registry-connections-vur0Zrsf.js} +1 -1
  149. package/dist/client/assets/{use-status-sounds-CN6Aqzsb.js → use-status-sounds-DkEi-BmD.js} +1 -1
  150. package/dist/client/assets/{use-tasks-CvLwec2V.js → use-tasks-CIfTcsjC.js} +1 -1
  151. package/dist/client/assets/{use-view-mode-Cfb_2w0E.js → use-view-mode-NasGzpHg.js} +1 -1
  152. package/dist/client/assets/{use-virtual-mcp-CTsmN-sy.js → use-virtual-mcp-9JsEXBge.js} +1 -1
  153. package/dist/client/assets/useInfiniteQuery-BOZnPi0L.js +1 -0
  154. package/dist/client/assets/useSuspenseInfiniteQuery-M_8yh3H4.js +1 -0
  155. package/dist/client/assets/{user-CtOwtNK9.js → user-pxLMJc6I.js} +1 -1
  156. package/dist/client/assets/{view-mode-toggle-cM3ZdaYG.js → view-mode-toggle-_crWUr2e.js} +1 -1
  157. package/dist/client/assets/{workflow-DFUEo5vC.js → workflow-DvosQfQf.js} +1 -1
  158. package/dist/client/assets/workflow-detail-CeNwzbGr.js +1 -0
  159. package/dist/client/index.html +1 -1
  160. package/dist/server/cli.js +1 -1
  161. package/dist/server/node_modules/postgres-date/index.js +116 -0
  162. package/dist/server/node_modules/{postgres-interval → postgres-date}/package.json +8 -11
  163. package/dist/server/node_modules/postgres-date/readme.md +49 -0
  164. package/package.json +1 -1
  165. package/dist/client/assets/ai-providers-Beu_Ygx3.js +0 -1
  166. package/dist/client/assets/index-BdJA1qE_.js +0 -1
  167. package/dist/client/assets/registry-CKN348lV.js +0 -2
  168. package/dist/client/assets/store-registry-DsM1-Xx4.js +0 -2
  169. package/dist/client/assets/useInfiniteQuery-B47NEP-H.js +0 -1
  170. package/dist/client/assets/useSuspenseInfiniteQuery-DKOsvjoC.js +0 -1
  171. package/dist/client/assets/workflow-detail-Dg_TbZT2.js +0 -1
  172. package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
  173. package/dist/server/node_modules/mimic-fn/index.js +0 -13
  174. package/dist/server/node_modules/mimic-fn/license +0 -9
  175. package/dist/server/node_modules/mimic-fn/package.json +0 -42
  176. package/dist/server/node_modules/mimic-fn/readme.md +0 -69
  177. package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
  178. package/dist/server/node_modules/postgres-interval/index.js +0 -125
  179. package/dist/server/node_modules/postgres-interval/readme.md +0 -48
  180. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  181. package/dist/server/node_modules/xtend/LICENSE +0 -20
  182. package/dist/server/node_modules/xtend/README.md +0 -32
  183. package/dist/server/node_modules/xtend/immutable.js +0 -19
  184. package/dist/server/node_modules/xtend/mutable.js +0 -17
  185. package/dist/server/node_modules/xtend/package.json +0 -55
  186. package/dist/server/node_modules/xtend/test.js +0 -103
  187. /package/dist/server/node_modules/{postgres-interval → postgres-date}/license +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-C6unfZ4i.js","assets/index-BAywNAd0.js","assets/index-D9g6ZM2x.css","assets/pair-D59ITUWs.js","assets/agent-icon-BhmyvzVy.js","assets/AlertCircle-TmMuXcjl.js","assets/Tool01-w4UQOYN_.js","assets/XClose-BkeTzjOp.js","assets/RefreshCcw01-CrQnDm5g.js","assets/ArrowNarrowLeft-XQKT7KRo.js","assets/XCircle-D0VmL_m9.js","assets/ArrowUpRight-B1eJ8Zux.js","assets/ZapSquare-CaSKDWHD.js","assets/Users03-BhdZR1Z1.js","assets/CheckCircle-CPpusm9-.js","assets/ChevronDown-XsMPED_o.js","assets/ChevronRight-DvnZfu1J.js","assets/ChevronUp-g5JeXzsM.js","assets/DotsVertical-BOPp4_Zm.js","assets/Container-D8zDQGz9.js","assets/Star01-CoecGSHu.js","assets/Palette-BGUZxjCc.js","assets/SearchMd-CE8VI9gC.js","assets/index-CzqHZVv3.js","assets/tooltip-iWA8tsOt.js","assets/X-DgFNaccu.js","assets/LinkExternal01-CGJf1W_Z.js","assets/Lock01-LdcfCIRL.js","assets/Sun-D-OJyv5-.js","assets/Play-DADQfe47.js","assets/Plus-C7kl4UV6.js","assets/Settings02-_WxqBg1B.js","assets/Shield01-CieEV22y.js","assets/Trash01-O1QoDagR.js","assets/User01-C1foHOaz.js","assets/Zap-DUFASc4_.js","assets/index-Uxv9KeQf.js","assets/use-copy-D_tdIgNn.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-qUGJw8fC.js","assets/content-blocks-o63cs2vh.js","assets/types-D1-bFUi0.js","assets/constants-CQ_wYHud.js","assets/chat-context-BIEHgp18.js","assets/use-virtual-mcp-CTsmN-sy.js","assets/use-collections-CB-s1Fe8.js","assets/use-ai-providers-O6PDM1es.js","assets/use-decopilot-events-gWQ7TcNv.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-CvLwec2V.js","assets/use-organization-settings-Bm3oyYWt.js","assets/shell-layout-vlCxg3wp.js","assets/required-auth-layout-DAS0oBtI.js","assets/use-org-sso-2VDp-rZw.js","assets/integration-icon-Cw-LLP9G.js","assets/use-mcp-tools-Cqhx2HL6.js"])))=>i.map(i=>d[i]);
2
- import{o as Ht,r as A,p as jl,q as El,e as V,s as Ce,K as As,n as Wo,a as Uo,c as te,j as o,l as Me,B as se,E as Qt,b as Si,v as ni,f as Mt,d as Yr,w as Tl,x as me,y as Dl,V as Rl,t as Se,z as Vo,C as Ml,D as Xt,F as Bl,G as vn,L as Il,H as Ai,I as Js,J as ct,M as Ko,P as Al,_ as Pl,Q as qo,R as Go,T as Ll,g as Ol}from"./index-BAywNAd0.js";import{C as je,u as zl,w as $l,A as Fl,T as Hl,a as Wl}from"./index-DWP35Bmu.js";import{I as ds}from"./integration-icon-Cw-LLP9G.js";import{S as Bt,u as Fe,g as Yo,a as Xo}from"./constants-CQ_wYHud.js";import{u as gt,a as Ul}from"./use-virtual-mcp-CTsmN-sy.js";import{a as Vl}from"./Users03-BhdZR1Z1.js";import{u as Jo,a as lt,b as yi,c as wi,t as Kl,d as xn}from"./chat-context-BIEHgp18.js";import{i as as}from"./AlertCircle-TmMuXcjl.js";import{i as ql}from"./CheckCircle-CPpusm9-.js";import{n as bn,a as Gl}from"./ZapSquare-CaSKDWHD.js";import{i as Yl,a as Xl,b as Jl,c as Ci,d as Zl}from"./XCircle-D0VmL_m9.js";import{s as ls,i as Ql}from"./XClose-BkeTzjOp.js";import{c as ec,r as tc,p as Zo,f as Sn,a as sc,F as ic,t as yn,M as Xr,G as Qo,L as rc,i as nc,b as oc,d as ac,e as lc}from"./pair-D59ITUWs.js";import{C as cc,a as wn,b as Cn,c as hc,d as dc,e as uc,f as fc}from"./command-vxtKK455.js";import{P as Hs,a as Ws,b as Us}from"./popover-CIQ5nYbk.js";import{i as Ds,a as mi,b as mc,c as _c,p as ki,g as Ni,d as Jr,e as ea,h as ar,f as Pi,j as kn,A as Nn,k as ta,l as pc,m as gc,n as vc,t as xc,o as bc,q as sa,r as ia,s as ra,u as na,v as jn,w as Sc,x as Rs,y as yc,z as wc,B as Cc,C as oa}from"./agent-icon-BhmyvzVy.js";import{u as us,a as kc}from"./use-mcp-tools-Cqhx2HL6.js";import{u as Nc,a as jc}from"./use-ai-providers-O6PDM1es.js";import{g as It,c as En,u as Ec,b as lr,d as Tc,e as Dc,f as Rc,T as Mc}from"./index-6CBqUZKF.js";import{u as Zr,i as Bc}from"./shell-layout-vlCxg3wp.js";import{i as Ic,P as at,u as Ac,c as Pc,d as Lc,e as Oc}from"./index-CzqHZVv3.js";import{u as aa,T as Ve,a as Ke,b as qe,c as zc}from"./tooltip-iWA8tsOt.js";import{u as $c}from"./use-status-sounds-CN6Aqzsb.js";import{E as Ps}from"./empty-state-LwBr5UHb.js";import{A as Fc,a as Hc,b as Wc,c as Uc,R as la,d as Vc,e as Kc}from"./accordion-DRSjy726.js";import{u as ji,a as Qr,b as qc}from"./use-connection-BRDOgzI9.js";import{g as Gc}from"./constants-Bwo9TbsB.js";import{u as Yc,g as Xc}from"./types-D1-bFUi0.js";import{U as ca}from"./user-CtOwtNK9.js";import{T as Jc,u as ha}from"./tools-list-BQ35DR0s.js";import{u as Li}from"./unwrap-tool-result-BYXdCQMg.js";import{s as da,g as Zc}from"./connection-slug-eyAPH6o3.js";import{A as ua,a as fa,b as ma,c as _a,d as pa,e as ga,f as va,g as xa}from"./alert-dialog-DTrs5R7J.js";import{D as Qc,a as en,b as tn,c as ba,d as Sa}from"./dialog-qUGJw8fC.js";import{C as eh,a as Tn}from"./card-DRRYnLR5.js";import{I as fs}from"./input-BqrzTDvC.js";import{L as Ms}from"./label-Cq6u2Lh-.js";import{S as es,a as ts,b as ss,c as is,d as Rt}from"./select-BsqOoRjy.js";import{S as cr}from"./switch-BOLNOz2b.js";import{T as Dn}from"./textarea-CmJMc5JU.js";import{i as oi}from"./Play-DADQfe47.js";import{s as cs}from"./Plus-C7kl4UV6.js";import{a as th}from"./Settings02-_WxqBg1B.js";import{t as ya}from"./Tool01-w4UQOYN_.js";import{s as hr}from"./Trash01-O1QoDagR.js";import{S as wa}from"./scroll-area-CwefWQJz.js";import{i as Ca,a as sh}from"./SearchMd-CE8VI9gC.js";import{C as ih}from"./collection-tabs-C2kDDRsi.js";import{C as rh}from"./checkbox-BTh_K87_.js";import{u as nh,T as Oi,a as oh,b as ah,c as zi}from"./tabs-C14WE3bq.js";import{D as lh,a as ch,b as hh}from"./drawer-C92DFVm0.js";import{i as Ei,t as dr}from"./ChevronDown-XsMPED_o.js";import{n as Wt}from"./LinkExternal01-CGJf1W_Z.js";import{D as rs,a as ns,b as os,c as yt,d as dh,e as uh,f as fh}from"./dropdown-menu-SKNeSVuW.js";import{i as ka}from"./RefreshCcw01-CrQnDm5g.js";import{V as mh}from"./view-mode-toggle-cM3ZdaYG.js";import{G as _h}from"./lean-canvas-recruit-modal-B99UeYIe.js";import{M as ph}from"./select-model-2XCyUhYh.js";import{u as Vs,a as gh,b as vh,c as xh,A as bh,d as Sh}from"./automation-list-row-CkuYa5Xq.js";import{i as Ls}from"./Zap-DUFASc4_.js";import{S as yh}from"./search-input-Cw7qsY4D.js";import"./use-navigate-to-agent-CnLUwuJt.js";import"./use-tasks-CvLwec2V.js";import"./use-collections-CB-s1Fe8.js";import"./index-Uxv9KeQf.js";import"./collection-search-13gXcoNW.js";import"./form-DcpGmWEm.js";import"./Star01-CoecGSHu.js";import"./Lock01-LdcfCIRL.js";import"./X-DgFNaccu.js";import"./toggle-group-Cw56io9g.js";import"./index-BLaDEfeN.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-D6a8kmGH.js";import"./connection-card-BxYJJKnz.js";import"./use-registry-connections-GaolpGHd.js";import"./use-organization-settings-Bm3oyYWt.js";import"./useInfiniteQuery-B47NEP-H.js";import"./infiniteQueryObserver-CsxksMd0.js";import"./extract-connection-data-DoQ8Agh8.js";import"./Container-D8zDQGz9.js";import"./connection-form-helpers-MZU_9Qmb.js";import"./use-infinite-scroll-CXsf__mT.js";import"./useSuspenseInfiniteQuery-DKOsvjoC.js";import"./badge-CUROAd7Y.js";import"./ChevronRight-DvnZfu1J.js";import"./use-decopilot-events-gWQ7TcNv.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-D_tdIgNn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./index-DSFZ7nsY.js";import"./ArrowNarrowLeft-XQKT7KRo.js";import"./ArrowUpRight-B1eJ8Zux.js";import"./ChevronUp-g5JeXzsM.js";import"./DotsVertical-BOPp4_Zm.js";import"./Palette-BGUZxjCc.js";import"./Sun-D-OJyv5-.js";import"./Shield01-CieEV22y.js";import"./User01-C1foHOaz.js";import"./skeleton-ut2Fjnfc.js";import"./avatar-DHedl4lM.js";import"./index-_iFpWniT.js";import"./collection-search-BLwJ-m2r.js";import"./use-create-virtual-mcp-SQq_0wwz.js";import"./task-status-FilXySGc.js";import"./required-auth-layout-DAS0oBtI.js";import"./use-org-sso-2VDp-rZw.js";import"./collections-_hjyrDNM.js";import"./settings-section-a70NRysW.js";import"./formatDistanceToNow-Cb2QZZJn.js";function wh(t,e){const s=Ht(e);return Ch({filters:{...t,status:"pending"}},s).length}function Rn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Ch(t={},e){const s=Ht(e).getMutationCache(),i=A.useRef(t),r=A.useRef(null);return r.current===null&&(r.current=Rn(s,t)),A.useEffect(()=>{i.current=t}),A.useSyncExternalStore(A.useCallback(n=>s.subscribe(()=>{const a=jl(r.current,Rn(s,i.current));r.current!==a&&(r.current=a,El.schedule(n))}),[s]),()=>r.current,()=>r.current)}function kh(t,e){const s=V.c(39),{org:i,locator:r}=Ce();let n;s[0]!==i.id?(n={connectionId:Bt,orgId:i.id},s[0]=i.id,s[1]=n):n=s[1];const a=Fe(n),l=Ht();let h;s[2]!==t||s[3]!==i.id?(h=As.ensureTask(i.id,t),s[2]=t,s[3]=i.id,s[4]=h):h=s[4];let c;s[5]!==a||s[6]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[5]=a,s[6]=t,s[7]=c):c=s[7];const d=t.length>0;let u;s[8]!==h||s[9]!==c||s[10]!==d?(u={queryKey:h,queryFn:c,enabled:d,retry:!1,refetchOnWindowFocus:!1},s[8]=h,s[9]=c,s[10]=d,s[11]=u):u=s[11];const m=Wo(u);let _;s[12]!==a||s[13]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const y=w.content,k=Array.isArray(y)&&y[0]&&typeof y[0]=="object"?y[0].text??"Create failed":"Create failed";throw new Error(k)}return w.structuredContent.item},s[12]=a,s[13]=e,s[14]=_):_=s[14];let f;s[15]!==r||s[16]!==i.id||s[17]!==m||s[18]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[15]=r,s[16]=i.id,s[17]=m,s[18]=l,s[19]=f):f=s[19];let p;s[20]!==_||s[21]!==f?(p={mutationFn:_,onSuccess:f},s[20]=_,s[21]=f,s[22]=p):p=s[22];const g=Uo(p);let v,b;if(s[23]!==g||s[24]!==t||s[25]!==m.data||s[26]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[23]=g,s[24]=t,s[25]=m.data,s[26]=m.isSuccess,s[27]=v,s[28]=b):(v=s[27],b=s[28]),A.useEffect(v,b),!t){let x;return s[29]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[29]=x):x=s[29],x}if(m.isLoading){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[30]=x):x=s[30],x}if(m.isError){const x=m.error;let w;return s[31]!==x?(w={status:"error",error:x},s[31]=x,s[32]=w):w=s[32],w}if(m.isSuccess&&m.data){let x;return s[33]!==m.data?(x={status:"ready",task:m.data},s[33]=m.data,s[34]=x):x=s[34],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[35]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[35]=x):x=s[35],x}if(g.isError){let x;return s[36]!==g.error?(x={status:"error",error:g.error},s[36]=g.error,s[37]=x):x=s[37],x}let S;return s[38]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[38]=S):S=s[38],S}function vs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Mn(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Nh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function jh(t){const e=V.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Eh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Eh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Th(t){const e=V.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let m;e[6]!==c||e[7]!==d||e[8]!==u?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==m?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=w):w=e[29],w}function Dh(t){const e=V.c(19),{part:s}=t,i=s.input?.agent_id,r=gt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let d;e[0]!==a||e[1]!==n?(d=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=d):d=e[2];const u=h?"text-destructive":"text-foreground";let m;e[3]!==u?(m=te("shrink-0 font-medium",u),e[3]=u,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Me,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Yl,{size:12,className:"text-destructive"}):c?o.jsx(as,{size:12,className:"text-warning"}):o.jsx(ql,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==d||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,_,f,p]}),e[14]=d,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Rh(t){const e=V.c(58),{onClose:s,back:i,className:r}=t,[n,a]=A.useState(null),{messages:l}=Jo(),{tasks:h,taskId:c}=lt(),{selectedModel:d,selectedVirtualMcp:u}=yi();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==d||e[6]!==u?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let N;e[17]!==c?(N=Q=>Q.id===c,e[17]=c,e[18]=N):N=e[18];const y=h.find(N),k=ec(l),j=[...l].reverse().find($h),B=j?.metadata?.usage,D=j?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow??null,T=B?.contextTokens??B?.totalTokens??0,C=D&&D>0?(T/D*100).toFixed(1):null,R=l;let E;e[19]!==R?(E=R.filter(zh).reduce(Oh,0),e[19]=R,e[20]=E):E=e[20];const O=E,z=l;let I;e[21]!==z?(I=z.filter(Lh).reduce(Ph,0),e[21]=z,e[22]=I):I=e[22];const L=I,$=Math.max(0,k.totalTokens-O-L),F=l[0],M=l.at(-1),W=F?.metadata?.created_at??y?.created_at,U=M?.metadata?.created_at??y?.updated_at,K=l.filter(Ah),G=l.flatMap(Bh),P=d?.modelId?Nh(d.modelId):"—",Z=u?.title??"Decopilot",Y=[{label:"Session",value:y?.title??"New chat"},{label:"Messages",value:K.length},{label:"Agent",value:Z},{label:"Model",value:P},{label:"Context Limit",value:D?vs(D):"—"},{label:"Session Tokens (billed)",value:k.totalTokens>0?vs(k.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:k.inputTokens>0?vs(k.inputTokens):"0"},{label:"Output Tokens",value:k.outputTokens>0?vs(k.outputTokens):"0"},{label:"Reasoning Tokens",value:k.reasoningTokens>0?vs(k.reasoningTokens):"0"},{label:"Cost",value:k.cost>0?`$${k.cost<.001?k.cost.toFixed(6):k.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Mn(W)},{label:"Last Activity",value:Mn(U)}];if(!y&&K.length===0){let Q;e[23]!==r?(Q=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Q):Q=e[24];let he;e[25]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=he):he=e[25];let de;e[26]!==i?(de=i?o.jsx(bn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=de):de=e[27];let ue;e[28]!==s||e[29]!==de?(ue=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[he,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:de})]}),e[28]=s,e[29]=de,e[30]=ue):ue=e[30];let ye;e[31]===Symbol.for("react.memo_cache_sentinel")?(ye=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=ye):ye=e[31];let Xe;e[32]!==Q||e[33]!==ue?(Xe=o.jsxs("div",{className:Q,children:[ue,ye]}),e[32]=Q,e[33]=ue,e[34]=Xe):Xe=e[34],S=Xe;break e}e[35]!==r?(v=te("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let ee;e[37]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=ee):ee=e[37];let ce;e[38]!==i?(ce=i?o.jsx(bn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ce):ce=e[39],e[40]!==s||e[41]!==ce?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[ee,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ce})]}),e[40]=s,e[41]=ce,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=G.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:G.map(Mh)})]}),f=o.jsx(jh,{items:Y});let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ie):ie=e[43],e[44]!==L||e[45]!==$||e[46]!==O?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ie,o.jsx(Th,{userTokens:O,assistantTokens:L,otherTokens:$})]}),e[44]=L,e[45]=$,e[46]=O,e[47]=p):p=e[47],g=K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:K.map(Q=>{const he=Q.metadata?.created_at,de=n?.id===Q.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Q),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:te("shrink-0 font-medium",Q.role==="user"?"text-chart-1":"text-chart-2"),children:Q.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Q.id})]}),he&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(he).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(Q,null,2)})]},Q.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=d,e[6]=u?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Mh(t,e){return o.jsx(Dh,{part:t},e)}function Bh(t){return(t.parts??[]).filter(Ih)}function Ih(t){return t.type==="tool-subtask"}function Ah(t){return t.role!=="system"}function Ph(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Lh(t){return t.role==="assistant"}function Oh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function zh(t){return t.role==="user"}function $h(t){return t.role==="assistant"&&t.metadata?.usage}const Bn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],In=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Fh(){const t=Bn[Math.floor(Math.random()*Bn.length)],e=In[Math.floor(Math.random()*In.length)];return`deco/${t}-${e}`}function Hh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Wh(t){const e=V.c(25),{orgId:s,userId:i,connectionId:r,vmMap:n,owner:a,repo:l,enabled:h}=t,c=h===void 0?!0:h,d=r??null;let u;e[0]!==s||e[1]!==d?(u={connectionId:d,orgId:s},e[0]=s,e[1]=d,e[2]=u):u=e[2];const m=Fe(u);let _;e[3]!==a||e[4]!==l?(_={owner:a,repo:l},e[3]=a,e[4]=l,e[5]=_):_=e[5];const f=c&&!!r&&!!a&&!!l;let p;e[6]!==m||e[7]!==_||e[8]!==f?(p={client:m,toolName:"list_branches",toolArguments:_,enabled:f,staleTime:3e4,select:qh},e[6]=m,e[7]=_,e[8]=f,e[9]=p):p=e[9];const{data:g,isLoading:v,isError:b}=us(p);let S,x;e[10]!==i||e[11]!==n?(x=new Set(Object.keys(n?.[i]??{})),S=[...x].sort().map(Kh),e[10]=i,e[11]=n,e[12]=S,e[13]=x):(S=e[12],x=e[13]);const w=S;let N;if(e[14]!==g||e[15]!==x){const B=Array.isArray(g)?g:g?.branches??[];let D;e[17]!==x?(D=T=>!x.has(T.name),e[17]=x,e[18]=D):D=e[18],N=B.filter(Vh).filter(D).map(Uh),e[14]=g,e[15]=x,e[16]=N}else N=e[16];const y=N,k=Array.isArray(g)?null:g?.default_branch??null;let j;return e[19]!==k||e[20]!==b||e[21]!==v||e[22]!==y||e[23]!==w?(j={yours:w,others:y,defaultBase:k,isLoading:v,isError:b},e[19]=k,e[20]=b,e[21]=v,e[22]=y,e[23]=w,e[24]=j):j=e[24],j}function Uh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Vh(t){return typeof t.name=="string"}function Kh(t){return{name:t,source:"yours"}}function qh(t){return Hh(t)}function Gh(t){const e=V.c(41),{orgId:s,userId:i,connectionId:r,owner:n,repo:a,vmMap:l,value:h,onChange:c}=t,[d,u]=A.useState(!1);let m;e[0]!==r||e[1]!==d||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==i||e[6]!==l?(m={orgId:s,userId:i,connectionId:r,vmMap:l,owner:n,repo:a,enabled:d},e[0]=r,e[1]=d,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=l,e[7]=m):m=e[7];const{yours:_,others:f,isLoading:p,isError:g}=Wh(m);let v;e[8]!==c?(v=E=>{c(E),u(!1)},e[8]=c,e[9]=v):v=e[9];const b=v,S=h??"Select branch…";let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ds,{className:"h-3.5 w-3.5"}),e[10]=x):x=e[10];let w;e[11]!==S?(w=o.jsx(Hs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[x,o.jsx("span",{className:"max-w-[200px] truncate",children:S})]})}),e[11]=S,e[12]=w):w=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(dc,{placeholder:"Search branches…"}),e[13]=N):N=e[13];let y;e[14]!==b?(y=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[N,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>b(Fh()),children:"New"})]}),e[14]=b,e[15]=y):y=e[15];let k;e[16]!==g?(k=g&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[16]=g,e[17]=k):k=e[17];let j;e[18]!==g||e[19]!==p||e[20]!==f.length||e[21]!==_.length?(j=!g&&!p&&_.length===0&&f.length===0&&o.jsx(cc,{children:"No branches found."}),e[18]=g,e[19]=p,e[20]=f.length,e[21]=_.length,e[22]=j):j=e[22];let B;e[23]!==b||e[24]!==_?(B=_.length>0&&o.jsx(wn,{heading:"Your branches",children:_.map(E=>o.jsxs(Cn,{value:E.name,onSelect:()=>b(E.name),children:[o.jsx(Ds,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:E.name})]},E.name))}),e[23]=b,e[24]=_,e[25]=B):B=e[25];let D;e[26]!==f||e[27]!==b?(D=f.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{}),o.jsx(wn,{heading:"Other branches in repo",children:f.map(E=>o.jsxs(Cn,{value:E.name,onSelect:()=>b(E.name),children:[o.jsx(Ds,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:E.name}),E.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",E.author]})]},E.name))})]}),e[26]=f,e[27]=b,e[28]=D):D=e[28];let T;e[29]!==D||e[30]!==k||e[31]!==j||e[32]!==B?(T=o.jsxs(uc,{children:[k,j,B,D]}),e[29]=D,e[30]=k,e[31]=j,e[32]=B,e[33]=T):T=e[33];let C;e[34]!==T||e[35]!==y?(C=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(fc,{children:[y,T]})}),e[34]=T,e[35]=y,e[36]=C):C=e[36];let R;return e[37]!==d||e[38]!==C||e[39]!==w?(R=o.jsxs(Us,{open:d,onOpenChange:u,children:[w,C]}),e[37]=d,e[38]=C,e[39]=w,e[40]=R):R=e[40],R}function Yh(){const t=V.c(26),{org:e}=Ce(),{selectedVirtualMcp:s}=yi(),{data:i}=Si.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Yo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=gt(h.id),d=i?.user?.id??"",u=c?.metadata?.githubRepo??null,m=!!u?.connectionId&&!!d;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Vl,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==u||t[13]!==e.id||t[14]!==n||t[15]!==m||t[16]!==d?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Gh,{orgId:e.id,userId:d,connectionId:u.connectionId,owner:u.owner,repo:u.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=u,t[13]=e.id,t[14]=n,t[15]=m,t[16]=d,t[17]=b):b=t[17];let S;t[18]!==f||t[19]!==p||t[20]!==v||t[21]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[18]=f,t[19]=p,t[20]=v,t[21]=b,t[22]=S):S=t[22];let x;t[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(je.IceBreakers,{})}),t[23]=x):x=t[23];let w;return t[24]!==S?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[24]=S,t[25]=w):w=t[25],w}function Xh(){const t=V.c(26),{org:e}=Ce(),s=Nc(),{isChatEmpty:i}=Jo(),[r,n]=A.useState("chat"),a=zl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(je,{className:"animate-in fade-in-0 duration-200",children:o.jsx(je.Main,{className:"flex flex-col items-center",children:o.jsx(je.EmptyState,{children:o.jsx(je.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!$l(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(je.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const d=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let u;t[10]!==d?(u=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",d),t[10]=d,t[11]=u):u=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(je.Main,{children:o.jsx(Yh,{})}),o.jsx(je.Footer,{children:o.jsx(je.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(je.Main,{children:o.jsx(je.Messages,{})}),o.jsx(je.Footer,{children:o.jsx(je.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==u||t[15]!==m?(_=o.jsx("div",{className:u,children:m}),t[14]=u,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Rh,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(je,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Na(){const t=V.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(je.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Qt,{fallback:e,children:o.jsx(A.Suspense,{fallback:o.jsx(je.Skeleton,{}),children:o.jsx(Xh,{})})}),t[1]=s):s=t[1],s}async function Jh(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const ja=["VM_START"],Zs=new Map,Zh=t=>`${t.virtualMcpId}::${t.branch??""}`;function sn(t){const e=Ht();return Uo({mutationKey:ja,mutationFn:async s=>{const i=Zh(s),r=Zs.get(i);if(r)return r;const n=(async()=>(await Jh(t,"VM_START",s)).structuredContent)();Zs.set(i,n);try{return await n}finally{Zs.get(i)===n&&Zs.delete(i)}},onSuccess:()=>{ni(e)}})}function Ea(t,e){const s=V.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:ja,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],wh(i)>0}const Qh={settings:_c,automations:mc,env:mi,preview:Xl,git:Ds};function An(t){const e=ki(t);if(e.type==="icon"){const s=Ni(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function $i(t){if(t.kind==="system")return{kind:"component",Component:Qh[t.tabId]};const e=An(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=An(s.icon);return i||{kind:"fallback"}}function ed(t){const{org:e}=Ce(),s=Fe({connectionId:Bt,orgId:e.id}),{data:i}=Tl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Ta(t){const e=V.c(8),s=Mt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Yr(i),n=gt(t.virtualMcpId),a=ed(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,d=c?.tabs??[],u=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&It(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=ji(f),{activeTab:g,mainOpen:v}=tc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:d.map(td)}:null}),b=Zo(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const B=Sn(j.appId,j.toolName);x.set(B,{id:B,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of u){const B=Sn(j.connectionId,j.toolName);x.set(B,{id:B,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let w;e[2]!==p?(w=j=>({id:j.id,title:j.title,kind:"agent",icon:$i({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const N=[...d.map(w),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:$i({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:$i({tabId:j.id,kind:"system",connections:p})}))];let y;return e[4]!==g||e[5]!==v||e[6]!==s?(y=j=>{const B=sc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:D=>({...D,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=y):y=e[7],{activeTab:g,mainOpen:v,setActiveTab:y,systemTabs:S,layoutTabs:d,expandedTools:m,automationTabParsed:b,tabs:N}}function td(t){return{id:t.id}}function sd(t){const e=V.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:d}=t,u=a===void 0?"lg":a,m=c===void 0?!0:c,_=d===void 0?!1:d,[f,p]=A.useState(!1),[g,v]=A.useState("icons"),[b,S]=A.useState(""),[x,w]=A.useState("blue");let N;e[0]!==s?(N=ki(s),e[0]=s,e[1]=N):N=e[1];const y=N,k=y.type==="icon"||y.type==="url"&&y.color?y.color:x;let j;e[2]!==i||e[3]!==k?(j=_e=>{i(Pi(_e,k))},e[2]=i,e[3]=k,e[4]=j):j=e[4];const B=j;let D;e[5]!==i||e[6]!==r||e[7]!==y.name||e[8]!==y.type||e[9]!==y.url?(D=_e=>{w(_e),r?.(_e),y.type==="icon"?i(Pi(y.name,_e)):y.type==="url"&&i(kn(y.url,_e))},e[5]=i,e[6]=r,e[7]=y.name,e[8]=y.type,e[9]=y.url,e[10]=D):D=e[10];const T=D;let C;e[11]!==i||e[12]!==k?(C=_e=>{i(kn(_e,k)),p(!1)},e[11]=i,e[12]=k,e[13]=C):C=e[13];const R=C;let E;e[14]!==i||e[15]!==k?(E=()=>{const _e=Jr(),Vt=_e[Math.floor(Math.random()*_e.length)];i(Pi(Vt,k))},e[14]=i,e[15]=k,e[16]=E):E=e[16];const O=E;let z,I,L,$,F,M,W,U;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==u){const _e={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};I=Us,M=_?!1:f,W=p,z=Hs,F=!0,U="button",L=_,$=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",_e[u],l),e[17]=l,e[18]=_,e[19]=f,e[20]=u,e[21]=z,e[22]=I,e[23]=L,e[24]=$,e[25]=F,e[26]=M,e[27]=W,e[28]=U}else z=e[21],I=e[22],L=e[23],$=e[24],F=e[25],M=e[26],W=e[27],U=e[28];let K;e[29]!==h||e[30]!==n||e[31]!==u||e[32]!==s?(K=o.jsx(Nn,{icon:s,name:n,size:u,className:h}),e[29]=h,e[30]=n,e[31]=u,e[32]=s,e[33]=K):K=e[33];let G;e[34]!==_||e[35]!==m?(G=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ta,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=G):G=e[36];let P;e[37]!==L||e[38]!==$||e[39]!==K||e[40]!==G||e[41]!==U?(P=o.jsxs("button",{type:U,disabled:L,className:$,children:[K,G]}),e[37]=L,e[38]=$,e[39]=K,e[40]=G,e[41]=U,e[42]=P):P=e[42];let Z;e[43]!==z||e[44]!==F||e[45]!==P?(Z=o.jsx(z,{asChild:F,children:P}),e[43]=z,e[44]=F,e[45]=P,e[46]=Z):Z=e[46];let Y;e[47]!==n||e[48]!==s?(Y=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Nn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=Y):Y=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>v("icons"),e[50]=ee):ee=e[50];const ce=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[51]!==ce?(ie=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ie):ie=e[52];let Q;e[53]!==ie?(Q=o.jsx("button",{type:"button",onClick:ee,className:ie,children:"Icons"}),e[53]=ie,e[54]=Q):Q=e[54];let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=()=>v("upload"),e[55]=he):he=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ue;e[56]!==de?(ue=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=ue):ue=e[57];let ye;e[58]!==ue?(ye=o.jsx("button",{type:"button",onClick:he,className:ue,children:"Upload"}),e[58]=ue,e[59]=ye):ye=e[59];let Xe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Xe=o.jsx("div",{className:"flex-1"}),e[60]=Xe):Xe=e[60];let He;e[61]!==Q||e[62]!==ye?(He=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Q,ye,Xe]}),e[61]=Q,e[62]=ye,e[63]=He):He=e[63];let ne;e[64]!==T||e[65]!==O||e[66]!==B||e[67]!==R||e[68]!==y.name||e[69]!==y.type||e[70]!==b||e[71]!==k||e[72]!==g?(ne=g==="icons"?o.jsx(od,{search:b,onSearchChange:S,selectedColor:k,onColorChange:T,onSelectIcon:B,onRandom:O,currentIconName:y.type==="icon"?y.name:null}):o.jsx(ad,{onUpload:R}),e[64]=T,e[65]=O,e[66]=B,e[67]=R,e[68]=y.name,e[69]=y.type,e[70]=b,e[71]=k,e[72]=g,e[73]=ne):ne=e[73];let ve;e[74]!==Y||e[75]!==He||e[76]!==ne?(ve=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:id,children:o.jsxs("div",{className:"flex flex-col",children:[Y,He,ne]})}),e[74]=Y,e[75]=He,e[76]=ne,e[77]=ve):ve=e[77];let tt;return e[78]!==I||e[79]!==M||e[80]!==W||e[81]!==Z||e[82]!==ve?(tt=o.jsxs(I,{open:M,onOpenChange:W,children:[Z,ve]}),e[78]=I,e[79]=M,e[80]=W,e[81]=Z,e[82]=ve,e[83]=tt):tt=e[83],tt}function id(t){return t.preventDefault()}function rd(t){const e=V.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=A.useState(!1);let a,l,h,c,d,u,m;if(e[0]!==r||e[1]!==s){const b=ea(s);l=Us,u=r,m=n,a=Hs,d=!0,h="button",c=te("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=d,e[7]=u,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==d||e[14]!==_?(f=o.jsx(a,{asChild:d,children:_}),e[12]=a,e[13]=d,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=gc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:te("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Ws,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:nd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==u||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:u,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=u,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function nd(t){return t.preventDefault()}function od(t){const e=V.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,d,u,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=Jr(),w=ea(r);d=s.trim()?x.filter(T=>{const C=ar(T),R=s.toLowerCase();return C.includes(R)||T.toLowerCase().includes(R)}):x,f="flex flex-col";let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(Ca,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=N):N=e[14];let y;e[15]!==i?(y=T=>i(T.target.value),e[15]=i,e[16]=y):y=e[16];let k;e[17]!==s||e[18]!==y?(k=o.jsxs("div",{className:"relative flex-1",children:[N,o.jsx(fs,{value:s,onChange:y,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=y,e[19]=k):k=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(pc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let B;e[21]!==l?(B=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=B):B=e[22];let D;e[23]!==n||e[24]!==r?(D=o.jsx(rd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=D):D=e[25],e[26]!==B||e[27]!==D||e[28]!==k?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[k,B,D]}),e[26]=B,e[27]=D,e[28]=k,e[29]=p):p=e[29],c=wa,_="h-56",u="grid grid-cols-9 gap-0.5 px-2 pb-2",m=d.map(T=>{const C=Ni(T);return C?o.jsx("button",{type:"button",onClick:()=>a(T),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===T?te(w.bg,w.text):te(w.text,"hover:bg-accent")),title:T,children:o.jsx(C,{size:18})},T):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=d,e[9]=u,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],d=e[8],u=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==u||e[31]!==m?(g=o.jsx("div",{className:u,children:m}),e[30]=u,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==d.length?(v=d.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=d.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function ad(t){const e=V.c(27),{onUpload:s}=t,i=A.useRef(null);let r;e[0]!==s?(r=N=>{const y=N.target.files?.[0];if(!y)return;if(y.size>2097152){me.error("Image must be smaller than 2MB"),N.target.value="";return}const k=new FileReader;k.onerror=()=>{me.error("Failed to read image file"),i.current&&(i.current.value="")},k.onloadend=()=>{k.readyState===FileReader.DONE&&k.result&&s(k.result),i.current&&(i.current.value="")},k.readAsDataURL(y)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=A.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const N=a.trim();N&&(s(N),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let d;e[5]!==n?(d=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=()=>i.current?.click(),e[7]=u):u=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:u,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Jl,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=N=>l(N.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=N=>{N.key==="Enter"&&(N.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let w;return e[24]!==x||e[25]!==d?(w=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[d,m,_,x]}),e[24]=x,e[25]=d,e[26]=w):w=e[26],w}function ld(t){const e=V.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=ki(s);if(n.type==="icon"){const a=Ni(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Ic,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function cd(t){const e=V.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=A.useState(!1),[h,c]=A.useState("");let d;e[0]!==s?(d=ki(s),e[0]=s,e[1]=d):d=e[1];const u=d,m=u.type==="icon"?u.name:null;let _,f,p,g,v,b,S,x,w,N,y,k,j,B,D;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const I=Jr();g=h.trim()?I.filter(K=>{const G=h.toLowerCase();return ar(K).includes(G)||K.toLowerCase().includes(G)}):I,p=Us,v=n?!1:a,b=l;const L=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let $;e[24]!==r||e[25]!==L?($=te("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",L,r),e[24]=r,e[25]=L,e[26]=$):$=e[26];let F;e[27]!==s?(F=o.jsx(ld,{value:s}),e[27]=s,e[28]=F):F=e[28],e[29]!==n||e[30]!==$||e[31]!==F?(S=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:$,children:F})}),e[29]=n,e[30]=$,e[31]=F,e[32]=S):S=e[32],f=Ws,j="start",B="w-64 p-0",D=hd,y="flex flex-col";let M;e[33]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(Ca,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=M):M=e[33];let W;e[34]===Symbol.for("react.memo_cache_sentinel")?(W=K=>c(K.target.value),e[34]=W):W=e[34],e[35]!==h?(k=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[M,o.jsx(fs,{value:h,onChange:W,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=k):k=e[36],_=wa,N="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let U;e[37]!==m||e[38]!==i?(U=K=>{const G=Ni(K);return G?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${K}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===K?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:ar(K),children:o.jsx(G,{size:16})},K):null},e[37]=m,e[38]=i,e[39]=U):U=e[39],w=g.map(U),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=w,e[18]=N,e[19]=y,e[20]=k,e[21]=j,e[22]=B,e[23]=D}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],w=e[17],N=e[18],y=e[19],k=e[20],j=e[21],B=e[22],D=e[23];let T;e[40]!==x||e[41]!==w?(T=o.jsx("div",{className:x,children:w}),e[40]=x,e[41]=w,e[42]=T):T=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let R;e[45]!==_||e[46]!==T||e[47]!==C||e[48]!==N?(R=o.jsxs(_,{className:N,children:[T,C]}),e[45]=_,e[46]=T,e[47]=C,e[48]=N,e[49]=R):R=e[49];let E;e[50]!==R||e[51]!==y||e[52]!==k?(E=o.jsxs("div",{className:y,children:[k,R]}),e[50]=R,e[51]=y,e[52]=k,e[53]=E):E=e[53];let O;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==B||e[58]!==D?(O=o.jsx(f,{align:j,className:B,onOpenAutoFocus:D,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=B,e[58]=D,e[59]=O):O=e[59];let z;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==O?(z=o.jsxs(p,{open:v,onOpenChange:b,children:[S,O]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=O,e[65]=z):z=e[65],z}function hd(t){return t.preventDefault()}function ai(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Me,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Fi(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Dl,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function dd(t){const e=V.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=te("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.tags?(d=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==u||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[u,m]}),e[12]=u,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(rh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function rn(t){const e=V.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const u=s.map(ud);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(dd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,u),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let d;return e[10]!==l||e[11]!==h?(d=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=d):d=e[12],d}function ud(t){return t.id}function fd(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=kc(c);let u;e[5]!==d.tools?(u=d.tools.map(md),e[5]=d.tools,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function md(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Jc,{annotations:t.annotations,_meta:t._meta})}}function _d(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=Yc(c);let u;e[5]!==d.resources?(u=d.resources.map(pd),e[5]=d.resources,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function pd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function gd(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=nh(c);let u;e[5]!==d.prompts?(u=d.prompts.map(vd),e[5]=d.prompts,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function vd(t){return{id:t.name,name:t.name,description:t.description}}function xd(t){const e=V.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:d,toggleAllPrompts:u,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==u||e[3]!==d||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?d(r):u(r)},e[0]=i,e[1]=r,e[2]=u,e[3]=d,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let w;e[16]!==v||e[17]!==x?(w=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=w):w=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=N):N=e[19];let y;e[20]!==m?(y=z=>m(z),e[20]=m,e[21]=y):y=e[21];let k;e[22]!==i||e[23]!==y?(k=o.jsx(ih,{tabs:N,activeTab:i,onTabChange:y}),e[22]=i,e[23]=y,e[24]=k):k=e[24];const j=f?"Deselect all":"Select all";let B;e[25]!==g||e[26]!==j?(B=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=B):B=e[27];let D;e[28]!==B||e[29]!==k?(D=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[k,B]}),e[28]=B,e[29]=k,e[30]=D):D=e[30];let T;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(T=i==="tools"&&o.jsx(Qt,{fallback:Fi("Tools not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(fd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(z,I)=>a(r,z,I)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=T):T=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx(Qt,{fallback:Fi("Resources not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(_d,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(z,I)=>l(r,z,I)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let R;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(R=i==="prompts"&&o.jsx(Qt,{fallback:Fi("Prompts not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(gd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(z,I)=>h(r,z,I)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=R):R=e[45];let E;e[46]!==T||e[47]!==C||e[48]!==R?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[T,C,R]}),e[46]=T,e[47]=C,e[48]=R,e[49]=E):E=e[49];let O;return e[50]!==D||e[51]!==E||e[52]!==w?(O=o.jsxs(o.Fragment,{children:[w,D,E]}),e[50]=D,e[51]=E,e[52]=w,e[53]=O):O=e[53],O}function bd(t){const e=V.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=ha(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(vc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=d):d=e[3];let u;e[4]!==s||e[5]!==i?(u=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=u):u=e[6];let m;return e[7]!==u?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,d,u]}),e[7]=u,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function Sd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Pn(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function yd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function wd(t){const e=V.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,d]=A.useReducer(yd,h),u=Qr(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Sd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(M,W,U,K)=>{const G=f[M]?.[W];let P;G===null?P=K.filter(Y=>Y!==U):G?.includes(U)?P=G.filter(Y=>Y!==U):(P=[...G??[],U],P.length===K.length&&(P=null));const Z={...f};Z[M]?Z[M]={...Z[M]}:Z[M]={tools:null,resources:null,prompts:null},Z[M][W]=P,n.setValue("connections",Pn(Z),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=(M,W)=>{const K=f[M]?.[W]===null?[]:null,G={...f};G[M]?G[M]={...G[M]}:G[M]={tools:null,resources:null,prompts:null},G[M][W]=K,n.setValue("connections",Pn(G),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=(M,W,U)=>g(M,"tools",W,U),e[11]=g,e[12]=S):S=e[12];const x=S;let w;e[13]!==g?(w=(M,W,U)=>g(M,"resources",W,U),e[13]=g,e[14]=w):w=e[14];const N=w;let y;e[15]!==g?(y=(M,W,U)=>g(M,"prompts",W,U),e[15]=g,e[16]=y):y=e[16];const k=y;let j;e[17]!==b?(j=M=>b(M,"tools"),e[17]=b,e[18]=j):j=e[18];const B=j;let D;e[19]!==b?(D=M=>b(M,"resources"),e[19]=b,e[20]=D):D=e[20];const T=D;let C;e[21]!==b?(C=M=>b(M,"prompts"),e[21]=b,e[22]=C):C=e[22];const R=C;if(!r||!u)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ai,{}),e[23]=E):E=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=M=>d({type:"SET_ACTIVE_TAB",payload:M}),e[24]=O):O=e[24];let z;e[25]!==u||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==R||e[30]!==T||e[31]!==B||e[32]!==k||e[33]!==N||e[34]!==x?(z=o.jsx(xd,{currentConnection:u,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:N,togglePrompt:k,toggleAllTools:B,toggleAllResources:T,toggleAllPrompts:R,onTabChange:O},r),e[25]=u,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=R,e[30]=T,e[31]=B,e[32]=k,e[33]=N,e[34]=x,e[35]=z):z=e[35];let I;e[36]!==l||e[37]!==r||e[38]!==z?(I=o.jsx(A.Suspense,{fallback:E,children:o.jsx(bd,{connectionId:r,onAuthenticate:l,children:z})}),e[36]=l,e[37]=r,e[38]=z,e[39]=I):I=e[39];let L;e[40]!==i?(L=o.jsx(Qc,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=L):L=e[41];let $;e[42]!==I||e[43]!==L?($=o.jsxs(en,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[I,L]}),e[42]=I,e[43]=L,e[44]=$):$=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==$?(F=o.jsx(tn,{open:s,onOpenChange:i,children:$}),e[45]=i,e[46]=s,e[47]=$,e[48]=F):F=e[48],F}const Hi={tools:null,resources:null,prompts:null},Cd=Rl.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function kd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Nd(t){const e=V.c(11),{url:s,agentId:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{Se("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),me.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Ei,{size:20,className:"text-green-600"}):o.jsx(Ci,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let d;e[5]!==c?(d=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==h||e[9]!==d?(u=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,d]}),e[7]=l,e[8]=h,e[9]=d,e[10]=u):u=e[10],u}function jd(t){const e=V.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{Se("agent_connect_action",{agent_id:r,action:"install_cursor"});const d=da(i),m=kd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(d)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),me.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Ed(t){const e=V.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=A.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{Se("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=da(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),me.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Ei,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const d=n?"Copied!":"Install on Claude Code";let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium",children:d}),e[6]=d,e[7]=u):u=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==u?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,u]}),e[8]=h,e[9]=c,e[10]=u,e[11]=m):m=e[11],m}function Td({virtualMcp:t}){const{org:e}=Ce(),s=Fe({connectionId:Bt,orgId:e.id}),[i,r]=A.useState(null),[n,a]=A.useState(!1),[l,h]=A.useState(!1),c=t.id,d=t.title||`agent-${c.slice(0,8)}`,u=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${d}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),Se("agent_typegen_key_generated",{agent_id:c})}catch{Se("agent_typegen_key_failed",{agent_id:c}),me.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{Se("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(u),h(!0),me.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Me,{size:14,className:"animate-spin"}):o.jsx(sh,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:u}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Ei,{size:12,className:"text-green-600"}):o.jsx(Ci,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Dd,{apiKey:i,agentId:c})]})}function Dd(t){const e=V.c(21),{apiKey:s,agentId:i}=t,[r,n]=A.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-BL-P3zUl.js","assets/index-CariFzvs.js","assets/index-D9g6ZM2x.css","assets/pair-vGTs_zPg.js","assets/agent-icon-BhGa08Fl.js","assets/AlertCircle-DGWwcoQZ.js","assets/Tool01-CB2DUdHU.js","assets/XClose-N2VTvn-z.js","assets/RefreshCcw01-CtjTkTf4.js","assets/ArrowNarrowLeft-6CbLfe6R.js","assets/XCircle-m0QK52Tq.js","assets/ArrowUpRight-DGFb4j2X.js","assets/ZapSquare-CpCXmnKj.js","assets/Users03-CrrZL9MY.js","assets/CheckCircle-TABxOmV2.js","assets/ChevronDown-YpILLXr3.js","assets/ChevronRight-C5cwFzdi.js","assets/ChevronUp-D3ACbD1g.js","assets/DotsVertical-uATdSTpl.js","assets/Container-CEV9uk-Z.js","assets/Star01-BP3IsurF.js","assets/Palette-BXvnxfG9.js","assets/SearchMd-OYsWp4RC.js","assets/index-D_1AR6r3.js","assets/tooltip-Dr3uY9D4.js","assets/X-Cg5jWZ6W.js","assets/LinkExternal01-DRPBZiOD.js","assets/Lock01-BwE9ru6U.js","assets/Sun-beuoApqH.js","assets/Play-DgZHjcoJ.js","assets/Plus-CCywDmjg.js","assets/Settings02-DxdBNXj6.js","assets/Shield01-Qjvq_pQT.js","assets/Trash01-Rux2RMYE.js","assets/User01-CKOZDyFQ.js","assets/Zap-DHpdmH1S.js","assets/index-Dcc7hO3D.js","assets/use-copy-CpV0fKqM.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-YE4SL2S_.js","assets/content-blocks-o63cs2vh.js","assets/types-mFMyaEXB.js","assets/constants-ajN1Bhug.js","assets/chat-context-mYdLYubP.js","assets/use-virtual-mcp-9JsEXBge.js","assets/use-collections-B9qAfcJY.js","assets/use-ai-providers-D5NHg2Ru.js","assets/use-decopilot-events-Lyv24iLh.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-CIfTcsjC.js","assets/use-organization-settings-B81E2rNE.js","assets/shell-layout-BnsXbGf-.js","assets/required-auth-layout-BOwcnbO9.js","assets/use-org-sso-B61uYZKs.js","assets/integration-icon-Ceb5m9KS.js","assets/use-mcp-tools-C2NC0OB_.js"])))=>i.map(i=>d[i]);
2
+ import{o as Ht,r as A,p as jl,q as El,e as V,s as Ce,K as As,n as Wo,a as Uo,c as te,j as o,l as Me,B as se,E as Qt,b as Si,v as ni,f as Mt,d as Yr,w as Tl,x as me,y as Dl,V as Rl,t as Se,z as Vo,C as Ml,D as Xt,F as Bl,G as vn,L as Il,H as Ai,I as Js,J as ct,M as Ko,P as Al,_ as Pl,Q as qo,R as Go,T as Ll,g as Ol}from"./index-CariFzvs.js";import{C as je,u as zl,w as $l,A as Fl,T as Hl,a as Wl}from"./index-BMNXmL0A.js";import{I as ds}from"./integration-icon-Ceb5m9KS.js";import{S as Bt,u as Fe,g as Yo,a as Xo}from"./constants-ajN1Bhug.js";import{u as gt,a as Ul}from"./use-virtual-mcp-9JsEXBge.js";import{a as Vl}from"./Users03-CrrZL9MY.js";import{u as Jo,a as lt,b as yi,c as wi,t as Kl,d as xn}from"./chat-context-mYdLYubP.js";import{i as as}from"./AlertCircle-DGWwcoQZ.js";import{i as ql}from"./CheckCircle-TABxOmV2.js";import{n as bn,a as Gl}from"./ZapSquare-CpCXmnKj.js";import{i as Yl,a as Xl,b as Jl,c as Ci,d as Zl}from"./XCircle-m0QK52Tq.js";import{s as ls,i as Ql}from"./XClose-N2VTvn-z.js";import{c as ec,r as tc,p as Zo,f as Sn,a as sc,F as ic,t as yn,M as Xr,G as Qo,L as rc,i as nc,b as oc,d as ac,e as lc}from"./pair-vGTs_zPg.js";import{C as cc,a as wn,b as Cn,c as hc,d as dc,e as uc,f as fc}from"./command-s71Khs6g.js";import{P as Hs,a as Ws,b as Us}from"./popover-5Qa5l709.js";import{i as Ds,a as mi,b as mc,c as _c,p as ki,g as Ni,d as Jr,e as ea,h as ar,f as Pi,j as kn,A as Nn,k as ta,l as pc,m as gc,n as vc,t as xc,o as bc,q as sa,r as ia,s as ra,u as na,v as jn,w as Sc,x as Rs,y as yc,z as wc,B as Cc,C as oa}from"./agent-icon-BhGa08Fl.js";import{u as us,a as kc}from"./use-mcp-tools-C2NC0OB_.js";import{u as Nc,a as jc}from"./use-ai-providers-D5NHg2Ru.js";import{g as It,c as En,u as Ec,b as lr,d as Tc,e as Dc,f as Rc,T as Mc}from"./index-BoZfrZ34.js";import{u as Zr,i as Bc}from"./shell-layout-BnsXbGf-.js";import{i as Ic,P as at,u as Ac,c as Pc,d as Lc,e as Oc}from"./index-D_1AR6r3.js";import{u as aa,T as Ve,a as Ke,b as qe,c as zc}from"./tooltip-Dr3uY9D4.js";import{u as $c}from"./use-status-sounds-DkEi-BmD.js";import{E as Ps}from"./empty-state-8HZoUHAZ.js";import{A as Fc,a as Hc,b as Wc,c as Uc,R as la,d as Vc,e as Kc}from"./accordion-CCTO7OqO.js";import{u as ji,a as Qr,b as qc}from"./use-connection-Dw3HjptL.js";import{g as Gc}from"./constants-BJnjE8Tt.js";import{u as Yc,g as Xc}from"./types-mFMyaEXB.js";import{U as ca}from"./user-pxLMJc6I.js";import{T as Jc,u as ha}from"./tools-list-kpR-DdJQ.js";import{u as Li}from"./unwrap-tool-result-BYXdCQMg.js";import{s as da,g as Zc}from"./connection-slug-eyAPH6o3.js";import{A as ua,a as fa,b as ma,c as _a,d as pa,e as ga,f as va,g as xa}from"./alert-dialog-BvOLTTjL.js";import{D as Qc,a as en,b as tn,c as ba,d as Sa}from"./dialog-YE4SL2S_.js";import{C as eh,a as Tn}from"./card-DL6KKkK7.js";import{I as fs}from"./input-DHEAaYve.js";import{L as Ms}from"./label-BMzmJDQh.js";import{S as es,a as ts,b as ss,c as is,d as Rt}from"./select-C5MYEBtM.js";import{S as cr}from"./switch-HROyTNdj.js";import{T as Dn}from"./textarea-KDZuzqvR.js";import{i as oi}from"./Play-DgZHjcoJ.js";import{s as cs}from"./Plus-CCywDmjg.js";import{a as th}from"./Settings02-DxdBNXj6.js";import{t as ya}from"./Tool01-CB2DUdHU.js";import{s as hr}from"./Trash01-Rux2RMYE.js";import{S as wa}from"./scroll-area-HNGrspxG.js";import{i as Ca,a as sh}from"./SearchMd-OYsWp4RC.js";import{C as ih}from"./collection-tabs-CQzwJ8u9.js";import{C as rh}from"./checkbox-BYgqHfbE.js";import{u as nh,T as Oi,a as oh,b as ah,c as zi}from"./tabs-BPvd4P0n.js";import{D as lh,a as ch,b as hh}from"./drawer-DoyG2yiq.js";import{i as Ei,t as dr}from"./ChevronDown-YpILLXr3.js";import{n as Wt}from"./LinkExternal01-DRPBZiOD.js";import{D as rs,a as ns,b as os,c as yt,d as dh,e as uh,f as fh}from"./dropdown-menu-CT4y7aY2.js";import{i as ka}from"./RefreshCcw01-CtjTkTf4.js";import{V as mh}from"./view-mode-toggle-_crWUr2e.js";import{G as _h}from"./lean-canvas-recruit-modal-BkLS8u5W.js";import{M as ph}from"./select-model-_j0smQSE.js";import{u as Vs,a as gh,b as vh,c as xh,A as bh,d as Sh}from"./automation-list-row-BP2xxw0G.js";import{i as Ls}from"./Zap-DHpdmH1S.js";import{S as yh}from"./search-input-BvZNM2RM.js";import"./use-navigate-to-agent-CxjZQ1fq.js";import"./use-tasks-CIfTcsjC.js";import"./use-collections-B9qAfcJY.js";import"./index-Dcc7hO3D.js";import"./collection-search-D9AiUt0i.js";import"./form-BbmPNrg3.js";import"./Star01-BP3IsurF.js";import"./Lock01-BwE9ru6U.js";import"./X-Cg5jWZ6W.js";import"./toggle-group-DM97u04F.js";import"./index-BqwQgnOI.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-D6a8kmGH.js";import"./connection-card-ICJdFYlE.js";import"./use-registry-connections-vur0Zrsf.js";import"./use-organization-settings-B81E2rNE.js";import"./useInfiniteQuery-BOZnPi0L.js";import"./infiniteQueryObserver-B14O_xhx.js";import"./extract-connection-data-D_uDRowj.js";import"./Container-CEV9uk-Z.js";import"./connection-form-helpers-BWfgsLZZ.js";import"./use-infinite-scroll-C-7Y6eBv.js";import"./useSuspenseInfiniteQuery-M_8yh3H4.js";import"./badge-mnYUd_xY.js";import"./ChevronRight-C5cwFzdi.js";import"./use-decopilot-events-Lyv24iLh.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-CpV0fKqM.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-beuoApqH.js";import"./index-C7tDpZrl.js";import"./ArrowNarrowLeft-6CbLfe6R.js";import"./ArrowUpRight-DGFb4j2X.js";import"./ChevronUp-D3ACbD1g.js";import"./DotsVertical-uATdSTpl.js";import"./Palette-BXvnxfG9.js";import"./Shield01-Qjvq_pQT.js";import"./User01-CKOZDyFQ.js";import"./skeleton-BzKJgxvw.js";import"./avatar-Di9GD8dd.js";import"./index-DMby3CEd.js";import"./collection-search-CS-ZVub-.js";import"./use-create-virtual-mcp-GSBx9joR.js";import"./task-status-DZKELKFJ.js";import"./required-auth-layout-BOwcnbO9.js";import"./use-org-sso-B61uYZKs.js";import"./collections-CxHTq2dT.js";import"./settings-section-COnpJzJz.js";import"./formatDistanceToNow-Cb2QZZJn.js";function wh(t,e){const s=Ht(e);return Ch({filters:{...t,status:"pending"}},s).length}function Rn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Ch(t={},e){const s=Ht(e).getMutationCache(),i=A.useRef(t),r=A.useRef(null);return r.current===null&&(r.current=Rn(s,t)),A.useEffect(()=>{i.current=t}),A.useSyncExternalStore(A.useCallback(n=>s.subscribe(()=>{const a=jl(r.current,Rn(s,i.current));r.current!==a&&(r.current=a,El.schedule(n))}),[s]),()=>r.current,()=>r.current)}function kh(t,e){const s=V.c(39),{org:i,locator:r}=Ce();let n;s[0]!==i.id?(n={connectionId:Bt,orgId:i.id},s[0]=i.id,s[1]=n):n=s[1];const a=Fe(n),l=Ht();let h;s[2]!==t||s[3]!==i.id?(h=As.ensureTask(i.id,t),s[2]=t,s[3]=i.id,s[4]=h):h=s[4];let c;s[5]!==a||s[6]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[5]=a,s[6]=t,s[7]=c):c=s[7];const d=t.length>0;let u;s[8]!==h||s[9]!==c||s[10]!==d?(u={queryKey:h,queryFn:c,enabled:d,retry:!1,refetchOnWindowFocus:!1},s[8]=h,s[9]=c,s[10]=d,s[11]=u):u=s[11];const m=Wo(u);let _;s[12]!==a||s[13]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const y=w.content,k=Array.isArray(y)&&y[0]&&typeof y[0]=="object"?y[0].text??"Create failed":"Create failed";throw new Error(k)}return w.structuredContent.item},s[12]=a,s[13]=e,s[14]=_):_=s[14];let f;s[15]!==r||s[16]!==i.id||s[17]!==m||s[18]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[15]=r,s[16]=i.id,s[17]=m,s[18]=l,s[19]=f):f=s[19];let p;s[20]!==_||s[21]!==f?(p={mutationFn:_,onSuccess:f},s[20]=_,s[21]=f,s[22]=p):p=s[22];const g=Uo(p);let v,b;if(s[23]!==g||s[24]!==t||s[25]!==m.data||s[26]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[23]=g,s[24]=t,s[25]=m.data,s[26]=m.isSuccess,s[27]=v,s[28]=b):(v=s[27],b=s[28]),A.useEffect(v,b),!t){let x;return s[29]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[29]=x):x=s[29],x}if(m.isLoading){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[30]=x):x=s[30],x}if(m.isError){const x=m.error;let w;return s[31]!==x?(w={status:"error",error:x},s[31]=x,s[32]=w):w=s[32],w}if(m.isSuccess&&m.data){let x;return s[33]!==m.data?(x={status:"ready",task:m.data},s[33]=m.data,s[34]=x):x=s[34],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[35]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[35]=x):x=s[35],x}if(g.isError){let x;return s[36]!==g.error?(x={status:"error",error:g.error},s[36]=g.error,s[37]=x):x=s[37],x}let S;return s[38]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[38]=S):S=s[38],S}function vs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Mn(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Nh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function jh(t){const e=V.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Eh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Eh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Th(t){const e=V.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let m;e[6]!==c||e[7]!==d||e[8]!==u?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==m?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=w):w=e[29],w}function Dh(t){const e=V.c(19),{part:s}=t,i=s.input?.agent_id,r=gt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let d;e[0]!==a||e[1]!==n?(d=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=d):d=e[2];const u=h?"text-destructive":"text-foreground";let m;e[3]!==u?(m=te("shrink-0 font-medium",u),e[3]=u,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Me,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Yl,{size:12,className:"text-destructive"}):c?o.jsx(as,{size:12,className:"text-warning"}):o.jsx(ql,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==d||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,_,f,p]}),e[14]=d,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Rh(t){const e=V.c(58),{onClose:s,back:i,className:r}=t,[n,a]=A.useState(null),{messages:l}=Jo(),{tasks:h,taskId:c}=lt(),{selectedModel:d,selectedVirtualMcp:u}=yi();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==d||e[6]!==u?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let N;e[17]!==c?(N=Q=>Q.id===c,e[17]=c,e[18]=N):N=e[18];const y=h.find(N),k=ec(l),j=[...l].reverse().find($h),B=j?.metadata?.usage,D=j?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow??null,T=B?.contextTokens??B?.totalTokens??0,C=D&&D>0?(T/D*100).toFixed(1):null,R=l;let E;e[19]!==R?(E=R.filter(zh).reduce(Oh,0),e[19]=R,e[20]=E):E=e[20];const O=E,z=l;let I;e[21]!==z?(I=z.filter(Lh).reduce(Ph,0),e[21]=z,e[22]=I):I=e[22];const L=I,$=Math.max(0,k.totalTokens-O-L),F=l[0],M=l.at(-1),W=F?.metadata?.created_at??y?.created_at,U=M?.metadata?.created_at??y?.updated_at,K=l.filter(Ah),G=l.flatMap(Bh),P=d?.modelId?Nh(d.modelId):"—",Z=u?.title??"Decopilot",Y=[{label:"Session",value:y?.title??"New chat"},{label:"Messages",value:K.length},{label:"Agent",value:Z},{label:"Model",value:P},{label:"Context Limit",value:D?vs(D):"—"},{label:"Session Tokens (billed)",value:k.totalTokens>0?vs(k.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:k.inputTokens>0?vs(k.inputTokens):"0"},{label:"Output Tokens",value:k.outputTokens>0?vs(k.outputTokens):"0"},{label:"Reasoning Tokens",value:k.reasoningTokens>0?vs(k.reasoningTokens):"0"},{label:"Cost",value:k.cost>0?`$${k.cost<.001?k.cost.toFixed(6):k.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Mn(W)},{label:"Last Activity",value:Mn(U)}];if(!y&&K.length===0){let Q;e[23]!==r?(Q=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Q):Q=e[24];let he;e[25]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=he):he=e[25];let de;e[26]!==i?(de=i?o.jsx(bn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=de):de=e[27];let ue;e[28]!==s||e[29]!==de?(ue=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[he,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:de})]}),e[28]=s,e[29]=de,e[30]=ue):ue=e[30];let ye;e[31]===Symbol.for("react.memo_cache_sentinel")?(ye=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=ye):ye=e[31];let Xe;e[32]!==Q||e[33]!==ue?(Xe=o.jsxs("div",{className:Q,children:[ue,ye]}),e[32]=Q,e[33]=ue,e[34]=Xe):Xe=e[34],S=Xe;break e}e[35]!==r?(v=te("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let ee;e[37]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=ee):ee=e[37];let ce;e[38]!==i?(ce=i?o.jsx(bn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ce):ce=e[39],e[40]!==s||e[41]!==ce?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[ee,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ce})]}),e[40]=s,e[41]=ce,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=G.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:G.map(Mh)})]}),f=o.jsx(jh,{items:Y});let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ie):ie=e[43],e[44]!==L||e[45]!==$||e[46]!==O?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ie,o.jsx(Th,{userTokens:O,assistantTokens:L,otherTokens:$})]}),e[44]=L,e[45]=$,e[46]=O,e[47]=p):p=e[47],g=K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:K.map(Q=>{const he=Q.metadata?.created_at,de=n?.id===Q.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Q),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:te("shrink-0 font-medium",Q.role==="user"?"text-chart-1":"text-chart-2"),children:Q.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Q.id})]}),he&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(he).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(Q,null,2)})]},Q.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=d,e[6]=u?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Mh(t,e){return o.jsx(Dh,{part:t},e)}function Bh(t){return(t.parts??[]).filter(Ih)}function Ih(t){return t.type==="tool-subtask"}function Ah(t){return t.role!=="system"}function Ph(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Lh(t){return t.role==="assistant"}function Oh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function zh(t){return t.role==="user"}function $h(t){return t.role==="assistant"&&t.metadata?.usage}const Bn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],In=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Fh(){const t=Bn[Math.floor(Math.random()*Bn.length)],e=In[Math.floor(Math.random()*In.length)];return`deco/${t}-${e}`}function Hh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Wh(t){const e=V.c(25),{orgId:s,userId:i,connectionId:r,vmMap:n,owner:a,repo:l,enabled:h}=t,c=h===void 0?!0:h,d=r??null;let u;e[0]!==s||e[1]!==d?(u={connectionId:d,orgId:s},e[0]=s,e[1]=d,e[2]=u):u=e[2];const m=Fe(u);let _;e[3]!==a||e[4]!==l?(_={owner:a,repo:l},e[3]=a,e[4]=l,e[5]=_):_=e[5];const f=c&&!!r&&!!a&&!!l;let p;e[6]!==m||e[7]!==_||e[8]!==f?(p={client:m,toolName:"list_branches",toolArguments:_,enabled:f,staleTime:3e4,select:qh},e[6]=m,e[7]=_,e[8]=f,e[9]=p):p=e[9];const{data:g,isLoading:v,isError:b}=us(p);let S,x;e[10]!==i||e[11]!==n?(x=new Set(Object.keys(n?.[i]??{})),S=[...x].sort().map(Kh),e[10]=i,e[11]=n,e[12]=S,e[13]=x):(S=e[12],x=e[13]);const w=S;let N;if(e[14]!==g||e[15]!==x){const B=Array.isArray(g)?g:g?.branches??[];let D;e[17]!==x?(D=T=>!x.has(T.name),e[17]=x,e[18]=D):D=e[18],N=B.filter(Vh).filter(D).map(Uh),e[14]=g,e[15]=x,e[16]=N}else N=e[16];const y=N,k=Array.isArray(g)?null:g?.default_branch??null;let j;return e[19]!==k||e[20]!==b||e[21]!==v||e[22]!==y||e[23]!==w?(j={yours:w,others:y,defaultBase:k,isLoading:v,isError:b},e[19]=k,e[20]=b,e[21]=v,e[22]=y,e[23]=w,e[24]=j):j=e[24],j}function Uh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Vh(t){return typeof t.name=="string"}function Kh(t){return{name:t,source:"yours"}}function qh(t){return Hh(t)}function Gh(t){const e=V.c(41),{orgId:s,userId:i,connectionId:r,owner:n,repo:a,vmMap:l,value:h,onChange:c}=t,[d,u]=A.useState(!1);let m;e[0]!==r||e[1]!==d||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==i||e[6]!==l?(m={orgId:s,userId:i,connectionId:r,vmMap:l,owner:n,repo:a,enabled:d},e[0]=r,e[1]=d,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=l,e[7]=m):m=e[7];const{yours:_,others:f,isLoading:p,isError:g}=Wh(m);let v;e[8]!==c?(v=E=>{c(E),u(!1)},e[8]=c,e[9]=v):v=e[9];const b=v,S=h??"Select branch…";let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ds,{className:"h-3.5 w-3.5"}),e[10]=x):x=e[10];let w;e[11]!==S?(w=o.jsx(Hs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[x,o.jsx("span",{className:"max-w-[200px] truncate",children:S})]})}),e[11]=S,e[12]=w):w=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(dc,{placeholder:"Search branches…"}),e[13]=N):N=e[13];let y;e[14]!==b?(y=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[N,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>b(Fh()),children:"New"})]}),e[14]=b,e[15]=y):y=e[15];let k;e[16]!==g?(k=g&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[16]=g,e[17]=k):k=e[17];let j;e[18]!==g||e[19]!==p||e[20]!==f.length||e[21]!==_.length?(j=!g&&!p&&_.length===0&&f.length===0&&o.jsx(cc,{children:"No branches found."}),e[18]=g,e[19]=p,e[20]=f.length,e[21]=_.length,e[22]=j):j=e[22];let B;e[23]!==b||e[24]!==_?(B=_.length>0&&o.jsx(wn,{heading:"Your branches",children:_.map(E=>o.jsxs(Cn,{value:E.name,onSelect:()=>b(E.name),children:[o.jsx(Ds,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:E.name})]},E.name))}),e[23]=b,e[24]=_,e[25]=B):B=e[25];let D;e[26]!==f||e[27]!==b?(D=f.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(hc,{}),o.jsx(wn,{heading:"Other branches in repo",children:f.map(E=>o.jsxs(Cn,{value:E.name,onSelect:()=>b(E.name),children:[o.jsx(Ds,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:E.name}),E.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",E.author]})]},E.name))})]}),e[26]=f,e[27]=b,e[28]=D):D=e[28];let T;e[29]!==D||e[30]!==k||e[31]!==j||e[32]!==B?(T=o.jsxs(uc,{children:[k,j,B,D]}),e[29]=D,e[30]=k,e[31]=j,e[32]=B,e[33]=T):T=e[33];let C;e[34]!==T||e[35]!==y?(C=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(fc,{children:[y,T]})}),e[34]=T,e[35]=y,e[36]=C):C=e[36];let R;return e[37]!==d||e[38]!==C||e[39]!==w?(R=o.jsxs(Us,{open:d,onOpenChange:u,children:[w,C]}),e[37]=d,e[38]=C,e[39]=w,e[40]=R):R=e[40],R}function Yh(){const t=V.c(26),{org:e}=Ce(),{selectedVirtualMcp:s}=yi(),{data:i}=Si.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Yo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=gt(h.id),d=i?.user?.id??"",u=c?.metadata?.githubRepo??null,m=!!u?.connectionId&&!!d;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Vl,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==u||t[13]!==e.id||t[14]!==n||t[15]!==m||t[16]!==d?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Gh,{orgId:e.id,userId:d,connectionId:u.connectionId,owner:u.owner,repo:u.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=u,t[13]=e.id,t[14]=n,t[15]=m,t[16]=d,t[17]=b):b=t[17];let S;t[18]!==f||t[19]!==p||t[20]!==v||t[21]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[18]=f,t[19]=p,t[20]=v,t[21]=b,t[22]=S):S=t[22];let x;t[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(je.IceBreakers,{})}),t[23]=x):x=t[23];let w;return t[24]!==S?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[24]=S,t[25]=w):w=t[25],w}function Xh(){const t=V.c(26),{org:e}=Ce(),s=Nc(),{isChatEmpty:i}=Jo(),[r,n]=A.useState("chat"),a=zl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(je,{className:"animate-in fade-in-0 duration-200",children:o.jsx(je.Main,{className:"flex flex-col items-center",children:o.jsx(je.EmptyState,{children:o.jsx(je.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!$l(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(je.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const d=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let u;t[10]!==d?(u=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",d),t[10]=d,t[11]=u):u=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(je.Main,{children:o.jsx(Yh,{})}),o.jsx(je.Footer,{children:o.jsx(je.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(je.Main,{children:o.jsx(je.Messages,{})}),o.jsx(je.Footer,{children:o.jsx(je.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==u||t[15]!==m?(_=o.jsx("div",{className:u,children:m}),t[14]=u,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Rh,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(je,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Na(){const t=V.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(je.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Qt,{fallback:e,children:o.jsx(A.Suspense,{fallback:o.jsx(je.Skeleton,{}),children:o.jsx(Xh,{})})}),t[1]=s):s=t[1],s}async function Jh(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const ja=["VM_START"],Zs=new Map,Zh=t=>`${t.virtualMcpId}::${t.branch??""}`;function sn(t){const e=Ht();return Uo({mutationKey:ja,mutationFn:async s=>{const i=Zh(s),r=Zs.get(i);if(r)return r;const n=(async()=>(await Jh(t,"VM_START",s)).structuredContent)();Zs.set(i,n);try{return await n}finally{Zs.get(i)===n&&Zs.delete(i)}},onSuccess:()=>{ni(e)}})}function Ea(t,e){const s=V.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:ja,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],wh(i)>0}const Qh={settings:_c,automations:mc,env:mi,preview:Xl,git:Ds};function An(t){const e=ki(t);if(e.type==="icon"){const s=Ni(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function $i(t){if(t.kind==="system")return{kind:"component",Component:Qh[t.tabId]};const e=An(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=An(s.icon);return i||{kind:"fallback"}}function ed(t){const{org:e}=Ce(),s=Fe({connectionId:Bt,orgId:e.id}),{data:i}=Tl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Ta(t){const e=V.c(8),s=Mt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Yr(i),n=gt(t.virtualMcpId),a=ed(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,d=c?.tabs??[],u=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&It(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=ji(f),{activeTab:g,mainOpen:v}=tc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:d.map(td)}:null}),b=Zo(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const B=Sn(j.appId,j.toolName);x.set(B,{id:B,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of u){const B=Sn(j.connectionId,j.toolName);x.set(B,{id:B,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let w;e[2]!==p?(w=j=>({id:j.id,title:j.title,kind:"agent",icon:$i({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const N=[...d.map(w),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:$i({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:$i({tabId:j.id,kind:"system",connections:p})}))];let y;return e[4]!==g||e[5]!==v||e[6]!==s?(y=j=>{const B=sc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:D=>({...D,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=y):y=e[7],{activeTab:g,mainOpen:v,setActiveTab:y,systemTabs:S,layoutTabs:d,expandedTools:m,automationTabParsed:b,tabs:N}}function td(t){return{id:t.id}}function sd(t){const e=V.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:d}=t,u=a===void 0?"lg":a,m=c===void 0?!0:c,_=d===void 0?!1:d,[f,p]=A.useState(!1),[g,v]=A.useState("icons"),[b,S]=A.useState(""),[x,w]=A.useState("blue");let N;e[0]!==s?(N=ki(s),e[0]=s,e[1]=N):N=e[1];const y=N,k=y.type==="icon"||y.type==="url"&&y.color?y.color:x;let j;e[2]!==i||e[3]!==k?(j=_e=>{i(Pi(_e,k))},e[2]=i,e[3]=k,e[4]=j):j=e[4];const B=j;let D;e[5]!==i||e[6]!==r||e[7]!==y.name||e[8]!==y.type||e[9]!==y.url?(D=_e=>{w(_e),r?.(_e),y.type==="icon"?i(Pi(y.name,_e)):y.type==="url"&&i(kn(y.url,_e))},e[5]=i,e[6]=r,e[7]=y.name,e[8]=y.type,e[9]=y.url,e[10]=D):D=e[10];const T=D;let C;e[11]!==i||e[12]!==k?(C=_e=>{i(kn(_e,k)),p(!1)},e[11]=i,e[12]=k,e[13]=C):C=e[13];const R=C;let E;e[14]!==i||e[15]!==k?(E=()=>{const _e=Jr(),Vt=_e[Math.floor(Math.random()*_e.length)];i(Pi(Vt,k))},e[14]=i,e[15]=k,e[16]=E):E=e[16];const O=E;let z,I,L,$,F,M,W,U;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==u){const _e={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};I=Us,M=_?!1:f,W=p,z=Hs,F=!0,U="button",L=_,$=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",_e[u],l),e[17]=l,e[18]=_,e[19]=f,e[20]=u,e[21]=z,e[22]=I,e[23]=L,e[24]=$,e[25]=F,e[26]=M,e[27]=W,e[28]=U}else z=e[21],I=e[22],L=e[23],$=e[24],F=e[25],M=e[26],W=e[27],U=e[28];let K;e[29]!==h||e[30]!==n||e[31]!==u||e[32]!==s?(K=o.jsx(Nn,{icon:s,name:n,size:u,className:h}),e[29]=h,e[30]=n,e[31]=u,e[32]=s,e[33]=K):K=e[33];let G;e[34]!==_||e[35]!==m?(G=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ta,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=G):G=e[36];let P;e[37]!==L||e[38]!==$||e[39]!==K||e[40]!==G||e[41]!==U?(P=o.jsxs("button",{type:U,disabled:L,className:$,children:[K,G]}),e[37]=L,e[38]=$,e[39]=K,e[40]=G,e[41]=U,e[42]=P):P=e[42];let Z;e[43]!==z||e[44]!==F||e[45]!==P?(Z=o.jsx(z,{asChild:F,children:P}),e[43]=z,e[44]=F,e[45]=P,e[46]=Z):Z=e[46];let Y;e[47]!==n||e[48]!==s?(Y=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Nn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=Y):Y=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>v("icons"),e[50]=ee):ee=e[50];const ce=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[51]!==ce?(ie=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ie):ie=e[52];let Q;e[53]!==ie?(Q=o.jsx("button",{type:"button",onClick:ee,className:ie,children:"Icons"}),e[53]=ie,e[54]=Q):Q=e[54];let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=()=>v("upload"),e[55]=he):he=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ue;e[56]!==de?(ue=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=ue):ue=e[57];let ye;e[58]!==ue?(ye=o.jsx("button",{type:"button",onClick:he,className:ue,children:"Upload"}),e[58]=ue,e[59]=ye):ye=e[59];let Xe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Xe=o.jsx("div",{className:"flex-1"}),e[60]=Xe):Xe=e[60];let He;e[61]!==Q||e[62]!==ye?(He=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Q,ye,Xe]}),e[61]=Q,e[62]=ye,e[63]=He):He=e[63];let ne;e[64]!==T||e[65]!==O||e[66]!==B||e[67]!==R||e[68]!==y.name||e[69]!==y.type||e[70]!==b||e[71]!==k||e[72]!==g?(ne=g==="icons"?o.jsx(od,{search:b,onSearchChange:S,selectedColor:k,onColorChange:T,onSelectIcon:B,onRandom:O,currentIconName:y.type==="icon"?y.name:null}):o.jsx(ad,{onUpload:R}),e[64]=T,e[65]=O,e[66]=B,e[67]=R,e[68]=y.name,e[69]=y.type,e[70]=b,e[71]=k,e[72]=g,e[73]=ne):ne=e[73];let ve;e[74]!==Y||e[75]!==He||e[76]!==ne?(ve=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:id,children:o.jsxs("div",{className:"flex flex-col",children:[Y,He,ne]})}),e[74]=Y,e[75]=He,e[76]=ne,e[77]=ve):ve=e[77];let tt;return e[78]!==I||e[79]!==M||e[80]!==W||e[81]!==Z||e[82]!==ve?(tt=o.jsxs(I,{open:M,onOpenChange:W,children:[Z,ve]}),e[78]=I,e[79]=M,e[80]=W,e[81]=Z,e[82]=ve,e[83]=tt):tt=e[83],tt}function id(t){return t.preventDefault()}function rd(t){const e=V.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=A.useState(!1);let a,l,h,c,d,u,m;if(e[0]!==r||e[1]!==s){const b=ea(s);l=Us,u=r,m=n,a=Hs,d=!0,h="button",c=te("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=d,e[7]=u,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==d||e[14]!==_?(f=o.jsx(a,{asChild:d,children:_}),e[12]=a,e[13]=d,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=gc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:te("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Ws,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:nd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==u||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:u,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=u,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function nd(t){return t.preventDefault()}function od(t){const e=V.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,d,u,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=Jr(),w=ea(r);d=s.trim()?x.filter(T=>{const C=ar(T),R=s.toLowerCase();return C.includes(R)||T.toLowerCase().includes(R)}):x,f="flex flex-col";let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(Ca,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=N):N=e[14];let y;e[15]!==i?(y=T=>i(T.target.value),e[15]=i,e[16]=y):y=e[16];let k;e[17]!==s||e[18]!==y?(k=o.jsxs("div",{className:"relative flex-1",children:[N,o.jsx(fs,{value:s,onChange:y,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=y,e[19]=k):k=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(pc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let B;e[21]!==l?(B=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=B):B=e[22];let D;e[23]!==n||e[24]!==r?(D=o.jsx(rd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=D):D=e[25],e[26]!==B||e[27]!==D||e[28]!==k?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[k,B,D]}),e[26]=B,e[27]=D,e[28]=k,e[29]=p):p=e[29],c=wa,_="h-56",u="grid grid-cols-9 gap-0.5 px-2 pb-2",m=d.map(T=>{const C=Ni(T);return C?o.jsx("button",{type:"button",onClick:()=>a(T),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===T?te(w.bg,w.text):te(w.text,"hover:bg-accent")),title:T,children:o.jsx(C,{size:18})},T):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=d,e[9]=u,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],d=e[8],u=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==u||e[31]!==m?(g=o.jsx("div",{className:u,children:m}),e[30]=u,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==d.length?(v=d.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=d.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function ad(t){const e=V.c(27),{onUpload:s}=t,i=A.useRef(null);let r;e[0]!==s?(r=N=>{const y=N.target.files?.[0];if(!y)return;if(y.size>2097152){me.error("Image must be smaller than 2MB"),N.target.value="";return}const k=new FileReader;k.onerror=()=>{me.error("Failed to read image file"),i.current&&(i.current.value="")},k.onloadend=()=>{k.readyState===FileReader.DONE&&k.result&&s(k.result),i.current&&(i.current.value="")},k.readAsDataURL(y)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=A.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const N=a.trim();N&&(s(N),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let d;e[5]!==n?(d=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=()=>i.current?.click(),e[7]=u):u=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:u,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Jl,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=N=>l(N.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=N=>{N.key==="Enter"&&(N.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let w;return e[24]!==x||e[25]!==d?(w=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[d,m,_,x]}),e[24]=x,e[25]=d,e[26]=w):w=e[26],w}function ld(t){const e=V.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=ki(s);if(n.type==="icon"){const a=Ni(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Ic,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function cd(t){const e=V.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=A.useState(!1),[h,c]=A.useState("");let d;e[0]!==s?(d=ki(s),e[0]=s,e[1]=d):d=e[1];const u=d,m=u.type==="icon"?u.name:null;let _,f,p,g,v,b,S,x,w,N,y,k,j,B,D;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const I=Jr();g=h.trim()?I.filter(K=>{const G=h.toLowerCase();return ar(K).includes(G)||K.toLowerCase().includes(G)}):I,p=Us,v=n?!1:a,b=l;const L=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let $;e[24]!==r||e[25]!==L?($=te("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",L,r),e[24]=r,e[25]=L,e[26]=$):$=e[26];let F;e[27]!==s?(F=o.jsx(ld,{value:s}),e[27]=s,e[28]=F):F=e[28],e[29]!==n||e[30]!==$||e[31]!==F?(S=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:$,children:F})}),e[29]=n,e[30]=$,e[31]=F,e[32]=S):S=e[32],f=Ws,j="start",B="w-64 p-0",D=hd,y="flex flex-col";let M;e[33]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(Ca,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=M):M=e[33];let W;e[34]===Symbol.for("react.memo_cache_sentinel")?(W=K=>c(K.target.value),e[34]=W):W=e[34],e[35]!==h?(k=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[M,o.jsx(fs,{value:h,onChange:W,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=k):k=e[36],_=wa,N="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let U;e[37]!==m||e[38]!==i?(U=K=>{const G=Ni(K);return G?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${K}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===K?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:ar(K),children:o.jsx(G,{size:16})},K):null},e[37]=m,e[38]=i,e[39]=U):U=e[39],w=g.map(U),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=w,e[18]=N,e[19]=y,e[20]=k,e[21]=j,e[22]=B,e[23]=D}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],w=e[17],N=e[18],y=e[19],k=e[20],j=e[21],B=e[22],D=e[23];let T;e[40]!==x||e[41]!==w?(T=o.jsx("div",{className:x,children:w}),e[40]=x,e[41]=w,e[42]=T):T=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let R;e[45]!==_||e[46]!==T||e[47]!==C||e[48]!==N?(R=o.jsxs(_,{className:N,children:[T,C]}),e[45]=_,e[46]=T,e[47]=C,e[48]=N,e[49]=R):R=e[49];let E;e[50]!==R||e[51]!==y||e[52]!==k?(E=o.jsxs("div",{className:y,children:[k,R]}),e[50]=R,e[51]=y,e[52]=k,e[53]=E):E=e[53];let O;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==B||e[58]!==D?(O=o.jsx(f,{align:j,className:B,onOpenAutoFocus:D,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=B,e[58]=D,e[59]=O):O=e[59];let z;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==O?(z=o.jsxs(p,{open:v,onOpenChange:b,children:[S,O]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=O,e[65]=z):z=e[65],z}function hd(t){return t.preventDefault()}function ai(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Me,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Fi(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Dl,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function dd(t){const e=V.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=te("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.tags?(d=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==u||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[u,m]}),e[12]=u,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(rh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function rn(t){const e=V.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const u=s.map(ud);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(dd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,u),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let d;return e[10]!==l||e[11]!==h?(d=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=d):d=e[12],d}function ud(t){return t.id}function fd(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=kc(c);let u;e[5]!==d.tools?(u=d.tools.map(md),e[5]=d.tools,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function md(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Jc,{annotations:t.annotations,_meta:t._meta})}}function _d(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=Yc(c);let u;e[5]!==d.resources?(u=d.resources.map(pd),e[5]=d.resources,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function pd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function gd(t){const e=V.c(12),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=Ce();let l;e[0]!==s||e[1]!==a.id?(l={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=l):l=e[2];const h=Fe(l);let c;e[3]!==h?(c={client:h},e[3]=h,e[4]=c):c=e[4];const{data:d}=nh(c);let u;e[5]!==d.prompts?(u=d.prompts.map(vd),e[5]=d.prompts,e[6]=u):u=e[6];const m=u;let _;return e[7]!==n||e[8]!==m||e[9]!==r||e[10]!==i?(_=o.jsx(rn,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[7]=n,e[8]=m,e[9]=r,e[10]=i,e[11]=_):_=e[11],_}function vd(t){return{id:t.name,name:t.name,description:t.description}}function xd(t){const e=V.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:d,toggleAllPrompts:u,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==u||e[3]!==d||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?d(r):u(r)},e[0]=i,e[1]=r,e[2]=u,e[3]=d,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let w;e[16]!==v||e[17]!==x?(w=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=w):w=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=N):N=e[19];let y;e[20]!==m?(y=z=>m(z),e[20]=m,e[21]=y):y=e[21];let k;e[22]!==i||e[23]!==y?(k=o.jsx(ih,{tabs:N,activeTab:i,onTabChange:y}),e[22]=i,e[23]=y,e[24]=k):k=e[24];const j=f?"Deselect all":"Select all";let B;e[25]!==g||e[26]!==j?(B=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=B):B=e[27];let D;e[28]!==B||e[29]!==k?(D=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[k,B]}),e[28]=B,e[29]=k,e[30]=D):D=e[30];let T;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(T=i==="tools"&&o.jsx(Qt,{fallback:Fi("Tools not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(fd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(z,I)=>a(r,z,I)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=T):T=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx(Qt,{fallback:Fi("Resources not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(_d,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(z,I)=>l(r,z,I)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let R;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(R=i==="prompts"&&o.jsx(Qt,{fallback:Fi("Prompts not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ai,{}),children:o.jsx(gd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(z,I)=>h(r,z,I)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=R):R=e[45];let E;e[46]!==T||e[47]!==C||e[48]!==R?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[T,C,R]}),e[46]=T,e[47]=C,e[48]=R,e[49]=E):E=e[49];let O;return e[50]!==D||e[51]!==E||e[52]!==w?(O=o.jsxs(o.Fragment,{children:[w,D,E]}),e[50]=D,e[51]=E,e[52]=w,e[53]=O):O=e[53],O}function bd(t){const e=V.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=ha(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(vc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=d):d=e[3];let u;e[4]!==s||e[5]!==i?(u=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=u):u=e[6];let m;return e[7]!==u?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,d,u]}),e[7]=u,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function Sd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Pn(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function yd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function wd(t){const e=V.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,d]=A.useReducer(yd,h),u=Qr(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Sd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(M,W,U,K)=>{const G=f[M]?.[W];let P;G===null?P=K.filter(Y=>Y!==U):G?.includes(U)?P=G.filter(Y=>Y!==U):(P=[...G??[],U],P.length===K.length&&(P=null));const Z={...f};Z[M]?Z[M]={...Z[M]}:Z[M]={tools:null,resources:null,prompts:null},Z[M][W]=P,n.setValue("connections",Pn(Z),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=(M,W)=>{const K=f[M]?.[W]===null?[]:null,G={...f};G[M]?G[M]={...G[M]}:G[M]={tools:null,resources:null,prompts:null},G[M][W]=K,n.setValue("connections",Pn(G),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=(M,W,U)=>g(M,"tools",W,U),e[11]=g,e[12]=S):S=e[12];const x=S;let w;e[13]!==g?(w=(M,W,U)=>g(M,"resources",W,U),e[13]=g,e[14]=w):w=e[14];const N=w;let y;e[15]!==g?(y=(M,W,U)=>g(M,"prompts",W,U),e[15]=g,e[16]=y):y=e[16];const k=y;let j;e[17]!==b?(j=M=>b(M,"tools"),e[17]=b,e[18]=j):j=e[18];const B=j;let D;e[19]!==b?(D=M=>b(M,"resources"),e[19]=b,e[20]=D):D=e[20];const T=D;let C;e[21]!==b?(C=M=>b(M,"prompts"),e[21]=b,e[22]=C):C=e[22];const R=C;if(!r||!u)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ai,{}),e[23]=E):E=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=M=>d({type:"SET_ACTIVE_TAB",payload:M}),e[24]=O):O=e[24];let z;e[25]!==u||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==R||e[30]!==T||e[31]!==B||e[32]!==k||e[33]!==N||e[34]!==x?(z=o.jsx(xd,{currentConnection:u,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:N,togglePrompt:k,toggleAllTools:B,toggleAllResources:T,toggleAllPrompts:R,onTabChange:O},r),e[25]=u,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=R,e[30]=T,e[31]=B,e[32]=k,e[33]=N,e[34]=x,e[35]=z):z=e[35];let I;e[36]!==l||e[37]!==r||e[38]!==z?(I=o.jsx(A.Suspense,{fallback:E,children:o.jsx(bd,{connectionId:r,onAuthenticate:l,children:z})}),e[36]=l,e[37]=r,e[38]=z,e[39]=I):I=e[39];let L;e[40]!==i?(L=o.jsx(Qc,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=L):L=e[41];let $;e[42]!==I||e[43]!==L?($=o.jsxs(en,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[I,L]}),e[42]=I,e[43]=L,e[44]=$):$=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==$?(F=o.jsx(tn,{open:s,onOpenChange:i,children:$}),e[45]=i,e[46]=s,e[47]=$,e[48]=F):F=e[48],F}const Hi={tools:null,resources:null,prompts:null},Cd=Rl.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function kd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Nd(t){const e=V.c(11),{url:s,agentId:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{Se("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),me.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Ei,{size:20,className:"text-green-600"}):o.jsx(Ci,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let d;e[5]!==c?(d=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==h||e[9]!==d?(u=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,d]}),e[7]=l,e[8]=h,e[9]=d,e[10]=u):u=e[10],u}function jd(t){const e=V.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{Se("agent_connect_action",{agent_id:r,action:"install_cursor"});const d=da(i),m=kd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(d)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),me.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Ed(t){const e=V.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=A.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{Se("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=da(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),me.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Ei,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const d=n?"Copied!":"Install on Claude Code";let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium",children:d}),e[6]=d,e[7]=u):u=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==u?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,u]}),e[8]=h,e[9]=c,e[10]=u,e[11]=m):m=e[11],m}function Td({virtualMcp:t}){const{org:e}=Ce(),s=Fe({connectionId:Bt,orgId:e.id}),[i,r]=A.useState(null),[n,a]=A.useState(!1),[l,h]=A.useState(!1),c=t.id,d=t.title||`agent-${c.slice(0,8)}`,u=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${d}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),Se("agent_typegen_key_generated",{agent_id:c})}catch{Se("agent_typegen_key_failed",{agent_id:c}),me.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{Se("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(u),h(!0),me.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Me,{size:14,className:"animate-spin"}):o.jsx(sh,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:u}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Ei,{size:12,className:"text-green-600"}):o.jsx(Ci,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Dd,{apiKey:i,agentId:c})]})}function Dd(t){const e=V.c(21),{apiKey:s,agentId:i}=t,[r,n]=A.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
3
3
  ${h}`;let d;e[0]!==i||e[1]!==s||e[2]!==c?(d=async()=>{Se("agent_connect_action",{agent_id:i,action:"typegen_copy_env",has_api_key:!!s}),await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=c,e[3]=d):d=e[3];const u=d,m=!s;let _;e[4]!==m?(_=te({"opacity-50":m}),e[4]=m,e[5]=_):_=e[5];let f;e[6]!==l||e[7]!==_?(f=o.jsx("span",{className:_,children:l}),e[6]=l,e[7]=_,e[8]=f):f=e[8];let p,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("br",{}),g=o.jsx("span",{children:h}),e[9]=p,e[10]=g):(p=e[9],g=e[10]);let v;e[11]!==f?(v=o.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[f,p,g]}),e[11]=f,e[12]=v):v=e[12];let b;e[13]!==r?(b=r?o.jsx(Ei,{size:12,className:"text-green-600"}):o.jsx(Ci,{size:12}),e[13]=r,e[14]=b):b=e[14];let S;e[15]!==u||e[16]!==b?(S=o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:u,children:b}),e[15]=u,e[16]=b,e[17]=S):S=e[17];let x;return e[18]!==v||e[19]!==S?(x=o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[v,S]})}),e[18]=v,e[19]=S,e[20]=x):x=e[20],x}function Rd(t){const e=V.c(3),{virtualMcp:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx(Td,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Md(t){const e=V.c(37),{open:s,onOpenChange:i,virtualMcp:r}=t,n=`/mcp/virtual-mcp/${r.id}`;let a;e[0]!==n?(a=new URL(n,window.location.origin),e[0]=n,e[1]=a):a=e[1];const l=a;let h;e[2]!==r.id||e[3]!==r.title?(h=r.title||`agent-${r.id?.slice(0,8)??"default"}`,e[2]=r.id,e[3]=r.title,e[4]=h):h=e[4];const c=h,d=aa();let u;e[5]!==r.id||e[6]!==l.href?(u=o.jsx(Nd,{url:l.href,agentId:r.id}),e[5]=r.id,e[6]=l.href,e[7]=u):u=e[7];let m,_;e[8]!==c||e[9]!==r.id||e[10]!==l.href?(m=o.jsx(jd,{url:l.href,serverName:c,agentId:r.id}),_=o.jsx(Ed,{url:l.href,serverName:c,agentId:r.id}),e[8]=c,e[9]=r.id,e[10]=l.href,e[11]=m,e[12]=_):(m=e[11],_=e[12]);let f;e[13]!==u||e[14]!==m||e[15]!==_?(f=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[u,m,_]})}),e[13]=u,e[14]=m,e[15]=_,e[16]=f):f=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"border-t border-border"}),e[17]=p):p=e[17];let g;e[18]!==r?(g=o.jsx(Rd,{virtualMcp:r}),e[18]=r,e[19]=g):g=e[19];let v;e[20]!==f||e[21]!==g?(v=o.jsxs("div",{className:"flex flex-col gap-6",children:[f,p,g]}),e[20]=f,e[21]=g,e[22]=v):v=e[22];const b=v;if(d){let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(lh,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=N):N=e[23];let y;e[24]!==b?(y=o.jsx(ch,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[N,b]})}),e[24]=b,e[25]=y):y=e[25];let k;return e[26]!==i||e[27]!==s||e[28]!==y?(k=o.jsx(hh,{open:s,onOpenChange:i,children:y}),e[26]=i,e[27]=s,e[28]=y,e[29]=k):k=e[29],k}let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ba,{children:o.jsx(Sa,{children:"Connect"})}),e[30]=S):S=e[30];let x;e[31]!==b?(x=o.jsxs(en,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[S,b]}),e[31]=b,e[32]=x):x=e[32];let w;return e[33]!==i||e[34]!==s||e[35]!==x?(w=o.jsx(tn,{open:s,onOpenChange:i,children:x}),e[33]=i,e[34]=s,e[35]=x,e[36]=w):w=e[36],w}function Bd(t,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...t,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...t,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...t,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...t,settingsDialogOpen:!1,settingsConnectionId:null};default:return t}}function Id(t){const e=V.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=Qr(s),{org:d}=Ce();if(!c)return null;let u;e[0]!==c?(u=Zc(c),e[0]=c,e[1]=u):u=e[1];const m=u;let _;e[2]!==s?(_=o.jsx(Od,{connection_id:s}),e[2]=s,e[3]=_):_=e[3];let f;e[4]!==c.app_name||e[5]!==c.connection_type||e[6]!==c.description||e[7]!==c.icon||e[8]!==c.title||e[9]!==s||e[10]!==a||e[11]!==h||e[12]!==r||e[13]!==n||e[14]!==l||e[15]!==d.slug||e[16]!==m||e[17]!==i?(f=o.jsx(Ld,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:m,orgSlug:d.slug,appName:c.app_name,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}),e[4]=c.app_name,e[5]=c.connection_type,e[6]=c.description,e[7]=c.icon,e[8]=c.title,e[9]=s,e[10]=a,e[11]=h,e[12]=r,e[13]=n,e[14]=l,e[15]=d.slug,e[16]=m,e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==_||e[20]!==f?(p=o.jsx(A.Suspense,{fallback:_,children:f}),e[19]=_,e[20]=f,e[21]=p):p=e[21],p}const Ln="__new_instance__";async function Ad(t,e){const s=t?.idToken??null;if(s){const r=On(s);if(r)return r}const i=t?.userinfoEndpoint??null;if(i)try{const r=await fetch(i,{headers:{Authorization:`Bearer ${e}`}});if(r.ok){const n=await r.json(),a=typeof n.email=="string"?n.email:typeof n.upn=="string"?n.upn:typeof n.preferred_username=="string"?n.preferred_username:null;if(a)return a}}catch{}return On(e)}function On(t){try{const e=t.split(".");if(e.length===3&&e[1]){const s=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof s.email=="string")return s.email;if(typeof s.upn=="string")return s.upn;if(typeof s.preferred_username=="string")return s.preferred_username}}catch{}return null}function Pd(t){const e=V.c(23),{appName:s,connectionId:i,usedConnectionIds:r,onSwitchInstance:n,onNewInstance:a}=t;let l;e[0]!==s?(l={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=l):l=e[1];const h=ji(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===Ln?a?.():n(i,p)},e[2]=i,e[3]=a,e[4]=n,e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ts,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(ss,{})}),e[6]=d):d=e[6];let u;if(e[7]!==i||e[8]!==h||e[9]!==r){let p;e[11]!==i||e[12]!==r?(p=g=>o.jsx(Rt,{value:g.id,className:"text-xs",disabled:g.id!==i&&r.has(g.id),children:g.title},g.id),e[11]=i,e[12]=r,e[13]=p):p=e[13],u=h.map(p),e[7]=i,e[8]=h,e[9]=r,e[10]=u}else u=e[10];let m;e[14]!==a?(m=a&&o.jsx(Rt,{value:Ln,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=m):m=e[15];let _;e[16]!==u||e[17]!==m?(_=o.jsxs(is,{children:[u,m]}),e[16]=u,e[17]=m,e[18]=_):_=e[18];let f;return e[19]!==i||e[20]!==c||e[21]!==_?(f=o.jsxs(es,{value:i,onValueChange:c,children:[d,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=f):f=e[22],f}function Ld(t){const e=V.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:d,onOpenSettings:u,onRemove:m,onAuthenticate:_,onSwitchInstance:f,onNewInstance:p}=t;let g;e[0]!==s?(g={connectionId:s},e[0]=s,e[1]=g):g=e[1];const v=ha(g),S=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=S?"border-destructive/50 bg-destructive/5":"border-border";let w;e[2]!==x?(w=te("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=w):w=e[3];let N;e[4]!==h||e[5]!==l?(N={org:h,appSlug:l},e[4]=h,e[5]=l,e[6]=N):N=e[6];let y;e[7]!==n||e[8]!==i?(y=o.jsx(ds,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=y):y=e[9];let k;e[10]!==i?(k=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=k):k=e[11];let j;e[12]!==r||e[13]!==S?(j=S?o.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):r&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r}),e[12]=r,e[13]=S,e[14]=j):j=e[14];let B;e[15]!==k||e[16]!==j?(B=o.jsxs("div",{className:"flex-1 min-w-0",children:[k,j]}),e[15]=k,e[16]=j,e[17]=B):B=e[17];let D;e[18]!==s||e[19]!==S||e[20]!==_?(D=S?o.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:K=>{K.preventDefault(),K.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(Ve,{delayDuration:0,children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:o.jsx(th,{size:16})})}),o.jsx(qe,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=S,e[20]=_,e[21]=D):D=e[21];let T;e[22]!==N||e[23]!==y||e[24]!==B||e[25]!==D?(T=o.jsxs(Il,{to:"/$org/settings/connections/$appSlug",params:N,className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[y,B,D]}),e[22]=N,e[23]=y,e[24]=B,e[25]=D,e[26]=T):T=e[26];let C;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==f||e[31]!==d?(C=c&&o.jsx(Pd,{appName:c,connectionId:s,usedConnectionIds:d,onSwitchInstance:f,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=f,e[31]=d,e[32]=C):C=e[32];let R;e[33]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(bc,{size:13}),e[33]=R):R=e[33];let E;e[34]!==u?(E=o.jsx(Ke,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:u,"aria-label":"Configure resources",children:R})}),e[34]=u,e[35]=E):E=e[35];let O;e[36]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(qe,{side:"bottom",children:"Configure resources"}),e[36]=O):O=e[36];let z;e[37]!==E?(z=o.jsxs(Ve,{delayDuration:0,children:[E,O]}),e[37]=E,e[38]=z):z=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(ls,{size:13}),e[39]=I):I=e[39];let L;e[40]!==m?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:m,"aria-label":"Remove connection",children:I})}),e[40]=m,e[41]=L):L=e[41];let $;e[42]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(qe,{side:"bottom",children:"Remove"}),e[42]=$):$=e[42];let F;e[43]!==L?(F=o.jsxs(Ve,{delayDuration:0,children:[L,$]}),e[43]=L,e[44]=F):F=e[44];let M;e[45]!==z||e[46]!==F?(M=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[z,F]}),e[45]=z,e[46]=F,e[47]=M):M=e[47];let W;e[48]!==C||e[49]!==M?(W=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[C,M]}),e[48]=C,e[49]=M,e[50]=W):W=e[50];let U;return e[51]!==T||e[52]!==W||e[53]!==w?(U=o.jsxs("div",{className:w,children:[T,W]}),e[51]=T,e[52]=W,e[53]=w,e[54]=U):U=e[54],U}function Od(t){const e=V.c(17),{connection_id:s}=t,i=Qr(s);if(!i){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Da,{}),e[0]=u):u=e[0],u}let r;e[1]!==i.icon||e[2]!==i.title?(r=o.jsx(ds,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0"}),e[1]=i.icon,e[2]=i.title,e[3]=r):r=e[3];let n;e[4]!==i.title?(n=o.jsx("p",{className:"text-sm font-medium truncate",children:i.title}),e[4]=i.title,e[5]=n):n=e[5];let a;e[6]!==i.description?(a=i.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.description}),e[6]=i.description,e[7]=a):a=e[7];let l;e[8]!==n||e[9]!==a?(l=o.jsxs("div",{className:"flex-1 min-w-0",children:[n,a]}),e[8]=n,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==r||e[12]!==l?(h=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r,l]}),e[11]=r,e[12]=l,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let d;return e[15]!==h?(d=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=d):d=e[16],d}function Da(){const t=V.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),t[1]=s):s=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[s,o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),t[2]=i):i=t[2],i}function zd({virtualMcpId:t}){const{org:e}=Ce(),s=Fe({connectionId:Bt,orgId:e.id}),i=Ht(),r=gt(t),n=(r?.connections??[]).map(L=>L.connection_id).sort(),{data:a}=Wo({queryKey:As.projectConnectionDetails(t,n),enabled:n.length>0,queryFn:async()=>await Promise.all(n.map(async $=>{try{const F=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:$}}),{item:M}=Li(F),W=(M?.tools??[]).filter(U=>!!Xc(U._meta)).map(U=>({name:U.name,description:U.description}));return{fetchOk:!0,id:$,title:M?.title??$,icon:M?.icon??null,uiTools:W}}catch{return{fetchOk:!1,id:$,title:$,icon:null,uiTools:[]}}}))}),l=(a??[]).filter(L=>L.uiTools.length>0),h=new Set(ic),c=r?.metadata?.ui,d=c?.pinnedViews??[],u=c?.layout?.defaultMainView??null,m=c?.layout?.chatDefaultOpen??!1,_=!u||u.type==="chat"?"chat":u.type==="instructions"||u.type==="connections"||u.type==="layout"?"settings":h.has(u.type)?u.type:`${u.type}:${u.id??""}:${u.toolName??""}`,[f,p]=A.useState(d),[g,v]=A.useState(_),[b,S]=A.useState(m),[x,w]=A.useState(!1),N=L=>{const[$,F,M]=L.split(":");return $?$==="chat"?{type:$}:h.has($)?{type:$}:$==="ext-apps"&&F?{type:"ext-apps",id:F,toolName:M||void 0}:null:null},y=A.useRef(!1);if(a&&a.length>0&&!y.current){y.current=!0;const L=new Set((a??[]).filter(M=>M.fetchOk).map(M=>M.id)),$=new Set(l.flatMap(M=>M.uiTools.map(W=>`${M.id}:${W.name}`))),F=d.filter(M=>!L.has(M.connectionId)||$.has(`${M.connectionId}:${M.toolName}`));if(F.length!==d.length){p(F);let M=g;u?.type==="ext-apps"&&!F.some(W=>W.connectionId===u.id&&W.toolName===u.toolName)&&(M="chat",v(M)),s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:F,layout:{defaultMainView:N(M),chatDefaultOpen:b}}}).then(W=>{Li(W),i.invalidateQueries({predicate:U=>Array.isArray(U.queryKey)&&U.queryKey.includes("collection")&&U.queryKey.includes("VIRTUAL_MCP")})}).catch(()=>{p(d),v(_)})}}const k=(L,$,F)=>{w(!0),(async()=>{try{const W=await s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:L,layout:{defaultMainView:N($),chatDefaultOpen:F??b}}});Li(W),i.invalidateQueries({predicate:U=>Array.isArray(U.queryKey)&&U.queryKey.includes("collection")&&U.queryKey.includes("VIRTUAL_MCP")}),me.success("Layout updated")}catch(W){me.error("Failed to update layout: "+(W instanceof Error?W.message:"Unknown error"))}finally{w(!1)}})()},j=(L,$)=>{const F=f.some(U=>U.connectionId===L&&U.toolName===$);let M,W=g;if(F){M=f.filter(K=>!(K.connectionId===L&&K.toolName===$));const U=`ext-apps:${L}:${$}`;g===U&&(W="chat",v(W))}else M=[...f,{connectionId:L,toolName:$,label:yn($),icon:null}];p(M),k(M,W)},B=(L,$,F)=>{p(M=>M.map(W=>W.connectionId===L&&W.toolName===$?{...W,label:F}:W))},D=()=>{k(f,g)},T=(L,$,F)=>{p(W=>W.map(U=>U.connectionId===L&&U.toolName===$?{...U,icon:F}:U));const M=f.map(W=>W.connectionId===L&&W.toolName===$?{...W,icon:F}:W);k(M,g)},C=L=>{v(L),k(f,L)},R=n.length===0,E=a&&l.length===0,O=!!It(r),z=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];O&&(z.push({value:"env",label:"Terminal"}),z.push({value:"preview",label:"Preview"}));for(const L of f)z.push({value:`ext-apps:${L.connectionId}:${L.toolName}`,label:L.label||L.toolName});const I=l.length>0||R||E;return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Layout"})}),o.jsxs(eh,{className:"p-6 gap-5",children:[o.jsxs(Tn,{className:"p-0 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ms,{className:"font-normal text-foreground",children:"Main view"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"What users see when they first open this agent."})]}),o.jsxs(es,{value:g,onValueChange:C,children:[o.jsx(ts,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(ss,{})}),o.jsx(is,{children:z.map(L=>o.jsx(Rt,{value:L.value,className:"capitalize",children:L.label},L.value))})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ms,{className:"font-normal text-foreground",children:"Show chat"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Display the chat panel alongside the main view."})]}),o.jsxs(Ve,{delayDuration:0,children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(cr,{checked:g==="chat"?!0:b,disabled:g==="chat"||x,onCheckedChange:L=>{S(L),k(f,g,L)}})})}),g==="chat"&&o.jsx(qe,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),I&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(Tn,{className:"p-0 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ms,{className:"font-normal text-foreground",children:"Pinned views"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Surface interactive tools as top-level tabs in the agent."})]})}),R&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a connection above to configure pinned views."}),E&&!R&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"None of the connected servers expose interactive tools."}),l.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:l.map((L,$)=>o.jsxs("div",{children:[$>0&&o.jsx("div",{className:"border-t border-border -mx-6 mb-4"}),o.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[o.jsx(ds,{icon:L.icon,name:L.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L.title})]}),o.jsx("div",{className:"space-y-1.5",children:L.uiTools.map(F=>{const M=f.some(U=>U.connectionId===L.id&&U.toolName===F.name),W=f.find(U=>U.connectionId===L.id&&U.toolName===F.name);return o.jsxs("div",{className:te("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",M?"bg-accent/40 border-border":"bg-transparent border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[o.jsx(cd,{value:W?.icon??null,onChange:U=>T(L.id,F.name,U),disabled:!M||x}),o.jsx(fs,{value:M&&W?W.label:yn(F.name),onChange:U=>B(L.id,F.name,U.target.value),onBlur:D,className:"h-7 text-sm w-40",disabled:!M||x,readOnly:!M})]}),o.jsx(cr,{checked:M,onCheckedChange:()=>j(L.id,F.name),disabled:x})]},F.name)})})]},L.id))})]})]})]})]})}function $d({virtualMcp:t,hideOwnTitle:e}){const{org:s}=Ce(),i=Ul(),r=qc(),n=Ht(),a=Fe({connectionId:Bt,orgId:s.id}),l=Vo({resolver:Ml(Cd),defaultValues:t}),h=l.watch("connections"),c=!!It(t),[d,u]=A.useReducer(Bd,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[m,_]=A.useState(!1),{createTaskWithMessage:f}=lt(),{setChatMode:p}=yi(),{createNewTask:g}=Zr(),v=()=>{const P=l.getValues("metadata.instructions");P?.trim()&&(B(),Se("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:P.length}),p("plan"),f({virtualMcpId:Xo(s.id),message:{parts:[{type:"text",text:`/writing-prompts ${t.id}
4
4
 
5
5
  <instructions>
@@ -186,4 +186,4 @@ ${X}
186
186
 
187
187
  <message>
188
188
  ${ve}
189
- </message>`}]}}))},I=e.models?.credentialId||_||"",L=e.models?.thinking?.id||f?.modelId||"",$=Vo({defaultValues:{name:e.name,active:e.active,credential_id:I,model_id:L}}),F=$.watch("active"),M=$.watch("credential_id"),W=$.watch("model_id"),{models:U,isLoading:K}=jc(M||void 0),G=U.find(ne=>ne.modelId===W)??null,P=A.useRef(null),Z=A.useRef(new Set),Y=A.useRef(0),ee=A.useRef(null),ce=3e4,ie=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),P.current!==null&&(Se("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(Z.current),save_count:Y.current,edit_duration_ms:Date.now()-P.current}),P.current=null,Z.current=new Set,Y.current=0)},Q=async()=>{if(!(Object.keys($.formState.dirtyFields).length>0)&&!E.current)return!0;const ve=Object.keys($.formState.dirtyFields),tt=E.current;E.current=!1;const _e=$.getValues(),Vt=O.current;try{const gs=_e.credential_id&&_e.model_id?_e.credential_id:"",X=_e.credential_id&&_e.model_id?_e.model_id:"",oe={id:t,name:_e.name,active:_e.active,agent:{id:n},models:{credentialId:gs,thinking:{id:X}},messages:Kl(Vt),temperature:0};await l.mutateAsync(oe),P.current===null&&(P.current=Date.now());for(const Ie of ve)Z.current.add(Ie);return tt&&Z.current.add("messages"),Y.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ie,ce),$.reset({..._e,credential_id:gs,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},he=A.useRef(Q);he.current=Q;const de=()=>{R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{R.current=null,he.current()},1e3)},ue=async()=>(R.current&&(clearTimeout(R.current),R.current=null),he.current()),ye=ne=>{if(O.current=ne,x(ne),!C.current){C.current=!0;return}E.current=!0,de()},Xe=A.useRef(!1);Xe.current||(Xe.current=!0,$.watch(()=>{de()})),A.useEffect(()=>()=>{R.current&&(clearTimeout(R.current),R.current=null,he.current())},[]);const He=async()=>{Se("automation_test_clicked",{automation_id:t,agent_id:n});const ne=await ue();if(ie(),!ne)return;if(!S){me.error("No instructions configured for this automation");return}G&&M&&m({...G,keyId:M}),v({...g,toolApprovalLevel:"auto"});const ve=xn(S);u({message:{tiptapDoc:S,parts:ve},virtualMcpId:n||void 0})};return o.jsxs(o.Fragment,{children:[i&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:i,children:[o.jsx(ka,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...$.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),r&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:r,children:o.jsx(hr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xt,{control:$.control,name:"active",render:({field:ne})=>o.jsx(cr,{checked:ne.value,onCheckedChange:ve=>{ne.onChange(ve),setTimeout(()=>ue(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ca,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(kp,{automationId:t,open:w,onOpenChange:N,onCustomSelect:()=>{k(!0),T(!1),B("")},onEventSelect:()=>{T(!0),k(!1)}})]}),e.triggers.length===0&&!y?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>N(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ne=>o.jsx(Np,{trigger:ne,automationId:t,connectionName:ne.connection_id?d.get(ne.connection_id):void 0},ne.id))}),y&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Rs,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:j,onChange:ne=>B(ne.target.value),onBlur:async()=>{const ne=j.trim();if(!(!ne||!Is(ne)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:ne}),Se("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),k(!1),B("")}catch{me.error("Failed to add starter")}},onKeyDown:async ne=>{const ve=j.trim();ne.key==="Enter"&&ve&&Is(ve)&&ne.target.blur(),ne.key==="Escape"&&(k(!1),B(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Is(j)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),h.isPending&&o.jsx(Me,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{k(!1),B("")},children:o.jsx(ls,{size:13})})]}),D&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Me,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Ep,{automationId:t,onDone:()=>T(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!S,onClick:z,children:[o.jsx(ya,{size:13}),"Improve"]})]}),o.jsx(Hl,{tiptapDoc:S,setTiptapDoc:ye,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Wl,{virtualMcpId:n||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(ph,{model:G,isLoading:K,credentialId:M||null,onCredentialChange:ne=>{$.setValue("credential_id",ne??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0})},onModelChange:ne=>$.setValue("model_id",ne.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:He,disabled:!n,children:[o.jsx(Ql,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function Bp(t){const e=V.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=Zo(s),e[0]=s,e[1]=r):r=e[1];const n=r;if(!n)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==n.id||e[4]!==i?(l=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(A.Suspense,{fallback:a,children:o.jsx(Ip,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function Ip(t){const e=V.c(9),{id:s,virtualMcpId:i}=t,r=Mt(),{data:n,isLoading:a}=vh(s);let l;e[0]!==r?(l=()=>r({to:".",search:Ap,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=d):d=e[2],d}if(!n){let d;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=d):d=e[3],d}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Mp,{automationId:s,automation:n,virtualMcpId:i,onBack:h}),e[4]=n,e[5]=s,e[6]=h,e[7]=i,e[8]=c):c=e[8],c}function Ap(t){return{...t,main:"automations"}}function Pp(t){const e=V.c(20),{virtualMcpId:s}=t,i=Mt(),{data:r}=xh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=A.useState(""),c=l.toLowerCase(),d=n.filter(B=>B.name.toLowerCase().includes(c));let u;e[0]!==i?(u=B=>i({to:".",search:D=>({...D,main:"automation:"+B}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const m=u,_=async()=>{if(a.isPending)return;Se("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const B=await a.mutateAsync(Sh(s));m(B.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(yh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let w;e[7]!==b||e[8]!==x?(w=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=w):w=e[9];const N=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):d.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(B=>o.jsx(bh,{automation:B,onClick:()=>m(B.id)},B.id))});let y;e[10]!==N||e[11]!==g.Body||e[12]!==w?(y=o.jsxs(g.Body,{children:[w,N]}),e[10]=N,e[11]=g.Body,e[12]=w,e[13]=y):y=e[13];let k;e[14]!==y||e[15]!==p.Content?(k=o.jsx(p.Content,{children:y}),e[14]=y,e[15]=p.Content,e[16]=k):k=e[16];let j;return e[17]!==f||e[18]!==k?(j=o.jsx(f,{children:k}),e[17]=f,e[18]=k,e[19]=j):j=e[19],j}function Lp(t){const e=V.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx(Pp,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Lo=A.lazy(()=>Pl(()=>import("./project-app-view-C6unfZ4i.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Op(t){const e=V.c(44),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Ta(r);if(nc(n)){let f;return e[3]!==i?(f=o.jsx(zn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(xu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Lp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(xp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(ef,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n||e[14]!==i?(f=o.jsx(Bp,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=oc(n),e[16]=n,e[17]=c):c=e[17];const d=c;if(d){let f;if(e[18]!==l||e[19]!==d.connectionId||e[20]!==d.toolName){let S;e[22]!==d.connectionId||e[23]!==d.toolName?(S=x=>x.appId===d.connectionId&&x.toolName===d.toolName,e[22]=d.connectionId,e[23]=d.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=d.connectionId,e[20]=d.toolName,e[21]=f}else f=e[21];const p=f;let g;e[25]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[25]=g):g=e[25];const v=p?.args;let b;return e[26]!==n||e[27]!==d.connectionId||e[28]!==d.toolName||e[29]!==v?(b=o.jsx(A.Suspense,{fallback:g,children:o.jsx(Lo,{connectionId:d.connectionId,toolName:d.toolName,args:v},n)}),e[26]=n,e[27]=d.connectionId,e[28]=d.toolName,e[29]=v,e[30]=b):b=e[30],b}let u;if(e[31]!==n||e[32]!==a){let f;e[34]!==n?(f=p=>p.id===n,e[34]=n,e[35]=f):f=e[35],u=a.find(f),e[31]=n,e[32]=a,e[33]=u}else u=e[33];const m=u;if(m){let f;e[36]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[36]=f):f=e[36];let p;return e[37]!==n||e[38]!==m.id||e[39]!==m.view.appId||e[40]!==m.view.args?(p=o.jsx(A.Suspense,{fallback:f,children:o.jsx(Lo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[37]=n,e[38]=m.id,e[39]=m.view.appId,e[40]=m.view.args,e[41]=p):p=e[41],p}let _;return e[42]!==i?(_=o.jsx(zn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function zp(t){const e=V.c(7),{children:s,defaultSize:i}=t,[,r]=A.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Go.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=qo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const d=c;let u;return e[3]!==s||e[4]!==h||e[5]!==d?(u=o.jsx(la,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:d,order:1,children:s}),e[3]=s,e[4]=h,e[5]=d,e[6]=u):u=e[6],u}function $p(t){const e=V.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=En(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Go.decoChatPanelWidth(),e[3]=c):c=e[3];const[d]=qo(c,45),u=A.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==d?(m=()=>{const B=u.current;if(!B)return;const D=En(r,n),T=D.chat>0&&D.chat<100?d:D.chat,C=D.chat>0&&D.chat<100?100-d:D.main;B.setLayout([T,C])},_=[r,n,d],e[4]=r,e[5]=n,e[6]=d,e[7]=m,e[8]=_):(m=e[7],_=e[8]),A.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Na,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(zp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Vc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=te("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=N):N=e[19];let y;e[20]!==i||e[21]!==s?(y=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:N,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Op,{taskId:i,virtualMcpId:s})})})}),e[20]=i,e[21]=s,e[22]=y):y=e[22];let k;e[23]!==h.main||e[24]!==y?(k=o.jsx(la,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:y}),e[23]=h.main,e[24]=y,e[25]=k):k=e[25];let j;return e[26]!==k||e[27]!==f||e[28]!==b?(j=o.jsxs(Kc,{ref:u,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,k]},f),e[26]=k,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const nr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Oo="bg-sidebar-accent text-sidebar-foreground",or="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Fp(t){const e=V.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Ec(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{Se("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?Oo:or;let d;e[3]!==c?(d=te(nr,c),e[3]=c,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(wc,{size:16}),e[5]=u):u=e[5];let m;e[6]!==h||e[7]!==d||e[8]!==n?(m=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:d,children:u})}),e[6]=h,e[7]=d,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ve,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{Se("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?Oo:or;let v;e[16]!==g?(v=te(nr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Cc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==S?(w=o.jsxs(Ve,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=w):w=e[25];const N=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let y;e[26]!==N?(y=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",N),e[26]=N,e[27]=y):y=e[27];const k=!l,j=l?0:-1,B=!l,D=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let T;e[28]!==D?(T=te(nr,or,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",D),e[28]=D,e[29]=T):T=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ta,{size:16}),e[30]=C):C=e[30];let R;e[31]!==r||e[32]!==k||e[33]!==j||e[34]!==B||e[35]!==T?(R=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:k,tabIndex:j,"aria-hidden":B,className:T,children:C})}),e[31]=r,e[32]=k,e[33]=j,e[34]=B,e[35]=T,e[36]=R):R=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let O;e[38]!==R?(O=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[R,E]})}),e[38]=R,e[39]=O):O=e[39];let z;e[40]!==y||e[41]!==O?(z=o.jsx("div",{className:y,children:O}),e[40]=y,e[41]=O,e[42]=z):z=e[42];let I;return e[43]!==w||e[44]!==z||e[45]!==f?(I=o.jsxs(o.Fragment,{children:[f,w,z]}),e[43]=w,e[44]=z,e[45]=f,e[46]=I):I=e[46],I}function Hp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(u=>u.id===e))return{visible:i,overflow:r};const a=r.findIndex(u=>u.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],d=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:d}}function Wp(t){const e=V.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=te("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Up,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(d=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=d):d=e[12],d}function Up(t){const e=V.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(oa,{className:"size-4"}),e[4]=i):i=e[4],i}function Vp(t){const e=V.c(13),{overflow:s,onSelect:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ia,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Kp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let d;e[8]!==c?(d=o.jsx(Ws,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,d]}),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}function Kp(t){const e=V.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(oa,{className:"size-4"}),e[4]=i):i=e[4],i}const qp=6;function Gp(t){const e=V.c(20),{virtualMcpId:s,taskId:i}=t,r=Mt();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Ta(n);let d,u,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=ac({activeTab:l,mainOpen:h}),v=N=>N.id==="automations"?g:h&&N.id===l,S=a.find(N=>v(N))?.id??null,{visible:x,overflow:w}=Hp(a,S,qp);u=w,d=N=>{const y=a.find(j=>j.id===N),k=S===N&&h;if(Se("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:N,tab_kind:y?.kind??null,was_active:k}),N==="automations"){const j=lc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:j}),replace:!0});return}c(N)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(N=>o.jsx(Wp,{title:N.title,icon:N.icon,active:v(N),onClick:()=>d(N.id)},N.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=d,e[10]=u,e[11]=m,e[12]=_}else d=e[9],u=e[10],m=e[11],_=e[12];let f;e[13]!==d||e[14]!==u?(f=u.length>0&&o.jsx(Vp,{overflow:u,onSelect:d}),e[13]=d,e[14]=u,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Yp(t){const e=V.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=te("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(Ll,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function Xp(t){const e=V.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(lu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(au({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",className:"rounded-r-none border-r border-primary-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(dr,{className:"h-3.5 w-3.5"}),e[9]=d):d=e[9];let u;e[10]!==i?(u=o.jsx(ns,{asChild:!0,children:o.jsx(se,{size:"sm",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:d})}),e[10]=i,e[11]=u):u=e[11];let m;e[12]!==h?(m=o.jsx(os,{align:"end",children:o.jsx(yt,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==u||e[15]!==m?(_=o.jsxs(rs,{children:[u,m]}),e[14]=u,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const Jp=new Set(["failure","timed_out","cancelled","action_required"]);function Zp(t){return t.status==="completed"&&Jp.has(t.conclusion)}function Qp(t){return t.status==="queued"||t.status==="in_progress"}function eg(t){const{branchStatus:e,pr:s,checks:i,reviews:r}=t;if(!e)return null;if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Submit for review",action:"create-pr"}:null;if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen"};if(!s)return{label:"Submit for review",action:"create-pr"};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase"};const l=i.filter(Zp).map(h=>h.name);return l.length>0?{label:"Fix tests",action:"fix-checks",meta:{failingChecks:l}}:i.some(Qp)?{label:"Running tests…",disabled:!0}:r?.draft?{label:"Mark ready",action:"mark-ready"}:(r?.unresolvedConversations??0)>0?{label:"Address feedback",action:"resolve-comments"}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0}:{label:"Publish",action:"merge-split"}}return null}function tg(){return ms().branchStatus}const sg=6e4,ig=3e4;function rg(t){const e=V.c(11);let s;e[0]!==t.connectionId||e[1]!==t.orgId?(s={connectionId:t.connectionId,orgId:t.orgId},e[0]=t.connectionId,e[1]=t.orgId,e[2]=s):s=e[2];const i=Fe(s),r=t.prNumber??0;let n;e[3]!==t.owner||e[4]!==t.repo||e[5]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[3]=t.owner,e[4]=t.repo,e[5]=r,e[6]=n):n=e[6];const a=!!t.prNumber;let l;return e[7]!==i||e[8]!==n||e[9]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:sg,refetchIntervalInBackground:!1,staleTime:ig,select:ng},e[7]=i,e[8]=n,e[9]=a,e[10]=l):l=e[10],us(l)}function ng(t){const e=Ks(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function og(t){const e=V.c(38),{virtualMcpId:s}=t,{org:i}=Ce(),r=gt(s),{currentBranch:n}=lt(),a=wi(),l=r?.metadata?.githubRepo??null,h=tg(),c=l?.connectionId??"",d=l?.owner??"",u=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==c||e[2]!==d||e[3]!==u||e[4]!==m?(_={orgId:i.id,connectionId:c,owner:d,repo:u,branch:m},e[0]=i.id,e[1]=c,e[2]=d,e[3]=u,e[4]=m,e[5]=_):_=e[5];const p=Ra(_).data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[6]!==i.id||e[7]!==g||e[8]!==v||e[9]!==b||e[10]!==S?(x={orgId:i.id,connectionId:g,owner:v,repo:b,prNumber:S},e[6]=i.id,e[7]=g,e[8]=v,e[9]=b,e[10]=S,e[11]=x):x=e[11];const w=Ba(x),N=l?.connectionId??"",y=l?.owner??"",k=l?.name??"",j=p&&p.state==="open"?p.number:null;let B;e[12]!==i.id||e[13]!==N||e[14]!==y||e[15]!==k||e[16]!==j?(B={orgId:i.id,connectionId:N,owner:y,repo:k,prNumber:j},e[12]=i.id,e[13]=N,e[14]=y,e[15]=k,e[16]=j,e[17]=B):B=e[17];const D=rg(B);if(!l?.connectionId||!n)return null;let T;e[18]!==h||e[19]!==w.data||e[20]!==p||e[21]!==D.data?(T=eg({branchStatus:h,pr:p,checks:w.data??[],reviews:D.data??null}),e[18]=h,e[19]=w.data,e[20]=p,e[21]=D.data,e[22]=T):T=e[22];const C=T;if(!C)return null;let R;e[23]!==a?(R=M=>a.sendMessage({parts:[{type:"text",text:M}]}),e[23]=a,e[24]=R):R=e[24];const E=R,O=a.isStreaming;let z;e[25]!==n||e[26]!==C||e[27]!==O||e[28]!==p||e[29]!==E?(z=M=>{if(!O)switch(M){case"commit-and-push":{E(Qd({branch:n}));return}case"create-pr":{E(eu({branch:n}));return}case"reopen":{p&&E(tu({prNumber:p.number}));return}case"rebase":{E(su({branch:n}));return}case"fix-checks":{p&&E(ru({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(nu({prNumber:p.number}));return}case"resolve-comments":{p&&E(ou({prNumber:p.number}));return}case"merge-split":return}},e[25]=n,e[26]=C,e[27]=O,e[28]=p,e[29]=E,e[30]=z):z=e[30];const I=z;let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Yp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[31]=L):L=e[31];const $=p?.number;let F;return e[32]!==C||e[33]!==O||e[34]!==I||e[35]!==E||e[36]!==$?(F=o.jsxs(o.Fragment,{children:[L,o.jsx(ag,{button:C,isStreaming:O,onActivate:I,prNumber:$,send:E})]}),e[32]=C,e[33]=O,e[34]=I,e[35]=E,e[36]=$,e[37]=F):F=e[37],F}function ag(t){const e=V.c(18),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":null;if(s.action==="merge-split"&&t.prNumber!=null){let d;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(d=o.jsx(Xp,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=d):d=e[3];let u;return e[4]!==d||e[5]!==n?(u=o.jsx(zo,{label:n,children:d}),e[4]=d,e[5]=n,e[6]=u):u=e[6],u}const a=s.disabled?"outline":"default";let l;e[7]!==s.action||e[8]!==t?(l=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=l):l=e[9];let h;e[10]!==s.label||e[11]!==r||e[12]!==a||e[13]!==l?(h=o.jsx(se,{size:"sm",variant:a,disabled:r,onClick:l,children:s.label}),e[10]=s.label,e[11]=r,e[12]=a,e[13]=l,e[14]=h):h=e[14];let c;return e[15]!==h||e[16]!==n?(c=o.jsx(zo,{label:n,children:h}),e[15]=h,e[16]=n,e[17]=c):c=e[17],c}function zo(t){const e=V.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(zc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function lg(t){const e=V.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(lr.Right,{children:o.jsx(og,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Jt=A.createContext(null);function pn(){return A.use(Jt)}function $o(t){const e=V.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(je.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Na,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(Qt,{fallback:r,children:o.jsx(A.Suspense,{fallback:n,children:o.jsx(je.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Fo(t){const e=V.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],A.useLayoutEffect(r),null}function cg(t){const e=V.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Gl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Ho(t){const e=V.c(15),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=Ce(),{currentBranch:l}=lt(),{data:h}=Si.useSession(),c=h?.user?.id;let d;e[0]!==a.id?(d={connectionId:Bt,orgId:a.id},e[0]=a.id,e[1]=d):d=e[1];const u=Fe(d),{mutate:m}=sn(u);let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[2]=_):_=e[2];const f=A.useRef(_);let p,g;e[3]!==l||e[4]!==i||e[5]!==m||e[6]!==c||e[7]!==s||e[8]!==r?(p=()=>{i&&c&&l&&(r?.[c]?.[l]||f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:hg})))},g=[i,c,l,r,s,m],e[3]=l,e[4]=i,e[5]=m,e[6]=c,e[7]=s,e[8]=r,e[9]=p,e[10]=g):(p=e[9],g=e[10]),A.useEffect(p,g);const v=l??null;let b;return e[11]!==n||e[12]!==v||e[13]!==s?(b=o.jsx(Iu,{virtualMcpId:s,branch:v,children:n}),e[11]=n,e[12]=v,e[13]=s,e[14]=b):b=e[14],b}function hg(t){console.error("[auto-start-vm] failed:",t)}function dg(){const t=V.c(96),e=aa(),s=Mt(),{org:i}=Ce(),r=Tc()?.tasksOpen??!1;$c(i.id);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Ol(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Yr(h);let d;t[2]!==i.id||t[3]!==c.virtualmcpid?(d=c.virtualmcpid??Yo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=d):d=t[4];const u=d,m=kh(a.taskId??"",u),_=gt(u),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&It(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==u?(S={virtualMcpId:u,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=u,t[11]=S):S=t[11];const x=Dc(g,S),{setOpenMobile:w,openMobile:N}=Ac(),y=w,k=A.useRef(null);let j,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const K=G=>{Bc(G)&&G.shiftKey&&G.code==="KeyS"&&!G.repeat&&(G.preventDefault(),k.current?.())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},B=[],t[12]=j,t[13]=B):(j=t[12],B=t[13]),A.useEffect(j,B);const D=u;let T;t[14]!==_||t[15]!==u?(T={virtualMcpId:u,entity:_},t[14]=_,t[15]=u,t[16]=T):T=t[16];const C=T;if(m.status==="creating"||m.status==="loading"){let K;t[17]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Me,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=K):K=t[17];let G;return t[18]!==C?(G=o.jsx(Jt,{value:C,children:K}),t[18]=C,t[19]=G):G=t[19],G}if(m.status==="error"){let K;t[20]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=K):K=t[20];let G;t[21]!==m.error.message?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[K,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=G):G=t[22];let P;return t[23]!==C||t[24]!==G?(P=o.jsx(Jt,{value:C,children:G}),t[23]=C,t[24]=G,t[25]=P):P=t[25],P}if(!_){let K;t[26]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(as,{size:48,className:"text-muted-foreground"}),t[26]=K):K=t[26];const G=`The agent "${u}" does not exist in this organization.`;let P;t[27]!==s||t[28]!==l?(P=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=P):P=t[29];let Z;t[30]!==G||t[31]!==P?(Z=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ps,{image:K,title:"Agent not found",description:G,actions:P})})}),t[30]=G,t[31]=P,t[32]=Z):Z=t[32];let Y;return t[33]!==C||t[34]!==Z?(Y=o.jsx(Jt,{value:C,children:Z}),t[33]=C,t[34]=Z,t[35]=Y):Y=t[35],Y}if(e){let K;t[36]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Pc,{className:"sr-only",children:"Navigation"}),t[36]=K):K=t[36];let G;t[37]!==y?(G=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Rc,{onClose:()=>y(!1)})}),t[37]=y,t[38]=G):G=t[38];let P;t[39]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Mc,{})}),t[39]=P):P=t[39];let Z;t[40]!==G?(Z=o.jsxs(Lc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[K,o.jsxs("div",{className:"flex h-full",children:[G,P]})]}),t[40]=G,t[41]=Z):Z=t[41];let Y;t[42]!==N||t[43]!==y||t[44]!==Z?(Y=o.jsx(Oc,{open:N,onOpenChange:y,children:Z}),t[42]=N,t[43]=y,t[44]=Z,t[45]=Y):Y=t[45];const ee=Y,ce=_?.metadata?.vmMap;let ie;t[46]!==x.createNewTask?(ie=o.jsx(Fo,{onNewTaskRef:k,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ie):ie=t[47];let Q;t[48]!==y?(Q=o.jsx(cg,{onOpenSidebar:()=>y(!0)}),t[48]=y,t[49]=Q):Q=t[49];let he;t[50]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($o,{})}),t[50]=he):he=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==ce||t[54]!==ie||t[55]!==Q||t[56]!==u?(de=o.jsxs(Ho,{virtualMcpId:u,hasActiveGithubRepo:b,vmMap:ce,children:[ie,Q,he,ee]}),t[51]=b,t[52]=ee,t[53]=ce,t[54]=ie,t[55]=Q,t[56]=u,t[57]=de):de=t[57];let ue;t[58]!==D||t[59]!==de?(ue=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(je.Provider,{virtualMcpId:D,children:de},D)}),t[58]=D,t[59]=de,t[60]=ue):ue=t[60];let ye;return t[61]!==C||t[62]!==ue?(ye=o.jsx(Jt,{value:C,children:ue}),t[61]=C,t[62]=ue,t[63]=ye):ye=t[63],ye}const R=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==R?(E=o.jsx(lr.Toggles,{children:o.jsx(Fp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:R})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=R,t[67]=E):E=t[67];let O;t[68]!==x.taskId||t[69]!==u?(O=o.jsx(lr.Tabs,{children:o.jsx(Gp,{virtualMcpId:u,taskId:x.taskId})}),t[68]=x.taskId,t[69]=u,t[70]=O):O=t[70];const z=_?.metadata?.vmMap;let I;t[71]!==_?(I=o.jsx(lg,{virtualMcp:_}),t[71]=_,t[72]=I):I=t[72];let L;t[73]!==x.createNewTask?(L=o.jsx(Fo,{onNewTaskRef:k,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=L):L=t[74];let $;t[75]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx($o,{}),t[75]=$):$=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==u?(F=o.jsx($p,{virtualMcpId:u,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:$}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=u,t[80]=F):F=t[80];let M;t[81]!==b||t[82]!==z||t[83]!==I||t[84]!==L||t[85]!==F||t[86]!==u?(M=o.jsxs(Ho,{virtualMcpId:u,hasActiveGithubRepo:b,vmMap:z,children:[I,L,F]}),t[81]=b,t[82]=z,t[83]=I,t[84]=L,t[85]=F,t[86]=u,t[87]=M):M=t[87];let W;t[88]!==D||t[89]!==O||t[90]!==M?(W=o.jsxs(je.Provider,{virtualMcpId:D,children:[O,M]},D),t[88]=D,t[89]=O,t[90]=M,t[91]=W):W=t[91];let U;return t[92]!==C||t[93]!==E||t[94]!==W?(U=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Jt,{value:C,children:[E,W]})}),t[92]=C,t[93]=E,t[94]=W,t[95]=U):U=t[95],U}function g1(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(dg,{})}),t[0]=e):e=t[0],e}export{g1 as default,pn as useInsetContext};
189
+ </message>`}]}}))},I=e.models?.credentialId||_||"",L=e.models?.thinking?.id||f?.modelId||"",$=Vo({defaultValues:{name:e.name,active:e.active,credential_id:I,model_id:L}}),F=$.watch("active"),M=$.watch("credential_id"),W=$.watch("model_id"),{models:U,isLoading:K}=jc(M||void 0),G=U.find(ne=>ne.modelId===W)??null,P=A.useRef(null),Z=A.useRef(new Set),Y=A.useRef(0),ee=A.useRef(null),ce=3e4,ie=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),P.current!==null&&(Se("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(Z.current),save_count:Y.current,edit_duration_ms:Date.now()-P.current}),P.current=null,Z.current=new Set,Y.current=0)},Q=async()=>{if(!(Object.keys($.formState.dirtyFields).length>0)&&!E.current)return!0;const ve=Object.keys($.formState.dirtyFields),tt=E.current;E.current=!1;const _e=$.getValues(),Vt=O.current;try{const gs=_e.credential_id&&_e.model_id?_e.credential_id:"",X=_e.credential_id&&_e.model_id?_e.model_id:"",oe={id:t,name:_e.name,active:_e.active,agent:{id:n},models:{credentialId:gs,thinking:{id:X}},messages:Kl(Vt),temperature:0};await l.mutateAsync(oe),P.current===null&&(P.current=Date.now());for(const Ie of ve)Z.current.add(Ie);return tt&&Z.current.add("messages"),Y.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ie,ce),$.reset({..._e,credential_id:gs,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},he=A.useRef(Q);he.current=Q;const de=()=>{R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{R.current=null,he.current()},1e3)},ue=async()=>(R.current&&(clearTimeout(R.current),R.current=null),he.current()),ye=ne=>{if(O.current=ne,x(ne),!C.current){C.current=!0;return}E.current=!0,de()},Xe=A.useRef(!1);Xe.current||(Xe.current=!0,$.watch(()=>{de()})),A.useEffect(()=>()=>{R.current&&(clearTimeout(R.current),R.current=null,he.current())},[]);const He=async()=>{Se("automation_test_clicked",{automation_id:t,agent_id:n});const ne=await ue();if(ie(),!ne)return;if(!S){me.error("No instructions configured for this automation");return}G&&M&&m({...G,keyId:M}),v({...g,toolApprovalLevel:"auto"});const ve=xn(S);u({message:{tiptapDoc:S,parts:ve},virtualMcpId:n||void 0})};return o.jsxs(o.Fragment,{children:[i&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:i,children:[o.jsx(ka,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...$.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),r&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:r,children:o.jsx(hr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xt,{control:$.control,name:"active",render:({field:ne})=>o.jsx(cr,{checked:ne.value,onCheckedChange:ve=>{ne.onChange(ve),setTimeout(()=>ue(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ca,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(kp,{automationId:t,open:w,onOpenChange:N,onCustomSelect:()=>{k(!0),T(!1),B("")},onEventSelect:()=>{T(!0),k(!1)}})]}),e.triggers.length===0&&!y?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>N(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ne=>o.jsx(Np,{trigger:ne,automationId:t,connectionName:ne.connection_id?d.get(ne.connection_id):void 0},ne.id))}),y&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Rs,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:j,onChange:ne=>B(ne.target.value),onBlur:async()=>{const ne=j.trim();if(!(!ne||!Is(ne)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:ne}),Se("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),k(!1),B("")}catch{me.error("Failed to add starter")}},onKeyDown:async ne=>{const ve=j.trim();ne.key==="Enter"&&ve&&Is(ve)&&ne.target.blur(),ne.key==="Escape"&&(k(!1),B(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Is(j)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),h.isPending&&o.jsx(Me,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{k(!1),B("")},children:o.jsx(ls,{size:13})})]}),D&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Me,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Ep,{automationId:t,onDone:()=>T(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!S,onClick:z,children:[o.jsx(ya,{size:13}),"Improve"]})]}),o.jsx(Hl,{tiptapDoc:S,setTiptapDoc:ye,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Wl,{virtualMcpId:n||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(ph,{model:G,isLoading:K,credentialId:M||null,onCredentialChange:ne=>{$.setValue("credential_id",ne??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0})},onModelChange:ne=>$.setValue("model_id",ne.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:He,disabled:!n,children:[o.jsx(Ql,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function Bp(t){const e=V.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=Zo(s),e[0]=s,e[1]=r):r=e[1];const n=r;if(!n)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==n.id||e[4]!==i?(l=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(A.Suspense,{fallback:a,children:o.jsx(Ip,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function Ip(t){const e=V.c(9),{id:s,virtualMcpId:i}=t,r=Mt(),{data:n,isLoading:a}=vh(s);let l;e[0]!==r?(l=()=>r({to:".",search:Ap,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=d):d=e[2],d}if(!n){let d;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=d):d=e[3],d}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Mp,{automationId:s,automation:n,virtualMcpId:i,onBack:h}),e[4]=n,e[5]=s,e[6]=h,e[7]=i,e[8]=c):c=e[8],c}function Ap(t){return{...t,main:"automations"}}function Pp(t){const e=V.c(20),{virtualMcpId:s}=t,i=Mt(),{data:r}=xh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=A.useState(""),c=l.toLowerCase(),d=n.filter(B=>B.name.toLowerCase().includes(c));let u;e[0]!==i?(u=B=>i({to:".",search:D=>({...D,main:"automation:"+B}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const m=u,_=async()=>{if(a.isPending)return;Se("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const B=await a.mutateAsync(Sh(s));m(B.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(yh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let w;e[7]!==b||e[8]!==x?(w=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=w):w=e[9];const N=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):d.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(B=>o.jsx(bh,{automation:B,onClick:()=>m(B.id)},B.id))});let y;e[10]!==N||e[11]!==g.Body||e[12]!==w?(y=o.jsxs(g.Body,{children:[w,N]}),e[10]=N,e[11]=g.Body,e[12]=w,e[13]=y):y=e[13];let k;e[14]!==y||e[15]!==p.Content?(k=o.jsx(p.Content,{children:y}),e[14]=y,e[15]=p.Content,e[16]=k):k=e[16];let j;return e[17]!==f||e[18]!==k?(j=o.jsx(f,{children:k}),e[17]=f,e[18]=k,e[19]=j):j=e[19],j}function Lp(t){const e=V.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx(Pp,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Lo=A.lazy(()=>Pl(()=>import("./project-app-view-BL-P3zUl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Op(t){const e=V.c(44),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Ta(r);if(nc(n)){let f;return e[3]!==i?(f=o.jsx(zn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(xu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Lp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(xp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(ef,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n||e[14]!==i?(f=o.jsx(Bp,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=oc(n),e[16]=n,e[17]=c):c=e[17];const d=c;if(d){let f;if(e[18]!==l||e[19]!==d.connectionId||e[20]!==d.toolName){let S;e[22]!==d.connectionId||e[23]!==d.toolName?(S=x=>x.appId===d.connectionId&&x.toolName===d.toolName,e[22]=d.connectionId,e[23]=d.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=d.connectionId,e[20]=d.toolName,e[21]=f}else f=e[21];const p=f;let g;e[25]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[25]=g):g=e[25];const v=p?.args;let b;return e[26]!==n||e[27]!==d.connectionId||e[28]!==d.toolName||e[29]!==v?(b=o.jsx(A.Suspense,{fallback:g,children:o.jsx(Lo,{connectionId:d.connectionId,toolName:d.toolName,args:v},n)}),e[26]=n,e[27]=d.connectionId,e[28]=d.toolName,e[29]=v,e[30]=b):b=e[30],b}let u;if(e[31]!==n||e[32]!==a){let f;e[34]!==n?(f=p=>p.id===n,e[34]=n,e[35]=f):f=e[35],u=a.find(f),e[31]=n,e[32]=a,e[33]=u}else u=e[33];const m=u;if(m){let f;e[36]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),e[36]=f):f=e[36];let p;return e[37]!==n||e[38]!==m.id||e[39]!==m.view.appId||e[40]!==m.view.args?(p=o.jsx(A.Suspense,{fallback:f,children:o.jsx(Lo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[37]=n,e[38]=m.id,e[39]=m.view.appId,e[40]=m.view.args,e[41]=p):p=e[41],p}let _;return e[42]!==i?(_=o.jsx(zn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function zp(t){const e=V.c(7),{children:s,defaultSize:i}=t,[,r]=A.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Go.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=qo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const d=c;let u;return e[3]!==s||e[4]!==h||e[5]!==d?(u=o.jsx(la,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:d,order:1,children:s}),e[3]=s,e[4]=h,e[5]=d,e[6]=u):u=e[6],u}function $p(t){const e=V.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=En(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Go.decoChatPanelWidth(),e[3]=c):c=e[3];const[d]=qo(c,45),u=A.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==d?(m=()=>{const B=u.current;if(!B)return;const D=En(r,n),T=D.chat>0&&D.chat<100?d:D.chat,C=D.chat>0&&D.chat<100?100-d:D.main;B.setLayout([T,C])},_=[r,n,d],e[4]=r,e[5]=n,e[6]=d,e[7]=m,e[8]=_):(m=e[7],_=e[8]),A.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Na,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(zp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Vc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=te("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=N):N=e[19];let y;e[20]!==i||e[21]!==s?(y=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:N,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Op,{taskId:i,virtualMcpId:s})})})}),e[20]=i,e[21]=s,e[22]=y):y=e[22];let k;e[23]!==h.main||e[24]!==y?(k=o.jsx(la,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:y}),e[23]=h.main,e[24]=y,e[25]=k):k=e[25];let j;return e[26]!==k||e[27]!==f||e[28]!==b?(j=o.jsxs(Kc,{ref:u,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,k]},f),e[26]=k,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const nr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Oo="bg-sidebar-accent text-sidebar-foreground",or="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Fp(t){const e=V.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Ec(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{Se("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?Oo:or;let d;e[3]!==c?(d=te(nr,c),e[3]=c,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(wc,{size:16}),e[5]=u):u=e[5];let m;e[6]!==h||e[7]!==d||e[8]!==n?(m=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:d,children:u})}),e[6]=h,e[7]=d,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ve,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{Se("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?Oo:or;let v;e[16]!==g?(v=te(nr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Cc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==S?(w=o.jsxs(Ve,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=w):w=e[25];const N=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let y;e[26]!==N?(y=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",N),e[26]=N,e[27]=y):y=e[27];const k=!l,j=l?0:-1,B=!l,D=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let T;e[28]!==D?(T=te(nr,or,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",D),e[28]=D,e[29]=T):T=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ta,{size:16}),e[30]=C):C=e[30];let R;e[31]!==r||e[32]!==k||e[33]!==j||e[34]!==B||e[35]!==T?(R=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:k,tabIndex:j,"aria-hidden":B,className:T,children:C})}),e[31]=r,e[32]=k,e[33]=j,e[34]=B,e[35]=T,e[36]=R):R=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let O;e[38]!==R?(O=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[R,E]})}),e[38]=R,e[39]=O):O=e[39];let z;e[40]!==y||e[41]!==O?(z=o.jsx("div",{className:y,children:O}),e[40]=y,e[41]=O,e[42]=z):z=e[42];let I;return e[43]!==w||e[44]!==z||e[45]!==f?(I=o.jsxs(o.Fragment,{children:[f,w,z]}),e[43]=w,e[44]=z,e[45]=f,e[46]=I):I=e[46],I}function Hp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(u=>u.id===e))return{visible:i,overflow:r};const a=r.findIndex(u=>u.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],d=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:d}}function Wp(t){const e=V.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=te("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Up,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(d=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=d):d=e[12],d}function Up(t){const e=V.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(oa,{className:"size-4"}),e[4]=i):i=e[4],i}function Vp(t){const e=V.c(13),{overflow:s,onSelect:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ia,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Kp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let d;e[8]!==c?(d=o.jsx(Ws,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,d]}),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}function Kp(t){const e=V.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(oa,{className:"size-4"}),e[4]=i):i=e[4],i}const qp=6;function Gp(t){const e=V.c(20),{virtualMcpId:s,taskId:i}=t,r=Mt();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Ta(n);let d,u,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=ac({activeTab:l,mainOpen:h}),v=N=>N.id==="automations"?g:h&&N.id===l,S=a.find(N=>v(N))?.id??null,{visible:x,overflow:w}=Hp(a,S,qp);u=w,d=N=>{const y=a.find(j=>j.id===N),k=S===N&&h;if(Se("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:N,tab_kind:y?.kind??null,was_active:k}),N==="automations"){const j=lc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:j}),replace:!0});return}c(N)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(N=>o.jsx(Wp,{title:N.title,icon:N.icon,active:v(N),onClick:()=>d(N.id)},N.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=d,e[10]=u,e[11]=m,e[12]=_}else d=e[9],u=e[10],m=e[11],_=e[12];let f;e[13]!==d||e[14]!==u?(f=u.length>0&&o.jsx(Vp,{overflow:u,onSelect:d}),e[13]=d,e[14]=u,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Yp(t){const e=V.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=te("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(Ll,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function Xp(t){const e=V.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(lu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(au({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",className:"rounded-r-none border-r border-primary-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(dr,{className:"h-3.5 w-3.5"}),e[9]=d):d=e[9];let u;e[10]!==i?(u=o.jsx(ns,{asChild:!0,children:o.jsx(se,{size:"sm",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:d})}),e[10]=i,e[11]=u):u=e[11];let m;e[12]!==h?(m=o.jsx(os,{align:"end",children:o.jsx(yt,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==u||e[15]!==m?(_=o.jsxs(rs,{children:[u,m]}),e[14]=u,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const Jp=new Set(["failure","timed_out","cancelled","action_required"]);function Zp(t){return t.status==="completed"&&Jp.has(t.conclusion)}function Qp(t){return t.status==="queued"||t.status==="in_progress"}function eg(t){const{branchStatus:e,pr:s,checks:i,reviews:r}=t;if(!e)return null;if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Submit for review",action:"create-pr"}:null;if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen"};if(!s)return{label:"Submit for review",action:"create-pr"};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase"};const l=i.filter(Zp).map(h=>h.name);return l.length>0?{label:"Fix tests",action:"fix-checks",meta:{failingChecks:l}}:i.some(Qp)?{label:"Running tests…",disabled:!0}:r?.draft?{label:"Mark ready",action:"mark-ready"}:(r?.unresolvedConversations??0)>0?{label:"Address feedback",action:"resolve-comments"}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0}:{label:"Publish",action:"merge-split"}}return null}function tg(){return ms().branchStatus}const sg=6e4,ig=3e4;function rg(t){const e=V.c(11);let s;e[0]!==t.connectionId||e[1]!==t.orgId?(s={connectionId:t.connectionId,orgId:t.orgId},e[0]=t.connectionId,e[1]=t.orgId,e[2]=s):s=e[2];const i=Fe(s),r=t.prNumber??0;let n;e[3]!==t.owner||e[4]!==t.repo||e[5]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[3]=t.owner,e[4]=t.repo,e[5]=r,e[6]=n):n=e[6];const a=!!t.prNumber;let l;return e[7]!==i||e[8]!==n||e[9]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:sg,refetchIntervalInBackground:!1,staleTime:ig,select:ng},e[7]=i,e[8]=n,e[9]=a,e[10]=l):l=e[10],us(l)}function ng(t){const e=Ks(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function og(t){const e=V.c(38),{virtualMcpId:s}=t,{org:i}=Ce(),r=gt(s),{currentBranch:n}=lt(),a=wi(),l=r?.metadata?.githubRepo??null,h=tg(),c=l?.connectionId??"",d=l?.owner??"",u=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==c||e[2]!==d||e[3]!==u||e[4]!==m?(_={orgId:i.id,connectionId:c,owner:d,repo:u,branch:m},e[0]=i.id,e[1]=c,e[2]=d,e[3]=u,e[4]=m,e[5]=_):_=e[5];const p=Ra(_).data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[6]!==i.id||e[7]!==g||e[8]!==v||e[9]!==b||e[10]!==S?(x={orgId:i.id,connectionId:g,owner:v,repo:b,prNumber:S},e[6]=i.id,e[7]=g,e[8]=v,e[9]=b,e[10]=S,e[11]=x):x=e[11];const w=Ba(x),N=l?.connectionId??"",y=l?.owner??"",k=l?.name??"",j=p&&p.state==="open"?p.number:null;let B;e[12]!==i.id||e[13]!==N||e[14]!==y||e[15]!==k||e[16]!==j?(B={orgId:i.id,connectionId:N,owner:y,repo:k,prNumber:j},e[12]=i.id,e[13]=N,e[14]=y,e[15]=k,e[16]=j,e[17]=B):B=e[17];const D=rg(B);if(!l?.connectionId||!n)return null;let T;e[18]!==h||e[19]!==w.data||e[20]!==p||e[21]!==D.data?(T=eg({branchStatus:h,pr:p,checks:w.data??[],reviews:D.data??null}),e[18]=h,e[19]=w.data,e[20]=p,e[21]=D.data,e[22]=T):T=e[22];const C=T;if(!C)return null;let R;e[23]!==a?(R=M=>a.sendMessage({parts:[{type:"text",text:M}]}),e[23]=a,e[24]=R):R=e[24];const E=R,O=a.isStreaming;let z;e[25]!==n||e[26]!==C||e[27]!==O||e[28]!==p||e[29]!==E?(z=M=>{if(!O)switch(M){case"commit-and-push":{E(Qd({branch:n}));return}case"create-pr":{E(eu({branch:n}));return}case"reopen":{p&&E(tu({prNumber:p.number}));return}case"rebase":{E(su({branch:n}));return}case"fix-checks":{p&&E(ru({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(nu({prNumber:p.number}));return}case"resolve-comments":{p&&E(ou({prNumber:p.number}));return}case"merge-split":return}},e[25]=n,e[26]=C,e[27]=O,e[28]=p,e[29]=E,e[30]=z):z=e[30];const I=z;let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Yp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[31]=L):L=e[31];const $=p?.number;let F;return e[32]!==C||e[33]!==O||e[34]!==I||e[35]!==E||e[36]!==$?(F=o.jsxs(o.Fragment,{children:[L,o.jsx(ag,{button:C,isStreaming:O,onActivate:I,prNumber:$,send:E})]}),e[32]=C,e[33]=O,e[34]=I,e[35]=E,e[36]=$,e[37]=F):F=e[37],F}function ag(t){const e=V.c(18),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":null;if(s.action==="merge-split"&&t.prNumber!=null){let d;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(d=o.jsx(Xp,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=d):d=e[3];let u;return e[4]!==d||e[5]!==n?(u=o.jsx(zo,{label:n,children:d}),e[4]=d,e[5]=n,e[6]=u):u=e[6],u}const a=s.disabled?"outline":"default";let l;e[7]!==s.action||e[8]!==t?(l=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=l):l=e[9];let h;e[10]!==s.label||e[11]!==r||e[12]!==a||e[13]!==l?(h=o.jsx(se,{size:"sm",variant:a,disabled:r,onClick:l,children:s.label}),e[10]=s.label,e[11]=r,e[12]=a,e[13]=l,e[14]=h):h=e[14];let c;return e[15]!==h||e[16]!==n?(c=o.jsx(zo,{label:n,children:h}),e[15]=h,e[16]=n,e[17]=c):c=e[17],c}function zo(t){const e=V.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(zc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function lg(t){const e=V.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(lr.Right,{children:o.jsx(og,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Jt=A.createContext(null);function pn(){return A.use(Jt)}function $o(t){const e=V.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(je.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Na,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(Qt,{fallback:r,children:o.jsx(A.Suspense,{fallback:n,children:o.jsx(je.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Fo(t){const e=V.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],A.useLayoutEffect(r),null}function cg(t){const e=V.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Gl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Ho(t){const e=V.c(15),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=Ce(),{currentBranch:l}=lt(),{data:h}=Si.useSession(),c=h?.user?.id;let d;e[0]!==a.id?(d={connectionId:Bt,orgId:a.id},e[0]=a.id,e[1]=d):d=e[1];const u=Fe(d),{mutate:m}=sn(u);let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[2]=_):_=e[2];const f=A.useRef(_);let p,g;e[3]!==l||e[4]!==i||e[5]!==m||e[6]!==c||e[7]!==s||e[8]!==r?(p=()=>{i&&c&&l&&(r?.[c]?.[l]||f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:hg})))},g=[i,c,l,r,s,m],e[3]=l,e[4]=i,e[5]=m,e[6]=c,e[7]=s,e[8]=r,e[9]=p,e[10]=g):(p=e[9],g=e[10]),A.useEffect(p,g);const v=l??null;let b;return e[11]!==n||e[12]!==v||e[13]!==s?(b=o.jsx(Iu,{virtualMcpId:s,branch:v,children:n}),e[11]=n,e[12]=v,e[13]=s,e[14]=b):b=e[14],b}function hg(t){console.error("[auto-start-vm] failed:",t)}function dg(){const t=V.c(96),e=aa(),s=Mt(),{org:i}=Ce(),r=Tc()?.tasksOpen??!1;$c(i.id);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Ol(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Yr(h);let d;t[2]!==i.id||t[3]!==c.virtualmcpid?(d=c.virtualmcpid??Yo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=d):d=t[4];const u=d,m=kh(a.taskId??"",u),_=gt(u),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&It(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==u?(S={virtualMcpId:u,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=u,t[11]=S):S=t[11];const x=Dc(g,S),{setOpenMobile:w,openMobile:N}=Ac(),y=w,k=A.useRef(null);let j,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const K=G=>{Bc(G)&&G.shiftKey&&G.code==="KeyS"&&!G.repeat&&(G.preventDefault(),k.current?.())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},B=[],t[12]=j,t[13]=B):(j=t[12],B=t[13]),A.useEffect(j,B);const D=u;let T;t[14]!==_||t[15]!==u?(T={virtualMcpId:u,entity:_},t[14]=_,t[15]=u,t[16]=T):T=t[16];const C=T;if(m.status==="creating"||m.status==="loading"){let K;t[17]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Me,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=K):K=t[17];let G;return t[18]!==C?(G=o.jsx(Jt,{value:C,children:K}),t[18]=C,t[19]=G):G=t[19],G}if(m.status==="error"){let K;t[20]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=K):K=t[20];let G;t[21]!==m.error.message?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[K,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=G):G=t[22];let P;return t[23]!==C||t[24]!==G?(P=o.jsx(Jt,{value:C,children:G}),t[23]=C,t[24]=G,t[25]=P):P=t[25],P}if(!_){let K;t[26]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(as,{size:48,className:"text-muted-foreground"}),t[26]=K):K=t[26];const G=`The agent "${u}" does not exist in this organization.`;let P;t[27]!==s||t[28]!==l?(P=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=P):P=t[29];let Z;t[30]!==G||t[31]!==P?(Z=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ps,{image:K,title:"Agent not found",description:G,actions:P})})}),t[30]=G,t[31]=P,t[32]=Z):Z=t[32];let Y;return t[33]!==C||t[34]!==Z?(Y=o.jsx(Jt,{value:C,children:Z}),t[33]=C,t[34]=Z,t[35]=Y):Y=t[35],Y}if(e){let K;t[36]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Pc,{className:"sr-only",children:"Navigation"}),t[36]=K):K=t[36];let G;t[37]!==y?(G=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Rc,{onClose:()=>y(!1)})}),t[37]=y,t[38]=G):G=t[38];let P;t[39]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Mc,{})}),t[39]=P):P=t[39];let Z;t[40]!==G?(Z=o.jsxs(Lc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[K,o.jsxs("div",{className:"flex h-full",children:[G,P]})]}),t[40]=G,t[41]=Z):Z=t[41];let Y;t[42]!==N||t[43]!==y||t[44]!==Z?(Y=o.jsx(Oc,{open:N,onOpenChange:y,children:Z}),t[42]=N,t[43]=y,t[44]=Z,t[45]=Y):Y=t[45];const ee=Y,ce=_?.metadata?.vmMap;let ie;t[46]!==x.createNewTask?(ie=o.jsx(Fo,{onNewTaskRef:k,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ie):ie=t[47];let Q;t[48]!==y?(Q=o.jsx(cg,{onOpenSidebar:()=>y(!0)}),t[48]=y,t[49]=Q):Q=t[49];let he;t[50]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($o,{})}),t[50]=he):he=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==ce||t[54]!==ie||t[55]!==Q||t[56]!==u?(de=o.jsxs(Ho,{virtualMcpId:u,hasActiveGithubRepo:b,vmMap:ce,children:[ie,Q,he,ee]}),t[51]=b,t[52]=ee,t[53]=ce,t[54]=ie,t[55]=Q,t[56]=u,t[57]=de):de=t[57];let ue;t[58]!==D||t[59]!==de?(ue=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(je.Provider,{virtualMcpId:D,children:de},D)}),t[58]=D,t[59]=de,t[60]=ue):ue=t[60];let ye;return t[61]!==C||t[62]!==ue?(ye=o.jsx(Jt,{value:C,children:ue}),t[61]=C,t[62]=ue,t[63]=ye):ye=t[63],ye}const R=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==R?(E=o.jsx(lr.Toggles,{children:o.jsx(Fp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:R})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=R,t[67]=E):E=t[67];let O;t[68]!==x.taskId||t[69]!==u?(O=o.jsx(lr.Tabs,{children:o.jsx(Gp,{virtualMcpId:u,taskId:x.taskId})}),t[68]=x.taskId,t[69]=u,t[70]=O):O=t[70];const z=_?.metadata?.vmMap;let I;t[71]!==_?(I=o.jsx(lg,{virtualMcp:_}),t[71]=_,t[72]=I):I=t[72];let L;t[73]!==x.createNewTask?(L=o.jsx(Fo,{onNewTaskRef:k,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=L):L=t[74];let $;t[75]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx($o,{}),t[75]=$):$=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==u?(F=o.jsx($p,{virtualMcpId:u,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:$}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=u,t[80]=F):F=t[80];let M;t[81]!==b||t[82]!==z||t[83]!==I||t[84]!==L||t[85]!==F||t[86]!==u?(M=o.jsxs(Ho,{virtualMcpId:u,hasActiveGithubRepo:b,vmMap:z,children:[I,L,F]}),t[81]=b,t[82]=z,t[83]=I,t[84]=L,t[85]=F,t[86]=u,t[87]=M):M=t[87];let W;t[88]!==D||t[89]!==O||t[90]!==M?(W=o.jsxs(je.Provider,{virtualMcpId:D,children:[O,M]},D),t[88]=D,t[89]=O,t[90]=M,t[91]=W):W=t[91];let U;return t[92]!==C||t[93]!==E||t[94]!==W?(U=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Jt,{value:C,children:[E,W]})}),t[92]=C,t[93]=E,t[94]=W,t[95]=U):U=t[95],U}function g1(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Me,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(dg,{})}),t[0]=e):e=t[0],e}export{g1 as default,pn as useInsetContext};