decocms 4.17.1 → 4.17.2

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 (226) hide show
  1. package/dist/client/assets/{AlertCircle-CWgtpDgs.js → AlertCircle-DdrwwZMq.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-O2h0Esun.js → ArrowUpRight-jXBy9ipz.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-CzbMe8sq.js → CheckCircle-3ZOkMXIL.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-B0d3gCJ4.js → ChevronDown-CLx4-WM1.js} +1 -1
  5. package/dist/client/assets/{ChevronRight-D8G4YOXh.js → ChevronRight-jYKilAXW.js} +1 -1
  6. package/dist/client/assets/{ChevronUp-2KGxjR7x.js → ChevronUp-BGt4chTY.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-B-sq-ide.js → DotsVertical-CqrNmdxL.js} +1 -1
  8. package/dist/client/assets/{Eye-DmGPRR_e.js → Eye-o5yQXJvl.js} +1 -1
  9. package/dist/client/assets/{FilterLines-DEMLsHE0.js → FilterLines-CDGBU4Yu.js} +1 -1
  10. package/dist/client/assets/{Globe01-DO0D_c2f.js → Globe01-CcG20jKe.js} +1 -1
  11. package/dist/client/assets/{Globe04-XJoX6kmZ.js → Globe04-Cv_V-Fs_.js} +1 -1
  12. package/dist/client/assets/{HardDrive-BICUWfOq.js → HardDrive-BSIK0u4A.js} +1 -1
  13. package/dist/client/assets/{Key01-BtQzPiv-.js → Key01-DgIKoZGo.js} +1 -1
  14. package/dist/client/assets/{LayoutLeft-Bi6Cd7VR.js → LayoutLeft-Ck3c6EbZ.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-CB818nxD.js → LinkExternal01-C4RHyT_k.js} +1 -1
  16. package/dist/client/assets/{Monitor01-DG_zJQKB.js → Monitor01-CWIDsYmm.js} +1 -1
  17. package/dist/client/assets/{Palette-D5uFHHtD.js → Palette-BFwjtSY1.js} +1 -1
  18. package/dist/client/assets/{Play-8mfsN5e2.js → Play-DqQKGu-U.js} +1 -1
  19. package/dist/client/assets/{Plus-tW6PYhLA.js → Plus-DZiClNST.js} +1 -1
  20. package/dist/client/assets/{SearchLg-BRB4E-a6.js → SearchLg-CaS6w27I.js} +1 -1
  21. package/dist/client/assets/{SearchMd-DCtxyy_L.js → SearchMd-CYoVQBZq.js} +1 -1
  22. package/dist/client/assets/{Settings02-CYQjLDZe.js → Settings02-C-6P9tLl.js} +1 -1
  23. package/dist/client/assets/{Shield01-BmIMMGLU.js → Shield01-B3rvsBtl.js} +1 -1
  24. package/dist/client/assets/{Star01-BiHTCvVR.js → Star01-CkOKT_Ec.js} +1 -1
  25. package/dist/client/assets/{Stars01-BoOQBwEf.js → Stars01-sPe6wVRL.js} +1 -1
  26. package/dist/client/assets/{Stars02-DBhfsTYG.js → Stars02-YL1S7hw5.js} +1 -1
  27. package/dist/client/assets/{Sun-YyXJklY4.js → Sun-CX24eczl.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-DCwK87MF.js → SwitchHorizontal01-1JfD3pEr.js} +1 -1
  29. package/dist/client/assets/{Tool01-D68BO4Z1.js → Tool01-84S8urW1.js} +1 -1
  30. package/dist/client/assets/{Trash01-BDaXEXf_.js → Trash01-oru1b8W8.js} +1 -1
  31. package/dist/client/assets/{Upload01-B14hHeGP.js → Upload01-Cou_1dwr.js} +1 -1
  32. package/dist/client/assets/{User01-D26yJD3f.js → User01-BL-jdznB.js} +1 -1
  33. package/dist/client/assets/{Users01-DcpQUESq.js → Users01-CvViXbMH.js} +1 -1
  34. package/dist/client/assets/{Users03-DdlXwWfA.js → Users03-B-JAgn9g.js} +1 -1
  35. package/dist/client/assets/{X-C54nvkaE.js → X-D1xM7jXL.js} +1 -1
  36. package/dist/client/assets/{XCircle-DMTFcHqR.js → XCircle-D1ibZ16t.js} +1 -1
  37. package/dist/client/assets/{XClose-DnDy-OvD.js → XClose-D0Zu_lRC.js} +1 -1
  38. package/dist/client/assets/{Zap-DtiJN-LC.js → Zap-Bo8lb0F-.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-BOyZ6Rgl.js → ZapSquare-B4AjMOPu.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-BVzIyFeW.js → ZoomOut-DfCeUHFX.js} +1 -1
  41. package/dist/client/assets/{access-gate-CahH-m4n.js → access-gate-CRTZfiyx.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-BmSyVksR.js → add-section-modal-t6NTp3dt.js} +1 -1
  43. package/dist/client/assets/{agent-capabilities-2TzzHD_U.js → agent-capabilities-BDCwG9Eh.js} +1 -1
  44. package/dist/client/assets/agent-icon-C1BWispo.js +1 -0
  45. package/dist/client/assets/{agents-list-DK_ZBuLv.js → agents-list-D2wP1uld.js} +1 -1
  46. package/dist/client/assets/ai-providers-D8gEIycW.js +1 -0
  47. package/dist/client/assets/{alert-BY6dLNYK.js → alert-DAyg3TSF.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-depKBGzY.js → alert-dialog-ha1v59qY.js} +2 -2
  49. package/dist/client/assets/app-editor-3RKJRSU7.js +1 -0
  50. package/dist/client/assets/{auth-catchall-3AJlIltf.js → auth-catchall-B-EHVfUd.js} +1 -1
  51. package/dist/client/assets/{auth-entry-CN6penGo.js → auth-entry-BFuuwZkf.js} +1 -1
  52. package/dist/client/assets/{auth-JzTDloGx.js → auth-ou2428Bw.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-DG4yNxsb.js → auth-split-layout-lfv3bwPm.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-DBxyWtpZ.js → authenticate-and-persist-oauth-B3lWqExf.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-BIgl3VhR.js → automation-list-row-DUKMiAFn.js} +1 -1
  56. package/dist/client/assets/{automation-runs-DT5n-ItD.js → automation-runs-HEfBB2IO.js} +1 -1
  57. package/dist/client/assets/{automations-CkBsMFYI.js → automations-DcVo9aht.js} +1 -1
  58. package/dist/client/assets/{avatar-CQ--7kDr.js → avatar-tYV7Xj5e.js} +1 -1
  59. package/dist/client/assets/{badge-Cu9Vf21V.js → badge-DjU6bfHE.js} +1 -1
  60. package/dist/client/assets/{block-document-6rmSaazN.js → block-document-CYnqjTQ5.js} +1 -1
  61. package/dist/client/assets/{brand-context-Bx9fuG7L.js → brand-context-D5KhJzF5.js} +1 -1
  62. package/dist/client/assets/{breadcrumb-Iv2RnKdx.js → breadcrumb-C_jNPElt.js} +1 -1
  63. package/dist/client/assets/{buckets-DhP3Px4o.js → buckets-Bi6Dz7dc.js} +1 -1
  64. package/dist/client/assets/{bulk-category-panel-Ry5Wrf4t.js → bulk-category-panel-CQyTVuMJ.js} +1 -1
  65. package/dist/client/assets/{capability-load-error-CZgYniY2.js → capability-load-error-B4T1DTOe.js} +1 -1
  66. package/dist/client/assets/{card-BtxpfIMO.js → card-BcWpe7XA.js} +1 -1
  67. package/dist/client/assets/category-editor-CHiWWzkP.js +1 -0
  68. package/dist/client/assets/{chat-context-BXYlU18c.js → chat-context-BXvC8snN.js} +1 -1
  69. package/dist/client/assets/{checkbox-_ejCMjxu.js → checkbox-BGLrFwOD.js} +1 -1
  70. package/dist/client/assets/{cli-auth-success-JyzfdETB.js → cli-auth-success-SPj5zX1c.js} +1 -1
  71. package/dist/client/assets/{collection-detail-Bs_bKbq1.js → collection-detail-ClK5ckvV.js} +1 -1
  72. package/dist/client/assets/{collection-display-button-x3VETGSA.js → collection-display-button-AdaNOeng.js} +1 -1
  73. package/dist/client/assets/{collection-search-CVteq94G.js → collection-search-BWPhJb0W.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-DHih69-0.js → collection-tabs-LbK97vzL.js} +1 -1
  75. package/dist/client/assets/{command-B9iUw_Wf.js → command-BrahLBH2.js} +1 -1
  76. package/dist/client/assets/{commerce-onboarding-D7yN_rh5.js → commerce-onboarding-BY8ZIbvj.js} +1 -1
  77. package/dist/client/assets/{connect-desktop-dialog-BP-u_roi.js → connect-desktop-dialog-wN68EGmx.js} +1 -1
  78. package/dist/client/assets/{connection-card-syvtXQo3.js → connection-card-CS0ZRcyq.js} +1 -1
  79. package/dist/client/assets/{connection-detail-LdZiPrUN.js → connection-detail-6cGe5AzW.js} +1 -1
  80. package/dist/client/assets/{connection-form-helpers-NLjgFKGu.js → connection-form-helpers--RFzi4SS.js} +1 -1
  81. package/dist/client/assets/{connections-CFiPE6LL.js → connections-BM_4XV1f.js} +1 -1
  82. package/dist/client/assets/{decopilot-BzscZwEe.js → decopilot-DitDP2XU.js} +1 -1
  83. package/dist/client/assets/{decopilot-sse-pool-4ct7M3nK.js → decopilot-sse-pool-DrXwOdO1.js} +1 -1
  84. package/dist/client/assets/{dialog-a5ZkDZhy.js → dialog-DaSKz7DM.js} +1 -1
  85. package/dist/client/assets/{domain-settings-C3cSnSXe.js → domain-settings-BssGRdmx.js} +1 -1
  86. package/dist/client/assets/{drawer-CKH1wPOe.js → drawer-DdiW0TLs.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-BsT801zR.js → dropdown-menu-5pJpeeqf.js} +1 -1
  88. package/dist/client/assets/{empty-state-Cd23QDa9.js → empty-state-B08-kVr_.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data--lA2dih1.js → extract-connection-data-X711B5tE.js} +1 -1
  90. package/dist/client/assets/file-explorer-CXo4_clT.js +2 -0
  91. package/dist/client/assets/{file-type-icon-BpvAmzSL.js → file-type-icon-Cm6D0wrz.js} +1 -1
  92. package/dist/client/assets/{files-DmRhHPaD.js → files-K9oI8c_-.js} +1 -1
  93. package/dist/client/assets/{form-B8xO7s3Q.js → form-D1efg8C-.js} +1 -1
  94. package/dist/client/assets/{general-BerFQJYO.js → general-BSA7tAJi.js} +1 -1
  95. package/dist/client/assets/{github-repo-picker-CNVz0qrC.js → github-repo-picker-CXt90kMG.js} +1 -1
  96. package/dist/client/assets/{hooks-DFBNXh69.js → hooks-BgBnOJ3c.js} +1 -1
  97. package/dist/client/assets/{import-from-deco-dialog-DdhvtCEU.js → import-from-deco-dialog-P6TRPQ14.js} +1 -1
  98. package/dist/client/assets/index-8NfBTjo_.js +1 -0
  99. package/dist/client/assets/{index-PDu5YsgJ.js → index-B96RsdAE.js} +1 -1
  100. package/dist/client/assets/{index-CBxJPtyP.js → index-BtaxzVR0.js} +1 -1
  101. package/dist/client/assets/{index-DJkBk8Ax.js → index-C3i4LyhT.js} +1 -1
  102. package/dist/client/assets/{index-DGvdL2uz.js → index-D3ZbfB7L.js} +1 -1
  103. package/dist/client/assets/{index-NOL0uTvV.js → index-D9Jl2teh.js} +1 -1
  104. package/dist/client/assets/{index-DIWWb6ZU.js → index-Da2BgJQV.js} +1 -1
  105. package/dist/client/assets/{index-Dzrzv-LN.js → index-DikJYrmI.js} +1 -1
  106. package/dist/client/assets/{index-COdjrItE.js → index-YOEpEUyS.js} +1 -1
  107. package/dist/client/assets/{index-BEAvVWMY.js → index-YqfRemtU.js} +13 -13
  108. package/dist/client/assets/{index-BmhWpNA2.js → index-cif87MVR.js} +1 -1
  109. package/dist/client/assets/{index-Dn1UY3fg.js → index-pn1YPMKj.js} +1 -1
  110. package/dist/client/assets/{index-DIyNSN96.js → index-qfheH9Xc.js} +26 -26
  111. package/dist/client/assets/{index-redirect-B55CPpl6.js → index-redirect-DdgddsNH.js} +1 -1
  112. package/dist/client/assets/{input-CaPkg-tG.js → input-c3bkJxBD.js} +1 -1
  113. package/dist/client/assets/{integration-icon-BVqUmyhK.js → integration-icon-DsTjAPrY.js} +1 -1
  114. package/dist/client/assets/{label-D0Oq_enN.js → label-C-M0DX5a.js} +1 -1
  115. package/dist/client/assets/{library-tab-pbqcFRtG.js → library-tab-D1dP6e2l.js} +1 -1
  116. package/dist/client/assets/{login-CsVa9y82.js → login-DMQTn7wh.js} +1 -1
  117. package/dist/client/assets/{mcp-oauth-DkfCvuSl.js → mcp-oauth-D8P2QaWG.js} +1 -1
  118. package/dist/client/assets/{members-DVCX1OGf.js → members-B3Jf-1QZ.js} +1 -1
  119. package/dist/client/assets/{monaco-editor-CQvQ4wyD.js → monaco-editor-Bn7nTC-y.js} +1 -1
  120. package/dist/client/assets/{monitoring-stats-row-N_7BtDVw.js → monitoring-stats-row-D2SCaVP_.js} +1 -1
  121. package/dist/client/assets/{oauth-callback-ai-provider-JgWSWhQO.js → oauth-callback-ai-provider-BrGx-toi.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-C_nBi9hb.js → oauth-callback-arRRISlw.js} +1 -1
  123. package/dist/client/assets/{onboarding-CRvfQK7U.js → onboarding-DfQssXGo.js} +1 -1
  124. package/dist/client/assets/{org-install-DlfY4HcA.js → org-install-CAxOgyNR.js} +1 -1
  125. package/dist/client/assets/{org-layout-BNkJ-PnS.js → org-layout-C7RcAVm5.js} +1 -1
  126. package/dist/client/assets/{organization-choice-C3OXP1wc.js → organization-choice-aXwHBCUC.js} +1 -1
  127. package/dist/client/assets/{page-seo-form-DtixMLnX.js → page-seo-form-DTBhJgv0.js} +1 -1
  128. package/dist/client/assets/page-seo-sheet-DSFzu1g0.js +1 -0
  129. package/dist/client/assets/{popover-Q1EdqSJG.js → popover-DvGqLTJl.js} +1 -1
  130. package/dist/client/assets/post-editor-C-KR7OSD.js +1 -0
  131. package/dist/client/assets/{primitives-Dn_2KW04.js → primitives-Cbyyj3A3.js} +1 -1
  132. package/dist/client/assets/{profile-C2BABr7w.js → profile-eglAZx5J.js} +1 -1
  133. package/dist/client/assets/project-app-view-BZfBTk7X.js +1 -0
  134. package/dist/client/assets/record-editor-lkwoQjs9.js +1 -0
  135. package/dist/client/assets/registry-_cXAc0hk.js +2 -0
  136. package/dist/client/assets/{registry-layout-C4d4IZ2d.js → registry-layout-hOf6zsxt.js} +1 -1
  137. package/dist/client/assets/{require-capability-DwU8Ss9R.js → require-capability-XNz95caz.js} +1 -1
  138. package/dist/client/assets/{required-auth-layout-C_pN8svZ.js → required-auth-layout-CrFETKOt.js} +1 -1
  139. package/dist/client/assets/{reset-password-tIJsS-gp.js → reset-password-DvMp7JEU.js} +1 -1
  140. package/dist/client/assets/{roles-BK-t6UPP.js → roles-HzDtUpXH.js} +1 -1
  141. package/dist/client/assets/{scroll-area-DSkli5k_.js → scroll-area-Bkg-mZA1.js} +1 -1
  142. package/dist/client/assets/{search-input-BiiOvDrk.js → search-input-Csys3Koh.js} +1 -1
  143. package/dist/client/assets/{secrets-CNbF_xMH.js → secrets-Bc04lDOi.js} +1 -1
  144. package/dist/client/assets/{sections-editor-CBzzlQi2.js → sections-editor-DMIuM8hP.js} +1 -1
  145. package/dist/client/assets/{select-z6yZBkEp.js → select-CyjV0F4C.js} +1 -1
  146. package/dist/client/assets/{select-model-CxlVTA2J.js → select-model-DkNEmCB-.js} +1 -1
  147. package/dist/client/assets/seo-editor-CXv7fPuW.js +1 -0
  148. package/dist/client/assets/{settings-layout-B89sZDAn.js → settings-layout-CqQSdUJ1.js} +1 -1
  149. package/dist/client/assets/{settings-section-Cn_5NRzd.js → settings-section-CWGTzuvV.js} +1 -1
  150. package/dist/client/assets/{sheet-B0u11yoj.js → sheet-DuOoVZUG.js} +1 -1
  151. package/dist/client/assets/{shell-controls-CYHtSsaG.js → shell-controls-_ERLWSRt.js} +1 -1
  152. package/dist/client/assets/{shell-layout-BCl91e2n.js → shell-layout-DbD_tkNz.js} +1 -1
  153. package/dist/client/assets/{sidebar-haKmZZ-W.js → sidebar-Dk_5AbOf.js} +1 -1
  154. package/dist/client/assets/{skeleton-BuPVKDK7.js → skeleton-erh5yXDG.js} +1 -1
  155. package/dist/client/assets/{sso-CWL1a3Ph.js → sso-CA0aW0DE.js} +1 -1
  156. package/dist/client/assets/{store-Cca_yMwP.js → store-fNZRBFZQ.js} +1 -1
  157. package/dist/client/assets/store-registry-Bfou8ECl.js +2 -0
  158. package/dist/client/assets/{studio-tools-Bs0xo1Z2.js → studio-tools-BaSvhr-J.js} +1 -1
  159. package/dist/client/assets/{switch-xjp3ajZN.js → switch-BHo8xs7D.js} +1 -1
  160. package/dist/client/assets/{table-CyATWOpP.js → table-7NpUUPTt.js} +1 -1
  161. package/dist/client/assets/{tabs-ChaZLm39.js → tabs-MyyL-fGu.js} +1 -1
  162. package/dist/client/assets/task-row-CSJH3BP-.js +1 -0
  163. package/dist/client/assets/{task-status-DTdpp4Y7.js → task-status-CcNy4g07.js} +1 -1
  164. package/dist/client/assets/{textarea-CvJkxwG_.js → textarea-DE7i4Gz-.js} +1 -1
  165. package/dist/client/assets/{toggle-group-C5lfVqY9.js → toggle-group-BPcVs9aZ.js} +1 -1
  166. package/dist/client/assets/{toolbar-DfZcXUSS.js → toolbar-DO76WyPk.js} +1 -1
  167. package/dist/client/assets/{toolbar-icon-button-BJjnMzvJ.js → toolbar-icon-button-CRc66nZ-.js} +1 -1
  168. package/dist/client/assets/tools-list-Bq5PisM1.js +1 -0
  169. package/dist/client/assets/{tooltip-Dn6TT4fb.js → tooltip-CBYM2iV5.js} +1 -1
  170. package/dist/client/assets/{types-CZ4rLOEl.js → types-BxTesI-C.js} +5 -5
  171. package/dist/client/assets/{use-ai-providers-zyN1ygBC.js → use-ai-providers-BLBRqrOl.js} +1 -1
  172. package/dist/client/assets/{use-automations-DME2P9Yb.js → use-automations-5UyPQOVR.js} +1 -1
  173. package/dist/client/assets/{use-capability-BKrWdNMG.js → use-capability-BOo3wKB9.js} +1 -1
  174. package/dist/client/assets/{use-clock-tick-nZuMTIzb.js → use-clock-tick-DpMHy-Ay.js} +1 -1
  175. package/dist/client/assets/{use-collections-BS7_MipP.js → use-collections-CQf58LpF.js} +1 -1
  176. package/dist/client/assets/{use-connection-Cs21veSc.js → use-connection-BuG3o_JE.js} +1 -1
  177. package/dist/client/assets/{use-copy-CY1tiWSY.js → use-copy-jWg55WQ8.js} +1 -1
  178. package/dist/client/assets/{use-create-virtual-mcp-BRn7Xglj.js → use-create-virtual-mcp-LuXF-lyt.js} +1 -1
  179. package/dist/client/assets/{use-debounced-autosave-Cl9vOVRq.js → use-debounced-autosave-BlFX0cfT.js} +1 -1
  180. package/dist/client/assets/{use-debounced-value-fFVCMUXm.js → use-debounced-value-Df6CEQAw.js} +1 -1
  181. package/dist/client/assets/{use-decopilot-events-CtfZfAhc.js → use-decopilot-events-uI4wGrsY.js} +1 -1
  182. package/dist/client/assets/{use-delete-connection-B695Tef1.js → use-delete-connection-UF4lOt5V.js} +1 -1
  183. package/dist/client/assets/{use-file-configs-DxHSl6ZD.js → use-file-configs-Bs9D0249.js} +1 -1
  184. package/dist/client/assets/{use-infinite-scroll-BUhxpG1i.js → use-infinite-scroll-DlYly1rf.js} +1 -1
  185. package/dist/client/assets/{use-join-requests-COO3fg4J.js → use-join-requests-B315-fOS.js} +1 -1
  186. package/dist/client/assets/{use-mcp-client-tU9_Q31R.js → use-mcp-client-CpnbLiac.js} +2 -2
  187. package/dist/client/assets/{use-mcp-prompts-CVL6RAIG.js → use-mcp-prompts-B5dgZtuY.js} +1 -1
  188. package/dist/client/assets/{use-mcp-tools-B2LI7RR7.js → use-mcp-tools-DpNh0INt.js} +1 -1
  189. package/dist/client/assets/{use-members-Bm9KhrJN.js → use-members-BRjOC4BL.js} +1 -1
  190. package/dist/client/assets/{use-mobile-Dd_g0aui.js → use-mobile-BnJF8Qa_.js} +1 -1
  191. package/dist/client/assets/{use-navigate-to-agent-KaAiMohr.js → use-navigate-to-agent-CI_L2BEy.js} +1 -1
  192. package/dist/client/assets/{use-org-auth-client-CqXitYKc.js → use-org-auth-client-DmjZpfi2.js} +1 -1
  193. package/dist/client/assets/{use-org-sso-2HCpkr8C.js → use-org-sso-B_xa25Ag.js} +1 -1
  194. package/dist/client/assets/{use-organization-roles-D4lESRwM.js → use-organization-roles-BO6fS6vf.js} +1 -1
  195. package/dist/client/assets/{use-organization-settings-DrjygbOR.js → use-organization-settings-DtUUny9s.js} +1 -1
  196. package/dist/client/assets/{use-registry-connections-D1C6nHHR.js → use-registry-connections-CLetM4Ks.js} +1 -1
  197. package/dist/client/assets/{use-secrets-CLseSmaH.js → use-secrets-CuFzitLe.js} +1 -1
  198. package/dist/client/assets/{use-status-sounds-DX4ADJSs.js → use-status-sounds-4tbPTgQW.js} +1 -1
  199. package/dist/client/assets/{use-view-mode-CIr8WEyc.js → use-view-mode-C2fVP0l9.js} +1 -1
  200. package/dist/client/assets/{use-virtual-mcp-WZNqIa1a.js → use-virtual-mcp-OVYXqA3Z.js} +1 -1
  201. package/dist/client/assets/useInfiniteQuery-CgWnzkKu.js +1 -0
  202. package/dist/client/assets/useSuspenseInfiniteQuery-DtkXwhfE.js +1 -0
  203. package/dist/client/assets/{useSuspenseQueries-84o7R4r8.js → useSuspenseQueries-g4R4jK3t.js} +1 -1
  204. package/dist/client/assets/{variant-calendar-Dzqm1NJv.js → variant-calendar-amJKLF4x.js} +1 -1
  205. package/dist/client/assets/{view-mode-toggle-C24MUWOu.js → view-mode-toggle-DGsaaoN8.js} +1 -1
  206. package/dist/client/index.html +1 -1
  207. package/dist/server/cli.js +1 -1
  208. package/dist/server/server.js +1 -1
  209. package/package.json +1 -1
  210. package/dist/client/assets/agent-icon-XUhQzRLX.js +0 -1
  211. package/dist/client/assets/ai-providers-DlWOFrVq.js +0 -1
  212. package/dist/client/assets/app-editor-DcpXXBks.js +0 -1
  213. package/dist/client/assets/category-editor-B79PzaJo.js +0 -1
  214. package/dist/client/assets/file-explorer-DIYnWmFv.js +0 -2
  215. package/dist/client/assets/index-xcUq28N4.js +0 -1
  216. package/dist/client/assets/page-seo-sheet-DQkpfhcZ.js +0 -1
  217. package/dist/client/assets/post-editor-BxN87jA0.js +0 -1
  218. package/dist/client/assets/project-app-view-E9wqVY5b.js +0 -1
  219. package/dist/client/assets/record-editor-ZFaj6Wi4.js +0 -1
  220. package/dist/client/assets/registry-TjO0PApk.js +0 -2
  221. package/dist/client/assets/seo-editor-BENQBDhy.js +0 -1
  222. package/dist/client/assets/shell-route-loading-D29sfZCo.js +0 -1
  223. package/dist/client/assets/store-registry-Bn93Vvrq.js +0 -2
  224. package/dist/client/assets/tools-list-BKWr5wCK.js +0 -1
  225. package/dist/client/assets/useInfiniteQuery-CG1m_ZaE.js +0 -1
  226. package/dist/client/assets/useSuspenseInfiniteQuery-9_oq2OeL.js +0 -1
