decocms 2.304.7 → 2.304.8

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 (255) hide show
  1. package/dist/client/assets/{AlertCircle-D2CfiqIb.js → AlertCircle-CGS7SlNZ.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-DbvZvWo_.js → ArrowNarrowLeft-BvcKCPPt.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-C4097qeP.js → ArrowUpRight-BfE23c8s.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DzPOiS7f.js → CheckCircle-DQGoPzYM.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-nbfYLv74.js → ChevronDown-Dle378FN.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-BMU5pFO3.js → ChevronRight-BwTBPBXD.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-DYWpqTMs.js → ChevronUp-DOPSv7Jo.js} +1 -1
  8. package/dist/client/assets/{Container-BExsAw1Y.js → Container-Bjdb96SI.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-vQJr-cQl.js → DotsVertical-BuAzAdDZ.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CIznTcjx.js → LinkExternal01-ryVwfw5_.js} +1 -1
  11. package/dist/client/assets/{Lock01-_cHNYwVm.js → Lock01-D9gVlZ3n.js} +1 -1
  12. package/dist/client/assets/{Palette-CpHUCWb_.js → Palette-1qL25a9u.js} +1 -1
  13. package/dist/client/assets/{Play-P-JNZi6M.js → Play-C6odCWa1.js} +1 -1
  14. package/dist/client/assets/{Plus-UMVRoN9P.js → Plus-CGctI5qa.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-DImxDs2M.js → RefreshCcw01-DlTzZS8a.js} +1 -1
  16. package/dist/client/assets/{SearchMd-BZgC3RwY.js → SearchMd-JWdfIDAa.js} +1 -1
  17. package/dist/client/assets/{Settings02-DsZ22GF2.js → Settings02-DtwFPoYp.js} +1 -1
  18. package/dist/client/assets/{Shield01-DSdOF02b.js → Shield01-Dj1UOyDV.js} +1 -1
  19. package/dist/client/assets/{Star01-B5DJ8WSO.js → Star01-CxLxZthD.js} +1 -1
  20. package/dist/client/assets/{Sun-DwLarfIS.js → Sun-D1drbPvR.js} +1 -1
  21. package/dist/client/assets/{Tool01-BYbeRyP1.js → Tool01-Cj173b_Q.js} +1 -1
  22. package/dist/client/assets/{Trash01-XaVufWhG.js → Trash01-DmugmVtH.js} +1 -1
  23. package/dist/client/assets/{User01-DOEJf7_z.js → User01-DNfbm8LW.js} +1 -1
  24. package/dist/client/assets/{Users03-BDvrLgkH.js → Users03-BAiUjF-1.js} +1 -1
  25. package/dist/client/assets/{X-80NRAfnw.js → X-DqLs9vpH.js} +1 -1
  26. package/dist/client/assets/{XCircle-BEAFTgYK.js → XCircle-D_4uFiCh.js} +1 -1
  27. package/dist/client/assets/{XClose-DWbPt4W1.js → XClose-Rxztrnzf.js} +1 -1
  28. package/dist/client/assets/{Zap-DJ-5nwQH.js → Zap-DCSjpSJ7.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-CUSW7lK1.js → ZapSquare-Dzrt3oay.js} +1 -1
  30. package/dist/client/assets/{accordion-Cs5A2mwd.js → accordion-UDoYmaIB.js} +1 -1
  31. package/dist/client/assets/{agent-icon-CNwr7nQ6.js → agent-icon-CL45Wifm.js} +1 -1
  32. package/dist/client/assets/{agents-list-DbYzBYNO.js → agents-list-C8LXqbnr.js} +1 -1
  33. package/dist/client/assets/ai-providers-DjpPn0iI.js +1 -0
  34. package/dist/client/assets/{alert-dialog-CjZ_yEsA.js → alert-dialog-Cs2lf0wi.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-C25SUnt0.js → auth-catchall-DGnDQLN0.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-wACLbSFs.js → automation-list-row-7DtUnIlg.js} +1 -1
  37. package/dist/client/assets/{automations-M3aSI6qo.js → automations-CWt4GOLz.js} +1 -1
  38. package/dist/client/assets/{avatar-VfK9F8Gm.js → avatar-BcGOvZ9P.js} +1 -1
  39. package/dist/client/assets/{badge-BJCa3Rup.js → badge-Cpo1XmAx.js} +1 -1
  40. package/dist/client/assets/{brand-context-DgCqovd4.js → brand-context-COazQM8-.js} +1 -1
  41. package/dist/client/assets/{card-iIHVwReR.js → card-ChPTWuEz.js} +1 -1
  42. package/dist/client/assets/{chat-context-BTZrU_bp.js → chat-context-B5mCE2Dl.js} +1 -1
  43. package/dist/client/assets/{checkbox-pdr67-6J.js → checkbox-CgeI-KLu.js} +1 -1
  44. package/dist/client/assets/{collection-detail-BEYnuLnN.js → collection-detail-Bx_h9wvL.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-DxpSOd3z.js → collection-display-button-DMRYWpDV.js} +1 -1
  46. package/dist/client/assets/{collection-search-DGbMy7UX.js → collection-search-CvOZQgZf.js} +1 -1
  47. package/dist/client/assets/{collection-search-DzHZlyRO.js → collection-search-Xsvaup1l.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-mfnrIfln.js → collection-table-wrapper-CovgsN3b.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-CUM5pTIq.js → collection-tabs-CeSeUpFD.js} +1 -1
  50. package/dist/client/assets/{collections-CPizzQEO.js → collections-BgKSt6n0.js} +1 -1
  51. package/dist/client/assets/{command-xCX5Hjh8.js → command-Cwx2tkAC.js} +1 -1
  52. package/dist/client/assets/{connection-card-BH_OVnZ0.js → connection-card-BBgrlkNf.js} +1 -1
  53. package/dist/client/assets/{connection-detail-BoLTCviP.js → connection-detail-BujhlI5m.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-CDFSSkBK.js → connection-form-helpers-1Nu4mg1N.js} +1 -1
  55. package/dist/client/assets/{connections-uq0w2h-m.js → connections-_If2WcK2.js} +1 -1
  56. package/dist/client/assets/{constants-Cir84GoX.js → constants-BBeVlOcv.js} +1 -1
  57. package/dist/client/assets/{constants-CL9Yh3jE.js → constants-DWJv5284.js} +1 -1
  58. package/dist/client/assets/{dialog-BY7V3l1b.js → dialog-o_JVdycy.js} +1 -1
  59. package/dist/client/assets/{domain-settings-CY-m55Yf.js → domain-settings-CbIxe1dN.js} +1 -1
  60. package/dist/client/assets/{drawer-CF_GY3GP.js → drawer-DuBsYQy-.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-CZKqA1eF.js → dropdown-menu-NLdCnhe2.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-vv0w1X_h.js → dynamic-plugin-layout-BePmHsM5.js} +1 -1
  63. package/dist/client/assets/{empty-state-B6o1wtCI.js → empty-state-BNIqiqmO.js} +1 -1
  64. package/dist/client/assets/{empty-state-C50VMolH.js → empty-state-CS7vMz-S.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-CXgcXDyg.js → extract-connection-data-C1rFp-EK.js} +1 -1
  66. package/dist/client/assets/{features-CKpfzOBb.js → features-C8abN4ke.js} +1 -1
  67. package/dist/client/assets/{form-Bqxj9UR_.js → form-DYhJizGS.js} +1 -1
  68. package/dist/client/assets/{general-08k-NPRS.js → general-BDubresg.js} +1 -1
  69. package/dist/client/assets/{index-CC-8lukI.js → index-BAEkPxc0.js} +1 -1
  70. package/dist/client/assets/{index-C6PH122m.js → index-BH7Qrxij.js} +1 -1
  71. package/dist/client/assets/{index-DTFrJfZ5.js → index-BRC1FK7F.js} +1 -1
  72. package/dist/client/assets/{index-B3-v3ay0.js → index-BnnTf_Sd.js} +1 -1
  73. package/dist/client/assets/{index-lG8RrDCk.js → index-BtuZ6g--.js} +1 -1
  74. package/dist/client/assets/{index-CWBm8dkR.js → index-BxjSTUlr.js} +1 -1
  75. package/dist/client/assets/{index-OL4lmhJr.js → index-C-CxSS2X.js} +1 -1
  76. package/dist/client/assets/{index-UnY-zvRC.js → index-C9M4Xv-S.js} +2 -2
  77. package/dist/client/assets/{index-C6PkFaxl.js → index-C9Z9u1Tw.js} +1 -1
  78. package/dist/client/assets/{index-QzcyPSZ1.js → index-CV-Szw_N.js} +1 -1
  79. package/dist/client/assets/{index-DW5-Qpk8.js → index-D8ndbAa3.js} +1 -1
  80. package/dist/client/assets/index-DseuXjGf.js +1 -0
  81. package/dist/client/assets/{index-CpEh11mD.js → index-KkQYgVnb.js} +1 -1
  82. package/dist/client/assets/{index-CvfgmSHb.js → index-QdTc2-Rk.js} +1 -1
  83. package/dist/client/assets/{index-D3YEAKgK.js → index-lGyUFz6v.js} +1 -1
  84. package/dist/client/assets/{index-DSTE_mKl.js → index-qcF-nEjv.js} +3 -3
  85. package/dist/client/assets/{infiniteQueryObserver-Dx_FFlyw.js → infiniteQueryObserver-CrM8xD0J.js} +1 -1
  86. package/dist/client/assets/{input-D6bqiRsc.js → input-D7aJNH3r.js} +1 -1
  87. package/dist/client/assets/{integration-icon-Czloo5aB.js → integration-icon-CikcQgPA.js} +1 -1
  88. package/dist/client/assets/{label-OH00Bm2e.js → label-nMjNWeer.js} +1 -1
  89. package/dist/client/assets/{layout-B8grH51l.js → layout-BdrWRcCU.js} +1 -1
  90. package/dist/client/assets/{lean-canvas-recruit-modal-D3uOPj7B.js → lean-canvas-recruit-modal-D2NK3tQ5.js} +1 -1
  91. package/dist/client/assets/{login-BIRsXm68.js → login-7TTbEZ4g.js} +1 -1
  92. package/dist/client/assets/{members-CpgyEKOu.js → members-d5KexfoH.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-CCm4ijBh.js → monaco-editor-B6okB9o3.js} +1 -1
  94. package/dist/client/assets/{monitoring-stats-row-BI6rRgmE.js → monitoring-stats-row-BP9UqHTj.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-DzeQ4ct_.js → oauth-callback-DdD8wzEd.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-ai-provider-D0xvnKC5.js → oauth-callback-ai-provider-Eo5vnDNg.js} +1 -1
  97. package/dist/client/assets/{onboarding-9fXXhsXI.js → onboarding-Btum00Ln.js} +1 -1
  98. package/dist/client/assets/{org-layout-DVzQC_Yi.js → org-layout-o44AzcTB.js} +1 -1
  99. package/dist/client/assets/{org-plugin-layout-DNF-iC79.js → org-plugin-layout-BQQN1snQ.js} +1 -1
  100. package/dist/client/assets/{pair-Dnl7WYnw.js → pair-D6t7TZZY.js} +1 -1
  101. package/dist/client/assets/{plugin-empty-state-DHJl5jI3.js → plugin-empty-state-v3unt4A_.js} +1 -1
  102. package/dist/client/assets/{plugin-header-CKGimWCh.js → plugin-header-C5hJY-bG.js} +1 -1
  103. package/dist/client/assets/{plugin-layout-BHyhXQOZ.js → plugin-layout-ByjMXE2_.js} +1 -1
  104. package/dist/client/assets/{popover-BdA1Au4C.js → popover-DvYGtEfv.js} +1 -1
  105. package/dist/client/assets/{profile-Bl2GSS8s.js → profile-bhSlw_hZ.js} +1 -1
  106. package/dist/client/assets/{project-app-view-BKdpoQ4z.js → project-app-view-C5KFZJmQ.js} +1 -1
  107. package/dist/client/assets/registry-CDWfMNhx.js +2 -0
  108. package/dist/client/assets/{registry-layout-C7UuH9A8.js → registry-layout-BjTa2Fez.js} +1 -1
  109. package/dist/client/assets/{required-auth-layout-DyXOjWp0.js → required-auth-layout-B-n0CRtk.js} +1 -1
  110. package/dist/client/assets/{reset-password-DFyOjTrX.js → reset-password-CVmoiZSn.js} +1 -1
  111. package/dist/client/assets/{roles-BBiEMyt9.js → roles-DOvgAdNt.js} +1 -1
  112. package/dist/client/assets/{scroll-area-BtYccAiz.js → scroll-area-C9jltrVR.js} +1 -1
  113. package/dist/client/assets/{search-input-DRArEtrV.js → search-input-J2Up5mqM.js} +1 -1
  114. package/dist/client/assets/{select-DBTJ405R.js → select-BpWMsKq-.js} +1 -1
  115. package/dist/client/assets/{select-model-CVihu6QE.js → select-model-B5AXvSeg.js} +1 -1
  116. package/dist/client/assets/{settings-layout-DSg7AZLP.js → settings-layout-BCEM9NqD.js} +1 -1
  117. package/dist/client/assets/{settings-section-B-H7r-eT.js → settings-section-ZpAPCH6i.js} +1 -1
  118. package/dist/client/assets/{shell-layout-V_I5BZHu.js → shell-layout-CKhsw5Sh.js} +1 -1
  119. package/dist/client/assets/{skeleton-C2zJGx2Y.js → skeleton-BhL9H11L.js} +1 -1
  120. package/dist/client/assets/{sso-RdX7LN5j.js → sso-DMGvs9Z-.js} +1 -1
  121. package/dist/client/assets/{store-cLIKmL15.js → store-B2Lmd39T.js} +1 -1
  122. package/dist/client/assets/store-registry-C0UdTWoP.js +2 -0
  123. package/dist/client/assets/{switch-BsX6ngUr.js → switch-B20JmlBf.js} +1 -1
  124. package/dist/client/assets/{table-DmKKh-Uo.js → table-D4DqVxc9.js} +1 -1
  125. package/dist/client/assets/{tabs-DKwgBUgV.js → tabs-BX6UCACt.js} +1 -1
  126. package/dist/client/assets/{task-status-DEPsM1Cn.js → task-status-BIfmjfC3.js} +1 -1
  127. package/dist/client/assets/{textarea-CPrSylHb.js → textarea-UvbmRoe-.js} +1 -1
  128. package/dist/client/assets/{toggle-group-B7clKLKk.js → toggle-group-Tf_rUt5t.js} +1 -1
  129. package/dist/client/assets/{tools-list-C3T4yOSU.js → tools-list-CRd4heFY.js} +1 -1
  130. package/dist/client/assets/{tooltip-ADPPk7Xn.js → tooltip-B3IUO41H.js} +1 -1
  131. package/dist/client/assets/{types-DHKNdHPr.js → types-M1_25Vrf.js} +1 -1
  132. package/dist/client/assets/{use-ai-providers-BwSVWd-T.js → use-ai-providers-Dqu6jx-F.js} +1 -1
  133. package/dist/client/assets/{use-collections-ALcwG43o.js → use-collections-Da70-nLG.js} +1 -1
  134. package/dist/client/assets/{use-connection-BCg6eUzo.js → use-connection-BpZtYbNe.js} +1 -1
  135. package/dist/client/assets/{use-copy-ckzdRU4i.js → use-copy-BSXck2x7.js} +1 -1
  136. package/dist/client/assets/{use-create-virtual-mcp-CZMfwNnK.js → use-create-virtual-mcp-DjyE6zmA.js} +1 -1
  137. package/dist/client/assets/{use-decopilot-events-DkifTpav.js → use-decopilot-events-B-oXB6oi.js} +1 -1
  138. package/dist/client/assets/{use-delete-connection-Q6Ekhh19.js → use-delete-connection-CJNEN3TP.js} +1 -1
  139. package/dist/client/assets/{use-infinite-scroll-D8lsFQgN.js → use-infinite-scroll-BDVxH8Nj.js} +1 -1
  140. package/dist/client/assets/{use-list-state-DDYvJEtn.js → use-list-state-Bf4Orvks.js} +1 -1
  141. package/dist/client/assets/{use-mcp-tools-CecwS7ew.js → use-mcp-tools-UPubU5dS.js} +1 -1
  142. package/dist/client/assets/{use-members-D_xWh-py.js → use-members-6lxWp3cM.js} +1 -1
  143. package/dist/client/assets/{use-navigate-to-agent-HfjXn9N3.js → use-navigate-to-agent-CHUquCU3.js} +1 -1
  144. package/dist/client/assets/{use-org-auth-client-B8yYcDOl.js → use-org-auth-client-VBCw4Z09.js} +1 -1
  145. package/dist/client/assets/{use-org-sso-D3_x4jf3.js → use-org-sso-B4E1THrG.js} +1 -1
  146. package/dist/client/assets/{use-organization-roles-DbDXN-yR.js → use-organization-roles-DkTxgjYa.js} +1 -1
  147. package/dist/client/assets/{use-organization-settings-Chq5JyfA.js → use-organization-settings-BVe1RnJv.js} +1 -1
  148. package/dist/client/assets/{use-registry-connections-BTRKcUsD.js → use-registry-connections-o0Gae1A5.js} +1 -1
  149. package/dist/client/assets/{use-status-sounds-Lh1NAEqk.js → use-status-sounds-BJnu3Bk4.js} +1 -1
  150. package/dist/client/assets/{use-tasks-DHfFkdLo.js → use-tasks-COfJsoNk.js} +1 -1
  151. package/dist/client/assets/{use-view-mode-C_0UGTCG.js → use-view-mode-ptHtxrZN.js} +1 -1
  152. package/dist/client/assets/{use-virtual-mcp-Bd5gChwa.js → use-virtual-mcp-Ci4PPj2K.js} +1 -1
  153. package/dist/client/assets/useInfiniteQuery-DtUmiZEX.js +1 -0
  154. package/dist/client/assets/useSuspenseInfiniteQuery-CCko66uu.js +1 -0
  155. package/dist/client/assets/{user-Dp4XSqp-.js → user-BcXNPJaC.js} +1 -1
  156. package/dist/client/assets/{view-mode-toggle-D-WxHo9K.js → view-mode-toggle-DbMW5Bpx.js} +1 -1
  157. package/dist/client/assets/{workflow-Mj-lIDhI.js → workflow-DLWGQFO8.js} +1 -1
  158. package/dist/client/assets/workflow-detail-B6yBsW48.js +1 -0
  159. package/dist/client/index.html +1 -1
  160. package/dist/server/cli.js +3 -3
  161. package/dist/server/migrate.js +2 -2
  162. package/dist/server/server.js +2 -2
  163. package/package.json +1 -1
  164. package/dist/client/assets/ai-providers-FYypRZeO.js +0 -1
  165. package/dist/client/assets/index-DESpfOlS.js +0 -1
  166. package/dist/client/assets/registry-CK0nGsxr.js +0 -2
  167. package/dist/client/assets/store-registry-336aF83x.js +0 -2
  168. package/dist/client/assets/useInfiniteQuery-CRbDZq1R.js +0 -1
  169. package/dist/client/assets/useSuspenseInfiniteQuery-Cs4PAUkF.js +0 -1
  170. package/dist/client/assets/workflow-detail-CXPhEJbk.js +0 -1
  171. package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
  172. package/dist/server/node_modules/ansi-styles/index.js +0 -223
  173. package/dist/server/node_modules/ansi-styles/license +0 -9
  174. package/dist/server/node_modules/ansi-styles/package.json +0 -54
  175. package/dist/server/node_modules/ansi-styles/readme.md +0 -173
  176. package/dist/server/node_modules/environment/index.d.ts +0 -74
  177. package/dist/server/node_modules/environment/index.js +0 -47
  178. package/dist/server/node_modules/environment/license +0 -9
  179. package/dist/server/node_modules/environment/package.json +0 -74
  180. package/dist/server/node_modules/environment/readme.md +0 -94
  181. package/dist/server/node_modules/escape-string-regexp/index.d.ts +0 -18
  182. package/dist/server/node_modules/escape-string-regexp/index.js +0 -11
  183. package/dist/server/node_modules/escape-string-regexp/license +0 -9
  184. package/dist/server/node_modules/escape-string-regexp/package.json +0 -43
  185. package/dist/server/node_modules/escape-string-regexp/readme.md +0 -29
  186. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  187. package/dist/server/node_modules/is-fullwidth-code-point/index.js +0 -12
  188. package/dist/server/node_modules/is-fullwidth-code-point/license +0 -9
  189. package/dist/server/node_modules/is-fullwidth-code-point/package.json +0 -53
  190. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +0 -31
  191. package/dist/server/node_modules/is-unicode-supported/index.d.ts +0 -12
  192. package/dist/server/node_modules/is-unicode-supported/index.js +0 -21
  193. package/dist/server/node_modules/is-unicode-supported/license +0 -9
  194. package/dist/server/node_modules/is-unicode-supported/package.json +0 -47
  195. package/dist/server/node_modules/is-unicode-supported/readme.md +0 -35
  196. package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
  197. package/dist/server/node_modules/mimic-fn/index.js +0 -13
  198. package/dist/server/node_modules/mimic-fn/license +0 -9
  199. package/dist/server/node_modules/mimic-fn/package.json +0 -42
  200. package/dist/server/node_modules/mimic-fn/readme.md +0 -69
  201. package/dist/server/node_modules/onetime/index.d.ts +0 -64
  202. package/dist/server/node_modules/onetime/index.js +0 -44
  203. package/dist/server/node_modules/onetime/license +0 -9
  204. package/dist/server/node_modules/onetime/package.json +0 -43
  205. package/dist/server/node_modules/onetime/readme.md +0 -94
  206. package/dist/server/node_modules/pg-int8/LICENSE +0 -13
  207. package/dist/server/node_modules/pg-int8/README.md +0 -16
  208. package/dist/server/node_modules/pg-int8/index.js +0 -100
  209. package/dist/server/node_modules/pg-int8/package.json +0 -24
  210. package/dist/server/node_modules/pg-pool/LICENSE +0 -21
  211. package/dist/server/node_modules/pg-pool/README.md +0 -357
  212. package/dist/server/node_modules/pg-pool/esm/index.mjs +0 -5
  213. package/dist/server/node_modules/pg-pool/index.js +0 -517
  214. package/dist/server/node_modules/pg-pool/package.json +0 -51
  215. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  216. package/dist/server/node_modules/postgres-array/index.js +0 -97
  217. package/dist/server/node_modules/postgres-array/license +0 -21
  218. package/dist/server/node_modules/postgres-array/package.json +0 -35
  219. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  220. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  221. package/dist/server/node_modules/postgres-bytea/license +0 -21
  222. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  223. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  224. package/dist/server/node_modules/postgres-date/index.js +0 -116
  225. package/dist/server/node_modules/postgres-date/license +0 -21
  226. package/dist/server/node_modules/postgres-date/package.json +0 -33
  227. package/dist/server/node_modules/postgres-date/readme.md +0 -49
  228. package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
  229. package/dist/server/node_modules/postgres-interval/index.js +0 -125
  230. package/dist/server/node_modules/postgres-interval/license +0 -21
  231. package/dist/server/node_modules/postgres-interval/package.json +0 -36
  232. package/dist/server/node_modules/postgres-interval/readme.md +0 -48
  233. package/dist/server/node_modules/restore-cursor/index.d.ts +0 -11
  234. package/dist/server/node_modules/restore-cursor/index.js +0 -11
  235. package/dist/server/node_modules/restore-cursor/license +0 -9
  236. package/dist/server/node_modules/restore-cursor/package.json +0 -55
  237. package/dist/server/node_modules/restore-cursor/readme.md +0 -31
  238. package/dist/server/node_modules/split2/LICENSE +0 -13
  239. package/dist/server/node_modules/split2/README.md +0 -85
  240. package/dist/server/node_modules/split2/bench.js +0 -27
  241. package/dist/server/node_modules/split2/index.js +0 -141
  242. package/dist/server/node_modules/split2/package.json +0 -39
  243. package/dist/server/node_modules/split2/test.js +0 -409
  244. package/dist/server/node_modules/string-width/index.d.ts +0 -39
  245. package/dist/server/node_modules/string-width/index.js +0 -82
  246. package/dist/server/node_modules/string-width/license +0 -9
  247. package/dist/server/node_modules/string-width/package.json +0 -64
  248. package/dist/server/node_modules/string-width/readme.md +0 -66
  249. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  250. package/dist/server/node_modules/xtend/LICENSE +0 -20
  251. package/dist/server/node_modules/xtend/README.md +0 -32
  252. package/dist/server/node_modules/xtend/immutable.js +0 -19
  253. package/dist/server/node_modules/xtend/mutable.js +0 -17
  254. package/dist/server/node_modules/xtend/package.json +0 -55
  255. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-BKdpoQ4z.js","assets/index-UnY-zvRC.js","assets/index-DXHNyf1g.css","assets/pair-Dnl7WYnw.js","assets/agent-icon-CNwr7nQ6.js","assets/AlertCircle-D2CfiqIb.js","assets/Tool01-BYbeRyP1.js","assets/XClose-DWbPt4W1.js","assets/RefreshCcw01-DImxDs2M.js","assets/ArrowNarrowLeft-DbvZvWo_.js","assets/XCircle-BEAFTgYK.js","assets/ArrowUpRight-C4097qeP.js","assets/ZapSquare-CUSW7lK1.js","assets/Users03-BDvrLgkH.js","assets/CheckCircle-DzPOiS7f.js","assets/ChevronDown-nbfYLv74.js","assets/ChevronRight-BMU5pFO3.js","assets/ChevronUp-DYWpqTMs.js","assets/DotsVertical-vQJr-cQl.js","assets/Container-BExsAw1Y.js","assets/Star01-B5DJ8WSO.js","assets/Palette-CpHUCWb_.js","assets/SearchMd-BZgC3RwY.js","assets/index-DTFrJfZ5.js","assets/tooltip-ADPPk7Xn.js","assets/X-80NRAfnw.js","assets/LinkExternal01-CIznTcjx.js","assets/Lock01-_cHNYwVm.js","assets/Sun-DwLarfIS.js","assets/Play-P-JNZi6M.js","assets/Plus-UMVRoN9P.js","assets/Settings02-DsZ22GF2.js","assets/Shield01-DSdOF02b.js","assets/Trash01-XaVufWhG.js","assets/User01-DOEJf7_z.js","assets/Zap-DJ-5nwQH.js","assets/index-C6PH122m.js","assets/use-copy-ckzdRU4i.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-BY7V3l1b.js","assets/content-blocks-o63cs2vh.js","assets/types-DHKNdHPr.js","assets/constants-Cir84GoX.js","assets/chat-context-BTZrU_bp.js","assets/use-virtual-mcp-Bd5gChwa.js","assets/use-collections-ALcwG43o.js","assets/use-ai-providers-BwSVWd-T.js","assets/use-decopilot-events-DkifTpav.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-DHfFkdLo.js","assets/use-organization-settings-Chq5JyfA.js","assets/shell-layout-V_I5BZHu.js","assets/required-auth-layout-DyXOjWp0.js","assets/use-org-sso-D3_x4jf3.js","assets/integration-icon-Czloo5aB.js","assets/use-mcp-tools-CecwS7ew.js"])))=>i.map(i=>d[i]);
