decocms 4.22.1 → 4.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/client/assets/{AlertCircle-hfr9WJXe.js → AlertCircle-BWfyWgiw.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DBXurizV.js → ArrowUpRight-h5-lNOU3.js} +1 -1
  3. package/dist/client/assets/{Check-DhEV1E4F.js → Check-B2t3_u8j.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CbuPUNoj.js → CheckCircle-Cd9sCPj_.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BJvvkmIr.js → ChevronDown-CJGVvA9G.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-BP1EbKKr.js → ChevronRight-SxNLyRA0.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CVqQKtsY.js → ChevronUp-Cfv8kwOP.js} +1 -1
  8. package/dist/client/assets/{Circle-BnMDtDeu.js → Circle-CmWJQsR2.js} +1 -1
  9. package/dist/client/assets/{Copy01-Cm6DymEJ.js → Copy01-C_1mrR9P.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-BU3qKzJo.js → DotsVertical-DQ-r-KXk.js} +1 -1
  11. package/dist/client/assets/{Eye-CtocRVwR.js → Eye-Jd91Hda4.js} +1 -1
  12. package/dist/client/assets/{FilterLines-XaejSF3d.js → FilterLines-C7Zdp7-q.js} +1 -1
  13. package/dist/client/assets/{Globe01-CxIEuzOP.js → Globe01-4bI1LBPk.js} +1 -1
  14. package/dist/client/assets/{Globe04-DZ-Pm9xo.js → Globe04-CPnbhr3e.js} +1 -1
  15. package/dist/client/assets/{HardDrive-C2sIA93N.js → HardDrive-WT4IA8YF.js} +1 -1
  16. package/dist/client/assets/{Key01-D8bQG_zp.js → Key01-_0kmrESm.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-C8PdEJOQ.js → LayoutLeft-D_5UU_fl.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-D58rAWvm.js → LinkExternal01-CYx_LjKe.js} +1 -1
  19. package/dist/client/assets/{List-vf0HKUEp.js → List-5nWMXvgZ.js} +1 -1
  20. package/dist/client/assets/{Loading02-DejqZGnO.js → Loading02-D5Q9o2ML.js} +1 -1
  21. package/dist/client/assets/{Monitor01-CodDwsVO.js → Monitor01-EVfMwGgl.js} +1 -1
  22. package/dist/client/assets/{Palette-CgTelSEQ.js → Palette-Cg2Il5Mo.js} +1 -1
  23. package/dist/client/assets/{Play-Dh4_54hC.js → Play-C4pBBuTc.js} +1 -1
  24. package/dist/client/assets/{Plus-DX9uB6jT.js → Plus-Cj9kK9tN.js} +1 -1
  25. package/dist/client/assets/{SearchLg-D0ZqoPSb.js → SearchLg-JSkDDvk4.js} +1 -1
  26. package/dist/client/assets/{SearchMd-DWSBWjan.js → SearchMd-CP9WApAb.js} +1 -1
  27. package/dist/client/assets/{Settings02-CZ9vMUyw.js → Settings02-Bs74lw7T.js} +1 -1
  28. package/dist/client/assets/{Shield01-DvUXE0jO.js → Shield01-DMFwBOtF.js} +1 -1
  29. package/dist/client/assets/{Star01-7qhyucrX.js → Star01-CC3gyOop.js} +1 -1
  30. package/dist/client/assets/{Stars01-DN1mvd59.js → Stars01-DKD-uu49.js} +1 -1
  31. package/dist/client/assets/{Stars02-CFivD_f8.js → Stars02-DGriyPK-.js} +1 -1
  32. package/dist/client/assets/{Sun-CHp4Y1Dq.js → Sun-DszeKWvN.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-sG-IqCt6.js → SwitchHorizontal01-a_i15cCW.js} +1 -1
  34. package/dist/client/assets/{Tool01-DGnLcysQ.js → Tool01-iIXzQIf6.js} +1 -1
  35. package/dist/client/assets/{Trash01-CAEn55T5.js → Trash01-D_xTnQtW.js} +1 -1
  36. package/dist/client/assets/{Upload01-DKn5tYXN.js → Upload01-COCQSA6j.js} +1 -1
  37. package/dist/client/assets/{User01-IYcmkjnc.js → User01-DBHhpCM7.js} +1 -1
  38. package/dist/client/assets/{Users01-0WxprMle.js → Users01-BymojQtX.js} +1 -1
  39. package/dist/client/assets/{Users03-DHP7OUDR.js → Users03-Dnn-6pZq.js} +1 -1
  40. package/dist/client/assets/{X-BWG-JTku.js → X-DY9hR308.js} +1 -1
  41. package/dist/client/assets/{XCircle-C94QFqN0.js → XCircle-DofnF94J.js} +1 -1
  42. package/dist/client/assets/{XClose-CQikaAXa.js → XClose-CmiCfuv_.js} +1 -1
  43. package/dist/client/assets/{Zap-DeHaXJHA.js → Zap-BwbZR_TW.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-DBjTUciD.js → ZapSquare-B7pUKk1h.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-DltoXGbL.js → ZoomOut-B3kimgA9.js} +1 -1
  46. package/dist/client/assets/{access-gate-CaRDuo1w.js → access-gate-BOS773UI.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-Dkbb81MA.js → add-section-modal-Z7yIxDfk.js} +1 -1
  48. package/dist/client/assets/{agent-capabilities-BBWlBKsQ.js → agent-capabilities-DRUNyKs6.js} +1 -1
  49. package/dist/client/assets/{agent-icon-CuxkxUe-.js → agent-icon-K57A0DzY.js} +1 -1
  50. package/dist/client/assets/{agents-list-BiXTIWXs.js → agents-list-DdfrpJA4.js} +1 -1
  51. package/dist/client/assets/{ai-providers-BQfoPc8M.js → ai-providers-ZlX0S41Y.js} +1 -1
  52. package/dist/client/assets/{alert-BU-LVOFa.js → alert-D12iE_jh.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-BLM89Cw2.js → alert-dialog-BuY0O9iQ.js} +1 -1
  54. package/dist/client/assets/{app-editor-BxQrAgCs.js → app-editor-B6oORsVZ.js} +1 -1
  55. package/dist/client/assets/{auth-By4coGKl.js → auth-D1xUzxIp.js} +1 -1
  56. package/dist/client/assets/{auth-catchall-CZA5Hfvu.js → auth-catchall-BTjXPhNI.js} +1 -1
  57. package/dist/client/assets/{auth-entry-HXEUnKNQ.js → auth-entry-Bg2Xb6tT.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-X0hXvUdh.js → auth-split-layout-CzHLXrwa.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-1U_DESs3.js → authenticate-and-persist-oauth-CbQ04gTK.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-BMTjAch1.js → automation-list-row-3xTUT0sz.js} +1 -1
  61. package/dist/client/assets/{automation-runs-C8J9he9y.js → automation-runs-B5QugYRM.js} +1 -1
  62. package/dist/client/assets/{automations-CJ9i_c9k.js → automations-DpLONqEv.js} +1 -1
  63. package/dist/client/assets/{avatar-BeEkEhV9.js → avatar-b6IKYKQs.js} +1 -1
  64. package/dist/client/assets/{badge-EC_FS1hJ.js → badge-DGFEVFje.js} +1 -1
  65. package/dist/client/assets/{block-document-zDNpXx1K.js → block-document-CLPFDPat.js} +1 -1
  66. package/dist/client/assets/{brand-context-BkgDlw8b.js → brand-context-Ba-On5d-.js} +1 -1
  67. package/dist/client/assets/{breadcrumb-UZDdQrwI.js → breadcrumb-8G_CoEun.js} +1 -1
  68. package/dist/client/assets/{buckets-8plr1d-P.js → buckets-pXaevYUV.js} +1 -1
  69. package/dist/client/assets/{bulk-category-panel-76hRbL0c.js → bulk-category-panel-OTFFglhS.js} +1 -1
  70. package/dist/client/assets/{capability-load-error-6mU8gg9S.js → capability-load-error-CEmXpgFG.js} +1 -1
  71. package/dist/client/assets/{card-Cd_UT82w.js → card-dPxA0RCs.js} +1 -1
  72. package/dist/client/assets/{category-editor-CAmRTXwv.js → category-editor-B2KWZmpg.js} +1 -1
  73. package/dist/client/assets/{chat-context-BEYxfvRE.js → chat-context-COllONR2.js} +1 -1
  74. package/dist/client/assets/{checkbox-B7ovMLyf.js → checkbox-5y5TSI8u.js} +1 -1
  75. package/dist/client/assets/{cli-auth-success-LMcjXaku.js → cli-auth-success-DY-Hf-b0.js} +1 -1
  76. package/dist/client/assets/{collection-detail-D-KxR4bK.js → collection-detail-bmPgPvem.js} +1 -1
  77. package/dist/client/assets/{collection-display-button-DmoD5b6J.js → collection-display-button-B4kpKs3o.js} +1 -1
  78. package/dist/client/assets/{collection-search-_ltIvUcU.js → collection-search-SaKzAiAF.js} +1 -1
  79. package/dist/client/assets/{collection-table-wrapper-Cz2kpo8j.js → collection-table-wrapper-CJ-K0eS_.js} +1 -1
  80. package/dist/client/assets/{collection-tabs-ByJ2lCEV.js → collection-tabs-CZb_AY94.js} +1 -1
  81. package/dist/client/assets/{command-D8TSS276.js → command-DDwBnk4S.js} +1 -1
  82. package/dist/client/assets/{commerce-onboarding-BlroNemj.js → commerce-onboarding-Cj6KuavN.js} +1 -1
  83. package/dist/client/assets/{connect-desktop-dialog-D4NpUtWr.js → connect-desktop-dialog-uu1uNLI_.js} +1 -1
  84. package/dist/client/assets/{connection-card-COLJGGyb.js → connection-card-BsaY572f.js} +1 -1
  85. package/dist/client/assets/{connection-detail-IEtqvqDx.js → connection-detail-CVTulNyz.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-Bx2EyqE0.js → connection-form-helpers-CHdocTpm.js} +1 -1
  87. package/dist/client/assets/{connections-CtMf6Y72.js → connections-JYGKhfuk.js} +1 -1
  88. package/dist/client/assets/{decopilot-CphvkEuu.js → decopilot-B6qg2Op3.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-tveLasMO.js → decopilot-sse-pool-D8tR3MTD.js} +1 -1
  90. package/dist/client/assets/{dialog-1PlbGnxl.js → dialog-RRPWwqaQ.js} +1 -1
  91. package/dist/client/assets/{domain-settings-C5LwCZzv.js → domain-settings-CtXa1jf3.js} +1 -1
  92. package/dist/client/assets/{drawer-D7F9J8H1.js → drawer-DJfZ0VmD.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-DgucD0Wn.js → dropdown-menu-DDhytuEd.js} +1 -1
  94. package/dist/client/assets/{empty-state-CKmzL0iR.js → empty-state-CtsFp5nF.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-DXmsDXzN.js → extract-connection-data-DI_Hy6px.js} +1 -1
  96. package/dist/client/assets/{file-explorer-Dw7VTTo2.js → file-explorer-D1P9uacX.js} +1 -1
  97. package/dist/client/assets/{file-type-icon-CjQ-i8Tj.js → file-type-icon-CBM2EyFd.js} +1 -1
  98. package/dist/client/assets/{files-4PjS2DE6.js → files-DdTksaS8.js} +1 -1
  99. package/dist/client/assets/{form-DY5CJF6A.js → form-BylSC3lX.js} +1 -1
  100. package/dist/client/assets/{general-B1x-jxiu.js → general-DGX6oTcl.js} +1 -1
  101. package/dist/client/assets/{github-repo-picker-C928_gR2.js → github-repo-picker-J64_EPEa.js} +1 -1
  102. package/dist/client/assets/{hooks-C98PDXkO.js → hooks-B4JA5-D1.js} +1 -1
  103. package/dist/client/assets/{index-BIvxcsMT.js → index-5AaNNafz.js} +3 -3
  104. package/dist/client/assets/{index-CXhPz6Na.js → index-8heN4TLW.js} +1 -1
  105. package/dist/client/assets/{index-D7F2qNe_.js → index-B3JJ62uP.js} +1 -1
  106. package/dist/client/assets/{index-DBJUANyT.js → index-Bxu03H5X.js} +1 -1
  107. package/dist/client/assets/{index-Co62zZxD.js → index-C7SCPFX7.js} +1 -1
  108. package/dist/client/assets/{index-BeJ1yeue.js → index-CC3_vx1n.js} +1 -1
  109. package/dist/client/assets/{index-DPO0Ar5L.js → index-CZfoQE-0.js} +1 -1
  110. package/dist/client/assets/{index-CCO5X6vK.js → index-DACIolxc.js} +1 -1
  111. package/dist/client/assets/{index-D2iM60An.js → index-DEenRZAo.js} +1 -1
  112. package/dist/client/assets/{index-Du424YAy.js → index-DHu9eqr8.js} +1 -1
  113. package/dist/client/assets/{index-3pMCJF1F.js → index-DKXcf6uO.js} +1 -1
  114. package/dist/client/assets/{index-ChDm4HPz.js → index-DTx-RDv5.js} +1 -1
  115. package/dist/client/assets/{index-BhywTD9L.js → index-FLLcVjP1.js} +26 -26
  116. package/dist/client/assets/{index-BnU8c8Ro.js → index-jUZDCPpZ.js} +1 -1
  117. package/dist/client/assets/{index-redirect-B-jN-fhS.js → index-redirect-KOsw3DwK.js} +1 -1
  118. package/dist/client/assets/{input-C-5bkxwu.js → input-BAz505sI.js} +1 -1
  119. package/dist/client/assets/{integration-icon-DWcR_mMd.js → integration-icon-DtLxCtgy.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-c6uPezaw.js → invite-member-dialog-BDVAAQIu.js} +1 -1
  121. package/dist/client/assets/{label-CuPUA6lI.js → label-BALEyZ3d.js} +1 -1
  122. package/dist/client/assets/{library-tab-B9PQjg9x.js → library-tab-Ds5fpIQF.js} +1 -1
  123. package/dist/client/assets/{login-MwH_nULc.js → login-DPGDZC34.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-BFb5Mr2N.js → mcp-oauth-CXxRaWx9.js} +1 -1
  125. package/dist/client/assets/{members-DMKRSesY.js → members-Bape-XGh.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-B_E6MYgL.js → monaco-editor-qr3YxpgD.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-CDUo4bJg.js → monitoring-stats-row-DHs40KAy.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-CpqRc4mk.js → oauth-callback-DAEXXBSA.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-ai-provider-BEZ67TTl.js → oauth-callback-ai-provider-DGzIC1E3.js} +1 -1
  130. package/dist/client/assets/{onboarding-DY1XdIjP.js → onboarding-BQNZ1j24.js} +1 -1
  131. package/dist/client/assets/{org-install-_qYii8TY.js → org-install-cdxFoHPK.js} +1 -1
  132. package/dist/client/assets/{org-layout-CH6-dACM.js → org-layout-MlmaWu50.js} +1 -1
  133. package/dist/client/assets/{organization-choice-q9IVQdh1.js → organization-choice-CCNhBIVu.js} +1 -1
  134. package/dist/client/assets/{page-seo-form-Dl3vlbYl.js → page-seo-form-B9WRtqtD.js} +1 -1
  135. package/dist/client/assets/page-seo-sheet-Da6XfVR0.js +1 -0
  136. package/dist/client/assets/{popover-BnhIWYgB.js → popover-QpTPPo-c.js} +1 -1
  137. package/dist/client/assets/{post-editor-BzHE5onr.js → post-editor-DrsCS-yJ.js} +1 -1
  138. package/dist/client/assets/{primitives-B_yiwpb8.js → primitives-BjlgEPjn.js} +1 -1
  139. package/dist/client/assets/{profile-q_xefMdi.js → profile-BJ8vtOlo.js} +1 -1
  140. package/dist/client/assets/project-app-view-DseQWbDi.js +1 -0
  141. package/dist/client/assets/record-editor-DbGexVfp.js +1 -0
  142. package/dist/client/assets/registry-DeMcmcPG.js +2 -0
  143. package/dist/client/assets/{registry-layout-CY97jFJ5.js → registry-layout-ksLcOWzv.js} +1 -1
  144. package/dist/client/assets/{require-capability-B4CjdwjM.js → require-capability-C2pr3gWk.js} +1 -1
  145. package/dist/client/assets/{required-auth-layout-B14liizk.js → required-auth-layout-BIsgDBTS.js} +1 -1
  146. package/dist/client/assets/{reset-password-xrDJRi-g.js → reset-password-5xoBMew1.js} +1 -1
  147. package/dist/client/assets/{roles-Bjp9hGjL.js → roles-CTVYbrPK.js} +1 -1
  148. package/dist/client/assets/{scroll-area-CiGoarGm.js → scroll-area-B7g9A0xO.js} +1 -1
  149. package/dist/client/assets/{search-input-CmJ7IuJz.js → search-input-Cn-k-Sr0.js} +1 -1
  150. package/dist/client/assets/{secrets-CuAdzo5u.js → secrets-01-N-EoG.js} +1 -1
  151. package/dist/client/assets/{sections-editor-CDssHvQJ.js → sections-editor-FTn-qJ5h.js} +1 -1
  152. package/dist/client/assets/{select-XC9B8kYb.js → select-DMOL9nTa.js} +1 -1
  153. package/dist/client/assets/{select-model-Bb4qdZ4V.js → select-model-DJ7qLHls.js} +1 -1
  154. package/dist/client/assets/{seo-editor-CBv7uxMZ.js → seo-editor-CJg20m-v.js} +1 -1
  155. package/dist/client/assets/{settings-layout-D8XYD_1r.js → settings-layout-C-lnHpnd.js} +1 -1
  156. package/dist/client/assets/{settings-section-CZoUIOGy.js → settings-section-knuBYiSB.js} +1 -1
  157. package/dist/client/assets/{sheet-DMsXF2a5.js → sheet-B1hdeTXZ.js} +1 -1
  158. package/dist/client/assets/{shell-controls-K02mDLgA.js → shell-controls-DGQEgSmu.js} +1 -1
  159. package/dist/client/assets/{shell-layout-CX1dOlGj.js → shell-layout-BzrEGgvG.js} +1 -1
  160. package/dist/client/assets/{sidebar-BxApc71_.js → sidebar-BZHqZbJ1.js} +1 -1
  161. package/dist/client/assets/{skeleton-CS6PjKeZ.js → skeleton-C1g3sLzc.js} +1 -1
  162. package/dist/client/assets/{sso-DEuC0ilk.js → sso-BRP47dTR.js} +1 -1
  163. package/dist/client/assets/{store-CW4k1iID.js → store-COqKQ01f.js} +1 -1
  164. package/dist/client/assets/store-registry-DkYzijdd.js +2 -0
  165. package/dist/client/assets/{studio-tools-DGpKprde.js → studio-tools-CK3O9apC.js} +1 -1
  166. package/dist/client/assets/{switch-BofmoE_g.js → switch-CTqoacsA.js} +1 -1
  167. package/dist/client/assets/{table-Cbxpe5u6.js → table-D9O3xZPm.js} +1 -1
  168. package/dist/client/assets/{tabs-mPJyea1e.js → tabs-OKKf4LAY.js} +1 -1
  169. package/dist/client/assets/{task-row-BrC9ZQiv.js → task-row-mk4G9x-_.js} +1 -1
  170. package/dist/client/assets/{task-status-MSiVemqS.js → task-status-gvDe4NpG.js} +1 -1
  171. package/dist/client/assets/{textarea-BJ7uXt99.js → textarea-BwMDBTqD.js} +1 -1
  172. package/dist/client/assets/{toggle-group-CRVZDsng.js → toggle-group-CqoGi-AW.js} +1 -1
  173. package/dist/client/assets/{toolbar-BIJJ6VS7.js → toolbar-Do7hu99P.js} +1 -1
  174. package/dist/client/assets/{toolbar-icon-button-sU8FyquD.js → toolbar-icon-button-D8xZWaZ4.js} +1 -1
  175. package/dist/client/assets/{tools-list-D-u8vbQL.js → tools-list-D7bHk7AU.js} +1 -1
  176. package/dist/client/assets/{tooltip-BGL3A5jy.js → tooltip-jwNiafJz.js} +1 -1
  177. package/dist/client/assets/{types-DUULP3Cg.js → types-Z9nbiCM2.js} +1 -1
  178. package/dist/client/assets/{use-ai-providers-CGMLoVgI.js → use-ai-providers-CaFOP2gL.js} +1 -1
  179. package/dist/client/assets/{use-automations-eYq1QdPO.js → use-automations-BYB1tBxg.js} +1 -1
  180. package/dist/client/assets/{use-capability--pStQfW2.js → use-capability-BJgOQ1dM.js} +1 -1
  181. package/dist/client/assets/{use-clock-tick-CF30qkon.js → use-clock-tick-DiuTRa3m.js} +1 -1
  182. package/dist/client/assets/{use-collections-DaNfbX0Q.js → use-collections-D9VCe-RD.js} +1 -1
  183. package/dist/client/assets/{use-connection-rw8Y5wYH.js → use-connection-BsHhz007.js} +1 -1
  184. package/dist/client/assets/{use-copy-CLk0PZni.js → use-copy-BhkveYAE.js} +1 -1
  185. package/dist/client/assets/{use-create-virtual-mcp-B_ygxy0B.js → use-create-virtual-mcp-DL7SpS9p.js} +1 -1
  186. package/dist/client/assets/{use-debounced-autosave-Chq2pCXJ.js → use-debounced-autosave-CP4G_DMm.js} +1 -1
  187. package/dist/client/assets/{use-debounced-value-DarNUEml.js → use-debounced-value-qurf1YAB.js} +1 -1
  188. package/dist/client/assets/{use-decopilot-events-C4jxMeza.js → use-decopilot-events-89JO9cLA.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-GWWQ0NwP.js → use-delete-connection-CPcnCL2Y.js} +1 -1
  190. package/dist/client/assets/{use-file-configs--8K7Ji7z.js → use-file-configs-C37Mzz_w.js} +1 -1
  191. package/dist/client/assets/{use-infinite-scroll-C2oRLreW.js → use-infinite-scroll-Dzaxo4bN.js} +1 -1
  192. package/dist/client/assets/{use-join-requests-n3oXhO9U.js → use-join-requests-CPgcKwb5.js} +1 -1
  193. package/dist/client/assets/{use-mcp-client-DbN0o_29.js → use-mcp-client-DAdRU1cY.js} +1 -1
  194. package/dist/client/assets/{use-mcp-prompts-k9BBdGe-.js → use-mcp-prompts-DbP7dBZf.js} +1 -1
  195. package/dist/client/assets/{use-mcp-tools-BaQM5Bz7.js → use-mcp-tools-s0H1m2Ok.js} +1 -1
  196. package/dist/client/assets/{use-members-CJvmy-r3.js → use-members-BT2wuks0.js} +1 -1
  197. package/dist/client/assets/{use-mobile-CdswWdV_.js → use-mobile-CCjACM_-.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-yzOIB4ca.js → use-navigate-to-agent-CMFaBfX6.js} +1 -1
  199. package/dist/client/assets/{use-org-auth-client-DQwimkN2.js → use-org-auth-client-BSqoqb51.js} +1 -1
  200. package/dist/client/assets/{use-org-sso-DRbO1SYZ.js → use-org-sso-CZi5R7ze.js} +1 -1
  201. package/dist/client/assets/{use-organization-roles-CoVa3Svg.js → use-organization-roles-amhmG5-6.js} +1 -1
  202. package/dist/client/assets/{use-organization-settings-B87409No.js → use-organization-settings-DJLfSIHV.js} +1 -1
  203. package/dist/client/assets/{use-registry-connections-DPvd05bN.js → use-registry-connections-DPtEZCsY.js} +1 -1
  204. package/dist/client/assets/{use-secrets-BfSDmFK4.js → use-secrets-CTWIslZA.js} +1 -1
  205. package/dist/client/assets/{use-status-sounds-DzIbcTbB.js → use-status-sounds-Du5pinlF.js} +1 -1
  206. package/dist/client/assets/{use-view-mode-viB7TTSY.js → use-view-mode-C9H3mYaP.js} +1 -1
  207. package/dist/client/assets/{use-virtual-mcp-st0OLLtk.js → use-virtual-mcp-B0Bq3-Jt.js} +1 -1
  208. package/dist/client/assets/useInfiniteQuery-C7fx2naq.js +1 -0
  209. package/dist/client/assets/useSuspenseInfiniteQuery-DpHAMt5e.js +1 -0
  210. package/dist/client/assets/{useSuspenseQueries-_jBEPc9k.js → useSuspenseQueries-BQ3vTQtS.js} +1 -1
  211. package/dist/client/assets/{variant-calendar-BaDsfBeS.js → variant-calendar-DKaaO6xE.js} +1 -1
  212. package/dist/client/assets/{view-mode-toggle-BekCb9Y2.js → view-mode-toggle-B6q9qYR8.js} +1 -1
  213. package/dist/client/index.html +1 -1
  214. package/dist/server/cli.js +5 -2
  215. package/dist/server/server.js +1 -1
  216. package/package.json +1 -1
  217. package/dist/client/assets/page-seo-sheet-pnb4BjH1.js +0 -1
  218. package/dist/client/assets/project-app-view-BoTA9-Gv.js +0 -1
  219. package/dist/client/assets/record-editor-C6Mdc0zg.js +0 -1
  220. package/dist/client/assets/registry-BRcT-CVu.js +0 -2
  221. package/dist/client/assets/store-registry-C0XIPk1o.js +0 -2
  222. package/dist/client/assets/useInfiniteQuery-Cd0Nyb0J.js +0 -1
  223. package/dist/client/assets/useSuspenseInfiniteQuery-DO0pAzSF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as a,a3 as R}from"./index-BIvxcsMT.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,a3 as R}from"./index-5AaNNafz.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ne(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oe(e,t){if(e==null)return{};var r,n,o=je(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function je(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Me(e,t){return me(e)||ye(e,t)||Ee(e,t)||we()}function Pe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Se(e){var t=Pe(e,"string");return typeof t=="symbol"?t:t+""}function Ee(e,t){if(e){if(typeof e=="string")return re(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ie(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function A(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function F(e){return{}.toString.call(e).includes("Object")}function Te(e){return!Object.keys(e).length}function D(e){return typeof e=="function"}function Ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t){return F(t)||P("changeType"),Object.keys(t).some(function(r){return!Ce(e,r)})&&P("changeField"),t}function Ae(e){D(e)||P("selectorType")}function $e(e){D(e)||F(e)||P("handlerType"),F(e)&&Object.values(e).some(function(t){return!D(t)})&&P("handlersType")}function De(e){e||P("initialIsRequired"),F(e)||P("initialType"),Te(e)&&P("initialContent")}function Ve(e,t){throw new Error(e[t]||e.default)}var xe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},P=A(Ve)(xe),q={changes:Le,selector:Ae,handler:$e,initial:De};function Ne(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q.initial(e),q.handler(t);var r={current:e},n=A(Fe)(r,t),o=A(ze)(r),i=A(q.changes)(e),c=A(qe)(r);function s(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(j){return j};return q.selector(p),p(r.current)}function f(p){Ie(n,o,i,c)(p)}return[s,f]}function qe(e,t){return D(t)?t(e.current):t}function ze(e,t){return e.current=ae(ae({},e.current),t),t}function Fe(e,t,r){return D(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Ue={create:Ne},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function We(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function Be(e){return{}.toString.call(e).includes("Object")}function Ke(e){return e||ue("configIsRequired"),Be(e)||ue("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(ce.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var ce={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -1 +1 @@
1
- import{c as k,j as n,r as A,D as J,m as xe,l as Q,i as le,ag as Z,t as K,K as te,k as se,B as Y,d as nt,W as it,E as ot,a as rt,b as lt,u as at}from"./index-BIvxcsMT.js";import{u as ge}from"./use-mobile-CdswWdV_.js";import{u as ct}from"./useSuspenseQueries-_jBEPc9k.js";import{u as ae,m as dt}from"./use-mcp-client-DbN0o_29.js";import{i as mt,a as ut,S as ft}from"./constants-C8_Swa4x.js";import{u as pt,b as ht,v as xt,a as gt}from"./use-virtual-mcp-st0OLLtk.js";import{i as bt}from"./Check-DhEV1E4F.js";import{b as Pe,a as Se}from"./ZoomOut-DltoXGbL.js";import{i as yt,A as ce,t as jt,ae as vt,H as Nt,l as wt}from"./agent-icon-CuxkxUe-.js";import{s as be}from"./Plus-DX9uB6jT.js";import{i as ye}from"./X-BWG-JTku.js";import{p as St}from"./index-DPO0Ar5L.js";import{b as Me,c as oe,K as Ee,P as ze,D as Le,d as _t,S as Ct,v as It,g as Tt,h as kt,i as $t,f as At,e as Pt,n as Mt,C as re,L as Et,k as zt}from"./library-tab-B9PQjg9x.js";import{f as Lt,d as Ot}from"./tab-id-CLpu897Q.js";import{b as Dt}from"./chat-context-BEYxfvRE.js";import{N as Ht}from"./decopilot-CphvkEuu.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-BBWlBKsQ.js";import{a as Oe,b as De,o as Vt}from"./use-organization-settings-B87409No.js";import{c as je,b as Kt,h as Wt}from"./shell-layout-CX1dOlGj.js";import{I as He}from"./input-C-5bkxwu.js";import{S as qt,t as ve,P as Gt,j as Qt,s as Jt,g as Xt}from"./scroll-area-CiGoarGm.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-DMsXF2a5.js";import{S as V}from"./skeleton-CS6PjKeZ.js";import{t as Re}from"./ChevronDown-BJvvkmIr.js";import{g as Fe,M as ns}from"./types-DUULP3Cg.js";import{I as Ue}from"./integration-icon-DWcR_mMd.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-XC9B8kYb.js";import{T as as}from"./textarea-BJ7uXt99.js";import{u as Be}from"./studio-tools-DGpKprde.js";import{a as cs}from"./use-mcp-tools-BaQM5Bz7.js";import{i as ds}from"./XCircle-C94QFqN0.js";import{g as ms}from"./use-mcp-prompts-k9BBdGe-.js";import{b as us,w as fs}from"./hooks-C98PDXkO.js";import{b as ps,d as hs,c as xs,D as gs,a as bs}from"./dropdown-menu-DgucD0Wn.js";import{s as ys}from"./Trash01-CAEn55T5.js";import{a as js,u as vs}from"./use-ai-providers-CGMLoVgI.js";import{u as Ns}from"./connect-desktop-dialog-D4NpUtWr.js";import{T as ws}from"./toolbar-BIJJ6VS7.js";import"./auth-By4coGKl.js";import"./use-collections-DaNfbX0Q.js";import"./AlertCircle-hfr9WJXe.js";import"./Tool01-DGnLcysQ.js";import"./SwitchHorizontal01-sG-IqCt6.js";import"./Settings02-CZ9vMUyw.js";import"./ArrowUpRight-DBXurizV.js";import"./ZapSquare-DBjTUciD.js";import"./Users03-DHP7OUDR.js";import"./CheckCircle-CbuPUNoj.js";import"./ChevronRight-BP1EbKKr.js";import"./ChevronUp-CVqQKtsY.js";import"./Circle-BnMDtDeu.js";import"./Stars02-CFivD_f8.js";import"./Loading02-DejqZGnO.js";import"./Copy01-Cm6DymEJ.js";import"./DotsVertical-BU3qKzJo.js";import"./Globe01-CxIEuzOP.js";import"./Eye-CtocRVwR.js";import"./FilterLines-XaejSF3d.js";import"./Star01-7qhyucrX.js";import"./Globe04-DZ-Pm9xo.js";import"./HardDrive-C2sIA93N.js";import"./Key01-D8bQG_zp.js";import"./LayoutLeft-C8PdEJOQ.js";import"./LinkExternal01-D58rAWvm.js";import"./List-vf0HKUEp.js";import"./Monitor01-CodDwsVO.js";import"./Sun-CHp4Y1Dq.js";import"./Palette-CgTelSEQ.js";import"./Play-Dh4_54hC.js";import"./SearchLg-D0ZqoPSb.js";import"./SearchMd-DWSBWjan.js";import"./Shield01-DvUXE0jO.js";import"./Stars01-DN1mvd59.js";import"./Upload01-DKn5tYXN.js";import"./User01-IYcmkjnc.js";import"./Users01-0WxprMle.js";import"./XClose-CQikaAXa.js";import"./Zap-DeHaXJHA.js";import"./alert-dialog-BLM89Cw2.js";import"./dialog-1PlbGnxl.js";import"./file-type-icon-CjQ-i8Tj.js";import"./use-debounced-value-DarNUEml.js";import"./popover-BnhIWYgB.js";import"./tooltip-BGL3A5jy.js";import"./index-CXhPz6Na.js";import"./drawer-D7F9J8H1.js";import"./collection-search-_ltIvUcU.js";import"./form-DY5CJF6A.js";import"./label-CuPUA6lI.js";import"./tabs-mPJyea1e.js";import"./toggle-group-CRVZDsng.js";import"./command-D8TSS276.js";import"./index-Du424YAy.js";import"./useInfiniteQuery-Cd0Nyb0J.js";import"./use-infinite-scroll-C2oRLreW.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-C4jxMeza.js";import"./decopilot-sse-pool-tveLasMO.js";import"./backoff-CrEUbyZT.js";import"./checkbox-B7ovMLyf.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-BeEkEhV9.js";import"./settings-section-CZoUIOGy.js";import"./card-Cd_UT82w.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-COLJGGyb.js";import"./use-registry-connections-DPvd05bN.js";import"./use-connection-rw8Y5wYH.js";import"./extract-connection-data-DXmsDXzN.js";import"./collection-tabs-ByJ2lCEV.js";import"./badge-EC_FS1hJ.js";import"./connection-form-helpers-Bx2EyqE0.js";import"./authenticate-and-persist-oauth-1U_DESs3.js";import"./mcp-oauth-BFb5Mr2N.js";import"./useSuspenseInfiniteQuery-DO0pAzSF.js";import"./required-auth-layout-B14liizk.js";import"./use-org-sso-DRbO1SYZ.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CLk0PZni.js";import"./content-blocks-o63cs2vh.js";import"./use-clock-tick-CF30qkon.js";import"./use-navigate-to-agent-yzOIB4ca.js";import"./delay-CnY5UFtP.js";function Ve(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(Ss,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function Ss(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(as,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=g=>r(g==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(is,{className:"h-7 text-xs",children:n.jsx(os,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(rs,{children:[n.jsx(_e,{value:"true",children:"true"}),n.jsx(_e,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(ls,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(He,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function _s(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=A.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Zt,{children:"Manage home"}),d=n.jsx(Yt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(yt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=g=>r(g.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(es,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(He,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(tn,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx(A.Suspense,{fallback:u,children:n.jsx(Is,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(ts,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(ss,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function Cs(t){const e=k.c(32),{org:s}=J(),o=Oe();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=De(),d=ht(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const g=p>=ne;let b;e[10]!==g||e[11]!==f||e[12]!==a?(b=_=>f(_)||g?Promise.resolve():a.apply(C=>C.includes(_)?null:[...C,_]),e[10]=g,e[11]=f,e[12]=a,e[13]=b):b=e[13];const y=b;let N;e[14]!==a?(N=_=>a.apply(C=>C.filter(I=>I!==_)),e[14]=a,e[15]=N):N=e[15];const v=N;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const x=j;let w;e[18]!==d||e[19]!==g||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,C)=>{await d.update.mutateAsync({id:_.id,data:{metadata:C}}),!f(_.id)&&!g&&await a.apply(I=>I.includes(_.id)?null:[...I,_.id]),await c()},e[18]=d,e[19]=g,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let T;return e[24]!==y||e[25]!==g||e[26]!==r||e[27]!==f||e[28]!==v||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:v,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=v,e[29]=x,e[30]=S,e[31]=T):T=e[31],T}function Is(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=pt(o);let r;e[1]!==i?(r=new Set(i.map(Ps)),e[1]=i,e[2]=r):r=e[2];const a=Cs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const g=new Map(i.map(As));d=s.trim().toLowerCase();const b=v=>!d||v.title?.toLowerCase().includes(d);l=a.homeIds.map(v=>g.get(v)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=v=>!a.isOnHome(v.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(v=>!y.has(v.id)).filter(N).filter(b).sort(Ts),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Ms,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(Ls,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function Ts(t,e){return(t.title??"").localeCompare(e.title??"")}function ks(t){return t.id&&!mt(t.id)}function $s(t){return!!t}function As(t){return[t.id,t]}function Ps(t){return t.id}function Ke(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Ms(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:$t},e[1]=r):r=e[1];const a=Me(oe(ze,i),oe(Ee,r));let d;e[2]!==s?(d=p=>{const{active:h,over:g}=p;if(!g||h.id===g.id)return;const b=s.homeIds,y=b.indexOf(h.id),N=b.indexOf(g.id);y===-1||N===-1||s.reorder(At([...b],y,N)).catch(zs)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ke,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Le,{sensors:a,collisionDetection:_t,onDragEnd:l,children:n.jsx(Ct,{items:o.map(Es),strategy:It,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(Ds,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function Es(t){return t.id}function zs(){return K.error("Couldn't reorder home — please try again.")}function Ls(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=A.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ke,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Fs,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a(Os),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function Os(t){return t+20}function We(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function Ds(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=A.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=Tt(a),p=We(s)||"Quick access";let h;e[2]!==c?(h=kt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const g=f?.5:void 0,b=f?100:void 0;let y;e[4]!==h||e[5]!==g||e[6]!==b||e[7]!==u?(y={transform:h,transition:u,opacity:g,zIndex:b},e[4]=h,e[5]=g,e[6]=b,e[7]=u,e[8]=y):y=e[8];const N=y,v=f&&"shadow-lg";let j;e[9]!==v?(j=Q("rounded-lg border border-border bg-card",v),e[9]=v,e[10]=j):j=e[10];const x=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pe,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==x?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":x,children:w}),e[12]=d,e[13]=l,e[14]=x,e[15]=S):S=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>r(Rs),e[16]=T):T=e[16];const _=s.title??s.id;let C;e[17]!==s.icon||e[18]!==_?(C=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=C):C=e[19];const I=s.title??s.id;let P;e[20]!==I?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=P):P=e[21];let E;e[22]!==p?(E=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=E):E=e[23];let z;e[24]!==P||e[25]!==E?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,E]}),e[24]=P,e[25]=E,e[26]=z):z=e[26];const H=i&&"rotate-180";let L;e[27]!==H?(L=Q("shrink-0 text-muted-foreground transition-transform",H),e[27]=H,e[28]=L):L=e[28];let D;e[29]!==L?(D=n.jsx(Re,{size:16,className:L}),e[29]=L,e[30]=D):D=e[30];let U;e[31]!==i||e[32]!==C||e[33]!==z||e[34]!==D?(U=n.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[C,z,D]}),e[31]=i,e[32]=C,e[33]=z,e[34]=D,e[35]=U):U=e[35];let $;e[36]!==s.id||e[37]!==o?($=()=>o.removeAgent(s.id).catch(Hs),e[36]=s.id,e[37]=o,e[38]=$):$=e[38];const R=`Remove ${s.title??s.id} from home`;let O;e[39]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(ye,{size:14}),e[39]=O):O=e[39];let M;e[40]!==$||e[41]!==R?(M=n.jsx("button",{type:"button",onClick:$,"aria-label":R,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:O}),e[40]=$,e[41]=R,e[42]=M):M=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==M?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,M]}),e[43]=S,e[44]=U,e[45]=M,e[46]=F):F=e[46];let B;e[47]!==s||e[48]!==i||e[49]!==o?(B=i&&n.jsx(qe,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=B):B=e[50];let W;return e[51]!==m||e[52]!==N||e[53]!==F||e[54]!==B||e[55]!==j?(W=n.jsxs("div",{ref:m,style:N,className:j,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=j,e[56]=W):W=e[56],W}function Hs(){return K.error("Couldn't remove from home — please try again.")}function Rs(t){return!t}function Fs({agent:t,home:e}){const[s,o]=A.useState(!1),[i,r]=A.useState(!1),a=We(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{K.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(Re,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(be,{size:14})})]}),s&&n.jsx(qe,{agent:t,home:e})]})}function qe(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(Us).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Vs,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Bs,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx(A.Suspense,{fallback:u,children:n.jsx(Qs,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function Us(t){return t.connection_id}function Bs(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(V,{className:"h-8 w-full"}),n.jsx(V,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Vs({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Be(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const g=Fe(h._meta);return g?[{name:h.name,description:h.description,resourceUri:g,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(qs,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Gs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function Ge(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Ks(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Ws(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function qs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=A.useState(!1),[d,l]=A.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=A.useState(()=>Ks(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const g=Z(t.metadata?.ui),b=i.tileId?g.filter(N=>N.tileId!==i.tileId):g.filter(N=>N!==i),y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,y),l(!1)}catch(g){console.error("[home-tiles] failed to remove tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let g;if(m&&o.inputSchema?.properties){const v=Ge(c,o.inputSchema.properties);if(!v){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(v).length>0&&(g=v)}const y=Z(t.metadata?.ui).map(v=>(i.tileId?v.tileId===i.tileId:v===i)?{...v,toolInput:g}:v),N={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,N),l(!1)}catch(g){console.error("[home-tiles] failed to save tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Ws(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:ve(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(g=>!g),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(jt,{size:14})}),n.jsx(Ne,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(g,b)=>u(y=>({...y,[g]:b}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Gs({agent:t,home:e,connection:s,tool:o}){const[i,r]=A.useState(!1),[a,d]=A.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=A.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const y=Ge(m,o.inputSchema.properties);if(!y){K.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(y).length>0&&(p=y)}const g=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:g}};await e.saveAgentMetadata(t,b),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),K.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:ve(o.name)}),n.jsx(Ne,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(g=>({...g,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function Ne(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(vt,{size:14}):n.jsx(be,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Qs(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:x}=await d.listPrompts();return x.map(Ys)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=je(r.slug);let g,b;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let x;e[17]!==s.id?(x=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=x):x=e[18],g=h.prompts.filter(x).map(Zs);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],b=[...w];for(const S of g)b.some(T=>T.name===S.name)||b.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=g,e[16]=b}else g=e[15],b=e[16];if(f&&g.length===0){let x;return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]}),e[21]=x):x=e[21],x}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(b.length===0)return null;let y;e[22]!==i||e[23]!==b?(y=i??b.map(Xs),e[22]=i,e[23]=b,e[24]=y):y=e[24];let N;e[25]!==y?(N=new Set(y),e[25]=y,e[26]=N):N=e[26];const v=N;let j;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==v?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:b.map(x=>n.jsx(en,{agent:s,home:o,prompt:x,allPromptNames:b.map(Js),isPinned:v.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=v,e[31]=j):j=e[31],j}function Js(t){return t.name}function Xs(t){return t.name}function Zs(t){return{name:t.promptName,title:t.title,description:t.description}}function Ys(t){return{name:t.name,title:t.title,description:t.description}}function en({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=A.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),K.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??ve(s.name)}),n.jsx(Ne,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function tn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},sn)}),t[0]=e):e=t[0],e}function sn(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(V,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Qe=`home-board.layout.v${ee}`;function Je(t){return`home-board.layout.v${ee}.${t}`}const Xe={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Xe:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function nn(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function on(t){try{const e=localStorage.getItem(Je(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Ce(t,e){try{localStorage.setItem(Je(t),JSON.stringify(e))}catch{}}async function Ie(t,e){if(!(await fetch(`/api/${t}/kv/${Qe}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function rn(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=on(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const y=await fetch(`/api/${t}/kv/${Qe}`);if(y.status===404)return a&&nn(a)?(await Ie(t,a),a):Xe;if(!y.ok)throw new Error("Failed to load board layout");const N=await y.json(),v=fe(N.value);return Ce(t,v),v},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:y=>Ie(t,y)},e[11]=t,e[12]=u):u=e[12];const f=nt(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=y=>{Ce(t,y),s.setQueryData(i,y),f.mutate(y)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let g;e[18]!==m?(g=fe(m),e[18]=m,e[19]=g):g=e[19];let b;return e[20]!==c||e[21]!==h||e[22]!==g?(b={layout:g,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}const Ze=A.createContext(null);function ln(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=rn(o.slug),[r,a]=A.useState(!1),[d,l]=A.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,g=r&&d!==null,b=g?d:i.layout;let y;e[6]!==d||e[7]!==g||e[8]!==i.layout?(y=g?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=g,e[8]=i.layout,e[9]=y):y=e[9];const N=y;let v;e[10]!==r||e[11]!==i?(v=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=v):v=e[12];const j=v;let x;e[13]!==j||e[14]!==c||e[15]!==N||e[16]!==r||e[17]!==b||e[18]!==h||e[19]!==i.isLoading?(x={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:N,layout:b,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=N,e[16]=r,e[17]=b,e[18]=h,e[19]=i.isLoading,e[20]=x):x=e[20];let w;return e[21]!==s||e[22]!==x?(w=n.jsx(Ze.Provider,{value:x,children:s}),e[21]=s,e[22]=x,e[23]=w):w=e[23],w}function Ye(){const t=A.useContext(Ze);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function an({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=us(),{setTaskId:r}=Kt(),[a,d]=A.useState(null),[l,m]=A.useState(!1),c=A.useRef(!1),u=async(b,y)=>{if(!o){K.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const N=await ms(o,b.name,y),v={type:"doc",content:[{type:"paragraph",content:[Qt({id:b.name,name:Jt(b.name,Xt(b._meta)),metadata:N.messages,char:"/",kind:"prompt",args:y}),{type:"text",text:" "}]}]},j=crypto.randomUUID();fs(sessionStorage,s,j,{tiptapDoc:v}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(N){console.error("[start-thread-from-prompt] failed",N),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async b=>{if(!c.current){if(b.arguments&&b.arguments.length>0){d(b);return}await u(b)}},p=async b=>{if(!a)return;const y=a;d(null),await u(y,b)};return{start:f,startBlank:async b=>{if(!c.current){c.current=!0,m(!0);try{const y=crypto.randomUUID();await i({id:y,virtual_mcp_id:t}),r(y,t,b?.main?{main:b.main}:void 0)}catch(y){console.error("[start-thread-from-prompt] startBlank failed",y),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Gt,{prompt:a,setPrompt:b=>d(b),onSubmit:p}),dialogPrompt:a,starting:l}}const q=4,G=100,Te=12,cn=5,dn={w:2,h:2};class pe extends A.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(it,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function mn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=A.useRef(null),[c,u]=A.useState(null),[f,p]=A.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const g=Me(oe(ze,h),oe(Ee)),b=s.reduce(un,0),y=o?Math.max(b+2,4):Math.max(b,1);let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{const $=m.current?.getBoundingClientRect();return $?{cellWidth:$.width/q,cellHeight:G}:null},e[1]=N):N=e[1];const v=N;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=$=>{u(String($.active.id)),p(v())},e[2]=j):j=e[2];const x=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??v();if(u(null),p(null),!O||O.cellWidth<=0)return;const M=s.find(W=>W.id===R);if(!M)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:M.x+F,y:M.y+B})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let $;if(e[7]!==i||e[8]!==s){let O;e[10]!==i?(O=M=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(M)})},M.id),e[10]=i,e[11]=O):O=e[11],$=s.map(O),e[7]=i,e[8]=s,e[9]=$}else $=e[9];let R;return e[12]!==$?(R=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:$}),e[12]=$,e[13]=R):R=e[13],R}let T,_,C,I,P,E,z,H,L;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==y){const $=c?s.find(X=>X.id===c):null;_=Le,H=g,L=x,C=S;const R=y*G,O=o?G*4:G;let M;e[33]!==R||e[34]!==O?(M={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=M):M=e[35];let F;e[36]!==o||e[37]!==s||e[38]!==y?(F=o&&n.jsx(fn,{rows:y,tiles:s}),e[36]=o,e[37]=s,e[38]=y,e[39]=F):F=e[39];let B;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(hn,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],B=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=B}else B=e[46];e[53]!==M||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:M,children:[F,B]}),e[53]=M,e[54]=F,e[55]=B,e[56]=I):I=e[56],T=Pt,P=null;const W=$&&f?$.w*f.cellWidth-Te:void 0,de=$&&f?$.h*f.cellHeight-Te:void 0;e[57]!==W||e[58]!==de?(E={width:W,height:de},e[57]=W,e[58]=de,e[59]=E):E=e[59],z=$&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i($)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=g,e[22]=s,e[23]=y,e[24]=T,e[25]=_,e[26]=C,e[27]=I,e[28]=P,e[29]=E,e[30]=z,e[31]=H,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],E=e[29],z=e[30],H=e[31],L=e[32];let D;e[60]!==T||e[61]!==P||e[62]!==E||e[63]!==z?(D=n.jsx(T,{dropAnimation:P,style:E,children:z}),e[60]=T,e[61]=P,e[62]=E,e[63]=z,e[64]=D):D=e[64];let U;return e[65]!==_||e[66]!==C||e[67]!==I||e[68]!==D||e[69]!==H||e[70]!==L?(U=n.jsxs(_,{sensors:H,onDragStart:L,onDragEnd:C,children:[I,D]}),e[65]=_,e[66]=C,e[67]=I,e[68]=D,e[69]=H,e[70]=L,e[71]=U):U=e[71],U}function un(t,e){return Math.max(t,e.y+e.h)}function fn(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<q;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(pn)}),e[5]=a,e[6]=d):d=e[6],d}function pn(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/q*100}%`,top:t.y*G,width:`${1/q*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function hn(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Mt(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,v=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=N&&"opacity-30";let x;e[3]!==v||e[4]!==j?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",v,j),e[3]=v,e[4]=j,e[5]=x):x=e[5];let w;e[6]!==y||e[7]!==h||e[8]!==b||e[9]!==g?(w={left:h,top:b,width:g,height:y},e[6]=y,e[7]=h,e[8]=b,e[9]=g,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==S?(T=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=T):T=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(Pe,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(xn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let C;e[20]!==d?(C=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=C):C=e[21];let I;e[22]!==C||e[23]!==T||e[24]!==_?(I=n.jsxs("div",{className:T,children:[_,C]}),e[22]=C,e[23]=T,e[24]=_,e[25]=I):I=e[25];let P;return e[26]!==c||e[27]!==I||e[28]!==x||e[29]!==w?(P=n.jsx("div",{ref:c,className:x,style:w,children:I}),e[26]=c,e[27]=I,e[28]=x,e[29]=w,e[30]=P):P=e[30],P}function xn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=A.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ps,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(Nt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=b=>{o(s.id,b),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(gn,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(hs,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ys,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(xs,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(gs,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let g;return e[17]!==r||e[18]!==h?(g=n.jsxs(bs,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=g):g=e[19],g}function gn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=A.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${q}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:cn},(b,y)=>Array.from({length:q},(N,v)=>{const j=v+1,x=y+1,w=j<i||x<r,S=j<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${x}`,onPointerEnter:()=>d({w:j,h:x}),onClick:()=>o({w:j,h:x}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${x}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let g;return e[16]!==u||e[17]!==h?(g=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=g):g=e[18],g}function bn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=q-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)bn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(q,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(q-s,t)),i=Math.max(0,e);return{x:o,y:i}}function yn(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function jn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ye();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let N;e[7]!==a?(N=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=N):N=e[8];const v=t.filter(N);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of v){const x=s.tiles[j.id];if(!x)continue;const w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:j.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const j of v){if(l.some(C=>C.id===j.id))continue;const x=j.defaultSize??dn,w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:j.id,x:_.x,y:_.y,w:S,h:T,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(vn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,v)=>{const j={};for(const x of N)j[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:j,hidden:v.filter(x=>c.has(x))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(N,v)=>{const j=l.find(S=>S.id===N);if(!j)return;const x=ue(v.x,v.y,j.w);if(x.x===j.x&&x.y===j.y)return;const w=yn(l,N,x);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let g;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(g=(N,v)=>{const j=l.find(I=>I.id===N);if(!j)return;const x=d.get(N),{w,h:S}=me(v.w,v.h,x);if(w===j.w&&S===j.h)return;const T={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(I=>I.id!==N),C=[T];for(const I of _){const P=he(C,I.w,I.h);C.push({...I,x:P.x,y:P.y})}f(C,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=g):g=e[24];let b;e[25]!==f||e[26]!==s||e[27]!==l?(b=N=>{const v=l.filter(j=>j.id!==N);f(v,Array.from(new Set([...s.hidden,N])))},e[25]=f,e[26]=s,e[27]=l,e[28]=b):b=e[28];let y;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==g||e[33]!==b?(y={snapshot:p,isLoading:o,moveTile:h,resizeTile:g,hideTile:b},e[29]=o,e[30]=p,e[31]=h,e[32]=g,e[33]=b,e[34]=y):y=e[34],y}function vn(t){return t.id}const Nn={w:2,h:4},wn={w:1,h:2},Sn={w:1,h:1};function _n(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function Cn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function In(t){return t.promptName?t.agentName:t.description}function Tn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function et(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=dt({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=cs(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Fe(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?Lt(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function we(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=an(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(Tn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function kn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=we(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let g;e[12]!==s?(g=In(s),e[12]=s,e[13]=g):g=e[13];let b;e[14]!==g?(b=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==h?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,b]}),e[16]=b,e[17]=h,e[18]=y):y=e[18];let N;e[19]!==o?(N=!o&&n.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=N):N=e[20];let v;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(v=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,y,N]}),e[21]=a,e[22]=d,e[23]=y,e[24]=N,e[25]=l,e[26]=f,e[27]=p,e[28]=v):v=e[28];let j;return e[29]!==r||e[30]!==v?(j=n.jsxs(n.Fragment,{children:[v,r]}),e[29]=r,e[30]=v,e[31]=j):j=e[31],j}function $n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},An)}),t[0]=e):e=t[0],e}function An(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(V,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Pn(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=we(s.agentId),u=o.filter(Mn),f=et(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const g="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(zn,{}),e[5]=b):b=e[5];let y;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(y=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx(A.Suspense,{fallback:b,children:n.jsx(En,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=y):y=e[9];const N=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(x=>n.jsx("button",{type:"button",onClick:()=>d(x),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:x.title})},x.promptName))});let v;e[10]!==y||e[11]!==N?(v=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=v):v=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==v?(j=n.jsxs("div",{className:p,children:[h,v,m]}),e[13]=m,e[14]=h,e[15]=v,e[16]=j):j=e[16],j}function Mn(t){return!!t.promptName}function En(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(ns,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function zn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ln(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(V,{className:"h-3 w-3/4"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function On(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=we(s.agentId),m=o.filter(Dn),c=et(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const g=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(y=>n.jsx("button",{type:"button",onClick:()=>!i&&r(y),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:y.title})},y.promptName))});let b;return e[6]!==d||e[7]!==h||e[8]!==g?(b=n.jsxs("div",{className:u,children:[h,g,d]}),e[6]=d,e[7]=h,e[8]=g,e[9]=b):b=e[9],b}function Dn(t){return!!t.promptName}function tt({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=je(e.slug),r=Oe()?.ids??[],a=new Set(r),d=De(),l=Be(),m=xe(),c=new Set(i.map(x=>x.agentId)),u=new Map;for(const x of o){const w=u.get(x.agentId);w?w.push(x):u.set(x.agentId,[x])}const f=o.filter(x=>!c.has(x.agentId)),p=[...i.map(x=>({kind:"tile",id:Cn(x),data:x})),...f.map(x=>({kind:"prompt",id:_n(x),data:x}))],h=new Map(p.map(x=>[x.id,x])),g=jn(p.map(x=>({id:x.id,defaultSize:x.kind==="tile"?Nn:Sn,minSize:x.kind==="tile"?wn:void 0,pinned:a.has(x.data.agentId)}))),b=x=>{d.apply(w=>w.filter(S=>S!==x)).catch(()=>K.error("Couldn't remove from home — please try again."))},y=async x=>{if(i.filter(S=>S.agentId===x.agentId).length<=1){b(x.agentId);return}try{const T=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:x.agentId})).item;if(!T)throw new Error("Agent not found");const _=Z(T.metadata?.ui),C=x.tileId?_.filter(I=>I.tileId!==x.tileId):_.filter(I=>I.connectionId!==x.connectionId||I.resourceUri!==x.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:x.agentId,data:{metadata:{...T.metadata??{},ui:{...T.metadata?.ui??{},homeTile:null,homeTiles:C}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{K.error("Couldn't remove tile — please try again.")}},N=x=>{const w=h.get(x);if(w){if(!a.has(w.data.agentId)){g.hideTile(x);return}w.kind==="tile"?y(w.data):b(w.data.agentId)}},v=x=>{const w=h.get(x.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(ot,{fallback:n.jsx(On,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx(A.Suspense,{fallback:n.jsx(Ln,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(Pn,{tile:w.data,prompts:S,isEditMode:t,tileWidth:x.w})})})}return n.jsx(kn,{entry:w.data,isEditMode:t})};return s||g.isLoading?n.jsx($n,{}):g.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(mn,{tiles:g.snapshot.visible,isEditMode:t,renderTile:v,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Hn(t){const e=k.c(2),{prompts:s,tiles:o}=je(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const ke=420,$e=305;function st(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:$e}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:$e}})]}),t[3]=i):i=t[3],i}function Ae(){const t=k.c(33),{data:e}=rt.useSession(),{org:s}=J(),o=ge(),i=Ns(),{selectedVirtualMcp:r}=Dt();let a;t[0]!==s.id?(a=ut(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Wt(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:ft,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=js(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Vt(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=xt(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let g;t[17]!==f||t[18]!==p||t[19]!==h?(g={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=g):g=t[20],ct(g);const b=vs(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:v,isInitialFreeCredit:j,balanceDollars:x,hasOnlyDecoProvider:w}=Ft(),{hasVisibleTiles:S}=Hn(s.slug),T=Ut(y?.metadata);if(b.length===0&&!(T&&Bt(i))){let D;return t[21]===Symbol.for("react.memo_cache_sentinel")?(D=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(Ht,{})})}),t[21]=D):D=t[21],D}let C;t[22]!==e?.user?.name?(C=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=C):C=t[23];const I=C,P=N&&j&&x!=null,E=N&&v&&w;let z;t[24]!==x||t[25]!==P||t[26]!==E?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):E?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=E,t[27]=z):z=t[27];const H=z;let L;return t[28]!==H||t[29]!==S||t[30]!==o||t[31]!==I?(L=n.jsx(ln,{children:o?n.jsx(Rn,{eyebrow:H,userName:I}):n.jsx(Fn,{eyebrow:H,userName:I,hasVisibleTiles:S})}),t[28]=H,t[29]=S,t[30]=o,t[31]=I,t[32]=L):L=t[32],L}function Rn(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(st,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(re.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(tt,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function Fn(t){const e=k.c(54),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ye(),[c,u]=A.useState(!1),f=lt();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={strict:!1},e[0]=p):p=e[0];const{main:h}=at(p);let g;e[1]!==h?(g=h?Ot(h):null,e[1]=h,e[2]=g):g=e[2];const b=g,y=h==="files"||!!b;let N;e[3]!==f?(N=B=>f({to:".",search:W=>({...W,main:B}),replace:!0}),e[3]=f,e[4]=N):N=e[4];const v=N;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={kind:"component",Component:Se},e[5]=j):j=e[5];let x;e[6]!==y||e[7]!==v?(x=()=>v(y?void 0:"files"),e[6]=y,e[7]=v,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:j,active:y,onClick:x}),e[9]=y,e[10]=x,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),e[12]=S):S=e[12];let T;e[13]!==l||e[14]!==a||e[15]!==m||e[16]!==r||e[17]!==d?(T=n.jsx(Un,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:S}),e[13]=l,e[14]=a,e[15]=m,e[16]=r,e[17]=d,e[18]=T):T=e[18];let _;e[19]!==w||e[20]!==T?(_=n.jsxs(ws.Right,{children:[w,T]}),e[19]=w,e[20]=T,e[21]=_):_=e[21];let C;e[22]!==c?(C=n.jsx(_s,{open:c,onOpenChange:u}),e[22]=c,e[23]=C):C=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(st,{}),e[24]=I):I=e[24];const P=i||r?"pt-32":"flex-1 justify-center";let E;e[25]!==P?(E=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=E):E=e[26];let z;e[27]!==s?(z=s&&n.jsx("div",{className:"mb-4",children:s}),e[27]=s,e[28]=z):z=e[28];let H;e[29]!==o?(H=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[29]=o,e[30]=H):H=e[30];let L;e[31]!==z||e[32]!==H?(L=n.jsxs("div",{className:"text-center mb-10",children:[z,H]}),e[31]=z,e[32]=H,e[33]=L):L=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsxs("div",{className:"relative w-full",children:[n.jsx(Bn,{}),n.jsx(re.Input,{showConnectionsBanner:!0})]}),e[34]=D):D=e[34];let U;e[35]!==L?(U=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[L,D]}),e[35]=L,e[36]=U):U=e[36];let $;e[37]!==r?($=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(tt,{isEditMode:r})}),e[37]=r,e[38]=$):$=e[38];let R;e[39]!==E||e[40]!==U||e[41]!==$?(R=n.jsxs("div",{className:"flex-1 min-w-0 relative flex flex-col",children:[I,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:E,children:[U,$]})})]}),e[39]=E,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==v?(O=y&&n.jsxs("div",{className:"w-[45%] max-w-[680px] min-w-[380px] shrink-0 flex flex-col min-h-0 border-l border-border bg-background",children:[n.jsxs("div",{className:"h-10 shrink-0 flex items-center justify-between px-3 border-b border-border",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[n.jsx(Se,{size:16}),"Library"]}),n.jsx("button",{type:"button",onClick:()=>v(void 0),"aria-label":"Close Library panel",className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:n.jsx(ye,{size:16})})]}),n.jsx("div",{className:"flex-1 min-h-0",children:b?n.jsx(Et,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=v,e[46]=O):O=e[46];let M;e[47]!==R||e[48]!==O?(M=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=M):M=e[49];let F;return e[50]!==C||e[51]!==M||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,M]}),e[50]=C,e[51]=M,e[52]=_,e[53]=F):F=e[53],F}function Un(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(be,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ye,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(bt,{size:14}),e[6]=g):g=e[6];let b;e[7]!==r||e[8]!==h?(b=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[g,"Save"]}),e[7]=r,e[8]=h,e[9]=b):b=e[9];let y;return e[10]!==u||e[11]!==p||e[12]!==b?(y=n.jsxs(n.Fragment,{children:[u,p,b]}),e[10]=u,e[11]=p,e[12]=b,e[13]=y):y=e[13],y}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(wt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function Bn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function lr(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(Ae,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(Ae,{})})})}),t[1]=s):s=t[1],s}export{lr as default};
1
+ import{c as k,j as n,r as A,D as J,m as xe,l as Q,i as le,ag as Z,t as K,K as te,k as se,B as Y,d as nt,W as it,E as ot,a as rt,b as lt,u as at}from"./index-5AaNNafz.js";import{u as ge}from"./use-mobile-CCjACM_-.js";import{u as ct}from"./useSuspenseQueries-BQ3vTQtS.js";import{u as ae,m as dt}from"./use-mcp-client-DAdRU1cY.js";import{i as mt,a as ut,S as ft}from"./constants-C8_Swa4x.js";import{u as pt,b as ht,v as xt,a as gt}from"./use-virtual-mcp-B0Bq3-Jt.js";import{i as bt}from"./Check-B2t3_u8j.js";import{b as Pe,a as Se}from"./ZoomOut-B3kimgA9.js";import{i as yt,A as ce,t as jt,ae as vt,H as Nt,l as wt}from"./agent-icon-K57A0DzY.js";import{s as be}from"./Plus-Cj9kK9tN.js";import{i as ye}from"./X-DY9hR308.js";import{p as St}from"./index-CZfoQE-0.js";import{b as Me,c as oe,K as Ee,P as ze,D as Le,d as _t,S as Ct,v as It,g as Tt,h as kt,i as $t,f as At,e as Pt,n as Mt,C as re,L as Et,k as zt}from"./library-tab-Ds5fpIQF.js";import{f as Lt,d as Ot}from"./tab-id-CLpu897Q.js";import{b as Dt}from"./chat-context-COllONR2.js";import{N as Ht}from"./decopilot-B6qg2Op3.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-DRUNyKs6.js";import{a as Oe,b as De,o as Vt}from"./use-organization-settings-DJLfSIHV.js";import{c as je,b as Kt,h as Wt}from"./shell-layout-BzrEGgvG.js";import{I as He}from"./input-BAz505sI.js";import{S as qt,t as ve,P as Gt,j as Qt,s as Jt,g as Xt}from"./scroll-area-B7g9A0xO.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-B1hdeTXZ.js";import{S as V}from"./skeleton-C1g3sLzc.js";import{t as Re}from"./ChevronDown-CJGVvA9G.js";import{g as Fe,M as ns}from"./types-Z9nbiCM2.js";import{I as Ue}from"./integration-icon-DtLxCtgy.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-DMOL9nTa.js";import{T as as}from"./textarea-BwMDBTqD.js";import{u as Be}from"./studio-tools-CK3O9apC.js";import{a as cs}from"./use-mcp-tools-s0H1m2Ok.js";import{i as ds}from"./XCircle-DofnF94J.js";import{g as ms}from"./use-mcp-prompts-DbP7dBZf.js";import{b as us,w as fs}from"./hooks-B4JA5-D1.js";import{b as ps,d as hs,c as xs,D as gs,a as bs}from"./dropdown-menu-DDhytuEd.js";import{s as ys}from"./Trash01-D_xTnQtW.js";import{a as js,u as vs}from"./use-ai-providers-CaFOP2gL.js";import{u as Ns}from"./connect-desktop-dialog-uu1uNLI_.js";import{T as ws}from"./toolbar-Do7hu99P.js";import"./auth-D1xUzxIp.js";import"./use-collections-D9VCe-RD.js";import"./AlertCircle-BWfyWgiw.js";import"./Tool01-iIXzQIf6.js";import"./SwitchHorizontal01-a_i15cCW.js";import"./Settings02-Bs74lw7T.js";import"./ArrowUpRight-h5-lNOU3.js";import"./ZapSquare-B7pUKk1h.js";import"./Users03-Dnn-6pZq.js";import"./CheckCircle-Cd9sCPj_.js";import"./ChevronRight-SxNLyRA0.js";import"./ChevronUp-Cfv8kwOP.js";import"./Circle-CmWJQsR2.js";import"./Stars02-DGriyPK-.js";import"./Loading02-D5Q9o2ML.js";import"./Copy01-C_1mrR9P.js";import"./DotsVertical-DQ-r-KXk.js";import"./Globe01-4bI1LBPk.js";import"./Eye-Jd91Hda4.js";import"./FilterLines-C7Zdp7-q.js";import"./Star01-CC3gyOop.js";import"./Globe04-CPnbhr3e.js";import"./HardDrive-WT4IA8YF.js";import"./Key01-_0kmrESm.js";import"./LayoutLeft-D_5UU_fl.js";import"./LinkExternal01-CYx_LjKe.js";import"./List-5nWMXvgZ.js";import"./Monitor01-EVfMwGgl.js";import"./Sun-DszeKWvN.js";import"./Palette-Cg2Il5Mo.js";import"./Play-C4pBBuTc.js";import"./SearchLg-JSkDDvk4.js";import"./SearchMd-CP9WApAb.js";import"./Shield01-DMFwBOtF.js";import"./Stars01-DKD-uu49.js";import"./Upload01-COCQSA6j.js";import"./User01-DBHhpCM7.js";import"./Users01-BymojQtX.js";import"./XClose-CmiCfuv_.js";import"./Zap-BwbZR_TW.js";import"./alert-dialog-BuY0O9iQ.js";import"./dialog-RRPWwqaQ.js";import"./file-type-icon-CBM2EyFd.js";import"./use-debounced-value-qurf1YAB.js";import"./popover-QpTPPo-c.js";import"./tooltip-jwNiafJz.js";import"./index-8heN4TLW.js";import"./drawer-DJfZ0VmD.js";import"./collection-search-SaKzAiAF.js";import"./form-BylSC3lX.js";import"./label-BALEyZ3d.js";import"./tabs-OKKf4LAY.js";import"./toggle-group-CqoGi-AW.js";import"./command-DDwBnk4S.js";import"./index-DHu9eqr8.js";import"./useInfiniteQuery-C7fx2naq.js";import"./use-infinite-scroll-Dzaxo4bN.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-89JO9cLA.js";import"./decopilot-sse-pool-D8tR3MTD.js";import"./backoff-CrEUbyZT.js";import"./checkbox-5y5TSI8u.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-b6IKYKQs.js";import"./settings-section-knuBYiSB.js";import"./card-dPxA0RCs.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BsaY572f.js";import"./use-registry-connections-DPtEZCsY.js";import"./use-connection-BsHhz007.js";import"./extract-connection-data-DI_Hy6px.js";import"./collection-tabs-CZb_AY94.js";import"./badge-DGFEVFje.js";import"./connection-form-helpers-CHdocTpm.js";import"./authenticate-and-persist-oauth-CbQ04gTK.js";import"./mcp-oauth-CXxRaWx9.js";import"./useSuspenseInfiniteQuery-DpHAMt5e.js";import"./required-auth-layout-BIsgDBTS.js";import"./use-org-sso-CZi5R7ze.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BhkveYAE.js";import"./content-blocks-o63cs2vh.js";import"./use-clock-tick-DiuTRa3m.js";import"./use-navigate-to-agent-CMFaBfX6.js";import"./delay-CnY5UFtP.js";function Ve(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(Ss,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function Ss(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(as,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=g=>r(g==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(is,{className:"h-7 text-xs",children:n.jsx(os,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(rs,{children:[n.jsx(_e,{value:"true",children:"true"}),n.jsx(_e,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(ls,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(He,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function _s(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=A.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Zt,{children:"Manage home"}),d=n.jsx(Yt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(yt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=g=>r(g.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(es,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(He,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(tn,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx(A.Suspense,{fallback:u,children:n.jsx(Is,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(ts,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(ss,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function Cs(t){const e=k.c(32),{org:s}=J(),o=Oe();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=De(),d=ht(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const g=p>=ne;let b;e[10]!==g||e[11]!==f||e[12]!==a?(b=_=>f(_)||g?Promise.resolve():a.apply(C=>C.includes(_)?null:[...C,_]),e[10]=g,e[11]=f,e[12]=a,e[13]=b):b=e[13];const y=b;let N;e[14]!==a?(N=_=>a.apply(C=>C.filter(I=>I!==_)),e[14]=a,e[15]=N):N=e[15];const v=N;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const x=j;let w;e[18]!==d||e[19]!==g||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,C)=>{await d.update.mutateAsync({id:_.id,data:{metadata:C}}),!f(_.id)&&!g&&await a.apply(I=>I.includes(_.id)?null:[...I,_.id]),await c()},e[18]=d,e[19]=g,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let T;return e[24]!==y||e[25]!==g||e[26]!==r||e[27]!==f||e[28]!==v||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:v,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=v,e[29]=x,e[30]=S,e[31]=T):T=e[31],T}function Is(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=pt(o);let r;e[1]!==i?(r=new Set(i.map(Ps)),e[1]=i,e[2]=r):r=e[2];const a=Cs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const g=new Map(i.map(As));d=s.trim().toLowerCase();const b=v=>!d||v.title?.toLowerCase().includes(d);l=a.homeIds.map(v=>g.get(v)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=v=>!a.isOnHome(v.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(v=>!y.has(v.id)).filter(N).filter(b).sort(Ts),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Ms,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(Ls,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function Ts(t,e){return(t.title??"").localeCompare(e.title??"")}function ks(t){return t.id&&!mt(t.id)}function $s(t){return!!t}function As(t){return[t.id,t]}function Ps(t){return t.id}function Ke(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Ms(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:$t},e[1]=r):r=e[1];const a=Me(oe(ze,i),oe(Ee,r));let d;e[2]!==s?(d=p=>{const{active:h,over:g}=p;if(!g||h.id===g.id)return;const b=s.homeIds,y=b.indexOf(h.id),N=b.indexOf(g.id);y===-1||N===-1||s.reorder(At([...b],y,N)).catch(zs)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ke,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Le,{sensors:a,collisionDetection:_t,onDragEnd:l,children:n.jsx(Ct,{items:o.map(Es),strategy:It,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(Ds,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function Es(t){return t.id}function zs(){return K.error("Couldn't reorder home — please try again.")}function Ls(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=A.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ke,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Fs,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a(Os),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function Os(t){return t+20}function We(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function Ds(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=A.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=Tt(a),p=We(s)||"Quick access";let h;e[2]!==c?(h=kt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const g=f?.5:void 0,b=f?100:void 0;let y;e[4]!==h||e[5]!==g||e[6]!==b||e[7]!==u?(y={transform:h,transition:u,opacity:g,zIndex:b},e[4]=h,e[5]=g,e[6]=b,e[7]=u,e[8]=y):y=e[8];const N=y,v=f&&"shadow-lg";let j;e[9]!==v?(j=Q("rounded-lg border border-border bg-card",v),e[9]=v,e[10]=j):j=e[10];const x=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pe,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==x?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":x,children:w}),e[12]=d,e[13]=l,e[14]=x,e[15]=S):S=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>r(Rs),e[16]=T):T=e[16];const _=s.title??s.id;let C;e[17]!==s.icon||e[18]!==_?(C=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=C):C=e[19];const I=s.title??s.id;let P;e[20]!==I?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=P):P=e[21];let E;e[22]!==p?(E=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=E):E=e[23];let z;e[24]!==P||e[25]!==E?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,E]}),e[24]=P,e[25]=E,e[26]=z):z=e[26];const H=i&&"rotate-180";let L;e[27]!==H?(L=Q("shrink-0 text-muted-foreground transition-transform",H),e[27]=H,e[28]=L):L=e[28];let D;e[29]!==L?(D=n.jsx(Re,{size:16,className:L}),e[29]=L,e[30]=D):D=e[30];let U;e[31]!==i||e[32]!==C||e[33]!==z||e[34]!==D?(U=n.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[C,z,D]}),e[31]=i,e[32]=C,e[33]=z,e[34]=D,e[35]=U):U=e[35];let $;e[36]!==s.id||e[37]!==o?($=()=>o.removeAgent(s.id).catch(Hs),e[36]=s.id,e[37]=o,e[38]=$):$=e[38];const R=`Remove ${s.title??s.id} from home`;let O;e[39]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(ye,{size:14}),e[39]=O):O=e[39];let M;e[40]!==$||e[41]!==R?(M=n.jsx("button",{type:"button",onClick:$,"aria-label":R,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:O}),e[40]=$,e[41]=R,e[42]=M):M=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==M?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,M]}),e[43]=S,e[44]=U,e[45]=M,e[46]=F):F=e[46];let B;e[47]!==s||e[48]!==i||e[49]!==o?(B=i&&n.jsx(qe,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=B):B=e[50];let W;return e[51]!==m||e[52]!==N||e[53]!==F||e[54]!==B||e[55]!==j?(W=n.jsxs("div",{ref:m,style:N,className:j,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=j,e[56]=W):W=e[56],W}function Hs(){return K.error("Couldn't remove from home — please try again.")}function Rs(t){return!t}function Fs({agent:t,home:e}){const[s,o]=A.useState(!1),[i,r]=A.useState(!1),a=We(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{K.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(Re,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(be,{size:14})})]}),s&&n.jsx(qe,{agent:t,home:e})]})}function qe(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(Us).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Vs,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Bs,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx(A.Suspense,{fallback:u,children:n.jsx(Qs,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function Us(t){return t.connection_id}function Bs(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(V,{className:"h-8 w-full"}),n.jsx(V,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Vs({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Be(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const g=Fe(h._meta);return g?[{name:h.name,description:h.description,resourceUri:g,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(qs,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Gs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function Ge(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Ks(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Ws(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function qs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=A.useState(!1),[d,l]=A.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=A.useState(()=>Ks(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const g=Z(t.metadata?.ui),b=i.tileId?g.filter(N=>N.tileId!==i.tileId):g.filter(N=>N!==i),y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,y),l(!1)}catch(g){console.error("[home-tiles] failed to remove tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let g;if(m&&o.inputSchema?.properties){const v=Ge(c,o.inputSchema.properties);if(!v){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(v).length>0&&(g=v)}const y=Z(t.metadata?.ui).map(v=>(i.tileId?v.tileId===i.tileId:v===i)?{...v,toolInput:g}:v),N={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,N),l(!1)}catch(g){console.error("[home-tiles] failed to save tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Ws(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:ve(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(g=>!g),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(jt,{size:14})}),n.jsx(Ne,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(g,b)=>u(y=>({...y,[g]:b}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Gs({agent:t,home:e,connection:s,tool:o}){const[i,r]=A.useState(!1),[a,d]=A.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=A.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const y=Ge(m,o.inputSchema.properties);if(!y){K.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(y).length>0&&(p=y)}const g=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:g}};await e.saveAgentMetadata(t,b),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),K.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:ve(o.name)}),n.jsx(Ne,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(g=>({...g,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function Ne(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(vt,{size:14}):n.jsx(be,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Qs(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:x}=await d.listPrompts();return x.map(Ys)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=je(r.slug);let g,b;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let x;e[17]!==s.id?(x=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=x):x=e[18],g=h.prompts.filter(x).map(Zs);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],b=[...w];for(const S of g)b.some(T=>T.name===S.name)||b.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=g,e[16]=b}else g=e[15],b=e[16];if(f&&g.length===0){let x;return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]}),e[21]=x):x=e[21],x}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(b.length===0)return null;let y;e[22]!==i||e[23]!==b?(y=i??b.map(Xs),e[22]=i,e[23]=b,e[24]=y):y=e[24];let N;e[25]!==y?(N=new Set(y),e[25]=y,e[26]=N):N=e[26];const v=N;let j;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==v?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:b.map(x=>n.jsx(en,{agent:s,home:o,prompt:x,allPromptNames:b.map(Js),isPinned:v.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=v,e[31]=j):j=e[31],j}function Js(t){return t.name}function Xs(t){return t.name}function Zs(t){return{name:t.promptName,title:t.title,description:t.description}}function Ys(t){return{name:t.name,title:t.title,description:t.description}}function en({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=A.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),K.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??ve(s.name)}),n.jsx(Ne,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function tn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},sn)}),t[0]=e):e=t[0],e}function sn(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(V,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Qe=`home-board.layout.v${ee}`;function Je(t){return`home-board.layout.v${ee}.${t}`}const Xe={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Xe:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function nn(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function on(t){try{const e=localStorage.getItem(Je(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Ce(t,e){try{localStorage.setItem(Je(t),JSON.stringify(e))}catch{}}async function Ie(t,e){if(!(await fetch(`/api/${t}/kv/${Qe}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function rn(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=on(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const y=await fetch(`/api/${t}/kv/${Qe}`);if(y.status===404)return a&&nn(a)?(await Ie(t,a),a):Xe;if(!y.ok)throw new Error("Failed to load board layout");const N=await y.json(),v=fe(N.value);return Ce(t,v),v},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:y=>Ie(t,y)},e[11]=t,e[12]=u):u=e[12];const f=nt(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=y=>{Ce(t,y),s.setQueryData(i,y),f.mutate(y)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let g;e[18]!==m?(g=fe(m),e[18]=m,e[19]=g):g=e[19];let b;return e[20]!==c||e[21]!==h||e[22]!==g?(b={layout:g,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}const Ze=A.createContext(null);function ln(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=rn(o.slug),[r,a]=A.useState(!1),[d,l]=A.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,g=r&&d!==null,b=g?d:i.layout;let y;e[6]!==d||e[7]!==g||e[8]!==i.layout?(y=g?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=g,e[8]=i.layout,e[9]=y):y=e[9];const N=y;let v;e[10]!==r||e[11]!==i?(v=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=v):v=e[12];const j=v;let x;e[13]!==j||e[14]!==c||e[15]!==N||e[16]!==r||e[17]!==b||e[18]!==h||e[19]!==i.isLoading?(x={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:N,layout:b,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=N,e[16]=r,e[17]=b,e[18]=h,e[19]=i.isLoading,e[20]=x):x=e[20];let w;return e[21]!==s||e[22]!==x?(w=n.jsx(Ze.Provider,{value:x,children:s}),e[21]=s,e[22]=x,e[23]=w):w=e[23],w}function Ye(){const t=A.useContext(Ze);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function an({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=us(),{setTaskId:r}=Kt(),[a,d]=A.useState(null),[l,m]=A.useState(!1),c=A.useRef(!1),u=async(b,y)=>{if(!o){K.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const N=await ms(o,b.name,y),v={type:"doc",content:[{type:"paragraph",content:[Qt({id:b.name,name:Jt(b.name,Xt(b._meta)),metadata:N.messages,char:"/",kind:"prompt",args:y}),{type:"text",text:" "}]}]},j=crypto.randomUUID();fs(sessionStorage,s,j,{tiptapDoc:v}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(N){console.error("[start-thread-from-prompt] failed",N),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async b=>{if(!c.current){if(b.arguments&&b.arguments.length>0){d(b);return}await u(b)}},p=async b=>{if(!a)return;const y=a;d(null),await u(y,b)};return{start:f,startBlank:async b=>{if(!c.current){c.current=!0,m(!0);try{const y=crypto.randomUUID();await i({id:y,virtual_mcp_id:t}),r(y,t,b?.main?{main:b.main}:void 0)}catch(y){console.error("[start-thread-from-prompt] startBlank failed",y),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Gt,{prompt:a,setPrompt:b=>d(b),onSubmit:p}),dialogPrompt:a,starting:l}}const q=4,G=100,Te=12,cn=5,dn={w:2,h:2};class pe extends A.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(it,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function mn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=A.useRef(null),[c,u]=A.useState(null),[f,p]=A.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const g=Me(oe(ze,h),oe(Ee)),b=s.reduce(un,0),y=o?Math.max(b+2,4):Math.max(b,1);let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{const $=m.current?.getBoundingClientRect();return $?{cellWidth:$.width/q,cellHeight:G}:null},e[1]=N):N=e[1];const v=N;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=$=>{u(String($.active.id)),p(v())},e[2]=j):j=e[2];const x=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??v();if(u(null),p(null),!O||O.cellWidth<=0)return;const M=s.find(W=>W.id===R);if(!M)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:M.x+F,y:M.y+B})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let $;if(e[7]!==i||e[8]!==s){let O;e[10]!==i?(O=M=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(M)})},M.id),e[10]=i,e[11]=O):O=e[11],$=s.map(O),e[7]=i,e[8]=s,e[9]=$}else $=e[9];let R;return e[12]!==$?(R=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:$}),e[12]=$,e[13]=R):R=e[13],R}let T,_,C,I,P,E,z,H,L;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==y){const $=c?s.find(X=>X.id===c):null;_=Le,H=g,L=x,C=S;const R=y*G,O=o?G*4:G;let M;e[33]!==R||e[34]!==O?(M={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=M):M=e[35];let F;e[36]!==o||e[37]!==s||e[38]!==y?(F=o&&n.jsx(fn,{rows:y,tiles:s}),e[36]=o,e[37]=s,e[38]=y,e[39]=F):F=e[39];let B;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(hn,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],B=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=B}else B=e[46];e[53]!==M||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:M,children:[F,B]}),e[53]=M,e[54]=F,e[55]=B,e[56]=I):I=e[56],T=Pt,P=null;const W=$&&f?$.w*f.cellWidth-Te:void 0,de=$&&f?$.h*f.cellHeight-Te:void 0;e[57]!==W||e[58]!==de?(E={width:W,height:de},e[57]=W,e[58]=de,e[59]=E):E=e[59],z=$&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i($)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=g,e[22]=s,e[23]=y,e[24]=T,e[25]=_,e[26]=C,e[27]=I,e[28]=P,e[29]=E,e[30]=z,e[31]=H,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],E=e[29],z=e[30],H=e[31],L=e[32];let D;e[60]!==T||e[61]!==P||e[62]!==E||e[63]!==z?(D=n.jsx(T,{dropAnimation:P,style:E,children:z}),e[60]=T,e[61]=P,e[62]=E,e[63]=z,e[64]=D):D=e[64];let U;return e[65]!==_||e[66]!==C||e[67]!==I||e[68]!==D||e[69]!==H||e[70]!==L?(U=n.jsxs(_,{sensors:H,onDragStart:L,onDragEnd:C,children:[I,D]}),e[65]=_,e[66]=C,e[67]=I,e[68]=D,e[69]=H,e[70]=L,e[71]=U):U=e[71],U}function un(t,e){return Math.max(t,e.y+e.h)}function fn(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<q;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(pn)}),e[5]=a,e[6]=d):d=e[6],d}function pn(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/q*100}%`,top:t.y*G,width:`${1/q*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function hn(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Mt(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,v=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=N&&"opacity-30";let x;e[3]!==v||e[4]!==j?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",v,j),e[3]=v,e[4]=j,e[5]=x):x=e[5];let w;e[6]!==y||e[7]!==h||e[8]!==b||e[9]!==g?(w={left:h,top:b,width:g,height:y},e[6]=y,e[7]=h,e[8]=b,e[9]=g,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==S?(T=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=T):T=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(Pe,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(xn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let C;e[20]!==d?(C=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=C):C=e[21];let I;e[22]!==C||e[23]!==T||e[24]!==_?(I=n.jsxs("div",{className:T,children:[_,C]}),e[22]=C,e[23]=T,e[24]=_,e[25]=I):I=e[25];let P;return e[26]!==c||e[27]!==I||e[28]!==x||e[29]!==w?(P=n.jsx("div",{ref:c,className:x,style:w,children:I}),e[26]=c,e[27]=I,e[28]=x,e[29]=w,e[30]=P):P=e[30],P}function xn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=A.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ps,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(Nt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=b=>{o(s.id,b),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(gn,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(hs,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ys,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(xs,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(gs,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let g;return e[17]!==r||e[18]!==h?(g=n.jsxs(bs,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=g):g=e[19],g}function gn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=A.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${q}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:cn},(b,y)=>Array.from({length:q},(N,v)=>{const j=v+1,x=y+1,w=j<i||x<r,S=j<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${x}`,onPointerEnter:()=>d({w:j,h:x}),onClick:()=>o({w:j,h:x}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${x}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let g;return e[16]!==u||e[17]!==h?(g=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=g):g=e[18],g}function bn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=q-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)bn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(q,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(q-s,t)),i=Math.max(0,e);return{x:o,y:i}}function yn(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function jn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ye();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let N;e[7]!==a?(N=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=N):N=e[8];const v=t.filter(N);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of v){const x=s.tiles[j.id];if(!x)continue;const w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:j.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const j of v){if(l.some(C=>C.id===j.id))continue;const x=j.defaultSize??dn,w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:j.id,x:_.x,y:_.y,w:S,h:T,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(vn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,v)=>{const j={};for(const x of N)j[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:j,hidden:v.filter(x=>c.has(x))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(N,v)=>{const j=l.find(S=>S.id===N);if(!j)return;const x=ue(v.x,v.y,j.w);if(x.x===j.x&&x.y===j.y)return;const w=yn(l,N,x);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let g;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(g=(N,v)=>{const j=l.find(I=>I.id===N);if(!j)return;const x=d.get(N),{w,h:S}=me(v.w,v.h,x);if(w===j.w&&S===j.h)return;const T={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(I=>I.id!==N),C=[T];for(const I of _){const P=he(C,I.w,I.h);C.push({...I,x:P.x,y:P.y})}f(C,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=g):g=e[24];let b;e[25]!==f||e[26]!==s||e[27]!==l?(b=N=>{const v=l.filter(j=>j.id!==N);f(v,Array.from(new Set([...s.hidden,N])))},e[25]=f,e[26]=s,e[27]=l,e[28]=b):b=e[28];let y;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==g||e[33]!==b?(y={snapshot:p,isLoading:o,moveTile:h,resizeTile:g,hideTile:b},e[29]=o,e[30]=p,e[31]=h,e[32]=g,e[33]=b,e[34]=y):y=e[34],y}function vn(t){return t.id}const Nn={w:2,h:4},wn={w:1,h:2},Sn={w:1,h:1};function _n(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function Cn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function In(t){return t.promptName?t.agentName:t.description}function Tn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function et(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=dt({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=cs(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Fe(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?Lt(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function we(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=an(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(Tn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function kn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=we(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let g;e[12]!==s?(g=In(s),e[12]=s,e[13]=g):g=e[13];let b;e[14]!==g?(b=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==h?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,b]}),e[16]=b,e[17]=h,e[18]=y):y=e[18];let N;e[19]!==o?(N=!o&&n.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=N):N=e[20];let v;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(v=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,y,N]}),e[21]=a,e[22]=d,e[23]=y,e[24]=N,e[25]=l,e[26]=f,e[27]=p,e[28]=v):v=e[28];let j;return e[29]!==r||e[30]!==v?(j=n.jsxs(n.Fragment,{children:[v,r]}),e[29]=r,e[30]=v,e[31]=j):j=e[31],j}function $n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},An)}),t[0]=e):e=t[0],e}function An(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(V,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Pn(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=we(s.agentId),u=o.filter(Mn),f=et(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const g="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(zn,{}),e[5]=b):b=e[5];let y;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(y=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx(A.Suspense,{fallback:b,children:n.jsx(En,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=y):y=e[9];const N=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(x=>n.jsx("button",{type:"button",onClick:()=>d(x),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:x.title})},x.promptName))});let v;e[10]!==y||e[11]!==N?(v=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=v):v=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==v?(j=n.jsxs("div",{className:p,children:[h,v,m]}),e[13]=m,e[14]=h,e[15]=v,e[16]=j):j=e[16],j}function Mn(t){return!!t.promptName}function En(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(ns,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function zn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ln(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(V,{className:"h-3 w-3/4"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function On(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=we(s.agentId),m=o.filter(Dn),c=et(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const g=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(y=>n.jsx("button",{type:"button",onClick:()=>!i&&r(y),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:y.title})},y.promptName))});let b;return e[6]!==d||e[7]!==h||e[8]!==g?(b=n.jsxs("div",{className:u,children:[h,g,d]}),e[6]=d,e[7]=h,e[8]=g,e[9]=b):b=e[9],b}function Dn(t){return!!t.promptName}function tt({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=je(e.slug),r=Oe()?.ids??[],a=new Set(r),d=De(),l=Be(),m=xe(),c=new Set(i.map(x=>x.agentId)),u=new Map;for(const x of o){const w=u.get(x.agentId);w?w.push(x):u.set(x.agentId,[x])}const f=o.filter(x=>!c.has(x.agentId)),p=[...i.map(x=>({kind:"tile",id:Cn(x),data:x})),...f.map(x=>({kind:"prompt",id:_n(x),data:x}))],h=new Map(p.map(x=>[x.id,x])),g=jn(p.map(x=>({id:x.id,defaultSize:x.kind==="tile"?Nn:Sn,minSize:x.kind==="tile"?wn:void 0,pinned:a.has(x.data.agentId)}))),b=x=>{d.apply(w=>w.filter(S=>S!==x)).catch(()=>K.error("Couldn't remove from home — please try again."))},y=async x=>{if(i.filter(S=>S.agentId===x.agentId).length<=1){b(x.agentId);return}try{const T=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:x.agentId})).item;if(!T)throw new Error("Agent not found");const _=Z(T.metadata?.ui),C=x.tileId?_.filter(I=>I.tileId!==x.tileId):_.filter(I=>I.connectionId!==x.connectionId||I.resourceUri!==x.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:x.agentId,data:{metadata:{...T.metadata??{},ui:{...T.metadata?.ui??{},homeTile:null,homeTiles:C}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{K.error("Couldn't remove tile — please try again.")}},N=x=>{const w=h.get(x);if(w){if(!a.has(w.data.agentId)){g.hideTile(x);return}w.kind==="tile"?y(w.data):b(w.data.agentId)}},v=x=>{const w=h.get(x.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(ot,{fallback:n.jsx(On,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx(A.Suspense,{fallback:n.jsx(Ln,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(Pn,{tile:w.data,prompts:S,isEditMode:t,tileWidth:x.w})})})}return n.jsx(kn,{entry:w.data,isEditMode:t})};return s||g.isLoading?n.jsx($n,{}):g.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(mn,{tiles:g.snapshot.visible,isEditMode:t,renderTile:v,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Hn(t){const e=k.c(2),{prompts:s,tiles:o}=je(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const ke=420,$e=305;function st(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:$e}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:$e}})]}),t[3]=i):i=t[3],i}function Ae(){const t=k.c(33),{data:e}=rt.useSession(),{org:s}=J(),o=ge(),i=Ns(),{selectedVirtualMcp:r}=Dt();let a;t[0]!==s.id?(a=ut(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Wt(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:ft,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=js(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Vt(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=xt(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let g;t[17]!==f||t[18]!==p||t[19]!==h?(g={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=g):g=t[20],ct(g);const b=vs(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:v,isInitialFreeCredit:j,balanceDollars:x,hasOnlyDecoProvider:w}=Ft(),{hasVisibleTiles:S}=Hn(s.slug),T=Ut(y?.metadata);if(b.length===0&&!(T&&Bt(i))){let D;return t[21]===Symbol.for("react.memo_cache_sentinel")?(D=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(Ht,{})})}),t[21]=D):D=t[21],D}let C;t[22]!==e?.user?.name?(C=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=C):C=t[23];const I=C,P=N&&j&&x!=null,E=N&&v&&w;let z;t[24]!==x||t[25]!==P||t[26]!==E?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):E?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=E,t[27]=z):z=t[27];const H=z;let L;return t[28]!==H||t[29]!==S||t[30]!==o||t[31]!==I?(L=n.jsx(ln,{children:o?n.jsx(Rn,{eyebrow:H,userName:I}):n.jsx(Fn,{eyebrow:H,userName:I,hasVisibleTiles:S})}),t[28]=H,t[29]=S,t[30]=o,t[31]=I,t[32]=L):L=t[32],L}function Rn(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(st,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(re.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(tt,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function Fn(t){const e=k.c(54),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ye(),[c,u]=A.useState(!1),f=lt();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={strict:!1},e[0]=p):p=e[0];const{main:h}=at(p);let g;e[1]!==h?(g=h?Ot(h):null,e[1]=h,e[2]=g):g=e[2];const b=g,y=h==="files"||!!b;let N;e[3]!==f?(N=B=>f({to:".",search:W=>({...W,main:B}),replace:!0}),e[3]=f,e[4]=N):N=e[4];const v=N;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={kind:"component",Component:Se},e[5]=j):j=e[5];let x;e[6]!==y||e[7]!==v?(x=()=>v(y?void 0:"files"),e[6]=y,e[7]=v,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:j,active:y,onClick:x}),e[9]=y,e[10]=x,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),e[12]=S):S=e[12];let T;e[13]!==l||e[14]!==a||e[15]!==m||e[16]!==r||e[17]!==d?(T=n.jsx(Un,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:S}),e[13]=l,e[14]=a,e[15]=m,e[16]=r,e[17]=d,e[18]=T):T=e[18];let _;e[19]!==w||e[20]!==T?(_=n.jsxs(ws.Right,{children:[w,T]}),e[19]=w,e[20]=T,e[21]=_):_=e[21];let C;e[22]!==c?(C=n.jsx(_s,{open:c,onOpenChange:u}),e[22]=c,e[23]=C):C=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(st,{}),e[24]=I):I=e[24];const P=i||r?"pt-32":"flex-1 justify-center";let E;e[25]!==P?(E=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=E):E=e[26];let z;e[27]!==s?(z=s&&n.jsx("div",{className:"mb-4",children:s}),e[27]=s,e[28]=z):z=e[28];let H;e[29]!==o?(H=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[29]=o,e[30]=H):H=e[30];let L;e[31]!==z||e[32]!==H?(L=n.jsxs("div",{className:"text-center mb-10",children:[z,H]}),e[31]=z,e[32]=H,e[33]=L):L=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsxs("div",{className:"relative w-full",children:[n.jsx(Bn,{}),n.jsx(re.Input,{showConnectionsBanner:!0})]}),e[34]=D):D=e[34];let U;e[35]!==L?(U=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[L,D]}),e[35]=L,e[36]=U):U=e[36];let $;e[37]!==r?($=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(tt,{isEditMode:r})}),e[37]=r,e[38]=$):$=e[38];let R;e[39]!==E||e[40]!==U||e[41]!==$?(R=n.jsxs("div",{className:"flex-1 min-w-0 relative flex flex-col",children:[I,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:E,children:[U,$]})})]}),e[39]=E,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==v?(O=y&&n.jsxs("div",{className:"w-[45%] max-w-[680px] min-w-[380px] shrink-0 flex flex-col min-h-0 border-l border-border bg-background",children:[n.jsxs("div",{className:"h-10 shrink-0 flex items-center justify-between px-3 border-b border-border",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[n.jsx(Se,{size:16}),"Library"]}),n.jsx("button",{type:"button",onClick:()=>v(void 0),"aria-label":"Close Library panel",className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:n.jsx(ye,{size:16})})]}),n.jsx("div",{className:"flex-1 min-h-0",children:b?n.jsx(Et,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=v,e[46]=O):O=e[46];let M;e[47]!==R||e[48]!==O?(M=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=M):M=e[49];let F;return e[50]!==C||e[51]!==M||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,M]}),e[50]=C,e[51]=M,e[52]=_,e[53]=F):F=e[53],F}function Un(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(be,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ye,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(bt,{size:14}),e[6]=g):g=e[6];let b;e[7]!==r||e[8]!==h?(b=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[g,"Save"]}),e[7]=r,e[8]=h,e[9]=b):b=e[9];let y;return e[10]!==u||e[11]!==p||e[12]!==b?(y=n.jsxs(n.Fragment,{children:[u,p,b]}),e[10]=u,e[11]=p,e[12]=b,e[13]=y):y=e[13],y}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(wt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function Bn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function lr(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(Ae,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(Ae,{})})})}),t[1]=s):s=t[1],s}export{lr as default};