decocms 3.18.7 → 3.18.9

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 (230) hide show
  1. package/dist/client/assets/{AlertCircle-CMSkIA9E.js → AlertCircle-BHVtmqg5.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BU_doFgY.js → ArrowUpRight-BjNBbpmV.js} +1 -1
  3. package/dist/client/assets/{Check-BXdJG7IX.js → Check-B0P5hodH.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Y8pQlek8.js → CheckCircle-Bdqev0nO.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Cey2L4Eb.js → ChevronDown-BLvS4ToG.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-kI7QenDi.js → ChevronLeft-DkNaQH3V.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CVJANjc-.js → ChevronRight-4ehX8OPq.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-OF-9kR35.js → ChevronUp-BPS-J5rQ.js} +1 -1
  9. package/dist/client/assets/{Container-D6nffAf7.js → Container-BgS7rK8J.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-BVOHmnSk.js → DotsVertical-J6xX8bRK.js} +1 -1
  11. package/dist/client/assets/{Eye-DHs2I-Av.js → Eye-B4txmFQS.js} +1 -1
  12. package/dist/client/assets/{FilterLines--Y6NBJ0G.js → FilterLines-BTMjQgiq.js} +1 -1
  13. package/dist/client/assets/{Globe01-BWO8gXaQ.js → Globe01-xi-0s299.js} +1 -1
  14. package/dist/client/assets/{HardDrive-kmcEZpKn.js → HardDrive-Cw5wbzfr.js} +1 -1
  15. package/dist/client/assets/{Key01-y2clCwOu.js → Key01-CIFx1b27.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CoYySogd.js → LayoutLeft-DoTZR2dr.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-BXgyzJwg.js → LinkExternal01-BUo_Z2Ai.js} +1 -1
  18. package/dist/client/assets/{Monitor01-Dgg3fTje.js → Monitor01-CU2IldL2.js} +1 -1
  19. package/dist/client/assets/{Palette-CHdbp1n7.js → Palette-C1x3Xgx8.js} +1 -1
  20. package/dist/client/assets/{Play-DHAAJoir.js → Play-cC3e0aRw.js} +1 -1
  21. package/dist/client/assets/{Plus-BFwEplz1.js → Plus-C-omi-dN.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-BHSrgNLa.js → RefreshCcw01-BRsF38y3.js} +1 -1
  23. package/dist/client/assets/{SearchMd-B_TDDT-J.js → SearchMd-B0_Yf3yk.js} +1 -1
  24. package/dist/client/assets/{Settings02-DakgZ_6U.js → Settings02-BAzPyCQK.js} +1 -1
  25. package/dist/client/assets/{Shield01-DgxPEC3k.js → Shield01-D-Ka40fc.js} +1 -1
  26. package/dist/client/assets/{Star01-89lkc6pp.js → Star01-BTZ2441m.js} +1 -1
  27. package/dist/client/assets/{Stars01-BG4JVYDm.js → Stars01-BvMjy7DM.js} +1 -1
  28. package/dist/client/assets/{Stars02-CifKQ3Pc.js → Stars02-D5yjx9l2.js} +1 -1
  29. package/dist/client/assets/{Sun-ByYnyvJz.js → Sun-CU5c1BQU.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-Ijxg5N6G.js → SwitchHorizontal01-CI__ZFHo.js} +1 -1
  31. package/dist/client/assets/{Tool01-BbbVaqpj.js → Tool01-jh5OdcD_.js} +1 -1
  32. package/dist/client/assets/{Trash01-ACbi1Ltw.js → Trash01-CY-IoFVl.js} +1 -1
  33. package/dist/client/assets/{Upload01-DrTNbCod.js → Upload01-Dws98jTe.js} +1 -1
  34. package/dist/client/assets/{User01-DLJ_n1LK.js → User01-CsfdlOo_.js} +1 -1
  35. package/dist/client/assets/{Users01-C3slMaaS.js → Users01-KgnDENeu.js} +1 -1
  36. package/dist/client/assets/{Users03-x49ISqXw.js → Users03-B1-zgOdp.js} +1 -1
  37. package/dist/client/assets/{X-IA2k1lZV.js → X-wAJMKsDG.js} +1 -1
  38. package/dist/client/assets/{XCircle-BjboHb-q.js → XCircle-C5XzBzrQ.js} +1 -1
  39. package/dist/client/assets/{XClose-RzErdjnv.js → XClose-Wh4jKrco.js} +1 -1
  40. package/dist/client/assets/{Zap-DOMCV9vX.js → Zap-Cd9ypkMC.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-CexDE4rM.js → ZapSquare-BdJ-x7Vi.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-CFwr52eB.js → ZoomOut-DnPCWp9x.js} +1 -1
  43. package/dist/client/assets/{access-gate-CzElmpS-.js → access-gate-CNsIQ_vY.js} +1 -1
  44. package/dist/client/assets/{accordion-D8_XNPgy.js → accordion-CCq9lsEc.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-DJbY2b0E.js → add-section-modal-DRe-XbIV.js} +1 -1
  46. package/dist/client/assets/agent-capabilities-Dk3tx7gd.js +3 -0
  47. package/dist/client/assets/{agent-icon-Dqe2G8l6.js → agent-icon-Dr1bpYZ_.js} +1 -1
  48. package/dist/client/assets/{agent-icons-BZzVIoSr.js → agent-icons-CzC15bIN.js} +1 -1
  49. package/dist/client/assets/{agents-list-NI79bPNX.js → agents-list-DWy0GtDE.js} +1 -1
  50. package/dist/client/assets/{ai-providers-B-8BkIje.js → ai-providers-BmFmfBdt.js} +1 -1
  51. package/dist/client/assets/{alert-DNdHJuMF.js → alert-BYbunVHe.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-Bvcvs-PK.js → alert-dialog-B_G3fFis.js} +1 -1
  53. package/dist/client/assets/app-editor-eVQHoVzV.js +1 -0
  54. package/dist/client/assets/{auth-catchall-lnsS6_Ua.js → auth-catchall-DbEVklo6.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-B8EqHOxY.js → auth-split-layout-DuWIkei5.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-miLzygwu.js → automation-list-row-Ca7Xhucl.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CASgCp0g.js → automation-runs-hyU42Y3D.js} +1 -1
  58. package/dist/client/assets/{automations-C2WG_h1w.js → automations-2cAsHwG9.js} +1 -1
  59. package/dist/client/assets/{avatar-o0teoCxe.js → avatar-DhzY0Eh2.js} +1 -1
  60. package/dist/client/assets/{badge-Bw33wy_e.js → badge-bZNUWBV_.js} +1 -1
  61. package/dist/client/assets/{brand-context-DLiTcs7r.js → brand-context-D0vg5dZK.js} +1 -1
  62. package/dist/client/assets/{buckets-DhKk-7tw.js → buckets-DBovtxB9.js} +1 -1
  63. package/dist/client/assets/{calendar-BrplQIIO.js → calendar-BLg-8LXk.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DisjQtBM.js → capability-load-error-DBKsDtKJ.js} +1 -1
  65. package/dist/client/assets/{card-fxwvyxSe.js → card-BDlh34z0.js} +1 -1
  66. package/dist/client/assets/{chat-context-DAZfCiSi.js → chat-context-n64-vv_1.js} +1 -1
  67. package/dist/client/assets/{checkbox-DgCOgJ_F.js → checkbox-X6v3rKHo.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-CTT6xob_.js → cli-auth-success-CQVq7_y_.js} +1 -1
  69. package/dist/client/assets/{collection-detail-CAVyv3y2.js → collection-detail-C5P4CU7T.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-3i2S_zJ0.js → collection-display-button-BV3ToLFg.js} +1 -1
  71. package/dist/client/assets/{collection-search-CZDXSMn-.js → collection-search-B7dmZ18T.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-B-Wo83qD.js → collection-table-wrapper-B0Cp6x2U.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-ixrhsC43.js → collection-tabs-IXoyjsqg.js} +1 -1
  74. package/dist/client/assets/{collections-vKAzbOjS.js → collections-Ca9cgdYF.js} +1 -1
  75. package/dist/client/assets/{command-CwWqPNsH.js → command-eM0_ztLa.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CbvHGPbf.js → connect-desktop-dialog-BnrR7FIp.js} +1 -1
  77. package/dist/client/assets/{connection-card-8_99bUQw.js → connection-card-BNhxgt1r.js} +1 -1
  78. package/dist/client/assets/{connection-detail-WQSoA1gx.js → connection-detail-BfklQCKA.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-Dg6lEM1u.js → connection-form-helpers-E666kWj7.js} +1 -1
  80. package/dist/client/assets/{connections-BWb-VOfE.js → connections-Bayyg13Q.js} +1 -1
  81. package/dist/client/assets/{constants-kA9rWvH5.js → constants-CNZvm1cO.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-CcaUpt2_.js → decopilot-sse-pool-BbXhLnto.js} +1 -1
  83. package/dist/client/assets/{dialog-B4w5HroU.js → dialog-B25EnfSZ.js} +1 -1
  84. package/dist/client/assets/{domain-settings-DgIRawYa.js → domain-settings-DeaBF1NN.js} +1 -1
  85. package/dist/client/assets/{drawer-DjJS3_gd.js → drawer-fSMBE52Q.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-CDKNh3cP.js → dropdown-menu-CqB2EneR.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-DOVBBIHO.js → dynamic-plugin-layout-Hd9w0NQy.js} +1 -1
  88. package/dist/client/assets/{empty-state-BAzwuFVO.js → empty-state-BZ5IbUpC.js} +1 -1
  89. package/dist/client/assets/{empty-state-2qnpnTbh.js → empty-state-ntjfA1V-.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-DGFjfipx.js → extract-connection-data-DtUMTD6M.js} +1 -1
  91. package/dist/client/assets/{features-BzdwVS8W.js → features-Do_DYvUG.js} +1 -1
  92. package/dist/client/assets/{file-explorer-DZo35p68.js → file-explorer-CzHWiTKa.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-Da4ldwse.js → file-type-icon-vEyv3GKo.js} +1 -1
  94. package/dist/client/assets/{files-CYrEdfi1.js → files-CqHDF15j.js} +1 -1
  95. package/dist/client/assets/{form-CBSLMGev.js → form-Ck7oM85d.js} +1 -1
  96. package/dist/client/assets/{general-BOHOjatd.js → general-CiySELJl.js} +1 -1
  97. package/dist/client/assets/{generate-id-BAuGEsGf.js → generate-id-DFeI4rCP.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-DJD0fIfz.js → github-repo-picker-C8SuJIC3.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-CEgugq7E.js → header-tab-button-ByTfW4d9.js} +1 -1
  100. package/dist/client/assets/{hover-card-D0gW17Ne.js → hover-card-Bs_VQXY_.js} +1 -1
  101. package/dist/client/assets/{image-field-7XxH_jq9.js → image-field-DsGhzGiD.js} +1 -1
  102. package/dist/client/assets/{index-hJdddtpv.js → index-B6C3Resz.js} +1 -1
  103. package/dist/client/assets/{index-BVn__NxU.js → index-B7tMIGCq.js} +3 -3
  104. package/dist/client/assets/{index-BxheWbKP.js → index-B9ljcRCy.js} +1 -1
  105. package/dist/client/assets/{index-CbGLl-hL.js → index-BHIyMqy_.js} +1 -1
  106. package/dist/client/assets/{index-BCW7dRwu.js → index-BNuieAvN.js} +1 -1
  107. package/dist/client/assets/{index-DhmXzfCN.js → index-BaZaX52j.js} +1 -1
  108. package/dist/client/assets/{index-BSIbiB3J.js → index-BicGKvEo.js} +4 -4
  109. package/dist/client/assets/{index-BDw1Z9lp.js → index-BraUXQtj.js} +1 -1
  110. package/dist/client/assets/{index-CmzgdX_m.js → index-CCsVvAb0.js} +1 -1
  111. package/dist/client/assets/{index-DNKLrBGo.js → index-CF0CDpUh.js} +1 -1
  112. package/dist/client/assets/{index-AMOcpi4Q.js → index-DFwf5_Tj.js} +1 -1
  113. package/dist/client/assets/{index-Bt3z2f5Y.js → index-DJZidEIe.js} +1 -1
  114. package/dist/client/assets/{index-BNnfBCaX.js → index-DjvTsn28.js} +1 -1
  115. package/dist/client/assets/{index-Bw1i9_xF.js → index-DllrVy9q.js} +1 -1
  116. package/dist/client/assets/{index-BP_9fzxs.js → index-IIM93U8v.js} +1 -1
  117. package/dist/client/assets/{index-redirect-DwpyZYdV.js → index-redirect-DwG4UFJN.js} +1 -1
  118. package/dist/client/assets/{infiniteQueryObserver-B9utYzeT.js → infiniteQueryObserver-GqeTL4E_.js} +1 -1
  119. package/dist/client/assets/{input-C1HJ5Zf7.js → input-DwlCJ28N.js} +1 -1
  120. package/dist/client/assets/{integration-icon-BOQdoPAu.js → integration-icon-BI887rQg.js} +1 -1
  121. package/dist/client/assets/{label-BXcRR1X8.js → label-Cp7h2a1f.js} +1 -1
  122. package/dist/client/assets/{layout-DXFIQIyR.js → layout-CHqfnKZ0.js} +1 -1
  123. package/dist/client/assets/{login-CrLWSUv9.js → login-CxERd25A.js} +1 -1
  124. package/dist/client/assets/{members-BNCvQH62.js → members-BIU1EAnp.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-DrHJpDB7.js → monaco-editor-4zJKgWND.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-B1_KiCNh.js → monitoring-stats-row-Ckcrs5bU.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-DY5F8suv.js → oauth-callback-C1wSOpSi.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-DCAsMNAv.js → oauth-callback-ai-provider-CIslKnkJ.js} +1 -1
  129. package/dist/client/assets/{onboarding-vjcOGTdX.js → onboarding-DzOFbPHY.js} +1 -1
  130. package/dist/client/assets/{org-install-DyleJ2iq.js → org-install-DkWUqjZM.js} +1 -1
  131. package/dist/client/assets/{org-layout-DLKh_mPW.js → org-layout-D9qKjB7L.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-BJMkg6OK.js → org-plugin-layout-CQA5014y.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-trV0pWZD.js → page-seo-form-CCHdZJVC.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-muZrfYn9.js +1 -0
  135. package/dist/client/assets/{pair-VRhixa1-.js → pair-DbyXobZ6.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-zAN1_Cdf.js → plugin-empty-state-ClBAOxte.js} +1 -1
  137. package/dist/client/assets/{plugin-header-J9aCtcJX.js → plugin-header-0fc0DfDo.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-CPNniEbQ.js → plugin-layout-CQ-ZS4on.js} +1 -1
  139. package/dist/client/assets/{popover-C7YUc47y.js → popover-BpkFIRrC.js} +1 -1
  140. package/dist/client/assets/{post-editor-D0XNB4yj.js → post-editor-B4qR5gjS.js} +1 -1
  141. package/dist/client/assets/{primitives-BgOSPx0B.js → primitives-C0xseebZ.js} +1 -1
  142. package/dist/client/assets/{profile-CFwac5gf.js → profile-j_YIrPxD.js} +1 -1
  143. package/dist/client/assets/project-app-view-BIOfOBLG.js +1 -0
  144. package/dist/client/assets/record-editor-DF21NWvv.js +1 -0
  145. package/dist/client/assets/registry-BiWmGi9J.js +2 -0
  146. package/dist/client/assets/{registry-layout-3kNSY7oF.js → registry-layout-DVn6I6vz.js} +1 -1
  147. package/dist/client/assets/{require-capability-Bb3n0O7_.js → require-capability-DfrpjX-u.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-BOnaqol9.js → required-auth-layout-D-bn_J69.js} +1 -1
  149. package/dist/client/assets/{reset-password-CVCF1EWj.js → reset-password-CiNms6Sr.js} +1 -1
  150. package/dist/client/assets/{resizable-KoadMJep.js → resizable-v_bPD4vg.js} +1 -1
  151. package/dist/client/assets/{roles-9eEZA6Et.js → roles-A-J3RPs5.js} +1 -1
  152. package/dist/client/assets/{save-status-CTE6wlEr.js → save-status-caXPf-sW.js} +1 -1
  153. package/dist/client/assets/{schema-form-KT1GeubW.js → schema-form-OP25FipI.js} +1 -1
  154. package/dist/client/assets/{scroll-area-DRnD2Hi1.js → scroll-area-DfF1DGTO.js} +1 -1
  155. package/dist/client/assets/{search-input-C8HUEG33.js → search-input-D2vapx7T.js} +1 -1
  156. package/dist/client/assets/{secrets-DsI3_K8L.js → secrets-D9MKTymT.js} +1 -1
  157. package/dist/client/assets/{sections-editor-UpDrwI-5.js → sections-editor-7GVJxDWw.js} +1 -1
  158. package/dist/client/assets/{select-sIfPt8s2.js → select-D6NiWcOv.js} +1 -1
  159. package/dist/client/assets/{select-model-B6rYErDb.js → select-model-TEFtvtVK.js} +1 -1
  160. package/dist/client/assets/{seo-editor-xqI_4H2x.js → seo-editor-CxuXRBUg.js} +1 -1
  161. package/dist/client/assets/{settings-layout-BZb3IBu5.js → settings-layout-q8E9c9E2.js} +1 -1
  162. package/dist/client/assets/{settings-section-DQ3YChba.js → settings-section-BhG1oXRm.js} +1 -1
  163. package/dist/client/assets/{sheet-BuqHy-Si.js → sheet-CA-bu41g.js} +1 -1
  164. package/dist/client/assets/{shell-controls-CY1FFFgH.js → shell-controls-_xZFFXXO.js} +1 -1
  165. package/dist/client/assets/{shell-layout-CQkOfuM8.js → shell-layout-BJmtvdOF.js} +1 -1
  166. package/dist/client/assets/{shell-route-loading-CQmDFF5S.js → shell-route-loading-kYHtFyzE.js} +1 -1
  167. package/dist/client/assets/{sidebar-CuD3wsjA.js → sidebar-MAITYPYL.js} +1 -1
  168. package/dist/client/assets/{skeleton-CIa51SoU.js → skeleton-B3z9RhFw.js} +1 -1
  169. package/dist/client/assets/{sortable.esm-CwuS19fS.js → sortable.esm-ChXSQgk4.js} +1 -1
  170. package/dist/client/assets/{spinner-DopMyilY.js → spinner-u4N4s9Z6.js} +1 -1
  171. package/dist/client/assets/{sso-DZudOzL7.js → sso-QXpS_be1.js} +1 -1
  172. package/dist/client/assets/{store-CeeZSlM5.js → store-D0VBS3Tx.js} +1 -1
  173. package/dist/client/assets/store-registry-xnI7S9bB.js +2 -0
  174. package/dist/client/assets/{switch-CMjF5je3.js → switch-B-X7IR6_.js} +1 -1
  175. package/dist/client/assets/{tab-id-uZHKAnxy.js → tab-id-D4XtWZcv.js} +1 -1
  176. package/dist/client/assets/{table-Drf3IgG6.js → table-CUgkm7T_.js} +1 -1
  177. package/dist/client/assets/{tabs-xwE4oWoi.js → tabs-CxIIMzaj.js} +1 -1
  178. package/dist/client/assets/{task-status-uNlhhuR1.js → task-status-4rr9cZ7d.js} +1 -1
  179. package/dist/client/assets/{textarea-BX3azmwY.js → textarea-AHMya-Yu.js} +1 -1
  180. package/dist/client/assets/{toggle-group-BHICknTH.js → toggle-group-B_TX0y3P.js} +1 -1
  181. package/dist/client/assets/{toolbar-BP-z0tyV.js → toolbar-BNPhEiqF.js} +1 -1
  182. package/dist/client/assets/{tools-list-BuVTAuVQ.js → tools-list-ASCoS6LU.js} +1 -1
  183. package/dist/client/assets/{tooltip-Dew1dW6J.js → tooltip-VoacnTKM.js} +1 -1
  184. package/dist/client/assets/{types-YiD71gBA.js → types-DGaPEJ11.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-CP8Svjpa.js → use-ai-providers-B08Dfztq.js} +1 -1
  186. package/dist/client/assets/{use-automations-CvGtivCa.js → use-automations-D6JWA2qr.js} +1 -1
  187. package/dist/client/assets/{use-capability-DeWHWWpc.js → use-capability-CD7uDLwB.js} +1 -1
  188. package/dist/client/assets/{use-collections-D53B3cAC.js → use-collections-DEYzPSLv.js} +1 -1
  189. package/dist/client/assets/{use-connection-DDnrqSRD.js → use-connection-DY59WvYT.js} +1 -1
  190. package/dist/client/assets/{use-copy-Bt7O7jGp.js → use-copy-DAGbC1GA.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-JcDY6kpA.js → use-create-virtual-mcp-BXxjk7k6.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-DmoK52qY.js → use-debounced-autosave-BOriK1WA.js} +1 -1
  193. package/dist/client/assets/{use-delete-connection-CrZMBu8l.js → use-delete-connection-wvPOAsuG.js} +1 -1
  194. package/dist/client/assets/{use-file-configs-bFR_mt87.js → use-file-configs-c_8gPz9N.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-StOdWqVO.js → use-infinite-scroll-2beLt-Er.js} +1 -1
  196. package/dist/client/assets/{use-list-state-P0icAjHN.js → use-list-state-ZOMnKb9E.js} +1 -1
  197. package/dist/client/assets/{use-mcp-prompts-Bvpi-KUm.js → use-mcp-prompts-Z9l1A0Zz.js} +1 -1
  198. package/dist/client/assets/{use-mcp-tools-BpEixmcZ.js → use-mcp-tools-Da-abucn.js} +1 -1
  199. package/dist/client/assets/{use-members-C9WKx8Ke.js → use-members-BbxKUa81.js} +1 -1
  200. package/dist/client/assets/{use-navigate-to-agent-CBxpaXpy.js → use-navigate-to-agent-D4fCB-ku.js} +1 -1
  201. package/dist/client/assets/{use-org-auth-client-BFj-pU1a.js → use-org-auth-client-D8pwkohW.js} +1 -1
  202. package/dist/client/assets/{use-org-sso-vPIXgR2c.js → use-org-sso-Z-KrfZMw.js} +1 -1
  203. package/dist/client/assets/{use-organization-roles-BBiYTtNb.js → use-organization-roles-BPbcrovc.js} +1 -1
  204. package/dist/client/assets/{use-organization-settings-CsfMu5Qr.js → use-organization-settings-DK19F2g9.js} +1 -1
  205. package/dist/client/assets/{use-registry-connections-Dj0koBdK.js → use-registry-connections-BT5RIBa1.js} +1 -1
  206. package/dist/client/assets/{use-secrets-K7iHoOzj.js → use-secrets-HKPmUn7b.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-CjPj2h7f.js → use-status-sounds-bkoIBdSr.js} +1 -1
  208. package/dist/client/assets/{use-view-mode-1TCZbQjD.js → use-view-mode-DTI3AORs.js} +1 -1
  209. package/dist/client/assets/{use-virtual-mcp-O0NBqWjY.js → use-virtual-mcp-C0J6vZOy.js} +1 -1
  210. package/dist/client/assets/useInfiniteQuery-BYU0zu4v.js +1 -0
  211. package/dist/client/assets/{useRouterState-Z5rR6rOI.js → useRouterState-BpN6uFWZ.js} +1 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-CsscVl3c.js +1 -0
  213. package/dist/client/assets/{user-s_zONEew.js → user-DICnku4_.js} +1 -1
  214. package/dist/client/assets/{view-mode-toggle-BH_34oQQ.js → view-mode-toggle-CbsM9RpS.js} +1 -1
  215. package/dist/client/assets/{workflow-CIs4DWrm.js → workflow-3MM_iKc4.js} +1 -1
  216. package/dist/client/assets/workflow-detail-Nu0x63kt.js +1 -0
  217. package/dist/client/index.html +1 -1
  218. package/dist/server/cli.js +377 -377
  219. package/dist/server/server.js +268 -268
  220. package/package.json +1 -1
  221. package/dist/client/assets/agent-capabilities-CweaqBKI.js +0 -3
  222. package/dist/client/assets/app-editor-jqxZHZj0.js +0 -1
  223. package/dist/client/assets/page-seo-sheet-DJFCxpYr.js +0 -1
  224. package/dist/client/assets/project-app-view-5ev07WG-.js +0 -1
  225. package/dist/client/assets/record-editor-Be4_-H41.js +0 -1
  226. package/dist/client/assets/registry-ZN7E1Jb7.js +0 -2
  227. package/dist/client/assets/store-registry-BUPuU3um.js +0 -2
  228. package/dist/client/assets/useInfiniteQuery-b7VQW1Jm.js +0 -1
  229. package/dist/client/assets/useSuspenseInfiniteQuery-_xnb2z66.js +0 -1
  230. package/dist/client/assets/workflow-detail-wkW1PTr9.js +0 -1
@@ -1 +1 @@
1
- import{bC as _}from"./index-BVn__NxU.js";var S={exports:{}},r={};var $;function C(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function I(){return v||(v=1,S.exports=C()),S.exports}var g=I();const h=_(g);export{h as R,g as r};
1
+ import{bC as _}from"./index-B7tMIGCq.js";var S={exports:{}},r={};var $;function C(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function I(){return v||(v=1,S.exports=C()),S.exports}var g=I();const h=_(g);export{h as R,g as r};
@@ -1 +1 @@
1
- import{r as h}from"./index-BVn__NxU.js";var w=(o,i,l,s,c,t,m,d)=>{let r=document.documentElement,u=["light","dark"];function n(e){(Array.isArray(o)?o:[o]).forEach(a=>{let p=a==="class",S=p&&t?c.map(f=>t[f]||f):c;p?(r.classList.remove(...S),r.classList.add(t&&t[e]?t[e]:e)):r.setAttribute(a,e)}),y(e)}function y(e){d&&u.includes(e)&&(r.style.colorScheme=e)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)n(s);else try{let e=localStorage.getItem(i)||l,a=m&&e==="system"?g():e;n(a)}catch{}};h.createContext(void 0);h.memo(({forcedTheme:o,storageKey:i,attribute:l,enableSystem:s,enableColorScheme:c,defaultTheme:t,value:m,themes:d,nonce:r,scriptProps:u})=>{let n=JSON.stringify([l,i,t,o,d,m,s,c]).slice(1,-1);return h.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?r:"",dangerouslySetInnerHTML:{__html:`(${w.toString()})(${n})`}})});
1
+ import{r as h}from"./index-B7tMIGCq.js";var w=(o,i,l,s,c,t,m,d)=>{let r=document.documentElement,u=["light","dark"];function n(e){(Array.isArray(o)?o:[o]).forEach(a=>{let p=a==="class",S=p&&t?c.map(f=>t[f]||f):c;p?(r.classList.remove(...S),r.classList.add(t&&t[e]?t[e]:e)):r.setAttribute(a,e)}),y(e)}function y(e){d&&u.includes(e)&&(r.style.colorScheme=e)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)n(s);else try{let e=localStorage.getItem(i)||l,a=m&&e==="system"?g():e;n(a)}catch{}};h.createContext(void 0);h.memo(({forcedTheme:o,storageKey:i,attribute:l,enableSystem:s,enableColorScheme:c,defaultTheme:t,value:m,themes:d,nonce:r,scriptProps:u})=>{let n=JSON.stringify([l,i,t,o,d,m,s,c]).slice(1,-1);return h.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?r:"",dangerouslySetInnerHTML:{__html:`(${w.toString()})(${n})`}})});
@@ -1,4 +1,4 @@
1
- import{cY as tc,dU as Fe,bV as Os,W as oe,U as ge,aK as ti,ct as _i,aH as Ie,bT as mt,bp as Ve,aI as mr,dV as rn,T as _e,dW as Ii,dX as ws,dY as nc,cr as rc,dZ as ia,d_ as ic,d$ as sc,e0 as oc,d8 as fn,d9 as Cr,da as xs,ch as sa,c9 as ac,ba as ze,cs as lc,aJ as On,bC as Ti,e1 as cc,r as N,j as w,e2 as oa,cX as uc}from"./index-BVn__NxU.js";import{A as aa,d as fc,e as dc,n as hc,f as pc,C as mc}from"./constants-kA9rWvH5.js";import{B as Ci,c as Pi}from"./collections-vKAzbOjS.js";import{R as Es}from"./index-BxheWbKP.js";function yc(){const e=new aa({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tc(e),e}class gc{#e=yc();#t=new Map;#n=new WeakMap;getValidator(t){const n=this.#n.get(t);if(n)return n;const r=bc(t);let i=this.#t.get(r);i||(i=this.#e.compile(t),this.#t.set(r,i));const s=i,o=a=>s(a)?{valid:!0,data:a,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this.#e.errorsText(s.errors)};return this.#n.set(t,o),o}}function bc(e){return JSON.stringify(e,(t,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,n[r]])):n)}const Sc=new gc;var vc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},Oc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=Ve(n):typeof n=="number"?e.number=Ve(n):typeof n=="boolean"?e.boolean=Ve(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},wc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return Ve(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([Ve(n),Ve(r),...i.map(s=>Ve(s))])}return t==="boolean"?mt([Ve(!0),Ve(!1)]):!1}},xc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=oc();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Ec=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},Ac=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},_c=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},Ic=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},Tc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Cc=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Pc=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},Fc=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},jc=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},$c=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Dc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Nc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Rc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof nc){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},Mc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},Uc=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},kc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Lc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Bc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Cn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Cn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Cn(e[i],t[i]))}return!1}function Wc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Cn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Vc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},qc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Wc(),{message:"Array items must be unique"})}},Hc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Kc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Gc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},zc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Yc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof ic||e instanceof sc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Jc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Cn(r,i)),{message:"Value must match one of the enum values"})}},Zc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Cn(r,n),{message:"Value must equal the const value"})}},Xc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},Qc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},eu=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},tu=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},nu=[new Oc,new wc,new vc,new xc,new Ec,new $c,new kc,new Ac,new _c,new Ic,new Tc,new Cc,new Pc,new Fc,new jc,new Mc,new Dc,new Nc,new Rc,new Lc,new Bc,new Uc],ru=[new Qc,new Jc,new Zc,new Hc,new Kc,new Gc,new zc,new Yc,new eu,new Vc,new qc,new tu,new Xc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of nu)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=rc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of ru)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function iu(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var la=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||la("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?la("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Te,Et,kt,Qn,ur,wn,Vt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Te),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,Vt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Te)===this.CLOSED)return;he(this,Te,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,Vt,void 0),G(this,Te)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,su()));else throw new Error("Invalid URL")}catch{throw iu("An invalid or illegal string was specified")}he(this,Lt,fc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Te,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Te)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,Vt)&&clearTimeout(G(this,Vt)),G(this,Te)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Te,this.CLOSED),he(this,ct,void 0))}}Te=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,Vt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Te,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Te)!==this.CLOSED&&he(this,Te,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Te)===this.CLOSED)return;he(this,Te,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,Vt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function su(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class ou extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class au{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=dc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Cr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=hc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new ou(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Cr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Cr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const lu="mcp";class cu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,lu),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class uu extends pc{constructor(t,n){super(t,n)}send(t,n){const r=fu(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function fu(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class du extends mc{constructor(t,n){super(t,{jsonSchemaValidator:Sc,...n})}async listTools(t,n){return await this.request({method:"tools/list",params:t},ac,n)}}const hu=async(e,t,n)=>{const r=pu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new du({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},pu=(e,t,n)=>{if(e.type==="Websocket")return new cu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new au(new URL(e.url),s)}return new uu(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Ts=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Cs=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function mu(e){const t=n=>"connection"in e?hu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Ts(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Ts(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Cs(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Cs(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>yu({connection:n}):global[t]}});function yu(e){return mu(e)}const gu=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),bu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
1
+ import{cY as tc,dU as Fe,bV as Os,W as oe,U as ge,aK as ti,ct as _i,aH as Ie,bT as mt,bp as Ve,aI as mr,dV as rn,T as _e,dW as Ii,dX as ws,dY as nc,cr as rc,dZ as ia,d_ as ic,d$ as sc,e0 as oc,d8 as fn,d9 as Cr,da as xs,ch as sa,c9 as ac,ba as ze,cs as lc,aJ as On,bC as Ti,e1 as cc,r as N,j as w,e2 as oa,cX as uc}from"./index-B7tMIGCq.js";import{A as aa,d as fc,e as dc,n as hc,f as pc,C as mc}from"./constants-CNZvm1cO.js";import{B as Ci,c as Pi}from"./collections-Ca9cgdYF.js";import{R as Es}from"./index-B9ljcRCy.js";function yc(){const e=new aa({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tc(e),e}class gc{#e=yc();#t=new Map;#n=new WeakMap;getValidator(t){const n=this.#n.get(t);if(n)return n;const r=bc(t);let i=this.#t.get(r);i||(i=this.#e.compile(t),this.#t.set(r,i));const s=i,o=a=>s(a)?{valid:!0,data:a,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this.#e.errorsText(s.errors)};return this.#n.set(t,o),o}}function bc(e){return JSON.stringify(e,(t,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,n[r]])):n)}const Sc=new gc;var vc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},Oc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=Ve(n):typeof n=="number"?e.number=Ve(n):typeof n=="boolean"?e.boolean=Ve(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},wc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return Ve(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([Ve(n),Ve(r),...i.map(s=>Ve(s))])}return t==="boolean"?mt([Ve(!0),Ve(!1)]):!1}},xc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=oc();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Ec=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},Ac=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},_c=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},Ic=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},Tc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Cc=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Pc=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},Fc=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},jc=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},$c=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Dc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Nc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Rc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof nc){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},Mc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},Uc=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},kc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Lc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Bc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Cn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Cn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Cn(e[i],t[i]))}return!1}function Wc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Cn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Vc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},qc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Wc(),{message:"Array items must be unique"})}},Hc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Kc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Gc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},zc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Yc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof ic||e instanceof sc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Jc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Cn(r,i)),{message:"Value must match one of the enum values"})}},Zc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Cn(r,n),{message:"Value must equal the const value"})}},Xc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},Qc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},eu=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},tu=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},nu=[new Oc,new wc,new vc,new xc,new Ec,new $c,new kc,new Ac,new _c,new Ic,new Tc,new Cc,new Pc,new Fc,new jc,new Mc,new Dc,new Nc,new Rc,new Lc,new Bc,new Uc],ru=[new Qc,new Jc,new Zc,new Hc,new Kc,new Gc,new zc,new Yc,new eu,new Vc,new qc,new tu,new Xc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of nu)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=rc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of ru)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function iu(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var la=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||la("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?la("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Te,Et,kt,Qn,ur,wn,Vt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Te),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,Vt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Te)===this.CLOSED)return;he(this,Te,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,Vt,void 0),G(this,Te)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,su()));else throw new Error("Invalid URL")}catch{throw iu("An invalid or illegal string was specified")}he(this,Lt,fc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Te,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Te)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,Vt)&&clearTimeout(G(this,Vt)),G(this,Te)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Te,this.CLOSED),he(this,ct,void 0))}}Te=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,Vt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Te,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Te)!==this.CLOSED&&he(this,Te,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Te)===this.CLOSED)return;he(this,Te,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,Vt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function su(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class ou extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class au{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=dc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Cr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=hc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new ou(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Cr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Cr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const lu="mcp";class cu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,lu),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class uu extends pc{constructor(t,n){super(t,n)}send(t,n){const r=fu(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function fu(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class du extends mc{constructor(t,n){super(t,{jsonSchemaValidator:Sc,...n})}async listTools(t,n){return await this.request({method:"tools/list",params:t},ac,n)}}const hu=async(e,t,n)=>{const r=pu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new du({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},pu=(e,t,n)=>{if(e.type==="Websocket")return new cu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new au(new URL(e.url),s)}return new uu(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Ts=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Cs=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function mu(e){const t=n=>"connection"in e?hu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Ts(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Ts(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Cs(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Cs(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>yu({connection:n}):global[t]}});function yu(e){return mu(e)}const gu=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),bu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
2
2
  The stepInput is the resolved value of the references in the input field. Example:
3
3
  {
4
4
  "input": {
@@ -1 +1 @@
1
- import{ar as st,as as me,at as it,au as nt,av as Ae,G as pe,aw as rt,ax as ot,r as M,ay as lt,az as at,aA as ct,aB as dt,aC as je,aD as mt,aE as ut,aF as ft,e as $,j as i,q as V,c as K,l as Me,aG as xe,o as W,K as oe,n as le,a as ht,v as pt,E as xt,b as gt,B as we}from"./index-BVn__NxU.js";import{u as ge}from"./tooltip-Dew1dW6J.js";import{i as bt,u as ee,S as Le,g as yt}from"./constants-kA9rWvH5.js";import{a as vt,b as jt,v as wt,u as Nt}from"./use-virtual-mcp-O0NBqWjY.js";import{i as St}from"./Check-BXdJG7IX.js";import{Z as _t,A as Y,$ as Ct,u as Tt,c as Et}from"./agent-icon-Dqe2G8l6.js";import{s as be}from"./Plus-BFwEplz1.js";import{i as ze}from"./X-IA2k1lZV.js";import{u as It,b as kt,h as $t,C as ne}from"./agent-capabilities-CweaqBKI.js";import{u as At,c as Mt}from"./chat-context-DAZfCiSi.js";import{N as Lt}from"./agent-icons-BZzVIoSr.js";import{u as Oe,a as re,K as Re,P as Pe,D as De,c as zt,S as Ot,v as Rt,b as Pt,C as Dt,s as Ht,d as Bt,e as Ut,f as Ft}from"./sortable.esm-CwuS19fS.js";import{u as He,a as Be,o as Qt}from"./use-organization-settings-CsfMu5Qr.js";import{c as ye,u as Wt,h as qt}from"./shell-layout-CQkOfuM8.js";import{I as Kt}from"./input-C1HJ5Zf7.js";import{S as Xt}from"./scroll-area-DRnD2Hi1.js";import{S as Gt,c as Vt,d as Zt,a as Jt,b as Yt}from"./sheet-BuqHy-Si.js";import{S as D}from"./skeleton-CIa51SoU.js";import{t as Ue}from"./ChevronDown-Cey2L4Eb.js";import{d as Fe}from"./ZoomOut-CFwr52eB.js";import{g as es,M as ts}from"./types-YiD71gBA.js";import{I as ss}from"./integration-icon-BOQdoPAu.js";import{u as is}from"./unwrap-tool-result-BYXdCQMg.js";import{t as Qe,P as ns,e as rs,s as os,g as ls}from"./pair-VRhixa1-.js";import{a as as}from"./XCircle-BjboHb-q.js";import{g as cs}from"./use-mcp-prompts-Bvpi-KUm.js";import{u as ds,w as ms}from"./tab-id-uZHKAnxy.js";import{D as us,a as fs,b as hs,h as ps,c as Ne,d as xs}from"./dropdown-menu-CDKNh3cP.js";import{s as gs}from"./Trash01-ACbi1Ltw.js";import{a as bs,u as ys}from"./use-ai-providers-CP8Svjpa.js";import{a as vs}from"./toolbar-BP-z0tyV.js";import"./use-collections-D53B3cAC.js";import"./AlertCircle-CMSkIA9E.js";import"./Tool01-BbbVaqpj.js";import"./SwitchHorizontal01-Ijxg5N6G.js";import"./RefreshCcw01-BHSrgNLa.js";import"./ArrowUpRight-BU_doFgY.js";import"./ZapSquare-CexDE4rM.js";import"./Users03-x49ISqXw.js";import"./CheckCircle-Y8pQlek8.js";import"./ChevronLeft-kI7QenDi.js";import"./ChevronRight-CVJANjc-.js";import"./ChevronUp-OF-9kR35.js";import"./DotsVertical-BVOHmnSk.js";import"./Container-D6nffAf7.js";import"./Eye-DHs2I-Av.js";import"./Globe01-BWO8gXaQ.js";import"./FilterLines--Y6NBJ0G.js";import"./Star01-89lkc6pp.js";import"./Palette-CHdbp1n7.js";import"./HardDrive-kmcEZpKn.js";import"./Stars02-CifKQ3Pc.js";import"./Key01-y2clCwOu.js";import"./LayoutLeft-CoYySogd.js";import"./LinkExternal01-BXgyzJwg.js";import"./Monitor01-Dgg3fTje.js";import"./Sun-ByYnyvJz.js";import"./Play-DHAAJoir.js";import"./SearchMd-B_TDDT-J.js";import"./Settings02-DakgZ_6U.js";import"./Shield01-DgxPEC3k.js";import"./Stars01-BG4JVYDm.js";import"./Upload01-DrTNbCod.js";import"./User01-DLJ_n1LK.js";import"./Users01-C3slMaaS.js";import"./XClose-RzErdjnv.js";import"./Zap-DOMCV9vX.js";import"./spinner-DopMyilY.js";import"./dialog-B4w5HroU.js";import"./drawer-DjJS3_gd.js";import"./collection-search-CZDXSMn-.js";import"./form-CBSLMGev.js";import"./label-BXcRR1X8.js";import"./select-sIfPt8s2.js";import"./tabs-xwE4oWoi.js";import"./toggle-group-BHICknTH.js";import"./connect-desktop-dialog-CbvHGPbf.js";import"./popover-C7YUc47y.js";import"./command-CwWqPNsH.js";import"./index-BDw1Z9lp.js";import"./useInfiniteQuery-b7VQW1Jm.js";import"./infiniteQueryObserver-B9utYzeT.js";import"./index-BNnfBCaX.js";import"./question-004-sINsf4GQ.js";import"./checkbox-DgCOgJ_F.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-o0teoCxe.js";import"./settings-section-DQ3YChba.js";import"./card-fxwvyxSe.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-8_99bUQw.js";import"./use-registry-connections-Dj0koBdK.js";import"./use-connection-DDnrqSRD.js";import"./extract-connection-data-DGFjfipx.js";import"./generate-id-BAuGEsGf.js";import"./collections-vKAzbOjS.js";import"./collection-tabs-ixrhsC43.js";import"./badge-Bw33wy_e.js";import"./textarea-BX3azmwY.js";import"./connection-form-helpers-Dg6lEM1u.js";import"./use-infinite-scroll-StOdWqVO.js";import"./useSuspenseInfiniteQuery-_xnb2z66.js";import"./required-auth-layout-BOnaqol9.js";import"./useRouterState-Z5rR6rOI.js";import"./use-org-sso-vPIXgR2c.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Bt7O7jGp.js";import"./file-type-icon-Da4ldwse.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-CBxpaXpy.js";import"./decopilot-sse-pool-CcaUpt2_.js";import"./create-sse-subscription-BS5983N4.js";function Se(t,e){const s=new Set(e);return t.filter(r=>!s.has(r))}function js(t,e,s){const r=t.slice(0);return r[e]=s,r}var ws=class extends st{#n;#e;#r;#i;#t;#s;#o;#l;#a;#c=[];constructor(t,e,s){super(),this.#n=t,this.#i=s,this.#r=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(t=>{t.subscribe(e=>{this.#f(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(t=>{t.destroy()})}setQueries(t,e){this.#r=t,this.#i=e,me.batch(()=>{const s=this.#t,r=this.#u(this.#r);r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const n=r.map(m=>m.observer),l=n.map(m=>m.getCurrentResult()),o=s.length!==n.length,c=n.some((m,u)=>m!==s[u]),a=o||c,d=a?!0:l.some((m,u)=>{const f=this.#e[u];return!f||!it(m,f)});!a&&!d||(a&&(this.#c=r,this.#t=n),this.#e=l,this.hasListeners()&&(a&&(Se(s,n).forEach(m=>{m.destroy()}),Se(n,s).forEach(m=>{m.subscribe(u=>{this.#f(m,u)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(t=>t.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(t,e){const s=this.#u(t),r=s.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),n=s.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>this.#m(l??r,e,n),()=>this.#d(r,s)]}#d(t,e){return e.map((s,r)=>{const n=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?n:s.observer.trackResult(n,l=>{e.forEach(o=>{o.observer.trackProp(l)})})})}#m(t,e,s){if(e){const r=this.#a,n=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((l,o)=>l!==r[o]));return(!this.#s||this.#e!==this.#l||n||e!==this.#o)&&(this.#o=e,this.#l=this.#e,s!==void 0&&(this.#a=s),this.#s=nt(this.#s,e(t))),this.#s}return t}#p(){return this.#i?.combine!==void 0&&this.#t.some((t,e)=>t.options.suspense&&this.#e[e]?.data===void 0)}#u(t){const e=new Map;this.#t.forEach(r=>{const n=r.options.queryHash;if(!n)return;const l=e.get(n);l?l.push(r):e.set(n,[r])});const s=[];return t.forEach(r=>{const n=this.#n.defaultQueryOptions(r),o=e.get(n.queryHash)?.shift()??new Ae(this.#n,n);s.push({defaultedQueryOptions:n,observer:o})}),s}#f(t,e){const s=this.#t.indexOf(t);s!==-1&&(this.#e=js(this.#e,s,e),this.#h())}#h(){if(this.hasListeners()){const t=this.#d(this.#e,this.#c),e=this.#p(),s=this.#s,r=e?s:this.#m(t,this.#i?.combine);(e||s!==r)&&me.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ns({queries:t,...e},s){const r=pe(s),n=rt(),l=ot(),o=M.useMemo(()=>t.map(p=>{const h=r.defaultQueryOptions(p);return h._optimisticResults=n?"isRestoring":"optimistic",h}),[t,r,n]);o.forEach(p=>{lt(p);const h=r.getQueryCache().get(p.queryHash);at(p,l,h)}),ct(l);const[c]=M.useState(()=>new ws(r,o,e)),[a,d,m]=c.getOptimisticResult(o,e.combine),u=!n&&e.subscribed!==!1;M.useSyncExternalStore(M.useCallback(p=>u?c.subscribe(me.batchCalls(p)):dt,[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setQueries(o,e)},[o,e,c]);const x=a.some((p,h)=>je(o[h],p))?a.flatMap((p,h)=>{const g=o[h];if(g&&je(g,p)){const y=new Ae(r,g);return mt(g,y,l)}return[]}):[];if(x.length>0)throw Promise.all(x);const b=a.find((p,h)=>{const g=o[h];return g&&ut({result:p,errorResetBoundary:l,throwOnError:g.throwOnError,query:r.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(b?.error)throw b.error;return d(m())}function Ss(t,e){return Ns({...t,queries:t.queries.map(s=>({...s,suspense:!0,throwOnError:ft,enabled:!0,placeholderData:void 0}))},e)}const te=8;function _s(t){const e=$.c(16),{open:s,onOpenChange:r}=t,[n,l]=M.useState("");let o,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Gt,{children:"Manage home"}),c=i.jsx(Vt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=o,e[1]=c):(o=e[0],c=e[1]);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(_t,{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]=a):a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=p=>l(p.target.value),e[3]=d):d=e[3];let m;e[4]!==n?(m=i.jsxs(Zt,{className:"px-5 py-4 border-b border-border",children:[o,c,i.jsxs("div",{className:"relative mt-3",children:[a,i.jsx(Kt,{value:n,onChange:d,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=n,e[5]=m):m=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ys,{}),e[6]=u):u=e[6];let f;e[7]!==n?(f=i.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3 flex flex-col gap-4",children:i.jsx(M.Suspense,{fallback:u,children:i.jsx(Ts,{search:n})})})}),e[7]=n,e[8]=f):f=e[8];let x;e[9]!==m||e[10]!==f?(x=i.jsxs(Jt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[m,f]}),e[9]=m,e[10]=f,e[11]=x):x=e[11];let b;return e[12]!==r||e[13]!==s||e[14]!==x?(b=i.jsx(Yt,{open:s,onOpenChange:r,children:x}),e[12]=r,e[13]=s,e[14]=x,e[15]=b):b=e[15],b}function Cs(t){const e=$.c(32),{org:s}=V(),r=He();let n;e[0]!==r?.ids?(n=r?.ids??[],e[0]=r?.ids,e[1]=n):n=e[1];const l=n,o=Be(),c=jt(),a=pe();let d;e[2]!==s||e[3]!==a?(d=()=>a.refetchQueries({queryKey:oe.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=a,e[4]=d):d=e[4];const m=d;let u;e[5]!==l?(u=_=>l.includes(_),e[5]=l,e[6]=u):u=e[6];const f=u;let x;e[7]!==l||e[8]!==t?(x=t?l.filter(_=>t.has(_)).length:l.length,e[7]=l,e[8]=t,e[9]=x):x=e[9];const p=x>=te;let h;e[10]!==p||e[11]!==f||e[12]!==o?(h=_=>f(_)||p?Promise.resolve():o.apply(T=>T.includes(_)?null:[...T,_]),e[10]=p,e[11]=f,e[12]=o,e[13]=h):h=e[13];const g=h;let y;e[14]!==o?(y=_=>o.apply(T=>T.filter(I=>I!==_)),e[14]=o,e[15]=y):y=e[15];const j=y;let v;e[16]!==o?(v=_=>o.apply(()=>_),e[16]=o,e[17]=v):v=e[17];const w=v;let N;e[18]!==c||e[19]!==p||e[20]!==f||e[21]!==m||e[22]!==o?(N=async(_,T)=>{await c.update.mutateAsync({id:_.id,data:{metadata:T}}),!f(_.id)&&!p&&await o.apply(I=>I.includes(_.id)?null:[...I,_.id]),await m()},e[18]=c,e[19]=p,e[20]=f,e[21]=m,e[22]=o,e[23]=N):N=e[23];const S=N;let C;return e[24]!==g||e[25]!==p||e[26]!==l||e[27]!==f||e[28]!==j||e[29]!==w||e[30]!==S?(C={homeIds:l,isOnHome:f,atLimit:p,addAgent:g,removeAgent:j,reorder:w,saveAgentMetadata:S},e[24]=g,e[25]=p,e[26]=l,e[27]=f,e[28]=j,e[29]=w,e[30]=S,e[31]=C):C=e[31],C}function Ts(t){const e=$.c(21),{search:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={pageSize:1e3},e[0]=r):r=e[0];const n=vt(r);let l;e[1]!==n?(l=new Set(n.map(As)),e[1]=n,e[2]=l):l=e[2];const o=Cs(l);let c,a,d;if(e[3]!==n||e[4]!==o||e[5]!==s){const p=new Map(n.map($s));c=s.trim().toLowerCase();const h=y=>!c||y.title?.toLowerCase().includes(c);a=o.homeIds.map(y=>p.get(y)).filter(ks).filter(h);let g;e[9]!==o?(g=y=>!o.isOnHome(y.id),e[9]=o,e[10]=g):g=e[10],d=n.filter(Is).filter(g).filter(h).sort(Es),e[3]=n,e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=d}else c=e[6],a=e[7],d=e[8];const m=d;let u;e[11]!==o||e[12]!==a?(u=i.jsx(Ms,{home:o,agents:a}),e[11]=o,e[12]=a,e[13]=u):u=e[13];const f=!!c;let x;e[14]!==m||e[15]!==o||e[16]!==f?(x=i.jsx(Os,{home:o,agents:m,hasSearch:f}),e[14]=m,e[15]=o,e[16]=f,e[17]=x):x=e[17];let b;return e[18]!==u||e[19]!==x?(b=i.jsxs(i.Fragment,{children:[u,x]}),e[18]=u,e[19]=x,e[20]=b):b=e[20],b}function Es(t,e){return(t.title??"").localeCompare(e.title??"")}function Is(t){return t.id&&!bt(t.id)}function ks(t){return!!t}function $s(t){return[t.id,t]}function As(t){return t.id}function We(t){const e=$.c(7),{title:s,hint:r}=t;let n;e[0]!==s?(n=i.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1];let l;e[2]!==r?(l=r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let o;return e[4]!==n||e[5]!==l?(o=i.jsxs("div",{className:"flex items-center justify-between px-1",children:[n,l]}),e[4]=n,e[5]=l,e[6]=o):o=e[6],o}function Ms(t){const e=$.c(14),{home:s,agents:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={activationConstraint:{distance:5}},e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={coordinateGetter:Ht},e[1]=l):l=e[1];const o=Oe(re(Pe,n),re(Re,l));let c;e[2]!==s?(c=x=>{const{active:b,over:p}=x;if(!p||b.id===p.id)return;const h=s.homeIds,g=h.indexOf(b.id),y=h.indexOf(p.id);g===-1||y===-1||s.reorder(Bt([...h],g,y)).catch(zs)},e[2]=s,e[3]=c):c=e[3];const a=c,d=`${s.homeIds.length}/${te}`;let m;e[4]!==d?(m=i.jsx(We,{title:"On home",hint:d}),e[4]=d,e[5]=m):m=e[5];let u;e[6]!==r||e[7]!==a||e[8]!==s||e[9]!==o?(u=r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):i.jsx(De,{sensors:o,collisionDetection:zt,onDragEnd:a,children:i.jsx(Ot,{items:r.map(Ls),strategy:Rt,children:i.jsx("div",{className:"flex flex-col gap-1",children:r.map(x=>i.jsx(Ps,{agent:x,home:s},x.id))})})}),e[6]=r,e[7]=a,e[8]=s,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==m||e[12]!==u?(f=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,u]}),e[11]=m,e[12]=u,e[13]=f):f=e[13],f}function Ls(t){return t.id}function zs(){return W.error("Couldn't reorder home — please try again.")}function Os(t){const e=$.c(6),{home:s,agents:r,hasSearch:n}=t,[l,o]=M.useState(20);let c;if(e[0]!==r||e[1]!==n||e[2]!==s||e[3]!==l){const a=r.slice(0,l);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(We,{title:"Add to home"}),e[5]=d):d=e[5],c=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:n?"No agents match.":"Every agent is on the home."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>i.jsx(Bs,{agent:m,home:s},m.id))}),r.length>l&&i.jsxs("button",{type:"button",onClick:()=>o(Rs),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 (",r.length-l,")"]})]})]}),e[0]=r,e[1]=n,e[2]=s,e[3]=l,e[4]=c}else c=e[4];return c}function Rs(t){return t+20}function qe(t){const e=xe(t.metadata?.ui).filter(l=>!!l.resourceUri).length,s=t.metadata?.ui?.homePrompts,r=Array.isArray(s)?s.length:null,n=[];return e>0&&n.push(`${e} tile${e===1?"":"s"}`),r!==null&&r>0&&n.push(`${r} prompt${r===1?"":"s"}`),r===0&&n.push("prompts off"),n.join(" · ")}function Ps(t){const e=$.c(57),{agent:s,home:r}=t,[n,l]=M.useState(!1);let o;e[0]!==s.id?(o={id:s.id},e[0]=s.id,e[1]=o):o=e[1];const{attributes:c,listeners:a,setNodeRef:d,transform:m,transition:u,isDragging:f}=Pt(o),x=qe(s)||"Quick access";let b;e[2]!==m?(b=Dt.Transform.toString(m),e[2]=m,e[3]=b):b=e[3];const p=f?.5:void 0,h=f?100:void 0;let g;e[4]!==b||e[5]!==p||e[6]!==h||e[7]!==u?(g={transform:b,transition:u,opacity:p,zIndex:h},e[4]=b,e[5]=p,e[6]=h,e[7]=u,e[8]=g):g=e[8];const y=g,j=f&&"shadow-lg";let v;e[9]!==j?(v=K("rounded-lg border border-border bg-card",j),e[9]=j,e[10]=v):v=e[10];const w=`Drag to reorder ${s.title??s.id}`;let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(Fe,{size:14}),e[11]=N):N=e[11];let S;e[12]!==c||e[13]!==a||e[14]!==w?(S=i.jsx("button",{type:"button",...c,...a,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":w,children:N}),e[12]=c,e[13]=a,e[14]=w,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>l(Hs),e[16]=C):C=e[16];const _=s.title??s.id;let T;e[17]!==s.icon||e[18]!==_?(T=i.jsx(Y,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=T):T=e[19];const I=s.title??s.id;let E;e[20]!==I?(E=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=E):E=e[21];let k;e[22]!==x?(k=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:x}),e[22]=x,e[23]=k):k=e[23];let L;e[24]!==E||e[25]!==k?(L=i.jsxs("div",{className:"min-w-0 flex-1",children:[E,k]}),e[24]=E,e[25]=k,e[26]=L):L=e[26];const U=n&&"rotate-180";let O;e[27]!==U?(O=K("shrink-0 text-muted-foreground transition-transform",U),e[27]=U,e[28]=O):O=e[28];let R;e[29]!==O?(R=i.jsx(Ue,{size:16,className:O}),e[29]=O,e[30]=R):R=e[30];let Q;e[31]!==n||e[32]!==T||e[33]!==L||e[34]!==R?(Q=i.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":n,children:[T,L,R]}),e[31]=n,e[32]=T,e[33]=L,e[34]=R,e[35]=Q):Q=e[35];let A;e[36]!==s.id||e[37]!==r?(A=()=>r.removeAgent(s.id).catch(Ds),e[36]=s.id,e[37]=r,e[38]=A):A=e[38];const F=`Remove ${s.title??s.id} from home`;let P;e[39]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(ze,{size:14}),e[39]=P):P=e[39];let z;e[40]!==A||e[41]!==F?(z=i.jsx("button",{type:"button",onClick:A,"aria-label":F,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:P}),e[40]=A,e[41]=F,e[42]=z):z=e[42];let H;e[43]!==S||e[44]!==Q||e[45]!==z?(H=i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,Q,z]}),e[43]=S,e[44]=Q,e[45]=z,e[46]=H):H=e[46];let B;e[47]!==s||e[48]!==n||e[49]!==r?(B=n&&i.jsx(Ke,{agent:s,home:r}),e[47]=s,e[48]=n,e[49]=r,e[50]=B):B=e[50];let q;return e[51]!==d||e[52]!==y||e[53]!==H||e[54]!==B||e[55]!==v?(q=i.jsxs("div",{ref:d,style:y,className:v,children:[H,B]}),e[51]=d,e[52]=y,e[53]=H,e[54]=B,e[55]=v,e[56]=q):q=e[56],q}function Ds(){return W.error("Couldn't remove from home — please try again.")}function Hs(t){return!t}function Bs({agent:t,home:e}){const[s,r]=M.useState(!1),[n,l]=M.useState(!1),o=qe(t),c=async()=>{if(!e.atLimit){l(!0);try{await e.addAgent(t.id)}catch{W.error("Couldn't add to home — please try again.")}finally{l(!1)}}};return i.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[i.jsxs("button",{type:"button",onClick:()=>r(a=>!a),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[i.jsx(Y,{icon:t.icon,name:t.title??t.id,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),o&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o})]}),i.jsx(Ue,{size:16,className:K("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),i.jsx("button",{type:"button",onClick:c,disabled:n||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${te}) — 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:n?i.jsx(Me,{size:12,className:"animate-spin"}):i.jsx(be,{size:14})})]}),s&&i.jsx(Ke,{agent:t,home:e})]})}function Ke(t){const e=$.c(26),{agent:s,home:r}=t;let n,l,o,c,a,d,m;if(e[0]!==s||e[1]!==r){const h=xe(s.metadata?.ui);let g;e[9]!==s.connections?(g=(s.connections??[]).map(Fs).sort(),e[9]=s.connections,e[10]=g):g=e[10];const y=g;l=s.metadata?.ui?.homePrompts,m="border-t border-border px-3 py-2 flex flex-col gap-3",n=Ws,o=s,c=r,a=y,d=new Set(h.map(Us)),e[0]=s,e[1]=r,e[2]=n,e[3]=l,e[4]=o,e[5]=c,e[6]=a,e[7]=d,e[8]=m}else n=e[2],l=e[3],o=e[4],c=e[5],a=e[6],d=e[7],m=e[8];let u;e[11]!==n||e[12]!==o||e[13]!==c||e[14]!==a||e[15]!==d?(u=i.jsx(n,{agent:o,home:c,connectionIds:a,pinnedResourceUris:d}),e[11]=n,e[12]=o,e[13]=c,e[14]=a,e[15]=d,e[16]=u):u=e[16];let f;e[17]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Qs,{}),e[17]=f):f=e[17];const x=l??null;let b;e[18]!==s||e[19]!==r||e[20]!==x?(b=i.jsx(M.Suspense,{fallback:f,children:i.jsx(Ks,{agent:s,home:r,curated:x})}),e[18]=s,e[19]=r,e[20]=x,e[21]=b):b=e[21];let p;return e[22]!==m||e[23]!==u||e[24]!==b?(p=i.jsxs("div",{className:m,children:[u,b]}),e[22]=m,e[23]=u,e[24]=b,e[25]=p):p=e[25],p}function Us(t){return t.resourceUri}function Fs(t){return t.connection_id}function Qs(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[i.jsx(D,{className:"h-8 w-full"}),i.jsx(D,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Ws({agent:t,home:e,connectionIds:s,pinnedResourceUris:r}){const{org:n}=V(),l=ee({connectionId:Le,orgId:n.id,orgSlug:n.slug}),{data:o,isLoading:c}=le({queryKey:oe.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async d=>{try{const m=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}}),{item:u}=is(m),f=(u?.tools??[]).flatMap(x=>{const b=es(x._meta);return b?[{name:x.name,description:x.description,resourceUri:b}]:[]});return{id:d,title:u?.title??d,icon:u?.icon??null,uiTools:f}}catch{return{id:d,title:d,icon:null,uiTools:[]}}}))).filter(d=>d.uiTools.length>0)});return s.length===0?null:c?i.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[i.jsx(D,{className:"h-7 w-full"}),i.jsx(D,{className:"h-7 w-2/3"})]}):!o||o.length===0?null:i.jsx("div",{className:"flex flex-col gap-0.5",children:o.map(a=>a.uiTools.map(d=>i.jsx(qs,{agent:t,home:e,connection:a,tool:d,isPinned:r.has(d.resourceUri)},`${a.id}:${d.name}`)))})}function qs({agent:t,home:e,connection:s,tool:r,isPinned:n}){const[l,o]=M.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=xe(t.metadata?.ui),d=n?a.filter(u=>u.resourceUri!==r.resourceUri):[...a,{connectionId:s.id,resourceUri:r.resourceUri}],m={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:d}};await e.saveAgentMetadata(t,m)}catch(a){console.error("[home-tiles] failed to toggle tile",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx(ss,{icon:s.icon,name:s.title,size:"xs"}),i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:Qe(r.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Xe(t){const e=$.c(11),{isPinned:s,submitting:r,onClick:n,label:l}=t,o=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let c;e[0]!==o?(c=K("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]!==s||e[3]!==r?(a=r?i.jsx(Me,{size:12,className:"animate-spin"}):s?i.jsx(Ct,{size:14}):i.jsx(be,{size:14}),e[2]=s,e[3]=r,e[4]=a):a=e[4];let d;return e[5]!==l||e[6]!==n||e[7]!==r||e[8]!==c||e[9]!==a?(d=i.jsx("button",{type:"button",onClick:n,disabled:r,"aria-label":l,title:l,className:c,children:a}),e[5]=l,e[6]=n,e[7]=r,e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Ks(t){const e=$.c(32),{agent:s,home:r,curated:n}=t,{org:l}=V();let o;e[0]!==s.id||e[1]!==l.id||e[2]!==l.slug?(o={connectionId:s.id,orgId:l.id,orgSlug:l.slug},e[0]=s.id,e[1]=l.id,e[2]=l.slug,e[3]=o):o=e[3];const c=ee(o);let a;e[4]!==s.id||e[5]!==l.id?(a=oe.agentPrompts(l.id,s.id),e[4]=s.id,e[5]=l.id,e[6]=a):a=e[6];let d;e[7]!==c?(d=async()=>{const{prompts:w}=await c.listPrompts();return w.map(Zs)},e[7]=c,e[8]=d):d=e[8];let m;e[9]!==a||e[10]!==d?(m={queryKey:a,queryFn:d,staleTime:3e4,retry:!1},e[9]=a,e[10]=d,e[11]=m):m=e[11];const{data:u,isLoading:f,error:x}=le(m),b=ye(l.slug);let p,h;if(e[12]!==s.id||e[13]!==u||e[14]!==b.prompts){let w;e[17]!==s.id?(w=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=w):w=e[18],p=b.prompts.filter(w).map(Vs);let N;e[19]!==u?(N=u??[],e[19]=u,e[20]=N):N=e[20],h=[...N];for(const S of p)h.some(C=>C.name===S.name)||h.push(S);e[12]=s.id,e[13]=u,e[14]=b.prompts,e[15]=p,e[16]=h}else p=e[15],h=e[16];if(f&&p.length===0){let w;return e[21]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(D,{className:"h-7 w-full"}),i.jsx(D,{className:"h-7 w-2/3"})]}),e[21]=w):w=e[21],w}if(x&&p.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,x),null;if(h.length===0)return null;let g;e[22]!==n||e[23]!==h?(g=n??h.map(Gs),e[22]=n,e[23]=h,e[24]=g):g=e[24];let y;e[25]!==g?(y=new Set(g),e[25]=g,e[26]=y):y=e[26];const j=y;let v;return e[27]!==s||e[28]!==r||e[29]!==h||e[30]!==j?(v=i.jsx("div",{className:"flex flex-col gap-0.5",children:h.map(w=>i.jsx(Js,{agent:s,home:r,prompt:w,allPromptNames:h.map(Xs),isPinned:j.has(w.name)},w.name))}),e[27]=s,e[28]=r,e[29]=h,e[30]=j,e[31]=v):v=e[31],v}function Xs(t){return t.name}function Gs(t){return t.name}function Vs(t){return{name:t.promptName,title:t.title,description:t.description}}function Zs(t){return{name:t.name,title:t.title,description:t.description}}function Js({agent:t,home:e,prompt:s,allPromptNames:r,isPinned:n}){const[l,o]=M.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=t.metadata?.ui?.homePrompts;let d;Array.isArray(a)?d=n?a.filter(u=>u!==s.name):[...a,s.name]:d=n?r.filter(u=>u!==s.name):r;const m={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:d}};await e.saveAgentMetadata(t,m)}catch(a){console.error("[home-tiles] failed to toggle prompt",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??Qe(s.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Ys(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},ei)}),t[0]=e):e=t[0],e}function ei(t,e){return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[i.jsx(D,{className:"size-8 rounded-md"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"h-2.5 w-1/3"})]})]},e)}const J=1,Ge=`home-board.layout.v${J}`;function Ve(t){return`home-board.layout.v${J}.${t}`}const Ze={version:J,tiles:{},hidden:[]};function ue(t){return!t||t.version!==J?Ze:{version:J,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function ti(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function si(t){try{const e=localStorage.getItem(Ve(t));return e?ue(JSON.parse(e)):void 0}catch{return}}function _e(t,e){try{localStorage.setItem(Ve(t),JSON.stringify(e))}catch{}}async function Ce(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function ii(t){const e=$.c(24),s=pe();let r;e[0]!==t?(r=oe.boardLayout(t),e[0]=t,e[1]=r):r=e[1];const n=r;let l;e[2]!==t?(l=si(t),e[2]=t,e[3]=l):l=e[3];const o=l;let c;e[4]!==o||e[5]!==t?(c=async()=>{const g=await fetch(`/api/${t}/kv/${Ge}`);if(g.status===404)return o&&ti(o)?(await Ce(t,o),o):Ze;if(!g.ok)throw new Error("Failed to load board layout");const y=await g.json(),j=ue(y.value);return _e(t,j),j},e[4]=o,e[5]=t,e[6]=c):c=e[6];let a;e[7]!==o||e[8]!==n||e[9]!==c?(a={queryKey:n,queryFn:c,initialData:o,staleTime:0,refetchOnWindowFocus:!1},e[7]=o,e[8]=n,e[9]=c,e[10]=a):a=e[10];const{data:d,isLoading:m}=le(a);let u;e[11]!==t?(u={mutationFn:g=>Ce(t,g)},e[11]=t,e[12]=u):u=e[12];const f=ht(u);let x;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==n?(x=g=>{_e(t,g),s.setQueryData(n,g),f.mutate(g)},e[13]=f,e[14]=t,e[15]=s,e[16]=n,e[17]=x):x=e[17];const b=x;let p;e[18]!==d?(p=ue(d),e[18]=d,e[19]=p):p=e[19];let h;return e[20]!==m||e[21]!==b||e[22]!==p?(h={layout:p,isLoading:m,save:b},e[20]=m,e[21]=b,e[22]=p,e[23]=h):h=e[23],h}const Je=M.createContext(null);function ni(t){const e=$.c(24),{children:s}=t,{org:r}=V(),n=ii(r.slug),[l,o]=M.useState(!1),[c,a]=M.useState(null);let d;e[0]!==n.layout?(d=()=>{a(n.layout),o(!0)},e[0]=n.layout,e[1]=d):d=e[1];const m=d;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{a(null),o(!1)},e[2]=u):u=e[2];const f=u;let x;e[3]!==c||e[4]!==n?(x=()=>{c&&n.save(c),a(null),o(!1)},e[3]=c,e[4]=n,e[5]=x):x=e[5];const b=x,p=l&&c!==null,h=p?c:n.layout;let g;e[6]!==c||e[7]!==p||e[8]!==n.layout?(g=p?JSON.stringify(c)!==JSON.stringify(n.layout):!1,e[6]=c,e[7]=p,e[8]=n.layout,e[9]=g):g=e[9];const y=g;let j;e[10]!==l||e[11]!==n?(j=S=>{l?a(S):n.save(S)},e[10]=l,e[11]=n,e[12]=j):j=e[12];const v=j;let w;e[13]!==v||e[14]!==m||e[15]!==y||e[16]!==l||e[17]!==h||e[18]!==b||e[19]!==n.isLoading?(w={isEditMode:l,enter:m,cancel:f,save:b,hasChanges:y,layout:h,isLayoutLoading:n.isLoading,commitLayout:v},e[13]=v,e[14]=m,e[15]=y,e[16]=l,e[17]=h,e[18]=b,e[19]=n.isLoading,e[20]=w):w=e[20];let N;return e[21]!==s||e[22]!==w?(N=i.jsx(Je.Provider,{value:w,children:s}),e[21]=s,e[22]=w,e[23]=N):N=e[23],N}function Ye(){const t=M.useContext(Je);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function ri({agentId:t}){const{org:e,locator:s}=V(),r=ee({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:n}=ds(),{setTaskId:l}=Wt(),[o,c]=M.useState(null),[a,d]=M.useState(!1),m=M.useRef(!1),u=async(h,g)=>{if(!r){W.error("MCP client not available");return}if(!m.current){m.current=!0,d(!0);try{const y=await cs(r,h.name,g),j={type:"doc",content:[{type:"paragraph",content:[rs({id:h.name,name:os(h.name,ls(h._meta)),metadata:y.messages,char:"/",kind:"prompt",args:g}),{type:"text",text:" "}]}]},v=crypto.randomUUID();ms(sessionStorage,s,v,{tiptapDoc:j}),await n({id:v,virtual_mcp_id:t}),l(v,t,{autosend:!0})}catch(y){console.error("[start-thread-from-prompt] failed",y),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},f=async h=>{if(!m.current){if(h.arguments&&h.arguments.length>0){c(h);return}await u(h)}},x=async h=>{if(!o)return;const g=o;c(null),await u(g,h)};return{start:f,startBlank:async()=>{if(!m.current){m.current=!0,d(!0);try{const h=crypto.randomUUID();await n({id:h,virtual_mcp_id:t}),l(h,t)}catch(h){console.error("[start-thread-from-prompt] startBlank failed",h),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},dialog:i.jsx(ns,{prompt:o,setPrompt:h=>c(h),onSubmit:x}),dialogPrompt:o,starting:a}}const G=4,X=100,Te=12,ie={S:{w:1,h:1},M:{w:1,h:2},T:{w:1,h:3},L:{w:2,h:1},XL:{w:2,h:2},LT:{w:2,h:3},XLT:{w:2,h:4},XXLT:{w:2,h:5},W:{w:4,h:1},WT:{w:4,h:3}},oi={S:"Small",M:"Tall",T:"Column",L:"Wide",XL:"Large",LT:"Showcase",XLT:"Display",XXLT:"Tower",W:"Full width",WT:"Hero"},Ee=["S","M","T","L","XL","LT","XLT","XXLT","W","WT"],li=ie.XL;class fe extends M.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?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[i.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:i.jsx(pt,{size:16})}),i.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),i.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 ai(t){const e=$.c(72),{tiles:s,isEditMode:r,renderTile:n,onMove:l,onResize:o,onRemove:c}=t,a=ge(),d=M.useRef(null),[m,u]=M.useState(null),[f,x]=M.useState(null);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={activationConstraint:{distance:4}},e[0]=b):b=e[0];const p=Oe(re(Pe,b),re(Re)),h=s.reduce(ci,0),g=r?Math.max(h+2,4):Math.max(h,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const A=d.current?.getBoundingClientRect();return A?{cellWidth:A.width/G,cellHeight:X}:null},e[1]=y):y=e[1];const j=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=A=>{u(String(A.active.id)),x(j())},e[2]=v):v=e[2];const w=v;let N;e[3]!==f||e[4]!==l||e[5]!==s?(N=A=>{const F=String(A.active.id),P=f??j();if(u(null),x(null),!P||P.cellWidth<=0)return;const z=s.find(q=>q.id===F);if(!z)return;const H=Math.round(A.delta.x/P.cellWidth),B=Math.round(A.delta.y/P.cellHeight);H===0&&B===0||l(F,{x:z.x+H,y:z.y+B})},e[3]=f,e[4]=l,e[5]=s,e[6]=N):N=e[6];const S=N;if(a){let A;if(e[7]!==n||e[8]!==s){let P;e[10]!==n?(P=z=>i.jsx("div",{className:"bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:X},children:i.jsx(fe,{children:n(z)})},z.id),e[10]=n,e[11]=P):P=e[11],A=s.map(P),e[7]=n,e[8]=s,e[9]=A}else A=e[9];let F;return e[12]!==A?(F=i.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=F):F=e[13],F}let C,_,T,I,E,k,L,U,O;if(e[14]!==m||e[15]!==f||e[16]!==r||e[17]!==S||e[18]!==c||e[19]!==o||e[20]!==n||e[21]!==p||e[22]!==s||e[23]!==g){const A=m?s.find(Z=>Z.id===m):null;_=De,U=p,O=w,T=S;const F=g*X,P=r?X*4:X;let z;e[33]!==F||e[34]!==P?(z={height:F,minHeight:P},e[33]=F,e[34]=P,e[35]=z):z=e[35];let H;e[36]!==r||e[37]!==s||e[38]!==g?(H=r&&i.jsx(di,{rows:g,tiles:s}),e[36]=r,e[37]=s,e[38]=g,e[39]=H):H=e[39];let B;if(e[40]!==m||e[41]!==r||e[42]!==c||e[43]!==o||e[44]!==n||e[45]!==s){let Z;e[47]!==m||e[48]!==r||e[49]!==c||e[50]!==o||e[51]!==n?(Z=se=>i.jsx(ui,{tile:se,isEditMode:r,isDragging:m===se.id,onResize:o,onRemove:c,children:n(se)},se.id),e[47]=m,e[48]=r,e[49]=c,e[50]=o,e[51]=n,e[52]=Z):Z=e[52],B=s.map(Z),e[40]=m,e[41]=r,e[42]=c,e[43]=o,e[44]=n,e[45]=s,e[46]=B}else B=e[46];e[53]!==z||e[54]!==H||e[55]!==B?(I=i.jsxs("div",{ref:d,className:"relative w-full",style:z,children:[H,B]}),e[53]=z,e[54]=H,e[55]=B,e[56]=I):I=e[56],C=Ut,E=null;const q=A&&f?A.w*f.cellWidth-Te:void 0,ae=A&&f?A.h*f.cellHeight-Te:void 0;e[57]!==q||e[58]!==ae?(k={width:q,height:ae},e[57]=q,e[58]=ae,e[59]=k):k=e[59],L=A&&i.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:i.jsx(fe,{children:n(A)})}),e[14]=m,e[15]=f,e[16]=r,e[17]=S,e[18]=c,e[19]=o,e[20]=n,e[21]=p,e[22]=s,e[23]=g,e[24]=C,e[25]=_,e[26]=T,e[27]=I,e[28]=E,e[29]=k,e[30]=L,e[31]=U,e[32]=O}else C=e[24],_=e[25],T=e[26],I=e[27],E=e[28],k=e[29],L=e[30],U=e[31],O=e[32];let R;e[60]!==C||e[61]!==E||e[62]!==k||e[63]!==L?(R=i.jsx(C,{dropAnimation:E,style:k,children:L}),e[60]=C,e[61]=E,e[62]=k,e[63]=L,e[64]=R):R=e[64];let Q;return e[65]!==_||e[66]!==T||e[67]!==I||e[68]!==R||e[69]!==U||e[70]!==O?(Q=i.jsxs(_,{sensors:U,onDragStart:O,onDragEnd:T,children:[I,R]}),e[65]=_,e[66]=T,e[67]=I,e[68]=R,e[69]=U,e[70]=O,e[71]=Q):Q=e[71],Q}function ci(t,e){return Math.max(t,e.y+e.h)}function di(t){const e=$.c(7),{rows:s,tiles:r}=t;let n;e[0]!==r?(n=(a,d)=>r.some(m=>a>=m.x&&a<m.x+m.w&&d>=m.y&&d<m.y+m.h),e[0]=r,e[1]=n):n=e[1];const l=n;let o;if(e[2]!==l||e[3]!==s){o=[];for(let a=0;a<s;a++)for(let d=0;d<G;d++)l(d,a)||o.push({x:d,y:a});e[2]=l,e[3]=s,e[4]=o}else o=e[4];let c;return e[5]!==o?(c=i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(mi)}),e[5]=o,e[6]=c):c=e[6],c}function mi(t){return i.jsx("div",{className:"absolute p-1",style:{left:`${t.x/G*100}%`,top:t.y*X,width:`${1/G*100}%`,height:X},children:i.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function ui(t){const e=$.c(31),{tile:s,isEditMode:r,isDragging:n,onResize:l,onRemove:o,children:c}=t,a=!r;let d;e[0]!==a||e[1]!==s.id?(d={id:s.id,disabled:a},e[0]=a,e[1]=s.id,e[2]=d):d=e[2];const{setNodeRef:m,attributes:u,listeners:f,isDragging:x}=Ft(d),b=`${s.x/G*100}%`,p=`${s.w/G*100}%`,h=s.y*X,g=s.h*X,y=x||n,j=!y&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=y&&"opacity-30";let w;e[3]!==j||e[4]!==v?(w=K("absolute p-1 will-change-[left,top,width,height,opacity]",j,v),e[3]=j,e[4]=v,e[5]=w):w=e[5];let N;e[6]!==g||e[7]!==b||e[8]!==h||e[9]!==p?(N={left:b,top:h,width:p,height:g},e[6]=g,e[7]=b,e[8]=h,e[9]=p,e[10]=N):N=e[10];const S=r&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=K("relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=e[12];let _;e[13]!==u||e[14]!==r||e[15]!==f||e[16]!==o||e[17]!==l||e[18]!==s?(_=r&&i.jsxs(i.Fragment,{children:[i.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:i.jsx(Fe,{size:16})}),i.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:i.jsx(fi,{tile:s,onResize:l,onRemove:o})})]}),e[13]=u,e[14]=r,e[15]=f,e[16]=o,e[17]=l,e[18]=s,e[19]=_):_=e[19];let T;e[20]!==c?(T=i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(fe,{children:c})}),e[20]=c,e[21]=T):T=e[21];let I;e[22]!==T||e[23]!==C||e[24]!==_?(I=i.jsxs("div",{className:C,children:[_,T]}),e[22]=T,e[23]=C,e[24]=_,e[25]=I):I=e[25];let E;return e[26]!==m||e[27]!==I||e[28]!==w||e[29]!==N?(E=i.jsx("div",{ref:m,className:w,style:N,children:I}),e[26]=m,e[27]=I,e[28]=w,e[29]=N,e[30]=E):E=e[30],E}function fi(t){const e=$.c(43),{tile:s,onResize:r,onRemove:n}=t,l=s.minW??1,o=s.minH??1;let c,a,d,m,u,f,x;if(e[0]!==o||e[1]!==l||e[2]!==r||e[3]!==s.h||e[4]!==s.id||e[5]!==s.w){let v;e[13]!==o||e[14]!==l?(v=_=>{const T=ie[_];return T.w>=l&&T.h>=o},e[13]=o,e[14]=l,e[15]=v):v=e[15];const w=Ee.filter(v);let N;e[16]!==s.h||e[17]!==s.w?(N=(()=>{for(const T of Ee){const I=ie[T];if(I.w===s.w&&I.h===s.h)return T}return null})(),e[16]=s.h,e[17]=s.w,e[18]=N):N=e[18];const S=N;a=us,e[19]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(fs,{asChild:!0,children:i.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:i.jsx(Tt,{size:16})})}),e[19]=x):x=e[19],c=hs,d="end",m="w-44",e[20]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(ps,{children:"Size"}),e[20]=u):u=e[20];let C;e[21]!==S||e[22]!==r||e[23]!==s.id?(C=_=>{const T=ie[_];return i.jsxs(Ne,{onSelect:()=>r(s.id,T),className:"flex items-center justify-between",children:[i.jsx("span",{children:oi[_]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:S===_?"✓":`${T.w}×${T.h}`})]},_)},e[21]=S,e[22]=r,e[23]=s.id,e[24]=C):C=e[24],f=w.map(C),e[0]=o,e[1]=l,e[2]=r,e[3]=s.h,e[4]=s.id,e[5]=s.w,e[6]=c,e[7]=a,e[8]=d,e[9]=m,e[10]=u,e[11]=f,e[12]=x}else c=e[6],a=e[7],d=e[8],m=e[9],u=e[10],f=e[11],x=e[12];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(xs,{}),e[25]=b):b=e[25];let p;e[26]!==n||e[27]!==s.id?(p=()=>n(s.id),e[26]=n,e[27]=s.id,e[28]=p):p=e[28];let h;e[29]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(gs,{size:14,className:"mr-2"}),e[29]=h):h=e[29];let g;e[30]!==p?(g=i.jsxs(Ne,{onSelect:p,className:"text-destructive focus:text-destructive",children:[h,"Remove tile"]}),e[30]=p,e[31]=g):g=e[31];let y;e[32]!==c||e[33]!==d||e[34]!==m||e[35]!==u||e[36]!==f||e[37]!==g?(y=i.jsxs(c,{align:d,className:m,children:[u,f,b,g]}),e[32]=c,e[33]=d,e[34]=m,e[35]=u,e[36]=f,e[37]=g,e[38]=y):y=e[38];let j;return e[39]!==a||e[40]!==y||e[41]!==x?(j=i.jsxs(a,{children:[x,y]}),e[39]=a,e[40]=y,e[41]=x,e[42]=j):j=e[42],j}function hi(t,e,s){return t.some(r=>e>=r.x&&e<r.x+r.w&&s>=r.y&&s<r.y+r.h)}function he(t,e,s){for(let r=0;r<100;r++)for(let n=0;n<=G-e;n++){let l=!0;for(let o=0;o<s&&l;o++)for(let c=0;c<e&&l;c++)hi(t,n+c,r+o)&&(l=!1);if(l)return{x:n,y:r}}return{x:0,y:0}}function ce(t,e,s={w:1,h:1}){const r=Math.max(s.w,Math.min(G,t)),n=Math.max(s.h,Math.min(6,e));return{w:r,h:n}}function de(t,e,s){const r=Math.max(0,Math.min(G-s,t)),n=Math.max(0,e);return{x:r,y:n}}function pi(t,e,s){const r=t.find(a=>a.id===e);if(!r)return t;const n=t.filter(a=>a.id!==e),l=n.find(a=>s.x>=a.x&&s.x<a.x+a.w&&s.y>=a.y&&s.y<a.y+a.h);if(l&&l.w===r.w&&l.h===r.h)return t.map(a=>a.id===e?{...a,x:l.x,y:l.y}:a.id===l.id?{...a,x:r.x,y:r.y}:a);const c=[{...r,x:s.x,y:s.y}];for(const a of n){const d=he(c,a.w,a.h);c.push({...a,x:d.x,y:d.y})}return c}function xi(t){const e=$.c(35),{layout:s,isLayoutLoading:r,commitLayout:n}=Ye();let l;e[0]!==s.hidden?(l=new Set(s.hidden),e[0]=s.hidden,e[1]=l):l=e[1];const o=l;let c,a;if(e[2]!==t||e[3]!==o||e[4]!==s.tiles){a=[];let y;e[7]!==o?(y=v=>v.pinned||!o.has(v.id),e[7]=o,e[8]=y):y=e[8];const j=t.filter(y);c=new Map;for(const v of t)v.minSize&&c.set(v.id,v.minSize);for(const v of j){const w=s.tiles[v.id];if(!w)continue;const N=c.get(v.id),{w:S,h:C}=ce(w.w,w.h,N),{x:_,y:T}=de(w.x,w.y,S);a.push({id:v.id,x:_,y:T,w:S,h:C,minW:N?.w,minH:N?.h})}for(const v of j){if(a.some(T=>T.id===v.id))continue;const w=v.defaultSize??li,N=c.get(v.id),{w:S,h:C}=ce(w.w,w.h,N),_=he(a,S,C);a.push({id:v.id,x:_.x,y:_.y,w:S,h:C,minW:N?.w,minH:N?.h})}e[2]=t,e[3]=o,e[4]=s.tiles,e[5]=c,e[6]=a}else c=e[5],a=e[6];let d;e[9]!==t?(d=new Set(t.map(gi)),e[9]=t,e[10]=d):d=e[10];const m=d;let u;e[11]!==m||e[12]!==n?(u=(y,j)=>{const v={};for(const w of y)v[w.id]={x:w.x,y:w.y,w:w.w,h:w.h};n({version:J,tiles:v,hidden:j.filter(w=>m.has(w))})},e[11]=m,e[12]=n,e[13]=u):u=e[13];const f=u;let x;e[14]!==a?(x={visible:a},e[14]=a,e[15]=x):x=e[15];let b;e[16]!==f||e[17]!==s||e[18]!==a?(b=(y,j)=>{const v=a.find(S=>S.id===y);if(!v)return;const w=de(j.x,j.y,v.w);if(w.x===v.x&&w.y===v.y)return;const N=pi(a,y,w);f(N,s.hidden)},e[16]=f,e[17]=s,e[18]=a,e[19]=b):b=e[19];let p;e[20]!==f||e[21]!==s||e[22]!==c||e[23]!==a?(p=(y,j)=>{const v=a.find(I=>I.id===y);if(!v)return;const w=c.get(y),{w:N,h:S}=ce(j.w,j.h,w);if(N===v.w&&S===v.h)return;const C={...v,w:N,h:S,x:de(v.x,v.y,N).x},_=a.filter(I=>I.id!==y),T=[C];for(const I of _){const E=he(T,I.w,I.h);T.push({...I,x:E.x,y:E.y})}f(T,s.hidden)},e[20]=f,e[21]=s,e[22]=c,e[23]=a,e[24]=p):p=e[24];let h;e[25]!==f||e[26]!==s||e[27]!==a?(h=y=>{const j=a.filter(v=>v.id!==y);f(j,Array.from(new Set([...s.hidden,y])))},e[25]=f,e[26]=s,e[27]=a,e[28]=h):h=e[28];let g;return e[29]!==r||e[30]!==x||e[31]!==b||e[32]!==p||e[33]!==h?(g={snapshot:x,isLoading:r,moveTile:b,resizeTile:p,hideTile:h},e[29]=r,e[30]=x,e[31]=b,e[32]=p,e[33]=h,e[34]=g):g=e[34],g}function gi(t){return t.id}const bi={w:2,h:4},yi={w:1,h:2},vi={w:1,h:1};function ji(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function wi(t){return`tile:${t.agentId}:${t.resourceUri}`}function Ni(t){return t.promptName?t.agentName:t.description}function Si(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function ve(t){const e=$.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:r,startBlank:n,dialog:l,starting:o}=ri(s);let c;e[2]!==r||e[3]!==n?(c=m=>{if(!m.promptName){n();return}r(Si(m))},e[2]=r,e[3]=n,e[4]=c):c=e[4];const a=c;let d;return e[5]!==l||e[6]!==a||e[7]!==n||e[8]!==o?(d={open:a,startBlank:n,dialog:l,starting:o},e[5]=l,e[6]=a,e[7]=n,e[8]=o,e[9]=d):d=e[9],d}function _i(t){const e=$.c(32),{entry:s,isEditMode:r}=t,{open:n,dialog:l,starting:o}=ve(s.agentId);let c;e[0]!==s||e[1]!==n?(c=()=>n(s),e[0]=s,e[1]=n,e[2]=c):c=e[2];const a=o||r,d=!r&&"cursor-pointer transition-colors hover:bg-accent/40",m=r&&"cursor-default pl-12",u=o&&"opacity-60";let f;e[3]!==d||e[4]!==m||e[5]!==u?(f=K("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,m,u),e[3]=d,e[4]=m,e[5]=u,e[6]=f):f=e[6];let x;e[7]!==s.agentIcon||e[8]!==s.agentName?(x=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=x):x=e[9];let b;e[10]!==s.title?(b=i.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=b):b=e[11];let p;e[12]!==s?(p=Ni(s),e[12]=s,e[13]=p):p=e[13];let h;e[14]!==p?(h=i.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:p}),e[14]=p,e[15]=h):h=e[15];let g;e[16]!==h||e[17]!==b?(g=i.jsxs("div",{className:"min-w-0 flex-1",children:[b,h]}),e[16]=h,e[17]=b,e[18]=g):g=e[18];let y;e[19]!==r?(y=!r&&i.jsx(as,{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]=r,e[20]=y):y=e[20];let j;e[21]!==o||e[22]!==c||e[23]!==g||e[24]!==y||e[25]!==a||e[26]!==f||e[27]!==x?(j=i.jsxs("button",{type:"button",onClick:c,disabled:a,"aria-busy":o,className:f,children:[x,g,y]}),e[21]=o,e[22]=c,e[23]=g,e[24]=y,e[25]=a,e[26]=f,e[27]=x,e[28]=j):j=e[28];let v;return e[29]!==l||e[30]!==j?(v=i.jsxs(i.Fragment,{children:[j,l]}),e[29]=l,e[30]=j,e[31]=v):v=e[31],v}function Ci(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.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},Ti)}),t[0]=e):e=t[0],e}function Ti(t,e){return i.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[i.jsx(D,{className:"size-10 rounded-xl"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(D,{className:"h-3 w-2/3"}),i.jsx(D,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Ei(t){const e=$.c(49),{tile:s,prompts:r,isEditMode:n,tileWidth:l}=t,{org:o}=V(),{open:c,startBlank:a,dialog:d,starting:m}=ve(s.agentId);let u,f,x,b,p;if(e[0]!==n||e[1]!==c||e[2]!==o.id||e[3]!==o.slug||e[4]!==r||e[5]!==a||e[6]!==m||e[7]!==s||e[8]!==l){const y=r.filter(Ii);b="flex h-full w-full flex-col gap-3 p-3";let j;e[14]!==a?(j=()=>{a()},e[14]=a,e[15]=j):j=e[15];const v=m||n,w=n&&"pl-10 pr-10";let N;e[16]!==w?(N=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",w),e[16]=w,e[17]=N):N=e[17];let S;e[18]!==s.agentIcon||e[19]!==s.agentName?(S=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[18]=s.agentIcon,e[19]=s.agentName,e[20]=S):S=e[20];let C;e[21]!==s.agentName?(C=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[21]=s.agentName,e[22]=C):C=e[22];const _=n?"Drag to rearrange":"Open chat";let T;e[23]!==_?(T=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_}),e[23]=_,e[24]=T):T=e[24];let I;e[25]!==C||e[26]!==T?(I=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[C,T]}),e[25]=C,e[26]=T,e[27]=I):I=e[27],e[28]!==m||e[29]!==S||e[30]!==I||e[31]!==j||e[32]!==v||e[33]!==N?(p=i.jsxs("button",{type:"button",onClick:j,disabled:v,"aria-busy":m,className:N,children:[S,I]}),e[28]=m,e[29]=S,e[30]=I,e[31]=j,e[32]=v,e[33]=N,e[34]=p):p=e[34],u="flex min-h-0 flex-1 gap-3 overflow-hidden";let E;e[35]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx($i,{}),e[35]=E):E=e[35],e[36]!==o.id||e[37]!==o.slug||e[38]!==s?(f=i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:i.jsx(M.Suspense,{fallback:E,children:i.jsx(ki,{tile:s,orgId:o.id,orgSlug:o.slug})})}),e[36]=o.id,e[37]=o.slug,e[38]=s,e[39]=f):f=e[39],x=y.length>0&&!n&&l>=2&&i.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:y.map(k=>i.jsx("button",{type:"button",onClick:()=>c(k),disabled:m,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:i.jsx("span",{className:"line-clamp-2",children:k.title})},k.promptName))}),e[0]=n,e[1]=c,e[2]=o.id,e[3]=o.slug,e[4]=r,e[5]=a,e[6]=m,e[7]=s,e[8]=l,e[9]=u,e[10]=f,e[11]=x,e[12]=b,e[13]=p}else u=e[9],f=e[10],x=e[11],b=e[12],p=e[13];let h;e[40]!==u||e[41]!==f||e[42]!==x?(h=i.jsxs("div",{className:u,children:[f,x]}),e[40]=u,e[41]=f,e[42]=x,e[43]=h):h=e[43];let g;return e[44]!==d||e[45]!==b||e[46]!==p||e[47]!==h?(g=i.jsxs("div",{className:b,children:[p,h,d]}),e[44]=d,e[45]=b,e[46]=p,e[47]=h,e[48]=g):g=e[48],g}function Ii(t){return!!t.promptName}function ki(t){const e=$.c(12),{tile:s,orgId:r,orgSlug:n}=t;let l;e[0]!==r||e[1]!==n||e[2]!==s.connectionId?(l={connectionId:s.connectionId,orgId:r,orgSlug:n},e[0]=r,e[1]=n,e[2]=s.connectionId,e[3]=l):l=e[3];const o=ee(l),c=s.minHeight??200,a=s.maxHeight??4e3;let d;return e[4]!==o||e[5]!==r||e[6]!==n||e[7]!==c||e[8]!==a||e[9]!==s.connectionId||e[10]!==s.resourceUri?(d=i.jsx(ts,{resourceURI:s.resourceUri,orgId:r,orgSlug:n,connectionId:s.connectionId,client:o,displayMode:"fullscreen",minHeight:c,maxHeight:a,className:"h-full"}),e[4]=o,e[5]=r,e[6]=n,e[7]=c,e[8]=a,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=d):d=e[11],d}function $i(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[i.jsx(D,{className:"h-3 w-2/3"}),i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ai(t){const e=$.c(14),{icon:s,name:r}=t;let n;e[0]!==s||e[1]!==r?(n=i.jsx(Y,{icon:s,name:r,size:"sm+"}),e[0]=s,e[1]=r,e[2]=n):n=e[2];let l;e[3]!==r?(l=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=o):o=e[5];let c;e[6]!==l?(c=i.jsxs("div",{className:"min-w-0 flex-1",children:[l,o]}),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==n||e[9]!==c?(a=i.jsxs("div",{className:"flex items-center gap-2.5",children:[n,c]}),e[8]=n,e[9]=c,e[10]=a):a=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[i.jsx(D,{className:"h-3 w-3/4"}),i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"h-3 w-2/3"})]}),e[11]=d):d=e[11];let m;return e[12]!==a?(m=i.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[a,d]}),e[12]=a,e[13]=m):m=e[13],m}function Mi(t){const e=$.c(33),{tile:s,prompts:r,isEditMode:n}=t,{open:l,startBlank:o,dialog:c,starting:a}=ve(s.agentId);let d,m,u;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==o||e[4]!==a||e[5]!==s.agentIcon||e[6]!==s.agentName){const x=r.filter(Li);d="flex h-full w-full flex-col gap-3 p-4";let b;e[10]!==o?(b=()=>{o()},e[10]=o,e[11]=b):b=e[11];const p=a||n,h=n&&"pl-10 pr-10";let g;e[12]!==h?(g=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",h),e[12]=h,e[13]=g):g=e[13];let y;e[14]!==s.agentIcon||e[15]!==s.agentName?(y=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[14]=s.agentIcon,e[15]=s.agentName,e[16]=y):y=e[16];let j;e[17]!==s.agentName?(j=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[17]=s.agentName,e[18]=j):j=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"UI unavailable — open chat"}),e[19]=v):v=e[19];let w;e[20]!==j?(w=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[j,v]}),e[20]=j,e[21]=w):w=e[21],e[22]!==w||e[23]!==b||e[24]!==p||e[25]!==g||e[26]!==y?(m=i.jsxs("button",{type:"button",onClick:b,disabled:p,className:g,children:[y,w]}),e[22]=w,e[23]=b,e[24]=p,e[25]=g,e[26]=y,e[27]=m):m=e[27],u=x.length>0&&!n&&i.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:x.map(N=>i.jsx("button",{type:"button",onClick:()=>!n&&l(N),disabled:a,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:i.jsx("span",{className:"line-clamp-2",children:N.title})},N.promptName))}),e[0]=n,e[1]=l,e[2]=r,e[3]=o,e[4]=a,e[5]=s.agentIcon,e[6]=s.agentName,e[7]=d,e[8]=m,e[9]=u}else d=e[7],m=e[8],u=e[9];let f;return e[28]!==c||e[29]!==d||e[30]!==m||e[31]!==u?(f=i.jsxs("div",{className:d,children:[m,u,c]}),e[28]=c,e[29]=d,e[30]=m,e[31]=u,e[32]=f):f=e[32],f}function Li(t){return!!t.promptName}function et(t){const e=$.c(36),{isEditMode:s}=t,{org:r}=V(),{isLoading:n,prompts:l,tiles:o}=ye(r.slug),c=He()?.ids??[];let a;e[0]!==c?(a=new Set(c),e[0]=c,e[1]=a):a=e[1];const d=a,m=Be();let u;e[2]!==o?(u=new Set(o.map(Di)),e[2]=o,e[3]=u):u=e[3];const f=u;let x;if(e[4]!==l){x=new Map;for(const E of l){const k=x.get(E.agentId);k?k.push(E):x.set(E.agentId,[E])}e[4]=l,e[5]=x}else x=e[5];let b;if(e[6]!==l||e[7]!==f||e[8]!==o){let E;e[10]!==f?(E=L=>!f.has(L.agentId),e[10]=f,e[11]=E):E=e[11];const k=l.filter(E);b=[...o.map(Pi),...k.map(Ri)],e[6]=l,e[7]=f,e[8]=o,e[9]=b}else b=e[9];const p=b;let h;e[12]!==p?(h=new Map(p.map(Oi)),e[12]=p,e[13]=h):h=e[13];const g=h;let y;e[14]!==p||e[15]!==d?(y=p.map(E=>({id:E.id,defaultSize:E.kind==="tile"?bi:vi,minSize:E.kind==="tile"?yi:void 0,pinned:d.has(E.data.agentId)})),e[14]=p,e[15]=d,e[16]=y):y=e[16];const j=xi(y);let v;e[17]!==m?(v=E=>{m.apply(k=>k.filter(L=>L!==E)).catch(zi)},e[17]=m,e[18]=v):v=e[18];const w=v;let N;e[19]!==g||e[20]!==j||e[21]!==d||e[22]!==w?(N=E=>{const k=g.get(E);k&&d.has(k.data.agentId)?w(k.data.agentId):j.hideTile(E)},e[19]=g,e[20]=j,e[21]=d,e[22]=w,e[23]=N):N=e[23];const S=N;let C;e[24]!==g||e[25]!==s||e[26]!==x?(C=E=>{const k=g.get(E.id);if(!k)return null;if(k.kind==="tile"){const L=x.get(k.data.agentId)??[];return i.jsx(xt,{fallback:i.jsx(Mi,{tile:k.data,prompts:L,isEditMode:s}),children:i.jsx(M.Suspense,{fallback:i.jsx(Ai,{icon:k.data.agentIcon,name:k.data.agentName}),children:i.jsx(Ei,{tile:k.data,prompts:L,isEditMode:s,tileWidth:E.w})})})}return i.jsx(_i,{entry:k.data,isEditMode:s})},e[24]=g,e[25]=s,e[26]=x,e[27]=C):C=e[27];const _=C;if(n||j.isLoading){let E;return e[28]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx(Ci,{}),e[28]=E):E=e[28],E}if(j.snapshot.visible.length===0&&!s)return null;let I;return e[29]!==s||e[30]!==j.moveTile||e[31]!==j.resizeTile||e[32]!==j.snapshot.visible||e[33]!==S||e[34]!==_?(I=i.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:i.jsx(ai,{tiles:j.snapshot.visible,isEditMode:s,renderTile:_,onMove:j.moveTile,onResize:j.resizeTile,onRemove:S})}),e[29]=s,e[30]=j.moveTile,e[31]=j.resizeTile,e[32]=j.snapshot.visible,e[33]=S,e[34]=_,e[35]=I):I=e[35],I}function zi(){return W.error("Couldn't remove from home — please try again.")}function Oi(t){return[t.id,t]}function Ri(t){return{kind:"prompt",id:ji(t),data:t}}function Pi(t){return{kind:"tile",id:wi(t),data:t}}function Di(t){return t.agentId}function Hi(t){const e=$.c(2),{prompts:s,tiles:r}=ye(t),n=r.length>0||s.length>0;let l;return e[0]!==n?(l={hasVisibleTiles:n},e[0]=n,e[1]=l):l=e[1],l}const Ie=420,ke=305;function tt(){const t=$.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}}),t[1]=s):s=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.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:ke}}),t[2]=r):r=t[2];let n;return t[3]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,r,i.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:ke}})]}),t[3]=n):n=t[3],n}function $e(){const t=$.c(33),{data:e}=gt.useSession(),{org:s}=V(),r=ge(),n=At(),{selectedVirtualMcp:l}=Mt();let o;t[0]!==s.id?(o=yt(s.id),t[0]=s.id,t[1]=o):o=t[1];const a=l??o;let d;t[2]!==s.slug?(d=qt(s.slug),t[2]=s.slug,t[3]=d):d=t[3],le(d);let m;t[4]!==s.id||t[5]!==s.slug?(m={connectionId:Le,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=m):m=t[6];const u=ee(m);let f;t[7]!==s.id||t[8]!==u?(f=bs(u,s.id),t[7]=s.id,t[8]=u,t[9]=f):f=t[9];let x;t[10]!==s.id||t[11]!==u?(x=Qt(u,s.id),t[10]=s.id,t[11]=u,t[12]=x):x=t[12];let b;t[13]!==a.id||t[14]!==s.id||t[15]!==u?(b=wt(s.id,a.id,u),t[13]=a.id,t[14]=s.id,t[15]=u,t[16]=b):b=t[16];let p;t[17]!==f||t[18]!==x||t[19]!==b?(p={queries:[f,x,b]},t[17]=f,t[18]=x,t[19]=b,t[20]=p):p=t[20],Ss(p);const h=ys(),g=Nt(a.id),{hasDecoKey:y,isZeroBalance:j,isInitialFreeCredit:v,balanceDollars:w,hasOnlyDecoProvider:N}=It(),{hasVisibleTiles:S}=Hi(s.slug),C=kt(g?.metadata);if(h.length===0&&!(C&&$t(n))){let R;return t[21]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:i.jsx(Lt,{})})}),t[21]=R):R=t[21],R}let T;t[22]!==e?.user?.name?(T=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=T):T=t[23];const I=T,E=y&&v&&w!=null,k=y&&j&&N;let L;t[24]!==w||t[25]!==E||t[26]!==k?(L=E?i.jsx(ne.CreditsEyebrow,{balanceDollars:w}):k?i.jsx(ne.NoCreditsEyebrow,{}):null,t[24]=w,t[25]=E,t[26]=k,t[27]=L):L=t[27];const U=L;let O;return t[28]!==U||t[29]!==S||t[30]!==r||t[31]!==I?(O=i.jsx(ni,{children:r?i.jsx(Bi,{eyebrow:U,userName:I}):i.jsx(Ui,{eyebrow:U,userName:I,hasVisibleTiles:S})}),t[28]=U,t[29]=S,t[30]=r,t[31]=I,t[32]=O):O=t[32],O}function Bi(t){const e=$.c(12),{eyebrow:s,userName:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(tt,{}),e[0]=n):n=e[0];let l;e[1]!==s?(l=s&&i.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=l):l=e[2];let o;e[3]!==r?(o=i.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",r,"?"]}),e[3]=r,e[4]=o):o=e[4];let c;e[5]!==l||e[6]!==o?(c=i.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[l,o]}),e[5]=l,e[6]=o,e[7]=c):c=e[7];let a;e[8]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:i.jsx(ne.Input,{showConnectionsBanner:!0})}),e[8]=a):a=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("div",{className:"relative w-full px-4 pb-8",children:i.jsx(et,{isEditMode:!1})}),e[9]=d):d=e[9];let m;return e[10]!==c?(m=i.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[n,c,a,d]}),e[10]=c,e[11]=m):m=e[11],m}function Ui(t){const e=$.c(32),{eyebrow:s,userName:r,hasVisibleTiles:n}=t,{isEditMode:l,enter:o,save:c,cancel:a,hasChanges:d}=Ye(),[m,u]=M.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let x;e[1]!==a||e[2]!==o||e[3]!==d||e[4]!==l||e[5]!==c?(x=i.jsx(vs.Right,{children:i.jsx(Fi,{isEditMode:l,hasChanges:d,onEnter:o,onSave:c,onCancel:a,onAddTile:f})}),e[1]=a,e[2]=o,e[3]=d,e[4]=l,e[5]=c,e[6]=x):x=e[6];let b;e[7]!==m?(b=i.jsx(_s,{open:m,onOpenChange:u}),e[7]=m,e[8]=b):b=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(tt,{}),e[9]=p):p=e[9];const h=n||l?"pt-32":"flex-1 justify-center";let g;e[10]!==h?(g=K("relative flex flex-col items-center px-10 pb-4",h),e[10]=h,e[11]=g):g=e[11];let y;e[12]!==s?(y=s&&i.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=y):y=e[13];let j;e[14]!==r?(j=i.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",r,"?"]}),e[14]=r,e[15]=j):j=e[15];let v;e[16]!==y||e[17]!==j?(v=i.jsxs("div",{className:"text-center mb-10",children:[y,j]}),e[16]=y,e[17]=j,e[18]=v):v=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"relative w-full",children:[i.jsx(Qi,{}),i.jsx(ne.Input,{showConnectionsBanner:!0})]}),e[19]=w):w=e[19];let N;e[20]!==v?(N=i.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[v,w]}),e[20]=v,e[21]=N):N=e[21];let S;e[22]!==l?(S=i.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:i.jsx(et,{isEditMode:l})}),e[22]=l,e[23]=S):S=e[23];let C;e[24]!==N||e[25]!==S||e[26]!==g?(C=i.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[p,i.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:i.jsxs("div",{className:g,children:[N,S]})})]}),e[24]=N,e[25]=S,e[26]=g,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==x||e[30]!==b?(_=i.jsxs(i.Fragment,{children:[x,b,C]}),e[28]=C,e[29]=x,e[30]=b,e[31]=_):_=e[31],_}function Fi(t){const e=$.c(17),{isEditMode:s,hasChanges:r,onEnter:n,onSave:l,onCancel:o,onAddTile:c}=t;if(s){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(be,{size:14}),e[0]=m):m=e[0];let u;e[1]!==c?(u=i.jsxs("button",{type:"button",onClick:c,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:[m,"Add tile"]}),e[1]=c,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(ze,{size:14}),e[3]=f):f=e[3];let x;e[4]!==o?(x=i.jsxs(we,{size:"sm",variant:"ghost",onClick:o,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=o,e[5]=x):x=e[5];const b=!r;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(St,{size:14}),e[6]=p):p=e[6];let h;e[7]!==l||e[8]!==b?(h=i.jsxs(we,{size:"sm",onClick:l,disabled:b,className:"gap-1.5 h-7 text-xs",children:[p,"Save"]}),e[7]=l,e[8]=b,e[9]=h):h=e[9];let g;return e[10]!==u||e[11]!==x||e[12]!==h?(g=i.jsxs(i.Fragment,{children:[u,x,h]}),e[10]=u,e[11]=x,e[12]=h,e[13]=g):g=e[13],g}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Et,{size:14}),e[14]=a):a=e[14];let d;return e[15]!==n?(d=i.jsxs("button",{type:"button",onClick:n,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:[a,"Customize"]}),e[15]=n,e[16]=d):d=e[16],d}function Qi(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.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 Zr(){const t=$.c(2);if(ge()){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:i.jsx($e,{})}),t[0]=r):r=t[0],r}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:i.jsx("div",{className:"h-full p-0.5 pt-0.25",children:i.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:i.jsx($e,{})})})}),t[1]=s):s=t[1],s}export{Zr as default};
1
+ import{ar as st,as as me,at as it,au as nt,av as Ae,G as pe,aw as rt,ax as ot,r as M,ay as lt,az as at,aA as ct,aB as dt,aC as je,aD as mt,aE as ut,aF as ft,e as $,j as i,q as V,c as K,l as Me,aG as xe,o as W,K as oe,n as le,a as ht,v as pt,E as xt,b as gt,B as we}from"./index-B7tMIGCq.js";import{u as ge}from"./tooltip-VoacnTKM.js";import{i as bt,u as ee,S as Le,g as yt}from"./constants-CNZvm1cO.js";import{a as vt,b as jt,v as wt,u as Nt}from"./use-virtual-mcp-C0J6vZOy.js";import{i as St}from"./Check-B0P5hodH.js";import{Z as _t,A as Y,$ as Ct,u as Tt,c as Et}from"./agent-icon-Dr1bpYZ_.js";import{s as be}from"./Plus-C-omi-dN.js";import{i as ze}from"./X-wAJMKsDG.js";import{u as It,b as kt,h as $t,C as ne}from"./agent-capabilities-Dk3tx7gd.js";import{u as At,c as Mt}from"./chat-context-n64-vv_1.js";import{N as Lt}from"./agent-icons-CzC15bIN.js";import{u as Oe,a as re,K as Re,P as Pe,D as De,c as zt,S as Ot,v as Rt,b as Pt,C as Dt,s as Ht,d as Bt,e as Ut,f as Ft}from"./sortable.esm-ChXSQgk4.js";import{u as He,a as Be,o as Qt}from"./use-organization-settings-DK19F2g9.js";import{c as ye,u as Wt,h as qt}from"./shell-layout-BJmtvdOF.js";import{I as Kt}from"./input-DwlCJ28N.js";import{S as Xt}from"./scroll-area-DfF1DGTO.js";import{S as Gt,c as Vt,d as Zt,a as Jt,b as Yt}from"./sheet-CA-bu41g.js";import{S as D}from"./skeleton-B3z9RhFw.js";import{t as Ue}from"./ChevronDown-BLvS4ToG.js";import{d as Fe}from"./ZoomOut-DnPCWp9x.js";import{g as es,M as ts}from"./types-DGaPEJ11.js";import{I as ss}from"./integration-icon-BI887rQg.js";import{u as is}from"./unwrap-tool-result-BYXdCQMg.js";import{t as Qe,P as ns,e as rs,s as os,g as ls}from"./pair-DbyXobZ6.js";import{a as as}from"./XCircle-C5XzBzrQ.js";import{g as cs}from"./use-mcp-prompts-Z9l1A0Zz.js";import{u as ds,w as ms}from"./tab-id-D4XtWZcv.js";import{D as us,a as fs,b as hs,h as ps,c as Ne,d as xs}from"./dropdown-menu-CqB2EneR.js";import{s as gs}from"./Trash01-CY-IoFVl.js";import{a as bs,u as ys}from"./use-ai-providers-B08Dfztq.js";import{a as vs}from"./toolbar-BNPhEiqF.js";import"./use-collections-DEYzPSLv.js";import"./AlertCircle-BHVtmqg5.js";import"./Tool01-jh5OdcD_.js";import"./SwitchHorizontal01-CI__ZFHo.js";import"./RefreshCcw01-BRsF38y3.js";import"./ArrowUpRight-BjNBbpmV.js";import"./ZapSquare-BdJ-x7Vi.js";import"./Users03-B1-zgOdp.js";import"./CheckCircle-Bdqev0nO.js";import"./ChevronLeft-DkNaQH3V.js";import"./ChevronRight-4ehX8OPq.js";import"./ChevronUp-BPS-J5rQ.js";import"./DotsVertical-J6xX8bRK.js";import"./Container-BgS7rK8J.js";import"./Eye-B4txmFQS.js";import"./Globe01-xi-0s299.js";import"./FilterLines-BTMjQgiq.js";import"./Star01-BTZ2441m.js";import"./Palette-C1x3Xgx8.js";import"./HardDrive-Cw5wbzfr.js";import"./Stars02-D5yjx9l2.js";import"./Key01-CIFx1b27.js";import"./LayoutLeft-DoTZR2dr.js";import"./LinkExternal01-BUo_Z2Ai.js";import"./Monitor01-CU2IldL2.js";import"./Sun-CU5c1BQU.js";import"./Play-cC3e0aRw.js";import"./SearchMd-B0_Yf3yk.js";import"./Settings02-BAzPyCQK.js";import"./Shield01-D-Ka40fc.js";import"./Stars01-BvMjy7DM.js";import"./Upload01-Dws98jTe.js";import"./User01-CsfdlOo_.js";import"./Users01-KgnDENeu.js";import"./XClose-Wh4jKrco.js";import"./Zap-Cd9ypkMC.js";import"./spinner-u4N4s9Z6.js";import"./dialog-B25EnfSZ.js";import"./drawer-fSMBE52Q.js";import"./collection-search-B7dmZ18T.js";import"./form-Ck7oM85d.js";import"./label-Cp7h2a1f.js";import"./select-D6NiWcOv.js";import"./tabs-CxIIMzaj.js";import"./toggle-group-B_TX0y3P.js";import"./connect-desktop-dialog-BnrR7FIp.js";import"./popover-BpkFIRrC.js";import"./command-eM0_ztLa.js";import"./index-BraUXQtj.js";import"./useInfiniteQuery-BYU0zu4v.js";import"./infiniteQueryObserver-GqeTL4E_.js";import"./index-DjvTsn28.js";import"./question-004-sINsf4GQ.js";import"./checkbox-X6v3rKHo.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-DhzY0Eh2.js";import"./settings-section-BhG1oXRm.js";import"./card-BDlh34z0.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BNhxgt1r.js";import"./use-registry-connections-BT5RIBa1.js";import"./use-connection-DY59WvYT.js";import"./extract-connection-data-DtUMTD6M.js";import"./generate-id-DFeI4rCP.js";import"./collections-Ca9cgdYF.js";import"./collection-tabs-IXoyjsqg.js";import"./badge-bZNUWBV_.js";import"./textarea-AHMya-Yu.js";import"./connection-form-helpers-E666kWj7.js";import"./use-infinite-scroll-2beLt-Er.js";import"./useSuspenseInfiniteQuery-CsscVl3c.js";import"./required-auth-layout-D-bn_J69.js";import"./useRouterState-BpN6uFWZ.js";import"./use-org-sso-Z-KrfZMw.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DAGbC1GA.js";import"./file-type-icon-vEyv3GKo.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-D4fCB-ku.js";import"./decopilot-sse-pool-BbXhLnto.js";import"./create-sse-subscription-BS5983N4.js";function Se(t,e){const s=new Set(e);return t.filter(r=>!s.has(r))}function js(t,e,s){const r=t.slice(0);return r[e]=s,r}var ws=class extends st{#n;#e;#r;#i;#t;#s;#o;#l;#a;#c=[];constructor(t,e,s){super(),this.#n=t,this.#i=s,this.#r=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(t=>{t.subscribe(e=>{this.#f(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(t=>{t.destroy()})}setQueries(t,e){this.#r=t,this.#i=e,me.batch(()=>{const s=this.#t,r=this.#u(this.#r);r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const n=r.map(m=>m.observer),l=n.map(m=>m.getCurrentResult()),o=s.length!==n.length,c=n.some((m,u)=>m!==s[u]),a=o||c,d=a?!0:l.some((m,u)=>{const f=this.#e[u];return!f||!it(m,f)});!a&&!d||(a&&(this.#c=r,this.#t=n),this.#e=l,this.hasListeners()&&(a&&(Se(s,n).forEach(m=>{m.destroy()}),Se(n,s).forEach(m=>{m.subscribe(u=>{this.#f(m,u)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(t=>t.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(t,e){const s=this.#u(t),r=s.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),n=s.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>this.#m(l??r,e,n),()=>this.#d(r,s)]}#d(t,e){return e.map((s,r)=>{const n=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?n:s.observer.trackResult(n,l=>{e.forEach(o=>{o.observer.trackProp(l)})})})}#m(t,e,s){if(e){const r=this.#a,n=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((l,o)=>l!==r[o]));return(!this.#s||this.#e!==this.#l||n||e!==this.#o)&&(this.#o=e,this.#l=this.#e,s!==void 0&&(this.#a=s),this.#s=nt(this.#s,e(t))),this.#s}return t}#p(){return this.#i?.combine!==void 0&&this.#t.some((t,e)=>t.options.suspense&&this.#e[e]?.data===void 0)}#u(t){const e=new Map;this.#t.forEach(r=>{const n=r.options.queryHash;if(!n)return;const l=e.get(n);l?l.push(r):e.set(n,[r])});const s=[];return t.forEach(r=>{const n=this.#n.defaultQueryOptions(r),o=e.get(n.queryHash)?.shift()??new Ae(this.#n,n);s.push({defaultedQueryOptions:n,observer:o})}),s}#f(t,e){const s=this.#t.indexOf(t);s!==-1&&(this.#e=js(this.#e,s,e),this.#h())}#h(){if(this.hasListeners()){const t=this.#d(this.#e,this.#c),e=this.#p(),s=this.#s,r=e?s:this.#m(t,this.#i?.combine);(e||s!==r)&&me.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ns({queries:t,...e},s){const r=pe(s),n=rt(),l=ot(),o=M.useMemo(()=>t.map(p=>{const h=r.defaultQueryOptions(p);return h._optimisticResults=n?"isRestoring":"optimistic",h}),[t,r,n]);o.forEach(p=>{lt(p);const h=r.getQueryCache().get(p.queryHash);at(p,l,h)}),ct(l);const[c]=M.useState(()=>new ws(r,o,e)),[a,d,m]=c.getOptimisticResult(o,e.combine),u=!n&&e.subscribed!==!1;M.useSyncExternalStore(M.useCallback(p=>u?c.subscribe(me.batchCalls(p)):dt,[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setQueries(o,e)},[o,e,c]);const x=a.some((p,h)=>je(o[h],p))?a.flatMap((p,h)=>{const g=o[h];if(g&&je(g,p)){const y=new Ae(r,g);return mt(g,y,l)}return[]}):[];if(x.length>0)throw Promise.all(x);const b=a.find((p,h)=>{const g=o[h];return g&&ut({result:p,errorResetBoundary:l,throwOnError:g.throwOnError,query:r.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(b?.error)throw b.error;return d(m())}function Ss(t,e){return Ns({...t,queries:t.queries.map(s=>({...s,suspense:!0,throwOnError:ft,enabled:!0,placeholderData:void 0}))},e)}const te=8;function _s(t){const e=$.c(16),{open:s,onOpenChange:r}=t,[n,l]=M.useState("");let o,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Gt,{children:"Manage home"}),c=i.jsx(Vt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=o,e[1]=c):(o=e[0],c=e[1]);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(_t,{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]=a):a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=p=>l(p.target.value),e[3]=d):d=e[3];let m;e[4]!==n?(m=i.jsxs(Zt,{className:"px-5 py-4 border-b border-border",children:[o,c,i.jsxs("div",{className:"relative mt-3",children:[a,i.jsx(Kt,{value:n,onChange:d,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=n,e[5]=m):m=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ys,{}),e[6]=u):u=e[6];let f;e[7]!==n?(f=i.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3 flex flex-col gap-4",children:i.jsx(M.Suspense,{fallback:u,children:i.jsx(Ts,{search:n})})})}),e[7]=n,e[8]=f):f=e[8];let x;e[9]!==m||e[10]!==f?(x=i.jsxs(Jt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[m,f]}),e[9]=m,e[10]=f,e[11]=x):x=e[11];let b;return e[12]!==r||e[13]!==s||e[14]!==x?(b=i.jsx(Yt,{open:s,onOpenChange:r,children:x}),e[12]=r,e[13]=s,e[14]=x,e[15]=b):b=e[15],b}function Cs(t){const e=$.c(32),{org:s}=V(),r=He();let n;e[0]!==r?.ids?(n=r?.ids??[],e[0]=r?.ids,e[1]=n):n=e[1];const l=n,o=Be(),c=jt(),a=pe();let d;e[2]!==s||e[3]!==a?(d=()=>a.refetchQueries({queryKey:oe.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=a,e[4]=d):d=e[4];const m=d;let u;e[5]!==l?(u=_=>l.includes(_),e[5]=l,e[6]=u):u=e[6];const f=u;let x;e[7]!==l||e[8]!==t?(x=t?l.filter(_=>t.has(_)).length:l.length,e[7]=l,e[8]=t,e[9]=x):x=e[9];const p=x>=te;let h;e[10]!==p||e[11]!==f||e[12]!==o?(h=_=>f(_)||p?Promise.resolve():o.apply(T=>T.includes(_)?null:[...T,_]),e[10]=p,e[11]=f,e[12]=o,e[13]=h):h=e[13];const g=h;let y;e[14]!==o?(y=_=>o.apply(T=>T.filter(I=>I!==_)),e[14]=o,e[15]=y):y=e[15];const j=y;let v;e[16]!==o?(v=_=>o.apply(()=>_),e[16]=o,e[17]=v):v=e[17];const w=v;let N;e[18]!==c||e[19]!==p||e[20]!==f||e[21]!==m||e[22]!==o?(N=async(_,T)=>{await c.update.mutateAsync({id:_.id,data:{metadata:T}}),!f(_.id)&&!p&&await o.apply(I=>I.includes(_.id)?null:[...I,_.id]),await m()},e[18]=c,e[19]=p,e[20]=f,e[21]=m,e[22]=o,e[23]=N):N=e[23];const S=N;let C;return e[24]!==g||e[25]!==p||e[26]!==l||e[27]!==f||e[28]!==j||e[29]!==w||e[30]!==S?(C={homeIds:l,isOnHome:f,atLimit:p,addAgent:g,removeAgent:j,reorder:w,saveAgentMetadata:S},e[24]=g,e[25]=p,e[26]=l,e[27]=f,e[28]=j,e[29]=w,e[30]=S,e[31]=C):C=e[31],C}function Ts(t){const e=$.c(21),{search:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={pageSize:1e3},e[0]=r):r=e[0];const n=vt(r);let l;e[1]!==n?(l=new Set(n.map(As)),e[1]=n,e[2]=l):l=e[2];const o=Cs(l);let c,a,d;if(e[3]!==n||e[4]!==o||e[5]!==s){const p=new Map(n.map($s));c=s.trim().toLowerCase();const h=y=>!c||y.title?.toLowerCase().includes(c);a=o.homeIds.map(y=>p.get(y)).filter(ks).filter(h);let g;e[9]!==o?(g=y=>!o.isOnHome(y.id),e[9]=o,e[10]=g):g=e[10],d=n.filter(Is).filter(g).filter(h).sort(Es),e[3]=n,e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=d}else c=e[6],a=e[7],d=e[8];const m=d;let u;e[11]!==o||e[12]!==a?(u=i.jsx(Ms,{home:o,agents:a}),e[11]=o,e[12]=a,e[13]=u):u=e[13];const f=!!c;let x;e[14]!==m||e[15]!==o||e[16]!==f?(x=i.jsx(Os,{home:o,agents:m,hasSearch:f}),e[14]=m,e[15]=o,e[16]=f,e[17]=x):x=e[17];let b;return e[18]!==u||e[19]!==x?(b=i.jsxs(i.Fragment,{children:[u,x]}),e[18]=u,e[19]=x,e[20]=b):b=e[20],b}function Es(t,e){return(t.title??"").localeCompare(e.title??"")}function Is(t){return t.id&&!bt(t.id)}function ks(t){return!!t}function $s(t){return[t.id,t]}function As(t){return t.id}function We(t){const e=$.c(7),{title:s,hint:r}=t;let n;e[0]!==s?(n=i.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1];let l;e[2]!==r?(l=r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let o;return e[4]!==n||e[5]!==l?(o=i.jsxs("div",{className:"flex items-center justify-between px-1",children:[n,l]}),e[4]=n,e[5]=l,e[6]=o):o=e[6],o}function Ms(t){const e=$.c(14),{home:s,agents:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={activationConstraint:{distance:5}},e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={coordinateGetter:Ht},e[1]=l):l=e[1];const o=Oe(re(Pe,n),re(Re,l));let c;e[2]!==s?(c=x=>{const{active:b,over:p}=x;if(!p||b.id===p.id)return;const h=s.homeIds,g=h.indexOf(b.id),y=h.indexOf(p.id);g===-1||y===-1||s.reorder(Bt([...h],g,y)).catch(zs)},e[2]=s,e[3]=c):c=e[3];const a=c,d=`${s.homeIds.length}/${te}`;let m;e[4]!==d?(m=i.jsx(We,{title:"On home",hint:d}),e[4]=d,e[5]=m):m=e[5];let u;e[6]!==r||e[7]!==a||e[8]!==s||e[9]!==o?(u=r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):i.jsx(De,{sensors:o,collisionDetection:zt,onDragEnd:a,children:i.jsx(Ot,{items:r.map(Ls),strategy:Rt,children:i.jsx("div",{className:"flex flex-col gap-1",children:r.map(x=>i.jsx(Ps,{agent:x,home:s},x.id))})})}),e[6]=r,e[7]=a,e[8]=s,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==m||e[12]!==u?(f=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,u]}),e[11]=m,e[12]=u,e[13]=f):f=e[13],f}function Ls(t){return t.id}function zs(){return W.error("Couldn't reorder home — please try again.")}function Os(t){const e=$.c(6),{home:s,agents:r,hasSearch:n}=t,[l,o]=M.useState(20);let c;if(e[0]!==r||e[1]!==n||e[2]!==s||e[3]!==l){const a=r.slice(0,l);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(We,{title:"Add to home"}),e[5]=d):d=e[5],c=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:n?"No agents match.":"Every agent is on the home."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>i.jsx(Bs,{agent:m,home:s},m.id))}),r.length>l&&i.jsxs("button",{type:"button",onClick:()=>o(Rs),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 (",r.length-l,")"]})]})]}),e[0]=r,e[1]=n,e[2]=s,e[3]=l,e[4]=c}else c=e[4];return c}function Rs(t){return t+20}function qe(t){const e=xe(t.metadata?.ui).filter(l=>!!l.resourceUri).length,s=t.metadata?.ui?.homePrompts,r=Array.isArray(s)?s.length:null,n=[];return e>0&&n.push(`${e} tile${e===1?"":"s"}`),r!==null&&r>0&&n.push(`${r} prompt${r===1?"":"s"}`),r===0&&n.push("prompts off"),n.join(" · ")}function Ps(t){const e=$.c(57),{agent:s,home:r}=t,[n,l]=M.useState(!1);let o;e[0]!==s.id?(o={id:s.id},e[0]=s.id,e[1]=o):o=e[1];const{attributes:c,listeners:a,setNodeRef:d,transform:m,transition:u,isDragging:f}=Pt(o),x=qe(s)||"Quick access";let b;e[2]!==m?(b=Dt.Transform.toString(m),e[2]=m,e[3]=b):b=e[3];const p=f?.5:void 0,h=f?100:void 0;let g;e[4]!==b||e[5]!==p||e[6]!==h||e[7]!==u?(g={transform:b,transition:u,opacity:p,zIndex:h},e[4]=b,e[5]=p,e[6]=h,e[7]=u,e[8]=g):g=e[8];const y=g,j=f&&"shadow-lg";let v;e[9]!==j?(v=K("rounded-lg border border-border bg-card",j),e[9]=j,e[10]=v):v=e[10];const w=`Drag to reorder ${s.title??s.id}`;let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(Fe,{size:14}),e[11]=N):N=e[11];let S;e[12]!==c||e[13]!==a||e[14]!==w?(S=i.jsx("button",{type:"button",...c,...a,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":w,children:N}),e[12]=c,e[13]=a,e[14]=w,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>l(Hs),e[16]=C):C=e[16];const _=s.title??s.id;let T;e[17]!==s.icon||e[18]!==_?(T=i.jsx(Y,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=T):T=e[19];const I=s.title??s.id;let E;e[20]!==I?(E=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=E):E=e[21];let k;e[22]!==x?(k=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:x}),e[22]=x,e[23]=k):k=e[23];let L;e[24]!==E||e[25]!==k?(L=i.jsxs("div",{className:"min-w-0 flex-1",children:[E,k]}),e[24]=E,e[25]=k,e[26]=L):L=e[26];const U=n&&"rotate-180";let O;e[27]!==U?(O=K("shrink-0 text-muted-foreground transition-transform",U),e[27]=U,e[28]=O):O=e[28];let R;e[29]!==O?(R=i.jsx(Ue,{size:16,className:O}),e[29]=O,e[30]=R):R=e[30];let Q;e[31]!==n||e[32]!==T||e[33]!==L||e[34]!==R?(Q=i.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":n,children:[T,L,R]}),e[31]=n,e[32]=T,e[33]=L,e[34]=R,e[35]=Q):Q=e[35];let A;e[36]!==s.id||e[37]!==r?(A=()=>r.removeAgent(s.id).catch(Ds),e[36]=s.id,e[37]=r,e[38]=A):A=e[38];const F=`Remove ${s.title??s.id} from home`;let P;e[39]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(ze,{size:14}),e[39]=P):P=e[39];let z;e[40]!==A||e[41]!==F?(z=i.jsx("button",{type:"button",onClick:A,"aria-label":F,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:P}),e[40]=A,e[41]=F,e[42]=z):z=e[42];let H;e[43]!==S||e[44]!==Q||e[45]!==z?(H=i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,Q,z]}),e[43]=S,e[44]=Q,e[45]=z,e[46]=H):H=e[46];let B;e[47]!==s||e[48]!==n||e[49]!==r?(B=n&&i.jsx(Ke,{agent:s,home:r}),e[47]=s,e[48]=n,e[49]=r,e[50]=B):B=e[50];let q;return e[51]!==d||e[52]!==y||e[53]!==H||e[54]!==B||e[55]!==v?(q=i.jsxs("div",{ref:d,style:y,className:v,children:[H,B]}),e[51]=d,e[52]=y,e[53]=H,e[54]=B,e[55]=v,e[56]=q):q=e[56],q}function Ds(){return W.error("Couldn't remove from home — please try again.")}function Hs(t){return!t}function Bs({agent:t,home:e}){const[s,r]=M.useState(!1),[n,l]=M.useState(!1),o=qe(t),c=async()=>{if(!e.atLimit){l(!0);try{await e.addAgent(t.id)}catch{W.error("Couldn't add to home — please try again.")}finally{l(!1)}}};return i.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[i.jsxs("button",{type:"button",onClick:()=>r(a=>!a),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[i.jsx(Y,{icon:t.icon,name:t.title??t.id,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),o&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o})]}),i.jsx(Ue,{size:16,className:K("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),i.jsx("button",{type:"button",onClick:c,disabled:n||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${te}) — 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:n?i.jsx(Me,{size:12,className:"animate-spin"}):i.jsx(be,{size:14})})]}),s&&i.jsx(Ke,{agent:t,home:e})]})}function Ke(t){const e=$.c(26),{agent:s,home:r}=t;let n,l,o,c,a,d,m;if(e[0]!==s||e[1]!==r){const h=xe(s.metadata?.ui);let g;e[9]!==s.connections?(g=(s.connections??[]).map(Fs).sort(),e[9]=s.connections,e[10]=g):g=e[10];const y=g;l=s.metadata?.ui?.homePrompts,m="border-t border-border px-3 py-2 flex flex-col gap-3",n=Ws,o=s,c=r,a=y,d=new Set(h.map(Us)),e[0]=s,e[1]=r,e[2]=n,e[3]=l,e[4]=o,e[5]=c,e[6]=a,e[7]=d,e[8]=m}else n=e[2],l=e[3],o=e[4],c=e[5],a=e[6],d=e[7],m=e[8];let u;e[11]!==n||e[12]!==o||e[13]!==c||e[14]!==a||e[15]!==d?(u=i.jsx(n,{agent:o,home:c,connectionIds:a,pinnedResourceUris:d}),e[11]=n,e[12]=o,e[13]=c,e[14]=a,e[15]=d,e[16]=u):u=e[16];let f;e[17]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Qs,{}),e[17]=f):f=e[17];const x=l??null;let b;e[18]!==s||e[19]!==r||e[20]!==x?(b=i.jsx(M.Suspense,{fallback:f,children:i.jsx(Ks,{agent:s,home:r,curated:x})}),e[18]=s,e[19]=r,e[20]=x,e[21]=b):b=e[21];let p;return e[22]!==m||e[23]!==u||e[24]!==b?(p=i.jsxs("div",{className:m,children:[u,b]}),e[22]=m,e[23]=u,e[24]=b,e[25]=p):p=e[25],p}function Us(t){return t.resourceUri}function Fs(t){return t.connection_id}function Qs(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[i.jsx(D,{className:"h-8 w-full"}),i.jsx(D,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Ws({agent:t,home:e,connectionIds:s,pinnedResourceUris:r}){const{org:n}=V(),l=ee({connectionId:Le,orgId:n.id,orgSlug:n.slug}),{data:o,isLoading:c}=le({queryKey:oe.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async d=>{try{const m=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}}),{item:u}=is(m),f=(u?.tools??[]).flatMap(x=>{const b=es(x._meta);return b?[{name:x.name,description:x.description,resourceUri:b}]:[]});return{id:d,title:u?.title??d,icon:u?.icon??null,uiTools:f}}catch{return{id:d,title:d,icon:null,uiTools:[]}}}))).filter(d=>d.uiTools.length>0)});return s.length===0?null:c?i.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[i.jsx(D,{className:"h-7 w-full"}),i.jsx(D,{className:"h-7 w-2/3"})]}):!o||o.length===0?null:i.jsx("div",{className:"flex flex-col gap-0.5",children:o.map(a=>a.uiTools.map(d=>i.jsx(qs,{agent:t,home:e,connection:a,tool:d,isPinned:r.has(d.resourceUri)},`${a.id}:${d.name}`)))})}function qs({agent:t,home:e,connection:s,tool:r,isPinned:n}){const[l,o]=M.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=xe(t.metadata?.ui),d=n?a.filter(u=>u.resourceUri!==r.resourceUri):[...a,{connectionId:s.id,resourceUri:r.resourceUri}],m={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:d}};await e.saveAgentMetadata(t,m)}catch(a){console.error("[home-tiles] failed to toggle tile",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx(ss,{icon:s.icon,name:s.title,size:"xs"}),i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:Qe(r.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Xe(t){const e=$.c(11),{isPinned:s,submitting:r,onClick:n,label:l}=t,o=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let c;e[0]!==o?(c=K("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]!==s||e[3]!==r?(a=r?i.jsx(Me,{size:12,className:"animate-spin"}):s?i.jsx(Ct,{size:14}):i.jsx(be,{size:14}),e[2]=s,e[3]=r,e[4]=a):a=e[4];let d;return e[5]!==l||e[6]!==n||e[7]!==r||e[8]!==c||e[9]!==a?(d=i.jsx("button",{type:"button",onClick:n,disabled:r,"aria-label":l,title:l,className:c,children:a}),e[5]=l,e[6]=n,e[7]=r,e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Ks(t){const e=$.c(32),{agent:s,home:r,curated:n}=t,{org:l}=V();let o;e[0]!==s.id||e[1]!==l.id||e[2]!==l.slug?(o={connectionId:s.id,orgId:l.id,orgSlug:l.slug},e[0]=s.id,e[1]=l.id,e[2]=l.slug,e[3]=o):o=e[3];const c=ee(o);let a;e[4]!==s.id||e[5]!==l.id?(a=oe.agentPrompts(l.id,s.id),e[4]=s.id,e[5]=l.id,e[6]=a):a=e[6];let d;e[7]!==c?(d=async()=>{const{prompts:w}=await c.listPrompts();return w.map(Zs)},e[7]=c,e[8]=d):d=e[8];let m;e[9]!==a||e[10]!==d?(m={queryKey:a,queryFn:d,staleTime:3e4,retry:!1},e[9]=a,e[10]=d,e[11]=m):m=e[11];const{data:u,isLoading:f,error:x}=le(m),b=ye(l.slug);let p,h;if(e[12]!==s.id||e[13]!==u||e[14]!==b.prompts){let w;e[17]!==s.id?(w=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=w):w=e[18],p=b.prompts.filter(w).map(Vs);let N;e[19]!==u?(N=u??[],e[19]=u,e[20]=N):N=e[20],h=[...N];for(const S of p)h.some(C=>C.name===S.name)||h.push(S);e[12]=s.id,e[13]=u,e[14]=b.prompts,e[15]=p,e[16]=h}else p=e[15],h=e[16];if(f&&p.length===0){let w;return e[21]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(D,{className:"h-7 w-full"}),i.jsx(D,{className:"h-7 w-2/3"})]}),e[21]=w):w=e[21],w}if(x&&p.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,x),null;if(h.length===0)return null;let g;e[22]!==n||e[23]!==h?(g=n??h.map(Gs),e[22]=n,e[23]=h,e[24]=g):g=e[24];let y;e[25]!==g?(y=new Set(g),e[25]=g,e[26]=y):y=e[26];const j=y;let v;return e[27]!==s||e[28]!==r||e[29]!==h||e[30]!==j?(v=i.jsx("div",{className:"flex flex-col gap-0.5",children:h.map(w=>i.jsx(Js,{agent:s,home:r,prompt:w,allPromptNames:h.map(Xs),isPinned:j.has(w.name)},w.name))}),e[27]=s,e[28]=r,e[29]=h,e[30]=j,e[31]=v):v=e[31],v}function Xs(t){return t.name}function Gs(t){return t.name}function Vs(t){return{name:t.promptName,title:t.title,description:t.description}}function Zs(t){return{name:t.name,title:t.title,description:t.description}}function Js({agent:t,home:e,prompt:s,allPromptNames:r,isPinned:n}){const[l,o]=M.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=t.metadata?.ui?.homePrompts;let d;Array.isArray(a)?d=n?a.filter(u=>u!==s.name):[...a,s.name]:d=n?r.filter(u=>u!==s.name):r;const m={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:d}};await e.saveAgentMetadata(t,m)}catch(a){console.error("[home-tiles] failed to toggle prompt",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??Qe(s.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Ys(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},ei)}),t[0]=e):e=t[0],e}function ei(t,e){return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[i.jsx(D,{className:"size-8 rounded-md"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"h-2.5 w-1/3"})]})]},e)}const J=1,Ge=`home-board.layout.v${J}`;function Ve(t){return`home-board.layout.v${J}.${t}`}const Ze={version:J,tiles:{},hidden:[]};function ue(t){return!t||t.version!==J?Ze:{version:J,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function ti(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function si(t){try{const e=localStorage.getItem(Ve(t));return e?ue(JSON.parse(e)):void 0}catch{return}}function _e(t,e){try{localStorage.setItem(Ve(t),JSON.stringify(e))}catch{}}async function Ce(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function ii(t){const e=$.c(24),s=pe();let r;e[0]!==t?(r=oe.boardLayout(t),e[0]=t,e[1]=r):r=e[1];const n=r;let l;e[2]!==t?(l=si(t),e[2]=t,e[3]=l):l=e[3];const o=l;let c;e[4]!==o||e[5]!==t?(c=async()=>{const g=await fetch(`/api/${t}/kv/${Ge}`);if(g.status===404)return o&&ti(o)?(await Ce(t,o),o):Ze;if(!g.ok)throw new Error("Failed to load board layout");const y=await g.json(),j=ue(y.value);return _e(t,j),j},e[4]=o,e[5]=t,e[6]=c):c=e[6];let a;e[7]!==o||e[8]!==n||e[9]!==c?(a={queryKey:n,queryFn:c,initialData:o,staleTime:0,refetchOnWindowFocus:!1},e[7]=o,e[8]=n,e[9]=c,e[10]=a):a=e[10];const{data:d,isLoading:m}=le(a);let u;e[11]!==t?(u={mutationFn:g=>Ce(t,g)},e[11]=t,e[12]=u):u=e[12];const f=ht(u);let x;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==n?(x=g=>{_e(t,g),s.setQueryData(n,g),f.mutate(g)},e[13]=f,e[14]=t,e[15]=s,e[16]=n,e[17]=x):x=e[17];const b=x;let p;e[18]!==d?(p=ue(d),e[18]=d,e[19]=p):p=e[19];let h;return e[20]!==m||e[21]!==b||e[22]!==p?(h={layout:p,isLoading:m,save:b},e[20]=m,e[21]=b,e[22]=p,e[23]=h):h=e[23],h}const Je=M.createContext(null);function ni(t){const e=$.c(24),{children:s}=t,{org:r}=V(),n=ii(r.slug),[l,o]=M.useState(!1),[c,a]=M.useState(null);let d;e[0]!==n.layout?(d=()=>{a(n.layout),o(!0)},e[0]=n.layout,e[1]=d):d=e[1];const m=d;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{a(null),o(!1)},e[2]=u):u=e[2];const f=u;let x;e[3]!==c||e[4]!==n?(x=()=>{c&&n.save(c),a(null),o(!1)},e[3]=c,e[4]=n,e[5]=x):x=e[5];const b=x,p=l&&c!==null,h=p?c:n.layout;let g;e[6]!==c||e[7]!==p||e[8]!==n.layout?(g=p?JSON.stringify(c)!==JSON.stringify(n.layout):!1,e[6]=c,e[7]=p,e[8]=n.layout,e[9]=g):g=e[9];const y=g;let j;e[10]!==l||e[11]!==n?(j=S=>{l?a(S):n.save(S)},e[10]=l,e[11]=n,e[12]=j):j=e[12];const v=j;let w;e[13]!==v||e[14]!==m||e[15]!==y||e[16]!==l||e[17]!==h||e[18]!==b||e[19]!==n.isLoading?(w={isEditMode:l,enter:m,cancel:f,save:b,hasChanges:y,layout:h,isLayoutLoading:n.isLoading,commitLayout:v},e[13]=v,e[14]=m,e[15]=y,e[16]=l,e[17]=h,e[18]=b,e[19]=n.isLoading,e[20]=w):w=e[20];let N;return e[21]!==s||e[22]!==w?(N=i.jsx(Je.Provider,{value:w,children:s}),e[21]=s,e[22]=w,e[23]=N):N=e[23],N}function Ye(){const t=M.useContext(Je);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function ri({agentId:t}){const{org:e,locator:s}=V(),r=ee({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:n}=ds(),{setTaskId:l}=Wt(),[o,c]=M.useState(null),[a,d]=M.useState(!1),m=M.useRef(!1),u=async(h,g)=>{if(!r){W.error("MCP client not available");return}if(!m.current){m.current=!0,d(!0);try{const y=await cs(r,h.name,g),j={type:"doc",content:[{type:"paragraph",content:[rs({id:h.name,name:os(h.name,ls(h._meta)),metadata:y.messages,char:"/",kind:"prompt",args:g}),{type:"text",text:" "}]}]},v=crypto.randomUUID();ms(sessionStorage,s,v,{tiptapDoc:j}),await n({id:v,virtual_mcp_id:t}),l(v,t,{autosend:!0})}catch(y){console.error("[start-thread-from-prompt] failed",y),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},f=async h=>{if(!m.current){if(h.arguments&&h.arguments.length>0){c(h);return}await u(h)}},x=async h=>{if(!o)return;const g=o;c(null),await u(g,h)};return{start:f,startBlank:async()=>{if(!m.current){m.current=!0,d(!0);try{const h=crypto.randomUUID();await n({id:h,virtual_mcp_id:t}),l(h,t)}catch(h){console.error("[start-thread-from-prompt] startBlank failed",h),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},dialog:i.jsx(ns,{prompt:o,setPrompt:h=>c(h),onSubmit:x}),dialogPrompt:o,starting:a}}const G=4,X=100,Te=12,ie={S:{w:1,h:1},M:{w:1,h:2},T:{w:1,h:3},L:{w:2,h:1},XL:{w:2,h:2},LT:{w:2,h:3},XLT:{w:2,h:4},XXLT:{w:2,h:5},W:{w:4,h:1},WT:{w:4,h:3}},oi={S:"Small",M:"Tall",T:"Column",L:"Wide",XL:"Large",LT:"Showcase",XLT:"Display",XXLT:"Tower",W:"Full width",WT:"Hero"},Ee=["S","M","T","L","XL","LT","XLT","XXLT","W","WT"],li=ie.XL;class fe extends M.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?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[i.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:i.jsx(pt,{size:16})}),i.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),i.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 ai(t){const e=$.c(72),{tiles:s,isEditMode:r,renderTile:n,onMove:l,onResize:o,onRemove:c}=t,a=ge(),d=M.useRef(null),[m,u]=M.useState(null),[f,x]=M.useState(null);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={activationConstraint:{distance:4}},e[0]=b):b=e[0];const p=Oe(re(Pe,b),re(Re)),h=s.reduce(ci,0),g=r?Math.max(h+2,4):Math.max(h,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const A=d.current?.getBoundingClientRect();return A?{cellWidth:A.width/G,cellHeight:X}:null},e[1]=y):y=e[1];const j=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=A=>{u(String(A.active.id)),x(j())},e[2]=v):v=e[2];const w=v;let N;e[3]!==f||e[4]!==l||e[5]!==s?(N=A=>{const F=String(A.active.id),P=f??j();if(u(null),x(null),!P||P.cellWidth<=0)return;const z=s.find(q=>q.id===F);if(!z)return;const H=Math.round(A.delta.x/P.cellWidth),B=Math.round(A.delta.y/P.cellHeight);H===0&&B===0||l(F,{x:z.x+H,y:z.y+B})},e[3]=f,e[4]=l,e[5]=s,e[6]=N):N=e[6];const S=N;if(a){let A;if(e[7]!==n||e[8]!==s){let P;e[10]!==n?(P=z=>i.jsx("div",{className:"bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:X},children:i.jsx(fe,{children:n(z)})},z.id),e[10]=n,e[11]=P):P=e[11],A=s.map(P),e[7]=n,e[8]=s,e[9]=A}else A=e[9];let F;return e[12]!==A?(F=i.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=F):F=e[13],F}let C,_,T,I,E,k,L,U,O;if(e[14]!==m||e[15]!==f||e[16]!==r||e[17]!==S||e[18]!==c||e[19]!==o||e[20]!==n||e[21]!==p||e[22]!==s||e[23]!==g){const A=m?s.find(Z=>Z.id===m):null;_=De,U=p,O=w,T=S;const F=g*X,P=r?X*4:X;let z;e[33]!==F||e[34]!==P?(z={height:F,minHeight:P},e[33]=F,e[34]=P,e[35]=z):z=e[35];let H;e[36]!==r||e[37]!==s||e[38]!==g?(H=r&&i.jsx(di,{rows:g,tiles:s}),e[36]=r,e[37]=s,e[38]=g,e[39]=H):H=e[39];let B;if(e[40]!==m||e[41]!==r||e[42]!==c||e[43]!==o||e[44]!==n||e[45]!==s){let Z;e[47]!==m||e[48]!==r||e[49]!==c||e[50]!==o||e[51]!==n?(Z=se=>i.jsx(ui,{tile:se,isEditMode:r,isDragging:m===se.id,onResize:o,onRemove:c,children:n(se)},se.id),e[47]=m,e[48]=r,e[49]=c,e[50]=o,e[51]=n,e[52]=Z):Z=e[52],B=s.map(Z),e[40]=m,e[41]=r,e[42]=c,e[43]=o,e[44]=n,e[45]=s,e[46]=B}else B=e[46];e[53]!==z||e[54]!==H||e[55]!==B?(I=i.jsxs("div",{ref:d,className:"relative w-full",style:z,children:[H,B]}),e[53]=z,e[54]=H,e[55]=B,e[56]=I):I=e[56],C=Ut,E=null;const q=A&&f?A.w*f.cellWidth-Te:void 0,ae=A&&f?A.h*f.cellHeight-Te:void 0;e[57]!==q||e[58]!==ae?(k={width:q,height:ae},e[57]=q,e[58]=ae,e[59]=k):k=e[59],L=A&&i.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:i.jsx(fe,{children:n(A)})}),e[14]=m,e[15]=f,e[16]=r,e[17]=S,e[18]=c,e[19]=o,e[20]=n,e[21]=p,e[22]=s,e[23]=g,e[24]=C,e[25]=_,e[26]=T,e[27]=I,e[28]=E,e[29]=k,e[30]=L,e[31]=U,e[32]=O}else C=e[24],_=e[25],T=e[26],I=e[27],E=e[28],k=e[29],L=e[30],U=e[31],O=e[32];let R;e[60]!==C||e[61]!==E||e[62]!==k||e[63]!==L?(R=i.jsx(C,{dropAnimation:E,style:k,children:L}),e[60]=C,e[61]=E,e[62]=k,e[63]=L,e[64]=R):R=e[64];let Q;return e[65]!==_||e[66]!==T||e[67]!==I||e[68]!==R||e[69]!==U||e[70]!==O?(Q=i.jsxs(_,{sensors:U,onDragStart:O,onDragEnd:T,children:[I,R]}),e[65]=_,e[66]=T,e[67]=I,e[68]=R,e[69]=U,e[70]=O,e[71]=Q):Q=e[71],Q}function ci(t,e){return Math.max(t,e.y+e.h)}function di(t){const e=$.c(7),{rows:s,tiles:r}=t;let n;e[0]!==r?(n=(a,d)=>r.some(m=>a>=m.x&&a<m.x+m.w&&d>=m.y&&d<m.y+m.h),e[0]=r,e[1]=n):n=e[1];const l=n;let o;if(e[2]!==l||e[3]!==s){o=[];for(let a=0;a<s;a++)for(let d=0;d<G;d++)l(d,a)||o.push({x:d,y:a});e[2]=l,e[3]=s,e[4]=o}else o=e[4];let c;return e[5]!==o?(c=i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(mi)}),e[5]=o,e[6]=c):c=e[6],c}function mi(t){return i.jsx("div",{className:"absolute p-1",style:{left:`${t.x/G*100}%`,top:t.y*X,width:`${1/G*100}%`,height:X},children:i.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function ui(t){const e=$.c(31),{tile:s,isEditMode:r,isDragging:n,onResize:l,onRemove:o,children:c}=t,a=!r;let d;e[0]!==a||e[1]!==s.id?(d={id:s.id,disabled:a},e[0]=a,e[1]=s.id,e[2]=d):d=e[2];const{setNodeRef:m,attributes:u,listeners:f,isDragging:x}=Ft(d),b=`${s.x/G*100}%`,p=`${s.w/G*100}%`,h=s.y*X,g=s.h*X,y=x||n,j=!y&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=y&&"opacity-30";let w;e[3]!==j||e[4]!==v?(w=K("absolute p-1 will-change-[left,top,width,height,opacity]",j,v),e[3]=j,e[4]=v,e[5]=w):w=e[5];let N;e[6]!==g||e[7]!==b||e[8]!==h||e[9]!==p?(N={left:b,top:h,width:p,height:g},e[6]=g,e[7]=b,e[8]=h,e[9]=p,e[10]=N):N=e[10];const S=r&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=K("relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=e[12];let _;e[13]!==u||e[14]!==r||e[15]!==f||e[16]!==o||e[17]!==l||e[18]!==s?(_=r&&i.jsxs(i.Fragment,{children:[i.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:i.jsx(Fe,{size:16})}),i.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:i.jsx(fi,{tile:s,onResize:l,onRemove:o})})]}),e[13]=u,e[14]=r,e[15]=f,e[16]=o,e[17]=l,e[18]=s,e[19]=_):_=e[19];let T;e[20]!==c?(T=i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(fe,{children:c})}),e[20]=c,e[21]=T):T=e[21];let I;e[22]!==T||e[23]!==C||e[24]!==_?(I=i.jsxs("div",{className:C,children:[_,T]}),e[22]=T,e[23]=C,e[24]=_,e[25]=I):I=e[25];let E;return e[26]!==m||e[27]!==I||e[28]!==w||e[29]!==N?(E=i.jsx("div",{ref:m,className:w,style:N,children:I}),e[26]=m,e[27]=I,e[28]=w,e[29]=N,e[30]=E):E=e[30],E}function fi(t){const e=$.c(43),{tile:s,onResize:r,onRemove:n}=t,l=s.minW??1,o=s.minH??1;let c,a,d,m,u,f,x;if(e[0]!==o||e[1]!==l||e[2]!==r||e[3]!==s.h||e[4]!==s.id||e[5]!==s.w){let v;e[13]!==o||e[14]!==l?(v=_=>{const T=ie[_];return T.w>=l&&T.h>=o},e[13]=o,e[14]=l,e[15]=v):v=e[15];const w=Ee.filter(v);let N;e[16]!==s.h||e[17]!==s.w?(N=(()=>{for(const T of Ee){const I=ie[T];if(I.w===s.w&&I.h===s.h)return T}return null})(),e[16]=s.h,e[17]=s.w,e[18]=N):N=e[18];const S=N;a=us,e[19]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(fs,{asChild:!0,children:i.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:i.jsx(Tt,{size:16})})}),e[19]=x):x=e[19],c=hs,d="end",m="w-44",e[20]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(ps,{children:"Size"}),e[20]=u):u=e[20];let C;e[21]!==S||e[22]!==r||e[23]!==s.id?(C=_=>{const T=ie[_];return i.jsxs(Ne,{onSelect:()=>r(s.id,T),className:"flex items-center justify-between",children:[i.jsx("span",{children:oi[_]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:S===_?"✓":`${T.w}×${T.h}`})]},_)},e[21]=S,e[22]=r,e[23]=s.id,e[24]=C):C=e[24],f=w.map(C),e[0]=o,e[1]=l,e[2]=r,e[3]=s.h,e[4]=s.id,e[5]=s.w,e[6]=c,e[7]=a,e[8]=d,e[9]=m,e[10]=u,e[11]=f,e[12]=x}else c=e[6],a=e[7],d=e[8],m=e[9],u=e[10],f=e[11],x=e[12];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(xs,{}),e[25]=b):b=e[25];let p;e[26]!==n||e[27]!==s.id?(p=()=>n(s.id),e[26]=n,e[27]=s.id,e[28]=p):p=e[28];let h;e[29]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(gs,{size:14,className:"mr-2"}),e[29]=h):h=e[29];let g;e[30]!==p?(g=i.jsxs(Ne,{onSelect:p,className:"text-destructive focus:text-destructive",children:[h,"Remove tile"]}),e[30]=p,e[31]=g):g=e[31];let y;e[32]!==c||e[33]!==d||e[34]!==m||e[35]!==u||e[36]!==f||e[37]!==g?(y=i.jsxs(c,{align:d,className:m,children:[u,f,b,g]}),e[32]=c,e[33]=d,e[34]=m,e[35]=u,e[36]=f,e[37]=g,e[38]=y):y=e[38];let j;return e[39]!==a||e[40]!==y||e[41]!==x?(j=i.jsxs(a,{children:[x,y]}),e[39]=a,e[40]=y,e[41]=x,e[42]=j):j=e[42],j}function hi(t,e,s){return t.some(r=>e>=r.x&&e<r.x+r.w&&s>=r.y&&s<r.y+r.h)}function he(t,e,s){for(let r=0;r<100;r++)for(let n=0;n<=G-e;n++){let l=!0;for(let o=0;o<s&&l;o++)for(let c=0;c<e&&l;c++)hi(t,n+c,r+o)&&(l=!1);if(l)return{x:n,y:r}}return{x:0,y:0}}function ce(t,e,s={w:1,h:1}){const r=Math.max(s.w,Math.min(G,t)),n=Math.max(s.h,Math.min(6,e));return{w:r,h:n}}function de(t,e,s){const r=Math.max(0,Math.min(G-s,t)),n=Math.max(0,e);return{x:r,y:n}}function pi(t,e,s){const r=t.find(a=>a.id===e);if(!r)return t;const n=t.filter(a=>a.id!==e),l=n.find(a=>s.x>=a.x&&s.x<a.x+a.w&&s.y>=a.y&&s.y<a.y+a.h);if(l&&l.w===r.w&&l.h===r.h)return t.map(a=>a.id===e?{...a,x:l.x,y:l.y}:a.id===l.id?{...a,x:r.x,y:r.y}:a);const c=[{...r,x:s.x,y:s.y}];for(const a of n){const d=he(c,a.w,a.h);c.push({...a,x:d.x,y:d.y})}return c}function xi(t){const e=$.c(35),{layout:s,isLayoutLoading:r,commitLayout:n}=Ye();let l;e[0]!==s.hidden?(l=new Set(s.hidden),e[0]=s.hidden,e[1]=l):l=e[1];const o=l;let c,a;if(e[2]!==t||e[3]!==o||e[4]!==s.tiles){a=[];let y;e[7]!==o?(y=v=>v.pinned||!o.has(v.id),e[7]=o,e[8]=y):y=e[8];const j=t.filter(y);c=new Map;for(const v of t)v.minSize&&c.set(v.id,v.minSize);for(const v of j){const w=s.tiles[v.id];if(!w)continue;const N=c.get(v.id),{w:S,h:C}=ce(w.w,w.h,N),{x:_,y:T}=de(w.x,w.y,S);a.push({id:v.id,x:_,y:T,w:S,h:C,minW:N?.w,minH:N?.h})}for(const v of j){if(a.some(T=>T.id===v.id))continue;const w=v.defaultSize??li,N=c.get(v.id),{w:S,h:C}=ce(w.w,w.h,N),_=he(a,S,C);a.push({id:v.id,x:_.x,y:_.y,w:S,h:C,minW:N?.w,minH:N?.h})}e[2]=t,e[3]=o,e[4]=s.tiles,e[5]=c,e[6]=a}else c=e[5],a=e[6];let d;e[9]!==t?(d=new Set(t.map(gi)),e[9]=t,e[10]=d):d=e[10];const m=d;let u;e[11]!==m||e[12]!==n?(u=(y,j)=>{const v={};for(const w of y)v[w.id]={x:w.x,y:w.y,w:w.w,h:w.h};n({version:J,tiles:v,hidden:j.filter(w=>m.has(w))})},e[11]=m,e[12]=n,e[13]=u):u=e[13];const f=u;let x;e[14]!==a?(x={visible:a},e[14]=a,e[15]=x):x=e[15];let b;e[16]!==f||e[17]!==s||e[18]!==a?(b=(y,j)=>{const v=a.find(S=>S.id===y);if(!v)return;const w=de(j.x,j.y,v.w);if(w.x===v.x&&w.y===v.y)return;const N=pi(a,y,w);f(N,s.hidden)},e[16]=f,e[17]=s,e[18]=a,e[19]=b):b=e[19];let p;e[20]!==f||e[21]!==s||e[22]!==c||e[23]!==a?(p=(y,j)=>{const v=a.find(I=>I.id===y);if(!v)return;const w=c.get(y),{w:N,h:S}=ce(j.w,j.h,w);if(N===v.w&&S===v.h)return;const C={...v,w:N,h:S,x:de(v.x,v.y,N).x},_=a.filter(I=>I.id!==y),T=[C];for(const I of _){const E=he(T,I.w,I.h);T.push({...I,x:E.x,y:E.y})}f(T,s.hidden)},e[20]=f,e[21]=s,e[22]=c,e[23]=a,e[24]=p):p=e[24];let h;e[25]!==f||e[26]!==s||e[27]!==a?(h=y=>{const j=a.filter(v=>v.id!==y);f(j,Array.from(new Set([...s.hidden,y])))},e[25]=f,e[26]=s,e[27]=a,e[28]=h):h=e[28];let g;return e[29]!==r||e[30]!==x||e[31]!==b||e[32]!==p||e[33]!==h?(g={snapshot:x,isLoading:r,moveTile:b,resizeTile:p,hideTile:h},e[29]=r,e[30]=x,e[31]=b,e[32]=p,e[33]=h,e[34]=g):g=e[34],g}function gi(t){return t.id}const bi={w:2,h:4},yi={w:1,h:2},vi={w:1,h:1};function ji(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function wi(t){return`tile:${t.agentId}:${t.resourceUri}`}function Ni(t){return t.promptName?t.agentName:t.description}function Si(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function ve(t){const e=$.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:r,startBlank:n,dialog:l,starting:o}=ri(s);let c;e[2]!==r||e[3]!==n?(c=m=>{if(!m.promptName){n();return}r(Si(m))},e[2]=r,e[3]=n,e[4]=c):c=e[4];const a=c;let d;return e[5]!==l||e[6]!==a||e[7]!==n||e[8]!==o?(d={open:a,startBlank:n,dialog:l,starting:o},e[5]=l,e[6]=a,e[7]=n,e[8]=o,e[9]=d):d=e[9],d}function _i(t){const e=$.c(32),{entry:s,isEditMode:r}=t,{open:n,dialog:l,starting:o}=ve(s.agentId);let c;e[0]!==s||e[1]!==n?(c=()=>n(s),e[0]=s,e[1]=n,e[2]=c):c=e[2];const a=o||r,d=!r&&"cursor-pointer transition-colors hover:bg-accent/40",m=r&&"cursor-default pl-12",u=o&&"opacity-60";let f;e[3]!==d||e[4]!==m||e[5]!==u?(f=K("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,m,u),e[3]=d,e[4]=m,e[5]=u,e[6]=f):f=e[6];let x;e[7]!==s.agentIcon||e[8]!==s.agentName?(x=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=x):x=e[9];let b;e[10]!==s.title?(b=i.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=b):b=e[11];let p;e[12]!==s?(p=Ni(s),e[12]=s,e[13]=p):p=e[13];let h;e[14]!==p?(h=i.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:p}),e[14]=p,e[15]=h):h=e[15];let g;e[16]!==h||e[17]!==b?(g=i.jsxs("div",{className:"min-w-0 flex-1",children:[b,h]}),e[16]=h,e[17]=b,e[18]=g):g=e[18];let y;e[19]!==r?(y=!r&&i.jsx(as,{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]=r,e[20]=y):y=e[20];let j;e[21]!==o||e[22]!==c||e[23]!==g||e[24]!==y||e[25]!==a||e[26]!==f||e[27]!==x?(j=i.jsxs("button",{type:"button",onClick:c,disabled:a,"aria-busy":o,className:f,children:[x,g,y]}),e[21]=o,e[22]=c,e[23]=g,e[24]=y,e[25]=a,e[26]=f,e[27]=x,e[28]=j):j=e[28];let v;return e[29]!==l||e[30]!==j?(v=i.jsxs(i.Fragment,{children:[j,l]}),e[29]=l,e[30]=j,e[31]=v):v=e[31],v}function Ci(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.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},Ti)}),t[0]=e):e=t[0],e}function Ti(t,e){return i.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[i.jsx(D,{className:"size-10 rounded-xl"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(D,{className:"h-3 w-2/3"}),i.jsx(D,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Ei(t){const e=$.c(49),{tile:s,prompts:r,isEditMode:n,tileWidth:l}=t,{org:o}=V(),{open:c,startBlank:a,dialog:d,starting:m}=ve(s.agentId);let u,f,x,b,p;if(e[0]!==n||e[1]!==c||e[2]!==o.id||e[3]!==o.slug||e[4]!==r||e[5]!==a||e[6]!==m||e[7]!==s||e[8]!==l){const y=r.filter(Ii);b="flex h-full w-full flex-col gap-3 p-3";let j;e[14]!==a?(j=()=>{a()},e[14]=a,e[15]=j):j=e[15];const v=m||n,w=n&&"pl-10 pr-10";let N;e[16]!==w?(N=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",w),e[16]=w,e[17]=N):N=e[17];let S;e[18]!==s.agentIcon||e[19]!==s.agentName?(S=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[18]=s.agentIcon,e[19]=s.agentName,e[20]=S):S=e[20];let C;e[21]!==s.agentName?(C=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[21]=s.agentName,e[22]=C):C=e[22];const _=n?"Drag to rearrange":"Open chat";let T;e[23]!==_?(T=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_}),e[23]=_,e[24]=T):T=e[24];let I;e[25]!==C||e[26]!==T?(I=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[C,T]}),e[25]=C,e[26]=T,e[27]=I):I=e[27],e[28]!==m||e[29]!==S||e[30]!==I||e[31]!==j||e[32]!==v||e[33]!==N?(p=i.jsxs("button",{type:"button",onClick:j,disabled:v,"aria-busy":m,className:N,children:[S,I]}),e[28]=m,e[29]=S,e[30]=I,e[31]=j,e[32]=v,e[33]=N,e[34]=p):p=e[34],u="flex min-h-0 flex-1 gap-3 overflow-hidden";let E;e[35]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx($i,{}),e[35]=E):E=e[35],e[36]!==o.id||e[37]!==o.slug||e[38]!==s?(f=i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:i.jsx(M.Suspense,{fallback:E,children:i.jsx(ki,{tile:s,orgId:o.id,orgSlug:o.slug})})}),e[36]=o.id,e[37]=o.slug,e[38]=s,e[39]=f):f=e[39],x=y.length>0&&!n&&l>=2&&i.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:y.map(k=>i.jsx("button",{type:"button",onClick:()=>c(k),disabled:m,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:i.jsx("span",{className:"line-clamp-2",children:k.title})},k.promptName))}),e[0]=n,e[1]=c,e[2]=o.id,e[3]=o.slug,e[4]=r,e[5]=a,e[6]=m,e[7]=s,e[8]=l,e[9]=u,e[10]=f,e[11]=x,e[12]=b,e[13]=p}else u=e[9],f=e[10],x=e[11],b=e[12],p=e[13];let h;e[40]!==u||e[41]!==f||e[42]!==x?(h=i.jsxs("div",{className:u,children:[f,x]}),e[40]=u,e[41]=f,e[42]=x,e[43]=h):h=e[43];let g;return e[44]!==d||e[45]!==b||e[46]!==p||e[47]!==h?(g=i.jsxs("div",{className:b,children:[p,h,d]}),e[44]=d,e[45]=b,e[46]=p,e[47]=h,e[48]=g):g=e[48],g}function Ii(t){return!!t.promptName}function ki(t){const e=$.c(12),{tile:s,orgId:r,orgSlug:n}=t;let l;e[0]!==r||e[1]!==n||e[2]!==s.connectionId?(l={connectionId:s.connectionId,orgId:r,orgSlug:n},e[0]=r,e[1]=n,e[2]=s.connectionId,e[3]=l):l=e[3];const o=ee(l),c=s.minHeight??200,a=s.maxHeight??4e3;let d;return e[4]!==o||e[5]!==r||e[6]!==n||e[7]!==c||e[8]!==a||e[9]!==s.connectionId||e[10]!==s.resourceUri?(d=i.jsx(ts,{resourceURI:s.resourceUri,orgId:r,orgSlug:n,connectionId:s.connectionId,client:o,displayMode:"fullscreen",minHeight:c,maxHeight:a,className:"h-full"}),e[4]=o,e[5]=r,e[6]=n,e[7]=c,e[8]=a,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=d):d=e[11],d}function $i(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[i.jsx(D,{className:"h-3 w-2/3"}),i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ai(t){const e=$.c(14),{icon:s,name:r}=t;let n;e[0]!==s||e[1]!==r?(n=i.jsx(Y,{icon:s,name:r,size:"sm+"}),e[0]=s,e[1]=r,e[2]=n):n=e[2];let l;e[3]!==r?(l=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=o):o=e[5];let c;e[6]!==l?(c=i.jsxs("div",{className:"min-w-0 flex-1",children:[l,o]}),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==n||e[9]!==c?(a=i.jsxs("div",{className:"flex items-center gap-2.5",children:[n,c]}),e[8]=n,e[9]=c,e[10]=a):a=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[i.jsx(D,{className:"h-3 w-3/4"}),i.jsx(D,{className:"h-3 w-1/2"}),i.jsx(D,{className:"h-3 w-2/3"})]}),e[11]=d):d=e[11];let m;return e[12]!==a?(m=i.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[a,d]}),e[12]=a,e[13]=m):m=e[13],m}function Mi(t){const e=$.c(33),{tile:s,prompts:r,isEditMode:n}=t,{open:l,startBlank:o,dialog:c,starting:a}=ve(s.agentId);let d,m,u;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==o||e[4]!==a||e[5]!==s.agentIcon||e[6]!==s.agentName){const x=r.filter(Li);d="flex h-full w-full flex-col gap-3 p-4";let b;e[10]!==o?(b=()=>{o()},e[10]=o,e[11]=b):b=e[11];const p=a||n,h=n&&"pl-10 pr-10";let g;e[12]!==h?(g=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",h),e[12]=h,e[13]=g):g=e[13];let y;e[14]!==s.agentIcon||e[15]!==s.agentName?(y=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[14]=s.agentIcon,e[15]=s.agentName,e[16]=y):y=e[16];let j;e[17]!==s.agentName?(j=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[17]=s.agentName,e[18]=j):j=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"UI unavailable — open chat"}),e[19]=v):v=e[19];let w;e[20]!==j?(w=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[j,v]}),e[20]=j,e[21]=w):w=e[21],e[22]!==w||e[23]!==b||e[24]!==p||e[25]!==g||e[26]!==y?(m=i.jsxs("button",{type:"button",onClick:b,disabled:p,className:g,children:[y,w]}),e[22]=w,e[23]=b,e[24]=p,e[25]=g,e[26]=y,e[27]=m):m=e[27],u=x.length>0&&!n&&i.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:x.map(N=>i.jsx("button",{type:"button",onClick:()=>!n&&l(N),disabled:a,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:i.jsx("span",{className:"line-clamp-2",children:N.title})},N.promptName))}),e[0]=n,e[1]=l,e[2]=r,e[3]=o,e[4]=a,e[5]=s.agentIcon,e[6]=s.agentName,e[7]=d,e[8]=m,e[9]=u}else d=e[7],m=e[8],u=e[9];let f;return e[28]!==c||e[29]!==d||e[30]!==m||e[31]!==u?(f=i.jsxs("div",{className:d,children:[m,u,c]}),e[28]=c,e[29]=d,e[30]=m,e[31]=u,e[32]=f):f=e[32],f}function Li(t){return!!t.promptName}function et(t){const e=$.c(36),{isEditMode:s}=t,{org:r}=V(),{isLoading:n,prompts:l,tiles:o}=ye(r.slug),c=He()?.ids??[];let a;e[0]!==c?(a=new Set(c),e[0]=c,e[1]=a):a=e[1];const d=a,m=Be();let u;e[2]!==o?(u=new Set(o.map(Di)),e[2]=o,e[3]=u):u=e[3];const f=u;let x;if(e[4]!==l){x=new Map;for(const E of l){const k=x.get(E.agentId);k?k.push(E):x.set(E.agentId,[E])}e[4]=l,e[5]=x}else x=e[5];let b;if(e[6]!==l||e[7]!==f||e[8]!==o){let E;e[10]!==f?(E=L=>!f.has(L.agentId),e[10]=f,e[11]=E):E=e[11];const k=l.filter(E);b=[...o.map(Pi),...k.map(Ri)],e[6]=l,e[7]=f,e[8]=o,e[9]=b}else b=e[9];const p=b;let h;e[12]!==p?(h=new Map(p.map(Oi)),e[12]=p,e[13]=h):h=e[13];const g=h;let y;e[14]!==p||e[15]!==d?(y=p.map(E=>({id:E.id,defaultSize:E.kind==="tile"?bi:vi,minSize:E.kind==="tile"?yi:void 0,pinned:d.has(E.data.agentId)})),e[14]=p,e[15]=d,e[16]=y):y=e[16];const j=xi(y);let v;e[17]!==m?(v=E=>{m.apply(k=>k.filter(L=>L!==E)).catch(zi)},e[17]=m,e[18]=v):v=e[18];const w=v;let N;e[19]!==g||e[20]!==j||e[21]!==d||e[22]!==w?(N=E=>{const k=g.get(E);k&&d.has(k.data.agentId)?w(k.data.agentId):j.hideTile(E)},e[19]=g,e[20]=j,e[21]=d,e[22]=w,e[23]=N):N=e[23];const S=N;let C;e[24]!==g||e[25]!==s||e[26]!==x?(C=E=>{const k=g.get(E.id);if(!k)return null;if(k.kind==="tile"){const L=x.get(k.data.agentId)??[];return i.jsx(xt,{fallback:i.jsx(Mi,{tile:k.data,prompts:L,isEditMode:s}),children:i.jsx(M.Suspense,{fallback:i.jsx(Ai,{icon:k.data.agentIcon,name:k.data.agentName}),children:i.jsx(Ei,{tile:k.data,prompts:L,isEditMode:s,tileWidth:E.w})})})}return i.jsx(_i,{entry:k.data,isEditMode:s})},e[24]=g,e[25]=s,e[26]=x,e[27]=C):C=e[27];const _=C;if(n||j.isLoading){let E;return e[28]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx(Ci,{}),e[28]=E):E=e[28],E}if(j.snapshot.visible.length===0&&!s)return null;let I;return e[29]!==s||e[30]!==j.moveTile||e[31]!==j.resizeTile||e[32]!==j.snapshot.visible||e[33]!==S||e[34]!==_?(I=i.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:i.jsx(ai,{tiles:j.snapshot.visible,isEditMode:s,renderTile:_,onMove:j.moveTile,onResize:j.resizeTile,onRemove:S})}),e[29]=s,e[30]=j.moveTile,e[31]=j.resizeTile,e[32]=j.snapshot.visible,e[33]=S,e[34]=_,e[35]=I):I=e[35],I}function zi(){return W.error("Couldn't remove from home — please try again.")}function Oi(t){return[t.id,t]}function Ri(t){return{kind:"prompt",id:ji(t),data:t}}function Pi(t){return{kind:"tile",id:wi(t),data:t}}function Di(t){return t.agentId}function Hi(t){const e=$.c(2),{prompts:s,tiles:r}=ye(t),n=r.length>0||s.length>0;let l;return e[0]!==n?(l={hasVisibleTiles:n},e[0]=n,e[1]=l):l=e[1],l}const Ie=420,ke=305;function tt(){const t=$.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}}),t[1]=s):s=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.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:ke}}),t[2]=r):r=t[2];let n;return t[3]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,r,i.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:ke}})]}),t[3]=n):n=t[3],n}function $e(){const t=$.c(33),{data:e}=gt.useSession(),{org:s}=V(),r=ge(),n=At(),{selectedVirtualMcp:l}=Mt();let o;t[0]!==s.id?(o=yt(s.id),t[0]=s.id,t[1]=o):o=t[1];const a=l??o;let d;t[2]!==s.slug?(d=qt(s.slug),t[2]=s.slug,t[3]=d):d=t[3],le(d);let m;t[4]!==s.id||t[5]!==s.slug?(m={connectionId:Le,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=m):m=t[6];const u=ee(m);let f;t[7]!==s.id||t[8]!==u?(f=bs(u,s.id),t[7]=s.id,t[8]=u,t[9]=f):f=t[9];let x;t[10]!==s.id||t[11]!==u?(x=Qt(u,s.id),t[10]=s.id,t[11]=u,t[12]=x):x=t[12];let b;t[13]!==a.id||t[14]!==s.id||t[15]!==u?(b=wt(s.id,a.id,u),t[13]=a.id,t[14]=s.id,t[15]=u,t[16]=b):b=t[16];let p;t[17]!==f||t[18]!==x||t[19]!==b?(p={queries:[f,x,b]},t[17]=f,t[18]=x,t[19]=b,t[20]=p):p=t[20],Ss(p);const h=ys(),g=Nt(a.id),{hasDecoKey:y,isZeroBalance:j,isInitialFreeCredit:v,balanceDollars:w,hasOnlyDecoProvider:N}=It(),{hasVisibleTiles:S}=Hi(s.slug),C=kt(g?.metadata);if(h.length===0&&!(C&&$t(n))){let R;return t[21]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:i.jsx(Lt,{})})}),t[21]=R):R=t[21],R}let T;t[22]!==e?.user?.name?(T=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=T):T=t[23];const I=T,E=y&&v&&w!=null,k=y&&j&&N;let L;t[24]!==w||t[25]!==E||t[26]!==k?(L=E?i.jsx(ne.CreditsEyebrow,{balanceDollars:w}):k?i.jsx(ne.NoCreditsEyebrow,{}):null,t[24]=w,t[25]=E,t[26]=k,t[27]=L):L=t[27];const U=L;let O;return t[28]!==U||t[29]!==S||t[30]!==r||t[31]!==I?(O=i.jsx(ni,{children:r?i.jsx(Bi,{eyebrow:U,userName:I}):i.jsx(Ui,{eyebrow:U,userName:I,hasVisibleTiles:S})}),t[28]=U,t[29]=S,t[30]=r,t[31]=I,t[32]=O):O=t[32],O}function Bi(t){const e=$.c(12),{eyebrow:s,userName:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(tt,{}),e[0]=n):n=e[0];let l;e[1]!==s?(l=s&&i.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=l):l=e[2];let o;e[3]!==r?(o=i.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",r,"?"]}),e[3]=r,e[4]=o):o=e[4];let c;e[5]!==l||e[6]!==o?(c=i.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[l,o]}),e[5]=l,e[6]=o,e[7]=c):c=e[7];let a;e[8]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:i.jsx(ne.Input,{showConnectionsBanner:!0})}),e[8]=a):a=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("div",{className:"relative w-full px-4 pb-8",children:i.jsx(et,{isEditMode:!1})}),e[9]=d):d=e[9];let m;return e[10]!==c?(m=i.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[n,c,a,d]}),e[10]=c,e[11]=m):m=e[11],m}function Ui(t){const e=$.c(32),{eyebrow:s,userName:r,hasVisibleTiles:n}=t,{isEditMode:l,enter:o,save:c,cancel:a,hasChanges:d}=Ye(),[m,u]=M.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let x;e[1]!==a||e[2]!==o||e[3]!==d||e[4]!==l||e[5]!==c?(x=i.jsx(vs.Right,{children:i.jsx(Fi,{isEditMode:l,hasChanges:d,onEnter:o,onSave:c,onCancel:a,onAddTile:f})}),e[1]=a,e[2]=o,e[3]=d,e[4]=l,e[5]=c,e[6]=x):x=e[6];let b;e[7]!==m?(b=i.jsx(_s,{open:m,onOpenChange:u}),e[7]=m,e[8]=b):b=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(tt,{}),e[9]=p):p=e[9];const h=n||l?"pt-32":"flex-1 justify-center";let g;e[10]!==h?(g=K("relative flex flex-col items-center px-10 pb-4",h),e[10]=h,e[11]=g):g=e[11];let y;e[12]!==s?(y=s&&i.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=y):y=e[13];let j;e[14]!==r?(j=i.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",r,"?"]}),e[14]=r,e[15]=j):j=e[15];let v;e[16]!==y||e[17]!==j?(v=i.jsxs("div",{className:"text-center mb-10",children:[y,j]}),e[16]=y,e[17]=j,e[18]=v):v=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"relative w-full",children:[i.jsx(Qi,{}),i.jsx(ne.Input,{showConnectionsBanner:!0})]}),e[19]=w):w=e[19];let N;e[20]!==v?(N=i.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[v,w]}),e[20]=v,e[21]=N):N=e[21];let S;e[22]!==l?(S=i.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:i.jsx(et,{isEditMode:l})}),e[22]=l,e[23]=S):S=e[23];let C;e[24]!==N||e[25]!==S||e[26]!==g?(C=i.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[p,i.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:i.jsxs("div",{className:g,children:[N,S]})})]}),e[24]=N,e[25]=S,e[26]=g,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==x||e[30]!==b?(_=i.jsxs(i.Fragment,{children:[x,b,C]}),e[28]=C,e[29]=x,e[30]=b,e[31]=_):_=e[31],_}function Fi(t){const e=$.c(17),{isEditMode:s,hasChanges:r,onEnter:n,onSave:l,onCancel:o,onAddTile:c}=t;if(s){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(be,{size:14}),e[0]=m):m=e[0];let u;e[1]!==c?(u=i.jsxs("button",{type:"button",onClick:c,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:[m,"Add tile"]}),e[1]=c,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(ze,{size:14}),e[3]=f):f=e[3];let x;e[4]!==o?(x=i.jsxs(we,{size:"sm",variant:"ghost",onClick:o,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=o,e[5]=x):x=e[5];const b=!r;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(St,{size:14}),e[6]=p):p=e[6];let h;e[7]!==l||e[8]!==b?(h=i.jsxs(we,{size:"sm",onClick:l,disabled:b,className:"gap-1.5 h-7 text-xs",children:[p,"Save"]}),e[7]=l,e[8]=b,e[9]=h):h=e[9];let g;return e[10]!==u||e[11]!==x||e[12]!==h?(g=i.jsxs(i.Fragment,{children:[u,x,h]}),e[10]=u,e[11]=x,e[12]=h,e[13]=g):g=e[13],g}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Et,{size:14}),e[14]=a):a=e[14];let d;return e[15]!==n?(d=i.jsxs("button",{type:"button",onClick:n,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:[a,"Customize"]}),e[15]=n,e[16]=d):d=e[16],d}function Qi(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.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 Zr(){const t=$.c(2);if(ge()){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:i.jsx($e,{})}),t[0]=r):r=t[0],r}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:i.jsx("div",{className:"h-full p-0.5 pt-0.25",children:i.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:i.jsx($e,{})})})}),t[1]=s):s=t[1],s}export{Zr as default};