@@ -1 +1 @@
1
- import{b as M,G as $,m as U,p as Q,n as Y,d as q,v as P,t as w,K as L,j as n,a0 as I,o as Z,s as k,c as E,r as T,B as H,L as B,y as J}from"./index-DIyNSN96.js";import{P as N}from"./index-Dn1UY3fg.js";import{u as W}from"./use-org-auth-client-CqXitYKc.js";import{u as X}from"./use-debounced-autosave-Cl9vOVRq.js";import{A as ee}from"./avatar-CQ--7kDr.js";import{I as V}from"./input-CaPkg-tG.js";import{S as G,a as K,b as A,c as te}from"./settings-section-Cn_5NRzd.js";import{D as ne}from"./domain-settings-C3cSnSXe.js";import{u as ae}from"./studio-tools-Bs0xo1Z2.js";import{c as se,b as oe,d as ie,A as re,e as le,g as ce,a as ue,f as de}from"./alert-dialog-depKBGzY.js";import{R as me}from"./require-capability-DwU8Ss9R.js";import"./sidebar-haKmZZ-W.js";import"./LayoutLeft-Bi6Cd7VR.js";import"./use-mobile-Dd_g0aui.js";import"./sheet-B0u11yoj.js";import"./X-C54nvkaE.js";import"./tooltip-Dn6TT4fb.js";import"./User01-D26yJD3f.js";import"./card-BtxpfIMO.js";import"./ArrowUpRight-O2h0Esun.js";import"./badge-Cu9Vf21V.js";import"./select-z6yZBkEp.js";import"./ChevronUp-2KGxjR7x.js";import"./ChevronDown-B0d3gCJ4.js";import"./use-capability-BKrWdNMG.js";import"./access-gate-CahH-m4n.js";import"./capability-load-error-CZgYniY2.js";const ge=Z({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function fe(e){const t=E.c(13),{value:v,onChange:h,name:o,disabled:d}=e,m=T.useRef(null);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>m.current?.click(),t[0]=l):l=t[0];const r=l;let c;t[1]!==h?(c=x=>{const j=x.target.files?.[0];if(!j)return;if(j.size>2097152){w.error("Image must be smaller than 2MB");return}const u=new FileReader;u.onerror=pe,u.onloadend=()=>{u.result&&h(u.result),m.current&&(m.current.value="")},u.readAsDataURL(j)},t[1]=h,t[2]=c):c=t[2];const a=c;let s;t[3]!==d||t[4]!==a?(s=n.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:d}),t[3]=d,t[4]=a,t[5]=s):s=t[5];const i=v||void 0,p=o??"?";let g;t[6]!==i||t[7]!==p?(g=n.jsx(ee,{url:i,fallback:p,shape:"square",size:"base"}),t[6]=i,t[7]=p,t[8]=g):g=t[8];let f;return t[9]!==d||t[10]!==s||t[11]!==g?(f=n.jsxs("button",{type:"button",onClick:r,disabled:d,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=d,t[10]=s,t[11]=g,t[12]=f):f=t[12],f}function pe(){return w.error("Failed to read image")}function he(){const e=M(),{org:t}=$(),v=W(),h=U(),o=Q({resolver:Y(ge),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),d=q({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const i=await v.organization.update({data:s});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(a,s)=>{P("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:L.organizations()}),h.invalidateQueries({queryKey:L.activeOrganization(t.slug)}),w.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{P("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),w.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:m,flush:l}=X({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const i=o.getValues(),p=o.control._defaultValues;o.reset(i,{keepValues:!0});try{await d.mutateAsync(i)}catch{o.reset(p,{keepValues:!0})}}}),r=o.formState.errors,c=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(G,{children:n.jsxs(K,{children:[n.jsx(A,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(fe,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),l()},name:o.watch("name")})}),n.jsx(A,{title:"Name",action:n.jsx(I,{control:o.control,name:"name",render:({field:a})=>n.jsx(V,{id:"org-name",...a,onChange:s=>{a.onChange(s),m()},onBlur:()=>{a.onBlur(),l()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(A,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[c&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:c}),n.jsx(I,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const i=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),m()},onBlur:()=>{a.onBlur(),l()}})})]})}),(r.name||r.slug||r.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&n.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&n.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&n.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function xe(){const e=E.c(42),{org:t}=$(),[v,h]=T.useState(!1),[o,d]=T.useState(""),m=ae();let l;e[0]!==t.id||e[1]!==m?(l=async()=>{await m.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=m,e[2]=l):l=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{P("organization_deleted",{organization_id:t.id}),localStorage.getItem(B.lastOrgSlug())===t.slug&&localStorage.removeItem(B.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c={mutationFn:l,onSuccess:r,onError:je},e[6]=l,e[7]=r,e[8]=c):c=e[8];const a=q(c);let s;e[9]===Symbol.for("react.memo_cache_sentinel")?(s=()=>h(!0),e[9]=s):s=e[9];let i;e[10]!==a.isPending?(i=n.jsx(G,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(K,{className:"border-destructive/40",children:n.jsx(A,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(H,{variant:"destructive",size:"sm",onClick:s,disabled:a.isPending,children:"Delete"})})})}),e[10]=a.isPending,e[11]=i):i=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=O=>{h(O),O||d("")},e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(se,{children:"Delete Organization?"}),e[13]=g):g=e[13];let f;e[14]!==t.name?(f=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=f):f=e[15];let x;e[16]!==t.name?(x=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=O=>d(O.target.value),e[18]=j):j=e[18];let u;e[19]!==o||e[20]!==t.name?(u=n.jsx(V,{value:o,onChange:j,placeholder:t.name,autoFocus:!0}),e[19]=o,e[20]=t.name,e[21]=u):u=e[21];let y;e[22]!==u||e[23]!==f||e[24]!==x?(y=n.jsxs(oe,{children:[g,n.jsx(ie,{asChild:!0,children:n.jsxs("div",{children:[f,x,u]})})]}),e[22]=u,e[23]=f,e[24]=x,e[25]=y):y=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(re,{children:"Cancel"}),e[26]=D):D=e[26];let b;e[27]!==a?(b=()=>a.mutate(),e[27]=a,e[28]=b):b=e[28];const F=o!==t.name||a.isPending,R=a.isPending?"Deleting…":"Delete organization";let S;e[29]!==b||e[30]!==F||e[31]!==R?(S=n.jsxs(le,{children:[D,n.jsx(ce,{onClick:b,disabled:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=b,e[30]=F,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==y||e[34]!==S?(z=n.jsxs(ue,{children:[y,S]}),e[33]=y,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==v||e[37]!==z?(C=n.jsx(de,{open:v,onOpenChange:p,children:z}),e[36]=v,e[37]=z,e[38]=C):C=e[38];let _;return e[39]!==C||e[40]!==i?(_=n.jsxs(n.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=_):_=e[41],_}function je(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ve(){const e=E.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(N.Content,{children:n.jsx(N.Body,{children:n.jsxs(te,{children:[n.jsx(N.Title,{children:"Organization"}),n.jsx(he,{}),n.jsx(ne,{}),n.jsx(xe,{})]})})})}),e[0]=t):t=e[0],t}function Qe(){const e=E.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(me,{capability:"org:manage",area:"general settings",children:n.jsx(ve,{})}),e[0]=t):t=e[0],t}export{Qe as default};
1
+ import{b as M,G as $,m as U,p as Q,n as Y,d as q,v as P,t as w,K as L,j as n,a1 as I,o as Z,s as k,c as E,r as T,B as H,L as B,y as J}from"./index-qfheH9Xc.js";import{P as N}from"./index-pn1YPMKj.js";import{u as W}from"./use-org-auth-client-DmjZpfi2.js";import{u as X}from"./use-debounced-autosave-BlFX0cfT.js";import{A as ee}from"./avatar-tYV7Xj5e.js";import{I as V}from"./input-c3bkJxBD.js";import{S as G,a as K,b as A,c as te}from"./settings-section-CWGTzuvV.js";import{D as ne}from"./domain-settings-BssGRdmx.js";import{u as ae}from"./studio-tools-BaSvhr-J.js";import{c as se,b as oe,d as ie,A as re,e as le,g as ce,a as ue,f as de}from"./alert-dialog-ha1v59qY.js";import{R as me}from"./require-capability-XNz95caz.js";import"./sidebar-Dk_5AbOf.js";import"./LayoutLeft-Ck3c6EbZ.js";import"./use-mobile-BnJF8Qa_.js";import"./sheet-DuOoVZUG.js";import"./X-D1xM7jXL.js";import"./tooltip-CBYM2iV5.js";import"./User01-BL-jdznB.js";import"./card-BcWpe7XA.js";import"./ArrowUpRight-jXBy9ipz.js";import"./badge-DjU6bfHE.js";import"./select-CyjV0F4C.js";import"./ChevronUp-BGt4chTY.js";import"./ChevronDown-CLx4-WM1.js";import"./use-capability-BOo3wKB9.js";import"./access-gate-CRTZfiyx.js";import"./capability-load-error-B4T1DTOe.js";const ge=Z({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function fe(e){const t=E.c(13),{value:v,onChange:h,name:o,disabled:d}=e,m=T.useRef(null);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>m.current?.click(),t[0]=l):l=t[0];const r=l;let c;t[1]!==h?(c=x=>{const j=x.target.files?.[0];if(!j)return;if(j.size>2097152){w.error("Image must be smaller than 2MB");return}const u=new FileReader;u.onerror=pe,u.onloadend=()=>{u.result&&h(u.result),m.current&&(m.current.value="")},u.readAsDataURL(j)},t[1]=h,t[2]=c):c=t[2];const a=c;let s;t[3]!==d||t[4]!==a?(s=n.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:d}),t[3]=d,t[4]=a,t[5]=s):s=t[5];const i=v||void 0,p=o??"?";let g;t[6]!==i||t[7]!==p?(g=n.jsx(ee,{url:i,fallback:p,shape:"square",size:"base"}),t[6]=i,t[7]=p,t[8]=g):g=t[8];let f;return t[9]!==d||t[10]!==s||t[11]!==g?(f=n.jsxs("button",{type:"button",onClick:r,disabled:d,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=d,t[10]=s,t[11]=g,t[12]=f):f=t[12],f}function pe(){return w.error("Failed to read image")}function he(){const e=M(),{org:t}=$(),v=W(),h=U(),o=Q({resolver:Y(ge),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),d=q({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const i=await v.organization.update({data:s});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(a,s)=>{P("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:L.organizations()}),h.invalidateQueries({queryKey:L.activeOrganization(t.slug)}),w.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{P("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),w.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:m,flush:l}=X({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const i=o.getValues(),p=o.control._defaultValues;o.reset(i,{keepValues:!0});try{await d.mutateAsync(i)}catch{o.reset(p,{keepValues:!0})}}}),r=o.formState.errors,c=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(G,{children:n.jsxs(K,{children:[n.jsx(A,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(fe,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),l()},name:o.watch("name")})}),n.jsx(A,{title:"Name",action:n.jsx(I,{control:o.control,name:"name",render:({field:a})=>n.jsx(V,{id:"org-name",...a,onChange:s=>{a.onChange(s),m()},onBlur:()=>{a.onBlur(),l()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(A,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[c&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:c}),n.jsx(I,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const i=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),m()},onBlur:()=>{a.onBlur(),l()}})})]})}),(r.name||r.slug||r.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&n.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&n.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&n.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function xe(){const e=E.c(42),{org:t}=$(),[v,h]=T.useState(!1),[o,d]=T.useState(""),m=ae();let l;e[0]!==t.id||e[1]!==m?(l=async()=>{await m.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=m,e[2]=l):l=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{P("organization_deleted",{organization_id:t.id}),localStorage.getItem(B.lastOrgSlug())===t.slug&&localStorage.removeItem(B.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c={mutationFn:l,onSuccess:r,onError:je},e[6]=l,e[7]=r,e[8]=c):c=e[8];const a=q(c);let s;e[9]===Symbol.for("react.memo_cache_sentinel")?(s=()=>h(!0),e[9]=s):s=e[9];let i;e[10]!==a.isPending?(i=n.jsx(G,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(K,{className:"border-destructive/40",children:n.jsx(A,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(H,{variant:"destructive",size:"sm",onClick:s,disabled:a.isPending,children:"Delete"})})})}),e[10]=a.isPending,e[11]=i):i=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=O=>{h(O),O||d("")},e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(se,{children:"Delete Organization?"}),e[13]=g):g=e[13];let f;e[14]!==t.name?(f=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=f):f=e[15];let x;e[16]!==t.name?(x=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=O=>d(O.target.value),e[18]=j):j=e[18];let u;e[19]!==o||e[20]!==t.name?(u=n.jsx(V,{value:o,onChange:j,placeholder:t.name,autoFocus:!0}),e[19]=o,e[20]=t.name,e[21]=u):u=e[21];let y;e[22]!==u||e[23]!==f||e[24]!==x?(y=n.jsxs(oe,{children:[g,n.jsx(ie,{asChild:!0,children:n.jsxs("div",{children:[f,x,u]})})]}),e[22]=u,e[23]=f,e[24]=x,e[25]=y):y=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(re,{children:"Cancel"}),e[26]=D):D=e[26];let b;e[27]!==a?(b=()=>a.mutate(),e[27]=a,e[28]=b):b=e[28];const F=o!==t.name||a.isPending,R=a.isPending?"Deleting…":"Delete organization";let S;e[29]!==b||e[30]!==F||e[31]!==R?(S=n.jsxs(le,{children:[D,n.jsx(ce,{onClick:b,disabled:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=b,e[30]=F,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==y||e[34]!==S?(z=n.jsxs(ue,{children:[y,S]}),e[33]=y,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==v||e[37]!==z?(C=n.jsx(de,{open:v,onOpenChange:p,children:z}),e[36]=v,e[37]=z,e[38]=C):C=e[38];let _;return e[39]!==C||e[40]!==i?(_=n.jsxs(n.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=_):_=e[41],_}function je(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ve(){const e=E.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(N.Content,{children:n.jsx(N.Body,{children:n.jsxs(te,{children:[n.jsx(N.Title,{children:"Organization"}),n.jsx(he,{}),n.jsx(ne,{}),n.jsx(xe,{})]})})})}),e[0]=t):t=e[0],t}function Qe(){const e=E.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(me,{capability:"org:manage",area:"general settings",children:n.jsx(ve,{})}),e[0]=t):t=e[0],t}export{Qe as default};
@@ -1 +1 @@
1
- import{c as $,j as t,G as Q,a as te,m as W,r as G,U as B,i as D,d as ne,t as z,K as V,k as se,l as K,q as oe,a1 as re}from"./index-DIyNSN96.js";import{c as ie,a as ae,d as le,e as ce}from"./dialog-a5ZkDZhy.js";import{C as J}from"./checkbox-_ejCMjxu.js";import{C as ue}from"./collection-search-CVteq94G.js";import{u as de}from"./use-debounced-value-fFVCMUXm.js";import{b as me,u as fe}from"./use-connection-Cs21veSc.js";import{W as pe,u as H,S as X}from"./use-mcp-client-tU9_Q31R.js";import{b as Z}from"./Settings02-CYQjLDZe.js";import{w as ge}from"./agent-icon-XUhQzRLX.js";import{a as xe}from"./authenticate-and-persist-oauth-DBxyWtpZ.js";import{u as he}from"./use-mcp-tools-B2LI7RR7.js";import{e as ye}from"./extract-connection-data--lA2dih1.js";import{c as be}from"./use-navigate-to-agent-KaAiMohr.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
+ 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 +1,4 @@
1
- import{L as St,cp as Et,cq as It,bd as R,s as c,cr as de,bj as ze,bq as Tt,bc as wt,ab as At,ay as O,ax as q,av as oe,o as _,be as f,a_ as F,cs as Mt,ct as E,aw as Ot,t as ve,r as Y,c as Ie,G as Ct,j as Rt}from"./index-DIyNSN96.js";import{S as Nt,u as xt}from"./use-mcp-client-tU9_Q31R.js";import{d as Pt,D as Dt}from"./decopilot-sse-pool-4ct7M3nK.js";import{d as Lt}from"./delay-CnY5UFtP.js";import{e as kt}from"./backoff-CrEUbyZT.js";var re;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw new Error}t.assertNever=a,t.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},t.getValidEnumValues=s=>{const o=t.objectKeys(s).filter(n=>typeof s[s[n]]!="number"),i={};for(const n of o)i[n]=s[n];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(const i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var Me;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Me||(Me={}));re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ce extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let n=r,p=0;for(;p<i.path.length;){const u=i.path[p];p===i.path.length-1?(n[u]=n[u]||{_errors:[]},n[u]._errors.push(a(i))):n[u]=n[u]||{_errors:[]},n=n[u],p++}}};return s(this),r}static assert(e){if(!(e instanceof ce))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];a[o]=a[o]||[],a[o].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}ce.create=t=>new ce(t);var Oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Oe||(Oe={}));var h;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(h||(h={}));const jt=1e4,Wr="true";function fe(t,e){return St.chatAutosend(t,e)}function Zt(t){return t==="pending"||t==="sending"}function $t(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return!e||typeof e!="object"||typeof e.createdAt!="number"||typeof e.message!="object"||!Zt(e.status)?null:e}function Hr(t,e,a,r,s=Date.now()){const o={message:r,createdAt:s,status:"pending"};return t.setItem(fe(e,a),JSON.stringify(o)),o}function Ut(t,e,a){const r=fe(e,a),s=$t(t.getItem(r));return s||(t.removeItem(r),null)}function Gr(t,e,a,r=Date.now()){const s=fe(e,a),o=Ut(t,e,a);return!o||o.status!=="pending"?null:r-o.createdAt>=jt?(t.removeItem(s),null):(t.setItem(s,JSON.stringify({...o,status:"sending"})),{message:o.message,createdAt:o.createdAt})}function Xr(t,e,a){t.removeItem(fe(e,a))}var Je="vercel.ai.error",Ft=Symbol.for(Je),Ce,Re,Z=class Ye extends(Re=Error,Ce=Ft,Re){constructor({name:e,message:a,cause:r}){super(a),this[Ce]=!0,this.name=e,this.cause=r}static isInstance(e){return Ye.hasMarker(e,Je)}static hasMarker(e,a){const r=Symbol.for(a);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function qe(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var We="AI_InvalidArgumentError",He=`vercel.ai.error.${We}`,Bt=Symbol.for(He),Ne,xe,Vt=class extends(xe=Z,Ne=Bt,xe){constructor({message:t,cause:e,argument:a}){super({name:We,message:t,cause:e}),this[Ne]=!0,this.argument=a}static isInstance(t){return Z.hasMarker(t,He)}},Ge="AI_JSONParseError",Xe=`vercel.ai.error.${Ge}`,zt=Symbol.for(Xe),Pe,De,Le=class extends(De=Z,Pe=zt,De){constructor({text:t,cause:e}){super({name:Ge,message:`JSON parsing failed: Text: ${t}.
1
+ import{L as St,cq as Et,cr as It,be as R,s as c,cs as de,bk as ze,br as Tt,bd as wt,ac as At,az as O,ay as q,aw as oe,o as _,bf as f,a$ as F,ct as Mt,cu as E,ax as Ot,t as ve,r as Y,c as Ie,G as Ct,j as Rt}from"./index-qfheH9Xc.js";import{S as Nt,u as xt}from"./use-mcp-client-CpnbLiac.js";import{d as Pt,D as Dt}from"./decopilot-sse-pool-DrXwOdO1.js";import{d as Lt}from"./delay-CnY5UFtP.js";import{e as kt}from"./backoff-CrEUbyZT.js";var re;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw new Error}t.assertNever=a,t.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},t.getValidEnumValues=s=>{const o=t.objectKeys(s).filter(n=>typeof s[s[n]]!="number"),i={};for(const n of o)i[n]=s[n];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(const i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var Me;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Me||(Me={}));re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ce extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let n=r,p=0;for(;p<i.path.length;){const u=i.path[p];p===i.path.length-1?(n[u]=n[u]||{_errors:[]},n[u]._errors.push(a(i))):n[u]=n[u]||{_errors:[]},n=n[u],p++}}};return s(this),r}static assert(e){if(!(e instanceof ce))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];a[o]=a[o]||[],a[o].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}ce.create=t=>new ce(t);var Oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Oe||(Oe={}));var h;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(h||(h={}));const jt=1e4,Wr="true";function fe(t,e){return St.chatAutosend(t,e)}function Zt(t){return t==="pending"||t==="sending"}function $t(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return!e||typeof e!="object"||typeof e.createdAt!="number"||typeof e.message!="object"||!Zt(e.status)?null:e}function Hr(t,e,a,r,s=Date.now()){const o={message:r,createdAt:s,status:"pending"};return t.setItem(fe(e,a),JSON.stringify(o)),o}function Ut(t,e,a){const r=fe(e,a),s=$t(t.getItem(r));return s||(t.removeItem(r),null)}function Gr(t,e,a,r=Date.now()){const s=fe(e,a),o=Ut(t,e,a);return!o||o.status!=="pending"?null:r-o.createdAt>=jt?(t.removeItem(s),null):(t.setItem(s,JSON.stringify({...o,status:"sending"})),{message:o.message,createdAt:o.createdAt})}function Xr(t,e,a){t.removeItem(fe(e,a))}var Je="vercel.ai.error",Ft=Symbol.for(Je),Ce,Re,Z=class Ye extends(Re=Error,Ce=Ft,Re){constructor({name:e,message:a,cause:r}){super(a),this[Ce]=!0,this.name=e,this.cause=r}static isInstance(e){return Ye.hasMarker(e,Je)}static hasMarker(e,a){const r=Symbol.for(a);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function qe(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var We="AI_InvalidArgumentError",He=`vercel.ai.error.${We}`,Bt=Symbol.for(He),Ne,xe,Vt=class extends(xe=Z,Ne=Bt,xe){constructor({message:t,cause:e,argument:a}){super({name:We,message:t,cause:e}),this[Ne]=!0,this.argument=a}static isInstance(t){return Z.hasMarker(t,He)}},Ge="AI_JSONParseError",Xe=`vercel.ai.error.${Ge}`,zt=Symbol.for(Xe),Pe,De,Le=class extends(De=Z,Pe=zt,De){constructor({text:t,cause:e}){super({name:Ge,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${qe(e)}`,cause:e}),this[Pe]=!0,this.text=t}static isInstance(t){return Z.hasMarker(t,Xe)}},Qe="AI_TypeValidationError",Ke=`vercel.ai.error.${Qe}`,Jt=Symbol.for(Ke),ke,je,X=class ye extends(je=Z,ke=Jt,je){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r?.field&&(s+=` for ${r.field}`),r?.entityName||r?.entityId){s+=" (";const o=[];r.entityName&&o.push(r.entityName),r.entityId&&o.push(`id: "${r.entityId}"`),s+=o.join(", "),s+=")"}super({name:Qe,message:`${s}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${qe(a)}`,cause:a}),this[ke]=!0,this.value=e,this.context=r}static isInstance(e){return Z.hasMarker(e,Ke)}static wrap({value:e,cause:a,context:r}){var s,o,i;return ye.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===r?.field&&((o=a.context)==null?void 0:o.entityName)===r?.entityName&&((i=a.context)==null?void 0:i.entityId)===r?.entityId?a:new ye({value:e,cause:a,context:r})}},ie=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const s=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return s;if(a.includes(r))throw new Vt({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${a}".`});return()=>`${t}${r}${s()}`};ie();var Yt=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,qt=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Ze(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Yt.test(t)===!1&&qt.test(t)===!1?e:Wt(e)}function Wt(t){let e=[t];for(;e.length;){const a=e;e=[];for(const r of a){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const s in r){const o=r[s];o&&typeof o=="object"&&e.push(o)}}}return t}function Ht(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Ze(t)}try{return Ze(t)}finally{Error.stackTraceLimit=e}}function Te(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const r of Object.keys(a))a[r]=z(a[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(z):z(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(z)),t.allOf!=null&&(t.allOf=t.allOf.map(z)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(z));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=z(e[a]);return t}function z(t){return typeof t=="boolean"?t:Te(t)}var Gt=Symbol("Let zodToJsonSchema decide on which parser to use"),$e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Xt=t=>typeof t=="string"?{...$e,name:t}:{...$e,...t};function N(){return{}}function Qt(t,e){var a,r,s;const o={type:"array"};return(a=t.type)!=null&&a._def&&((s=(r=t.type)==null?void 0:r._def)==null?void 0:s.typeName)!==h.ZodAny&&(o.items=b(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function Kt(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function ea(){return{type:"boolean"}}function et(t,e){return b(t.type._def,e)}var ta=(t,e)=>b(t.innerType._def,e);function tt(t,e,a){const r=a??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((s,o)=>tt(t,e,s))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return aa(t)}}var aa=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function ra(t,e){return{...b(t.innerType._def,e),default:t.defaultValue()}}function sa(t,e){return e.effectStrategy==="input"?b(t.schema._def,e):N()}function na(t){return{type:"string",enum:Array.from(t.values)}}var oa=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function ia(t,e){const a=[b(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),b(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),r=[];return a.forEach(s=>{if(oa(s))r.push(...s.allOf);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){const{additionalProperties:i,...n}=s;o=n}r.push(o)}}),r.length?{allOf:r}:void 0}function la(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var he=void 0,P={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(he===void 0&&(he=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),he),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function at(t,e){const a={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":D(a,"email",r.message,e);break;case"format:idn-email":D(a,"idn-email",r.message,e);break;case"pattern:zod":M(a,P.email,r.message,e);break}break;case"url":D(a,"uri",r.message,e);break;case"uuid":D(a,"uuid",r.message,e);break;case"regex":M(a,r.regex,r.message,e);break;case"cuid":M(a,P.cuid,r.message,e);break;case"cuid2":M(a,P.cuid2,r.message,e);break;case"startsWith":M(a,RegExp(`^${ge(r.value,e)}`),r.message,e);break;case"endsWith":M(a,RegExp(`${ge(r.value,e)}$`),r.message,e);break;case"datetime":D(a,"date-time",r.message,e);break;case"date":D(a,"date",r.message,e);break;case"time":D(a,"time",r.message,e);break;case"duration":D(a,"duration",r.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,r.value):r.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,r.value):r.value;break;case"includes":{M(a,RegExp(ge(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&D(a,"ipv4",r.message,e),r.version!=="v4"&&D(a,"ipv6",r.message,e);break}case"base64url":M(a,P.base64url,r.message,e);break;case"jwt":M(a,P.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&M(a,P.ipv4Cidr,r.message,e),r.version!=="v4"&&M(a,P.ipv6Cidr,r.message,e);break}case"emoji":M(a,P.emoji(),r.message,e);break;case"ulid":{M(a,P.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{D(a,"binary",r.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{M(a,P.base64,r.message,e);break}}break}case"nanoid":M(a,P.nanoid,r.message,e)}return a}function ge(t,e){return e.patternStrategy==="escape"?da(t):t}var ua=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function da(t){let e="";for(let a=0;a<t.length;a++)ua.has(t[a])||(e+="\\"),e+=t[a];return e}function D(t,e,a,r){var s;t.format||(s=t.anyOf)!=null&&s.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&r.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function M(t,e,a,r){var s;t.pattern||(s=t.allOf)!=null&&s.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Ue(e,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Ue(e,r)}function Ue(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=r.i?t.source.toLowerCase():t.source;let o="",i=!1,n=!1,p=!1;for(let u=0;u<s.length;u++){if(i){o+=s[u],i=!1;continue}if(r.i){if(n){if(s[u].match(/[a-z]/)){p?(o+=s[u],o+=`${s[u-2]}-${s[u]}`.toUpperCase(),p=!1):s[u+1]==="-"&&((a=s[u+2])!=null&&a.match(/[a-z]/))?(o+=s[u],p=!0):o+=`${s[u]}${s[u].toUpperCase()}`;continue}}else if(s[u].match(/[a-z]/)){o+=`[${s[u]}${s[u].toUpperCase()}]`;continue}}if(r.m){if(s[u]==="^"){o+=`(^|(?<=[\r
4
4
  ]))`;continue}else if(s[u]==="$"){o+=`($|(?=[\r
@@ -1,4 +1,4 @@
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-DIyNSN96.js";import{b as de}from"./use-virtual-mcp-WZNqIa1a.js";import{c as Z}from"./use-navigate-to-agent-KaAiMohr.js";import{u as ue}from"./use-connection-Cs21veSc.js";import{u as Y,S as me}from"./use-mcp-client-tU9_Q31R.js";import{g as pe,u as he,p as ge,a as fe}from"./github-repo-picker-CNVz0qrC.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-a5ZkDZhy.js";import{b as Se}from"./Settings02-CYQjLDZe.js";import{C as ve}from"./collection-search-CVteq94G.js";const Ee=`<svg width="74" height="84" viewBox="0 0 74 84" fill="none" xmlns="http://www.w3.org/2000/svg">
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
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
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
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};
@@ -0,0 +1 @@
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};
@@ -1,4 +1,4 @@
1
- import{r as a,a2 as R}from"./index-DIyNSN96.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,a3 as R}from"./index-qfheH9Xc.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ne(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oe(e,t){if(e==null)return{};var r,n,o=je(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function je(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Me(e,t){return me(e)||ye(e,t)||Ee(e,t)||we()}function Pe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Se(e){var t=Pe(e,"string");return typeof t=="symbol"?t:t+""}function Ee(e,t){if(e){if(typeof e=="string")return re(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ie(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function A(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function F(e){return{}.toString.call(e).includes("Object")}function Te(e){return!Object.keys(e).length}function D(e){return typeof e=="function"}function Ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t){return F(t)||P("changeType"),Object.keys(t).some(function(r){return!Ce(e,r)})&&P("changeField"),t}function Ae(e){D(e)||P("selectorType")}function $e(e){D(e)||F(e)||P("handlerType"),F(e)&&Object.values(e).some(function(t){return!D(t)})&&P("handlersType")}function De(e){e||P("initialIsRequired"),F(e)||P("initialType"),Te(e)&&P("initialContent")}function Ve(e,t){throw new Error(e[t]||e.default)}var xe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},P=A(Ve)(xe),q={changes:Le,selector:Ae,handler:$e,initial:De};function Ne(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q.initial(e),q.handler(t);var r={current:e},n=A(Fe)(r,t),o=A(ze)(r),i=A(q.changes)(e),c=A(qe)(r);function s(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(j){return j};return q.selector(p),p(r.current)}function f(p){Ie(n,o,i,c)(p)}return[s,f]}function qe(e,t){return D(t)?t(e.current):t}function ze(e,t){return e.current=ae(ae({},e.current),t),t}function Fe(e,t,r){return D(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Ue={create:Ne},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function We(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function Be(e){return{}.toString.call(e).includes("Object")}function Ke(e){return e||ue("configIsRequired"),Be(e)||ue("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(ce.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var ce={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4