2
- import{o as Ut,r as P,p as Tl,q as Rl,e as K,s as xe,K as As,n as Ko,a as qo,c as te,j as o,l as Ie,B as se,E as $t,b as ki,v as ai,f as At,d as en,w as Dl,x as _e,y as Ml,V as Il,t as we,z as Go,C as Al,D as Zt,F as Pl,G as yn,L as Bl,H as zi,I as Zs,J as ct,M as Yo,P as Ll,_ as Ol,Q as Xo,R as Jo,T as zl,g as $l}from"./index-UnY-zvRC.js";import{C as Ee,u as Fl,w as Hl,A as Wl,T as Ul,a as Vl}from"./index-CC-8lukI.js";import{I as ds}from"./integration-icon-Czloo5aB.js";import{S as Pt,u as He,g as Zo,a as Qo}from"./constants-Cir84GoX.js";import{u as yt,a as Kl}from"./use-virtual-mcp-Bd5gChwa.js";import{a as ql}from"./Users03-BDvrLgkH.js";import{u as ea,a as lt,b as Ni,c as ji,t as Gl,d as wn}from"./chat-context-BTZrU_bp.js";import{i as Ps}from"./AlertCircle-D2CfiqIb.js";import{i as Yl}from"./CheckCircle-DzPOiS7f.js";import{n as Cn,a as Xl}from"./ZapSquare-CUSW7lK1.js";import{i as Jl,a as Zl,b as Ql,c as Ei,d as ec}from"./XCircle-BEAFTgYK.js";import{s as ls,i as tc}from"./XClose-DWbPt4W1.js";import{c as sc,r as ic,p as ta,f as kn,a as rc,F as nc,t as Nn,M as tn,G as sa,L as oc,i as ac,b as lc,d as cc,e as hc}from"./pair-Dnl7WYnw.js";import{C as dc,a as jn,b as En,c as uc,d as fc,e as mc,f as _c}from"./command-xCX5Hjh8.js";import{P as Hs,a as Ws,b as Us}from"./popover-BdA1Au4C.js";import{i as Ts,a as gi,b as pc,c as gc,p as Ti,g as Ri,d as sn,e as ia,h as ur,f as $i,j as Tn,A as Rn,k as ra,l as vc,m as xc,n as bc,t as Sc,o as yc,q as li,r as na,s as oa,u as aa,v as Dn,w as wc,x as Rs,y as Cc,z as kc,B as Nc,C as la}from"./agent-icon-CNwr7nQ6.js";import{u as us,a as jc}from"./use-mcp-tools-CecwS7ew.js";import{u as Ec,a as Tc}from"./use-ai-providers-BwSVWd-T.js";import{g as Vt,c as Mn,u as Rc,b as fr,d as Dc,e as Mc,f as Ic,T as Ac}from"./index-CWBm8dkR.js";import{u as rn,i as Pc}from"./shell-layout-V_I5BZHu.js";import{i as Bc,P as at,u as Lc,c as Oc,d as zc,e as $c}from"./index-DTFrJfZ5.js";import{u as ca,T as Ke,a as qe,b as Ge,c as Fc}from"./tooltip-ADPPk7Xn.js";import{u as Hc}from"./use-status-sounds-Lh1NAEqk.js";import{E as Bs}from"./empty-state-B6o1wtCI.js";import{A as Wc,a as Uc,b as Vc,c as Kc,R as ha,d as qc,e as Gc}from"./accordion-Cs5A2mwd.js";import{u as Di,a as nn,b as Yc}from"./use-connection-BCg6eUzo.js";import{g as Xc}from"./constants-CL9Yh3jE.js";import{u as Jc,g as Zc}from"./types-DHKNdHPr.js";import{U as da}from"./user-Dp4XSqp-.js";import{T as Qc,u as ua}from"./tools-list-C3T4yOSU.js";import{u as Fi}from"./unwrap-tool-result-BYXdCQMg.js";import{s as fa,g as eh}from"./connection-slug-eyAPH6o3.js";import{A as ma,a as _a,b as pa,c as ga,d as va,e as xa,f as ba,g as Sa}from"./alert-dialog-CjZ_yEsA.js";import{D as th,a as on,b as an,c as ya,d as wa}from"./dialog-BY7V3l1b.js";import{C as sh,a as In}from"./card-iIHVwReR.js";import{I as fs}from"./input-D6bqiRsc.js";import{L as Ds}from"./label-OH00Bm2e.js";import{S as ts,a as ss,b as is,c as rs,d as It}from"./select-DBTJ405R.js";import{S as mr}from"./switch-BsX6ngUr.js";import{T as An}from"./textarea-CPrSylHb.js";import{i as ci}from"./Play-P-JNZi6M.js";import{s as cs}from"./Plus-UMVRoN9P.js";import{a as ih}from"./Settings02-DsZ22GF2.js";import{t as Ca}from"./Tool01-BYbeRyP1.js";import{s as _r}from"./Trash01-XaVufWhG.js";import{S as ka}from"./scroll-area-BtYccAiz.js";import{i as Na,a as rh}from"./SearchMd-BZgC3RwY.js";import{C as nh}from"./collection-tabs-CUM5pTIq.js";import{C as oh}from"./checkbox-pdr67-6J.js";import{u as ah,T as Hi,a as lh,b as ch,c as Wi}from"./tabs-DKwgBUgV.js";import{D as hh,a as dh,b as uh}from"./drawer-CF_GY3GP.js";import{i as Mi,t as pr}from"./ChevronDown-nbfYLv74.js";import{n as Kt}from"./LinkExternal01-CIznTcjx.js";import{S as fh}from"./index-C6PH122m.js";import{D as ns,a as os,b as as,c as St,d as mh,e as _h,f as ph}from"./dropdown-menu-CZKqA1eF.js";import{i as ja}from"./RefreshCcw01-DImxDs2M.js";import{V as gh}from"./view-mode-toggle-D-WxHo9K.js";import{G as vh}from"./lean-canvas-recruit-modal-D3uOPj7B.js";import{M as xh}from"./select-model-CVihu6QE.js";import{u as Vs,a as bh,b as Sh,c as yh,A as wh,d as Ch}from"./automation-list-row-wACLbSFs.js";import{i as Ls}from"./Zap-DJ-5nwQH.js";import{S as kh}from"./search-input-DRArEtrV.js";import"./use-navigate-to-agent-HfjXn9N3.js";import"./use-tasks-DHfFkdLo.js";import"./use-collections-ALcwG43o.js";import"./collection-search-DzHZlyRO.js";import"./form-Bqxj9UR_.js";import"./Star01-B5DJ8WSO.js";import"./Lock01-_cHNYwVm.js";import"./X-80NRAfnw.js";import"./toggle-group-B7clKLKk.js";import"./index-DW5-Qpk8.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-BH_OVnZ0.js";import"./use-registry-connections-BTRKcUsD.js";import"./use-organization-settings-Chq5JyfA.js";import"./useInfiniteQuery-CRbDZq1R.js";import"./infiniteQueryObserver-Dx_FFlyw.js";import"./extract-connection-data-CXgcXDyg.js";import"./Container-BExsAw1Y.js";import"./connection-form-helpers-CDFSSkBK.js";import"./use-infinite-scroll-D8lsFQgN.js";import"./useSuspenseInfiniteQuery-Cs4PAUkF.js";import"./badge-BJCa3Rup.js";import"./ChevronRight-BMU5pFO3.js";import"./use-decopilot-events-DkifTpav.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-ckzdRU4i.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-DwLarfIS.js";import"./index-CvfgmSHb.js";import"./ArrowNarrowLeft-DbvZvWo_.js";import"./ArrowUpRight-C4097qeP.js";import"./ChevronUp-DYWpqTMs.js";import"./DotsVertical-vQJr-cQl.js";import"./Palette-CpHUCWb_.js";import"./Shield01-DSdOF02b.js";import"./User01-DOEJf7_z.js";import"./skeleton-C2zJGx2Y.js";import"./avatar-VfK9F8Gm.js";import"./index-OL4lmhJr.js";import"./collection-search-DGbMy7UX.js";import"./use-create-virtual-mcp-CZMfwNnK.js";import"./task-status-DEPsM1Cn.js";import"./required-auth-layout-DyXOjWp0.js";import"./use-org-sso-D3_x4jf3.js";import"./collections-CPizzQEO.js";import"./settings-section-B-H7r-eT.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Nh(t,e){const s=Ut(e);return jh({filters:{...t,status:"pending"}},s).length}function Pn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function jh(t={},e){const s=Ut(e).getMutationCache(),i=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=Pn(s,t)),P.useEffect(()=>{i.current=t}),P.useSyncExternalStore(P.useCallback(n=>s.subscribe(()=>{const a=Tl(r.current,Pn(s,i.current));r.current!==a&&(r.current=a,Rl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Eh(t,e){const s=K.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Pt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=He(n),l=Ut();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Ko(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==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[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=qo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),P.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function gs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bn(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 Th(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Rh(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Dh),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 Dh(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 Mh(t){const e=K.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 u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,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 y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Ih(t){const e=K.c(19),{part:s}=t,i=s.input?.agent_id,r=yt(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 u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=te("shrink-0 font-medium",d),e[3]=d,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(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Jl,{size:12,className:"text-destructive"}):c?o.jsx(Ps,{size:12,className:"text-warning"}):o.jsx(Yl,{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]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=K.c(58),{onClose:s,back:i,className:r}=t,[n,a]=P.useState(null),{messages:l}=ea(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=Ni();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]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=Z=>Z.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=sc(l),j=[...l].reverse().find(Vh),R=j?.metadata?.usage,M=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,D=R?.contextTokens??R?.totalTokens??0,C=M&&M>0?(D/M*100).toFixed(1):null,T=l;let E;e[19]!==T?(E=T.filter(Uh).reduce(Wh,0),e[19]=T,e[20]=E):E=e[20];const I=E,O=l;let B;e[21]!==O?(B=O.filter(Hh).reduce(Fh,0),e[21]=O,e[22]=B):B=e[22];const L=B,$=Math.max(0,N.totalTokens-I-L),F=l[0],z=l.at(-1),V=F?.metadata?.created_at??w?.created_at,W=z?.metadata?.created_at??w?.updated_at,U=l.filter($h),q=l.flatMap(Oh),A=u?.modelId?Th(u.modelId):"—",Y=d?.title??"Decopilot",J=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:Y},{label:"Model",value:A},{label:"Context Limit",value:M?gs(M):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?gs(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?gs(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?gs(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?gs(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Bn(V)},{label:"Last Activity",value:Bn(W)}];if(!w&&U.length===0){let Z;e[23]!==r?(Z=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Z):Z=e[24];let ue;e[25]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=ue):ue=e[25];let de;e[26]!==i?(de=i?o.jsx(Cn,{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 he;e[28]!==s||e[29]!==de?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ue,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]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=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]=pe):pe=e[31];let We;e[32]!==Z||e[33]!==he?(We=o.jsxs("div",{className:Z,children:[he,pe]}),e[32]=Z,e[33]=he,e[34]=We):We=e[34],S=We;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(Cn,{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",_=q.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:q.map(Lh)})]}),f=o.jsx(Rh,{items:J});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==L||e[45]!==$||e[46]!==I?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Mh,{userTokens:I,assistantTokens:L,otherTokens:$})]}),e[44]=L,e[45]=$,e[46]=I,e[47]=p):p=e[47],g=U.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:U.map(Z=>{const ue=Z.metadata?.created_at,de=n?.id===Z.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Z),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",Z.role==="user"?"text-chart-1":"text-chart-2"),children:Z.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Z.id})]}),ue&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ue).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsxs(o.Fragment,{children:[Z.role==="assistant"&&(()=>{const he=Z.metadata?._request;if(!he)return null;const pe=he.systemSections??[],We=Math.max(1,...pe.map(Bh)),Pe=pe.reduce(Ph,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Pe/4).toLocaleString()," ","tok"]})]}),pe.map((ie,ge)=>{const Je=ie.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ge}`,fe=ie.chars/We*100,kt=Math.round(ie.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:Je}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",kt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${fe}%`}})})]},ge)})]})]})})(),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(Z,null,2)})]})]},Z.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.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 y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Ph(t,e){return t+e.chars}function Bh(t){return t.chars}function Lh(t,e){return o.jsx(Ih,{part:t},e)}function Oh(t){return(t.parts??[]).filter(zh)}function zh(t){return t.type==="tool-subtask"}function $h(t){return t.role!=="system"}function Fh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Hh(t){return t.role==="assistant"}function Wh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Uh(t){return t.role==="user"}function Vh(t){return t.role==="assistant"&&t.metadata?.usage}const Ln=["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"],On=["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 Kh(){const t=Ln[Math.floor(Math.random()*Ln.length)],e=On[Math.floor(Math.random()*On.length)];return`deco/${t}-${e}`}function qh(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 Gh(t){const e=K.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=He(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Zh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Jh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const M=Array.isArray(v)?v:v?.branches??[];let D;e[18]!==y?(D=C=>!y.has(C.name),e[18]=y,e[19]=D):D=e[19],w=M.filter(Xh).filter(D).map(Yh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let R;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(R={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=R):R=e[25],R}function Yh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Xh(t){return typeof t.name=="string"}function Jh(t){return{name:t,source:"yours"}}function Zh(t){return qh(t)}function Qh(t){const e=K.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=P.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=Gh(_);let b;e[9]!==u?(b=I=>{u(I),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ts,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=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:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(fc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=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:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Kh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&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[17]=v,e[18]=j):j=e[18];let R;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(R=!v&&!g&&f.length===0&&p.length===0&&o.jsx(dc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=R):R=e[23];let M;e[24]!==S||e[25]!==f?(M=f.length>0&&o.jsx(jn,{heading:"Your branches",children:f.map(I=>o.jsxs(En,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))}),e[24]=S,e[25]=f,e[26]=M):M=e[26];let D;e[27]!==p||e[28]!==S?(D=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(uc,{}),o.jsx(jn,{heading:"Other branches in repo",children:p.map(I=>o.jsxs(En,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),I.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",I.author]})]},I.name))})]}),e[27]=p,e[28]=S,e[29]=D):D=e[29];let C;e[30]!==D||e[31]!==j||e[32]!==R||e[33]!==M?(C=o.jsxs(mc,{children:[j,R,M,D]}),e[30]=D,e[31]=j,e[32]=R,e[33]=M,e[34]=C):C=e[34];let T;e[35]!==C||e[36]!==N?(T=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(_c,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=T):T=e[37];let E;return e[38]!==d||e[39]!==T||e[40]!==k?(E=o.jsxs(Us,{open:d,onOpenChange:m,children:[k,T]}),e[38]=d,e[39]=T,e[40]=k,e[41]=E):E=e[41],E}function ed(){const t=K.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=Ni(),{data:i}=ki.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Zo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=yt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ql,{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]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Qh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==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[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function td(){const t=K.c(26),{org:e}=xe(),s=Ec(),{isChatEmpty:i}=ea(),[r,n]=P.useState("chat"),a=Fl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.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&&!Hl(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(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(ed,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,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(Ah,{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(Ee,{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 Ea(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{fallback:e,children:o.jsx(P.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(td,{})})}),t[1]=s):s=t[1],s}async function sd(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 Ta=["VM_START"],Qs=new Map,id=t=>`${t.virtualMcpId}::${t.branch??""}`,Ui=new Set,vi={mark:(t,e)=>Ui.add(`${t}::${e}`),clear:(t,e)=>Ui.delete(`${t}::${e}`),isStopped:(t,e)=>Ui.has(`${t}::${e}`)};function ln(t){const e=Ut();return qo({mutationKey:Ta,mutationFn:async s=>{s.branch&&vi.clear(s.virtualMcpId,s.branch);const i=id(s),r=Qs.get(i);if(r)return r;const n=(async()=>(await sd(t,"VM_START",s)).structuredContent)();Qs.set(i,n);try{return await n}finally{Qs.get(i)===n&&Qs.delete(i)}},onSuccess:()=>{ai(e)}})}function Ra(t,e){const s=K.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ta,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],Nh(i)>0}const rd={settings:gc,automations:pc,env:gi,preview:Zl,git:Ts};function zn(t){const e=Ti(t);if(e.type==="icon"){const s=Ri(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Vi(t){if(t.kind==="system")return{kind:"component",Component:rd[t.tabId]};const e=zn(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=zn(s.icon);return i||{kind:"fallback"}}function nd(t){const{org:e}=xe(),s=He({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),{data:i}=Dl({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 Da(t){const e=K.c(8),s=At();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=en(i),n=yt(t.virtualMcpId),a=nd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Vt(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Di(f),{activeTab:g,mainOpen:v}=ic({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(od)}:null}),b=ta(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 R=kn(j.appId,j.toolName);x.set(R,{id:R,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const R=kn(j.connectionId,j.toolName);x.set(R,{id:R,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Vi({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Vi({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:Vi({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const R=rc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:M=>({...M,main:R}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function od(t){return{id:t.id}}function ad(t){const e=K.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=P.useState(!1),[g,v]=P.useState("icons"),[b,S]=P.useState(""),[x,y]=P.useState("blue");let k;e[0]!==s?(k=Ti(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=fe=>{i($i(fe,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const R=j;let M;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(M=fe=>{y(fe),r?.(fe),w.type==="icon"?i($i(w.name,fe)):w.type==="url"&&i(Tn(w.url,fe))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=M):M=e[10];const D=M;let C;e[11]!==i||e[12]!==N?(C=fe=>{i(Tn(fe,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const T=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const fe=sn(),kt=fe[Math.floor(Math.random()*fe.length)];i($i(kt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const I=E;let O,B,L,$,F,z,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const fe={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};B=Us,z=_?!1:f,V=p,O=Hs,F=!0,W="button",L=_,$=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",fe[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=O,e[22]=B,e[23]=L,e[24]=$,e[25]=F,e[26]=z,e[27]=V,e[28]=W}else O=e[21],B=e[22],L=e[23],$=e[24],F=e[25],z=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(Rn,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let q;e[34]!==_||e[35]!==m?(q=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(ra,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=q):q=e[36];let A;e[37]!==L||e[38]!==$||e[39]!==U||e[40]!==q||e[41]!==W?(A=o.jsxs("button",{type:W,disabled:L,className:$,children:[U,q]}),e[37]=L,e[38]=$,e[39]=U,e[40]=q,e[41]=W,e[42]=A):A=e[42];let Y;e[43]!==O||e[44]!==F||e[45]!==A?(Y=o.jsx(O,{asChild:F,children:A}),e[43]=O,e[44]=F,e[45]=A,e[46]=Y):Y=e[46];let J;e[47]!==n||e[48]!==s?(J=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Rn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=J):J=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 ne;e[51]!==ce?(ne=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ne):ne=e[52];let Z;e[53]!==ne?(Z=o.jsx("button",{type:"button",onClick:ee,className:ne,children:"Icons"}),e[53]=ne,e[54]=Z):Z=e[54];let ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>v("upload"),e[55]=ue):ue=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==de?(he=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:ue,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let We;e[60]===Symbol.for("react.memo_cache_sentinel")?(We=o.jsx("div",{className:"flex-1"}),e[60]=We):We=e[60];let Pe;e[61]!==Z||e[62]!==pe?(Pe=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Z,pe,We]}),e[61]=Z,e[62]=pe,e[63]=Pe):Pe=e[63];let ie;e[64]!==D||e[65]!==I||e[66]!==R||e[67]!==T||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(ie=g==="icons"?o.jsx(dd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:D,onSelectIcon:R,onRandom:I,currentIconName:w.type==="icon"?w.name:null}):o.jsx(ud,{onUpload:T}),e[64]=D,e[65]=I,e[66]=R,e[67]=T,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=ie):ie=e[73];let ge;e[74]!==J||e[75]!==Pe||e[76]!==ie?(ge=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ld,children:o.jsxs("div",{className:"flex flex-col",children:[J,Pe,ie]})}),e[74]=J,e[75]=Pe,e[76]=ie,e[77]=ge):ge=e[77];let Je;return e[78]!==B||e[79]!==z||e[80]!==V||e[81]!==Y||e[82]!==ge?(Je=o.jsxs(B,{open:z,onOpenChange:V,children:[Y,ge]}),e[78]=B,e[79]=z,e[80]=V,e[81]=Y,e[82]=ge,e[83]=Je):Je=e[83],Je}function ld(t){return t.preventDefault()}function cd(t){const e=K.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=P.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=ia(s);l=Us,d=r,m=n,a=Hs,u=!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]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=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]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=xc.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:hd,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]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function hd(t){return t.preventDefault()}function dd(t){const e=K.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,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=sn(),y=ia(r);u=s.trim()?x.filter(D=>{const C=ur(D),T=s.toLowerCase();return C.includes(T)||D.toLowerCase().includes(T)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=D=>i(D.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(vc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let R;e[21]!==l?(R=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]=R):R=e[22];let M;e[23]!==n||e[24]!==r?(M=o.jsx(cd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=M):M=e[25],e[26]!==R||e[27]!==M||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,R,M]}),e[26]=R,e[27]=M,e[28]=N,e[29]=p):p=e[29],c=ka,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(D=>{const C=Ri(D);return C?o.jsx("button",{type:"button",onClick:()=>a(D),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===D?te(y.bg,y.text):te(y.text,"hover:bg-accent")),title:D,children:o.jsx(C,{size:18})},D):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]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.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 ud(t){const e=K.c(27),{onUpload:s}=t,i=P.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){_e.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{_e.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=P.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,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(Ql,{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=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.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 y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function fd(t){const e=K.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ti(s);if(n.type==="icon"){const a=Ri(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(Bc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function md(t){const e=K.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=P.useState(!1),[h,c]=P.useState("");let u;e[0]!==s?(u=Ti(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,R,M;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const B=sn();g=h.trim()?B.filter(U=>{const q=h.toLowerCase();return ur(U).includes(q)||U.toLowerCase().includes(q)}):B,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(fd,{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",R="w-64 p-0",M=_d,w="flex flex-col";let z;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=z):z=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[z,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=ka,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const q=Ri(U);return q?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:ur(U),children:o.jsx(q,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),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]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=R,e[23]=M}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],R=e[22],M=e[23];let D;e[40]!==x||e[41]!==y?(D=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=D):D=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 T;e[45]!==_||e[46]!==D||e[47]!==C||e[48]!==k?(T=o.jsxs(_,{className:k,children:[D,C]}),e[45]=_,e[46]=D,e[47]=C,e[48]=k,e[49]=T):T=e[49];let E;e[50]!==T||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,T]}),e[50]=T,e[51]=w,e[52]=N,e[53]=E):E=e[53];let I;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==R||e[58]!==M?(I=o.jsx(f,{align:j,className:R,onOpenAutoFocus:M,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=R,e[58]=M,e[59]=I):I=e[59];let O;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==I?(O=o.jsxs(p,{open:v,onOpenChange:b,children:[S,I]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=I,e[65]=O):O=e[65],O}function _d(t){return t.preventDefault()}function hi(){const t=K.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(Ie,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Ki(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(Ml,{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 pd(t){const e=K.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 u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=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]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(oh,{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 cn(t){const e=K.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 d=s.map(gd);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(pd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),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 u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function gd(t){return t.id}function vd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=jc(c);let d;e[6]!==u.tools?(d=u.tools.map(xd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function xd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Qc,{annotations:t.annotations,_meta:t._meta})}}function bd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Jc(c);let d;e[6]!==u.resources?(d=u.resources.map(Sd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Sd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function yd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=ah(c);let d;e[6]!==u.prompts?(d=u.prompts.map(wd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function wd(t){return{id:t.name,name:t.name,description:t.description}}function Cd(t){const e=K.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,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]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,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 y;e[16]!==v||e[17]!==x?(y=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]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=O=>m(O),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(nh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let R;e[25]!==g||e[26]!==j?(R=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]=R):R=e[27];let M;e[28]!==R||e[29]!==N?(M=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,R]}),e[28]=R,e[29]=N,e[30]=M):M=e[30];let D;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(D=i==="tools"&&o.jsx($t,{fallback:Ki("Tools not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(vd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(O,B)=>a(r,O,B)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=D):D=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx($t,{fallback:Ki("Resources not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(bd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(O,B)=>l(r,O,B)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let T;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(T=i==="prompts"&&o.jsx($t,{fallback:Ki("Prompts not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(yd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(O,B)=>h(r,O,B)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=T):T=e[45];let E;e[46]!==D||e[47]!==C||e[48]!==T?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[D,C,T]}),e[46]=D,e[47]=C,e[48]=T,e[49]=E):E=e[49];let I;return e[50]!==M||e[51]!==E||e[52]!==y?(I=o.jsxs(o.Fragment,{children:[y,M,E]}),e[50]=M,e[51]=E,e[52]=y,e[53]=I):I=e[53],I}function kd(t){const e=K.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=ua(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(bc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,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 Nd(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 $n(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function jd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function Ed(t){const e=K.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,u]=P.useReducer(jd,h),d=nn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Nd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(z,V,W,U)=>{const q=f[z]?.[V];let A;q===null?A=U.filter(J=>J!==W):q?.includes(W)?A=q.filter(J=>J!==W):(A=[...q??[],W],A.length===U.length&&(A=null));const Y={...f};Y[z]?Y[z]={...Y[z]}:Y[z]={tools:null,resources:null,prompts:null},Y[z][V]=A,n.setValue("connections",$n(Y),{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=(z,V)=>{const U=f[z]?.[V]===null?[]:null,q={...f};q[z]?q[z]={...q[z]}:q[z]={tools:null,resources:null,prompts:null},q[z][V]=U,n.setValue("connections",$n(q),{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=(z,V,W)=>g(z,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=(z,V,W)=>g(z,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=(z,V,W)=>g(z,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=z=>b(z,"tools"),e[17]=b,e[18]=j):j=e[18];const R=j;let M;e[19]!==b?(M=z=>b(z,"resources"),e[19]=b,e[20]=M):M=e[20];const D=M;let C;e[21]!==b?(C=z=>b(z,"prompts"),e[21]=b,e[22]=C):C=e[22];const T=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(hi,{}),e[23]=E):E=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=z=>u({type:"SET_ACTIVE_TAB",payload:z}),e[24]=I):I=e[24];let O;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==T||e[30]!==D||e[31]!==R||e[32]!==N||e[33]!==k||e[34]!==x?(O=o.jsx(Cd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:R,toggleAllResources:D,toggleAllPrompts:T,onTabChange:I},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=T,e[30]=D,e[31]=R,e[32]=N,e[33]=k,e[34]=x,e[35]=O):O=e[35];let B;e[36]!==l||e[37]!==r||e[38]!==O?(B=o.jsx(P.Suspense,{fallback:E,children:o.jsx(kd,{connectionId:r,onAuthenticate:l,children:O})}),e[36]=l,e[37]=r,e[38]=O,e[39]=B):B=e[39];let L;e[40]!==i?(L=o.jsx(th,{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]!==B||e[43]!==L?($=o.jsxs(on,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[B,L]}),e[42]=B,e[43]=L,e[44]=$):$=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==$?(F=o.jsx(an,{open:s,onOpenChange:i,children:$}),e[45]=i,e[46]=s,e[47]=$,e[48]=F):F=e[48],F}const qi={tools:null,resources:null,prompts:null},Td=Il.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Rd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Dd(t){const e=K.c(11),{url:s,agentId:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{we("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),_e.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(Mi,{size:20,className:"text-green-600"}):o.jsx(Ei,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=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,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Md(t){const e=K.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{we("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=fa(i),m=Rd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),_e.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 Id(t){const e=K.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=P.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{we("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=fa(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),_e.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(Mi,{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 u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(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,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=xe(),s=He({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),[i,r]=P.useState(null),[n,a]=P.useState(!1),[l,h]=P.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=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-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),we("agent_typegen_key_generated",{agent_id:c})}catch{we("agent_typegen_key_failed",{agent_id:c}),_e.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{we("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),_e.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(Ie,{size:14,className:"animate-spin"}):o.jsx(rh,{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:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Mi,{size:12,className:"text-green-600"}):o.jsx(Ei,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Pd,{apiKey:i,agentId:c})]})}function Pd(t){const e=K.c(21),{apiKey:s,agentId:i}=t,[r,n]=P.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-C5KFZJmQ.js","assets/index-C9M4Xv-S.js","assets/index-DXHNyf1g.css","assets/pair-D6t7TZZY.js","assets/agent-icon-CL45Wifm.js","assets/AlertCircle-CGS7SlNZ.js","assets/Tool01-Cj173b_Q.js","assets/XClose-Rxztrnzf.js","assets/RefreshCcw01-DlTzZS8a.js","assets/ArrowNarrowLeft-BvcKCPPt.js","assets/XCircle-D_4uFiCh.js","assets/ArrowUpRight-BfE23c8s.js","assets/ZapSquare-Dzrt3oay.js","assets/Users03-BAiUjF-1.js","assets/CheckCircle-DQGoPzYM.js","assets/ChevronDown-Dle378FN.js","assets/ChevronRight-BwTBPBXD.js","assets/ChevronUp-DOPSv7Jo.js","assets/DotsVertical-BuAzAdDZ.js","assets/Container-Bjdb96SI.js","assets/Star01-CxLxZthD.js","assets/Palette-1qL25a9u.js","assets/SearchMd-JWdfIDAa.js","assets/index-BRC1FK7F.js","assets/tooltip-B3IUO41H.js","assets/X-DqLs9vpH.js","assets/LinkExternal01-ryVwfw5_.js","assets/Lock01-D9gVlZ3n.js","assets/Sun-D1drbPvR.js","assets/Play-C6odCWa1.js","assets/Plus-CGctI5qa.js","assets/Settings02-DtwFPoYp.js","assets/Shield01-Dj1UOyDV.js","assets/Trash01-DmugmVtH.js","assets/User01-DNfbm8LW.js","assets/Zap-DCSjpSJ7.js","assets/index-BH7Qrxij.js","assets/use-copy-BSXck2x7.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-o_JVdycy.js","assets/content-blocks-o63cs2vh.js","assets/types-M1_25Vrf.js","assets/constants-BBeVlOcv.js","assets/chat-context-B5mCE2Dl.js","assets/use-virtual-mcp-Ci4PPj2K.js","assets/use-collections-Da70-nLG.js","assets/use-ai-providers-Dqu6jx-F.js","assets/use-decopilot-events-B-oXB6oi.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-COfJsoNk.js","assets/use-organization-settings-BVe1RnJv.js","assets/shell-layout-CKhsw5Sh.js","assets/required-auth-layout-B-n0CRtk.js","assets/use-org-sso-B4E1THrG.js","assets/integration-icon-CikcQgPA.js","assets/use-mcp-tools-UPubU5dS.js"])))=>i.map(i=>d[i]);
2
+ import{o as Ut,r as P,p as Tl,q as Rl,e as K,s as xe,K as As,n as Ko,a as qo,c as te,j as o,l as Ie,B as se,E as $t,b as ki,v as ai,f as At,d as en,w as Dl,x as _e,y as Ml,V as Il,t as we,z as Go,C as Al,D as Zt,F as Pl,G as yn,L as Bl,H as zi,I as Zs,J as ct,M as Yo,P as Ll,_ as Ol,Q as Xo,R as Jo,T as zl,g as $l}from"./index-C9M4Xv-S.js";import{C as Ee,u as Fl,w as Hl,A as Wl,T as Ul,a as Vl}from"./index-BAEkPxc0.js";import{I as ds}from"./integration-icon-CikcQgPA.js";import{S as Pt,u as He,g as Zo,a as Qo}from"./constants-BBeVlOcv.js";import{u as yt,a as Kl}from"./use-virtual-mcp-Ci4PPj2K.js";import{a as ql}from"./Users03-BAiUjF-1.js";import{u as ea,a as lt,b as Ni,c as ji,t as Gl,d as wn}from"./chat-context-B5mCE2Dl.js";import{i as Ps}from"./AlertCircle-CGS7SlNZ.js";import{i as Yl}from"./CheckCircle-DQGoPzYM.js";import{n as Cn,a as Xl}from"./ZapSquare-Dzrt3oay.js";import{i as Jl,a as Zl,b as Ql,c as Ei,d as ec}from"./XCircle-D_4uFiCh.js";import{s as ls,i as tc}from"./XClose-Rxztrnzf.js";import{c as sc,r as ic,p as ta,f as kn,a as rc,F as nc,t as Nn,M as tn,G as sa,L as oc,i as ac,b as lc,d as cc,e as hc}from"./pair-D6t7TZZY.js";import{C as dc,a as jn,b as En,c as uc,d as fc,e as mc,f as _c}from"./command-Cwx2tkAC.js";import{P as Hs,a as Ws,b as Us}from"./popover-DvYGtEfv.js";import{i as Ts,a as gi,b as pc,c as gc,p as Ti,g as Ri,d as sn,e as ia,h as ur,f as $i,j as Tn,A as Rn,k as ra,l as vc,m as xc,n as bc,t as Sc,o as yc,q as li,r as na,s as oa,u as aa,v as Dn,w as wc,x as Rs,y as Cc,z as kc,B as Nc,C as la}from"./agent-icon-CL45Wifm.js";import{u as us,a as jc}from"./use-mcp-tools-UPubU5dS.js";import{u as Ec,a as Tc}from"./use-ai-providers-Dqu6jx-F.js";import{g as Vt,c as Mn,u as Rc,b as fr,d as Dc,e as Mc,f as Ic,T as Ac}from"./index-BxjSTUlr.js";import{u as rn,i as Pc}from"./shell-layout-CKhsw5Sh.js";import{i as Bc,P as at,u as Lc,c as Oc,d as zc,e as $c}from"./index-BRC1FK7F.js";import{u as ca,T as Ke,a as qe,b as Ge,c as Fc}from"./tooltip-B3IUO41H.js";import{u as Hc}from"./use-status-sounds-BJnu3Bk4.js";import{E as Bs}from"./empty-state-BNIqiqmO.js";import{A as Wc,a as Uc,b as Vc,c as Kc,R as ha,d as qc,e as Gc}from"./accordion-UDoYmaIB.js";import{u as Di,a as nn,b as Yc}from"./use-connection-BpZtYbNe.js";import{g as Xc}from"./constants-DWJv5284.js";import{u as Jc,g as Zc}from"./types-M1_25Vrf.js";import{U as da}from"./user-BcXNPJaC.js";import{T as Qc,u as ua}from"./tools-list-CRd4heFY.js";import{u as Fi}from"./unwrap-tool-result-BYXdCQMg.js";import{s as fa,g as eh}from"./connection-slug-eyAPH6o3.js";import{A as ma,a as _a,b as pa,c as ga,d as va,e as xa,f as ba,g as Sa}from"./alert-dialog-Cs2lf0wi.js";import{D as th,a as on,b as an,c as ya,d as wa}from"./dialog-o_JVdycy.js";import{C as sh,a as In}from"./card-ChPTWuEz.js";import{I as fs}from"./input-D7aJNH3r.js";import{L as Ds}from"./label-nMjNWeer.js";import{S as ts,a as ss,b as is,c as rs,d as It}from"./select-BpWMsKq-.js";import{S as mr}from"./switch-B20JmlBf.js";import{T as An}from"./textarea-UvbmRoe-.js";import{i as ci}from"./Play-C6odCWa1.js";import{s as cs}from"./Plus-CGctI5qa.js";import{a as ih}from"./Settings02-DtwFPoYp.js";import{t as Ca}from"./Tool01-Cj173b_Q.js";import{s as _r}from"./Trash01-DmugmVtH.js";import{S as ka}from"./scroll-area-C9jltrVR.js";import{i as Na,a as rh}from"./SearchMd-JWdfIDAa.js";import{C as nh}from"./collection-tabs-CeSeUpFD.js";import{C as oh}from"./checkbox-CgeI-KLu.js";import{u as ah,T as Hi,a as lh,b as ch,c as Wi}from"./tabs-BX6UCACt.js";import{D as hh,a as dh,b as uh}from"./drawer-DuBsYQy-.js";import{i as Mi,t as pr}from"./ChevronDown-Dle378FN.js";import{n as Kt}from"./LinkExternal01-ryVwfw5_.js";import{S as fh}from"./index-BH7Qrxij.js";import{D as ns,a as os,b as as,c as St,d as mh,e as _h,f as ph}from"./dropdown-menu-NLdCnhe2.js";import{i as ja}from"./RefreshCcw01-DlTzZS8a.js";import{V as gh}from"./view-mode-toggle-DbMW5Bpx.js";import{G as vh}from"./lean-canvas-recruit-modal-D2NK3tQ5.js";import{M as xh}from"./select-model-B5AXvSeg.js";import{u as Vs,a as bh,b as Sh,c as yh,A as wh,d as Ch}from"./automation-list-row-7DtUnIlg.js";import{i as Ls}from"./Zap-DCSjpSJ7.js";import{S as kh}from"./search-input-J2Up5mqM.js";import"./use-navigate-to-agent-CHUquCU3.js";import"./use-tasks-COfJsoNk.js";import"./use-collections-Da70-nLG.js";import"./collection-search-Xsvaup1l.js";import"./form-DYhJizGS.js";import"./Star01-CxLxZthD.js";import"./Lock01-D9gVlZ3n.js";import"./X-DqLs9vpH.js";import"./toggle-group-Tf_rUt5t.js";import"./index-D8ndbAa3.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-BBgrlkNf.js";import"./use-registry-connections-o0Gae1A5.js";import"./use-organization-settings-BVe1RnJv.js";import"./useInfiniteQuery-DtUmiZEX.js";import"./infiniteQueryObserver-CrM8xD0J.js";import"./extract-connection-data-C1rFp-EK.js";import"./Container-Bjdb96SI.js";import"./connection-form-helpers-1Nu4mg1N.js";import"./use-infinite-scroll-BDVxH8Nj.js";import"./useSuspenseInfiniteQuery-CCko66uu.js";import"./badge-Cpo1XmAx.js";import"./ChevronRight-BwTBPBXD.js";import"./use-decopilot-events-B-oXB6oi.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-BSXck2x7.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-D1drbPvR.js";import"./index-QdTc2-Rk.js";import"./ArrowNarrowLeft-BvcKCPPt.js";import"./ArrowUpRight-BfE23c8s.js";import"./ChevronUp-DOPSv7Jo.js";import"./DotsVertical-BuAzAdDZ.js";import"./Palette-1qL25a9u.js";import"./Shield01-Dj1UOyDV.js";import"./User01-DNfbm8LW.js";import"./skeleton-BhL9H11L.js";import"./avatar-BcGOvZ9P.js";import"./index-C-CxSS2X.js";import"./collection-search-CvOZQgZf.js";import"./use-create-virtual-mcp-DjyE6zmA.js";import"./task-status-BIfmjfC3.js";import"./required-auth-layout-B-n0CRtk.js";import"./use-org-sso-B4E1THrG.js";import"./collections-BgKSt6n0.js";import"./settings-section-ZpAPCH6i.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Nh(t,e){const s=Ut(e);return jh({filters:{...t,status:"pending"}},s).length}function Pn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function jh(t={},e){const s=Ut(e).getMutationCache(),i=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=Pn(s,t)),P.useEffect(()=>{i.current=t}),P.useSyncExternalStore(P.useCallback(n=>s.subscribe(()=>{const a=Tl(r.current,Pn(s,i.current));r.current!==a&&(r.current=a,Rl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Eh(t,e){const s=K.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Pt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=He(n),l=Ut();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Ko(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==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[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=qo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),P.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function gs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bn(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 Th(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Rh(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Dh),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 Dh(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 Mh(t){const e=K.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 u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,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 y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Ih(t){const e=K.c(19),{part:s}=t,i=s.input?.agent_id,r=yt(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 u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=te("shrink-0 font-medium",d),e[3]=d,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(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Jl,{size:12,className:"text-destructive"}):c?o.jsx(Ps,{size:12,className:"text-warning"}):o.jsx(Yl,{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]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=K.c(58),{onClose:s,back:i,className:r}=t,[n,a]=P.useState(null),{messages:l}=ea(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=Ni();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]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=Z=>Z.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=sc(l),j=[...l].reverse().find(Vh),R=j?.metadata?.usage,M=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,D=R?.contextTokens??R?.totalTokens??0,C=M&&M>0?(D/M*100).toFixed(1):null,T=l;let E;e[19]!==T?(E=T.filter(Uh).reduce(Wh,0),e[19]=T,e[20]=E):E=e[20];const I=E,O=l;let B;e[21]!==O?(B=O.filter(Hh).reduce(Fh,0),e[21]=O,e[22]=B):B=e[22];const L=B,$=Math.max(0,N.totalTokens-I-L),F=l[0],z=l.at(-1),V=F?.metadata?.created_at??w?.created_at,W=z?.metadata?.created_at??w?.updated_at,U=l.filter($h),q=l.flatMap(Oh),A=u?.modelId?Th(u.modelId):"—",Y=d?.title??"Decopilot",J=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:Y},{label:"Model",value:A},{label:"Context Limit",value:M?gs(M):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?gs(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?gs(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?gs(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?gs(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Bn(V)},{label:"Last Activity",value:Bn(W)}];if(!w&&U.length===0){let Z;e[23]!==r?(Z=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Z):Z=e[24];let ue;e[25]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=ue):ue=e[25];let de;e[26]!==i?(de=i?o.jsx(Cn,{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 he;e[28]!==s||e[29]!==de?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ue,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]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=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]=pe):pe=e[31];let We;e[32]!==Z||e[33]!==he?(We=o.jsxs("div",{className:Z,children:[he,pe]}),e[32]=Z,e[33]=he,e[34]=We):We=e[34],S=We;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(Cn,{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",_=q.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:q.map(Lh)})]}),f=o.jsx(Rh,{items:J});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==L||e[45]!==$||e[46]!==I?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Mh,{userTokens:I,assistantTokens:L,otherTokens:$})]}),e[44]=L,e[45]=$,e[46]=I,e[47]=p):p=e[47],g=U.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:U.map(Z=>{const ue=Z.metadata?.created_at,de=n?.id===Z.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Z),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",Z.role==="user"?"text-chart-1":"text-chart-2"),children:Z.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Z.id})]}),ue&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ue).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsxs(o.Fragment,{children:[Z.role==="assistant"&&(()=>{const he=Z.metadata?._request;if(!he)return null;const pe=he.systemSections??[],We=Math.max(1,...pe.map(Bh)),Pe=pe.reduce(Ph,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Pe/4).toLocaleString()," ","tok"]})]}),pe.map((ie,ge)=>{const Je=ie.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ge}`,fe=ie.chars/We*100,kt=Math.round(ie.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:Je}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",kt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${fe}%`}})})]},ge)})]})]})})(),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(Z,null,2)})]})]},Z.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.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 y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Ph(t,e){return t+e.chars}function Bh(t){return t.chars}function Lh(t,e){return o.jsx(Ih,{part:t},e)}function Oh(t){return(t.parts??[]).filter(zh)}function zh(t){return t.type==="tool-subtask"}function $h(t){return t.role!=="system"}function Fh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Hh(t){return t.role==="assistant"}function Wh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Uh(t){return t.role==="user"}function Vh(t){return t.role==="assistant"&&t.metadata?.usage}const Ln=["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"],On=["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 Kh(){const t=Ln[Math.floor(Math.random()*Ln.length)],e=On[Math.floor(Math.random()*On.length)];return`deco/${t}-${e}`}function qh(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 Gh(t){const e=K.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=He(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Zh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Jh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const M=Array.isArray(v)?v:v?.branches??[];let D;e[18]!==y?(D=C=>!y.has(C.name),e[18]=y,e[19]=D):D=e[19],w=M.filter(Xh).filter(D).map(Yh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let R;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(R={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=R):R=e[25],R}function Yh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Xh(t){return typeof t.name=="string"}function Jh(t){return{name:t,source:"yours"}}function Zh(t){return qh(t)}function Qh(t){const e=K.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=P.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=Gh(_);let b;e[9]!==u?(b=I=>{u(I),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ts,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=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:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(fc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=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:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Kh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&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[17]=v,e[18]=j):j=e[18];let R;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(R=!v&&!g&&f.length===0&&p.length===0&&o.jsx(dc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=R):R=e[23];let M;e[24]!==S||e[25]!==f?(M=f.length>0&&o.jsx(jn,{heading:"Your branches",children:f.map(I=>o.jsxs(En,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))}),e[24]=S,e[25]=f,e[26]=M):M=e[26];let D;e[27]!==p||e[28]!==S?(D=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(uc,{}),o.jsx(jn,{heading:"Other branches in repo",children:p.map(I=>o.jsxs(En,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),I.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",I.author]})]},I.name))})]}),e[27]=p,e[28]=S,e[29]=D):D=e[29];let C;e[30]!==D||e[31]!==j||e[32]!==R||e[33]!==M?(C=o.jsxs(mc,{children:[j,R,M,D]}),e[30]=D,e[31]=j,e[32]=R,e[33]=M,e[34]=C):C=e[34];let T;e[35]!==C||e[36]!==N?(T=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(_c,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=T):T=e[37];let E;return e[38]!==d||e[39]!==T||e[40]!==k?(E=o.jsxs(Us,{open:d,onOpenChange:m,children:[k,T]}),e[38]=d,e[39]=T,e[40]=k,e[41]=E):E=e[41],E}function ed(){const t=K.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=Ni(),{data:i}=ki.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Zo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=yt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ql,{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]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Qh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==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[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function td(){const t=K.c(26),{org:e}=xe(),s=Ec(),{isChatEmpty:i}=ea(),[r,n]=P.useState("chat"),a=Fl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.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&&!Hl(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(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(ed,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,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(Ah,{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(Ee,{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 Ea(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{fallback:e,children:o.jsx(P.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(td,{})})}),t[1]=s):s=t[1],s}async function sd(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 Ta=["VM_START"],Qs=new Map,id=t=>`${t.virtualMcpId}::${t.branch??""}`,Ui=new Set,vi={mark:(t,e)=>Ui.add(`${t}::${e}`),clear:(t,e)=>Ui.delete(`${t}::${e}`),isStopped:(t,e)=>Ui.has(`${t}::${e}`)};function ln(t){const e=Ut();return qo({mutationKey:Ta,mutationFn:async s=>{s.branch&&vi.clear(s.virtualMcpId,s.branch);const i=id(s),r=Qs.get(i);if(r)return r;const n=(async()=>(await sd(t,"VM_START",s)).structuredContent)();Qs.set(i,n);try{return await n}finally{Qs.get(i)===n&&Qs.delete(i)}},onSuccess:()=>{ai(e)}})}function Ra(t,e){const s=K.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ta,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],Nh(i)>0}const rd={settings:gc,automations:pc,env:gi,preview:Zl,git:Ts};function zn(t){const e=Ti(t);if(e.type==="icon"){const s=Ri(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Vi(t){if(t.kind==="system")return{kind:"component",Component:rd[t.tabId]};const e=zn(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=zn(s.icon);return i||{kind:"fallback"}}function nd(t){const{org:e}=xe(),s=He({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),{data:i}=Dl({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 Da(t){const e=K.c(8),s=At();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=en(i),n=yt(t.virtualMcpId),a=nd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Vt(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Di(f),{activeTab:g,mainOpen:v}=ic({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(od)}:null}),b=ta(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 R=kn(j.appId,j.toolName);x.set(R,{id:R,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const R=kn(j.connectionId,j.toolName);x.set(R,{id:R,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Vi({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Vi({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:Vi({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const R=rc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:M=>({...M,main:R}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function od(t){return{id:t.id}}function ad(t){const e=K.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=P.useState(!1),[g,v]=P.useState("icons"),[b,S]=P.useState(""),[x,y]=P.useState("blue");let k;e[0]!==s?(k=Ti(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=fe=>{i($i(fe,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const R=j;let M;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(M=fe=>{y(fe),r?.(fe),w.type==="icon"?i($i(w.name,fe)):w.type==="url"&&i(Tn(w.url,fe))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=M):M=e[10];const D=M;let C;e[11]!==i||e[12]!==N?(C=fe=>{i(Tn(fe,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const T=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const fe=sn(),kt=fe[Math.floor(Math.random()*fe.length)];i($i(kt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const I=E;let O,B,L,$,F,z,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const fe={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};B=Us,z=_?!1:f,V=p,O=Hs,F=!0,W="button",L=_,$=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",fe[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=O,e[22]=B,e[23]=L,e[24]=$,e[25]=F,e[26]=z,e[27]=V,e[28]=W}else O=e[21],B=e[22],L=e[23],$=e[24],F=e[25],z=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(Rn,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let q;e[34]!==_||e[35]!==m?(q=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(ra,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=q):q=e[36];let A;e[37]!==L||e[38]!==$||e[39]!==U||e[40]!==q||e[41]!==W?(A=o.jsxs("button",{type:W,disabled:L,className:$,children:[U,q]}),e[37]=L,e[38]=$,e[39]=U,e[40]=q,e[41]=W,e[42]=A):A=e[42];let Y;e[43]!==O||e[44]!==F||e[45]!==A?(Y=o.jsx(O,{asChild:F,children:A}),e[43]=O,e[44]=F,e[45]=A,e[46]=Y):Y=e[46];let J;e[47]!==n||e[48]!==s?(J=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Rn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=J):J=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 ne;e[51]!==ce?(ne=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ne):ne=e[52];let Z;e[53]!==ne?(Z=o.jsx("button",{type:"button",onClick:ee,className:ne,children:"Icons"}),e[53]=ne,e[54]=Z):Z=e[54];let ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>v("upload"),e[55]=ue):ue=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==de?(he=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:ue,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let We;e[60]===Symbol.for("react.memo_cache_sentinel")?(We=o.jsx("div",{className:"flex-1"}),e[60]=We):We=e[60];let Pe;e[61]!==Z||e[62]!==pe?(Pe=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Z,pe,We]}),e[61]=Z,e[62]=pe,e[63]=Pe):Pe=e[63];let ie;e[64]!==D||e[65]!==I||e[66]!==R||e[67]!==T||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(ie=g==="icons"?o.jsx(dd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:D,onSelectIcon:R,onRandom:I,currentIconName:w.type==="icon"?w.name:null}):o.jsx(ud,{onUpload:T}),e[64]=D,e[65]=I,e[66]=R,e[67]=T,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=ie):ie=e[73];let ge;e[74]!==J||e[75]!==Pe||e[76]!==ie?(ge=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ld,children:o.jsxs("div",{className:"flex flex-col",children:[J,Pe,ie]})}),e[74]=J,e[75]=Pe,e[76]=ie,e[77]=ge):ge=e[77];let Je;return e[78]!==B||e[79]!==z||e[80]!==V||e[81]!==Y||e[82]!==ge?(Je=o.jsxs(B,{open:z,onOpenChange:V,children:[Y,ge]}),e[78]=B,e[79]=z,e[80]=V,e[81]=Y,e[82]=ge,e[83]=Je):Je=e[83],Je}function ld(t){return t.preventDefault()}function cd(t){const e=K.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=P.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=ia(s);l=Us,d=r,m=n,a=Hs,u=!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]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=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]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=xc.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:hd,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]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function hd(t){return t.preventDefault()}function dd(t){const e=K.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,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=sn(),y=ia(r);u=s.trim()?x.filter(D=>{const C=ur(D),T=s.toLowerCase();return C.includes(T)||D.toLowerCase().includes(T)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=D=>i(D.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(vc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let R;e[21]!==l?(R=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]=R):R=e[22];let M;e[23]!==n||e[24]!==r?(M=o.jsx(cd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=M):M=e[25],e[26]!==R||e[27]!==M||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,R,M]}),e[26]=R,e[27]=M,e[28]=N,e[29]=p):p=e[29],c=ka,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(D=>{const C=Ri(D);return C?o.jsx("button",{type:"button",onClick:()=>a(D),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===D?te(y.bg,y.text):te(y.text,"hover:bg-accent")),title:D,children:o.jsx(C,{size:18})},D):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]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.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 ud(t){const e=K.c(27),{onUpload:s}=t,i=P.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){_e.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{_e.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=P.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,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(Ql,{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=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.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 y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function fd(t){const e=K.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ti(s);if(n.type==="icon"){const a=Ri(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(Bc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function md(t){const e=K.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=P.useState(!1),[h,c]=P.useState("");let u;e[0]!==s?(u=Ti(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,R,M;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const B=sn();g=h.trim()?B.filter(U=>{const q=h.toLowerCase();return ur(U).includes(q)||U.toLowerCase().includes(q)}):B,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(fd,{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",R="w-64 p-0",M=_d,w="flex flex-col";let z;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=z):z=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[z,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=ka,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const q=Ri(U);return q?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:ur(U),children:o.jsx(q,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),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]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=R,e[23]=M}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],R=e[22],M=e[23];let D;e[40]!==x||e[41]!==y?(D=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=D):D=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 T;e[45]!==_||e[46]!==D||e[47]!==C||e[48]!==k?(T=o.jsxs(_,{className:k,children:[D,C]}),e[45]=_,e[46]=D,e[47]=C,e[48]=k,e[49]=T):T=e[49];let E;e[50]!==T||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,T]}),e[50]=T,e[51]=w,e[52]=N,e[53]=E):E=e[53];let I;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==R||e[58]!==M?(I=o.jsx(f,{align:j,className:R,onOpenAutoFocus:M,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=R,e[58]=M,e[59]=I):I=e[59];let O;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==I?(O=o.jsxs(p,{open:v,onOpenChange:b,children:[S,I]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=I,e[65]=O):O=e[65],O}function _d(t){return t.preventDefault()}function hi(){const t=K.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(Ie,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Ki(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(Ml,{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 pd(t){const e=K.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 u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=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]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(oh,{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 cn(t){const e=K.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 d=s.map(gd);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(pd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),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 u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function gd(t){return t.id}function vd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=jc(c);let d;e[6]!==u.tools?(d=u.tools.map(xd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function xd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Qc,{annotations:t.annotations,_meta:t._meta})}}function bd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Jc(c);let d;e[6]!==u.resources?(d=u.resources.map(Sd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Sd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function yd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=ah(c);let d;e[6]!==u.prompts?(d=u.prompts.map(wd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(cn,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function wd(t){return{id:t.name,name:t.name,description:t.description}}function Cd(t){const e=K.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,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]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,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 y;e[16]!==v||e[17]!==x?(y=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]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=O=>m(O),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(nh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let R;e[25]!==g||e[26]!==j?(R=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]=R):R=e[27];let M;e[28]!==R||e[29]!==N?(M=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,R]}),e[28]=R,e[29]=N,e[30]=M):M=e[30];let D;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(D=i==="tools"&&o.jsx($t,{fallback:Ki("Tools not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(vd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(O,B)=>a(r,O,B)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=D):D=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx($t,{fallback:Ki("Resources not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(bd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(O,B)=>l(r,O,B)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let T;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(T=i==="prompts"&&o.jsx($t,{fallback:Ki("Prompts not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(hi,{}),children:o.jsx(yd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(O,B)=>h(r,O,B)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=T):T=e[45];let E;e[46]!==D||e[47]!==C||e[48]!==T?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[D,C,T]}),e[46]=D,e[47]=C,e[48]=T,e[49]=E):E=e[49];let I;return e[50]!==M||e[51]!==E||e[52]!==y?(I=o.jsxs(o.Fragment,{children:[y,M,E]}),e[50]=M,e[51]=E,e[52]=y,e[53]=I):I=e[53],I}function kd(t){const e=K.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=ua(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(bc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,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 Nd(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 $n(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function jd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function Ed(t){const e=K.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,u]=P.useReducer(jd,h),d=nn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Nd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(z,V,W,U)=>{const q=f[z]?.[V];let A;q===null?A=U.filter(J=>J!==W):q?.includes(W)?A=q.filter(J=>J!==W):(A=[...q??[],W],A.length===U.length&&(A=null));const Y={...f};Y[z]?Y[z]={...Y[z]}:Y[z]={tools:null,resources:null,prompts:null},Y[z][V]=A,n.setValue("connections",$n(Y),{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=(z,V)=>{const U=f[z]?.[V]===null?[]:null,q={...f};q[z]?q[z]={...q[z]}:q[z]={tools:null,resources:null,prompts:null},q[z][V]=U,n.setValue("connections",$n(q),{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=(z,V,W)=>g(z,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=(z,V,W)=>g(z,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=(z,V,W)=>g(z,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=z=>b(z,"tools"),e[17]=b,e[18]=j):j=e[18];const R=j;let M;e[19]!==b?(M=z=>b(z,"resources"),e[19]=b,e[20]=M):M=e[20];const D=M;let C;e[21]!==b?(C=z=>b(z,"prompts"),e[21]=b,e[22]=C):C=e[22];const T=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(hi,{}),e[23]=E):E=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=z=>u({type:"SET_ACTIVE_TAB",payload:z}),e[24]=I):I=e[24];let O;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==T||e[30]!==D||e[31]!==R||e[32]!==N||e[33]!==k||e[34]!==x?(O=o.jsx(Cd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:R,toggleAllResources:D,toggleAllPrompts:T,onTabChange:I},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=T,e[30]=D,e[31]=R,e[32]=N,e[33]=k,e[34]=x,e[35]=O):O=e[35];let B;e[36]!==l||e[37]!==r||e[38]!==O?(B=o.jsx(P.Suspense,{fallback:E,children:o.jsx(kd,{connectionId:r,onAuthenticate:l,children:O})}),e[36]=l,e[37]=r,e[38]=O,e[39]=B):B=e[39];let L;e[40]!==i?(L=o.jsx(th,{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]!==B||e[43]!==L?($=o.jsxs(on,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[B,L]}),e[42]=B,e[43]=L,e[44]=$):$=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==$?(F=o.jsx(an,{open:s,onOpenChange:i,children:$}),e[45]=i,e[46]=s,e[47]=$,e[48]=F):F=e[48],F}const qi={tools:null,resources:null,prompts:null},Td=Il.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Rd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Dd(t){const e=K.c(11),{url:s,agentId:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{we("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),_e.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(Mi,{size:20,className:"text-green-600"}):o.jsx(Ei,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=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,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Md(t){const e=K.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{we("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=fa(i),m=Rd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),_e.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 Id(t){const e=K.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=P.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{we("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=fa(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),_e.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(Mi,{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 u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(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,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=xe(),s=He({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),[i,r]=P.useState(null),[n,a]=P.useState(!1),[l,h]=P.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=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-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),we("agent_typegen_key_generated",{agent_id:c})}catch{we("agent_typegen_key_failed",{agent_id:c}),_e.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{we("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),_e.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(Ie,{size:14,className:"animate-spin"}):o.jsx(rh,{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:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Mi,{size:12,className:"text-green-600"}):o.jsx(Ei,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Pd,{apiKey:i,agentId:c})]})}function Pd(t){const e=K.c(21),{apiKey:s,agentId:i}=t,[r,n]=P.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 u;e[0]!==i||e[1]!==s||e[2]!==c?(u=async()=>{we("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]=u):u=e[3];const d=u,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(Mi,{size:12,className:"text-green-600"}):o.jsx(Ei,{size:12}),e[13]=r,e[14]=b):b=e[14];let S;e[15]!==d||e[16]!==b?(S=o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:b}),e[15]=d,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 Bd(t){const e=K.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(P.Suspense,{fallback:i,children:o.jsx(Ad,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Ld(t){const e=K.c(37),{open:s,onOpenChange:i,virtualMcp:r}=t,{org:n}=xe(),a=`/api/${n.slug}/mcp/virtual-mcp/${r.id}`;let l;e[0]!==a?(l=new URL(a,window.location.origin),e[0]=a,e[1]=l):l=e[1];const h=l;let c;e[2]!==r.id||e[3]!==r.title?(c=r.title||`agent-${r.id?.slice(0,8)??"default"}`,e[2]=r.id,e[3]=r.title,e[4]=c):c=e[4];const u=c,d=ca();let m;e[5]!==r.id||e[6]!==h.href?(m=o.jsx(Dd,{url:h.href,agentId:r.id}),e[5]=r.id,e[6]=h.href,e[7]=m):m=e[7];let _,f;e[8]!==u||e[9]!==r.id||e[10]!==h.href?(_=o.jsx(Md,{url:h.href,serverName:u,agentId:r.id}),f=o.jsx(Id,{url:h.href,serverName:u,agentId:r.id}),e[8]=u,e[9]=r.id,e[10]=h.href,e[11]=_,e[12]=f):(_=e[11],f=e[12]);let p;e[13]!==m||e[14]!==_||e[15]!==f?(p=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[m,_,f]})}),e[13]=m,e[14]=_,e[15]=f,e[16]=p):p=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"border-t border-border"}),e[17]=g):g=e[17];let v;e[18]!==r?(v=o.jsx(Bd,{virtualMcp:r}),e[18]=r,e[19]=v):v=e[19];let b;e[20]!==p||e[21]!==v?(b=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,g,v]}),e[20]=p,e[21]=v,e[22]=b):b=e[22];const S=b;if(d){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(hh,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=w):w=e[23];let N;e[24]!==S?(N=o.jsx(dh,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[w,S]})}),e[24]=S,e[25]=N):N=e[25];let j;return e[26]!==i||e[27]!==s||e[28]!==N?(j=o.jsx(uh,{open:s,onOpenChange:i,children:N}),e[26]=i,e[27]=s,e[28]=N,e[29]=j):j=e[29],j}let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ya,{children:o.jsx(wa,{children:"Connect"})}),e[30]=x):x=e[30];let y;e[31]!==S?(y=o.jsxs(on,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[x,S]}),e[31]=S,e[32]=y):y=e[32];let k;return e[33]!==i||e[34]!==s||e[35]!==y?(k=o.jsx(an,{open:s,onOpenChange:i,children:y}),e[33]=i,e[34]=s,e[35]=y,e[36]=k):k=e[36],k}function Od(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 zd(t){const e=K.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=nn(s),{org:u}=xe();if(!c)return null;let d;e[0]!==c?(d=eh(c),e[0]=c,e[1]=d):d=e[1];const m=d;let _;e[2]!==s?(_=o.jsx(Wd,{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]!==u.slug||e[16]!==m||e[17]!==i?(f=o.jsx(Hd,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:m,orgSlug:u.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]=u.slug,e[16]=m,e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==_||e[20]!==f?(p=o.jsx(P.Suspense,{fallback:_,children:f}),e[19]=_,e[20]=f,e[21]=p):p=e[21],p}const Fn="__new_instance__";async function $d(t,e){const s=t?.idToken??null;if(s){const r=Hn(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 Hn(e)}function Hn(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 Fd(t){const e=K.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=Di(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===Fn?a?.():n(i,p)},e[2]=i,e[3]=a,e[4]=n,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ss,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(is,{})}),e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==h||e[9]!==r){let p;e[11]!==i||e[12]!==r?(p=g=>o.jsx(It,{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],d=h.map(p),e[7]=i,e[8]=h,e[9]=r,e[10]=d}else d=e[10];let m;e[14]!==a?(m=a&&o.jsx(It,{value:Fn,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=m):m=e[15];let _;e[16]!==d||e[17]!==m?(_=o.jsxs(rs,{children:[d,m]}),e[16]=d,e[17]=m,e[18]=_):_=e[18];let f;return e[19]!==i||e[20]!==c||e[21]!==_?(f=o.jsxs(ts,{value:i,onValueChange:c,children:[u,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=f):f=e[22],f}function Hd(t){const e=K.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:u,onOpenSettings:d,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=ua(g),S=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=S?"border-destructive/50 bg-destructive/5":"border-border";let y;e[2]!==x?(y=te("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=y):y=e[3];let k;e[4]!==h||e[5]!==l?(k={org:h,appSlug:l},e[4]=h,e[5]=l,e[6]=k):k=e[6];let w;e[7]!==n||e[8]!==i?(w=o.jsx(ds,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=w):w=e[9];let N;e[10]!==i?(N=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=N):N=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 R;e[15]!==N||e[16]!==j?(R=o.jsxs("div",{className:"flex-1 min-w-0",children:[N,j]}),e[15]=N,e[16]=j,e[17]=R):R=e[17];let M;e[18]!==s||e[19]!==S||e[20]!==_?(M=S?o.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:U=>{U.preventDefault(),U.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(Ke,{delayDuration:0,children:[o.jsx(qe,{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(ih,{size:16})})}),o.jsx(Ge,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=S,e[20]=_,e[21]=M):M=e[21];let D;e[22]!==k||e[23]!==w||e[24]!==R||e[25]!==M?(D=o.jsxs(Bl,{to:"/$org/settings/connections/$appSlug",params:k,className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[w,R,M]}),e[22]=k,e[23]=w,e[24]=R,e[25]=M,e[26]=D):D=e[26];let C;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==f||e[31]!==u?(C=c&&o.jsx(Fd,{appName:c,connectionId:s,usedConnectionIds:u,onSwitchInstance:f,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=f,e[31]=u,e[32]=C):C=e[32];let T;e[33]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(yc,{size:13}),e[33]=T):T=e[33];let E;e[34]!==d?(E=o.jsx(qe,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,"aria-label":"Configure resources",children:T})}),e[34]=d,e[35]=E):E=e[35];let I;e[36]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ge,{side:"bottom",children:"Configure resources"}),e[36]=I):I=e[36];let O;e[37]!==E?(O=o.jsxs(Ke,{delayDuration:0,children:[E,I]}),e[37]=E,e[38]=O):O=e[38];let B;e[39]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(ls,{size:13}),e[39]=B):B=e[39];let L;e[40]!==m?(L=o.jsx(qe,{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:B})}),e[40]=m,e[41]=L):L=e[41];let $;e[42]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ge,{side:"bottom",children:"Remove"}),e[42]=$):$=e[42];let F;e[43]!==L?(F=o.jsxs(Ke,{delayDuration:0,children:[L,$]}),e[43]=L,e[44]=F):F=e[44];let z;e[45]!==O||e[46]!==F?(z=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[O,F]}),e[45]=O,e[46]=F,e[47]=z):z=e[47];let V;e[48]!==C||e[49]!==z?(V=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[C,z]}),e[48]=C,e[49]=z,e[50]=V):V=e[50];let W;return e[51]!==D||e[52]!==V||e[53]!==y?(W=o.jsxs("div",{className:y,children:[D,V]}),e[51]=D,e[52]=V,e[53]=y,e[54]=W):W=e[54],W}function Wd(t){const e=K.c(17),{connection_id:s}=t,i=nn(s);if(!i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ma,{}),e[0]=d):d=e[0],d}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 u;return e[15]!==h?(u=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=u):u=e[16],u}function Ma(){const t=K.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 Ud({virtualMcpId:t}){const{org:e}=xe(),s=He({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),i=Ut(),r=yt(t),n=(r?.connections??[]).map(L=>L.connection_id).sort(),{data:a}=Ko({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:z}=Fi(F),V=(z?.tools??[]).filter(W=>!!Zc(W._meta)).map(W=>({name:W.name,description:W.description}));return{fetchOk:!0,id:$,title:z?.title??$,icon:z?.icon??null,uiTools:V}}catch{return{fetchOk:!1,id:$,title:$,icon:null,uiTools:[]}}}))}),l=(a??[]).filter(L=>L.uiTools.length>0),h=new Set(nc),c=r?.metadata?.ui,u=c?.pinnedViews??[],d=c?.layout?.defaultMainView??null,m=c?.layout?.chatDefaultOpen??!1,_=!d||d.type==="chat"?"chat":d.type==="instructions"||d.type==="connections"||d.type==="layout"?"settings":h.has(d.type)?d.type:`${d.type}:${d.id??""}:${d.toolName??""}`,[f,p]=P.useState(u),[g,v]=P.useState(_),[b,S]=P.useState(m),[x,y]=P.useState(!1),k=L=>{const[$,F,z]=L.split(":");return $?$==="chat"?{type:$}:h.has($)?{type:$}:$==="ext-apps"&&F?{type:"ext-apps",id:F,toolName:z||void 0}:null:null},w=P.useRef(!1);if(a&&a.length>0&&!w.current){w.current=!0;const L=new Set((a??[]).filter(z=>z.fetchOk).map(z=>z.id)),$=new Set(l.flatMap(z=>z.uiTools.map(V=>`${z.id}:${V.name}`))),F=u.filter(z=>!L.has(z.connectionId)||$.has(`${z.connectionId}:${z.toolName}`));if(F.length!==u.length){p(F);let z=g;d?.type==="ext-apps"&&!F.some(V=>V.connectionId===d.id&&V.toolName===d.toolName)&&(z="chat",v(z)),s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:F,layout:{defaultMainView:k(z),chatDefaultOpen:b}}}).then(V=>{Fi(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")})}).catch(()=>{p(u),v(_)})}}const N=(L,$,F)=>{y(!0),(async()=>{try{const V=await s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:L,layout:{defaultMainView:k($),chatDefaultOpen:F??b}}});Fi(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")}),_e.success("Layout updated")}catch(V){_e.error("Failed to update layout: "+(V instanceof Error?V.message:"Unknown error"))}finally{y(!1)}})()},j=(L,$)=>{const F=f.some(W=>W.connectionId===L&&W.toolName===$);let z,V=g;if(F){z=f.filter(U=>!(U.connectionId===L&&U.toolName===$));const W=`ext-apps:${L}:${$}`;g===W&&(V="chat",v(V))}else z=[...f,{connectionId:L,toolName:$,label:Nn($),icon:null}];p(z),N(z,V)},R=(L,$,F)=>{p(z=>z.map(V=>V.connectionId===L&&V.toolName===$?{...V,label:F}:V))},M=()=>{N(f,g)},D=(L,$,F)=>{p(V=>V.map(W=>W.connectionId===L&&W.toolName===$?{...W,icon:F}:W));const z=f.map(V=>V.connectionId===L&&V.toolName===$?{...V,icon:F}:V);N(z,g)},C=L=>{v(L),N(f,L)},T=n.length===0,E=a&&l.length===0,I=!!Vt(r),O=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];I&&(O.push({value:"env",label:"Terminal"}),O.push({value:"preview",label:"Preview"}));for(const L of f)O.push({value:`ext-apps:${L.connectionId}:${L.toolName}`,label:L.label||L.toolName});const B=l.length>0||T||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(sh,{className:"p-6 gap-5",children:[o.jsxs(In,{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(Ds,{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(ts,{value:g,onValueChange:C,children:[o.jsx(ss,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(is,{})}),o.jsx(rs,{children:O.map(L=>o.jsx(It,{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(Ds,{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(Ke,{delayDuration:0,children:[o.jsx(qe,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(mr,{checked:g==="chat"?!0:b,disabled:g==="chat"||x,onCheckedChange:L=>{S(L),N(f,g,L)}})})}),g==="chat"&&o.jsx(Ge,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),B&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(In,{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(Ds,{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."})]})}),T&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a connection above to configure pinned views."}),E&&!T&&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 z=f.some(W=>W.connectionId===L.id&&W.toolName===F.name),V=f.find(W=>W.connectionId===L.id&&W.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",z?"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(md,{value:V?.icon??null,onChange:W=>D(L.id,F.name,W),disabled:!z||x}),o.jsx(fs,{value:z&&V?V.label:Nn(F.name),onChange:W=>R(L.id,F.name,W.target.value),onBlur:M,className:"h-7 text-sm w-40",disabled:!z||x,readOnly:!z})]}),o.jsx(mr,{checked:z,onCheckedChange:()=>j(L.id,F.name),disabled:x})]},F.name)})})]},L.id))})]})]})]})]})}function Vd({virtualMcp:t,hideOwnTitle:e}){const{org:s}=xe(),i=Kl(),r=Yc(),n=Ut(),a=He({connectionId:Pt,orgId:s.id,orgSlug:s.slug}),l=Go({resolver:Al(Td),defaultValues:t}),h=l.watch("connections"),c=!!Vt(t),[u,d]=P.useReducer(Od,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[m,_]=P.useState(!1),{createTaskWithMessage:f}=lt(),{setChatMode:p}=Ni(),{createNewTask:g}=rn(),v=()=>{const A=l.getValues("metadata.instructions");A?.trim()&&(R(),we("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:A.length}),p("plan"),f({virtualMcpId:Qo(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
  ${ge}
189
- </message>`}]}}))},B=e.models?.credentialId||_||"",L=e.models?.thinking?.id||f?.modelId||"",$=Go({defaultValues:{name:e.name,active:e.active,credential_id:B,model_id:L}}),F=$.watch("active"),z=$.watch("credential_id"),V=$.watch("model_id"),{models:W,isLoading:U}=Tc(z||void 0),q=W.find(ie=>ie.modelId===V)??null,A=P.useRef(null),Y=P.useRef(new Set),J=P.useRef(0),ee=P.useRef(null),ce=3e4,ne=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),A.current!==null&&(we("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(Y.current),save_count:J.current,edit_duration_ms:Date.now()-A.current}),A.current=null,Y.current=new Set,J.current=0)},Z=async()=>{if(!(Object.keys($.formState.dirtyFields).length>0)&&!E.current)return!0;const ge=Object.keys($.formState.dirtyFields),Je=E.current;E.current=!1;const fe=$.getValues(),kt=I.current;try{const ps=fe.credential_id&&fe.model_id?fe.credential_id:"",X=fe.credential_id&&fe.model_id?fe.model_id:"",oe={id:t,name:fe.name,active:fe.active,agent:{id:n},models:{credentialId:ps,thinking:{id:X}},messages:Gl(kt),temperature:0};await l.mutateAsync(oe),A.current===null&&(A.current=Date.now());for(const Ce of ge)Y.current.add(Ce);return Je&&Y.current.add("messages"),J.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ne,ce),$.reset({...fe,credential_id:ps,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},ue=P.useRef(Z);ue.current=Z;const de=()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{T.current=null,ue.current()},1e3)},he=async()=>(T.current&&(clearTimeout(T.current),T.current=null),ue.current()),pe=ie=>{if(I.current=ie,x(ie),!C.current){C.current=!0;return}E.current=!0,de()},We=P.useRef(!1);We.current||(We.current=!0,$.watch(()=>{de()})),P.useEffect(()=>()=>{T.current&&(clearTimeout(T.current),T.current=null,ue.current())},[]);const Pe=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:n});const ie=await he();if(ne(),!ie)return;if(!S){_e.error("No instructions configured for this automation");return}q&&z&&m({...q,keyId:z}),v({...g,toolApprovalLevel:"auto"});const ge=wn(S);d({message:{tiptapDoc:S,parts:ge},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(ja,{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(_r,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{control:$.control,name:"active",render:({field:ie})=>o.jsx(mr,{checked:ie.value,onCheckedChange:ge=>{ie.onChange(ge),setTimeout(()=>he(),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(da,{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(Rp,{automationId:t,open:y,onOpenChange:k,onCustomSelect:()=>{N(!0),D(!1),R("")},onEventSelect:()=>{D(!0),N(!1)}})]}),e.triggers.length===0&&!w?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:()=>k(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ie=>o.jsx(Dp,{trigger:ie,automationId:t,connectionName:ie.connection_id?u.get(ie.connection_id):void 0},ie.id))}),w&&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:ie=>R(ie.target.value),onBlur:async()=>{const ie=j.trim();if(!(!ie||!Is(ie)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:ie}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),N(!1),R("")}catch{_e.error("Failed to add starter")}},onKeyDown:async ie=>{const ge=j.trim();ie.key==="Enter"&&ge&&Is(ge)&&ie.target.blur(),ie.key==="Escape"&&(N(!1),R(""))},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(Ie,{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:()=>{N(!1),R("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(P.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(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Ip,{automationId:t,onDone:()=>D(!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:O,children:[o.jsx(Ca,{size:13}),"Improve"]})]}),o.jsx(Ul,{tiptapDoc:S,setTiptapDoc:pe,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(Vl,{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(xh,{model:q,isLoading:U,credentialId:z||null,onCredentialChange:ie=>{$.setValue("credential_id",ie??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0})},onModelChange:ie=>$.setValue("model_id",ie.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ke,{children:[o.jsx(qe,{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:Pe,disabled:!n,children:[o.jsx(tc,{size:16}),"Test"]})}),o.jsx(Ge,{children:"Test Automation"})]})]})]})})]})]})]})}function Op(t){const e=K.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=ta(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(Ie,{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(P.Suspense,{fallback:a,children:o.jsx(zp,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function zp(t){const e=K.c(9),{id:s,virtualMcpId:i}=t,r=At(),{data:n,isLoading:a}=Sh(s);let l;e[0]!==r?(l=()=>r({to:".",search:$p,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!n){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Lp,{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 $p(t){return{...t,main:"automations"}}function Fp(t){const e=K.c(20),{virtualMcpId:s}=t,i=At(),{data:r}=yh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=P.useState(""),c=l.toLowerCase(),u=n.filter(R=>R.name.toLowerCase().includes(c));let d;e[0]!==i?(d=R=>i({to:".",search:M=>({...M,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=await a.mutateAsync(Ch(s));m(R.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(kh,{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 y;e[7]!==b||e[8]!==x?(y=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]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{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"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{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:u.map(R=>o.jsx(wh,{automation:R,onClick:()=>m(R.id)},R.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Hp(t){const e=K.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(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:i,children:o.jsx(Fp,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const $o=P.lazy(()=>Ol(()=>import("./project-app-view-BKdpoQ4z.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 Wp(t){const e=K.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}=Da(r);if(ac(n)){let f;return e[3]!==i?(f=o.jsx(Wn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(Cu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Hp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(Cp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(af,{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(Op,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=lc(n),e[16]=n,e[17]=c):c=e[17];const u=c;if(u){let f;if(e[18]!==l||e[19]!==u.connectionId||e[20]!==u.toolName){let S;e[22]!==u.connectionId||e[23]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[22]=u.connectionId,e[23]=u.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=u.connectionId,e[20]=u.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(Ie,{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]!==u.connectionId||e[28]!==u.toolName||e[29]!==v?(b=o.jsx(P.Suspense,{fallback:g,children:o.jsx($o,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[26]=n,e[27]=u.connectionId,e[28]=u.toolName,e[29]=v,e[30]=b):b=e[30],b}let d;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],d=a.find(f),e[31]=n,e[32]=a,e[33]=d}else d=e[33];const m=d;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(Ie,{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(P.Suspense,{fallback:f,children:o.jsx($o,{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(Wn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function Up(t){const e=K.c(7),{children:s,defaultSize:i}=t,[,r]=P.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Jo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Xo(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 u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ha,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Vp(t){const e=K.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Mn(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=Jo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Xo(c,45),d=P.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const R=d.current;if(!R)return;const M=Mn(r,n),D=M.chat>0&&M.chat<100?u:M.chat,C=M.chat>0&&M.chat<100?100-u:M.main;R.setLayout([D,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),P.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(Ea,{}),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(Up,{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(qc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=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]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($t,{children:o.jsx(Wp,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ha,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(Gc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const hr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Fo="bg-sidebar-accent text-sidebar-foreground",dr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Kp(t){const e=K.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Rc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{we("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?Fo:dr;let u;e[3]!==c?(u=te(hr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(kc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ge,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ke,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{we("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?Fo:dr;let v;e[16]!==g?(v=te(hr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Nc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(qe,{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(Ge,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(Ke,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,R=!l,M=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let D;e[28]!==M?(D=te(hr,dr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",M),e[28]=M,e[29]=D):D=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ra,{size:16}),e[30]=C):C=e[30];let T;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==R||e[35]!==D?(T=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":R,className:D,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=R,e[35]=D,e[36]=T):T=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ge,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let I;e[38]!==T?(I=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ke,{delayDuration:300,children:[T,E]})}),e[38]=T,e[39]=I):I=e[39];let O;e[40]!==w||e[41]!==I?(O=o.jsx("div",{className:w,children:I}),e[40]=w,e[41]=I,e[42]=O):O=e[42];let B;return e[43]!==y||e[44]!==O||e[45]!==f?(B=o.jsxs(o.Fragment,{children:[f,y,O]}),e[43]=y,e[44]=O,e[45]=f,e[46]=B):B=e[46],B}function qp(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(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.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],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function Gp(t){const e=K.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(Yp,{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 u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=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]=u):u=e[12],u}function Yp(t){const e=K.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(la,{className:"size-4"}),e[4]=i):i=e[4],i}function Xp(t){const e=K.c(13),{overflow:s,onSelect:i}=t,[r,n]=P.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(na,{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(Jp,{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 u;e[8]!==c?(u=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]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Jp(t){const e=K.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(la,{className:"size-4"}),e[4]=i):i=e[4],i}const Zp=6;function Qp(t){const e=K.c(20),{virtualMcpId:s,taskId:i}=t,r=At();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}=Da(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=cc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=qp(a,S,Zp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=hc({activeTab:l,mainOpen:h});r({to:".",search:R=>({...R,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(Gp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Xp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,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 eg(t){const e=K.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(zl,{"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 tg(t){const e=K.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(fu({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(uu({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",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(pr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(St,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,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 sg=new Set(["failure","timed_out","cancelled","action_required"]);function ig(t){return t.status==="completed"&&sg.has(t.conclusion)}function rg(t){return t.status==="queued"||t.status==="in_progress"}function ng(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(ig).map(m=>m.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(rg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function og(){return qt().branchStatus}const ag=6e4,lg=3e4;function cg(t){const e=K.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=He(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:ag,refetchIntervalInBackground:!1,staleTime:lg,select:hg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function hg(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 dg(t){const e=K.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=yt(s),{currentBranch:n}=lt(),a=ji(),l=r?.metadata?.githubRepo??null,h=og(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ia(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Pa(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let R;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(R={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=R):R=e[20];const M=cg(R);if(!l?.connectionId||!n)return null;let D;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==M.data?(D=ng({branchStatus:h,pr:p,checks:y.data??[],reviews:M.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=M.data,e[26]=D):D=e[26];const C=D;let T;e[27]!==a?(T=z=>a.sendMessage({parts:[{type:"text",text:z}]}),e[27]=a,e[28]=T):T=e[28];const E=T,I=a.isStreaming;let O;e[29]!==n||e[30]!==C||e[31]!==I||e[32]!==p||e[33]!==E?(O=z=>{if(!I)switch(z){case"commit-and-push":{E(ru({branch:n}));return}case"create-pr":{E(nu({branch:n}));return}case"reopen":{p&&E(ou({prNumber:p.number}));return}case"rebase":{E(au({branch:n}));return}case"fix-checks":{p&&E(cu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(hu({prNumber:p.number}));return}case"resolve-comments":{p&&E(du({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=I,e[32]=p,e[33]=E,e[34]=O):O=e[34];const B=O;let L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(eg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=L):L=e[35];const $=p?.number;let F;return e[36]!==C||e[37]!==I||e[38]!==B||e[39]!==E||e[40]!==$?(F=o.jsxs(o.Fragment,{children:[L,o.jsx(ug,{button:C,isStreaming:I,onActivate:B,prNumber:$,send:E})]}),e[36]=C,e[37]=I,e[38]=B,e[39]=E,e[40]=$,e[41]=F):F=e[41],F}function ug(t){const e=K.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(tg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Ho,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(fh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Ho,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Ho(t){const e=K.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(qe,{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(Ge,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Fc,{children:o.jsxs(Ke,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function fg(t){const e=K.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(fr.Right,{children:o.jsx(dg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=P.createContext(null);function Sn(){return P.use(Qt)}function Wo(t){const e=K.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(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ea,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx($t,{fallback:r,children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Uo(t){const e=K.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],P.useLayoutEffect(r),null}function mg(t){const e=K.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Xl,{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 Vo(t){const e=K.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=lt(),{data:h}=ki.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Pt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=He(u),{mutate:m}=ln(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=P.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:_g}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),P.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(zu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function _g(t){console.error("[auto-start-vm] failed:",t)}function pg(){const t=K.c(96),e=ca(),s=At(),{org:i}=xe(),r=Dc()?.tasksOpen??!1;Hc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=$l(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=en(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Zo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=Eh(a.taskId??"",d),_=yt(d),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=_&&Vt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Mc(g,S),{setOpenMobile:y,openMobile:k}=Lc(),w=y,N=P.useRef(null);let j,R;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=q=>{Pc(q)&&q.shiftKey&&q.code==="KeyS"&&!q.repeat&&(q.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},R=[],t[12]=j,t[13]=R):(j=t[12],R=t[13]),P.useEffect(j,R);const M=d;let D;t[14]!==_||t[15]!==d?(D={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=D):D=t[16];const C=D;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=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(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let q;return t[18]!==C?(q=o.jsx(Qt,{value:C,children:U}),t[18]=C,t[19]=q):q=t[19],q}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let q;t[21]!==m.error.message?(q=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:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=q):q=t[22];let A;return t[23]!==C||t[24]!==q?(A=o.jsx(Qt,{value:C,children:q}),t[23]=C,t[24]=q,t[25]=A):A=t[25],A}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Ps,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const q=`The agent "${d}" does not exist in this organization.`;let A;t[27]!==s||t[28]!==l?(A=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]=A):A=t[29];let Y;t[30]!==q||t[31]!==A?(Y=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(Bs,{image:U,title:"Agent not found",description:q,actions:A})})}),t[30]=q,t[31]=A,t[32]=Y):Y=t[32];let J;return t[33]!==C||t[34]!==Y?(J=o.jsx(Qt,{value:C,children:Y}),t[33]=C,t[34]=Y,t[35]=J):J=t[35],J}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Oc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let q;t[37]!==w?(q=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(Ic,{onClose:()=>w(!1)})}),t[37]=w,t[38]=q):q=t[38];let A;t[39]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=A):A=t[39];let Y;t[40]!==q?(Y=o.jsxs(zc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[q,A]})]}),t[40]=q,t[41]=Y):Y=t[41];let J;t[42]!==k||t[43]!==w||t[44]!==Y?(J=o.jsx($c,{open:k,onOpenChange:w,children:Y}),t[42]=k,t[43]=w,t[44]=Y,t[45]=J):J=t[45];const ee=J,ce=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Uo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let Z;t[48]!==w?(Z=o.jsx(mg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=Z):Z=t[49];let ue;t[50]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Wo,{})}),t[50]=ue):ue=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==ce||t[54]!==ne||t[55]!==Z||t[56]!==d?(de=o.jsxs(Vo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ce,children:[ne,Z,ue,ee]}),t[51]=b,t[52]=ee,t[53]=ce,t[54]=ne,t[55]=Z,t[56]=d,t[57]=de):de=t[57];let he;t[58]!==M||t[59]!==de?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:M,children:de},M)}),t[58]=M,t[59]=de,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Qt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const T=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==T?(E=o.jsx(fr.Toggles,{children:o.jsx(Kp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:T})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=T,t[67]=E):E=t[67];let I;t[68]!==x.taskId||t[69]!==d?(I=o.jsx(fr.Tabs,{children:o.jsx(Qp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=I):I=t[70];const O=_?.metadata?.vmMap;let B;t[71]!==_?(B=o.jsx(fg,{virtualMcp:_}),t[71]=_,t[72]=B):B=t[72];let L;t[73]!==x.createNewTask?(L=o.jsx(Uo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=L):L=t[74];let $;t[75]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Wo,{}),t[75]=$):$=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(F=o.jsx(Vp,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:$}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=F):F=t[80];let z;t[81]!==b||t[82]!==O||t[83]!==B||t[84]!==L||t[85]!==F||t[86]!==d?(z=o.jsxs(Vo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:O,children:[B,L,F]}),t[81]=b,t[82]=O,t[83]=B,t[84]=L,t[85]=F,t[86]=d,t[87]=z):z=t[87];let V;t[88]!==M||t[89]!==I||t[90]!==z?(V=o.jsxs(Ee.Provider,{virtualMcpId:M,children:[I,z]},M),t[88]=M,t[89]=I,t[90]=z,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function y1(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(pg,{})}),t[0]=e):e=t[0],e}export{y1 as default,Sn as useInsetContext};
189
+ </message>`}]}}))},B=e.models?.credentialId||_||"",L=e.models?.thinking?.id||f?.modelId||"",$=Go({defaultValues:{name:e.name,active:e.active,credential_id:B,model_id:L}}),F=$.watch("active"),z=$.watch("credential_id"),V=$.watch("model_id"),{models:W,isLoading:U}=Tc(z||void 0),q=W.find(ie=>ie.modelId===V)??null,A=P.useRef(null),Y=P.useRef(new Set),J=P.useRef(0),ee=P.useRef(null),ce=3e4,ne=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),A.current!==null&&(we("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(Y.current),save_count:J.current,edit_duration_ms:Date.now()-A.current}),A.current=null,Y.current=new Set,J.current=0)},Z=async()=>{if(!(Object.keys($.formState.dirtyFields).length>0)&&!E.current)return!0;const ge=Object.keys($.formState.dirtyFields),Je=E.current;E.current=!1;const fe=$.getValues(),kt=I.current;try{const ps=fe.credential_id&&fe.model_id?fe.credential_id:"",X=fe.credential_id&&fe.model_id?fe.model_id:"",oe={id:t,name:fe.name,active:fe.active,agent:{id:n},models:{credentialId:ps,thinking:{id:X}},messages:Gl(kt),temperature:0};await l.mutateAsync(oe),A.current===null&&(A.current=Date.now());for(const Ce of ge)Y.current.add(Ce);return Je&&Y.current.add("messages"),J.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ne,ce),$.reset({...fe,credential_id:ps,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},ue=P.useRef(Z);ue.current=Z;const de=()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{T.current=null,ue.current()},1e3)},he=async()=>(T.current&&(clearTimeout(T.current),T.current=null),ue.current()),pe=ie=>{if(I.current=ie,x(ie),!C.current){C.current=!0;return}E.current=!0,de()},We=P.useRef(!1);We.current||(We.current=!0,$.watch(()=>{de()})),P.useEffect(()=>()=>{T.current&&(clearTimeout(T.current),T.current=null,ue.current())},[]);const Pe=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:n});const ie=await he();if(ne(),!ie)return;if(!S){_e.error("No instructions configured for this automation");return}q&&z&&m({...q,keyId:z}),v({...g,toolApprovalLevel:"auto"});const ge=wn(S);d({message:{tiptapDoc:S,parts:ge},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(ja,{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(_r,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{control:$.control,name:"active",render:({field:ie})=>o.jsx(mr,{checked:ie.value,onCheckedChange:ge=>{ie.onChange(ge),setTimeout(()=>he(),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(da,{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(Rp,{automationId:t,open:y,onOpenChange:k,onCustomSelect:()=>{N(!0),D(!1),R("")},onEventSelect:()=>{D(!0),N(!1)}})]}),e.triggers.length===0&&!w?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:()=>k(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ie=>o.jsx(Dp,{trigger:ie,automationId:t,connectionName:ie.connection_id?u.get(ie.connection_id):void 0},ie.id))}),w&&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:ie=>R(ie.target.value),onBlur:async()=>{const ie=j.trim();if(!(!ie||!Is(ie)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:ie}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),N(!1),R("")}catch{_e.error("Failed to add starter")}},onKeyDown:async ie=>{const ge=j.trim();ie.key==="Enter"&&ge&&Is(ge)&&ie.target.blur(),ie.key==="Escape"&&(N(!1),R(""))},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(Ie,{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:()=>{N(!1),R("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(P.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(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Ip,{automationId:t,onDone:()=>D(!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:O,children:[o.jsx(Ca,{size:13}),"Improve"]})]}),o.jsx(Ul,{tiptapDoc:S,setTiptapDoc:pe,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(Vl,{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(xh,{model:q,isLoading:U,credentialId:z||null,onCredentialChange:ie=>{$.setValue("credential_id",ie??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0})},onModelChange:ie=>$.setValue("model_id",ie.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ke,{children:[o.jsx(qe,{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:Pe,disabled:!n,children:[o.jsx(tc,{size:16}),"Test"]})}),o.jsx(Ge,{children:"Test Automation"})]})]})]})})]})]})]})}function Op(t){const e=K.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=ta(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(Ie,{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(P.Suspense,{fallback:a,children:o.jsx(zp,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function zp(t){const e=K.c(9),{id:s,virtualMcpId:i}=t,r=At(),{data:n,isLoading:a}=Sh(s);let l;e[0]!==r?(l=()=>r({to:".",search:$p,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!n){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Lp,{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 $p(t){return{...t,main:"automations"}}function Fp(t){const e=K.c(20),{virtualMcpId:s}=t,i=At(),{data:r}=yh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=P.useState(""),c=l.toLowerCase(),u=n.filter(R=>R.name.toLowerCase().includes(c));let d;e[0]!==i?(d=R=>i({to:".",search:M=>({...M,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=await a.mutateAsync(Ch(s));m(R.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(kh,{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 y;e[7]!==b||e[8]!==x?(y=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]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{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"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{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:u.map(R=>o.jsx(wh,{automation:R,onClick:()=>m(R.id)},R.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Hp(t){const e=K.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(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:i,children:o.jsx(Fp,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const $o=P.lazy(()=>Ol(()=>import("./project-app-view-C5KFZJmQ.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 Wp(t){const e=K.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}=Da(r);if(ac(n)){let f;return e[3]!==i?(f=o.jsx(Wn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(Cu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Hp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(Cp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(af,{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(Op,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=lc(n),e[16]=n,e[17]=c):c=e[17];const u=c;if(u){let f;if(e[18]!==l||e[19]!==u.connectionId||e[20]!==u.toolName){let S;e[22]!==u.connectionId||e[23]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[22]=u.connectionId,e[23]=u.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=u.connectionId,e[20]=u.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(Ie,{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]!==u.connectionId||e[28]!==u.toolName||e[29]!==v?(b=o.jsx(P.Suspense,{fallback:g,children:o.jsx($o,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[26]=n,e[27]=u.connectionId,e[28]=u.toolName,e[29]=v,e[30]=b):b=e[30],b}let d;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],d=a.find(f),e[31]=n,e[32]=a,e[33]=d}else d=e[33];const m=d;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(Ie,{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(P.Suspense,{fallback:f,children:o.jsx($o,{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(Wn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function Up(t){const e=K.c(7),{children:s,defaultSize:i}=t,[,r]=P.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Jo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Xo(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 u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ha,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Vp(t){const e=K.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Mn(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=Jo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Xo(c,45),d=P.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const R=d.current;if(!R)return;const M=Mn(r,n),D=M.chat>0&&M.chat<100?u:M.chat,C=M.chat>0&&M.chat<100?100-u:M.main;R.setLayout([D,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),P.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(Ea,{}),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(Up,{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(qc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=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]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($t,{children:o.jsx(Wp,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ha,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(Gc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const hr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Fo="bg-sidebar-accent text-sidebar-foreground",dr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Kp(t){const e=K.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Rc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{we("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?Fo:dr;let u;e[3]!==c?(u=te(hr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(kc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ge,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ke,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{we("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?Fo:dr;let v;e[16]!==g?(v=te(hr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Nc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(qe,{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(Ge,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(Ke,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,R=!l,M=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let D;e[28]!==M?(D=te(hr,dr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",M),e[28]=M,e[29]=D):D=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ra,{size:16}),e[30]=C):C=e[30];let T;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==R||e[35]!==D?(T=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":R,className:D,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=R,e[35]=D,e[36]=T):T=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ge,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let I;e[38]!==T?(I=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ke,{delayDuration:300,children:[T,E]})}),e[38]=T,e[39]=I):I=e[39];let O;e[40]!==w||e[41]!==I?(O=o.jsx("div",{className:w,children:I}),e[40]=w,e[41]=I,e[42]=O):O=e[42];let B;return e[43]!==y||e[44]!==O||e[45]!==f?(B=o.jsxs(o.Fragment,{children:[f,y,O]}),e[43]=y,e[44]=O,e[45]=f,e[46]=B):B=e[46],B}function qp(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(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.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],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function Gp(t){const e=K.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(Yp,{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 u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=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]=u):u=e[12],u}function Yp(t){const e=K.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(la,{className:"size-4"}),e[4]=i):i=e[4],i}function Xp(t){const e=K.c(13),{overflow:s,onSelect:i}=t,[r,n]=P.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(na,{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(Jp,{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 u;e[8]!==c?(u=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]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Jp(t){const e=K.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(la,{className:"size-4"}),e[4]=i):i=e[4],i}const Zp=6;function Qp(t){const e=K.c(20),{virtualMcpId:s,taskId:i}=t,r=At();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}=Da(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=cc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=qp(a,S,Zp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=hc({activeTab:l,mainOpen:h});r({to:".",search:R=>({...R,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(Gp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Xp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,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 eg(t){const e=K.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(zl,{"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 tg(t){const e=K.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(fu({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(uu({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",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(pr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(St,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,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 sg=new Set(["failure","timed_out","cancelled","action_required"]);function ig(t){return t.status==="completed"&&sg.has(t.conclusion)}function rg(t){return t.status==="queued"||t.status==="in_progress"}function ng(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(ig).map(m=>m.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(rg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function og(){return qt().branchStatus}const ag=6e4,lg=3e4;function cg(t){const e=K.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=He(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:ag,refetchIntervalInBackground:!1,staleTime:lg,select:hg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function hg(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 dg(t){const e=K.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=yt(s),{currentBranch:n}=lt(),a=ji(),l=r?.metadata?.githubRepo??null,h=og(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ia(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Pa(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let R;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(R={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=R):R=e[20];const M=cg(R);if(!l?.connectionId||!n)return null;let D;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==M.data?(D=ng({branchStatus:h,pr:p,checks:y.data??[],reviews:M.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=M.data,e[26]=D):D=e[26];const C=D;let T;e[27]!==a?(T=z=>a.sendMessage({parts:[{type:"text",text:z}]}),e[27]=a,e[28]=T):T=e[28];const E=T,I=a.isStreaming;let O;e[29]!==n||e[30]!==C||e[31]!==I||e[32]!==p||e[33]!==E?(O=z=>{if(!I)switch(z){case"commit-and-push":{E(ru({branch:n}));return}case"create-pr":{E(nu({branch:n}));return}case"reopen":{p&&E(ou({prNumber:p.number}));return}case"rebase":{E(au({branch:n}));return}case"fix-checks":{p&&E(cu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(hu({prNumber:p.number}));return}case"resolve-comments":{p&&E(du({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=I,e[32]=p,e[33]=E,e[34]=O):O=e[34];const B=O;let L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(eg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=L):L=e[35];const $=p?.number;let F;return e[36]!==C||e[37]!==I||e[38]!==B||e[39]!==E||e[40]!==$?(F=o.jsxs(o.Fragment,{children:[L,o.jsx(ug,{button:C,isStreaming:I,onActivate:B,prNumber:$,send:E})]}),e[36]=C,e[37]=I,e[38]=B,e[39]=E,e[40]=$,e[41]=F):F=e[41],F}function ug(t){const e=K.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(tg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Ho,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(fh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Ho,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Ho(t){const e=K.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(qe,{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(Ge,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Fc,{children:o.jsxs(Ke,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function fg(t){const e=K.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(fr.Right,{children:o.jsx(dg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=P.createContext(null);function Sn(){return P.use(Qt)}function Wo(t){const e=K.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(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ea,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx($t,{fallback:r,children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Uo(t){const e=K.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],P.useLayoutEffect(r),null}function mg(t){const e=K.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Xl,{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 Vo(t){const e=K.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=lt(),{data:h}=ki.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Pt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=He(u),{mutate:m}=ln(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=P.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:_g}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),P.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(zu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function _g(t){console.error("[auto-start-vm] failed:",t)}function pg(){const t=K.c(96),e=ca(),s=At(),{org:i}=xe(),r=Dc()?.tasksOpen??!1;Hc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=$l(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=en(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Zo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=Eh(a.taskId??"",d),_=yt(d),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=_&&Vt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Mc(g,S),{setOpenMobile:y,openMobile:k}=Lc(),w=y,N=P.useRef(null);let j,R;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=q=>{Pc(q)&&q.shiftKey&&q.code==="KeyS"&&!q.repeat&&(q.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},R=[],t[12]=j,t[13]=R):(j=t[12],R=t[13]),P.useEffect(j,R);const M=d;let D;t[14]!==_||t[15]!==d?(D={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=D):D=t[16];const C=D;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=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(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let q;return t[18]!==C?(q=o.jsx(Qt,{value:C,children:U}),t[18]=C,t[19]=q):q=t[19],q}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let q;t[21]!==m.error.message?(q=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:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=q):q=t[22];let A;return t[23]!==C||t[24]!==q?(A=o.jsx(Qt,{value:C,children:q}),t[23]=C,t[24]=q,t[25]=A):A=t[25],A}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Ps,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const q=`The agent "${d}" does not exist in this organization.`;let A;t[27]!==s||t[28]!==l?(A=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]=A):A=t[29];let Y;t[30]!==q||t[31]!==A?(Y=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(Bs,{image:U,title:"Agent not found",description:q,actions:A})})}),t[30]=q,t[31]=A,t[32]=Y):Y=t[32];let J;return t[33]!==C||t[34]!==Y?(J=o.jsx(Qt,{value:C,children:Y}),t[33]=C,t[34]=Y,t[35]=J):J=t[35],J}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Oc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let q;t[37]!==w?(q=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(Ic,{onClose:()=>w(!1)})}),t[37]=w,t[38]=q):q=t[38];let A;t[39]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=A):A=t[39];let Y;t[40]!==q?(Y=o.jsxs(zc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[q,A]})]}),t[40]=q,t[41]=Y):Y=t[41];let J;t[42]!==k||t[43]!==w||t[44]!==Y?(J=o.jsx($c,{open:k,onOpenChange:w,children:Y}),t[42]=k,t[43]=w,t[44]=Y,t[45]=J):J=t[45];const ee=J,ce=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Uo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let Z;t[48]!==w?(Z=o.jsx(mg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=Z):Z=t[49];let ue;t[50]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Wo,{})}),t[50]=ue):ue=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==ce||t[54]!==ne||t[55]!==Z||t[56]!==d?(de=o.jsxs(Vo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ce,children:[ne,Z,ue,ee]}),t[51]=b,t[52]=ee,t[53]=ce,t[54]=ne,t[55]=Z,t[56]=d,t[57]=de):de=t[57];let he;t[58]!==M||t[59]!==de?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:M,children:de},M)}),t[58]=M,t[59]=de,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Qt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const T=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==T?(E=o.jsx(fr.Toggles,{children:o.jsx(Kp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:T})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=T,t[67]=E):E=t[67];let I;t[68]!==x.taskId||t[69]!==d?(I=o.jsx(fr.Tabs,{children:o.jsx(Qp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=I):I=t[70];const O=_?.metadata?.vmMap;let B;t[71]!==_?(B=o.jsx(fg,{virtualMcp:_}),t[71]=_,t[72]=B):B=t[72];let L;t[73]!==x.createNewTask?(L=o.jsx(Uo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=L):L=t[74];let $;t[75]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Wo,{}),t[75]=$):$=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(F=o.jsx(Vp,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:$}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=F):F=t[80];let z;t[81]!==b||t[82]!==O||t[83]!==B||t[84]!==L||t[85]!==F||t[86]!==d?(z=o.jsxs(Vo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:O,children:[B,L,F]}),t[81]=b,t[82]=O,t[83]=B,t[84]=L,t[85]=F,t[86]=d,t[87]=z):z=t[87];let V;t[88]!==M||t[89]!==I||t[90]!==z?(V=o.jsxs(Ee.Provider,{virtualMcpId:M,children:[I,z]},M),t[88]=M,t[89]=I,t[90]=z,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function y1(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(pg,{})}),t[0]=e):e=t[0],e}export{y1 as default,Sn as useInsetContext};