decocms 4.20.1 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/dist/client/assets/{AlertCircle-DMGExMxY.js → AlertCircle-BAqebLND.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BYUnq8gY.js → ArrowUpRight-BejkutVa.js} +1 -1
  3. package/dist/client/assets/Check-CC3ah2EP.js +1 -0
  4. package/dist/client/assets/{CheckCircle-C5ITwmFz.js → CheckCircle-C_Aedf-I.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BDi4pzpg.js → ChevronDown-ChsImHZJ.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CkirMRmz.js → ChevronRight-DKpM0qdo.js} +1 -1
  7. package/dist/client/assets/ChevronUp-CJ6cOnxb.js +1 -0
  8. package/dist/client/assets/Circle-Blw66dbf.js +1 -0
  9. package/dist/client/assets/Copy01-B9fTK-Gv.js +1 -0
  10. package/dist/client/assets/DotsVertical-CmhOyP1I.js +1 -0
  11. package/dist/client/assets/Eye-CFP70kHf.js +1 -0
  12. package/dist/client/assets/{FilterLines-DCrHo_W-.js → FilterLines-BCJIlwsH.js} +1 -1
  13. package/dist/client/assets/{Globe01-CHueNlXT.js → Globe01-CdKa67VI.js} +1 -1
  14. package/dist/client/assets/{Globe04-D1Ia72FD.js → Globe04-BwB-L-v7.js} +1 -1
  15. package/dist/client/assets/{HardDrive-C5pxB0xX.js → HardDrive-Cvln_XgB.js} +1 -1
  16. package/dist/client/assets/{Key01-D_Aswhqq.js → Key01-Dq3fyqt5.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-BIAH0kog.js → LayoutLeft-D7T3E-u6.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-vG76nXPe.js → LinkExternal01-Cohlmmy1.js} +1 -1
  19. package/dist/client/assets/List-BX1Dxe3c.js +1 -0
  20. package/dist/client/assets/Loading02-DutOxXF8.js +1 -0
  21. package/dist/client/assets/{Monitor01-BEHd5v9A.js → Monitor01-Do0cCBdt.js} +1 -1
  22. package/dist/client/assets/{Palette-CUxSqgEM.js → Palette-BmgCpHFj.js} +1 -1
  23. package/dist/client/assets/{Play-B6SMfN5e.js → Play-BBHolMYa.js} +1 -1
  24. package/dist/client/assets/{Plus-B3W-zU0m.js → Plus-Cpa6DE3F.js} +1 -1
  25. package/dist/client/assets/{SearchLg-CwA3o7Kq.js → SearchLg-D1sKIH4t.js} +1 -1
  26. package/dist/client/assets/{SearchMd-CG-ZdWyV.js → SearchMd-CafLz5-k.js} +1 -1
  27. package/dist/client/assets/{Settings02-BXQlyl72.js → Settings02-Qe5DtIFk.js} +1 -1
  28. package/dist/client/assets/{Shield01-C5cTYwHG.js → Shield01-CmqQX7z4.js} +1 -1
  29. package/dist/client/assets/{Star01-CaO0nMo9.js → Star01-Dx3yxBV5.js} +1 -1
  30. package/dist/client/assets/{Stars01-DjfTA0U2.js → Stars01-Cjj351UH.js} +1 -1
  31. package/dist/client/assets/{Stars02-oR68jXM_.js → Stars02-DVjaFNiu.js} +1 -1
  32. package/dist/client/assets/{Sun-gt9ujltE.js → Sun-9KvJTXMD.js} +1 -1
  33. package/dist/client/assets/SwitchHorizontal01-C2AiHI6d.js +1 -0
  34. package/dist/client/assets/{Tool01-CPfgYpSb.js → Tool01-CMdJij71.js} +1 -1
  35. package/dist/client/assets/{Trash01-De9U-JcA.js → Trash01-Bk68wFhO.js} +1 -1
  36. package/dist/client/assets/{Upload01-XVwkIKd6.js → Upload01-DfieuDNH.js} +1 -1
  37. package/dist/client/assets/{User01--wnyNy2g.js → User01-BiwKrQu6.js} +1 -1
  38. package/dist/client/assets/{Users01-DQSxkCun.js → Users01-rcBZnIdC.js} +1 -1
  39. package/dist/client/assets/{Users03-DEShSeP4.js → Users03-C2FdBaet.js} +1 -1
  40. package/dist/client/assets/{X-DchRughI.js → X-Dfoip5yB.js} +1 -1
  41. package/dist/client/assets/{XCircle-BMPeQmo7.js → XCircle-C9R5bCeP.js} +1 -1
  42. package/dist/client/assets/{XClose-BlQxiRFv.js → XClose-CPqc0UtD.js} +1 -1
  43. package/dist/client/assets/{Zap-gCfOy-ns.js → Zap-CRPirG1P.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-DRmIxSdp.js → ZapSquare-CGsw7HnP.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-VZDZQqnX.js → ZoomOut-Cq_jwvnh.js} +1 -1
  46. package/dist/client/assets/{access-gate-Cqrbc3BU.js → access-gate-7q5PI6kF.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-DgQQFrd8.js → add-section-modal-BVhFBSux.js} +1 -1
  48. package/dist/client/assets/agent-capabilities-BGx_yFvg.js +1 -0
  49. package/dist/client/assets/agent-icon-DAuEpvjN.js +1 -0
  50. package/dist/client/assets/agents-list-DEbqbve9.js +1 -0
  51. package/dist/client/assets/ai-providers-jW9pV5wT.js +1 -0
  52. package/dist/client/assets/{alert-CWiQ4BOG.js → alert-Chi9L6Lo.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-Buxux4Jv.js → alert-dialog-DNV8OhbX.js} +1 -1
  54. package/dist/client/assets/app-editor-B90O76NW.js +1 -0
  55. package/dist/client/assets/{auth-catchall-BM5rYO-b.js → auth-catchall-BeENOKgo.js} +1 -1
  56. package/dist/client/assets/{auth-entry-Cvl9qiXx.js → auth-entry-Banhr0Dj.js} +1 -1
  57. package/dist/client/assets/{auth-BZgEN2RD.js → auth-k2I4x92r.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-Dfe6g0QY.js → auth-split-layout-BpIandE_.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-cJNik8J_.js → authenticate-and-persist-oauth-DiKNvlD_.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-BUhdfpZz.js → automation-list-row-pGg9Lluh.js} +1 -1
  61. package/dist/client/assets/automation-runs-8IQ_r9WW.js +1 -0
  62. package/dist/client/assets/automations-DYcjcF3S.js +1 -0
  63. package/dist/client/assets/{avatar-B8STW9mD.js → avatar-BD1bv4j8.js} +1 -1
  64. package/dist/client/assets/{badge-D5WiG5D4.js → badge-Dz2OFDxQ.js} +1 -1
  65. package/dist/client/assets/{block-document-CyegCur0.js → block-document-MEJKfSm3.js} +1 -1
  66. package/dist/client/assets/{brand-context-BclDTNfv.js → brand-context-C-0cx-zk.js} +1 -1
  67. package/dist/client/assets/{breadcrumb-CrhSDATC.js → breadcrumb-DDrlJm3F.js} +1 -1
  68. package/dist/client/assets/buckets-K1kG3QiU.js +1 -0
  69. package/dist/client/assets/bulk-category-panel-Cpe8cv7-.js +1 -0
  70. package/dist/client/assets/{capability-load-error-DB0r6fSo.js → capability-load-error-CV7OdywL.js} +1 -1
  71. package/dist/client/assets/{card-BWrHlXPo.js → card-DT6z8UIy.js} +1 -1
  72. package/dist/client/assets/category-editor-97EZw1QP.js +1 -0
  73. package/dist/client/assets/{chat-context-D6mGbi6m.js → chat-context-CcZXAHlF.js} +5 -5
  74. package/dist/client/assets/checkbox-CGiCIR_t.js +1 -0
  75. package/dist/client/assets/{cli-auth-success-DYZ43GUt.js → cli-auth-success-C0sOgmEb.js} +1 -1
  76. package/dist/client/assets/collection-detail-Clwh-BUk.js +1 -0
  77. package/dist/client/assets/collection-display-button-S0ZgQk6P.js +1 -0
  78. package/dist/client/assets/{collection-search-C_fvYmsw.js → collection-search-eFRNtpdt.js} +1 -1
  79. package/dist/client/assets/{collection-table-wrapper-Cv1VGTD3.js → collection-table-wrapper-DQSn1GJT.js} +1 -1
  80. package/dist/client/assets/{collection-tabs-Bj8UeBuP.js → collection-tabs-CYD2CpTe.js} +1 -1
  81. package/dist/client/assets/{command-DeIgAPPz.js → command-DWilEO1e.js} +1 -1
  82. package/dist/client/assets/commerce-onboarding-Dmxkngyz.js +1 -0
  83. package/dist/client/assets/connect-desktop-dialog-C8fqunJ_.js +1 -0
  84. package/dist/client/assets/connection-card-De6SHWCH.js +1 -0
  85. package/dist/client/assets/connection-detail-BUV19nAJ.js +1 -0
  86. package/dist/client/assets/{connection-form-helpers-DYr5JaDw.js → connection-form-helpers-DsTip61C.js} +1 -1
  87. package/dist/client/assets/connections-DHz382Nc.js +1 -0
  88. package/dist/client/assets/constants-C8_Swa4x.js +1 -0
  89. package/dist/client/assets/{decopilot-BEN2dFqJ.js → decopilot-DA6E6MgD.js} +1 -1
  90. package/dist/client/assets/{decopilot-sse-pool-D-yGYu6w.js → decopilot-sse-pool-B-Li8vIf.js} +1 -1
  91. package/dist/client/assets/{dialog-Bw0pp5yj.js → dialog-Bx9_D2-i.js} +1 -1
  92. package/dist/client/assets/{domain-settings-ClPu3y3V.js → domain-settings-CmBMcneA.js} +1 -1
  93. package/dist/client/assets/{drawer-Bqwp_rDk.js → drawer-DUrVpGtt.js} +1 -1
  94. package/dist/client/assets/dropdown-menu-BXlOZYEj.js +1 -0
  95. package/dist/client/assets/{empty-state-DEvtcbTs.js → empty-state-DrOUH3OQ.js} +1 -1
  96. package/dist/client/assets/extract-connection-data-AeQK1qls.js +1 -0
  97. package/dist/client/assets/file-explorer-cazCHuV9.js +2 -0
  98. package/dist/client/assets/{file-type-icon-CeDR5FDE.js → file-type-icon-DHWkW0ug.js} +1 -1
  99. package/dist/client/assets/{files-BhVyoXap.js → files-CHpi2r2q.js} +1 -1
  100. package/dist/client/assets/{form-BvyPfbLQ.js → form-C6xzxaKT.js} +1 -1
  101. package/dist/client/assets/format-time-Cy7tTmZp.js +1 -0
  102. package/dist/client/assets/general-CBqmiHQR.js +1 -0
  103. package/dist/client/assets/github-repo-picker-BFPwF92l.js +1 -0
  104. package/dist/client/assets/{hooks-BPEh0QmD.js → hooks-DPy92pzv.js} +4 -4
  105. package/dist/client/assets/{index-BLK_ychv.js → index-C8i8F2aZ.js} +12 -12
  106. package/dist/client/assets/index-CARq6YCN.js +1 -0
  107. package/dist/client/assets/{index-DSmc84cq.js → index-CO9SnRbg.js} +4 -4
  108. package/dist/client/assets/{index-DBQeQBu7.js → index-CYLzTU3h.js} +6 -6
  109. package/dist/client/assets/{index-Bi8gy8BM.js → index-ChSXukaC.js} +1 -1
  110. package/dist/client/assets/index-CveMeMql.css +1 -0
  111. package/dist/client/assets/{index-C0UjMZmb.js → index-DD6weYxO.js} +1 -1
  112. package/dist/client/assets/{index-CuLYHmz6.js → index-DU_SD-rb.js} +1 -1
  113. package/dist/client/assets/{index-C4E5A5_g.js → index-DWzm9A1x.js} +1 -1
  114. package/dist/client/assets/{index-WiwoxaKL.js → index-Dx-JuX8X.js} +2 -2
  115. package/dist/client/assets/{index-BAAVzGGp.js → index-LGROg_hz.js} +1 -1
  116. package/dist/client/assets/index-Mlqi33Qh.js +1 -0
  117. package/dist/client/assets/{index-OF548fxc.js → index-S0Q7YlOD.js} +25 -25
  118. package/dist/client/assets/index-r-ZTThxt.js +1 -0
  119. package/dist/client/assets/{index-redirect-Ckad27gh.js → index-redirect-BDcT3T7b.js} +1 -1
  120. package/dist/client/assets/{index-C3UHIWhR.js → index-zDHcoqw4.js} +1 -1
  121. package/dist/client/assets/{input-C6fESize.js → input-Dmp_t77f.js} +1 -1
  122. package/dist/client/assets/{integration-icon-B3836mZm.js → integration-icon-D1vivc8T.js} +1 -1
  123. package/dist/client/assets/{invite-member-dialog-BuboFMvI.js → invite-member-dialog-B52NxzkC.js} +2 -2
  124. package/dist/client/assets/{label-Cpj2tcAv.js → label-D3ajqQqF.js} +1 -1
  125. package/dist/client/assets/{library-tab-BBjWEEvH.js → library-tab-D0-rbhqe.js} +3 -3
  126. package/dist/client/assets/{login-BGIn53vR.js → login-B5g56FG8.js} +1 -1
  127. package/dist/client/assets/{mcp-oauth-DXbhYp2n.js → mcp-oauth-jAFObzAH.js} +1 -1
  128. package/dist/client/assets/members-C3EfSHkY.js +1 -0
  129. package/dist/client/assets/{monaco-editor-Dg_OXRF1.js → monaco-editor-DMzl3sdg.js} +1 -1
  130. package/dist/client/assets/{monitoring-stats-row-ty05snCg.js → monitoring-stats-row-Cn7CUK3V.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-DmDYtprU.js → oauth-callback-Bs1-J2uC.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-ai-provider-nV9ol-kz.js → oauth-callback-ai-provider-1jknSd8R.js} +1 -1
  133. package/dist/client/assets/{onboarding-DFxThqB8.js → onboarding-DvEuy0D_.js} +1 -1
  134. package/dist/client/assets/{org-install-C6-_thTM.js → org-install-CJ7F5mZU.js} +1 -1
  135. package/dist/client/assets/{org-layout-rq33k6_9.js → org-layout-CQsIu6xu.js} +1 -1
  136. package/dist/client/assets/{organization-choice-LqtmycnE.js → organization-choice-UHSo9CAk.js} +1 -1
  137. package/dist/client/assets/{page-seo-form-SfmOLumQ.js → page-seo-form-BY-XtFIF.js} +1 -1
  138. package/dist/client/assets/page-seo-sheet-C-o48EMg.js +1 -0
  139. package/dist/client/assets/{popover-CPAEPhwT.js → popover-DbclufIS.js} +1 -1
  140. package/dist/client/assets/post-editor-o5fS997b.js +1 -0
  141. package/dist/client/assets/{primitives-TAuh4FGx.js → primitives-PoyK9-WR.js} +1 -1
  142. package/dist/client/assets/profile-DXLRzqRR.js +1 -0
  143. package/dist/client/assets/project-app-view-sebr-y53.js +1 -0
  144. package/dist/client/assets/record-editor-BGPyrMO7.js +1 -0
  145. package/dist/client/assets/registry-GJh_dUyE.js +2 -0
  146. package/dist/client/assets/{registry-layout-D8trut1f.js → registry-layout-DaPQiP8-.js} +4 -4
  147. package/dist/client/assets/{require-capability-Dh5JJLWW.js → require-capability-D_bY_XS6.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-BFKAd6mb.js → required-auth-layout-CUJtlw7e.js} +1 -1
  149. package/dist/client/assets/{reset-password-BVwK480T.js → reset-password-Boo6v3a2.js} +1 -1
  150. package/dist/client/assets/roles-CP5n6DBo.js +1 -0
  151. package/dist/client/assets/{scroll-area-DVylVd8s.js → scroll-area-C9lD0DG9.js} +11 -11
  152. package/dist/client/assets/{search-input-DsIBo_sc.js → search-input-CDcgzOxB.js} +1 -1
  153. package/dist/client/assets/secrets-BXbhAnGl.js +1 -0
  154. package/dist/client/assets/{sections-editor-BexUuo8y.js → sections-editor-DHI42whV.js} +2 -2
  155. package/dist/client/assets/select-CsaBdTgI.js +1 -0
  156. package/dist/client/assets/{select-model-BEsDOV7S.js → select-model-DflkFrTV.js} +1 -1
  157. package/dist/client/assets/seo-editor-CaMUQOw8.js +1 -0
  158. package/dist/client/assets/{settings-layout-CP6mrAe7.js → settings-layout-B_-ExZeb.js} +1 -1
  159. package/dist/client/assets/{settings-section-Cd3zmde3.js → settings-section-URYHyOYi.js} +1 -1
  160. package/dist/client/assets/{sheet-S1l6W00L.js → sheet-BGhHsN5F.js} +1 -1
  161. package/dist/client/assets/{shell-controls-CgJrLQ34.js → shell-controls-6cosW1pP.js} +1 -1
  162. package/dist/client/assets/shell-layout-DdBCXSg-.js +1 -0
  163. package/dist/client/assets/{sidebar-DKxDx7lC.js → sidebar-BAsFQ-MT.js} +1 -1
  164. package/dist/client/assets/{skeleton-wLHgTqVy.js → skeleton-BUBk-3xi.js} +1 -1
  165. package/dist/client/assets/sso-D_2b6Fc8.js +1 -0
  166. package/dist/client/assets/store-ievF1htD.js +1 -0
  167. package/dist/client/assets/store-registry-B3gzmTlr.js +2 -0
  168. package/dist/client/assets/{studio-tools-DkATXRgK.js → studio-tools-DgAshZ-_.js} +1 -1
  169. package/dist/client/assets/{switch-C4FKiTgP.js → switch-BonZrdli.js} +1 -1
  170. package/dist/client/assets/{table-BV3Hd7cI.js → table-DEH4uiQe.js} +1 -1
  171. package/dist/client/assets/{tabs-B9iGaa-Z.js → tabs-CRj6AkcW.js} +1 -1
  172. package/dist/client/assets/task-row-ChWV-nAj.js +1 -0
  173. package/dist/client/assets/task-status-Dh1x9gPU.js +1 -0
  174. package/dist/client/assets/{textarea-CiUwXw-w.js → textarea-BNlJNx-b.js} +1 -1
  175. package/dist/client/assets/{toggle-group-CN_l4byE.js → toggle-group-QkV1Q0_i.js} +1 -1
  176. package/dist/client/assets/{toolbar-ekp7NSbq.js → toolbar-CCAeF5A-.js} +1 -1
  177. package/dist/client/assets/{toolbar-icon-button-CBlJ6I0o.js → toolbar-icon-button-D7VY-9VN.js} +1 -1
  178. package/dist/client/assets/{tools-list-D_VeN0IP.js → tools-list-M23BH1hq.js} +1 -1
  179. package/dist/client/assets/{tooltip-CKk6MyBG.js → tooltip-FlCInimM.js} +1 -1
  180. package/dist/client/assets/{types-CeLnpp7L.js → types-kWY4145T.js} +1 -1
  181. package/dist/client/assets/{use-ai-providers-DhQCSBc1.js → use-ai-providers-Bc5pT284.js} +1 -1
  182. package/dist/client/assets/use-automations-CF2YS293.js +1 -0
  183. package/dist/client/assets/{use-capability-HK8_0h49.js → use-capability-BY1ZsP4P.js} +1 -1
  184. package/dist/client/assets/use-clock-tick-DiVstnVw.js +1 -0
  185. package/dist/client/assets/{use-collections-CdbL-rX2.js → use-collections-BwIgjkkY.js} +1 -1
  186. package/dist/client/assets/use-connection-BuLrAfYP.js +1 -0
  187. package/dist/client/assets/{use-copy-Ba_RrSds.js → use-copy-ue2G1-hn.js} +1 -1
  188. package/dist/client/assets/use-create-virtual-mcp-CwTiuOpk.js +1 -0
  189. package/dist/client/assets/{use-debounced-autosave-B6gDjRvo.js → use-debounced-autosave-DPoL6EyR.js} +1 -1
  190. package/dist/client/assets/{use-debounced-value-CyOmB5fJ.js → use-debounced-value-BaMggBf4.js} +1 -1
  191. package/dist/client/assets/{use-decopilot-events-DwY1rJO2.js → use-decopilot-events-CqBKeCC-.js} +1 -1
  192. package/dist/client/assets/{use-delete-connection-CPWy2xmw.js → use-delete-connection-Dz7PGuLT.js} +1 -1
  193. package/dist/client/assets/{use-file-configs-SlXV4SMn.js → use-file-configs-DG9Mhiyd.js} +1 -1
  194. package/dist/client/assets/{use-infinite-scroll-DHUYU_kG.js → use-infinite-scroll-3Uj2RNwo.js} +1 -1
  195. package/dist/client/assets/{use-join-requests-f9qAAjhC.js → use-join-requests-S43CfCdf.js} +1 -1
  196. package/dist/client/assets/use-mcp-client-CnRSGieI.js +10 -0
  197. package/dist/client/assets/{use-mcp-prompts-UzvitU_e.js → use-mcp-prompts-BHkYncis.js} +1 -1
  198. package/dist/client/assets/{use-mcp-tools-zFZxfr6-.js → use-mcp-tools-CDyeZmTp.js} +1 -1
  199. package/dist/client/assets/{use-members-DTTAqnQj.js → use-members-DSSi_h3c.js} +1 -1
  200. package/dist/client/assets/{use-mobile-71FrMeIQ.js → use-mobile-FUxUqTQv.js} +1 -1
  201. package/dist/client/assets/{use-navigate-to-agent-DIwK9fdW.js → use-navigate-to-agent-DqOg0uVZ.js} +1 -1
  202. package/dist/client/assets/{use-org-auth-client-CfqWFlO5.js → use-org-auth-client-DOD7ccpR.js} +1 -1
  203. package/dist/client/assets/{use-org-sso-DnPy8IJo.js → use-org-sso-DU73DmAG.js} +1 -1
  204. package/dist/client/assets/{use-organization-roles-DLiC1YgM.js → use-organization-roles-Dcz2MjMd.js} +1 -1
  205. package/dist/client/assets/use-organization-settings-C8EmnI93.js +1 -0
  206. package/dist/client/assets/use-registry-connections-Ctaa0JQV.js +1 -0
  207. package/dist/client/assets/{use-secrets-CJb3Q-KQ.js → use-secrets-B5E8bF7h.js} +1 -1
  208. package/dist/client/assets/{use-status-sounds-C23loojF.js → use-status-sounds-BH3nLka8.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-DtQqfjJM.js → use-view-mode-DHvPeuX3.js} +1 -1
  210. package/dist/client/assets/use-virtual-mcp-iU8WqU_q.js +1 -0
  211. package/dist/client/assets/useInfiniteQuery-MSYpmccr.js +1 -0
  212. package/dist/client/assets/useSuspenseInfiniteQuery-Wt188HkA.js +1 -0
  213. package/dist/client/assets/{useSuspenseQueries-f54Kg_lq.js → useSuspenseQueries-Cy-j8ofE.js} +1 -1
  214. package/dist/client/assets/variant-calendar-BWM8PQLC.js +1 -0
  215. package/dist/client/assets/{view-mode-toggle-xMIlyXz_.js → view-mode-toggle-td--5Ihh.js} +1 -1
  216. package/dist/client/index.html +2 -2
  217. package/dist/server/cli.js +521 -507
  218. package/dist/server/migrate.js +83 -83
  219. package/dist/server/server.js +314 -314
  220. package/package.json +1 -1
  221. package/dist/client/assets/ChevronUp-BgfgTfJo.js +0 -1
  222. package/dist/client/assets/DotsVertical-wFUaTKIr.js +0 -1
  223. package/dist/client/assets/Eye-BPtPfNj_.js +0 -1
  224. package/dist/client/assets/SwitchHorizontal01-DKfBMAMt.js +0 -1
  225. package/dist/client/assets/agent-capabilities-Bxs0ILD3.js +0 -1
  226. package/dist/client/assets/agent-icon-Bw-pYaqu.js +0 -1
  227. package/dist/client/assets/agents-list-BaYiXH15.js +0 -1
  228. package/dist/client/assets/ai-providers-C4e06NrJ.js +0 -1
  229. package/dist/client/assets/app-editor-DtV9KQKR.js +0 -1
  230. package/dist/client/assets/automation-runs-D52rO4m5.js +0 -1
  231. package/dist/client/assets/automations-Cc50qZvh.js +0 -1
  232. package/dist/client/assets/buckets--3cPd2W_.js +0 -1
  233. package/dist/client/assets/bulk-category-panel-DsOXc5WN.js +0 -1
  234. package/dist/client/assets/category-editor-EHZdd7WQ.js +0 -1
  235. package/dist/client/assets/checkbox-B0iPK-Vx.js +0 -1
  236. package/dist/client/assets/collection-detail-pr_0VNQT.js +0 -1
  237. package/dist/client/assets/collection-display-button-BdyEgFyg.js +0 -1
  238. package/dist/client/assets/commerce-onboarding-CHMkWtbP.js +0 -1
  239. package/dist/client/assets/connect-desktop-dialog-DU7oJbU_.js +0 -1
  240. package/dist/client/assets/connection-card-CIIT6a-B.js +0 -1
  241. package/dist/client/assets/connection-detail-DW7R20rk.js +0 -1
  242. package/dist/client/assets/connections-BXo316Yj.js +0 -1
  243. package/dist/client/assets/dropdown-menu-DBdT-R6w.js +0 -1
  244. package/dist/client/assets/extract-connection-data-DB2mp1s-.js +0 -1
  245. package/dist/client/assets/file-explorer-CCDyOatC.js +0 -2
  246. package/dist/client/assets/general-Cppvys0u.js +0 -1
  247. package/dist/client/assets/github-repo-picker-D7QB7NBL.js +0 -1
  248. package/dist/client/assets/index-B1I1Oi0g.css +0 -1
  249. package/dist/client/assets/index-BASamdWA.js +0 -1
  250. package/dist/client/assets/index-CgS6ZFaA.js +0 -1
  251. package/dist/client/assets/members-BJuT40Uf.js +0 -1
  252. package/dist/client/assets/page-seo-sheet-rEaKbGL4.js +0 -1
  253. package/dist/client/assets/post-editor-DNSrY2g5.js +0 -1
  254. package/dist/client/assets/profile-BJUc-WPJ.js +0 -1
  255. package/dist/client/assets/project-app-view-vdCIDY4V.js +0 -1
  256. package/dist/client/assets/record-editor-ChG8xfNH.js +0 -1
  257. package/dist/client/assets/registry-BDvYq0sF.js +0 -2
  258. package/dist/client/assets/roles-BVmBg8nQ.js +0 -1
  259. package/dist/client/assets/secrets-okf3dR05.js +0 -1
  260. package/dist/client/assets/select-CYLZmEqL.js +0 -1
  261. package/dist/client/assets/seo-editor-lx2p6Zbz.js +0 -1
  262. package/dist/client/assets/shell-layout-D3aCzUD1.js +0 -1
  263. package/dist/client/assets/sso-CsR0QPxD.js +0 -1
  264. package/dist/client/assets/store-Dmf6IFoE.js +0 -1
  265. package/dist/client/assets/store-registry-Ci8hLaqa.js +0 -2
  266. package/dist/client/assets/task-row-Dq6a6p3f.js +0 -1
  267. package/dist/client/assets/task-status-vCNfacyn.js +0 -1
  268. package/dist/client/assets/use-automations-DH-tTWJO.js +0 -1
  269. package/dist/client/assets/use-clock-tick-7xgXM9p8.js +0 -1
  270. package/dist/client/assets/use-connection-BoEeMU65.js +0 -1
  271. package/dist/client/assets/use-create-virtual-mcp-DCJ_9oKR.js +0 -1
  272. package/dist/client/assets/use-mcp-client-PdP6F3TE.js +0 -10
  273. package/dist/client/assets/use-organization-settings-BZHnFHzb.js +0 -1
  274. package/dist/client/assets/use-registry-connections-BItKY-Xq.js +0 -1
  275. package/dist/client/assets/use-virtual-mcp-D3Xj1Zyr.js +0 -1
  276. package/dist/client/assets/useInfiniteQuery-CdROm-U7.js +0 -1
  277. package/dist/client/assets/useSuspenseInfiniteQuery-DtKEQU_S.js +0 -1
  278. package/dist/client/assets/variant-calendar-BSvOsjHM.js +0 -1
