decocms 3.29.1 → 3.30.1

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 (247) hide show
  1. package/dist/client/assets/{AlertCircle-CIkJ_tva.js → AlertCircle-BQLR7I4E.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DjtsYmlk.js → ArrowUpRight-DSaWSvAP.js} +1 -1
  3. package/dist/client/assets/{Check-DZ5PZYLO.js → Check-DCDpfG7m.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DyJzuYoS.js → CheckCircle-BBK-3Pzt.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CGeYjJAK.js → ChevronDown-BD0G-h2k.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-DWiixe45.js → ChevronLeft-DtP_Ayjz.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-Bm_e-tIB.js → ChevronRight-DUzhuedZ.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BCv26pBY.js → ChevronUp-D5M0geM5.js} +1 -1
  9. package/dist/client/assets/{Container-DNJNU1b4.js → Container-Catp9d2q.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CqB_Aadi.js → DotsVertical-Dok1GVxI.js} +1 -1
  11. package/dist/client/assets/{Eye-MkeUTfT3.js → Eye-Dmik5hYP.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CfVg89f7.js → FilterLines-C37LaXJ1.js} +1 -1
  13. package/dist/client/assets/{Globe01-xZhhj276.js → Globe01-D1c-3J9t.js} +1 -1
  14. package/dist/client/assets/{HardDrive-CtdIy8yR.js → HardDrive-C1vRZoAn.js} +1 -1
  15. package/dist/client/assets/{Key01-CXIWciFj.js → Key01-CdveS1HN.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CJ48TbRA.js → LayoutLeft-Bfxz6P9F.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-Bi6In-BW.js → LinkExternal01-CxEkPs1F.js} +1 -1
  18. package/dist/client/assets/{Monitor01-CsSfQSQt.js → Monitor01-Bkoa3Nbe.js} +1 -1
  19. package/dist/client/assets/{Palette-CmO3ZuPu.js → Palette-C74Da44y.js} +1 -1
  20. package/dist/client/assets/{Play-CQ97sIka.js → Play-BERjgeke.js} +1 -1
  21. package/dist/client/assets/{Plus-CTho-g8m.js → Plus-CdvauR8B.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-D1X4YmG3.js → RefreshCcw01-4ELQWtuB.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BVJBwCEd.js → SearchMd-DvX2rzEB.js} +1 -1
  24. package/dist/client/assets/{Settings02-Cqx4N2is.js → Settings02-Cqwfv4FN.js} +1 -1
  25. package/dist/client/assets/{Shield01-D5OMek_B.js → Shield01-6id4oLiZ.js} +1 -1
  26. package/dist/client/assets/{Star01-4yFjK6bh.js → Star01--MeVNqbA.js} +1 -1
  27. package/dist/client/assets/{Stars01-DWbsIFJF.js → Stars01-C2BTpZeS.js} +1 -1
  28. package/dist/client/assets/{Stars02-BLn35DBB.js → Stars02-D6zEAnUT.js} +1 -1
  29. package/dist/client/assets/{Sun-FelsR2hx.js → Sun-BGVsB7Cm.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-Bsjx9paN.js → SwitchHorizontal01-DC97OO23.js} +1 -1
  31. package/dist/client/assets/{Tool01-BxT6lP7E.js → Tool01-DQ4cTbeu.js} +1 -1
  32. package/dist/client/assets/{Trash01-BczIIm5v.js → Trash01-Biurgfq6.js} +1 -1
  33. package/dist/client/assets/{Upload01-nIFiyRcG.js → Upload01-B-0o1yeU.js} +1 -1
  34. package/dist/client/assets/{User01-CamUMrWb.js → User01-CZ5ejYDg.js} +1 -1
  35. package/dist/client/assets/{Users01-CgFieXMp.js → Users01-CKNLJr4G.js} +1 -1
  36. package/dist/client/assets/{Users03-DT_R5tz6.js → Users03-CA9cu5qb.js} +1 -1
  37. package/dist/client/assets/{X-CRg5TH_Y.js → X-DlMQL-XM.js} +1 -1
  38. package/dist/client/assets/{XCircle-DkwGk6Y1.js → XCircle-G0WrPq0g.js} +1 -1
  39. package/dist/client/assets/{XClose-D72Lt3NI.js → XClose-LNW85JIs.js} +1 -1
  40. package/dist/client/assets/{Zap-B-Fg7TEp.js → Zap-CbtV6Vvm.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-BqiIusHB.js → ZapSquare-C9LhFrIW.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-zDFXRspK.js → ZoomOut-CImzlj9g.js} +1 -1
  43. package/dist/client/assets/{access-gate-SfXPQWUj.js → access-gate-DR0BZ9Yv.js} +1 -1
  44. package/dist/client/assets/{accordion-DKdXwYYc.js → accordion-CiWkTYYE.js} +1 -1
  45. package/dist/client/assets/add-section-modal-Dv2cxIh1.js +1 -0
  46. package/dist/client/assets/{agent-capabilities-QxThXvgQ.js → agent-capabilities-l_XcUqX-.js} +1 -1
  47. package/dist/client/assets/{agent-icon-C_8D2J-7.js → agent-icon-CjlB-XbA.js} +1 -1
  48. package/dist/client/assets/{agent-icons-DozoyM-L.js → agent-icons-COjGtXRX.js} +1 -1
  49. package/dist/client/assets/{agents-list-C0ILdC1R.js → agents-list-BbpQy40q.js} +1 -1
  50. package/dist/client/assets/ai-providers-YKtufrsd.js +1 -0
  51. package/dist/client/assets/{alert-Csb33_9v.js → alert-DUOzDLz2.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CbYM4jmz.js → alert-dialog-ZB1-0uWA.js} +1 -1
  53. package/dist/client/assets/app-editor-CFm4rW9v.js +1 -0
  54. package/dist/client/assets/{auth-catchall-tRl-mCnV.js → auth-catchall-p-9cQrp4.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-CRIa8lnq.js → auth-split-layout-DCQZj1x8.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-DaUVjzEO.js → automation-list-row-1QBzAyda.js} +1 -1
  57. package/dist/client/assets/{automation-runs-ByMFrYpg.js → automation-runs-CbXniThO.js} +1 -1
  58. package/dist/client/assets/{automations-DOHjwNUR.js → automations-DXbm14M-.js} +1 -1
  59. package/dist/client/assets/{avatar-Bf_YMKWh.js → avatar-DdrKHW7Q.js} +1 -1
  60. package/dist/client/assets/{badge-Di1xo__6.js → badge-GxV01_sa.js} +1 -1
  61. package/dist/client/assets/{brand-context-DVFnuzc3.js → brand-context-CckU9jvo.js} +1 -1
  62. package/dist/client/assets/{buckets-BKqAOUQL.js → buckets-BXxpFWbP.js} +1 -1
  63. package/dist/client/assets/{calendar-BvlrJX6s.js → calendar-ndWEDvWe.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-NgXOd2ZO.js → capability-load-error-C1lcmzPk.js} +1 -1
  65. package/dist/client/assets/{card-CWqz0DaV.js → card-B7vNztnP.js} +1 -1
  66. package/dist/client/assets/{chat-context-BoAn6xWM.js → chat-context-Dr8mURNn.js} +1 -1
  67. package/dist/client/assets/{checkbox-C5cEV_DH.js → checkbox-CvlqSsv8.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-Da-trtdE.js → cli-auth-success-DbBnzJkW.js} +1 -1
  69. package/dist/client/assets/collection-detail-dh1JPTkf.js +1 -0
  70. package/dist/client/assets/{collection-display-button-BAYgV8vn.js → collection-display-button-ByiFEfVE.js} +1 -1
  71. package/dist/client/assets/{collection-search-Bk4YcOKu.js → collection-search-B62hBYcH.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-DRe15D6A.js → collection-table-wrapper-p305Tve_.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-CSSbV4je.js → collection-tabs-BoWbncvo.js} +1 -1
  74. package/dist/client/assets/{collections-CG_8shjq.js → collections-BU-b7Qnp.js} +1 -1
  75. package/dist/client/assets/{command-CFpCNmCF.js → command-DeymMKPH.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-BIhfHnnr.js → connect-desktop-dialog-B6fCPmnk.js} +1 -1
  77. package/dist/client/assets/{connection-card-B1-pvTAQ.js → connection-card-BdHs3sI8.js} +1 -1
  78. package/dist/client/assets/{connection-detail-Bh5oWdyn.js → connection-detail-1bfT9skO.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-oVYdKzFk.js → connection-form-helpers-Cl8WE-Wv.js} +1 -1
  80. package/dist/client/assets/{connections-Dp3XGEkZ.js → connections-CQfywKkf.js} +1 -1
  81. package/dist/client/assets/decopilot-sse-pool-TF6jERkV.js +1 -0
  82. package/dist/client/assets/{dialog-DzWL-NrT.js → dialog-Bug5LYvY.js} +1 -1
  83. package/dist/client/assets/{domain-settings-DJD9U4sU.js → domain-settings-CiVW_jUc.js} +1 -1
  84. package/dist/client/assets/{drawer-BLGCEP9S.js → drawer-Ckfnpw8I.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-YzbwHIxx.js → dropdown-menu-CggnBdjt.js} +1 -1
  86. package/dist/client/assets/{dynamic-plugin-layout-BB8gWDVj.js → dynamic-plugin-layout-yS0CT9hK.js} +1 -1
  87. package/dist/client/assets/{empty-state-DfOA7oYG.js → empty-state-C6yeON6c.js} +1 -1
  88. package/dist/client/assets/{empty-state-CEcNMd77.js → empty-state-DtTBbW_W.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-DzgWcXVA.js → extract-connection-data-BR7VTC2M.js} +1 -1
  90. package/dist/client/assets/{features-CIhQ9FPK.js → features-fQ1ChqbW.js} +1 -1
  91. package/dist/client/assets/file-explorer-Bpe6MxXV.js +2 -0
  92. package/dist/client/assets/{file-type-icon-9WcINLx3.js → file-type-icon-Dg4vNCbL.js} +1 -1
  93. package/dist/client/assets/{files-CfinSi-B.js → files-C7GL35WM.js} +1 -1
  94. package/dist/client/assets/{form-DK41bruw.js → form-Bkkvnz-_.js} +1 -1
  95. package/dist/client/assets/{general-BUSEsa-r.js → general-T2AFh9Ye.js} +1 -1
  96. package/dist/client/assets/{generate-id-DOxNmKSl.js → generate-id-DfnWKozM.js} +1 -1
  97. package/dist/client/assets/github-repo-picker-BKJVsWG6.js +4 -0
  98. package/dist/client/assets/{header-tab-button-BDD5kZQa.js → header-tab-button-CfuW1KOG.js} +1 -1
  99. package/dist/client/assets/{hover-card-C0gmU-KR.js → hover-card-7wnR4X6J.js} +1 -1
  100. package/dist/client/assets/{image-field-CNdkpe4-.js → image-field-DsnvgvCV.js} +1 -1
  101. package/dist/client/assets/{index-4CkRjwqB.js → index-BD68Poau.js} +1 -1
  102. package/dist/client/assets/{index-DzNLTQFE.js → index-BDwe75Ed.js} +2 -2
  103. package/dist/client/assets/{index-DdTSg63X.js → index-BL9vKovB.js} +4 -4
  104. package/dist/client/assets/{index-CpG2_v8p.js → index-BjoOIgbb.js} +3 -3
  105. package/dist/client/assets/{index-D-Er7K2V.js → index-C6AFi5aI.js} +1 -1
  106. package/dist/client/assets/{index-CghQMTVW.js → index-CCldjkHi.js} +1 -1
  107. package/dist/client/assets/{index-rP7Vi9h6.js → index-CV7TX6uY.js} +1 -1
  108. package/dist/client/assets/{index-Bw6dLXGR.js → index-C_NDVGp1.js} +1 -1
  109. package/dist/client/assets/index-CoS-DNLH.js +1 -0
  110. package/dist/client/assets/{index-CH6_c02Q.js → index-CvubZqsl.js} +1 -1
  111. package/dist/client/assets/index-DHXKcvHJ.js +1 -0
  112. package/dist/client/assets/{index-Dd5x1Ugx.js → index-Dow8MSuu.js} +1 -1
  113. package/dist/client/assets/{index-B6yJwY9r.js → index-K-cFrJme.js} +1 -1
  114. package/dist/client/assets/{index-Vm79zSBa.js → index-M8U0QO9V.js} +1 -1
  115. package/dist/client/assets/{index-redirect-B5KfXttx.js → index-redirect-CDKs11B5.js} +1 -1
  116. package/dist/client/assets/{index-CRk3na1v.js → index-uM9cBeAz.js} +1 -1
  117. package/dist/client/assets/{infiniteQueryObserver-DKFzmh7N.js → infiniteQueryObserver-DjRZQa58.js} +1 -1
  118. package/dist/client/assets/{input-BWjbzzQM.js → input-CAytkUdm.js} +1 -1
  119. package/dist/client/assets/{integration-icon-Jhe4mXPc.js → integration-icon-BxZqCPgY.js} +1 -1
  120. package/dist/client/assets/{label-BD30ND7M.js → label-_bcDhrPn.js} +1 -1
  121. package/dist/client/assets/{layout-CshuPuNT.js → layout-D6JyUu-W.js} +1 -1
  122. package/dist/client/assets/{login-xvknfGAE.js → login-D_Y894-5.js} +1 -1
  123. package/dist/client/assets/{members-B-0d8UVK.js → members-BiZDHDwm.js} +1 -1
  124. package/dist/client/assets/{monaco-editor-CO97GxVj.js → monaco-editor-DR1buwuA.js} +1 -1
  125. package/dist/client/assets/{monitoring-stats-row-Cfw3-iQJ.js → monitoring-stats-row-BH1n8Qao.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-OP1K2cBS.js → oauth-callback-Bwrh5dBF.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-ai-provider-AV6p2GPf.js → oauth-callback-ai-provider-DnFWhV-5.js} +1 -1
  128. package/dist/client/assets/{onboarding-BydTnX4J.js → onboarding-0pY55b33.js} +1 -1
  129. package/dist/client/assets/{org-install-By9f70v3.js → org-install-CfS-9owX.js} +1 -1
  130. package/dist/client/assets/{org-layout-Cuv0PXEZ.js → org-layout-WjhxFhVG.js} +1 -1
  131. package/dist/client/assets/{org-plugin-layout-D6ftiJr2.js → org-plugin-layout-CBd88Pps.js} +1 -1
  132. package/dist/client/assets/{page-seo-form-D0J4BsJd.js → page-seo-form-DA-M0CRU.js} +1 -1
  133. package/dist/client/assets/page-seo-sheet-BGJM5zp7.js +1 -0
  134. package/dist/client/assets/pair-rWOsLIRO.js +46 -0
  135. package/dist/client/assets/{plugin-empty-state-CTifOpyh.js → plugin-empty-state-BC-cPjsG.js} +1 -1
  136. package/dist/client/assets/{plugin-header-D63WcJTf.js → plugin-header-CZ1sX2n9.js} +1 -1
  137. package/dist/client/assets/{plugin-layout-DIqP9Bzh.js → plugin-layout-egGFGy3C.js} +1 -1
  138. package/dist/client/assets/{popover-w66kr7qI.js → popover-H1IIsqsO.js} +1 -1
  139. package/dist/client/assets/{post-editor-CcNc2iwJ.js → post-editor-D8Amc377.js} +1 -1
  140. package/dist/client/assets/{primitives-CXAphNCy.js → primitives-DXNs_riQ.js} +1 -1
  141. package/dist/client/assets/{profile-DPgEYebY.js → profile-jQNt2qst.js} +1 -1
  142. package/dist/client/assets/project-app-view-CByPW7cJ.js +1 -0
  143. package/dist/client/assets/record-editor-BoDJjFQA.js +1 -0
  144. package/dist/client/assets/registry-aermVrqm.js +2 -0
  145. package/dist/client/assets/{registry-layout-CpOLAjVd.js → registry-layout-CC29q8fz.js} +1 -1
  146. package/dist/client/assets/{require-capability-BJrX_rPe.js → require-capability-g-UPmpGK.js} +1 -1
  147. package/dist/client/assets/{required-auth-layout-CzrHHdU9.js → required-auth-layout-B5sViZsY.js} +1 -1
  148. package/dist/client/assets/{reset-password-XeANzZ8O.js → reset-password-BC3ZM7w0.js} +1 -1
  149. package/dist/client/assets/{resizable-B8hoAXbl.js → resizable-DaIe2JEk.js} +1 -1
  150. package/dist/client/assets/{roles-CfBRlxaX.js → roles-C5M6mJ4v.js} +1 -1
  151. package/dist/client/assets/save-referenced-block-BLu5E_fA.js +1 -0
  152. package/dist/client/assets/{save-status-Ds8Nwo0Y.js → save-status-DaG-SHKI.js} +1 -1
  153. package/dist/client/assets/{schema-form-914BofiG.js → schema-form-BBSGBJV6.js} +1 -1
  154. package/dist/client/assets/{scroll-area-CFrtCBLi.js → scroll-area-7dB1B4gR.js} +1 -1
  155. package/dist/client/assets/{search-input-BXsljctW.js → search-input-DwwxFJsd.js} +1 -1
  156. package/dist/client/assets/{secrets-Dh_eQg6Y.js → secrets-BVqejBQE.js} +1 -1
  157. package/dist/client/assets/{sections-editor-Cy1_wyqm.js → sections-editor-B1P_XWwE.js} +1 -1
  158. package/dist/client/assets/{select-B0qONt_m.js → select-Dn6Da_1F.js} +1 -1
  159. package/dist/client/assets/{select-model-DV1J8lbW.js → select-model-W59Bilmt.js} +1 -1
  160. package/dist/client/assets/seo-editor-CBSOqlcM.js +1 -0
  161. package/dist/client/assets/settings-layout-DypT7z1u.js +1 -0
  162. package/dist/client/assets/{settings-section-ByFuwsko.js → settings-section-BkgYqxH8.js} +1 -1
  163. package/dist/client/assets/{sheet-BlMfZj2L.js → sheet-CxiAY8T5.js} +1 -1
  164. package/dist/client/assets/{shell-controls-URBQR3Oa.js → shell-controls-rZ6L5v7J.js} +1 -1
  165. package/dist/client/assets/{shell-layout-NuYzN-Gn.js → shell-layout-B5B3hmRp.js} +1 -1
  166. package/dist/client/assets/{shell-route-loading-DCVHDrWy.js → shell-route-loading-BURh1jIH.js} +1 -1
  167. package/dist/client/assets/{sidebar-DceLItg8.js → sidebar-CIJpOENy.js} +1 -1
  168. package/dist/client/assets/{skeleton-07IZijZM.js → skeleton-B0e2OkSv.js} +1 -1
  169. package/dist/client/assets/{sortable.esm-CzY2WOGE.js → sortable.esm-B6-kJBUo.js} +1 -1
  170. package/dist/client/assets/{spinner-B8QiOf4h.js → spinner-C2ljLkNd.js} +1 -1
  171. package/dist/client/assets/{sso-CwWhDCFg.js → sso-DutRn6kP.js} +1 -1
  172. package/dist/client/assets/{store-D9gP4byy.js → store-CuKFTdG_.js} +1 -1
  173. package/dist/client/assets/store-registry-CRmNQ4V9.js +2 -0
  174. package/dist/client/assets/{studio-tools-Cly5ZCG3.js → studio-tools-DfxdEEgB.js} +1 -1
  175. package/dist/client/assets/{switch-BJt48css.js → switch-DDGBJlE2.js} +1 -1
  176. package/dist/client/assets/{tab-id-Cgg9_UqF.js → tab-id-TBSp1YxU.js} +6 -6
  177. package/dist/client/assets/{table-3evUHy3g.js → table-GnXYzms9.js} +1 -1
  178. package/dist/client/assets/{tabs-B1x7Fe-S.js → tabs-BajnAGhM.js} +1 -1
  179. package/dist/client/assets/{task-status-F5X71Or6.js → task-status-fWcsMePP.js} +1 -1
  180. package/dist/client/assets/{textarea-CgmDS1mc.js → textarea-JAS7Y9kw.js} +1 -1
  181. package/dist/client/assets/{toggle-group-DVdH8zGh.js → toggle-group-Bv21I6Mc.js} +1 -1
  182. package/dist/client/assets/{toolbar-CXAxzeUh.js → toolbar-CkGflKXn.js} +1 -1
  183. package/dist/client/assets/{tools-list-B226mv7W.js → tools-list-DKrbt2O-.js} +1 -1
  184. package/dist/client/assets/{tooltip-D5r7nYKO.js → tooltip-CKtclZb-.js} +1 -1
  185. package/dist/client/assets/{types-DIAQ40QE.js → types-2N8PTdbg.js} +1 -1
  186. package/dist/client/assets/{use-ai-providers-BMK8G5pd.js → use-ai-providers-CGLipwx3.js} +1 -1
  187. package/dist/client/assets/{use-automations-CqVVjbv4.js → use-automations-BChOAOA6.js} +1 -1
  188. package/dist/client/assets/{use-capability-Dp-xHWqY.js → use-capability-czp9i90U.js} +1 -1
  189. package/dist/client/assets/{use-clock-tick-Dkz_tj-X.js → use-clock-tick-_Fh5zTFQ.js} +1 -1
  190. package/dist/client/assets/{use-collections-dzWuZTM5.js → use-collections-CrAY0KoX.js} +1 -1
  191. package/dist/client/assets/{use-connection-CbBvGv-y.js → use-connection-NiFefepq.js} +1 -1
  192. package/dist/client/assets/{use-copy-CP7WU0J2.js → use-copy-CQfxrmWX.js} +1 -1
  193. package/dist/client/assets/{use-create-virtual-mcp-Dz02gDB8.js → use-create-virtual-mcp-DwKQGNi1.js} +1 -1
  194. package/dist/client/assets/{use-debounced-autosave-7E-JkkEV.js → use-debounced-autosave-DCM6oAgZ.js} +1 -1
  195. package/dist/client/assets/{use-delete-connection-daNvL5F7.js → use-delete-connection-bIYVec_d.js} +1 -1
  196. package/dist/client/assets/{use-file-configs-CzOp0gY1.js → use-file-configs-CqXWCLQv.js} +1 -1
  197. package/dist/client/assets/{use-infinite-scroll-Dz0Ju18S.js → use-infinite-scroll-CNFLUrB_.js} +1 -1
  198. package/dist/client/assets/{use-list-state-Cf00xLLl.js → use-list-state-DRxXstLB.js} +1 -1
  199. package/dist/client/assets/{use-mcp-client-BDuQ-DKr.js → use-mcp-client-B46VYAN_.js} +1 -1
  200. package/dist/client/assets/{use-mcp-prompts-BfczuqQ1.js → use-mcp-prompts-BfYOND3X.js} +1 -1
  201. package/dist/client/assets/{use-mcp-tools-xqS_ta53.js → use-mcp-tools-wPegb5Xs.js} +1 -1
  202. package/dist/client/assets/{use-members-DH5dae5S.js → use-members-DTpTFucv.js} +1 -1
  203. package/dist/client/assets/{use-navigate-to-agent-CLdhXO-i.js → use-navigate-to-agent-DL0_jMva.js} +1 -1
  204. package/dist/client/assets/{use-org-auth-client-BwDW-s0s.js → use-org-auth-client-DFhI1mXp.js} +1 -1
  205. package/dist/client/assets/{use-org-sso-BO0DGPVQ.js → use-org-sso-B2JHlDcL.js} +1 -1
  206. package/dist/client/assets/{use-organization-roles-ZTYugFdP.js → use-organization-roles-Do917bwO.js} +1 -1
  207. package/dist/client/assets/{use-organization-settings-ofRxNgFR.js → use-organization-settings-CGdaVuD7.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-Clpq_83P.js → use-registry-connections-B7_YY-15.js} +1 -1
  209. package/dist/client/assets/{use-secrets-CjbHuNwC.js → use-secrets-qOLSEePj.js} +1 -1
  210. package/dist/client/assets/use-status-sounds-EA9ENH60.js +1 -0
  211. package/dist/client/assets/{use-view-mode-CjoQ3b4F.js → use-view-mode-C2K6zcu8.js} +1 -1
  212. package/dist/client/assets/{use-virtual-mcp-BOy7A3-I.js → use-virtual-mcp-DHileccV.js} +1 -1
  213. package/dist/client/assets/useInfiniteQuery-vMxng0_U.js +1 -0
  214. package/dist/client/assets/{useRouterState-BIyanAgq.js → useRouterState-93R-QVdz.js} +1 -1
  215. package/dist/client/assets/useSuspenseInfiniteQuery-_hGeqDYv.js +1 -0
  216. package/dist/client/assets/{user-DjbLcTMi.js → user-T0gsPnBH.js} +1 -1
  217. package/dist/client/assets/{view-mode-toggle-DnMmKH1O.js → view-mode-toggle-BvPi1TV1.js} +1 -1
  218. package/dist/client/assets/watch-sse-pool-BSePGeIN.js +1 -0
  219. package/dist/client/assets/{workflow-D0yr6HGh.js → workflow-aar8VltW.js} +1 -1
  220. package/dist/client/assets/workflow-detail-Cyps73VW.js +1 -0
  221. package/dist/client/index.html +1 -1
  222. package/dist/server/cli.js +499 -417
  223. package/dist/server/server.js +275 -275
  224. package/package.json +1 -1
  225. package/dist/client/assets/add-section-modal-rFZJepGX.js +0 -1
  226. package/dist/client/assets/ai-providers-BQNg7G2z.js +0 -1
  227. package/dist/client/assets/app-editor-D3p9xZvL.js +0 -1
  228. package/dist/client/assets/collection-detail-K9T_V-NT.js +0 -1
  229. package/dist/client/assets/create-sse-subscription-BS5983N4.js +0 -1
  230. package/dist/client/assets/decopilot-sse-pool-CJ_QbSiL.js +0 -1
  231. package/dist/client/assets/file-explorer-Dp5sNAMl.js +0 -2
  232. package/dist/client/assets/github-repo-picker-BJ45Iuw_.js +0 -4
  233. package/dist/client/assets/index-CZ9iD_kA.js +0 -1
  234. package/dist/client/assets/index-PP1_jM4a.js +0 -1
  235. package/dist/client/assets/page-seo-sheet-Q7Y1gsuc.js +0 -1
  236. package/dist/client/assets/pair-D1IR0Baq.js +0 -46
  237. package/dist/client/assets/project-app-view-B73O2qLq.js +0 -1
  238. package/dist/client/assets/record-editor-hFUcPDs2.js +0 -1
  239. package/dist/client/assets/registry-CSai7Qf3.js +0 -2
  240. package/dist/client/assets/save-referenced-block-MdHBsKGI.js +0 -1
  241. package/dist/client/assets/seo-editor-xn4RyB29.js +0 -1
  242. package/dist/client/assets/settings-layout-DagPHYsX.js +0 -1
  243. package/dist/client/assets/store-registry-Bu6pBKfc.js +0 -2
  244. package/dist/client/assets/use-status-sounds-BQhIBN31.js +0 -1
  245. package/dist/client/assets/useInfiniteQuery-BA4Q5DOk.js +0 -1
  246. package/dist/client/assets/useSuspenseInfiniteQuery-PHI3OnKC.js +0 -1
  247. package/dist/client/assets/workflow-detail-BCL21zFy.js +0 -1
