decocms 4.17.2 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/client/assets/{AlertCircle-DdrwwZMq.js → AlertCircle-Cq24_c-o.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-jXBy9ipz.js → ArrowUpRight-ClwqpF9i.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-3ZOkMXIL.js → CheckCircle-PV8cYNfz.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-CLx4-WM1.js → ChevronDown-BcFakGFK.js} +1 -1
  5. package/dist/client/assets/{ChevronRight-jYKilAXW.js → ChevronRight-Bc7TkKo_.js} +1 -1
  6. package/dist/client/assets/{ChevronUp-BGt4chTY.js → ChevronUp-CAyCvjRf.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-CqrNmdxL.js → DotsVertical-BZ79m9bZ.js} +1 -1
  8. package/dist/client/assets/{Eye-o5yQXJvl.js → Eye-CVTjrdPN.js} +1 -1
  9. package/dist/client/assets/{FilterLines-CDGBU4Yu.js → FilterLines-Dn-zRhq9.js} +1 -1
  10. package/dist/client/assets/{Globe01-CcG20jKe.js → Globe01-CINX7XLh.js} +1 -1
  11. package/dist/client/assets/{Globe04-Cv_V-Fs_.js → Globe04-BacMVcAF.js} +1 -1
  12. package/dist/client/assets/{HardDrive-BSIK0u4A.js → HardDrive-CfVRvrF-.js} +1 -1
  13. package/dist/client/assets/{Key01-DgIKoZGo.js → Key01-awLJepSc.js} +1 -1
  14. package/dist/client/assets/{LayoutLeft-Ck3c6EbZ.js → LayoutLeft-Bgn0Zg5G.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-C4RHyT_k.js → LinkExternal01-D60A4jNL.js} +1 -1
  16. package/dist/client/assets/{Monitor01-CWIDsYmm.js → Monitor01-oM90habT.js} +1 -1
  17. package/dist/client/assets/{Palette-BFwjtSY1.js → Palette-mFlZKLgw.js} +1 -1
  18. package/dist/client/assets/{Play-DqQKGu-U.js → Play-B2PQHuS4.js} +1 -1
  19. package/dist/client/assets/{Plus-DZiClNST.js → Plus-BDlCzerf.js} +1 -1
  20. package/dist/client/assets/{SearchLg-CaS6w27I.js → SearchLg-fYAuFx6T.js} +1 -1
  21. package/dist/client/assets/{SearchMd-CYoVQBZq.js → SearchMd-CrBda7dI.js} +1 -1
  22. package/dist/client/assets/{Settings02-C-6P9tLl.js → Settings02-C2Ys_yfp.js} +1 -1
  23. package/dist/client/assets/{Shield01-B3rvsBtl.js → Shield01-xKplN1D6.js} +1 -1
  24. package/dist/client/assets/{Star01-CkOKT_Ec.js → Star01-D-DX_VQ8.js} +1 -1
  25. package/dist/client/assets/{Stars01-sPe6wVRL.js → Stars01-BT514mww.js} +1 -1
  26. package/dist/client/assets/{Stars02-YL1S7hw5.js → Stars02-CvZNhXpQ.js} +1 -1
  27. package/dist/client/assets/{Sun-CX24eczl.js → Sun-BHmSueFc.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-1JfD3pEr.js → SwitchHorizontal01--w7jw1gn.js} +1 -1
  29. package/dist/client/assets/{Tool01-84S8urW1.js → Tool01-CYQXbAs9.js} +1 -1
  30. package/dist/client/assets/{Trash01-oru1b8W8.js → Trash01-CxMlDi9l.js} +1 -1
  31. package/dist/client/assets/{Upload01-Cou_1dwr.js → Upload01-DgQHfPA4.js} +1 -1
  32. package/dist/client/assets/{User01-BL-jdznB.js → User01-DJgqKWol.js} +1 -1
  33. package/dist/client/assets/{Users01-CvViXbMH.js → Users01-D_J5vhl7.js} +1 -1
  34. package/dist/client/assets/{Users03-B-JAgn9g.js → Users03-D7afztXh.js} +1 -1
  35. package/dist/client/assets/{X-D1xM7jXL.js → X-RECo41yg.js} +1 -1
  36. package/dist/client/assets/{XCircle-D1ibZ16t.js → XCircle-BhV8maG9.js} +1 -1
  37. package/dist/client/assets/{XClose-D0Zu_lRC.js → XClose-DNorGtW0.js} +1 -1
  38. package/dist/client/assets/{Zap-Bo8lb0F-.js → Zap-BqYKiBDY.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-B4AjMOPu.js → ZapSquare-EaCsR4ke.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-DfCeUHFX.js → ZoomOut-Dox0RGO8.js} +1 -1
  41. package/dist/client/assets/{access-gate-CRTZfiyx.js → access-gate-BqzkpTGs.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-t6NTp3dt.js → add-section-modal-D8dP-fUX.js} +1 -1
  43. package/dist/client/assets/{agent-capabilities-BDCwG9Eh.js → agent-capabilities-BOrZcw_f.js} +1 -1
  44. package/dist/client/assets/{agent-icon-C1BWispo.js → agent-icon-BtQxKV8a.js} +1 -1
  45. package/dist/client/assets/agents-list-rt-kO67C.js +4 -0
  46. package/dist/client/assets/{ai-providers-D8gEIycW.js → ai-providers-D7u6tgs7.js} +1 -1
  47. package/dist/client/assets/{alert-DAyg3TSF.js → alert-DOHmFwqn.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-ha1v59qY.js → alert-dialog-Bxo_MYXk.js} +1 -1
  49. package/dist/client/assets/{app-editor-3RKJRSU7.js → app-editor-BKBuOXj4.js} +1 -1
  50. package/dist/client/assets/{auth-ou2428Bw.js → auth-CoT0O1Wo.js} +1 -1
  51. package/dist/client/assets/{auth-catchall-B-EHVfUd.js → auth-catchall-ChVzL55k.js} +1 -1
  52. package/dist/client/assets/{auth-entry-BFuuwZkf.js → auth-entry-Db3UMJC5.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-lfv3bwPm.js → auth-split-layout-cO2rT7g9.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-B3lWqExf.js → authenticate-and-persist-oauth-DGhgmpvt.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-DUKMiAFn.js → automation-list-row-jcSA7dBx.js} +1 -1
  56. package/dist/client/assets/{automation-runs-HEfBB2IO.js → automation-runs-BaCQBHoa.js} +1 -1
  57. package/dist/client/assets/{automations-DcVo9aht.js → automations-CaKdnRJs.js} +1 -1
  58. package/dist/client/assets/{avatar-tYV7Xj5e.js → avatar-AaGlLABb.js} +1 -1
  59. package/dist/client/assets/{badge-DjU6bfHE.js → badge-C8xW1-Ny.js} +1 -1
  60. package/dist/client/assets/{block-document-CYnqjTQ5.js → block-document-OGoLVzGT.js} +2 -2
  61. package/dist/client/assets/{brand-context-D5KhJzF5.js → brand-context-DFabWIkO.js} +1 -1
  62. package/dist/client/assets/{breadcrumb-C_jNPElt.js → breadcrumb-Brp587yT.js} +1 -1
  63. package/dist/client/assets/{buckets-Bi6Dz7dc.js → buckets-DpneL_2_.js} +1 -1
  64. package/dist/client/assets/{bulk-category-panel-CQyTVuMJ.js → bulk-category-panel-CyzC_SX4.js} +1 -1
  65. package/dist/client/assets/{capability-load-error-B4T1DTOe.js → capability-load-error-BQZI9LLJ.js} +1 -1
  66. package/dist/client/assets/{card-BcWpe7XA.js → card-B9yAYcf2.js} +1 -1
  67. package/dist/client/assets/{category-editor-CHiWWzkP.js → category-editor-CZFJWDUa.js} +1 -1
  68. package/dist/client/assets/{chat-context-BXvC8snN.js → chat-context-Bd0ASrBV.js} +1 -1
  69. package/dist/client/assets/{checkbox-BGLrFwOD.js → checkbox-ChtxvVCl.js} +1 -1
  70. package/dist/client/assets/{cli-auth-success-SPj5zX1c.js → cli-auth-success-v9Qf_Z1z.js} +1 -1
  71. package/dist/client/assets/collection-detail-Ct0q9TWA.js +1 -0
  72. package/dist/client/assets/{collection-display-button-AdaNOeng.js → collection-display-button-ghx1fRrz.js} +1 -1
  73. package/dist/client/assets/{collection-search-BWPhJb0W.js → collection-search-qo9IZJLR.js} +1 -1
  74. package/dist/client/assets/collection-table-wrapper-D06hXFYs.js +1 -0
  75. package/dist/client/assets/{collection-tabs-LbK97vzL.js → collection-tabs-D8PDp1vW.js} +1 -1
  76. package/dist/client/assets/{command-BrahLBH2.js → command-DOtqEIF_.js} +1 -1
  77. package/dist/client/assets/{commerce-onboarding-BY8ZIbvj.js → commerce-onboarding-CQvkKr_A.js} +1 -1
  78. package/dist/client/assets/{connect-desktop-dialog-wN68EGmx.js → connect-desktop-dialog-BdgVHbLH.js} +1 -1
  79. package/dist/client/assets/{connection-card-CS0ZRcyq.js → connection-card-CrD4DNgk.js} +1 -1
  80. package/dist/client/assets/{connection-detail-6cGe5AzW.js → connection-detail-DgPAS7XR.js} +1 -1
  81. package/dist/client/assets/{connection-form-helpers--RFzi4SS.js → connection-form-helpers-OWEpNePK.js} +1 -1
  82. package/dist/client/assets/{connections-BM_4XV1f.js → connections-CEmlAedS.js} +1 -1
  83. package/dist/client/assets/{decopilot-DitDP2XU.js → decopilot-DsMsc6aJ.js} +1 -1
  84. package/dist/client/assets/{decopilot-sse-pool-DrXwOdO1.js → decopilot-sse-pool-BJzLmyeL.js} +1 -1
  85. package/dist/client/assets/{dialog-DaSKz7DM.js → dialog-B1eqTnf8.js} +1 -1
  86. package/dist/client/assets/{domain-settings-BssGRdmx.js → domain-settings-nPsYb5Fu.js} +1 -1
  87. package/dist/client/assets/{drawer-DdiW0TLs.js → drawer-HScIqfkZ.js} +1 -1
  88. package/dist/client/assets/{dropdown-menu-5pJpeeqf.js → dropdown-menu-BQUhOJKy.js} +1 -1
  89. package/dist/client/assets/{empty-state-B08-kVr_.js → empty-state-Dy6CNQJG.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-X711B5tE.js → extract-connection-data-MlduhWsI.js} +1 -1
  91. package/dist/client/assets/{file-explorer-CXo4_clT.js → file-explorer-CZAYIvIV.js} +2 -2
  92. package/dist/client/assets/{file-type-icon-Cm6D0wrz.js → file-type-icon-Bhag_euH.js} +1 -1
  93. package/dist/client/assets/{files-K9oI8c_-.js → files-uKwT7dMn.js} +1 -1
  94. package/dist/client/assets/{form-D1efg8C-.js → form-UVWmiPtA.js} +1 -1
  95. package/dist/client/assets/{general-BSA7tAJi.js → general-BT7ritMF.js} +1 -1
  96. package/dist/client/assets/github-repo-picker-Hp8ibQdT.js +1 -0
  97. package/dist/client/assets/{hooks-BgBnOJ3c.js → hooks-BkWjlB2G.js} +1 -1
  98. package/dist/client/assets/{index-C3i4LyhT.js → index-B1vu2Nbj.js} +1 -1
  99. package/dist/client/assets/{index-D9Jl2teh.js → index-BCQZbPeH.js} +3 -3
  100. package/dist/client/assets/{index-YOEpEUyS.js → index-BeAkwX8F.js} +1 -1
  101. package/dist/client/assets/{index-D3ZbfB7L.js → index-BspaoAFJ.js} +1 -1
  102. package/dist/client/assets/{index-DikJYrmI.js → index-C0RJqF7u.js} +1 -1
  103. package/dist/client/assets/{index-Da2BgJQV.js → index-CEZz0ndn.js} +1 -1
  104. package/dist/client/assets/{index-B96RsdAE.js → index-Cfi3HlHz.js} +1 -1
  105. package/dist/client/assets/index-Cnn6tTYH.css +1 -0
  106. package/dist/client/assets/{index-YqfRemtU.js → index-Cv2lqoTf.js} +5 -5
  107. package/dist/client/assets/{index-BtaxzVR0.js → index-D92tuiTs.js} +1 -1
  108. package/dist/client/assets/{index-cif87MVR.js → index-DihMtjYK.js} +1 -1
  109. package/dist/client/assets/{index-pn1YPMKj.js → index-Dutd3Lw0.js} +1 -1
  110. package/dist/client/assets/{index-qfheH9Xc.js → index-Fhr28YR7.js} +3 -3
  111. package/dist/client/assets/index-Q1C-CIMU.js +1 -0
  112. package/dist/client/assets/{index-redirect-DdgddsNH.js → index-redirect-Cx_VgwfS.js} +1 -1
  113. package/dist/client/assets/{input-c3bkJxBD.js → input-pJMroKkw.js} +1 -1
  114. package/dist/client/assets/{integration-icon-DsTjAPrY.js → integration-icon-GqCugUan.js} +1 -1
  115. package/dist/client/assets/invite-member-dialog-CGySt3ln.js +3 -0
  116. package/dist/client/assets/{label-C-M0DX5a.js → label-e8ipDDuV.js} +1 -1
  117. package/dist/client/assets/{library-tab-D1dP6e2l.js → library-tab-xtxwrwsE.js} +1 -1
  118. package/dist/client/assets/{login-DMQTn7wh.js → login-D36YSbZ3.js} +1 -1
  119. package/dist/client/assets/{mcp-oauth-D8P2QaWG.js → mcp-oauth-DJ_D41xa.js} +1 -1
  120. package/dist/client/assets/members-vbnJ5HeT.js +1 -0
  121. package/dist/client/assets/{monaco-editor-Bn7nTC-y.js → monaco-editor-Bb0hmy-d.js} +1 -1
  122. package/dist/client/assets/{monitoring-stats-row-D2SCaVP_.js → monitoring-stats-row-BZRgcvhm.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-arRRISlw.js → oauth-callback-DZYBu4eK.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-ai-provider-BrGx-toi.js → oauth-callback-ai-provider-Chg0Gwp5.js} +1 -1
  125. package/dist/client/assets/{onboarding-DfQssXGo.js → onboarding-DSFSSRFr.js} +1 -1
  126. package/dist/client/assets/{org-install-CAxOgyNR.js → org-install-DU4NcQb8.js} +1 -1
  127. package/dist/client/assets/{org-layout-C7RcAVm5.js → org-layout-CL__RtH7.js} +1 -1
  128. package/dist/client/assets/{organization-choice-aXwHBCUC.js → organization-choice-DuHbEnTg.js} +1 -1
  129. package/dist/client/assets/{page-seo-form-DTBhJgv0.js → page-seo-form-1MoU83LY.js} +1 -1
  130. package/dist/client/assets/page-seo-sheet-CLjhJXuO.js +1 -0
  131. package/dist/client/assets/{popover-DvGqLTJl.js → popover-BGYh0Vqy.js} +1 -1
  132. package/dist/client/assets/{post-editor-C-KR7OSD.js → post-editor-DoDFq7TS.js} +1 -1
  133. package/dist/client/assets/{primitives-Cbyyj3A3.js → primitives-LBvlK-aq.js} +1 -1
  134. package/dist/client/assets/{profile-eglAZx5J.js → profile-Dlqn0aYZ.js} +1 -1
  135. package/dist/client/assets/project-app-view-8w9_fvMi.js +1 -0
  136. package/dist/client/assets/record-editor-bXa5q0xQ.js +1 -0
  137. package/dist/client/assets/registry-BtF4LOFK.js +2 -0
  138. package/dist/client/assets/{registry-layout-hOf6zsxt.js → registry-layout-BYhrrdCJ.js} +1 -1
  139. package/dist/client/assets/{require-capability-XNz95caz.js → require-capability-U2maMAuO.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-CrFETKOt.js → required-auth-layout-C3UaWiTo.js} +1 -1
  141. package/dist/client/assets/{reset-password-DvMp7JEU.js → reset-password-C5cZQH7Y.js} +1 -1
  142. package/dist/client/assets/roles-Dra-Wfd-.js +1 -0
  143. package/dist/client/assets/{scroll-area-Bkg-mZA1.js → scroll-area-B0ntssfk.js} +1 -1
  144. package/dist/client/assets/{search-input-Csys3Koh.js → search-input-gVylns9Q.js} +1 -1
  145. package/dist/client/assets/{secrets-Bc04lDOi.js → secrets-D4L1pS60.js} +1 -1
  146. package/dist/client/assets/{sections-editor-DMIuM8hP.js → sections-editor-DGa1wmN5.js} +2 -2
  147. package/dist/client/assets/{select-CyjV0F4C.js → select-Bz_zhsne.js} +1 -1
  148. package/dist/client/assets/{select-model-DkNEmCB-.js → select-model-Dws7vIv0.js} +1 -1
  149. package/dist/client/assets/{seo-editor-CXv7fPuW.js → seo-editor-B6-szxCN.js} +1 -1
  150. package/dist/client/assets/{settings-layout-CqQSdUJ1.js → settings-layout-BIS898tZ.js} +1 -1
  151. package/dist/client/assets/{settings-section-CWGTzuvV.js → settings-section-BpxmEjXY.js} +1 -1
  152. package/dist/client/assets/{sheet-DuOoVZUG.js → sheet--GPTCkBV.js} +1 -1
  153. package/dist/client/assets/{shell-controls-_ERLWSRt.js → shell-controls-ly_2AJ45.js} +1 -1
  154. package/dist/client/assets/{shell-layout-DbD_tkNz.js → shell-layout-C_sGpxte.js} +1 -1
  155. package/dist/client/assets/{sidebar-Dk_5AbOf.js → sidebar-B6jtm1Ue.js} +1 -1
  156. package/dist/client/assets/{skeleton-erh5yXDG.js → skeleton-BuwUIpX4.js} +1 -1
  157. package/dist/client/assets/{sso-CA0aW0DE.js → sso-ydNnegVz.js} +1 -1
  158. package/dist/client/assets/{store-fNZRBFZQ.js → store-BxzPtxNS.js} +1 -1
  159. package/dist/client/assets/store-registry-C85lAMR7.js +2 -0
  160. package/dist/client/assets/{studio-tools-BaSvhr-J.js → studio-tools-C5AidOwh.js} +1 -1
  161. package/dist/client/assets/{switch-BHo8xs7D.js → switch--S_O_q8e.js} +1 -1
  162. package/dist/client/assets/{table-7NpUUPTt.js → table-Bn2PjNfj.js} +1 -1
  163. package/dist/client/assets/{tabs-MyyL-fGu.js → tabs-DLPd0DvT.js} +1 -1
  164. package/dist/client/assets/{task-row-CSJH3BP-.js → task-row-CrBNUNWV.js} +1 -1
  165. package/dist/client/assets/{task-status-CcNy4g07.js → task-status-Dt9iGaeJ.js} +1 -1
  166. package/dist/client/assets/{textarea-DE7i4Gz-.js → textarea-CjWp7xSP.js} +1 -1
  167. package/dist/client/assets/{toggle-group-BPcVs9aZ.js → toggle-group-ClY9GDOR.js} +1 -1
  168. package/dist/client/assets/{toolbar-DO76WyPk.js → toolbar-DOmN7mkS.js} +1 -1
  169. package/dist/client/assets/{toolbar-icon-button-CRc66nZ-.js → toolbar-icon-button-C8FxUmEM.js} +1 -1
  170. package/dist/client/assets/{tools-list-Bq5PisM1.js → tools-list-MDGz8nvX.js} +1 -1
  171. package/dist/client/assets/{tooltip-CBYM2iV5.js → tooltip-KzEPH1eR.js} +1 -1
  172. package/dist/client/assets/{types-BxTesI-C.js → types-B364N4aW.js} +1 -1
  173. package/dist/client/assets/{use-ai-providers-BLBRqrOl.js → use-ai-providers-Dq5k2aGK.js} +1 -1
  174. package/dist/client/assets/{use-automations-5UyPQOVR.js → use-automations-CzG9IQfm.js} +1 -1
  175. package/dist/client/assets/{use-capability-BOo3wKB9.js → use-capability-BJ4aG-VL.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-DpMHy-Ay.js → use-clock-tick-DyaHUns-.js} +1 -1
  177. package/dist/client/assets/{use-collections-CQf58LpF.js → use-collections-D1lQ_xC2.js} +1 -1
  178. package/dist/client/assets/{use-connection-BuG3o_JE.js → use-connection-iaNqg2f9.js} +1 -1
  179. package/dist/client/assets/{use-copy-jWg55WQ8.js → use-copy-D2sA2mMs.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-LuXF-lyt.js → use-create-virtual-mcp-qQdCtTI0.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-BlFX0cfT.js → use-debounced-autosave-jPoGEcl_.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-Df6CEQAw.js → use-debounced-value-CrPySguN.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-uI4wGrsY.js → use-decopilot-events-C_YXHznB.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-UF4lOt5V.js → use-delete-connection-BFjaOGmE.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-Bs9D0249.js → use-file-configs-DT_kH366.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-DlYly1rf.js → use-infinite-scroll-n6K3XvYN.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-B315-fOS.js → use-join-requests-ClpMRY-2.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-CpnbLiac.js → use-mcp-client-BBa18C66.js} +1 -1
  189. package/dist/client/assets/{use-mcp-prompts-B5dgZtuY.js → use-mcp-prompts-BJlX80Yp.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-DpNh0INt.js → use-mcp-tools-BRnTJmjH.js} +1 -1
  191. package/dist/client/assets/{use-members-BRjOC4BL.js → use-members-Ng06RoGr.js} +1 -1
  192. package/dist/client/assets/{use-mobile-BnJF8Qa_.js → use-mobile-fVP68LM8.js} +1 -1
  193. package/dist/client/assets/use-navigate-to-agent-C6SA_K8C.js +1 -0
  194. package/dist/client/assets/{use-org-auth-client-DmjZpfi2.js → use-org-auth-client-rKt5ss-n.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-B_xa25Ag.js → use-org-sso-Cs-tarFI.js} +1 -1
  196. package/dist/client/assets/use-organization-roles-BbGAZb76.js +1 -0
  197. package/dist/client/assets/{use-organization-settings-DtUUny9s.js → use-organization-settings-DRcl_3Dg.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-CLetM4Ks.js → use-registry-connections-DYKN0CFv.js} +1 -1
  199. package/dist/client/assets/{use-secrets-CuFzitLe.js → use-secrets-3i5_T1Ig.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-4tbPTgQW.js → use-status-sounds-CmPdHuAg.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-C2fVP0l9.js → use-view-mode-CxyCyyqP.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-OVYXqA3Z.js → use-virtual-mcp-CrBCSZ6B.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-_DQrdP-B.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-CkKiinpE.js +1 -0
  205. package/dist/client/assets/{useSuspenseQueries-g4R4jK3t.js → useSuspenseQueries-DqkS_kYg.js} +1 -1
  206. package/dist/client/assets/{variant-calendar-amJKLF4x.js → variant-calendar-D86dGqBT.js} +1 -1
  207. package/dist/client/assets/{view-mode-toggle-DGsaaoN8.js → view-mode-toggle-C2i_xBD9.js} +1 -1
  208. package/dist/client/index.html +2 -2
  209. package/dist/server/cli.js +979 -653
  210. package/dist/server/server.js +264 -264
  211. package/package.json +1 -1
  212. package/dist/client/assets/agents-list-D2wP1uld.js +0 -1
  213. package/dist/client/assets/collection-detail-ClK5ckvV.js +0 -1
  214. package/dist/client/assets/github-repo-picker-CXt90kMG.js +0 -1
  215. package/dist/client/assets/import-from-deco-dialog-P6TRPQ14.js +0 -4
  216. package/dist/client/assets/index-8NfBTjo_.js +0 -1
  217. package/dist/client/assets/index-DmMZ0-sF.css +0 -1
  218. package/dist/client/assets/members-B3Jf-1QZ.js +0 -3
  219. package/dist/client/assets/page-seo-sheet-DSFzu1g0.js +0 -1
  220. package/dist/client/assets/project-app-view-BZfBTk7X.js +0 -1
  221. package/dist/client/assets/record-editor-lkwoQjs9.js +0 -1
  222. package/dist/client/assets/registry-_cXAc0hk.js +0 -2
  223. package/dist/client/assets/roles-HzDtUpXH.js +0 -1
  224. package/dist/client/assets/store-registry-Bfou8ECl.js +0 -2
  225. package/dist/client/assets/use-navigate-to-agent-CI_L2BEy.js +0 -1
  226. package/dist/client/assets/use-organization-roles-BO6fS6vf.js +0 -1
  227. package/dist/client/assets/useInfiniteQuery-CgWnzkKu.js +0 -1
  228. package/dist/client/assets/useSuspenseInfiniteQuery-DtkXwhfE.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "4.17.2",
3
+ "version": "4.18.0",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{c as se,j as s,B as Z,G as me,r as Y,v,t as de}from"./index-qfheH9Xc.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-5pJpeeqf.js";import{s as pe}from"./Star01-CkOKT_Ec.js";import{a as fe}from"./Users03-B-JAgn9g.js";import{a as ge,G as ue}from"./github-repo-picker-CXt90kMG.js";import{S as he,u as xe,H as ie,W as oe,I as je}from"./import-from-deco-dialog-P6TRPQ14.js";import{a as _e,b as Ce,c as be}from"./use-virtual-mcp-OVYXqA3Z.js";import{P as K}from"./index-pn1YPMKj.js";import{i as ye}from"./DotsVertical-CqrNmdxL.js";import{a as Ne}from"./Settings02-C-6P9tLl.js";import{s as Se}from"./Trash01-oru1b8W8.js";import{A as De,ay as ve}from"./agent-icon-C1BWispo.js";import{c as Ae}from"./use-navigate-to-agent-CI_L2BEy.js";import{C as ke}from"./card-BcWpe7XA.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-BOo3wKB9.js";import{E as Te}from"./empty-state-B08-kVr_.js";import{u as ze}from"./use-create-virtual-mcp-LuXF-lyt.js";import{c as Ie,b as Pe,d as He,A as Ee,e as Me,g as Oe,a as Be,f as Ge}from"./alert-dialog-ha1v59qY.js";import{S as $e}from"./search-input-Csys3Koh.js";import{s as le}from"./Plus-DZiClNST.js";import"./ChevronUp-BGt4chTY.js";import"./ChevronRight-jYKilAXW.js";import"./dialog-DaSKz7DM.js";import"./X-D1xM7jXL.js";import"./checkbox-BGLrFwOD.js";import"./collection-search-BWPhJb0W.js";import"./SearchMd-CYoVQBZq.js";import"./use-debounced-value-Df6CEQAw.js";import"./use-connection-BuG3o_JE.js";import"./use-collections-CQf58LpF.js";import"./use-mcp-client-CpnbLiac.js";import"./auth-ou2428Bw.js";import"./authenticate-and-persist-oauth-B3lWqExf.js";import"./mcp-oauth-D8P2QaWG.js";import"./use-mcp-tools-DpNh0INt.js";import"./extract-connection-data-X711B5tE.js";import"./github-installations-DzN1UQ4x.js";import"./sidebar-Dk_5AbOf.js";import"./LayoutLeft-Ck3c6EbZ.js";import"./use-mobile-BnJF8Qa_.js";import"./sheet-DuOoVZUG.js";import"./tooltip-CBYM2iV5.js";import"./AlertCircle-DdrwwZMq.js";import"./Tool01-84S8urW1.js";import"./SwitchHorizontal01-1JfD3pEr.js";import"./XCircle-D1ibZ16t.js";import"./ArrowUpRight-jXBy9ipz.js";import"./ZapSquare-B4AjMOPu.js";import"./CheckCircle-3ZOkMXIL.js";import"./ChevronDown-CLx4-WM1.js";import"./Stars02-YL1S7hw5.js";import"./Eye-o5yQXJvl.js";import"./ZoomOut-DfCeUHFX.js";import"./Globe01-CcG20jKe.js";import"./FilterLines-CDGBU4Yu.js";import"./Globe04-Cv_V-Fs_.js";import"./HardDrive-BSIK0u4A.js";import"./Key01-DgIKoZGo.js";import"./LinkExternal01-C4RHyT_k.js";import"./Monitor01-CWIDsYmm.js";import"./Sun-CX24eczl.js";import"./Palette-BFwjtSY1.js";import"./Play-DqQKGu-U.js";import"./SearchLg-CaS6w27I.js";import"./Shield01-B3rvsBtl.js";import"./Stars01-sPe6wVRL.js";import"./Upload01-Cou_1dwr.js";import"./User01-BL-jdznB.js";import"./Users01-CvViXbMH.js";import"./XClose-D0Zu_lRC.js";import"./Zap-Bo8lb0F-.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=se.c(29),{onCreateFromScratch:i,onCreateWebsite:D,onCreateHydrogenStore:l,onImportGitHub:S,onImportDeco:f,isCreating:o,align:y,side:g,showBetaBadge:u}=t,h=y===void 0?"end":y;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(fe,{size:14}),e[0]=x):x=e[0];let a;e[1]!==o||e[2]!==i?(a=s.jsxs(k,{disabled:o,onClick:i,children:[x,"Create from scratch"]}),e[1]=o,e[2]=i,e[3]=a):a=e[3];let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:14}),e[4]=j):j=e[4];let n;e[5]!==o||e[6]!==D?(n=s.jsxs(k,{disabled:o,onClick:D,children:[j,"Start Website"]}),e[5]=o,e[6]=D,e[7]=n):n=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("img",{src:he,alt:"",className:"size-3.5 object-contain"}),e[8]=_):_=e[8];let c;e[9]!==o||e[10]!==l?(c=s.jsxs(k,{disabled:o,onClick:l,children:[_,"Create Shopify Headless Store"]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(ge,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(k,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(k,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(k,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(k,{variant:"destructive",onClick:w=>{w.stopPropagation(),l(w)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(ke,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function ns(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=xe(),[h,x]=Y.useState(null),[a,j]=Y.useState(!1),[n,_]=Y.useState(!1),{granted:c}=we("agents:manage"),N=l.toLowerCase(),r=i.filter(d=>d.id!==e.id&&(d.title.toLowerCase().includes(N)||d.description?.toLowerCase().includes(N))),{data:C}=be(r.map(Le));let p;t[1]!==D||t[2]!==h?(p=async()=>{if(!h)return;const{id:d,title:ce}=h;x(null);try{await D.delete.mutateAsync(d),v("agent_deleted",{agent_id:d,source:"agents_list"}),de.success(`Deleted "${ce}"`)}catch{}},t[1]=D,t[2]=h,t[3]=p):p=t[3];const m=p,b=K,A=K,w=K;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K.Title,{children:"Agents"}),t[4]=F):F=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{d.key==="Escape"&&(S(""),d.target.blur())},t[5]=L):L=t[5];let T;t[6]!==l?(T=s.jsx($e,{value:l,onChange:S,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=T):T=t[7];let z;t[8]!==c||t[9]!==g||t[10]!==o||t[11]!==y||t[12]!==u?(z=c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list",method:"deco"}),j(!0)},isCreating:y||u,align:"end"})]}),t[8]=c,t[9]=g,t[10]=o,t[11]=y,t[12]=u,t[13]=z):z=t[13];let I;t[14]!==T||t[15]!==z?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[F,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[T,z]})]}),t[14]=T,t[15]=z,t[16]=I):I=t[16];const q=r.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(ve,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),j(!0)},isCreating:y||u,align:"center",showBetaBadge:!0})]})})}),J=r.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:r.map(d=>s.jsx(Fe,{project:d,lastUsedAt:C?.get(d.id)?.last_used_at,onDeleteClick:c?()=>x({id:d.id,title:d.title}):void 0},d.id))})]});let P;t[17]!==J||t[18]!==w.Body||t[19]!==I||t[20]!==q?(P=s.jsxs(w.Body,{children:[I,q,J]}),t[17]=J,t[18]=w.Body,t[19]=I,t[20]=q,t[21]=P):P=t[21];let H;t[22]!==P||t[23]!==A.Content?(H=s.jsx(A.Content,{children:P}),t[22]=P,t[23]=A.Content,t[24]=H):H=t[24];let E;t[25]!==n?(E=s.jsx(ue,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{ns as default};
@@ -1 +0,0 @@
1
- import{c as O,j as t,B as F,i as Y,o as Ge,s as te,E as Pe,r as $,G as re,p as Qe,u as Ye,R as W,t as Xe,l as je,e as le,aW as ke}from"./index-qfheH9Xc.js";import{E as Ee}from"./empty-state-B08-kVr_.js";import{u as Ze,a as Ae}from"./use-collections-CQf58LpF.js";import{u as ae}from"./use-mcp-client-CpnbLiac.js";import{F as se,a as et,b as ce,d as de}from"./form-D1efg8C-.js";import{I as me}from"./input-c3bkJxBD.js";import{T as ie}from"./textarea-DE7i4Gz-.js";import{a as tt,b as st,V as ue,O as nt,M as ot}from"./index-cif87MVR.js";import{am as it,y as rt,ab as lt,an as at,$ as ct,ao as dt,K as be}from"./agent-icon-C1BWispo.js";import{g as mt,M as ut,a as Ne}from"./types-BxTesI-C.js";import{A as xt,a as pt,b as ft}from"./alert-DAyg3TSF.js";import{d as ve,S as Se,a as ye,b as we,c as ne}from"./select-CyjV0F4C.js";import{c as ht,T as Ce,a as Ie,b as $e}from"./tooltip-CBYM2iV5.js";import{i as gt}from"./AlertCircle-DdrwwZMq.js";import{s as jt}from"./Stars02-YL1S7hw5.js";import{a as bt}from"./Eye-o5yQXJvl.js";import{i as Nt}from"./Play-DqQKGu-U.js";import{b as Oe,c as Re,B as J,d as G,a as Q,e as _e}from"./breadcrumb-C_jNPElt.js";import{g as vt}from"./connection-slug-eyAPH6o3.js";import{u as St,T as yt}from"./tools-list-Bq5PisM1.js";import{a as De,u as Me}from"./use-connection-BuG3o_JE.js";import{a as wt}from"./use-mcp-tools-DpNh0INt.js";import{c as Ct}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-DsTjAPrY.js";import{j as It,m as $t}from"./chat-context-BXvC8snN.js";import{b as Tt}from"./shell-layout-DbD_tkNz.js";import{M as Pt}from"./monaco-editor-Bn7nTC-y.js";import{n as kt}from"./XCircle-D1ibZ16t.js";import"./auth-ou2428Bw.js";import"./label-C-M0DX5a.js";import"./index-pn1YPMKj.js";import"./sidebar-Dk_5AbOf.js";import"./LayoutLeft-Ck3c6EbZ.js";import"./use-mobile-BnJF8Qa_.js";import"./sheet-DuOoVZUG.js";import"./X-D1xM7jXL.js";import"./ZoomOut-DfCeUHFX.js";import"./Key01-DgIKoZGo.js";import"./extract-connection-data-X711B5tE.js";import"./use-registry-connections-CLetM4Ks.js";import"./use-organization-settings-DtUUny9s.js";import"./studio-tools-BaSvhr-J.js";import"./Plus-DZiClNST.js";import"./index-D3ZbfB7L.js";import"./index-C3i4LyhT.js";import"./index-DikJYrmI.js";import"./popover-DvGqLTJl.js";import"./use-virtual-mcp-OVYXqA3Z.js";import"./ChevronUp-BGt4chTY.js";import"./SearchMd-CYoVQBZq.js";import"./Users03-B-JAgn9g.js";import"./use-create-virtual-mcp-LuXF-lyt.js";import"./use-navigate-to-agent-CI_L2BEy.js";import"./Tool01-84S8urW1.js";import"./SwitchHorizontal01-1JfD3pEr.js";import"./Settings02-C-6P9tLl.js";import"./ArrowUpRight-jXBy9ipz.js";import"./ZapSquare-B4AjMOPu.js";import"./CheckCircle-3ZOkMXIL.js";import"./ChevronDown-CLx4-WM1.js";import"./ChevronRight-jYKilAXW.js";import"./DotsVertical-CqrNmdxL.js";import"./Globe01-CcG20jKe.js";import"./FilterLines-CDGBU4Yu.js";import"./Star01-CkOKT_Ec.js";import"./Globe04-Cv_V-Fs_.js";import"./HardDrive-BSIK0u4A.js";import"./LinkExternal01-C4RHyT_k.js";import"./Monitor01-CWIDsYmm.js";import"./Sun-CX24eczl.js";import"./Palette-BFwjtSY1.js";import"./SearchLg-CaS6w27I.js";import"./Shield01-B3rvsBtl.js";import"./Stars01-sPe6wVRL.js";import"./Trash01-oru1b8W8.js";import"./Upload01-Cou_1dwr.js";import"./User01-BL-jdznB.js";import"./Users01-CvViXbMH.js";import"./XClose-D0Zu_lRC.js";import"./Zap-Bo8lb0F-.js";import"./mcp-oauth-D8P2QaWG.js";import"./badge-DjU6bfHE.js";import"./hooks-BgBnOJ3c.js";import"./decopilot-sse-pool-DrXwOdO1.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-BLBRqrOl.js";import"./use-decopilot-events-uI4wGrsY.js";import"./tab-id-DPNwWMUY.js";import"./avatar-tYV7Xj5e.js";import"./dialog-DaSKz7DM.js";import"./alert-dialog-ha1v59qY.js";import"./required-auth-layout-CrFETKOt.js";import"./use-org-sso-B_xa25Ag.js";import"./index-B96RsdAE.js";function Et(s){const e=O.c(15),{onSave:r,onUndo:o,isDirty:l,isSaving:i,saveLabel:c,undoLabel:d}=s,n=c===void 0?"Save":c,u=d===void 0?"Undo":d;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(it,{size:14}),e[0]=x):x=e[0];let m;e[1]!==i||e[2]!==o||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:o,disabled:i,"aria-label":u,children:[x,u]}),e[1]=i,e[2]=o,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==i?(p=i?t.jsx(Y,{size:14,className:"animate-spin"}):t.jsx(rt,{size:14}),e[5]=i,e[6]=p):p=e[6];let f;e[7]!==i||e[8]!==r||e[9]!==n||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:r,disabled:i,"aria-label":n,children:[p,n]}),e[7]=i,e[8]=r,e[9]=n,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:te().min(1),description:te().nullable(),body:te()});function oe(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function At(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(o=>o==="mcps"),r=e>=0?s[e+1]:void 0;return r?decodeURIComponent(r):void 0}function Ot(s){const e=O.c(13),{form:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=o):o=e[0];let l;e[1]!==r.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[o,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(se,{control:r.control,name:"title",render:Dt}),t.jsx(se,{control:r.control,name:"description",render:_t})]})]}),e[1]=r.control,e[2]=l):l=e[2];let i,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),c=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=i,e[4]=c):(i=e[3],c=e[4]);let d;e[5]!==r.control?(d=t.jsxs("div",{className:"flex flex-col gap-2",children:[i,c,t.jsx(se,{control:r.control,name:"body",render:Rt})]}),e[5]=r.control,e[6]=d):d=e[6];let n;e[7]!==l||e[8]!==d?(n=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,d]}),e[7]=l,e[8]=d,e[9]=n):n=e[9];let u;return e[10]!==r||e[11]!==n?(u=t.jsx(et,{...r,children:n}),e[10]=r,e[11]=n,e[12]=u):u=e[12],u}function Rt(s){const{field:e}=s;return t.jsx(ce,{children:t.jsx(de,{children:t.jsx(ie,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function _t(s){const{field:e}=s;return t.jsxs(ce,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(de,{children:t.jsx(me,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Dt(s){const{field:e}=s;return t.jsxs(ce,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(de,{children:t.jsx(me,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Mt(s){const e=O.c(36),{providerId:r,promptId:o}=s,{org:l}=re(),i=r||null;let c;e[0]!==l.id||e[1]!==l.slug||e[2]!==i?(c={connectionId:i,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=i,e[3]=c):c=e[3];const d=ae(c),n=Ze(r,"PROMPT",o,d),u=Ae(r,"PROMPT",d),x=u.update.isPending;let m;e[4]!==n?(m=n?{title:n.title,description:n.description??null,body:oe(n)}:void 0,e[4]=n,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==n?(g=()=>{n&&f.reset({title:n.title,description:n.description??null,body:oe(n)})},e[8]=f,e[9]=n,e[10]=g):g=e[10];const S=g;let C;e[11]!==u.update||e[12]!==f||e[13]!==o?(C=f.handleSubmit(async N=>{const E=await u.update.mutateAsync({id:o,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:E.title,description:E.description??null,body:oe(E)})}),e[11]=u.update,e[12]=f,e[13]=o,e[14]=C):C=e[14];const R=C;if(!n){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let I;e[16]!==n.title?(I=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[16]=n.title,e[17]=I):I=e[17];let k;e[18]!==n.description?(k=n.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:n.description})]}):null,e[18]=n.description,e[19]=k):k=e[19];let T;e[20]!==I||e[21]!==k?(T=t.jsx(st,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I,k]})}),e[20]=I,e[21]=k,e[22]=T):T=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let y;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(y=t.jsx(tt,{children:t.jsx(Et,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=y):y=e[29];let w;e[30]!==f?(w=t.jsx("div",{className:"h-full",children:t.jsx(Ot,{form:f})}),e[30]=f,e[31]=w):w=e[31];let P;return e[32]!==y||e[33]!==w||e[34]!==T?(P=t.jsxs(ue,{children:[T,y,w]}),e[32]=y,e[33]=w,e[34]=T,e[35]=P):P=e[35],P}function zt(s){const e=O.c(4),{itemId:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=At(),e[0]=o):o=e[0];const l=o;if(!l){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let i;return e[2]!==r?(i=t.jsx(Pe,{children:t.jsx($.Suspense,{fallback:null,children:t.jsx(Mt,{providerId:l,promptId:r})})}),e[2]=r,e[3]=i):i=e[3],i}const Lt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ut(s){const e=O.c(11),{toolName:r,connectionId:o,siblings:l,onSelectInstance:i,onBack:c}=s;let d;e[0]!==o?(d={connectionId:o},e[0]=o,e[1]=d):d=e[1];const n=St(d);if(!n.isAuthenticated){let m;return e[2]!==n.supportsOAuth||e[3]!==c?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:n.supportsOAuth?t.jsx(nt,{onAuthenticate:()=>c(),buttonText:"Go back to authenticate"}):t.jsx(ot,{hasReadme:!1})}),e[2]=n.supportsOAuth,e[3]=c,e[4]=m):m=e[4],m}const u=`${o}:${r}`;let x;return e[5]!==o||e[6]!==i||e[7]!==l||e[8]!==u||e[9]!==r?(x=t.jsx(Bt,{toolName:r,connectionId:o,siblings:l,onSelectInstance:i},u),e[5]=o,e[6]=i,e[7]=l,e[8]=u,e[9]=r,e[10]=x):x=e[10],x}function Bt({toolName:s,connectionId:e,siblings:r,onSelectInstance:o}){const{replayId:l}=Ye({strict:!1}),i=(()=>{if(!l)return null;const a=`replay-${l}`,h=sessionStorage.getItem(a);if(!h)return null;sessionStorage.removeItem(a);try{return JSON.parse(h)}catch{return null}})(),c=(()=>{if(!i)return null;const a={};for(const[h,v]of Object.entries(i))v!==null&&typeof v=="object"?a[h]=JSON.stringify(v,null,2):a[h]=v;return a})(),[d,n]=$.useState(c??{}),[u,x]=$.useState(i?JSON.stringify(i,null,2):"{}"),[m,p]=$.useState(null),[f,g]=$.useState(null),[S,C]=$.useState(null),[R,I]=$.useState(null),[k,T]=$.useState(!1),[b,y]=$.useState(null),{org:w}=re(),P=De(e),N=It(),E=$t(),{setChatOpen:U}=Tt(),z=`${e}:${s}`,_=ae({connectionId:e,orgId:w.id,orgSlug:w.slug}),L=wt({client:_}),j=L.data?.tools?.find(a=>a.name===s),A=mt(j?._meta),V=a=>{if(!N)return;const h=Ct(a.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[D,X]=$.useState("json"),[ze,Le]=$.useState(!1);A&&!ze&&(X("ui"),Le(!0));const xe=j?.inputSchema?.properties,pe=xe?Object.keys(xe):[],q=pe.length>0,H={};if(q&&j?.inputSchema?.properties)for(const a of pe)H[a]=j.inputSchema.required?.includes(a)?"":void 0;const Z=a=>Object.prototype.hasOwnProperty.call(d,a),Ue=async()=>{T(!0),I(null),p(null),g(null),C(null),y(null);const a=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=q?{...H,...d}:(()=>{const M=u.trim();if(!M)return{};const B=JSON.parse(M);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();q&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([M,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[M]=="string")try{h[M]=JSON.parse(h[M])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[M]=="string"&&h[M]!==""){const ge=Number(h[M]);Number.isNaN(ge)||(h[M]=ge)}});const v=await _.callTool({name:s,arguments:h}),K=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-a);p(K),g(v),C(h);const We=JSON.stringify(K),he=new TextEncoder().encode(We).length;y({duration:`${Ke}ms`,bytes:`${he} bytes`,tokens:`~${Math.ceil(he/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);I(v||"Unknown error occurred");const K=performance.now();y({duration:`${Math.round(K-a)}ms`})}finally{T(!1)}},ee=(a,h)=>{n(v=>({...v,[a]:h}))},Be=()=>{p(null),g(null),C(null),I(null),y(null)},Fe=j?.name??Lt(s),Ve=t.jsx(Oe,{children:t.jsxs(Re,{children:[t.jsx(J,{children:t.jsx(G,{asChild:!0,children:t.jsx(W,{to:"/$org/settings/connections",params:{org:w.slug},children:"Connections"})})}),t.jsx(Q,{}),P&&t.jsxs(t.Fragment,{children:[t.jsx(J,{children:t.jsx(G,{asChild:!0,children:t.jsx(W,{to:"/$org/settings/connections/$appSlug",params:{org:w.slug,appSlug:vt(P)},search:{tab:"tools"},children:P.title})})}),t.jsx(Q,{})]}),t.jsx(J,{children:t.jsx(_e,{children:Fe})})]})}),fe=r.length>1&&t.jsxs(ve,{value:e,onValueChange:o,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:r.map(a=>t.jsx(ne,{value:a.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:a.icon,name:a.title,size:"xs",className:"shrink-0"}),a.title]})},a.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:q&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([a,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[a,j.inputSchema?.required?.includes(a)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(ie,{className:"font-mono text-xs",value:Z(a)?d[a]??"":H[a]??"",onChange:v=>ee(a,v.target.value),placeholder:`Enter ${a} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:Z(a)?String(d[a]??""):"",onValueChange:v=>ee(a,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(ne,{value:"true",children:"true"}),t.jsx(ne,{value:"false",children:"false"})]})]}):t.jsx(me,{value:Z(a)?d[a]??"":H[a]??"",onChange:v=>ee(a,v.target.value),placeholder:`Enter ${a}...`})]},a)):j?.inputSchema&&!q?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(ie,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:a=>x(a.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:k?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(lt,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(Nt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(jt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(at,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),A&&t.jsx(ht,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(dt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(xt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"h-4 w-4"}),t.jsx(pt,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ft,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:A&&D==="ui"&&_?t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(ut,{resourceURI:A,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:V,onUpdateModelContext:a=>E?.setAppContext(z,a),onTeardown:()=>E?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Pt,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(bt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(ue,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:P?.icon||null,name:P?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(Y,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(yt,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:fe})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),r.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),fe]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Ft(s){const e=O.c(10),{itemId:r,siblings:o,onBack:l}=s,[i,c]=$.useState(o[0]?.id??"");let d;e[0]!==i||e[1]!==o?(d=o.find(p=>p.id===i)?.id??o[0]?.id??"",e[0]=i,e[1]=o,e[2]=d):d=e[2];const n=d;if(!De(n||void 0)||!n){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==n||e[6]!==l||e[7]!==o||e[8]!==r?(m=t.jsx($.Suspense,{fallback:x,children:t.jsx(Ut,{toolName:r,connectionId:n,siblings:o,onSelectInstance:c,onBack:l})}),e[5]=n,e[6]=l,e[7]=o,e[8]=r,e[9]=m):m=e[9],m}function Vt(s){const e=O.c(21),{icon:r,illustration:o,title:l,description:i,buttonProps:c,buttonComponent:d,className:n,children:u}=s;let x;e[0]!==n?(x=je("flex flex-col items-center justify-center py-16 text-center",n),e[0]=n,e[1]=x):x=e[1];let m;e[2]!==r||e[3]!==o?(m=o?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:o}):r?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:r}):null,e[2]=r,e[3]=o,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==i?(f=i&&t.jsx("div",{className:"text-sm text-muted-foreground",children:i}),e[7]=i,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==d||e[13]!==c?(S=(d??c)&&t.jsx("div",{className:"mt-4",children:d??(c&&t.jsx(F,{size:"sm",className:je(c?.className),...c}))}),e[12]=d,e[13]=c,e[14]=S):S=e[14];let C;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(C=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=C):C=e[20],C}const Jt={prompt:zt};function qt(){const s=O.c(9),e=ke();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=r):r=s[0];const o=le(r),l=decodeURIComponent(o.itemId);let i;s[1]!==o.appSlug?(i={slug:o.appSlug},s[1]=o.appSlug,s[2]=i):i=s[2];const c=Me(i);let d;s[3]!==e.history?(d=()=>{e.history.back()},s[3]=e.history,s[4]=d):d=s[4];const n=d,u=Ht;let x;return s[5]!==n||s[6]!==l||s[7]!==c?(x=t.jsx(Ft,{itemId:l,siblings:c,onBack:n,onUpdate:u}),s[5]=n,s[6]=l,s[7]=c,s[8]=x):x=s[8],x}async function Ht(s){return Promise.resolve()}function Kt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Wt(){const s=O.c(41),e=ke();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=r):r=s[0];const o=le(r),l=decodeURIComponent(o.collectionName),i=decodeURIComponent(o.itemId);let c;s[1]!==e.history?(c=()=>{e.history.back()},s[1]=e.history,s[2]=c):c=s[2];const d=c,{org:n}=re();let u;s[3]!==o.appSlug?(u={slug:o.appSlug},s[3]=o.appSlug,s[4]=u):u=s[4];const m=Me(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==n.id||s[6]!==n.slug||s[7]!==g?(S={connectionId:g,orgId:n.id,orgSlug:n.slug},s[5]=n.id,s[6]=n.slug,s[7]=g,s[8]=S):S=s[8];const C=ae(S),R=Ae(f,l,C);let I;s[9]!==R||s[10]!==i?(I=async D=>{i&&await R.update.mutateAsync({id:i,data:D})},s[9]=R,s[10]=i,s[11]=I):I=s[11];const k=I;let T;s[12]!==l?(T=l?.toLowerCase(),s[12]=l,s[13]=T):T=s[13];const b=T,y=b&&Jt[b];let w;s[14]!==l?(w=Kt(l),s[14]=l,s[15]=w):w=s[15];const P=w;let N;s[16]!==n.slug?(N=t.jsx(J,{children:t.jsx(G,{asChild:!0,children:t.jsx(W,{to:"/$org/settings/connections",params:{org:n.slug},children:"Connections"})})}),s[16]=n.slug,s[17]=N):N=s[17];let E;s[18]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Q,{}),s[18]=E):E=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==n.slug||s[22]!==o.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(J,{children:t.jsx(G,{asChild:!0,children:t.jsx(W,{to:"/$org/settings/connections/$appSlug",params:{org:n.slug,appSlug:o.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Q,{})]}),s[19]=l,s[20]=m,s[21]=n.slug,s[22]=o.appSlug,s[23]=U):U=s[23];let z;s[24]!==P?(z=t.jsx(J,{children:t.jsx(_e,{children:P})}),s[24]=P,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(Oe,{children:t.jsxs(Re,{children:[N,E,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(y){let D;return s[30]!==y||s[31]!==d||s[32]!==k||s[33]!==i?(D=t.jsx(y,{itemId:i,onBack:d,onUpdate:k}),s[30]=y,s[31]=d,s[32]=k,s[33]=i,s[34]=D):D=s[34],D}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(kt,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let A;s[36]!==d?(A=t.jsx(Vt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:d,children:"Go back"}}),s[36]=d,s[37]=A):A=s[37];let V;return s[38]!==L||s[39]!==A?(V=t.jsx(ue,{breadcrumb:L,children:A}),s[38]=L,s[39]=A,s[40]=V):V=s[40],V}function Gt(){const s=O.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const r=le(e);if(decodeURIComponent(r.collectionName)==="tools"){let c;return s[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(qt,{}),s[1]=c):c=s[1],c}let i;return s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Wt,{}),s[2]=i):i=s[2],i}function zn(){const s=O.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Gt,{})})}),s[0]=e):e=s[0],e}export{zn as default};
@@ -1 +0,0 @@
1
- import{c as $,j as t,G as Q,a as te,m as W,r as G,V as B,i as D,d as ne,t as z,K as V,k as se,l as K,q as oe,a2 as re}from"./index-qfheH9Xc.js";import{c as ie,a as ae,d as le,e as ce}from"./dialog-DaSKz7DM.js";import{C as J}from"./checkbox-BGLrFwOD.js";import{C as ue}from"./collection-search-BWPhJb0W.js";import{u as de}from"./use-debounced-value-Df6CEQAw.js";import{b as me,u as fe}from"./use-connection-BuG3o_JE.js";import{W as pe,u as H,S as X}from"./use-mcp-client-CpnbLiac.js";import{b as Z}from"./Settings02-C-6P9tLl.js";import{w as ge}from"./agent-icon-C1BWispo.js";import{a as xe}from"./authenticate-and-persist-oauth-B3lWqExf.js";import{u as he}from"./use-mcp-tools-DpNh0INt.js";import{e as ye}from"./extract-connection-data-X711B5tE.js";import{c as be}from"./use-navigate-to-agent-CI_L2BEy.js";import{f as we}from"./github-installations-DzN1UQ4x.js";function M(s){const e=$.c(4),{size:n,className:o}=s;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=u):u=e[0];let l;return e[1]!==o||e[2]!==n?(l=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:u}),e[1]=o,e[2]=n,e[3]=l):l=e[3],l}function Ne(s,e){const n=$.c(12),{org:o}=Q();let u;n[0]!==o.id?(u=pe.REGISTRY(o.id),n[0]=o.id,n[1]=u):u=n[1];const l=u;let i;n[2]!==o.id||n[3]!==o.slug||n[4]!==l?(i={connectionId:l,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=l,n[5]=i):i=n[5];const x=H(i);let m;n[6]!==s?(m={name:s},n[6]=s,n[7]=m):m=n[7];const r=e?.enabled??!0;let h;return n[8]!==x||n[9]!==m||n[10]!==r?(h={client:x,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:m,enabled:r,staleTime:3e5,select:je},n[8]=x,n[9]=m,n[10]=r,n[11]=h):h=n[11],he(h)}function je(s){return s.structuredContent?.item??null}const Ie="deco/mcp-github";function Ce(s){const{org:e}=Q(),{data:n}=te.useSession(),o=me(),u=W(),[l,i]=G.useState("idle"),[x,m]=G.useState(null),[r,h]=G.useState(null),{data:g,isLoading:a}=Ne(Ie,{enabled:s.enabled}),w=G.useRef(!1);s.enabled&&g&&!a&&!w.current&&n?.user?.id&&l==="idle"&&(w.current=!0,b());async function b(){if(!(!g||!n?.user?.id||!e))try{i("installing"),m(null);const y=ye(g,e.id,n.user.id,{remoteIndex:0});if(!y.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:I}=await o.create.mutateAsync(y);i("authenticating");const f=await xe({connectionId:I,orgId:e.id,orgSlug:e.slug,persistFallback:d=>o.update.mutateAsync({id:I,data:{connection_token:d}}).then(()=>{})});if(f.ran&&!f.ok){try{await o.delete.mutateAsync(I)}catch{}throw new Error(f.error&&f.error!=="no token received"?f.error:"No token received from GitHub")}B(u,e.id),h(y),i("ready")}catch(y){m(y instanceof Error?y.message:String(y)),i("error")}}function N(){i("idle"),m(null),h(null),w.current=!1}return s.enabled&&a&&l==="idle"?{status:"installing",error:null,connection:null,retry:N}:{status:l,error:x,connection:r,retry:N}}const F={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Se(s){if(!s||typeof s!="object"||Array.isArray(s))return F;const e=s;return Object.values(e).some(n=>typeof n!="string")?F:e}function ve(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Ee(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=ve(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Se(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Te(s){return(s??[]).filter(e=>Ee(e)===null)}const Y="GitHub MCP did not return refreshable repo grant metadata";function L(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function ke(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function _e(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Ae(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:u,repo:l,githubCallTool:i,selfCallTool:x}=s,m=await i({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:u,repo:l,permissions:F}}),r=m.structuredContent;if(m.isError||!r?.token){const T=m.content?.find(v=>v.type==="text")?.text;throw new Error(T?`Failed to mint a repo-scoped GitHub token: ${T}`:"Failed to mint a repo-scoped GitHub token")}const h=L(r.refreshToken),g=L(r.tokenEndpoint),a=L(r.clientId);if(!h||!g||!a)throw new Error(Y);if(!ke(g))throw new Error(Y);const w=L(r.repository?.owner),b=L(r.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(r.repository?.owner!==void 0&&(!w||w.toLowerCase()!==u.toLowerCase()))throw new Error(N);if(r.repository?.name!==void 0&&(!b||b.toLowerCase()!==l.toLowerCase()))throw new Error(N);const y=_e(r.repository?.id),j=r.expiresAt?Date.parse(r.expiresAt):NaN,I=Number.isFinite(j)?Math.max(0,Math.floor((j-Date.now())/1e3)):null,d=(typeof r.expiresIn=="number"&&Number.isFinite(r.expiresIn)&&Number.isInteger(r.expiresIn)&&r.expiresIn>0?r.expiresIn:null)??I,C=await x({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${u}/${l}`,description:`Repo-scoped GitHub access for ${u}/${l}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:y,owner:u,repo:l,permissions:F,grantProvider:"github-mcp"}}}}}),p=C.structuredContent??C,S=p.item?.id??p.id;if(!S)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${S}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:r.token,refreshToken:h,expiresIn:d,scope:r.scope??null,clientId:a,tokenEndpoint:g})})).ok)throw await x({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:S,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:S}}const U=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Re(s,e){const n=new Set;if(s.paramsSchema)for(const u of Object.keys(s.paramsSchema))n.add(u);if(Array.isArray(s.params))for(const u of s.params)n.add(u.name);else if(s.params&&typeof s.params=="object")for(const u of Object.keys(s.params))n.add(u);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Oe({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:u,selectedKeys:l}){const i=await s({name:"TRIGGER_LIST",arguments:{}}),x=i.structuredContent??i,m=new Map((x.triggers??[]).map(a=>[a.type,a])),r=U.filter(a=>l.has(a.key)),h=await Promise.allSettled(r.map(async a=>{const w=m.get(a.triggerType);if(!w)throw new Error(`Trigger ${a.triggerType} not exposed`);const b=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${a.nameSuffix}`,virtual_mcp_id:n,messages:a.instructions(o),active:!0}}),N=(b.structuredContent??b).id;if(!N)throw new Error(`AUTOMATION_CREATE returned no id for ${a.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:N,type:"event",connection_id:u,event_type:a.triggerType,params:Re(w,o)}})})),g=h.filter(a=>a.status==="rejected").length;return g>0&&console.error("Some GitHub automations failed to set up:",h.filter(a=>a.status==="rejected")),{total:h.length,failed:g}}function Ze(s){const e=$.c(22),{open:n,onOpenChange:o,title:u,hideAutoRespondCheckbox:l,onImportComplete:i}=s,x=u===void 0?"Import from GitHub":u,m=l===void 0?!1:l,[r,h]=G.useState(null);let g;e[0]!==x?(g=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:x})}),e[0]=x,e[1]=g):g=e[1];let a;e[2]!==r||e[3]!==x?(a=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:r?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:r.avatarUrl,alt:r.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:r.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(M,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:x})]})}),e[2]=r,e[3]=x,e[4]=a):a=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=w):w=e[5];let b;e[6]!==o?(b=()=>o(!1),e[6]=o,e[7]=b):b=e[7];let N;e[8]!==m||e[9]!==i||e[10]!==n||e[11]!==r||e[12]!==b?(N=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(G.Suspense,{fallback:w,children:t.jsx(Ge,{open:n,onComplete:b,selectedInstallation:r,onSelectInstallation:h,hideAutoRespondCheckbox:m,onImportComplete:i})})}),e[8]=m,e[9]=i,e[10]=n,e[11]=r,e[12]=b,e[13]=N):N=e[13];let y;e[14]!==g||e[15]!==a||e[16]!==N?(y=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,a,N]}),e[14]=g,e[15]=a,e[16]=N,e[17]=y):y=e[17];let j;return e[18]!==o||e[19]!==n||e[20]!==y?(j=t.jsx(ce,{open:n,onOpenChange:o,children:y}),e[18]=o,e[19]=n,e[20]=y,e[21]=j):j=e[21],j}function Ge({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:u,onImportComplete:l}){const{org:i}=Q(),x=W(),m=be(),[r,h]=G.useState(null),[g,a]=G.useState(!0),[w,b]=G.useState(()=>new Set(U.filter(c=>c.defaultEnabled).map(c=>c.key))),N=U.filter(c=>c.defaultEnabled).map(c=>c.key),y=u?new Set(N):g?w:new Set,j=fe({slug:"mcp-github"}),I=Te(j),f=Ce({enabled:s&&I.length===0}),d=I.length===1?I[0]??null:r,C=H({connectionId:d?.id??"",orgId:i.id,orgSlug:i.slug}),p=H({connectionId:X,orgId:i.id,orgSlug:i.slug}),S=async(c,E)=>{try{const O=await C.callTool({name:"get_file_contents",arguments:{owner:c.owner,repo:c.name,path:E}});if(O.isError)return null;const P=O.content?.find(A=>A.type==="resource")?.resource?.text;if(!P)return null;try{const A=JSON.parse(P);return typeof A=="string"?A:JSON.stringify(A)}catch{return P}}catch{return null}},R=(c,E)=>{Promise.all([S(E,"AGENTS.md"),S(E,"CLAUDE.md")]).then(async([_,O])=>{const k=_??O??null;k&&(await p.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:c,data:{metadata:{instructions:k}}}}),B(x,i.id))}).catch(_=>{console.error("GitHub instructions fetch failed:",_)})},T=async({virtualMcpId:c,repo:E,connectionId:_,selectedKeys:O})=>{const{total:k,failed:P}=await Oe({githubCallTool:A=>C.callTool(A),selfCallTool:A=>p.callTool(A),virtualMcpId:c,repo:E,connectionId:_,selectedKeys:O});P>0&&z.warning(`Set up ${k-P}/${k} GitHub automations. Add the rest from the automations view.`)},v=ne({mutationFn:async c=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:_}=await Ae({orgSlug:i.slug,sourceConnection:d,installationId:E,owner:c.owner,repo:c.name,githubCallTool:k=>C.callTool(k),selfCallTool:k=>p.callTool(k)});let O=null;try{const k=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:c.name,description:c.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:c.owner,name:c.name,url:c.url,installationId:E,connectionId:_},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:_}]}}}),P=k.structuredContent??k,A=P.item?.id;if(!P.item||!A)throw new Error("Failed to create the imported agent");return O=A,y.size>0&&await T({virtualMcpId:A,repo:c,connectionId:_,selectedKeys:y}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),z.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:A,repo:c,connectionId:_,item:P.item}}catch(k){throw O&&await p.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:O}}).catch(()=>{}),await p.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:_,force:!0}}).catch(()=>{}),k}},onSuccess:({virtualMcpId:c,repo:E,connectionId:_,item:O})=>{if(x.setQueryData(V.collectionItem(p,i.id,"","VIRTUAL_MCP",c),{item:O}),B(x,i.id),R(c,E),l){l({virtualMcpId:c,repo:E,connectionId:_});return}z.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),m(c)},onError:c=>{z.error("Failed to import repo: "+(c instanceof Error?c.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(q,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(q,{status:"error",error:f.error,retry:f.retry}):I.length===0&&f.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:f.retry}):I.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),I.map(c=>t.jsxs("button",{type:"button",onClick:()=>h(c),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[c.icon?t.jsx("img",{src:c.icon,alt:c.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(M,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:c.title})]},c.id))]}):d?n?t.jsx($e,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,installation:n,onSelectRepo:c=>v.mutate(c),isSaving:v.isPending,autoRespondEnabled:g,onAutoRespondChange:a,selectedAutomationKeys:w,onAutomationKeysChange:b,hideAutoRespondCheckbox:u}):t.jsx(Pe,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,onSelect:o,showBackButton:I.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=$.c(31),{connectionId:n,orgId:o,orgSlug:u,onSelect:l,showBackButton:i,onBack:x}=s;let m;e[0]!==o||e[1]!==u?(m={connectionId:X,orgId:o,orgSlug:u},e[0]=o,e[1]=u,e[2]=m):m=e[2];const r=H(m);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let g;e[6]!==n||e[7]!==r?(g=()=>we(p=>r.callTool(p),n),e[6]=n,e[7]=r,e[8]=g):g=e[8];let a;e[9]!==h||e[10]!==g?(a={queryKey:h,queryFn:g},e[9]=h,e[10]=g,e[11]=a):a=e[11];const w=se(a);if(w.isLoading){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=p):p=e[12],p}if(w.isError){let p;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=p):p=e[13],p}const b=w.data;if(!b)return null;let N;e[14]!==x||e[15]!==i?(N=i&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=x,e[15]=i,e[16]=N):N=e[16];let y;if(e[17]!==b.installations||e[18]!==l){let p;e[20]!==l?(p=S=>t.jsxs("button",{type:"button",onClick:()=>l(S),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:S.avatarUrl,alt:S.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:S.login}),S.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},S.installationId),e[20]=l,e[21]=p):p=e[21],y=b.installations.map(p),e[17]=b.installations,e[18]=l,e[19]=y}else y=e[19];let j;e[22]!==y?(j=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:y}),e[22]=y,e[23]=j):j=e[23];const I=b.appSlug?`https://github.com/apps/${b.appSlug}/installations/new`:"https://github.com/settings/installations";let f;e[24]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=f):f=e[24];let d;e[25]!==I?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",f]})}),e[25]=I,e[26]=d):d=e[26];let C;return e[27]!==d||e[28]!==N||e[29]!==j?(C=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[N,j,d]}),e[27]=d,e[28]=N,e[29]=j,e[30]=C):C=e[30],C}function $e(s){const e=$.c(27),{connectionId:n,orgId:o,orgSlug:u,installation:l,onSelectRepo:i,isSaving:x,autoRespondEnabled:m,onAutoRespondChange:r,selectedAutomationKeys:h,onAutomationKeysChange:g,hideAutoRespondCheckbox:a}=s,[w,b]=G.useState(""),N=de(w,300),y=G.useDeferredValue(N),j=w!==y;let I;e[0]!==j||e[1]!==w?(I=t.jsx(ue,{placeholder:"Search repositories...",value:w,onChange:b,isSearching:j}),e[0]=j,e[1]=w,e[2]=I):I=e[2];const f=j?"opacity-40":"opacity-100";let d;e[3]!==f?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",f),e[3]=f,e[4]=d):d=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=C):C=e[5];let p;e[6]!==n||e[7]!==y||e[8]!==l||e[9]!==x||e[10]!==i||e[11]!==o||e[12]!==u?(p=t.jsx(G.Suspense,{fallback:C,children:t.jsx(Le,{connectionId:n,orgId:o,orgSlug:u,installation:l,query:y,onSelectRepo:i,isSaving:x})}),e[6]=n,e[7]=y,e[8]=l,e[9]=x,e[10]=i,e[11]=o,e[12]=u,e[13]=p):p=e[13];let S;e[14]!==d||e[15]!==p?(S=t.jsx("div",{className:d,children:p}),e[14]=d,e[15]=p,e[16]=S):S=e[16];let R;e[17]!==m||e[18]!==a||e[19]!==r||e[20]!==g||e[21]!==h?(R=!a&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:m,onCheckedChange:v=>r(v===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),m&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:U.map(v=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(v.key),onCheckedChange:c=>{const E=new Set(h);c===!0?E.add(v.key):E.delete(v.key),g(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:v.label})]},v.key))})]}),e[17]=m,e[18]=a,e[19]=r,e[20]=g,e[21]=h,e[22]=R):R=e[22];let T;return e[23]!==I||e[24]!==S||e[25]!==R?(T=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[I,S,R]}),e[23]=I,e[24]=S,e[25]=R,e[26]=T):T=e[26],T}function Le(s){const e=$.c(29),{connectionId:n,orgId:o,orgSlug:u,installation:l,query:i,onSelectRepo:x,isSaving:m}=s;let r;e[0]!==n||e[1]!==o||e[2]!==u?(r={connectionId:n,orgId:o,orgSlug:u},e[0]=n,e[1]=o,e[2]=u,e[3]=r):r=e[3];const h=H(r),g=l.type==="User"?"user":"org",a=i?`${g}:${l.login} ${i} in:name`:`${g}:${l.login}`;let w;e[4]!==n||e[5]!==l.login||e[6]!==o||e[7]!==i?(w=V.githubOrgRepos(o,n,l.login,i),e[4]=n,e[5]=l.login,e[6]=o,e[7]=i,e[8]=w):w=e[8];let b;e[9]!==h||e[10]!==a?(b=async f=>{const{signal:d}=f,p=(await h.callTool({name:"search_repositories",arguments:{query:a,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!p)throw new Error("No response from search_repositories");return(JSON.parse(p).items??[]).map(He)},e[9]=h,e[10]=a,e[11]=b):b=e[11];let N;e[12]!==w||e[13]!==b?(N={queryKey:w,queryFn:b},e[12]=w,e[13]=b,e[14]=N):N=e[14];const{data:y}=oe(N);if(y.length===0){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=f):f=e[15];let d;e[16]!==i?(d=i&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=i,e[17]=d):d=e[17];let C;return e[18]!==d?(C=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[f,d]}),e[18]=d,e[19]=C):C=e[19],C}let j;if(e[20]!==m||e[21]!==x||e[22]!==y){let f;e[24]!==m||e[25]!==x?(f=d=>t.jsxs("button",{type:"button",onClick:()=>x(d),disabled:m,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(M,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(ge,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=m,e[25]=x,e[26]=f):f=e[26],j=y.map(f),e[20]=m,e[21]=x,e[22]=y,e[23]=j}else j=e[23];let I;return e[27]!==j?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:j}),e[27]=j,e[28]=I):I=e[28],I}function He(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=$.c(33),{status:n,error:o,retry:u}=s;if(n==="error"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-destructive"})}),e[0]=p):p=e[0];let S;e[1]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=S):S=e[1];const R=o??"Something went wrong while connecting to GitHub.";let T;e[2]!==R?(T=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[S,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:R})]}),e[2]=R,e[3]=T):T=e[3];let v;e[4]!==u?(v=t.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=u,e[5]=v):v=e[5];let c;return e[6]!==T||e[7]!==v?(c=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[p,T,v]}),e[6]=T,e[7]=v,e[8]=c):c=e[8],c}const l=n==="authenticating";let i;e[9]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-foreground"})}),e[9]=i):i=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"relative size-10",children:[i,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(D,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=x):x=e[10];const m=l?"Authenticating with GitHub":"Setting up GitHub";let r;e[11]!==m?(r=t.jsx("p",{className:"text-sm font-medium",children:m}),e[11]=m,e[12]=r):r=e[12];const h=l?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let g;e[13]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=g):g=e[14];let a;e[15]!==r||e[16]!==g?(a=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[r,g]}),e[15]=r,e[16]=g,e[17]=a):a=e[17];const w=l?"bg-muted-foreground/30":"bg-foreground animate-pulse";let b;e[18]!==w?(b=K("size-1.5 rounded-full",w),e[18]=w,e[19]=b):b=e[19];let N;e[20]!==b?(N=t.jsx("span",{className:b}),e[20]=b,e[21]=N):N=e[21];const y=l?"bg-foreground animate-pulse":"bg-muted-foreground/30";let j;e[22]!==y?(j=K("size-1.5 rounded-full",y),e[22]=y,e[23]=j):j=e[23];let I;e[24]!==j?(I=t.jsx("span",{className:j}),e[24]=j,e[25]=I):I=e[25];let f;e[26]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=f):f=e[26];let d;e[27]!==N||e[28]!==I?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[N,I,f]}),e[27]=N,e[28]=I,e[29]=d):d=e[29];let C;return e[30]!==d||e[31]!==a?(C=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[x,a,d]}),e[30]=d,e[31]=a,e[32]=C):C=e[32],C}export{Ze as G,M as a,Te as g,Ae as p,Ce as u};
@@ -1,4 +0,0 @@
1
- import{c as oe,G as se,m as ie,a as re,r as A,k as ae,K as R,d as le,v as k,t as K,j as t,B as F,l as ce}from"./index-qfheH9Xc.js";import{b as de}from"./use-virtual-mcp-OVYXqA3Z.js";import{c as Z}from"./use-navigate-to-agent-CI_L2BEy.js";import{u as ue}from"./use-connection-BuG3o_JE.js";import{u as Y,S as me}from"./use-mcp-client-CpnbLiac.js";import{g as pe,u as he,p as ge,a as fe}from"./github-repo-picker-CXt90kMG.js";import{f as Ce,a as xe}from"./github-installations-DzN1UQ4x.js";import{e as be,d as we,c as ye,a as je,D as Ie}from"./dialog-DaSKz7DM.js";import{b as Se}from"./Settings02-C-6P9tLl.js";import{C as ve}from"./collection-search-BWPhJb0W.js";const Ee=`<svg width="74" height="84" viewBox="0 0 74 84" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M63.4462 15.3005C63.1414 15.2764 57.2333 15.1845 57.2333 15.1845C57.2333 15.1845 52.2906 10.3849 51.8019 9.89426C51.6127 9.71981 51.3729 9.60981 51.1172 9.58008V83.0253L73.2664 77.5175C73.2664 77.5175 64.2277 16.3953 64.1696 15.9772C64.1417 15.7997 64.055 15.6366 63.9235 15.5139C63.7919 15.3913 63.6255 15.3162 63.4462 15.3005Z" fill="#171717"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M32.748 0.00356357C34.8334 -0.0568526 36.5759 0.651298 37.9307 2.10122C38.0276 2.20613 38.1209 2.31463 38.2109 2.42544L38.2354 2.42349C38.4434 2.40657 38.6494 2.38638 38.8574 2.38638H38.8672C41.9831 2.3913 44.5571 4.16796 46.3184 7.527C46.8023 8.4621 47.2004 9.43976 47.5068 10.4469L49.9883 9.67837C50.3609 9.56961 51.315 9.42163 51.8037 9.90981L51.9922 82.3883L51.1162 83.0387L0 74.1979C0.0195597 74.0466 6.09952 27.0238 6.3291 25.3629C6.63636 23.1661 6.70922 23.0933 9.03906 22.361L16.957 19.9079C17.4531 16.377 19.1884 11.8165 21.4746 8.18423C24.7237 3.02487 28.7273 0.119714 32.748 0.00356357ZM38.8408 26.7077C38.8133 26.694 36.5926 25.6009 32.2842 25.8747C21.032 26.5853 15.9341 34.4515 16.4229 42.2213C17.0059 51.4485 26.2283 51.1199 26.584 56.734C26.6686 58.0922 25.8271 60.0114 23.4658 60.1588C19.8562 60.3883 15.3438 56.9831 15.3438 56.9831L13.6191 64.3249C13.6191 64.3249 18.1021 69.1296 26.2432 68.6149C33.027 68.1895 37.7351 62.759 37.2344 54.8249C36.5981 44.7397 25.2729 43.7966 25.002 39.4948C24.9512 38.7038 25.0055 35.556 29.9932 35.2418C33.3786 35.0279 36.2354 36.3195 36.2666 36.3336L38.8408 26.7077ZM32.8262 2.6813C26.6181 2.86014 21.2028 12.5587 19.8213 19.0211L26.8311 16.8512C27.6101 12.7476 29.5648 8.48928 32.1221 5.74868C33.0162 4.76667 34.0719 3.94401 35.2432 3.31704H35.2451C34.5654 2.87005 33.7695 2.66203 32.8262 2.6813ZM36.9775 5.46548C35.7921 5.95366 34.7952 6.80972 34.0791 7.57583C32.1608 9.63716 30.5951 12.7807 29.7725 15.9391L38.3057 13.2956C38.3322 11.0721 38.0904 7.7854 36.9775 5.46548ZM39.7568 5.14907C40.7052 7.59721 40.9505 10.4321 40.9795 12.4694L44.9473 11.2389C44.3133 9.17981 42.8075 5.72907 39.7568 5.14907Z" fill="#393939"/>
4
- </svg>`,Ne=`data:image/svg+xml,${encodeURIComponent(Ee)}`,Ue={title:"New Website",description:"Website cloned from a public template",url:"https://github.com/decocms/webapp-template",owner:"decocms",name:"webapp-template"},ze={title:"Shopify Headless Store",description:"Shopify Headless Store cloned from a public template",url:"https://github.com/Shopify/hydrogen-demo-store",owner:"Shopify",name:"hydrogen-demo-store",icon:Ne};function Be(){const n=oe.c(6),s=de(),i=Z();let o;n[0]!==s.create||n[1]!==i?(o=async d=>{const c=await s.create.mutateAsync({title:d.title,description:d.description,icon:d.icon??null,status:"active",pinned:!1,connections:[],metadata:{githubRepo:{url:d.url,owner:d.owner,name:d.name},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}}});return c.id&&i(c.id),c},n[0]=s.create,n[1]=i,n[2]=o):o=n[2];const u=o;let m;return n[3]!==s.create.isPending||n[4]!==u?(m={createFromTemplate:u,isCreating:s.create.isPending},n[3]=s.create.isPending,n[4]=u,n[5]=m):m=n[5],m}const Le="deco-sites";function Te(n){if(!n||typeof n!="object")return null;const s=n.github;if(!s||typeof s!="object")return null;const i=s.owner,o=s.repo;return typeof i!="string"||typeof o!="string"||i.length===0||o.length===0?null:{owner:i,repo:o}}function _e(n,s){const i=s?Te(s):null,o=i?.owner??Le,u=i?.repo??n;return{owner:o,name:u,url:`https://github.com/${o}/${u}`}}function Ge(n){return n.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Oe(n){const s=await fetch(`/api/${n}/deco-sites`);if(!s.ok){const i=await s.json().catch(()=>({}));throw new Error(i.error??`Failed to load sites (${s.status})`)}return s.json()}function Ke({open:n,onOpenChange:s,onBack:i}){const{org:o}=se(),u=Z(),m=ie(),{data:d}=re.useSession(),[c,$]=A.useState(null),[q,V]=A.useState(null),[y,N]=A.useState(""),h=Y({connectionId:me,orgId:o.id,orgSlug:o.slug}),Q=ue({slug:"mcp-github"}),f=pe(Q),r=he({enabled:n&&f.length===0}),C=f.length===1?f[0]??null:q,j=f.length>1&&!C,W=Y({connectionId:C?.id??"",orgId:o.id,orgSlug:o.slug}),x=n&&f.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:J,isLoading:I,error:X}=ae({queryKey:R.decoSites(d?.user?.email),queryFn:()=>Oe(o.slug),enabled:n&&!!d?.user?.email,staleTime:6e4,retry:!1}),S=J?.sites??[],L=e=>{e||($(null),V(null),N("")),s(e)},T=S.filter(e=>e.name.toLowerCase().includes(y.toLowerCase())||(e.domains?.[0]?.domain?.toLowerCase().includes(y.toLowerCase())??!1)),ee=!c||T.some(e=>e.name===c),v=le({mutationFn:async e=>{if(!C)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");k("deco_site_import_started",{site_name:e});const{installations:p,appSlug:g}=await Ce(l=>h.callTool(l),C.id),b=S.find(l=>l.name===e);if(!b)throw new Error("Selected site is no longer available");const a=_e(e,b.metadata),_=xe(p,a.owner);if(!_){const l=g?`https://github.com/apps/${g}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${a.owner}" organization to import this site. ${l}`)}let G=null,O=null,D=null;const te=async()=>{D&&await h.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:D}}).catch(()=>{}),O&&await h.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:O,force:!0}}).catch(()=>{}),G&&await h.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:G,force:!0}}).catch(()=>{})};try{const l=await fetch(`/api/${o.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:e})}),M=await l.json().catch(()=>({}));if(!l.ok)throw new Error(M.error??`Failed to create connection (${l.status})`);const w=M.connId;if(!w)throw new Error("Server did not return a connection ID");G=w;const{childConnectionId:H}=await ge({orgSlug:o.slug,sourceConnection:C,installationId:_.installationId,owner:a.owner,repo:a.name,githubCallTool:P=>W.callTool(P),selfCallTool:P=>h.callTool(P)});O=H;const U=M.icon??null,z=Ge(e),ne=e.toLowerCase(),B=await h.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:e,description:"Imported from deco.cx",pinned:!1,icon:U??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:ne,githubRepo:{owner:a.owner,name:a.name,url:a.url,installationId:_.installationId,connectionId:H},ui:{banner:null,bannerColor:"#22C55E",icon:U,themeColor:"#22C55E",slug:z,pinnedViews:[{connectionId:w,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:w,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:w},{connection_id:H}]}}}),E=B.structuredContent??B;if(!E.item?.id)throw new Error("Failed to create the imported agent");return D=E.item.id,{slug:z,virtualMcpId:E.item.id,connId:w,item:E.item}}catch(l){throw await te(),l}},onSuccess:({slug:e,virtualMcpId:p,item:g})=>{k("deco_site_import_succeeded",{site_name:g.title,virtual_mcp_id:p,slug:e}),m.setQueryData(R.collectionItem(h,o.id,"","VIRTUAL_MCP",p),{item:g}),m.invalidateQueries({predicate:b=>{const a=b.queryKey;return a[1]===o.id&&a[3]==="collection"&&a[4]==="VIRTUAL_MCP"}}),m.invalidateQueries({queryKey:R.projects(o.id)}),K.success(`Imported ${e} from deco.cx`),L(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(p)},onError:e=>{k("deco_site_import_failed",{error:e instanceof Error?e.message:"Unknown error"}),K.error("Import failed: "+(e instanceof Error?e.message:"Unknown error"))}});return t.jsx(be,{open:n,onOpenChange:L,children:t.jsxs(we,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[t.jsx(ye,{className:"sr-only",children:t.jsx(je,{children:"Import from deco.cx"})}),t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&t.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Se,{size:18})}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),t.jsx("div",{children:t.jsx(ve,{value:y,onChange:N,placeholder:"Search sites...",onKeyDown:e=>{e.key==="Escape"&&N("")}})}),t.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&t.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[t.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),t.jsx(F,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),x&&r.status!=="error"&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),j&&!x&&r.status!=="error"&&t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-8 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),f.map(e=>t.jsxs("button",{type:"button",onClick:()=>V(e),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[e.icon?t.jsx("img",{src:e.icon,alt:e.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(fe,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:e.title})]},e.id))]}),I&&!x&&r.status!=="error"&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!I&&!x&&!j&&r.status!=="error"&&!X&&S.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!I&&!x&&!j&&r.status!=="error"&&S.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[T.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",y,"”"]}),T.map(e=>{const p=e.domains?.find(b=>b.production)?.domain??e.domains?.[0]?.domain,g=c===e.name;return t.jsxs("button",{type:"button",onClick:()=>$(e.name),className:ce("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",g?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:e.thumb_url?t.jsx("img",{src:e.thumb_url,alt:e.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:e.name}),p&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:p})]})]},e.name)})]})]}),t.jsxs(Ie,{className:"px-8 py-5 border-t border-border",children:[t.jsx(F,{variant:"outline",onClick:()=>L(!1),disabled:v.isPending,children:"Cancel"}),t.jsx(F,{disabled:!c||!ee||v.isPending||I||x||j||!C||r.status==="error",onClick:()=>c&&v.mutate(c),children:v.isPending?"Importing...":"Import"})]})]})})}export{ze as H,Ke as I,Ne as S,Ue as W,Be as u};
@@ -1 +0,0 @@
1
- import{c as w,j as s,C as We,r as O,l as F,v as ae,D as Dt,F as Cs,a as be,G as de,b as he,H as ws,I as ks,t as ge,J as Is,M as zs,m as $s,B as Te,y as As,P as Ts,K as Ot,k as Mt,i as Pt,e as ot,u as it,E as Et,o as Ds,s as Os,n as Ms,p as Ps,d as Es,x as Fs,R as Ft,O as Rs,T as Ls}from"./index-qfheH9Xc.js";import{u as Ce,S as at,a as ct,b as _e,c as ue,d as se,e as Rt,f as Lt,g as Bs,h as Hs,i as tt,j as Us,k as Gs,l as qs}from"./sidebar-Dk_5AbOf.js";import{u as dt}from"./use-mobile-BnJF8Qa_.js";import{S as fe}from"./skeleton-erh5yXDG.js";import{i as Bt}from"./LayoutLeft-Ck3c6EbZ.js";import{T as xe}from"./toolbar-icon-button-CRc66nZ-.js";import{P as Pe,a as Ne,b as Ee}from"./popover-DvGqLTJl.js";import{D as Ht,a as Ut,b as Gt}from"./drawer-DdiW0TLs.js";import{A as Me}from"./avatar-tYV7Xj5e.js";import{a as je,b as ve,c as st,T as ye}from"./tooltip-CBYM2iV5.js";import{a as ht}from"./Eye-o5yQXJvl.js";import{n as Ws,i as Ks}from"./Globe01-CcG20jKe.js";import{i as Vs}from"./ZoomOut-DfCeUHFX.js";import{i as Xs}from"./ZapSquare-B4AjMOPu.js";import{i as qt}from"./Monitor01-CWIDsYmm.js";import{n as Qs,a as Ys}from"./Sun-CX24eczl.js";import{a as Ke,b as Js}from"./Settings02-C-6P9tLl.js";import{i as Zs}from"./Shield01-B3rvsBtl.js";import{a as en}from"./Users03-B-JAgn9g.js";import{a as pt,b as gt,c as Wt,A as De,d as bt,i as tn,s as sn,e as nn}from"./agent-icon-C1BWispo.js";import"./index-Da2BgJQV.js";import{n as Ve}from"./Stars02-YL1S7hw5.js";import{u as rn,v as ln,C as on}from"./connect-desktop-dialog-wN68EGmx.js";import{i as Xe}from"./ChevronUp-BGt4chTY.js";import{s as Kt}from"./XClose-D0Zu_lRC.js";import{u as an,a as cn}from"./use-join-requests-B315-fOS.js";import{i as Vt}from"./ChevronRight-jYKilAXW.js";import{u as dn,R as mn,a as un,b as mt,r as fn}from"./shell-layout-DbD_tkNz.js";import{u as Xt,g as xn}from"./agent-capabilities-BDCwG9Eh.js";import{i as hn}from"./FilterLines-CDGBU4Yu.js";import{T as pn,a as gn}from"./toggle-group-BPcVs9aZ.js";import{u as bn,S as jn,a as Ge,i as vn}from"./use-mcp-client-CpnbLiac.js";import{u as Qt,a as Yt}from"./use-virtual-mcp-OVYXqA3Z.js";import{u as yn,a as ut,b as Jt,T as Sn}from"./hooks-BgBnOJ3c.js";import{c as Nn,a as _n,b as Cn,d as wn,e as kn}from"./dialog-DaSKz7DM.js";import{C as In,a as zn,b as $n,c as An,d as Tn}from"./command-BrahLBH2.js";import{u as Zt}from"./studio-tools-BaSvhr-J.js";import{i as Dn}from"./Zap-Bo8lb0F-.js";import{S as es,M as On}from"./shell-controls-_ERLWSRt.js";import{T as ts}from"./task-row-CSJH3BP-.js";import{t as ft}from"./ChevronDown-CLx4-WM1.js";import{S as Mn}from"./task-status-CcNy4g07.js";import{S as ss,u as Pn,g as En,a as Fn,b as Rn}from"./use-navigate-to-agent-CI_L2BEy.js";import{S as Ln,C as Bn}from"./chat-context-BXvC8snN.js";import{B as jt,a as Hn,b as Un,c as Gn}from"./breadcrumb-C_jNPElt.js";import{T as te}from"./toolbar-DO76WyPk.js";import{s as Ae}from"./Plus-DZiClNST.js";import{i as ns}from"./SearchMd-CYoVQBZq.js";import{A as qn,a as Wn,b as Kn,c as Vn,d as Xn,e as Qn,f as Yn}from"./alert-dialog-ha1v59qY.js";import{F as Jn,a as Zn,b as er,c as tr,d as sr,f as nr,e as rr}from"./form-D1efg8C-.js";import{I as lr}from"./input-c3bkJxBD.js";import{s as or}from"./Star01-CkOKT_Ec.js";import{u as ir}from"./use-create-virtual-mcp-LuXF-lyt.js";import{I as ar,u as cr,W as dr}from"./import-from-deco-dialog-P6TRPQ14.js";import{G as mr,a as ur}from"./github-repo-picker-CXt90kMG.js";import"./sheet-DuOoVZUG.js";import"./X-D1xM7jXL.js";import"./User01-BL-jdznB.js";import"./AlertCircle-DdrwwZMq.js";import"./Tool01-84S8urW1.js";import"./SwitchHorizontal01-1JfD3pEr.js";import"./XCircle-D1ibZ16t.js";import"./ArrowUpRight-jXBy9ipz.js";import"./CheckCircle-3ZOkMXIL.js";import"./DotsVertical-CqrNmdxL.js";import"./Globe04-Cv_V-Fs_.js";import"./HardDrive-BSIK0u4A.js";import"./Key01-DgIKoZGo.js";import"./LinkExternal01-C4RHyT_k.js";import"./Palette-BFwjtSY1.js";import"./Play-DqQKGu-U.js";import"./SearchLg-CaS6w27I.js";import"./Stars01-sPe6wVRL.js";import"./Trash01-oru1b8W8.js";import"./Upload01-Cou_1dwr.js";import"./Users01-CvViXbMH.js";import"./use-capability-BOo3wKB9.js";import"./required-auth-layout-CrFETKOt.js";import"./tab-id-DPNwWMUY.js";import"./use-organization-settings-DtUUny9s.js";import"./use-org-sso-B_xa25Ag.js";import"./use-ai-providers-BLBRqrOl.js";import"./auth-ou2428Bw.js";import"./use-collections-CQf58LpF.js";import"./decopilot-sse-pool-DrXwOdO1.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./index-DikJYrmI.js";import"./use-clock-tick-DpMHy-Ay.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-decopilot-events-uI4wGrsY.js";import"./label-C-M0DX5a.js";import"./use-connection-BuG3o_JE.js";import"./github-installations-DzN1UQ4x.js";import"./collection-search-BWPhJb0W.js";import"./checkbox-BGLrFwOD.js";import"./use-debounced-value-Df6CEQAw.js";import"./authenticate-and-persist-oauth-B3lWqExf.js";import"./mcp-oauth-D8P2QaWG.js";import"./use-mcp-tools-DpNh0INt.js";import"./extract-connection-data-X711B5tE.js";function fr(t){const e=w.c(5),{onPointerDown:n,onDoubleClick:r}=t,{state:l,isMobile:o}=Ce();if(o||l==="collapsed")return null;let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={left:"var(--sidebar-width)"},a=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=i,e[1]=a):(i=e[0],a=e[1]);let c;return e[2]!==r||e[3]!==n?(c=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:r,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:i,children:a}),e[2]=r,e[3]=n,e[4]=c):c=e[4],c}const xt=240,xr=400,hr="sidebar.width";function Oe(t){return Math.max(xt,Math.min(xr,t))}function pr(){const t=w.c(11),[e,n]=We(hr,gr),r=O.useRef(null);let l;t[0]!==n||t[1]!==e?(l=m=>{m.preventDefault();const u=m.clientX,f=Oe(e),h=r.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),p=h?Array.from(h.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const b of p)b.style.transition="none";const x=b=>{const j=Oe(f+(b.clientX-u));h?.style.setProperty("--sidebar-width",`${j}px`)},g=b=>{const j=Oe(f+(b.clientX-u));n(j);for(const v of p)v.style.transition="";window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",g),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",x),window.addEventListener("pointerup",g)},t[0]=n,t[1]=e,t[2]=l):l=t[2];const o=l;let i;t[3]!==n?(i=()=>{n(xt)},t[3]=n,t[4]=i):i=t[4];const a=i;let c;t[5]!==e?(c=Oe(e),t[5]=e,t[6]=c):c=t[6];let d;return t[7]!==o||t[8]!==a||t[9]!==c?(d={width:c,wrapperRef:r,onStartResize:o,resetWidth:a},t[7]=o,t[8]=a,t[9]=c,t[10]=d):d=t[10],d}function gr(t){return typeof t=="number"?Oe(t):xt}function rs(){return[]}function ls(t){const e=w.c(3),{children:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=r):r=e[0];let l;return e[1]!==n?(l=s.jsxs(at,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[r,s.jsx(ct,{children:s.jsx(_e,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=l):l=e[2],l}function os(t){const e=w.c(18),{item:n}=t,{isMobile:r,setOpenMobile:l}=Ce();let o;e[0]!==r||e[1]!==n||e[2]!==l?(o=()=>{ae("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:r}),n.onClick?.(),r&&l(!1)},e[0]=r,e[1]=n,e[2]=l,e[3]=o):o=e[3];const i=o,a=n.key,c=n.isActive&&"z-10";let d;e[4]!==c?(d=F(c),e[4]=c,e[5]=d):d=e[5];let m;e[6]!==n.label?(m=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=m):m=e[7];let u;e[8]!==i||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==m?(u=s.jsxs(ue,{onClick:i,isActive:n.isActive,tooltip:n.label,children:[n.icon,m]}),e[8]=i,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=m,e[13]=u):u=e[13];let f;return e[14]!==n.key||e[15]!==d||e[16]!==u?(f=s.jsx(se,{className:d,children:u},a),e[14]=n.key,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function br(t){const e=w.c(12),{section:n}=t;switch(n.type){case"divider":{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Rt,{className:"my-2"}),e[0]=r):r=e[0],r}case"spacer":{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex-1"}),e[1]=r):r=e[1],r}case"group":{const r=n.group.label,l=n.group.defaultExpanded;let o;e[2]!==n.group.items?(o=n.group.items.map(vr),e[2]=n.group.items,e[3]=o):o=e[3];let i;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==o?(i=s.jsx(ls,{label:r,defaultExpanded:l,children:o}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=o,e[7]=i):i=e[7],i}case"items":{let r;e[8]!==n.items?(r=n.items.map(jr),e[8]=n.items,e[9]=r):r=e[9];let l;return e[10]!==r?(l=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(_e,{className:"gap-1.5",children:r})})}),e[10]=r,e[11]=l):l=e[11],l}case"custom":return n.content}}function jr(t){return s.jsx(os,{item:t},t.key)}function vr(t){return s.jsx(os,{item:t},t.key)}function yr(t){const e=w.c(14),{sections:n,footer:r,additionalContent:l,variant:o,contentClassName:i}=t,a=o===void 0?"sidebar":o;let c;e[0]!==i?(c=F("flex flex-col flex-1 px-2 py-2 gap-0.5",i),e[0]=i,e[1]=c):c=e[1];let d;e[2]!==n?(d=n.map(Sr),e[2]=n,e[3]=d):d=e[3];let m;e[4]!==l?(m=l&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:l}),e[4]=l,e[5]=m):m=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==m?(u=s.jsxs(Lt,{className:c,children:[d,m]}),e[6]=c,e[7]=d,e[8]=m,e[9]=u):u=e[9];let f;return e[10]!==r||e[11]!==u||e[12]!==a?(f=s.jsxs(Bs,{variant:a,children:[u,r]}),e[10]=r,e[11]=u,e[12]=a,e[13]=f):f=e[13],f}function Sr(t,e){return s.jsx(br,{section:t},e)}function is(t){const e=w.c(2);let n;return e[0]!==t?(n=s.jsx(yr,{...t}),e[0]=t,e[1]=n):n=e[1],n}is.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(fe,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function Nr(t){const e=w.c(16),{onToggle:n,className:r}=t,o=Dt().logo??Cs,i=typeof o=="string"?o:o.light,a=typeof o=="string"?o:o.dark;let c;e[0]!==r?(c=F("flex flex-row items-center gap-2 md:gap-0.5 shrink-0 h-12 pl-1 pr-2 pt-0.25 pb-0","group-data-[collapsible=icon]/sidebar:hidden",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==i?(d=s.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),e[2]=i,e[3]=d):d=e[3];let m;e[4]!==a?(m=s.jsx("img",{src:a,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),e[4]=a,e[5]=m):m=e[5];let u;e[6]!==d||e[7]!==m?(u=s.jsx("span",{className:"flex items-center shrink-0 pl-1",children:s.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[d,m]})}),e[6]=d,e[7]=m,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Bt,{size:16}),e[9]=f):f=e[9];let h;e[10]!==n?(h=s.jsx(xe,{onClick:n,"aria-label":"Toggle sidebar",children:f}),e[10]=n,e[11]=h):h=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h?(p=s.jsxs(Hs,{className:c,children:[u,h]}),e[12]=c,e[13]=u,e[14]=h,e[15]=p):p=e[15],p}function vt(t){const e=w.c(18),{item:n,onClose:r}=t,l=n.isActive&&"z-10";let o;e[0]!==l?(o=F(l),e[0]=l,e[1]=o):o=e[1];let i;e[2]!==n||e[3]!==r?(i=()=>{n.onClick?.(),r()},e[2]=n,e[3]=r,e[4]=i):i=e[4];let a;e[5]!==n.icon?(a=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=a):a=e[6];let c;e[7]!==n.label?(c=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=c):c=e[8];let d;e[9]!==n.isActive||e[10]!==n.label||e[11]!==i||e[12]!==a||e[13]!==c?(d=s.jsxs(ue,{onClick:i,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,c]}),e[9]=n.isActive,e[10]=n.label,e[11]=i,e[12]=a,e[13]=c,e[14]=d):d=e[14];let m;return e[15]!==o||e[16]!==d?(m=s.jsx(se,{className:o,children:d}),e[15]=o,e[16]=d,e[17]=m):m=e[17],m}function _r(t){const e=w.c(18),{section:n,onClose:r}=t;switch(n.type){case"divider":{let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Rt,{className:"my-2"}),e[0]=l):l=e[0],l}case"spacer":{let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1"}),e[1]=l):l=e[1],l}case"group":{const l=n.group.label,o=n.group.defaultExpanded;let i;if(e[2]!==r||e[3]!==n.group.items){let c;e[5]!==r?(c=d=>s.jsx(vt,{item:d,onClose:r},d.key),e[5]=r,e[6]=c):c=e[6],i=n.group.items.map(c),e[2]=r,e[3]=n.group.items,e[4]=i}else i=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==i?(a=s.jsx(ls,{label:l,defaultExpanded:o,children:i}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=i,e[10]=a):a=e[10],a}case"items":{let l;if(e[11]!==r||e[12]!==n.items){let i;e[14]!==r?(i=a=>s.jsx(vt,{item:a,onClose:r},a.key),e[14]=r,e[15]=i):i=e[15],l=n.items.map(i),e[11]=r,e[12]=n.items,e[13]=l}else l=e[13];let o;return e[16]!==l?(o=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(_e,{className:"gap-1.5",children:l})})}),e[16]=l,e[17]=o):o=e[17],o}case"custom":return n.content}}function Cr(t){const e=w.c(17),{sections:n,onClose:r,footer:l,additionalContent:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-12 shrink-0"}),e[0]=i):i=e[0];let a;e[1]!==r?(a=s.jsx(O.Suspense,{fallback:i,children:s.jsx(Nr,{onToggle:r})}),e[1]=r,e[2]=a):a=e[2];let c;if(e[3]!==r||e[4]!==n){let f;e[6]!==r?(f=(h,p)=>s.jsx(_r,{section:h,onClose:r},p),e[6]=r,e[7]=f):f=e[7],c=n.map(f),e[3]=r,e[4]=n,e[5]=c}else c=e[5];let d;e[8]!==o?(d=o&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:o}),e[8]=o,e[9]=d):d=e[9];let m;e[10]!==c||e[11]!==d?(m=s.jsxs(Lt,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[c,d]}),e[10]=c,e[11]=d,e[12]=m):m=e[12];let u;return e[13]!==l||e[14]!==a||e[15]!==m?(u=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[a,m,l]}),e[13]=l,e[14]=a,e[15]=m,e[16]=u):u=e[16],u}function Be(t){const e=w.c(22),{item:n,onClose:r}=t;if(n.href){const c=n.external?"_blank":void 0,d=n.external?"noopener noreferrer":void 0;let m;e[0]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[0]=n.icon,e[1]=m):m=e[1];let u;e[2]!==n.label?(u=s.jsx("span",{className:"flex-1",children:n.label}),e[2]=n.label,e[3]=u):u=e[3];let f;return e[4]!==n.href||e[5]!==r||e[6]!==c||e[7]!==d||e[8]!==m||e[9]!==u?(f=s.jsxs("a",{href:n.href,target:c,rel:d,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:r,children:[m,u]}),e[4]=n.href,e[5]=r,e[6]=c,e[7]=d,e[8]=m,e[9]=u,e[10]=f):f=e[10],f}let l;e[11]!==n||e[12]!==r?(l=()=>{n.onClick?.(),r()},e[11]=n,e[12]=r,e[13]=l):l=e[13];let o;e[14]!==n.icon?(o=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=o):o=e[15];let i;e[16]!==n.label?(i=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=i):i=e[17];let a;return e[18]!==l||e[19]!==o||e[20]!==i?(a=s.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[o,i]}),e[18]=l,e[19]=o,e[20]=i,e[21]=a):a=e[21],a}function yt(t){const e=w.c(126),{user:n,userImage:r,menuItems:l,signOutItem:o,themeOptions:i,preferences:a,setPreferences:c,close:d,isMobile:m}=t;if(m){const L=n?.name??"U";let H;e[0]!==L||e[1]!==r?(H=s.jsx(Me,{url:r,fallback:L,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=L,e[1]=r,e[2]=H):H=e[2];const Z=n?.name??"User";let K;e[3]!==Z?(K=s.jsx("p",{className:"text-sm font-medium truncate",children:Z}),e[3]=Z,e[4]=K):K=e[4];const ee=n?.email;let G;e[5]!==ee?(G=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ee}),e[5]=ee,e[6]=G):G=e[6];let le;e[7]!==K||e[8]!==G?(le=s.jsxs("div",{className:"flex-1 min-w-0",children:[K,G]}),e[7]=K,e[8]=G,e[9]=le):le=e[9];let ce;e[10]!==n?(ce=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(zr)},e[10]=n,e[11]=ce):ce=e[11];let V;e[12]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(ht,{size:14}),e[12]=V):V=e[12];let J;e[13]!==ce?(J=s.jsx(je,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:ce,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:V})}),e[13]=ce,e[14]=J):J=e[14];let me;e[15]===Symbol.for("react.memo_cache_sentinel")?(me=s.jsx(ve,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=me):me=e[15];let I;e[16]!==J?(I=s.jsx(st,{delayDuration:300,children:s.jsxs(ye,{children:[J,me]})}),e[16]=J,e[17]=I):I=e[17];let D;e[18]!==I||e[19]!==H||e[20]!==le?(D=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[H,le,I]}),e[18]=I,e[19]=H,e[20]=le,e[21]=D):D=e[21];let B;if(e[22]!==d||e[23]!==l){let pe;e[25]!==d?(pe=Le=>s.jsx(Be,{item:Le,onClose:d},Le.key),e[25]=d,e[26]=pe):pe=e[26],B=l.map(pe),e[22]=d,e[23]=l,e[24]=B}else B=e[24];let P;e[27]!==d||e[28]!==o?(P=s.jsx(Be,{item:o,onClose:d}),e[27]=d,e[28]=o,e[29]=P):P=e[29];let X;e[30]!==B||e[31]!==P?(X=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[B,P]})}),e[30]=B,e[31]=P,e[32]=X):X=e[32];let oe;if(e[33]!==a.theme||e[34]!==c||e[35]!==i){let pe;e[37]!==a.theme||e[38]!==c?(pe=Le=>{const{value:Je,icon:Ss,label:Ns}=Le;return s.jsx("button",{type:"button","aria-label":Ns,onClick:()=>c(_s=>({..._s,theme:Je})),className:F("size-8 rounded-md flex items-center justify-center transition-colors",a.theme===Je?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Ss},Je)},e[37]=a.theme,e[38]=c,e[39]=pe):pe=e[39],oe=i.map(pe),e[33]=a.theme,e[34]=c,e[35]=i,e[36]=oe}else oe=e[36];let ie;e[40]!==oe?(ie=s.jsx("div",{className:"flex items-center gap-0.5",children:oe}),e[40]=oe,e[41]=ie):ie=e[41];const Se=a.enableSounds?"Disable sounds":"Enable sounds";let U;e[42]!==c?(U=()=>c(Ir),e[42]=c,e[43]=U):U=e[43];const Ye=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let we;e[44]!==Ye?(we=F("size-8 rounded-md flex items-center justify-center transition-colors",Ye),e[44]=Ye,e[45]=we):we=e[45];let ke;e[46]!==a.enableSounds?(ke=a.enableSounds?s.jsx(pt,{size:14}):s.jsx(gt,{size:14}),e[46]=a.enableSounds,e[47]=ke):ke=e[47];let Ie;e[48]!==Se||e[49]!==U||e[50]!==we||e[51]!==ke?(Ie=s.jsx("button",{type:"button","aria-label":Se,onClick:U,className:we,children:ke}),e[48]=Se,e[49]=U,e[50]=we,e[51]=ke,e[52]=Ie):Ie=e[52];let Fe;e[53]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.17.2"]}),e[53]=Fe):Fe=e[53];let ze;e[54]!==Ie?(ze=s.jsxs("div",{className:"flex items-center gap-2",children:[Ie,Fe]}),e[54]=Ie,e[55]=ze):ze=e[55];let $e;e[56]!==ie||e[57]!==ze?($e=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[ie,ze]}),e[56]=ie,e[57]=ze,e[58]=$e):$e=e[58];let Re;return e[59]!==D||e[60]!==X||e[61]!==$e?(Re=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,X,$e]}),e[59]=D,e[60]=X,e[61]=$e,e[62]=Re):Re=e[62],Re}const u=n?.name??"U";let f;e[63]!==u||e[64]!==r?(f=s.jsx(Me,{url:r,fallback:u,shape:"circle",size:"sm",className:"shrink-0"}),e[63]=u,e[64]=r,e[65]=f):f=e[65];const h=n?.name??"User";let p;e[66]!==h?(p=s.jsx("p",{className:"text-sm font-medium truncate",children:h}),e[66]=h,e[67]=p):p=e[67];const x=n?.email;let g;e[68]!==x?(g=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:x}),e[68]=x,e[69]=g):g=e[69];let b;e[70]!==p||e[71]!==g?(b=s.jsxs("div",{className:"flex-1 min-w-0",children:[p,g]}),e[70]=p,e[71]=g,e[72]=b):b=e[72];let j;e[73]!==n?(j=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(kr)},e[73]=n,e[74]=j):j=e[74];let v;e[75]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ht,{size:14}),e[75]=v):v=e[75];let y;e[76]!==j?(y=s.jsx(je,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:j,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:v})}),e[76]=j,e[77]=y):y=e[77];let _;e[78]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(ve,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[78]=_):_=e[78];let k;e[79]!==y?(k=s.jsx(st,{delayDuration:300,children:s.jsxs(ye,{children:[y,_]})}),e[79]=y,e[80]=k):k=e[80];let N;e[81]!==k||e[82]!==f||e[83]!==b?(N=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[f,b,k]}),e[81]=k,e[82]=f,e[83]=b,e[84]=N):N=e[84];let C;if(e[85]!==d||e[86]!==l){let L;e[88]!==d?(L=H=>s.jsx(Be,{item:H,onClose:d},H.key),e[88]=d,e[89]=L):L=e[89],C=l.map(L),e[85]=d,e[86]=l,e[87]=C}else C=e[87];let S;e[90]!==d||e[91]!==o?(S=s.jsx(Be,{item:o,onClose:d}),e[90]=d,e[91]=o,e[92]=S):S=e[92];let z;e[93]!==C||e[94]!==S?(z=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[C,S]}),e[93]=C,e[94]=S,e[95]=z):z=e[95];let T;if(e[96]!==a.theme||e[97]!==c||e[98]!==i){let L;e[100]!==a.theme||e[101]!==c?(L=H=>{const{value:Z,icon:K,label:ee}=H;return s.jsx("button",{type:"button","aria-label":ee,onClick:()=>c(G=>({...G,theme:Z})),className:F("size-7 rounded-md flex items-center justify-center transition-colors",a.theme===Z?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:K},Z)},e[100]=a.theme,e[101]=c,e[102]=L):L=e[102],T=i.map(L),e[96]=a.theme,e[97]=c,e[98]=i,e[99]=T}else T=e[99];let A;e[103]!==T?(A=s.jsx("div",{className:"flex items-center gap-0.5",children:T}),e[103]=T,e[104]=A):A=e[104];const $=a.enableSounds?"Disable sounds":"Enable sounds";let E;e[105]!==c?(E=()=>c(wr),e[105]=c,e[106]=E):E=e[106];const W=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let M;e[107]!==W?(M=F("size-7 rounded-md flex items-center justify-center transition-colors",W),e[107]=W,e[108]=M):M=e[108];let q;e[109]!==a.enableSounds?(q=a.enableSounds?s.jsx(pt,{size:14}):s.jsx(gt,{size:14}),e[109]=a.enableSounds,e[110]=q):q=e[110];let R;e[111]!==$||e[112]!==E||e[113]!==M||e[114]!==q?(R=s.jsx("button",{type:"button","aria-label":$,onClick:E,className:M,children:q}),e[111]=$,e[112]=E,e[113]=M,e[114]=q,e[115]=R):R=e[115];let Q;e[116]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.17.2"]}),e[116]=Q):Q=e[116];let Y;e[117]!==R?(Y=s.jsxs("div",{className:"flex items-center gap-2",children:[R,Q]}),e[117]=R,e[118]=Y):Y=e[118];let ne;e[119]!==A||e[120]!==Y?(ne=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[A,Y]}),e[119]=A,e[120]=Y,e[121]=ne):ne=e[121];let re;return e[122]!==N||e[123]!==z||e[124]!==ne?(re=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[N,z,ne]})}),e[122]=N,e[123]=z,e[124]=ne,e[125]=re):re=e[125],re}function wr(t){return{...t,enableSounds:!t.enableSounds}}function kr(){ge.success("User ID copied")}function Ir(t){return{...t,enableSounds:!t.enableSounds}}function zr(){ge.success("User ID copied")}function nt(){const t=w.c(34),{data:e}=be.useSession(),{org:n}=de(),r=he();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org",shouldThrow:!1},t[0]=l):l=t[0];const i=ws(l)?.params.org,[a,c]=ks(),d=dt(),[m,u]=O.useState(!1),f=e?.user,h=f?.image;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>u(!1),t[1]=p):p=t[1];const x=p;let g;t[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ke,{size:16}),t[2]=g):g=t[2];let b;t[3]!==r||t[4]!==i?(b={key:"preferences",label:"Preferences",icon:g,onClick:()=>{r({to:"/$org/settings/profile",params:{org:i??""}})}},t[3]=r,t[4]=i,t[5]=b):b=t[5];let j;t[6]!==n||t[7]!==r?(j=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Ws,{size:16}),onClick:()=>{r({to:"/$org/install",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=r,t[8]=j):j=t[8];let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v={key:"terms",label:"Terms of Use",icon:s.jsx(Vs,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=v):v=t[9];let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y={key:"privacy",label:"Privacy Policy",icon:s.jsx(Zs,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=y):y=t[10];let _;t[11]===Symbol.for("react.memo_cache_sentinel")?(_={key:"github",label:"decocms/studio",icon:s.jsx(Is,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=_):_=t[11];let k;t[12]===Symbol.for("react.memo_cache_sentinel")?(k={key:"community",label:"Community",icon:s.jsx(en,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=k):k=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N={key:"homepage",label:"Homepage",icon:s.jsx(Ks,{size:16}),href:"https://decocms.com",external:!0},t[13]=N):N=t[13];let C;t[14]!==b||t[15]!==j?(C=[b,...j,v,y,_,k,N],t[14]=b,t[15]=j,t[16]=C):C=t[16];const S=C;let z;t[17]===Symbol.for("react.memo_cache_sentinel")?(z={key:"logout",label:"Sign out",icon:s.jsx(Xs,{size:16}),onClick:Ar},t[17]=z):z=t[17];const T=z;let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A={value:"light",icon:s.jsx(Qs,{size:14}),label:"Light theme"},t[18]=A):A=t[18];let $;t[19]===Symbol.for("react.memo_cache_sentinel")?($={value:"dark",icon:s.jsx(Ys,{size:14}),label:"Dark theme"},t[19]=$):$=t[19];let E;t[20]===Symbol.for("react.memo_cache_sentinel")?(E=[A,$,{value:"system",icon:s.jsx(qt,{size:14}),label:"System theme"}],t[20]=E):E=t[20];const W=E;let M;t[21]!==d||t[22]!==S||t[23]!==a||t[24]!==c||t[25]!==f||t[26]!==h?(M={user:f,userImage:h,menuItems:S,signOutItem:T,themeOptions:W,preferences:a,setPreferences:c,close:x,isMobile:d},t[21]=d,t[22]=S,t[23]=a,t[24]=c,t[25]=f,t[26]=h,t[27]=M):M=t[27];const q=M;let R;return t[28]!==d||t[29]!==m||t[30]!==q||t[31]!==f?.name||t[32]!==h?(R=s.jsx(s.Fragment,{children:d?s.jsxs(Ht,{open:m,onOpenChange:u,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx(Me,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Ut,{className:"h-[80dvh] p-0",children:[s.jsx(Gt,{className:"sr-only",children:"Account"}),s.jsx(yt,{...q})]})]}):s.jsxs(Pe,{open:m,onOpenChange:u,children:[s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:f?.name??"Account",className:"rounded-md",children:[s.jsx(Me,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ee,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:$r,children:s.jsx(yt,{...q})})]})}),t[28]=d,t[29]=m,t[30]=q,t[31]=f?.name,t[32]=h,t[33]=R):R=t[33],R}function $r(t){return t.preventDefault()}function Ar(){ae("signed_out",{source:"account_popover"}),zs(),be.signOut()}function rt(){const t=w.c(22),e=rn(),[n,r]=O.useState(!1);let l;if(t[0]!==e.capabilities||t[1]!==e.hostname||t[2]!==e.machineId||t[3]!==e.online){const x=ln(e.capabilities);l=e.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:e.hostname??e.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:x.length>0?`Available: ${x.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),t[0]=e.capabilities,t[1]=e.hostname,t[2]=e.machineId,t[3]=e.online,t[4]=l}else l=t[4];const o=l;let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=()=>r(!0),t[5]=i):i=t[5];const a=e.online?"Desktop linked":"Connect your desktop";let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(qt,{size:16}),t[6]=c):c=t[6];let d;t[7]!==e.online?(d=e.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),t[7]=e.online,t[8]=d):d=t[8];let m;t[9]!==a||t[10]!==d?(m=s.jsx(je,{asChild:!0,children:s.jsxs(xe,{onClick:i,"aria-label":a,children:[c,d]})}),t[9]=a,t[10]=d,t[11]=m):m=t[11];let u;t[12]!==o?(u=s.jsx(ve,{side:"bottom",children:o}),t[12]=o,t[13]=u):u=t[13];let f;t[14]!==m||t[15]!==u?(f=s.jsxs(ye,{children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16];let h;t[17]!==n?(h=s.jsx(on,{open:n,onOpenChange:r}),t[17]=n,t[18]=h):h=t[18];let p;return t[19]!==f||t[20]!==h?(p=s.jsxs(s.Fragment,{children:[f,h]}),t[19]=f,t[20]=h,t[21]=p):p=t[21],p}function Tr({invitation:t}){const[e,n]=O.useState(!1),[r,l]=O.useState(!1),o=$s(),i=async()=>{n(!0);try{const d=await be.organization.acceptInvitation({invitationId:t.id});if(d.error){ge.error(d.error.message),n(!1);return}}catch{ge.error("Failed to accept invitation"),n(!1);return}ge.success("Invitation accepted!"),As();let c;try{c=(await be.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{l(!0);try{const c=await be.organization.rejectInvitation({invitationId:t.id});c.error?(ge.error(c.error.message),l(!1)):(ge.success("Invitation declined"),o.invalidateQueries())}catch{ge.error("Failed to decline invitation"),l(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),s.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:i,disabled:e||r,"aria-label":"Accept invitation",children:s.jsx(Xe,{size:14})}),s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||r,"aria-label":"Decline invitation",children:s.jsx(Kt,{size:14})})]})]})}function Dr(t){const e=w.c(29),{request:n}=t,{approve:r,deny:l}=an(),o=r.isPending||l.isPending,i=n.user?.name??n.user?.email??n.userId,a=n.user?.image??void 0;let c;e[0]!==i?(c=i.charAt(0).toUpperCase(),e[0]=i,e[1]=c):c=e[1];let d;e[2]!==a||e[3]!==c?(d=s.jsx(Me,{url:a,fallback:c,shape:"circle",size:"sm"}),e[2]=a,e[3]=c,e[4]=d):d=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Requested to join"}),e[5]=m):m=e[5];let u;e[6]!==i?(u=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,s.jsx("p",{className:"text-sm font-medium truncate",children:i})]}),e[6]=i,e[7]=u):u=e[7];let f;e[8]!==r||e[9]!==n.id?(f=()=>r.mutate(n.id),e[8]=r,e[9]=n.id,e[10]=f):f=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Xe,{size:14}),e[11]=h):h=e[11];let p;e[12]!==o||e[13]!==f?(p=s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:f,disabled:o,"aria-label":"Approve join request",children:h}),e[12]=o,e[13]=f,e[14]=p):p=e[14];let x;e[15]!==l||e[16]!==n.id?(x=()=>l.mutate(n.id),e[15]=l,e[16]=n.id,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Kt,{size:14}),e[18]=g):g=e[18];let b;e[19]!==o||e[20]!==x?(b=s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:x,disabled:o,"aria-label":"Deny join request",children:g}),e[19]=o,e[20]=x,e[21]=b):b=e[21];let j;e[22]!==b||e[23]!==p?(j=s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p,b]}),e[22]=b,e[23]=p,e[24]=j):j=e[24];let v;return e[25]!==j||e[26]!==d||e[27]!==u?(v=s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[d,u,j]}),e[25]=j,e[26]=d,e[27]=u,e[28]=v):v=e[28],v}function Or(t){const e=w.c(14),{release:n,isSeen:r,onSelect:l}=t;let o;e[0]!==r?(o=!r&&s.jsx("span",{"aria-label":"New release",className:"absolute left-2 top-1/2 -translate-y-1/2 size-1.5 rounded-full bg-primary"}),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==n.eyebrow?(i=n.eyebrow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.eyebrow}),e[2]=n.eyebrow,e[3]=i):i=e[3];let a;e[4]!==n.title?(a=s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[4]=n.title,e[5]=a):a=e[5];let c;e[6]!==i||e[7]!==a?(c=s.jsxs("div",{className:"flex-1 min-w-0",children:[i,a]}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Vt,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=d):d=e[9];let m;return e[10]!==l||e[11]!==o||e[12]!==c?(m=s.jsxs("button",{type:"button",onClick:l,className:"relative w-full flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors text-left",children:[o,c,d]}),e[10]=l,e[11]=o,e[12]=c,e[13]=m):m=e[13],m}function Mr(){const t=O.useContext(Ts),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date)}function as(){const t=w.c(11),{isSeen:e,markSeen:n,unseenCount:r}=dn(),l=Mr(),o=cn();let i;if(t[0]!==e||t[1]!==l||t[2]!==o){const d=[...o].sort(Lr).map(Rr),m=[...l].sort(Fr).map(Er);let u;t[4]!==e?(u=h=>({type:"release",release:h,isSeen:e(h.id)}),t[4]=e,t[5]=u):u=t[5];const f=[...mn].sort(Pr).map(u);i=[...d,...m,...f],t[0]=e,t[1]=l,t[2]=o,t[3]=i}else i=t[3];const a=r+l.length+o.length;let c;return t[6]!==n||t[7]!==l||t[8]!==i||t[9]!==a?(c={items:i,pendingInvitations:l,redDotCount:a,markReleaseSeen:n},t[6]=n,t[7]=l,t[8]=i,t[9]=a,t[10]=c):c=t[10],c}function Pr(t,e){return new Date(e.date).getTime()-new Date(t.date).getTime()}function Er(t){return{type:"invitation",invitation:t}}function Fr(t,e){return new Date(t.expiresAt).getTime()-new Date(e.expiresAt).getTime()}function Rr(t){return{type:"join-request",request:t}}function Lr(t,e){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}class cs extends O.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function ds(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Br(){const t=w.c(17),e=he(),{org:n}=de(),{hasDecoKey:r,balanceDollars:l}=Xt();if(!r)return null;let o;t[0]!==l?(o=l!=null?`Credits: $${l.toFixed(2)}`:"Credits",t[0]=l,t[1]=o):o=t[1];let i;t[2]!==l?(i=F(l!=null&&ds(l)),t[2]=l,t[3]=i):i=t[3];let a;t[4]!==e||t[5]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Wt,{}),t[7]=c):c=t[7];let d;t[8]!==l?(d=l!=null?`$${l.toFixed(2)}`:"Credits",t[8]=l,t[9]=d):d=t[9];let m;t[10]!==d?(m=s.jsx("span",{children:d}),t[10]=d,t[11]=m):m=t[11];let u;return t[12]!==o||t[13]!==i||t[14]!==a||t[15]!==m?(u=s.jsx(_e,{children:s.jsx(se,{children:s.jsxs(ue,{tooltip:o,className:i,onClick:a,children:[c,m]})})}),t[12]=o,t[13]=i,t[14]=a,t[15]=m,t[16]=u):u=t[16],u}function Hr(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(cs,{children:s.jsx(O.Suspense,{fallback:null,children:s.jsx(Br,{})})}),t[0]=e):e=t[0],e}function Ur(){const t=w.c(17),e=he(),{org:n}=de(),{hasDecoKey:r,balanceDollars:l}=Xt();if(!r)return null;let o;t[0]!==l?(o=l!=null?`Credits: $${l.toFixed(2)}`:"Credits",t[0]=l,t[1]=o):o=t[1];const i=o;let a;t[2]!==e||t[3]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[2]=e,t[3]=n.slug,t[4]=a):a=t[4];let c;t[5]!==l?(c=F(l!=null&&ds(l)),t[5]=l,t[6]=c):c=t[6];let d;t[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Wt,{className:"size-4"}),t[7]=d):d=t[7];let m;t[8]!==a||t[9]!==c||t[10]!==i?(m=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":i,onClick:a,className:c,children:d})}),t[8]=a,t[9]=c,t[10]=i,t[11]=m):m=t[11];let u;t[12]!==i?(u=s.jsx(ve,{side:"top",children:i}),t[12]=i,t[13]=u):u=t[13];let f;return t[14]!==m||t[15]!==u?(f=s.jsxs(ye,{delayDuration:300,children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16],f}function Gr(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(cs,{children:s.jsx(O.Suspense,{fallback:null,children:s.jsx(Ur,{})})}),t[0]=e):e=t[0],e}function ms(t){const e=w.c(15),{children:n}=t,{items:r,markReleaseSeen:l}=as(),[o,i]=O.useState(null);let a;if(e[0]!==r||e[1]!==o){let x;e[3]!==o?(x=g=>g.type==="release"&&g.release.id===o,e[3]=o,e[4]=x):x=e[4],a=r.find(x),e[0]=r,e[1]=o,e[2]=a}else a=e[2];const c=a,d=c?.type==="release"?c.release:null;let m;e[5]!==l?(m=x=>{i(x),l(x)},e[5]=l,e[6]=m):m=e[6];const u=m;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x||i(null)},e[7]=f):f=e[7];let h;e[8]!==u||e[9]!==r||e[10]!==d?(h=s.jsx(Ee,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b border-border shrink-0",children:[s.jsx(Te,{size:"icon",variant:"ghost","aria-label":"Back to inbox",className:"size-7 text-muted-foreground",onClick:()=>i(null),children:s.jsx(Js,{size:16})}),s.jsx("h3",{className:"text-sm font-medium truncate",children:d.title})]}),s.jsx("div",{className:"overflow-y-auto flex-1 p-5",children:s.jsx(un,{release:d})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:s.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),r.length===0?s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[s.jsx(Ve,{size:24,className:"text-muted-foreground/50"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Nothing here yet"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Invitations, join requests, and release updates will appear here"})]}):s.jsx("div",{className:"overflow-y-auto flex-1",children:r.map(x=>x.type==="join-request"?s.jsx(Dr,{request:x.request},`req-${x.request.id}`):x.type==="invitation"?s.jsx(Tr,{invitation:x.invitation},`inv-${x.invitation.id}`):s.jsx(Or,{release:x.release,isSeen:x.isSeen,onSelect:()=>u(x.release.id)},`rel-${x.release.id}`))})]})}),e[8]=u,e[9]=r,e[10]=d,e[11]=h):h=e[11];let p;return e[12]!==n||e[13]!==h?(p=s.jsxs(Pe,{onOpenChange:f,children:[n,h]}),e[12]=n,e[13]=h,e[14]=p):p=e[14],p}function us(){const{redDotCount:t}=as();return t>0}function qr(){const t=w.c(6),e=us();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{children:"Inbox"}),t[3]=l):l=t[3];let o;return t[4]!==r?(o=s.jsx(ms,{children:s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:"Inbox",className:"relative",children:[n,r,l]})})}),t[4]=r,t[5]=o):o=t[5],o}function Wr(){const t=w.c(8),e=us();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{className:"size-4"}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-0.5 right-0.5 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let l;t[3]!==r?(l=s.jsx(Ne,{asChild:!0,children:s.jsx(je,{asChild:!0,children:s.jsxs(xe,{"aria-label":"Inbox",children:[n,r]})})}),t[3]=r,t[4]=l):l=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ve,{side:"top",children:"Inbox"}),t[5]=o):o=t[5];let i;return t[6]!==l?(i=s.jsx(ms,{children:s.jsxs(ye,{delayDuration:300,children:[l,o]})}),t[6]=l,t[7]=i):i=t[7],i}function Kr(){const t=w.c(7),e=he(),{org:n}=de();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let l,o;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ke,{}),o=s.jsx("span",{children:"Settings"}),t[3]=l,t[4]=o):(l=t[3],o=t[4]);let i;return t[5]!==r?(i=s.jsxs(ue,{tooltip:"Settings",onClick:r,children:[l,o]}),t[5]=r,t[6]=i):i=t[6],i}function Vr(){const t=w.c(9),e=he(),{org:n}=de();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ke,{className:"size-4"}),t[3]=l):l=t[3];let o;t[4]!==r?(o=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":"Settings",onClick:r,children:l})}),t[4]=r,t[5]=o):o=t[5];let i;t[6]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ve,{side:"top",children:"Settings"}),t[6]=i):i=t[6];let a;return t[7]!==o?(a=s.jsxs(ye,{delayDuration:300,children:[o,i]}),t[7]=o,t[8]=a):a=t[8],a}function Xr(){const t=w.c(6),{state:e}=Ce();if(e==="collapsed"){let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Hr,{}),t[0]=l):l=t[0];let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(se,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(rt,{})})}),t[1]=o):o=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(se,{children:s.jsx(qr,{})}),t[2]=i):i=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(se,{children:s.jsx(Kr,{})}),t[3]=a):a=t[3];let c;return t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(tt,{className:"px-2 pb-3 gap-1",children:[l,s.jsxs(_e,{children:[o,i,a,s.jsx(se,{children:s.jsx(nt,{})})]})]}),t[4]=c):c=t[4],c}let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(tt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(_e,{children:s.jsx(se,{children:s.jsx(nt,{})})})}),s.jsx(Vr,{}),s.jsx(Wr,{}),s.jsx(rt,{}),s.jsx(Gr,{})]})}),t[5]=r):r=t[5],r}function Qr(){const t=w.c(8),e=he(),{org:n}=de(),{setOpenMobile:r}=Ce();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(_e,{children:s.jsx(se,{children:s.jsx(nt,{})})})}),t[0]=l):l=t[0];let o;t[1]!==e||t[2]!==n.slug||t[3]!==r?(o=()=>{e({to:"/$org/settings",params:{org:n.slug}}),r(!1)},t[1]=e,t[2]=n.slug,t[3]=r,t[4]=o):o=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ke,{className:"size-4"}),t[5]=i):i=t[5];let a;return t[6]!==o?(a=s.jsx(tt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[l,s.jsx(xe,{"aria-label":"Settings",onClick:o,children:i})]})}),t[6]=o,t[7]=a):a=t[7],a}function St(t){const e=w.c(15),{className:n,wrapperClassName:r,children:l}=t,[o,i]=O.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=b=>{b&&i(b.scrollHeight>b.clientHeight+1)},e[0]=a):a=e[0];const c=a;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=b=>{const j=b.currentTarget;i(j.scrollHeight-j.scrollTop>j.clientHeight+1)},e[1]=d):d=e[1];const m=d;let u;e[2]!==r?(u=F("relative",r),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==l||e[5]!==n?(f=s.jsx("div",{ref:c,onScroll:m,className:n,children:l}),e[4]=l,e[5]=n,e[6]=f):f=e[6];const h=o?"opacity-100":"opacity-0";let p;e[7]!==h?(p=F("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",h),e[7]=h,e[8]=p):p=e[8];let x;e[9]!==p?(x=s.jsx("div",{"aria-hidden":!0,className:p}),e[9]=p,e[10]=x):x=e[10];let g;return e[11]!==u||e[12]!==f||e[13]!==x?(g=s.jsxs("div",{className:u,children:[f,x]}),e[11]=u,e[12]=f,e[13]=x,e[14]=g):g=e[14],g}function Yr(t){const e=w.c(8),{virtualMcpId:n,size:r,showAutomationBadge:l}=t,o=r===void 0?"sm":r;let i;e[0]!==o||e[1]!==n?(i=n?s.jsx(Jr,{virtualMcpId:n,size:o}):s.jsx(De,{icon:null,name:"?",size:o}),e[0]=o,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==l?(a=l&&s.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:s.jsx(Dn,{size:10,className:"text-white"})}),e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==a?(c=s.jsxs("div",{className:"relative shrink-0",children:[i,a]}),e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function Jr(t){const e=w.c(6),{virtualMcpId:n,size:r}=t,l=Qt(n);if(!l){let a;return e[0]!==r?(a=s.jsx(De,{icon:null,name:"?",size:r}),e[0]=r,e[1]=a):a=e[1],a}const o=l.icon??null;let i;return e[2]!==l.title||e[3]!==r||e[4]!==o?(i=s.jsx(De,{icon:o,name:l.title,size:r}),e[2]=l.title,e[3]=r,e[4]=o,e[5]=i):i=e[5],i}function Nt(t){const e=w.c(36),{open:n,onOpenChange:r}=t,[l,o]=O.useState(""),{org:i}=de(),{setTaskId:a}=mt(),c=Zt();let d,m,u;e[0]!==i.id||e[1]!==l?(u=l.trim(),m=Mt,d=Ot.globalSearch(i.id,u),e[0]=i.id,e[1]=l,e[2]=d,e[3]=m,e[4]=u):(d=e[2],m=e[3],u=e[4]);const f=n&&u.length>0;let h;e[5]!==c||e[6]!==u?(h=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=c,e[6]=u,e[7]=h):h=e[7];let p;e[8]!==d||e[9]!==f||e[10]!==h?(p={queryKey:d,enabled:f,queryFn:h,staleTime:1e4},e[8]=d,e[9]=f,e[10]=h,e[11]=p):p=e[11];const{data:x,isFetching:g}=m(p);let b;e[12]!==x?.items?(b=x?.items??[],e[12]=x?.items,e[13]=b):b=e[13];const j=b;let v;e[14]!==r?(v=$=>{$||o(""),r($)},e[14]=r,e[15]=v):v=e[15];const y=v;let _;e[16]!==y||e[17]!==a?(_=$=>{y(!1),a($.id,$.virtual_mcp_id??void 0)},e[16]=y,e[17]=a,e[18]=_):_=e[18];const k=_;let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Nn,{className:"sr-only",children:[s.jsx(_n,{children:"Search"}),s.jsx(Cn,{children:"Search across your organization's resources."})]}),e[19]=N):N=e[19];let C;e[20]!==l?(C=s.jsx($n,{value:l,onValueChange:o,placeholder:"Search..."}),e[20]=l,e[21]=C):C=e[21];let S;e[22]!==k||e[23]!==g||e[24]!==j||e[25]!==u?(S=u?g&&j.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):j.length===0?s.jsx(In,{children:"No results."}):j.map($=>$.type==="thread"?s.jsxs(zn,{value:`thread:${$.id}:${$.title}`,onSelect:()=>k($),className:"gap-2.5",children:[s.jsx(Yr,{virtualMcpId:$.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:$.title||"Untitled thread"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date($.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${$.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=k,e[23]=g,e[24]=j,e[25]=u,e[26]=S):S=e[26];let z;e[27]!==S?(z=s.jsx(An,{children:S}),e[27]=S,e[28]=z):z=e[28];let T;e[29]!==C||e[30]!==z?(T=s.jsxs(wn,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,s.jsxs(Tn,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[C,z]})]}),e[29]=C,e[30]=z,e[31]=T):T=e[31];let A;return e[32]!==y||e[33]!==n||e[34]!==T?(A=s.jsx(kn,{open:n,onOpenChange:y,children:T}),e[32]=y,e[33]=n,e[34]=T,e[35]=A):A=e[35],A}const _t=["requires_action","in_progress","failed","expired","completed"];function Zr(t){const e=new Map(_t.map(n=>[n,[]]));for(const n of t){const r=n.status??"completed";(e.get(r)??e.get("completed")).push(n)}return _t.map(n=>({status:n,threads:e.get(n)}))}const el="sidebar.group.expanded.";function tl(t,e){const n=w.c(3),[r,l]=We(`${el}${t}`,e);let o;return n[0]!==r||n[1]!==l?(o=[r,l],n[0]=r,n[1]=l,n[2]=o):o=n[2],o}function fs(t){const e=w.c(12),{onClick:n,isFetching:r,indented:l}=t,o=l?"-ml-4 pl-6 pr-2":"px-2";let i;e[0]!==o?(i=F("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",o,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==r?(a=r&&s.jsx(Pt,{size:14,className:"animate-spin"}),e[2]=r,e[3]=a):a=e[3];const c=r?"Loading…":"Show more";let d;e[4]!==c?(d=s.jsx("span",{children:c}),e[4]=c,e[5]=d):d=e[5];let m;return e[6]!==r||e[7]!==n||e[8]!==i||e[9]!==a||e[10]!==d?(m=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:r,className:i,children:[a,d]}),e[6]=r,e[7]=n,e[8]=i,e[9]=a,e[10]=d,e[11]=m):m=e[11],m}function sl(t,e,n,r){return[t,e,n,r.type,r.member,r.currentUserId??""].join("|")}function nl(t){return t.member==="mine"&&!t.currentUserId}const xs=4;let Ue=0;const lt=[];function rl(){for(;Ue<xs&&lt.length>0;){const t=lt.shift();t&&t()}}function hs(t){return new Promise((e,n)=>{const r=()=>{Ue++,t().then(e,n).finally(()=>{Ue--,rl()})};Ue<xs?r():lt.push(r)})}const Qe=10;function Ct(t,e,n,r,l){const o={hidden:!1};r.member==="mine"&&r.currentUserId&&(o.created_by=r.currentUserId),r.type==="automation"&&(o.has_trigger=!0),r.type==="manual"&&(o.has_trigger=!1);const i={where:o,limit:l,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return i.status=e,i}function ll(t,e,n,r){let l=0;for(const o of t)ps(o,e,n,r)&&l++;return l}function Ze(t,e,n,r){return ll(t,e,n,r)}function ol(t,e){return!!(t>=Qe||t===0&&e)}function wt(t,e){return t<e}function il(t,e){return e===!1?!1:e===!0?!0:t}function ps(t,e,n,r){return!(t.hidden||(t.status??"completed")!==n||r.member==="mine"&&r.currentUserId&&t.created_by!==r.currentUserId||r.type==="automation"&&!t.trigger_id||r.type==="manual"&&t.trigger_id)}const qe=new Map,He=new Map;function al(t,e){return e?t>=Qe?!0:null:!1}function kt(t){return qe.get(t)}function cl(t,e){qe.set(t,e)}function dl(t,e,n){const r=qe.get(t);if(r!==void 0){n(r);return}let l=He.get(t);l||(l=hs(e).then(o=>(qe.set(t,o),He.delete(t),o)).catch(()=>(He.delete(t),Promise.reject(new Error("group probe failed")))),He.set(t,l)),l.then(n,()=>n(!1))}function It(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Qe,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function ml(t,e,n,r,l){let o=0;for(const i of t)e.has(i.id)||ps(i,n,r,l)&&o++;return o}function ul(t,e,n,r){const l=w.c(8),{org:o}=de(),i=sl(o.id,t,e,n);let a;l[0]!==n?(a=nl(n),l[0]=n,l[1]=a):a=l[1];const c=a,[d,m]=O.useState({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==i&&m({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:null,serverHasMore:null});const u=yn(),{threads:f,hasMore:h}=ut(),p=Ze(f,t,e,n),x=ol(p,h),g=al(p,h),b=Zt();if(d.identity===i&&d.serverHasMore===null){const N=g??kt(i);N!==void 0&&m({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:N})}!c&&d.identity===i&&d.serverHasMore===null&&g===null&&kt(i)===void 0&&d.probeSubscribedIdentity!==i&&(m(N=>N.identity===i?{...N,isProbing:!0,probeSubscribedIdentity:i}:N),dl(i,async()=>{const N=Ct(t,e,0,n,1),C=await b.call("COLLECTION_THREADS_LIST",N),{totalCount:S}=It(C),z=Ze(u.threads.get(),t,e,n);return S===void 0?!1:wt(z,S)},N=>{m(C=>C.identity!==i?C:{...C,isProbing:!1,serverHasMore:N})}));const v=async function(){if(d.isFetching||d.isProbing||c)return;const C=i;m(S=>S.identity===C?{...S,isFetching:!0}:S);try{const S=Ze(f,t,e,n),z=Ct(t,e,S,n,Qe),T=await hs(()=>b.call("COLLECTION_THREADS_LIST",z)),{items:A,hasMore:$,totalCount:E}=It(T),W=new Set(f.map(fl)),M=ml(A,W,t,e,n),q=S;u.mergeThreads(A),m(R=>{if(R.identity!==C)return R;let Q;return E!==void 0?Q=wt(q+M,E):Q=A.length===0||M===0?!1:$,cl(C,Q),{...R,isFetching:!1,serverHasMore:Q}})}catch(S){const z=S,T=z instanceof Error?z.message:String(z);ge.error(`Could not load more tasks: ${T}`),m(A=>A.identity===C?{...A,isFetching:!1}:A)}},y=d.isFetching||d.isProbing,_=!c&&!y&&il(x,d.serverHasMore);let k;return l[2]!==y||l[3]!==v||l[4]!==_||l[5]!==d.isProbing||l[6]!==d.serverHasMore?(k={hasMore:_,isFetching:y,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:v},l[2]=y,l[3]=v,l[4]=_,l[5]=d.isProbing,l[6]=d.serverHasMore,l[7]=k):k=l[7],k}function fl(t){return t.id}function xl(t){const e=w.c(18),{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a}=t,{isFetching:c,isProbing:d,loadMore:m,hasMore:u,serverHasMore:f}=ul("status",n,a),[h,p]=O.useState(!1);!h&&r.length===0&&f===!0&&!c&&!d&&(p(!0),queueMicrotask(()=>{m()}));let x;if(e[0]!==l||e[1]!==a||e[2]!==i||e[3]!==o||e[4]!==r){let j;e[6]!==l||e[7]!==a||e[8]!==i||e[9]!==o?(j=v=>s.jsx(ts,{task:v,isActive:l===v.id,onClick:()=>o(v),onArchive:v.created_by===a.currentUserId?()=>i(v):void 0,showAutomationBadge:!!v.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},v.id),e[6]=l,e[7]=a,e[8]=i,e[9]=o,e[10]=j):j=e[10],x=r.map(j),e[0]=l,e[1]=a,e[2]=i,e[3]=o,e[4]=r,e[5]=x}else x=e[5];let g;e[11]!==u||e[12]!==c||e[13]!==m?(g=(u||c)&&s.jsx(fs,{onClick:()=>{m()},isFetching:c,indented:!0}),e[11]=u,e[12]=c,e[13]=m,e[14]=g):g=e[14];let b;return e[15]!==x||e[16]!==g?(b=s.jsxs(s.Fragment,{children:[x,g]}),e[15]=x,e[16]=g,e[17]=b):b=e[17],b}function hl(t){const e=w.c(35),{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a}=t,c=Mn[n],d=c.icon,[m,u]=tl(`status-${n}`,!1);let f;e[0]!==m||e[1]!==u?(f=function(){u(!m)},e[0]=m,e[1]=u,e[2]=f):f=e[2];const h=f;let p;e[3]!==h?(p=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),h())},e[3]=h,e[4]=p):p=e[4];let x;e[5]!==d||e[6]!==c.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(d,{size:12,className:c.iconClassName})}),e[5]=d,e[6]=c.iconClassName,e[7]=x):x=e[7];let g;e[8]!==m?(g=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?s.jsx(ft,{size:14}):s.jsx(Vt,{size:14})}),e[8]=m,e[9]=g):g=e[9];let b;e[10]!==x||e[11]!==g?(b=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[x,g]}),e[10]=x,e[11]=g,e[12]=b):b=e[12];let j;e[13]!==c.label?(j=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=j):j=e[14];let v;e[15]!==r.length?(v=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:r.length})}),e[15]=r.length,e[16]=v):v=e[16];let y;e[17]!==m||e[18]!==h||e[19]!==p||e[20]!==b||e[21]!==j||e[22]!==v?(y=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:h,onKeyDown:p,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[b,j,v]}),e[17]=m,e[18]=h,e[19]=p,e[20]=b,e[21]=j,e[22]=v,e[23]=y):y=e[23];let _;e[24]!==l||e[25]!==m||e[26]!==a||e[27]!==i||e[28]!==o||e[29]!==n||e[30]!==r?(_=m&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(xl,{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a})}),e[24]=l,e[25]=m,e[26]=a,e[27]=i,e[28]=o,e[29]=n,e[30]=r,e[31]=_):_=e[31];let k;return e[32]!==y||e[33]!==_?(k=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[y,_]}),e[32]=y,e[33]=_,e[34]=k):k=e[34],k}function zt(t){const e=w.c(34),{threads:n,groupBy:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a,hasMore:c,isFetchingMore:d,onLoadMore:m,filtersActive:u}=t;if(n.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ve,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const g=u?"No threads match your filters":"No threads yet";let b;return e[1]!==g?(b=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,s.jsx("p",{className:"text-sm",children:g})]}),e[1]=g,e[2]=b):b=e[2],b}if(r==="status"){let x;if(e[3]!==l||e[4]!==a||e[5]!==i||e[6]!==o||e[7]!==n){let b;e[9]!==l||e[10]!==a||e[11]!==i||e[12]!==o?(b=j=>s.jsx(hl,{status:j.status,threads:j.threads,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a},j.status),e[9]=l,e[10]=a,e[11]=i,e[12]=o,e[13]=b):b=e[13],x=Zr(n).map(b),e[3]=l,e[4]=a,e[5]=i,e[6]=o,e[7]=n,e[8]=x}else x=e[8];let g;return e[14]!==x?(g=s.jsx(s.Fragment,{children:x}),e[14]=x,e[15]=g):g=e[15],g}let f;if(e[16]!==l||e[17]!==a||e[18]!==i||e[19]!==o||e[20]!==n){let x;e[22]!==l||e[23]!==a||e[24]!==i||e[25]!==o?(x=g=>s.jsx(ts,{task:g,isActive:l===g.id,onClick:()=>o(g),onArchive:g.created_by===a.currentUserId?()=>i(g):void 0,showAutomationBadge:!!g.trigger_id,showAgentIcon:!0},g.id),e[22]=l,e[23]=a,e[24]=i,e[25]=o,e[26]=x):x=e[26],f=n.map(x),e[16]=l,e[17]=a,e[18]=i,e[19]=o,e[20]=n,e[21]=f}else f=e[21];let h;e[27]!==c||e[28]!==d||e[29]!==m?(h=(c||d)&&s.jsx(fs,{onClick:m,isFetching:d}),e[27]=c,e[28]=d,e[29]=m,e[30]=h):h=e[30];let p;return e[31]!==f||e[32]!==h?(p=s.jsxs(s.Fragment,{children:[f,h]}),e[31]=f,e[32]=h,e[33]=p):p=e[33],p}function $t(t){const e=w.c(17),{label:n,onClick:r,active:l,children:o}=t,[i,a]=O.useState(!1);let c,d,m,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!0),d=()=>a(!1),m=()=>a(!0),u=()=>a(!1),e[0]=c,e[1]=d,e[2]=m,e[3]=u):(c=e[0],d=e[1],m=e[2],u=e[3]);const f=l&&"bg-sidebar-accent text-foreground";let h;e[4]!==f?(h=F(f),e[4]=f,e[5]=h):h=e[5];let p;e[6]!==o||e[7]!==n||e[8]!==r||e[9]!==h?(p=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":n,onClick:r,onPointerEnter:c,onPointerLeave:d,onFocus:m,onBlur:u,className:h,children:o})}),e[6]=o,e[7]=n,e[8]=r,e[9]=h,e[10]=p):p=e[10];let x;e[11]!==n?(x=s.jsx(ve,{side:"bottom",children:n}),e[11]=n,e[12]=x):x=e[12];let g;return e[13]!==i||e[14]!==p||e[15]!==x?(g=s.jsxs(ye,{open:i,children:[p,x]}),e[13]=i,e[14]=p,e[15]=x,e[16]=g):g=e[16],g}function et(t){const e=w.c(13),{label:n,value:r,onChange:l,options:o}=t;let i;e[0]!==n?(i=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==l?(a=u=>u&&l(u),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==o?(c=o.map(pl),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==c||e[8]!==r?(d=s.jsx(gn,{type:"single",size:"sm",value:r,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=a,e[7]=c,e[8]=r,e[9]=d):d=e[9];let m;return e[10]!==i||e[11]!==d?(m=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i,d]}),e[10]=i,e[11]=d,e[12]=m):m=e[12],m}function pl(t){return s.jsxs(pn,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function gs({onNavigate:t}={}){const{data:e}=be.useSession(),n=e?.user?.id,{org:r}=de(),l=bn({connectionId:jn,orgId:r.id,orgSlug:r.slug}),o=Ge(r.id).id,i=Yt(),{threads:a,hasMore:c,isFetchingMore:d,fetchNextPage:m}=ut(),u=a.filter(I=>!I.hidden),{hide:f}=Jt(),h=he(),{setTaskId:p,createNewTask:x}=mt(),g=ot({strict:!1}),b=it({strict:!1}),j=g.taskId??null,v=b.virtualmcpid??a.find(I=>I.id===j)?.virtual_mcp_id??null,y=()=>{t?.()},_=[...u].sort((I,D)=>(D.updated_at??"").localeCompare(I.updated_at??"")),[k,N]=O.useState("all"),[C,S]=O.useState("flat"),[z,T]=We("sidebar-threads-scope-all",!1),[A,$]=O.useState(!1),[E,W]=O.useState(!1),M={type:k,member:"mine",currentUserId:n??null},q=I=>n?I.filter(D=>D.created_by===n):[],R=I=>k==="automation"?I.filter(D=>!!D.trigger_id):k==="manual"?I.filter(D=>!D.trigger_id):I,Q=q(_),Y=R(Q),ne=R(_),re=z?ne:Y,L=I=>{if(n&&I.created_by&&I.created_by!==n)return;const D=I.id===j;if(f(I.id),!D)return;const B=Q.find(P=>P.id!==I.id&&P.virtual_mcp_id===I.virtual_mcp_id);y(),B?p(B.id,B.virtual_mcp_id):h({to:"/$org",params:{org:r.slug}})},H=I=>{y(),p(I.id,I.virtual_mcp_id)},Z=async I=>{try{const D=await l.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:I,limit:1,offset:0}});return((D.structuredContent??D).items?.length??0)===0}catch{return!1}},K=async()=>{const I=v??o;ae("sidebar_new_thread_clicked",{virtual_mcp_id:I});const D=Q.find(B=>B.virtual_mcp_id===I&&B.title==="New chat");if(D&&await Z(D.id)){y(),p(D.id,I);return}y(),x(I)},{state:ee,isMobile:G,toggleSidebar:le}=Ce();if(ee==="collapsed"&&!G){const I=Ge(r.id),D=new Map((i??[]).map(P=>[P.id,P])),B=P=>(P?D.get(P):void 0)??(P===o?I:void 0);return s.jsxs(_e,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(se,{children:s.jsx(ue,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:le,children:s.jsx(Bt,{size:16})})}),s.jsx(se,{children:s.jsx(ue,{tooltip:"New thread",onClick:()=>{K()},children:s.jsx(bt,{size:16})})}),re.map(P=>{const X=B(P.virtual_mcp_id);return s.jsx(se,{children:s.jsx(ue,{tooltip:P.title||"New chat",isActive:P.id===j,onClick:()=>H(P),children:s.jsx(De,{icon:X?.icon??null,name:X?.title??"Agent",size:"2xs"})})},P.id)})]})}const V=C!=="flat"||k!=="all"||z===!0,J=s.jsxs(Pe,{children:[s.jsxs(ye,{children:[s.jsx(je,{asChild:!0,children:s.jsx(Ne,{asChild:!0,children:s.jsxs(xe,{"aria-label":"Filter threads",active:V,children:[s.jsx(hn,{size:16}),V&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(ve,{side:"bottom",children:"Filter threads"})]}),s.jsxs(Ee,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(et,{label:"View",value:C,onChange:I=>{ae("tasks_panel_group_by_changed",{to_value:I}),S(I)},options:[{value:"flat",label:"List",icon:s.jsx(sn,{size:13})},{value:"status",label:"Status",icon:s.jsx(nn,{size:13})}]}),s.jsx(et,{label:"Type",value:k,onChange:I=>{ae("tasks_panel_filter_changed",{to_value:I}),N(I)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(et,{label:"Scope",value:z?"team":"mine",onChange:I=>T(I==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),me=I=>s.jsx(st,{delayDuration:300,children:s.jsxs("div",{className:F("shrink-0 px-1 flex items-center justify-between",I?"h-10":"h-10 md:h-7 mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!I&&s.jsx(es,{}),J]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($t,{label:"Search threads",onClick:()=>{ae("tasks_panel_search_opened"),W(!0),$(!0)},children:s.jsx(tn,{size:16})}),s.jsx($t,{label:"New thread",onClick:()=>{K()},children:s.jsx(bt,{size:16})})]})]})});return G?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[me(!0),s.jsx(St,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(zt,{threads:re,groupBy:C,activeTaskId:j,onSelectTask:H,onArchiveTask:L,filters:M,hasMore:c,isFetchingMore:d,onLoadMore:()=>{m()},filtersActive:V})}),E&&s.jsx(Nt,{open:A,onOpenChange:$})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[me(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(St,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(zt,{threads:re,groupBy:C,activeTaskId:j,onSelectTask:H,onArchiveTask:L,filters:M,hasMore:c,isFetchingMore:d,onLoadMore:()=>{m()},filtersActive:V})})}),E&&s.jsx(Nt,{open:A,onOpenChange:$})]})}const gl=5,bl=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function bs(){const t=w.c(3),{state:e}=Ce();if(e==="collapsed"){let l;return t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:gl}).map(yl)}),t[0]=l):l=t[0],l}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(fe,{className:"size-6 rounded-md"}),s.jsx(fe,{className:"size-6 rounded-md"}),s.jsx(fe,{className:"size-6 rounded-md"})]}),s.jsx(fe,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:bl.map(jl)})]}),t[2]=r):r=t[2],r}function jl(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(fe,{className:"size-5 rounded-full shrink-0"}),s.jsx(fe,{className:F("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(vl)})]},e)}function vl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(fe,{className:"h-3 flex-1 rounded-sm"})},e)}function yl(t,e){return s.jsx(fe,{className:"size-10 rounded-lg mx-auto"},e)}function Sl(){const t=w.c(4),e=rs();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Xr,{}),t[0]=n):n=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Et,{children:s.jsx(O.Suspense,{fallback:s.jsx(bs,{}),children:s.jsx(gs,{})})}),t[1]=r):r=t[1];let l;return t[2]!==e?(l=s.jsx(ss,{children:s.jsx(is,{sections:e,footer:n,additionalContent:r})}),t[2]=e,t[3]=l):l=t[3],l}function Nl(t){const e=w.c(8),{onClose:n}=t,r=rs();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Qr,{}),e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(bs,{}),e[1]=o):o=e[1];let i;e[2]!==n?(i=s.jsx(Et,{children:s.jsx(O.Suspense,{fallback:o,children:s.jsx(gs,{onNavigate:n})})}),e[2]=n,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==i?(a=s.jsx(ss,{children:s.jsx(Cr,{sections:r,onClose:n,footer:l,additionalContent:i})}),e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function js(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const _l=Ds({name:Os().min(2,"Organization name is required")});function Cl(t){const e=w.c(41),{open:n,onOpenChange:r}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={resolver:Ms(_l),defaultValues:{name:""}},e[0]=l):l=e[0];const o=Ps(l);let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={mutationFn:kl,onSuccess:wl},e[1]=i):i=e[1];const a=Es(i),c=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs(Kn,{children:[s.jsx(Vn,{children:"Create a new organization"}),s.jsx(Xn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=d):d=e[2];let m;if(e[3]!==a||e[4]!==o){let N;e[6]!==a?(N=C=>a.mutateAsync(C),e[6]=a,e[7]=N):N=e[7],m=o.handleSubmit(N),e[3]=a,e[4]=o,e[5]=m}else m=e[5];let u;e[8]!==o.formState.isSubmitting?(u=N=>{const{field:C}=N;return s.jsxs(er,{children:[s.jsx(tr,{children:"Organization Name"}),s.jsx(sr,{children:s.jsx(lr,{...C,placeholder:"Acme Inc.",disabled:o.formState.isSubmitting})}),s.jsx(nr,{children:"The name of your company or organization"}),C.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",js(C.value)]})]}),s.jsx(rr,{})]})},e[8]=o.formState.isSubmitting,e[9]=u):u=e[9];let f;e[10]!==o.control||e[11]!==u?(f=s.jsx(Jn,{control:o.control,name:"name",render:u}),e[10]=o.control,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==c?(h=c&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=h):h=e[14];let p;e[15]!==a||e[16]!==o?(p=()=>{a.reset(),o.reset()},e[15]=a,e[16]=o,e[17]=p):p=e[17];let x;e[18]!==o.formState.isSubmitting||e[19]!==p?(x=s.jsx(qn,{disabled:o.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=o.formState.isSubmitting,e[19]=p,e[20]=x):x=e[20];const g=!o.formState.isValid||o.formState.isSubmitting;let b;e[21]!==o.formState.isSubmitting?(b=o.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Ln,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=o.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==g||e[24]!==b?(j=s.jsx(Te,{type:"submit",variant:"default",disabled:g,children:b}),e[23]=g,e[24]=b,e[25]=j):j=e[25];let v;e[26]!==j||e[27]!==x?(v=s.jsxs(Qn,{children:[x,j]}),e[26]=j,e[27]=x,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==m||e[31]!==f||e[32]!==h?(y=s.jsxs("form",{className:"space-y-6",onSubmit:m,autoComplete:"off",children:[f,h,v]}),e[29]=v,e[30]=m,e[31]=f,e[32]=h,e[33]=y):y=e[33];let _;e[34]!==o||e[35]!==y?(_=s.jsxs(Wn,{children:[d,s.jsx(Zn,{...o,children:y})]}),e[34]=o,e[35]=y,e[36]=_):_=e[36];let k;return e[37]!==r||e[38]!==n||e[39]!==_?(k=s.jsx(Yn,{open:n,onOpenChange:r,children:_}),e[37]=r,e[38]=n,e[39]=_,e[40]=k):k=e[40],k}function wl(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function kl(t){const e=js(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await be.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const r=n?.data?.slug??e;if(!r)throw new Error("Failed to create organization");return{orgSlug:r}}function Il(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function vs(t){const e=w.c(13),{org:n,size:r}=t,l=r===void 0?"sm":r,o=l==="xs"?"size-5":"size-6",i=l==="xs"?"text-[9px]":"text-xs";let a;e[0]!==o?(a=F(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n.logo||e[3]!==n.name?(c=n.logo?void 0:Il(n.name),e[2]=n.logo,e[3]=n.name,e[4]=c):c=e[4];let d;e[5]!==n.logo||e[6]!==n.name||e[7]!==i?(d=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:F("font-semibold leading-none",i),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=i,e[8]=d):d=e[8];let m;return e[9]!==a||e[10]!==c||e[11]!==d?(m=s.jsx("div",{className:a,style:c,children:d}),e[9]=a,e[10]=c,e[11]=d,e[12]=m):m=e[12],m}function zl(t){const e=w.c(24),{orgParam:n,onSelectOrg:r,onCreateOrg:l}=t,{data:o}=Fs();let i;e[0]!==n?(i=(S,z)=>S.slug===n?-1:z.slug===n?1:S.name.localeCompare(z.name),e[0]=n,e[1]=i):i=e[1];const a=[...o??[]].sort(i),[c,d]=O.useState(""),m=c.toLowerCase(),u=m?a.filter(S=>S.name.toLowerCase().includes(m)||S.slug.toLowerCase().includes(m)):a;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ns,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=f):f=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=S=>d(S.target.value),e[3]=h):h=e[3];let p;e[4]!==c?(p=S=>S.key==="Escape"&&c&&d(""),e[4]=c,e[5]=p):p=e[5];let x;e[6]!==c||e[7]!==p?(x=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:c,onChange:h,onKeyDown:p,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=c,e[7]=p,e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ae,{size:16}),e[9]=g):g=e[9];let b;e[10]!==l?(b=s.jsx("button",{type:"button",onClick:l,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:g}),e[10]=l,e[11]=b):b=e[11];let j;e[12]!==x||e[13]!==b?(j=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[f,x,b]}),e[12]=x,e[13]=b,e[14]=j):j=e[14];const v="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",y=u.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:c?`No organizations match "${c}"`:"No organizations available"});let _;e[15]!==r||e[16]!==n?(_=S=>s.jsxs("button",{type:"button",onClick:()=>r(S.slug),className:F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",S.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(vs,{org:S,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:S.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.slug})]}),S.slug===n&&s.jsx(Xe,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},S.id),e[15]=r,e[16]=n,e[17]=_):_=e[17];const k=u.map(_);let N;e[18]!==y||e[19]!==k?(N=s.jsxs("div",{className:v,children:[y,k]}),e[18]=y,e[19]=k,e[20]=N):N=e[20];let C;return e[21]!==N||e[22]!==j?(C=s.jsxs(s.Fragment,{children:[j,N]}),e[21]=N,e[22]=j,e[23]=C):C=e[23],C}function $l(t){const e=w.c(22),{trigger:n,orgParam:r,align:l,side:o}=t,i=l===void 0?"start":l,a=o===void 0?"bottom":o,c=he(),[d,m]=O.useState(!1),[u,f]=O.useState(!1);let h;e[0]!==n?(h=s.jsx(Ne,{asChild:!0,children:n}),e[0]=n,e[1]=h):h=e[1];const p=String(d);let x;e[2]!==c?(x=k=>{m(!1),c({to:"/$org",params:{org:k}})},e[2]=c,e[3]=x):x=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),f(!0)},e[4]=g):g=e[4];let b;e[5]!==r||e[6]!==p||e[7]!==x?(b=s.jsx(zl,{orgParam:r,onSelectOrg:x,onCreateOrg:g},p),e[5]=r,e[6]=p,e[7]=x,e[8]=b):b=e[8];let j;e[9]!==i||e[10]!==a||e[11]!==b?(j=s.jsx(Ee,{side:a,align:i,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:Tl,onCloseAutoFocus:Al,children:b}),e[9]=i,e[10]=a,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==d||e[14]!==h||e[15]!==j?(v=s.jsxs(Pe,{open:d,onOpenChange:m,children:[h,j]}),e[13]=d,e[14]=h,e[15]=j,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(Cl,{open:u,onOpenChange:f}),e[17]=u,e[18]=y):y=e[18];let _;return e[19]!==y||e[20]!==v?(_=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=_):_=e[21],_}function Al(t){return t.preventDefault()}function Tl(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function Dl(t){const e=w.c(21),{value:n,onChange:r,placeholder:l,onKeyDown:o,className:i,isSearching:a,disabled:c}=t,d=l===void 0?"Search...":l;let m;e[0]!==i?(m=F("shrink-0 w-full border-b border-border h-12",i),e[0]=i,e[1]=m):m=e[1];const u=c?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==u?(f=F("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=f):f=e[3];let h;e[4]!==a?(h=a?s.jsx(Pt,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(ns,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=h):h=e[5];let p;e[6]!==r?(p=j=>r(j.target.value),e[6]=r,e[7]=p):p=e[7];let x;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==p||e[12]!==n?(x=s.jsx("input",{type:"text",value:n,onChange:p,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=p,e[12]=n,e[13]=x):x=e[13];let g;e[14]!==f||e[15]!==h||e[16]!==x?(g=s.jsxs("label",{className:f,children:[h,x]}),e[14]=f,e[15]=h,e[16]=x,e[17]=g):g=e[17];let b;return e[18]!==m||e[19]!==g?(b=s.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=b):b=e[20],b}const Ol="Select an existing agent";function Ml(t){const e=w.c(5),{children:n}=t;let r;e[0]!==n?(r=s.jsx(je,{asChild:!0,children:n}),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ve,{side:"right",sideOffset:8,children:Ol}),e[2]=l):l=e[2];let o;return e[3]!==r?(o=s.jsxs(ye,{defaultOpen:!0,delayDuration:0,children:[r,l]}),e[3]=r,e[4]=o):o=e[4],o}function Pl(){const t=w.c(5),{enableDecoImport:e}=Dt(),{data:n}=be.useSession();let r;t[0]!==n?.user?.email?(r=Ot.decoProfile(n?.user?.email),t[0]=n?.user?.email,t[1]=r):r=t[1];const l=!!e&&!!n?.user?.email;let o;t[2]!==r||t[3]!==l?(o={queryKey:r,queryFn:El,enabled:l,staleTime:3e5},t[2]=r,t[3]=l,t[4]=o):o=t[4];const{data:i}=Mt(o);return i?.isDecoUser??!1}async function El(){const t=await fetch("/api/deco-sites/profile");return t.ok?t.json():{isDecoUser:!1}}function Fl(t){const e=he(),{create:n}=Jt(),{locator:r}=de(),l=ot({strict:!1}),o=it({strict:!1});return async i=>{const a=crypto.randomUUID(),c=i===o.virtualmcpid?fn(t,r,l.taskId??""):null;try{await n({id:a,virtual_mcp_id:i,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:i}})}}function At(t){const e=w.c(17),{agent:n,selected:r,onClick:l}=t,o=r?"bg-accent":"hover:bg-accent";let i;e[0]!==o?(i=F("flex flex-col items-center gap-2 p-3 rounded-xl transition-colors cursor-pointer group",o),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(De,{icon:n.icon,name:n.title,size:"md",className:"transition-transform group-hover:scale-105"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let c;e[5]!==r?(c=r&&s.jsx("span",{className:"absolute -bottom-1 -right-1 flex size-4 items-center justify-center rounded-full border border-border bg-background",children:s.jsx(Xe,{size:10,className:"text-foreground"})}),e[5]=r,e[6]=c):c=e[6];let d;e[7]!==a||e[8]!==c?(d=s.jsxs("div",{className:"relative",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9];let m;e[10]!==n.title?(m=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground line-clamp-2 w-full",children:n.title}),e[10]=n.title,e[11]=m):m=e[11];let u;return e[12]!==l||e[13]!==i||e[14]!==d||e[15]!==m?(u=s.jsxs("button",{type:"button",onClick:l,className:i,children:[d,m]}),e[12]=l,e[13]=i,e[14]=d,e[15]=m,e[16]=u):u=e[16],u}function Rl(t){const e=w.c(60),{onClose:n,onOpenImportDeco:r,onOpenGithubImport:l,onSelectAgent:o,selectedAgentId:i}=t,[a,c]=O.useState(""),d=Yt(),m=d??[],{org:u}=de(),{data:f}=be.useSession(),h=f?.user?.id??"anon",p=En(d),x=Fn();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={navigateOnCreate:!0},e[0]=g):g=e[0];const{createVirtualMCP:b,isCreating:j}=ir(g),{createFromTemplate:v,isCreating:y}=cr(),_=Pl(),k=Fl(u.slug),N=xn(d),C=a.toLowerCase(),S=m.filter(Ll).filter(U=>!N.has(U.id)).filter(U=>!a||U.title.toLowerCase().includes(C)),z=Ge(u.id),T=!a||z.title.toLowerCase().includes(C);let A;e[1]!==n||e[2]!==o?(A=()=>{o?.(null),n(),c("")},e[1]=n,e[2]=o,e[3]=A):A=e[3];const $=A,E=U=>{if(o){o(U.id),n(),c("");return}Rn({orgId:u.id,userId:h},U.id,p),x(),n(),c(""),k(U.id)},W="flex flex-col max-h-[min(640px,80dvh)]";let M;e[4]!==a?(M=s.jsx(Dl,{value:a,onChange:c,placeholder:"Search agents..."}),e[4]=a,e[5]=M):M=e[5];const q="overflow-y-auto flex-1 min-h-0 px-3 pb-3";let R;e[6]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx("div",{className:"px-1 pt-3 pb-2",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Agents"})}),e[6]=R):R=e[6];const Q="grid grid-cols-3 gap-1";let Y;e[7]!==b||e[8]!==n?(Y=async()=>{ae("agent_create_new_clicked",{source:"browse_popover"}),await b(),n()},e[7]=b,e[8]=n,e[9]=Y):Y=e[9];let ne,re;e[10]===Symbol.for("react.memo_cache_sentinel")?(re=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(Ae,{size:16,className:"text-muted-foreground"})}),ne=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Create new"}),e[10]=ne,e[11]=re):(ne=e[10],re=e[11]);let L;e[12]!==j||e[13]!==Y?(L=s.jsxs("button",{type:"button",disabled:j,onClick:Y,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[re,ne]}),e[12]=j,e[13]=Y,e[14]=L):L=e[14];let H;e[15]!==v||e[16]!==n?(H=async()=>{ae("agent_create_clicked",{source:"browse_popover",method:"website"}),await v(dr),n()},e[15]=v,e[16]=n,e[17]=H):H=e[17];let Z,K;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(or,{className:"size-5 text-muted-foreground"})}),K=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Start Website"}),e[18]=Z,e[19]=K):(Z=e[18],K=e[19]);let ee;e[20]!==y||e[21]!==H?(ee=s.jsxs("button",{type:"button",disabled:y,onClick:H,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[Z,K]}),e[20]=y,e[21]=H,e[22]=ee):ee=e[22];let G;e[23]!==n||e[24]!==l?(G=()=>{ae("agent_import_clicked",{source:"github"}),l(),n()},e[23]=n,e[24]=l,e[25]=G):G=e[25];let le,ce;e[26]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(ur,{className:"size-5 text-muted-foreground"})}),ce=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import GitHub"}),e[26]=le,e[27]=ce):(le=e[26],ce=e[27]);let V;e[28]!==G?(V=s.jsxs("button",{type:"button",onClick:G,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[le,ce]}),e[28]=G,e[29]=V):V=e[29];let J;e[30]!==_||e[31]!==n||e[32]!==r?(J=_&&s.jsxs("button",{type:"button",onClick:()=>{ae("agent_import_clicked",{source:"deco"}),r(),n()},className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"",className:"size-5 object-contain"})}),s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import deco.cx"})]}),e[30]=_,e[31]=n,e[32]=r,e[33]=J):J=e[33];const me=o&&T&&z&&s.jsx(At,{agent:z,selected:!i||i===z.id,onClick:$}),I=S.map(U=>s.jsx(At,{agent:U,selected:o?i===U.id:void 0,onClick:()=>E(U)},U.id));let D;e[34]!==L||e[35]!==ee||e[36]!==V||e[37]!==J||e[38]!==me||e[39]!==I?(D=s.jsxs("div",{className:Q,children:[L,ee,V,J,me,I]}),e[34]=L,e[35]=ee,e[36]=V,e[37]=J,e[38]=me,e[39]=I,e[40]=D):D=e[40];let B;e[41]!==j||e[42]!==a||e[43]!==S.length?(B=S.length===0&&!j&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:a?"No agents found":"No agents yet"}),e[41]=j,e[42]=a,e[43]=S.length,e[44]=B):B=e[44];let P;e[45]!==D||e[46]!==B||e[47]!==R?(P=s.jsxs("div",{className:q,children:[R,D,B]}),e[45]=D,e[46]=B,e[47]=R,e[48]=P):P=e[48];let X;e[49]!==u.slug?(X={org:u.slug},e[49]=u.slug,e[50]=X):X=e[50];let oe;e[51]!==n?(oe=()=>n(),e[51]=n,e[52]=oe):oe=e[52];let ie;e[53]!==X||e[54]!==oe?(ie=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Ft,{to:"/$org/settings/agents",params:X,onClick:oe,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[53]=X,e[54]=oe,e[55]=ie):ie=e[55];let Se;return e[56]!==P||e[57]!==ie||e[58]!==M?(Se=s.jsxs("div",{className:W,children:[M,P,ie]}),e[56]=P,e[57]=ie,e[58]=M,e[59]=Se):Se=e[59],Se}function Ll(t){return!vn(t.id)}function Bl(t){const e=w.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:r,trigger:l,onSelectAgent:o,selectedAgentId:i,side:a,align:c}=n,d=r===void 0?!1:r,m=a===void 0?"right":a,u=c===void 0?"start":c,[f,h]=O.useState(!1),[p,x]=O.useState(!1),[g,b]=O.useState(!1),j=dt(),{setOpenMobile:v}=Ce(),y=Pn(),_=y?"border border-border":void 0;let k;e[2]!==y?(k=M=>y?s.jsx(Ml,{children:M}):M,e[2]=y,e[3]=k):k=e[3];const N=k;let C;e[4]!==j||e[5]!==v?(C=()=>{h(!1),j&&v(!1)},e[4]=j,e[5]=v,e[6]=C):C=e[6];const S=C;let z;e[7]!==S||e[8]!==o||e[9]!==f||e[10]!==i?(z=f&&s.jsx(O.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(fe,{className:"h-4 w-24"})}),children:s.jsx(Rl,{onClose:S,onOpenImportDeco:()=>x(!0),onOpenGithubImport:()=>{b(!0),S()},onSelectAgent:o,selectedAgentId:i})}),e[7]=S,e[8]=o,e[9]=f,e[10]=i,e[11]=z):z=e[11];const T=z;let A;e[12]!==u||e[13]!==d||e[14]!==_||e[15]!==y||e[16]!==j||e[17]!==f||e[18]!==T||e[19]!==m||e[20]!==l||e[21]!==N?(A=j?s.jsxs(s.Fragment,{children:[l?s.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:l}):d?N(s.jsx(xe,{"aria-label":"Browse agents",className:F(_),onClick:()=>{ae("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:s.jsx(Ae,{className:"size-4"})})):s.jsx(se,{children:N(s.jsxs(ue,{tooltip:y?void 0:"Browse agents",className:F(_),onClick:()=>{ae("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:[s.jsx(Ae,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Ht,{open:f,onOpenChange:h,direction:"bottom",children:s.jsxs(Ut,{className:"max-h-[85dvh] p-0",children:[s.jsx(Gt,{className:"sr-only",children:"Browse agents"}),T]})})]}):s.jsxs(Pe,{open:f,onOpenChange:M=>{M&&!f&&ae("agent_browser_opened",{surface:"desktop_popover"}),h(M)},children:[l?s.jsx(Ne,{asChild:!0,children:l}):d?N(s.jsx(Ne,{asChild:!0,children:s.jsx(xe,{"aria-label":"Browse agents",className:F(_),children:s.jsx(Ae,{className:"size-4"})})})):s.jsx(se,{children:N(s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:y?void 0:"Browse agents",className:F(_),children:[s.jsx(Ae,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ee,{className:"w-[380px] p-0 overflow-hidden",side:m,align:u,children:T})]}),e[12]=u,e[13]=d,e[14]=_,e[15]=y,e[16]=j,e[17]=f,e[18]=T,e[19]=m,e[20]=l,e[21]=N,e[22]=A):A=e[22];let $;e[23]!==p?($=s.jsx(ar,{open:p,onOpenChange:x}),e[23]=p,e[24]=$):$=e[24];let E;e[25]!==g?(E=s.jsx(mr,{open:g,onOpenChange:b}),e[25]=g,e[26]=E):E=e[26];let W;return e[27]!==E||e[28]!==A||e[29]!==$?(W=s.jsxs(s.Fragment,{children:[A,$,E]}),e[27]=E,e[28]=A,e[29]=$,e[30]=W):W=e[30],W}const ys="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md px-1.5 py-1 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function Hl(t){const e=w.c(19),{agentId:n,onOpenHome:r,onPick:l}=t,o=Qt(n),i=o?.title??"Decopilot",a=`Open ${i} home`,c=o?.icon??null;let d;e[0]!==c||e[1]!==i?(d=s.jsx(De,{icon:c,name:i,size:"2xs"}),e[0]=c,e[1]=i,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==a||e[5]!==d?(m=s.jsx("button",{type:"button",onClick:r,"aria-label":a,className:"wco-no-drag flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:d}),e[3]=r,e[4]=a,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==i?(u=s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:i}),e[7]=i,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ft,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=f):f=e[9];let h;e[10]!==u?(h=s.jsxs("button",{type:"button",className:ys,children:[u,f]}),e[10]=u,e[11]=h):h=e[11];let p;e[12]!==n||e[13]!==l||e[14]!==h?(p=s.jsx(Bl,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:l,trigger:h}),e[12]=n,e[13]=l,e[14]=h,e[15]=p):p=e[15];let x;return e[16]!==m||e[17]!==p?(x=s.jsxs("div",{className:"flex items-center gap-0.5",children:[m,p]}),e[16]=m,e[17]=p,e[18]=x):x=e[18],x}function Tt(){const t=w.c(34),{org:e}=de(),{state:n}=Ce(),r=n==="collapsed",l=he();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const i=ot(o);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},t[1]=a):a=t[1];const c=it(a),{threads:d}=ut(),{setTaskId:m,createNewTask:u}=mt();let f;t[2]!==e.id?(f=Ge(e.id),t[2]=e.id,t[3]=f):f=t[3];const h=f.id,p=i.taskId?c.virtualmcpid??h:h;let x;t[4]!==u||t[5]!==h||t[6]!==l||t[7]!==e.slug||t[8]!==m||t[9]!==d?(x=T=>{if(!T||T===h){l({to:"/$org",params:{org:e.slug}});return}const A=d.find($=>!$.hidden&&$.virtual_mcp_id===T&&$.title==="New chat"&&(!$.status||$.status==="in_progress"));A?m(A.id,T):u(T)},t[4]=u,t[5]=h,t[6]=l,t[7]=e.slug,t[8]=m,t[9]=d,t[10]=x):x=t[10];const g=x;let b;t[11]!==e.slug?(b={org:e.slug},t[11]=e.slug,t[12]=b):b=t[12];let j;t[13]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(te.Logo,{}),t[13]=j):j=t[13];let v;t[14]!==b?(v=s.jsx(Ft,{to:"/$org",params:b,"aria-label":"Organization home",title:"Home",className:"wco-no-drag flex items-center shrink-0 cursor-pointer rounded-md px-1 hover:bg-accent/60 transition-colors",children:j}),t[14]=b,t[15]=v):v=t[15];let y;t[16]!==e||t[17]!==r?(y=!r&&s.jsx($l,{orgParam:e.slug,trigger:s.jsxs("button",{type:"button",className:ys,children:[s.jsx(vs,{org:e,size:"xs"}),s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:e.name}),s.jsx(ft,{size:14,className:"shrink-0 text-muted-foreground opacity-70"})]})}),t[16]=e,t[17]=r,t[18]=y):y=t[18];let _;t[19]!==v||t[20]!==y?(_=s.jsxs(jt,{className:"gap-0.5",children:[v,y]}),t[19]=v,t[20]=y,t[21]=_):_=t[21];let k;t[22]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Hn,{}),t[22]=k):k=t[22];let N;t[23]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"h-4 w-24 rounded bg-muted animate-pulse"}),t[23]=N):N=t[23];let C;t[24]!==p||t[25]!==g?(C=()=>g(p),t[24]=p,t[25]=g,t[26]=C):C=t[26];let S;t[27]!==p||t[28]!==g||t[29]!==C?(S=s.jsx(jt,{children:s.jsx(O.Suspense,{fallback:N,children:s.jsx(Hl,{agentId:p,onOpenHome:C,onPick:g})})}),t[27]=p,t[28]=g,t[29]=C,t[30]=S):S=t[30];let z;return t[31]!==S||t[32]!==_?(z=s.jsx(Un,{className:"wco-no-drag",children:s.jsxs(Gn,{className:"flex-nowrap",children:[_,k,S]})}),t[31]=S,t[32]=_,t[33]=z):z=t[33],z}const Ul="sidebar.open";function Gl(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ls,{}),t[0]=e):e=t[0],e}function Li(){const t=w.c(24),e=dt(),[n,r]=We(Ul,!1),{width:l,wrapperRef:o,onStartResize:i,resetWidth:a}=pr();let c;t[0]!==e?(c=e?s.jsxs(te.Header,{className:"grid-cols-1 px-1 pr-1",children:[s.jsxs("div",{className:"grid w-full grid-cols-[auto_auto_auto_1fr_auto_auto] items-center gap-2",children:[s.jsx(es,{}),s.jsx(Tt,{}),s.jsx(rt,{}),s.jsx("div",{"aria-hidden":!0,className:"min-w-0"}),s.jsx(te.TogglesSlot,{}),s.jsx(te.TabsSlot,{className:"min-w-0 justify-self-end"})]}),s.jsx(te.CenterSlot,{}),s.jsx(te.RightSlot,{})]}):s.jsxs(te.Header,{children:[s.jsx(te.LeftColumn,{children:s.jsx(Tt,{})}),s.jsx(te.CenterSlot,{}),s.jsxs(te.RightColumn,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end",children:s.jsx(te.TabsSlot,{})}),s.jsx(te.RightSlot,{}),s.jsx(te.TogglesSlot,{})]})]}),t[0]=e,t[1]=c):c=t[1];const d=`${l}px`;let m;t[2]!==d?(m={"--sidebar-width":d,"--sidebar-width-icon":"3.5rem"},t[2]=d,t[3]=m):m=t[3];const u=m;let f;t[4]!==e||t[5]!==i||t[6]!==a?(f=!e&&s.jsxs(s.Fragment,{children:[s.jsx(Sl,{}),s.jsx(fr,{onPointerDown:i,onDoubleClick:a})]}),t[4]=e,t[5]=i,t[6]=a,t[7]=f):f=t[7];let h;t[8]===Symbol.for("react.memo_cache_sentinel")?(h={background:"transparent",containerType:"inline-size"},t[8]=h):h=t[8];let p;t[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Us,{className:"flex flex-col",style:h,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(O.Suspense,{fallback:s.jsx(Gl,{}),children:s.jsx(Rs,{})})})})}),t[9]=p):p=t[9];let x;t[10]!==u||t[11]!==f||t[12]!==o?(x=s.jsxs(Gs,{ref:o,className:"flex-1 bg-sidebar relative min-h-0",style:u,children:[f,p]}),t[10]=u,t[11]=f,t[12]=o,t[13]=x):x=t[13];let g;t[14]!==e?(g=e&&s.jsx(On,{renderSidebar:ql}),t[14]=e,t[15]=g):g=t[15];let b;t[16]!==c||t[17]!==x||t[18]!==g?(b=s.jsx(Bn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[c,x,g]})}),t[16]=c,t[17]=x,t[18]=g,t[19]=b):b=t[19];let j;return t[20]!==r||t[21]!==n||t[22]!==b?(j=s.jsx(Sn,{children:s.jsx(te.Provider,{children:s.jsx(qs,{open:n,onOpenChange:r,children:b})})}),t[20]=r,t[21]=n,t[22]=b,t[23]=j):j=t[23],j}function ql(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(Nl,{onClose:e})})})}export{Li as default};