@@ -1 +0,0 @@
1
- import{c as w,j as s,C as qe,r as T,l as D,v as ie,D as Ss,F as Ns,a as pe,G as V,b as ee,H as _s,I as Cs,t as re,J as ws,M as ks,m as Is,B as Ae,y as zs,P as As,K as $s,k as Ts,i as Ot,e as it,u as ot,E as Dt,o as Ms,s as Os,n as Ds,p as Ps,d as Es,x as Fs,R as Pt,O as Rs,T as Ls}from"./index-OF548fxc.js";import{u as be,S as at,a as ct,b as oe,c as K,d as B,e as dt,f as Et,g as Bs,h as Hs,i as tt,j as Us,k as Gs,l as qs}from"./sidebar-DKxDx7lC.js";import{u as mt}from"./use-mobile-71FrMeIQ.js";import{S as J}from"./skeleton-wLHgTqVy.js";import{i as Ft}from"./LayoutLeft-BIAH0kog.js";import{T as Z}from"./toolbar-icon-button-CBlJ6I0o.js";import{P as De,a as ge,b as Pe}from"./popover-CPAEPhwT.js";import{D as Rt,a as Lt,b as Bt}from"./drawer-Bqwp_rDk.js";import{A as Oe}from"./avatar-B8STW9mD.js";import{a as ae,b as ce,c as st,T as de}from"./tooltip-CKk6MyBG.js";import{a as pt}from"./Eye-BPtPfNj_.js";import{n as Ws,i as Ks}from"./Globe01-CHueNlXT.js";import{i as Xs}from"./ZoomOut-VZDZQqnX.js";import{i as Vs,a as Qs}from"./ZapSquare-DRmIxSdp.js";import{i as Ht}from"./Monitor01-BEHd5v9A.js";import{n as Ys,a as Js}from"./Sun-gt9ujltE.js";import{a as We,b as Zs}from"./Settings02-BXQlyl72.js";import{i as en}from"./Shield01-C5cTYwHG.js";import{a as tn}from"./Users03-DEShSeP4.js";import{a as gt,b as bt,c as Ut,d as sn,A as $e,e as jt,i as nn,s as ln,f as rn}from"./agent-icon-Bw-pYaqu.js";import"./index-Bi8gy8BM.js";import{n as Ke}from"./Stars02-oR68jXM_.js";import{G as on,a as an}from"./github-repo-picker-D7QB7NBL.js";import{I as cn}from"./invite-member-dialog-BuboFMvI.js";import{u as Gt,A as dn,g as mn}from"./agent-capabilities-Bxs0ILD3.js";import{u as un,v as fn,C as xn}from"./connect-desktop-dialog-DU7oJbU_.js";import{i as Xe}from"./ChevronUp-BgfgTfJo.js";import{s as qt}from"./XClose-BlQxiRFv.js";import{u as hn,a as pn}from"./use-join-requests-f9qAAjhC.js";import{i as Wt}from"./ChevronRight-CkirMRmz.js";import{u as gn,R as bn,a as jn,b as ut,r as vn}from"./shell-layout-D3aCzUD1.js";import{i as yn}from"./FilterLines-DCrHo_W-.js";import{T as Sn,a as Nn}from"./toggle-group-CN_l4byE.js";import{u as _n,S as Cn,a as Ue,i as wn}from"./use-mcp-client-PdP6F3TE.js";import{u as Kt,a as Xt}from"./use-virtual-mcp-D3Xj1Zyr.js";import{u as kn,a as ft,b as Vt,T as In}from"./hooks-BPEh0QmD.js";import{c as zn,a as An,b as $n,d as Tn,e as Mn}from"./dialog-Bw0pp5yj.js";import{C as On,a as Dn,b as Pn,c as En,d as Fn}from"./command-DeIgAPPz.js";import{u as Qt}from"./studio-tools-DkATXRgK.js";import{i as Rn}from"./Zap-gCfOy-ns.js";import{S as Yt,M as Ln}from"./shell-controls-CgJrLQ34.js";import{T as Jt}from"./task-row-Dq6a6p3f.js";import{t as xt}from"./ChevronDown-BDi4pzpg.js";import{S as Bn}from"./task-status-vCNfacyn.js";import{S as Zt,u as Hn,g as Un,a as Gn,b as qn}from"./use-navigate-to-agent-DIwK9fdW.js";import{S as Wn,C as Kn}from"./chat-context-D6mGbi6m.js";import{B as vt,a as Xn,b as Vn}from"./breadcrumb-CrhSDATC.js";import{T as W}from"./toolbar-ekp7NSbq.js";import{s as Te}from"./Plus-B3W-zU0m.js";import{i as es}from"./SearchMd-CG-ZdWyV.js";import{A as Qn,a as Yn,b as Jn,c as Zn,d as el,e as tl,f as sl}from"./alert-dialog-Buxux4Jv.js";import{F as nl,a as ll,b as rl,c as il,d as ol,f as al,e as cl}from"./form-BvyPfbLQ.js";import{I as dl}from"./input-C6fESize.js";import"./sheet-S1l6W00L.js";import"./X-DchRughI.js";import"./User01--wnyNy2g.js";import"./AlertCircle-DMGExMxY.js";import"./Tool01-CPfgYpSb.js";import"./SwitchHorizontal01-DKfBMAMt.js";import"./XCircle-BMPeQmo7.js";import"./ArrowUpRight-BYUnq8gY.js";import"./CheckCircle-C5ITwmFz.js";import"./DotsVertical-wFUaTKIr.js";import"./Star01-CaO0nMo9.js";import"./Globe04-D1Ia72FD.js";import"./HardDrive-C5pxB0xX.js";import"./Key01-D_Aswhqq.js";import"./LinkExternal01-vG76nXPe.js";import"./Palette-CUxSqgEM.js";import"./Play-B6SMfN5e.js";import"./SearchLg-CwA3o7Kq.js";import"./Stars01-DjfTA0U2.js";import"./Trash01-De9U-JcA.js";import"./Upload01-XVwkIKd6.js";import"./Users01-DQSxkCun.js";import"./checkbox-B0iPK-Vx.js";import"./collection-search-C_fvYmsw.js";import"./use-debounced-value-CyOmB5fJ.js";import"./use-connection-BoEeMU65.js";import"./use-collections-CdbL-rX2.js";import"./authenticate-and-persist-oauth-cJNik8J_.js";import"./mcp-oauth-DXbhYp2n.js";import"./auth-BZgEN2RD.js";import"./use-mcp-tools-zFZxfr6-.js";import"./extract-connection-data-DB2mp1s-.js";import"./github-installations-DzN1UQ4x.js";import"./select-CYLZmEqL.js";import"./textarea-CiUwXw-w.js";import"./use-org-auth-client-CfqWFlO5.js";import"./use-organization-roles-DLiC1YgM.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CIIT6a-B.js";import"./use-registry-connections-BItKY-Xq.js";import"./use-organization-settings-BZHnFHzb.js";import"./useInfiniteQuery-CdROm-U7.js";import"./use-infinite-scroll-DHUYU_kG.js";import"./card-BWrHlXPo.js";import"./integration-icon-B3836mZm.js";import"./collection-tabs-Bj8UeBuP.js";import"./badge-D5WiG5D4.js";import"./connection-form-helpers-DYr5JaDw.js";import"./useSuspenseInfiniteQuery-DtKEQU_S.js";import"./use-ai-providers-DhQCSBc1.js";import"./use-capability-HK8_0h49.js";import"./required-auth-layout-BFKAd6mb.js";import"./tab-id-CLpu897Q.js";import"./use-org-sso-DnPy8IJo.js";import"./decopilot-sse-pool-D-yGYu6w.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./index-C3UHIWhR.js";import"./use-clock-tick-7xgXM9p8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-decopilot-events-DwY1rJO2.js";import"./label-Cpj2tcAv.js";function ml(t){const e=w.c(5),{onPointerDown:n,onDoubleClick:l}=t,{state:r,isMobile:i}=be();if(i||r==="collapsed")return null;let o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={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]=o,e[1]=a):(o=e[0],a=e[1]);let d;return e[2]!==l||e[3]!==n?(d=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:l,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:o,children:a}),e[2]=l,e[3]=n,e[4]=d):d=e[4],d}const ht=240,ul=400,fl="sidebar.width";function Me(t){return Math.max(ht,Math.min(ul,t))}function xl(){const t=w.c(11),[e,n]=qe(fl,hl),l=T.useRef(null);let r;t[0]!==n||t[1]!==e?(r=m=>{m.preventDefault();const u=m.clientX,f=Me(e),h=l.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=Me(f+(b.clientX-u));h?.style.setProperty("--sidebar-width",`${j}px`)},g=b=>{const j=Me(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]=r):r=t[2];const i=r;let o;t[3]!==n?(o=()=>{n(ht)},t[3]=n,t[4]=o):o=t[4];const a=o;let d;t[5]!==e?(d=Me(e),t[5]=e,t[6]=d):d=t[6];let c;return t[7]!==i||t[8]!==a||t[9]!==d?(c={width:d,wrapperRef:l,onStartResize:i,resetWidth:a},t[7]=i,t[8]=a,t[9]=d,t[10]=c):c=t[10],c}function hl(t){return typeof t=="number"?Me(t):ht}function ts(){return[]}function ss(t){const e=w.c(3),{children:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[0];let r;return e[1]!==n?(r=s.jsxs(at,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[l,s.jsx(ct,{children:s.jsx(oe,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=r):r=e[2],r}function ns(t){const e=w.c(18),{item:n}=t,{isMobile:l,setOpenMobile:r}=be();let i;e[0]!==l||e[1]!==n||e[2]!==r?(i=()=>{ie("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:l}),n.onClick?.(),l&&r(!1)},e[0]=l,e[1]=n,e[2]=r,e[3]=i):i=e[3];const o=i,a=n.key,d=n.isActive&&"z-10";let c;e[4]!==d?(c=D(d),e[4]=d,e[5]=c):c=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]!==o||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==m?(u=s.jsxs(K,{onClick:o,isActive:n.isActive,tooltip:n.label,children:[n.icon,m]}),e[8]=o,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]!==c||e[16]!==u?(f=s.jsx(B,{className:c,children:u},a),e[14]=n.key,e[15]=c,e[16]=u,e[17]=f):f=e[17],f}function pl(t){const e=w.c(12),{section:n}=t;switch(n.type){case"divider":{let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(dt,{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,r=n.group.defaultExpanded;let i;e[2]!==n.group.items?(i=n.group.items.map(bl),e[2]=n.group.items,e[3]=i):i=e[3];let o;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==i?(o=s.jsx(ss,{label:l,defaultExpanded:r,children:i}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=i,e[7]=o):o=e[7],o}case"items":{let l;e[8]!==n.items?(l=n.items.map(gl),e[8]=n.items,e[9]=l):l=e[9];let r;return e[10]!==l?(r=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(oe,{className:"gap-1.5",children:l})})}),e[10]=l,e[11]=r):r=e[11],r}case"custom":return n.content}}function gl(t){return s.jsx(ns,{item:t},t.key)}function bl(t){return s.jsx(ns,{item:t},t.key)}function jl(t){const e=w.c(14),{sections:n,footer:l,additionalContent:r,variant:i,contentClassName:o}=t,a=i===void 0?"sidebar":i;let d;e[0]!==o?(d=D("flex flex-col flex-1 px-2 py-2 gap-0.5",o),e[0]=o,e[1]=d):d=e[1];let c;e[2]!==n?(c=n.map(vl),e[2]=n,e[3]=c):c=e[3];let m;e[4]!==r?(m=r&&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:r}),e[4]=r,e[5]=m):m=e[5];let u;e[6]!==d||e[7]!==c||e[8]!==m?(u=s.jsxs(Et,{className:d,children:[c,m]}),e[6]=d,e[7]=c,e[8]=m,e[9]=u):u=e[9];let f;return e[10]!==l||e[11]!==u||e[12]!==a?(f=s.jsxs(Bs,{variant:a,children:[u,l]}),e[10]=l,e[11]=u,e[12]=a,e[13]=f):f=e[13],f}function vl(t,e){return s.jsx(pl,{section:t},e)}function ls(t){const e=w.c(2);let n;return e[0]!==t?(n=s.jsx(jl,{...t}),e[0]=t,e[1]=n):n=e[1],n}ls.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(J,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function yl(t){const e=w.c(16),{onToggle:n,className:l}=t,i=Ss().logo??Ns,o=typeof i=="string"?i:i.light,a=typeof i=="string"?i:i.dark;let d;e[0]!==l?(d=D("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",l),e[0]=l,e[1]=d):d=e[1];let c;e[2]!==o?(c=s.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain dark:hidden"}),e[2]=o,e[3]=c):c=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]!==c||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:[c,m]})}),e[6]=c,e[7]=m,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ft,{size:16}),e[9]=f):f=e[9];let h;e[10]!==n?(h=s.jsx(Z,{onClick:n,"aria-label":"Toggle sidebar",children:f}),e[10]=n,e[11]=h):h=e[11];let p;return e[12]!==d||e[13]!==u||e[14]!==h?(p=s.jsxs(Hs,{className:d,children:[u,h]}),e[12]=d,e[13]=u,e[14]=h,e[15]=p):p=e[15],p}function yt(t){const e=w.c(18),{item:n,onClose:l}=t,r=n.isActive&&"z-10";let i;e[0]!==r?(i=D(r),e[0]=r,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==l?(o=()=>{n.onClick?.(),l()},e[2]=n,e[3]=l,e[4]=o):o=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 d;e[7]!==n.label?(d=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=d):d=e[8];let c;e[9]!==n.isActive||e[10]!==n.label||e[11]!==o||e[12]!==a||e[13]!==d?(c=s.jsxs(K,{onClick:o,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,d]}),e[9]=n.isActive,e[10]=n.label,e[11]=o,e[12]=a,e[13]=d,e[14]=c):c=e[14];let m;return e[15]!==i||e[16]!==c?(m=s.jsx(B,{className:i,children:c}),e[15]=i,e[16]=c,e[17]=m):m=e[17],m}function Sl(t){const e=w.c(18),{section:n,onClose:l}=t;switch(n.type){case"divider":{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(dt,{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,i=n.group.defaultExpanded;let o;if(e[2]!==l||e[3]!==n.group.items){let d;e[5]!==l?(d=c=>s.jsx(yt,{item:c,onClose:l},c.key),e[5]=l,e[6]=d):d=e[6],o=n.group.items.map(d),e[2]=l,e[3]=n.group.items,e[4]=o}else o=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==o?(a=s.jsx(ss,{label:r,defaultExpanded:i,children:o}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=o,e[10]=a):a=e[10],a}case"items":{let r;if(e[11]!==l||e[12]!==n.items){let o;e[14]!==l?(o=a=>s.jsx(yt,{item:a,onClose:l},a.key),e[14]=l,e[15]=o):o=e[15],r=n.items.map(o),e[11]=l,e[12]=n.items,e[13]=r}else r=e[13];let i;return e[16]!==r?(i=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(oe,{className:"gap-1.5",children:r})})}),e[16]=r,e[17]=i):i=e[17],i}case"custom":return n.content}}function Nl(t){const e=w.c(17),{sections:n,onClose:l,footer:r,additionalContent:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"h-12 shrink-0"}),e[0]=o):o=e[0];let a;e[1]!==l?(a=s.jsx(T.Suspense,{fallback:o,children:s.jsx(yl,{onToggle:l})}),e[1]=l,e[2]=a):a=e[2];let d;if(e[3]!==l||e[4]!==n){let f;e[6]!==l?(f=(h,p)=>s.jsx(Sl,{section:h,onClose:l},p),e[6]=l,e[7]=f):f=e[7],d=n.map(f),e[3]=l,e[4]=n,e[5]=d}else d=e[5];let c;e[8]!==i?(c=i&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:i}),e[8]=i,e[9]=c):c=e[9];let m;e[10]!==d||e[11]!==c?(m=s.jsxs(Et,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[d,c]}),e[10]=d,e[11]=c,e[12]=m):m=e[12];let u;return e[13]!==r||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,r]}),e[13]=r,e[14]=a,e[15]=m,e[16]=u):u=e[16],u}function Le(t){const e=w.c(22),{item:n,onClose:l}=t;if(n.href){const d=n.external?"_blank":void 0,c=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]!==l||e[6]!==d||e[7]!==c||e[8]!==m||e[9]!==u?(f=s.jsxs("a",{href:n.href,target:d,rel:c,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:l,children:[m,u]}),e[4]=n.href,e[5]=l,e[6]=d,e[7]=c,e[8]=m,e[9]=u,e[10]=f):f=e[10],f}let r;e[11]!==n||e[12]!==l?(r=()=>{n.onClick?.(),l()},e[11]=n,e[12]=l,e[13]=r):r=e[13];let i;e[14]!==n.icon?(i=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=i):i=e[15];let o;e[16]!==n.label?(o=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=o):o=e[17];let a;return e[18]!==r||e[19]!==i||e[20]!==o?(a=s.jsxs("button",{type:"button",onClick:r,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:[i,o]}),e[18]=r,e[19]=i,e[20]=o,e[21]=a):a=e[21],a}function St(t){const e=w.c(126),{user:n,userImage:l,menuItems:r,signOutItem:i,themeOptions:o,preferences:a,setPreferences:d,close:c,isMobile:m}=t;if(m){const U=n?.name??"U";let q;e[0]!==U||e[1]!==l?(q=s.jsx(Oe,{url:l,fallback:U,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=U,e[1]=l,e[2]=q):q=e[2];const te=n?.name??"User";let Q;e[3]!==te?(Q=s.jsx("p",{className:"text-sm font-medium truncate",children:te}),e[3]=te,e[4]=Q):Q=e[4];const je=n?.email;let Y;e[5]!==je?(Y=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:je}),e[5]=je,e[6]=Y):Y=e[6];let xe;e[7]!==Q||e[8]!==Y?(xe=s.jsxs("div",{className:"flex-1 min-w-0",children:[Q,Y]}),e[7]=Q,e[8]=Y,e[9]=xe):xe=e[9];let ve;e[10]!==n?(ve=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(kl)},e[10]=n,e[11]=ve):ve=e[11];let se;e[12]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(pt,{size:14}),e[12]=se):se=e[12];let he;e[13]!==ve?(he=s.jsx(ae,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:ve,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:se})}),e[13]=ve,e[14]=he):he=e[14];let ye;e[15]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(ce,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=ye):ye=e[15];let I;e[16]!==he?(I=s.jsx(st,{delayDuration:300,children:s.jsxs(de,{children:[he,ye]})}),e[16]=he,e[17]=I):I=e[17];let P;e[18]!==I||e[19]!==q||e[20]!==xe?(P=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[q,xe,I]}),e[18]=I,e[19]=q,e[20]=xe,e[21]=P):P=e[21];let G;if(e[22]!==c||e[23]!==r){let le;e[25]!==c?(le=Re=>s.jsx(Le,{item:Re,onClose:c},Re.key),e[25]=c,e[26]=le):le=e[26],G=r.map(le),e[22]=c,e[23]=r,e[24]=G}else G=e[24];let R;e[27]!==c||e[28]!==i?(R=s.jsx(Le,{item:i,onClose:c}),e[27]=c,e[28]=i,e[29]=R):R=e[29];let ne;e[30]!==G||e[31]!==R?(ne=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:[G,R]})}),e[30]=G,e[31]=R,e[32]=ne):ne=e[32];let Se;if(e[33]!==a.theme||e[34]!==d||e[35]!==o){let le;e[37]!==a.theme||e[38]!==d?(le=Re=>{const{value:Je,icon:js,label:vs}=Re;return s.jsx("button",{type:"button","aria-label":vs,onClick:()=>d(ys=>({...ys,theme:Je})),className:D("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:js},Je)},e[37]=a.theme,e[38]=d,e[39]=le):le=e[39],Se=o.map(le),e[33]=a.theme,e[34]=d,e[35]=o,e[36]=Se}else Se=e[36];let Ne;e[40]!==Se?(Ne=s.jsx("div",{className:"flex items-center gap-0.5",children:Se}),e[40]=Se,e[41]=Ne):Ne=e[41];const Qe=a.enableSounds?"Disable sounds":"Enable sounds";let _e;e[42]!==d?(_e=()=>d(wl),e[42]=d,e[43]=_e):_e=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 Ce;e[44]!==Ye?(Ce=D("size-8 rounded-md flex items-center justify-center transition-colors",Ye),e[44]=Ye,e[45]=Ce):Ce=e[45];let we;e[46]!==a.enableSounds?(we=a.enableSounds?s.jsx(gt,{size:14}):s.jsx(bt,{size:14}),e[46]=a.enableSounds,e[47]=we):we=e[47];let ke;e[48]!==Qe||e[49]!==_e||e[50]!==Ce||e[51]!==we?(ke=s.jsx("button",{type:"button","aria-label":Qe,onClick:_e,className:Ce,children:we}),e[48]=Qe,e[49]=_e,e[50]=Ce,e[51]=we,e[52]=ke):ke=e[52];let Ee;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.20.1"]}),e[53]=Ee):Ee=e[53];let Ie;e[54]!==ke?(Ie=s.jsxs("div",{className:"flex items-center gap-2",children:[ke,Ee]}),e[54]=ke,e[55]=Ie):Ie=e[55];let ze;e[56]!==Ne||e[57]!==Ie?(ze=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Ne,Ie]}),e[56]=Ne,e[57]=Ie,e[58]=ze):ze=e[58];let Fe;return e[59]!==P||e[60]!==ne||e[61]!==ze?(Fe=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[P,ne,ze]}),e[59]=P,e[60]=ne,e[61]=ze,e[62]=Fe):Fe=e[62],Fe}const u=n?.name??"U";let f;e[63]!==u||e[64]!==l?(f=s.jsx(Oe,{url:l,fallback:u,shape:"circle",size:"sm",className:"shrink-0"}),e[63]=u,e[64]=l,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(Cl)},e[73]=n,e[74]=j):j=e[74];let v;e[75]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(pt,{size:14}),e[75]=v):v=e[75];let y;e[76]!==j?(y=s.jsx(ae,{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 C;e[78]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(ce,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[78]=C):C=e[78];let k;e[79]!==y?(k=s.jsx(st,{delayDuration:300,children:s.jsxs(de,{children:[y,C]})}),e[79]=y,e[80]=k):k=e[80];let S;e[81]!==k||e[82]!==f||e[83]!==b?(S=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]=S):S=e[84];let N;if(e[85]!==c||e[86]!==r){let U;e[88]!==c?(U=q=>s.jsx(Le,{item:q,onClose:c},q.key),e[88]=c,e[89]=U):U=e[89],N=r.map(U),e[85]=c,e[86]=r,e[87]=N}else N=e[87];let _;e[90]!==c||e[91]!==i?(_=s.jsx(Le,{item:i,onClose:c}),e[90]=c,e[91]=i,e[92]=_):_=e[92];let z;e[93]!==N||e[94]!==_?(z=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[N,_]}),e[93]=N,e[94]=_,e[95]=z):z=e[95];let O;if(e[96]!==a.theme||e[97]!==d||e[98]!==o){let U;e[100]!==a.theme||e[101]!==d?(U=q=>{const{value:te,icon:Q,label:je}=q;return s.jsx("button",{type:"button","aria-label":je,onClick:()=>d(Y=>({...Y,theme:te})),className:D("size-7 rounded-md flex items-center justify-center transition-colors",a.theme===te?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Q},te)},e[100]=a.theme,e[101]=d,e[102]=U):U=e[102],O=o.map(U),e[96]=a.theme,e[97]=d,e[98]=o,e[99]=O}else O=e[99];let A;e[103]!==O?(A=s.jsx("div",{className:"flex items-center gap-0.5",children:O}),e[103]=O,e[104]=A):A=e[104];const $=a.enableSounds?"Disable sounds":"Enable sounds";let E;e[105]!==d?(E=()=>d(_l),e[105]=d,e[106]=E):E=e[106];const H=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let F;e[107]!==H?(F=D("size-7 rounded-md flex items-center justify-center transition-colors",H),e[107]=H,e[108]=F):F=e[108];let L;e[109]!==a.enableSounds?(L=a.enableSounds?s.jsx(gt,{size:14}):s.jsx(bt,{size:14}),e[109]=a.enableSounds,e[110]=L):L=e[110];let M;e[111]!==$||e[112]!==E||e[113]!==F||e[114]!==L?(M=s.jsx("button",{type:"button","aria-label":$,onClick:E,className:F,children:L}),e[111]=$,e[112]=E,e[113]=F,e[114]=L,e[115]=M):M=e[115];let X;e[116]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.20.1"]}),e[116]=X):X=e[116];let me;e[117]!==M?(me=s.jsxs("div",{className:"flex items-center gap-2",children:[M,X]}),e[117]=M,e[118]=me):me=e[118];let ue;e[119]!==A||e[120]!==me?(ue=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[A,me]}),e[119]=A,e[120]=me,e[121]=ue):ue=e[121];let fe;return e[122]!==S||e[123]!==z||e[124]!==ue?(fe=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[S,z,ue]})}),e[122]=S,e[123]=z,e[124]=ue,e[125]=fe):fe=e[125],fe}function _l(t){return{...t,enableSounds:!t.enableSounds}}function Cl(){re.success("User ID copied")}function wl(t){return{...t,enableSounds:!t.enableSounds}}function kl(){re.success("User ID copied")}function nt(){const t=w.c(34),{data:e}=pe.useSession(),{org:n}=V(),l=ee();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org",shouldThrow:!1},t[0]=r):r=t[0];const o=_s(r)?.params.org,[a,d]=Cs(),c=mt(),[m,u]=T.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(We,{size:16}),t[2]=g):g=t[2];let b;t[3]!==l||t[4]!==o?(b={key:"preferences",label:"Preferences",icon:g,onClick:()=>{l({to:"/$org/settings/profile",params:{org:o??""}})}},t[3]=l,t[4]=o,t[5]=b):b=t[5];let j;t[6]!==n||t[7]!==l?(j=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Ws,{size:16}),onClick:()=>{l({to:"/$org/install",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=l,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(Xs,{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(en,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=y):y=t[10];let C;t[11]===Symbol.for("react.memo_cache_sentinel")?(C={key:"github",label:"decocms/studio",icon:s.jsx(ws,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=C):C=t[11];let k;t[12]===Symbol.for("react.memo_cache_sentinel")?(k={key:"community",label:"Community",icon:s.jsx(tn,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=k):k=t[12];let S;t[13]===Symbol.for("react.memo_cache_sentinel")?(S={key:"homepage",label:"Homepage",icon:s.jsx(Ks,{size:16}),href:"https://decocms.com",external:!0},t[13]=S):S=t[13];let N;t[14]!==b||t[15]!==j?(N=[b,...j,v,y,C,k,S],t[14]=b,t[15]=j,t[16]=N):N=t[16];const _=N;let z;t[17]===Symbol.for("react.memo_cache_sentinel")?(z={key:"logout",label:"Sign out",icon:s.jsx(Vs,{size:16}),onClick:zl},t[17]=z):z=t[17];const O=z;let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A={value:"light",icon:s.jsx(Ys,{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(Js,{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(Ht,{size:14}),label:"System theme"}],t[20]=E):E=t[20];const H=E;let F;t[21]!==c||t[22]!==_||t[23]!==a||t[24]!==d||t[25]!==f||t[26]!==h?(F={user:f,userImage:h,menuItems:_,signOutItem:O,themeOptions:H,preferences:a,setPreferences:d,close:x,isMobile:c},t[21]=c,t[22]=_,t[23]=a,t[24]=d,t[25]=f,t[26]=h,t[27]=F):F=t[27];const L=F;let M;return t[28]!==c||t[29]!==m||t[30]!==L||t[31]!==f?.name||t[32]!==h?(M=s.jsx(s.Fragment,{children:c?s.jsxs(Rt,{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(Oe,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Lt,{className:"h-[80dvh] p-0",children:[s.jsx(Bt,{className:"sr-only",children:"Account"}),s.jsx(St,{...L})]})]}):s.jsxs(De,{open:m,onOpenChange:u,children:[s.jsx(ge,{asChild:!0,children:s.jsxs(K,{tooltip:f?.name??"Account",className:"rounded-md",children:[s.jsx(Oe,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Pe,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:Il,children:s.jsx(St,{...L})})]})}),t[28]=c,t[29]=m,t[30]=L,t[31]=f?.name,t[32]=h,t[33]=M):M=t[33],M}function Il(t){return t.preventDefault()}function zl(){ie("signed_out",{source:"account_popover"}),ks(),pe.signOut()}const Nt=["requires_action","in_progress","failed","expired","completed"];function Al(t){const e=new Map(Nt.map(n=>[n,[]]));for(const n of t){const l=n.status??"completed";(e.get(l)??e.get("completed")).push(n)}return Nt.map(n=>({status:n,threads:e.get(n)}))}function lt(){const t=w.c(22),e=un(),[n,l]=T.useState(!1);let r;if(t[0]!==e.capabilities||t[1]!==e.hostname||t[2]!==e.machineId||t[3]!==e.online){const x=fn(e.capabilities);r=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]=r}else r=t[4];const i=r;let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=()=>l(!0),t[5]=o):o=t[5];const a=e.online?"Desktop linked":"Connect your desktop";let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ht,{size:16}),t[6]=d):d=t[6];let c;t[7]!==e.online?(c=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]=c):c=t[8];let m;t[9]!==a||t[10]!==c?(m=s.jsx(ae,{asChild:!0,children:s.jsxs(Z,{onClick:o,"aria-label":a,children:[d,c]})}),t[9]=a,t[10]=c,t[11]=m):m=t[11];let u;t[12]!==i?(u=s.jsx(ce,{side:"bottom",children:i}),t[12]=i,t[13]=u):u=t[13];let f;t[14]!==m||t[15]!==u?(f=s.jsxs(de,{children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16];let h;t[17]!==n?(h=s.jsx(xn,{open:n,onOpenChange:l}),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 $l({invitation:t}){const[e,n]=T.useState(!1),[l,r]=T.useState(!1),i=Is(),o=async()=>{n(!0);try{const c=await pe.organization.acceptInvitation({invitationId:t.id});if(c.error){re.error(c.error.message),n(!1);return}}catch{re.error("Failed to accept invitation"),n(!1);return}re.success("Invitation accepted!"),zs();let d;try{d=(await pe.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=d?`/${d}`:"/"},a=async()=>{r(!0);try{const d=await pe.organization.rejectInvitation({invitationId:t.id});d.error?(re.error(d.error.message),r(!1)):(re.success("Invitation declined"),i.invalidateQueries())}catch{re.error("Failed to decline invitation"),r(!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(Ae,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:o,disabled:e||l,"aria-label":"Accept invitation",children:s.jsx(Xe,{size:14})}),s.jsx(Ae,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||l,"aria-label":"Decline invitation",children:s.jsx(qt,{size:14})})]})]})}function Tl(t){const e=w.c(29),{request:n}=t,{approve:l,deny:r}=hn(),i=l.isPending||r.isPending,o=n.user?.name??n.user?.email??n.userId,a=n.user?.image??void 0;let d;e[0]!==o?(d=o.charAt(0).toUpperCase(),e[0]=o,e[1]=d):d=e[1];let c;e[2]!==a||e[3]!==d?(c=s.jsx(Oe,{url:a,fallback:d,shape:"circle",size:"sm"}),e[2]=a,e[3]=d,e[4]=c):c=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]!==o?(u=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,s.jsx("p",{className:"text-sm font-medium truncate",children:o})]}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==l||e[9]!==n.id?(f=()=>l.mutate(n.id),e[8]=l,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]!==i||e[13]!==f?(p=s.jsx(Ae,{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:i,"aria-label":"Approve join request",children:h}),e[12]=i,e[13]=f,e[14]=p):p=e[14];let x;e[15]!==r||e[16]!==n.id?(x=()=>r.mutate(n.id),e[15]=r,e[16]=n.id,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(qt,{size:14}),e[18]=g):g=e[18];let b;e[19]!==i||e[20]!==x?(b=s.jsx(Ae,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:x,disabled:i,"aria-label":"Deny join request",children:g}),e[19]=i,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]!==c||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:[c,u,j]}),e[25]=j,e[26]=c,e[27]=u,e[28]=v):v=e[28],v}function Ml(t){const e=w.c(14),{release:n,isSeen:l,onSelect:r}=t;let i;e[0]!==l?(i=!l&&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]=l,e[1]=i):i=e[1];let o;e[2]!==n.eyebrow?(o=n.eyebrow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.eyebrow}),e[2]=n.eyebrow,e[3]=o):o=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 d;e[6]!==o||e[7]!==a?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[o,a]}),e[6]=o,e[7]=a,e[8]=d):d=e[8];let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Wt,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=c):c=e[9];let m;return e[10]!==r||e[11]!==i||e[12]!==d?(m=s.jsxs("button",{type:"button",onClick:r,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:[i,d,c]}),e[10]=r,e[11]=i,e[12]=d,e[13]=m):m=e[13],m}function Ol(){const t=T.useContext(As),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(l=>l.status==="pending"&&new Date(l.expiresAt)>new Date)}function rs(){const t=w.c(11),{isSeen:e,markSeen:n,unseenCount:l}=gn(),r=Ol(),i=pn();let o;if(t[0]!==e||t[1]!==r||t[2]!==i){const c=[...i].sort(Rl).map(Fl),m=[...r].sort(El).map(Pl);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=[...bn].sort(Dl).map(u);o=[...c,...m,...f],t[0]=e,t[1]=r,t[2]=i,t[3]=o}else o=t[3];const a=l+r.length+i.length;let d;return t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a?(d={items:o,pendingInvitations:r,redDotCount:a,markReleaseSeen:n},t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=d):d=t[10],d}function Dl(t,e){return new Date(e.date).getTime()-new Date(t.date).getTime()}function Pl(t){return{type:"invitation",invitation:t}}function El(t,e){return new Date(t.expiresAt).getTime()-new Date(e.expiresAt).getTime()}function Fl(t){return{type:"join-request",request:t}}function Rl(t,e){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}class is extends T.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 os(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Ll(){const t=w.c(17),e=ee(),{org:n}=V(),{hasDecoKey:l,balanceDollars:r}=Gt();if(!l)return null;let i;t[0]!==r?(i=r!=null?`Credits: $${r.toFixed(2)}`:"Credits",t[0]=r,t[1]=i):i=t[1];let o;t[2]!==r?(o=D(r!=null&&os(r)),t[2]=r,t[3]=o):o=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 d;t[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ut,{}),t[7]=d):d=t[7];let c;t[8]!==r?(c=r!=null?`$${r.toFixed(2)}`:"Credits",t[8]=r,t[9]=c):c=t[9];let m;t[10]!==c?(m=s.jsx("span",{children:c}),t[10]=c,t[11]=m):m=t[11];let u;return t[12]!==i||t[13]!==o||t[14]!==a||t[15]!==m?(u=s.jsx(oe,{children:s.jsx(B,{children:s.jsxs(K,{tooltip:i,className:o,onClick:a,children:[d,m]})})}),t[12]=i,t[13]=o,t[14]=a,t[15]=m,t[16]=u):u=t[16],u}function Bl(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(is,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(Ll,{})})}),t[0]=e):e=t[0],e}function Hl(){const t=w.c(17),e=ee(),{org:n}=V(),{hasDecoKey:l,balanceDollars:r}=Gt();if(!l)return null;let i;t[0]!==r?(i=r!=null?`Credits: $${r.toFixed(2)}`:"Credits",t[0]=r,t[1]=i):i=t[1];const o=i;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 d;t[5]!==r?(d=D(r!=null&&os(r)),t[5]=r,t[6]=d):d=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ut,{className:"size-4"}),t[7]=c):c=t[7];let m;t[8]!==a||t[9]!==d||t[10]!==o?(m=s.jsx(ae,{asChild:!0,children:s.jsx(Z,{"aria-label":o,onClick:a,className:d,children:c})}),t[8]=a,t[9]=d,t[10]=o,t[11]=m):m=t[11];let u;t[12]!==o?(u=s.jsx(ce,{side:"top",children:o}),t[12]=o,t[13]=u):u=t[13];let f;return t[14]!==m||t[15]!==u?(f=s.jsxs(de,{delayDuration:300,children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16],f}function Ul(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(is,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(Hl,{})})}),t[0]=e):e=t[0],e}function as(t){const e=w.c(15),{children:n}=t,{items:l,markReleaseSeen:r}=rs(),[i,o]=T.useState(null);let a;if(e[0]!==l||e[1]!==i){let x;e[3]!==i?(x=g=>g.type==="release"&&g.release.id===i,e[3]=i,e[4]=x):x=e[4],a=l.find(x),e[0]=l,e[1]=i,e[2]=a}else a=e[2];const d=a,c=d?.type==="release"?d.release:null;let m;e[5]!==r?(m=x=>{o(x),r(x)},e[5]=r,e[6]=m):m=e[6];const u=m;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x||o(null)},e[7]=f):f=e[7];let h;e[8]!==u||e[9]!==l||e[10]!==c?(h=s.jsx(Pe,{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:c?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(Ae,{size:"icon",variant:"ghost","aria-label":"Back to inbox",className:"size-7 text-muted-foreground",onClick:()=>o(null),children:s.jsx(Zs,{size:16})}),s.jsx("h3",{className:"text-sm font-medium truncate",children:c.title})]}),s.jsx("div",{className:"overflow-y-auto flex-1 p-5",children:s.jsx(jn,{release:c})})]}):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"})}),l.length===0?s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[s.jsx(Ke,{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:l.map(x=>x.type==="join-request"?s.jsx(Tl,{request:x.request},`req-${x.request.id}`):x.type==="invitation"?s.jsx($l,{invitation:x.invitation},`inv-${x.invitation.id}`):s.jsx(Ml,{release:x.release,isSeen:x.isSeen,onSelect:()=>u(x.release.id)},`rel-${x.release.id}`))})]})}),e[8]=u,e[9]=l,e[10]=c,e[11]=h):h=e[11];let p;return e[12]!==n||e[13]!==h?(p=s.jsxs(De,{onOpenChange:f,children:[n,h]}),e[12]=n,e[13]=h,e[14]=p):p=e[14],p}function cs(){const{redDotCount:t}=rs();return t>0}function Gl(){const t=w.c(6),e=cs();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ke,{}),t[0]=n):n=t[0];let l;t[1]!==e?(l=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]=l):l=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{children:"Inbox"}),t[3]=r):r=t[3];let i;return t[4]!==l?(i=s.jsx(as,{children:s.jsx(ge,{asChild:!0,children:s.jsxs(K,{tooltip:"Inbox",className:"relative",children:[n,l,r]})})}),t[4]=l,t[5]=i):i=t[5],i}function ql(){const t=w.c(8),e=cs();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ke,{className:"size-4"}),t[0]=n):n=t[0];let l;t[1]!==e?(l=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]=l):l=t[2];let r;t[3]!==l?(r=s.jsx(ge,{asChild:!0,children:s.jsx(ae,{asChild:!0,children:s.jsxs(Z,{"aria-label":"Inbox",children:[n,l]})})}),t[3]=l,t[4]=r):r=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ce,{side:"top",children:"Inbox"}),t[5]=i):i=t[5];let o;return t[6]!==r?(o=s.jsx(as,{children:s.jsxs(de,{delayDuration:300,children:[r,i]})}),t[6]=r,t[7]=o):o=t[7],o}function Wl(){const t=w.c(7),e=ee(),{org:n}=V();let l;t[0]!==e||t[1]!==n.slug?(l=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=l):l=t[2];let r,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(We,{}),i=s.jsx("span",{children:"Settings"}),t[3]=r,t[4]=i):(r=t[3],i=t[4]);let o;return t[5]!==l?(o=s.jsxs(K,{tooltip:"Settings",onClick:l,children:[r,i]}),t[5]=l,t[6]=o):o=t[6],o}function Kl(){const t=w.c(9),e=ee(),{org:n}=V();let l;t[0]!==e||t[1]!==n.slug?(l=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=l):l=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(We,{className:"size-4"}),t[3]=r):r=t[3];let i;t[4]!==l?(i=s.jsx(ae,{asChild:!0,children:s.jsx(Z,{"aria-label":"Settings",onClick:l,children:r})}),t[4]=l,t[5]=i):i=t[5];let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ce,{side:"top",children:"Settings"}),t[6]=o):o=t[6];let a;return t[7]!==i?(a=s.jsxs(de,{delayDuration:300,children:[i,o]}),t[7]=i,t[8]=a):a=t[8],a}function Xl(){const t=w.c(10),[e,n]=T.useState(!1),[l,r]=T.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(B,{children:s.jsx(cn,{trigger:s.jsxs(K,{tooltip:"Invite members",children:[s.jsx(sn,{}),s.jsx("span",{children:"Invite members"})]})})}),t[0]=i):i=t[0];let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(B,{children:s.jsxs(K,{tooltip:"Add repo",onClick:()=>n(!0),children:[s.jsx(on,{}),s.jsx("span",{children:"Add repo"})]})}),t[1]=o):o=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs(oe,{className:"gap-0.5",children:[i,o,s.jsx(B,{children:s.jsxs(K,{tooltip:"Add connection",onClick:()=>r(!0),children:[s.jsx(Qs,{}),s.jsx("span",{children:"Add connection"})]})})]}),t[2]=a):a=t[2];let d;t[3]!==e?(d=s.jsx(an,{open:e,onOpenChange:n,mode:"connection"}),t[3]=e,t[4]=d):d=t[4];let c;t[5]!==l?(c=s.jsx(dn,{open:l,onOpenChange:r,mode:"browse"}),t[5]=l,t[6]=c):c=t[6];let m;return t[7]!==d||t[8]!==c?(m=s.jsxs(s.Fragment,{children:[a,d,c]}),t[7]=d,t[8]=c,t[9]=m):m=t[9],m}function Vl(){const t=w.c(8),{state:e}=be();if(e==="collapsed"){let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Bl,{}),t[0]=o):o=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(B,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(lt,{})})}),t[1]=a):a=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(B,{children:s.jsx(Gl,{})}),t[2]=d):d=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(B,{children:s.jsx(Wl,{})}),t[3]=c):c=t[3];let m;return t[4]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs(tt,{className:"px-2 pb-3 gap-1",children:[o,s.jsxs(oe,{children:[a,d,c,s.jsx(B,{children:s.jsx(nt,{})})]})]}),t[4]=m):m=t[4],m}let l,r;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Xl,{}),r=s.jsx(dt,{className:"mx-0"}),t[5]=l,t[6]=r):(l=t[5],r=t[6]);let i;return t[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(tt,{className:"px-2 pb-3 gap-1.5",children:[l,r,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(oe,{children:s.jsx(B,{children:s.jsx(nt,{})})})}),s.jsx(Kl,{}),s.jsx(ql,{}),s.jsx(lt,{}),s.jsx(Ul,{})]})]}),t[7]=i):i=t[7],i}function Ql(){const t=w.c(8),e=ee(),{org:n}=V(),{setOpenMobile:l}=be();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(oe,{children:s.jsx(B,{children:s.jsx(nt,{})})})}),t[0]=r):r=t[0];let i;t[1]!==e||t[2]!==n.slug||t[3]!==l?(i=()=>{e({to:"/$org/settings",params:{org:n.slug}}),l(!1)},t[1]=e,t[2]=n.slug,t[3]=l,t[4]=i):i=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(We,{className:"size-4"}),t[5]=o):o=t[5];let a;return t[6]!==i?(a=s.jsx(tt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[r,s.jsx(Z,{"aria-label":"Settings",onClick:i,children:o})]})}),t[6]=i,t[7]=a):a=t[7],a}function _t(t){const e=w.c(15),{className:n,wrapperClassName:l,children:r}=t,[i,o]=T.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=b=>{b&&o(b.scrollHeight>b.clientHeight+1)},e[0]=a):a=e[0];const d=a;let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=b=>{const j=b.currentTarget;o(j.scrollHeight-j.scrollTop>j.clientHeight+1)},e[1]=c):c=e[1];const m=c;let u;e[2]!==l?(u=D("relative",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==r||e[5]!==n?(f=s.jsx("div",{ref:d,onScroll:m,className:n,children:r}),e[4]=r,e[5]=n,e[6]=f):f=e[6];const h=i?"opacity-100":"opacity-0";let p;e[7]!==h?(p=D("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 Yl(t){const e=w.c(8),{virtualMcpId:n,size:l,showAutomationBadge:r}=t,i=l===void 0?"sm":l;let o;e[0]!==i||e[1]!==n?(o=n?s.jsx(Jl,{virtualMcpId:n,size:i}):s.jsx($e,{icon:null,name:"?",size:i}),e[0]=i,e[1]=n,e[2]=o):o=e[2];let a;e[3]!==r?(a=r&&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(Rn,{size:10,className:"text-white"})}),e[3]=r,e[4]=a):a=e[4];let d;return e[5]!==o||e[6]!==a?(d=s.jsxs("div",{className:"relative shrink-0",children:[o,a]}),e[5]=o,e[6]=a,e[7]=d):d=e[7],d}function Jl(t){const e=w.c(6),{virtualMcpId:n,size:l}=t,r=Kt(n);if(!r){let a;return e[0]!==l?(a=s.jsx($e,{icon:null,name:"?",size:l}),e[0]=l,e[1]=a):a=e[1],a}const i=r.icon??null;let o;return e[2]!==r.title||e[3]!==l||e[4]!==i?(o=s.jsx($e,{icon:i,name:r.title,size:l}),e[2]=r.title,e[3]=l,e[4]=i,e[5]=o):o=e[5],o}function Ct(t){const e=w.c(36),{open:n,onOpenChange:l}=t,[r,i]=T.useState(""),{org:o}=V(),{setTaskId:a}=ut(),d=Qt();let c,m,u;e[0]!==o.id||e[1]!==r?(u=r.trim(),m=Ts,c=$s.globalSearch(o.id,u),e[0]=o.id,e[1]=r,e[2]=c,e[3]=m,e[4]=u):(c=e[2],m=e[3],u=e[4]);const f=n&&u.length>0;let h;e[5]!==d||e[6]!==u?(h=async()=>await d.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=d,e[6]=u,e[7]=h):h=e[7];let p;e[8]!==c||e[9]!==f||e[10]!==h?(p={queryKey:c,enabled:f,queryFn:h,staleTime:1e4},e[8]=c,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]!==l?(v=$=>{$||i(""),l($)},e[14]=l,e[15]=v):v=e[15];const y=v;let C;e[16]!==y||e[17]!==a?(C=$=>{y(!1),a($.id,$.virtual_mcp_id??void 0)},e[16]=y,e[17]=a,e[18]=C):C=e[18];const k=C;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs(zn,{className:"sr-only",children:[s.jsx(An,{children:"Search"}),s.jsx($n,{children:"Search across your organization's resources."})]}),e[19]=S):S=e[19];let N;e[20]!==r?(N=s.jsx(Pn,{value:r,onValueChange:i,placeholder:"Search..."}),e[20]=r,e[21]=N):N=e[21];let _;e[22]!==k||e[23]!==g||e[24]!==j||e[25]!==u?(_=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(On,{children:"No results."}):j.map($=>$.type==="thread"?s.jsxs(Dn,{value:`thread:${$.id}:${$.title}`,onSelect:()=>k($),className:"gap-2.5",children:[s.jsx(Yl,{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]=_):_=e[26];let z;e[27]!==_?(z=s.jsx(En,{children:_}),e[27]=_,e[28]=z):z=e[28];let O;e[29]!==N||e[30]!==z?(O=s.jsxs(Tn,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,s.jsxs(Fn,{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:[N,z]})]}),e[29]=N,e[30]=z,e[31]=O):O=e[31];let A;return e[32]!==y||e[33]!==n||e[34]!==O?(A=s.jsx(Mn,{open:n,onOpenChange:y,children:O}),e[32]=y,e[33]=n,e[34]=O,e[35]=A):A=e[35],A}const Zl="sidebar.group.expanded.";function er(t,e){const n=w.c(3),[l,r]=qe(`${Zl}${t}`,e);let i;return n[0]!==l||n[1]!==r?(i=[l,r],n[0]=l,n[1]=r,n[2]=i):i=n[2],i}function ds(t){const e=w.c(12),{onClick:n,isFetching:l,indented:r}=t,i=r?"-ml-4 pl-6 pr-2":"px-2";let o;e[0]!==i?(o=D("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",i,"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]=i,e[1]=o):o=e[1];let a;e[2]!==l?(a=l&&s.jsx(Ot,{size:14,className:"animate-spin"}),e[2]=l,e[3]=a):a=e[3];const d=l?"Loading…":"Show more";let c;e[4]!==d?(c=s.jsx("span",{children:d}),e[4]=d,e[5]=c):c=e[5];let m;return e[6]!==l||e[7]!==n||e[8]!==o||e[9]!==a||e[10]!==c?(m=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:l,className:o,children:[a,c]}),e[6]=l,e[7]=n,e[8]=o,e[9]=a,e[10]=c,e[11]=m):m=e[11],m}function tr(t,e,n,l){return[t,e,n,l.type,l.member,l.currentUserId??""].join("|")}function sr(t){return t.member==="mine"&&!t.currentUserId}const ms=4;let He=0;const rt=[];function nr(){for(;He<ms&&rt.length>0;){const t=rt.shift();t&&t()}}function us(t){return new Promise((e,n)=>{const l=()=>{He++,t().then(e,n).finally(()=>{He--,nr()})};He<ms?l():rt.push(l)})}const Ve=10;function wt(t,e,n,l,r){const i={hidden:!1};l.member==="mine"&&l.currentUserId&&(i.created_by=l.currentUserId),l.type==="automation"&&(i.has_trigger=!0),l.type==="manual"&&(i.has_trigger=!1);const o={where:i,limit:r,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return o.status=e,o}function lr(t,e,n,l){let r=0;for(const i of t)fs(i,e,n,l)&&r++;return r}function Ze(t,e,n,l){return lr(t,e,n,l)}function rr(t,e){return!!(t>=Ve||t===0&&e)}function kt(t,e){return t<e}function ir(t,e){return e===!1?!1:e===!0?!0:t}function fs(t,e,n,l){return!(t.hidden||(t.status??"completed")!==n||l.member==="mine"&&l.currentUserId&&t.created_by!==l.currentUserId||l.type==="automation"&&!t.trigger_id||l.type==="manual"&&t.trigger_id)}const Ge=new Map,Be=new Map;function or(t,e){return e?t>=Ve?!0:null:!1}function It(t){return Ge.get(t)}function ar(t,e){Ge.set(t,e)}function cr(t,e,n){const l=Ge.get(t);if(l!==void 0){n(l);return}let r=Be.get(t);r||(r=us(e).then(i=>(Ge.set(t,i),Be.delete(t),i)).catch(()=>(Be.delete(t),Promise.reject(new Error("group probe failed")))),Be.set(t,r)),r.then(n,()=>n(!1))}function zt(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Ve,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function dr(t,e,n,l,r){let i=0;for(const o of t)e.has(o.id)||fs(o,n,l,r)&&i++;return i}function mr(t,e,n,l){const r=w.c(8),{org:i}=V(),o=tr(i.id,t,e,n);let a;r[0]!==n?(a=sr(n),r[0]=n,r[1]=a):a=r[1];const d=a,[c,m]=T.useState({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:null,serverHasMore:null});c.identity!==o&&m({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:null,serverHasMore:null});const u=kn(),{threads:f,hasMore:h}=ft(),p=Ze(f,t,e,n),x=rr(p,h),g=or(p,h),b=Qt();if(c.identity===o&&c.serverHasMore===null){const S=g??It(o);S!==void 0&&m({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:c.probeSubscribedIdentity,serverHasMore:S})}!d&&c.identity===o&&c.serverHasMore===null&&g===null&&It(o)===void 0&&c.probeSubscribedIdentity!==o&&(m(S=>S.identity===o?{...S,isProbing:!0,probeSubscribedIdentity:o}:S),cr(o,async()=>{const S=wt(t,e,0,n,1),N=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:_}=zt(N),z=Ze(u.threads.get(),t,e,n);return _===void 0?!1:kt(z,_)},S=>{m(N=>N.identity!==o?N:{...N,isProbing:!1,serverHasMore:S})}));const v=async function(){if(c.isFetching||c.isProbing||d)return;const N=o;m(_=>_.identity===N?{..._,isFetching:!0}:_);try{const _=Ze(f,t,e,n),z=wt(t,e,_,n,Ve),O=await us(()=>b.call("COLLECTION_THREADS_LIST",z)),{items:A,hasMore:$,totalCount:E}=zt(O),H=new Set(f.map(ur)),F=dr(A,H,t,e,n),L=_;u.mergeThreads(A),m(M=>{if(M.identity!==N)return M;let X;return E!==void 0?X=kt(L+F,E):X=A.length===0||F===0?!1:$,ar(N,X),{...M,isFetching:!1,serverHasMore:X}})}catch(_){const z=_,O=z instanceof Error?z.message:String(z);re.error(`Could not load more tasks: ${O}`),m(A=>A.identity===N?{...A,isFetching:!1}:A)}},y=c.isFetching||c.isProbing,C=!d&&!y&&ir(x,c.serverHasMore);let k;return r[2]!==y||r[3]!==v||r[4]!==C||r[5]!==c.isProbing||r[6]!==c.serverHasMore?(k={hasMore:C,isFetching:y,isProbing:c.isProbing,serverHasMore:c.serverHasMore,loadMore:v},r[2]=y,r[3]=v,r[4]=C,r[5]=c.isProbing,r[6]=c.serverHasMore,r[7]=k):k=r[7],k}function ur(t){return t.id}function fr(t){const e=w.c(18),{status:n,threads:l,activeTaskId:r,onSelectTask:i,onArchiveTask:o,filters:a}=t,{isFetching:d,isProbing:c,loadMore:m,hasMore:u,serverHasMore:f}=mr("status",n,a),[h,p]=T.useState(!1);!h&&l.length===0&&f===!0&&!d&&!c&&(p(!0),queueMicrotask(()=>{m()}));let x;if(e[0]!==r||e[1]!==a||e[2]!==o||e[3]!==i||e[4]!==l){let j;e[6]!==r||e[7]!==a||e[8]!==o||e[9]!==i?(j=v=>s.jsx(Jt,{task:v,isActive:r===v.id,onClick:()=>i(v),onArchive:v.created_by===a.currentUserId?()=>o(v):void 0,showAutomationBadge:!!v.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},v.id),e[6]=r,e[7]=a,e[8]=o,e[9]=i,e[10]=j):j=e[10],x=l.map(j),e[0]=r,e[1]=a,e[2]=o,e[3]=i,e[4]=l,e[5]=x}else x=e[5];let g;e[11]!==u||e[12]!==d||e[13]!==m?(g=(u||d)&&s.jsx(ds,{onClick:()=>{m()},isFetching:d,indented:!0}),e[11]=u,e[12]=d,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 xr(t){const e=w.c(35),{status:n,threads:l,activeTaskId:r,onSelectTask:i,onArchiveTask:o,filters:a}=t,d=Bn[n],c=d.icon,[m,u]=er(`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=S=>{S.target===S.currentTarget&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),h())},e[3]=h,e[4]=p):p=e[4];let x;e[5]!==c||e[6]!==d.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(c,{size:12,className:d.iconClassName})}),e[5]=c,e[6]=d.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(xt,{size:14}):s.jsx(Wt,{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]!==d.label?(j=s.jsx("span",{className:"flex-1 truncate",children:d.label}),e[13]=d.label,e[14]=j):j=e[14];let v;e[15]!==l.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:l.length})}),e[15]=l.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 C;e[24]!==r||e[25]!==m||e[26]!==a||e[27]!==o||e[28]!==i||e[29]!==n||e[30]!==l?(C=m&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(fr,{status:n,threads:l,activeTaskId:r,onSelectTask:i,onArchiveTask:o,filters:a})}),e[24]=r,e[25]=m,e[26]=a,e[27]=o,e[28]=i,e[29]=n,e[30]=l,e[31]=C):C=e[31];let k;return e[32]!==y||e[33]!==C?(k=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[y,C]}),e[32]=y,e[33]=C,e[34]=k):k=e[34],k}function At(t){const e=w.c(34),{threads:n,groupBy:l,activeTaskId:r,onSelectTask:i,onArchiveTask:o,filters:a,hasMore:d,isFetchingMore:c,onLoadMore:m,filtersActive:u}=t;if(n.length===0&&!d&&!c){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ke,{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(l==="status"){let x;if(e[3]!==r||e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==n){let b;e[9]!==r||e[10]!==a||e[11]!==o||e[12]!==i?(b=j=>s.jsx(xr,{status:j.status,threads:j.threads,activeTaskId:r,onSelectTask:i,onArchiveTask:o,filters:a},j.status),e[9]=r,e[10]=a,e[11]=o,e[12]=i,e[13]=b):b=e[13],x=Al(n).map(b),e[3]=r,e[4]=a,e[5]=o,e[6]=i,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]!==r||e[17]!==a||e[18]!==o||e[19]!==i||e[20]!==n){let x;e[22]!==r||e[23]!==a||e[24]!==o||e[25]!==i?(x=g=>s.jsx(Jt,{task:g,isActive:r===g.id,onClick:()=>i(g),onArchive:g.created_by===a.currentUserId?()=>o(g):void 0,showAutomationBadge:!!g.trigger_id,showAgentIcon:!0},g.id),e[22]=r,e[23]=a,e[24]=o,e[25]=i,e[26]=x):x=e[26],f=n.map(x),e[16]=r,e[17]=a,e[18]=o,e[19]=i,e[20]=n,e[21]=f}else f=e[21];let h;e[27]!==d||e[28]!==c||e[29]!==m?(h=(d||c)&&s.jsx(ds,{onClick:m,isFetching:c}),e[27]=d,e[28]=c,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:l,active:r,children:i}=t,[o,a]=T.useState(!1);let d,c,m,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>a(!0),c=()=>a(!1),m=()=>a(!0),u=()=>a(!1),e[0]=d,e[1]=c,e[2]=m,e[3]=u):(d=e[0],c=e[1],m=e[2],u=e[3]);const f=r&&"bg-sidebar-accent text-foreground";let h;e[4]!==f?(h=D(f),e[4]=f,e[5]=h):h=e[5];let p;e[6]!==i||e[7]!==n||e[8]!==l||e[9]!==h?(p=s.jsx(ae,{asChild:!0,children:s.jsx(Z,{"aria-label":n,onClick:l,onPointerEnter:d,onPointerLeave:c,onFocus:m,onBlur:u,className:h,children:i})}),e[6]=i,e[7]=n,e[8]=l,e[9]=h,e[10]=p):p=e[10];let x;e[11]!==n?(x=s.jsx(ce,{side:"bottom",children:n}),e[11]=n,e[12]=x):x=e[12];let g;return e[13]!==o||e[14]!==p||e[15]!==x?(g=s.jsxs(de,{open:o,children:[p,x]}),e[13]=o,e[14]=p,e[15]=x,e[16]=g):g=e[16],g}function et(t){const e=w.c(13),{label:n,value:l,onChange:r,options:i}=t;let o;e[0]!==n?(o=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=o):o=e[1];let a;e[2]!==r?(a=u=>u&&r(u),e[2]=r,e[3]=a):a=e[3];let d;e[4]!==i?(d=i.map(hr),e[4]=i,e[5]=d):d=e[5];let c;e[6]!==a||e[7]!==d||e[8]!==l?(c=s.jsx(Nn,{type:"single",size:"sm",value:l,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:d}),e[6]=a,e[7]=d,e[8]=l,e[9]=c):c=e[9];let m;return e[10]!==o||e[11]!==c?(m=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o,c]}),e[10]=o,e[11]=c,e[12]=m):m=e[12],m}function hr(t){return s.jsxs(Sn,{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 xs({onNavigate:t}={}){const{data:e}=pe.useSession(),n=e?.user?.id,{org:l}=V(),r=_n({connectionId:Cn,orgId:l.id,orgSlug:l.slug}),i=Ue(l.id).id,o=Xt(),{threads:a,hasMore:d,isFetchingMore:c,fetchNextPage:m}=ft(),u=a.filter(I=>!I.hidden),{hide:f}=Vt(),h=ee(),{setTaskId:p,createNewTask:x}=ut(),g=it({strict:!1}),b=ot({strict:!1}),j=g.taskId??null,v=b.virtualmcpid??a.find(I=>I.id===j)?.virtual_mcp_id??null,y=()=>{t?.()},C=[...u].sort((I,P)=>(P.updated_at??"").localeCompare(I.updated_at??"")),[k,S]=T.useState("all"),[N,_]=T.useState("flat"),[z,O]=qe("sidebar-threads-scope-all",!1),[A,$]=T.useState(!1),[E,H]=T.useState(!1),F={type:k,member:"mine",currentUserId:n??null},L=I=>n?I.filter(P=>P.created_by===n):[],M=I=>k==="automation"?I.filter(P=>!!P.trigger_id):k==="manual"?I.filter(P=>!P.trigger_id):I,X=L(C),me=M(X),ue=M(C),fe=z?ue:me,U=I=>{if(n&&I.created_by&&I.created_by!==n)return;const P=I.id===j;if(f(I.id),!P)return;const G=X.find(R=>R.id!==I.id&&R.virtual_mcp_id===I.virtual_mcp_id);y(),G?p(G.id,G.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}})},q=I=>{y(),p(I.id,I.virtual_mcp_id)},te=async I=>{try{const P=await r.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:I,limit:1,offset:0}});return((P.structuredContent??P).items?.length??0)===0}catch{return!1}},Q=async()=>{const I=v??i;ie("sidebar_new_thread_clicked",{virtual_mcp_id:I});const P=X.find(G=>G.virtual_mcp_id===I&&G.title==="New chat");if(P&&await te(P.id)){y(),p(P.id,I);return}y(),x(I)},{state:je,isMobile:Y,toggleSidebar:xe}=be();if(je==="collapsed"&&!Y){const I=Ue(l.id),P=new Map((o??[]).map(R=>[R.id,R])),G=R=>(R?P.get(R):void 0)??(R===i?I:void 0);return s.jsxs(oe,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(B,{children:s.jsx(K,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:xe,children:s.jsx(Ft,{size:16})})}),s.jsx(B,{children:s.jsx(K,{tooltip:"New thread",onClick:()=>{Q()},children:s.jsx(jt,{size:16})})}),fe.map(R=>{const ne=G(R.virtual_mcp_id);return s.jsx(B,{children:s.jsx(K,{tooltip:R.title||"New chat",isActive:R.id===j,onClick:()=>q(R),children:s.jsx($e,{icon:ne?.icon??null,name:ne?.title??"Agent",size:"2xs"})})},R.id)})]})}const se=N!=="flat"||k!=="all"||z===!0,he=s.jsxs(De,{children:[s.jsxs(de,{children:[s.jsx(ae,{asChild:!0,children:s.jsx(ge,{asChild:!0,children:s.jsxs(Z,{"aria-label":"Filter threads",active:se,children:[s.jsx(yn,{size:16}),se&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(ce,{side:"bottom",children:"Filter threads"})]}),s.jsxs(Pe,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(et,{label:"View",value:N,onChange:I=>{ie("tasks_panel_group_by_changed",{to_value:I}),_(I)},options:[{value:"flat",label:"List",icon:s.jsx(ln,{size:13})},{value:"status",label:"Status",icon:s.jsx(rn,{size:13})}]}),s.jsx(et,{label:"Type",value:k,onChange:I=>{ie("tasks_panel_filter_changed",{to_value:I}),S(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=>O(I==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),ye=I=>s.jsx(st,{delayDuration:300,children:s.jsxs("div",{className:D("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(Yt,{}),he]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($t,{label:"Search threads",onClick:()=>{ie("tasks_panel_search_opened"),H(!0),$(!0)},children:s.jsx(nn,{size:16})}),s.jsx($t,{label:"New thread",onClick:()=>{Q()},children:s.jsx(jt,{size:16})})]})]})});return Y?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[ye(!0),s.jsx(_t,{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(At,{threads:fe,groupBy:N,activeTaskId:j,onSelectTask:q,onArchiveTask:U,filters:F,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:se})}),E&&s.jsx(Ct,{open:A,onOpenChange:$})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[ye(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(_t,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(At,{threads:fe,groupBy:N,activeTaskId:j,onSelectTask:q,onArchiveTask:U,filters:F,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:se})})}),E&&s.jsx(Ct,{open:A,onOpenChange:$})]})}const pr=5,gr=[{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 hs(){const t=w.c(3),{state:e}=be();if(e==="collapsed"){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:pr}).map(vr)}),t[0]=r):r=t[0],r}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(J,{className:"size-6 rounded-md"}),s.jsx(J,{className:"size-6 rounded-md"}),s.jsx(J,{className:"size-6 rounded-md"})]}),s.jsx(J,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=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:gr.map(br)})]}),t[2]=l):l=t[2],l}function br(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(J,{className:"size-5 rounded-full shrink-0"}),s.jsx(J,{className:D("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(jr)})]},e)}function jr(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(J,{className:"h-3 flex-1 rounded-sm"})},e)}function vr(t,e){return s.jsx(J,{className:"size-10 rounded-lg mx-auto"},e)}function yr(){const t=w.c(4),e=ts();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Vl,{}),t[0]=n):n=t[0];let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Dt,{children:s.jsx(T.Suspense,{fallback:s.jsx(hs,{}),children:s.jsx(xs,{})})}),t[1]=l):l=t[1];let r;return t[2]!==e?(r=s.jsx(Zt,{children:s.jsx(ls,{sections:e,footer:n,additionalContent:l})}),t[2]=e,t[3]=r):r=t[3],r}function Sr(t){const e=w.c(8),{onClose:n}=t,l=ts();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ql,{}),e[0]=r):r=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(hs,{}),e[1]=i):i=e[1];let o;e[2]!==n?(o=s.jsx(Dt,{children:s.jsx(T.Suspense,{fallback:i,children:s.jsx(xs,{onNavigate:n})})}),e[2]=n,e[3]=o):o=e[3];let a;return e[4]!==n||e[5]!==l||e[6]!==o?(a=s.jsx(Zt,{children:s.jsx(Nl,{sections:l,onClose:n,footer:r,additionalContent:o})}),e[4]=n,e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function ps(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Nr=Ms({name:Os().min(2,"Organization name is required")});function _r(t){const e=w.c(41),{open:n,onOpenChange:l}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={resolver:Ds(Nr),defaultValues:{name:""}},e[0]=r):r=e[0];const i=Ps(r);let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o={mutationFn:wr,onSuccess:Cr},e[1]=o):o=e[1];const a=Es(o),d=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(Jn,{children:[s.jsx(Zn,{children:"Create a new organization"}),s.jsx(el,{children:"Set up a new organization to collaborate with others."})]}),e[2]=c):c=e[2];let m;if(e[3]!==a||e[4]!==i){let S;e[6]!==a?(S=N=>a.mutateAsync(N),e[6]=a,e[7]=S):S=e[7],m=i.handleSubmit(S),e[3]=a,e[4]=i,e[5]=m}else m=e[5];let u;e[8]!==i.formState.isSubmitting?(u=S=>{const{field:N}=S;return s.jsxs(rl,{children:[s.jsx(il,{children:"Organization Name"}),s.jsx(ol,{children:s.jsx(dl,{...N,placeholder:"Acme Inc.",disabled:i.formState.isSubmitting})}),s.jsx(al,{children:"The name of your company or organization"}),N.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:"","/",ps(N.value)]})]}),s.jsx(cl,{})]})},e[8]=i.formState.isSubmitting,e[9]=u):u=e[9];let f;e[10]!==i.control||e[11]!==u?(f=s.jsx(nl,{control:i.control,name:"name",render:u}),e[10]=i.control,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==d?(h=d&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:d}),e[13]=d,e[14]=h):h=e[14];let p;e[15]!==a||e[16]!==i?(p=()=>{a.reset(),i.reset()},e[15]=a,e[16]=i,e[17]=p):p=e[17];let x;e[18]!==i.formState.isSubmitting||e[19]!==p?(x=s.jsx(Qn,{disabled:i.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=i.formState.isSubmitting,e[19]=p,e[20]=x):x=e[20];const g=!i.formState.isValid||i.formState.isSubmitting;let b;e[21]!==i.formState.isSubmitting?(b=i.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Wn,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=i.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==g||e[24]!==b?(j=s.jsx(Ae,{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(tl,{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 C;e[34]!==i||e[35]!==y?(C=s.jsxs(Yn,{children:[c,s.jsx(ll,{...i,children:y})]}),e[34]=i,e[35]=y,e[36]=C):C=e[36];let k;return e[37]!==l||e[38]!==n||e[39]!==C?(k=s.jsx(sl,{open:n,onOpenChange:l,children:C}),e[37]=l,e[38]=n,e[39]=C,e[40]=k):k=e[40],k}function Cr(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function wr(t){const e=ps(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await pe.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const l=n?.data?.slug??e;if(!l)throw new Error("Failed to create organization");return{orgSlug:l}}function kr(t){let e=0;for(let l=0;l<t.length;l++)e=t.charCodeAt(l)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function gs(t){const e=w.c(13),{org:n,size:l}=t,r=l===void 0?"sm":l,i=r==="xs"?"size-5":"size-6",o=r==="xs"?"text-[9px]":"text-xs";let a;e[0]!==i?(a=D(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=a):a=e[1];let d;e[2]!==n.logo||e[3]!==n.name?(d=n.logo?void 0:kr(n.name),e[2]=n.logo,e[3]=n.name,e[4]=d):d=e[4];let c;e[5]!==n.logo||e[6]!==n.name||e[7]!==o?(c=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:D("font-semibold leading-none",o),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=o,e[8]=c):c=e[8];let m;return e[9]!==a||e[10]!==d||e[11]!==c?(m=s.jsx("div",{className:a,style:d,children:c}),e[9]=a,e[10]=d,e[11]=c,e[12]=m):m=e[12],m}function Ir(t){const e=w.c(24),{orgParam:n,onSelectOrg:l,onCreateOrg:r}=t,{data:i}=Fs();let o;e[0]!==n?(o=(_,z)=>_.slug===n?-1:z.slug===n?1:_.name.localeCompare(z.name),e[0]=n,e[1]=o):o=e[1];const a=[...i??[]].sort(o),[d,c]=T.useState(""),m=d.toLowerCase(),u=m?a.filter(_=>_.name.toLowerCase().includes(m)||_.slug.toLowerCase().includes(m)):a;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(es,{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=_=>c(_.target.value),e[3]=h):h=e[3];let p;e[4]!==d?(p=_=>_.key==="Escape"&&d&&c(""),e[4]=d,e[5]=p):p=e[5];let x;e[6]!==d||e[7]!==p?(x=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:d,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]=d,e[7]=p,e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Te,{size:16}),e[9]=g):g=e[9];let b;e[10]!==r?(b=s.jsx("button",{type:"button",onClick:r,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]=r,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:d?`No organizations match "${d}"`:"No organizations available"});let C;e[15]!==l||e[16]!==n?(C=_=>s.jsxs("button",{type:"button",onClick:()=>l(_.slug),className:D("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",_.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(gs,{org:_,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:_.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.slug})]}),_.slug===n&&s.jsx(Xe,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},_.id),e[15]=l,e[16]=n,e[17]=C):C=e[17];const k=u.map(C);let S;e[18]!==y||e[19]!==k?(S=s.jsxs("div",{className:v,children:[y,k]}),e[18]=y,e[19]=k,e[20]=S):S=e[20];let N;return e[21]!==S||e[22]!==j?(N=s.jsxs(s.Fragment,{children:[j,S]}),e[21]=S,e[22]=j,e[23]=N):N=e[23],N}function zr(t){const e=w.c(22),{trigger:n,orgParam:l,align:r,side:i}=t,o=r===void 0?"start":r,a=i===void 0?"bottom":i,d=ee(),[c,m]=T.useState(!1),[u,f]=T.useState(!1);let h;e[0]!==n?(h=s.jsx(ge,{asChild:!0,children:n}),e[0]=n,e[1]=h):h=e[1];const p=String(c);let x;e[2]!==d?(x=k=>{m(!1),d({to:"/$org",params:{org:k}})},e[2]=d,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]!==l||e[6]!==p||e[7]!==x?(b=s.jsx(Ir,{orgParam:l,onSelectOrg:x,onCreateOrg:g},p),e[5]=l,e[6]=p,e[7]=x,e[8]=b):b=e[8];let j;e[9]!==o||e[10]!==a||e[11]!==b?(j=s.jsx(Pe,{side:a,align:o,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:$r,onCloseAutoFocus:Ar,children:b}),e[9]=o,e[10]=a,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==c||e[14]!==h||e[15]!==j?(v=s.jsxs(De,{open:c,onOpenChange:m,children:[h,j]}),e[13]=c,e[14]=h,e[15]=j,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(_r,{open:u,onOpenChange:f}),e[17]=u,e[18]=y):y=e[18];let C;return e[19]!==y||e[20]!==v?(C=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=C):C=e[21],C}function Ar(t){return t.preventDefault()}function $r(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function Tr(t){const e=w.c(21),{value:n,onChange:l,placeholder:r,onKeyDown:i,className:o,isSearching:a,disabled:d}=t,c=r===void 0?"Search...":r;let m;e[0]!==o?(m=D("shrink-0 w-full border-b border-border h-12",o),e[0]=o,e[1]=m):m=e[1];const u=d?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==u?(f=D("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(Ot,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(es,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=h):h=e[5];let p;e[6]!==l?(p=j=>l(j.target.value),e[6]=l,e[7]=p):p=e[7];let x;e[8]!==d||e[9]!==i||e[10]!==c||e[11]!==p||e[12]!==n?(x=s.jsx("input",{type:"text",value:n,onChange:p,onKeyDown:i,placeholder:c,disabled:d,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=d,e[9]=i,e[10]=c,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 Mr="Select an existing agent";function Or(t){const e=w.c(5),{children:n}=t;let l;e[0]!==n?(l=s.jsx(ae,{asChild:!0,children:n}),e[0]=n,e[1]=l):l=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ce,{side:"right",sideOffset:8,children:Mr}),e[2]=r):r=e[2];let i;return e[3]!==l?(i=s.jsxs(de,{defaultOpen:!0,delayDuration:0,children:[l,r]}),e[3]=l,e[4]=i):i=e[4],i}function Dr(t){const e=ee(),{create:n}=Vt(),{locator:l}=V(),r=it({strict:!1}),i=ot({strict:!1});return async o=>{const a=crypto.randomUUID(),d=o===i.virtualmcpid?vn(t,l,r.taskId??""):null;try{await n({id:a,virtual_mcp_id:o,...d?{branch:d}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:o}})}}function Tt(t){const e=w.c(20),{agent:n,selected:l,onClick:r}=t,i=l?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let o;e[0]!==i?(o=D("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",i),e[0]=i,e[1]=o):o=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx($e,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let d;e[5]!==n.title?(d=s.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[5]=n.title,e[6]=d):d=e[6];let c;e[7]!==n.description?(c=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[7]=n.description,e[8]=c):c=e[8];let m;e[9]!==d||e[10]!==c?(m=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,c]}),e[9]=d,e[10]=c,e[11]=m):m=e[11];let u;e[12]!==l?(u=l&&s.jsx(Xe,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=l,e[13]=u):u=e[13];let f;return e[14]!==r||e[15]!==o||e[16]!==a||e[17]!==m||e[18]!==u?(f=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,m,u]}),e[14]=r,e[15]=o,e[16]=a,e[17]=m,e[18]=u,e[19]=f):f=e[19],f}function Pr(t){const e=w.c(23),{onClose:n,onSelectAgent:l,selectedAgentId:r}=t,[i,o]=T.useState(""),a=Xt(),d=a??[],{org:c}=V(),{data:m}=pe.useSession(),u=m?.user?.id??"anon",f=Un(a),h=Gn(),p=Dr(c.slug),x=mn(a),g=i.toLowerCase(),b=d.filter(Er).filter(M=>!x.has(M.id)).filter(M=>!i||M.title.toLowerCase().includes(g)),j=Ue(c.id),v=!i||j.title.toLowerCase().includes(g);let y;e[0]!==n||e[1]!==l?(y=()=>{l?.(null),n(),o("")},e[0]=n,e[1]=l,e[2]=y):y=e[2];const C=y,k=M=>{if(l){l(M.id),n(),o("");return}qn({orgId:c.id,userId:u},M.id,f),h(),n(),o(""),p(M.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let N;e[3]!==i?(N=s.jsx(Tr,{value:i,onChange:o,placeholder:"Search agents..."}),e[3]=i,e[4]=N):N=e[4];const _="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-1",z=l&&v&&j&&s.jsx(Tt,{agent:j,selected:!r||r===j.id,onClick:C}),O=b.map(M=>s.jsx(Tt,{agent:M,selected:l?r===M.id:void 0,onClick:()=>k(M)},M.id));let A;e[5]!==i||e[6]!==b.length?(A=b.length===0&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:i?"No agents found":"No agents yet"}),e[5]=i,e[6]=b.length,e[7]=A):A=e[7];let $;e[8]!==z||e[9]!==O||e[10]!==A?($=s.jsxs("div",{className:_,children:[z,O,A]}),e[8]=z,e[9]=O,e[10]=A,e[11]=$):$=e[11];let E;e[12]!==c.slug?(E={org:c.slug},e[12]=c.slug,e[13]=E):E=e[13];let H;e[14]!==n?(H=()=>n(),e[14]=n,e[15]=H):H=e[15];let F;e[16]!==H||e[17]!==E?(F=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Pt,{to:"/$org/settings/agents",params:E,onClick:H,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[16]=H,e[17]=E,e[18]=F):F=e[18];let L;return e[19]!==F||e[20]!==N||e[21]!==$?(L=s.jsxs("div",{className:S,children:[N,$,F]}),e[19]=F,e[20]=N,e[21]=$,e[22]=L):L=e[22],L}function Er(t){return!wn(t.id)}function Fr(t){const e=w.c(23);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:l,trigger:r,onSelectAgent:i,selectedAgentId:o,side:a,align:d}=n,c=l===void 0?!1:l,m=a===void 0?"right":a,u=d===void 0?"start":d,[f,h]=T.useState(!1),p=mt(),{setOpenMobile:x}=be(),g=Hn(),b=g?"border border-border":void 0;let j;e[2]!==g?(j=_=>g?s.jsx(Or,{children:_}):_,e[2]=g,e[3]=j):j=e[3];const v=j;let y;e[4]!==p||e[5]!==x?(y=()=>{h(!1),p&&x(!1)},e[4]=p,e[5]=x,e[6]=y):y=e[6];const C=y;let k;e[7]!==C||e[8]!==i||e[9]!==f||e[10]!==o?(k=f&&s.jsx(T.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(J,{className:"h-4 w-24"})}),children:s.jsx(Pr,{onClose:C,onSelectAgent:i,selectedAgentId:o})}),e[7]=C,e[8]=i,e[9]=f,e[10]=o,e[11]=k):k=e[11];const S=k;let N;return e[12]!==u||e[13]!==c||e[14]!==b||e[15]!==g||e[16]!==p||e[17]!==f||e[18]!==S||e[19]!==m||e[20]!==r||e[21]!==v?(N=s.jsx(s.Fragment,{children:p?s.jsxs(s.Fragment,{children:[r?s.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:r}):c?v(s.jsx(Z,{"aria-label":"Browse agents",className:D(b),onClick:()=>{ie("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:s.jsx(Te,{className:"size-4"})})):s.jsx(B,{children:v(s.jsxs(K,{tooltip:g?void 0:"Browse agents",className:D(b),onClick:()=>{ie("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:[s.jsx(Te,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Rt,{open:f,onOpenChange:h,direction:"bottom",children:s.jsxs(Lt,{className:"max-h-[85dvh] p-0",children:[s.jsx(Bt,{className:"sr-only",children:"Browse agents"}),S]})})]}):s.jsxs(De,{open:f,onOpenChange:_=>{_&&!f&&ie("agent_browser_opened",{surface:"desktop_popover"}),h(_)},children:[r?s.jsx(ge,{asChild:!0,children:r}):c?v(s.jsx(ge,{asChild:!0,children:s.jsx(Z,{"aria-label":"Browse agents",className:D(b),children:s.jsx(Te,{className:"size-4"})})})):s.jsx(B,{children:v(s.jsx(ge,{asChild:!0,children:s.jsxs(K,{tooltip:g?void 0:"Browse agents",className:D(b),children:[s.jsx(Te,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Pe,{className:"w-[380px] p-0 overflow-hidden",side:m,align:u,children:S})]})}),e[12]=u,e[13]=c,e[14]=b,e[15]=g,e[16]=p,e[17]=f,e[18]=S,e[19]=m,e[20]=r,e[21]=v,e[22]=N):N=e[22],N}const bs="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 Rr(t){const e=w.c(19),{agentId:n,onOpenHome:l,onPick:r}=t,i=Kt(n),o=i?.title??"Decopilot",a=`Open ${o} home`,d=i?.icon??null;let c;e[0]!==d||e[1]!==o?(c=s.jsx($e,{icon:d,name:o,size:"2xs"}),e[0]=d,e[1]=o,e[2]=c):c=e[2];let m;e[3]!==l||e[4]!==a||e[5]!==c?(m=s.jsx("button",{type:"button",onClick:l,"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:c}),e[3]=l,e[4]=a,e[5]=c,e[6]=m):m=e[6];let u;e[7]!==o?(u=s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:o}),e[7]=o,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(xt,{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:bs,children:[u,f]}),e[10]=u,e[11]=h):h=e[11];let p;e[12]!==n||e[13]!==r||e[14]!==h?(p=s.jsx(Fr,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:r,trigger:h}),e[12]=n,e[13]=r,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 Mt(){const t=w.c(33),{org:e}=V(),{state:n}=be(),l=n==="collapsed",r=ee();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[0]=i):i=t[0];const o=it(i);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},t[1]=a):a=t[1];const d=ot(a),{threads:c}=ft(),{setTaskId:m,createNewTask:u}=ut();let f;t[2]!==e.id?(f=Ue(e.id),t[2]=e.id,t[3]=f):f=t[3];const h=f.id,p=o.taskId?d.virtualmcpid??h:h;let x;t[4]!==u||t[5]!==h||t[6]!==r||t[7]!==e.slug||t[8]!==m||t[9]!==c?(x=z=>{if(!z||z===h){r({to:"/$org",params:{org:e.slug}});return}const O=c.find(A=>!A.hidden&&A.virtual_mcp_id===z&&A.title==="New chat"&&(!A.status||A.status==="in_progress"));O?m(O.id,z):u(z)},t[4]=u,t[5]=h,t[6]=r,t[7]=e.slug,t[8]=m,t[9]=c,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(W.Logo,{}),t[13]=j):j=t[13];let v;t[14]!==b?(v=s.jsx(Pt,{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]!==l?(y=!l&&s.jsx(zr,{orgParam:e.slug,trigger:s.jsxs("button",{type:"button",className:bs,children:[s.jsx(gs,{org:e,size:"xs"}),s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:e.name}),s.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"})]})}),t[16]=e,t[17]=l,t[18]=y):y=t[18];let C;t[19]!==v||t[20]!==y?(C=s.jsxs(vt,{className:"gap-0.5",children:[v,y]}),t[19]=v,t[20]=y,t[21]=C):C=t[21];let k;t[22]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("span",{className:"h-4 w-24 rounded bg-muted animate-pulse"}),t[22]=k):k=t[22];let S;t[23]!==p||t[24]!==g?(S=()=>g(p),t[23]=p,t[24]=g,t[25]=S):S=t[25];let N;t[26]!==p||t[27]!==g||t[28]!==S?(N=s.jsx(vt,{children:s.jsx(T.Suspense,{fallback:k,children:s.jsx(Rr,{agentId:p,onOpenHome:S,onPick:g})})}),t[26]=p,t[27]=g,t[28]=S,t[29]=N):N=t[29];let _;return t[30]!==N||t[31]!==C?(_=s.jsx(Xn,{className:"wco-no-drag",children:s.jsxs(Vn,{className:"flex-nowrap",children:[C,N]})}),t[30]=N,t[31]=C,t[32]=_):_=t[32],_}const Lr="sidebar.open";function Br(){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 Yo(){const t=w.c(24),e=mt(),[n,l]=qe(Lr,!1),{width:r,wrapperRef:i,onStartResize:o,resetWidth:a}=xl();let d;t[0]!==e?(d=e?s.jsxs(W.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(Yt,{}),s.jsx(Mt,{}),s.jsx(lt,{}),s.jsx("div",{"aria-hidden":!0,className:"min-w-0"}),s.jsx(W.TogglesSlot,{}),s.jsx(W.TabsSlot,{className:"min-w-0 justify-self-end"})]}),s.jsx(W.CenterSlot,{}),s.jsx(W.RightSlot,{})]}):s.jsxs(W.Header,{children:[s.jsx(W.LeftColumn,{children:s.jsx(Mt,{})}),s.jsx(W.CenterSlot,{}),s.jsxs(W.RightColumn,{children:[s.jsxs("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end items-center gap-0.5",children:[s.jsx(W.TogglesSlot,{}),s.jsx(W.TabsSlot,{})]}),s.jsx(W.RightSlot,{})]})]}),t[0]=e,t[1]=d):d=t[1];const c=`${r}px`;let m;t[2]!==c?(m={"--sidebar-width":c,"--sidebar-width-icon":"3.5rem"},t[2]=c,t[3]=m):m=t[3];const u=m;let f;t[4]!==e||t[5]!==o||t[6]!==a?(f=!e&&s.jsxs(s.Fragment,{children:[s.jsx(yr,{}),s.jsx(ml,{onPointerDown:o,onDoubleClick:a})]}),t[4]=e,t[5]=o,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(T.Suspense,{fallback:s.jsx(Br,{}),children:s.jsx(Rs,{})})})})}),t[9]=p):p=t[9];let x;t[10]!==u||t[11]!==f||t[12]!==i?(x=s.jsxs(Gs,{ref:i,className:"flex-1 bg-sidebar relative min-h-0",style:u,children:[f,p]}),t[10]=u,t[11]=f,t[12]=i,t[13]=x):x=t[13];let g;t[14]!==e?(g=e&&s.jsx(Ln,{renderSidebar:Hr}),t[14]=e,t[15]=g):g=t[15];let b;t[16]!==d||t[17]!==x||t[18]!==g?(b=s.jsx(Kn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[d,x,g]})}),t[16]=d,t[17]=x,t[18]=g,t[19]=b):b=t[19];let j;return t[20]!==l||t[21]!==n||t[22]!==b?(j=s.jsx(In,{children:s.jsx(W.Provider,{children:s.jsx(qs,{open:n,onOpenChange:l,children:b})})}),t[20]=l,t[21]=n,t[22]=b,t[23]=j):j=t[23],j}function Hr(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(Sr,{onClose:e})})})}export{Yo as default};
@@ -1 +0,0 @@
1
- import{c as k,j as n,r as A,G as J,m as xe,l as Q,i as le,ag as Z,t as K,K as te,k as se,B as Y,d as nt,W as it,E as ot,a as rt,b as lt,u as at}from"./index-OF548fxc.js";import{u as ge}from"./use-mobile-71FrMeIQ.js";import{u as ct}from"./useSuspenseQueries-f54Kg_lq.js";import{i as dt,u as ae,m as mt,a as ut,S as ft}from"./use-mcp-client-PdP6F3TE.js";import{a as pt,b as ht,v as xt,u as gt}from"./use-virtual-mcp-D3Xj1Zyr.js";import{i as bt}from"./ChevronUp-BgfgTfJo.js";import{b as Pe,a as Se}from"./ZoomOut-VZDZQqnX.js";import{i as yt,A as ce,t as jt,ae as vt,H as Nt,l as wt}from"./agent-icon-Bw-pYaqu.js";import{s as be}from"./Plus-B3W-zU0m.js";import{i as ye}from"./X-DchRughI.js";import{p as St}from"./index-DBQeQBu7.js";import{b as Me,c as oe,K as Ee,P as ze,D as Le,d as _t,S as Ct,v as It,g as Tt,h as kt,i as $t,f as At,e as Pt,n as Mt,C as re,L as Et,k as zt}from"./library-tab-BBjWEEvH.js";import{f as Lt,d as Ot}from"./tab-id-CLpu897Q.js";import{b as Ht}from"./chat-context-D6mGbi6m.js";import{N as Dt}from"./decopilot-BEN2dFqJ.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-Bxs0ILD3.js";import{u as Oe,a as He,o as Vt}from"./use-organization-settings-BZHnFHzb.js";import{c as je,b as Kt,h as Wt}from"./shell-layout-D3aCzUD1.js";import{I as De}from"./input-C6fESize.js";import{S as qt,t as ve,P as Gt,j as Qt,s as Jt,g as Xt}from"./scroll-area-DVylVd8s.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-S1l6W00L.js";import{S as V}from"./skeleton-wLHgTqVy.js";import{t as Re}from"./ChevronDown-BDi4pzpg.js";import{g as Fe,M as ns}from"./types-CeLnpp7L.js";import{I as Ue}from"./integration-icon-B3836mZm.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-CYLZmEqL.js";import{T as as}from"./textarea-CiUwXw-w.js";import{u as Be}from"./studio-tools-DkATXRgK.js";import{a as cs}from"./use-mcp-tools-zFZxfr6-.js";import{i as ds}from"./XCircle-BMPeQmo7.js";import{g as ms}from"./use-mcp-prompts-UzvitU_e.js";import{b as us,w as fs}from"./hooks-BPEh0QmD.js";import{a as ps,g as hs,c as xs,b as gs,D as bs}from"./dropdown-menu-DBdT-R6w.js";import{s as ys}from"./Trash01-De9U-JcA.js";import{a as js,u as vs}from"./use-ai-providers-DhQCSBc1.js";import{u as Ns}from"./connect-desktop-dialog-DU7oJbU_.js";import{T as ws}from"./toolbar-ekp7NSbq.js";import"./auth-BZgEN2RD.js";import"./use-collections-CdbL-rX2.js";import"./AlertCircle-DMGExMxY.js";import"./Tool01-CPfgYpSb.js";import"./SwitchHorizontal01-DKfBMAMt.js";import"./Settings02-BXQlyl72.js";import"./ArrowUpRight-BYUnq8gY.js";import"./ZapSquare-DRmIxSdp.js";import"./Users03-DEShSeP4.js";import"./CheckCircle-C5ITwmFz.js";import"./ChevronRight-CkirMRmz.js";import"./DotsVertical-wFUaTKIr.js";import"./Stars02-oR68jXM_.js";import"./Eye-BPtPfNj_.js";import"./Globe01-CHueNlXT.js";import"./FilterLines-DCrHo_W-.js";import"./Star01-CaO0nMo9.js";import"./Globe04-D1Ia72FD.js";import"./HardDrive-C5pxB0xX.js";import"./Key01-D_Aswhqq.js";import"./LayoutLeft-BIAH0kog.js";import"./LinkExternal01-vG76nXPe.js";import"./Monitor01-BEHd5v9A.js";import"./Sun-gt9ujltE.js";import"./Palette-CUxSqgEM.js";import"./Play-B6SMfN5e.js";import"./SearchLg-CwA3o7Kq.js";import"./SearchMd-CG-ZdWyV.js";import"./Shield01-C5cTYwHG.js";import"./Stars01-DjfTA0U2.js";import"./Upload01-XVwkIKd6.js";import"./User01--wnyNy2g.js";import"./Users01-DQSxkCun.js";import"./XClose-BlQxiRFv.js";import"./Zap-gCfOy-ns.js";import"./alert-dialog-Buxux4Jv.js";import"./dialog-Bw0pp5yj.js";import"./file-type-icon-CeDR5FDE.js";import"./use-debounced-value-CyOmB5fJ.js";import"./popover-CPAEPhwT.js";import"./tooltip-CKk6MyBG.js";import"./index-C0UjMZmb.js";import"./drawer-Bqwp_rDk.js";import"./collection-search-C_fvYmsw.js";import"./form-BvyPfbLQ.js";import"./label-Cpj2tcAv.js";import"./tabs-B9iGaa-Z.js";import"./toggle-group-CN_l4byE.js";import"./command-DeIgAPPz.js";import"./index-C3UHIWhR.js";import"./useInfiniteQuery-CdROm-U7.js";import"./use-infinite-scroll-DHUYU_kG.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-DwY1rJO2.js";import"./decopilot-sse-pool-D-yGYu6w.js";import"./backoff-CrEUbyZT.js";import"./checkbox-B0iPK-Vx.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-B8STW9mD.js";import"./settings-section-Cd3zmde3.js";import"./card-BWrHlXPo.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CIIT6a-B.js";import"./use-registry-connections-BItKY-Xq.js";import"./use-connection-BoEeMU65.js";import"./extract-connection-data-DB2mp1s-.js";import"./collection-tabs-Bj8UeBuP.js";import"./badge-D5WiG5D4.js";import"./connection-form-helpers-DYr5JaDw.js";import"./authenticate-and-persist-oauth-cJNik8J_.js";import"./mcp-oauth-DXbhYp2n.js";import"./useSuspenseInfiniteQuery-DtKEQU_S.js";import"./required-auth-layout-BFKAd6mb.js";import"./use-org-sso-DnPy8IJo.js";import"./use-clock-tick-7xgXM9p8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Ba_RrSds.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-DIwK9fdW.js";import"./delay-CnY5UFtP.js";function Ve(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(Ss,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function Ss(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(as,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=g=>r(g==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(is,{className:"h-7 text-xs",children:n.jsx(os,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(rs,{children:[n.jsx(_e,{value:"true",children:"true"}),n.jsx(_e,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(ls,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(De,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function _s(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=A.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Zt,{children:"Manage home"}),d=n.jsx(Yt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(yt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=g=>r(g.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(es,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(De,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(tn,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx(A.Suspense,{fallback:u,children:n.jsx(Is,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(ts,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(ss,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function Cs(t){const e=k.c(32),{org:s}=J(),o=Oe();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=He(),d=ht(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const g=p>=ne;let b;e[10]!==g||e[11]!==f||e[12]!==a?(b=_=>f(_)||g?Promise.resolve():a.apply(C=>C.includes(_)?null:[...C,_]),e[10]=g,e[11]=f,e[12]=a,e[13]=b):b=e[13];const y=b;let N;e[14]!==a?(N=_=>a.apply(C=>C.filter(I=>I!==_)),e[14]=a,e[15]=N):N=e[15];const v=N;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const x=j;let w;e[18]!==d||e[19]!==g||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,C)=>{await d.update.mutateAsync({id:_.id,data:{metadata:C}}),!f(_.id)&&!g&&await a.apply(I=>I.includes(_.id)?null:[...I,_.id]),await c()},e[18]=d,e[19]=g,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let T;return e[24]!==y||e[25]!==g||e[26]!==r||e[27]!==f||e[28]!==v||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:v,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=v,e[29]=x,e[30]=S,e[31]=T):T=e[31],T}function Is(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=pt(o);let r;e[1]!==i?(r=new Set(i.map(Ps)),e[1]=i,e[2]=r):r=e[2];const a=Cs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const g=new Map(i.map(As));d=s.trim().toLowerCase();const b=v=>!d||v.title?.toLowerCase().includes(d);l=a.homeIds.map(v=>g.get(v)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=v=>!a.isOnHome(v.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(v=>!y.has(v.id)).filter(N).filter(b).sort(Ts),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Ms,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(Ls,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function Ts(t,e){return(t.title??"").localeCompare(e.title??"")}function ks(t){return t.id&&!dt(t.id)}function $s(t){return!!t}function As(t){return[t.id,t]}function Ps(t){return t.id}function Ke(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Ms(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:$t},e[1]=r):r=e[1];const a=Me(oe(ze,i),oe(Ee,r));let d;e[2]!==s?(d=p=>{const{active:h,over:g}=p;if(!g||h.id===g.id)return;const b=s.homeIds,y=b.indexOf(h.id),N=b.indexOf(g.id);y===-1||N===-1||s.reorder(At([...b],y,N)).catch(zs)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ke,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Le,{sensors:a,collisionDetection:_t,onDragEnd:l,children:n.jsx(Ct,{items:o.map(Es),strategy:It,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(Hs,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function Es(t){return t.id}function zs(){return K.error("Couldn't reorder home — please try again.")}function Ls(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=A.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ke,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Fs,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a(Os),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function Os(t){return t+20}function We(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function Hs(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=A.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=Tt(a),p=We(s)||"Quick access";let h;e[2]!==c?(h=kt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const g=f?.5:void 0,b=f?100:void 0;let y;e[4]!==h||e[5]!==g||e[6]!==b||e[7]!==u?(y={transform:h,transition:u,opacity:g,zIndex:b},e[4]=h,e[5]=g,e[6]=b,e[7]=u,e[8]=y):y=e[8];const N=y,v=f&&"shadow-lg";let j;e[9]!==v?(j=Q("rounded-lg border border-border bg-card",v),e[9]=v,e[10]=j):j=e[10];const x=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pe,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==x?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":x,children:w}),e[12]=d,e[13]=l,e[14]=x,e[15]=S):S=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>r(Rs),e[16]=T):T=e[16];const _=s.title??s.id;let C;e[17]!==s.icon||e[18]!==_?(C=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=C):C=e[19];const I=s.title??s.id;let P;e[20]!==I?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=P):P=e[21];let E;e[22]!==p?(E=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=E):E=e[23];let z;e[24]!==P||e[25]!==E?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,E]}),e[24]=P,e[25]=E,e[26]=z):z=e[26];const D=i&&"rotate-180";let L;e[27]!==D?(L=Q("shrink-0 text-muted-foreground transition-transform",D),e[27]=D,e[28]=L):L=e[28];let H;e[29]!==L?(H=n.jsx(Re,{size:16,className:L}),e[29]=L,e[30]=H):H=e[30];let U;e[31]!==i||e[32]!==C||e[33]!==z||e[34]!==H?(U=n.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[C,z,H]}),e[31]=i,e[32]=C,e[33]=z,e[34]=H,e[35]=U):U=e[35];let $;e[36]!==s.id||e[37]!==o?($=()=>o.removeAgent(s.id).catch(Ds),e[36]=s.id,e[37]=o,e[38]=$):$=e[38];const R=`Remove ${s.title??s.id} from home`;let O;e[39]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(ye,{size:14}),e[39]=O):O=e[39];let M;e[40]!==$||e[41]!==R?(M=n.jsx("button",{type:"button",onClick:$,"aria-label":R,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:O}),e[40]=$,e[41]=R,e[42]=M):M=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==M?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,M]}),e[43]=S,e[44]=U,e[45]=M,e[46]=F):F=e[46];let B;e[47]!==s||e[48]!==i||e[49]!==o?(B=i&&n.jsx(qe,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=B):B=e[50];let W;return e[51]!==m||e[52]!==N||e[53]!==F||e[54]!==B||e[55]!==j?(W=n.jsxs("div",{ref:m,style:N,className:j,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=j,e[56]=W):W=e[56],W}function Ds(){return K.error("Couldn't remove from home — please try again.")}function Rs(t){return!t}function Fs({agent:t,home:e}){const[s,o]=A.useState(!1),[i,r]=A.useState(!1),a=We(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{K.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(Re,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(be,{size:14})})]}),s&&n.jsx(qe,{agent:t,home:e})]})}function qe(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(Us).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Vs,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Bs,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx(A.Suspense,{fallback:u,children:n.jsx(Qs,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function Us(t){return t.connection_id}function Bs(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(V,{className:"h-8 w-full"}),n.jsx(V,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Vs({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Be(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const g=Fe(h._meta);return g?[{name:h.name,description:h.description,resourceUri:g,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(qs,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Gs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function Ge(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Ks(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Ws(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function qs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=A.useState(!1),[d,l]=A.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=A.useState(()=>Ks(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const g=Z(t.metadata?.ui),b=i.tileId?g.filter(N=>N.tileId!==i.tileId):g.filter(N=>N!==i),y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,y),l(!1)}catch(g){console.error("[home-tiles] failed to remove tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let g;if(m&&o.inputSchema?.properties){const v=Ge(c,o.inputSchema.properties);if(!v){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(v).length>0&&(g=v)}const y=Z(t.metadata?.ui).map(v=>(i.tileId?v.tileId===i.tileId:v===i)?{...v,toolInput:g}:v),N={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,N),l(!1)}catch(g){console.error("[home-tiles] failed to save tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Ws(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:ve(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(g=>!g),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(jt,{size:14})}),n.jsx(Ne,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(g,b)=>u(y=>({...y,[g]:b}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Gs({agent:t,home:e,connection:s,tool:o}){const[i,r]=A.useState(!1),[a,d]=A.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=A.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const y=Ge(m,o.inputSchema.properties);if(!y){K.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(y).length>0&&(p=y)}const g=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:g}};await e.saveAgentMetadata(t,b),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),K.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:ve(o.name)}),n.jsx(Ne,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(g=>({...g,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function Ne(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(vt,{size:14}):n.jsx(be,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Qs(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:x}=await d.listPrompts();return x.map(Ys)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=je(r.slug);let g,b;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let x;e[17]!==s.id?(x=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=x):x=e[18],g=h.prompts.filter(x).map(Zs);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],b=[...w];for(const S of g)b.some(T=>T.name===S.name)||b.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=g,e[16]=b}else g=e[15],b=e[16];if(f&&g.length===0){let x;return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]}),e[21]=x):x=e[21],x}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(b.length===0)return null;let y;e[22]!==i||e[23]!==b?(y=i??b.map(Xs),e[22]=i,e[23]=b,e[24]=y):y=e[24];let N;e[25]!==y?(N=new Set(y),e[25]=y,e[26]=N):N=e[26];const v=N;let j;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==v?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:b.map(x=>n.jsx(en,{agent:s,home:o,prompt:x,allPromptNames:b.map(Js),isPinned:v.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=v,e[31]=j):j=e[31],j}function Js(t){return t.name}function Xs(t){return t.name}function Zs(t){return{name:t.promptName,title:t.title,description:t.description}}function Ys(t){return{name:t.name,title:t.title,description:t.description}}function en({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=A.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),K.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??ve(s.name)}),n.jsx(Ne,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function tn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},sn)}),t[0]=e):e=t[0],e}function sn(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(V,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Qe=`home-board.layout.v${ee}`;function Je(t){return`home-board.layout.v${ee}.${t}`}const Xe={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Xe:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function nn(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function on(t){try{const e=localStorage.getItem(Je(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Ce(t,e){try{localStorage.setItem(Je(t),JSON.stringify(e))}catch{}}async function Ie(t,e){if(!(await fetch(`/api/${t}/kv/${Qe}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function rn(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=on(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const y=await fetch(`/api/${t}/kv/${Qe}`);if(y.status===404)return a&&nn(a)?(await Ie(t,a),a):Xe;if(!y.ok)throw new Error("Failed to load board layout");const N=await y.json(),v=fe(N.value);return Ce(t,v),v},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:y=>Ie(t,y)},e[11]=t,e[12]=u):u=e[12];const f=nt(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=y=>{Ce(t,y),s.setQueryData(i,y),f.mutate(y)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let g;e[18]!==m?(g=fe(m),e[18]=m,e[19]=g):g=e[19];let b;return e[20]!==c||e[21]!==h||e[22]!==g?(b={layout:g,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}const Ze=A.createContext(null);function ln(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=rn(o.slug),[r,a]=A.useState(!1),[d,l]=A.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,g=r&&d!==null,b=g?d:i.layout;let y;e[6]!==d||e[7]!==g||e[8]!==i.layout?(y=g?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=g,e[8]=i.layout,e[9]=y):y=e[9];const N=y;let v;e[10]!==r||e[11]!==i?(v=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=v):v=e[12];const j=v;let x;e[13]!==j||e[14]!==c||e[15]!==N||e[16]!==r||e[17]!==b||e[18]!==h||e[19]!==i.isLoading?(x={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:N,layout:b,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=N,e[16]=r,e[17]=b,e[18]=h,e[19]=i.isLoading,e[20]=x):x=e[20];let w;return e[21]!==s||e[22]!==x?(w=n.jsx(Ze.Provider,{value:x,children:s}),e[21]=s,e[22]=x,e[23]=w):w=e[23],w}function Ye(){const t=A.useContext(Ze);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function an({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=us(),{setTaskId:r}=Kt(),[a,d]=A.useState(null),[l,m]=A.useState(!1),c=A.useRef(!1),u=async(b,y)=>{if(!o){K.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const N=await ms(o,b.name,y),v={type:"doc",content:[{type:"paragraph",content:[Qt({id:b.name,name:Jt(b.name,Xt(b._meta)),metadata:N.messages,char:"/",kind:"prompt",args:y}),{type:"text",text:" "}]}]},j=crypto.randomUUID();fs(sessionStorage,s,j,{tiptapDoc:v}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(N){console.error("[start-thread-from-prompt] failed",N),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async b=>{if(!c.current){if(b.arguments&&b.arguments.length>0){d(b);return}await u(b)}},p=async b=>{if(!a)return;const y=a;d(null),await u(y,b)};return{start:f,startBlank:async b=>{if(!c.current){c.current=!0,m(!0);try{const y=crypto.randomUUID();await i({id:y,virtual_mcp_id:t}),r(y,t,b?.main?{main:b.main}:void 0)}catch(y){console.error("[start-thread-from-prompt] startBlank failed",y),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Gt,{prompt:a,setPrompt:b=>d(b),onSubmit:p}),dialogPrompt:a,starting:l}}const q=4,G=100,Te=12,cn=5,dn={w:2,h:2};class pe extends A.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(it,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function mn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=A.useRef(null),[c,u]=A.useState(null),[f,p]=A.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const g=Me(oe(ze,h),oe(Ee)),b=s.reduce(un,0),y=o?Math.max(b+2,4):Math.max(b,1);let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{const $=m.current?.getBoundingClientRect();return $?{cellWidth:$.width/q,cellHeight:G}:null},e[1]=N):N=e[1];const v=N;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=$=>{u(String($.active.id)),p(v())},e[2]=j):j=e[2];const x=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??v();if(u(null),p(null),!O||O.cellWidth<=0)return;const M=s.find(W=>W.id===R);if(!M)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:M.x+F,y:M.y+B})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let $;if(e[7]!==i||e[8]!==s){let O;e[10]!==i?(O=M=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(M)})},M.id),e[10]=i,e[11]=O):O=e[11],$=s.map(O),e[7]=i,e[8]=s,e[9]=$}else $=e[9];let R;return e[12]!==$?(R=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:$}),e[12]=$,e[13]=R):R=e[13],R}let T,_,C,I,P,E,z,D,L;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==y){const $=c?s.find(X=>X.id===c):null;_=Le,D=g,L=x,C=S;const R=y*G,O=o?G*4:G;let M;e[33]!==R||e[34]!==O?(M={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=M):M=e[35];let F;e[36]!==o||e[37]!==s||e[38]!==y?(F=o&&n.jsx(fn,{rows:y,tiles:s}),e[36]=o,e[37]=s,e[38]=y,e[39]=F):F=e[39];let B;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(hn,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],B=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=B}else B=e[46];e[53]!==M||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:M,children:[F,B]}),e[53]=M,e[54]=F,e[55]=B,e[56]=I):I=e[56],T=Pt,P=null;const W=$&&f?$.w*f.cellWidth-Te:void 0,de=$&&f?$.h*f.cellHeight-Te:void 0;e[57]!==W||e[58]!==de?(E={width:W,height:de},e[57]=W,e[58]=de,e[59]=E):E=e[59],z=$&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i($)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=g,e[22]=s,e[23]=y,e[24]=T,e[25]=_,e[26]=C,e[27]=I,e[28]=P,e[29]=E,e[30]=z,e[31]=D,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],E=e[29],z=e[30],D=e[31],L=e[32];let H;e[60]!==T||e[61]!==P||e[62]!==E||e[63]!==z?(H=n.jsx(T,{dropAnimation:P,style:E,children:z}),e[60]=T,e[61]=P,e[62]=E,e[63]=z,e[64]=H):H=e[64];let U;return e[65]!==_||e[66]!==C||e[67]!==I||e[68]!==H||e[69]!==D||e[70]!==L?(U=n.jsxs(_,{sensors:D,onDragStart:L,onDragEnd:C,children:[I,H]}),e[65]=_,e[66]=C,e[67]=I,e[68]=H,e[69]=D,e[70]=L,e[71]=U):U=e[71],U}function un(t,e){return Math.max(t,e.y+e.h)}function fn(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<q;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(pn)}),e[5]=a,e[6]=d):d=e[6],d}function pn(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/q*100}%`,top:t.y*G,width:`${1/q*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function hn(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Mt(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,v=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=N&&"opacity-30";let x;e[3]!==v||e[4]!==j?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",v,j),e[3]=v,e[4]=j,e[5]=x):x=e[5];let w;e[6]!==y||e[7]!==h||e[8]!==b||e[9]!==g?(w={left:h,top:b,width:g,height:y},e[6]=y,e[7]=h,e[8]=b,e[9]=g,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==S?(T=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=T):T=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(Pe,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(xn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let C;e[20]!==d?(C=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=C):C=e[21];let I;e[22]!==C||e[23]!==T||e[24]!==_?(I=n.jsxs("div",{className:T,children:[_,C]}),e[22]=C,e[23]=T,e[24]=_,e[25]=I):I=e[25];let P;return e[26]!==c||e[27]!==I||e[28]!==x||e[29]!==w?(P=n.jsx("div",{ref:c,className:x,style:w,children:I}),e[26]=c,e[27]=I,e[28]=x,e[29]=w,e[30]=P):P=e[30],P}function xn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=A.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ps,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(Nt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=b=>{o(s.id,b),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(gn,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(hs,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ys,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(xs,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(gs,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let g;return e[17]!==r||e[18]!==h?(g=n.jsxs(bs,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=g):g=e[19],g}function gn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=A.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${q}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:cn},(b,y)=>Array.from({length:q},(N,v)=>{const j=v+1,x=y+1,w=j<i||x<r,S=j<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${x}`,onPointerEnter:()=>d({w:j,h:x}),onClick:()=>o({w:j,h:x}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${x}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let g;return e[16]!==u||e[17]!==h?(g=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=g):g=e[18],g}function bn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=q-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)bn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(q,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(q-s,t)),i=Math.max(0,e);return{x:o,y:i}}function yn(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function jn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ye();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let N;e[7]!==a?(N=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=N):N=e[8];const v=t.filter(N);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of v){const x=s.tiles[j.id];if(!x)continue;const w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:j.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const j of v){if(l.some(C=>C.id===j.id))continue;const x=j.defaultSize??dn,w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:j.id,x:_.x,y:_.y,w:S,h:T,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(vn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,v)=>{const j={};for(const x of N)j[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:j,hidden:v.filter(x=>c.has(x))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(N,v)=>{const j=l.find(S=>S.id===N);if(!j)return;const x=ue(v.x,v.y,j.w);if(x.x===j.x&&x.y===j.y)return;const w=yn(l,N,x);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let g;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(g=(N,v)=>{const j=l.find(I=>I.id===N);if(!j)return;const x=d.get(N),{w,h:S}=me(v.w,v.h,x);if(w===j.w&&S===j.h)return;const T={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(I=>I.id!==N),C=[T];for(const I of _){const P=he(C,I.w,I.h);C.push({...I,x:P.x,y:P.y})}f(C,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=g):g=e[24];let b;e[25]!==f||e[26]!==s||e[27]!==l?(b=N=>{const v=l.filter(j=>j.id!==N);f(v,Array.from(new Set([...s.hidden,N])))},e[25]=f,e[26]=s,e[27]=l,e[28]=b):b=e[28];let y;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==g||e[33]!==b?(y={snapshot:p,isLoading:o,moveTile:h,resizeTile:g,hideTile:b},e[29]=o,e[30]=p,e[31]=h,e[32]=g,e[33]=b,e[34]=y):y=e[34],y}function vn(t){return t.id}const Nn={w:2,h:4},wn={w:1,h:2},Sn={w:1,h:1};function _n(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function Cn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function In(t){return t.promptName?t.agentName:t.description}function Tn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function et(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=mt({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=cs(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Fe(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?Lt(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function we(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=an(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(Tn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function kn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=we(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let g;e[12]!==s?(g=In(s),e[12]=s,e[13]=g):g=e[13];let b;e[14]!==g?(b=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==h?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,b]}),e[16]=b,e[17]=h,e[18]=y):y=e[18];let N;e[19]!==o?(N=!o&&n.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=N):N=e[20];let v;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(v=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,y,N]}),e[21]=a,e[22]=d,e[23]=y,e[24]=N,e[25]=l,e[26]=f,e[27]=p,e[28]=v):v=e[28];let j;return e[29]!==r||e[30]!==v?(j=n.jsxs(n.Fragment,{children:[v,r]}),e[29]=r,e[30]=v,e[31]=j):j=e[31],j}function $n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},An)}),t[0]=e):e=t[0],e}function An(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(V,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Pn(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=we(s.agentId),u=o.filter(Mn),f=et(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const g="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(zn,{}),e[5]=b):b=e[5];let y;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(y=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx(A.Suspense,{fallback:b,children:n.jsx(En,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=y):y=e[9];const N=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(x=>n.jsx("button",{type:"button",onClick:()=>d(x),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:x.title})},x.promptName))});let v;e[10]!==y||e[11]!==N?(v=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=v):v=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==v?(j=n.jsxs("div",{className:p,children:[h,v,m]}),e[13]=m,e[14]=h,e[15]=v,e[16]=j):j=e[16],j}function Mn(t){return!!t.promptName}function En(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(ns,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function zn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ln(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(V,{className:"h-3 w-3/4"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function On(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=we(s.agentId),m=o.filter(Hn),c=et(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const g=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(y=>n.jsx("button",{type:"button",onClick:()=>!i&&r(y),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:y.title})},y.promptName))});let b;return e[6]!==d||e[7]!==h||e[8]!==g?(b=n.jsxs("div",{className:u,children:[h,g,d]}),e[6]=d,e[7]=h,e[8]=g,e[9]=b):b=e[9],b}function Hn(t){return!!t.promptName}function tt({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=je(e.slug),r=Oe()?.ids??[],a=new Set(r),d=He(),l=Be(),m=xe(),c=new Set(i.map(x=>x.agentId)),u=new Map;for(const x of o){const w=u.get(x.agentId);w?w.push(x):u.set(x.agentId,[x])}const f=o.filter(x=>!c.has(x.agentId)),p=[...i.map(x=>({kind:"tile",id:Cn(x),data:x})),...f.map(x=>({kind:"prompt",id:_n(x),data:x}))],h=new Map(p.map(x=>[x.id,x])),g=jn(p.map(x=>({id:x.id,defaultSize:x.kind==="tile"?Nn:Sn,minSize:x.kind==="tile"?wn:void 0,pinned:a.has(x.data.agentId)}))),b=x=>{d.apply(w=>w.filter(S=>S!==x)).catch(()=>K.error("Couldn't remove from home — please try again."))},y=async x=>{if(i.filter(S=>S.agentId===x.agentId).length<=1){b(x.agentId);return}try{const T=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:x.agentId})).item;if(!T)throw new Error("Agent not found");const _=Z(T.metadata?.ui),C=x.tileId?_.filter(I=>I.tileId!==x.tileId):_.filter(I=>I.connectionId!==x.connectionId||I.resourceUri!==x.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:x.agentId,data:{metadata:{...T.metadata??{},ui:{...T.metadata?.ui??{},homeTile:null,homeTiles:C}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{K.error("Couldn't remove tile — please try again.")}},N=x=>{const w=h.get(x);if(w){if(!a.has(w.data.agentId)){g.hideTile(x);return}w.kind==="tile"?y(w.data):b(w.data.agentId)}},v=x=>{const w=h.get(x.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(ot,{fallback:n.jsx(On,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx(A.Suspense,{fallback:n.jsx(Ln,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(Pn,{tile:w.data,prompts:S,isEditMode:t,tileWidth:x.w})})})}return n.jsx(kn,{entry:w.data,isEditMode:t})};return s||g.isLoading?n.jsx($n,{}):g.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(mn,{tiles:g.snapshot.visible,isEditMode:t,renderTile:v,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Dn(t){const e=k.c(2),{prompts:s,tiles:o}=je(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const ke=420,$e=305;function st(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:$e}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:$e}})]}),t[3]=i):i=t[3],i}function Ae(){const t=k.c(33),{data:e}=rt.useSession(),{org:s}=J(),o=ge(),i=Ns(),{selectedVirtualMcp:r}=Ht();let a;t[0]!==s.id?(a=ut(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Wt(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:ft,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=js(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Vt(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=xt(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let g;t[17]!==f||t[18]!==p||t[19]!==h?(g={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=g):g=t[20],ct(g);const b=vs(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:v,isInitialFreeCredit:j,balanceDollars:x,hasOnlyDecoProvider:w}=Ft(),{hasVisibleTiles:S}=Dn(s.slug),T=Ut(y?.metadata);if(b.length===0&&!(T&&Bt(i))){let H;return t[21]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:n.jsx(Dt,{})})}),t[21]=H):H=t[21],H}let C;t[22]!==e?.user?.name?(C=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=C):C=t[23];const I=C,P=N&&j&&x!=null,E=N&&v&&w;let z;t[24]!==x||t[25]!==P||t[26]!==E?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):E?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=E,t[27]=z):z=t[27];const D=z;let L;return t[28]!==D||t[29]!==S||t[30]!==o||t[31]!==I?(L=n.jsx(ln,{children:o?n.jsx(Rn,{eyebrow:D,userName:I}):n.jsx(Fn,{eyebrow:D,userName:I,hasVisibleTiles:S})}),t[28]=D,t[29]=S,t[30]=o,t[31]=I,t[32]=L):L=t[32],L}function Rn(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(st,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(re.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(tt,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function Fn(t){const e=k.c(54),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ye(),[c,u]=A.useState(!1),f=lt();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={strict:!1},e[0]=p):p=e[0];const{main:h}=at(p);let g;e[1]!==h?(g=h?Ot(h):null,e[1]=h,e[2]=g):g=e[2];const b=g,y=h==="files"||!!b;let N;e[3]!==f?(N=B=>f({to:".",search:W=>({...W,main:B}),replace:!0}),e[3]=f,e[4]=N):N=e[4];const v=N;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={kind:"component",Component:Se},e[5]=j):j=e[5];let x;e[6]!==y||e[7]!==v?(x=()=>v(y?void 0:"files"),e[6]=y,e[7]=v,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:j,active:y,onClick:x}),e[9]=y,e[10]=x,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),e[12]=S):S=e[12];let T;e[13]!==l||e[14]!==a||e[15]!==m||e[16]!==r||e[17]!==d?(T=n.jsx(Un,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:S}),e[13]=l,e[14]=a,e[15]=m,e[16]=r,e[17]=d,e[18]=T):T=e[18];let _;e[19]!==w||e[20]!==T?(_=n.jsxs(ws.Right,{children:[w,T]}),e[19]=w,e[20]=T,e[21]=_):_=e[21];let C;e[22]!==c?(C=n.jsx(_s,{open:c,onOpenChange:u}),e[22]=c,e[23]=C):C=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(st,{}),e[24]=I):I=e[24];const P=i||r?"pt-32":"flex-1 justify-center";let E;e[25]!==P?(E=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=E):E=e[26];let z;e[27]!==s?(z=s&&n.jsx("div",{className:"mb-4",children:s}),e[27]=s,e[28]=z):z=e[28];let D;e[29]!==o?(D=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[29]=o,e[30]=D):D=e[30];let L;e[31]!==z||e[32]!==D?(L=n.jsxs("div",{className:"text-center mb-10",children:[z,D]}),e[31]=z,e[32]=D,e[33]=L):L=e[33];let H;e[34]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsxs("div",{className:"relative w-full",children:[n.jsx(Bn,{}),n.jsx(re.Input,{showConnectionsBanner:!0})]}),e[34]=H):H=e[34];let U;e[35]!==L?(U=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[L,H]}),e[35]=L,e[36]=U):U=e[36];let $;e[37]!==r?($=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(tt,{isEditMode:r})}),e[37]=r,e[38]=$):$=e[38];let R;e[39]!==E||e[40]!==U||e[41]!==$?(R=n.jsxs("div",{className:"flex-1 min-w-0 relative flex flex-col",children:[I,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:E,children:[U,$]})})]}),e[39]=E,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==v?(O=y&&n.jsxs("div",{className:"w-[45%] max-w-[680px] min-w-[380px] shrink-0 flex flex-col min-h-0 border-l border-border bg-background",children:[n.jsxs("div",{className:"h-10 shrink-0 flex items-center justify-between px-3 border-b border-border",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[n.jsx(Se,{size:16}),"Library"]}),n.jsx("button",{type:"button",onClick:()=>v(void 0),"aria-label":"Close Library panel",className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:n.jsx(ye,{size:16})})]}),n.jsx("div",{className:"flex-1 min-h-0",children:b?n.jsx(Et,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=v,e[46]=O):O=e[46];let M;e[47]!==R||e[48]!==O?(M=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=M):M=e[49];let F;return e[50]!==C||e[51]!==M||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,M]}),e[50]=C,e[51]=M,e[52]=_,e[53]=F):F=e[53],F}function Un(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(be,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ye,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(bt,{size:14}),e[6]=g):g=e[6];let b;e[7]!==r||e[8]!==h?(b=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[g,"Save"]}),e[7]=r,e[8]=h,e[9]=b):b=e[9];let y;return e[10]!==u||e[11]!==p||e[12]!==b?(y=n.jsxs(n.Fragment,{children:[u,p,b]}),e[10]=u,e[11]=p,e[12]=b,e[13]=y):y=e[13],y}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(wt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function Bn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function er(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(Ae,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(Ae,{})})})}),t[1]=s):s=t[1],s}export{er as default};
@@ -1 +0,0 @@
1
- import{c as Q,j as s,B as ze,G as pe,q as Mt,m as Ve,d as Me,K as ce,t as oe,k as Ct,r as re,l as ke,i as Xe,E as Rt,v as Re}from"./index-OF548fxc.js";import{C as zt}from"./collection-display-button-BdyEgFyg.js";import{S as Pt}from"./search-input-DsIBo_sc.js";import{P as Ae}from"./index-C4E5A5_g.js";import{C as Et}from"./collection-table-wrapper-Cv1VGTD3.js";import{E as We}from"./empty-state-DEvtcbTs.js";import{I as kt}from"./invite-member-dialog-BuboFMvI.js";import{b as Dt,S as $t,a as Ot}from"./settings-section-Cd3zmde3.js";import{a as qt,u as Lt}from"./use-join-requests-f9qAAjhC.js";import{A as De}from"./avatar-B8STW9mD.js";import{u as Ft}from"./use-members-DTTAqnQj.js";import{u as $e}from"./studio-tools-DkATXRgK.js";import{u as yt}from"./use-org-auth-client-CfqWFlO5.js";import{u as Bt}from"./use-organization-roles-DLiC1YgM.js";import{a as Kt,b as Ut,c as Vt,T as Gt}from"./tooltip-CKk6MyBG.js";import{a as st,e as nt,g as it,b as at,c as lt,d as ot,A as rt,f as ct}from"./alert-dialog-Buxux4Jv.js";import{B as Ge}from"./badge-D5WiG5D4.js";import{C as mt}from"./card-BWrHlXPo.js";import{D as St,a as Nt,b as wt,d as Qt,e as Jt,f as Ht,c as et,g as Wt}from"./dropdown-menu-DBdT-R6w.js";import{i as _t}from"./DotsVertical-wFUaTKIr.js";import{i as Yt}from"./Key01-D_Aswhqq.js";import{i as Zt}from"./Shield01-C5cTYwHG.js";import{b as Xt}from"./SwitchHorizontal01-DKfBMAMt.js";import{s as es}from"./Trash01-De9U-JcA.js";import{s as Tt}from"./XClose-BlQxiRFv.js";import{a as dt,S as ut,c as ft,b as pt,d as ht}from"./select-CYLZmEqL.js";import{C as gt}from"./checkbox-B0iPK-Vx.js";import{e as Ye,a as Ze,g as xt,C as ts,c as ss,d as ns,b as is}from"./command-DeIgAPPz.js";import{b as as,P as ls,a as os}from"./popover-CPAEPhwT.js";import{t as rs}from"./ChevronDown-BDi4pzpg.js";import{s as cs}from"./Plus-B3W-zU0m.js";import{R as ms}from"./require-capability-Dh5JJLWW.js";import"./ChevronUp-BgfgTfJo.js";import"./view-mode-toggle-xMIlyXz_.js";import"./SearchMd-CG-ZdWyV.js";import"./sidebar-DKxDx7lC.js";import"./LayoutLeft-BIAH0kog.js";import"./use-mobile-71FrMeIQ.js";import"./sheet-S1l6W00L.js";import"./X-DchRughI.js";import"./table-BV3Hd7cI.js";import"./dialog-Bw0pp5yj.js";import"./form-BvyPfbLQ.js";import"./label-Cpj2tcAv.js";import"./textarea-CiUwXw-w.js";import"./ArrowUpRight-BYUnq8gY.js";import"./use-capability-HK8_0h49.js";import"./User01--wnyNy2g.js";import"./ChevronRight-CkirMRmz.js";import"./index-C3UHIWhR.js";import"./access-gate-Cqrbc3BU.js";import"./capability-load-error-DB0r6fSo.js";function ds(){const t=Q.c(9),e=qt(),{approve:n,deny:l}=Lt();if(e.length===0)return null;let i;if(t[0]!==n||t[1]!==l||t[2]!==e){let o;t[4]!==n||t[5]!==l?(o=r=>s.jsx(Dt,{icon:s.jsx(De,{url:r.user?.image??void 0,fallback:(r.user?.name??r.user?.email??"?").charAt(0).toUpperCase(),shape:"circle",size:"sm"}),title:r.user?.name??r.user?.email??r.userId,description:r.user?.email,action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{size:"sm",variant:"outline",onClick:()=>l.mutate(r.id),disabled:l.isPending||n.isPending,children:"Deny"}),s.jsx(ze,{size:"sm",onClick:()=>n.mutate(r.id),disabled:n.isPending||l.isPending,children:"Approve"})]})},r.id),t[4]=n,t[5]=l,t[6]=o):o=t[6],i=e.map(o),t[0]=n,t[1]=l,t[2]=e,t[3]=i}else i=t[3];let a;return t[7]!==i?(a=s.jsx($t,{title:"Join requests",description:"People who requested to join via a domain in approval mode.",children:s.jsx(Ot,{children:i})}),t[7]=i,t[8]=a):a=t[8],a}function us(){const t=Q.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.invitations(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>(await n.call("ORGANIZATION_GET",{}))?.invitations??[],t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i},t[4]=l,t[5]=i,t[6]=a):a=t[6],Mt(a)}function fs(){const t=Q.c(10),{locator:e}=pe(),n=yt(),l=Ve();let i;t[0]!==n?(i=async f=>{const g=await n.organization.cancelInvitation({invitationId:f});if(g?.error)throw new Error(g.error.message);return g.data},t[0]=n,t[1]=i):i=t[1];let a;t[2]!==e||t[3]!==l?(a=()=>{l.invalidateQueries({queryKey:ce.invitations(e)}),oe.success("Invitation cancelled")},t[2]=e,t[3]=l,t[4]=a):a=t[4];let o;t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:ps},t[5]=i,t[6]=a,t[7]=o):o=t[7];const r=Me(o);let u;return t[8]!==r?(u={cancel:r},t[8]=r,t[9]=u):u=t[9],u}function ps(t){oe.error(t instanceof Error?t.message:"Failed to cancel invitation")}function hs(){const t=Q.c(7),{locator:e}=pe(),n=$e();let l;t[0]!==e?(l=ce.tags(e),t[0]=e,t[1]=l):l=t[1];let i;t[2]!==n?(i=async()=>{const{tags:o}=await n.call("TAGS_LIST",{});return o},t[2]=n,t[3]=i):i=t[3];let a;return t[4]!==l||t[5]!==i?(a={queryKey:l,queryFn:i,staleTime:3e4},t[4]=l,t[5]=i,t[6]=a):a=t[6],Ct(a)}function gs(){const t=Q.c(8),e=Ve(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{tag:u}=await l.call("TAGS_CREATE",{name:r});return u},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=()=>{e.invalidateQueries({queryKey:ce.tags(n)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:xs},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function xs(t){oe.error(t instanceof Error?t.message:"Failed to create tag")}function bs(t){const e=Q.c(10),{locator:n}=pe(),l=$e();let i;e[0]!==n||e[1]!==t?(i=ce.memberTags(n,t),e[0]=n,e[1]=t,e[2]=i):i=e[2];let a;e[3]!==t||e[4]!==l?(a=async()=>{const{tags:u}=await l.call("MEMBER_TAGS_GET",{memberId:t});return u},e[3]=t,e[4]=l,e[5]=a):a=e[5];const o=!!t;let r;return e[6]!==i||e[7]!==a||e[8]!==o?(r={queryKey:i,queryFn:a,staleTime:3e4,enabled:o},e[6]=i,e[7]=a,e[8]=o,e[9]=r):r=e[9],Ct(r)}function js(){const t=Q.c(8),e=Ve(),{locator:n}=pe(),l=$e();let i;t[0]!==l?(i=async r=>{const{memberId:u,tagIds:f}=r;return await l.call("MEMBER_TAGS_SET",{memberId:u,tagIds:f})},t[0]=l,t[1]=i):i=t[1];let a;t[2]!==n||t[3]!==e?(a=(r,u)=>{e.invalidateQueries({queryKey:ce.memberTags(n,u.memberId)})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o={mutationFn:i,onSuccess:a,onError:vs},t[5]=i,t[6]=a,t[7]=o):o=t[7],Me(o)}function vs(t){oe.error(t instanceof Error?t.message:"Failed to update member tags")}function It(t){const e=Q.c(44),{memberId:n,className:l,disabled:i,placeholder:a,maxDisplay:o}=t,r=i===void 0?!1:i,u=a===void 0?"Add tags...":a,f=o===void 0?2:o,[g,b]=re.useState(!1),[p,I]=re.useState(""),{data:M,isLoading:j}=hs(),D=M===void 0?[]:M,{data:v,isLoading:$}=bs(n),C=v===void 0?[]:v,E=gs(),N=js(),R=j||$,S=C.map(ys);let z;e[0]!==p?(z=x=>x.name.toLowerCase().includes(p.toLowerCase()),e[0]=p,e[1]=z):z=e[1];const A=D.filter(z);let y;e[2]!==p?(y=x=>x.name.toLowerCase()===p.toLowerCase(),e[2]=p,e[3]=y):y=e[3];const K=D.find(y),w=p.trim()&&!K,k=async x=>{const fe=S.includes(x.id)?S.filter(xe=>xe!==x.id):[...S,x.id];await N.mutateAsync({memberId:n,tagIds:fe})},_=async()=>{if(!p.trim())return;const x=await E.mutateAsync(p.trim());await N.mutateAsync({memberId:n,tagIds:[...S,x.id]}),I("")},c=async x=>{const se=S.filter(fe=>fe!==x);await N.mutateAsync({memberId:n,tagIds:se})},h=E.isPending||N.isPending,L=ls;let P;e[4]!==g?(P=()=>b(!g),e[4]=g,e[5]=P):P=e[5];let O;e[6]!==l?(O=ke("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",l),e[6]=l,e[7]=O):O=e[7];const U=r||R,q=R?s.jsx(Xe,{size:14,className:"animate-spin text-muted-foreground"}):C.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[C.slice(0,f).map(Cs),C.length>f&&s.jsxs(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",C.length-f]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(rs,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=V):V=e[8];let F;e[9]!==U||e[10]!==q||e[11]!==P||e[12]!==O?(F=s.jsx(os,{asChild:!0,children:s.jsxs(ze,{variant:"ghost",size:"sm",onClick:P,className:O,disabled:U,children:[q,V]})}),e[9]=U,e[10]=q,e[11]=P,e[12]=O,e[13]=F):F=e[13];const G=as,J="w-56 p-0",H="start";let W;e[14]===Symbol.for("react.memo_cache_sentinel")?(W=()=>b(!1),e[14]=W):W=e[14];const ne=ns,he=!1;let Y;e[15]!==p?(Y=s.jsx(is,{placeholder:"Search or create...",value:p,onValueChange:I,className:"h-9"}),e[15]=p,e[16]=Y):Y=e[16];const ie=ss,me=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Ye,{heading:"Selected",children:C.map(x=>s.jsx(Ze,{onSelect:()=>k(x),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gt,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:x.name})]}),s.jsx("button",{onClick:se=>{se.stopPropagation(),c(x.id)},className:"opacity-50 hover:opacity-100",disabled:h,children:s.jsx(Tt,{size:14})})]})},x.id))}),s.jsx(xt,{})]}),Pe=Ye,ge="Available",Ee=A.length===0&&!w&&s.jsx(ts,{children:"No tags found."}),ue=A.filter(x=>!S.includes(x.id)).map(x=>s.jsx(Ze,{onSelect:()=>k(x),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gt,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:x.name})]})},x.id));let ae;e[17]!==Pe||e[18]!==Ee||e[19]!==ue?(ae=s.jsxs(Pe,{heading:ge,children:[Ee,ue]}),e[17]=Pe,e[18]=Ee,e[19]=ue,e[20]=ae):ae=e[20];let le;e[21]!==_||e[22]!==h||e[23]!==p||e[24]!==w?(le=w&&s.jsxs(s.Fragment,{children:[s.jsx(xt,{}),s.jsx(Ye,{children:s.jsx(Ze,{onSelect:_,className:"cursor-pointer",disabled:h,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[h?s.jsx(Xe,{size:14,className:"animate-spin"}):s.jsx(cs,{size:14}),s.jsxs("span",{children:['Create "',p.trim(),'"']})]})})})]}),e[21]=_,e[22]=h,e[23]=p,e[24]=w,e[25]=le):le=e[25];let Z;e[26]!==ie||e[27]!==me||e[28]!==ae||e[29]!==le?(Z=s.jsxs(ie,{children:[me,ae,le]}),e[26]=ie,e[27]=me,e[28]=ae,e[29]=le,e[30]=Z):Z=e[30];let X;e[31]!==ne||e[32]!==Y||e[33]!==Z?(X=s.jsxs(ne,{shouldFilter:he,children:[Y,Z]}),e[31]=ne,e[32]=Y,e[33]=Z,e[34]=X):X=e[34];let ee;e[35]!==G||e[36]!==W||e[37]!==X?(ee=s.jsx(G,{className:J,align:H,onEscapeKeyDown:W,children:X}),e[35]=G,e[36]=W,e[37]=X,e[38]=ee):ee=e[38];let te;return e[39]!==L||e[40]!==g||e[41]!==F||e[42]!==ee?(te=s.jsxs(L,{open:g,onOpenChange:b,children:[F,ee]}),e[39]=L,e[40]=g,e[41]=F,e[42]=ee,e[43]=te):te=e[43],te}function Cs(t){return s.jsx(Ge,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function ys(t){return t.id}const bt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],Ss={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ue(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ns(t){const e=new Map;for(const[n,l]of Object.entries(Ss))e.set(n,l);for(let n=0;n<t.length;n++){const l=t[n];l&&!e.has(l.role)&&e.set(l.role,bt[n%bt.length]??"bg-neutral-400")}return e}function ws(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Ke(t){const e=Q.c(79),{role:n,memberId:l,isOwner:i,roleColorMap:a,selectableRoles:o,onRoleChange:r,size:u,className:f}=t,g=u===void 0?"xs":u;let b,p,I,M,j,D,v,$,C,E,N;if(e[0]!==f||e[1]!==i||e[2]!==l||e[3]!==r||e[4]!==n||e[5]!==a||e[6]!==o||e[7]!==g){N=Symbol.for("react.early_return_sentinel");e:{const _=a.get(n)??"bg-neutral-400";if(i){let c;e[19]!==l||e[20]!==r?(c=J=>r(l,J),e[19]=l,e[20]=r,e[21]=c):c=e[21];let h;e[22]!==n?(h=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=h):h=e[23];const L=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:ke("size-2 rounded-full shrink-0",_)}),h]});let P;e[24]!==L?(P=s.jsx(dt,{children:L}),e[24]=L,e[25]=P):P=e[25];let O;e[26]!==f||e[27]!==g||e[28]!==P?(O=s.jsx(ut,{size:g,className:f,children:P}),e[26]=f,e[27]=g,e[28]=P,e[29]=O):O=e[29];let U;if(e[30]!==a||e[31]!==o){let J;e[33]!==a?(J=H=>{const W=a.get(H.role)??"bg-neutral-400";return s.jsx(ft,{value:H.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",W)}),s.jsx("span",{className:"capitalize",children:H.label})]})},H.role)},e[33]=a,e[34]=J):J=e[34],U=o.map(J),e[30]=a,e[31]=o,e[32]=U}else U=e[32];let q;e[35]!==U?(q=s.jsx(pt,{children:U}),e[35]=U,e[36]=q):q=e[36];let V;e[37]!==i||e[38]!==n||e[39]!==c||e[40]!==O||e[41]!==q?(V=s.jsx(Kt,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ht,{value:n,onValueChange:c,disabled:i,children:[O,q]})})}),e[37]=i,e[38]=n,e[39]=c,e[40]=O,e[41]=q,e[42]=V):V=e[42];let F;e[43]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Ut,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=F):F=e[43];let G;e[44]!==V?(G=s.jsx(Vt,{children:s.jsxs(Gt,{children:[V,F]})}),e[44]=V,e[45]=G):G=e[45],N=G;break e}I=ht,$=n,e[46]!==l||e[47]!==r?(C=c=>r(l,c),e[46]=l,e[47]=r,e[48]=C):C=e[48],E=i,p=ut,D=g,v=f,b=dt,j="flex items-center gap-2 min-w-0",M=ke("size-2 rounded-full shrink-0",_)}e[0]=f,e[1]=i,e[2]=l,e[3]=r,e[4]=n,e[5]=a,e[6]=o,e[7]=g,e[8]=b,e[9]=p,e[10]=I,e[11]=M,e[12]=j,e[13]=D,e[14]=v,e[15]=$,e[16]=C,e[17]=E,e[18]=N}else b=e[8],p=e[9],I=e[10],M=e[11],j=e[12],D=e[13],v=e[14],$=e[15],C=e[16],E=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let R;e[49]!==M?(R=s.jsx("div",{className:M}),e[49]=M,e[50]=R):R=e[50];let S;e[51]!==n?(S=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=S):S=e[52];let z;e[53]!==R||e[54]!==S||e[55]!==j?(z=s.jsxs("div",{className:j,children:[R,S]}),e[53]=R,e[54]=S,e[55]=j,e[56]=z):z=e[56];let A;e[57]!==b||e[58]!==z?(A=s.jsx(b,{children:z}),e[57]=b,e[58]=z,e[59]=A):A=e[59];let y;e[60]!==p||e[61]!==A||e[62]!==D||e[63]!==v?(y=s.jsx(p,{size:D,className:v,children:A}),e[60]=p,e[61]=A,e[62]=D,e[63]=v,e[64]=y):y=e[64];let K;if(e[65]!==a||e[66]!==o){let _;e[68]!==a?(_=c=>{const h=a.get(c.role)??"bg-neutral-400";return s.jsx(ft,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ke("size-3 rounded-full",h)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[68]=a,e[69]=_):_=e[69],K=o.map(_),e[65]=a,e[66]=o,e[67]=K}else K=e[67];let w;e[70]!==K?(w=s.jsx(pt,{children:K}),e[70]=K,e[71]=w):w=e[71];let k;return e[72]!==I||e[73]!==y||e[74]!==w||e[75]!==$||e[76]!==C||e[77]!==E?(k=s.jsxs(I,{value:$,onValueChange:C,disabled:E,children:[y,w]}),e[72]=I,e[73]=y,e[74]=w,e[75]=$,e[76]=C,e[77]=E,e[78]=k):k=e[78],k}function jt(t){const e=Q.c(51),{member:n,roles:l,onChangeRole:i,onRemove:a,isUpdating:o}=t,r=o===void 0?!1:o,u=n.role==="owner";let f,g,b,p,I,M,j,D,v;if(e[0]!==u||e[1]!==r||e[2]!==n.id||e[3]!==n.role||e[4]!==i||e[5]!==l){let y;e[15]!==n.role?(y=c=>c.role!==n.role&&c.role!=="owner",e[15]=n.role,e[16]=y):y=e[16];const K=l.filter(y);p=St;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(_t,{size:20}),e[17]=w):w=e[17],e[18]!==u?(v=s.jsx(Nt,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Ts,children:w})}),e[18]=u,e[19]=v):v=e[19],b=wt,j="end",D=_s,g=Qt;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Xt,{size:16}),e[20]=k):k=e[20],e[21]!==r?(M=s.jsxs(Jt,{disabled:r,children:[k,"Change Role"]}),e[21]=r,e[22]=M):M=e[22],f=Ht;let _;e[23]!==r||e[24]!==n.id||e[25]!==i?(_=c=>{const h=[];return c.isBuiltin||(c.allowsAllStaticPermissions?h.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&h.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?h.push("All connections"):c.connectionCount&&c.connectionCount>0&&h.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?h.push("all tools"):c.toolCount&&c.toolCount>0&&h.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),s.jsxs(et,{onClick:L=>{L.stopPropagation(),i(n.id,c.role)},disabled:r,children:[c.isBuiltin?s.jsx(Zt,{size:16}):s.jsx(Yt,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:c.label}),!c.isBuiltin&&h.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:h.join(", ")})]})]},c.role)},e[23]=r,e[24]=n.id,e[25]=i,e[26]=_):_=e[26],I=K.map(_),e[0]=u,e[1]=r,e[2]=n.id,e[3]=n.role,e[4]=i,e[5]=l,e[6]=f,e[7]=g,e[8]=b,e[9]=p,e[10]=I,e[11]=M,e[12]=j,e[13]=D,e[14]=v}else f=e[6],g=e[7],b=e[8],p=e[9],I=e[10],M=e[11],j=e[12],D=e[13],v=e[14];let $;e[27]!==f||e[28]!==I?($=s.jsx(f,{children:I}),e[27]=f,e[28]=I,e[29]=$):$=e[29];let C;e[30]!==g||e[31]!==M||e[32]!==$?(C=s.jsxs(g,{children:[M,$]}),e[30]=g,e[31]=M,e[32]=$,e[33]=C):C=e[33];let E;e[34]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(Wt,{}),e[34]=E):E=e[34];let N;e[35]!==n.id||e[36]!==a?(N=y=>{y.stopPropagation(),a(n.id)},e[35]=n.id,e[36]=a,e[37]=N):N=e[37];let R;e[38]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(es,{size:16}),e[38]=R):R=e[38];let S;e[39]!==N?(S=s.jsxs(et,{variant:"destructive",onClick:N,children:[R,"Remove Member"]}),e[39]=N,e[40]=S):S=e[40];let z;e[41]!==b||e[42]!==S||e[43]!==j||e[44]!==D||e[45]!==C?(z=s.jsxs(b,{align:j,onClick:D,children:[C,E,S]}),e[41]=b,e[42]=S,e[43]=j,e[44]=D,e[45]=C,e[46]=z):z=e[46];let A;return e[47]!==p||e[48]!==z||e[49]!==v?(A=s.jsxs(p,{children:[v,z]}),e[47]=p,e[48]=z,e[49]=v,e[50]=A):A=e[50],A}function _s(t){return t.stopPropagation()}function Ts(t){return t.stopPropagation()}function vt(t){const e=Q.c(8),{invitationId:n,onCancel:l,isCancelling:i}=t,a=i===void 0?!1:i;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Nt,{asChild:!0,children:s.jsx(ze,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:As,children:s.jsx(_t,{size:20})})}),e[0]=o):o=e[0];let r;e[1]!==n||e[2]!==l?(r=g=>{g.stopPropagation(),l(n)},e[1]=n,e[2]=l,e[3]=r):r=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Tt,{size:16}),e[4]=u):u=e[4];let f;return e[5]!==a||e[6]!==r?(f=s.jsxs(St,{children:[o,s.jsx(wt,{align:"end",onClick:Is,children:s.jsxs(et,{variant:"destructive",onClick:r,disabled:a,children:[u,"Cancel Invitation"]})})]}),e[5]=a,e[6]=r,e[7]=f):f=e[7],f}function Is(t){return t.stopPropagation()}function As(t){return t.stopPropagation()}function Ms(){const t=Q.c(103),{data:e}=Ft(),{data:n}=us(),l=fs(),i=Ve(),{locator:a}=pe(),o=yt(),[r,u]=re.useState(null),[f,g]=re.useState(null),[b,p]=re.useState(""),[I,M]=re.useState("table"),[j,D]=re.useState("member"),[v,$]=re.useState("asc"),C=e?.data?.members;let E;t[0]!==j?(E=m=>{j===m?$(Fs):(D(m),$("asc"))},t[0]=j,t[1]=E):E=t[1];const N=E;let R=C??[],S=n??[];if(b){const m=b.toLowerCase();R=R.filter(d=>d.user?.name?.toLowerCase().includes(m)||d.user?.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m)),S=S.filter(d=>d.email?.toLowerCase().includes(m)||d.role?.toLowerCase().includes(m))}if(j&&v){let m;t[2]!==v||t[3]!==j?(m=(d,T)=>{let B,de;e:switch(j){case"member":{B=d.user?.name||"",de=T.user?.name||"";break e}case"role":{B=d.role||"",de=T.role||"";break e}case"joined":{B=d.createdAt?typeof d.createdAt=="string"?d.createdAt:d.createdAt.toISOString():"",de=T.createdAt?typeof T.createdAt=="string"?T.createdAt:T.createdAt.toISOString():"";break e}default:return 0}return v==="asc"?B.localeCompare(de):de.localeCompare(B)},t[2]=v,t[3]=j,t[4]=m):m=t[4],R=[...R].sort(m)}const z=R;let A;t[5]!==o?(A=async m=>{const d=await o.organization.removeMember({memberIdOrEmail:m});if(d?.error)throw new Error(d.error.message)},t[5]=o,t[6]=A):A=t[6];let y;t[7]!==a||t[8]!==i?(y=()=>{Re("member_removed"),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member has been removed from the organization"),u(null)},t[7]=a,t[8]=i,t[9]=y):y=t[9];let K;t[10]!==A||t[11]!==y?(K={mutationFn:A,onSuccess:y,onError:Ls},t[10]=A,t[11]=y,t[12]=K):K=t[12];const w=Me(K);let k;t[13]!==o?(k=async m=>{const{memberId:d,role:T}=m,B=await o.organization.updateMemberRole({memberId:d,role:[T]});if(B?.error)throw new Error(B.error.message)},t[13]=o,t[14]=k):k=t[14];let _;t[15]!==a||t[16]!==i?(_=(m,d)=>{Re("member_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.members(a)}),oe.success("Member's role has been updated")},t[15]=a,t[16]=i,t[17]=_):_=t[17];let c;t[18]!==k||t[19]!==_?(c={mutationFn:k,onSuccess:_,onError:qs},t[18]=k,t[19]=_,t[20]=c):c=t[20];const h=Me(c);let L;t[21]!==o?(L=async m=>{const{invitationId:d,role:T,email:B}=m,de=await o.organization.cancelInvitation({invitationId:d});if(de?.error)throw new Error(de.error.message);const tt=await o.organization.inviteMember({email:B,role:T});if(tt?.error)throw new Error(tt.error.message)},t[21]=o,t[22]=L):L=t[22];let P;t[23]!==a||t[24]!==i?(P=(m,d)=>{Re("invitation_role_updated",{new_role:d.role}),i.invalidateQueries({queryKey:ce.invitations(a)}),oe.success("Invitation role has been updated")},t[23]=a,t[24]=i,t[25]=P):P=t[25];let O;t[26]!==L||t[27]!==P?(O={mutationFn:L,onSuccess:P,onError:Os},t[26]=L,t[27]=P,t[28]=O):O=t[28];const U=Me(O),{roles:q,customRoles:V}=Bt();let F;t[29]!==V?(F=Ns(V),t[29]=V,t[30]=F):F=t[30];const G=F;let J;t[31]!==q?(J=q.filter($s),t[31]=q,t[32]=J):J=t[32];const H=J;let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W={id:"member",header:"Member",render:Ds,cellClassName:"flex-1 min-w-0",sortable:!0},t[33]=W):W=t[33];let ne;t[34]!==G||t[35]!==H||t[36]!==U||t[37]!==h?(ne={id:"role",header:"Role",render:m=>m.type==="member"?s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:m.data.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>h.mutate({memberId:d,role:T}),className:"w-36"}):s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(d,T)=>U.mutate({invitationId:d,role:T,email:m.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[34]=G,t[35]=H,t[36]=U,t[37]=h,t[38]=ne):ne=t[38];let he,Y;t[39]===Symbol.for("react.memo_cache_sentinel")?(he={id:"tags",header:"Tags",render:ks,cellClassName:"w-40 shrink-0"},Y={id:"joined",header:"Joined",render:Es,cellClassName:"w-48 shrink-0",sortable:!0},t[39]=he,t[40]=Y):(he=t[39],Y=t[40]);let ie;t[41]!==l.cancel.isPending||t[42]!==q||t[43]!==h?(ie={id:"actions",header:"",render:m=>m.type==="member"?s.jsx(jt,{member:m.data,roles:q,onChangeRole:(d,T)=>h.mutate({memberId:d,role:T}),onRemove:u,isUpdating:h.isPending}):s.jsx(vt,{invitationId:m.data.id,onCancel:g,isCancelling:l.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[41]=l.cancel.isPending,t[42]=q,t[43]=h,t[44]=ie):ie=t[44];let me;t[45]!==ne||t[46]!==ie?(me=[W,ne,he,Y,ie],t[45]=ne,t[46]=ie,t[47]=me):me=t[47];const Pe=me;let ge;t[48]===Symbol.for("react.memo_cache_sentinel")?(ge=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(kt,{trigger:s.jsx(ze,{children:"Invite Member"})})}),t[48]=ge):ge=t[48];const Ee=ge,ue=[...z.map(Ps),...S.filter(zs).map(Rs)],ae=Ae,le=!!f;let Z;t[49]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>g(null),t[49]=Z):Z=t[49];let X;t[50]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs(at,{children:[s.jsx(lt,{children:"Cancel Invitation"}),s.jsx(ot,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[50]=X):X=t[50];let ee;t[51]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(rt,{children:"Keep Invitation"}),t[51]=ee):ee=t[51];let te;t[52]!==l.cancel||t[53]!==f?(te=()=>{f&&(l.cancel.mutate(f),g(null))},t[52]=l.cancel,t[53]=f,t[54]=te):te=t[54];let x;t[55]!==l.cancel.isPending||t[56]!==te?(x=s.jsxs(st,{children:[X,s.jsxs(nt,{children:[ee,s.jsx(it,{onClick:te,disabled:l.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[55]=l.cancel.isPending,t[56]=te,t[57]=x):x=t[57];let se;t[58]!==le||t[59]!==x?(se=s.jsx(ct,{open:le,onOpenChange:Z,children:x}),t[58]=le,t[59]=x,t[60]=se):se=t[60];const fe=!!r;let xe;t[61]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>u(null),t[61]=xe):xe=t[61];let Oe;t[62]===Symbol.for("react.memo_cache_sentinel")?(Oe=s.jsxs(at,{children:[s.jsx(lt,{children:"Remove Member"}),s.jsx(ot,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[62]=Oe):Oe=t[62];let qe;t[63]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsx(rt,{children:"Cancel"}),t[63]=qe):qe=t[63];let be;t[64]!==r||t[65]!==w?(be=()=>r&&w.mutate(r),t[64]=r,t[65]=w,t[66]=be):be=t[66];let je;t[67]!==w.isPending||t[68]!==be?(je=s.jsxs(st,{children:[Oe,s.jsxs(nt,{children:[qe,s.jsx(it,{onClick:be,disabled:w.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[67]=w.isPending,t[68]=be,t[69]=je):je=t[69];let ve;t[70]!==fe||t[71]!==je?(ve=s.jsx(ct,{open:fe,onOpenChange:xe,children:je}),t[70]=fe,t[71]=je,t[72]=ve):ve=t[72];const Qe=Ae,Je=Ae,At="flex flex-col gap-6";let Ce,ye;t[73]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(ds,{}),ye=s.jsx(Ae.Title,{children:"Members"}),t[73]=Ce,t[74]=ye):(Ce=t[73],ye=t[74]);let Le;t[75]===Symbol.for("react.memo_cache_sentinel")?(Le=m=>{m.key==="Escape"&&(p(""),m.target.blur())},t[75]=Le):Le=t[75];let Se;t[76]!==b?(Se=s.jsx(Pt,{value:b,onChange:p,placeholder:"Search members...",className:"w-full md:w-[375px]",onKeyDown:Le}),t[76]=b,t[77]=Se):Se=t[77];let Fe;t[78]===Symbol.for("react.memo_cache_sentinel")?(Fe=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[78]=Fe):Fe=t[78];let Ne;t[79]!==N||t[80]!==v||t[81]!==j||t[82]!==I?(Ne=s.jsx(zt,{viewMode:I,onViewModeChange:M,sortKey:j,sortDirection:v,onSort:N,sortOptions:Fe}),t[79]=N,t[80]=v,t[81]=j,t[82]=I,t[83]=Ne):Ne=t[83];let we;t[84]!==Se||t[85]!==Ne?(we=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Se,Ne]}),Ee]}),t[84]=Se,t[85]=Ne,t[86]=we):we=t[86];const He=I==="cards"?s.jsx("div",{children:ue.length===0?s.jsx(We,{title:"No members found",description:b?`No members match "${b}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:ue.map(m=>{if(m.type==="invitation")return s.jsxs(mt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(vt,{invitationId:m.data.id,onCancel:g,isCancelling:l.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{fallback:Ue(m.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:m.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ge,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(Ke,{role:m.data.role,memberId:m.data.id,isOwner:!1,roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>U.mutate({invitationId:T,role:B,email:m.data.email}),className:"w-fit"})]})]})]},`inv-${m.data.id}`);const d=m.data;return s.jsxs(mt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(jt,{member:d,roles:q,onChangeRole:(T,B)=>h.mutate({memberId:T,role:B}),onRemove:u,isUpdating:h.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(De,{url:d.user?.image??void 0,fallback:Ue(d.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:d.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:d.user?.email}),s.jsx(Ke,{role:d.role,memberId:d.id,isOwner:d.role==="owner",roleColorMap:G,selectableRoles:H,onRoleChange:(T,B)=>h.mutate({memberId:T,role:B}),className:"w-fit"}),s.jsx(It,{memberId:d.id,maxDisplay:3})]})]})]},d.id)})})}):s.jsx(Et,{columns:Pe,data:ue,isLoading:!1,sortKey:j,sortDirection:v,onSort:N,emptyState:b?s.jsx(We,{title:"No members found",description:`No members match "${b}"`}):s.jsx(We,{title:"No members found",description:"Invite members to get started."})});let _e;t[87]!==Ce||t[88]!==ye||t[89]!==we||t[90]!==He?(_e=s.jsxs("div",{className:At,children:[Ce,ye,we,He]}),t[87]=Ce,t[88]=ye,t[89]=we,t[90]=He,t[91]=_e):_e=t[91];let Te;t[92]!==Je.Body||t[93]!==_e?(Te=s.jsx(Je.Body,{children:_e}),t[92]=Je.Body,t[93]=_e,t[94]=Te):Te=t[94];let Ie;t[95]!==Qe.Content||t[96]!==Te?(Ie=s.jsx(Qe.Content,{children:Te}),t[95]=Qe.Content,t[96]=Te,t[97]=Ie):Ie=t[97];let Be;return t[98]!==ae||t[99]!==se||t[100]!==ve||t[101]!==Ie?(Be=s.jsxs(ae,{children:[se,ve,Ie]}),t[98]=ae,t[99]=se,t[100]=ve,t[101]=Ie,t[102]=Be):Be=t[102],Be}function Rs(t){return{type:"invitation",data:t}}function zs(t){return t.status==="pending"}function Ps(t){return{type:"member",data:t}}function Es(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?ws(t.data.createdAt):"N/A"}):s.jsx(Ge,{variant:"outline",children:"Pending"})}function ks(t){return t.type==="member"?s.jsx(It,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function Ds(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{url:t.data.user?.image??void 0,fallback:Ue(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(De,{fallback:Ue(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function $s(t){return t.role!=="owner"}function Os(t,e){Re("invitation_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update invitation role")}function qs(t,e){Re("member_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to update role")}function Ls(t){Re("member_remove_failed",{error:t instanceof Error?t.message:String(t)}),oe.error(t instanceof Error?t.message:"Failed to remove member")}function Fs(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Bs(){const t=Q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ae,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Rt,{fallback:e,children:s.jsx(re.Suspense,{fallback:s.jsx(Ae,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ms,{})})}),t[1]=n):n=t[1],n}function Bn(){const t=Q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ms,{capability:"members:manage",area:"members",children:s.jsx(Bs,{})}),t[0]=e):e=t[0],e}export{Bn as default};
@@ -1 +0,0 @@
1
- import{c as it,r as E,j as e,i as rt}from"./index-OF548fxc.js";import{S as mt,b as pt,c as st,d as at}from"./sheet-S1l6W00L.js";import{S as nt}from"./scroll-area-DVylVd8s.js";import{r as lt,c as ct,u as dt,a as St,i as ft,f as ut,d as vt,P as ht,S as gt}from"./page-seo-form-SfmOLumQ.js";import{v as xt}from"./index-BLK_ychv.js";import"./X-DchRughI.js";import"./agent-icon-Bw-pYaqu.js";import"./AlertCircle-DMGExMxY.js";import"./Tool01-CPfgYpSb.js";import"./SwitchHorizontal01-DKfBMAMt.js";import"./Settings02-BXQlyl72.js";import"./XCircle-BMPeQmo7.js";import"./ArrowUpRight-BYUnq8gY.js";import"./ZapSquare-DRmIxSdp.js";import"./Users03-DEShSeP4.js";import"./CheckCircle-C5ITwmFz.js";import"./ChevronUp-BgfgTfJo.js";import"./ChevronDown-BDi4pzpg.js";import"./ChevronRight-CkirMRmz.js";import"./DotsVertical-wFUaTKIr.js";import"./Stars02-oR68jXM_.js";import"./Eye-BPtPfNj_.js";import"./ZoomOut-VZDZQqnX.js";import"./Globe01-CHueNlXT.js";import"./FilterLines-DCrHo_W-.js";import"./Star01-CaO0nMo9.js";import"./Globe04-D1Ia72FD.js";import"./HardDrive-C5pxB0xX.js";import"./Key01-D_Aswhqq.js";import"./LayoutLeft-BIAH0kog.js";import"./LinkExternal01-vG76nXPe.js";import"./Monitor01-BEHd5v9A.js";import"./Sun-gt9ujltE.js";import"./Palette-CUxSqgEM.js";import"./Play-B6SMfN5e.js";import"./Plus-B3W-zU0m.js";import"./SearchLg-CwA3o7Kq.js";import"./SearchMd-CG-ZdWyV.js";import"./Shield01-C5cTYwHG.js";import"./Stars01-DjfTA0U2.js";import"./Trash01-De9U-JcA.js";import"./Upload01-XVwkIKd6.js";import"./User01--wnyNy2g.js";import"./Users01-DQSxkCun.js";import"./XClose-BlQxiRFv.js";import"./Zap-gCfOy-ns.js";import"./use-clock-tick-7xgXM9p8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Ba_RrSds.js";import"./tooltip-CKk6MyBG.js";import"./file-type-icon-CeDR5FDE.js";import"./dialog-Bw0pp5yj.js";import"./use-mobile-71FrMeIQ.js";import"./tab-id-CLpu897Q.js";import"./content-blocks-o63cs2vh.js";import"./types-CeLnpp7L.js";import"./use-mcp-client-PdP6F3TE.js";import"./auth-BZgEN2RD.js";import"./chat-context-D6mGbi6m.js";import"./hooks-BPEh0QmD.js";import"./decopilot-sse-pool-D-yGYu6w.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-D3Xj1Zyr.js";import"./use-collections-CdbL-rX2.js";import"./use-ai-providers-DhQCSBc1.js";import"./studio-tools-DkATXRgK.js";import"./use-decopilot-events-DwY1rJO2.js";import"./use-organization-settings-BZHnFHzb.js";import"./shell-layout-D3aCzUD1.js";import"./avatar-B8STW9mD.js";import"./alert-dialog-Buxux4Jv.js";import"./required-auth-layout-BFKAd6mb.js";import"./use-org-sso-DnPy8IJo.js";import"./integration-icon-B3836mZm.js";import"./use-navigate-to-agent-DIwK9fdW.js";import"./use-connection-BoEeMU65.js";import"./use-mcp-prompts-UzvitU_e.js";import"./form-BvyPfbLQ.js";import"./label-Cpj2tcAv.js";import"./input-C6fESize.js";import"./select-CYLZmEqL.js";import"./switch-C4FKiTgP.js";import"./library-tab-BBjWEEvH.js";import"./drawer-Bqwp_rDk.js";import"./collection-search-C_fvYmsw.js";import"./tabs-B9iGaa-Z.js";import"./toggle-group-CN_l4byE.js";import"./agent-capabilities-Bxs0ILD3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CIIT6a-B.js";import"./use-registry-connections-BItKY-Xq.js";import"./useInfiniteQuery-CdROm-U7.js";import"./use-infinite-scroll-DHUYU_kG.js";import"./extract-connection-data-DB2mp1s-.js";import"./card-BWrHlXPo.js";import"./collection-tabs-Bj8UeBuP.js";import"./badge-D5WiG5D4.js";import"./textarea-CiUwXw-w.js";import"./connection-form-helpers-DYr5JaDw.js";import"./authenticate-and-persist-oauth-cJNik8J_.js";import"./mcp-oauth-DXbhYp2n.js";import"./useSuspenseInfiniteQuery-DtKEQU_S.js";import"./connect-desktop-dialog-DU7oJbU_.js";import"./decopilot-BEN2dFqJ.js";import"./checkbox-B0iPK-Vx.js";import"./skeleton-wLHgTqVy.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cd3zmde3.js";import"./popover-CPAEPhwT.js";import"./command-DeIgAPPz.js";import"./index-C3UHIWhR.js";import"./index-DBQeQBu7.js";import"./toolbar-ekp7NSbq.js";import"./use-debounced-value-CyOmB5fJ.js";import"./dropdown-menu-DBdT-R6w.js";import"./index-C0UjMZmb.js";import"./question-004-sINsf4GQ.js";import"./task-row-Dq6a6p3f.js";import"./task-status-vCNfacyn.js";import"./use-status-sounds-C23loojF.js";import"./empty-state-DEvtcbTs.js";import"./use-mcp-tools-zFZxfr6-.js";import"./use-capability-HK8_0h49.js";import"./tools-list-D_VeN0IP.js";import"./use-debounced-autosave-B6gDjRvo.js";import"./index-C4E5A5_g.js";import"./sidebar-DKxDx7lC.js";import"./search-input-DsIBo_sc.js";import"./github-repo-picker-D7QB7NBL.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-CJb3Q-KQ.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./toolbar-icon-button-CBlJ6I0o.js";import"./automation-runs-D52rO4m5.js";import"./table-BV3Hd7cI.js";import"./use-members-DTTAqnQj.js";import"./use-org-auth-client-CfqWFlO5.js";import"./use-automations-DH-tTWJO.js";import"./use-file-configs-SlXV4SMn.js";import"./monaco-editor-Dg_OXRF1.js";import"./select-model-BEsDOV7S.js";import"./automation-list-row-BUhdfpZz.js";function ri(u){const t=it.c(46),{open:N,onOpenChange:P,orgSlug:Q,virtualMcpId:U,branch:W,decofile:G,meta:s,target:m,onSaved:X}=u,o=lt(G,m,s),k=m.kind==="site"?"site":m.pageKey,[Y,Z]=E.useState(k),[tt,i]=E.useState(null),[J,g]=E.useState(void 0),[x,y]=E.useState(0);Y!==k&&(Z(k),i(null),g(void 0),y(wt));const{persistSeo:a,persistRawSeo:I,flush:K,isPending:D}=ct({orgSlug:Q,virtualMcpId:U,branch:W,target:m,resolved:o,onSaved:X}),w=m.kind==="page",ot=w?o?.rawSeoData:void 0,v=J!==void 0?J:ot,et=w?dt(v)??void 0:void 0,h=tt??et??o?.seoData??{},p=o?St(h,o):null,n=p&&(!w||ft(v))?xt(p,s):null,_=m.kind==="page"?ut(G,s)?.seoData??void 0:void 0;let j;t[0]!==s?(j=vt(s),t[0]=s,t[1]=j):j=t[1];const M=j;let R;t[2]!==a||t[3]!==o||t[4]!==i?(R=r=>{if(!o)return;const L=r;i(L),a(L)},t[2]=a,t[3]=o,t[4]=i,t[5]=R):R=t[5];const V=R;let F;t[6]!==K||t[7]!==P?(F=r=>{r||K(),P(r)},t[6]=K,t[7]=P,t[8]=F):F=t[8];const z=F,A=m.kind==="site"?"Site SEO":"Page SEO",T=w&&o,B=m.kind==="site"&&o&&n,H=m.kind==="site"?"No site-level SEO block found.":o?"SEO schema not found for this page.":"Could not load page SEO.";let C;t[9]!==i?(C=()=>i(null),t[9]=i,t[10]=C):C=t[10];const $=C;let O;t[11]!==y?(O=()=>y(yt),t[11]=y,t[12]=O):O=t[12];const q=O;let l;t[13]!==A?(l=e.jsx(mt,{className:"text-sm font-semibold",children:A}),t[13]=A,t[14]=l):l=t[14];let c;t[15]!==D?(c=D&&e.jsx(rt,{size:14,className:"animate-spin text-muted-foreground"}),t[15]=D,t[16]=c):c=t[16];let d;t[17]!==l||t[18]!==c?(d=e.jsxs(pt,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[l,c]}),t[17]=l,t[18]=c,t[19]=d):d=t[19];let S;t[20]!==p||t[21]!==q||t[22]!==$||t[23]!==M||t[24]!==v||t[25]!==h||t[26]!==H||t[27]!==x||t[28]!==V||t[29]!==I||t[30]!==a||t[31]!==o||t[32]!==n||t[33]!==i||t[34]!==g||t[35]!==T||t[36]!==B||t[37]!==_?(S=!o||!T&&!B?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:H}):e.jsx(nt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:e.jsx("div",{className:"px-6 py-4",children:e.jsx("div",{className:"mx-auto max-w-sm",children:T?e.jsx(ht,{rawSeo:v,innerSeo:h,defaultResolveType:M,seoSchema:n,activeResolveType:p,seoTypeOptions:o.seoTypeOptions,formResetKey:x,siteDefaultSeo:_,onPersistRaw:r=>{g(r),I(r)},onInnerChange:r=>{i(r),a(r)},onClearForm:$,onBumpFormKey:q}):n&&p&&e.jsx(gt,{schema:n,resolveType:p,value:h,formResetKey:x,onChange:V})})})}),t[20]=p,t[21]=q,t[22]=$,t[23]=M,t[24]=v,t[25]=h,t[26]=H,t[27]=x,t[28]=V,t[29]=I,t[30]=a,t[31]=o,t[32]=n,t[33]=i,t[34]=g,t[35]=T,t[36]=B,t[37]=_,t[38]=S):S=t[38];let f;t[39]!==d||t[40]!==S?(f=e.jsxs(st,{side:"right",className:"w-[400px] sm:max-w-[440px] p-0 gap-0",children:[d,S]}),t[39]=d,t[40]=S,t[41]=f):f=t[41];let b;return t[42]!==z||t[43]!==N||t[44]!==f?(b=e.jsx(at,{open:N,onOpenChange:z,children:f}),t[42]=z,t[43]=N,t[44]=f,t[45]=b):b=t[45],b}function yt(u){return u+1}function wt(u){return u+1}export{ri as SeoSheet};
@@ -1 +0,0 @@
1
- import{c as H,j as t,B as Z}from"./index-OF548fxc.js";import{n as ee}from"./LinkExternal01-vG76nXPe.js";import{aE as te,t as oe}from"./agent-icon-Bw-pYaqu.js";import{I as J}from"./input-C6fESize.js";import{L as G}from"./label-Cpj2tcAv.js";import{M as ie}from"./automation-runs-D52rO4m5.js";import{T as Q,a as se,b as W,c as le}from"./tabs-B9iGaa-Z.js";import{T as re}from"./textarea-CiUwXw-w.js";import{au as ae,av as me,at as pe,aw as ne,ax as ce,ay as de,az as fe}from"./index-BLK_ychv.js";import{b as ue,a as xe,B as he}from"./block-document-CyegCur0.js";import{u as ge,s as F,E as ve,R as ye,A as je}from"./primitives-TAuh4FGx.js";import"./AlertCircle-DMGExMxY.js";import"./Tool01-CPfgYpSb.js";import"./SwitchHorizontal01-DKfBMAMt.js";import"./Settings02-BXQlyl72.js";import"./XCircle-BMPeQmo7.js";import"./ArrowUpRight-BYUnq8gY.js";import"./ZapSquare-DRmIxSdp.js";import"./Users03-DEShSeP4.js";import"./CheckCircle-C5ITwmFz.js";import"./ChevronUp-BgfgTfJo.js";import"./ChevronDown-BDi4pzpg.js";import"./ChevronRight-CkirMRmz.js";import"./DotsVertical-wFUaTKIr.js";import"./Stars02-oR68jXM_.js";import"./Eye-BPtPfNj_.js";import"./ZoomOut-VZDZQqnX.js";import"./Globe01-CHueNlXT.js";import"./FilterLines-DCrHo_W-.js";import"./Star01-CaO0nMo9.js";import"./Globe04-D1Ia72FD.js";import"./HardDrive-C5pxB0xX.js";import"./Key01-D_Aswhqq.js";import"./LayoutLeft-BIAH0kog.js";import"./Monitor01-BEHd5v9A.js";import"./Sun-gt9ujltE.js";import"./Palette-CUxSqgEM.js";import"./Play-B6SMfN5e.js";import"./Plus-B3W-zU0m.js";import"./SearchLg-CwA3o7Kq.js";import"./SearchMd-CG-ZdWyV.js";import"./Shield01-C5cTYwHG.js";import"./Stars01-DjfTA0U2.js";import"./Trash01-De9U-JcA.js";import"./Upload01-XVwkIKd6.js";import"./User01--wnyNy2g.js";import"./Users01-DQSxkCun.js";import"./XClose-BlQxiRFv.js";import"./X-DchRughI.js";import"./Zap-gCfOy-ns.js";import"./useInfiniteQuery-CdROm-U7.js";import"./use-infinite-scroll-DHUYU_kG.js";import"./use-connection-BoEeMU65.js";import"./use-collections-CdbL-rX2.js";import"./use-mcp-client-PdP6F3TE.js";import"./auth-BZgEN2RD.js";import"./use-virtual-mcp-D3Xj1Zyr.js";import"./card-BWrHlXPo.js";import"./sheet-S1l6W00L.js";import"./table-BV3Hd7cI.js";import"./empty-state-DEvtcbTs.js";import"./use-members-DTTAqnQj.js";import"./use-org-auth-client-CfqWFlO5.js";import"./task-status-vCNfacyn.js";import"./use-automations-DH-tTWJO.js";import"./studio-tools-DkATXRgK.js";import"./useSuspenseInfiniteQuery-DtKEQU_S.js";import"./badge-D5WiG5D4.js";import"./select-CYLZmEqL.js";import"./tooltip-CKk6MyBG.js";import"./checkbox-B0iPK-Vx.js";import"./command-DeIgAPPz.js";import"./index-C3UHIWhR.js";import"./dialog-Bw0pp5yj.js";import"./popover-CPAEPhwT.js";import"./avatar-B8STW9mD.js";import"./scroll-area-DVylVd8s.js";import"./use-clock-tick-7xgXM9p8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Ba_RrSds.js";import"./file-type-icon-CeDR5FDE.js";import"./use-mobile-71FrMeIQ.js";import"./tab-id-CLpu897Q.js";import"./content-blocks-o63cs2vh.js";import"./types-CeLnpp7L.js";import"./chat-context-D6mGbi6m.js";import"./hooks-BPEh0QmD.js";import"./decopilot-sse-pool-D-yGYu6w.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-DhQCSBc1.js";import"./use-decopilot-events-DwY1rJO2.js";import"./use-organization-settings-BZHnFHzb.js";import"./shell-layout-D3aCzUD1.js";import"./alert-dialog-Buxux4Jv.js";import"./required-auth-layout-BFKAd6mb.js";import"./use-org-sso-DnPy8IJo.js";import"./integration-icon-B3836mZm.js";import"./use-navigate-to-agent-DIwK9fdW.js";import"./use-mcp-prompts-UzvitU_e.js";import"./form-BvyPfbLQ.js";import"./library-tab-BBjWEEvH.js";import"./drawer-Bqwp_rDk.js";import"./collection-search-C_fvYmsw.js";import"./toggle-group-CN_l4byE.js";import"./agent-capabilities-Bxs0ILD3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CIIT6a-B.js";import"./use-registry-connections-BItKY-Xq.js";import"./extract-connection-data-DB2mp1s-.js";import"./collection-tabs-Bj8UeBuP.js";import"./connection-form-helpers-DYr5JaDw.js";import"./authenticate-and-persist-oauth-cJNik8J_.js";import"./mcp-oauth-DXbhYp2n.js";import"./connect-desktop-dialog-DU7oJbU_.js";import"./decopilot-BEN2dFqJ.js";import"./skeleton-wLHgTqVy.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cd3zmde3.js";import"./index-DBQeQBu7.js";import"./toolbar-ekp7NSbq.js";import"./use-debounced-value-CyOmB5fJ.js";import"./dropdown-menu-DBdT-R6w.js";import"./index-C0UjMZmb.js";import"./question-004-sINsf4GQ.js";import"./task-row-Dq6a6p3f.js";import"./use-status-sounds-C23loojF.js";import"./use-mcp-tools-zFZxfr6-.js";import"./use-capability-HK8_0h49.js";import"./tools-list-D_VeN0IP.js";import"./switch-C4FKiTgP.js";import"./use-debounced-autosave-B6gDjRvo.js";import"./index-C4E5A5_g.js";import"./sidebar-DKxDx7lC.js";import"./search-input-DsIBo_sc.js";import"./github-repo-picker-D7QB7NBL.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-CJb3Q-KQ.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./toolbar-icon-button-CBlJ6I0o.js";import"./use-file-configs-SlXV4SMn.js";import"./monaco-editor-Dg_OXRF1.js";import"./select-model-BEsDOV7S.js";import"./automation-list-row-BUhdfpZz.js";function be(A){return Array.isArray(A)?A.map(e=>({key:F(e?.key),value:F(e?.value)})):[]}function ai(A){const e=H.c(66),{orgSlug:i,virtualMcpId:d,branch:o,blockKey:l,block:p,decofile:m,meta:u,previewBaseUrl:x}=A;let y;e[0]!==o||e[1]!==i||e[2]!==d?(y={orgSlug:i,virtualMcpId:d,branch:o},e[0]=o,e[1]=i,e[2]=d,e[3]=y):y=e[3];const s=ae(y);let n;e[4]!==p?(n=me(p,"posts"),e[4]=p,e[5]=n):n=e[5];const j=n;let b;e[6]!==l||e[7]!==s?(b=T=>{s.mutate({blockKey:l,data:ne(l,"posts",T)})},e[6]=l,e[7]=s,e[8]=b):b=e[8];const[r,_]=ge(j,b);let C;e[9]!==r||e[10]!==_?(C=(T,Y)=>_({...r,[T]:Y}),e[9]=r,e[10]=_,e[11]=C):C=e[11];const h=C;let S;e[12]!==m||e[13]!==r||e[14]!==x?(S=ue({decofile:m,post:r,previewBaseUrl:x}),e[12]=m,e[13]=r,e[14]=x,e[15]=S):S=e[15];const f=S;let a;e[16]!==r.title?(a=F(r.title)||"Untitled post",e[16]=r.title,e[17]=a):a=e[17];let c;e[18]!==a?(c=t.jsx("span",{className:"truncate text-sm font-medium",children:a}),e[18]=a,e[19]=c):c=e[19];let g;e[20]!==s.isError||e[21]!==s.isPending?(g=t.jsx(pe,{isPending:s.isPending,isError:s.isError}),e[20]=s.isError,e[21]=s.isPending,e[22]=g):g=e[22];const k=!f,P=f?"Open the post preview in a new tab":"Set the post slug (and its category) plus the blog app's pageSlug to preview";let N;e[23]!==f?(N=()=>{f&&window.open(f,"_blank","noopener,noreferrer")},e[23]=f,e[24]=N):N=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx(ee,{size:14}),e[25]=B):B=e[25];let w;e[26]!==P||e[27]!==N||e[28]!==k?(w=t.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:k,title:P,onClick:N,children:[B,"See preview"]}),e[26]=P,e[27]=N,e[28]=k,e[29]=w):w=e[29];let E;e[30]!==w||e[31]!==g?(E=t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[g,w]}),e[30]=w,e[31]=g,e[32]=E):E=e[32];let v;e[33]!==E||e[34]!==c?(v=t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[c,E]}),e[33]=E,e[34]=c,e[35]=v):v=e[35];let L;e[36]!==r.title?(L=F(r.title),e[36]=r.title,e[37]=L):L=e[37];let R;e[38]!==h?(R=T=>h("title",T),e[38]=h,e[39]=R):R=e[39];let U;e[40]!==L||e[41]!==R?(U=t.jsx(ve,{value:L,onChange:R,placeholder:"Post title",className:"py-1 text-4xl font-bold text-foreground"}),e[40]=L,e[41]=R,e[42]=U):U=e[42];let O;e[43]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs(Q,{value:"content",children:[t.jsx(te,{}),"Content"]}),e[43]=O):O=e[43];let K;e[44]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsxs(se,{children:[O,t.jsxs(Q,{value:"settings",children:[t.jsx(oe,{}),"Settings"]})]}),e[44]=K):K=e[44];let $;e[45]!==r.sections?($=xe(r.sections),e[45]=r.sections,e[46]=$):$=e[46];let I;e[47]!==h?(I=T=>h("sections",T),e[47]=h,e[48]=I):I=e[48];let M;e[49]!==u||e[50]!==$||e[51]!==I?(M=t.jsx(W,{value:"content",children:t.jsx("div",{className:"rounded-xl border bg-card p-8 shadow-sm",children:t.jsx(he,{value:$,onChange:I,meta:u,emptyMessage:"This post has no content yet. Use ⊕ to add your first block."})})}),e[49]=u,e[50]=$,e[51]=I,e[52]=M):M=e[52];let z;e[53]!==m||e[54]!==r||e[55]!==h?(z=t.jsx(W,{value:"settings",children:t.jsx("div",{className:"rounded-xl border bg-card p-6 shadow-sm",children:t.jsx(Ce,{post:r,decofile:m,onChange:h})})}),e[53]=m,e[54]=r,e[55]=h,e[56]=z):z=e[56];let D;e[57]!==M||e[58]!==z?(D=t.jsxs(le,{defaultValue:"content",className:"mt-6 gap-4",children:[K,M,z]}),e[57]=M,e[58]=z,e[59]=D):D=e[59];let V;e[60]!==U||e[61]!==D?(V=t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[U,D]})}),e[60]=U,e[61]=D,e[62]=V):V=e[62];let q;return e[63]!==v||e[64]!==V?(q=t.jsxs("div",{className:"flex h-full flex-col",children:[v,V]}),e[63]=v,e[64]=V,e[65]=q):q=e[65],q}function Ce(A){const e=H.c(59),{post:i,decofile:d,onChange:o}=A;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(G,{htmlFor:"post-excerpt",children:"Excerpt"}),e[0]=l):l=e[0];let p;e[1]!==i.excerpt?(p=F(i.excerpt),e[1]=i.excerpt,e[2]=p):p=e[2];let m;e[3]!==o?(m=v=>o("excerpt",v.target.value),e[3]=o,e[4]=m):m=e[4];let u;e[5]!==p||e[6]!==m?(u=t.jsxs("div",{className:"space-y-2",children:[l,t.jsx(re,{id:"post-excerpt",value:p,onChange:m,rows:2})]}),e[5]=p,e[6]=m,e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(G,{htmlFor:"post-slug",children:"Slug"}),e[8]=x):x=e[8];let y;e[9]!==i.slug?(y=F(i.slug),e[9]=i.slug,e[10]=y):y=e[10];let s;e[11]!==o?(s=v=>o("slug",v.target.value),e[11]=o,e[12]=s):s=e[12];let n;e[13]!==y||e[14]!==s?(n=t.jsxs("div",{className:"space-y-2",children:[x,t.jsx(J,{id:"post-slug",value:y,onChange:s,placeholder:"my-post",className:"h-10"})]}),e[13]=y,e[14]=s,e[15]=n):n=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j={type:"string",format:"date",title:"Date"},e[16]=j):j=e[16];let b;e[17]!==i.date?(b=F(i.date),e[17]=i.date,e[18]=b):b=e[18];let r;e[19]!==o?(r=v=>o("date",v),e[19]=o,e[20]=r):r=e[20];let _;e[21]!==b||e[22]!==r?(_=t.jsx(fe,{schema:j,value:b,onChange:r,path:"post-date",label:"Date"}),e[21]=b,e[22]=r,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==n?(C=t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n,_]}),e[24]=_,e[25]=n,e[26]=C):C=e[26];let h;e[27]===Symbol.for("react.memo_cache_sentinel")?(h={type:"string",format:"image-uri",title:"Cover image"},e[27]=h):h=e[27];let S;e[28]!==o?(S=v=>o("image",v),e[28]=o,e[29]=S):S=e[29];let f;e[30]!==i.image||e[31]!==S?(f=t.jsx(ce,{schema:h,value:i.image,onChange:S,path:"post-image",label:"Cover image"}),e[30]=i.image,e[31]=S,e[32]=f):f=e[32];let a;e[33]===Symbol.for("react.memo_cache_sentinel")?(a=["email"],e[33]=a):a=e[33];let c;e[34]!==o?(c=v=>o("authors",v),e[34]=o,e[35]=c):c=e[35];let g;e[36]!==d||e[37]!==i.authors||e[38]!==c?(g=t.jsx(X,{label:"Authors",decofile:d,kind:"authors",valueField:"email",extraFields:a,selected:i.authors,onChange:c}),e[36]=d,e[37]=i.authors,e[38]=c,e[39]=g):g=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=["slug"],e[40]=k):k=e[40];let P;e[41]!==o?(P=v=>o("categories",v),e[41]=o,e[42]=P):P=e[42];let N;e[43]!==d||e[44]!==i.categories||e[45]!==P?(N=t.jsx(X,{label:"Categories",decofile:d,kind:"categories",valueField:"slug",extraFields:k,selected:i.categories,onChange:P}),e[43]=d,e[44]=i.categories,e[45]=P,e[46]=N):N=e[46];let B;e[47]!==o?(B=v=>o("extraProps",v),e[47]=o,e[48]=B):B=e[48];let w;e[49]!==i.extraProps||e[50]!==B?(w=t.jsx(ke,{value:i.extraProps,onChange:B}),e[49]=i.extraProps,e[50]=B,e[51]=w):w=e[51];let E;return e[52]!==C||e[53]!==f||e[54]!==g||e[55]!==N||e[56]!==w||e[57]!==u?(E=t.jsxs("div",{className:"space-y-5",children:[u,C,f,g,N,w]}),e[52]=C,e[53]=f,e[54]=g,e[55]=N,e[56]=w,e[57]=u,e[58]=E):E=e[58],E}function ke(A){const e=H.c(15),{value:i,onChange:d}=A;let o,l,p,m;if(e[0]!==d||e[1]!==i){o=be(i);const y=(s,n)=>d(o.map((j,b)=>b===s?{...j,...n}:j));l="space-y-2",e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(G,{children:"Extra props"}),e[6]=p):p=e[6],m=o.length>0&&t.jsx("ul",{className:"space-y-2",children:o.map((s,n)=>t.jsxs("li",{className:"group/item flex items-center gap-2",children:[t.jsx(J,{value:s.key,onChange:j=>y(n,{key:j.target.value}),placeholder:"key",className:"h-9 flex-1"}),t.jsx(J,{value:s.value,onChange:j=>y(n,{value:j.target.value}),placeholder:"value",className:"h-9 flex-1"}),t.jsx(ye,{label:"Remove prop",onClick:()=>d(o.filter((j,b)=>b!==n))})]},n))}),e[0]=d,e[1]=i,e[2]=o,e[3]=l,e[4]=p,e[5]=m}else o=e[2],l=e[3],p=e[4],m=e[5];let u;e[7]!==o||e[8]!==d?(u=t.jsx(je,{label:"Add prop",onClick:()=>d([...o,{key:"",value:""}])}),e[7]=o,e[8]=d,e[9]=u):u=e[9];let x;return e[10]!==l||e[11]!==p||e[12]!==m||e[13]!==u?(x=t.jsxs("div",{className:l,children:[p,m,u]}),e[10]=l,e[11]=p,e[12]=m,e[13]=u,e[14]=x):x=e[14],x}function X(A){const e=H.c(31),{label:i,decofile:d,kind:o,valueField:l,extraFields:p,selected:m,onChange:u}=A;let x,y,s;if(e[0]!==d||e[1]!==o||e[2]!==l){x=de(d,o);let f;e[6]!==l?(f=(c,g)=>F(c[l])||g,e[6]=l,e[7]=f):f=e[7],s=f;let a;e[8]!==s?(a=c=>{const{key:g,payload:k}=c;return{value:s(k,g),label:F(k.name)||s(k,g)}},e[8]=s,e[9]=a):a=e[9],y=x.map(a),e[0]=d,e[1]=o,e[2]=l,e[3]=x,e[4]=y,e[5]=s}else x=e[3],y=e[4],s=e[5];const n=y;let j;if(e[10]!==m||e[11]!==l){const f=Array.isArray(m)?m:[];let a;e[13]!==l?(a=c=>F(c[l]),e[13]=l,e[14]=a):a=e[14],j=f.map(a).filter(Boolean),e[10]=m,e[11]=l,e[12]=j}else j=e[12];const b=j;let r;e[15]!==p||e[16]!==u||e[17]!==x||e[18]!==l||e[19]!==s?(r=f=>{u(f.map(a=>{const c=x.find(k=>{const{key:P,payload:N}=k;return s(N,P)===a});if(!c)return{name:a,[l]:a};const g={name:F(c.payload.name)};for(const k of p)g[k]=c.payload[k]??a;return g}))},e[15]=p,e[16]=u,e[17]=x,e[18]=l,e[19]=s,e[20]=r):r=e[20];const _=r;let C;e[21]!==i?(C=t.jsx(G,{children:i}),e[21]=i,e[22]=C):C=e[22];let h;e[23]!==b||e[24]!==_||e[25]!==i||e[26]!==n?(h=n.length===0?t.jsxs("p",{className:"text-xs text-muted-foreground",children:["No ",i.toLowerCase()," yet — create some in the"," ",i.toLowerCase()," collection."]}):t.jsx(ie,{options:n,defaultValue:b,onValueChange:_,placeholder:`Select ${i.toLowerCase()}`,maxCount:4}),e[23]=b,e[24]=_,e[25]=i,e[26]=n,e[27]=h):h=e[27];let S;return e[28]!==C||e[29]!==h?(S=t.jsxs("div",{className:"space-y-2",children:[C,h]}),e[28]=C,e[29]=h,e[30]=S):S=e[30],S}export{ai as PostEditor};