@@ -1 +0,0 @@
1
- import{ar as Ze,as as de,at as Ye,au as et,av as $e,G as he,aw as tt,ax as st,r as A,ay as it,az as nt,aA as rt,aB as ot,aC as ve,aD as lt,aE as at,aF as ct,e as T,j as i,q as J,c as q,l as Ie,aG as pe,o as W,K as ne,n as re,a as dt,v as mt,E as ut,b as ft,B as je}from"./index-CpG2_v8p.js";import{u as xe}from"./tooltip-D5r7nYKO.js";import{i as ht,u as oe,g as pt,a as xt}from"./use-mcp-client-BDuQ-DKr.js";import{a as gt,b as bt,v as yt,u as vt}from"./use-virtual-mcp-BOy7A3-I.js";import{i as jt}from"./Check-DZ5PZYLO.js";import{_ as wt,A as Y,a0 as Nt,v as St,c as _t}from"./agent-icon-C_8D2J-7.js";import{s as ge}from"./Plus-CTho-g8m.js";import{i as Te}from"./X-CRg5TH_Y.js";import{u as Ct,b as kt,h as Et,C as se}from"./agent-capabilities-QxThXvgQ.js";import{u as $t,c as It}from"./chat-context-BoAn6xWM.js";import{N as Tt}from"./agent-icons-DozoyM-L.js";import{u as Ae,a as ie,K as Me,P as Oe,D as Re,c as At,S as Mt,v as Ot,b as Rt,C as zt,s as Pt,d as Dt,e as Ht,f as Lt}from"./sortable.esm-CzY2WOGE.js";import{u as ze,a as Pe,o as Ut}from"./use-organization-settings-ofRxNgFR.js";import{c as be,u as Bt,h as Ft}from"./shell-layout-NuYzN-Gn.js";import{I as Qt}from"./input-BWjbzzQM.js";import{S as Wt}from"./scroll-area-CFrtCBLi.js";import{S as qt,c as Kt,d as Gt,a as Vt,b as Jt}from"./sheet-BlMfZj2L.js";import{S as H}from"./skeleton-07IZijZM.js";import{t as De}from"./ChevronDown-CGeYjJAK.js";import{d as He}from"./ZoomOut-zDFXRspK.js";import{g as Xt,M as Zt}from"./types-DIAQ40QE.js";import{I as Yt}from"./integration-icon-Jhe4mXPc.js";import{u as es}from"./studio-tools-Cly5ZCG3.js";import{t as Le,P as ts,e as ss,s as is,g as ns}from"./pair-D1IR0Baq.js";import{a as rs}from"./XCircle-DkwGk6Y1.js";import{g as os}from"./use-mcp-prompts-BfczuqQ1.js";import{u as ls,w as as}from"./tab-id-Cgg9_UqF.js";import{a as cs,g as ds,c as ms,b as us,D as fs}from"./dropdown-menu-YzbwHIxx.js";import{s as hs}from"./Trash01-BczIIm5v.js";import{a as ps,u as xs}from"./use-ai-providers-BMK8G5pd.js";import{a as gs}from"./toolbar-CXAxzeUh.js";import"./use-collections-dzWuZTM5.js";import"./AlertCircle-CIkJ_tva.js";import"./Tool01-BxT6lP7E.js";import"./SwitchHorizontal01-Bsjx9paN.js";import"./RefreshCcw01-D1X4YmG3.js";import"./ArrowUpRight-DjtsYmlk.js";import"./ZapSquare-BqiIusHB.js";import"./Users03-DT_R5tz6.js";import"./CheckCircle-DyJzuYoS.js";import"./ChevronLeft-DWiixe45.js";import"./ChevronRight-Bm_e-tIB.js";import"./ChevronUp-BCv26pBY.js";import"./DotsVertical-CqB_Aadi.js";import"./Container-DNJNU1b4.js";import"./Eye-MkeUTfT3.js";import"./Globe01-xZhhj276.js";import"./FilterLines-CfVg89f7.js";import"./Star01-4yFjK6bh.js";import"./Palette-CmO3ZuPu.js";import"./HardDrive-CtdIy8yR.js";import"./Stars02-BLn35DBB.js";import"./Key01-CXIWciFj.js";import"./LayoutLeft-CJ48TbRA.js";import"./LinkExternal01-Bi6In-BW.js";import"./Monitor01-CsSfQSQt.js";import"./Sun-FelsR2hx.js";import"./Play-CQ97sIka.js";import"./SearchMd-BVJBwCEd.js";import"./Settings02-Cqx4N2is.js";import"./Shield01-D5OMek_B.js";import"./Stars01-DWbsIFJF.js";import"./Upload01-nIFiyRcG.js";import"./User01-CamUMrWb.js";import"./Users01-CgFieXMp.js";import"./XClose-D72Lt3NI.js";import"./Zap-B-Fg7TEp.js";import"./spinner-B8QiOf4h.js";import"./dialog-DzWL-NrT.js";import"./drawer-BLGCEP9S.js";import"./collection-search-Bk4YcOKu.js";import"./form-DK41bruw.js";import"./label-BD30ND7M.js";import"./select-B0qONt_m.js";import"./tabs-B1x7Fe-S.js";import"./toggle-group-DVdH8zGh.js";import"./connect-desktop-dialog-BIhfHnnr.js";import"./popover-w66kr7qI.js";import"./command-CFpCNmCF.js";import"./index-rP7Vi9h6.js";import"./useInfiniteQuery-BA4Q5DOk.js";import"./infiniteQueryObserver-DKFzmh7N.js";import"./index-B6yJwY9r.js";import"./question-004-sINsf4GQ.js";import"./checkbox-C5cEV_DH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-Bf_YMKWh.js";import"./settings-section-ByFuwsko.js";import"./card-CWqz0DaV.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-B1-pvTAQ.js";import"./use-registry-connections-Clpq_83P.js";import"./use-connection-CbBvGv-y.js";import"./extract-connection-data-DzgWcXVA.js";import"./generate-id-DOxNmKSl.js";import"./collections-CG_8shjq.js";import"./collection-tabs-CSSbV4je.js";import"./badge-Di1xo__6.js";import"./textarea-CgmDS1mc.js";import"./connection-form-helpers-oVYdKzFk.js";import"./use-infinite-scroll-Dz0Ju18S.js";import"./useSuspenseInfiniteQuery-PHI3OnKC.js";import"./required-auth-layout-CzrHHdU9.js";import"./useRouterState-BIyanAgq.js";import"./use-org-sso-BO0DGPVQ.js";import"./use-clock-tick-Dkz_tj-X.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CP7WU0J2.js";import"./file-type-icon-9WcINLx3.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-CLdhXO-i.js";import"./decopilot-sse-pool-CJ_QbSiL.js";import"./create-sse-subscription-BS5983N4.js";function we(t,e){const s=new Set(e);return t.filter(r=>!s.has(r))}function bs(t,e,s){const r=t.slice(0);return r[e]=s,r}var ys=class extends Ze{#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,de.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),a=n.map(m=>m.getCurrentResult()),l=s.length!==n.length,c=n.some((m,u)=>m!==s[u]),o=l||c,d=o?!0:a.some((m,u)=>{const f=this.#e[u];return!f||!Ye(m,f)});!o&&!d||(o&&(this.#c=r,this.#t=n),this.#e=a,this.hasListeners()&&(o&&(we(s,n).forEach(m=>{m.destroy()}),we(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(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),n=s.map(a=>a.defaultedQueryOptions.queryHash);return[r,a=>this.#m(a??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,a=>{e.forEach(l=>{l.observer.trackProp(a)})})})}#m(t,e,s){if(e){const r=this.#a,n=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((a,l)=>a!==r[l]));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=et(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 a=e.get(n);a?a.push(r):e.set(n,[r])});const s=[];return t.forEach(r=>{const n=this.#n.defaultQueryOptions(r),l=e.get(n.queryHash)?.shift()??new $e(this.#n,n);s.push({defaultedQueryOptions:n,observer:l})}),s}#f(t,e){const s=this.#t.indexOf(t);s!==-1&&(this.#e=bs(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)&&de.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function vs({queries:t,...e},s){const r=he(s),n=tt(),a=st(),l=A.useMemo(()=>t.map(h=>{const p=r.defaultQueryOptions(h);return p._optimisticResults=n?"isRestoring":"optimistic",p}),[t,r,n]);l.forEach(h=>{it(h);const p=r.getQueryCache().get(h.queryHash);nt(h,a,p)}),rt(a);const[c]=A.useState(()=>new ys(r,l,e)),[o,d,m]=c.getOptimisticResult(l,e.combine),u=!n&&e.subscribed!==!1;A.useSyncExternalStore(A.useCallback(h=>u?c.subscribe(de.batchCalls(h)):ot,[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),A.useEffect(()=>{c.setQueries(l,e)},[l,e,c]);const x=o.some((h,p)=>ve(l[p],h))?o.flatMap((h,p)=>{const b=l[p];if(b&&ve(b,h)){const v=new $e(r,b);return lt(b,v,a)}return[]}):[];if(x.length>0)throw Promise.all(x);const g=o.find((h,p)=>{const b=l[p];return b&&at({result:h,errorResetBoundary:a,throwOnError:b.throwOnError,query:r.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(g?.error)throw g.error;return d(m())}function js(t,e){return vs({...t,queries:t.queries.map(s=>({...s,suspense:!0,throwOnError:ct,enabled:!0,placeholderData:void 0}))},e)}const ee=8;function ws(t){const e=T.c(16),{open:s,onOpenChange:r}=t,[n,a]=A.useState("");let l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(qt,{children:"Manage home"}),c=i.jsx(Kt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=l,e[1]=c):(l=e[0],c=e[1]);let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(wt,{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]=o):o=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=h=>a(h.target.value),e[3]=d):d=e[3];let m;e[4]!==n?(m=i.jsxs(Gt,{className:"px-5 py-4 border-b border-border",children:[l,c,i.jsxs("div",{className:"relative mt-3",children:[o,i.jsx(Qt,{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(Js,{}),e[6]=u):u=e[6];let f;e[7]!==n?(f=i.jsx(Wt,{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(A.Suspense,{fallback:u,children:i.jsx(Ss,{search:n})})})}),e[7]=n,e[8]=f):f=e[8];let x;e[9]!==m||e[10]!==f?(x=i.jsxs(Vt,{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 g;return e[12]!==r||e[13]!==s||e[14]!==x?(g=i.jsx(Jt,{open:s,onOpenChange:r,children:x}),e[12]=r,e[13]=s,e[14]=x,e[15]=g):g=e[15],g}function Ns(t){const e=T.c(32),{org:s}=J(),r=ze();let n;e[0]!==r?.ids?(n=r?.ids??[],e[0]=r?.ids,e[1]=n):n=e[1];const a=n,l=Pe(),c=bt(),o=he();let d;e[2]!==s||e[3]!==o?(d=()=>o.refetchQueries({queryKey:ne.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=o,e[4]=d):d=e[4];const m=d;let u;e[5]!==a?(u=C=>a.includes(C),e[5]=a,e[6]=u):u=e[6];const f=u;let x;e[7]!==a||e[8]!==t?(x=t?a.filter(C=>t.has(C)).length:a.length,e[7]=a,e[8]=t,e[9]=x):x=e[9];const h=x>=ee;let p;e[10]!==h||e[11]!==f||e[12]!==l?(p=C=>f(C)||h?Promise.resolve():l.apply($=>$.includes(C)?null:[...$,C]),e[10]=h,e[11]=f,e[12]=l,e[13]=p):p=e[13];const b=p;let v;e[14]!==l?(v=C=>l.apply($=>$.filter(E=>E!==C)),e[14]=l,e[15]=v):v=e[15];const w=v;let y;e[16]!==l?(y=C=>l.apply(()=>C),e[16]=l,e[17]=y):y=e[17];const j=y;let N;e[18]!==c||e[19]!==h||e[20]!==f||e[21]!==m||e[22]!==l?(N=async(C,$)=>{await c.update.mutateAsync({id:C.id,data:{metadata:$}}),!f(C.id)&&!h&&await l.apply(E=>E.includes(C.id)?null:[...E,C.id]),await m()},e[18]=c,e[19]=h,e[20]=f,e[21]=m,e[22]=l,e[23]=N):N=e[23];const S=N;let k;return e[24]!==b||e[25]!==h||e[26]!==a||e[27]!==f||e[28]!==w||e[29]!==j||e[30]!==S?(k={homeIds:a,isOnHome:f,atLimit:h,addAgent:b,removeAgent:w,reorder:j,saveAgentMetadata:S},e[24]=b,e[25]=h,e[26]=a,e[27]=f,e[28]=w,e[29]=j,e[30]=S,e[31]=k):k=e[31],k}function Ss(t){const e=T.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=gt(r);let a;e[1]!==n?(a=new Set(n.map($s)),e[1]=n,e[2]=a):a=e[2];const l=Ns(a);let c,o,d;if(e[3]!==n||e[4]!==l||e[5]!==s){const h=new Map(n.map(Es));c=s.trim().toLowerCase();const p=v=>!c||v.title?.toLowerCase().includes(c);o=l.homeIds.map(v=>h.get(v)).filter(ks).filter(p);let b;e[9]!==l?(b=v=>!l.isOnHome(v.id),e[9]=l,e[10]=b):b=e[10],d=n.filter(Cs).filter(b).filter(p).sort(_s),e[3]=n,e[4]=l,e[5]=s,e[6]=c,e[7]=o,e[8]=d}else c=e[6],o=e[7],d=e[8];const m=d;let u;e[11]!==l||e[12]!==o?(u=i.jsx(Is,{home:l,agents:o}),e[11]=l,e[12]=o,e[13]=u):u=e[13];const f=!!c;let x;e[14]!==m||e[15]!==l||e[16]!==f?(x=i.jsx(Ms,{home:l,agents:m,hasSearch:f}),e[14]=m,e[15]=l,e[16]=f,e[17]=x):x=e[17];let g;return e[18]!==u||e[19]!==x?(g=i.jsxs(i.Fragment,{children:[u,x]}),e[18]=u,e[19]=x,e[20]=g):g=e[20],g}function _s(t,e){return(t.title??"").localeCompare(e.title??"")}function Cs(t){return t.id&&!ht(t.id)}function ks(t){return!!t}function Es(t){return[t.id,t]}function $s(t){return t.id}function Ue(t){const e=T.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 a;e[2]!==r?(a=r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let l;return e[4]!==n||e[5]!==a?(l=i.jsxs("div",{className:"flex items-center justify-between px-1",children:[n,a]}),e[4]=n,e[5]=a,e[6]=l):l=e[6],l}function Is(t){const e=T.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 a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={coordinateGetter:Pt},e[1]=a):a=e[1];const l=Ae(ie(Oe,n),ie(Me,a));let c;e[2]!==s?(c=x=>{const{active:g,over:h}=x;if(!h||g.id===h.id)return;const p=s.homeIds,b=p.indexOf(g.id),v=p.indexOf(h.id);b===-1||v===-1||s.reorder(Dt([...p],b,v)).catch(As)},e[2]=s,e[3]=c):c=e[3];const o=c,d=`${s.homeIds.length}/${ee}`;let m;e[4]!==d?(m=i.jsx(Ue,{title:"On home",hint:d}),e[4]=d,e[5]=m):m=e[5];let u;e[6]!==r||e[7]!==o||e[8]!==s||e[9]!==l?(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(Re,{sensors:l,collisionDetection:At,onDragEnd:o,children:i.jsx(Mt,{items:r.map(Ts),strategy:Ot,children:i.jsx("div",{className:"flex flex-col gap-1",children:r.map(x=>i.jsx(Rs,{agent:x,home:s},x.id))})})}),e[6]=r,e[7]=o,e[8]=s,e[9]=l,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 Ts(t){return t.id}function As(){return W.error("Couldn't reorder home — please try again.")}function Ms(t){const e=T.c(6),{home:s,agents:r,hasSearch:n}=t,[a,l]=A.useState(20);let c;if(e[0]!==r||e[1]!==n||e[2]!==s||e[3]!==a){const o=r.slice(0,a);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(Ue,{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:o.map(m=>i.jsx(Ds,{agent:m,home:s},m.id))}),r.length>a&&i.jsxs("button",{type:"button",onClick:()=>l(Os),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",r.length-a,")"]})]})]}),e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=c}else c=e[4];return c}function Os(t){return t+20}function Be(t){const e=pe(t.metadata?.ui).filter(a=>!!a.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 Rs(t){const e=T.c(57),{agent:s,home:r}=t,[n,a]=A.useState(!1);let l;e[0]!==s.id?(l={id:s.id},e[0]=s.id,e[1]=l):l=e[1];const{attributes:c,listeners:o,setNodeRef:d,transform:m,transition:u,isDragging:f}=Rt(l),x=Be(s)||"Quick access";let g;e[2]!==m?(g=zt.Transform.toString(m),e[2]=m,e[3]=g):g=e[3];const h=f?.5:void 0,p=f?100:void 0;let b;e[4]!==g||e[5]!==h||e[6]!==p||e[7]!==u?(b={transform:g,transition:u,opacity:h,zIndex:p},e[4]=g,e[5]=h,e[6]=p,e[7]=u,e[8]=b):b=e[8];const v=b,w=f&&"shadow-lg";let y;e[9]!==w?(y=q("rounded-lg border border-border bg-card",w),e[9]=w,e[10]=y):y=e[10];const j=`Drag to reorder ${s.title??s.id}`;let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(He,{size:14}),e[11]=N):N=e[11];let S;e[12]!==c||e[13]!==o||e[14]!==j?(S=i.jsx("button",{type:"button",...c,...o,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":j,children:N}),e[12]=c,e[13]=o,e[14]=j,e[15]=S):S=e[15];let k;e[16]===Symbol.for("react.memo_cache_sentinel")?(k=()=>a(Ps),e[16]=k):k=e[16];const C=s.title??s.id;let $;e[17]!==s.icon||e[18]!==C?($=i.jsx(Y,{icon:s.icon,name:C,size:"sm"}),e[17]=s.icon,e[18]=C,e[19]=$):$=e[19];const E=s.title??s.id;let _;e[20]!==E?(_=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:E}),e[20]=E,e[21]=_):_=e[21];let I;e[22]!==x?(I=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:x}),e[22]=x,e[23]=I):I=e[23];let O;e[24]!==_||e[25]!==I?(O=i.jsxs("div",{className:"min-w-0 flex-1",children:[_,I]}),e[24]=_,e[25]=I,e[26]=O):O=e[26];const B=n&&"rotate-180";let z;e[27]!==B?(z=q("shrink-0 text-muted-foreground transition-transform",B),e[27]=B,e[28]=z):z=e[28];let P;e[29]!==z?(P=i.jsx(De,{size:16,className:z}),e[29]=z,e[30]=P):P=e[30];let Q;e[31]!==n||e[32]!==$||e[33]!==O||e[34]!==P?(Q=i.jsxs("button",{type:"button",onClick:k,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":n,children:[$,O,P]}),e[31]=n,e[32]=$,e[33]=O,e[34]=P,e[35]=Q):Q=e[35];let M;e[36]!==s.id||e[37]!==r?(M=()=>r.removeAgent(s.id).catch(zs),e[36]=s.id,e[37]=r,e[38]=M):M=e[38];const F=`Remove ${s.title??s.id} from home`;let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx(Te,{size:14}),e[39]=D):D=e[39];let R;e[40]!==M||e[41]!==F?(R=i.jsx("button",{type:"button",onClick:M,"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:D}),e[40]=M,e[41]=F,e[42]=R):R=e[42];let L;e[43]!==S||e[44]!==Q||e[45]!==R?(L=i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,Q,R]}),e[43]=S,e[44]=Q,e[45]=R,e[46]=L):L=e[46];let U;e[47]!==s||e[48]!==n||e[49]!==r?(U=n&&i.jsx(Fe,{agent:s,home:r}),e[47]=s,e[48]=n,e[49]=r,e[50]=U):U=e[50];let G;return e[51]!==d||e[52]!==v||e[53]!==L||e[54]!==U||e[55]!==y?(G=i.jsxs("div",{ref:d,style:v,className:y,children:[L,U]}),e[51]=d,e[52]=v,e[53]=L,e[54]=U,e[55]=y,e[56]=G):G=e[56],G}function zs(){return W.error("Couldn't remove from home — please try again.")}function Ps(t){return!t}function Ds({agent:t,home:e}){const[s,r]=A.useState(!1),[n,a]=A.useState(!1),l=Be(t),c=async()=>{if(!e.atLimit){a(!0);try{await e.addAgent(t.id)}catch{W.error("Couldn't add to home — please try again.")}finally{a(!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(o=>!o),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}),l&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l})]}),i.jsx(De,{size:16,className:q("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 (${ee}) — 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(Ie,{size:12,className:"animate-spin"}):i.jsx(ge,{size:14})})]}),s&&i.jsx(Fe,{agent:t,home:e})]})}function Fe(t){const e=T.c(26),{agent:s,home:r}=t;let n,a,l,c,o,d,m;if(e[0]!==s||e[1]!==r){const p=pe(s.metadata?.ui);let b;e[9]!==s.connections?(b=(s.connections??[]).map(Ls).sort(),e[9]=s.connections,e[10]=b):b=e[10];const v=b;a=s.metadata?.ui?.homePrompts,m="border-t border-border px-3 py-2 flex flex-col gap-3",n=Bs,l=s,c=r,o=v,d=new Set(p.map(Hs)),e[0]=s,e[1]=r,e[2]=n,e[3]=a,e[4]=l,e[5]=c,e[6]=o,e[7]=d,e[8]=m}else n=e[2],a=e[3],l=e[4],c=e[5],o=e[6],d=e[7],m=e[8];let u;e[11]!==n||e[12]!==l||e[13]!==c||e[14]!==o||e[15]!==d?(u=i.jsx(n,{agent:l,home:c,connectionIds:o,pinnedResourceUris:d}),e[11]=n,e[12]=l,e[13]=c,e[14]=o,e[15]=d,e[16]=u):u=e[16];let f;e[17]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Us,{}),e[17]=f):f=e[17];const x=a??null;let g;e[18]!==s||e[19]!==r||e[20]!==x?(g=i.jsx(A.Suspense,{fallback:f,children:i.jsx(Qs,{agent:s,home:r,curated:x})}),e[18]=s,e[19]=r,e[20]=x,e[21]=g):g=e[21];let h;return e[22]!==m||e[23]!==u||e[24]!==g?(h=i.jsxs("div",{className:m,children:[u,g]}),e[22]=m,e[23]=u,e[24]=g,e[25]=h):h=e[25],h}function Hs(t){return t.resourceUri}function Ls(t){return t.connection_id}function Us(){const t=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(H,{className:"h-8 w-full"}),i.jsx(H,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Bs({agent:t,home:e,connectionIds:s,pinnedResourceUris:r}){const n=es(),{data:a,isLoading:l}=re({queryKey:ne.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async o=>{try{const{item:d}=await n.call("COLLECTION_CONNECTIONS_GET",{id:o}),m=(d?.tools??[]).flatMap(u=>{const f=Xt(u._meta);return f?[{name:u.name,description:u.description,resourceUri:f}]:[]});return{id:o,title:d?.title??o,icon:d?.icon??null,uiTools:m}}catch{return{id:o,title:o,icon:null,uiTools:[]}}}))).filter(o=>o.uiTools.length>0)});return s.length===0?null:l?i.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}):!a||a.length===0?null:i.jsx("div",{className:"flex flex-col gap-0.5",children:a.map(c=>c.uiTools.map(o=>i.jsx(Fs,{agent:t,home:e,connection:c,tool:o,isPinned:r.has(o.resourceUri)},`${c.id}:${o.name}`)))})}function Fs({agent:t,home:e,connection:s,tool:r,isPinned:n}){const[a,l]=A.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${ee}) — remove an agent first`);return}l(!0);try{const o=pe(t.metadata?.ui),d=n?o.filter(u=>u.resourceUri!==r.resourceUri):[...o,{connectionId:s.id,resourceUri:r.resourceUri}],m={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:d}};await e.saveAgentMetadata(t,m)}catch(o){console.error("[home-tiles] failed to toggle tile",o),W.error("Couldn't update home — please try again.")}finally{l(!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(Yt,{icon:s.icon,name:s.title,size:"xs"}),i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:Le(r.name)}),i.jsx(Qe,{isPinned:n,submitting:a,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Qe(t){const e=T.c(11),{isPinned:s,submitting:r,onClick:n,label:a}=t,l=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let c;e[0]!==l?(c=q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",l),e[0]=l,e[1]=c):c=e[1];let o;e[2]!==s||e[3]!==r?(o=r?i.jsx(Ie,{size:12,className:"animate-spin"}):s?i.jsx(Nt,{size:14}):i.jsx(ge,{size:14}),e[2]=s,e[3]=r,e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==n||e[7]!==r||e[8]!==c||e[9]!==o?(d=i.jsx("button",{type:"button",onClick:n,disabled:r,"aria-label":a,title:a,className:c,children:o}),e[5]=a,e[6]=n,e[7]=r,e[8]=c,e[9]=o,e[10]=d):d=e[10],d}function Qs(t){const e=T.c(32),{agent:s,home:r,curated:n}=t,{org:a}=J();let l;e[0]!==s.id||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s.id,orgId:a.id,orgSlug:a.slug},e[0]=s.id,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const c=oe(l);let o;e[4]!==s.id||e[5]!==a.id?(o=ne.agentPrompts(a.id,s.id),e[4]=s.id,e[5]=a.id,e[6]=o):o=e[6];let d;e[7]!==c?(d=async()=>{const{prompts:j}=await c.listPrompts();return j.map(Gs)},e[7]=c,e[8]=d):d=e[8];let m;e[9]!==o||e[10]!==d?(m={queryKey:o,queryFn:d,staleTime:3e4,retry:!1},e[9]=o,e[10]=d,e[11]=m):m=e[11];const{data:u,isLoading:f,error:x}=re(m),g=be(a.slug);let h,p;if(e[12]!==s.id||e[13]!==u||e[14]!==g.prompts){let j;e[17]!==s.id?(j=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=j):j=e[18],h=g.prompts.filter(j).map(Ks);let N;e[19]!==u?(N=u??[],e[19]=u,e[20]=N):N=e[20],p=[...N];for(const S of h)p.some(k=>k.name===S.name)||p.push(S);e[12]=s.id,e[13]=u,e[14]=g.prompts,e[15]=h,e[16]=p}else h=e[15],p=e[16];if(f&&h.length===0){let j;return e[21]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=j):j=e[21],j}if(x&&h.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,x),null;if(p.length===0)return null;let b;e[22]!==n||e[23]!==p?(b=n??p.map(qs),e[22]=n,e[23]=p,e[24]=b):b=e[24];let v;e[25]!==b?(v=new Set(b),e[25]=b,e[26]=v):v=e[26];const w=v;let y;return e[27]!==s||e[28]!==r||e[29]!==p||e[30]!==w?(y=i.jsx("div",{className:"flex flex-col gap-0.5",children:p.map(j=>i.jsx(Vs,{agent:s,home:r,prompt:j,allPromptNames:p.map(Ws),isPinned:w.has(j.name)},j.name))}),e[27]=s,e[28]=r,e[29]=p,e[30]=w,e[31]=y):y=e[31],y}function Ws(t){return t.name}function qs(t){return t.name}function Ks(t){return{name:t.promptName,title:t.title,description:t.description}}function Gs(t){return{name:t.name,title:t.title,description:t.description}}function Vs({agent:t,home:e,prompt:s,allPromptNames:r,isPinned:n}){const[a,l]=A.useState(!1),c=async()=>{if(!n&&!e.isOnHome(t.id)&&e.atLimit){W.error(`Home is full (${ee}) — remove an agent first`);return}l(!0);try{const o=t.metadata?.ui?.homePrompts;let d;Array.isArray(o)?d=n?o.filter(u=>u!==s.name):[...o,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(o){console.error("[home-tiles] failed to toggle prompt",o),W.error("Couldn't update home — please try again.")}finally{l(!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??Le(s.name)}),i.jsx(Qe,{isPinned:n,submitting:a,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Js(){const t=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},Xs)}),t[0]=e):e=t[0],e}function Xs(t,e){return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[i.jsx(H,{className:"size-8 rounded-md"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const Z=1,We=`home-board.layout.v${Z}`;function qe(t){return`home-board.layout.v${Z}.${t}`}const Ke={version:Z,tiles:{},hidden:[]};function me(t){return!t||t.version!==Z?Ke:{version:Z,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function Zs(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function Ys(t){try{const e=localStorage.getItem(qe(t));return e?me(JSON.parse(e)):void 0}catch{return}}function Ne(t,e){try{localStorage.setItem(qe(t),JSON.stringify(e))}catch{}}async function Se(t,e){if(!(await fetch(`/api/${t}/kv/${We}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function ei(t){const e=T.c(24),s=he();let r;e[0]!==t?(r=ne.boardLayout(t),e[0]=t,e[1]=r):r=e[1];const n=r;let a;e[2]!==t?(a=Ys(t),e[2]=t,e[3]=a):a=e[3];const l=a;let c;e[4]!==l||e[5]!==t?(c=async()=>{const b=await fetch(`/api/${t}/kv/${We}`);if(b.status===404)return l&&Zs(l)?(await Se(t,l),l):Ke;if(!b.ok)throw new Error("Failed to load board layout");const v=await b.json(),w=me(v.value);return Ne(t,w),w},e[4]=l,e[5]=t,e[6]=c):c=e[6];let o;e[7]!==l||e[8]!==n||e[9]!==c?(o={queryKey:n,queryFn:c,initialData:l,staleTime:0,refetchOnWindowFocus:!1},e[7]=l,e[8]=n,e[9]=c,e[10]=o):o=e[10];const{data:d,isLoading:m}=re(o);let u;e[11]!==t?(u={mutationFn:b=>Se(t,b)},e[11]=t,e[12]=u):u=e[12];const f=dt(u);let x;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==n?(x=b=>{Ne(t,b),s.setQueryData(n,b),f.mutate(b)},e[13]=f,e[14]=t,e[15]=s,e[16]=n,e[17]=x):x=e[17];const g=x;let h;e[18]!==d?(h=me(d),e[18]=d,e[19]=h):h=e[19];let p;return e[20]!==m||e[21]!==g||e[22]!==h?(p={layout:h,isLoading:m,save:g},e[20]=m,e[21]=g,e[22]=h,e[23]=p):p=e[23],p}const Ge=A.createContext(null);function ti(t){const e=T.c(24),{children:s}=t,{org:r}=J(),n=ei(r.slug),[a,l]=A.useState(!1),[c,o]=A.useState(null);let d;e[0]!==n.layout?(d=()=>{o(n.layout),l(!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=()=>{o(null),l(!1)},e[2]=u):u=e[2];const f=u;let x;e[3]!==c||e[4]!==n?(x=()=>{c&&n.save(c),o(null),l(!1)},e[3]=c,e[4]=n,e[5]=x):x=e[5];const g=x,h=a&&c!==null,p=h?c:n.layout;let b;e[6]!==c||e[7]!==h||e[8]!==n.layout?(b=h?JSON.stringify(c)!==JSON.stringify(n.layout):!1,e[6]=c,e[7]=h,e[8]=n.layout,e[9]=b):b=e[9];const v=b;let w;e[10]!==a||e[11]!==n?(w=S=>{a?o(S):n.save(S)},e[10]=a,e[11]=n,e[12]=w):w=e[12];const y=w;let j;e[13]!==y||e[14]!==m||e[15]!==v||e[16]!==a||e[17]!==p||e[18]!==g||e[19]!==n.isLoading?(j={isEditMode:a,enter:m,cancel:f,save:g,hasChanges:v,layout:p,isLayoutLoading:n.isLoading,commitLayout:y},e[13]=y,e[14]=m,e[15]=v,e[16]=a,e[17]=p,e[18]=g,e[19]=n.isLoading,e[20]=j):j=e[20];let N;return e[21]!==s||e[22]!==j?(N=i.jsx(Ge.Provider,{value:j,children:s}),e[21]=s,e[22]=j,e[23]=N):N=e[23],N}function Ve(){const t=A.useContext(Ge);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function si({agentId:t}){const{org:e,locator:s}=J(),r=oe({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:n}=ls(),{setTaskId:a}=Bt(),[l,c]=A.useState(null),[o,d]=A.useState(!1),m=A.useRef(!1),u=async(p,b)=>{if(!r){W.error("MCP client not available");return}if(!m.current){m.current=!0,d(!0);try{const v=await os(r,p.name,b),w={type:"doc",content:[{type:"paragraph",content:[ss({id:p.name,name:is(p.name,ns(p._meta)),metadata:v.messages,char:"/",kind:"prompt",args:b}),{type:"text",text:" "}]}]},y=crypto.randomUUID();as(sessionStorage,s,y,{tiptapDoc:w}),await n({id:y,virtual_mcp_id:t}),a(y,t,{autosend:!0})}catch(v){console.error("[start-thread-from-prompt] failed",v),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},f=async p=>{if(!m.current){if(p.arguments&&p.arguments.length>0){c(p);return}await u(p)}},x=async p=>{if(!l)return;const b=l;c(null),await u(b,p)};return{start:f,startBlank:async()=>{if(!m.current){m.current=!0,d(!0);try{const p=crypto.randomUUID();await n({id:p,virtual_mcp_id:t}),a(p,t)}catch(p){console.error("[start-thread-from-prompt] startBlank failed",p),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},dialog:i.jsx(ts,{prompt:l,setPrompt:p=>c(p),onSubmit:x}),dialogPrompt:l,starting:o}}const K=4,V=100,_e=12,ii=5,ni={w:2,h:2};class ue extends A.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?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(mt,{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 ri(t){const e=T.c(72),{tiles:s,isEditMode:r,renderTile:n,onMove:a,onResize:l,onRemove:c}=t,o=xe(),d=A.useRef(null),[m,u]=A.useState(null),[f,x]=A.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:4}},e[0]=g):g=e[0];const h=Ae(ie(Oe,g),ie(Me)),p=s.reduce(oi,0),b=r?Math.max(p+2,4):Math.max(p,1);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{const M=d.current?.getBoundingClientRect();return M?{cellWidth:M.width/K,cellHeight:V}:null},e[1]=v):v=e[1];const w=v;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=M=>{u(String(M.active.id)),x(w())},e[2]=y):y=e[2];const j=y;let N;e[3]!==f||e[4]!==a||e[5]!==s?(N=M=>{const F=String(M.active.id),D=f??w();if(u(null),x(null),!D||D.cellWidth<=0)return;const R=s.find(G=>G.id===F);if(!R)return;const L=Math.round(M.delta.x/D.cellWidth),U=Math.round(M.delta.y/D.cellHeight);L===0&&U===0||a(F,{x:R.x+L,y:R.y+U})},e[3]=f,e[4]=a,e[5]=s,e[6]=N):N=e[6];const S=N;if(o){let M;if(e[7]!==n||e[8]!==s){let D;e[10]!==n?(D=R=>i.jsx("div",{className:"bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:V},children:i.jsx(ue,{children:n(R)})},R.id),e[10]=n,e[11]=D):D=e[11],M=s.map(D),e[7]=n,e[8]=s,e[9]=M}else M=e[9];let F;return e[12]!==M?(F=i.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:M}),e[12]=M,e[13]=F):F=e[13],F}let k,C,$,E,_,I,O,B,z;if(e[14]!==m||e[15]!==f||e[16]!==r||e[17]!==S||e[18]!==c||e[19]!==l||e[20]!==n||e[21]!==h||e[22]!==s||e[23]!==b){const M=m?s.find(X=>X.id===m):null;C=Re,B=h,z=j,$=S;const F=b*V,D=r?V*4:V;let R;e[33]!==F||e[34]!==D?(R={height:F,minHeight:D},e[33]=F,e[34]=D,e[35]=R):R=e[35];let L;e[36]!==r||e[37]!==s||e[38]!==b?(L=r&&i.jsx(li,{rows:b,tiles:s}),e[36]=r,e[37]=s,e[38]=b,e[39]=L):L=e[39];let U;if(e[40]!==m||e[41]!==r||e[42]!==c||e[43]!==l||e[44]!==n||e[45]!==s){let X;e[47]!==m||e[48]!==r||e[49]!==c||e[50]!==l||e[51]!==n?(X=te=>i.jsx(ci,{tile:te,isEditMode:r,isDragging:m===te.id,onResize:l,onRemove:c,children:n(te)},te.id),e[47]=m,e[48]=r,e[49]=c,e[50]=l,e[51]=n,e[52]=X):X=e[52],U=s.map(X),e[40]=m,e[41]=r,e[42]=c,e[43]=l,e[44]=n,e[45]=s,e[46]=U}else U=e[46];e[53]!==R||e[54]!==L||e[55]!==U?(E=i.jsxs("div",{ref:d,className:"relative w-full",style:R,children:[L,U]}),e[53]=R,e[54]=L,e[55]=U,e[56]=E):E=e[56],k=Ht,_=null;const G=M&&f?M.w*f.cellWidth-_e:void 0,le=M&&f?M.h*f.cellHeight-_e:void 0;e[57]!==G||e[58]!==le?(I={width:G,height:le},e[57]=G,e[58]=le,e[59]=I):I=e[59],O=M&&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(ue,{children:n(M)})}),e[14]=m,e[15]=f,e[16]=r,e[17]=S,e[18]=c,e[19]=l,e[20]=n,e[21]=h,e[22]=s,e[23]=b,e[24]=k,e[25]=C,e[26]=$,e[27]=E,e[28]=_,e[29]=I,e[30]=O,e[31]=B,e[32]=z}else k=e[24],C=e[25],$=e[26],E=e[27],_=e[28],I=e[29],O=e[30],B=e[31],z=e[32];let P;e[60]!==k||e[61]!==_||e[62]!==I||e[63]!==O?(P=i.jsx(k,{dropAnimation:_,style:I,children:O}),e[60]=k,e[61]=_,e[62]=I,e[63]=O,e[64]=P):P=e[64];let Q;return e[65]!==C||e[66]!==$||e[67]!==E||e[68]!==P||e[69]!==B||e[70]!==z?(Q=i.jsxs(C,{sensors:B,onDragStart:z,onDragEnd:$,children:[E,P]}),e[65]=C,e[66]=$,e[67]=E,e[68]=P,e[69]=B,e[70]=z,e[71]=Q):Q=e[71],Q}function oi(t,e){return Math.max(t,e.y+e.h)}function li(t){const e=T.c(7),{rows:s,tiles:r}=t;let n;e[0]!==r?(n=(o,d)=>r.some(m=>o>=m.x&&o<m.x+m.w&&d>=m.y&&d<m.y+m.h),e[0]=r,e[1]=n):n=e[1];const a=n;let l;if(e[2]!==a||e[3]!==s){l=[];for(let o=0;o<s;o++)for(let d=0;d<K;d++)a(d,o)||l.push({x:d,y:o});e[2]=a,e[3]=s,e[4]=l}else l=e[4];let c;return e[5]!==l?(c=i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:l.map(ai)}),e[5]=l,e[6]=c):c=e[6],c}function ai(t){return i.jsx("div",{className:"absolute p-1",style:{left:`${t.x/K*100}%`,top:t.y*V,width:`${1/K*100}%`,height:V},children:i.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function ci(t){const e=T.c(31),{tile:s,isEditMode:r,isDragging:n,onResize:a,onRemove:l,children:c}=t,o=!r;let d;e[0]!==o||e[1]!==s.id?(d={id:s.id,disabled:o},e[0]=o,e[1]=s.id,e[2]=d):d=e[2];const{setNodeRef:m,attributes:u,listeners:f,isDragging:x}=Lt(d),g=`${s.x/K*100}%`,h=`${s.w/K*100}%`,p=s.y*V,b=s.h*V,v=x||n,w=!v&&"transition-[left,top,width,height,opacity] duration-200 ease-out",y=v&&"opacity-30";let j;e[3]!==w||e[4]!==y?(j=q("absolute p-1 will-change-[left,top,width,height,opacity]",w,y),e[3]=w,e[4]=y,e[5]=j):j=e[5];let N;e[6]!==b||e[7]!==g||e[8]!==p||e[9]!==h?(N={left:g,top:p,width:h,height:b},e[6]=b,e[7]=g,e[8]=p,e[9]=h,e[10]=N):N=e[10];const S=r&&"outline outline-1 outline-transparent hover:outline-primary/40";let k;e[11]!==S?(k=q("relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=k):k=e[12];let C;e[13]!==u||e[14]!==r||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==s?(C=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(He,{size:16})}),i.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:i.jsx(di,{tile:s,onResize:a,onRemove:l})})]}),e[13]=u,e[14]=r,e[15]=f,e[16]=l,e[17]=a,e[18]=s,e[19]=C):C=e[19];let $;e[20]!==c?($=i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(ue,{children:c})}),e[20]=c,e[21]=$):$=e[21];let E;e[22]!==$||e[23]!==k||e[24]!==C?(E=i.jsxs("div",{className:k,children:[C,$]}),e[22]=$,e[23]=k,e[24]=C,e[25]=E):E=e[25];let _;return e[26]!==m||e[27]!==E||e[28]!==j||e[29]!==N?(_=i.jsx("div",{ref:m,className:j,style:N,children:E}),e[26]=m,e[27]=E,e[28]=j,e[29]=N,e[30]=_):_=e[30],_}function di(t){const e=T.c(20),{tile:s,onResize:r,onRemove:n}=t,[a,l]=A.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(cs,{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(St,{size:16})})}),e[0]=c):c=e[0];let o;e[1]!==r||e[2]!==s.id?(o=p=>{r(s.id,p),l(!1)},e[1]=r,e[2]=s.id,e[3]=o):o=e[3];let d;e[4]!==o||e[5]!==s?(d=i.jsx(mi,{tile:s,onPick:o}),e[4]=o,e[5]=s,e[6]=d):d=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(ds,{}),e[7]=m):m=e[7];let u;e[8]!==n||e[9]!==s.id?(u=()=>n(s.id),e[8]=n,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(hs,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let x;e[12]!==u?(x=i.jsxs(ms,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=x):x=e[13];let g;e[14]!==d||e[15]!==x?(g=i.jsxs(us,{align:"end",className:"w-auto",children:[d,m,x]}),e[14]=d,e[15]=x,e[16]=g):g=e[16];let h;return e[17]!==a||e[18]!==g?(h=i.jsxs(fs,{open:a,onOpenChange:l,children:[c,g]}),e[17]=a,e[18]=g,e[19]=h):h=e[19],h}function mi(t){const e=T.c(19),{tile:s,onPick:r}=t,n=s.minW??1,a=s.minH??1,[l,c]=A.useState(null);let o;e[0]!==l||e[1]!==s.h||e[2]!==s.w?(o=l??{w:s.w,h:s.h},e[0]=l,e[1]=s.h,e[2]=s.w,e[3]=o):o=e[3];const d=o;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=m):m=e[4];let u;e[5]!==d.h||e[6]!==d.w?(u=i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[m,i.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[d.w," × ",d.h]})]}),e[5]=d.h,e[6]=d.w,e[7]=u):u=e[7];let f,x;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${K}, 1.25rem)`},x=()=>c(null),e[8]=f,e[9]=x):(f=e[8],x=e[9]);let g;e[10]!==d.h||e[11]!==d.w||e[12]!==a||e[13]!==n||e[14]!==r?(g=i.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:x,children:Array.from({length:ii},(p,b)=>Array.from({length:K},(v,w)=>{const y=w+1,j=b+1,N=y<n||j<a,S=y<=d.w&&j<=d.h;return i.jsx("button",{type:"button",disabled:N,"aria-label":`${y} by ${j}`,onPointerEnter:()=>c({w:y,h:j}),onClick:()=>r({w:y,h:j}),className:q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",N?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${y}x${j}`)}))}),e[10]=d.h,e[11]=d.w,e[12]=a,e[13]=n,e[14]=r,e[15]=g):g=e[15];let h;return e[16]!==u||e[17]!==g?(h=i.jsxs("div",{className:"px-2 py-1.5",children:[u,g]}),e[16]=u,e[17]=g,e[18]=h):h=e[18],h}function ui(t,e,s){return t.some(r=>e>=r.x&&e<r.x+r.w&&s>=r.y&&s<r.y+r.h)}function fe(t,e,s){for(let r=0;r<100;r++)for(let n=0;n<=K-e;n++){let a=!0;for(let l=0;l<s&&a;l++)for(let c=0;c<e&&a;c++)ui(t,n+c,r+l)&&(a=!1);if(a)return{x:n,y:r}}return{x:0,y:0}}function ae(t,e,s={w:1,h:1}){const r=Math.max(s.w,Math.min(K,t)),n=Math.max(s.h,Math.min(6,e));return{w:r,h:n}}function ce(t,e,s){const r=Math.max(0,Math.min(K-s,t)),n=Math.max(0,e);return{x:r,y:n}}function fi(t,e,s){const r=t.find(o=>o.id===e);if(!r)return t;const n=t.filter(o=>o.id!==e),a=n.find(o=>s.x>=o.x&&s.x<o.x+o.w&&s.y>=o.y&&s.y<o.y+o.h);if(a&&a.w===r.w&&a.h===r.h)return t.map(o=>o.id===e?{...o,x:a.x,y:a.y}:o.id===a.id?{...o,x:r.x,y:r.y}:o);const c=[{...r,x:s.x,y:s.y}];for(const o of n){const d=fe(c,o.w,o.h);c.push({...o,x:d.x,y:d.y})}return c}function hi(t){const e=T.c(35),{layout:s,isLayoutLoading:r,commitLayout:n}=Ve();let a;e[0]!==s.hidden?(a=new Set(s.hidden),e[0]=s.hidden,e[1]=a):a=e[1];const l=a;let c,o;if(e[2]!==t||e[3]!==l||e[4]!==s.tiles){o=[];let v;e[7]!==l?(v=y=>y.pinned||!l.has(y.id),e[7]=l,e[8]=v):v=e[8];const w=t.filter(v);c=new Map;for(const y of t)y.minSize&&c.set(y.id,y.minSize);for(const y of w){const j=s.tiles[y.id];if(!j)continue;const N=c.get(y.id),{w:S,h:k}=ae(j.w,j.h,N),{x:C,y:$}=ce(j.x,j.y,S);o.push({id:y.id,x:C,y:$,w:S,h:k,minW:N?.w,minH:N?.h})}for(const y of w){if(o.some($=>$.id===y.id))continue;const j=y.defaultSize??ni,N=c.get(y.id),{w:S,h:k}=ae(j.w,j.h,N),C=fe(o,S,k);o.push({id:y.id,x:C.x,y:C.y,w:S,h:k,minW:N?.w,minH:N?.h})}e[2]=t,e[3]=l,e[4]=s.tiles,e[5]=c,e[6]=o}else c=e[5],o=e[6];let d;e[9]!==t?(d=new Set(t.map(pi)),e[9]=t,e[10]=d):d=e[10];const m=d;let u;e[11]!==m||e[12]!==n?(u=(v,w)=>{const y={};for(const j of v)y[j.id]={x:j.x,y:j.y,w:j.w,h:j.h};n({version:Z,tiles:y,hidden:w.filter(j=>m.has(j))})},e[11]=m,e[12]=n,e[13]=u):u=e[13];const f=u;let x;e[14]!==o?(x={visible:o},e[14]=o,e[15]=x):x=e[15];let g;e[16]!==f||e[17]!==s||e[18]!==o?(g=(v,w)=>{const y=o.find(S=>S.id===v);if(!y)return;const j=ce(w.x,w.y,y.w);if(j.x===y.x&&j.y===y.y)return;const N=fi(o,v,j);f(N,s.hidden)},e[16]=f,e[17]=s,e[18]=o,e[19]=g):g=e[19];let h;e[20]!==f||e[21]!==s||e[22]!==c||e[23]!==o?(h=(v,w)=>{const y=o.find(E=>E.id===v);if(!y)return;const j=c.get(v),{w:N,h:S}=ae(w.w,w.h,j);if(N===y.w&&S===y.h)return;const k={...y,w:N,h:S,x:ce(y.x,y.y,N).x},C=o.filter(E=>E.id!==v),$=[k];for(const E of C){const _=fe($,E.w,E.h);$.push({...E,x:_.x,y:_.y})}f($,s.hidden)},e[20]=f,e[21]=s,e[22]=c,e[23]=o,e[24]=h):h=e[24];let p;e[25]!==f||e[26]!==s||e[27]!==o?(p=v=>{const w=o.filter(y=>y.id!==v);f(w,Array.from(new Set([...s.hidden,v])))},e[25]=f,e[26]=s,e[27]=o,e[28]=p):p=e[28];let b;return e[29]!==r||e[30]!==x||e[31]!==g||e[32]!==h||e[33]!==p?(b={snapshot:x,isLoading:r,moveTile:g,resizeTile:h,hideTile:p},e[29]=r,e[30]=x,e[31]=g,e[32]=h,e[33]=p,e[34]=b):b=e[34],b}function pi(t){return t.id}const xi={w:2,h:4},gi={w:1,h:2},bi={w:1,h:1};function yi(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function vi(t){return`tile:${t.agentId}:${t.resourceUri}`}function ji(t){return t.promptName?t.agentName:t.description}function wi(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function ye(t){const e=T.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:a,starting:l}=si(s);let c;e[2]!==r||e[3]!==n?(c=m=>{if(!m.promptName){n();return}r(wi(m))},e[2]=r,e[3]=n,e[4]=c):c=e[4];const o=c;let d;return e[5]!==a||e[6]!==o||e[7]!==n||e[8]!==l?(d={open:o,startBlank:n,dialog:a,starting:l},e[5]=a,e[6]=o,e[7]=n,e[8]=l,e[9]=d):d=e[9],d}function Ni(t){const e=T.c(32),{entry:s,isEditMode:r}=t,{open:n,dialog:a,starting:l}=ye(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 o=l||r,d=!r&&"cursor-pointer transition-colors hover:bg-accent/40",m=r&&"cursor-default pl-12",u=l&&"opacity-60";let f;e[3]!==d||e[4]!==m||e[5]!==u?(f=q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",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 g;e[10]!==s.title?(g=i.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=g):g=e[11];let h;e[12]!==s?(h=ji(s),e[12]=s,e[13]=h):h=e[13];let p;e[14]!==h?(p=i.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:h}),e[14]=h,e[15]=p):p=e[15];let b;e[16]!==p||e[17]!==g?(b=i.jsxs("div",{className:"min-w-0 flex-1",children:[g,p]}),e[16]=p,e[17]=g,e[18]=b):b=e[18];let v;e[19]!==r?(v=!r&&i.jsx(rs,{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]=v):v=e[20];let w;e[21]!==l||e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==o||e[26]!==f||e[27]!==x?(w=i.jsxs("button",{type:"button",onClick:c,disabled:o,"aria-busy":l,className:f,children:[x,b,v]}),e[21]=l,e[22]=c,e[23]=b,e[24]=v,e[25]=o,e[26]=f,e[27]=x,e[28]=w):w=e[28];let y;return e[29]!==a||e[30]!==w?(y=i.jsxs(i.Fragment,{children:[w,a]}),e[29]=a,e[30]=w,e[31]=y):y=e[31],y}function Si(){const t=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},_i)}),t[0]=e):e=t[0],e}function _i(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(H,{className:"size-10 rounded-xl"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Ci(t){const e=T.c(49),{tile:s,prompts:r,isEditMode:n,tileWidth:a}=t,{org:l}=J(),{open:c,startBlank:o,dialog:d,starting:m}=ye(s.agentId);let u,f,x,g,h;if(e[0]!==n||e[1]!==c||e[2]!==l.id||e[3]!==l.slug||e[4]!==r||e[5]!==o||e[6]!==m||e[7]!==s||e[8]!==a){const v=r.filter(ki);g="flex h-full w-full flex-col gap-3 p-3";let w;e[14]!==o?(w=()=>{o()},e[14]=o,e[15]=w):w=e[15];const y=m||n,j=n&&"pl-10 pr-10";let N;e[16]!==j?(N=q("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",j),e[16]=j,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 k;e[21]!==s.agentName?(k=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[21]=s.agentName,e[22]=k):k=e[22];const C=n?"Drag to rearrange":"Open chat";let $;e[23]!==C?($=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:C}),e[23]=C,e[24]=$):$=e[24];let E;e[25]!==k||e[26]!==$?(E=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[k,$]}),e[25]=k,e[26]=$,e[27]=E):E=e[27],e[28]!==m||e[29]!==S||e[30]!==E||e[31]!==w||e[32]!==y||e[33]!==N?(h=i.jsxs("button",{type:"button",onClick:w,disabled:y,"aria-busy":m,className:N,children:[S,E]}),e[28]=m,e[29]=S,e[30]=E,e[31]=w,e[32]=y,e[33]=N,e[34]=h):h=e[34],u="flex min-h-0 flex-1 gap-3 overflow-hidden";let _;e[35]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx($i,{}),e[35]=_):_=e[35],e[36]!==l.id||e[37]!==l.slug||e[38]!==s?(f=i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:i.jsx(A.Suspense,{fallback:_,children:i.jsx(Ei,{tile:s,orgId:l.id,orgSlug:l.slug})})}),e[36]=l.id,e[37]=l.slug,e[38]=s,e[39]=f):f=e[39],x=v.length>0&&!n&&a>=2&&i.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:v.map(I=>i.jsx("button",{type:"button",onClick:()=>c(I),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:I.title})},I.promptName))}),e[0]=n,e[1]=c,e[2]=l.id,e[3]=l.slug,e[4]=r,e[5]=o,e[6]=m,e[7]=s,e[8]=a,e[9]=u,e[10]=f,e[11]=x,e[12]=g,e[13]=h}else u=e[9],f=e[10],x=e[11],g=e[12],h=e[13];let p;e[40]!==u||e[41]!==f||e[42]!==x?(p=i.jsxs("div",{className:u,children:[f,x]}),e[40]=u,e[41]=f,e[42]=x,e[43]=p):p=e[43];let b;return e[44]!==d||e[45]!==g||e[46]!==h||e[47]!==p?(b=i.jsxs("div",{className:g,children:[h,p,d]}),e[44]=d,e[45]=g,e[46]=h,e[47]=p,e[48]=b):b=e[48],b}function ki(t){return!!t.promptName}function Ei(t){const e=T.c(12),{tile:s,orgId:r,orgSlug:n}=t;let a;e[0]!==r||e[1]!==n||e[2]!==s.connectionId?(a={connectionId:s.connectionId,orgId:r,orgSlug:n},e[0]=r,e[1]=n,e[2]=s.connectionId,e[3]=a):a=e[3];const l=oe(a),c=s.minHeight??200,o=s.maxHeight??4e3;let d;return e[4]!==l||e[5]!==r||e[6]!==n||e[7]!==c||e[8]!==o||e[9]!==s.connectionId||e[10]!==s.resourceUri?(d=i.jsx(Zt,{resourceURI:s.resourceUri,orgId:r,orgSlug:n,connectionId:s.connectionId,client:l,displayMode:"fullscreen",minHeight:c,maxHeight:o,className:"h-full"}),e[4]=l,e[5]=r,e[6]=n,e[7]=c,e[8]=o,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=d):d=e[11],d}function $i(){const t=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(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ii(t){const e=T.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 a;e[3]!==r?(a=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=a):a=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=l):l=e[5];let c;e[6]!==a?(c=i.jsxs("div",{className:"min-w-0 flex-1",children:[a,l]}),e[6]=a,e[7]=c):c=e[7];let o;e[8]!==n||e[9]!==c?(o=i.jsxs("div",{className:"flex items-center gap-2.5",children:[n,c]}),e[8]=n,e[9]=c,e[10]=o):o=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(H,{className:"h-3 w-3/4"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-3 w-2/3"})]}),e[11]=d):d=e[11];let m;return e[12]!==o?(m=i.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[o,d]}),e[12]=o,e[13]=m):m=e[13],m}function Ti(t){const e=T.c(33),{tile:s,prompts:r,isEditMode:n}=t,{open:a,startBlank:l,dialog:c,starting:o}=ye(s.agentId);let d,m,u;if(e[0]!==n||e[1]!==a||e[2]!==r||e[3]!==l||e[4]!==o||e[5]!==s.agentIcon||e[6]!==s.agentName){const x=r.filter(Ai);d="flex h-full w-full flex-col gap-3 p-4";let g;e[10]!==l?(g=()=>{l()},e[10]=l,e[11]=g):g=e[11];const h=o||n,p=n&&"pl-10 pr-10";let b;e[12]!==p?(b=q("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",p),e[12]=p,e[13]=b):b=e[13];let v;e[14]!==s.agentIcon||e[15]!==s.agentName?(v=i.jsx(Y,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[14]=s.agentIcon,e[15]=s.agentName,e[16]=v):v=e[16];let w;e[17]!==s.agentName?(w=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.agentName}),e[17]=s.agentName,e[18]=w):w=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"UI unavailable — open chat"}),e[19]=y):y=e[19];let j;e[20]!==w?(j=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[w,y]}),e[20]=w,e[21]=j):j=e[21],e[22]!==j||e[23]!==g||e[24]!==h||e[25]!==b||e[26]!==v?(m=i.jsxs("button",{type:"button",onClick:g,disabled:h,className:b,children:[v,j]}),e[22]=j,e[23]=g,e[24]=h,e[25]=b,e[26]=v,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&&a(N),disabled:o,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]=a,e[2]=r,e[3]=l,e[4]=o,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 Ai(t){return!!t.promptName}function Je(t){const e=T.c(36),{isEditMode:s}=t,{org:r}=J(),{isLoading:n,prompts:a,tiles:l}=be(r.slug),c=ze()?.ids??[];let o;e[0]!==c?(o=new Set(c),e[0]=c,e[1]=o):o=e[1];const d=o,m=Pe();let u;e[2]!==l?(u=new Set(l.map(Pi)),e[2]=l,e[3]=u):u=e[3];const f=u;let x;if(e[4]!==a){x=new Map;for(const _ of a){const I=x.get(_.agentId);I?I.push(_):x.set(_.agentId,[_])}e[4]=a,e[5]=x}else x=e[5];let g;if(e[6]!==a||e[7]!==f||e[8]!==l){let _;e[10]!==f?(_=O=>!f.has(O.agentId),e[10]=f,e[11]=_):_=e[11];const I=a.filter(_);g=[...l.map(zi),...I.map(Ri)],e[6]=a,e[7]=f,e[8]=l,e[9]=g}else g=e[9];const h=g;let p;e[12]!==h?(p=new Map(h.map(Oi)),e[12]=h,e[13]=p):p=e[13];const b=p;let v;e[14]!==h||e[15]!==d?(v=h.map(_=>({id:_.id,defaultSize:_.kind==="tile"?xi:bi,minSize:_.kind==="tile"?gi:void 0,pinned:d.has(_.data.agentId)})),e[14]=h,e[15]=d,e[16]=v):v=e[16];const w=hi(v);let y;e[17]!==m?(y=_=>{m.apply(I=>I.filter(O=>O!==_)).catch(Mi)},e[17]=m,e[18]=y):y=e[18];const j=y;let N;e[19]!==b||e[20]!==w||e[21]!==d||e[22]!==j?(N=_=>{const I=b.get(_);I&&d.has(I.data.agentId)?j(I.data.agentId):w.hideTile(_)},e[19]=b,e[20]=w,e[21]=d,e[22]=j,e[23]=N):N=e[23];const S=N;let k;e[24]!==b||e[25]!==s||e[26]!==x?(k=_=>{const I=b.get(_.id);if(!I)return null;if(I.kind==="tile"){const O=x.get(I.data.agentId)??[];return i.jsx(ut,{fallback:i.jsx(Ti,{tile:I.data,prompts:O,isEditMode:s}),children:i.jsx(A.Suspense,{fallback:i.jsx(Ii,{icon:I.data.agentIcon,name:I.data.agentName}),children:i.jsx(Ci,{tile:I.data,prompts:O,isEditMode:s,tileWidth:_.w})})})}return i.jsx(Ni,{entry:I.data,isEditMode:s})},e[24]=b,e[25]=s,e[26]=x,e[27]=k):k=e[27];const C=k;if(n||w.isLoading){let _;return e[28]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx(Si,{}),e[28]=_):_=e[28],_}if(w.snapshot.visible.length===0&&!s)return null;let E;return e[29]!==s||e[30]!==w.moveTile||e[31]!==w.resizeTile||e[32]!==w.snapshot.visible||e[33]!==S||e[34]!==C?(E=i.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:i.jsx(ri,{tiles:w.snapshot.visible,isEditMode:s,renderTile:C,onMove:w.moveTile,onResize:w.resizeTile,onRemove:S})}),e[29]=s,e[30]=w.moveTile,e[31]=w.resizeTile,e[32]=w.snapshot.visible,e[33]=S,e[34]=C,e[35]=E):E=e[35],E}function Mi(){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:yi(t),data:t}}function zi(t){return{kind:"tile",id:vi(t),data:t}}function Pi(t){return t.agentId}function Di(t){const e=T.c(2),{prompts:s,tiles:r}=be(t),n=r.length>0||s.length>0;let a;return e[0]!==n?(a={hasVisibleTiles:n},e[0]=n,e[1]=a):a=e[1],a}const Ce=420,ke=305;function Xe(){const t=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:Ce}}),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:Ce}}),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 Ee(){const t=T.c(33),{data:e}=ft.useSession(),{org:s}=J(),r=xe(),n=$t(),{selectedVirtualMcp:a}=It();let l;t[0]!==s.id?(l=pt(s.id),t[0]=s.id,t[1]=l):l=t[1];const o=a??l;let d;t[2]!==s.slug?(d=Ft(s.slug),t[2]=s.slug,t[3]=d):d=t[3],re(d);let m;t[4]!==s.id||t[5]!==s.slug?(m={connectionId:xt,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=m):m=t[6];const u=oe(m);let f;t[7]!==s.id||t[8]!==u?(f=ps(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=Ut(u,s.id),t[10]=s.id,t[11]=u,t[12]=x):x=t[12];let g;t[13]!==o.id||t[14]!==s.id||t[15]!==u?(g=yt(s.id,o.id,u),t[13]=o.id,t[14]=s.id,t[15]=u,t[16]=g):g=t[16];let h;t[17]!==f||t[18]!==x||t[19]!==g?(h={queries:[f,x,g]},t[17]=f,t[18]=x,t[19]=g,t[20]=h):h=t[20],js(h);const p=xs(),b=vt(o.id),{hasDecoKey:v,isZeroBalance:w,isInitialFreeCredit:y,balanceDollars:j,hasOnlyDecoProvider:N}=Ct(),{hasVisibleTiles:S}=Di(s.slug),k=kt(b?.metadata);if(p.length===0&&!(k&&Et(n))){let P;return t[21]===Symbol.for("react.memo_cache_sentinel")?(P=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(Tt,{})})}),t[21]=P):P=t[21],P}let $;t[22]!==e?.user?.name?($=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=$):$=t[23];const E=$,_=v&&y&&j!=null,I=v&&w&&N;let O;t[24]!==j||t[25]!==_||t[26]!==I?(O=_?i.jsx(se.CreditsEyebrow,{balanceDollars:j}):I?i.jsx(se.NoCreditsEyebrow,{}):null,t[24]=j,t[25]=_,t[26]=I,t[27]=O):O=t[27];const B=O;let z;return t[28]!==B||t[29]!==S||t[30]!==r||t[31]!==E?(z=i.jsx(ti,{children:r?i.jsx(Hi,{eyebrow:B,userName:E}):i.jsx(Li,{eyebrow:B,userName:E,hasVisibleTiles:S})}),t[28]=B,t[29]=S,t[30]=r,t[31]=E,t[32]=z):z=t[32],z}function Hi(t){const e=T.c(12),{eyebrow:s,userName:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(Xe,{}),e[0]=n):n=e[0];let a;e[1]!==s?(a=s&&i.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=a):a=e[2];let l;e[3]!==r?(l=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]=l):l=e[4];let c;e[5]!==a||e[6]!==l?(c=i.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[a,l]}),e[5]=a,e[6]=l,e[7]=c):c=e[7];let o;e[8]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:i.jsx(se.Input,{showConnectionsBanner:!0})}),e[8]=o):o=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(Je,{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,o,d]}),e[10]=c,e[11]=m):m=e[11],m}function Li(t){const e=T.c(32),{eyebrow:s,userName:r,hasVisibleTiles:n}=t,{isEditMode:a,enter:l,save:c,cancel:o,hasChanges:d}=Ve(),[m,u]=A.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]!==o||e[2]!==l||e[3]!==d||e[4]!==a||e[5]!==c?(x=i.jsx(gs.Right,{children:i.jsx(Ui,{isEditMode:a,hasChanges:d,onEnter:l,onSave:c,onCancel:o,onAddTile:f})}),e[1]=o,e[2]=l,e[3]=d,e[4]=a,e[5]=c,e[6]=x):x=e[6];let g;e[7]!==m?(g=i.jsx(ws,{open:m,onOpenChange:u}),e[7]=m,e[8]=g):g=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(Xe,{}),e[9]=h):h=e[9];const p=n||a?"pt-32":"flex-1 justify-center";let b;e[10]!==p?(b=q("relative flex flex-col items-center px-10 pb-4",p),e[10]=p,e[11]=b):b=e[11];let v;e[12]!==s?(v=s&&i.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=v):v=e[13];let w;e[14]!==r?(w=i.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",r,"?"]}),e[14]=r,e[15]=w):w=e[15];let y;e[16]!==v||e[17]!==w?(y=i.jsxs("div",{className:"text-center mb-10",children:[v,w]}),e[16]=v,e[17]=w,e[18]=y):y=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"relative w-full",children:[i.jsx(Bi,{}),i.jsx(se.Input,{showConnectionsBanner:!0})]}),e[19]=j):j=e[19];let N;e[20]!==y?(N=i.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[y,j]}),e[20]=y,e[21]=N):N=e[21];let S;e[22]!==a?(S=i.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:i.jsx(Je,{isEditMode:a})}),e[22]=a,e[23]=S):S=e[23];let k;e[24]!==N||e[25]!==S||e[26]!==b?(k=i.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[h,i.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:i.jsxs("div",{className:b,children:[N,S]})})]}),e[24]=N,e[25]=S,e[26]=b,e[27]=k):k=e[27];let C;return e[28]!==k||e[29]!==x||e[30]!==g?(C=i.jsxs(i.Fragment,{children:[x,g,k]}),e[28]=k,e[29]=x,e[30]=g,e[31]=C):C=e[31],C}function Ui(t){const e=T.c(17),{isEditMode:s,hasChanges:r,onEnter:n,onSave:a,onCancel:l,onAddTile:c}=t;if(s){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(ge,{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(Te,{size:14}),e[3]=f):f=e[3];let x;e[4]!==l?(x=i.jsxs(je,{size:"sm",variant:"ghost",onClick:l,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=l,e[5]=x):x=e[5];const g=!r;let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(jt,{size:14}),e[6]=h):h=e[6];let p;e[7]!==a||e[8]!==g?(p=i.jsxs(je,{size:"sm",onClick:a,disabled:g,className:"gap-1.5 h-7 text-xs",children:[h,"Save"]}),e[7]=a,e[8]=g,e[9]=p):p=e[9];let b;return e[10]!==u||e[11]!==x||e[12]!==p?(b=i.jsxs(i.Fragment,{children:[u,x,p]}),e[10]=u,e[11]=x,e[12]=p,e[13]=b):b=e[13],b}let o;e[14]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(_t,{size:14}),e[14]=o):o=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:[o,"Customize"]}),e[15]=n,e[16]=d):d=e[16],d}function Bi(){const t=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 Vr(){const t=T.c(2);if(xe()){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(Ee,{})}),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(Ee,{})})})}),t[1]=s):s=t[1],s}export{Vr as default};
@@ -1 +0,0 @@
1
- import{e as it,r as E,j as e,l as rt}from"./index-CpG2_v8p.js";import{S as mt,d as pt,a as st,b as at}from"./sheet-BlMfZj2L.js";import{S as nt}from"./scroll-area-CFrtCBLi.js";import{r as lt,c as ct,u as dt,a as St,i as ft,f as ut,d as vt,P as ht,S as gt}from"./page-seo-form-D0J4BsJd.js";import{m as xt}from"./index-DdTSg63X.js";import"./X-CRg5TH_Y.js";import"./select-B0qONt_m.js";import"./tooltip-D5r7nYKO.js";import"./Check-DZ5PZYLO.js";import"./ChevronDown-CGeYjJAK.js";import"./ChevronUp-BCv26pBY.js";import"./label-BD30ND7M.js";import"./switch-BJt48css.js";import"./schema-form-914BofiG.js";import"./agent-icon-C_8D2J-7.js";import"./AlertCircle-CIkJ_tva.js";import"./Tool01-BxT6lP7E.js";import"./SwitchHorizontal01-Bsjx9paN.js";import"./RefreshCcw01-D1X4YmG3.js";import"./XCircle-DkwGk6Y1.js";import"./ArrowUpRight-DjtsYmlk.js";import"./ZapSquare-BqiIusHB.js";import"./Users03-DT_R5tz6.js";import"./CheckCircle-DyJzuYoS.js";import"./ChevronLeft-DWiixe45.js";import"./ChevronRight-Bm_e-tIB.js";import"./DotsVertical-CqB_Aadi.js";import"./Container-DNJNU1b4.js";import"./Eye-MkeUTfT3.js";import"./ZoomOut-zDFXRspK.js";import"./Globe01-xZhhj276.js";import"./FilterLines-CfVg89f7.js";import"./Star01-4yFjK6bh.js";import"./Palette-CmO3ZuPu.js";import"./HardDrive-CtdIy8yR.js";import"./Stars02-BLn35DBB.js";import"./Key01-CXIWciFj.js";import"./LayoutLeft-CJ48TbRA.js";import"./LinkExternal01-Bi6In-BW.js";import"./Monitor01-CsSfQSQt.js";import"./Sun-FelsR2hx.js";import"./Play-CQ97sIka.js";import"./Plus-CTho-g8m.js";import"./SearchMd-BVJBwCEd.js";import"./Settings02-Cqx4N2is.js";import"./Shield01-D5OMek_B.js";import"./Stars01-DWbsIFJF.js";import"./Trash01-BczIIm5v.js";import"./Upload01-nIFiyRcG.js";import"./User01-CamUMrWb.js";import"./Users01-CgFieXMp.js";import"./XClose-D72Lt3NI.js";import"./Zap-B-Fg7TEp.js";import"./calendar-BvlrJX6s.js";import"./input-BWjbzzQM.js";import"./popover-w66kr7qI.js";import"./textarea-CgmDS1mc.js";import"./dropdown-menu-YzbwHIxx.js";import"./image-field-CNdkpe4-.js";import"./dialog-DzWL-NrT.js";import"./skeleton-07IZijZM.js";import"./tabs-B1x7Fe-S.js";import"./use-file-configs-CzOp0gY1.js";import"./studio-tools-Cly5ZCG3.js";import"./useInfiniteQuery-BA4Q5DOk.js";import"./infiniteQueryObserver-DKFzmh7N.js";import"./agent-capabilities-QxThXvgQ.js";import"./chat-context-BoAn6xWM.js";import"./tab-id-Cgg9_UqF.js";import"./use-mcp-client-BDuQ-DKr.js";import"./decopilot-sse-pool-CJ_QbSiL.js";import"./create-sse-subscription-BS5983N4.js";import"./use-virtual-mcp-BOy7A3-I.js";import"./use-collections-dzWuZTM5.js";import"./use-ai-providers-BMK8G5pd.js";import"./use-organization-settings-ofRxNgFR.js";import"./pair-D1IR0Baq.js";import"./use-clock-tick-Dkz_tj-X.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CP7WU0J2.js";import"./file-type-icon-9WcINLx3.js";import"./content-blocks-o63cs2vh.js";import"./types-DIAQ40QE.js";import"./shell-layout-NuYzN-Gn.js";import"./avatar-Bf_YMKWh.js";import"./required-auth-layout-CzrHHdU9.js";import"./useRouterState-BIyanAgq.js";import"./use-org-sso-BO0DGPVQ.js";import"./integration-icon-Jhe4mXPc.js";import"./use-navigate-to-agent-CLdhXO-i.js";import"./use-connection-CbBvGv-y.js";import"./use-mcp-prompts-BfczuqQ1.js";import"./form-DK41bruw.js";import"./spinner-B8QiOf4h.js";import"./drawer-BLGCEP9S.js";import"./collection-search-Bk4YcOKu.js";import"./toggle-group-DVdH8zGh.js";import"./connect-desktop-dialog-BIhfHnnr.js";import"./agent-icons-DozoyM-L.js";import"./checkbox-C5cEV_DH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-ByFuwsko.js";import"./card-CWqz0DaV.js";import"./command-CFpCNmCF.js";import"./index-rP7Vi9h6.js";import"./sortable.esm-CzY2WOGE.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-B1-pvTAQ.js";import"./use-registry-connections-Clpq_83P.js";import"./extract-connection-data-DzgWcXVA.js";import"./generate-id-DOxNmKSl.js";import"./collections-CG_8shjq.js";import"./collection-tabs-CSSbV4je.js";import"./badge-Di1xo__6.js";import"./connection-form-helpers-oVYdKzFk.js";import"./use-infinite-scroll-Dz0Ju18S.js";import"./useSuspenseInfiniteQuery-PHI3OnKC.js";import"./index-B6yJwY9r.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-DCVHDrWy.js";import"./sidebar-DceLItg8.js";import"./toolbar-CXAxzeUh.js";import"./use-create-virtual-mcp-Dz02gDB8.js";import"./github-repo-picker-BJ45Iuw_.js";import"./use-mcp-tools-xqS_ta53.js";import"./alert-dialog-CbYM4jmz.js";import"./index-CghQMTVW.js";import"./use-org-auth-client-BwDW-s0s.js";import"./hover-card-C0gmU-KR.js";import"./task-status-F5X71Or6.js";import"./use-status-sounds-BQhIBN31.js";import"./empty-state-CEcNMd77.js";import"./resizable-B8hoAXbl.js";import"./use-capability-Dp-xHWqY.js";import"./header-tab-button-BDD5kZQa.js";import"./index-D-Er7K2V.js";import"./user-DjbLcTMi.js";import"./tools-list-B226mv7W.js";import"./use-debounced-autosave-7E-JkkEV.js";import"./index-Vm79zSBa.js";import"./search-input-BXsljctW.js";import"./use-secrets-CjbHuNwC.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-DKdXwYYc.js";import"./view-mode-toggle-DnMmKH1O.js";import"./select-model-DV1J8lbW.js";import"./use-automations-CqVVjbv4.js";import"./monaco-editor-CO97GxVj.js";import"./automation-runs-ByMFrYpg.js";import"./table-3evUHy3g.js";import"./use-members-DH5dae5S.js";import"./automation-list-row-DaUVjzEO.js";function Si(u){const t=it.c(46),{open:N,onOpenChange:P,orgSlug:Q,virtualMcpId:U,branch:W,decofile:G,meta:s,target:m,onSaved:X}=u,o=lt(G,m,s),k=m.kind==="site"?"site":m.pageKey,[Y,Z]=E.useState(k),[tt,i]=E.useState(null),[J,g]=E.useState(void 0),[x,y]=E.useState(0);Y!==k&&(Z(k),i(null),g(void 0),y(wt));const{persistSeo:a,persistRawSeo:I,flush:K,isPending:D}=ct({orgSlug:Q,virtualMcpId:U,branch:W,target:m,resolved:o,onSaved:X}),w=m.kind==="page",ot=w?o?.rawSeoData:void 0,v=J!==void 0?J:ot,et=w?dt(v)??void 0:void 0,h=tt??et??o?.seoData??{},p=o?St(h,o):null,n=p&&(!w||ft(v))?xt(p,s):null,_=m.kind==="page"?ut(G,s)?.seoData??void 0:void 0;let j;t[0]!==s?(j=vt(s),t[0]=s,t[1]=j):j=t[1];const M=j;let R;t[2]!==a||t[3]!==o||t[4]!==i?(R=r=>{if(!o)return;const L=r;i(L),a(L)},t[2]=a,t[3]=o,t[4]=i,t[5]=R):R=t[5];const V=R;let F;t[6]!==K||t[7]!==P?(F=r=>{r||K(),P(r)},t[6]=K,t[7]=P,t[8]=F):F=t[8];const z=F,A=m.kind==="site"?"Site SEO":"Page SEO",T=w&&o,B=m.kind==="site"&&o&&n,H=m.kind==="site"?"No site-level SEO block found.":o?"SEO schema not found for this page.":"Could not load page SEO.";let C;t[9]!==i?(C=()=>i(null),t[9]=i,t[10]=C):C=t[10];const $=C;let O;t[11]!==y?(O=()=>y(yt),t[11]=y,t[12]=O):O=t[12];const q=O;let l;t[13]!==A?(l=e.jsx(mt,{className:"text-sm font-semibold",children:A}),t[13]=A,t[14]=l):l=t[14];let c;t[15]!==D?(c=D&&e.jsx(rt,{size:14,className:"animate-spin text-muted-foreground"}),t[15]=D,t[16]=c):c=t[16];let d;t[17]!==l||t[18]!==c?(d=e.jsxs(pt,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[l,c]}),t[17]=l,t[18]=c,t[19]=d):d=t[19];let S;t[20]!==p||t[21]!==q||t[22]!==$||t[23]!==M||t[24]!==v||t[25]!==h||t[26]!==H||t[27]!==x||t[28]!==V||t[29]!==I||t[30]!==a||t[31]!==o||t[32]!==n||t[33]!==i||t[34]!==g||t[35]!==T||t[36]!==B||t[37]!==_?(S=!o||!T&&!B?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:H}):e.jsx(nt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:e.jsx("div",{className:"px-6 py-4",children:e.jsx("div",{className:"mx-auto max-w-sm",children:T?e.jsx(ht,{rawSeo:v,innerSeo:h,defaultResolveType:M,seoSchema:n,activeResolveType:p,seoTypeOptions:o.seoTypeOptions,formResetKey:x,siteDefaultSeo:_,onPersistRaw:r=>{g(r),I(r)},onInnerChange:r=>{i(r),a(r)},onClearForm:$,onBumpFormKey:q}):n&&p&&e.jsx(gt,{schema:n,resolveType:p,value:h,formResetKey:x,onChange:V})})})}),t[20]=p,t[21]=q,t[22]=$,t[23]=M,t[24]=v,t[25]=h,t[26]=H,t[27]=x,t[28]=V,t[29]=I,t[30]=a,t[31]=o,t[32]=n,t[33]=i,t[34]=g,t[35]=T,t[36]=B,t[37]=_,t[38]=S):S=t[38];let f;t[39]!==d||t[40]!==S?(f=e.jsxs(st,{side:"right",className:"w-[400px] sm:max-w-[440px] p-0 gap-0",children:[d,S]}),t[39]=d,t[40]=S,t[41]=f):f=t[41];let b;return t[42]!==z||t[43]!==N||t[44]!==f?(b=e.jsx(at,{open:N,onOpenChange:z,children:f}),t[42]=z,t[43]=N,t[44]=f,t[45]=b):b=t[45],b}function yt(u){return u+1}function wt(u){return u+1}export{Si as SeoSheet};
@@ -1,46 +0,0 @@
1
- import{e as $,r as W,T as at,I as Wt,H as Ut,j as n,B as Se,W as Ke,c as V,t as qt,q as be,G as Vt,a as Gt,K as pe,o as Ee,n as De,f as je,E as Jt,C as Kt,bB as Be}from"./index-CpG2_v8p.js";import{$ as Xt,G as Qt,B as Yt,ac as Zt,O as es,N as ts,M as ss,a8 as rt,ad as ns,ae as ls,A as it,af as ie,ag as os,ah as as,ai as rs,b as is}from"./agent-icon-C_8D2J-7.js";import{t as He}from"./Stars01-DWbsIFJF.js";import{a as ct,t as cs,b as Te,d as us}from"./XCircle-DkwGk6Y1.js";import{i as We}from"./Check-DZ5PZYLO.js";import{i as Xe}from"./ChevronRight-Bm_e-tIB.js";import{a as ut,s as ds}from"./Eye-MkeUTfT3.js";import{a as de,c as Qe,t as fs,u as ms}from"./use-clock-tick-Dkz_tj-X.js";import{N as dt,R as ft,e as mt,C as ps,f as xs,g as gs,u as hs,i as bs,d as ys}from"./scroll-area-CFrtCBLi.js";import{u as pt}from"./use-copy-CP7WU0J2.js";import{T as xe,a as ge,b as he}from"./tooltip-D5r7nYKO.js";import{M as xt,I as gt,F as js}from"./file-type-icon-9WcINLx3.js";import{c as vs}from"./content-blocks-o63cs2vh.js";import{g as ht,M as Ns}from"./types-DIAQ40QE.js";import{g as _e,i as Ss,d as Ue,a as ks}from"./chat-context-BoAn6xWM.js";import{l as _s,f as ws,m as Ts,n as Cs}from"./tab-id-Cgg9_UqF.js";import{u as $s}from"./studio-tools-Cly5ZCG3.js";import{c as Is,u as bt,b as Ms}from"./use-mcp-client-BDuQ-DKr.js";import{i as yt}from"./AlertCircle-CIkJ_tva.js";import{s as $e,t as jt}from"./Star01-4yFjK6bh.js";import{s as Ls}from"./XClose-D72Lt3NI.js";import{n as vt}from"./ZapSquare-BqiIusHB.js";import{n as Nt,i as Rs}from"./Globe01-xZhhj276.js";import{b as As,i as zs,a as Re}from"./Tool01-BxT6lP7E.js";import{a as Ye,i as Es}from"./ZoomOut-zDFXRspK.js";import{i as Ne}from"./Monitor01-CsSfQSQt.js";import{i as Ps}from"./SearchMd-BVJBwCEd.js";import{i as Fs}from"./Upload01-nIFiyRcG.js";import{u as Os,c as Ds}from"./shell-layout-NuYzN-Gn.js";import{n as St}from"./LinkExternal01-Bi6In-BW.js";import{I as Ie}from"./integration-icon-Jhe4mXPc.js";import{u as Bs}from"./use-virtual-mcp-BOy7A3-I.js";import{a as kt}from"./Users03-DT_R5tz6.js";import{a as ce}from"./Palette-CmO3ZuPu.js";import{k as _t}from"./use-navigate-to-agent-CLdhXO-i.js";import{a as Hs}from"./use-connection-CbBvGv-y.js";import{s as Ws}from"./Stars02-BLn35DBB.js";import{g as Us}from"./use-mcp-prompts-BfczuqQ1.js";import{c as qs,b as Vs,d as Gs,a as Js,D as Ks}from"./dialog-DzWL-NrT.js";import{a as Xs,F as Qs,b as Ys,c as Zs,d as en,f as tn}from"./form-DK41bruw.js";import{I as sn}from"./input-BWjbzzQM.js";import{S as nn}from"./spinner-B8QiOf4h.js";import{t as ln}from"./ChevronDown-CGeYjJAK.js";const on={openrouter:s=>{const e=s?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function wt(s){if(!s?.providerMetadata)return 0;for(const e of Object.values(on)){const t=e(s.providerMetadata);if(t!==null)return t}return 0}function Tt(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Ct(s,e){if(!e)return s;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,l=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:s.inputTokens+(e.inputTokens??0),outputTokens:s.outputTokens+(e.outputTokens??0),reasoningTokens:s.reasoningTokens+(e.reasoningTokens??0),totalTokens:s.totalTokens+(e.totalTokens??0),cost:s.cost+wt(e),cacheReadTokens:s.cacheReadTokens+t,cacheWriteTokens:s.cacheWriteTokens+l}}function ba(s){return s.reduce((e,t)=>Ct(e,t.metadata?.usage),Tt())}function an(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function qe(s){if(s&&typeof s=="object"&&"gatewayClientId"in s&&typeof s.gatewayClientId=="string")return s.gatewayClientId}function Ve(s,e){if(!e)return s;const t=`${an(e)}_`;return s.startsWith(t)?s.slice(t.length):s}function rn(s,e){return Ve(s,e).replace(/[_-]/g," ").toLowerCase()}function cn(s){const e={};for(const t of s.arguments??[])e[t.name]=t.required?Ke().min(1,"Required"):Ke();return at(e)}function un(s,e){const t={};for(const l of s.arguments??[])t[l.name]=e?.[l.name]??"";return t}function dn(s){const e=$.c(66),{prompt:t,setPrompt:l,onSubmit:r,defaultValues:a}=s,o=W.useId();let c;if(e[0]!==t){const A=t?cn(t):at({});c=Wt(A),e[0]=t,e[1]=c}else c=e[1];const i=c;let m;e[2]!==a||e[3]!==t?(m=t?un(t,a):{},e[2]=a,e[3]=t,e[4]=m):m=e[4];let p;e[5]!==i||e[6]!==m?(p={resolver:i,defaultValues:m,mode:"onChange"},e[5]=i,e[6]=m,e[7]=p):p=e[7];const u=Ut(p);let d;e[8]!==t?.arguments?(d=t?.arguments??[],e[8]=t?.arguments,e[9]=d):d=e[9];const x=d;let g;e[10]!==u||e[11]!==r||e[12]!==l?(g=async A=>{await r(A),l(null),u.reset()},e[10]=u,e[11]=r,e[12]=l,e[13]=g):g=e[13];const b=g;let h;e[14]!==u||e[15]!==l?(h=A=>{A||(u.reset(),l(null))},e[14]=u,e[15]=l,e[16]=h):h=e[16];const S=h;if(!t)return null;let y;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(y=t.title||rn(t.name,qe(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=y):y=e[20];let v;e[21]!==y?(v=n.jsx(qs,{children:n.jsx("span",{className:"capitalize",children:y})}),e[21]=y,e[22]=v):v=e[22];let j;e[23]!==t.description?(j=t.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=j):j=e[24];let N;e[25]!==j||e[26]!==v?(N=n.jsxs(Vs,{children:[v,j]}),e[25]=j,e[26]=v,e[27]=N):N=e[27];let k;e[28]!==u||e[29]!==b?(k=A=>{A.stopPropagation(),u.handleSubmit(b)(A)},e[28]=u,e[29]=b,e[30]=k):k=e[30];let _;if(e[31]!==x||e[32]!==u.control||e[33]!==u.formState.isSubmitting){let A;e[35]!==u.control||e[36]!==u.formState.isSubmitting?(A=z=>n.jsx(Qs,{control:u.control,name:z.name,render:O=>{const{field:H}=O;return n.jsxs(Ys,{children:[n.jsxs(Zs,{className:"text-xs",children:[z.name,z.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(en,{children:n.jsx(sn,{...H,value:H.value??"",required:z.required,placeholder:z.description??"",className:"h-9",disabled:u.formState.isSubmitting})}),n.jsx(tn,{})]})}},z.name),e[35]=u.control,e[36]=u.formState.isSubmitting,e[37]=A):A=e[37],_=x.map(A),e[31]=x,e[32]=u.control,e[33]=u.formState.isSubmitting,e[34]=_}else _=e[34];let w;e[38]!==S?(w=()=>S(!1),e[38]=S,e[39]=w):w=e[39];let T;e[40]!==u.formState.isSubmitting||e[41]!==w?(T=n.jsx(Se,{type:"button",variant:"ghost",onClick:w,disabled:u.formState.isSubmitting,children:"Cancel"}),e[40]=u.formState.isSubmitting,e[41]=w,e[42]=T):T=e[42];let I;e[43]!==u.formState.isSubmitting?(I=u.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(nn,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=u.formState.isSubmitting,e[44]=I):I=e[44];let M;e[45]!==u.formState.isSubmitting||e[46]!==o||e[47]!==I?(M=n.jsx(Se,{type:"submit",form:o,disabled:u.formState.isSubmitting,children:I}),e[45]=u.formState.isSubmitting,e[46]=o,e[47]=I,e[48]=M):M=e[48];let C;e[49]!==T||e[50]!==M?(C=n.jsxs(Gs,{children:[T,M]}),e[49]=T,e[50]=M,e[51]=C):C=e[51];let L;e[52]!==o||e[53]!==k||e[54]!==_||e[55]!==C?(L=n.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:k,children:[_,C]}),e[52]=o,e[53]=k,e[54]=_,e[55]=C,e[56]=L):L=e[56];let R;e[57]!==u||e[58]!==L?(R=n.jsx(Xs,{...u,children:L}),e[57]=u,e[58]=L,e[59]=R):R=e[59];let F;e[60]!==N||e[61]!==R?(F=n.jsxs(Js,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[N,R]}),e[60]=N,e[61]=R,e[62]=F):F=e[62];let E;return e[63]!==S||e[64]!==F?(E=n.jsx(Ks,{open:!0,onOpenChange:S,children:F}),e[63]=S,e[64]=F,e[65]=E):E=e[65],E}function $t(s){return s?s.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function re(s,e){return s==="output-error"||s==="output-denied"?"error":s==="approval-requested"?"approval":s==="input-streaming"||s==="input-available"||s==="output-available"&&e===!0?"loading":"idle"}function ve(s){if(s==null||typeof s!="object")return;const e=s;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return s}function fn(s){return s.storage.mention}function ya(s,e,t){s.chain().focus().insertContentAt(e,[It(t),{type:"text",text:" "}]).run()}function It(s){return{type:"mention",attrs:s}}function mn(s){const e=$.c(19),{node:t,selected:l,view:r,editor:a,getPos:o}=s,{name:c,char:f,kind:i,id:m,args:p}=t.attrs,u=l&&r.editable,d=f==="@",x=r.editable&&f==="/"&&i!=="resource";let g;e[0]!==p||e[1]!==a||e[2]!==o||e[3]!==m||e[4]!==x||e[5]!==c?(g=_=>{if(!x)return;const T=fn(a)?.onEditChip;if(!T||typeof o!="function")return;const I=o();typeof I=="number"&&(_.preventDefault(),_.stopPropagation(),T({promptId:m,promptName:c,args:p??{},pos:I}))},e[0]=p,e[1]=a,e[2]=o,e[3]=m,e[4]=x,e[5]=c,e[6]=g):g=e[6];const b=g,h=x?"cursor-pointer":"cursor-default",S=d?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",y=u&&"outline-2 outline-blue-300 outline-offset-0",v=x&&"hover:brightness-95";let j;e[7]!==h||e[8]!==S||e[9]!==y||e[10]!==v?(j=V("px-1 py-1 rounded","inline-flex items-center gap-1",h,"select-none","text-xs font-light",S,y,v,"capitalize"),e[7]=h,e[8]=S,e[9]=y,e[10]=v,e[11]=j):j=e[11];let N;e[12]!==c?(N=c?$t(c):"",e[12]=c,e[13]=N):N=e[13];let k;return e[14]!==f||e[15]!==b||e[16]!==j||e[17]!==N?(k=n.jsxs(mt,{onClick:b,className:j,children:[f,N]}),e[14]=f,e[15]=b,e[16]=j,e[17]=N,e[18]=k):k=e[18],k}const pn=dt.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},char:{default:"/",parseHTML:s=>s.getAttribute("data-char")||"/",renderHTML:s=>s.char?{"data-char":s.char}:{}},metadata:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:s=>s.metadata?{"data-metadata":JSON.stringify(s.metadata)}:{}},kind:{default:null,parseHTML:s=>s.getAttribute("data-kind")||null,renderHTML:s=>s.kind?{"data-kind":s.kind}:{}},args:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-args")||"null")}catch{return null}},renderHTML:s=>s.args?{"data-args":JSON.stringify(s.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"mention"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.char&&(t["data-char"]=s.attrs.char),s.attrs.metadata&&(t["data-metadata"]=JSON.stringify(s.attrs.metadata)),s.attrs.kind&&(t["data-kind"]=s.attrs.kind),s.attrs.args&&(t["data-args"]=JSON.stringify(s.attrs.args)),["span",{...e,...t}]},renderText({node:s}){const e=s.attrs.char??"@",t=s.attrs.name??"";return`${e}${t}`},addNodeView(){return ft(mn)}}),xn=/^mcp__[a-zA-Z0-9_-]+__/;function Mt(s){return s.replace(xn,"")}function Ge(s){const e=$.c(18),{id:t,part:l,copyable:r,extraActions:a,alwaysShowActions:o,animate:c}=s,f=r===void 0?!1:r,i=o===void 0?!1:o,m=c===void 0?!1:c,{handleCopy:p}=pt(),[u,d]=W.useState(!1);let x;e[0]!==p||e[1]!==t||e[2]!==l.text?(x=async()=>{qt("chat_message_copied",{message_id:t,chars:l.text.length}),await p(l.text),d(!0),setTimeout(()=>d(!1),2e3)},e[0]=p,e[1]=t,e[2]=l.text,e[3]=x):x=e[3];const g=x,b=f&&a,h=b||a;let S;e[4]!==m||e[5]!==t||e[6]!==l.text?(S=n.jsx(xt,{id:t,text:l.text,animate:m}),e[4]=m,e[5]=t,e[6]=l.text,e[7]=S):S=e[7];let y;e[8]!==i||e[9]!==a||e[10]!==g||e[11]!==u||e[12]!==h||e[13]!==b?(y=h&&n.jsxs("div",{className:V("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",i?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[a,b&&a&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),b&&n.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":"Copy message",children:u?n.jsx(We,{className:"size-4"}):n.jsx(ut,{className:"size-4"})})]}),e[8]=i,e[9]=a,e[10]=g,e[11]=u,e[12]=h,e[13]=b,e[14]=y):y=e[14];let v;return e[15]!==S||e[16]!==y?(v=n.jsxs("div",{className:"group/part relative",children:[S,y]}),e[15]=S,e[16]=y,e[17]=v):v=e[17],v}function ja(s,e,t){s.chain().focus().insertContentAt(e,[gn(t),{type:"text",text:" "}]).run()}function gn(s){return{type:"file",attrs:s}}function hn(s){const e=$.c(17),{node:t,selected:l,view:r}=s,{name:a,mimeType:o,data:c}=t.attrs,f=l&&r.editable;let i;e[0]!==o?(i=o.startsWith("image/"),e[0]=o,e[1]=i):i=e[1];const m=i,p=f&&"outline-2 outline-blue-300 outline-offset-0";let u;e[2]!==p?(u=V("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",p),e[2]=p,e[3]=u):u=e[3];let d;e[4]!==a?(d=n.jsx(xe,{asChild:!0,children:n.jsx("span",{children:a})}),e[4]=a,e[5]=d):d=e[5];let x;e[6]!==c||e[7]!==m||e[8]!==o||e[9]!==a?(x=n.jsx(ge,{side:"top",className:"max-w-sm p-1.5",children:m?n.jsx("img",{src:`data:${o};base64,${c}`,alt:a,className:"max-w-full max-h-64 object-contain rounded"}):n.jsxs("div",{className:"text-xs",children:[n.jsx("div",{className:"font-medium",children:a}),n.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=c,e[7]=m,e[8]=o,e[9]=a,e[10]=x):x=e[10];let g;e[11]!==d||e[12]!==x?(g=n.jsxs(he,{children:[d,x]}),e[11]=d,e[12]=x,e[13]=g):g=e[13];let b;return e[14]!==u||e[15]!==g?(b=n.jsx(mt,{className:u,children:g}),e[14]=u,e[15]=g,e[16]=b):b=e[16],b}const bn=dt.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},mimeType:{default:null,parseHTML:s=>s.getAttribute("data-mime-type")||null,renderHTML:s=>s.mimeType?{"data-mime-type":s.mimeType}:{}},size:{default:0,parseHTML:s=>{const e=s.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:s=>s.size?{"data-size":String(s.size)}:{}},data:{default:null,parseHTML:s=>s.getAttribute("data-data")||null,renderHTML:s=>s.data?{"data-data":s.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"file"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.mimeType&&(t["data-mime-type"]=s.attrs.mimeType),s.attrs.size&&(t["data-size"]=String(s.attrs.size)),s.attrs.data&&(t["data-data"]=s.attrs.data),["span",{...e,...t}]},renderText({node:s}){return`[${s.attrs.name??""}]`},addNodeView(){return ft(hn)}}),fe=16,Pe=2.5,Fe=(fe-Pe)/2,Ae=2*Math.PI*Fe;function yn(s){const e=$.c(31),{usage:t}=s;if(!t)return null;const{totalTokens:l,inputTokens:r,outputTokens:a,cost:o}=t;if(!l&&!r&&!a)return null;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Xt,{size:12}),e[0]=c):c=e[0];let f;e[1]!==o||e[2]!==l?(f=o>0?`$${o.toFixed(4)}`:l.toLocaleString(),e[1]=o,e[2]=l,e[3]=f):f=e[3];let i;e[4]!==f?(i=n.jsx(xe,{asChild:!0,children:n.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[c,n.jsx("span",{className:"text-sm font-mono tabular-nums",children:f})]})}),e[4]=f,e[5]=i):i=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{className:"text-muted",children:"in"}),e[7]=p):p=e[7];let u;e[8]!==r?(u=r.toLocaleString(),e[8]=r,e[9]=u):u=e[9];let d;e[10]!==u?(d=n.jsx("span",{className:"text-right tabular-nums",children:u}),e[10]=u,e[11]=d):d=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("span",{className:"text-muted",children:"out"}),e[12]=x):x=e[12];const g=a-(t.reasoningTokens??0);let b;e[13]!==g?(b=g.toLocaleString(),e[13]=g,e[14]=b):b=e[14];let h;e[15]!==b?(h=n.jsx("span",{className:"text-right tabular-nums",children:b}),e[15]=b,e[16]=h):h=e[16];let S;e[17]!==r||e[18]!==t.cacheReadTokens||e[19]!==t.cacheWriteTokens?(S=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:r>0?`${(t.cacheReadTokens/r*100).toFixed(0)}%`:"0%"})]}),e[17]=r,e[18]=t.cacheReadTokens,e[19]=t.cacheWriteTokens,e[20]=S):S=e[20];let y;e[21]!==o?(y=o>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",o.toFixed(4)]})]}),e[21]=o,e[22]=y):y=e[22];let v;e[23]!==h||e[24]!==S||e[25]!==y||e[26]!==d?(v=n.jsxs(ge,{side:"top",className:"font-mono text-[11px]",children:[m,n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[p,d,x,h,S,y]})]}),e[23]=h,e[24]=S,e[25]=y,e[26]=d,e[27]=v):v=e[27];let j;return e[28]!==v||e[29]!==i?(j=n.jsxs(he,{children:[i,v]}),e[28]=v,e[29]=i,e[30]=j):j=e[30],j}function jn(s){const e=$.c(19),{usage:t,duration:l}=s,r=l!=null&&l>0,a=t!=null&&(t.cost??0)>0,o=t!=null&&(t.totalTokens??0)>0;if(!r&&!a&&!o)return null;let c;e[0]!==l||e[1]!==r?(c=r?de(l/1e3):null,e[0]=l,e[1]=r,e[2]=c):c=e[2];const f=c;let i;e[3]!==l||e[4]!==f||e[5]!==t?(i=f&&n.jsxs(he,{children:[n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:f})}),n.jsxs(ge,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),n.jsx("span",{className:"tabular-nums",children:de(l/1e3)}),(t?.reasoningTokens??0)>0&&n.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=l,e[4]=f,e[5]=t,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==r||e[9]!==o?(m=r&&(a||o)&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=a,e[8]=r,e[9]=o,e[10]=m):m=e[10];let p;e[11]!==a||e[12]!==o||e[13]!==t?(p=(a||o)&&n.jsxs(he,{children:[n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:a?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),n.jsxs(ge,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[n.jsx("span",{className:"opacity-60",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),n.jsx("span",{className:"opacity-60",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"think"}),n.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:(t?.inputTokens??0)>0?`${((t?.cacheReadTokens??0)/t.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=a,e[12]=o,e[13]=t,e[14]=p):p=e[14];let u;return e[15]!==i||e[16]!==m||e[17]!==p?(u=n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[i,m,p]}),e[15]=i,e[16]=m,e[17]=p,e[18]=u):u=e[18],u}function va(s){const e=$.c(51),{usage:t,totalTokens:l,contextWindow:r,onOpenContextPanel:a}=s,o=Math.min(l/r*100,100),c=Ae-o/100*Ae,f=t?.cost??0,i=t?.inputTokens??0,m=t?.outputTokens??0;let p;e[0]!==o?(p=o.toFixed(0),e[0]=o,e[1]=p):p=e[1];let u;e[2]!==f?(u=f>0?`, $${f.toFixed(2)}`:"",e[2]=f,e[3]=u):u=e[3];const d=`Context usage: ${p}%${u}`,x=a?"cursor-pointer":"cursor-default";let g;e[4]!==x?(g=V("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",x),e[4]=x,e[5]=g):g=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("circle",{cx:fe/2,cy:fe/2,r:Fe,fill:"none",stroke:"currentColor",strokeWidth:Pe,className:"opacity-15"}),e[6]=b):b=e[6];const h=o>90?"text-destructive":o>70?"text-warning":"text-muted-foreground";let S;e[7]!==h?(S=V(h),e[7]=h,e[8]=S):S=e[8];let y;e[9]!==c||e[10]!==S?(y=n.jsxs("svg",{width:fe,height:fe,className:"-rotate-90",children:[b,n.jsx("circle",{cx:fe/2,cy:fe/2,r:Fe,fill:"none",stroke:"currentColor",strokeWidth:Pe,strokeDasharray:Ae,strokeDashoffset:c,strokeLinecap:"round",className:S})]}),e[9]=c,e[10]=S,e[11]=y):y=e[11];let v;e[12]!==o?(v=o.toFixed(0),e[12]=o,e[13]=v):v=e[13];let j;e[14]!==f?(j=f>0?` · $${f.toFixed(2)}`:"",e[14]=f,e[15]=j):j=e[15];let N;e[16]!==v||e[17]!==j?(N=n.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[v,"%",j]}),e[16]=v,e[17]=j,e[18]=N):N=e[18];let k;e[19]!==a||e[20]!==N||e[21]!==d||e[22]!==g||e[23]!==y?(k=n.jsx(xe,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:a,"aria-label":d,className:g,children:[y,N]})}),e[19]=a,e[20]=N,e[21]=d,e[22]=g,e[23]=y,e[24]=k):k=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("span",{className:"text-muted",children:"context"}),e[25]=_):_=e[25];let w;e[26]!==l?(w=l.toLocaleString(),e[26]=l,e[27]=w):w=e[27];let T;e[28]!==r?(T=r.toLocaleString(),e[28]=r,e[29]=T):T=e[29];let I;e[30]!==o?(I=o.toFixed(1),e[30]=o,e[31]=I):I=e[31];let M;e[32]!==w||e[33]!==T||e[34]!==I?(M=n.jsxs("span",{className:"text-right tabular-nums",children:[w," / ",T," (",I,"%)"]}),e[32]=w,e[33]=T,e[34]=I,e[35]=M):M=e[35];let C;e[36]!==f||e[37]!==i||e[38]!==m?(C=f>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",f.toFixed(4)]}),n.jsx("span",{className:"text-muted",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:i.toLocaleString()}),n.jsx("span",{className:"text-muted",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=f,e[37]=i,e[38]=m,e[39]=C):C=e[39];let L;e[40]!==i||e[41]!==t?.cacheReadTokens||e[42]!==t?.cacheWriteTokens?(L=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:i>0?`${((t?.cacheReadTokens??0)/i*100).toFixed(0)}%`:"0%"})]}),e[40]=i,e[41]=t?.cacheReadTokens,e[42]=t?.cacheWriteTokens,e[43]=L):L=e[43];let R;e[44]!==M||e[45]!==C||e[46]!==L?(R=n.jsx(ge,{side:"top",className:"font-mono text-[11px]",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[_,M,C,L]})}),e[44]=M,e[45]=C,e[46]=L,e[47]=R):R=e[47];let F;return e[48]!==k||e[49]!==R?(F=n.jsxs(he,{children:[k,R]}),e[48]=k,e[49]=R,e[50]=F):F=e[50],F}function vn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(gs,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=l):l=e[3],l}function Nn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(ps,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=l):l=e[3],l}function Sn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(xs,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=l):l=e[3],l}function Lt({containerRef:s,enabled:e,contentDeps:t=[],threshold:l,intervalMs:r=500}){const[a,o]=W.useState(null),[c,f]=W.useState(!1),i=l??(s?.95:.1),m=()=>{if(s?.current){s.current.scrollTop=s.current.scrollHeight;return}if(!a)return;let p=a.parentElement;for(;p;){const u=window.getComputedStyle(p);if(u.overflowY==="auto"||u.overflowY==="scroll"||u.overflow==="auto"||u.overflow==="scroll"){p.scrollTop=p.scrollHeight;return}p=p.parentElement}};return W.useEffect(()=>{if(!a)return;const p=new IntersectionObserver(u=>{const d=u[0]?.isIntersecting??!1;f(d)},{root:s?.current??null,threshold:i,rootMargin:"0px"});return p.observe(a),()=>p.disconnect()},[a,i]),W.useEffect(()=>{if(!e||!c)return;const p=setInterval(m,r);return()=>clearInterval(p)},[e,c,r]),W.useEffect(()=>{!e||!c||m()},[e,c,...t]),{sentinelRef:o,isTracking:c}}function B(s){const e=$.c(53),{icon:t,title:l,usage:r,summary:a,state:o,detail:c,detailVariant:f,forceOpen:i,variant:m,trailing:p,iconDestructive:u,alwaysChevron:d,defaultOpen:x,children:g}=s,b=f===void 0?"code":f,h=m===void 0?"default":m,[S,y]=W.useState(x??!1),{handleCopy:v,copied:j}=pt(),N=o==="loading",k=o==="error";let _;e[0]!==c?(_=c&&c.trim(),e[0]=c,e[1]=_):_=e[1];const T=!!_||!!g,I=h==="subtask",M=(i??!1)||S,C=W.useRef(null),L=N&&M;let R;e[2]!==c?(R=[c],e[2]=c,e[3]=R):R=e[3];let F;e[4]!==L||e[5]!==R?(F={containerRef:C,enabled:L,contentDeps:R},e[4]=L,e[5]=R,e[6]=F):F=e[6];const{sentinelRef:E}=Lt(F),A=i?void 0:y,z=!T,O=T&&"[@media(hover:hover)]:hover:bg-accent/30",H=!T&&"cursor-default",U=N&&"shimmer";let D;e[7]!==H||e[8]!==U||e[9]!==O?(D=V("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",O,H,U),e[7]=H,e[8]=U,e[9]=O,e[10]=D):D=e[10];const G=!T;let K;e[11]!==d||e[12]!==M||e[13]!==t||e[14]!==u||e[15]!==k||e[16]!==T?(K=n.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:d?n.jsx(Xe,{className:V("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:V("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",u?"[&>svg]:text-destructive/70":k?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",T&&(M?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),T&&n.jsx("div",{className:V("absolute inset-0 flex items-center justify-center transition-opacity duration-150",M?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:n.jsx(Xe,{className:V("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")})})]})}),e[11]=d,e[12]=M,e[13]=t,e[14]=u,e[15]=k,e[16]=T,e[17]=K):K=e[17];const Y=k?"text-warning/80":"text-foreground";let Q;e[18]!==Y?(Q=V("shrink-0 text-[14px] font-normal",Y),e[18]=Y,e[19]=Q):Q=e[19];let Z;e[20]!==Q||e[21]!==l?(Z=n.jsx("span",{className:Q,children:l}),e[20]=Q,e[21]=l,e[22]=Z):Z=e[22];let P;e[23]!==a?(P=a?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:a})}):n.jsx("div",{className:"flex-1"}),e[23]=a,e[24]=P):P=e[24];let q;e[25]!==p?(q=p&&n.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:p}),e[25]=p,e[26]=q):q=e[26];let J;e[27]!==r?(J=n.jsx(yn,{usage:r}),e[27]=r,e[28]=J):J=e[28];let X;e[29]!==D||e[30]!==G||e[31]!==K||e[32]!==Z||e[33]!==P||e[34]!==q||e[35]!==J||e[36]!==z?(X=n.jsxs(Nn,{disabled:z,className:D,"aria-disabled":G,children:[K,Z,P,q,J]}),e[29]=D,e[30]=G,e[31]=K,e[32]=Z,e[33]=P,e[34]=q,e[35]=J,e[36]=z,e[37]=X):X=e[37];let ee;e[38]!==g||e[39]!==j||e[40]!==c||e[41]!==b||e[42]!==v||e[43]!==T||e[44]!==E?(ee=T&&n.jsx(Sn,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:g||(b==="prose"?n.jsx("div",{className:"mt-1 mb-1",children:n.jsxs("div",{ref:C,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:c}),n.jsx("div",{ref:E,className:"h-0 shrink-0"})]})}):n.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:n.jsxs("div",{ref:C,className:"flex flex-col max-h-48 overflow-y-auto",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c})}),n.jsx("button",{type:"button",onClick:()=>v(c),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":"Copy",children:j?n.jsx(We,{className:"size-3.5"}):n.jsx(ut,{className:"size-3.5"})})]}),n.jsx("div",{ref:E,className:"h-0 shrink-0"})]})}))}),e[38]=g,e[39]=j,e[40]=c,e[41]=b,e[42]=v,e[43]=T,e[44]=E,e[45]=ee):ee=e[45];let ue;e[46]!==M||e[47]!==X||e[48]!==ee||e[49]!==A?(ue=n.jsxs(vn,{open:M,onOpenChange:A,className:"min-w-0",children:[X,ee]}),e[46]=M,e[47]=X,e[48]=ee,e[49]=A,e[50]=ue):ue=e[50];const le=ue;if(I){let oe;return e[51]!==le?(oe=n.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:le}),e[51]=le,e[52]=oe):oe=e[52],oe}return le}function te(s){const e=$.c(4),{latency:t}=s;if(t==null||t<=0)return null;let l;e[0]!==t?(l=de(t),e[0]=t,e[1]=l):l=e[1];let r;return e[2]!==l?(r=n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:l}),e[2]=l,e[3]=r):r=e[3],r}const Rt=4;function At(s){const e=$.c(5),{count:t,noun:l,onClick:r}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(ct,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[0]=a):a=e[0];let o;return e[1]!==t||e[2]!==l||e[3]!==r?(o=n.jsxs("button",{type:"button",onClick:r,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:["See all ",t," ",l,a]}),e[1]=t,e[2]=l,e[3]=r,e[4]=o):o=e[4],o}function kn(s){const e=$.c(24),{org:t}=be(),l=Vt(),r=_s(),a=$s();let o;e[0]!==a||e[1]!==s?(o=async g=>{if(!s)throw new Error("useTaskExpandedTools: no task in context");const h=(await a.call("COLLECTION_THREADS_GET",{id:s})).item?.metadata??{},y=(h.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h,expanded_tools:y};return await a.call("COLLECTION_THREADS_UPDATE",{id:s,data:{metadata:v}}),y},e[0]=a,e[1]=s,e[2]=o):o=e[2];let c,f,i;e[3]!==t||e[4]!==l||e[5]!==s?(c=async g=>{const b=pe.ensureTask(t.id,s??"");await l.cancelQueries({queryKey:b});const h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(v=>v.toolName!==g.toolName);return y.push({...g,expandedAt:new Date().toISOString()}),l.setQueryData(b,v=>v&&{...v,metadata:{...v.metadata??{},expanded_tools:y}}),{previous:h}},f=()=>{l.invalidateQueries({queryKey:pe.ensureTask(t.id,s??"")})},i=(g,b,h)=>{const S=pe.ensureTask(t.id,s??"");h?.previous===void 0?l.removeQueries({queryKey:S,exact:!0}):l.setQueryData(S,h.previous),Ee.error(g instanceof Error?g.message:"Failed to expand tool")},e[3]=t,e[4]=l,e[5]=s,e[6]=c,e[7]=f,e[8]=i):(c=e[6],f=e[7],i=e[8]);let m;e[9]!==o||e[10]!==c||e[11]!==f||e[12]!==i?(m={mutationFn:o,onMutate:c,onSuccess:f,onError:i},e[9]=o,e[10]=c,e[11]=f,e[12]=i,e[13]=m):m=e[13];const p=Gt(m);let u;e[14]!==r||e[15]!==p||e[16]!==t||e[17]!==l||e[18]!==s?(u=g=>{if(!s||!r)return;const b=pe.ensureTask(t.id,s),h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h?.metadata??{},expanded_tools:y};l.setQueryData(b,j=>j&&{...j,metadata:v}),r.patchThread({id:s,metadata:v}),p.mutate(g)},e[14]=r,e[15]=p,e[16]=t,e[17]=l,e[18]=s,e[19]=u):u=e[19];const d=u;let x;return e[20]!==d||e[21]!==p.isPending||e[22]!==p.mutate?(x={addOrReplace:p.mutate,addOrReplaceEager:d,isPending:p.isPending},e[20]=d,e[21]=p.isPending,e[22]=p.mutate,e[23]=x):x=e[23],x}function _n(s,e,t,l){const{data:r,isLoading:a}=De({queryKey:pe.toolDefinitionLookup(e,t,s),queryFn:async()=>{if(!s||!e)return null;const o=await Is({connectionId:e,orgId:t,orgSlug:l});try{const{tools:c}=await o.listTools(),f=Mt(s);return c.find(i=>i.name===f)??null}finally{await o.close().catch(()=>{})}},enabled:!!s&&!!e,staleTime:6e4,gcTime:3e5,retry:!1});return{toolDef:r??void 0,isLoading:a}}const wn={read:{icon:Ye,label:"Read File"},write:{icon:zs,label:"Write File"},edit:{icon:ss,label:"Edit File"},grep:{icon:Ps,label:"Search Content"},glob:{icon:Es,label:"Find Files"},bash:{icon:ts,label:"Run Command"},read_tool_output:{icon:Ye,label:"Read Tool Output"},read_resource:{icon:es,label:"Read Resource"},read_prompt:{icon:vt,label:"Read Prompt"},enable_tool:{icon:As,label:"Enable Tool"},open_in_agent:{icon:Zt,label:"Open in Agent"},sandbox:{icon:Yt,label:"Run Code"},copy_to_sandbox:{icon:Nt,label:"Load File"},share_with_user:{icon:Fs,label:"Share with User"},take_screenshot:{icon:Ne,label:"Take Screenshot"},scrape_url:{icon:$e,label:"Scrape URL"},inspect_page:{icon:Qt,label:"Inspect Page"}};function Me(s,e="An unknown error occurred"){return"errorText"in s&&typeof s.errorText=="string"?s.errorText:e}function me(s){if(s==null)return"";try{return JSON.stringify(s)}catch{return"[Non-serializable value]"}}function Ze(s){const e=me(s);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const Tn=s=>s.type==="dynamic-tool"||s.type.startsWith("tool-");function Cn(s){if(!s||typeof s!="object")return null;const e=s;if(!Array.isArray(e.parts))return null;const t=[];for(const l of e.parts)if(l.type==="text"&&typeof l.text=="string")t.push(l.text);else if(l.type==="reasoning")t.push(`## Reasoning
2
- ${l.text}`);else if(l.type==="source-url")t.push(`## Source URL
3
- ${l.url}`);else if(l.type==="source-document")t.push(`## Source Document
4
- ${l.title}`);else if(l.type==="file")t.push(`## File
5
- ${l.filename??l.url}`);else if(l.type!=="step-start"){if(Tn(l)){const r=l.type.startsWith("tool-")?l.type.slice(5):l.toolName;if(l.state==="input-streaming")t.push(`## ${r}
6
- Input streaming...`);else if(l.state==="input-available"){const a=me(l.input).slice(0,20);t.push(`## ${r}
7
- ### Input
8
- ${a||"[No input]"}...`)}else if(l.state==="approval-requested")t.push(`## ${r}
9
- Approval requested...`);else if(l.state==="approval-responded")t.push(`## ${r}
10
- Approval responded...`);else if(l.state==="output-available"){const a=me(l.input).slice(0,40),o=me(l.output).slice(0,40);t.push(l.output!=null?`## ${r}
11
- Input: ${a||"[No input]"}...
12
- Output: ${o||"[No output]"}...`:`## ${r}
13
- Input: ${a||"[No input]"}...
14
- Output: Tool responded with no output`)}else if(l.state==="output-error"){const a=me(l.input).slice(0,40);t.push(l.errorText?`## ${r}
15
- Input: ${a||"[No input]"}...
16
- Error: ${l.errorText}`:`## ${r}
17
- Input: ${a||"[No input]"}...
18
- Error: Tool responded with an error`)}else if(l.state==="output-denied"){const a=me(l.input).slice(0,40);t.push(`## ${r}
19
- Input: ${a||"[No input]"}...
20
- Output: Tool execution was denied`)}}}return t.length>0?t.join(`
21
-
22
- `):null}function et(s){const e=me(s);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ce(s){const e=$.c(7),{icon:t,label:l}=s;let r;e[0]!==t?(r=n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:"flex items-center",children:t})}),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==l?(a=n.jsx(ge,{side:"top",children:l}),e[2]=l,e[3]=a):a=e[3];let o;return e[4]!==r||e[5]!==a?(o=n.jsxs(he,{children:[r,a]}),e[4]=r,e[5]=a,e[6]=o):o=e[6],o}function $n(s){const e=$.c(15),{annotations:t,toolMeta:l}=s;let r;e[0]!==l?(r=ht(l),e[0]=l,e[1]=r):r=e[1];const a=!!r;if(!t&&!a)return null;let o;e[2]!==a?(o=a&&n.jsx(Ce,{icon:n.jsx(rt,{}),label:"Interactive"}),e[2]=a,e[3]=o):o=e[3];let c;e[4]!==t?.readOnlyHint?(c=t?.readOnlyHint&&n.jsx(Ce,{icon:n.jsx(ds,{}),label:"Read-only — no side effects"}),e[4]=t?.readOnlyHint,e[5]=c):c=e[5];let f;e[6]!==t?.destructiveHint?(f=t?.destructiveHint&&n.jsx(Ce,{icon:n.jsx(yt,{}),label:"May modify or delete data"}),e[6]=t?.destructiveHint,e[7]=f):f=e[7];let i;e[8]!==t?.openWorldHint?(i=t?.openWorldHint&&n.jsx(Ce,{icon:n.jsx($e,{}),label:"Reaches outside this system"}),e[8]=t?.openWorldHint,e[9]=i):i=e[9];let m;return e[10]!==o||e[11]!==c||e[12]!==f||e[13]!==i?(m=n.jsxs(n.Fragment,{children:[o,c,f,i]}),e[10]=o,e[11]=c,e[12]=f,e[13]=i,e[14]=m):m=e[14],m}function In(s){if(s<1024)return`${s} B`;if(s<1024*1024){const t=s/1024;return t<10?`${t.toFixed(1)} KB`:`${Math.round(t)} KB`}const e=s/(1024*1024);return e<10?`${e.toFixed(1)} MB`:`${Math.round(e)} MB`}function Mn(s){return s<1?`${Math.round(s*1e3)}ms`:s<10?`${s.toFixed(1)}s`:`${Math.round(s)}s`}function Ln(s){const e=$.c(13),{latency:t,outputBytes:l}=s,r=typeof t=="number"&&t>0,a=typeof l=="number"&&l>=0;if(!r&&!a)return null;let o;e[0]!==r||e[1]!==t?(o=r&&n.jsx("span",{children:Mn(t)}),e[0]=r,e[1]=t,e[2]=o):o=e[2];let c;e[3]!==a||e[4]!==r?(c=r&&a&&n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=a,e[4]=r,e[5]=c):c=e[5];let f;e[6]!==a||e[7]!==l?(f=a&&n.jsx("span",{children:In(l)}),e[6]=a,e[7]=l,e[8]=f):f=e[8];let i;return e[9]!==o||e[10]!==c||e[11]!==f?(i=n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[o,c,f]}),e[9]=o,e[10]=c,e[11]=f,e[12]=i):i=e[12],i}function Rn(s,e,t){switch(s){case"input-streaming":case"input-available":return"Preparing...";case"approval-requested":return"Waiting for your approval";case"output-denied":return"Cancelled";case"output-error":return t??"Failed";case"output-available":{if(e==null)return"Done";if(typeof e=="string"){const l=e.trim();return l.length>100?l.slice(0,100)+"…":l}if(typeof e=="object"){for(const l of Object.keys(e)){const r=e[l];if(typeof r=="string"&&r.trim()){const a=r.trim();return a.length>100?a.slice(0,100)+"…":a}}return""}return String(e).slice(0,100)}default:return""}}function tt(s){const e=$.c(67),{part:t,annotations:l,latency:r,outputBytes:a,isLastMessage:o,toolMeta:c}=s,f="toolName"in t&&typeof t.toolName=="string"?t.toolName:t.type==="dynamic-tool"?"Dynamic Tool":t.type.replace("tool-","")||"Tool",i=Mt(f),m=_e(),p=Ss(),{org:u}=be(),{setChatOpen:d}=Os(),x=Ue()?.taskId??null,{addOrReplaceEager:g}=kn(x),b=je(),h=c&&typeof c=="object"&&c!==null&&"connectionId"in c&&c.connectionId!=null&&c.connectionId!==""?String(c.connectionId):p?.selectedVirtualMcp?.id??null,{toolDef:S}=_n(h?f:null,h,u.id,u.slug),y=S?._meta??c,v=qe(y),j=Ve(i,v),N=wn[j],k=S?.title??N?.label??$t(j);let _;e[0]!==y?(_=ht(y),e[0]=y,e[1]=_):_=e[1];const w=_,T=!!w&&t.state==="output-available",I=h?`${h}:${f}`:null,M=!!l?.destructiveHint,C=T&&!!h&&!M&&!!x;let L;e[2]!==g||e[3]!==h||e[4]!==b||e[5]!==t||e[6]!==f?(L=()=>{if(!h)return;const se="input"in t&&t.input&&typeof t.input=="object"?t.input:{};g({toolName:f,appId:h,args:se}),b({to:".",search:ae=>({...ae,main:ws(h,f)}),replace:!0})},e[2]=g,e[3]=h,e[4]=b,e[5]=t,e[6]=f,e[7]=L):L=e[7];const R=L;let F;e[8]!==C||e[9]!==R?(F=se=>se==="fullscreen"&&C?(R(),"fullscreen"):"inline",e[8]=C,e[9]=R,e[10]=F):F=e[10];const E=F;let A;e[11]!==m||e[12]!==d?(A=se=>{const ae=vs(se.content);ae.content.length>0&&(d?.(!0),m?.sendMessage(ae))},e[11]=m,e[12]=d,e[13]=A):A=e[13];const z=A,O=t.state==="approval-requested"&&o===!1,H=t.state==="output-denied"||O,U=t.state==="output-available"&&typeof t.output=="object"&&t.output!=null&&"isError"in t.output&&t.output.isError===!0;let D;e[14]!==t.state?(D=re(t.state),e[14]=t.state,e[15]=D):D=e[15];const G=D,K=O||G==="approval"?"idle":U?"error":G;let Y,Q;e[16]!==U||e[17]!==O||e[18]!==t?(Y=t.state==="output-error"?Me(t):void 0,Q=O?"Cancelled":U?"Failed":Rn(t.state,t.output,Y),e[16]=U,e[17]=O,e[18]=t,e[19]=Y,e[20]=Q):(Y=e[19],Q=e[20]);const Z=Q;let P="";t.input!==void 0&&(P=`# Input
23
- `+et(t.input)),t.state==="output-error"?(P&&(P=P+`
24
-
25
- `),P=P+(`# Error
26
- `+(Y??""))):t.output!==void 0&&!T&&(P&&(P=P+`
27
-
28
- `),P=P+(`# Output
29
- `+et(t.output)));let q;e:{if(H){let ne;e[21]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx(Ls,{}),e[21]=ne):ne=e[21],q=ne;break e}if(T){let ne;e[22]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx(rt,{className:"size-4 text-muted-foreground"}),e[22]=ne):ne=e[22],q=ne;break e}const se=N?.icon;if(se){let ne;e[23]!==se?(ne=n.jsx(se,{className:"size-4 text-muted-foreground"}),e[23]=se,e[24]=ne):ne=e[24],q=ne;break e}let ae;e[25]===Symbol.for("react.memo_cache_sentinel")?(ae=n.jsx(ns,{className:"size-4 text-muted-foreground"}),e[25]=ae):ae=e[25],q=ae}let J;e[26]!==l||e[27]!==c?(J=n.jsx($n,{annotations:l,toolMeta:c}),e[26]=l,e[27]=c,e[28]=J):J=e[28];let X;e[29]!==r||e[30]!==a?(X=n.jsx(Ln,{latency:r,outputBytes:a}),e[29]=r,e[30]=a,e[31]=X):X=e[31];let ee;e[32]!==J||e[33]!==X?(ee=n.jsxs(n.Fragment,{children:[J,X]}),e[32]=J,e[33]=X,e[34]=ee):ee=e[34];const ue=P||null;let le;e[35]!==K||e[36]!==k||e[37]!==H||e[38]!==r||e[39]!==Z||e[40]!==ee||e[41]!==ue||e[42]!==q?(le=n.jsx(B,{icon:q,iconDestructive:H,trailing:ee,title:k,latency:r,summary:Z,state:K,detail:ue}),e[35]=K,e[36]=k,e[37]=H,e[38]=r,e[39]=Z,e[40]=ee,e[41]=ue,e[42]=q,e[43]=le):le=e[43];let oe;e[44]!==C||e[45]!==R?(oe=C&&n.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:n.jsxs("button",{type:"button",onClick:R,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground rounded-md [@media(hover:hover)]:hover:bg-accent/50 [@media(hover:hover)]:hover:text-foreground transition-colors",children:[n.jsx(ls,{className:"size-3.5"}),"Open in panel"]})}),e[44]=C,e[45]=R,e[46]=oe):oe=e[46];let ye;e[47]!==C||e[48]!==p||e[49]!==h||e[50]!==k||e[51]!==z||e[52]!==E||e[53]!==T||e[54]!==y||e[55]!==u.id||e[56]!==u.slug||e[57]!==t.input||e[58]!==t.output||e[59]!==I||e[60]!==j||e[61]!==w?(ye=T&&w&&h&&u?.id&&n.jsx(n.Fragment,{children:n.jsx(Jt,{fallback:se=>{const{resetError:ae}=se;return n.jsxs("div",{className:"mt-2 flex items-center gap-2 px-3 py-2.5 border border-dashed border-destructive/30 bg-destructive/5 rounded-lg",children:[n.jsx(yt,{size:16,className:"shrink-0 text-destructive"}),n.jsxs("span",{className:"flex-1 text-xs text-destructive font-medium",children:["Failed to load"," ",n.jsx("span",{className:"font-mono",children:k})," app"]}),n.jsxs(Se,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:ae,children:[n.jsx(Kt,{className:"size-3.5"}),"Retry"]})]})},children:n.jsx(W.Suspense,{fallback:n.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),n.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:n.jsx(En,{uiResourceUri:w,connectionId:h,orgId:u.id,orgSlug:u.slug,toolName:j,toolInput:t.input,toolResult:t.output,toolMeta:y,onMessage:z,onUpdateModelContext:I&&p?se=>p.setAppContext(I,se):void 0,onTeardown:I&&p?()=>p.clearAppContext(I):void 0,onRequestDisplayMode:C?E:void 0})})})}),e[47]=C,e[48]=p,e[49]=h,e[50]=k,e[51]=z,e[52]=E,e[53]=T,e[54]=y,e[55]=u.id,e[56]=u.slug,e[57]=t.input,e[58]=t.output,e[59]=I,e[60]=j,e[61]=w,e[62]=ye):ye=e[62];let we;return e[63]!==le||e[64]!==oe||e[65]!==ye?(we=n.jsxs("div",{children:[le,oe,ye]}),e[63]=le,e[64]=oe,e[65]=ye,e[66]=we):we=e[66],we}function zt(s){return typeof s=="object"&&s!=null&&"type"in s&&s.type==="mcpToolCall"}function An(s){if(s!=null)return zt(s)?s.arguments??void 0:s}function zn(s){if(s==null)return;if(zt(s)&&s.result!=null)return s.result;if(typeof s=="object"&&"content"in s&&Array.isArray(s.content)){const t=s.content;if(t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"type"in t[0])return s}const e=typeof s=="string"?s:JSON.stringify(s);return{structuredContent:typeof s=="object"&&!Array.isArray(s)?s:void 0,content:[{type:"text",text:e}]}}function En(s){const e=$.c(27),{uiResourceUri:t,connectionId:l,orgId:r,orgSlug:a,toolName:o,toolInput:c,toolResult:f,toolMeta:i,onMessage:m,onUpdateModelContext:p,onTeardown:u,onRequestDisplayMode:d}=s;let x;e[0]!==l||e[1]!==r||e[2]!==a?(x={connectionId:l,orgId:r,orgSlug:a},e[0]=l,e[1]=r,e[2]=a,e[3]=x):x=e[3];const g=bt(x);let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b={type:"object"},e[4]=b):b=e[4];let h;e[5]!==i?(h=i!=null&&{_meta:i},e[5]=i,e[6]=h):h=e[6];let S;e[7]!==h||e[8]!==o?(S={name:o,inputSchema:b,...h},e[7]=h,e[8]=o,e[9]=S):S=e[9];const y=S;let v;e[10]!==y?(v={tool:y},e[10]=y,e[11]=v):v=e[11];let j;e[12]!==c?(j=An(c),e[12]=c,e[13]=j):j=e[13];let N;e[14]!==f?(N=zn(f),e[14]=f,e[15]=N):N=e[15];let k;return e[16]!==g||e[17]!==m||e[18]!==d||e[19]!==u||e[20]!==p||e[21]!==r||e[22]!==v||e[23]!==j||e[24]!==N||e[25]!==t?(k=n.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsx(Ns,{resourceURI:t,orgId:r,toolInfo:v,toolInput:j,toolResult:N,client:g,onMessage:m,onUpdateModelContext:p,onTeardown:u,onRequestDisplayMode:d})}),e[16]=g,e[17]=m,e[18]=d,e[19]=u,e[20]=p,e[21]=r,e[22]=v,e[23]=j,e[24]=N,e[25]=t,e[26]=k):k=e[26],k}const st="mesh-storage://";function Le(s){return s.startsWith(st)?s.slice(st.length):null}function Et(s,e){const t=Le(s);return t!==null?`/api/${e}/files/${t}`:s}function Pn(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;return l?{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function Fn(s){const e=$.c(13),{uri:t,orgSlug:l}=s;let r;e[0]!==l||e[1]!==t?(r=Et(t,l),e[0]=l,e[1]=t,e[2]=r):r=e[2];const a=r;let o;e[3]!==t?(o=Le(t)!==null?t.slice(t.lastIndexOf("/")+1):"reference",e[3]=t,e[4]=o):o=e[4];const c=o;let f;e[5]!==c?(f=n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded bg-muted text-muted-foreground text-xs cursor-default select-none",children:c})}),e[5]=c,e[6]=f):f=e[6];let i;e[7]!==c||e[8]!==a?(i=n.jsx(ge,{side:"top",className:"max-w-sm p-1.5",children:n.jsx("img",{src:a,alt:c,className:"max-w-full max-h-64 object-contain rounded"})}),e[7]=c,e[8]=a,e[9]=i):i=e[9];let m;return e[10]!==f||e[11]!==i?(m=n.jsxs(he,{children:[f,i]}),e[10]=f,e[11]=i,e[12]=m):m=e[12],m}function On(s){const e=$.c(71),{part:t,latency:l}=s,r=Be();let a;e[0]!==t.state?(a=re(t.state),e[0]=t.state,e[1]=a):a=e[1];const o=a,c=t.input,f=t.output,i=f?.images;let m;e[2]!==f?(m=Pn(f),e[2]=f,e[3]=m):m=e[3];const p=m,u=f?.model;let d,x,g,b,h,S,y,v,j,N,k,_;if(e[4]!==i||e[5]!==c||e[6]!==l||e[7]!==u||e[8]!==r||e[9]!==t||e[10]!==f||e[11]!==o||e[12]!==p){h=Symbol.for("react.early_return_sentinel");e:{const L=Array.isArray(c?.referenceImages)?c.referenceImages.filter(Dn):void 0;let R;e[25]!==l?(R=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[25]=l,e[26]=R):R=e[26];const F=R;if(o==="loading"){let E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx(Re,{size:14}),e[27]=E):E=e[27];let A;e[28]!==c?(A=c?.prompt?`"${c.prompt.slice(0,80)}…"`:void 0,e[28]=c,e[29]=A):A=e[29];let z;e[30]!==A?(z=n.jsx(B,{icon:E,title:"Generating image",summary:A,state:"loading"}),e[30]=A,e[31]=z):z=e[31],h=z;break e}if(o==="error"||!i||i.length===0){let E;e[32]!==t||e[33]!==o?(E=o==="error"?Me(t):void 0,e[32]=t,e[33]=o,e[34]=E):E=e[34];const A=E;let z="";c!==void 0&&(z=`# Input
30
- `+Ze(c)),A?(z&&(z=z+`
31
-
32
- `),z=z+(`# Error
33
- `+A)):f!==void 0&&(z&&(z=z+`
34
-
35
- `),z=z+(`# Output
36
- `+Ze(f)));let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(Re,{size:14}),e[35]=O):O=e[35];const H=o==="error"?"Failed":"No images generated",U=o==="error"?"error":"idle",D=z||null;let G;e[36]!==F||e[37]!==H||e[38]!==U||e[39]!==D||e[40]!==p?(G=n.jsx(B,{icon:O,title:"Image generation",summary:H,state:U,usage:p,trailing:F,detail:D}),e[36]=F,e[37]=H,e[38]=U,e[39]=D,e[40]=p,e[41]=G):G=e[41],h=G;break e}b="flex flex-col gap-2",d=B,e[42]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Re,{size:14,className:"text-pink-500"}),e[42]=j):j=e[42],N="Generated image",k=u,_="idle",x=p,g=F,S="flex flex-col gap-1 pb-2 pl-6",e[43]!==c?(y=c?.prompt&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.prompt}),e[43]=c,e[44]=y):y=e[44],v=L&&L.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:"references:"}),L.map((E,A)=>{const z=E.uri??E.url;return n.jsx(Fn,{uri:z,orgSlug:r.slug},A)})]})}e[4]=i,e[5]=c,e[6]=l,e[7]=u,e[8]=r,e[9]=t,e[10]=f,e[11]=o,e[12]=p,e[13]=d,e[14]=x,e[15]=g,e[16]=b,e[17]=h,e[18]=S,e[19]=y,e[20]=v,e[21]=j,e[22]=N,e[23]=k,e[24]=_}else d=e[13],x=e[14],g=e[15],b=e[16],h=e[17],S=e[18],y=e[19],v=e[20],j=e[21],N=e[22],k=e[23],_=e[24];if(h!==Symbol.for("react.early_return_sentinel"))return h;let w;e[45]!==S||e[46]!==y||e[47]!==v?(w=n.jsxs("div",{className:S,children:[y,v]}),e[45]=S,e[46]=y,e[47]=v,e[48]=w):w=e[48];let T;e[49]!==d||e[50]!==x||e[51]!==g||e[52]!==w||e[53]!==j||e[54]!==N||e[55]!==k||e[56]!==_?(T=n.jsx(d,{icon:j,title:N,summary:k,state:_,usage:x,trailing:g,children:w}),e[49]=d,e[50]=x,e[51]=g,e[52]=w,e[53]=j,e[54]=N,e[55]=k,e[56]=_,e[57]=T):T=e[57];let I;if(e[58]!==i||e[59]!==c?.prompt||e[60]!==r){let L;e[62]!==c?.prompt||e[63]!==r?(L=(R,F)=>{const E=R.uri??R.url;if(!E)return null;const A=Et(E,r.slug);return n.jsx(gt,{src:A,alt:c?.prompt??"Generated image",children:n.jsx("img",{src:A,alt:c?.prompt??"Generated image",className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},F)},e[62]=c?.prompt,e[63]=r,e[64]=L):L=e[64],I=i.map(L),e[58]=i,e[59]=c?.prompt,e[60]=r,e[61]=I}else I=e[61];let M;e[65]!==I?(M=n.jsx("div",{className:"flex flex-wrap gap-2",children:I}),e[65]=I,e[66]=M):M=e[66];let C;return e[67]!==b||e[68]!==T||e[69]!==M?(C=n.jsxs("div",{className:b,children:[T,M]}),e[67]=b,e[68]=T,e[69]=M,e[70]=C):C=e[70],C}function Dn(s){return s.uri??s.url}function Bn(s,e){const t=Le(s);return t!==null?`/api/${e}/files/${t}`:s}function Hn(s){const e=$.c(26),{part:t,latency:l}=s,r=Be(),a=re(t.state),o=t.input,c=t.output,f=c?.image?.uri,i=c?.url??o?.url;let m;e[0]!==l?(m=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[0]=l,e[1]=m):m=e[1];const p=m;if(a==="loading"){let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[2]=j):j=e[2];let N;return e[3]!==i?(N=n.jsx(B,{icon:j,title:"Taking screenshot",summary:i,state:"loading"}),e[3]=i,e[4]=N):N=e[4],N}if(a==="error"||c?.success===!1||!f){let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[5]=j):j=e[5];const N=c?.error??"Failed";let k;return e[6]!==p||e[7]!==N?(k=n.jsx(B,{icon:j,title:"Take screenshot",summary:N,state:"error",trailing:p}),e[6]=p,e[7]=N,e[8]=k):k=e[8],k}let u;e[9]!==r.slug||e[10]!==f?(u=Bn(f,r.slug),e[9]=r.slug,e[10]=f,e[11]=u):u=e[11];const d=u;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ne,{size:14,className:"text-blue-500"}),e[12]=x):x=e[12];let g;e[13]!==p||e[14]!==i?(g=n.jsx(B,{icon:x,title:"Screenshot",summary:i,state:"idle",trailing:p}),e[13]=p,e[14]=i,e[15]=g):g=e[15];const b=i??"Screenshot",h=i??"Screenshot";let S;e[16]!==d||e[17]!==h?(S=n.jsx("img",{src:d,alt:h,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[16]=d,e[17]=h,e[18]=S):S=e[18];let y;e[19]!==d||e[20]!==b||e[21]!==S?(y=n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(gt,{src:d,alt:b,children:S})}),e[19]=d,e[20]=b,e[21]=S,e[22]=y):y=e[22];let v;return e[23]!==g||e[24]!==y?(v=n.jsxs("div",{className:"flex flex-col gap-2",children:[g,y]}),e[23]=g,e[24]=y,e[25]=v):v=e[25],v}function Wn(s,e){const t=Le(s);return t!==null?`/api/${e}/files/${t}`:s}function Un(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;if(!l)return null;const r={providerMetadata:s.usage.providerMetadata};return{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:wt(r),cacheReadTokens:0,cacheWriteTokens:0}}function qn(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}function Vn(s){try{return`${new URL(s).origin}/favicon.ico`}catch{return""}}function Gn(s){const e=$.c(16),{citation:t,index:l}=s;let r;e[0]!==t.url?(r=qn(t.url),e[0]=t.url,e[1]=r):r=e[1];const a=r;let o;e[2]!==t.url?(o=Vn(t.url),e[2]=t.url,e[3]=o):o=e[3];const c=o,f=t.title||a;let i;e[4]!==c?(i=n.jsx("img",{src:c,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:Jn}),e[4]=c,e[5]=i):i=e[5];let m;e[6]!==f?(m=n.jsx("span",{className:"truncate max-w-[180px]",children:f}),e[6]=f,e[7]=m):m=e[7];const p=l+1;let u;e[8]!==p?(u=n.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",p,"]"]}),e[8]=p,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(St,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=d):d=e[10];let x;return e[11]!==t.url||e[12]!==i||e[13]!==m||e[14]!==u?(x=n.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[i,m,u,d]}),e[11]=t.url,e[12]=i,e[13]=m,e[14]=u,e[15]=x):x=e[15],x}function Jn(s){s.target.style.display="none"}function Kn(s,e){return s.replace(/\[(\d+)\]/g,(t,l)=>{const r=parseInt(l,10)-1,a=e[r];return a?`[\\[${l}\\]](${a.url})`:t})}const ze=5;function Xn(s){const e=$.c(12),{citations:t}=s,[l,r]=W.useState(!1),a=t.length>ze;let o;e[0]!==t||e[1]!==l?(o=l?t:t.slice(0,ze),e[0]=t,e[1]=l,e[2]=o):o=e[2];const c=o;let f;e[3]!==c?(f=c.map(Yn),e[3]=c,e[4]=f):f=e[4];let i;e[5]!==t.length||e[6]!==l||e[7]!==a?(i=a&&n.jsx("button",{type:"button",onClick:()=>r(Qn),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:l?"show less":`+${t.length-ze} more`}),e[5]=t.length,e[6]=l,e[7]=a,e[8]=i):i=e[8];let m;return e[9]!==f||e[10]!==i?(m=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[f,i]}),e[9]=f,e[10]=i,e[11]=m):m=e[11],m}function Qn(s){return!s}function Yn(s,e){return n.jsx(Gn,{citation:s,index:e},s.url)}function Zn(s){const e=$.c(51),{part:t,latency:l,streamingText:r}=s,a=Be();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const c=o,f=t.input,i=t.output;let m,p,u;e[2]!==a||e[3]!==i?(m=i?.uri?Wn(i.uri,a.slug):void 0,u=De,p=pe.webSearchBlob(m??""),e[2]=a,e[3]=i,e[4]=m,e[5]=p,e[6]=u):(m=e[4],p=e[5],u=e[6]);let d;e[7]!==m?(d=async()=>{const U=await fetch(m);if(!U.ok)throw new Error(`Failed to fetch: ${U.status}`);return U.text()},e[7]=m,e[8]=d):d=e[8];const x=!!m;let g;e[9]!==p||e[10]!==d||e[11]!==x?(g={queryKey:p,queryFn:d,enabled:x,staleTime:1/0},e[9]=p,e[10]=d,e[11]=x,e[12]=g):g=e[12];const{data:b}=u(g),h=c==="loading",S=c!=="loading"&&c!=="error",y=i?.citations;let v;e[13]!==i?(v=Un(i),e[13]=i,e[14]=v):v=e[14];const j=v,N=i?.content??b??r;let k;e[15]!==y||e[16]!==N?(k=N&&y?.length?Kn(N,y):N,e[15]=y,e[16]=N,e[17]=k):k=e[17];const _=k;let w;e[18]!==l?(w=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[18]=l,e[19]=w):w=e[19];const T=w;if(c==="error"){let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx($e,{size:14}),e[20]=U):U=e[20];let D;return e[21]!==T||e[22]!==j?(D=n.jsx(B,{icon:U,title:"Web search",summary:"Failed",state:"error",usage:j,trailing:T}),e[21]=T,e[22]=j,e[23]=D):D=e[23],D}const I=h?"animate-pulse":"text-blue-500";let M;e[24]!==I?(M=V(I),e[24]=I,e[25]=M):M=e[25];let C;e[26]!==M?(C=n.jsx($e,{size:14,className:M}),e[26]=M,e[27]=C):C=e[27];const L=h?"Researching...":"Web search";let R;e[28]!==f||e[29]!==S||e[30]!==i?.model?(R=S?i?.model??f?.query?.slice(0,60):f?.query?`"${f.query.slice(0,80)}"`:void 0,e[28]=f,e[29]=S,e[30]=i?.model,e[31]=R):R=e[31];const F=h?"loading":"idle";let E;e[32]!==f?(E=f?.query&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:f.query}),e[32]=f,e[33]=E):E=e[33];let A;e[34]!==_||e[35]!==t.toolCallId?(A=_?n.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:n.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:n.jsx(xt,{id:t.toolCallId,text:_})})}):n.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:n.jsxs("div",{className:"space-y-2 animate-pulse",children:[n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[34]=_,e[35]=t.toolCallId,e[36]=A):A=e[36];let z;e[37]!==y?(z=y&&y.length>0&&n.jsx(Xn,{citations:y}),e[37]=y,e[38]=z):z=e[38];let O;e[39]!==E||e[40]!==A||e[41]!==z?(O=n.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[E,A,z]}),e[39]=E,e[40]=A,e[41]=z,e[42]=O):O=e[42];let H;return e[43]!==T||e[44]!==C||e[45]!==L||e[46]!==R||e[47]!==F||e[48]!==O||e[49]!==j?(H=n.jsx(B,{icon:C,title:L,summary:R,state:F,usage:j,trailing:T,defaultOpen:!0,children:O}),e[43]=T,e[44]=C,e[45]=L,e[46]=R,e[47]=F,e[48]=O,e[49]=j,e[50]=H):H=e[50],H}function el(s){const e=$.c(14),{part:t}=s;if(!t.state.startsWith("output-"))return null;let l;e[0]!==t.input?.prompt?(l=t.input?.prompt?.trim()||"Question",e[0]=t.input?.prompt,e[1]=l):l=e[1];const r=l,a=t.state==="output-error"||t.state==="output-denied",o=t.state==="output-denied";let c;e[2]!==o||e[3]!==t?(c=o?"Skipped":t.state==="output-error"?Me(t)??"Error":t.output?.response??"",e[2]=o,e[3]=t,e[4]=c):c=e[4];const f=c;let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(cs,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[5]=i):i=e[5];let m;e[6]!==r?(m=n.jsxs("div",{className:"flex items-start gap-2",children:[i,n.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:r})]}),e[6]=r,e[7]=m):m=e[7];let p;e[8]!==f||e[9]!==a?(p=f&&n.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:n.jsx("span",{className:V("text-[14px] leading-snug",a?"text-muted-foreground/50 italic":"text-foreground/70"),children:f})}),e[8]=f,e[9]=a,e[10]=p):p=e[10];let u;return e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13],u}function tl(s){if(s&&typeof s=="object"&&!Array.isArray(s)){const e=s;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const l=typeof e.text=="string"?e.text.trim():"",r=e.finishReason==="length";return l?(r?`[Subtask hit step limit — partial result below; consider narrowing the task.]
37
-
38
- `:"")+l:r?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return Cn(s)}function Pt({part:s,subtaskMeta:e,latency:t}){const l=s.state==="input-streaming"||s.state==="input-available",r=s.state==="output-available"&&s.preliminary===!0,a=s.state==="output-available"&&!s.preliminary,o=s.state==="output-error",c=re(s.state,"preliminary"in s?s.preliminary:!1),f=c==="approval"?"idle":c,i=l?"Starting subtask...":r?"Subtask running...":a?"Subtask completed":o?"Subtask failed":"Subtask",m=s.input?.prompt??"",p=s.state==="approval-requested"?"Awaiting approval...":m.length>120?m.slice(0,120)+"…":m,x=(o?Me(s):tl(s.output))??(l||r?"":"No output available"),g=`# Task
39
- ${s.input?.prompt??"No prompt provided"}
40
-
41
- # ${o?"Error":"Result"}
42
- ${x}`;return{fallbackTitle:i,summary:p,usage:e?.usage,latency:t,detail:g,state:f}}function sl(s){const e=$.c(7),t=Pt(s);let l,r;e[0]!==t?({fallbackTitle:l,...r}=t,e[0]=t,e[1]=l,e[2]=r):(l=e[1],r=e[2]);let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ie,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:n.jsx(kt,{})}),e[3]=a):a=e[3];let o;return e[4]!==l||e[5]!==r?(o=n.jsx(B,{icon:a,title:l,...r}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o}function nl(s){const e=$.c(11),t=Pt(s);let l,r;e[0]!==t?({fallbackTitle:l,...r}=t,e[0]=t,e[1]=l,e[2]=r):(l=e[1],r=e[2]);const a=Bs(s.part.input?.agent_id),o=a?.icon,c=a?.title??"Subtask";let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(kt,{}),e[3]=f):f=e[3];let i;e[4]!==o||e[5]!==c?(i=n.jsx(Ie,{icon:o,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:f}),e[4]=o,e[5]=c,e[6]=i):i=e[6];const m=a?.title??l;let p;return e[7]!==r||e[8]!==i||e[9]!==m?(p=n.jsx(B,{icon:i,title:m,...r}),e[7]=r,e[8]=i,e[9]=m,e[10]=p):p=e[10],p}function ll(s){const e=$.c(16),{part:t}=s;if(!t.state.startsWith("output-"))return null;const l=t.input?.plan??"",a=t.output?.approved===!0;let o,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(vt,{className:"size-4 text-purple-500 shrink-0"}),c=n.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=o,e[1]=c):(o=e[0],c=e[1]);let f;e[2]!==a?(f=a&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600 bg-green-500/10 px-1.5 py-0.5 rounded-md",children:[n.jsx(We,{size:12}),"Approved"]}),e[2]=a,e[3]=f):f=e[3];let i;e[4]!==a||e[5]!==t.state?(i=!a&&t.state==="output-available"&&n.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=a,e[5]=t.state,e[6]=i):i=e[6];let m;e[7]!==f||e[8]!==i?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[o,c,f,i]}),e[7]=f,e[8]=i,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=p):p=e[10];let u;e[11]!==l?(u=n.jsxs("details",{className:"ml-6",children:[p,n.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:n.jsx(Ge,{id:"plan-content",part:{type:"text",text:l}})})]}),e[11]=l,e[12]=u):u=e[12];let d;return e[13]!==m||e[14]!==u?(d=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,u]}),e[13]=m,e[14]=u,e[15]=d):d=e[15],d}const Je={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function ol(s){return s.startsWith("http")?s:`https://${s}`}function nt(s){const e=$.c(2),{children:t}=s;let l;return e[0]!==t?(l=n.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l}function al(s){const e=$.c(12),{name:t,value:l}=s;let r;e[0]!==l?(r=n.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:l},"aria-hidden":!0}),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let o;e[4]!==l?(o=n.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:l}),e[4]=l,e[5]=o):o=e[5];let c;e[6]!==a||e[7]!==o?(c=n.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[a,o]}),e[6]=a,e[7]=o,e[8]=c):c=e[8];let f;return e[9]!==r||e[10]!==c?(f=n.jsxs("div",{className:"flex items-center gap-2.5",children:[r,c]}),e[9]=r,e[10]=c,e[11]=f):f=e[11],f}function rl(s){const e=$.c(15),{role:t,family:l}=s;let r;e[0]!==l?(r=n.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:l},"aria-hidden":!0,children:"Aa"}),e[0]=l,e[1]=r):r=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let o;e[4]!==l?(o={fontFamily:l},e[4]=l,e[5]=o):o=e[5];let c;e[6]!==l||e[7]!==o?(c=n.jsx("span",{className:"text-sm text-foreground",style:o,children:l}),e[6]=l,e[7]=o,e[8]=c):c=e[8];let f;e[9]!==a||e[10]!==c?(f=n.jsxs("div",{className:"flex flex-col leading-tight",children:[a,c]}),e[9]=a,e[10]=c,e[11]=f):f=e[11];let i;return e[12]!==r||e[13]!==f?(i=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[r,f]}),e[12]=r,e[13]=f,e[14]=i):i=e[14],i}function il(s){const e=$.c(3),{logo:t,favicon:l,name:r}=s,a=t??l;if(!a)return null;const o=r?`${r} logo`:"";let c;return e[0]!==a||e[1]!==o?(c=n.jsx("img",{src:a,alt:o,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:cl}),e[0]=a,e[1]=o,e[2]=c):c=e[2],c}function cl(s){s.target.style.display="none"}function Ft(s){const e=$.c(4),{colors:t}=s;let l;e[0]!==t?(l=Object.entries(t).filter(dl),e[0]=t,e[1]=l):l=e[1];const r=l;if(r.length===0)return null;let a;return e[2]!==r?(a=n.jsx("div",{className:"flex h-1.5",children:r.map(ul)}),e[2]=r,e[3]=a):a=e[3],a}function ul(s){const[e,t]=s;return n.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function dl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Ot(s){const e=$.c(36),{logo:t,favicon:l,name:r,domain:a,overview:o,colors:c,fonts:f,showDefaultBadge:i,isDefault:m}=s;let p;e[0]!==c?(p=c?Object.entries(c).filter(xl):[],e[0]=c,e[1]=p):p=e[1];const u=p;let d;e[2]!==f?(d=f?Object.entries(f).filter(pl):[],e[2]=f,e[3]=d):d=e[3];const x=d;let g;e[4]!==c?(g=c&&n.jsx(Ft,{colors:c}),e[4]=c,e[5]=g):g=e[5];let b;e[6]!==l||e[7]!==t||e[8]!==r?(b=n.jsx(il,{logo:t,favicon:l,name:r}),e[6]=l,e[7]=t,e[8]=r,e[9]=b):b=e[9];let h;e[10]!==m||e[11]!==r||e[12]!==i?(h=r&&n.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[r,i&&m&&n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[n.jsx(jt,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=m,e[11]=r,e[12]=i,e[13]=h):h=e[13];let S;e[14]!==a?(S=a&&n.jsxs("a",{href:ol(a),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a,n.jsx(St,{className:"size-3 shrink-0"})]}),e[14]=a,e[15]=S):S=e[15];let y;e[16]!==h||e[17]!==S?(y=n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h,S]}),e[16]=h,e[17]=S,e[18]=y):y=e[18];let v;e[19]!==b||e[20]!==y?(v=n.jsxs("div",{className:"flex items-center gap-4",children:[b,y]}),e[19]=b,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==o?(j=o&&n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o}),e[22]=o,e[23]=j):j=e[23];let N;e[24]!==u?(N=u.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(nt,{children:"Colors"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:u.map(ml)})]}),e[24]=u,e[25]=N):N=e[25];let k;e[26]!==x?(k=x.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(nt,{children:"Typography"}),n.jsx("div",{className:"flex flex-wrap gap-2.5",children:x.map(fl)})]}),e[26]=x,e[27]=k):k=e[27];let _;e[28]!==N||e[29]!==k||e[30]!==v||e[31]!==j?(_=n.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[v,j,N,k]}),e[28]=N,e[29]=k,e[30]=v,e[31]=j,e[32]=_):_=e[32];let w;return e[33]!==_||e[34]!==g?(w=n.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,_]}),e[33]=_,e[34]=g,e[35]=w):w=e[35],w}function fl(s){const[e,t]=s;return n.jsx(rl,{role:e,family:t},e)}function ml(s){const[e,t]=s;return n.jsx(al,{name:Je[e],value:t},e)}function pl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function xl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function gl(s){const e=$.c(29),{part:t,latency:l}=s,r=re(t.state);let a;e[0]!==t.output?(a=ve(t.output),e[0]=t.output,e[1]=a):a=e[1];const o=a,c=r==="loading",f=r==="error"||o&&o.success===!1;if(c){const k=t.input;let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(ce,{className:"animate-pulse"}),e[2]=_):_=e[2];const w=k?.domain?`from ${k.domain}`:void 0;let T;return e[3]!==w?(T=n.jsx(B,{icon:_,title:"Extracting brand",summary:w,state:"loading",defaultOpen:!0}),e[3]=w,e[4]=T):T=e[4],T}if(f){let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ce,{}),e[5]=k):k=e[5];const _=o?.error??"Unknown error";let w;e[6]!==l?(w=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[6]=l,e[7]=w):w=e[7];let T;return e[8]!==_||e[9]!==w?(T=n.jsx(B,{icon:k,title:"Brand extraction failed",summary:_,state:"error",trailing:w}),e[8]=_,e[9]=w,e[10]=T):T=e[10],T}let i;e[11]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(ce,{className:"text-fuchsia-500"}),e[11]=i):i=e[11];const m=o?.name?`Brand set: ${o.name}`:"Brand context set",p=o?.domain;let u;e[12]!==l?(u=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[12]=l,e[13]=u):u=e[13];let d;e[14]!==m||e[15]!==p||e[16]!==u?(d=n.jsx(B,{icon:i,title:m,summary:p,state:"idle",trailing:u}),e[14]=m,e[15]=p,e[16]=u,e[17]=d):d=e[17];const x=o?.logo,g=o?.favicon,b=o?.name,h=o?.domain,S=o?.overview,y=o?.colors,v=o?.fonts;let j;e[18]!==h||e[19]!==S||e[20]!==y||e[21]!==v||e[22]!==x||e[23]!==g||e[24]!==b?(j=n.jsx(Ot,{logo:x,favicon:g,name:b,domain:h,overview:S,colors:y,fonts:v}),e[18]=h,e[19]=S,e[20]=y,e[21]=v,e[22]=x,e[23]=g,e[24]=b,e[25]=j):j=e[25];let N;return e[26]!==j||e[27]!==d?(N=n.jsxs(n.Fragment,{children:[d,j]}),e[26]=j,e[27]=d,e[28]=N):N=e[28],N}function hl(s){const e=$.c(27),{part:t,latency:l}=s,r=re(t.state);let a;e[0]!==t.output?(a=ve(t.output),e[0]=t.output,e[1]=a):a=e[1];const o=a,c=r==="loading",f=r==="error"||o&&o.success===!1;if(c){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(f||!o){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ce,{}),e[3]=g):g=e[3];let b;e[4]!==l?(b=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[4]=l,e[5]=b):b=e[5];let h;return e[6]!==b?(h=n.jsx(B,{icon:g,title:"Couldn't load brand",state:"error",trailing:b}),e[6]=b,e[7]=h):h=e[7],h}let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(ce,{className:"text-fuchsia-500"}),e[8]=i):i=e[8];const m=o.name?`Brand · ${o.name}`:"Brand";let p;e[9]!==l?(p=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[9]=l,e[10]=p):p=e[10];let u;e[11]!==o.domain||e[12]!==m||e[13]!==p?(u=n.jsx(B,{icon:i,title:m,summary:o.domain,state:"idle",trailing:p}),e[11]=o.domain,e[12]=m,e[13]=p,e[14]=u):u=e[14];let d;e[15]!==o.colors||e[16]!==o.domain||e[17]!==o.favicon||e[18]!==o.fonts||e[19]!==o.isDefault||e[20]!==o.logo||e[21]!==o.name||e[22]!==o.overview?(d=n.jsx(Ot,{logo:o.logo,favicon:o.favicon,name:o.name,domain:o.domain,overview:o.overview,colors:o.colors,fonts:o.fonts,showDefaultBadge:!0,isDefault:o.isDefault}),e[15]=o.colors,e[16]=o.domain,e[17]=o.favicon,e[18]=o.fonts,e[19]=o.isDefault,e[20]=o.logo,e[21]=o.name,e[22]=o.overview,e[23]=d):d=e[23];let x;return e[24]!==u||e[25]!==d?(x=n.jsxs(n.Fragment,{children:[u,d]}),e[24]=u,e[25]=d,e[26]=x):x=e[26],x}function bl(s){const e=$.c(32),{part:t,latency:l}=s;let r;e[0]!==t.state?(r=re(t.state),e[0]=t.state,e[1]=r):r=e[1];const a=r;let o,c,f,i;if(e[2]!==l||e[3]!==t.output||e[4]!==a){i=Symbol.for("react.early_return_sentinel");e:{const u=ve(t.output),d=Array.isArray(u?.items)?u.items:[],x=a==="loading",g=a==="error";if(x){let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=y):y=e[9],i=y;break e}if(g){let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[10]=y):y=e[10];let v;e[11]!==l?(v=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[11]=l,e[12]=v):v=e[12];let j;e[13]!==v?(j=n.jsx(B,{icon:y,title:"Couldn't load brands",state:"error",trailing:v}),e[13]=v,e[14]=j):j=e[14],i=j;break e}if(d.length===0){let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[15]=y):y=e[15];let v;e[16]!==l?(v=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[16]=l,e[17]=v):v=e[17];let j;e[18]!==v?(j=n.jsx(B,{icon:y,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:v}),e[18]=v,e[19]=j):j=e[19],i=j;break e}let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ce,{className:"text-fuchsia-500"}),e[20]=b):b=e[20];const h=d.length===1?"1 brand":`${d.length} brands`;let S;e[21]!==l?(S=l!=null&&l>0?n.jsx(te,{latency:l}):void 0,e[21]=l,e[22]=S):S=e[22],e[23]!==h||e[24]!==S?(f=n.jsx(B,{icon:b,title:h,state:"idle",trailing:S}),e[23]=h,e[24]=S,e[25]=f):f=e[25],o="mt-2 flex flex-col gap-1.5",c=d.map(yl)}e[2]=l,e[3]=t.output,e[4]=a,e[5]=o,e[6]=c,e[7]=f,e[8]=i}else o=e[5],c=e[6],f=e[7],i=e[8];if(i!==Symbol.for("react.early_return_sentinel"))return i;let m;e[26]!==o||e[27]!==c?(m=n.jsx("div",{className:o,children:c}),e[26]=o,e[27]=c,e[28]=m):m=e[28];let p;return e[29]!==f||e[30]!==m?(p=n.jsxs(n.Fragment,{children:[f,m]}),e[29]=f,e[30]=m,e[31]=p):p=e[31],p}function yl(s){const e=s.colors?Object.entries(s.colors).filter(Nl):[];return n.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.colors&&n.jsx(Ft,{colors:s.colors}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(s.logo||s.favicon)&&n.jsx("img",{src:s.logo??s.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:vl}),n.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[s.name??"Untitled",s.isDefault&&n.jsx(jt,{className:"size-3 text-amber-500 shrink-0"})]}),s.domain&&n.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:s.domain})]}),e.length>0&&n.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(jl)})]})]},s.id??`${s.name}-${s.domain}`)}function jl(s){const[e,t]=s;return n.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function vl(s){s.target.style.display="none"}function Nl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Oe(s){const e=$.c(4),{connection_id:t,iconSize:l}=s,r=l===void 0?"xs":l,a=Hs(t);if(!a)return null;let o;return e[0]!==a.icon||e[1]!==a.title||e[2]!==r?(o=n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx(Ie,{icon:a.icon,name:a.title,size:r})}),e[0]=a.icon,e[1]=a.title,e[2]=r,e[3]=o):o=e[3],o}Oe.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:V(t,"rounded bg-muted animate-pulse")})})};function ke(s){const e=$.c(18),{connectionIds:t,maxVisibleIcons:l,iconSize:r,className:a}=s,o=l===void 0?2:l,c=r===void 0?"xs":r;if(t.length===0)return null;let f,i,m;if(e[0]!==a||e[1]!==t||e[2]!==c||e[3]!==o){const d=t.slice(0,o);f=t.length-o,e[7]!==a?(i=V("flex items-center justify-end -space-x-2",a),e[7]=a,e[8]=i):i=e[8];let x;e[9]!==c?(x=g=>n.jsx(W.Suspense,{fallback:n.jsx(Oe.Fallback,{iconSize:c}),children:n.jsx(Oe,{connection_id:g,iconSize:c})},g),e[9]=c,e[10]=x):x=e[10],m=d.map(x),e[0]=a,e[1]=t,e[2]=c,e[3]=o,e[4]=f,e[5]=i,e[6]=m}else f=e[4],i=e[5],m=e[6];let p;e[11]!==c||e[12]!==f?(p=f>0&&n.jsx("div",{className:V("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",c==="sm"?"size-8":"size-6"),children:n.jsxs("span",{className:V(c==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${f} more`,children:["+",f]})}),e[11]=c,e[12]=f,e[13]=p):p=e[13];let u;return e[14]!==i||e[15]!==m||e[16]!==p?(u=n.jsxs("div",{className:i,children:[m,p]}),e[14]=i,e[15]=m,e[16]=p,e[17]=u):u=e[17],u}ke.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:l="xs"}){const r=l==="sm"?"size-6":"size-5",a=l==="sm"?"size-8":"size-6",o=t!==void 0&&t>e;return n.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((c,f)=>n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:V(r,"rounded bg-muted animate-pulse")})},f)),o&&n.jsx("div",{className:V("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",a),children:n.jsx("div",{className:V(l==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Sl="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",lt=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function kl(s){const e=$.c(64),{part:t,latency:l}=s,r=_t(),a=re(t.state),o=W.useRef(null),c=W.useRef(null),f=W.useRef(null),i=W.useRef(null),m=W.useRef(null);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{lt?.matches||(m.current=o.current?.getBoundingClientRect()??null,o.current&&(o.current.style.willChange="transform"))},e[0]=p):p=e[0];const u=p;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=P=>{if(lt?.matches)return;const q=m.current,J=o.current;if(!q||!J)return;const X=(P.clientX-q.left)/q.width*100,ee=(P.clientY-q.top)/q.height*100;J.style.transform=`perspective(800px) rotateY(${(X-50)*.05}deg) rotateX(${(ee-50)*-.05}deg)`,c.current&&(c.current.style.opacity="1",c.current.style.transform=`translate(${(X-50)*.15}px, ${(ee-50)*.15}px)`),f.current&&(f.current.style.opacity="0.45"),i.current&&(i.current.style.opacity="0.45")},e[1]=d):d=e[1];const x=d;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const P=o.current;P&&(P.style.transform="none",P.style.willChange="auto"),c.current&&(c.current.style.opacity="0.4",c.current.style.transform="translate(0, 0)"),f.current&&(f.current.style.opacity="0.3"),i.current&&(i.current.style.opacity="0.3"),m.current=null},e[2]=g):g=e[2];const b=g;if(a==="loading"){let P;return e[3]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=P):P=e[3],P}if(a==="approval"){let P;return e[4]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{}),title:"Create agent",state:"idle"}),e[4]=P):P=e[4],P}if(a==="error"){let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[5]=P):P=e[5];const q=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let J;e[6]!==l?(J=n.jsx(te,{latency:l}),e[6]=l,e[7]=J):J=e[7];let X;return e[8]!==q||e[9]!==J?(X=n.jsx(B,{icon:P,title:q,state:"error",trailing:J}),e[8]=q,e[9]=J,e[10]=X):X=e[10],X}let h,S,y;if(e[11]!==l||e[12]!==t.output){y=Symbol.for("react.early_return_sentinel");e:{if(h=ve(t.output)?.item,!h?.id||!h?.title){let P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[16]=P):P=e[16];let q;e[17]!==l?(q=n.jsx(B,{icon:P,title:"Agent created",state:"idle",trailing:n.jsx(te,{latency:l})}),e[17]=l,e[18]=q):q=e[18],y=q;break e}S=(h.connections??[]).map(_l)}e[11]=l,e[12]=t.output,e[13]=h,e[14]=S,e[15]=y}else h=e[13],S=e[14],y=e[15];if(y!==Symbol.for("react.early_return_sentinel"))return y;const v=S;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(ie,{className:"text-emerald-500"}),e[19]=j):j=e[19];const N=`Agent created: ${h.title}`;let k;e[20]!==l?(k=n.jsx(te,{latency:l}),e[20]=l,e[21]=k):k=e[21];let _;e[22]!==N||e[23]!==k?(_=n.jsx(B,{icon:j,title:N,state:"idle",trailing:k}),e[22]=N,e[23]=k,e[24]=_):_=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w={transition:"transform 0.3s ease-out"},e[25]=w):w=e[25];let T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{ref:c,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[26]=T):T=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I={textAlign:"justify",wordBreak:"break-all"},e[27]=I):I=e[27];let M,C;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:I,"aria-hidden":"true",children:Sl.repeat(6)}),C=n.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[28]=M,e[29]=C):(M=e[28],C=e[29]);let L;e[30]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("img",{ref:f,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[30]=L):L=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx("img",{ref:i,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[31]=R):R=e[31];let F;e[32]!==h.icon||e[33]!==h.title?(F=n.jsx(it,{icon:h.icon,name:h.title,size:"md"}),e[32]=h.icon,e[33]=h.title,e[34]=F):F=e[34];let E;e[35]!==h.title?(E=n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:h.title})}),e[35]=h.title,e[36]=E):E=e[36];let A;e[37]!==F||e[38]!==E?(A=n.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[F,E]}),e[37]=F,e[38]=E,e[39]=A):A=e[39];let z;e[40]!==h.description?(z=h.description&&n.jsx("div",{className:"px-2 pt-1 pr-16",children:n.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:h.description})}),e[40]=h.description,e[41]=z):z=e[41];let O;e[42]!==A||e[43]!==z?(O=n.jsxs("div",{className:"relative",children:[A,z]}),e[42]=A,e[43]=z,e[44]=O):O=e[44];let H;e[45]!==v?(H=v.length>0&&n.jsx(W.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:v.length}),children:n.jsx(ke,{connectionIds:v,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=v,e[46]=H):H=e[46];let U;e[47]!==H?(U=n.jsx("div",{className:"flex-1 min-w-0",children:H}),e[47]=H,e[48]=U):U=e[48];let D;e[49]!==h.id||e[50]!==r?(D=()=>r(h.id),e[49]=h.id,e[50]=r,e[51]=D):D=e[51];const G=`See agent: ${h.title}`;let K;e[52]!==D||e[53]!==G?(K=n.jsx("div",{className:"flex items-center gap-2 shrink-0",children:n.jsx(Se,{size:"sm",className:"h-7",onClick:D,"aria-label":G,children:"See agent"})}),e[52]=D,e[53]=G,e[54]=K):K=e[54];let Y;e[55]!==U||e[56]!==K?(Y=n.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[U,K]}),e[55]=U,e[56]=K,e[57]=Y):Y=e[57];let Q;e[58]!==O||e[59]!==Y?(Q=n.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:n.jsxs("div",{ref:o,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:w,onMouseEnter:u,onMouseMove:x,onMouseLeave:b,children:[T,M,C,L,R,O,Y]})}),e[58]=O,e[59]=Y,e[60]=Q):Q=e[60];let Z;return e[61]!==Q||e[62]!==_?(Z=n.jsxs(n.Fragment,{children:[_,Q]}),e[61]=Q,e[62]=_,e[63]=Z):Z=e[63],Z}function _l(s){return s.connection_id}function wl(s){const e=$.c(24),{agent:t}=s,l=_t();if(!t.id)return null;let r;e[0]!==t.connections?(r=t.connections??[],e[0]=t.connections,e[1]=r):r=e[1];let a;e[2]!==r?(a=r.map(Tl),e[2]=r,e[3]=a):a=e[3];const o=a;let c;e[4]!==t.id||e[5]!==l?(c=()=>l(t.id),e[4]=t.id,e[5]=l,e[6]=c):c=e[6];let f;e[7]!==t.icon||e[8]!==t.title?(f=n.jsx(it,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=f):f=e[9];let i;e[10]!==t.title?(i=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=i):i=e[11];let m;e[12]!==t.description?(m=t.description&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=m):m=e[13];let p;e[14]!==i||e[15]!==m?(p=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i,m]}),e[14]=i,e[15]=m,e[16]=p):p=e[16];let u;e[17]!==o?(u=o.length>0&&n.jsx(W.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:o.length}),children:n.jsx(ke,{connectionIds:o,iconSize:"xs",maxVisibleIcons:3})}),e[17]=o,e[18]=u):u=e[18];let d;return e[19]!==c||e[20]!==f||e[21]!==p||e[22]!==u?(d=n.jsxs("button",{type:"button",onClick:c,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[f,p,u]}),e[19]=c,e[20]=f,e[21]=p,e[22]=u,e[23]=d):d=e[23],d}function Tl(s){return s.connection_id}function Cl(s){const e=$.c(41),{part:t,latency:l}=s,r=je(),{org:a}=be();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const c=o;let f,i,m,p,u,d;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==c){d=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(i=Array.isArray(h?.items)?h.items:[],c==="loading"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=N):N=e[12],d=N;break e}if(c==="approval"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{}),title:"List agents",state:"idle"}),e[13]=N):N=e[13],d=N;break e}if(c==="error"){let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[14]=N):N=e[14];const k=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let _;e[15]!==l?(_=n.jsx(te,{latency:l}),e[15]=l,e[16]=_):_=e[16];let w;e[17]!==k||e[18]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[17]=k,e[18]=_,e[19]=w):w=e[19],d=w;break e}if(i.length===0){let N;e[20]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[20]=N):N=e[20];let k;e[21]!==l?(k=n.jsx(B,{icon:N,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:n.jsx(te,{latency:l})}),e[21]=l,e[22]=k):k=e[22],d=k;break e}const S=i.slice(0,Rt);f=i.length-S.length;let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ie,{className:"text-emerald-500"}),e[23]=y):y=e[23];const v=i.length===1?"1 agent":`${i.length} agents`;let j;e[24]!==l?(j=n.jsx(te,{latency:l}),e[24]=l,e[25]=j):j=e[25],e[26]!==v||e[27]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[26]=v,e[27]=j,e[28]=u):u=e[28],m="mt-2 flex flex-col gap-1.5",p=S.map($l)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=c,e[6]=f,e[7]=i,e[8]=m,e[9]=p,e[10]=u,e[11]=d}else f=e[6],i=e[7],m=e[8],p=e[9],u=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;let x;e[29]!==f||e[30]!==i||e[31]!==r||e[32]!==a?(x=f>0&&n.jsx(At,{count:i.length,noun:"agents",onClick:()=>r({to:"/$org/settings/agents",params:{org:a.slug}})}),e[29]=f,e[30]=i,e[31]=r,e[32]=a,e[33]=x):x=e[33];let g;e[34]!==m||e[35]!==p||e[36]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[34]=m,e[35]=p,e[36]=x,e[37]=g):g=e[37];let b;return e[38]!==u||e[39]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[38]=u,e[39]=g,e[40]=b):b=e[40],b}function $l(s){return n.jsx(wl,{agent:s},s.id)}const Il={active:"bg-emerald-500",inactive:"bg-muted-foreground",error:"bg-destructive"};function Ml(s){const e=$.c(27),{connection:t}=s,l=je(),{org:r}=be(),a=t.slug,o=t.description||t.app_name,c=!a||void 0;let f;e[0]!==l||e[1]!==r||e[2]!==a?(f=()=>a&&l({to:"/$org/settings/connections/$appSlug",params:{org:r.slug,appSlug:a}}),e[0]=l,e[1]=r,e[2]=a,e[3]=f):f=e[3];let i;e[4]!==t.icon||e[5]!==t.title?(i=n.jsx(Ie,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=i):i=e[6];let m;e[7]!==t.title?(m=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=m):m=e[8];let p;e[9]!==o?(p=o&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:o}),e[9]=o,e[10]=p):p=e[10];let u;e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13];const d=Il[t.status]??"bg-muted-foreground";let x;e[14]!==d?(x=V("size-2 shrink-0 rounded-full",d),e[14]=d,e[15]=x):x=e[15];let g;e[16]!==x?(g=n.jsx("span",{className:x,"aria-hidden":"true"}),e[16]=x,e[17]=g):g=e[17];let b;e[18]!==t.status?(b=n.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=b):b=e[19];let h;return e[20]!==c||e[21]!==b||e[22]!==f||e[23]!==i||e[24]!==u||e[25]!==g?(h=n.jsxs("button",{type:"button","aria-disabled":c,onClick:f,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[i,u,g,b]}),e[20]=c,e[21]=b,e[22]=f,e[23]=i,e[24]=u,e[25]=g,e[26]=h):h=e[26],h}function Ll(s){const e=$.c(40),{part:t,latency:l}=s,r=je(),{org:a}=be();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const c=o;let f,i,m,p,u,d;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==c){d=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(i=(Array.isArray(h?.items)?h.items:[]).filter(Al),c==="loading"||c==="approval"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(Te,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=N):N=e[12],d=N;break e}if(c==="error"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Te,{}),e[13]=N):N=e[13];const k=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let _;e[14]!==l?(_=n.jsx(te,{latency:l}),e[14]=l,e[15]=_):_=e[15];let w;e[16]!==k||e[17]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[16]=k,e[17]=_,e[18]=w):w=e[18],d=w;break e}if(i.length===0){let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Te,{}),e[19]=N):N=e[19];let k;e[20]!==l?(k=n.jsx(B,{icon:N,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:n.jsx(te,{latency:l})}),e[20]=l,e[21]=k):k=e[21],d=k;break e}const S=i.slice(0,Rt);f=i.length-S.length;let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Te,{className:"text-emerald-500"}),e[22]=y):y=e[22];const v=i.length===1?"1 connection":`${i.length} connections`;let j;e[23]!==l?(j=n.jsx(te,{latency:l}),e[23]=l,e[24]=j):j=e[24],e[25]!==v||e[26]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[25]=v,e[26]=j,e[27]=u):u=e[27],m="mt-2 flex flex-col gap-1.5",p=S.map(Rl)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=c,e[6]=f,e[7]=i,e[8]=m,e[9]=p,e[10]=u,e[11]=d}else f=e[6],i=e[7],m=e[8],p=e[9],u=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;let x;e[28]!==f||e[29]!==i||e[30]!==r||e[31]!==a?(x=f>0&&n.jsx(At,{count:i.length,noun:"connections",onClick:()=>r({to:"/$org/settings/connections",params:{org:a.slug}})}),e[28]=f,e[29]=i,e[30]=r,e[31]=a,e[32]=x):x=e[32];let g;e[33]!==m||e[34]!==p||e[35]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[33]=m,e[34]=p,e[35]=x,e[36]=g):g=e[36];let b;return e[37]!==u||e[38]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[37]=u,e[38]=g,e[39]=b):b=e[39],b}function Rl(s){return n.jsx(Ml,{connection:s},s.id)}function Al(s){return s.connection_type!=="VIRTUAL"}function zl(){const s=$.c(37),e=Ue(),{sendMessage:t,isStreaming:l,messages:r}=ks(),{org:a}=be(),o=e?.virtualMcpId,{prompts:c}=Ds(a.slug),f=o??null;let i;s[0]!==a.id||s[1]!==a.slug||s[2]!==f?(i={connectionId:f,orgId:a.id,orgSlug:a.slug},s[0]=a.id,s[1]=a.slug,s[2]=f,s[3]=i):i=s[3];const m=bt(i),[p,u]=W.useState(null);if(!o||l||!Ms(o)||!r.some(El))return null;let x;if(s[4]!==c||s[5]!==o){let C;s[7]!==o?(C=L=>L.agentId===o&&L.promptName,s[7]=o,s[8]=C):C=s[8],x=c.find(C),s[4]=c,s[5]=o,s[6]=x}else x=s[6];const g=x;if(!g)return null;let b;s[9]!==m||s[10]!==t?(b=async(C,L)=>{if(!m){Ee.error("MCP client not available");return}try{const R=await Us(m,C.name,L);await t({type:"doc",content:[{type:"paragraph",content:[It({id:C.name,name:Ve(C.name,qe(C._meta)),metadata:R.messages,char:"/",kind:"prompt",args:L}),{type:"text",text:" "}]}]})}catch(R){console.error("[next-action-chip] failed",R),Ee.error("Failed to load prompt. Please try again.")}},s[9]=m,s[10]=t,s[11]=b):b=s[11];const h=b;let S;s[12]!==g._meta||s[13]!==g.arguments||s[14]!==g.description||s[15]!==g.promptName||s[16]!==g.title||s[17]!==h?(S=()=>{const C={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(C.arguments&&C.arguments.length>0){u(C);return}h(C)},s[12]=g._meta,s[13]=g.arguments,s[14]=g.description,s[15]=g.promptName,s[16]=g.title,s[17]=h,s[18]=S):S=s[18];const y=S;let v,j;s[19]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Ws,{size:12,className:"shrink-0 text-purple-500"}),j=n.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),s[19]=v,s[20]=j):(v=s[19],j=s[20]);let N;s[21]!==g.title?(N=n.jsx("span",{className:"truncate",children:g.title}),s[21]=g.title,s[22]=N):N=s[22];let k;s[23]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ct,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),s[23]=k):k=s[23];let _;s[24]!==y||s[25]!==N?(_=n.jsxs("button",{type:"button",onClick:y,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[v,j,N,k]}),s[24]=y,s[25]=N,s[26]=_):_=s[26];let w;s[27]===Symbol.for("react.memo_cache_sentinel")?(w=C=>u(C),s[27]=w):w=s[27];let T;s[28]!==p||s[29]!==h?(T=async C=>{const L=p;u(null),L&&await h(L,C)},s[28]=p,s[29]=h,s[30]=T):T=s[30];let I;s[31]!==p||s[32]!==T?(I=n.jsx(dn,{prompt:p,setPrompt:w,onSubmit:T}),s[31]=p,s[32]=T,s[33]=I):I=s[33];let M;return s[34]!==I||s[35]!==_?(M=n.jsxs(n.Fragment,{children:[_,I]}),s[34]=I,s[35]=_,s[36]=M):M=s[36],M}function El(s){return s.role==="user"||s.parts.some(Pl)}function Pl(s){return s.type==="tool-user_ask"&&s.state==="output-available"}function Fl(s){const e=$.c(5),{parts:t}=s,l=t?.length,r=t?.[t.length-1];let a;e[0]!==r||e[1]!==l?(a={enabled:!0,contentDeps:[l,r]},e[0]=r,e[1]=l,e[2]=a):a=e[2];const{sentinelRef:o}=Lt(a);let c;return e[3]!==o?(c=n.jsx("div",{ref:o,className:"h-0"}),e[3]=o,e[4]=c):c=e[4],c}function Ol(s){const e=new Map;for(let t=s.length-1;t>=0;t--){const l=s[t]?.parts;if(l)for(const r of l){const a=r;if(a.type!=="data-deck-updated")continue;const o=a.data;if(!o?.path)continue;const c=`deck:${o.path}`;e.has(c)||e.set(c,{tabId:Ts(o.path),label:o.name||o.path,kind:o.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Dl(){const s=$.c(9),e=je(),t=_e()?.messages??[],l=Ol(t);if(l.length===0)return null;const r=l.some(Hl),a=l.some(Bl),o=r?a?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",c="flex flex-col gap-1.5 py-2";let f;s[0]!==o?(f=n.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:o}),s[0]=o,s[1]=f):f=s[1];const i="flex flex-wrap gap-2";let m;s[2]!==e?(m=x=>n.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:x.tabId}),replace:!0}),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[x.kind==="deck"?n.jsx(Ne,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Rs,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:x.label})]},x.tabId),s[2]=e,s[3]=m):m=s[3];const p=l.map(m);let u;s[4]!==p?(u=n.jsx("div",{className:i,children:p}),s[4]=p,s[5]=u):u=s[5];let d;return s[6]!==f||s[7]!==u?(d=n.jsxs("div",{className:c,children:[f,u]}),s[6]=f,s[7]=u,s[8]=d):d=s[8],d}function Bl(s){return s.kind==="page"}function Hl(s){return s.kind==="deck"}async function Wl(s,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(s)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function Na(){const s=$.c(2),e=_e()?.messages??[];let t;return s[0]!==e?(t=e.some(Ul),s[0]=e,s[1]=t):t=s[1],t}function Ul(s){return s.parts?.some(ql)}function ql(s){const e=s;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function Vl(s,e){const t=$.c(9),{org:l}=be();let r;t[0]!==s?(r=pe.threadOutputs(s??""),t[0]=s,t[1]=r):r=t[1];let a;t[2]!==l||t[3]!==s?(a=()=>Wl(s??"",l.slug),t[2]=l,t[3]=s,t[4]=a):a=t[4];const o=!!s&&(e?.enabled??!0);let c;return t[5]!==r||t[6]!==a||t[7]!==o?(c={queryKey:r,queryFn:a,enabled:o,staleTime:0},t[5]=r,t[6]=a,t[7]=o,t[8]=c):c=t[8],De(c)}function Gl(s){const e=$.c(20),{file:t}=s,l=je();let r;e[0]!==t.key||e[1]!==l?(r=()=>l({to:".",search:d=>({...d,main:Cs(t.key)}),replace:!0}),e[0]=t.key,e[1]=l,e[2]=r):r=e[2];const a=r;let o;e[3]!==t.filename?(o=n.jsx(js,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=o):o=e[4];let c;e[5]!==t.filename||e[6]!==a?(c=n.jsx("button",{type:"button",onClick:a,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:t.filename,children:t.filename}),e[5]=t.filename,e[6]=a,e[7]=c):c=e[7];const f=`Download ${t.filename}`;let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Nt,{className:"size-3.5"}),e[8]=i):i=e[8];let m;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==f?(m=n.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":f,children:i}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=f,e[12]=m):m=e[12];let p;e[13]!==a?(p=n.jsx(Se,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:a,children:"Open"}),e[13]=a,e[14]=p):p=e[14];let u;return e[15]!==o||e[16]!==c||e[17]!==m||e[18]!==p?(u=n.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[o,c,m,p]}),e[15]=o,e[16]=c,e[17]=m,e[18]=p,e[19]=u):u=e[19],u}function ot(s){return s.split("/").pop()??s}const Jl=/(^|\/)output\//;function Kl(s){const e=new Set;for(const t of s.parts??[]){const l=t;if(l.state==="output-available"){if(l.type==="tool-share_with_user"){const r=l.output?.filename??l.input?.name??(l.input?.source?ot(l.input.source):null);r&&e.add(r)}else if(l.type==="tool-write"){const r=l.input?.path;r&&Jl.test(r)&&e.add(ot(r))}}}return e}function Xl(s){const e=$.c(4),{threadId:t,message:l}=s,r=Kl(l),a=r.size>0;let o;e[0]!==a?(o={enabled:a},e[0]=a,e[1]=o):o=e[1];const{data:c}=Vl(t,o);if(r.size===0)return null;const f=(c??[]).filter(u=>r.has(u.filename));if(f.length===0)return null;const i="flex flex-col gap-1.5 py-2",m=f.map(Ql);let p;return e[2]!==m?(p=n.jsx("div",{className:i,children:m}),e[2]=m,e[3]=p):p=e[3],p}function Ql(s){return n.jsx(Gl,{file:s},s.key)}function Yl(s){return s.type==="reasoning"}function Zl(s){const e=[],t=new Set,l=new Map,r=new Map,a=new Map;if(s){let c=null;for(let f=0;f<s.parts.length;f++){const i=s.parts[f];if(Yl(i)){c||(c={parts:[],startIndex:f},e.push(c)),c.parts.push(i),t.add(f);continue}if(c=null,i.type==="data-tool-metadata"&&"id"in i&&"data"in i){const m=i.data,p={};m.annotations&&(p.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(p.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(p.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(p._meta=m._meta),l.set(i.id,p);continue}if(i.type==="data-tool-subtask-metadata"&&"id"in i){r.set(i.id,i.data);continue}if(i.type==="data-web-search"&&"id"in i&&"data"in i){const m=i.id,p=i.data;a.set(m,p.text??"");continue}}}const o=[];if(s){let c=[],f=[];const i=new Set,m=()=>{for(const p of c)i.has(p)||(i.add(p),o.push({kind:"reasoning-group",group:p}));for(const p of f)o.push({kind:"part",index:p.index});c=[],f=[]};for(let p=0;p<s.parts.length;p++){const u=s.parts[p];if(u.type==="step-start"){m();continue}if(t.has(p)){const d=e.find(x=>x.startIndex===p);d&&c.push(d);continue}u.type.startsWith("data-")||f.push({index:p})}m()}return{reasoningGroups:e,renderOrder:o,dataParts:{toolMetadata:l,toolSubtaskMetadata:r,webSearchStreaming:a}}}function Dt(s){const e=$.c(9),{since:t}=s;let l;e[0]!==t?(l=()=>Qe(t,Date.now()),e[0]=t,e[1]=l):l=e[1];const[r,a]=W.useState(l);let o,c;e[2]!==t?(o=()=>{const p=setInterval(()=>a(Qe(t,Date.now())),100);return()=>clearInterval(p)},c=[t],e[2]=t,e[3]=o,e[4]=c):(o=e[3],c=e[4]),W.useEffect(o,c);const f=r/1e3;let i;e[5]!==f?(i=de(f),e[5]=f,e[6]=i):i=e[6];let m;return e[7]!==i?(m=n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:i}),e[7]=i,e[8]=m):m=e[8],m}const Bt=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function eo(){const s=$.c(5),[e]=W.useState(to);let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},s[0]=t):t=s[0];let l;s[1]!==e?(l=Bt.map((a,o)=>{const{delay:c}=a;return n.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[o],animation:"grid-ripple 1s ease infinite",animationDelay:`${c}ms`}},o)}),s[1]=e,s[2]=l):l=s[2];let r;return s[3]!==l?(r=n.jsx("div",{className:"grid",style:t,children:l}),s[3]=l,s[4]=r):r=s[4],r}function to(){const s=`var(--chart-${Math.ceil(Math.random()*5)})`;return Bt.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":s)}const so={planning:{icon:n.jsx(as,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:n.jsx(He,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},no=1200;function lo(){const s=$.c(7),[e,t]=W.useState("planning");let l,r;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const f=setTimeout(()=>{t("thinking")},no);return()=>{clearTimeout(f)}},r=[],s[0]=l,s[1]=r):(l=s[0],r=s[1]),W.useEffect(l,r);const a=so[e];let o;s[2]!==a.label?(o=n.jsxs("span",{className:"text-[14px] text-muted-foreground shimmer",children:[a.label,"..."]}),s[2]=a.label,s[3]=o):o=s[3];let c;return s[4]!==a.icon||s[5]!==o?(c=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[a.icon,o]})}),s[4]=a.icon,s[5]=o,s[6]=c):c=s[6],c}function oo(s){const e=$.c(3),{startedAt:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(eo,{}),e[0]=l):l=e[0];let r;return e[1]!==t?(r=n.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[l,n.jsx(Dt,{since:t})]}),e[1]=t,e[2]=r):r=e[2],r}const ao=2e4;function ro(s){const e=$.c(11),{startedAt:t}=s;ms(1e3);const l=_e(),a=(t!==null?Date.now()-t:0)>=ao;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(lo,{}),e[0]=o):o=e[0];let c;e[1]!==t?(c=t!==null&&n.jsx("span",{className:"opacity-60",children:n.jsx(Dt,{since:t})}),e[1]=t,e[2]=c):c=e[2];let f;e[3]!==c?(f=n.jsxs("div",{className:"flex items-center gap-2",children:[o,c]}),e[3]=c,e[4]=f):f=e[4];let i;e[5]!==a||e[6]!==l?(i=a&&l?.stop&&n.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[n.jsx("span",{children:"This is taking longer than usual."}),n.jsx("button",{type:"button",onClick:()=>l.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Cancel"})]}),e[5]=a,e[6]=l,e[7]=i):i=e[7];let m;return e[8]!==f||e[9]!==i?(m=n.jsxs("div",{className:"flex flex-col gap-0.5",children:[f,i]}),e[8]=f,e[9]=i,e[10]=m):m=e[10],m}function io(s){const e=$.c(20),{duration:t,parts:l,isStreaming:r}=s;let a;e[0]!==l?(a=l.every(fo),e[0]=l,e[1]=a):a=e[1];const o=a;let c;e[2]!==t?(c=t&&t/1e3>1?`Thought for ${de(t/1e3)}`:"Thought",e[2]=t,e[3]=c):c=e[3];const f=c;let i;if(e[4]!==o||e[5]!==r||e[6]!==l){const y=l.map(uo).join(`
43
- `).trim().split(`
44
- `).filter(Boolean),v=r?y[y.length-1]??"":y[0]??"";i=!o&&v?v.length>100?v.slice(0,100)+"…":v:void 0,e[4]=o,e[5]=r,e[6]=l,e[7]=i}else i=e[7];const m=i;let p;if(e[8]!==o||e[9]!==l){const S=l.map(co).join(`
45
-
46
- `);p=!o&&S.trim()?S:null,e[8]=o,e[9]=l,e[10]=p}else p=e[10];const u=p,d=!r&&t!=null?t/1e3:void 0;let x;e[11]!==r?(x=r?n.jsx(He,{className:"size-4"}):n.jsx(os,{className:"size-4"}),e[11]=r,e[12]=x):x=e[12];const g=r?"Thinking...":f,b=r?"loading":"idle";let h;return e[13]!==u||e[14]!==d||e[15]!==m||e[16]!==x||e[17]!==g||e[18]!==b?(h=n.jsx(B,{icon:x,title:g,summary:m,detail:u,state:b,detailVariant:"prose",latency:d}),e[13]=u,e[14]=d,e[15]=m,e[16]=x,e[17]=g,e[18]=b,e[19]=h):h=e[19],h}function co(s){return s.text??""}function uo(s){return s.text??""}function fo(s){return s.text?.includes("REDACTED")}const mo=3;function po(s,e){let t=-1;for(let l=s.length-1;l>=0;l--){const r=s[l];if(r.kind==="part"&&e[r.index]?.type==="text"){t=l;break}}return t===-1?{collapsed:[],tail:s}:{collapsed:s.slice(0,t),tail:s.slice(t)}}function xo(s,e){let t=0,l=0;for(const r of s)if(r.kind==="reasoning-group")l++;else{const a=e[r.index]?.type;a==="text"?l++:(a==="dynamic-tool"||a?.startsWith("tool-"))&&a!=="tool-todo_write"&&a!=="tool-update_interests"&&t++}return{toolCalls:t,messages:l}}function go(s){const e=$.c(8),{toolCalls:t,messages:l}=s;let r;e[0]!==l||e[1]!==t?(r=t>0&&n.jsxs(n.Fragment,{children:[n.jsx(us,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[t," tool call",t===1?"":"s",l>0?",":""]})]}),e[0]=l,e[1]=t,e[2]=r):r=e[2];let a;e[3]!==l?(a=l>0&&n.jsxs(n.Fragment,{children:[n.jsx(rs,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[l," message",l===1?"":"s"]})]}),e[3]=l,e[4]=a):a=e[4];let o;return e[5]!==r||e[6]!==a?(o=n.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[r,a]}),e[5]=r,e[6]=a,e[7]=o):o=e[7],o}function ho(s){const e=$.c(28),{items:t,message:l,reasoningGroups:r,isReasoningActive:a,totalDuration:o,dataParts:c,isLoading:f,isLast:i}=s;let m;e[0]!==t||e[1]!==l.parts?(m=xo(t,l.parts),e[0]=t,e[1]=l.parts,e[2]=m):m=e[2];const{toolCalls:p,messages:u}=m;if(p===0&&u===0)return null;let d;e[3]!==u||e[4]!==p?(d=n.jsx(go,{toolCalls:p,messages:u}),e[3]=u,e[4]=p,e[5]=d):d=e[5];let x;if(e[6]!==c||e[7]!==i||e[8]!==f||e[9]!==a||e[10]!==t||e[11]!==l||e[12]!==r||e[13]!==o){let h;e[15]!==c||e[16]!==i||e[17]!==f||e[18]!==a||e[19]!==l||e[20]!==r||e[21]!==o?(h=(S,y)=>Ht({item:S,renderIndex:y,message:l,reasoningGroups:r,isReasoningActive:a,totalDuration:o,dataParts:c,isLoading:f,isLast:i,isLastVisiblePart:!1}),e[15]=c,e[16]=i,e[17]=f,e[18]=a,e[19]=l,e[20]=r,e[21]=o,e[22]=h):h=e[22],x=t.map(h),e[6]=c,e[7]=i,e[8]=f,e[9]=a,e[10]=t,e[11]=l,e[12]=r,e[13]=o,e[14]=x}else x=e[14];let g;e[23]!==x?(g=n.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:x}),e[23]=x,e[24]=g):g=e[24];let b;return e[25]!==d||e[26]!==g?(b=n.jsx(B,{icon:null,alwaysChevron:!0,title:d,state:"idle",children:g}),e[25]=d,e[26]=g,e[27]=b):b=e[27],b}function Ht({item:s,renderIndex:e,message:t,reasoningGroups:l,isReasoningActive:r,totalDuration:a,dataParts:o,isLoading:c,isLast:f,isLastVisiblePart:i,renderOrder:m}){if(s.kind==="reasoning-group"){const{group:x}=s,g=x===l[l.length-1],b=r&&g;if(!x.parts.some(y=>y.text?.trim())&&!b)return null;const S=l.length===1?a:null;return n.jsx(io,{duration:S,parts:x.parts,isStreaming:b},`${t.id}-reasoning-${x.startIndex}`)}const p=t.parts[s.index],u=i||(m?m.findLastIndex(x=>x.kind==="part")===e:!1),d=u?Ct(Tt(),t.metadata?.usage):null;return n.jsx(bo,{part:p,id:t.id,usageStats:u&&n.jsx(jn,{usage:d,duration:a}),dataParts:o,isLoading:c,isLastMessage:f},`${t.id}-${s.index}`)}function bo(s){const e=$.c(121),{part:t,id:l,usageStats:r,dataParts:a,isLoading:o,isLastMessage:c}=s;let f;e[0]!==a.toolMetadata?(f=u=>a.toolMetadata.get(u),e[0]=a.toolMetadata,e[1]=f):f=e[1];const i=f;let m;e[2]!==a.toolSubtaskMetadata?(m=u=>a.toolSubtaskMetadata.get(u),e[2]=a.toolSubtaskMetadata,e[3]=m):m=e[3];const p=m;switch(t.type){case"dynamic-tool":{let u;e[4]!==i||e[5]!==t.toolCallId?(u=i(t.toolCallId)?.annotations,e[4]=i,e[5]=t.toolCallId,e[6]=u):u=e[6];let d;e[7]!==i||e[8]!==t.toolCallId?(d=i(t.toolCallId)?.latencySeconds,e[7]=i,e[8]=t.toolCallId,e[9]=d):d=e[9];let x;e[10]!==i||e[11]!==t.toolCallId?(x=i(t.toolCallId)?.outputBytes,e[10]=i,e[11]=t.toolCallId,e[12]=x):x=e[12];let g;e[13]!==i||e[14]!==t.toolCallId?(g=i(t.toolCallId)?._meta,e[13]=i,e[14]=t.toolCallId,e[15]=g):g=e[15];let b;return e[16]!==c||e[17]!==t||e[18]!==u||e[19]!==d||e[20]!==x||e[21]!==g?(b=n.jsx(tt,{part:t,annotations:u,latency:d,outputBytes:x,isLastMessage:c,toolMeta:g}),e[16]=c,e[17]=t,e[18]=u,e[19]=d,e[20]=x,e[21]=g,e[22]=b):b=e[22],b}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let u;e[23]!==i||e[24]!==t.toolCallId?(u=i(t.toolCallId)?.latencySeconds,e[23]=i,e[24]=t.toolCallId,e[25]=u):u=e[25];let d;return e[26]!==t||e[27]!==u?(d=n.jsx(el,{part:t,latency:u}),e[26]=t,e[27]=u,e[28]=d):d=e[28],d}case"tool-propose_plan":{let u;return e[29]!==t?(u=n.jsx(ll,{part:t}),e[29]=t,e[30]=u):u=e[30],u}case"tool-generate_image":{let u;e[31]!==i||e[32]!==t.toolCallId?(u=i(t.toolCallId)?.latencySeconds,e[31]=i,e[32]=t.toolCallId,e[33]=u):u=e[33];let d;return e[34]!==t||e[35]!==u?(d=n.jsx(On,{part:t,latency:u}),e[34]=t,e[35]=u,e[36]=d):d=e[36],d}case"tool-take_screenshot":{let u;e[37]!==i||e[38]!==t.toolCallId?(u=i(t.toolCallId)?.latencySeconds,e[37]=i,e[38]=t.toolCallId,e[39]=u):u=e[39];let d;return e[40]!==t||e[41]!==u?(d=n.jsx(Hn,{part:t,latency:u}),e[40]=t,e[41]=u,e[42]=d):d=e[42],d}case"tool-web_search":{let u;e[43]!==i||e[44]!==t.toolCallId?(u=i(t.toolCallId)?.latencySeconds,e[43]=i,e[44]=t.toolCallId,e[45]=u):u=e[45];let d;e[46]!==a.webSearchStreaming||e[47]!==t.toolCallId?(d=a.webSearchStreaming.get(t.toolCallId),e[46]=a.webSearchStreaming,e[47]=t.toolCallId,e[48]=d):d=e[48];let x;return e[49]!==t||e[50]!==u||e[51]!==d?(x=n.jsx(Zn,{part:t,latency:u,streamingText:d}),e[49]=t,e[50]=u,e[51]=d,e[52]=x):x=e[52],x}case"tool-subtask":{let u;e[53]!==p||e[54]!==t.toolCallId?(u=p(t.toolCallId),e[53]=p,e[54]=t.toolCallId,e[55]=u):u=e[55];let d;e[56]!==i||e[57]!==t.toolCallId?(d=i(t.toolCallId)?.annotations,e[56]=i,e[57]=t.toolCallId,e[58]=d):d=e[58];let x;e[59]!==i||e[60]!==t.toolCallId?(x=i(t.toolCallId)?.latencySeconds,e[59]=i,e[60]=t.toolCallId,e[61]=x):x=e[61];let g;e[62]!==t||e[63]!==u||e[64]!==d||e[65]!==x?(g={part:t,subtaskMeta:u,annotations:d,latency:x},e[62]=t,e[63]=u,e[64]=d,e[65]=x,e[66]=g):g=e[66];const b=g;let h;return e[67]!==b?(h=n.jsx(W.Suspense,{fallback:n.jsx(sl,{...b}),children:n.jsx(nl,{...b})}),e[67]=b,e[68]=h):h=e[68],h}case"text":{const u=!!r&&!o,d=o&&c;let x;return e[69]!==l||e[70]!==t||e[71]!==u||e[72]!==d||e[73]!==r?(x=n.jsx(Ge,{id:l,part:t,extraActions:r,copyable:!0,alwaysShowActions:u,animate:d}),e[69]=l,e[70]=t,e[71]=u,e[72]=d,e[73]=r,e[74]=x):x=e[74],x}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const u=t;if(u.type==="tool-brand_context_setup"||u.type==="tool-BRAND_CONTEXT_EXTRACT"){let d;e[75]!==u.toolCallId||e[76]!==i?(d=i(u.toolCallId)?.latencySeconds,e[75]=u.toolCallId,e[76]=i,e[77]=d):d=e[77];let x;return e[78]!==u||e[79]!==d?(x=n.jsx(gl,{part:u,latency:d}),e[78]=u,e[79]=d,e[80]=x):x=e[80],x}if(u.type==="tool-BRAND_CONTEXT_GET"){let d;e[81]!==u.toolCallId||e[82]!==i?(d=i(u.toolCallId)?.latencySeconds,e[81]=u.toolCallId,e[82]=i,e[83]=d):d=e[83];let x;return e[84]!==u||e[85]!==d?(x=n.jsx(hl,{part:u,latency:d}),e[84]=u,e[85]=d,e[86]=x):x=e[86],x}if(u.type==="tool-BRAND_CONTEXT_LIST"){let d;e[87]!==u.toolCallId||e[88]!==i?(d=i(u.toolCallId)?.latencySeconds,e[87]=u.toolCallId,e[88]=i,e[89]=d):d=e[89];let x;return e[90]!==u||e[91]!==d?(x=n.jsx(bl,{part:u,latency:d}),e[90]=u,e[91]=d,e[92]=x):x=e[92],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let d;e[93]!==u.toolCallId||e[94]!==i?(d=i(u.toolCallId)?.latencySeconds,e[93]=u.toolCallId,e[94]=i,e[95]=d):d=e[95];let x;return e[96]!==u||e[97]!==d?(x=n.jsx(kl,{part:u,latency:d}),e[96]=u,e[97]=d,e[98]=x):x=e[98],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let d;e[99]!==u.toolCallId||e[100]!==i?(d=i(u.toolCallId)?.latencySeconds,e[99]=u.toolCallId,e[100]=i,e[101]=d):d=e[101];let x;return e[102]!==u||e[103]!==d?(x=n.jsx(Cl,{part:u,latency:d}),e[102]=u,e[103]=d,e[104]=x):x=e[104],x}if(u.type==="tool-COLLECTION_CONNECTIONS_LIST"){let d;e[105]!==u.toolCallId||e[106]!==i?(d=i(u.toolCallId)?.latencySeconds,e[105]=u.toolCallId,e[106]=i,e[107]=d):d=e[107];let x;return e[108]!==u||e[109]!==d?(x=n.jsx(Ll,{part:u,latency:d}),e[108]=u,e[109]=d,e[110]=x):x=e[110],x}if(u.type.startsWith("tool-")){const d=u.toolCallId;let x;e[111]!==a.toolMetadata||e[112]!==d?(x=a.toolMetadata.get(d),e[111]=a.toolMetadata,e[112]=d,e[113]=x):x=e[113];const g=x,b=g?.annotations,h=g?.latencySeconds,S=g?.outputBytes,y=g?._meta;let v;return e[114]!==u||e[115]!==c||e[116]!==b||e[117]!==h||e[118]!==S||e[119]!==y?(v=n.jsx(tt,{part:u,annotations:b,latency:h,outputBytes:S,isLastMessage:c,toolMeta:y}),e[114]=u,e[115]=c,e[116]=b,e[117]=h,e[118]=S,e[119]=y,e[120]=v):v=e[120],v}if(u.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${u.type}`)}}}function yo(s){const e=$.c(2),{isRunInProgress:t}=s;if(t){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(He,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),n.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=r):r=e[0],r}let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=l):l=e[1],l}function jo(s){const e=$.c(7),{className:t,children:l}=s;let r;e[0]!==t?(r=V("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==l?(a=n.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:n.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:l})}),e[2]=l,e[3]=a):a=e[3];let o;return e[4]!==r||e[5]!==a?(o=n.jsx("div",{className:r,children:a}),e[4]=r,e[5]=a,e[6]=o):o=e[6],o}function vo(s){const e=$.c(42),{message:t,turnStartedAt:l,status:r,className:a,isLast:o}=s,c=o===void 0?!1:o,{isRunInProgress:f}=_e()??{},i=f===void 0?!1:f,m=Ue()?.taskId??null,p=r==="streaming",d=p||r==="submitted";let x;e[0]!==l?(x=fs(l),e[0]=l,e[1]=x):x=e[1];const g=x;let b;e[2]!==d?(b=()=>d?Date.now():null,e[2]=d,e[3]=b):b=e[3];const[h,S]=W.useState(b),[y,v]=W.useState(d);y!==d&&(v(d),S(d?Date.now():null));const j=g??h,N=t!==null&&t.parts.length>0,{reasoningGroups:k,renderOrder:_,dataParts:w}=Zl(t),T=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,I=p&&T?.type==="reasoning";let M;if(e[4]!==t){const D=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,G=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;M=D!==null?G.getTime()-D.getTime():null,e[4]=t,e[5]=M}else M=e[5];const C=M;let L;e[6]!==c||e[7]!==t?(L=!c||!t||!t.parts.some(So),e[6]=c,e[7]=t,e[8]=L):L=e[8];const R=L;let F;e[9]!==N||e[10]!==d||e[11]!==R||e[12]!==t||e[13]!==_?(F=!d&&N&&R&&(()=>{let D=0;for(const G of _)if(G.kind==="part"){const K=t.parts[G.index]?.type;(K==="dynamic-tool"||K?.startsWith("tool-"))&&D++}return D>=mo})(),e[9]=N,e[10]=d,e[11]=R,e[12]=t,e[13]=_,e[14]=F):F=e[14];const E=F;let A,z,O;if(e[15]!==a||e[16]!==w||e[17]!==N||e[18]!==c||e[19]!==d||e[20]!==I||e[21]!==i||e[22]!==R||e[23]!==t||e[24]!==k||e[25]!==_||e[26]!==E||e[27]!==j||e[28]!==m||e[29]!==C){const{collapsed:D,tail:G}=E?po(_,t.parts):{collapsed:[],tail:_};A=jo,z=a,O=N?n.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[D.length>0&&n.jsx(ho,{items:D,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:d,isLast:c}),G.map((K,Y)=>{const Q=D.length+Y,Z=G.findLastIndex(No)===Y;return Ht({item:K,renderIndex:Q,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:d,isLast:c,isLastVisiblePart:Z,renderOrder:_})}),m&&n.jsx(Xl,{threadId:m,message:t}),c&&d&&j!==null&&n.jsx(oo,{startedAt:j}),c&&!d&&m&&n.jsxs(n.Fragment,{children:[n.jsx(Dl,{}),R&&n.jsx(zl,{})]})]}):d?n.jsx(ro,{startedAt:j}):n.jsx(yo,{isRunInProgress:c&&i}),e[15]=a,e[16]=w,e[17]=N,e[18]=c,e[19]=d,e[20]=I,e[21]=i,e[22]=R,e[23]=t,e[24]=k,e[25]=_,e[26]=E,e[27]=j,e[28]=m,e[29]=C,e[30]=A,e[31]=z,e[32]=O}else A=e[30],z=e[31],O=e[32];let H;e[33]!==c||e[34]!==p||e[35]!==t?.parts?(H=c&&p&&n.jsx(Fl,{parts:t?.parts}),e[33]=c,e[34]=p,e[35]=t?.parts,e[36]=H):H=e[36];let U;return e[37]!==A||e[38]!==H||e[39]!==z||e[40]!==O?(U=n.jsxs(A,{className:z,children:[O,H]}),e[37]=A,e[38]=H,e[39]=z,e[40]=O,e[41]=U):U=e[41],U}function No(s){return s.kind==="part"}function So(s){const e=s.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=s.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function ko(s){const e=$.c(21),{event:t}=s,[l,r]=W.useState(!1);let a;e[0]!==t.data?(a=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=a):a=e[1];const o=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>r(_o),e[2]=c):c=e[2];let f,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(is,{className:"size-4 shrink-0 text-muted-foreground"}),i=n.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=f,e[4]=i):(f=e[3],i=e[4]);let m;e[5]!==t.type?(m=n.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=m):m=e[6];const p=l&&"rotate-180";let u;e[7]!==p?(u=V("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[7]=p,e[8]=u):u=e[8];let d;e[9]!==u?(d=n.jsx(ln,{className:u}),e[9]=u,e[10]=d):d=e[10];let x;e[11]!==m||e[12]!==d?(x=n.jsxs("button",{type:"button",onClick:c,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[f,i,m,d]}),e[11]=m,e[12]=d,e[13]=x):x=e[13];let g;e[14]!==t.source||e[15]!==l||e[16]!==o?(g=l&&n.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[n.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:o})]}),e[14]=t.source,e[15]=l,e[16]=o,e[17]=g):g=e[17];let b;return e[18]!==g||e[19]!==x?(b=n.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[x,g]}),e[18]=g,e[19]=x,e[20]=b):b=e[20],b}function _o(s){return!s}const wo=[bs.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),pn,bn];function To(s){const e=$.c(5),{tiptapDoc:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=l):l=e[0];let r;e[1]!==t?(r={extensions:wo,content:t,editable:!1,editorProps:l},e[1]=t,e[2]=r):r=e[2];const a=hs(r);if(!a)return null;let o;return e[3]!==a?(o=n.jsx(ys,{editor:a,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=a,e[4]=o):o=e[4],o}function Co(s){const e=$.c(33),{message:t,className:l,onScrollToPair:r}=s,{id:a,parts:o,metadata:c}=t,[f,i]=W.useState(!1),[m,p]=W.useState(!1),u=W.useRef(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=C=>{C&&!u.current&&(u.current=!0,p(C.scrollHeight>C.clientHeight))},e[0]=d):d=e[0];const x=d;if(!o||o.length===0)return null;let g;e[1]!==r?(g=()=>{i(!0),r?.()},e[1]=r,e[2]=g):g=e[2];const b=g,h=c?.tiptapDoc;let S;e[3]!==l?(S=V("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",l),e[3]=l,e[4]=S):S=e[4];let y,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>i(!0),v=()=>i(!1),e[5]=y,e[6]=v):(y=e[5],v=e[6]);let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=j):j=e[7];let N;e[8]!==f||e[9]!==m?(N=V("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",f?"max-h-[50vh] overflow-auto opacity-100":V("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=f,e[9]=m,e[10]=N):N=e[10];let k;if(e[11]!==a||e[12]!==o){let C;e[14]!==a?(C=(L,R)=>L.type==="data-trigger-event"?n.jsx(ko,{event:L.data},`${a}-${R}`):null,e[14]=a,e[15]=C):C=e[15],k=o.map(C),e[11]=a,e[12]=o,e[13]=k}else k=e[13];let _;e[16]!==h||e[17]!==a||e[18]!==c||e[19]!==o?(_=h?n.jsx(To,{tiptapDoc:c.tiptapDoc}):o.map((C,L)=>C.type==="text"?o[L-1]?.type==="data-trigger-event"?null:n.jsx(Ge,{id:a,part:C},`${a}-${L}`):null),e[16]=h,e[17]=a,e[18]=c,e[19]=o,e[20]=_):_=e[20];let w;e[21]!==k||e[22]!==_?(w=n.jsxs("div",{className:"flex flex-col gap-2",children:[k,_]}),e[21]=k,e[22]=_,e[23]=w):w=e[23];let T;e[24]!==w||e[25]!==N?(T=n.jsx("div",{ref:x,className:N,children:w}),e[24]=w,e[25]=N,e[26]=T):T=e[26];let I;e[27]!==b||e[28]!==T?(I=n.jsxs("div",{tabIndex:0,onClick:b,onFocus:y,onBlur:v,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[j,T]}),e[27]=b,e[28]=T,e[29]=I):I=e[29];let M;return e[30]!==I||e[31]!==S?(M=n.jsx(n.Fragment,{children:n.jsx("div",{className:S,children:I})}),e[30]=I,e[31]=S,e[32]=M):M=e[32],M}function Sa(s){const e=[],t=s.filter(l=>l.role!=="system");for(let l=0;l<t.length;l++){const r=t[l];if(r)if(r.role==="user"){const a=t[l+1];a&&a.role==="assistant"?(e.push({user:r,assistant:a}),l++):e.push({user:r,assistant:null})}else r.role==="assistant"&&e.push({user:null,assistant:r})}return e}function ka(s){const e=$.c(18),{pair:t,isLastPair:l,status:r}=s,a=W.useRef(null),o=W.useRef(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{a.current&&a.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=c):c=e[0];const f=c;let i;e[1]!==l||e[2]!==r?(i=h=>{if(a.current=h,!l||!h||o.current)return;if(o.current=!0,r==="submitted"||r==="streaming"){h.scrollIntoView({behavior:"smooth",block:"start"});return}const S=h.closest("[data-chat-scroller]");S?S.scrollTop=S.scrollHeight:h.scrollIntoView({behavior:"instant",block:"start"})},e[1]=l,e[2]=r,e[3]=i):i=e[3];const m=i,p=!t.user&&"pt-8 sm:pt-6";let u;e[4]!==p?(u=V("flex flex-col pb-2 sm:pb-2",p),e[4]=p,e[5]=u):u=e[5];let d;e[6]!==t.user?(d=t.user&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),n.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:n.jsx(Co,{message:t.user,onScrollToPair:f})})]}),e[6]=t.user,e[7]=d):d=e[7];const x=t.user?.created_at??null;let g;e[8]!==l||e[9]!==t.assistant||e[10]!==r||e[11]!==x?(g=n.jsx(vo,{message:t.assistant,turnStartedAt:x,status:r,isLast:l}),e[8]=l,e[9]=t.assistant,e[10]=r,e[11]=x,e[12]=g):g=e[12];let b;return e[13]!==m||e[14]!==u||e[15]!==d||e[16]!==g?(b=n.jsxs("div",{ref:m,className:u,children:[d,g]}),e[13]=m,e[14]=u,e[15]=d,e[16]=g,e[17]=b):b=e[17],b}export{vn as C,bn as F,eo as G,Ge as M,Gl as O,dn as P,va as S,Vl as a,Nn as b,ba as c,Sn as d,It as e,rn as f,qe as g,Mt as h,ja as i,ya as j,fn as k,pn as l,Sa as m,ka as n,Ve as s,$t as t,Na as u};
@@ -1 +0,0 @@
1
- import{e as H,q as $,j}from"./index-CpG2_v8p.js";import{h as q,g as O,s as b}from"./pair-D1IR0Baq.js";import{u as v}from"./use-mcp-client-BDuQ-DKr.js";import{a as L,c as B}from"./use-mcp-tools-xqS_ta53.js";import{c as Y}from"./content-blocks-o63cs2vh.js";import{g as k,M as G,a as E}from"./types-DIAQ40QE.js";import{a as V,c as z}from"./chat-context-BoAn6xWM.js";import{u as F}from"./shell-layout-NuYzN-Gn.js";import"./agent-icon-C_8D2J-7.js";import"./AlertCircle-CIkJ_tva.js";import"./Tool01-BxT6lP7E.js";import"./SwitchHorizontal01-Bsjx9paN.js";import"./RefreshCcw01-D1X4YmG3.js";import"./XCircle-DkwGk6Y1.js";import"./ArrowUpRight-DjtsYmlk.js";import"./ZapSquare-BqiIusHB.js";import"./Users03-DT_R5tz6.js";import"./CheckCircle-DyJzuYoS.js";import"./Check-DZ5PZYLO.js";import"./ChevronDown-CGeYjJAK.js";import"./ChevronLeft-DWiixe45.js";import"./ChevronRight-Bm_e-tIB.js";import"./ChevronUp-BCv26pBY.js";import"./DotsVertical-CqB_Aadi.js";import"./Container-DNJNU1b4.js";import"./Eye-MkeUTfT3.js";import"./ZoomOut-zDFXRspK.js";import"./Globe01-xZhhj276.js";import"./FilterLines-CfVg89f7.js";import"./Star01-4yFjK6bh.js";import"./Palette-CmO3ZuPu.js";import"./HardDrive-CtdIy8yR.js";import"./Stars02-BLn35DBB.js";import"./Key01-CXIWciFj.js";import"./LayoutLeft-CJ48TbRA.js";import"./LinkExternal01-Bi6In-BW.js";import"./Monitor01-CsSfQSQt.js";import"./Sun-FelsR2hx.js";import"./Play-CQ97sIka.js";import"./Plus-CTho-g8m.js";import"./SearchMd-BVJBwCEd.js";import"./Settings02-Cqx4N2is.js";import"./Shield01-D5OMek_B.js";import"./Stars01-DWbsIFJF.js";import"./Trash01-BczIIm5v.js";import"./Upload01-nIFiyRcG.js";import"./User01-CamUMrWb.js";import"./Users01-CgFieXMp.js";import"./XClose-D72Lt3NI.js";import"./X-CRg5TH_Y.js";import"./Zap-B-Fg7TEp.js";import"./use-clock-tick-Dkz_tj-X.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./scroll-area-CFrtCBLi.js";import"./select-B0qONt_m.js";import"./tooltip-D5r7nYKO.js";import"./use-copy-CP7WU0J2.js";import"./file-type-icon-9WcINLx3.js";import"./dialog-DzWL-NrT.js";import"./tab-id-Cgg9_UqF.js";import"./decopilot-sse-pool-CJ_QbSiL.js";import"./create-sse-subscription-BS5983N4.js";import"./studio-tools-Cly5ZCG3.js";import"./integration-icon-Jhe4mXPc.js";import"./use-virtual-mcp-BOy7A3-I.js";import"./use-collections-dzWuZTM5.js";import"./use-navigate-to-agent-CLdhXO-i.js";import"./use-connection-CbBvGv-y.js";import"./use-mcp-prompts-BfczuqQ1.js";import"./form-DK41bruw.js";import"./label-BD30ND7M.js";import"./input-BWjbzzQM.js";import"./spinner-B8QiOf4h.js";import"./use-ai-providers-BMK8G5pd.js";import"./use-organization-settings-ofRxNgFR.js";import"./avatar-Bf_YMKWh.js";import"./required-auth-layout-CzrHHdU9.js";import"./useRouterState-BIyanAgq.js";import"./use-org-sso-BO0DGPVQ.js";const J={};function K(S){const t=H.c(37),{client:r,resourceURI:g,tool:e,connectionId:s,orgId:a,args:c}=S,{sendMessage:u}=V(),{setAppContext:d,clearAppContext:o}=z(),{setChatOpen:f,openTab:m}=F(),p=`${s}:${e.name}`;let l;t[0]!==m?(l=h=>h==="inline"?(m("0"),"inline"):"fullscreen",t[0]=m,t[1]=l):l=t[1];const i=l,n=c??J;let T;t[2]!==r||t[3]!==e.name||t[4]!==n?(T={client:r,toolName:e.name,toolArguments:n},t[2]=r,t[3]=e.name,t[4]=n,t[5]=T):T=t[5];const{data:x}=B(T);let R;if(t[6]!==e._meta||t[7]!==e.name){const h=O(e._meta);R=b(e.name,h),t[6]=e._meta,t[7]=e.name,t[8]=R}else R=t[8];const U=R;let I;t[9]!==e.inputSchema?(I=e.inputSchema??{type:"object"},t[9]=e.inputSchema,t[10]=I):I=t[10];let N;t[11]!==U||t[12]!==I||t[13]!==e?(N={...e,name:U,inputSchema:I},t[11]=U,t[12]=I,t[13]=e,t[14]=N):N=t[14];const y=N;let _;t[15]!==u||t[16]!==f?(_=h=>{const w=Y(h.content);w.content.length>0&&(f(!0),u({tiptapDoc:w}))},t[15]=u,t[16]=f,t[17]=_):_=t[17];const D=_;let C;t[18]!==y?(C={tool:y},t[18]=y,t[19]=C):C=t[19];let M;t[20]!==d||t[21]!==p?(M=h=>d(p,h),t[20]=d,t[21]=p,t[22]=M):M=t[22];let P;t[23]!==o||t[24]!==p?(P=()=>o(p),t[23]=o,t[24]=p,t[25]=P):P=t[25];let A;return t[26]!==r||t[27]!==D||t[28]!==i||t[29]!==a||t[30]!==g||t[31]!==C||t[32]!==M||t[33]!==P||t[34]!==n||t[35]!==x?(A=j.jsx(G,{resourceURI:g,orgId:a,toolInfo:C,toolInput:n,toolResult:x,displayMode:"fullscreen",minHeight:E.fullscreen.minHeight,maxHeight:E.fullscreen.maxHeight,client:r,onMessage:D,onUpdateModelContext:M,onTeardown:P,onRequestDisplayMode:i,className:"h-full"}),t[26]=r,t[27]=D,t[28]=i,t[29]=a,t[30]=g,t[31]=C,t[32]=M,t[33]=P,t[34]=n,t[35]=x,t[36]=A):A=t[36],A}function Pe(S){const t=H.c(20),{connectionId:r,toolName:g,args:e}=S,{org:s}=$();let a;t[0]!==r||t[1]!==s.id||t[2]!==s.slug?(a={connectionId:r,orgId:s.id,orgSlug:s.slug},t[0]=r,t[1]=s.id,t[2]=s.slug,t[3]=a):a=t[3];const c=v(a);let u;t[4]!==c?(u={client:c},t[4]=c,t[5]=u):u=t[5];const{data:d}=L(u);let o,f,m;t[6]!==g||t[7]!==d.tools?(o=q(decodeURIComponent(g)),m=d.tools.find(i=>i.name===o)??d.tools.find(i=>{const n=O(i._meta);if(!n)return!1;if(b(i.name,n)===o)return!0;const x=b(o,n);return x!==o&&i.name===x}),f=m?._meta?k(m._meta):void 0,t[6]=g,t[7]=d.tools,t[8]=o,t[9]=f,t[10]=m):(o=t[8],f=t[9],m=t[10]);const p=f;if(!m||!p){let i;return t[11]!==o?(i=j.jsx("div",{className:"flex items-center justify-center h-full w-full",children:j.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',o,'" not found or has no UI']})}),t[11]=o,t[12]=i):i=t[12],i}let l;return t[13]!==e||t[14]!==c||t[15]!==r||t[16]!==s.id||t[17]!==p||t[18]!==m?(l=j.jsx(K,{client:c,resourceURI:p,tool:m,connectionId:r,orgId:s.id,args:e}),t[13]=e,t[14]=c,t[15]=r,t[16]=s.id,t[17]=p,t[18]=m,t[19]=l):l=t[19],l}export{Pe as AppViewContent};