decocms 3.97.4 → 3.97.5

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 (212) hide show
  1. package/dist/client/assets/{AlertCircle-BI7qL-zf.js → AlertCircle-BY01IebW.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-Z3BBkuVk.js → ArrowUpRight-CrNpVXJQ.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-Ct0IkEsg.js → CheckCircle-UPyj94ce.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-c1oSYfs-.js → ChevronDown-DuS1gosF.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-B5WBGMCf.js → ChevronLeft-DNoBDBkQ.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-ro8pTEbC.js → ChevronRight-DUYBaJAA.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-D4yp8Sde.js → ChevronUp-Bj5wnP8v.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-Bva5wMia.js → DotsVertical-BoWHOZg-.js} +1 -1
  9. package/dist/client/assets/{Eye-Dz0LfZhX.js → Eye-BN8eZd3q.js} +1 -1
  10. package/dist/client/assets/{FilterLines-CNNSd5My.js → FilterLines-BcDA53T2.js} +1 -1
  11. package/dist/client/assets/{Globe01-Cat8RRQP.js → Globe01-CtRTi-q3.js} +1 -1
  12. package/dist/client/assets/{Globe04-CNkdEC4q.js → Globe04-DcqSH090.js} +1 -1
  13. package/dist/client/assets/{HardDrive-Bp0ax-t_.js → HardDrive-LcockCRx.js} +1 -1
  14. package/dist/client/assets/{Key01-CK-dtvzj.js → Key01-BcXniqTr.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-DRgE3-pt.js → LayoutLeft-DIu4qlvA.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-BMRTG9GY.js → LinkExternal01-Dyt9zIKA.js} +1 -1
  17. package/dist/client/assets/{Monitor01-ClILKoXR.js → Monitor01-BY0WhsQY.js} +1 -1
  18. package/dist/client/assets/{Palette-DzZpBk45.js → Palette-D0tFYq6o.js} +1 -1
  19. package/dist/client/assets/{Play-B0tuLbrU.js → Play-Ds_dyiCJ.js} +1 -1
  20. package/dist/client/assets/{Plus-C2AcrVDQ.js → Plus-CXJQYPWf.js} +1 -1
  21. package/dist/client/assets/{SearchMd-CiOkSnnl.js → SearchMd--1Uwo-4h.js} +1 -1
  22. package/dist/client/assets/{Settings02-DIy8pOAO.js → Settings02-Qog-9BW9.js} +1 -1
  23. package/dist/client/assets/{Shield01-txQYlyv3.js → Shield01-BjGAptDu.js} +1 -1
  24. package/dist/client/assets/{Star01-DhVZBXZp.js → Star01-BNPre7m8.js} +1 -1
  25. package/dist/client/assets/{Stars01-BpFWqd_D.js → Stars01-CUSSCI6Q.js} +1 -1
  26. package/dist/client/assets/{Stars02-Ulg_Ysyf.js → Stars02--YU8wF8-.js} +1 -1
  27. package/dist/client/assets/{Sun-DTQS8SC0.js → Sun-DF1tmwEc.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-h5bJ4Pj6.js → SwitchHorizontal01-C-d9B1Pc.js} +1 -1
  29. package/dist/client/assets/{Tool01-95LOctqu.js → Tool01-Cbity1uu.js} +1 -1
  30. package/dist/client/assets/{Trash01-CA4eBk7v.js → Trash01-Csom-OmK.js} +1 -1
  31. package/dist/client/assets/{Upload01-C6hlgF_d.js → Upload01-BKLWvYK3.js} +1 -1
  32. package/dist/client/assets/{User01-Bj4QEnuq.js → User01-rB66Yp8m.js} +1 -1
  33. package/dist/client/assets/{Users01-DjqWZa4u.js → Users01-CSjiAX-B.js} +1 -1
  34. package/dist/client/assets/{Users03-BnJ4POBL.js → Users03-CzMI4hYk.js} +1 -1
  35. package/dist/client/assets/{X-C3pn9FBd.js → X-C23kraKx.js} +1 -1
  36. package/dist/client/assets/{XCircle-NMY-qxx5.js → XCircle-DAQ6sXs1.js} +1 -1
  37. package/dist/client/assets/{XClose-JPFhglUg.js → XClose-CD3EJbwD.js} +1 -1
  38. package/dist/client/assets/{Zap-DZT0zVFp.js → Zap-BKA-au81.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CqtF4LbQ.js → ZapSquare-JpoS_XnR.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-D5bsZWrB.js → ZoomOut-B5vLZpoX.js} +1 -1
  41. package/dist/client/assets/{access-gate-WSH9l2fw.js → access-gate-hq7UmdZv.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-B8U8k2da.js → add-section-modal-DPGYUmmW.js} +1 -1
  43. package/dist/client/assets/{agent-icon-CUDD1qQU.js → agent-icon-B_lvSp90.js} +1 -1
  44. package/dist/client/assets/{agents-list-Mmv48hK1.js → agents-list-BuiqFvDD.js} +1 -1
  45. package/dist/client/assets/{ai-providers-DG_vNOxr.js → ai-providers-igMP4uEw.js} +1 -1
  46. package/dist/client/assets/{alert-B3Lwgjtc.js → alert-B6tz0cqs.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-Dr09xmbF.js → alert-dialog-CsikfeuV.js} +1 -1
  48. package/dist/client/assets/{app-editor-iiNJMmFS.js → app-editor-DA7fDqIP.js} +1 -1
  49. package/dist/client/assets/{auth-DEoT60Hp.js → auth-CdNUf-u6.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-mlk2GEuO.js → auth-catchall-DTkC1khj.js} +1 -1
  51. package/dist/client/assets/{auth-entry-D5mX9Y1D.js → auth-entry-ChKD6XAl.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-BmZglzY9.js → auth-split-layout-CUgDVzOC.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-DdfnmUPY.js → authenticate-and-persist-oauth-B-HUI4Rh.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-DPE279l_.js → automation-list-row-DqslLX8-.js} +1 -1
  55. package/dist/client/assets/{automation-runs-BKcxyen4.js → automation-runs-C-ImxLWq.js} +1 -1
  56. package/dist/client/assets/{automations-smiyhS9S.js → automations-BIUDKFSY.js} +1 -1
  57. package/dist/client/assets/{avatar-VM4z7Sph.js → avatar-CjYG3-98.js} +1 -1
  58. package/dist/client/assets/{badge-BZaA6_yP.js → badge-yqmEwWNw.js} +1 -1
  59. package/dist/client/assets/{block-document-BZQOaxe6.js → block-document-Ddmw8MXB.js} +1 -1
  60. package/dist/client/assets/{brand-context-DY3B6pea.js → brand-context-b43I5gSL.js} +1 -1
  61. package/dist/client/assets/{buckets-CIWObJCG.js → buckets-dtFdBXmS.js} +1 -1
  62. package/dist/client/assets/{capability-load-error-CTNXM3k1.js → capability-load-error-CFrsagBh.js} +1 -1
  63. package/dist/client/assets/{card-6Fn3KHk6.js → card-CZci2Ked.js} +1 -1
  64. package/dist/client/assets/{category-editor-E-0PdzQN.js → category-editor-CufMmbEd.js} +1 -1
  65. package/dist/client/assets/{chat-context-CkCIvS-v.js → chat-context-hue9xev7.js} +1 -1
  66. package/dist/client/assets/{checkbox-DwEPCxo5.js → checkbox-CnyL8XHl.js} +1 -1
  67. package/dist/client/assets/{cli-auth-success-CjSSt7y-.js → cli-auth-success-DEWC2vv9.js} +1 -1
  68. package/dist/client/assets/{collection-detail-Dx0PFfMs.js → collection-detail-BmiSLLei.js} +1 -1
  69. package/dist/client/assets/{collection-display-button-DCfbO2En.js → collection-display-button-DA3BZFv2.js} +1 -1
  70. package/dist/client/assets/{collection-search-D0UcbNUO.js → collection-search-BaiviTLW.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-C7i3EtkQ.js → collection-tabs-gJzAs0-U.js} +1 -1
  72. package/dist/client/assets/{command-C2F2XANI.js → command-BtIUrGW9.js} +1 -1
  73. package/dist/client/assets/{commerce-onboarding-DpQtYpFJ.js → commerce-onboarding-B6X46OGL.js} +1 -1
  74. package/dist/client/assets/{connect-desktop-dialog-SkaagoHI.js → connect-desktop-dialog-lLRzH9Wf.js} +1 -1
  75. package/dist/client/assets/{connection-card-DKzKsYD0.js → connection-card-BvZozJYf.js} +1 -1
  76. package/dist/client/assets/{connection-detail-106OasvA.js → connection-detail--FRkiCAU.js} +1 -1
  77. package/dist/client/assets/{connection-form-helpers-xWNyKJEb.js → connection-form-helpers-BXpJ-39p.js} +1 -1
  78. package/dist/client/assets/{connections-CQDCMrAi.js → connections-B8tGIqm6.js} +1 -1
  79. package/dist/client/assets/{context-menu-DBrEbI4f.js → context-menu-DdUP1nvw.js} +1 -1
  80. package/dist/client/assets/{decopilot-xz4hhVZ2.js → decopilot-D6Us63Iz.js} +1 -1
  81. package/dist/client/assets/{decopilot-sse-pool-p2LEr2W4.js → decopilot-sse-pool-Cn1O82-8.js} +1 -1
  82. package/dist/client/assets/{dialog-XnZQaCET.js → dialog-Djo11OZ8.js} +1 -1
  83. package/dist/client/assets/{domain-settings-BmO0lECY.js → domain-settings-Qv_TUecy.js} +1 -1
  84. package/dist/client/assets/{drawer-B5z2AOPt.js → drawer-CGy7XhOb.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-CjfuPw4B.js → dropdown-menu-CuiF-07J.js} +1 -1
  86. package/dist/client/assets/{empty-state-K13YYE8V.js → empty-state-CFMrMwNK.js} +1 -1
  87. package/dist/client/assets/{extract-connection-data-D2_IgRyD.js → extract-connection-data-HZVgcUqH.js} +1 -1
  88. package/dist/client/assets/{file-explorer-CSMcmCDO.js → file-explorer-d1r4yEtA.js} +1 -1
  89. package/dist/client/assets/{file-type-icon-gLx9uWdG.js → file-type-icon-9Eew51_j.js} +1 -1
  90. package/dist/client/assets/{files-CgBtSGQa.js → files-BX2R4Hdg.js} +1 -1
  91. package/dist/client/assets/{form-BCSBsB3M.js → form-Bws9hvDL.js} +1 -1
  92. package/dist/client/assets/{general-Dev0qsuS.js → general-BfDLAR84.js} +1 -1
  93. package/dist/client/assets/{github-repo-picker-B4DQ87lb.js → github-repo-picker-DgsWIyrn.js} +1 -1
  94. package/dist/client/assets/{hooks-Dh6Jo6FF.js → hooks-BFhhtb2P.js} +1 -1
  95. package/dist/client/assets/{import-from-deco-dialog-BVHsGWbT.js → import-from-deco-dialog-B_FF9twl.js} +1 -1
  96. package/dist/client/assets/{index-WC9jROXW.js → index-BQpSQsx-.js} +1 -1
  97. package/dist/client/assets/{index-IsMJIAw6.js → index-Bbr4phoV.js} +1 -1
  98. package/dist/client/assets/{index-CE2XOQVr.js → index-Bfc1Ah6s.js} +1 -1
  99. package/dist/client/assets/{index-CJOXnwUs.js → index-BolwlNK6.js} +1 -1
  100. package/dist/client/assets/{index-Djd6TuLO.js → index-BwVMeD3q.js} +3 -3
  101. package/dist/client/assets/{index-DSYaiu7_.js → index-C5p4XFGO.js} +1 -1
  102. package/dist/client/assets/{index-y2e8K8Eh.js → index-CM09tGUK.js} +1 -1
  103. package/dist/client/assets/{index-Wtqqsvov.js → index-CNHawUWP.js} +1 -1
  104. package/dist/client/assets/{index-C8Wh7-Ly.js → index-Cb0xFHoO.js} +1 -1
  105. package/dist/client/assets/{index-DbYhcgAw.js → index-CxFZHubh.js} +5 -5
  106. package/dist/client/assets/{index-BbxDcYXz.js → index-Cyi-U3f4.js} +1 -1
  107. package/dist/client/assets/{index-BBAsYjSg.js → index-D6bagO5K.js} +1 -1
  108. package/dist/client/assets/{index-CQJFA7-5.js → index-DgHQzdnZ.js} +1 -1
  109. package/dist/client/assets/{index-redirect-LwQf8HQF.js → index-redirect-CEK3pBZ_.js} +1 -1
  110. package/dist/client/assets/{index-BuTMcq2r.js → index-zLeBpb-e.js} +1 -1
  111. package/dist/client/assets/{input-BNOGUlQT.js → input-C8pdmexi.js} +1 -1
  112. package/dist/client/assets/{integration-icon-Da8Ja8xZ.js → integration-icon-BYt__tsS.js} +1 -1
  113. package/dist/client/assets/{label-BzwbJuLA.js → label-6fUzynqC.js} +1 -1
  114. package/dist/client/assets/{login-BFTv0hNB.js → login-RzsGUcw2.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-CiksM5XP.js → mcp-oauth-DOYfP2o1.js} +1 -1
  116. package/dist/client/assets/{members-BhnBffwF.js → members-C8QsS2ME.js} +1 -1
  117. package/dist/client/assets/{monaco-editor-DiBPYiNx.js → monaco-editor-DGlh_VCI.js} +1 -1
  118. package/dist/client/assets/{monitoring-stats-row-CcPgk97X.js → monitoring-stats-row-tBQqJwnX.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-BrGCqspF.js → oauth-callback-C7HO5sjA.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-ai-provider-BfdjFrej.js → oauth-callback-ai-provider-C2ZKRasi.js} +1 -1
  121. package/dist/client/assets/{onboarding-CxGIxXF1.js → onboarding-Pxz11AYs.js} +1 -1
  122. package/dist/client/assets/{org-install-CI7aPCB0.js → org-install-Fk_fo4EG.js} +1 -1
  123. package/dist/client/assets/{org-layout-DOBb0Fbt.js → org-layout-BYDLh4Da.js} +1 -1
  124. package/dist/client/assets/{organization-choice-BFeOoh8u.js → organization-choice-D91Z6ihZ.js} +1 -1
  125. package/dist/client/assets/{page-seo-form-BTOsm1v0.js → page-seo-form-Dw_-ajyz.js} +1 -1
  126. package/dist/client/assets/page-seo-sheet-CFP5LBzL.js +1 -0
  127. package/dist/client/assets/{popover-D2ChxMGV.js → popover-cxXkvARj.js} +1 -1
  128. package/dist/client/assets/{post-editor-BkEG5JCy.js → post-editor-CqZVJyys.js} +1 -1
  129. package/dist/client/assets/{preview-dialog-Dyv-Otum.js → preview-dialog-C1XBzik_.js} +1 -1
  130. package/dist/client/assets/{primitives-DqhOOS3x.js → primitives-C8RGsHih.js} +1 -1
  131. package/dist/client/assets/{profile-BJcOUl1z.js → profile-RQBuJ0-C.js} +1 -1
  132. package/dist/client/assets/project-app-view-BUDCdtfR.js +1 -0
  133. package/dist/client/assets/record-editor-x3p3WRWl.js +1 -0
  134. package/dist/client/assets/registry-DUN-rzpb.js +2 -0
  135. package/dist/client/assets/{registry-layout-BHbBw0Su.js → registry-layout-JxXagtmN.js} +1 -1
  136. package/dist/client/assets/{require-capability-CS7JuOWU.js → require-capability-D8wtdjJA.js} +1 -1
  137. package/dist/client/assets/{required-auth-layout-D8JzfwRM.js → required-auth-layout-Bni9Lv8T.js} +1 -1
  138. package/dist/client/assets/{reset-password-BUI5EECa.js → reset-password-CDD1X47u.js} +1 -1
  139. package/dist/client/assets/{roles-B25l2ywl.js → roles-BmFGLWBQ.js} +1 -1
  140. package/dist/client/assets/{save-status-CcBc_RS2.js → save-status-Ap0tRvUu.js} +1 -1
  141. package/dist/client/assets/{scroll-area-BnoH8jf-.js → scroll-area-BFIPKXPy.js} +1 -1
  142. package/dist/client/assets/{search-input-Djqm0TA1.js → search-input-DqD8geWF.js} +1 -1
  143. package/dist/client/assets/{secrets-DcAzNXon.js → secrets-CUG9brF8.js} +1 -1
  144. package/dist/client/assets/{sections-editor-Bk9qVARB.js → sections-editor-2XAp7iDT.js} +1 -1
  145. package/dist/client/assets/{select-DKj7B0V2.js → select-UKSqIIxL.js} +1 -1
  146. package/dist/client/assets/{select-model-Bimfcw46.js → select-model-Duntt4sG.js} +1 -1
  147. package/dist/client/assets/{seo-editor-J7Oo13p-.js → seo-editor-sJTA698t.js} +1 -1
  148. package/dist/client/assets/{settings-layout-DY61B_5X.js → settings-layout-D4PyBfZX.js} +1 -1
  149. package/dist/client/assets/{settings-section-BHLR2lqY.js → settings-section-uysJimh1.js} +1 -1
  150. package/dist/client/assets/{sheet-a31ex1bd.js → sheet-DaEm5-cm.js} +1 -1
  151. package/dist/client/assets/{shell-controls-BRxhvPab.js → shell-controls-D-FZtlw4.js} +1 -1
  152. package/dist/client/assets/{shell-layout-C1UY2dDO.js → shell-layout-BU2Eo26M.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-D1Wm-1cK.js → shell-route-loading-k31lp-sb.js} +1 -1
  154. package/dist/client/assets/{sidebar-Cj_aFqAP.js → sidebar-CDHrQeMJ.js} +1 -1
  155. package/dist/client/assets/{skeleton-BgGeuCF7.js → skeleton-CjN5A6XL.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-CMtvLYoN.js → sortable.esm-DWhmpOCs.js} +1 -1
  157. package/dist/client/assets/{sso-DqhUN-uI.js → sso-CWuDaOKP.js} +1 -1
  158. package/dist/client/assets/{store-CdnJ7fUT.js → store-DMU35qQr.js} +1 -1
  159. package/dist/client/assets/store-registry-DE3B_JjR.js +2 -0
  160. package/dist/client/assets/{studio-tools-gp9mLcnF.js → studio-tools-Cj1fBaXp.js} +1 -1
  161. package/dist/client/assets/{switch-14YiCb40.js → switch-BlhCItPG.js} +1 -1
  162. package/dist/client/assets/{table-D5xuIpUU.js → table-Bt_fbenL.js} +1 -1
  163. package/dist/client/assets/{tabs-ChA8V1ag.js → tabs-DLLYyT_4.js} +1 -1
  164. package/dist/client/assets/{task-status-C7xHgaQ7.js → task-status-DG_3CCeu.js} +1 -1
  165. package/dist/client/assets/{textarea-0LfkB4H6.js → textarea-LTBnL6Dv.js} +1 -1
  166. package/dist/client/assets/{toggle-group-Ctok94CI.js → toggle-group-DLR6cnlJ.js} +1 -1
  167. package/dist/client/assets/{toolbar-Dgv-0cJG.js → toolbar-BuAJdBWi.js} +1 -1
  168. package/dist/client/assets/{tooltip-DNHEz7H9.js → tooltip-_TcC7QSJ.js} +1 -1
  169. package/dist/client/assets/{types-BpjdnyIn.js → types-C9zbfwjF.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-FEYc1hYo.js → use-ai-providers-Mmhw_1Og.js} +1 -1
  171. package/dist/client/assets/{use-automations-BBBpz3Ll.js → use-automations-Cw5ubZKL.js} +1 -1
  172. package/dist/client/assets/{use-capability-BDeYhQRR.js → use-capability-CP1V4i_3.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-xyRkceIk.js → use-clock-tick-BbDdy2cM.js} +1 -1
  174. package/dist/client/assets/{use-collections-DHsBnI-g.js → use-collections-DDwKLwWC.js} +1 -1
  175. package/dist/client/assets/{use-connection-d25soQOF.js → use-connection-bj-QmeCF.js} +1 -1
  176. package/dist/client/assets/{use-copy-dG8egJns.js → use-copy-TPlwZ6aA.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-t3h12kDQ.js → use-create-virtual-mcp-CoJdf93N.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-CbQ41T1D.js → use-debounced-autosave-D_Bc7lE0.js} +1 -1
  179. package/dist/client/assets/{use-delete-connection-DWsYfcTZ.js → use-delete-connection-0kzxSS_1.js} +1 -1
  180. package/dist/client/assets/{use-file-configs-BZdMLkS5.js → use-file-configs-BumxkY1W.js} +1 -1
  181. package/dist/client/assets/{use-infinite-scroll-B66e2kY3.js → use-infinite-scroll-B0LwAHpI.js} +1 -1
  182. package/dist/client/assets/{use-join-requests-SbIrsr3r.js → use-join-requests-BVChfrSN.js} +1 -1
  183. package/dist/client/assets/{use-mcp-client-DIy-B1wr.js → use-mcp-client-DjnQKDkF.js} +1 -1
  184. package/dist/client/assets/{use-mcp-prompts-9snCiqu-.js → use-mcp-prompts-7fCwwbYc.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-Dm8hC2Ai.js → use-mcp-tools-CbjkHt5p.js} +1 -1
  186. package/dist/client/assets/{use-members-QdT6WLec.js → use-members-DPAHG5Sy.js} +1 -1
  187. package/dist/client/assets/{use-mobile-thzrczKW.js → use-mobile-7oYhfh2a.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-BUtLr1-s.js → use-navigate-to-agent-C1cPyWif.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-DEuaxZpa.js → use-org-auth-client-CywDmsAy.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-CydJi_gG.js → use-org-sso-BRBxUiX-.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-DoQvWm8B.js → use-organization-roles-Bk3e4nqx.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-BIHpPlmZ.js → use-organization-settings-DeAexlNB.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-DaDcQiUE.js → use-registry-connections-B0D0ZFPH.js} +1 -1
  194. package/dist/client/assets/{use-secrets-JQFoSSKX.js → use-secrets-COBbdB1z.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-DuB5Qdsa.js → use-status-sounds-CwxWlyu5.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-n-a_ONE0.js → use-view-mode-DY00qIDT.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-Cw7Cf-co.js → use-virtual-mcp-Bn261I3R.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-CbK39j5Y.js +1 -0
  199. package/dist/client/assets/useSuspenseInfiniteQuery-HNqdvvLG.js +1 -0
  200. package/dist/client/assets/{useSuspenseQueries-DxszLLty.js → useSuspenseQueries-BZYHmjMQ.js} +1 -1
  201. package/dist/client/assets/{variant-calendar-E9B1QGS8.js → variant-calendar-Ds28F-NA.js} +1 -1
  202. package/dist/client/assets/{view-mode-toggle-CmzDEt1O.js → view-mode-toggle-e9BSYjzY.js} +1 -1
  203. package/dist/client/index.html +1 -1
  204. package/dist/server/cli.js +1 -1
  205. package/package.json +1 -1
  206. package/dist/client/assets/page-seo-sheet-BC74IS3P.js +0 -1
  207. package/dist/client/assets/project-app-view-juh8eCQN.js +0 -1
  208. package/dist/client/assets/record-editor-Bl6ua1Xn.js +0 -1
  209. package/dist/client/assets/registry-1R5kgpGp.js +0 -2
  210. package/dist/client/assets/store-registry-k484eohP.js +0 -2
  211. package/dist/client/assets/useInfiniteQuery-sDr4Gfly.js +0 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-CpcwLIEk.js +0 -1
@@ -1 +1 @@
1
- import{c as f,l as d,r as p,j as r}from"./index-Djd6TuLO.js";import{m as w}from"./sidebar-Cj_aFqAP.js";const v=p.createContext(void 0),H=v.Provider;function N(c,e){const l=p.Children.toArray(c);for(const i of l)if(p.isValidElement(i)&&i.type===e)return i;return null}function P(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex flex-col h-full w-full bg-background overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function C(c){const e=f.c(17),{children:l,className:i,hideSidebarTrigger:s}=c;let t;e[0]!==l?(t=N(l,j),e[0]=l,e[1]=t):t=e[1];const n=t;let a;e[2]!==l?(a=N(l,b),e[2]=l,e[3]=a):a=e[3];const o=a;let m;e[4]!==i?(m=d("shrink-0 w-full border-b border-border/50 h-11","flex items-center justify-between gap-3 pr-2 pl-2 md:pl-4",i),e[4]=i,e[5]=m):m=e[5];let x;e[6]!==s?(x=!s&&r.jsx(w,{className:"md:hidden shrink-0"}),e[6]=s,e[7]=x):x=e[7];let u;e[8]!==n||e[9]!==x?(u=r.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[x,n]}),e[8]=n,e[9]=x,e[10]=u):u=e[10];let h;e[11]!==o?(h=r.jsx("div",{className:"flex items-center",children:o}),e[11]=o,e[12]=h):h=e[12];let g;return e[13]!==m||e[14]!==u||e[15]!==h?(g=r.jsxs("div",{className:m,children:[u,h]}),e[13]=m,e[14]=u,e[15]=h,e[16]=g):g=e[16],g}function j(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 min-w-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function b(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 shrink-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function $(c){const e=f.c(6),{children:l,className:i}=c,s=p.useContext(v);let t;e[0]!==i||e[1]!==s?(t=d("flex-1 overflow-auto",s,i),e[0]=i,e[1]=s,e[2]=t):t=e[2];let n;return e[3]!==l||e[4]!==t?(n=r.jsx("div",{className:t,children:l}),e[3]=l,e[4]=t,e[5]=n):n=e[5],n}function y(c){const e=f.c(10),{children:l,actions:i,className:s}=c;let t;e[0]!==s?(t=d("flex flex-wrap items-center justify-between gap-3",s),e[0]=s,e[1]=t):t=e[1];let n;e[2]!==l?(n=r.jsx("div",{className:"text-xl font-medium min-w-0",children:l}),e[2]=l,e[3]=n):n=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"flex items-center gap-2",children:i}),e[4]=i,e[5]=a):a=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==a?(o=r.jsxs("div",{className:t,children:[n,a]}),e[6]=t,e[7]=n,e[8]=a,e[9]=o):o=e[9],o}function R(c){const e=f.c(6),{children:l,className:i,maxWidth:s}=c,t=s===void 0?"max-w-[1200px]":s;let n;e[0]!==i||e[1]!==t?(n=d("mx-auto w-full px-4 pt-8 pb-6 md:px-10 md:pt-12 md:pb-10",t,i),e[0]=i,e[1]=t,e[2]=n):n=e[2];let a;return e[3]!==l||e[4]!==n?(a=r.jsx("div",{className:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5],a}const T=Object.assign(P,{Header:Object.assign(C,{Left:j,Right:b}),Content:$,Title:y,Body:R});export{T as P,H as a};
1
+ import{c as f,l as d,r as p,j as r}from"./index-BwVMeD3q.js";import{m as w}from"./sidebar-CDHrQeMJ.js";const v=p.createContext(void 0),H=v.Provider;function N(c,e){const l=p.Children.toArray(c);for(const i of l)if(p.isValidElement(i)&&i.type===e)return i;return null}function P(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex flex-col h-full w-full bg-background overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function C(c){const e=f.c(17),{children:l,className:i,hideSidebarTrigger:s}=c;let t;e[0]!==l?(t=N(l,j),e[0]=l,e[1]=t):t=e[1];const n=t;let a;e[2]!==l?(a=N(l,b),e[2]=l,e[3]=a):a=e[3];const o=a;let m;e[4]!==i?(m=d("shrink-0 w-full border-b border-border/50 h-11","flex items-center justify-between gap-3 pr-2 pl-2 md:pl-4",i),e[4]=i,e[5]=m):m=e[5];let x;e[6]!==s?(x=!s&&r.jsx(w,{className:"md:hidden shrink-0"}),e[6]=s,e[7]=x):x=e[7];let u;e[8]!==n||e[9]!==x?(u=r.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[x,n]}),e[8]=n,e[9]=x,e[10]=u):u=e[10];let h;e[11]!==o?(h=r.jsx("div",{className:"flex items-center",children:o}),e[11]=o,e[12]=h):h=e[12];let g;return e[13]!==m||e[14]!==u||e[15]!==h?(g=r.jsxs("div",{className:m,children:[u,h]}),e[13]=m,e[14]=u,e[15]=h,e[16]=g):g=e[16],g}function j(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 min-w-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function b(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 shrink-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function $(c){const e=f.c(6),{children:l,className:i}=c,s=p.useContext(v);let t;e[0]!==i||e[1]!==s?(t=d("flex-1 overflow-auto",s,i),e[0]=i,e[1]=s,e[2]=t):t=e[2];let n;return e[3]!==l||e[4]!==t?(n=r.jsx("div",{className:t,children:l}),e[3]=l,e[4]=t,e[5]=n):n=e[5],n}function y(c){const e=f.c(10),{children:l,actions:i,className:s}=c;let t;e[0]!==s?(t=d("flex flex-wrap items-center justify-between gap-3",s),e[0]=s,e[1]=t):t=e[1];let n;e[2]!==l?(n=r.jsx("div",{className:"text-xl font-medium min-w-0",children:l}),e[2]=l,e[3]=n):n=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"flex items-center gap-2",children:i}),e[4]=i,e[5]=a):a=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==a?(o=r.jsxs("div",{className:t,children:[n,a]}),e[6]=t,e[7]=n,e[8]=a,e[9]=o):o=e[9],o}function R(c){const e=f.c(6),{children:l,className:i,maxWidth:s}=c,t=s===void 0?"max-w-[1200px]":s;let n;e[0]!==i||e[1]!==t?(n=d("mx-auto w-full px-4 pt-8 pb-6 md:px-10 md:pt-12 md:pb-10",t,i),e[0]=i,e[1]=t,e[2]=n):n=e[2];let a;return e[3]!==l||e[4]!==n?(a=r.jsx("div",{className:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5],a}const T=Object.assign(P,{Header:Object.assign(C,{Left:j,Right:b}),Content:$,Title:y,Body:R});export{T as P,H as a};
@@ -1 +1 @@
1
- import{r as h}from"./index-Djd6TuLO.js";var w=(o,i,l,s,c,t,m,d)=>{let r=document.documentElement,u=["light","dark"];function n(e){(Array.isArray(o)?o:[o]).forEach(a=>{let p=a==="class",S=p&&t?c.map(f=>t[f]||f):c;p?(r.classList.remove(...S),r.classList.add(t&&t[e]?t[e]:e)):r.setAttribute(a,e)}),y(e)}function y(e){d&&u.includes(e)&&(r.style.colorScheme=e)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)n(s);else try{let e=localStorage.getItem(i)||l,a=m&&e==="system"?g():e;n(a)}catch{}};h.createContext(void 0);h.memo(({forcedTheme:o,storageKey:i,attribute:l,enableSystem:s,enableColorScheme:c,defaultTheme:t,value:m,themes:d,nonce:r,scriptProps:u})=>{let n=JSON.stringify([l,i,t,o,d,m,s,c]).slice(1,-1);return h.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?r:"",dangerouslySetInnerHTML:{__html:`(${w.toString()})(${n})`}})});
1
+ import{r as h}from"./index-BwVMeD3q.js";var w=(o,i,l,s,c,t,m,d)=>{let r=document.documentElement,u=["light","dark"];function n(e){(Array.isArray(o)?o:[o]).forEach(a=>{let p=a==="class",S=p&&t?c.map(f=>t[f]||f):c;p?(r.classList.remove(...S),r.classList.add(t&&t[e]?t[e]:e)):r.setAttribute(a,e)}),y(e)}function y(e){d&&u.includes(e)&&(r.style.colorScheme=e)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)n(s);else try{let e=localStorage.getItem(i)||l,a=m&&e==="system"?g():e;n(a)}catch{}};h.createContext(void 0);h.memo(({forcedTheme:o,storageKey:i,attribute:l,enableSystem:s,enableColorScheme:c,defaultTheme:t,value:m,themes:d,nonce:r,scriptProps:u})=>{let n=JSON.stringify([l,i,t,o,d,m,s,c]).slice(1,-1);return h.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?r:"",dangerouslySetInnerHTML:{__html:`(${w.toString()})(${n})`}})});
@@ -1 +1 @@
1
- import{c as j,D as L,K as H,q as $,a8 as V,ae as z,j as n,r as R,aj as W,a3 as Y,bd as J,V as x,_ as C,bb as Q,W as I,bc as _,Z as X,Y as k,bK as Z,bJ as ee}from"./index-Djd6TuLO.js";import{i as oe}from"./mcp-oauth-CiksM5XP.js";import{B as w}from"./badge-BZaA6_yP.js";import{T as E,a as P,b as S,c as te}from"./tooltip-DNHEz7H9.js";import{g as re}from"./types-BpjdnyIn.js";import{s as ae}from"./Eye-Dz0LfZhX.js";import{s as se}from"./Star01-DhVZBXZp.js";import{aj as ne}from"./agent-icon-CUDD1qQU.js";function ke(d){const e=j.c(11),{connectionId:t}=d,{org:a}=L();let o,r,s;e[0]!==t||e[1]!==a.slug?(o=new URL(`/api/${a.slug}/mcp/${t}`,window.location.origin),s=$,r=H.isMCPAuthenticated(o.href,null),e[0]=t,e[1]=a.slug,e[2]=o,e[3]=r,e[4]=s):(o=e[2],r=e[3],s=e[4]);let i;e[5]!==o||e[6]!==a.id?(i=()=>oe({url:o.href,token:null,orgId:a.id}),e[5]=o,e[6]=a.id,e[7]=i):i=e[7];let c;e[8]!==r||e[9]!==i?(c={queryKey:r,queryFn:i},e[8]=r,e[9]=i,e[10]=c):c=e[10];const{data:l}=s(c);return l}const ie=[{key:"readOnlyHint",label:"Read-only",Icon:ae,variant:"secondary"},{key:"destructiveHint",label:"Destructive",Icon:V,variant:"destructive"},{key:"idempotentHint",label:"Idempotent",Icon:z,variant:"secondary"},{key:"openWorldHint",label:"Open-world",Icon:se,variant:"outline"}];function we(d){const e=j.c(18),{annotations:t,_meta:a}=d;let o;e[0]!==a?(o=re(a),e[0]=a,e[1]=o):o=e[1];const r=!!o;let s,i,c,l,p;if(e[2]!==t||e[3]!==r){p=Symbol.for("react.early_return_sentinel");e:{const f=t?ie.filter(m=>t[m.key]===!0):[];if(f.length===0&&!r){p=null;break e}s=te,i="flex gap-1 flex-nowrap",e[9]!==r?(c=r&&n.jsxs(E,{children:[n.jsx(P,{asChild:!0,children:n.jsx(w,{asChild:!0,variant:"secondary",className:"size-6 p-1",children:n.jsx(ne,{})})}),n.jsx(S,{children:"Interactive"})]}),e[9]=r,e[10]=c):c=e[10],l=f.map(ce)}e[2]=t,e[3]=r,e[4]=s,e[5]=i,e[6]=c,e[7]=l,e[8]=p}else s=e[4],i=e[5],c=e[6],l=e[7],p=e[8];if(p!==Symbol.for("react.early_return_sentinel"))return p;let u;e[11]!==i||e[12]!==c||e[13]!==l?(u=n.jsxs("div",{className:i,children:[c,l]}),e[11]=i,e[12]=c,e[13]=l,e[14]=u):u=e[14];let v;return e[15]!==s||e[16]!==u?(v=n.jsx(s,{children:u}),e[15]=s,e[16]=u,e[17]=v):v=e[17],v}function ce(d){const{label:e,Icon:t,variant:a}=d;return n.jsxs(E,{children:[n.jsx(P,{asChild:!0,children:n.jsx(w,{asChild:!0,variant:a,className:"size-6 p-1",children:n.jsx(t,{})})}),n.jsx(S,{children:e})]},e)}var g="Radio",[de,A]=k(g),[le,ue]=de(g),N=R.forwardRef((d,e)=>{const{__scopeRadio:t,name:a,checked:o=!1,required:r,disabled:s,value:i="on",onCheck:c,form:l,...p}=d,[u,v]=R.useState(null),f=C(e,y=>v(y)),m=R.useRef(!1),h=u?l||!!u.closest("form"):!0;return n.jsxs(le,{scope:t,checked:o,disabled:s,children:[n.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":O(o),"data-disabled":s?"":void 0,disabled:s,value:i,...p,ref:f,onClick:I(d.onClick,y=>{o||c?.(),h&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})}),h&&n.jsx(D,{control:u,bubbles:!m.current,name:a,value:i,checked:o,required:r,disabled:s,form:l,style:{transform:"translateX(-100%)"}})]})});N.displayName=g;var G="RadioIndicator",T=R.forwardRef((d,e)=>{const{__scopeRadio:t,forceMount:a,...o}=d,r=ue(G,t);return n.jsx(X,{present:a||r.checked,children:n.jsx(x.span,{"data-state":O(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:e})})});T.displayName=G;var pe="RadioBubbleInput",D=R.forwardRef(({__scopeRadio:d,control:e,checked:t,bubbles:a=!0,...o},r)=>{const s=R.useRef(null),i=C(s,r),c=Z(t),l=ee(e);return R.useEffect(()=>{const p=s.current;if(!p)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==t&&f){const m=new Event("click",{bubbles:a});f.call(p,t),p.dispatchEvent(m)}},[c,t,a]),n.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:i,style:{...o.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});D.displayName=pe;function O(d){return d?"checked":"unchecked"}var fe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b="RadioGroup",[ve]=k(b,[_,A]),M=_(),U=A(),[me,Re]=ve(b),B=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,name:a,defaultValue:o,value:r,required:s=!1,disabled:i=!1,orientation:c,dir:l,loop:p=!0,onValueChange:u,...v}=d,f=M(t),m=W(l),[h,y]=Y({prop:r,defaultProp:o??null,onChange:u,caller:b});return n.jsx(me,{scope:t,name:a,required:s,disabled:i,value:h,onValueChange:y,children:n.jsx(J,{asChild:!0,...f,orientation:c,dir:m,loop:p,children:n.jsx(x.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":i?"":void 0,dir:m,...v,ref:e})})})});B.displayName=b;var K="RadioGroupItem",q=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,disabled:a,...o}=d,r=Re(K,t),s=r.disabled||a,i=M(t),c=U(t),l=R.useRef(null),p=C(e,l),u=r.value===o.value,v=R.useRef(!1);return R.useEffect(()=>{const f=h=>{fe.includes(h.key)&&(v.current=!0)},m=()=>v.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",m)}},[]),n.jsx(Q,{asChild:!0,...i,focusable:!s,active:u,children:n.jsx(N,{disabled:s,required:r.required,checked:u,...c,...o,name:r.name,ref:p,onCheck:()=>r.onValueChange(o.value),onKeyDown:I(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:I(o.onFocus,()=>{v.current&&l.current?.click()})})})});q.displayName=K;var he="RadioGroupIndicator",F=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,...a}=d,o=U(t);return n.jsx(T,{...o,...a,ref:e})});F.displayName=he;var Ee=B,Pe=q,Se=F;export{Pe as I,Ee as R,we as T,Se as a,ke as u};
1
+ import{c as j,D as L,K as H,q as $,a8 as V,ae as z,j as n,r as R,aj as W,a3 as Y,bd as J,V as x,_ as C,bb as Q,W as I,bc as _,Z as X,Y as k,bK as Z,bJ as ee}from"./index-BwVMeD3q.js";import{i as oe}from"./mcp-oauth-DOYfP2o1.js";import{B as w}from"./badge-yqmEwWNw.js";import{T as E,a as P,b as S,c as te}from"./tooltip-_TcC7QSJ.js";import{g as re}from"./types-C9zbfwjF.js";import{s as ae}from"./Eye-BN8eZd3q.js";import{s as se}from"./Star01-BNPre7m8.js";import{aj as ne}from"./agent-icon-B_lvSp90.js";function ke(d){const e=j.c(11),{connectionId:t}=d,{org:a}=L();let o,r,s;e[0]!==t||e[1]!==a.slug?(o=new URL(`/api/${a.slug}/mcp/${t}`,window.location.origin),s=$,r=H.isMCPAuthenticated(o.href,null),e[0]=t,e[1]=a.slug,e[2]=o,e[3]=r,e[4]=s):(o=e[2],r=e[3],s=e[4]);let i;e[5]!==o||e[6]!==a.id?(i=()=>oe({url:o.href,token:null,orgId:a.id}),e[5]=o,e[6]=a.id,e[7]=i):i=e[7];let c;e[8]!==r||e[9]!==i?(c={queryKey:r,queryFn:i},e[8]=r,e[9]=i,e[10]=c):c=e[10];const{data:l}=s(c);return l}const ie=[{key:"readOnlyHint",label:"Read-only",Icon:ae,variant:"secondary"},{key:"destructiveHint",label:"Destructive",Icon:V,variant:"destructive"},{key:"idempotentHint",label:"Idempotent",Icon:z,variant:"secondary"},{key:"openWorldHint",label:"Open-world",Icon:se,variant:"outline"}];function we(d){const e=j.c(18),{annotations:t,_meta:a}=d;let o;e[0]!==a?(o=re(a),e[0]=a,e[1]=o):o=e[1];const r=!!o;let s,i,c,l,p;if(e[2]!==t||e[3]!==r){p=Symbol.for("react.early_return_sentinel");e:{const f=t?ie.filter(m=>t[m.key]===!0):[];if(f.length===0&&!r){p=null;break e}s=te,i="flex gap-1 flex-nowrap",e[9]!==r?(c=r&&n.jsxs(E,{children:[n.jsx(P,{asChild:!0,children:n.jsx(w,{asChild:!0,variant:"secondary",className:"size-6 p-1",children:n.jsx(ne,{})})}),n.jsx(S,{children:"Interactive"})]}),e[9]=r,e[10]=c):c=e[10],l=f.map(ce)}e[2]=t,e[3]=r,e[4]=s,e[5]=i,e[6]=c,e[7]=l,e[8]=p}else s=e[4],i=e[5],c=e[6],l=e[7],p=e[8];if(p!==Symbol.for("react.early_return_sentinel"))return p;let u;e[11]!==i||e[12]!==c||e[13]!==l?(u=n.jsxs("div",{className:i,children:[c,l]}),e[11]=i,e[12]=c,e[13]=l,e[14]=u):u=e[14];let v;return e[15]!==s||e[16]!==u?(v=n.jsx(s,{children:u}),e[15]=s,e[16]=u,e[17]=v):v=e[17],v}function ce(d){const{label:e,Icon:t,variant:a}=d;return n.jsxs(E,{children:[n.jsx(P,{asChild:!0,children:n.jsx(w,{asChild:!0,variant:a,className:"size-6 p-1",children:n.jsx(t,{})})}),n.jsx(S,{children:e})]},e)}var g="Radio",[de,A]=k(g),[le,ue]=de(g),N=R.forwardRef((d,e)=>{const{__scopeRadio:t,name:a,checked:o=!1,required:r,disabled:s,value:i="on",onCheck:c,form:l,...p}=d,[u,v]=R.useState(null),f=C(e,y=>v(y)),m=R.useRef(!1),h=u?l||!!u.closest("form"):!0;return n.jsxs(le,{scope:t,checked:o,disabled:s,children:[n.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":O(o),"data-disabled":s?"":void 0,disabled:s,value:i,...p,ref:f,onClick:I(d.onClick,y=>{o||c?.(),h&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})}),h&&n.jsx(D,{control:u,bubbles:!m.current,name:a,value:i,checked:o,required:r,disabled:s,form:l,style:{transform:"translateX(-100%)"}})]})});N.displayName=g;var G="RadioIndicator",T=R.forwardRef((d,e)=>{const{__scopeRadio:t,forceMount:a,...o}=d,r=ue(G,t);return n.jsx(X,{present:a||r.checked,children:n.jsx(x.span,{"data-state":O(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:e})})});T.displayName=G;var pe="RadioBubbleInput",D=R.forwardRef(({__scopeRadio:d,control:e,checked:t,bubbles:a=!0,...o},r)=>{const s=R.useRef(null),i=C(s,r),c=Z(t),l=ee(e);return R.useEffect(()=>{const p=s.current;if(!p)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==t&&f){const m=new Event("click",{bubbles:a});f.call(p,t),p.dispatchEvent(m)}},[c,t,a]),n.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:i,style:{...o.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});D.displayName=pe;function O(d){return d?"checked":"unchecked"}var fe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b="RadioGroup",[ve]=k(b,[_,A]),M=_(),U=A(),[me,Re]=ve(b),B=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,name:a,defaultValue:o,value:r,required:s=!1,disabled:i=!1,orientation:c,dir:l,loop:p=!0,onValueChange:u,...v}=d,f=M(t),m=W(l),[h,y]=Y({prop:r,defaultProp:o??null,onChange:u,caller:b});return n.jsx(me,{scope:t,name:a,required:s,disabled:i,value:h,onValueChange:y,children:n.jsx(J,{asChild:!0,...f,orientation:c,dir:m,loop:p,children:n.jsx(x.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":i?"":void 0,dir:m,...v,ref:e})})})});B.displayName=b;var K="RadioGroupItem",q=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,disabled:a,...o}=d,r=Re(K,t),s=r.disabled||a,i=M(t),c=U(t),l=R.useRef(null),p=C(e,l),u=r.value===o.value,v=R.useRef(!1);return R.useEffect(()=>{const f=h=>{fe.includes(h.key)&&(v.current=!0)},m=()=>v.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",m)}},[]),n.jsx(Q,{asChild:!0,...i,focusable:!s,active:u,children:n.jsx(N,{disabled:s,required:r.required,checked:u,...c,...o,name:r.name,ref:p,onCheck:()=>r.onValueChange(o.value),onKeyDown:I(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:I(o.onFocus,()=>{v.current&&l.current?.click()})})})});q.displayName=K;var he="RadioGroupIndicator",F=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,...a}=d,o=U(t);return n.jsx(T,{...o,...a,ref:e})});F.displayName=he;var Ee=B,Pe=q,Se=F;export{Pe as I,Ee as R,we as T,Se as a,ke as u};
@@ -1 +1 @@
1
- import{c as g,e as p,j as s,i as u,N as a}from"./index-Djd6TuLO.js";import{a as x}from"./use-capability-BDeYhQRR.js";import{C as j}from"./capability-load-error-CTNXM3k1.js";function v(){const t=g.c(21);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org"},t[0]=o):o=t[0];const{org:r}=p(o),{capabilities:l,isPrivileged:m,loading:c,error:f}=x();if(c){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:s.jsx(u,{size:20,className:"animate-spin text-muted-foreground"})}),t[1]=e):e=t[1],e}if(f){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(j,{}),t[2]=e):e=t[2],e}const i=e=>m||l[e]===!0;if(i("org:manage")){let e;return t[3]!==r?(e=s.jsx(a,{to:"/$org/settings/general",params:{org:r},replace:!0}),t[3]=r,t[4]=e):e=t[4],e}if(i("ai-providers:manage")){let e;return t[5]!==r?(e=s.jsx(a,{to:"/$org/settings/ai-providers",params:{org:r},replace:!0}),t[5]=r,t[6]=e):e=t[6],e}if(i("secrets:manage")){let e;return t[7]!==r?(e=s.jsx(a,{to:"/$org/settings/secrets",params:{org:r},replace:!0}),t[7]=r,t[8]=e):e=t[8],e}if(i("file-configs:manage")){let e;return t[9]!==r?(e=s.jsx(a,{to:"/$org/settings/buckets",params:{org:r},replace:!0}),t[9]=r,t[10]=e):e=t[10],e}if(i("automations:manage")){let e;return t[11]!==r?(e=s.jsx(a,{to:"/$org/settings/automations",params:{org:r},replace:!0}),t[11]=r,t[12]=e):e=t[12],e}if(i("registry:manage")){let e;return t[13]!==r?(e=s.jsx(a,{to:"/$org/settings/store",params:{org:r},replace:!0}),t[13]=r,t[14]=e):e=t[14],e}if(i("monitoring:view")){let e;return t[15]!==r?(e=s.jsx(a,{to:"/$org/settings/monitor",params:{org:r},replace:!0}),t[15]=r,t[16]=e):e=t[16],e}if(i("members:manage")){let e;return t[17]!==r?(e=s.jsx(a,{to:"/$org/settings/members",params:{org:r},replace:!0}),t[17]=r,t[18]=e):e=t[18],e}let n;return t[19]!==r?(n=s.jsx(a,{to:"/$org/settings/profile",params:{org:r},replace:!0}),t[19]=r,t[20]=n):n=t[20],n}export{v as default};
1
+ import{c as g,e as p,j as s,i as u,N as a}from"./index-BwVMeD3q.js";import{a as x}from"./use-capability-CP1V4i_3.js";import{C as j}from"./capability-load-error-CFrsagBh.js";function v(){const t=g.c(21);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org"},t[0]=o):o=t[0];const{org:r}=p(o),{capabilities:l,isPrivileged:m,loading:c,error:f}=x();if(c){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:s.jsx(u,{size:20,className:"animate-spin text-muted-foreground"})}),t[1]=e):e=t[1],e}if(f){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(j,{}),t[2]=e):e=t[2],e}const i=e=>m||l[e]===!0;if(i("org:manage")){let e;return t[3]!==r?(e=s.jsx(a,{to:"/$org/settings/general",params:{org:r},replace:!0}),t[3]=r,t[4]=e):e=t[4],e}if(i("ai-providers:manage")){let e;return t[5]!==r?(e=s.jsx(a,{to:"/$org/settings/ai-providers",params:{org:r},replace:!0}),t[5]=r,t[6]=e):e=t[6],e}if(i("secrets:manage")){let e;return t[7]!==r?(e=s.jsx(a,{to:"/$org/settings/secrets",params:{org:r},replace:!0}),t[7]=r,t[8]=e):e=t[8],e}if(i("file-configs:manage")){let e;return t[9]!==r?(e=s.jsx(a,{to:"/$org/settings/buckets",params:{org:r},replace:!0}),t[9]=r,t[10]=e):e=t[10],e}if(i("automations:manage")){let e;return t[11]!==r?(e=s.jsx(a,{to:"/$org/settings/automations",params:{org:r},replace:!0}),t[11]=r,t[12]=e):e=t[12],e}if(i("registry:manage")){let e;return t[13]!==r?(e=s.jsx(a,{to:"/$org/settings/store",params:{org:r},replace:!0}),t[13]=r,t[14]=e):e=t[14],e}if(i("monitoring:view")){let e;return t[15]!==r?(e=s.jsx(a,{to:"/$org/settings/monitor",params:{org:r},replace:!0}),t[15]=r,t[16]=e):e=t[16],e}if(i("members:manage")){let e;return t[17]!==r?(e=s.jsx(a,{to:"/$org/settings/members",params:{org:r},replace:!0}),t[17]=r,t[18]=e):e=t[18],e}let n;return t[19]!==r?(n=s.jsx(a,{to:"/$org/settings/profile",params:{org:r},replace:!0}),t[19]=r,t[20]=n):n=t[20],n}export{v as default};
@@ -1 +1 @@
1
- import{c as k,j as n,r as $,D as J,m as xe,l as Q,i as le,an as Z,t as U,K as te,k as se,B as Y,d as st,a8 as nt,E as it,a as ot}from"./index-Djd6TuLO.js";import{u as ge}from"./use-mobile-thzrczKW.js";import{u as rt}from"./useSuspenseQueries-DxszLLty.js";import{i as lt,u as ae,m as at,a as ct,S as dt}from"./use-mcp-client-DIy-B1wr.js";import{u as mt,b as ut,v as ft,a as pt}from"./use-virtual-mcp-Cw7Cf-co.js";import{i as ht}from"./ChevronUp-D4yp8Sde.js";import{i as xt,A as ce,Y as gt,a8 as yt,D as bt,k as jt}from"./agent-icon-CUDD1qQU.js";import{s as ye}from"./Plus-C2AcrVDQ.js";import{i as $e}from"./X-C3pn9FBd.js";import{C as oe}from"./index-IsMJIAw6.js";import{b as vt}from"./chat-context-CkCIvS-v.js";import{N as Nt}from"./decopilot-xz4hhVZ2.js";import{g as wt,b as Ae,c as re,K as Pe,P as Ee,D as Me,d as St,S as _t,v as Ct,e as It,C as Tt,s as kt,l as $t,k as At,o as Pt,u as Et,j as Mt,h as zt}from"./sortable.esm-CMtvLYoN.js";import{u as ze,a as Oe,o as Ot}from"./use-organization-settings-BIHpPlmZ.js";import{c as be,b as Lt,h as Dt}from"./shell-layout-C1UY2dDO.js";import{I as Le}from"./input-BNOGUlQT.js";import{S as Ht,t as je,P as Rt,j as Ft,s as Ut,g as Bt}from"./scroll-area-BnoH8jf-.js";import{S as Vt,a as Kt,b as Wt,c as qt,d as Gt}from"./sheet-a31ex1bd.js";import{S as H}from"./skeleton-BgGeuCF7.js";import{t as De}from"./ChevronDown-c1oSYfs-.js";import{d as He}from"./ZoomOut-D5bsZWrB.js";import{g as Re,M as Qt}from"./types-BpjdnyIn.js";import{I as Fe}from"./integration-icon-Da8Ja8xZ.js";import{b as Jt,c as Xt,S as Zt,a as we,d as Yt}from"./select-DKj7B0V2.js";import{T as es}from"./textarea-0LfkB4H6.js";import{u as Ue}from"./studio-tools-gp9mLcnF.js";import{a as ts}from"./use-mcp-tools-Dm8hC2Ai.js";import{i as ss}from"./XCircle-NMY-qxx5.js";import{f as ns}from"./tab-id-BptcWVWa.js";import{g as is}from"./use-mcp-prompts-9snCiqu-.js";import{u as os,w as rs}from"./hooks-Dh6Jo6FF.js";import{a as ls,g as as,c as cs,b as ds,D as ms}from"./dropdown-menu-CjfuPw4B.js";import{s as us}from"./Trash01-CA4eBk7v.js";import{a as fs,u as ps}from"./use-ai-providers-FEYc1hYo.js";import{u as hs}from"./connect-desktop-dialog-SkaagoHI.js";import{a as xs}from"./toolbar-Dgv-0cJG.js";import"./auth-DEoT60Hp.js";import"./use-collections-DHsBnI-g.js";import"./AlertCircle-BI7qL-zf.js";import"./Tool01-95LOctqu.js";import"./SwitchHorizontal01-h5bJ4Pj6.js";import"./Settings02-DIy8pOAO.js";import"./ArrowUpRight-Z3BBkuVk.js";import"./ZapSquare-CqtF4LbQ.js";import"./Users03-BnJ4POBL.js";import"./CheckCircle-Ct0IkEsg.js";import"./ChevronLeft-B5WBGMCf.js";import"./ChevronRight-ro8pTEbC.js";import"./DotsVertical-Bva5wMia.js";import"./Stars02-Ulg_Ysyf.js";import"./Eye-Dz0LfZhX.js";import"./Globe01-Cat8RRQP.js";import"./FilterLines-CNNSd5My.js";import"./Star01-DhVZBXZp.js";import"./Globe04-CNkdEC4q.js";import"./HardDrive-Bp0ax-t_.js";import"./Key01-CK-dtvzj.js";import"./LayoutLeft-DRgE3-pt.js";import"./LinkExternal01-BMRTG9GY.js";import"./Monitor01-ClILKoXR.js";import"./Sun-DTQS8SC0.js";import"./Palette-DzZpBk45.js";import"./Play-B0tuLbrU.js";import"./SearchMd-CiOkSnnl.js";import"./Shield01-txQYlyv3.js";import"./Stars01-BpFWqd_D.js";import"./Upload01-C6hlgF_d.js";import"./User01-Bj4QEnuq.js";import"./Users01-DjqWZa4u.js";import"./XClose-JPFhglUg.js";import"./Zap-DZT0zVFp.js";import"./tooltip-DNHEz7H9.js";import"./dialog-XnZQaCET.js";import"./drawer-B5z2AOPt.js";import"./collection-search-D0UcbNUO.js";import"./form-BCSBsB3M.js";import"./label-BzwbJuLA.js";import"./tabs-ChA8V1ag.js";import"./toggle-group-Ctok94CI.js";import"./popover-D2ChxMGV.js";import"./command-C2F2XANI.js";import"./index-Wtqqsvov.js";import"./useInfiniteQuery-sDr4Gfly.js";import"./use-infinite-scroll-B66e2kY3.js";import"./question-004-sINsf4GQ.js";import"./checkbox-DwEPCxo5.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-VM4z7Sph.js";import"./settings-section-BHLR2lqY.js";import"./card-6Fn3KHk6.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DKzKsYD0.js";import"./use-registry-connections-DaDcQiUE.js";import"./use-connection-d25soQOF.js";import"./extract-connection-data-D2_IgRyD.js";import"./collection-tabs-C7i3EtkQ.js";import"./badge-BZaA6_yP.js";import"./connection-form-helpers-xWNyKJEb.js";import"./authenticate-and-persist-oauth-DdfnmUPY.js";import"./mcp-oauth-CiksM5XP.js";import"./useSuspenseInfiniteQuery-CpcwLIEk.js";import"./required-auth-layout-D8JzfwRM.js";import"./use-org-sso-CydJi_gG.js";import"./use-clock-tick-xyRkceIk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-dG8egJns.js";import"./file-type-icon-gLx9uWdG.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-BUtLr1-s.js";import"./decopilot-sse-pool-p2LEr2W4.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function Be(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(gs,{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 gs(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(es,{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=x=>r(x==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Jt,{className:"h-7 text-xs",children:n.jsx(Xt,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(Zt,{children:[n.jsx(we,{value:"true",children:"true"}),n.jsx(we,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(Yt,{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(Le,{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 ys(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=$.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Vt,{children:"Manage home"}),d=n.jsx(Kt,{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(xt,{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=x=>r(x.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(Wt,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(Le,{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(Gs,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(Ht,{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($.Suspense,{fallback:u,children:n.jsx(js,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(qt,{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(Gt,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function bs(t){const e=k.c(32),{org:s}=J(),o=ze();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=Oe(),d=ut(),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 x=p>=ne;let y;e[10]!==x||e[11]!==f||e[12]!==a?(y=_=>f(_)||x?Promise.resolve():a.apply(I=>I.includes(_)?null:[...I,_]),e[10]=x,e[11]=f,e[12]=a,e[13]=y):y=e[13];const b=y;let v;e[14]!==a?(v=_=>a.apply(I=>I.filter(T=>T!==_)),e[14]=a,e[15]=v):v=e[15];const N=v;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const g=j;let w;e[18]!==d||e[19]!==x||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,I)=>{await d.update.mutateAsync({id:_.id,data:{metadata:I}}),!f(_.id)&&!x&&await a.apply(T=>T.includes(_.id)?null:[...T,_.id]),await c()},e[18]=d,e[19]=x,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let C;return e[24]!==b||e[25]!==x||e[26]!==r||e[27]!==f||e[28]!==N||e[29]!==g||e[30]!==S?(C={homeIds:r,isOnHome:f,atLimit:x,addAgent:b,removeAgent:N,reorder:g,saveAgentMetadata:S},e[24]=b,e[25]=x,e[26]=r,e[27]=f,e[28]=N,e[29]=g,e[30]=S,e[31]=C):C=e[31],C}function js(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=mt(o);let r;e[1]!==i?(r=new Set(i.map(_s)),e[1]=i,e[2]=r):r=e[2];const a=bs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const x=new Map(i.map(Ss));d=s.trim().toLowerCase();const y=N=>!d||N.title?.toLowerCase().includes(d);l=a.homeIds.map(N=>x.get(N)).filter(ws).filter(y);const b=wt(i);let v;e[9]!==a?(v=N=>!a.isOnHome(N.id),e[9]=a,e[10]=v):v=e[10],m=i.filter(Ns).filter(N=>!b.has(N.id)).filter(v).filter(y).sort(vs),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(Cs,{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(ks,{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 vs(t,e){return(t.title??"").localeCompare(e.title??"")}function Ns(t){return t.id&&!lt(t.id)}function ws(t){return!!t}function Ss(t){return[t.id,t]}function _s(t){return t.id}function Ve(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 Cs(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:kt},e[1]=r):r=e[1];const a=Ae(re(Ee,i),re(Pe,r));let d;e[2]!==s?(d=p=>{const{active:h,over:x}=p;if(!x||h.id===x.id)return;const y=s.homeIds,b=y.indexOf(h.id),v=y.indexOf(x.id);b===-1||v===-1||s.reorder($t([...y],b,v)).catch(Ts)},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(Ve,{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(Me,{sensors:a,collisionDetection:St,onDragEnd:l,children:n.jsx(_t,{items:o.map(Is),strategy:Ct,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(As,{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 Is(t){return t.id}function Ts(){return U.error("Couldn't reorder home — please try again.")}function ks(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,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(Ve,{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(Ms,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a($s),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 $s(t){return t+20}function Ke(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 As(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=$.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}=It(a),p=Ke(s)||"Quick access";let h;e[2]!==c?(h=Tt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const x=f?.5:void 0,y=f?100:void 0;let b;e[4]!==h||e[5]!==x||e[6]!==y||e[7]!==u?(b={transform:h,transition:u,opacity:x,zIndex:y},e[4]=h,e[5]=x,e[6]=y,e[7]=u,e[8]=b):b=e[8];const v=b,N=f&&"shadow-lg";let j;e[9]!==N?(j=Q("rounded-lg border border-border bg-card",N),e[9]=N,e[10]=j):j=e[10];const g=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(He,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==g?(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":g,children:w}),e[12]=d,e[13]=l,e[14]=g,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r(Es),e[16]=C):C=e[16];const _=s.title??s.id;let I;e[17]!==s.icon||e[18]!==_?(I=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=I):I=e[19];const T=s.title??s.id;let P;e[20]!==T?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:T}),e[20]=T,e[21]=P):P=e[21];let M;e[22]!==p?(M=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=M):M=e[23];let z;e[24]!==P||e[25]!==M?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,M]}),e[24]=P,e[25]=M,e[26]=z):z=e[26];const B=i&&"rotate-180";let O;e[27]!==B?(O=Q("shrink-0 text-muted-foreground transition-transform",B),e[27]=B,e[28]=O):O=e[28];let L;e[29]!==O?(L=n.jsx(De,{size:16,className:O}),e[29]=O,e[30]=L):L=e[30];let K;e[31]!==i||e[32]!==I||e[33]!==z||e[34]!==L?(K=n.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[I,z,L]}),e[31]=i,e[32]=I,e[33]=z,e[34]=L,e[35]=K):K=e[35];let A;e[36]!==s.id||e[37]!==o?(A=()=>o.removeAgent(s.id).catch(Ps),e[36]=s.id,e[37]=o,e[38]=A):A=e[38];const V=`Remove ${s.title??s.id} from home`;let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx($e,{size:14}),e[39]=D):D=e[39];let E;e[40]!==A||e[41]!==V?(E=n.jsx("button",{type:"button",onClick:A,"aria-label":V,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:D}),e[40]=A,e[41]=V,e[42]=E):E=e[42];let R;e[43]!==S||e[44]!==K||e[45]!==E?(R=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,K,E]}),e[43]=S,e[44]=K,e[45]=E,e[46]=R):R=e[46];let F;e[47]!==s||e[48]!==i||e[49]!==o?(F=i&&n.jsx(We,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=F):F=e[50];let q;return e[51]!==m||e[52]!==v||e[53]!==R||e[54]!==F||e[55]!==j?(q=n.jsxs("div",{ref:m,style:v,className:j,children:[R,F]}),e[51]=m,e[52]=v,e[53]=R,e[54]=F,e[55]=j,e[56]=q):q=e[56],q}function Ps(){return U.error("Couldn't remove from home — please try again.")}function Es(t){return!t}function Ms({agent:t,home:e}){const[s,o]=$.useState(!1),[i,r]=$.useState(!1),a=Ke(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{U.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(De,{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(ye,{size:14})})]}),s&&n.jsx(We,{agent:t,home:e})]})}function We(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(zs).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(Ls,{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(Os,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx($.Suspense,{fallback:u,children:n.jsx(Us,{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 zs(t){return t.connection_id}function Os(){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(H,{className:"h-8 w-full"}),n.jsx(H,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Ls({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Ue(),{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 x=Re(h._meta);return x?[{name:h.name,description:h.description,resourceUri:x,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(H,{className:"h-7 w-full"}),n.jsx(H,{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(Rs,{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(Fs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function qe(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 Ds(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 Hs(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 Rs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=$.useState(!1),[d,l]=$.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=$.useState(()=>Ds(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const x=Z(t.metadata?.ui),y=i.tileId?x.filter(v=>v.tileId!==i.tileId):x.filter(v=>v!==i),b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,b),l(!1)}catch(x){console.error("[home-tiles] failed to remove tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let x;if(m&&o.inputSchema?.properties){const N=qe(c,o.inputSchema.properties);if(!N){U.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(N).length>0&&(x=N)}const b=Z(t.metadata?.ui).map(N=>(i.tileId?N.tileId===i.tileId:N===i)?{...N,toolInput:x}:N),v={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,v),l(!1)}catch(x){console.error("[home-tiles] failed to save tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Hs(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(Fe,{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:je(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(x=>!x),"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(gt,{size:14})}),n.jsx(ve,{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(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(x,y)=>u(b=>({...b,[x]:y}))}),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 Fs({agent:t,home:e,connection:s,tool:o}){const[i,r]=$.useState(!1),[a,d]=$.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=$.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){U.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 b=qe(m,o.inputSchema.properties);if(!b){U.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(b).length>0&&(p=b)}const x=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:x}};await e.saveAgentMetadata(t,y),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),U.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(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:je(o.name)}),n.jsx(ve,{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(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(x=>({...x,[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 ve(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(yt,{size:14}):n.jsx(ye,{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 Us(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:g}=await d.listPrompts();return g.map(Ws)},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=be(r.slug);let x,y;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let g;e[17]!==s.id?(g=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=g):g=e[18],x=h.prompts.filter(g).map(Ks);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],y=[...w];for(const S of x)y.some(C=>C.name===S.name)||y.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=x,e[16]=y}else x=e[15],y=e[16];if(f&&x.length===0){let g;return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=g):g=e[21],g}if(p&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(y.length===0)return null;let b;e[22]!==i||e[23]!==y?(b=i??y.map(Vs),e[22]=i,e[23]=y,e[24]=b):b=e[24];let v;e[25]!==b?(v=new Set(b),e[25]=b,e[26]=v):v=e[26];const N=v;let j;return e[27]!==s||e[28]!==o||e[29]!==y||e[30]!==N?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:y.map(g=>n.jsx(qs,{agent:s,home:o,prompt:g,allPromptNames:y.map(Bs),isPinned:N.has(g.name)},g.name))}),e[27]=s,e[28]=o,e[29]=y,e[30]=N,e[31]=j):j=e[31],j}function Bs(t){return t.name}function Vs(t){return t.name}function Ks(t){return{name:t.promptName,title:t.title,description:t.description}}function Ws(t){return{name:t.name,title:t.title,description:t.description}}function qs({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=$.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){U.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),U.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??je(s.name)}),n.jsx(ve,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function Gs(){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},Qs)}),t[0]=e):e=t[0],e}function Qs(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(H,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Ge=`home-board.layout.v${ee}`;function Qe(t){return`home-board.layout.v${ee}.${t}`}const Je={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Je:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function Js(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function Xs(t){try{const e=localStorage.getItem(Qe(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Se(t,e){try{localStorage.setItem(Qe(t),JSON.stringify(e))}catch{}}async function _e(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function Zs(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=Xs(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const b=await fetch(`/api/${t}/kv/${Ge}`);if(b.status===404)return a&&Js(a)?(await _e(t,a),a):Je;if(!b.ok)throw new Error("Failed to load board layout");const v=await b.json(),N=fe(v.value);return Se(t,N),N},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:b=>_e(t,b)},e[11]=t,e[12]=u):u=e[12];const f=st(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=b=>{Se(t,b),s.setQueryData(i,b),f.mutate(b)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let x;e[18]!==m?(x=fe(m),e[18]=m,e[19]=x):x=e[19];let y;return e[20]!==c||e[21]!==h||e[22]!==x?(y={layout:x,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=x,e[23]=y):y=e[23],y}const Xe=$.createContext(null);function Ys(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=Zs(o.slug),[r,a]=$.useState(!1),[d,l]=$.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,x=r&&d!==null,y=x?d:i.layout;let b;e[6]!==d||e[7]!==x||e[8]!==i.layout?(b=x?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=x,e[8]=i.layout,e[9]=b):b=e[9];const v=b;let N;e[10]!==r||e[11]!==i?(N=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=N):N=e[12];const j=N;let g;e[13]!==j||e[14]!==c||e[15]!==v||e[16]!==r||e[17]!==y||e[18]!==h||e[19]!==i.isLoading?(g={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:v,layout:y,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=v,e[16]=r,e[17]=y,e[18]=h,e[19]=i.isLoading,e[20]=g):g=e[20];let w;return e[21]!==s||e[22]!==g?(w=n.jsx(Xe.Provider,{value:g,children:s}),e[21]=s,e[22]=g,e[23]=w):w=e[23],w}function Ze(){const t=$.useContext(Xe);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function en({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=os(),{setTaskId:r}=Lt(),[a,d]=$.useState(null),[l,m]=$.useState(!1),c=$.useRef(!1),u=async(y,b)=>{if(!o){U.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const v=await is(o,y.name,b),N={type:"doc",content:[{type:"paragraph",content:[Ft({id:y.name,name:Ut(y.name,Bt(y._meta)),metadata:v.messages,char:"/",kind:"prompt",args:b}),{type:"text",text:" "}]}]},j=crypto.randomUUID();rs(sessionStorage,s,j,{tiptapDoc:N}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(v){console.error("[start-thread-from-prompt] failed",v),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async y=>{if(!c.current){if(y.arguments&&y.arguments.length>0){d(y);return}await u(y)}},p=async y=>{if(!a)return;const b=a;d(null),await u(b,y)};return{start:f,startBlank:async y=>{if(!c.current){c.current=!0,m(!0);try{const b=crypto.randomUUID();await i({id:b,virtual_mcp_id:t}),r(b,t,y?.main?{main:y.main}:void 0)}catch(b){console.error("[start-thread-from-prompt] startBlank failed",b),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Rt,{prompt:a,setPrompt:y=>d(y),onSubmit:p}),dialogPrompt:a,starting:l}}const W=4,G=100,Ce=12,tn=5,sn={w:2,h:2};class pe extends $.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(nt,{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 nn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=$.useRef(null),[c,u]=$.useState(null),[f,p]=$.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const x=Ae(re(Ee,h),re(Pe)),y=s.reduce(on,0),b=o?Math.max(y+2,4):Math.max(y,1);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{const A=m.current?.getBoundingClientRect();return A?{cellWidth:A.width/W,cellHeight:G}:null},e[1]=v):v=e[1];const N=v;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=A=>{u(String(A.active.id)),p(N())},e[2]=j):j=e[2];const g=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=A=>{const V=String(A.active.id),D=f??N();if(u(null),p(null),!D||D.cellWidth<=0)return;const E=s.find(q=>q.id===V);if(!E)return;const R=Math.round(A.delta.x/D.cellWidth),F=Math.round(A.delta.y/D.cellHeight);R===0&&F===0||r(V,{x:E.x+R,y:E.y+F})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let A;if(e[7]!==i||e[8]!==s){let D;e[10]!==i?(D=E=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(E)})},E.id),e[10]=i,e[11]=D):D=e[11],A=s.map(D),e[7]=i,e[8]=s,e[9]=A}else A=e[9];let V;return e[12]!==A?(V=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=V):V=e[13],V}let C,_,I,T,P,M,z,B,O;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==x||e[22]!==s||e[23]!==b){const A=c?s.find(X=>X.id===c):null;_=Me,B=x,O=g,I=S;const V=b*G,D=o?G*4:G;let E;e[33]!==V||e[34]!==D?(E={height:V,minHeight:D},e[33]=V,e[34]=D,e[35]=E):E=e[35];let R;e[36]!==o||e[37]!==s||e[38]!==b?(R=o&&n.jsx(rn,{rows:b,tiles:s}),e[36]=o,e[37]=s,e[38]=b,e[39]=R):R=e[39];let F;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(an,{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],F=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=F}else F=e[46];e[53]!==E||e[54]!==R||e[55]!==F?(T=n.jsxs("div",{ref:m,className:"relative w-full",style:E,children:[R,F]}),e[53]=E,e[54]=R,e[55]=F,e[56]=T):T=e[56],C=At,P=null;const q=A&&f?A.w*f.cellWidth-Ce:void 0,de=A&&f?A.h*f.cellHeight-Ce:void 0;e[57]!==q||e[58]!==de?(M={width:q,height:de},e[57]=q,e[58]=de,e[59]=M):M=e[59],z=A&&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(A)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=x,e[22]=s,e[23]=b,e[24]=C,e[25]=_,e[26]=I,e[27]=T,e[28]=P,e[29]=M,e[30]=z,e[31]=B,e[32]=O}else C=e[24],_=e[25],I=e[26],T=e[27],P=e[28],M=e[29],z=e[30],B=e[31],O=e[32];let L;e[60]!==C||e[61]!==P||e[62]!==M||e[63]!==z?(L=n.jsx(C,{dropAnimation:P,style:M,children:z}),e[60]=C,e[61]=P,e[62]=M,e[63]=z,e[64]=L):L=e[64];let K;return e[65]!==_||e[66]!==I||e[67]!==T||e[68]!==L||e[69]!==B||e[70]!==O?(K=n.jsxs(_,{sensors:B,onDragStart:O,onDragEnd:I,children:[T,L]}),e[65]=_,e[66]=I,e[67]=T,e[68]=L,e[69]=B,e[70]=O,e[71]=K):K=e[71],K}function on(t,e){return Math.max(t,e.y+e.h)}function rn(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<W;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(ln)}),e[5]=a,e[6]=d):d=e[6],d}function ln(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/W*100}%`,top:t.y*G,width:`${1/W*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 an(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}=Pt(m),h=`${s.x/W*100}%`,x=`${s.w/W*100}%`,y=s.y*G,b=s.h*G,v=p||i,N=!v&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=v&&"opacity-30";let g;e[3]!==N||e[4]!==j?(g=Q("absolute p-1 will-change-[left,top,width,height,opacity]",N,j),e[3]=N,e[4]=j,e[5]=g):g=e[5];let w;e[6]!==b||e[7]!==h||e[8]!==y||e[9]!==x?(w={left:h,top:y,width:x,height:b},e[6]=b,e[7]=h,e[8]=y,e[9]=x,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=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(He,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(cn,{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 I;e[20]!==d?(I=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=I):I=e[21];let T;e[22]!==I||e[23]!==C||e[24]!==_?(T=n.jsxs("div",{className:C,children:[_,I]}),e[22]=I,e[23]=C,e[24]=_,e[25]=T):T=e[25];let P;return e[26]!==c||e[27]!==T||e[28]!==g||e[29]!==w?(P=n.jsx("div",{ref:c,className:g,style:w,children:T}),e[26]=c,e[27]=T,e[28]=g,e[29]=w,e[30]=P):P=e[30],P}function cn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=$.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ls,{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(bt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=y=>{o(s.id,y),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(dn,{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(as,{}),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(us,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(cs,{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(ds,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let x;return e[17]!==r||e[18]!==h?(x=n.jsxs(ms,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=x):x=e[19],x}function dn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=$.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(${W}, 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:tn},(y,b)=>Array.from({length:W},(v,N)=>{const j=N+1,g=b+1,w=j<i||g<r,S=j<=m.w&&g<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${g}`,onPointerEnter:()=>d({w:j,h:g}),onClick:()=>o({w:j,h:g}),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${g}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let x;return e[16]!==u||e[17]!==h?(x=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=x):x=e[18],x}function mn(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<=W-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)mn(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(W,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(W-s,t)),i=Math.max(0,e);return{x:o,y:i}}function un(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 fn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ze();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 v;e[7]!==a?(v=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=v):v=e[8];const N=t.filter(v);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of N){const g=s.tiles[j.id];if(!g)continue;const w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),{x:_,y:I}=ue(g.x,g.y,S);l.push({id:j.id,x:_,y:I,w:S,h:C,minW:w?.w,minH:w?.h})}for(const j of N){if(l.some(I=>I.id===j.id))continue;const g=j.defaultSize??sn,w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),_=he(l,S,C);l.push({id:j.id,x:_.x,y:_.y,w:S,h:C,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(pn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(v,N)=>{const j={};for(const g of v)j[g.id]={x:g.x,y:g.y,w:g.w,h:g.h};i({version:ee,tiles:j,hidden:N.filter(g=>c.has(g))})},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=(v,N)=>{const j=l.find(S=>S.id===v);if(!j)return;const g=ue(N.x,N.y,j.w);if(g.x===j.x&&g.y===j.y)return;const w=un(l,v,g);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let x;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(x=(v,N)=>{const j=l.find(T=>T.id===v);if(!j)return;const g=d.get(v),{w,h:S}=me(N.w,N.h,g);if(w===j.w&&S===j.h)return;const C={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(T=>T.id!==v),I=[C];for(const T of _){const P=he(I,T.w,T.h);I.push({...T,x:P.x,y:P.y})}f(I,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=x):x=e[24];let y;e[25]!==f||e[26]!==s||e[27]!==l?(y=v=>{const N=l.filter(j=>j.id!==v);f(N,Array.from(new Set([...s.hidden,v])))},e[25]=f,e[26]=s,e[27]=l,e[28]=y):y=e[28];let b;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==x||e[33]!==y?(b={snapshot:p,isLoading:o,moveTile:h,resizeTile:x,hideTile:y},e[29]=o,e[30]=p,e[31]=h,e[32]=x,e[33]=y,e[34]=b):b=e[34],b}function pn(t){return t.id}const hn={w:2,h:4},xn={w:1,h:2},gn={w:1,h:1};function yn(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function bn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function jn(t){return t.promptName?t.agentName:t.description}function vn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function Ye(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=at({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}=ts(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Re(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?ns(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function Ne(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}=en(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(vn(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 Nn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=Ne(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 x;e[12]!==s?(x=jn(s),e[12]=s,e[13]=x):x=e[13];let y;e[14]!==x?(y=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=y):y=e[15];let b;e[16]!==y||e[17]!==h?(b=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,y]}),e[16]=y,e[17]=h,e[18]=b):b=e[18];let v;e[19]!==o?(v=!o&&n.jsx(ss,{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]=v):v=e[20];let N;e[21]!==a||e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==l||e[26]!==f||e[27]!==p?(N=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,b,v]}),e[21]=a,e[22]=d,e[23]=b,e[24]=v,e[25]=l,e[26]=f,e[27]=p,e[28]=N):N=e[28];let j;return e[29]!==r||e[30]!==N?(j=n.jsxs(n.Fragment,{children:[N,r]}),e[29]=r,e[30]=N,e[31]=j):j=e[31],j}function wn(){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},Sn)}),t[0]=e):e=t[0],e}function Sn(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(H,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function _n(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}=Ne(s.agentId),u=o.filter(Cn),f=Ye(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 x="flex min-h-0 flex-1 gap-3 overflow-hidden";let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Tn,{}),e[5]=y):y=e[5];let b;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(b=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx($.Suspense,{fallback:y,children:n.jsx(In,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=b):b=e[9];const v=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(g=>n.jsx("button",{type:"button",onClick:()=>d(g),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:g.title})},g.promptName))});let N;e[10]!==b||e[11]!==v?(N=n.jsxs("div",{className:x,children:[b,v]}),e[10]=b,e[11]=v,e[12]=N):N=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==N?(j=n.jsxs("div",{className:p,children:[h,N,m]}),e[13]=m,e[14]=h,e[15]=N,e[16]=j):j=e[16],j}function Cn(t){return!!t.promptName}function In(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(Qt,{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 Tn(){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(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function kn(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(H,{className:"h-3 w-3/4"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{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 $n(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=Ne(s.agentId),m=o.filter(An),c=Ye(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 x=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(b=>n.jsx("button",{type:"button",onClick:()=>!i&&r(b),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:b.title})},b.promptName))});let y;return e[6]!==d||e[7]!==h||e[8]!==x?(y=n.jsxs("div",{className:u,children:[h,x,d]}),e[6]=d,e[7]=h,e[8]=x,e[9]=y):y=e[9],y}function An(t){return!!t.promptName}function et({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=be(e.slug),r=ze()?.ids??[],a=new Set(r),d=Oe(),l=Ue(),m=xe(),c=new Set(i.map(g=>g.agentId)),u=new Map;for(const g of o){const w=u.get(g.agentId);w?w.push(g):u.set(g.agentId,[g])}const f=o.filter(g=>!c.has(g.agentId)),p=[...i.map(g=>({kind:"tile",id:bn(g),data:g})),...f.map(g=>({kind:"prompt",id:yn(g),data:g}))],h=new Map(p.map(g=>[g.id,g])),x=fn(p.map(g=>({id:g.id,defaultSize:g.kind==="tile"?hn:gn,minSize:g.kind==="tile"?xn:void 0,pinned:a.has(g.data.agentId)}))),y=g=>{d.apply(w=>w.filter(S=>S!==g)).catch(()=>U.error("Couldn't remove from home — please try again."))},b=async g=>{if(i.filter(S=>S.agentId===g.agentId).length<=1){y(g.agentId);return}try{const C=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:g.agentId})).item;if(!C)throw new Error("Agent not found");const _=Z(C.metadata?.ui),I=g.tileId?_.filter(T=>T.tileId!==g.tileId):_.filter(T=>T.connectionId!==g.connectionId||T.resourceUri!==g.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:g.agentId,data:{metadata:{...C.metadata??{},ui:{...C.metadata?.ui??{},homeTile:null,homeTiles:I}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{U.error("Couldn't remove tile — please try again.")}},v=g=>{const w=h.get(g);if(w){if(!a.has(w.data.agentId)){x.hideTile(g);return}w.kind==="tile"?b(w.data):y(w.data.agentId)}},N=g=>{const w=h.get(g.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(it,{fallback:n.jsx($n,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx($.Suspense,{fallback:n.jsx(kn,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(_n,{tile:w.data,prompts:S,isEditMode:t,tileWidth:g.w})})})}return n.jsx(Nn,{entry:w.data,isEditMode:t})};return s||x.isLoading?n.jsx(wn,{}):x.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(nn,{tiles:x.snapshot.visible,isEditMode:t,renderTile:N,onMove:x.moveTile,onResize:x.resizeTile,onRemove:v})})}function Pn(t){const e=k.c(2),{prompts:s,tiles:o}=be(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 Ie=420,Te=305;function tt(){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:Ie}}),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:Ie}}),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:Te}}),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:Te}})]}),t[3]=i):i=t[3],i}function ke(){const t=k.c(33),{data:e}=ot.useSession(),{org:s}=J(),o=ge(),i=hs(),{selectedVirtualMcp:r}=vt();let a;t[0]!==s.id?(a=ct(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Dt(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:dt,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=fs(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=Ot(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=ft(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let x;t[17]!==f||t[18]!==p||t[19]!==h?(x={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=x):x=t[20],rt(x);const y=ps(),b=pt(l.id),{hasDecoKey:v,isZeroBalance:N,isInitialFreeCredit:j,balanceDollars:g,hasOnlyDecoProvider:w}=Et(),{hasVisibleTiles:S}=Pn(s.slug),C=Mt(b?.metadata);if(y.length===0&&!(C&&zt(i))){let L;return t[21]===Symbol.for("react.memo_cache_sentinel")?(L=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(Nt,{})})}),t[21]=L):L=t[21],L}let I;t[22]!==e?.user?.name?(I=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=I):I=t[23];const T=I,P=v&&j&&g!=null,M=v&&N&&w;let z;t[24]!==g||t[25]!==P||t[26]!==M?(z=P?n.jsx(oe.CreditsEyebrow,{balanceDollars:g}):M?n.jsx(oe.NoCreditsEyebrow,{}):null,t[24]=g,t[25]=P,t[26]=M,t[27]=z):z=t[27];const B=z;let O;return t[28]!==B||t[29]!==S||t[30]!==o||t[31]!==T?(O=n.jsx(Ys,{children:o?n.jsx(En,{eyebrow:B,userName:T}):n.jsx(Mn,{eyebrow:B,userName:T,hasVisibleTiles:S})}),t[28]=B,t[29]=S,t[30]=o,t[31]=T,t[32]=O):O=t[32],O}function En(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(tt,{}),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(oe.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(et,{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 Mn(t){const e=k.c(32),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ze(),[c,u]=$.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let p;e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==r||e[5]!==d?(p=n.jsx(xs.Right,{children:n.jsx(zn,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:f})}),e[1]=l,e[2]=a,e[3]=m,e[4]=r,e[5]=d,e[6]=p):p=e[6];let h;e[7]!==c?(h=n.jsx(ys,{open:c,onOpenChange:u}),e[7]=c,e[8]=h):h=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(tt,{}),e[9]=x):x=e[9];const y=i||r?"pt-32":"flex-1 justify-center";let b;e[10]!==y?(b=Q("relative flex flex-col items-center px-10 pb-4",y),e[10]=y,e[11]=b):b=e[11];let v;e[12]!==s?(v=s&&n.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=v):v=e[13];let N;e[14]!==o?(N=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[14]=o,e[15]=N):N=e[15];let j;e[16]!==v||e[17]!==N?(j=n.jsxs("div",{className:"text-center mb-10",children:[v,N]}),e[16]=v,e[17]=N,e[18]=j):j=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"relative w-full",children:[n.jsx(On,{}),n.jsx(oe.Input,{showConnectionsBanner:!0})]}),e[19]=g):g=e[19];let w;e[20]!==j?(w=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[j,g]}),e[20]=j,e[21]=w):w=e[21];let S;e[22]!==r?(S=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(et,{isEditMode:r})}),e[22]=r,e[23]=S):S=e[23];let C;e[24]!==w||e[25]!==S||e[26]!==b?(C=n.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:b,children:[w,S]})})]}),e[24]=w,e[25]=S,e[26]=b,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==p||e[30]!==h?(_=n.jsxs(n.Fragment,{children:[p,h,C]}),e[28]=C,e[29]=p,e[30]=h,e[31]=_):_=e[31],_}function zn(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(ye,{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($e,{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 x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(ht,{size:14}),e[6]=x):x=e[6];let y;e[7]!==r||e[8]!==h?(y=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=r,e[8]=h,e[9]=y):y=e[9];let b;return e[10]!==u||e[11]!==p||e[12]!==y?(b=n.jsxs(n.Fragment,{children:[u,p,y]}),e[10]=u,e[11]=p,e[12]=y,e[13]=b):b=e[13],b}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(jt,{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 On(){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 Uo(){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(ke,{})}),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(ke,{})})})}),t[1]=s):s=t[1],s}export{Uo as default};
1
+ import{c as k,j as n,r as $,D as J,m as xe,l as Q,i as le,an as Z,t as U,K as te,k as se,B as Y,d as st,a8 as nt,E as it,a as ot}from"./index-BwVMeD3q.js";import{u as ge}from"./use-mobile-7oYhfh2a.js";import{u as rt}from"./useSuspenseQueries-BZYHmjMQ.js";import{i as lt,u as ae,m as at,a as ct,S as dt}from"./use-mcp-client-DjnQKDkF.js";import{u as mt,b as ut,v as ft,a as pt}from"./use-virtual-mcp-Bn261I3R.js";import{i as ht}from"./ChevronUp-Bj5wnP8v.js";import{i as xt,A as ce,Y as gt,a8 as yt,D as bt,k as jt}from"./agent-icon-B_lvSp90.js";import{s as ye}from"./Plus-CXJQYPWf.js";import{i as $e}from"./X-C23kraKx.js";import{C as oe}from"./index-Bbr4phoV.js";import{b as vt}from"./chat-context-hue9xev7.js";import{N as Nt}from"./decopilot-D6Us63Iz.js";import{g as wt,b as Ae,c as re,K as Pe,P as Ee,D as Me,d as St,S as _t,v as Ct,e as It,C as Tt,s as kt,l as $t,k as At,o as Pt,u as Et,j as Mt,h as zt}from"./sortable.esm-DWhmpOCs.js";import{u as ze,a as Oe,o as Ot}from"./use-organization-settings-DeAexlNB.js";import{c as be,b as Lt,h as Dt}from"./shell-layout-BU2Eo26M.js";import{I as Le}from"./input-C8pdmexi.js";import{S as Ht,t as je,P as Rt,j as Ft,s as Ut,g as Bt}from"./scroll-area-BFIPKXPy.js";import{S as Vt,a as Kt,b as Wt,c as qt,d as Gt}from"./sheet-DaEm5-cm.js";import{S as H}from"./skeleton-CjN5A6XL.js";import{t as De}from"./ChevronDown-DuS1gosF.js";import{d as He}from"./ZoomOut-B5vLZpoX.js";import{g as Re,M as Qt}from"./types-C9zbfwjF.js";import{I as Fe}from"./integration-icon-BYt__tsS.js";import{b as Jt,c as Xt,S as Zt,a as we,d as Yt}from"./select-UKSqIIxL.js";import{T as es}from"./textarea-LTBnL6Dv.js";import{u as Ue}from"./studio-tools-Cj1fBaXp.js";import{a as ts}from"./use-mcp-tools-CbjkHt5p.js";import{i as ss}from"./XCircle-DAQ6sXs1.js";import{f as ns}from"./tab-id-BptcWVWa.js";import{g as is}from"./use-mcp-prompts-7fCwwbYc.js";import{u as os,w as rs}from"./hooks-BFhhtb2P.js";import{a as ls,g as as,c as cs,b as ds,D as ms}from"./dropdown-menu-CuiF-07J.js";import{s as us}from"./Trash01-Csom-OmK.js";import{a as fs,u as ps}from"./use-ai-providers-Mmhw_1Og.js";import{u as hs}from"./connect-desktop-dialog-lLRzH9Wf.js";import{a as xs}from"./toolbar-BuAJdBWi.js";import"./auth-CdNUf-u6.js";import"./use-collections-DDwKLwWC.js";import"./AlertCircle-BY01IebW.js";import"./Tool01-Cbity1uu.js";import"./SwitchHorizontal01-C-d9B1Pc.js";import"./Settings02-Qog-9BW9.js";import"./ArrowUpRight-CrNpVXJQ.js";import"./ZapSquare-JpoS_XnR.js";import"./Users03-CzMI4hYk.js";import"./CheckCircle-UPyj94ce.js";import"./ChevronLeft-DNoBDBkQ.js";import"./ChevronRight-DUYBaJAA.js";import"./DotsVertical-BoWHOZg-.js";import"./Stars02--YU8wF8-.js";import"./Eye-BN8eZd3q.js";import"./Globe01-CtRTi-q3.js";import"./FilterLines-BcDA53T2.js";import"./Star01-BNPre7m8.js";import"./Globe04-DcqSH090.js";import"./HardDrive-LcockCRx.js";import"./Key01-BcXniqTr.js";import"./LayoutLeft-DIu4qlvA.js";import"./LinkExternal01-Dyt9zIKA.js";import"./Monitor01-BY0WhsQY.js";import"./Sun-DF1tmwEc.js";import"./Palette-D0tFYq6o.js";import"./Play-Ds_dyiCJ.js";import"./SearchMd--1Uwo-4h.js";import"./Shield01-BjGAptDu.js";import"./Stars01-CUSSCI6Q.js";import"./Upload01-BKLWvYK3.js";import"./User01-rB66Yp8m.js";import"./Users01-CSjiAX-B.js";import"./XClose-CD3EJbwD.js";import"./Zap-BKA-au81.js";import"./tooltip-_TcC7QSJ.js";import"./dialog-Djo11OZ8.js";import"./drawer-CGy7XhOb.js";import"./collection-search-BaiviTLW.js";import"./form-Bws9hvDL.js";import"./label-6fUzynqC.js";import"./tabs-DLLYyT_4.js";import"./toggle-group-DLR6cnlJ.js";import"./popover-cxXkvARj.js";import"./command-BtIUrGW9.js";import"./index-CNHawUWP.js";import"./useInfiniteQuery-CbK39j5Y.js";import"./use-infinite-scroll-B0LwAHpI.js";import"./question-004-sINsf4GQ.js";import"./checkbox-CnyL8XHl.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-CjYG3-98.js";import"./settings-section-uysJimh1.js";import"./card-CZci2Ked.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BvZozJYf.js";import"./use-registry-connections-B0D0ZFPH.js";import"./use-connection-bj-QmeCF.js";import"./extract-connection-data-HZVgcUqH.js";import"./collection-tabs-gJzAs0-U.js";import"./badge-yqmEwWNw.js";import"./connection-form-helpers-BXpJ-39p.js";import"./authenticate-and-persist-oauth-B-HUI4Rh.js";import"./mcp-oauth-DOYfP2o1.js";import"./useSuspenseInfiniteQuery-HNqdvvLG.js";import"./required-auth-layout-Bni9Lv8T.js";import"./use-org-sso-BRBxUiX-.js";import"./use-clock-tick-BbDdy2cM.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-TPlwZ6aA.js";import"./file-type-icon-9Eew51_j.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-C1cPyWif.js";import"./decopilot-sse-pool-Cn1O82-8.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function Be(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(gs,{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 gs(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(es,{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=x=>r(x==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Jt,{className:"h-7 text-xs",children:n.jsx(Xt,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(Zt,{children:[n.jsx(we,{value:"true",children:"true"}),n.jsx(we,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(Yt,{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(Le,{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 ys(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=$.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Vt,{children:"Manage home"}),d=n.jsx(Kt,{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(xt,{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=x=>r(x.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(Wt,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(Le,{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(Gs,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(Ht,{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($.Suspense,{fallback:u,children:n.jsx(js,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(qt,{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(Gt,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function bs(t){const e=k.c(32),{org:s}=J(),o=ze();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=Oe(),d=ut(),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 x=p>=ne;let y;e[10]!==x||e[11]!==f||e[12]!==a?(y=_=>f(_)||x?Promise.resolve():a.apply(I=>I.includes(_)?null:[...I,_]),e[10]=x,e[11]=f,e[12]=a,e[13]=y):y=e[13];const b=y;let v;e[14]!==a?(v=_=>a.apply(I=>I.filter(T=>T!==_)),e[14]=a,e[15]=v):v=e[15];const N=v;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const g=j;let w;e[18]!==d||e[19]!==x||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,I)=>{await d.update.mutateAsync({id:_.id,data:{metadata:I}}),!f(_.id)&&!x&&await a.apply(T=>T.includes(_.id)?null:[...T,_.id]),await c()},e[18]=d,e[19]=x,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let C;return e[24]!==b||e[25]!==x||e[26]!==r||e[27]!==f||e[28]!==N||e[29]!==g||e[30]!==S?(C={homeIds:r,isOnHome:f,atLimit:x,addAgent:b,removeAgent:N,reorder:g,saveAgentMetadata:S},e[24]=b,e[25]=x,e[26]=r,e[27]=f,e[28]=N,e[29]=g,e[30]=S,e[31]=C):C=e[31],C}function js(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=mt(o);let r;e[1]!==i?(r=new Set(i.map(_s)),e[1]=i,e[2]=r):r=e[2];const a=bs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const x=new Map(i.map(Ss));d=s.trim().toLowerCase();const y=N=>!d||N.title?.toLowerCase().includes(d);l=a.homeIds.map(N=>x.get(N)).filter(ws).filter(y);const b=wt(i);let v;e[9]!==a?(v=N=>!a.isOnHome(N.id),e[9]=a,e[10]=v):v=e[10],m=i.filter(Ns).filter(N=>!b.has(N.id)).filter(v).filter(y).sort(vs),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(Cs,{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(ks,{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 vs(t,e){return(t.title??"").localeCompare(e.title??"")}function Ns(t){return t.id&&!lt(t.id)}function ws(t){return!!t}function Ss(t){return[t.id,t]}function _s(t){return t.id}function Ve(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 Cs(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:kt},e[1]=r):r=e[1];const a=Ae(re(Ee,i),re(Pe,r));let d;e[2]!==s?(d=p=>{const{active:h,over:x}=p;if(!x||h.id===x.id)return;const y=s.homeIds,b=y.indexOf(h.id),v=y.indexOf(x.id);b===-1||v===-1||s.reorder($t([...y],b,v)).catch(Ts)},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(Ve,{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(Me,{sensors:a,collisionDetection:St,onDragEnd:l,children:n.jsx(_t,{items:o.map(Is),strategy:Ct,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(As,{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 Is(t){return t.id}function Ts(){return U.error("Couldn't reorder home — please try again.")}function ks(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,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(Ve,{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(Ms,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a($s),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 $s(t){return t+20}function Ke(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 As(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=$.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}=It(a),p=Ke(s)||"Quick access";let h;e[2]!==c?(h=Tt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const x=f?.5:void 0,y=f?100:void 0;let b;e[4]!==h||e[5]!==x||e[6]!==y||e[7]!==u?(b={transform:h,transition:u,opacity:x,zIndex:y},e[4]=h,e[5]=x,e[6]=y,e[7]=u,e[8]=b):b=e[8];const v=b,N=f&&"shadow-lg";let j;e[9]!==N?(j=Q("rounded-lg border border-border bg-card",N),e[9]=N,e[10]=j):j=e[10];const g=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(He,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==g?(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":g,children:w}),e[12]=d,e[13]=l,e[14]=g,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r(Es),e[16]=C):C=e[16];const _=s.title??s.id;let I;e[17]!==s.icon||e[18]!==_?(I=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=I):I=e[19];const T=s.title??s.id;let P;e[20]!==T?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:T}),e[20]=T,e[21]=P):P=e[21];let M;e[22]!==p?(M=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=M):M=e[23];let z;e[24]!==P||e[25]!==M?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,M]}),e[24]=P,e[25]=M,e[26]=z):z=e[26];const B=i&&"rotate-180";let O;e[27]!==B?(O=Q("shrink-0 text-muted-foreground transition-transform",B),e[27]=B,e[28]=O):O=e[28];let L;e[29]!==O?(L=n.jsx(De,{size:16,className:O}),e[29]=O,e[30]=L):L=e[30];let K;e[31]!==i||e[32]!==I||e[33]!==z||e[34]!==L?(K=n.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[I,z,L]}),e[31]=i,e[32]=I,e[33]=z,e[34]=L,e[35]=K):K=e[35];let A;e[36]!==s.id||e[37]!==o?(A=()=>o.removeAgent(s.id).catch(Ps),e[36]=s.id,e[37]=o,e[38]=A):A=e[38];const V=`Remove ${s.title??s.id} from home`;let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx($e,{size:14}),e[39]=D):D=e[39];let E;e[40]!==A||e[41]!==V?(E=n.jsx("button",{type:"button",onClick:A,"aria-label":V,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:D}),e[40]=A,e[41]=V,e[42]=E):E=e[42];let R;e[43]!==S||e[44]!==K||e[45]!==E?(R=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,K,E]}),e[43]=S,e[44]=K,e[45]=E,e[46]=R):R=e[46];let F;e[47]!==s||e[48]!==i||e[49]!==o?(F=i&&n.jsx(We,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=F):F=e[50];let q;return e[51]!==m||e[52]!==v||e[53]!==R||e[54]!==F||e[55]!==j?(q=n.jsxs("div",{ref:m,style:v,className:j,children:[R,F]}),e[51]=m,e[52]=v,e[53]=R,e[54]=F,e[55]=j,e[56]=q):q=e[56],q}function Ps(){return U.error("Couldn't remove from home — please try again.")}function Es(t){return!t}function Ms({agent:t,home:e}){const[s,o]=$.useState(!1),[i,r]=$.useState(!1),a=Ke(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{U.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(De,{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(ye,{size:14})})]}),s&&n.jsx(We,{agent:t,home:e})]})}function We(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(zs).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(Ls,{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(Os,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx($.Suspense,{fallback:u,children:n.jsx(Us,{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 zs(t){return t.connection_id}function Os(){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(H,{className:"h-8 w-full"}),n.jsx(H,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Ls({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Ue(),{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 x=Re(h._meta);return x?[{name:h.name,description:h.description,resourceUri:x,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(H,{className:"h-7 w-full"}),n.jsx(H,{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(Rs,{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(Fs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function qe(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 Ds(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 Hs(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 Rs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=$.useState(!1),[d,l]=$.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=$.useState(()=>Ds(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const x=Z(t.metadata?.ui),y=i.tileId?x.filter(v=>v.tileId!==i.tileId):x.filter(v=>v!==i),b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,b),l(!1)}catch(x){console.error("[home-tiles] failed to remove tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let x;if(m&&o.inputSchema?.properties){const N=qe(c,o.inputSchema.properties);if(!N){U.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(N).length>0&&(x=N)}const b=Z(t.metadata?.ui).map(N=>(i.tileId?N.tileId===i.tileId:N===i)?{...N,toolInput:x}:N),v={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,v),l(!1)}catch(x){console.error("[home-tiles] failed to save tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Hs(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(Fe,{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:je(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(x=>!x),"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(gt,{size:14})}),n.jsx(ve,{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(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(x,y)=>u(b=>({...b,[x]:y}))}),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 Fs({agent:t,home:e,connection:s,tool:o}){const[i,r]=$.useState(!1),[a,d]=$.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=$.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){U.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 b=qe(m,o.inputSchema.properties);if(!b){U.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(b).length>0&&(p=b)}const x=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:x}};await e.saveAgentMetadata(t,y),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),U.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(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:je(o.name)}),n.jsx(ve,{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(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(x=>({...x,[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 ve(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(yt,{size:14}):n.jsx(ye,{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 Us(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:g}=await d.listPrompts();return g.map(Ws)},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=be(r.slug);let x,y;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let g;e[17]!==s.id?(g=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=g):g=e[18],x=h.prompts.filter(g).map(Ks);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],y=[...w];for(const S of x)y.some(C=>C.name===S.name)||y.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=x,e[16]=y}else x=e[15],y=e[16];if(f&&x.length===0){let g;return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=g):g=e[21],g}if(p&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(y.length===0)return null;let b;e[22]!==i||e[23]!==y?(b=i??y.map(Vs),e[22]=i,e[23]=y,e[24]=b):b=e[24];let v;e[25]!==b?(v=new Set(b),e[25]=b,e[26]=v):v=e[26];const N=v;let j;return e[27]!==s||e[28]!==o||e[29]!==y||e[30]!==N?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:y.map(g=>n.jsx(qs,{agent:s,home:o,prompt:g,allPromptNames:y.map(Bs),isPinned:N.has(g.name)},g.name))}),e[27]=s,e[28]=o,e[29]=y,e[30]=N,e[31]=j):j=e[31],j}function Bs(t){return t.name}function Vs(t){return t.name}function Ks(t){return{name:t.promptName,title:t.title,description:t.description}}function Ws(t){return{name:t.name,title:t.title,description:t.description}}function qs({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=$.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){U.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),U.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??je(s.name)}),n.jsx(ve,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function Gs(){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},Qs)}),t[0]=e):e=t[0],e}function Qs(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(H,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Ge=`home-board.layout.v${ee}`;function Qe(t){return`home-board.layout.v${ee}.${t}`}const Je={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Je:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function Js(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function Xs(t){try{const e=localStorage.getItem(Qe(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Se(t,e){try{localStorage.setItem(Qe(t),JSON.stringify(e))}catch{}}async function _e(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function Zs(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=Xs(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const b=await fetch(`/api/${t}/kv/${Ge}`);if(b.status===404)return a&&Js(a)?(await _e(t,a),a):Je;if(!b.ok)throw new Error("Failed to load board layout");const v=await b.json(),N=fe(v.value);return Se(t,N),N},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:b=>_e(t,b)},e[11]=t,e[12]=u):u=e[12];const f=st(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=b=>{Se(t,b),s.setQueryData(i,b),f.mutate(b)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let x;e[18]!==m?(x=fe(m),e[18]=m,e[19]=x):x=e[19];let y;return e[20]!==c||e[21]!==h||e[22]!==x?(y={layout:x,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=x,e[23]=y):y=e[23],y}const Xe=$.createContext(null);function Ys(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=Zs(o.slug),[r,a]=$.useState(!1),[d,l]=$.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,x=r&&d!==null,y=x?d:i.layout;let b;e[6]!==d||e[7]!==x||e[8]!==i.layout?(b=x?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=x,e[8]=i.layout,e[9]=b):b=e[9];const v=b;let N;e[10]!==r||e[11]!==i?(N=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=N):N=e[12];const j=N;let g;e[13]!==j||e[14]!==c||e[15]!==v||e[16]!==r||e[17]!==y||e[18]!==h||e[19]!==i.isLoading?(g={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:v,layout:y,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=v,e[16]=r,e[17]=y,e[18]=h,e[19]=i.isLoading,e[20]=g):g=e[20];let w;return e[21]!==s||e[22]!==g?(w=n.jsx(Xe.Provider,{value:g,children:s}),e[21]=s,e[22]=g,e[23]=w):w=e[23],w}function Ze(){const t=$.useContext(Xe);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function en({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=os(),{setTaskId:r}=Lt(),[a,d]=$.useState(null),[l,m]=$.useState(!1),c=$.useRef(!1),u=async(y,b)=>{if(!o){U.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const v=await is(o,y.name,b),N={type:"doc",content:[{type:"paragraph",content:[Ft({id:y.name,name:Ut(y.name,Bt(y._meta)),metadata:v.messages,char:"/",kind:"prompt",args:b}),{type:"text",text:" "}]}]},j=crypto.randomUUID();rs(sessionStorage,s,j,{tiptapDoc:N}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(v){console.error("[start-thread-from-prompt] failed",v),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async y=>{if(!c.current){if(y.arguments&&y.arguments.length>0){d(y);return}await u(y)}},p=async y=>{if(!a)return;const b=a;d(null),await u(b,y)};return{start:f,startBlank:async y=>{if(!c.current){c.current=!0,m(!0);try{const b=crypto.randomUUID();await i({id:b,virtual_mcp_id:t}),r(b,t,y?.main?{main:y.main}:void 0)}catch(b){console.error("[start-thread-from-prompt] startBlank failed",b),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Rt,{prompt:a,setPrompt:y=>d(y),onSubmit:p}),dialogPrompt:a,starting:l}}const W=4,G=100,Ce=12,tn=5,sn={w:2,h:2};class pe extends $.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(nt,{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 nn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=$.useRef(null),[c,u]=$.useState(null),[f,p]=$.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const x=Ae(re(Ee,h),re(Pe)),y=s.reduce(on,0),b=o?Math.max(y+2,4):Math.max(y,1);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{const A=m.current?.getBoundingClientRect();return A?{cellWidth:A.width/W,cellHeight:G}:null},e[1]=v):v=e[1];const N=v;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=A=>{u(String(A.active.id)),p(N())},e[2]=j):j=e[2];const g=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=A=>{const V=String(A.active.id),D=f??N();if(u(null),p(null),!D||D.cellWidth<=0)return;const E=s.find(q=>q.id===V);if(!E)return;const R=Math.round(A.delta.x/D.cellWidth),F=Math.round(A.delta.y/D.cellHeight);R===0&&F===0||r(V,{x:E.x+R,y:E.y+F})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let A;if(e[7]!==i||e[8]!==s){let D;e[10]!==i?(D=E=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(E)})},E.id),e[10]=i,e[11]=D):D=e[11],A=s.map(D),e[7]=i,e[8]=s,e[9]=A}else A=e[9];let V;return e[12]!==A?(V=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=V):V=e[13],V}let C,_,I,T,P,M,z,B,O;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==x||e[22]!==s||e[23]!==b){const A=c?s.find(X=>X.id===c):null;_=Me,B=x,O=g,I=S;const V=b*G,D=o?G*4:G;let E;e[33]!==V||e[34]!==D?(E={height:V,minHeight:D},e[33]=V,e[34]=D,e[35]=E):E=e[35];let R;e[36]!==o||e[37]!==s||e[38]!==b?(R=o&&n.jsx(rn,{rows:b,tiles:s}),e[36]=o,e[37]=s,e[38]=b,e[39]=R):R=e[39];let F;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(an,{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],F=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=F}else F=e[46];e[53]!==E||e[54]!==R||e[55]!==F?(T=n.jsxs("div",{ref:m,className:"relative w-full",style:E,children:[R,F]}),e[53]=E,e[54]=R,e[55]=F,e[56]=T):T=e[56],C=At,P=null;const q=A&&f?A.w*f.cellWidth-Ce:void 0,de=A&&f?A.h*f.cellHeight-Ce:void 0;e[57]!==q||e[58]!==de?(M={width:q,height:de},e[57]=q,e[58]=de,e[59]=M):M=e[59],z=A&&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(A)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=x,e[22]=s,e[23]=b,e[24]=C,e[25]=_,e[26]=I,e[27]=T,e[28]=P,e[29]=M,e[30]=z,e[31]=B,e[32]=O}else C=e[24],_=e[25],I=e[26],T=e[27],P=e[28],M=e[29],z=e[30],B=e[31],O=e[32];let L;e[60]!==C||e[61]!==P||e[62]!==M||e[63]!==z?(L=n.jsx(C,{dropAnimation:P,style:M,children:z}),e[60]=C,e[61]=P,e[62]=M,e[63]=z,e[64]=L):L=e[64];let K;return e[65]!==_||e[66]!==I||e[67]!==T||e[68]!==L||e[69]!==B||e[70]!==O?(K=n.jsxs(_,{sensors:B,onDragStart:O,onDragEnd:I,children:[T,L]}),e[65]=_,e[66]=I,e[67]=T,e[68]=L,e[69]=B,e[70]=O,e[71]=K):K=e[71],K}function on(t,e){return Math.max(t,e.y+e.h)}function rn(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<W;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(ln)}),e[5]=a,e[6]=d):d=e[6],d}function ln(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/W*100}%`,top:t.y*G,width:`${1/W*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 an(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}=Pt(m),h=`${s.x/W*100}%`,x=`${s.w/W*100}%`,y=s.y*G,b=s.h*G,v=p||i,N=!v&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=v&&"opacity-30";let g;e[3]!==N||e[4]!==j?(g=Q("absolute p-1 will-change-[left,top,width,height,opacity]",N,j),e[3]=N,e[4]=j,e[5]=g):g=e[5];let w;e[6]!==b||e[7]!==h||e[8]!==y||e[9]!==x?(w={left:h,top:y,width:x,height:b},e[6]=b,e[7]=h,e[8]=y,e[9]=x,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=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(He,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(cn,{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 I;e[20]!==d?(I=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=I):I=e[21];let T;e[22]!==I||e[23]!==C||e[24]!==_?(T=n.jsxs("div",{className:C,children:[_,I]}),e[22]=I,e[23]=C,e[24]=_,e[25]=T):T=e[25];let P;return e[26]!==c||e[27]!==T||e[28]!==g||e[29]!==w?(P=n.jsx("div",{ref:c,className:g,style:w,children:T}),e[26]=c,e[27]=T,e[28]=g,e[29]=w,e[30]=P):P=e[30],P}function cn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=$.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ls,{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(bt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=y=>{o(s.id,y),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(dn,{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(as,{}),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(us,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(cs,{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(ds,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let x;return e[17]!==r||e[18]!==h?(x=n.jsxs(ms,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=x):x=e[19],x}function dn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=$.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(${W}, 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:tn},(y,b)=>Array.from({length:W},(v,N)=>{const j=N+1,g=b+1,w=j<i||g<r,S=j<=m.w&&g<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${g}`,onPointerEnter:()=>d({w:j,h:g}),onClick:()=>o({w:j,h:g}),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${g}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let x;return e[16]!==u||e[17]!==h?(x=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=x):x=e[18],x}function mn(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<=W-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)mn(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(W,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(W-s,t)),i=Math.max(0,e);return{x:o,y:i}}function un(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 fn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ze();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 v;e[7]!==a?(v=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=v):v=e[8];const N=t.filter(v);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of N){const g=s.tiles[j.id];if(!g)continue;const w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),{x:_,y:I}=ue(g.x,g.y,S);l.push({id:j.id,x:_,y:I,w:S,h:C,minW:w?.w,minH:w?.h})}for(const j of N){if(l.some(I=>I.id===j.id))continue;const g=j.defaultSize??sn,w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),_=he(l,S,C);l.push({id:j.id,x:_.x,y:_.y,w:S,h:C,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(pn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(v,N)=>{const j={};for(const g of v)j[g.id]={x:g.x,y:g.y,w:g.w,h:g.h};i({version:ee,tiles:j,hidden:N.filter(g=>c.has(g))})},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=(v,N)=>{const j=l.find(S=>S.id===v);if(!j)return;const g=ue(N.x,N.y,j.w);if(g.x===j.x&&g.y===j.y)return;const w=un(l,v,g);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let x;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(x=(v,N)=>{const j=l.find(T=>T.id===v);if(!j)return;const g=d.get(v),{w,h:S}=me(N.w,N.h,g);if(w===j.w&&S===j.h)return;const C={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(T=>T.id!==v),I=[C];for(const T of _){const P=he(I,T.w,T.h);I.push({...T,x:P.x,y:P.y})}f(I,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=x):x=e[24];let y;e[25]!==f||e[26]!==s||e[27]!==l?(y=v=>{const N=l.filter(j=>j.id!==v);f(N,Array.from(new Set([...s.hidden,v])))},e[25]=f,e[26]=s,e[27]=l,e[28]=y):y=e[28];let b;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==x||e[33]!==y?(b={snapshot:p,isLoading:o,moveTile:h,resizeTile:x,hideTile:y},e[29]=o,e[30]=p,e[31]=h,e[32]=x,e[33]=y,e[34]=b):b=e[34],b}function pn(t){return t.id}const hn={w:2,h:4},xn={w:1,h:2},gn={w:1,h:1};function yn(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function bn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function jn(t){return t.promptName?t.agentName:t.description}function vn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function Ye(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=at({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}=ts(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Re(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?ns(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function Ne(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}=en(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(vn(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 Nn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=Ne(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 x;e[12]!==s?(x=jn(s),e[12]=s,e[13]=x):x=e[13];let y;e[14]!==x?(y=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=y):y=e[15];let b;e[16]!==y||e[17]!==h?(b=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,y]}),e[16]=y,e[17]=h,e[18]=b):b=e[18];let v;e[19]!==o?(v=!o&&n.jsx(ss,{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]=v):v=e[20];let N;e[21]!==a||e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==l||e[26]!==f||e[27]!==p?(N=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,b,v]}),e[21]=a,e[22]=d,e[23]=b,e[24]=v,e[25]=l,e[26]=f,e[27]=p,e[28]=N):N=e[28];let j;return e[29]!==r||e[30]!==N?(j=n.jsxs(n.Fragment,{children:[N,r]}),e[29]=r,e[30]=N,e[31]=j):j=e[31],j}function wn(){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},Sn)}),t[0]=e):e=t[0],e}function Sn(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(H,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function _n(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}=Ne(s.agentId),u=o.filter(Cn),f=Ye(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 x="flex min-h-0 flex-1 gap-3 overflow-hidden";let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Tn,{}),e[5]=y):y=e[5];let b;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(b=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx($.Suspense,{fallback:y,children:n.jsx(In,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=b):b=e[9];const v=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(g=>n.jsx("button",{type:"button",onClick:()=>d(g),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:g.title})},g.promptName))});let N;e[10]!==b||e[11]!==v?(N=n.jsxs("div",{className:x,children:[b,v]}),e[10]=b,e[11]=v,e[12]=N):N=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==N?(j=n.jsxs("div",{className:p,children:[h,N,m]}),e[13]=m,e[14]=h,e[15]=N,e[16]=j):j=e[16],j}function Cn(t){return!!t.promptName}function In(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(Qt,{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 Tn(){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(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function kn(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(H,{className:"h-3 w-3/4"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{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 $n(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=Ne(s.agentId),m=o.filter(An),c=Ye(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 x=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(b=>n.jsx("button",{type:"button",onClick:()=>!i&&r(b),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:b.title})},b.promptName))});let y;return e[6]!==d||e[7]!==h||e[8]!==x?(y=n.jsxs("div",{className:u,children:[h,x,d]}),e[6]=d,e[7]=h,e[8]=x,e[9]=y):y=e[9],y}function An(t){return!!t.promptName}function et({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=be(e.slug),r=ze()?.ids??[],a=new Set(r),d=Oe(),l=Ue(),m=xe(),c=new Set(i.map(g=>g.agentId)),u=new Map;for(const g of o){const w=u.get(g.agentId);w?w.push(g):u.set(g.agentId,[g])}const f=o.filter(g=>!c.has(g.agentId)),p=[...i.map(g=>({kind:"tile",id:bn(g),data:g})),...f.map(g=>({kind:"prompt",id:yn(g),data:g}))],h=new Map(p.map(g=>[g.id,g])),x=fn(p.map(g=>({id:g.id,defaultSize:g.kind==="tile"?hn:gn,minSize:g.kind==="tile"?xn:void 0,pinned:a.has(g.data.agentId)}))),y=g=>{d.apply(w=>w.filter(S=>S!==g)).catch(()=>U.error("Couldn't remove from home — please try again."))},b=async g=>{if(i.filter(S=>S.agentId===g.agentId).length<=1){y(g.agentId);return}try{const C=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:g.agentId})).item;if(!C)throw new Error("Agent not found");const _=Z(C.metadata?.ui),I=g.tileId?_.filter(T=>T.tileId!==g.tileId):_.filter(T=>T.connectionId!==g.connectionId||T.resourceUri!==g.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:g.agentId,data:{metadata:{...C.metadata??{},ui:{...C.metadata?.ui??{},homeTile:null,homeTiles:I}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{U.error("Couldn't remove tile — please try again.")}},v=g=>{const w=h.get(g);if(w){if(!a.has(w.data.agentId)){x.hideTile(g);return}w.kind==="tile"?b(w.data):y(w.data.agentId)}},N=g=>{const w=h.get(g.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(it,{fallback:n.jsx($n,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx($.Suspense,{fallback:n.jsx(kn,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(_n,{tile:w.data,prompts:S,isEditMode:t,tileWidth:g.w})})})}return n.jsx(Nn,{entry:w.data,isEditMode:t})};return s||x.isLoading?n.jsx(wn,{}):x.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(nn,{tiles:x.snapshot.visible,isEditMode:t,renderTile:N,onMove:x.moveTile,onResize:x.resizeTile,onRemove:v})})}function Pn(t){const e=k.c(2),{prompts:s,tiles:o}=be(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 Ie=420,Te=305;function tt(){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:Ie}}),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:Ie}}),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:Te}}),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:Te}})]}),t[3]=i):i=t[3],i}function ke(){const t=k.c(33),{data:e}=ot.useSession(),{org:s}=J(),o=ge(),i=hs(),{selectedVirtualMcp:r}=vt();let a;t[0]!==s.id?(a=ct(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Dt(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:dt,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=fs(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=Ot(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=ft(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let x;t[17]!==f||t[18]!==p||t[19]!==h?(x={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=x):x=t[20],rt(x);const y=ps(),b=pt(l.id),{hasDecoKey:v,isZeroBalance:N,isInitialFreeCredit:j,balanceDollars:g,hasOnlyDecoProvider:w}=Et(),{hasVisibleTiles:S}=Pn(s.slug),C=Mt(b?.metadata);if(y.length===0&&!(C&&zt(i))){let L;return t[21]===Symbol.for("react.memo_cache_sentinel")?(L=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(Nt,{})})}),t[21]=L):L=t[21],L}let I;t[22]!==e?.user?.name?(I=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=I):I=t[23];const T=I,P=v&&j&&g!=null,M=v&&N&&w;let z;t[24]!==g||t[25]!==P||t[26]!==M?(z=P?n.jsx(oe.CreditsEyebrow,{balanceDollars:g}):M?n.jsx(oe.NoCreditsEyebrow,{}):null,t[24]=g,t[25]=P,t[26]=M,t[27]=z):z=t[27];const B=z;let O;return t[28]!==B||t[29]!==S||t[30]!==o||t[31]!==T?(O=n.jsx(Ys,{children:o?n.jsx(En,{eyebrow:B,userName:T}):n.jsx(Mn,{eyebrow:B,userName:T,hasVisibleTiles:S})}),t[28]=B,t[29]=S,t[30]=o,t[31]=T,t[32]=O):O=t[32],O}function En(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(tt,{}),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(oe.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(et,{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 Mn(t){const e=k.c(32),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ze(),[c,u]=$.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let p;e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==r||e[5]!==d?(p=n.jsx(xs.Right,{children:n.jsx(zn,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:f})}),e[1]=l,e[2]=a,e[3]=m,e[4]=r,e[5]=d,e[6]=p):p=e[6];let h;e[7]!==c?(h=n.jsx(ys,{open:c,onOpenChange:u}),e[7]=c,e[8]=h):h=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(tt,{}),e[9]=x):x=e[9];const y=i||r?"pt-32":"flex-1 justify-center";let b;e[10]!==y?(b=Q("relative flex flex-col items-center px-10 pb-4",y),e[10]=y,e[11]=b):b=e[11];let v;e[12]!==s?(v=s&&n.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=v):v=e[13];let N;e[14]!==o?(N=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[14]=o,e[15]=N):N=e[15];let j;e[16]!==v||e[17]!==N?(j=n.jsxs("div",{className:"text-center mb-10",children:[v,N]}),e[16]=v,e[17]=N,e[18]=j):j=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"relative w-full",children:[n.jsx(On,{}),n.jsx(oe.Input,{showConnectionsBanner:!0})]}),e[19]=g):g=e[19];let w;e[20]!==j?(w=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[j,g]}),e[20]=j,e[21]=w):w=e[21];let S;e[22]!==r?(S=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(et,{isEditMode:r})}),e[22]=r,e[23]=S):S=e[23];let C;e[24]!==w||e[25]!==S||e[26]!==b?(C=n.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:b,children:[w,S]})})]}),e[24]=w,e[25]=S,e[26]=b,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==p||e[30]!==h?(_=n.jsxs(n.Fragment,{children:[p,h,C]}),e[28]=C,e[29]=p,e[30]=h,e[31]=_):_=e[31],_}function zn(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(ye,{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($e,{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 x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(ht,{size:14}),e[6]=x):x=e[6];let y;e[7]!==r||e[8]!==h?(y=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=r,e[8]=h,e[9]=y):y=e[9];let b;return e[10]!==u||e[11]!==p||e[12]!==y?(b=n.jsxs(n.Fragment,{children:[u,p,y]}),e[10]=u,e[11]=p,e[12]=y,e[13]=b):b=e[13],b}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(jt,{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 On(){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 Uo(){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(ke,{})}),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(ke,{})})})}),t[1]=s):s=t[1],s}export{Uo as default};
@@ -1 +1 @@
1
- import{c as s,l as a,j as d}from"./index-Djd6TuLO.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
1
+ import{c as s,l as a,j as d}from"./index-BwVMeD3q.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
@@ -1 +1 @@
1
- import{c as k,j as h,r as C,l as L}from"./index-Djd6TuLO.js";import{n as Z}from"./XCircle-NMY-qxx5.js";import{A as y}from"./agent-icon-CUDD1qQU.js";const M={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},R={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},T={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},W={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function G(E){const t=k.c(13),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g;if(e?.startsWith("icon://")||e?.includes("#agentcolor=")){const r=W[n];let l;return t[0]!==o||t[1]!==e||t[2]!==s||t[3]!==r?(l=h.jsx(y,{icon:e,name:s,size:r,className:o}),t[0]=o,t[1]=e,t[2]=s,t[3]=r,t[4]=l):l=t[4],l}const S=e??"no-icon";let i;return t[5]!==o||t[6]!==c||t[7]!==I||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==S?(i=h.jsx($,{icon:e,name:s,size:n,className:o,fallbackIcon:c,fit:I},S),t[5]=o,t[6]=c,t[7]=I,t[8]=e,t[9]=s,t[10]=n,t[11]=S,t[12]=i):i=t[12],i}function $(E){const t=k.c(25),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g,[S,i]=C.useState(!1),r=!!e&&S,l=M[n],p=R[n];let a;t[0]!==o||t[1]!==l||t[2]!==p?(a=L("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,p,o),t[0]=o,t[1]=l,t[2]=p,t[3]=a):a=t[3];const N=e||void 0,_=I==="contain"?"object-contain":"object-cover",A=!r&&"hidden";let m;t[4]!==_||t[5]!==A?(m=L("h-full w-full",_,A),t[4]=_,t[5]=A,t[6]=m):m=t[6];let v,j;t[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>i(!1),j=()=>i(!0),t[7]=v,t[8]=j):(v=t[7],j=t[8]);let d;t[9]!==s||t[10]!==N||t[11]!==m?(d=h.jsx("img",{src:N,alt:s,className:m,onError:v,onLoad:j}),t[9]=s,t[10]=N,t[11]=m,t[12]=d):d=t[12];const z=r&&"hidden";let f;t[13]!==z?(f=L("h-full w-full flex items-center justify-center bg-muted/20",z),t[13]=z,t[14]=f):f=t[14];let x;t[15]!==c||t[16]!==n?(x=c??h.jsx(Z,{size:T[n],className:"text-muted-foreground"}),t[15]=c,t[16]=n,t[17]=x):x=t[17];let u;t[18]!==f||t[19]!==x?(u=h.jsx("div",{className:f,children:x}),t[18]=f,t[19]=x,t[20]=u):u=t[20];let b;return t[21]!==d||t[22]!==u||t[23]!==a?(b=h.jsxs("div",{className:a,children:[d,u]}),t[21]=d,t[22]=u,t[23]=a,t[24]=b):b=t[24],b}export{G as I};
1
+ import{c as k,j as h,r as C,l as L}from"./index-BwVMeD3q.js";import{n as Z}from"./XCircle-DAQ6sXs1.js";import{A as y}from"./agent-icon-B_lvSp90.js";const M={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},R={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},T={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},W={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function G(E){const t=k.c(13),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g;if(e?.startsWith("icon://")||e?.includes("#agentcolor=")){const r=W[n];let l;return t[0]!==o||t[1]!==e||t[2]!==s||t[3]!==r?(l=h.jsx(y,{icon:e,name:s,size:r,className:o}),t[0]=o,t[1]=e,t[2]=s,t[3]=r,t[4]=l):l=t[4],l}const S=e??"no-icon";let i;return t[5]!==o||t[6]!==c||t[7]!==I||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==S?(i=h.jsx($,{icon:e,name:s,size:n,className:o,fallbackIcon:c,fit:I},S),t[5]=o,t[6]=c,t[7]=I,t[8]=e,t[9]=s,t[10]=n,t[11]=S,t[12]=i):i=t[12],i}function $(E){const t=k.c(25),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g,[S,i]=C.useState(!1),r=!!e&&S,l=M[n],p=R[n];let a;t[0]!==o||t[1]!==l||t[2]!==p?(a=L("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,p,o),t[0]=o,t[1]=l,t[2]=p,t[3]=a):a=t[3];const N=e||void 0,_=I==="contain"?"object-contain":"object-cover",A=!r&&"hidden";let m;t[4]!==_||t[5]!==A?(m=L("h-full w-full",_,A),t[4]=_,t[5]=A,t[6]=m):m=t[6];let v,j;t[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>i(!1),j=()=>i(!0),t[7]=v,t[8]=j):(v=t[7],j=t[8]);let d;t[9]!==s||t[10]!==N||t[11]!==m?(d=h.jsx("img",{src:N,alt:s,className:m,onError:v,onLoad:j}),t[9]=s,t[10]=N,t[11]=m,t[12]=d):d=t[12];const z=r&&"hidden";let f;t[13]!==z?(f=L("h-full w-full flex items-center justify-center bg-muted/20",z),t[13]=z,t[14]=f):f=t[14];let x;t[15]!==c||t[16]!==n?(x=c??h.jsx(Z,{size:T[n],className:"text-muted-foreground"}),t[15]=c,t[16]=n,t[17]=x):x=t[17];let u;t[18]!==f||t[19]!==x?(u=h.jsx("div",{className:f,children:x}),t[18]=f,t[19]=x,t[20]=u):u=t[20];let b;return t[21]!==d||t[22]!==u||t[23]!==a?(b=h.jsxs("div",{className:a,children:[d,u]}),t[21]=d,t[22]=u,t[23]=a,t[24]=b):b=t[24],b}export{G as I};
@@ -1 +1 @@
1
- import{c as n,l as r,j as i,bI as p}from"./index-Djd6TuLO.js";function c(o){const e=n.c(8);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}export{c as L};
1
+ import{c as n,l as r,j as i,bI as p}from"./index-BwVMeD3q.js";function c(o){const e=n.c(8);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}export{c as L};
@@ -1 +1 @@
1
- import{a,u as f,j as o,S as g,N as p}from"./index-Djd6TuLO.js";import{A as x}from"./auth-entry-D5mX9Y1D.js";import{A as S}from"./auth-split-layout-BmZglzY9.js";import"./input-BNOGUlQT.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function L(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{L as default};
1
+ import{a,u as f,j as o,S as g,N as p}from"./index-BwVMeD3q.js";import{A as x}from"./auth-entry-ChKD6XAl.js";import{A as S}from"./auth-split-layout-CUgDVzOC.js";import"./input-C8pdmexi.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function L(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{L as default};
@@ -1 +1 @@
1
- import{d as x,b as N,c as z,a as D}from"./auth-DEoT60Hp.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};
1
+ import{d as x,b as N,c as z,a as D}from"./auth-CdNUf-u6.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};