decocms 4.77.3 → 4.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/dist/client/assets/{AlertCircle-DFFB807G.js → AlertCircle-MC4CJN2u.js} +1 -1
  2. package/dist/client/assets/{AreaChart-oIJCSonG.js → AreaChart-CKdhf7VE.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-CFU7eduC.js → ArrowUp-CDvmrJ6W.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-D37SsWBk.js → ArrowUpRight-B9KRcnSr.js} +1 -1
  5. package/dist/client/assets/{Check-BAiULwRg.js → Check-cn_meqVT.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BwwAyNzV.js → CheckCircle-B1AmIxvb.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-Cpk84lU5.js → ChevronDown-NXwJat-t.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-UlscOqp6.js → ChevronRight-BkyR6Gh2.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CqCnswy_.js → ChevronUp-BKni5Kl1.js} +1 -1
  10. package/dist/client/assets/{Circle-pOPoWDQn.js → Circle-CoJFprpO.js} +1 -1
  11. package/dist/client/assets/{Copy01-BEB5hDKQ.js → Copy01-B6bJiU3v.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-BFfMlorx.js → DotsVertical-C2uB--5c.js} +1 -1
  13. package/dist/client/assets/{Eye-Bbh_ejV6.js → Eye-sbrSKx56.js} +1 -1
  14. package/dist/client/assets/{FilterLines-Dm0WP1zI.js → FilterLines-BpZjngDE.js} +1 -1
  15. package/dist/client/assets/{Flag01-e55mynPF.js → Flag01-BoiQJLhV.js} +1 -1
  16. package/dist/client/assets/{Globe01-DVm51A__.js → Globe01-BcDHoZMB.js} +1 -1
  17. package/dist/client/assets/{Globe04-DA8QsMrW.js → Globe04-C6kLd29T.js} +1 -1
  18. package/dist/client/assets/{HardDrive-BJ2MS6we.js → HardDrive-D9fiWG_3.js} +1 -1
  19. package/dist/client/assets/{Image01-Y4d3ZI2r.js → Image01-D3O5mi00.js} +1 -1
  20. package/dist/client/assets/{Key01-xPUeBTf6.js → Key01-K0MDmi9m.js} +1 -1
  21. package/dist/client/assets/{LayoutLeft-CNWN8tpf.js → LayoutLeft-BjRudRyw.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-B6bTrNoI.js → LinkExternal01-UQyEtlk5.js} +1 -1
  23. package/dist/client/assets/{List-gTaMGV9z.js → List-B8ULg1gV.js} +1 -1
  24. package/dist/client/assets/{Monitor01-BdI_dCjX.js → Monitor01-CdYhNIqN.js} +1 -1
  25. package/dist/client/assets/{Package-WlP_SelV.js → Package-22bugwqB.js} +1 -1
  26. package/dist/client/assets/{Palette-DwivsXKp.js → Palette-BKYjG_Wo.js} +1 -1
  27. package/dist/client/assets/{Play-BPQdBfbt.js → Play-DnlhcxHH.js} +1 -1
  28. package/dist/client/assets/{Plus-C8FiAr3i.js → Plus-fmH0NLI5.js} +1 -1
  29. package/dist/client/assets/{SearchLg-CMWIHllt.js → SearchLg-TKwhc8Bj.js} +1 -1
  30. package/dist/client/assets/{SearchMd-Gwm-384G.js → SearchMd-DA0-KDiX.js} +1 -1
  31. package/dist/client/assets/{Settings02-D5c8FtUa.js → Settings02-jMJjtHW9.js} +1 -1
  32. package/dist/client/assets/{Shield01-Dn6encQp.js → Shield01-BMARQ75B.js} +1 -1
  33. package/dist/client/assets/{Star01-C32-NjaL.js → Star01-B75nBxkS.js} +1 -1
  34. package/dist/client/assets/{Stars01-C8WemEnv.js → Stars01-Bao1JtUg.js} +1 -1
  35. package/dist/client/assets/{Stars02-CzKVb8lE.js → Stars02-8YQoTenj.js} +1 -1
  36. package/dist/client/assets/{Sun-BPhwV-Eh.js → Sun-CY23h1v7.js} +1 -1
  37. package/dist/client/assets/{SwitchHorizontal01-C8Rnw5uG.js → SwitchHorizontal01-KBjs_jDr.js} +1 -1
  38. package/dist/client/assets/{Tool01-CSravChF.js → Tool01-CN1_r45u.js} +1 -1
  39. package/dist/client/assets/{Tool02-csu1mOp1.js → Tool02-BaHC7p6k.js} +1 -1
  40. package/dist/client/assets/{Trash01-DZTkGJqE.js → Trash01-BmD2x8hq.js} +1 -1
  41. package/dist/client/assets/{TrendUp01-Dw2DNRxA.js → TrendUp01-DRH2LRR-.js} +1 -1
  42. package/dist/client/assets/{Upload01-s2ES1URH.js → Upload01-Bcbd6SO1.js} +1 -1
  43. package/dist/client/assets/{User01-D0_zDlJM.js → User01-KKzWqyMk.js} +1 -1
  44. package/dist/client/assets/{UserPlus01-DjFNU1Mn.js → UserPlus01-PUjyP7xk.js} +1 -1
  45. package/dist/client/assets/{Users01-CAC4FOXB.js → Users01-DrqxRqvw.js} +1 -1
  46. package/dist/client/assets/{Users03-Iz-TpUuJ.js → Users03-D5nKq5Zv.js} +1 -1
  47. package/dist/client/assets/{X-CTTK5Zj2.js → X-D4qfglsn.js} +1 -1
  48. package/dist/client/assets/{XCircle-CiVL5z-e.js → XCircle-Cnz7pnmF.js} +1 -1
  49. package/dist/client/assets/{XClose-DxMKQUUD.js → XClose-KYFsn0L_.js} +1 -1
  50. package/dist/client/assets/{Zap-CrYnUVJy.js → Zap-Dlla6YUZ.js} +1 -1
  51. package/dist/client/assets/{ZapSquare-BDp8YrcS.js → ZapSquare-CozZbGC_.js} +1 -1
  52. package/dist/client/assets/{ZoomOut-CvmU5uj5.js → ZoomOut-DbbfChZH.js} +1 -1
  53. package/dist/client/assets/{access-gate-Bw06fv-s.js → access-gate-b-Jw4VvS.js} +1 -1
  54. package/dist/client/assets/{add-section-modal-BUwFQaqb.js → add-section-modal-WjseCefh.js} +1 -1
  55. package/dist/client/assets/{agent-icon-jdj2JAEm.js → agent-icon-CnFJncsU.js} +1 -1
  56. package/dist/client/assets/agents-list-Bt6c3IA7.js +1 -0
  57. package/dist/client/assets/ai-providers-DUnpe_UQ.js +1 -0
  58. package/dist/client/assets/{alert-U_1RTm6v.js → alert-Ctrgd039.js} +1 -1
  59. package/dist/client/assets/{alert-dialog-DtmlB9JL.js → alert-dialog-B3jXNKAT.js} +1 -1
  60. package/dist/client/assets/app-editor-7IUCmt2i.js +1 -0
  61. package/dist/client/assets/{auth-BR_fNNK7.js → auth-CmDvGM_p.js} +1 -1
  62. package/dist/client/assets/{auth-catchall-Dwo94U32.js → auth-catchall-BFvFPL6J.js} +1 -1
  63. package/dist/client/assets/{auth-entry-CsuZU0Hz.js → auth-entry-vjywuOuE.js} +1 -1
  64. package/dist/client/assets/{auth-split-layout-HOd3Qhyr.js → auth-split-layout-C81ApvW_.js} +1 -1
  65. package/dist/client/assets/{authenticate-and-persist-oauth-BuaZSTeD.js → authenticate-and-persist-oauth-CPYKBKnA.js} +1 -1
  66. package/dist/client/assets/{automation-list-row-BuCXNsSo.js → automation-list-row-CxtmRxoQ.js} +1 -1
  67. package/dist/client/assets/{automation-runs-nQ99AMoV.js → automation-runs-KI44WFTQ.js} +1 -1
  68. package/dist/client/assets/automations-DxZctOwG.js +1 -0
  69. package/dist/client/assets/{autosend-CIDdvZqc.js → autosend-DVJtIiSy.js} +1 -1
  70. package/dist/client/assets/{avatar-DJpRqbqg.js → avatar-hWW2DOJ5.js} +1 -1
  71. package/dist/client/assets/{badge-zT-Fh3qN.js → badge-ClvUyOER.js} +1 -1
  72. package/dist/client/assets/{block-document-2XwXLkCF.js → block-document-a4BmJw8K.js} +1 -1
  73. package/dist/client/assets/{brand-context-CzRgrT9p.js → brand-context-C8Ix1LuB.js} +1 -1
  74. package/dist/client/assets/{buckets-BbJLX44L.js → buckets-i7tkYiXe.js} +1 -1
  75. package/dist/client/assets/{bulk-category-panel-CAMc8JnB.js → bulk-category-panel-DacnDZ0P.js} +1 -1
  76. package/dist/client/assets/{calendar-CibxNjt0.js → calendar-D7ErCpqJ.js} +1 -1
  77. package/dist/client/assets/{capability-load-error-BEzrfkB_.js → capability-load-error-vuuAezzu.js} +1 -1
  78. package/dist/client/assets/{card-CEUspnmz.js → card-gGbD7uzE.js} +1 -1
  79. package/dist/client/assets/category-editor-DqRcunqE.js +1 -0
  80. package/dist/client/assets/chat-context-BMvwowZa.js +34 -0
  81. package/dist/client/assets/{checkbox-C7atZRmN.js → checkbox-DyEr8WZh.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-DAwaPZJZ.js → cli-auth-success-Ba62G5UU.js} +1 -1
  83. package/dist/client/assets/collection-detail-rA4poIYn.js +1 -0
  84. package/dist/client/assets/{collection-display-button-WEEgaqOV.js → collection-display-button-X1ZHJpAJ.js} +1 -1
  85. package/dist/client/assets/{collection-search-BLJH2aa6.js → collection-search-BLC1wkT6.js} +1 -1
  86. package/dist/client/assets/{collection-table-wrapper-Bs9ViQbC.js → collection-table-wrapper-Jb0Vzcev.js} +1 -1
  87. package/dist/client/assets/{collection-tabs-D10lR104.js → collection-tabs-EiSD9pPR.js} +1 -1
  88. package/dist/client/assets/{command-Cih9cb-G.js → command-BYZRh7Un.js} +1 -1
  89. package/dist/client/assets/commerce-onboarding-DWux_6Zz.js +1 -0
  90. package/dist/client/assets/companions-core-DLWNGUQE.js +1 -0
  91. package/dist/client/assets/{connect-desktop-dialog-B4c48mz3.js → connect-desktop-dialog-SkFp4-fK.js} +1 -1
  92. package/dist/client/assets/{connection-card-DPw_9IvV.js → connection-card-CAklKRBd.js} +1 -1
  93. package/dist/client/assets/{connection-detail-CDG1VEQ1.js → connection-detail-8dKgwdaU.js} +1 -1
  94. package/dist/client/assets/{connection-form-helpers-svNTHB1P.js → connection-form-helpers-BiD69C66.js} +1 -1
  95. package/dist/client/assets/{connections-DOceib-0.js → connections-Cxl8yAvr.js} +1 -1
  96. package/dist/client/assets/{decopilot-sse-pool-pi1pVqbX.js → decopilot-sse-pool-DAyFX7c0.js} +1 -1
  97. package/dist/client/assets/{dialog-BboVhzku.js → dialog-Bc70YzBB.js} +1 -1
  98. package/dist/client/assets/{domain-settings-Dg0Enr4v.js → domain-settings-CxCMfmR2.js} +1 -1
  99. package/dist/client/assets/{drawer-D5XLtSzP.js → drawer-hNM8Zzn6.js} +1 -1
  100. package/dist/client/assets/{dropdown-menu-DcV4HAvf.js → dropdown-menu-CLthmv2L.js} +1 -1
  101. package/dist/client/assets/{empty-state-C6JrR5eZ.js → empty-state-DqtyRC39.js} +1 -1
  102. package/dist/client/assets/{extract-connection-data-DEmXsdA0.js → extract-connection-data-BScsDwBx.js} +1 -1
  103. package/dist/client/assets/file-explorer-DiIfFa6G.js +2 -0
  104. package/dist/client/assets/{file-type-icon-BR1G8n26.js → file-type-icon-eliK4cHR.js} +1 -1
  105. package/dist/client/assets/{files-uX2RLUIk.js → files-kbLU4Yjc.js} +1 -1
  106. package/dist/client/assets/{form-p6ZihW38.js → form-BplqXc_T.js} +1 -1
  107. package/dist/client/assets/{general-pRqMY7to.js → general-CzHaZcNU.js} +1 -1
  108. package/dist/client/assets/github-repo-picker-DbmhhMvi.js +1 -0
  109. package/dist/client/assets/github-repo-scope-DjMZbiKa.js +1 -0
  110. package/dist/client/assets/{hooks-DYM3Q-Vq.js → hooks-BU0YCEnQ.js} +1 -1
  111. package/dist/client/assets/{index-DmYBKzjc.js → index-3iH-snQS.js} +1 -1
  112. package/dist/client/assets/{index-Bbk1PCkR.js → index-56Lvflig.js} +1 -1
  113. package/dist/client/assets/index-B5kIIanX.js +2 -0
  114. package/dist/client/assets/{index-BTfVRtBq.js → index-BK244FDW.js} +1 -1
  115. package/dist/client/assets/{index-Bnro1Vjb.js → index-BNpkZfof.js} +28 -28
  116. package/dist/client/assets/index-BNs3YygR.js +1 -0
  117. package/dist/client/assets/{index-BN6_Cjv8.js → index-BZhMDITt.js} +1 -1
  118. package/dist/client/assets/index-BpnK1A01.js +173 -0
  119. package/dist/client/assets/{index-Dz8rxMiO.js → index-Bww1xuar.js} +1 -1
  120. package/dist/client/assets/{index-BEqdT-CX.js → index-C7XcxFcf.js} +3 -3
  121. package/dist/client/assets/{index-BXTPhNSj.js → index-DC_inVns.js} +1 -1
  122. package/dist/client/assets/{index-BXfKOYdf.js → index-DGkpnMCo.js} +1 -1
  123. package/dist/client/assets/{index-hWnZ5W-G.js → index-DswFc6mR.js} +2 -2
  124. package/dist/client/assets/{index-B06wwOYR.js → index-d2-g1cb5.js} +1 -1
  125. package/dist/client/assets/{index-redirect-CTPXAnic.js → index-redirect-DP7ALRx4.js} +1 -1
  126. package/dist/client/assets/{input-CqfDyI-C.js → input-KbRt12Tc.js} +1 -1
  127. package/dist/client/assets/{integration-icon-Dhyv93zr.js → integration-icon-CJ5xLVIx.js} +1 -1
  128. package/dist/client/assets/{invite-member-dialog-BhSkjT-N.js → invite-member-dialog-Bx0ZPaDs.js} +1 -1
  129. package/dist/client/assets/{label-DbwTUWd9.js → label-CA94UmZU.js} +1 -1
  130. package/dist/client/assets/{layout-BBgXJHVj.js → layout-D2StDK75.js} +1 -1
  131. package/dist/client/assets/location-BpLtHjTZ.js +1 -0
  132. package/dist/client/assets/{login-Ml29AK4n.js → login-D6XF_XJ3.js} +1 -1
  133. package/dist/client/assets/{mcp-oauth-CeGeftbL.js → mcp-oauth-Ccq1VLyZ.js} +1 -1
  134. package/dist/client/assets/{members-D5IT4H1V.js → members-Bu257Ra_.js} +1 -1
  135. package/dist/client/assets/{monaco-editor-YwujFe9g.js → monaco-editor-DegQ6sUD.js} +1 -1
  136. package/dist/client/assets/{monitoring-stats-row-CQqHLPvk.js → monitoring-stats-row-B-cJxm0J.js} +1 -1
  137. package/dist/client/assets/{multi-select-B1FaaLCf.js → multi-select-D3Ta2keD.js} +1 -1
  138. package/dist/client/assets/{oauth-callback-B-ebprV-.js → oauth-callback-B2H-FOvB.js} +1 -1
  139. package/dist/client/assets/{oauth-callback-ai-provider-DPqgkHzz.js → oauth-callback-ai-provider-MteaMReF.js} +1 -1
  140. package/dist/client/assets/{onboarding-3CEMDgie.js → onboarding-NZFsF4AL.js} +1 -1
  141. package/dist/client/assets/{org-install-C-mvhkMd.js → org-install-fP3hcRWK.js} +1 -1
  142. package/dist/client/assets/{org-layout-CXafMRKl.js → org-layout-l59R2YVm.js} +1 -1
  143. package/dist/client/assets/{organization-choice-D3k9ZPpO.js → organization-choice-CYku1Q9K.js} +1 -1
  144. package/dist/client/assets/{orgs-Xyph7dZi.js → orgs-C6B5Hp-n.js} +1 -1
  145. package/dist/client/assets/{page-seo-form-55rMBIi9.js → page-seo-form-CgaxuJPt.js} +1 -1
  146. package/dist/client/assets/page-seo-sheet-B3DQq42q.js +1 -0
  147. package/dist/client/assets/{popover-BJYBT3EY.js → popover-Cm-wfyAj.js} +1 -1
  148. package/dist/client/assets/post-editor-CTdOmVSR.js +1 -0
  149. package/dist/client/assets/{primitives-QqbAbc1Q.js → primitives-Cx-HYlvI.js} +1 -1
  150. package/dist/client/assets/{profile-CgJpwyXB.js → profile-DYuuH_zq.js} +1 -1
  151. package/dist/client/assets/project-app-view-Bj9rYTbh.js +1 -0
  152. package/dist/client/assets/provision-repo-scoped-github-connection-2iDn-wQ1.js +1 -0
  153. package/dist/client/assets/record-editor-Bta3C-s5.js +1 -0
  154. package/dist/client/assets/redirect-editor-CjIIdTOb.js +1 -0
  155. package/dist/client/assets/registry-C6Qv2JSB.js +2 -0
  156. package/dist/client/assets/{registry-layout-qd98OrCw.js → registry-layout-I8XwNnrZ.js} +1 -1
  157. package/dist/client/assets/{reports-Don6tc4i.js → reports-RCEY804D.js} +1 -1
  158. package/dist/client/assets/{require-capability-9_BT8d0_.js → require-capability-B3XpXfOz.js} +1 -1
  159. package/dist/client/assets/{required-auth-layout-BXaZVxWQ.js → required-auth-layout-DlqYTbd0.js} +1 -1
  160. package/dist/client/assets/{reset-password-BTQg39kb.js → reset-password-jEsHE0ZX.js} +1 -1
  161. package/dist/client/assets/{roles-CMByu1Mi.js → roles-tWzAumB7.js} +1 -1
  162. package/dist/client/assets/{search-input-CYwO2ZSV.js → search-input-BaYbM0ir.js} +1 -1
  163. package/dist/client/assets/{secrets-BHEJh0I9.js → secrets-BWW1Y54j.js} +1 -1
  164. package/dist/client/assets/{sections-editor-BjlPsEWB.js → sections-editor-DvsMahVH.js} +2 -2
  165. package/dist/client/assets/{select-Bh2Z8rK3.js → select-DjGlEfn_.js} +1 -1
  166. package/dist/client/assets/{select-model-BHB_Fir_.js → select-model-D6Mphu5F.js} +1 -1
  167. package/dist/client/assets/{self-tool-result-BkP7cEqy.js → self-tool-result-Cof0h4dl.js} +1 -1
  168. package/dist/client/assets/seo-editor-DxPE9LrR.js +1 -0
  169. package/dist/client/assets/{settings-layout-DX2Oqcs9.js → settings-layout-aq9RbRQA.js} +1 -1
  170. package/dist/client/assets/{settings-section-HiisdE7T.js → settings-section-bExdMe2b.js} +1 -1
  171. package/dist/client/assets/{shell-controls-Dsv9TiVE.js → shell-controls-CpjAEXs5.js} +1 -1
  172. package/dist/client/assets/{shell-layout-CcPRSmgX.js → shell-layout-CG1JoyZM.js} +1 -1
  173. package/dist/client/assets/{sidebar-CRtkHPvX.js → sidebar-Cayljdng.js} +1 -1
  174. package/dist/client/assets/{skeleton-C-LbiBGP.js → skeleton-WPUSGA-E.js} +1 -1
  175. package/dist/client/assets/{sso-CHr6NXev.js → sso-BTU8lQxJ.js} +1 -1
  176. package/dist/client/assets/store-registry-xseDv1eI.js +2 -0
  177. package/dist/client/assets/{store-CJu8MR_n.js → store-wWLjBOqa.js} +1 -1
  178. package/dist/client/assets/{studio-tools-Cdt3UzXo.js → studio-tools-UDfc8K6F.js} +1 -1
  179. package/dist/client/assets/{switch-BL8XQR8K.js → switch-NxSbpBE9.js} +1 -1
  180. package/dist/client/assets/{table-VOE9WRkg.js → table-BuB0d-SX.js} +1 -1
  181. package/dist/client/assets/{tabs-DPmfTv0c.js → tabs-B1nWdfKC.js} +1 -1
  182. package/dist/client/assets/{textarea-B9g6Z2-r.js → textarea-CznXQAMB.js} +1 -1
  183. package/dist/client/assets/{toggle-group-BnuMLJr8.js → toggle-group-CaR55Dw5.js} +1 -1
  184. package/dist/client/assets/{toolbar-65iromlk.js → toolbar-DCWHrgb1.js} +1 -1
  185. package/dist/client/assets/{toolbar-icon-button-BBh2Csxi.js → toolbar-icon-button-BAeXIWt5.js} +1 -1
  186. package/dist/client/assets/{tooltip-C7c-Tgru.js → tooltip-D_eFEfV_.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-C7iVrgY-.js → use-ai-providers-LBDz2ckP.js} +1 -1
  188. package/dist/client/assets/{use-automations-CELpHT79.js → use-automations-CrBQkTWf.js} +1 -1
  189. package/dist/client/assets/{use-autosave-B1tnyn5H.js → use-autosave-ByiQun2_.js} +1 -1
  190. package/dist/client/assets/{use-capability-DsC1r5oD.js → use-capability-Dk5qq1e4.js} +1 -1
  191. package/dist/client/assets/{use-clock-tick-F8Oybd0p.js → use-clock-tick-CwtHoPgO.js} +1 -1
  192. package/dist/client/assets/{use-collections-Dy7WD_eH.js → use-collections-D4kOf7Iw.js} +1 -1
  193. package/dist/client/assets/{use-connection-DUpx0NEA.js → use-connection-Bp25Y6WP.js} +1 -1
  194. package/dist/client/assets/{use-copy-C0FUXmsm.js → use-copy-DzRxhxcP.js} +1 -1
  195. package/dist/client/assets/{use-create-virtual-mcp-Bbp45Sum.js → use-create-virtual-mcp-5-qhMskg.js} +1 -1
  196. package/dist/client/assets/{use-debounced-autosave-IEMI4Muz.js → use-debounced-autosave-C4zvCGEl.js} +1 -1
  197. package/dist/client/assets/{use-debounced-value-BqHYI-kn.js → use-debounced-value-CYeVdtFT.js} +1 -1
  198. package/dist/client/assets/{use-deco-credits-56-eyw-E.js → use-deco-credits-DVZwHNTh.js} +1 -1
  199. package/dist/client/assets/{use-decopilot-events-btxE-D2k.js → use-decopilot-events-CzAhCyN4.js} +1 -1
  200. package/dist/client/assets/{use-delete-connection-BCTMhr9Z.js → use-delete-connection-DZ6FYXvh.js} +1 -1
  201. package/dist/client/assets/{use-deployment-admin-D9-LjGCb.js → use-deployment-admin-CRS6kmM4.js} +1 -1
  202. package/dist/client/assets/{use-file-configs-CYmkQ98g.js → use-file-configs-B7LjlMZ2.js} +1 -1
  203. package/dist/client/assets/{use-infinite-scroll-DYbbFqLK.js → use-infinite-scroll-CoiXCNO-.js} +1 -1
  204. package/dist/client/assets/{use-join-requests-DZ4YwkLh.js → use-join-requests-B1s3JyLi.js} +1 -1
  205. package/dist/client/assets/{use-mcp-auth-status-Dy_Y2kKR.js → use-mcp-auth-status-CmyAwddJ.js} +1 -1
  206. package/dist/client/assets/{use-mcp-client-DvvHwezb.js → use-mcp-client-DytjKx7J.js} +1 -1
  207. package/dist/client/assets/{use-mcp-tools-Be4djRS3.js → use-mcp-tools-DGWNLEPk.js} +1 -1
  208. package/dist/client/assets/{use-members-BZPSqMOT.js → use-members-BQxCfk2b.js} +1 -1
  209. package/dist/client/assets/{use-mobile-DbBFg2WD.js → use-mobile-CIOByvVM.js} +1 -1
  210. package/dist/client/assets/{use-navigate-to-agent-CBi1-FBB.js → use-navigate-to-agent-DxwBpha3.js} +1 -1
  211. package/dist/client/assets/{use-org-auth-client-PHOIKqSH.js → use-org-auth-client-DdUSkkkk.js} +1 -1
  212. package/dist/client/assets/{use-org-sso-BA_UxewI.js → use-org-sso-ChlkeTDk.js} +1 -1
  213. package/dist/client/assets/{use-organization-roles-DDd0H73X.js → use-organization-roles-CW2a7AvK.js} +1 -1
  214. package/dist/client/assets/{use-organization-settings-CpbybQHD.js → use-organization-settings-DQCnuypy.js} +1 -1
  215. package/dist/client/assets/use-registry-app-fFCSg7fY.js +1 -0
  216. package/dist/client/assets/{use-registry-connections-CX_dlku1.js → use-registry-connections-CyOAouKU.js} +1 -1
  217. package/dist/client/assets/{use-secrets-ChIMRFxc.js → use-secrets-DrOp4WyO.js} +1 -1
  218. package/dist/client/assets/{use-status-sounds-BrRSDeZW.js → use-status-sounds-DrEeScBS.js} +1 -1
  219. package/dist/client/assets/{use-view-mode-C9HP0iNa.js → use-view-mode-BWOzKU0m.js} +1 -1
  220. package/dist/client/assets/{use-virtual-mcp-CNKe_WaY.js → use-virtual-mcp-DoKUvbm2.js} +1 -1
  221. package/dist/client/assets/useInfiniteQuery-Dzyz7I6W.js +1 -0
  222. package/dist/client/assets/{useRouterState-Bq6lDwd7.js → useRouterState-m5tMoyKs.js} +1 -1
  223. package/dist/client/assets/useSuspenseInfiniteQuery-BIAbn-uL.js +1 -0
  224. package/dist/client/assets/{users-DMEyTKsO.js → users-DTb6HCzc.js} +1 -1
  225. package/dist/client/assets/variant-calendar-BlWdPx5-.js +1 -0
  226. package/dist/client/assets/{view-mode-toggle-CyQ3mWd3.js → view-mode-toggle-DxtoYWkX.js} +1 -1
  227. package/dist/client/index.html +1 -1
  228. package/dist/server/cli.js +112 -110
  229. package/dist/server/server.js +4 -2
  230. package/package.json +1 -1
  231. package/dist/client/assets/agents-list-DZ3h25ic.js +0 -1
  232. package/dist/client/assets/ai-providers-azn7N2Yk.js +0 -1
  233. package/dist/client/assets/app-editor-Be08LQCr.js +0 -1
  234. package/dist/client/assets/automations-DB43wI7K.js +0 -1
  235. package/dist/client/assets/category-editor-DSqWbwsH.js +0 -1
  236. package/dist/client/assets/chat-context-CAoh3qxf.js +0 -28
  237. package/dist/client/assets/collection-detail-D0xuaTFw.js +0 -1
  238. package/dist/client/assets/commerce-onboarding-OnAQudmo.js +0 -1
  239. package/dist/client/assets/companions-core-Zwoux9HO.js +0 -1
  240. package/dist/client/assets/file-explorer-LHYs3ZjT.js +0 -2
  241. package/dist/client/assets/github-repo-picker-B_QoRL-b.js +0 -1
  242. package/dist/client/assets/index-BoB4jtNg.js +0 -1
  243. package/dist/client/assets/index-CbMrlBFr.js +0 -2
  244. package/dist/client/assets/index-S6xdCjXr.js +0 -173
  245. package/dist/client/assets/page-seo-sheet-D7RIqvrG.js +0 -1
  246. package/dist/client/assets/post-editor-DLBj2cKN.js +0 -1
  247. package/dist/client/assets/project-app-view-9_icLawb.js +0 -1
  248. package/dist/client/assets/provision-repo-scoped-github-connection-CB4ICKHq.js +0 -1
  249. package/dist/client/assets/record-editor-oee2Qj_I.js +0 -1
  250. package/dist/client/assets/redirect-editor-BtYgxzY9.js +0 -1
  251. package/dist/client/assets/registry-Dl1tv9V3.js +0 -2
  252. package/dist/client/assets/seo-editor-DwFM6IEi.js +0 -1
  253. package/dist/client/assets/store-registry-EZCYrXqX.js +0 -2
  254. package/dist/client/assets/useInfiniteQuery-BnNR1NVs.js +0 -1
  255. package/dist/client/assets/useSuspenseInfiniteQuery-3QrNhYz_.js +0 -1
  256. package/dist/client/assets/variant-calendar-CYVo9qj3.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "4.77.3",
3
+ "version": "4.79.0",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{c as ie,j as s,B as J,C as ce,n as fe,a as he,r as K,m as ge,K as ee,d as xe,p as $,t as te,l as je}from"./index-BEqdT-CX.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-DcV4HAvf.js";import{a as be}from"./Users03-Iz-TpUuJ.js";import{a as me,b as Ce,G as ye}from"./github-repo-picker-B_QoRL-b.js";import{u as we,b as _e,c as Ne}from"./use-virtual-mcp-CNKe_WaY.js";import{P as X}from"./index-BXTPhNSj.js";import{i as Se}from"./DotsVertical-BFfMlorx.js";import{a as ve,b as Ie}from"./Settings02-D5c8FtUa.js";import{s as De}from"./Trash01-DZTkGJqE.js";import{A as Ae,aw as Ee}from"./agent-icon-jdj2JAEm.js";import{c as ue}from"./use-navigate-to-agent-CBi1-FBB.js";import{C as Te}from"./card-CEUspnmz.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as ke}from"./use-capability-DsC1r5oD.js";import{E as Le}from"./empty-state-C6JrR5eZ.js";import{u as Ge}from"./use-create-virtual-mcp-Bbp45Sum.js";import{u as Oe}from"./use-connection-DUpx0NEA.js";import{u as re}from"./use-mcp-client-DvvHwezb.js";import{S as Pe}from"./constants-D_FQAPnt.js";import{g as ze,f as Me,a as $e,p as He}from"./provision-repo-scoped-github-connection-CB4ICKHq.js";import{e as Fe,d as Re,D as Ue,a as Be,c as Ve}from"./dialog-BboVhzku.js";import{C as Ke}from"./collection-search-BLJH2aa6.js";import{c as qe,b as Qe,d as Je,A as We,e as Ye,g as Xe,a as Ze,f as et}from"./alert-dialog-DtmlB9JL.js";import{S as tt}from"./search-input-CYwO2ZSV.js";import{s as le}from"./Plus-C8FiAr3i.js";import"./Check-BAiULwRg.js";import"./ChevronRight-UlscOqp6.js";import"./Circle-pOPoWDQn.js";import"./use-debounced-value-BqHYI-kn.js";import"./authenticate-and-persist-oauth-BuaZSTeD.js";import"./mcp-oauth-CeGeftbL.js";import"./auth-BR_fNNK7.js";import"./use-mcp-tools-Be4djRS3.js";import"./extract-connection-data-DEmXsdA0.js";import"./use-collections-Dy7WD_eH.js";import"./sidebar-CRtkHPvX.js";import"./LayoutLeft-CNWN8tpf.js";import"./use-mobile-DbBFg2WD.js";import"./X-CTTK5Zj2.js";import"./tooltip-C7c-Tgru.js";import"./AlertCircle-DFFB807G.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Tool02-csu1mOp1.js";import"./XCircle-CiVL5z-e.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./ZoomOut-CvmU5uj5.js";import"./CheckCircle-BwwAyNzV.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronUp-CqCnswy_.js";import"./Stars02-CzKVb8lE.js";import"./Copy01-BEB5hDKQ.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./SearchLg-CMWIHllt.js";import"./SearchMd-Gwm-384G.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./Zap-CrYnUVJy.js";import"./hooks-DYM3Q-Vq.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=ie.c(19),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:l,isCreating:b,align:C,side:d,showBetaBadge:g}=t,y=C===void 0?"end":C;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(be,{size:14}),e[0]=x):x=e[0];let m;e[1]!==b||e[2]!==i?(m=s.jsxs(Y,{disabled:b,onClick:i,children:[x,"Create from scratch"]}),e[1]=b,e[2]=i,e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(me,{className:"size-3.5"}),e[4]=f):f=e[4];let a;e[5]!==g?(a=g&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[5]=g,e[6]=a):a=e[6];let h;e[7]!==n||e[8]!==a?(h=s.jsxs(Y,{onClick:n,children:[f,"Import from GitHub",a]}),e[7]=n,e[8]=a,e[9]=h):h=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[10]=c):c=e[10];let r;e[11]!==l?(r=s.jsxs(Y,{onClick:l,children:[c,"Import from deco.cx"]}),e[11]=l,e[12]=r):r=e[12];let u;return e[13]!==y||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==r?(u=s.jsxs(de,{side:d,align:y,className:"w-48",children:[m,h,r]}),e[13]=y,e[14]=d,e[15]=m,e[16]=h,e[17]=r,e[18]=u):u=e[18],u}function st(t){const e=ie.c(45),{project:i,lastUsedAt:n,onDeleteClick:l}=t,b=ue();let C;e[0]!==b||e[1]!==i.id?(C=()=>b(i.id),e[0]=b,e[1]=i.id,e[2]=C):C=e[2];let d;e[3]!==i.title||e[4]!==C?(d=s.jsx("button",{type:"button",onClick:C,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=C,e[5]=d):d=e[5];let g;e[6]!==i.icon||e[7]!==i.title?(g=s.jsx(Ae,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=g):g=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Se,{size:20})})}),e[9]=y):y=e[9];let x;e[10]!==b||e[11]!==i.id?(x=()=>b(i.id,{search:{main:"settings"}}),e[10]=b,e[11]=i.id,e[12]=x):x=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(ve,{size:16}),e[13]=m):m=e[13];let f;e[14]!==x?(f=s.jsxs(Y,{onClick:x,children:[m,"Settings"]}),e[14]=x,e[15]=f):f=e[15];let a;e[16]!==l?(a=l&&s.jsxs(Y,{variant:"destructive",onClick:L=>{L.stopPropagation(),l(L)},children:[s.jsx(De,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let h;e[18]!==f||e[19]!==a?(h=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(oe,{children:[y,s.jsxs(de,{align:"end",children:[f,a]})]})}),e[18]=f,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==g||e[22]!==h?(c=s.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[21]=g,e[22]=h,e[23]=c):c=e[23];let r;e[24]!==i.title?(r=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=r):r=e[25];const u=i.description||"No description";let I;e[26]!==u?(I=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:u}),e[26]=u,e[27]=I):I=e[27];let D;e[28]!==r||e[29]!==I?(D=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,I]}),e[28]=r,e[29]=I,e[30]=D):D=e[30];let w;e[31]!==c||e[32]!==D?(w=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,D]}),e[31]=c,e[32]=D,e[33]=w):w=e[33];let E;e[34]!==n||e[35]!==i.updated_at?(E=n?`Last used ${ne(new Date(n),{addSuffix:!0})}`:`Updated ${ne(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=n,e[35]=i.updated_at,e[36]=E):E=e[36];let N;e[37]!==E?(N=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})})}),e[37]=E,e[38]=N):N=e[38];let T;e[39]!==w||e[40]!==N?(T=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[w,N]}),e[39]=w,e[40]=N,e[41]=T):T=e[41];let S;return e[42]!==T||e[43]!==d?(S=s.jsxs(Te,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[d,T]}),e[42]=T,e[43]=d,e[44]=S):S=e[44],S}const ot="deco-sites";function it(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const i=e.owner,n=e.repo;return typeof i!="string"||typeof n!="string"||i.length===0||n.length===0?null:{owner:i,repo:n}}function nt(t,e){const i=e?it(e):null,n=i?.owner??ot,l=i?.repo??t;return{owner:n,name:l,url:`https://github.com/${n}/${l}`}}function rt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function pe(t,e,i){const n=await fetch(t,e),l=await n.json().catch(()=>({}));if(!n.ok)throw new Error(l.error??`${i} (${n.status})`);return l}function lt(t){return pe(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function at({open:t,onOpenChange:e,onBack:i}){const{org:n}=ce(),l=ue(),b=fe(),{data:C}=he.useSession(),[d,g]=K.useState(null),[y,x]=K.useState(null),[m,f]=K.useState(""),a=re({connectionId:Pe,orgId:n.id,orgSlug:n.slug}),h=Oe({slug:"mcp-github"}),c=ze(h),r=Ce({enabled:t&&c.length===0}),u=c.length===1?c[0]??null:y,I=c.length>1&&!u,D=re({connectionId:u?.id??"",orgId:n.id,orgSlug:n.slug}),w=t&&c.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:E,isLoading:N,error:T}=ge({queryKey:ee.decoSites(C?.user?.email),queryFn:()=>lt(n.slug),enabled:t&&!!C?.user?.email,staleTime:6e4,retry:!1}),S=E?.sites??[],L=o=>{o||(g(null),x(null),f("")),e(o)},P=S.filter(o=>o.name.toLowerCase().includes(m.toLowerCase())||(o.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),R=!d||P.some(o=>o.name===d),G=xe({mutationFn:async o=>{if(!u)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");$("deco_site_import_started",{site_name:o});const{installations:k,appSlug:v}=await Me(_=>a.callTool(_),u.id),A=S.find(_=>_.name===o);if(!A)throw new Error("Selected site is no longer available");const j=nt(o,A.metadata),z=$e(k,j.owner);if(!z){const _=v?`https://github.com/apps/${v}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${j.owner}" organization to import this site. ${_}`)}let V=null,U=null,B=null;const W=async()=>{B&&await a.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:B}}).catch(()=>{}),U&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:U,force:!0}}).catch(()=>{}),V&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:V,force:!0}}).catch(()=>{})};try{const _=await pe(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:o})},"Failed to create connection"),O=_.connId;if(!O)throw new Error("Server did not return a connection ID");V=O;const{childConnectionId:M}=await He({orgSlug:n.slug,sourceConnection:u,installationId:z.installationId,owner:j.owner,repo:j.name,githubCallTool:Z=>D.callTool(Z),selfCallTool:Z=>a.callTool(Z)});U=M;const H=_.icon??null,F=rt(o),q=o.toLowerCase(),p=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o,description:"Imported from deco.cx",pinned:!1,icon:H??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:q,githubRepo:{owner:j.owner,name:j.name,url:j.url,installationId:z.installationId,connectionId:M},ui:{banner:null,bannerColor:"#22C55E",icon:H,themeColor:"#22C55E",slug:F,pinnedViews:[{connectionId:O,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:O,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:O},{connection_id:M}]}}}),Q=p.structuredContent??p;if(!Q.item?.id)throw new Error("Failed to create the imported agent");return B=Q.item.id,{slug:F,virtualMcpId:Q.item.id,connId:O,item:Q.item}}catch(_){throw await W(),_}},onSuccess:({slug:o,virtualMcpId:k,item:v})=>{$("deco_site_import_succeeded",{site_name:v.title,virtual_mcp_id:k,slug:o}),b.setQueryData(ee.collectionItem(a,n.id,"","VIRTUAL_MCP",k),{item:v}),b.invalidateQueries({predicate:A=>{const j=A.queryKey;return j[1]===n.id&&j[3]==="collection"&&j[4]==="VIRTUAL_MCP"}}),b.invalidateQueries({queryKey:ee.projects(n.id)}),te.success(`Imported ${o} from deco.cx`),L(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(k)},onError:o=>{$("deco_site_import_failed",{error:o instanceof Error?o.message:"Unknown error"}),te.error("Import failed: "+(o instanceof Error?o.message:"Unknown error"))}});return s.jsx(Fe,{open:t,onOpenChange:L,children:s.jsxs(Re,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[s.jsx(Ue,{className:"sr-only",children:s.jsx(Be,{children:"Import from deco.cx"})}),s.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:s.jsx(Ie,{size:18})}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),s.jsx("div",{children:s.jsx(Ke,{value:m,onChange:f,placeholder:"Search sites...",onKeyDown:o=>{o.key==="Escape"&&f("")}})}),s.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),s.jsx(J,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),I&&!w&&r.status!=="error"&&s.jsxs("div",{className:"flex flex-col py-2",children:[s.jsx("div",{className:"px-8 py-2",children:s.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),c.map(o=>s.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?s.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):s.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(me,{className:"size-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}),N&&!w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!N&&!w&&!I&&r.status!=="error"&&!T&&S.length===0&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!N&&!w&&!I&&r.status!=="error"&&S.length>0&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[P.length===0&&s.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",m,"”"]}),P.map(o=>{const k=o.domains?.find(A=>A.production)?.domain??o.domains?.[0]?.domain,v=d===o.name;return s.jsxs("button",{type:"button",onClick:()=>g(o.name),className:je("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",v?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[s.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:o.thumb_url?s.jsx("img",{src:o.thumb_url,alt:o.name,className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-muted"})}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),k&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:k})]})]},o.name)})]})]}),s.jsxs(Ve,{className:"px-8 py-5 border-t border-border",children:[s.jsx(J,{variant:"outline",onClick:()=>L(!1),disabled:G.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||G.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&G.mutate(d),children:G.isPending?"Importing...":"Import"})]})]})})}function Us(){const t=ie.c(46),{org:e}=ce(),i=we(),n=_e(),[l,b]=K.useState("");let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},t[0]=C):C=t[0];const{createVirtualMCP:d,isCreating:g}=Ge(C),[y,x]=K.useState(null),[m,f]=K.useState(!1),[a,h]=K.useState(!1),{granted:c}=ke("agents:manage"),r=l.toLowerCase(),u=i.filter(p=>p.id!==e.id&&(p.title.toLowerCase().includes(r)||p.description?.toLowerCase().includes(r))),{data:I}=Ne(u.map(ct));let D;t[1]!==n||t[2]!==y?(D=async()=>{if(!y)return;const{id:p,title:Q}=y;x(null);try{await n.delete.mutateAsync(p),$("agent_deleted",{agent_id:p,source:"agents_list"}),te.success(`Deleted "${Q}"`)}catch{}},t[1]=n,t[2]=y,t[3]=D):D=t[3];const w=D,E=X,N=X,T=X;let S;t[4]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(X.Title,{children:"Agents"}),t[4]=S):S=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=L):L=t[5];let P;t[6]!==l?(P=s.jsx(tt,{value:l,onChange:b,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=P):P=t[7];let R;t[8]!==c||t[9]!==d||t[10]!==g?(R=c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list",method:"deco"}),f(!0)},isCreating:g,align:"end"})]}),t[8]=c,t[9]=d,t[10]=g,t[11]=R):R=t[11];let G;t[12]!==P||t[13]!==R?(G=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[P,R]})]}),t[12]=P,t[13]=R,t[14]=G):G=t[14];const o=u.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Le,{image:s.jsx(Ee,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),f(!0)},isCreating:g,align:"center",showBetaBadge:!0})]})})}),k=u.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:u.map(p=>s.jsx(st,{project:p,lastUsedAt:I?.get(p.id)?.last_used_at,onDeleteClick:c?()=>x({id:p.id,title:p.title}):void 0},p.id))})]});let v;t[15]!==k||t[16]!==T.Body||t[17]!==G||t[18]!==o?(v=s.jsxs(T.Body,{children:[G,o,k]}),t[15]=k,t[16]=T.Body,t[17]=G,t[18]=o,t[19]=v):v=t[19];let A;t[20]!==v||t[21]!==N.Content?(A=s.jsx(N.Content,{children:v}),t[20]=v,t[21]=N.Content,t[22]=A):A=t[22];let j;t[23]!==a?(j=s.jsx(ye,{open:a,onOpenChange:h}),t[23]=a,t[24]=j):j=t[24];let z;t[25]!==m?(z=s.jsx(at,{open:m,onOpenChange:f}),t[25]=m,t[26]=z):z=t[26];const V=!!y;let U;t[27]===Symbol.for("react.memo_cache_sentinel")?(U=p=>!p&&x(null),t[27]=U):U=t[27];let B;t[28]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qe,{children:"Delete Agent?"}),t[28]=B):B=t[28];const W=y?.title;let _;t[29]!==W?(_=s.jsxs(Qe,{children:[B,s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),t[29]=W,t[30]=_):_=t[30];let O;t[31]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(We,{children:"Cancel"}),t[31]=O):O=t[31];let M;t[32]!==w?(M=s.jsxs(Ye,{children:[O,s.jsx(Xe,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[32]=w,t[33]=M):M=t[33];let H;t[34]!==_||t[35]!==M?(H=s.jsxs(Ze,{children:[_,M]}),t[34]=_,t[35]=M,t[36]=H):H=t[36];let F;t[37]!==V||t[38]!==H?(F=s.jsx(et,{open:V,onOpenChange:U,children:H}),t[37]=V,t[38]=H,t[39]=F):F=t[39];let q;return t[40]!==E||t[41]!==A||t[42]!==j||t[43]!==z||t[44]!==F?(q=s.jsxs(E,{children:[A,j,z,F]}),t[40]=E,t[41]=A,t[42]=j,t[43]=z,t[44]=F,t[45]=q):q=t[45],q}function ct(t){return t.id}export{Us as default};
@@ -1 +0,0 @@
1
- import{H as B,I as N,ad as ae,af as le,ag as he,ae as xe,b3 as me,c as U,J as ge,M as be,r as M,j as s,ah as Ee,t as G,aL as ye,C as re,n as oe,d as J,K as Q,m as ve,l as ue,B as V,p as je,E as $e}from"./index-BEqdT-CX.js";import{i as Re}from"./AlertCircle-DFFB807G.js";import{P as te}from"./index-BXTPhNSj.js";import{S as ne}from"./skeleton-C-LbiBGP.js";import{b as _e,a as ce,S as de,c as Fe}from"./settings-section-HiisdE7T.js";import{u as X,a as se,b as Se}from"./use-ai-providers-C7iVrgY-.js";import{i as Me}from"./CheckCircle-BwwAyNzV.js";import{n as Oe,o as Te,q as Ue,S as ze}from"./chat-context-CAoh3qxf.js";import{g as qe,h as Le}from"./use-organization-settings-CpbybQHD.js";import{M as Ve,O as ke,P as Be,C as pe}from"./select-model-BHB_Fir_.js";import{u as Qe}from"./use-debounced-autosave-IEMI4Muz.js";import{I as ie}from"./input-CqfDyI-C.js";import{T as fe,a as Ge}from"./toggle-group-BnuMLJr8.js";import{b as Ie,c as Ce,d as Ne,A as Pe,a as we,e as De,g as Ae,f as Ke}from"./alert-dialog-DtmlB9JL.js";import{u as H}from"./studio-tools-Cdt3UzXo.js";import{s as Ye}from"./Plus-C8FiAr3i.js";import{b as We}from"./Tool01-CSravChF.js";import{s as He}from"./Trash01-DZTkGJqE.js";import{A as Je}from"./avatar-DJpRqbqg.js";import{i as Xe}from"./Settings02-D5c8FtUa.js";import{s as Ze}from"./Eye-Bbh_ejV6.js";import{c as et,D as tt,a as st,d as it,e as rt}from"./dialog-BboVhzku.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-9_BT8d0_.js";import"./sidebar-CRtkHPvX.js";import"./LayoutLeft-CNWN8tpf.js";import"./use-mobile-DbBFg2WD.js";import"./X-CTTK5Zj2.js";import"./tooltip-C7c-Tgru.js";import"./card-CEUspnmz.js";import"./ArrowUpRight-D37SsWBk.js";import"./autosend-CIDdvZqc.js";import"./hooks-DYM3Q-Vq.js";import"./use-mcp-client-DvvHwezb.js";import"./constants-D_FQAPnt.js";import"./auth-BR_fNNK7.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CNKe_WaY.js";import"./use-collections-Dy7WD_eH.js";import"./use-decopilot-events-btxE-D2k.js";import"./tab-id-BijBBRwE.js";import"./drawer-D5XLtSzP.js";import"./checkbox-C7atZRmN.js";import"./Check-BAiULwRg.js";import"./select-Bh2Z8rK3.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronUp-CqCnswy_.js";import"./Key01-xPUeBTf6.js";import"./SearchMd-Gwm-384G.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-BdI_dCjX.js";import"./ChevronRight-UlscOqp6.js";import"./connect-desktop-dialog-B4c48mz3.js";import"./Copy01-BEB5hDKQ.js";import"./Image01-Y4d3ZI2r.js";import"./Stars01-C8WemEnv.js";import"./User01-D0_zDlJM.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-DsC1r5oD.js";import"./access-gate-Bw06fv-s.js";import"./capability-load-error-BEzrfkB_.js";B({title:N(),url:N(),icon:N()});B({registries:le(N(),B({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const W=B({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=B({tiers:B({fast:W,smart:W,thinking:W,image:W,web_search:W,deep_research:W})});B({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});B({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:B({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:B({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Oe(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=M.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],M.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const k=p;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const R=y.keyId??m??"";S(R),a({keyId:R,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let f;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(f=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=f):f=t[19],f}function pt(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Me,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function ft(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:w=>{o.reset(i),G.error(`Failed to save: ${w.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Qe(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:p}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),M.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==p?(h=()=>{const v=o.getValues(),w=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=p);const P=Y=>Y!=null&&!w.has(Y.keyId),C={fast:P(v.tiers.fast)?null:v.tiers.fast,smart:P(v.tiers.smart)?null:v.tiers.smart,thinking:P(v.tiers.thinking)?null:v.tiers.thinking,image:P(v.tiers.image)?null:v.tiers.image,web_search:P(v.tiers.web_search)?null:v.tiers.web_search,deep_research:P(v.tiers.deep_research)?null:v.tiers.deep_research},q=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!q&&z)return;const L=Ue(t,$);o.reset({tiers:{fast:C.fast??L.chat.fast,smart:C.smart??L.chat.smart,thinking:C.thinking??L.chat.thinking,image:C.image??L.image,web_search:C.web_search??L.webSearch,deep_research:C.deep_research??L.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=p,e[19]=h):h=e[19];const f=c?.id,y=u?.id,R=g?.id;let O;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==p||e[25]!==f||e[26]!==y||e[27]!==R?(O=[o,t,j,_,p,f,y,R],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=p,e[25]=f,e[26]=y,e[27]=R,e[28]=O):O=e[28],M.useEffect(h,O);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const F=b&&!d;let D;e[30]!==S||e[31]!==F?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(pt,{isPending:S,showSaved:F})]}),e[30]=S,e[31]=F,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:w=>{const{field:$}=w;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:P=>{$.onChange(P),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=H(),[i,a]=M.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:f}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return f},onSuccess:yt,onError:bt}),[o,x]=M.useState(""),[S,b]=M.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let p;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(p=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=p):p=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==p||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,p,k]})}),e[22]=_,e[23]=p,e[24]=k,e[25]=I):I=e[25],I}function bt(e){G.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=H(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=M.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=Q.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:p,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const f=p?.balanceCents!=null?p.balanceCents/100:null;let y;e[19]!==f?(y=f!=null?`$${f.toFixed(2)}`:"—",e[19]=f,e[20]=y):y=e[20];const R=y;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=O):O=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let F;e[23]!==c?(F=s.jsxs("div",{className:"flex items-center justify-between",children:[O,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=F):F=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(Ie,{children:[s.jsx(Ce,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ne,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Pe,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(we,{children:[D,s.jsxs(De,{children:[A,s.jsx(Ae,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ke,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==f||e[33]!==R||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",f!=null&&vt(f)),children:R}),e[32]=f,e[33]=R,e[34]=h,e[35]=k,e[36]=v):v=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const $=h&&"animate-spin";let P;e[39]!==$?(P=ue($),e[39]=$,e[40]=P):P=e[40];let C;e[41]!==P?(C=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=C):C=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==C?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=w,e[45]=C,e[46]=q):q=e[46];let z;e[47]!==v||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,q]}),e[47]=v,e[48]=q,e[49]=z):z=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=L):L=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,L]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==F||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[F,E,Y,Z]})})}),e[54]=F,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){G.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=H(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),G.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(V,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=B({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function Pt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=H(),d=oe(),[n,m]=M.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:p}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async f=>{let y;f.apiKey?c?y=JSON.stringify({baseUrl:f.baseUrl||l||"",apiKey:f.apiKey}):y=f.apiKey:c&&f.baseUrl&&f.baseUrl!==l&&(y=JSON.stringify({baseUrl:f.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:f.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:Q.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:Q.aiProviders(S.id)}),G.success("Provider updated"),x()},onError:f=>G.error(`Failed to update: ${f.message}`)});return s.jsxs("form",{onSubmit:j(f=>I(f)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),p.label&&s.jsx("p",{className:"text-xs text-destructive",children:p.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function wt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=H();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?ke.find(k=>k.id===i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=Q.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(Pt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let p;return t[24]!==l||t[25]!==r||t[26]!==_?(p=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=p):p=t[27],p}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=H(),o=oe(),[x,S]=M.useState(!1),[b,d]=M.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?ke.find(q=>q.id===i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${q} · added ${z} ago`}const _=j;let p;t[5]!==i.id||t[6]!==l?(p=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=p):p=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:Q.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:Q.aiProviders(r.id)}),o.invalidateQueries({queryKey:Q.aiProviderModels(r.id,i.id)}),G.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==p||t[13]!==k?(I={mutationFn:p,onSuccess:k,onError:At},t[12]=p,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:f}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Je,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let R;t[18]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(We,{size:14})}),t[18]=R):R=t[18];let O,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(O=()=>S(!0),T=s.jsx(He,{size:14}),t[19]=O,t[20]=T):(O=t[19],T=t[20]);let F;t[21]!==f?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[R,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:f,onClick:O,children:T})]}),t[21]=f,t[22]=F):F=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==F||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:F}),t[23]=_,t[24]=u,t[25]=F,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(wt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ce,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(Ie,{children:[K,s.jsxs(Ne,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Pe,{children:"Cancel"}),t[35]=v):v=t[35];let w;t[36]!==h?(w=s.jsxs(De,{children:[v,s.jsx(Ae,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let $;t[38]!==E||t[39]!==w?($=s.jsxs(we,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=$):$=t[40];let P;t[41]!==x||t[42]!==$?(P=s.jsx(Ke,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=P):P=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==P?(C=s.jsxs(s.Fragment,{children:[D,A,P]}),t[44]=D,t[45]=A,t[46]=P,t[47]=C):C=t[47],C}function At(e){return G.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Rt).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ye,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(V,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Rt(e){return e.providerId!=="deco"}function Ft(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Re,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Mt(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Ot),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=M.useState(!1),[x,S]=M.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let p;e[5]!==n?(p=s.jsx(Be,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=p):p=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=R=>{R||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let f;e[8]!==k||e[9]!==h?(f=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=f):f=e[10];let y;return e[11]!==p||e[12]!==f?(y=s.jsxs(s.Fragment,{children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(ft,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Ot(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Fe,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Mt,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Ft,{error:t??new Error("Failed to load AI providers")})}function Hs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Hs as default};
@@ -1 +0,0 @@
1
- import{c as gt,r as w,j as o,l as yt,t as ut,i as St}from"./index-BEqdT-CX.js";import{i as jt}from"./ChevronRight-UlscOqp6.js";import{A as kt}from"./automation-runs-nQ99AMoV.js";import{A as _t}from"./add-section-modal-BUwFQaqb.js";import{n as Bt,h as wt,j as At,e as Nt,k as Rt,l as Ct,m as Et,o as Kt,S as Tt}from"./index-Bnro1Vjb.js";import"./select-Bh2Z8rK3.js";import"./tooltip-C7c-Tgru.js";import"./Check-BAiULwRg.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronUp-CqCnswy_.js";import"./useInfiniteQuery-BnNR1NVs.js";import"./use-infinite-scroll-DYbbFqLK.js";import"./use-connection-DUpx0NEA.js";import"./use-collections-Dy7WD_eH.js";import"./use-mcp-client-DvvHwezb.js";import"./constants-D_FQAPnt.js";import"./auth-BR_fNNK7.js";import"./use-virtual-mcp-CNKe_WaY.js";import"./card-CEUspnmz.js";import"./sidebar-CRtkHPvX.js";import"./LayoutLeft-CNWN8tpf.js";import"./use-mobile-DbBFg2WD.js";import"./X-CTTK5Zj2.js";import"./table-VOE9WRkg.js";import"./empty-state-C6JrR5eZ.js";import"./use-members-BZPSqMOT.js";import"./use-org-auth-client-PHOIKqSH.js";import"./use-clock-tick-F8Oybd0p.js";import"./AlertCircle-DFFB807G.js";import"./CheckCircle-BwwAyNzV.js";import"./Circle-pOPoWDQn.js";import"./agent-icon-jdj2JAEm.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./Tool02-csu1mOp1.js";import"./XCircle-CiVL5z-e.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./ZoomOut-CvmU5uj5.js";import"./Users03-Iz-TpUuJ.js";import"./Stars02-CzKVb8lE.js";import"./Copy01-BEB5hDKQ.js";import"./DotsVertical-BFfMlorx.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./Plus-C8FiAr3i.js";import"./SearchLg-CMWIHllt.js";import"./SearchMd-Gwm-384G.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Trash01-DZTkGJqE.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./Zap-CrYnUVJy.js";import"./use-automations-CELpHT79.js";import"./studio-tools-Cdt3UzXo.js";import"./useSuspenseInfiniteQuery-3QrNhYz_.js";import"./avatar-DJpRqbqg.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-C0FUXmsm.js";import"./file-type-icon-BR1G8n26.js";import"./dialog-BboVhzku.js";import"./tab-id-BijBBRwE.js";import"./hooks-DYM3Q-Vq.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-CAoh3qxf.js";import"./autosend-CIDdvZqc.js";import"./use-ai-providers-C7iVrgY-.js";import"./use-decopilot-events-btxE-D2k.js";import"./use-organization-settings-CpbybQHD.js";import"./monaco-editor-YwujFe9g.js";import"./index-BTfVRtBq.js";import"./index-BXfKOYdf.js";import"./shell-layout-CcPRSmgX.js";import"./alert-dialog-DtmlB9JL.js";import"./required-auth-layout-BXaZVxWQ.js";import"./use-org-sso-BA_UxewI.js";import"./integration-icon-Dhyv93zr.js";import"./use-navigate-to-agent-CBi1-FBB.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-oIJCSonG.js";import"./form-p6ZihW38.js";import"./label-DbwTUWd9.js";import"./input-CqfDyI-C.js";import"./drawer-D5XLtSzP.js";import"./collection-search-BLJH2aa6.js";import"./tabs-DPmfTv0c.js";import"./toggle-group-BnuMLJr8.js";import"./use-deco-credits-56-eyw-E.js";import"./extract-connection-data-DEmXsdA0.js";import"./connection-card-DPw_9IvV.js";import"./use-registry-connections-CX_dlku1.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-B9g6Z2-r.js";import"./connection-form-helpers-svNTHB1P.js";import"./authenticate-and-persist-oauth-BuaZSTeD.js";import"./mcp-oauth-CeGeftbL.js";import"./collection-tabs-D10lR104.js";import"./badge-zT-Fh3qN.js";import"./connect-desktop-dialog-B4c48mz3.js";import"./select-model-BHB_Fir_.js";import"./checkbox-C7atZRmN.js";import"./skeleton-C-LbiBGP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-HiisdE7T.js";import"./command-Cih9cb-G.js";import"./index-Dz8rxMiO.js";import"./popover-BJYBT3EY.js";import"./dropdown-menu-DcV4HAvf.js";import"./index-S6xdCjXr.js";import"./toolbar-65iromlk.js";import"./use-debounced-value-BqHYI-kn.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BrRSDeZW.js";import"./use-mcp-tools-Be4djRS3.js";import"./use-capability-DsC1r5oD.js";import"./use-debounced-autosave-IEMI4Muz.js";import"./index-BXTPhNSj.js";import"./search-input-CYwO2ZSV.js";import"./use-mcp-auth-status-Dy_Y2kKR.js";import"./switch-BL8XQR8K.js";import"./github-repo-picker-B_QoRL-b.js";import"./provision-repo-scoped-github-connection-CB4ICKHq.js";import"./use-secrets-ChIMRFxc.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./companions-core-Zwoux9HO.js";import"./index-CbMrlBFr.js";import"./get-initials-D-f_fDFw.js";import"./calendar-CibxNjt0.js";import"./toolbar-icon-button-BBh2Csxi.js";import"./use-file-configs-CYmkQ98g.js";import"./automation-list-row-BuCXNsSo.js";function $t(l,t){const s=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",n=Bt(t,f);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Kr(l){const t=gt.c(77),{orgSlug:s,virtualMcpId:f,branch:n,blockKey:i,block:a,meta:m,decofile:c,title:D,excludeFields:H,schemaPending:nt,previewBaseUrl:at}=l,G=nt===void 0?!1:nt,u=at===void 0?null:at,x=typeof a?.__resolveType=="string"?a.__resolveType:"";let R;t[0]!==H||t[1]!==m||t[2]!==x?(R=wt(x,m,H),t[0]=H,t[1]=m,t[2]=x,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const J=C;let E;t[6]!==a||t[7]!==i||t[8]!==m||t[9]!==D?(E=D??(a?At(i,a,m):i),t[6]=a,t[7]=i,t[8]=m,t[9]=D,t[10]=E):E=t[10];const v=E;let K;t[11]!==n||t[12]!==s||t[13]!==f?(K={orgSlug:s,virtualMcpId:f,branch:n},t[11]=n,t[12]=s,t[13]=f,t[14]=K):K=t[14];const{save:b,flush:Q,isPending:W}=Nt(K);let T;t[15]!==n||t[16]!==s||t[17]!==f?(T={orgSlug:s,virtualMcpId:f,branch:n},t[15]=n,t[16]=s,t[17]=f,t[18]=T):T=t[18];const X=Rt(T);let $;t[19]!==b?($=Et((e,r)=>b(e,r)),t[19]=b,t[20]=$):$=t[20];const Y=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let F;t[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[21]=F):F=t[21];const[p,ft]=w.useState(F),[ot,rt]=w.useState(!1),P=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let O;t[22]!==a?(O=a??{},t[22]=a,t[23]=O):O=t[23];const it=O;let g;t[24]!==tt?(g=tt??{},t[24]=tt,t[25]=g):g=t[25];let z;t[26]!==it||t[27]!==g?(z={...it,...g},t[26]=it,t[27]=g,t[28]=z):z=t[28];const mt=z;let L;t[29]!==i||t[30]!==x||t[31]!==b?(L=e=>{const r=e;ct(r),b(i,{...r,__resolveType:x})},t[29]=i,t[30]=x,t[31]=b,t[32]=L):L=t[32];const st=L;let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{ft(e)},t[33]=V):V=t[33];const pt=V;let q;t[34]!==c||t[35]!==Q||t[36]!==X?(q=async(e,r)=>{try{const{blockKey:d,data:N}=$t(e,c);await X.mutateAsync({blockKey:d,data:N}),ut.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,bt=N instanceof Error?N.message:"Could not add section";throw ut.error(bt),N}},t[34]=c,t[35]=Q,t[36]=X,t[37]=q):q=t[37];const y=q;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{P.current=e.append,rt(!0)},t[38]=I):I=t[38];const vt=I;let U;t[39]!==y?(U=async e=>{const r=P.current;if(r)try{await y(e,d=>{r(d),rt(!1),P.current=null})}catch{}},t[39]=y,t[40]=U):U=t[40];const lt=U;let M;t[41]!==p||t[42]!==v?(M=p.length>0?[v,...p]:[],t[41]=p,t[42]=v,t[43]=M):M=t[43];const A=M;let S;t[44]!==p||t[45]!==A||t[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((e,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pt(r===0?[]:Ct(p,r)),dt(Ft)},title:e,className:yt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[44]=p,t[45]=A,t[46]=v,t[47]=S):S=t[47];let j;t[48]!==W?(j=o.jsx(Kt,{isPending:W,isError:!1}),t[48]=W,t[49]=j):j=t[49];let k;t[50]!==S||t[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),t[50]=S,t[51]=j,t[52]=k):k=t[52];let _;t[53]!==i||t[54]!==p||t[55]!==c||t[56]!==mt||t[57]!==et||t[58]!==y||t[59]!==st||t[60]!==J||t[61]!==m||t[62]!==u||t[63]!==Y||t[64]!==h||t[65]!==G?(_=o.jsx(kt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:J?o.jsx(Tt,{schema:h,value:mt,onChange:st,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pt,decofile:c,meta:m,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${et}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(St,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=p,t[55]=c,t[56]=mt,t[57]=et,t[58]=y,t[59]=st,t[60]=J,t[61]=m,t[62]=u,t[63]=Y,t[64]=h,t[65]=G,t[66]=_):_=t[66];let B;t[67]!==ot||t[68]!==c||t[69]!==lt||t[70]!==m||t[71]!==u?(B=u&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(P.current=null)},meta:m,decofile:c,previewBaseUrl:u,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=c,t[69]=lt,t[70]=m,t[71]=u,t[72]=B):B=t[72];let Z;return t[73]!==k||t[74]!==_||t[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),t[73]=k,t[74]=_,t[75]=B,t[76]=Z):Z=t[76],Z}function Ft(l){return l+1}function Pt(l){return l+1}export{Kr as AppEditor};
@@ -1 +0,0 @@
1
- import{c as B,j as o,C as L,b as T,r as $,B as M,p as N}from"./index-BEqdT-CX.js";import{s as q}from"./Plus-C8FiAr3i.js";import{i as S}from"./Zap-CrYnUVJy.js";import{S as D}from"./search-input-CYwO2ZSV.js";import{P as l}from"./index-BXTPhNSj.js";import{E as b}from"./empty-state-C6JrR5eZ.js";import{c as O}from"./use-automations-CELpHT79.js";import{c as V}from"./use-navigate-to-agent-CBi1-FBB.js";import{A as F}from"./automation-list-row-BuCXNsSo.js";import{f as G}from"./constants-D_FQAPnt.js";import{u as H}from"./use-virtual-mcp-CNKe_WaY.js";import{R as J}from"./require-capability-9_BT8d0_.js";import"./SearchMd-Gwm-384G.js";import"./sidebar-CRtkHPvX.js";import"./LayoutLeft-CNWN8tpf.js";import"./use-mobile-DbBFg2WD.js";import"./X-CTTK5Zj2.js";import"./tooltip-C7c-Tgru.js";import"./use-mcp-client-DvvHwezb.js";import"./auth-BR_fNNK7.js";import"./studio-tools-Cdt3UzXo.js";import"./hooks-DYM3Q-Vq.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./alert-dialog-DtmlB9JL.js";import"./dropdown-menu-DcV4HAvf.js";import"./Check-BAiULwRg.js";import"./ChevronRight-UlscOqp6.js";import"./Circle-pOPoWDQn.js";import"./Stars02-CzKVb8lE.js";import"./DotsVertical-BFfMlorx.js";import"./Trash01-DZTkGJqE.js";import"./agent-icon-jdj2JAEm.js";import"./AlertCircle-DFFB807G.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./Tool02-csu1mOp1.js";import"./XCircle-CiVL5z-e.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./ZoomOut-CvmU5uj5.js";import"./Users03-Iz-TpUuJ.js";import"./CheckCircle-BwwAyNzV.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronUp-CqCnswy_.js";import"./Copy01-BEB5hDKQ.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./SearchLg-CMWIHllt.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./use-collections-Dy7WD_eH.js";import"./use-capability-DsC1r5oD.js";import"./access-gate-Bw06fv-s.js";import"./capability-load-error-BEzrfkB_.js";function K(){const t=B.c(16),{org:e}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.map(Q)),C=u.filter(i=>{if(!g||i.name.toLowerCase().includes(g))return!0;if(i.virtual_mcp_id){const a=y.get(i.virtual_mcp_id);if(a&&a.title.toLowerCase().includes(g))return!0}return!1}),P=(i,a)=>{const A=a&&y.has(a)?a:G(e.id);N("automations_list_row_clicked",{automation_id:i,agent_id:A,source:"settings_automations"}),k(A,{search:{main:"automation:"+i}})};let n;t[0]!==d||t[1]!==e.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:e.slug}})},t[0]=d,t[1]=e.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(i=>o.jsx(F,{automation:i,showAgent:!0,onClick:()=>P(i.id,i.virtual_mcp_id)},i.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let m;t[10]!==h.Content||t[11]!==s?(m=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=m):m=t[12];let c;return t[13]!==x||t[14]!==m?(c=o.jsx(x,{children:m}),t[13]=x,t[14]=m,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function vo(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=e):e=t[0],e}export{vo as default};
@@ -1 +0,0 @@
1
- import{c as q,r as S,l as G,j as t,B as I,i as Q,t as U}from"./index-BEqdT-CX.js";import{i as X}from"./XCircle-CiVL5z-e.js";import{c as T}from"./ZoomOut-CvmU5uj5.js";import{n as Y}from"./LinkExternal01-B6bTrNoI.js";import{az as Z}from"./agent-icon-jdj2JAEm.js";import{f as K,a as _,b as tt,c as et,d as ot,e as rt,A as it,g as st}from"./alert-dialog-DtmlB9JL.js";import{I as M}from"./input-CqfDyI-C.js";import{L}from"./label-DbwTUWd9.js";import{v as at,w as mt,V as nt,o as lt,x as R,A as pt,W as ct,y as dt}from"./index-Bnro1Vjb.js";import{c as ut,B as gt,a as xt}from"./block-document-2XwXLkCF.js";import{u as ft}from"./use-autosave-B1tnyn5H.js";import{t as ht}from"./ChevronDown-Cpk84lU5.js";import{J as yt,K as jt,I as vt}from"./automation-runs-nQ99AMoV.js";import{s as v,E as bt}from"./primitives-QqbAbc1Q.js";import"./AlertCircle-DFFB807G.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./Tool02-csu1mOp1.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./Users03-Iz-TpUuJ.js";import"./CheckCircle-BwwAyNzV.js";import"./Check-BAiULwRg.js";import"./ChevronRight-UlscOqp6.js";import"./ChevronUp-CqCnswy_.js";import"./Circle-pOPoWDQn.js";import"./Stars02-CzKVb8lE.js";import"./Copy01-BEB5hDKQ.js";import"./DotsVertical-BFfMlorx.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LayoutLeft-CNWN8tpf.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./Plus-C8FiAr3i.js";import"./SearchLg-CMWIHllt.js";import"./SearchMd-Gwm-384G.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Trash01-DZTkGJqE.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./X-CTTK5Zj2.js";import"./Zap-CrYnUVJy.js";import"./chat-context-CAoh3qxf.js";import"./autosend-CIDdvZqc.js";import"./hooks-DYM3Q-Vq.js";import"./use-mcp-client-DvvHwezb.js";import"./constants-D_FQAPnt.js";import"./auth-BR_fNNK7.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-Cdt3UzXo.js";import"./use-virtual-mcp-CNKe_WaY.js";import"./use-collections-Dy7WD_eH.js";import"./use-ai-providers-C7iVrgY-.js";import"./use-decopilot-events-btxE-D2k.js";import"./tab-id-BijBBRwE.js";import"./use-organization-settings-CpbybQHD.js";import"./tooltip-C7c-Tgru.js";import"./dialog-BboVhzku.js";import"./drawer-D5XLtSzP.js";import"./collection-search-BLJH2aa6.js";import"./use-mobile-DbBFg2WD.js";import"./AreaChart-oIJCSonG.js";import"./index-BXfKOYdf.js";import"./shell-layout-CcPRSmgX.js";import"./avatar-DJpRqbqg.js";import"./required-auth-layout-BXaZVxWQ.js";import"./use-org-sso-BA_UxewI.js";import"./form-p6ZihW38.js";import"./select-Bh2Z8rK3.js";import"./tabs-DPmfTv0c.js";import"./toggle-group-BnuMLJr8.js";import"./use-deco-credits-56-eyw-E.js";import"./extract-connection-data-DEmXsdA0.js";import"./connection-card-DPw_9IvV.js";import"./use-registry-connections-CX_dlku1.js";import"./use-connection-DUpx0NEA.js";import"./useInfiniteQuery-BnNR1NVs.js";import"./use-infinite-scroll-DYbbFqLK.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-CEUspnmz.js";import"./integration-icon-Dhyv93zr.js";import"./textarea-B9g6Z2-r.js";import"./connection-form-helpers-svNTHB1P.js";import"./authenticate-and-persist-oauth-BuaZSTeD.js";import"./mcp-oauth-CeGeftbL.js";import"./collection-tabs-D10lR104.js";import"./badge-zT-Fh3qN.js";import"./useSuspenseInfiniteQuery-3QrNhYz_.js";import"./connect-desktop-dialog-B4c48mz3.js";import"./select-model-BHB_Fir_.js";import"./checkbox-C7atZRmN.js";import"./skeleton-C-LbiBGP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-HiisdE7T.js";import"./command-Cih9cb-G.js";import"./index-Dz8rxMiO.js";import"./popover-BJYBT3EY.js";import"./dropdown-menu-DcV4HAvf.js";import"./index-S6xdCjXr.js";import"./file-type-icon-BR1G8n26.js";import"./toolbar-65iromlk.js";import"./use-debounced-value-BqHYI-kn.js";import"./index-BTfVRtBq.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BrRSDeZW.js";import"./empty-state-C6JrR5eZ.js";import"./use-mcp-tools-Be4djRS3.js";import"./use-capability-DsC1r5oD.js";import"./use-debounced-autosave-IEMI4Muz.js";import"./index-BXTPhNSj.js";import"./sidebar-CRtkHPvX.js";import"./search-input-CYwO2ZSV.js";import"./use-mcp-auth-status-Dy_Y2kKR.js";import"./switch-BL8XQR8K.js";import"./github-repo-picker-B_QoRL-b.js";import"./use-navigate-to-agent-CBi1-FBB.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-CB4ICKHq.js";import"./use-secrets-ChIMRFxc.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./companions-core-Zwoux9HO.js";import"./format-time-BnbuEtat.js";import"./use-members-BZPSqMOT.js";import"./use-org-auth-client-PHOIKqSH.js";import"./index-CbMrlBFr.js";import"./get-initials-D-f_fDFw.js";import"./calendar-CibxNjt0.js";import"./use-copy-C0FUXmsm.js";import"./toolbar-icon-button-BBh2Csxi.js";import"./monaco-editor-YwujFe9g.js";import"./use-file-configs-CYmkQ98g.js";import"./use-automations-CELpHT79.js";import"./automation-list-row-BuCXNsSo.js";import"./table-VOE9WRkg.js";import"./use-clock-tick-F8Oybd0p.js";function Ct(k){const e=q.c(18),{icon:f,title:n,defaultOpen:b,children:d}=k,A=b===void 0?!1:b,[x,D]=S.useState(A);let l;e[0]!==f?(l=t.jsx(f,{size:15}),e[0]=f,e[1]=l):l=e[1];let i;e[2]!==n?(i=t.jsx("span",{className:"flex-1 text-left",children:n}),e[2]=n,e[3]=i):i=e[3];const h=x&&"rotate-180";let r;e[4]!==h?(r=G("transition-transform",h),e[4]=h,e[5]=r):r=e[5];let p;e[6]!==r?(p=t.jsx(ht,{size:15,className:r}),e[6]=r,e[7]=p):p=e[7];let c;e[8]!==l||e[9]!==i||e[10]!==p?(c=t.jsx(yt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[l,i,p]})}),e[8]=l,e[9]=i,e[10]=p,e[11]=c):c=e[11];let s;e[12]!==d?(s=t.jsx(jt,{className:"px-2 pt-4",children:d}),e[12]=d,e[13]=s):s=e[13];let u;return e[14]!==x||e[15]!==c||e[16]!==s?(u=t.jsxs(vt,{open:x,onOpenChange:D,className:"mt-4",children:[c,s]}),e[14]=x,e[15]=c,e[16]=s,e[17]=u):u=e[17],u}function vr({orgSlug:k,virtualMcpId:e,branch:f,blockKey:n,block:b,decofile:d,meta:A,onManagePosts:x,onOpenPost:D,previewBaseUrl:l}){const i=at({orgSlug:k,virtualMcpId:e,branch:f}),h=mt(b,"categories"),[r,p,c]=ft(h,o=>{i.mutate({blockKey:n,data:R(n,"categories",o)})}),s=(o,w)=>p({...r,[o]:w}),u=ut({decofile:d,category:r,previewBaseUrl:l}),a=v(r.slug),[B,y]=S.useState(a),[m,C]=S.useState(null),[N,z]=S.useState(!1),P=a?nt(d).filter(o=>o.categorySlugs.includes(a)):[],j=P.length,W=o=>s("slug",o),H=async(o,w)=>{const V=v(r.name);z(!0);try{let g=0;for(const{key:E,payload:O}of pt(d,"posts")){const F=ct(O,o,{name:V,slug:w});F!==O&&(await i.mutateAsync({blockKey:E,data:R(E,"posts",dt(F))}),g+=1)}const $={...r,slug:w};await i.mutateAsync({blockKey:n,data:R(n,"categories",$)}),c($),U.success(g>0?`Renamed slug and updated ${g} ${g===1?"post":"posts"}`:"Renamed slug"),C(null)}catch(g){y(o),C(null),U.error(g instanceof Error?g.message:"Rename failed")}finally{z(!1)}},J=()=>{const o=B.trim();if(o===a){B!==o&&y(o);return}if(!o){y(a);return}if(j===0){W(o);return}C({oldSlug:a,newSlug:o,count:j})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:v(r.name)||"Untitled category"}),t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.jsx(lt,{isPending:i.isPending,isError:i.isError}),u&&t.jsxs(I,{type:"button",variant:"outline",size:"sm",title:"Open the category preview in a new tab",onClick:()=>window.open(u,"_blank","noopener,noreferrer"),children:[t.jsx(Y,{size:14}),"See category preview"]})]})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[t.jsx(bt,{value:v(r.name),onChange:o=>s("name",o),placeholder:"Category name",className:"py-1 text-3xl font-bold text-foreground"}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(L,{htmlFor:"category-slug",children:"Slug"}),t.jsx(M,{id:"category-slug",value:B,onChange:o=>y(o.target.value),onBlur:J,placeholder:"my-category",className:"h-10"})]}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(L,{htmlFor:"category-description",children:"Description"}),t.jsx(M,{id:"category-description",value:v(r.description),onChange:o=>s("description",o.target.value),placeholder:"Short description for this category",className:"h-10"})]}),t.jsx(Ct,{icon:Z,title:"Content",defaultOpen:!0,children:t.jsx(gt,{value:xt(r.sections),onChange:o=>s("sections",o),meta:A,emptyMessage:"This category has no content yet. Use ⊕ to add your first block."})}),t.jsxs("div",{className:"mt-6 overflow-hidden rounded-lg border bg-muted/30",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(T,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"text-sm",children:[j," ",j===1?"post":"posts"," in this category"]})]}),t.jsxs(I,{type:"button",variant:"outline",size:"sm",disabled:!a,title:a?"Pick posts to add to this category":"Set a slug to add posts to this category",onClick:()=>x(a),children:["Add posts",t.jsx(X,{size:14})]})]}),j>0&&t.jsx("ul",{className:"divide-y border-t bg-background",children:P.map(o=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>D(o.key),className:"flex w-full items-center gap-2.5 px-4 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(T,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm",children:o.title||"Untitled post"}),o.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:o.slug})]})]})},o.key))})]})]})})]}),t.jsx(K,{open:!!m,onOpenChange:o=>{o||N||(y(a),C(null))},children:t.jsxs(_,{children:[t.jsxs(tt,{children:[t.jsx(et,{children:"Rename category slug?"}),t.jsx(ot,{children:m?`Changing the slug from "${m.oldSlug}" to "${m.newSlug}" will update ${m.count} ${m.count===1?"post":"posts"} that reference this category.`:null})]}),t.jsxs(rt,{children:[t.jsx(it,{disabled:N,children:"Cancel"}),t.jsx(st,{onClick:o=>{o.preventDefault(),m&&H(m.oldSlug,m.newSlug)},disabled:N,children:N?t.jsxs(t.Fragment,{children:[t.jsx(Q,{size:14,className:"animate-spin"}),"Renaming…"]}):"Rename & update posts"})]})]})})]})}export{vr as CategoryEditor};
@@ -1,28 +0,0 @@
1
- import{c as oe,l as Xe,bC as Ze,j as K,C as Y,K as ue,m as Ye,cs as Je,R as Ne,n as qe,t as ae,G as le,D as de,b as Fe,u as Ue,e as et,r as y,p as tt,a as nt,U as st,ak as at}from"./index-BEqdT-CX.js";import{A as je,c as ot,a as rt,w as it}from"./autosend-CIDdvZqc.js";import{S as ct,b as lt,e as dt,u as ut}from"./hooks-DYM3Q-Vq.js";import{u as pt}from"./studio-tools-Cdt3UzXo.js";import{u as ft}from"./use-mcp-client-DvvHwezb.js";import{a as ht,S as mt}from"./constants-D_FQAPnt.js";import{a as gt}from"./use-virtual-mcp-CNKe_WaY.js";import{u as yt,a as ge}from"./use-ai-providers-C7iVrgY-.js";import{u as xt}from"./use-decopilot-events-btxE-D2k.js";import{q as St,n as vt}from"./tab-id-BijBBRwE.js";import{g as It}from"./use-organization-settings-CpbybQHD.js";const bt={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],llmapi:["claude-haiku-4-5","claude-haiku","gpt-4o-mini"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.6-luna"]},Ct={anthropic:["claude-sonnet-5","claude-sonnet"],openrouter:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude"],llmapi:["claude-sonnet-4-6","claude-sonnet"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.6-terra"]},kt={anthropic:["claude-opus-4-8","claude-sonnet-5","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8:extended","anthropic/claude-opus-4.8","anthropic/claude-sonnet-5:extended","anthropic/claude-sonnet-5","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],llmapi:["claude-opus-4-8","claude-opus","claude-sonnet-4-6"],google:["gemini-3-pro"],"claude-code":["claude-code:opus-1m","claude-code:opus","claude-code:sonnet"],codex:["codex:gpt-5.6-sol"]},Mt={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],llmapi:["gemini-2.5-flash-image","gpt-image-1"],google:["gemini-2.0-flash-image"]},Tt={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},wt={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function Qe(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function Et(t){return Qe(t).includes("deepresearch")}const At=["sonar","searchpreview","online"];function Ke(t){const e=Qe(t);return e.includes("deepresearch")?!1:At.some(n=>e.includes(n))}function We(t){return t.asyncResearch!==!0&&Ke(t.modelId)}function Ve(t){return t.asyncResearch===!0||Et(t.modelId)||Ke(t.modelId)}function ie(t,e,n,s){for(const a of n){const o=t.find(r=>r.modelId===a);if(o)return{keyId:e,modelId:o.modelId,title:o.title}}for(const a of n){const o=t.find(r=>r.modelId.includes(a));if(o)return{keyId:e,modelId:o.modelId,title:o.title}}if(s){const a=t.find(s);if(a)return{keyId:e,modelId:a.modelId,title:a.title}}return null}function _t(t,e){const n={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const s of t){const a=e[s.id]??[],o=s.providerId;n.chat.fast||(n.chat.fast=ie(a,s.id,bt[o]??[])),n.chat.smart||(n.chat.smart=ie(a,s.id,Ct[o]??[])),n.chat.thinking||(n.chat.thinking=ie(a,s.id,kt[o]??[])),n.image||(n.image=ie(a,s.id,Mt[o]??[],r=>r.capabilities?.includes("image")===!0)),n.webSearch||(n.webSearch=ie(a,s.id,Tt[o]??[],We)),n.deepResearch||(n.deepResearch=ie(a,s.id,wt[o]??[],Ve))}return n}const Rt=Ze("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function In(t){const e=oe.c(10),{variant:n,size:s}=t;let a;e[0]!==s||e[1]!==n?(a=Xe(Rt({variant:n,size:s})),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o,r;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=K.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),r=K.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=o,e[4]=r):(o=e[3],r=e[4]);let l;e[5]!==a?(l=K.jsxs("svg",{"aria-hidden":"true",className:a,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o,r]}),e[5]=a,e[6]=l):l=e[6];let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=K.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=h):h=e[7];let m;return e[8]!==l?(m=K.jsxs("div",{role:"status",children:[l,h]}),e[8]=l,e[9]=m):m=e[9],m}const Pe={online:!1,capabilities:[],ready:!1};function Pt(t){const e=oe.c(9),{org:n}=Y(),s=pt(),a=t?.fast??!1;let o;e[0]!==n.id?(o=ue.currentLink(n.id),e[0]=n.id,e[1]=o):o=e[1];let r;e[2]!==s?(r=async()=>{const C=await s.call("LINK_CURRENT_GET",{});return C?{...C,ready:!0}:{...Pe,ready:!0}},e[2]=s,e[3]=r):r=e[3];const l=a?1e3:1e4,h=a?2e3:15e3;let m;e[4]!==o||e[5]!==r||e[6]!==l||e[7]!==h?(m={queryKey:o,queryFn:r,staleTime:l,refetchInterval:h,refetchOnWindowFocus:!0},e[4]=o,e[5]=r,e[6]=l,e[7]=h,e[8]=m):m=e[8];const{data:S}=Ye(m);return S??Pe}function $t(t,e=[]){return t==="stop"?e.filter(a=>a.type==="text"&&a.text).map(a=>a.text).join(`
2
- `).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed":t==="tool-calls"?e.some(s=>s.type==="tool-user_ask"&&s.state==="input-available"||s.state==="approval-requested")?"requires_action":"completed":"failed"}const Ie={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function Dt(t,e){if(!t)return null;const n=e?Je(e):null;if(t==="decopilot"&&n===null)return"decopilot";for(const[s,a]of Object.entries(Ie))if(a.harness===t&&a.sandbox===n)return s;return null}function bn(t){return t.claudeCode?"claude-code-desktop":t.codex?"codex-desktop":null}function Ot(t,e){return e&&t&&Ie[t].sandbox==="user-desktop"?"decopilot":t}function Lt(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function Nt(t){const e=oe.c(10);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=n):n=e[0];const s=Ne(n);let a;if(e[1]!==s?.params.appSlug||e[2]!==s?.params.collectionName||e[3]!==s?.params.itemId||e[4]!==t){a=[],t&&a.push(`### Selected Agent
3
- - ID: ${t}`);let o;e[6]!==s?.params.appSlug||e[7]!==s?.params.collectionName||e[8]!==s?.params.itemId?(o=[],s?.params.appSlug&&o.push(`- Connection ID: ${s?.params.appSlug}`),s?.params.collectionName&&o.push(`- Collection: ${s?.params.collectionName}`),s?.params.itemId&&o.push(`- Item ID: ${s?.params.itemId}`),e[6]=s?.params.appSlug,e[7]=s?.params.collectionName,e[8]=s?.params.itemId,e[9]=o):o=e[9],o.length>0&&a.push(`### Current Resource
4
- The user is viewing the following resource:
5
- ${o.join(`
6
- `)}
7
-
8
- Help the user understand and work with this resource.`),e[1]=s?.params.appSlug,e[2]=s?.params.collectionName,e[3]=s?.params.itemId,e[4]=t,e[5]=a}else a=e[5];return a.join(`
9
-
10
- `)}function qt(){const t=oe.c(5),e=qe(),{org:n}=Y();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=s):s=t[0];const a=Ne(s);let o;return t[1]!==a?.params||t[2]!==n||t[3]!==e?(o=r=>{const h=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!h||!h[1])return;const m=h[1],S=a?.params.appSlug;if(!S)return;e.invalidateQueries({queryKey:ue.collection(n.slug,S,m)});const C=m.toLowerCase().replace(/_/g," ");ae.success(`${C} updated`)},t[1]=a?.params,t[2]=n,t[3]=e,t[4]=o):o=t[4],o}function Ft(){const t=oe.c(4),{org:e,project:n}=Y(),s=`${e.id}/${n.id}`;let a;t[0]!==s?(a=de.taskLastViewed(s),t[0]=s,t[1]=a):a=t[1];const[,o]=le(a,Ut);let r;return t[2]!==o?(r={markTaskRead:h=>{o(m=>({...m,[h]:new Date().toISOString()}))}},t[2]=o,t[3]=r):r=t[3],r}function Ut(t){return t??{}}function Be(){const t=Fe(),{org:e}=Y(),n=Ue({strict:!1}),s=et({strict:!1}),a=n.virtualmcpid??ht(e.id).id,o=(h,m)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:h},search:S=>{const C={},F=m?.virtualMcpId??S.virtualmcpid;F&&(C.virtualmcpid=F);const f=S.main;return f&&typeof f=="string"&&!St(f)&&(C.main=f),(S.sidepanel==="chat"||S.sidepanel===0)&&(C.sidepanel=S.sidepanel),m?.autosend&&(C.autosend=je),C}})},r=y.useRef(crypto.randomUUID()),l=s.taskId??r.current;return{virtualMcpId:a,taskId:l,navigateToTask:o}}function jt(t,e){const{mimeType:n,data:s}=t;if(n.startsWith("text/"))try{const a=new TextDecoder().decode(Uint8Array.from(atob(s),o=>o.charCodeAt(0)));return[{type:"text",text:`${e}
11
- ${a}`}]}catch(a){console.error("Failed to decode text file:",a)}return[{type:"file",url:`data:${n};base64,${s}`,filename:e,mediaType:n}]}function $e(t,e){const n=[];for(const s of t)"text"in s&&s.text?n.push({type:"text",text:`[${e}]
12
- ${s.text}`}):"blob"in s&&s.blob&&s.mimeType&&n.push({type:"file",url:`data:${s.mimeType};base64,${s.blob}`,filename:String(s.uri),mediaType:String(s.mimeType)});return n}function Qt(t,e){const n=(t.files??[]).filter(r=>r.content?.trim()),s=t.omittedPaths??[];if(n.length===0&&s.length===0)return[];const a=n.map(r=>`<skill-file path="${r.relPath}">
13
- ${r.content.trim()}
14
- </skill-file>`).join(`
15
-
16
- `),o=s.length>0?`
17
-
18
- Other files in \`${t.sandboxPath}/\`: ${s.join(", ")}`:"";return[{type:"text",text:`[${e}]
19
- ${a}${o}`}]}function Kt(t,e){const n=[];for(const s of t){if(s.role!=="user"||!s.content)continue;const a=Array.isArray(s.content)?s.content:[s.content];for(const o of a)switch(o.type){case"text":{const r=o.text?.trim();if(!r)continue;n.push({type:"text",text:`[${e}]
20
- ${r}`});break}case"image":case"audio":{if(!o.data||!o.mimeType)continue;n.push({type:"file",url:`data:${o.mimeType};base64,${o.data}`,mediaType:o.mimeType});break}case"resource":{const r=o.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?n.push({type:"text",text:`[${e}]
21
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&n.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return n}function He(t){if(!t)return[];const e=[];let n="";const s=a=>{if(a){if(a.type==="text"&&"text"in a&&typeof a.text=="string")n+=a.text;else if(a.type==="mention"&&a.attrs){const o=a.attrs.char??"/",r=`${o}${a.attrs.name}`;if(n+=r,o==="@"){const l=a.attrs.metadata;l&&!Array.isArray(l)&&"agentId"in l?e.push({type:"text",text:`[DELEGATE TO AGENT: ${l.title??a.attrs.name} (agent_id: ${l.agentId})]
22
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(l)&&e.push(...$e(l,r))}else if(a.attrs.kind==="skill"){const l=a.attrs.metadata;l&&!Array.isArray(l)&&Array.isArray(l.files)&&e.push(...Qt(l,r))}else{const l=a.attrs.metadata||a.attrs.prompts||[];Array.isArray(l)&&l.length>0&&"role"in l[0]?e.push(...Kt(l,r)):Array.isArray(l)&&e.push(...$e(l,r))}}else if(a.type==="file"&&a.attrs){const o=a.attrs,r=`[file:://${encodeURIComponent(o.name)}]`;n+=r,e.push(...jt(o,r))}if("content"in a&&Array.isArray(a.content))for(const o of a.content)s(o)}};return s(t),n.trim()&&e.unshift({type:"text",text:n.trim()}),e}function Cn(t){const e=He(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}function kn(t){return new Set(t.filter(e=>e.status==="queued").map(e=>e.messageId))}function Wt(t){return(t??[]).map(e=>e?.type==="text"&&typeof e.text=="string"?e.text:"").join("").trim()}function Mn(t){return t.filter(e=>e.status==="queued").sort((e,n)=>e.enqueuedAt-n.enqueuedAt)}function Vt(t,e){return t.some(n=>n.messageId===e.messageId)?t:[...t,e]}function Bt(t,e){return t.filter(n=>n.messageId!==e)}const De=new Map,Ee=new Set;function Ht(t){Ee.add(t)}function Gt(t){return Ee.has(t)}function zt(t){Ee.delete(t)}function ye(t){let e=De.get(t);return e||(e=new ct([]),De.set(t,e)),e}function Ge(t,e){ye(t).update(n=>Vt(n,e))}function we(t,e){ye(t).update(n=>Bt(n,e))}function Xt(t,e){ye(t).set(e)}const be=new Map;function Zt(t,e){be.set(`${t}:${e.id}`,e)}function Yt(t,e){const n=`${t}:${e}`,s=be.get(n);return be.delete(n),s}function Oe(t,e){be.delete(`${t}:${e}`)}async function Z(t,e){try{const n=await fetch(`/api/${encodeURIComponent(t)}/decopilot/queue/${encodeURIComponent(e)}`,{credentials:"include"});if(!n.ok)return;const s=await n.json();Xt(e,s.items??[])}catch{}}function Tn(t){const e=oe.c(2);let n;e[0]!==t?(n=ye(t),e[0]=t,e[1]=n):n=e[1];const s=n;return y.useSyncExternalStore(s.subscribe,s.get,s.get)}function Jt(){const{org:t}=Y();return{enqueue:Ge,refresh:e=>Z(t.slug,e),cancel:async(e,n)=>{const s=`thread-run:${e}:${n}`;we(e,n);try{const a=await fetch(`/api/${encodeURIComponent(t.slug)}/decopilot/queue/${encodeURIComponent(e)}/cancel/${encodeURIComponent(s)}`,{method:"POST",credentials:"include"});if(!a.ok&&a.status!==404)throw new Error(`Cancel failed: ${a.status}`);return!0}catch(a){return ae.error(a instanceof Error?a.message:"Failed to cancel"),!1}finally{await Z(t.slug,e)}}}}function ne(t,e,n,s){if(!t)return null;const a=e.find(r=>r.id===t.keyId);if(!a)return null;const o=n.find(r=>r.modelId===t.modelId);return o?{...o,keyId:t.keyId}:{modelId:t.modelId,title:s??t.modelId,keyId:t.keyId,providerId:a.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function en(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function tn(t,e,n,s){if(!n||s.length===0)return null;const a=e.find(h=>h.id===n);if(!a)return null;const o=_t([a],{[n]:s}),r=t==="fast"?o.chat.fast:t==="thinking"?o.chat.thinking:o.chat.smart;if(!r)return null;const l=s.find(h=>h.modelId===r.modelId);return l?{...l,keyId:n}:null}const Le=new Set,se=new Set;function ce(t){return y.useSyncExternalStore(t.subscribe,t.get,t.get)}function nn(t){return t.kind==="loading"?"ready":t.kind}const sn=1e4,an=10,Ae=y.createContext(null),_e=y.createContext(null),Re=y.createContext(null),ze=y.createContext(null);function on({children:t}){const{locator:e}=Y(),{virtualMcpId:n}=Be(),[s,a]=le(de.chatSelectedImageModel(e),null),[o,r]=le(de.chatSelectedWebSearchModel(e),null),[l,h]=le(de.chatSelectedDeepResearchModel(e),null),[m,S]=y.useState(null),[C,F]=y.useState("default"),f=It(),[$,W]=le(de.chatSimpleModeTier(e),null),L=en($),k=yt(),M=f.tiers[L],D=m&&k.some(i=>i.id===m)?m:M?.keyId??k[0]?.id??null,{models:v,isLoading:V}=ge(D??void 0),{models:G}=ge(M?.keyId),{models:J}=ge(f.tiers.image?.keyId),{models:w}=ge(f.tiers.web_search?.keyId),{models:B}=ge(f.tiers.deep_research?.keyId),z=ne(M,k,G,M?.title)??tn(L,k,D,v),U=V,H=v.filter(i=>i.capabilities?.includes("image")),j=ne(s,k,H),u=ne(f.tiers.image,k,J,f.tiers.image?.title)??j??H[0]??null,_=v.filter(We),N=ne(o,k,_),ee=_.find(i=>i.modelId==="perplexity/sonar")??_[0]??null,Q=ne(f.tiers.web_search,k,w,f.tiers.web_search?.title)??N??ee,q=v.filter(Ve),T=ne(l,k,q),I=q.find(i=>i.modelId==="perplexity/deep-research")??q.find(i=>i.asyncResearch===!0)??q[0]??null,X=ne(f.tiers.deep_research,k,B,f.tiers.deep_research?.title)??T??I,xe=gt(n)??{id:n,title:"",description:null,icon:null},[Ce,fe]=y.useState({}),Se=(i,R)=>{const P=[];for(const A of R.content??[])A.type==="text"&&A.text?.trim()&&P.push(A.text.trim());const b=P.join(`
23
- `);if(!b){he(i);return}new TextEncoder().encode(b).length>sn||fe(A=>Object.keys(A).length>=an&&!(i in A)?A:{...A,[i]:b})},he=i=>{fe(R=>{const{[i]:P,...b}=R;return b})},[re,ke]=le(de.chatLastAgentOption(e),i=>i&&i in Ie?i:null),te=ln(),Me=te?.isThreadLocked&&te.lockedHarness!=null?Dt(te.lockedHarness,te.lockedSandbox):null,Te=Pt(),ve=Ot(re,Te.ready&&!Te.online),me=te?.isThreadLocked?Me:ve,c=me?Ie[me]:null,d=c?.harness??null,O=c?.sandbox??null,[E,p]=y.useState(void 0),x=y.useRef(E);x.current=E;const g={selectedModel:z,setModel:()=>{},credentialId:D,setCredentialId:S,allModelsConnections:k,isModelsLoading:U,selectedVirtualMcp:xe,imageModel:u,setImageModel:i=>{a(i?.keyId?{keyId:i.keyId,modelId:i.modelId}:null)},webSearchModel:Q,setWebSearchModel:i=>{r(i?.keyId?{keyId:i.keyId,modelId:i.modelId}:null)},deepResearchModel:X,setDeepResearchModel:i=>{h(i?.keyId?{keyId:i.keyId,modelId:i.modelId}:null)},chatMode:C,setChatMode:F,appContexts:Ce,setAppContext:Se,clearAppContext:he,tiptapDoc:E,setTiptapDoc:p,tiptapDocRef:x,resetInteraction:()=>{},simpleModeTier:L,setSimpleModeTier:i=>W(i),pendingAgentOption:me,setPendingAgentOption:ke,pendingHarnessId:d,pendingSandboxProviderKind:O};return K.jsx(Re.Provider,{value:g,children:t})}function wn(t){const e=oe.c(41),{virtualMcpId:n,task:s,children:a}=t,{locator:o}=Y(),{data:r}=nt.useSession(),l=r?.user??null,{taskId:h,virtualMcpId:m,navigateToTask:S}=Be(),[C]=st(),{markTaskRead:F}=Ft(),f=ut(),$=h,W=m,L=Nt(W);let k;e[0]!==F||e[1]!==S?(k=(T,I)=>{F(T),S(T,{virtualMcpId:I?.virtualMcpId,autosend:I?.autosend})},e[0]=F,e[1]=S,e[2]=k):k=e[2];const M=k,D=$&&s?.id===$?s:null,v=D?.harness_id??null,V=D?.sandbox_provider_kind??null,G=D?.branch??null,J=v!=null,w=G;let B;e[3]!==w||e[4]!==M||e[5]!==f||e[6]!==n?(B=()=>{const T=crypto.randomUUID();return f.create({id:T,virtual_mcp_id:n,...w?{branch:w}:{}}).then(()=>M(T)).catch(()=>{M(T)}),T},e[3]=w,e[4]=M,e[5]=f,e[6]=n,e[7]=B):B=e[7];const z=B;let U;e[8]!==w||e[9]!==o||e[10]!==M||e[11]!==f||e[12]!==n?(U=T=>{const I=crypto.randomUUID(),X=T.virtualMcpId??n,pe=X===n?w:null;it(sessionStorage,o,I,T.message),f.create({id:I,virtual_mcp_id:X,...pe?{branch:pe}:{}}).then(()=>M(I,{virtualMcpId:T.virtualMcpId,autosend:!0})).catch(()=>{M(I,{virtualMcpId:T.virtualMcpId,autosend:!0})})},e[8]=w,e[9]=o,e[10]=M,e[11]=f,e[12]=n,e[13]=U):U=e[13];const H=U;let j;e[14]!==$||e[15]!==f?(j=T=>{$&&f.setBranch($,T)},e[14]=$,e[15]=f,e[16]=j):j=e[16];let u;e[17]!==D||e[18]!==z||e[19]!==H||e[20]!==w||e[21]!==$||e[22]!==W||e[23]!==J||e[24]!==G||e[25]!==v||e[26]!==V||e[27]!==M||e[28]!==j?(u={virtualMcpId:W,taskId:$,openTask:M,createTask:z,createTaskWithMessage:H,activeTask:D,isThreadLocked:J,lockedHarness:v,lockedSandbox:V,lockedBranch:G,currentBranch:w,setCurrentTaskBranch:j},e[17]=D,e[18]=z,e[19]=H,e[20]=w,e[21]=$,e[22]=W,e[23]=J,e[24]=G,e[25]=v,e[26]=V,e[27]=M,e[28]=j,e[29]=u):u=e[29];const _=u;let N;e[30]!==L||e[31]!==C||e[32]!==S||e[33]!==l?(N={user:l,contextPrompt:L,preferences:C,rawNavigateToTask:S},e[30]=L,e[31]=C,e[32]=S,e[33]=l,e[34]=N):N=e[34];const ee=N;let Q;e[35]!==a||e[36]!==ee?(Q=K.jsx(on,{children:K.jsx(ze.Provider,{value:ee,children:a})}),e[35]=a,e[36]=ee,e[37]=Q):Q=e[37];let q;return e[38]!==Q||e[39]!==_?(q=K.jsx(_e.Provider,{value:_,children:Q}),e[38]=Q,e[39]=_,e[40]=q):q=e[40],q}function En({taskId:t,children:e}){const{virtualMcpId:n,activeTask:s,currentBranch:a}=rn();t&&!Le.has(t)&&(Le.add(t),tt("chat_opened",{thread_id:t}));const{imageModel:o,webSearchModel:r,deepResearchModel:l,chatMode:h,setChatMode:m,appContexts:S,setTiptapDoc:C,simpleModeTier:F,pendingSandboxProviderKind:f,pendingHarnessId:$}=cn(),W=y.useContext(ze);if(!W)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:L,contextPrompt:k,preferences:M,rawNavigateToTask:D}=W,{org:v,locator:V}=Y(),G=Jt(),[J,w]=y.useState(null),B=qt(),z=qe(),U=lt(),H=Fe(),j=ft({connectionId:mt,orgId:v.id,orgSlug:v.slug}),u=dt(v.slug,t,{client:j});y.use(u.ready);const _=ce(u.messages),N=ce(u.status),ee=ce(u.finishReason),Q=ce(u.runStatusStage),q=ce(u.hasMoreOlder),T=ce(u.isFetchingOlder),I=y.useRef({onToolCall:B,queryClient:z,rawNavigateToTask:D,taskId:t,manager:U,navigate:H,orgId:v.id,orgSlug:v.slug});I.current={onToolCall:B,queryClient:z,rawNavigateToTask:D,taskId:t,manager:U,navigate:H,orgId:v.id,orgSlug:v.slug},xt({orgSlug:v.slug,taskId:t,onTaskStatus:c=>{const d=I.current,O=c.data.message_id;if(c.data.status==="in_progress"&&O){we(d.taskId,O);const E=Yt(d.taskId,O);E&&u.applyLocalMessage(E),Z(d.orgSlug,d.taskId)}Gt(d.taskId)&&(async()=>(await Z(d.orgSlug,d.taskId),await u.reconcileFromServer()&&ye(d.taskId).get().length===0&&zt(d.taskId)))()}}),y.useEffect(()=>{const c={onData:p=>{if(p.type==="data-thread-title"){const x=p.data;if(!x?.title)return;const g=I.current;if(!g.taskId)return;g.manager.patchThread({id:g.taskId,title:x.title,updated_at:new Date().toISOString()});return}if(p.type==="data-deck-updated"){const x=p.data;if(!x?.path)return;const g=x.path,i=I.current;i.queryClient.invalidateQueries({queryKey:ue.orgFsStat(i.orgId,"home",g)}),i.queryClient.invalidateQueries({queryKey:ue.orgFsRecent(i.orgId)}),i.navigate({to:".",search:R=>({...R,main:vt(g)}),replace:!0});return}if(p.type==="data-open-preview"){const x=p.data,g=I.current,i=g.taskId;if(i){const R=g.manager.threads.get().find(P=>P.id===i);g.manager.patchThread({id:i,...x?.branch?{branch:x.branch}:{},...x?.sandboxProviderKind?{sandbox_provider_kind:x.sandboxProviderKind}:{},metadata:{...R?.metadata??{},...x?.githubRepo?{githubRepo:x.githubRepo}:{},...x?.sandboxMap?{sandboxMap:x.sandboxMap}:{}}})}g.navigate({to:".",search:R=>({...R,main:"preview"}),replace:!0});return}},onFinish:(p,x,g)=>{const i=I.current;i.taskId&&Z(i.orgSlug,i.taskId),i.taskId&&i.manager.patchThread({id:i.taskId,status:$t(g,p.parts),updated_at:new Date().toISOString()});const R=p.parts?.some(b=>{const A=b;return(A.type==="tool-share_with_user"||A.type==="tool-bash"||A.type==="tool-write")&&A.state==="output-available"});if(i.taskId&&R){const b=ue.threadOutputs(i.taskId);for(const A of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{i.queryClient.invalidateQueries({queryKey:b})},A)}i.queryClient.invalidateQueries({queryKey:ue.homeNextActions(i.orgSlug)});const P=p.metadata?.thread_id;P&&P!==i.taskId&&i.rawNavigateToTask(P)},onError:p=>{w(p),console.error("[chat] Error",p)},onToolCall:p=>I.current.onToolCall(p)};u.observer=c,Z(I.current.orgSlug,I.current.taskId);const d=p=>p==="submitted"||p==="streaming";let O=d(u.status.get().kind);const E=u.status.subscribe(()=>{const p=d(u.status.get().kind);if(p===O)return;O=p;const x=I.current;Z(x.orgSlug,x.taskId)});return()=>{u.observer===c&&(u.observer=null),E()}},[u]);const X=N.kind==="submitted"||N.kind==="streaming",pe=_.length===0,xe=_.at(-1),Ce=!X&&xe?.role==="assistant"&&xe.parts.some(c=>"state"in c&&c.state==="approval-requested"),fe=s,Se=(fe?.status==="in_progress"||fe?.status==="expired")&&N.kind==="ready"&&_.length>0;async function he(c){const d=t,O=n,E=Object.entries(S),p=E.length>0?E.map(([P,b])=>`### App Context: ${P}
24
- ${b}`).join(`
25
-
26
- `):"",x=[k,p].filter(Boolean).join(`
27
-
28
- `);let g=h;g==="gen-image"&&!o&&(g="default"),g==="web-search"&&!r&&(g="default"),g==="deep-research"&&!l&&(g="default"),(g==="web-search"||g==="deep-research")&&m("default");const i=Lt({thread:s?{harness_id:s.harness_id??null,sandbox_provider_kind:s.sandbox_provider_kind??null,branch:s.branch??null}:null,globals:{harnessId:$??void 0,sandboxProviderKind:f??void 0,branch:a}});s?.harness_id||U.patchThread({id:d,harness_id:i.harnessId??"decopilot",sandbox_provider_kind:i.sandboxProviderKind??null,updated_at:new Date().toISOString()});const R={tier:F,mode:g,toolApprovalLevel:M.toolApprovalLevel??at(),system:x||void 0,agent:{id:O},thread_id:d,...i};try{if(X||Se){let P=!0;try{Zt(d,c),await u.enqueue(c,R),Ge(d,{workflowId:`thread-run:${d}:${c.id}`,messageId:c.id,text:Wt(c.parts),hasAttachments:c.parts.some(b=>b.type==="file"),status:"queued",enqueuedAt:Date.now(),optimistic:!0}),Ht(d)}catch(b){P=!1,Oe(d,c.id),we(d,c.id),w(b instanceof Error?b:new Error(String(b))),ae.error(b instanceof Error?b.message:"Failed to queue message")}return Z(v.slug,d),P}return await u.submit({kind:"message",message:c},R),!0}finally{se.delete(d)}}async function re(c){const d=c.parts??He(c.tiptapDoc);if(d.length===0||se.has(t))return;se.add(t),w(null),C(void 0);const O={tiptapDoc:c.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:L?.image??void 0,name:L?.name??"you"}},E={id:crypto.randomUUID(),role:"user",parts:d,metadata:O};await he(E)}async function ke(c,d){if(se.has(t))return ae.info("Still sending your previous message — try again in a moment"),!1;if(se.add(t),!await G.cancel(t,c))return se.delete(t),ae.error("Couldn't remove the original message"),!1;Oe(t,c),u.removeLocalMessage(c);const E={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:d}],metadata:{created_at:new Date().toISOString(),user:{avatar:L?.image??void 0,name:L?.name??"you"}}};try{return await he(E)}catch(p){return ae.error(p instanceof Error?p.message:"Failed to send edited message"),!1}}const te=async()=>{u.stop();try{const c=await fetch(`/api/${v.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(c.status===404)return;if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.message??`Cancel failed: ${c.status}`)}}catch(c){const d=c instanceof Error?c.message:"Failed to cancel";ae.error(d),console.error("[chat] cancelRun",c)}},Me=c=>c&&typeof c=="object"&&"type"in c?re({tiptapDoc:c}):re(c),ve=Ue({strict:!1}).autosend===je;y.useEffect(()=>{if(!ve||_.length>0)return;const c=ot(sessionStorage,V,t);c&&re(c.message).then(()=>{rt(sessionStorage,V,t)})},[ve,_.length,V,t,re]);const me={messages:_,status:nn(N),sendMessage:Me,editQueuedMessage:ke,stop:()=>{te()},submit:(c,d)=>u.submit(c,d),removeLocalMessage:c=>u.removeLocalMessage(c),isSendInFlight:()=>se.has(t),error:J,clearError:()=>w(null),finishReason:ee,runStatusStage:Q,clearFinishReason:()=>u.finishReason.set(null),isStreaming:X,isChatEmpty:pe,isWaitingForApprovals:Ce??!1,isRunInProgress:Se,hasMoreOlder:q,isFetchingOlder:T,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return K.jsx(Ae.Provider,{value:me,children:e})}function An(){const t=y.useContext(Ae);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function _n(){return y.useContext(Ae)}function rn(){const t=y.useContext(_e);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function cn(){const t=y.useContext(Re);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function Rn(){return y.useContext(Re)}function ln(){return y.useContext(_e)}export{En as A,on as C,In as S,cn as a,An as b,ln as c,rn as d,Tn as e,Jt as f,Oe as g,_n as h,wn as i,kn as j,He as k,Be as l,Rn as m,We as n,Ve as o,bn as p,_t as q,Mn as s,Cn as t,Pt as u};
@@ -1 +0,0 @@
1
- import{c as y,j as t,B as F,i as Z,H as Qe,I as se,E as Pe,r as T,C as le,M as Ge,l as V,bd as Ye,u as Ze,L as Q,t as Xe,e as ae,aZ as ke}from"./index-BEqdT-CX.js";import{E as Ee}from"./empty-state-C6JrR5eZ.js";import{u as et,a as Ae}from"./use-collections-Dy7WD_eH.js";import{u as ce}from"./use-mcp-client-DvvHwezb.js";import{F as ne,a as tt,b as de,d as me}from"./form-p6ZihW38.js";import{I as ue}from"./input-CqfDyI-C.js";import{T as re}from"./textarea-B9g6Z2-r.js";import{a as st,b as nt,V as pe,O as ot,M as it}from"./index-BN6_Cjv8.js";import{al as rt,L as lt,ah as at,Q as ct,$ as dt,am as mt,U as be}from"./agent-icon-jdj2JAEm.js";import{g as ut,M as pt,a as Ne}from"./index-BXfKOYdf.js";import{A as xt,a as ft,b as ht}from"./alert-U_1RTm6v.js";import{S as ve,a as Se,b as ye,c as we,d as oe}from"./select-Bh2Z8rK3.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-C7c-Tgru.js";import{i as jt}from"./AlertCircle-DFFB807G.js";import{s as bt}from"./Stars02-CzKVb8lE.js";import{a as Nt}from"./Copy01-BEB5hDKQ.js";import{i as vt}from"./Play-BPQdBfbt.js";import{i as St}from"./ChevronRight-UlscOqp6.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./use-mcp-auth-status-Dy_Y2kKR.js";import{a as Oe,u as Re}from"./use-connection-DUpx0NEA.js";import{a as It}from"./use-mcp-tools-Be4djRS3.js";import{M as $t,c as Tt}from"./monaco-editor-YwujFe9g.js";import{I as Te}from"./integration-icon-Dhyv93zr.js";import{h as Pt,m as kt}from"./chat-context-CAoh3qxf.js";import{u as Et}from"./shell-layout-CcPRSmgX.js";import{n as At}from"./Tool02-csu1mOp1.js";import"./constants-D_FQAPnt.js";import"./auth-BR_fNNK7.js";import"./label-DbwTUWd9.js";import"./index-BXTPhNSj.js";import"./sidebar-CRtkHPvX.js";import"./LayoutLeft-CNWN8tpf.js";import"./use-mobile-DbBFg2WD.js";import"./X-CTTK5Zj2.js";import"./ZoomOut-CvmU5uj5.js";import"./Key01-xPUeBTf6.js";import"./extract-connection-data-DEmXsdA0.js";import"./use-registry-connections-CX_dlku1.js";import"./use-organization-settings-CpbybQHD.js";import"./studio-tools-Cdt3UzXo.js";import"./Plus-C8FiAr3i.js";import"./index-DmYBKzjc.js";import"./index-Dz8rxMiO.js";import"./popover-BJYBT3EY.js";import"./use-virtual-mcp-CNKe_WaY.js";import"./Check-BAiULwRg.js";import"./SearchMd-Gwm-384G.js";import"./Users03-Iz-TpUuJ.js";import"./use-create-virtual-mcp-Bbp45Sum.js";import"./use-navigate-to-agent-CBi1-FBB.js";import"./hooks-DYM3Q-Vq.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./XCircle-CiVL5z-e.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./CheckCircle-BwwAyNzV.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronUp-CqCnswy_.js";import"./Circle-pOPoWDQn.js";import"./DotsVertical-BFfMlorx.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./SearchLg-CMWIHllt.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Trash01-DZTkGJqE.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./Zap-CrYnUVJy.js";import"./badge-zT-Fh3qN.js";import"./mcp-oauth-CeGeftbL.js";import"./index-BTfVRtBq.js";import"./autosend-CIDdvZqc.js";import"./use-ai-providers-C7iVrgY-.js";import"./use-decopilot-events-btxE-D2k.js";import"./tab-id-BijBBRwE.js";import"./avatar-DJpRqbqg.js";import"./dialog-BboVhzku.js";import"./alert-dialog-DtmlB9JL.js";import"./required-auth-layout-BXaZVxWQ.js";import"./use-org-sso-BA_UxewI.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:i,isSaving:r,saveLabel:a,undoLabel:c}=s,l=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!i)return null;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(rt,{size:14}),e[0]=p):p=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[p,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let x;e[5]!==r?(x=r?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(lt,{size:14}),e[5]=r,e[6]=x):x=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==l||e[10]!==x?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":l,children:[x,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=x,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Qe({title:se().min(1),description:se().nullable(),body:se()});function ie(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let i;e[1]!==o.control?(i=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:zt}),t.jsx(ne,{control:o.control,name:"description",render:Dt})]})]}),e[1]=o.control,e[2]=i):i=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Mt})]}),e[5]=o.control,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsx(tt,{...o,children:l}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function Mt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Dt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:i}=le(),r=o||null;let a;e[0]!==i.id||e[1]!==i.slug||e[2]!==r?(a={connectionId:r,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),l=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),p=u.update.isPending;let m;e[4]!==l?(m=l?{title:l.title,description:l.description??null,body:ie(l)}:void 0,e[4]=l,e[5]=m):m=e[5];let x;e[6]!==m?(x={values:m},e[6]=m,e[7]=x):x=e[7];const f=Ge(x);let g;e[8]!==f||e[9]!==l?(g=()=>{l&&f.reset({title:l.title,description:l.description??null,body:ie(l)})},e[8]=f,e[9]=l,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:ie(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!l){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==l.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:l.title}),e[16]=l.title,e[17]=$):$=e[17];let E;e[18]!==l.description?(E=l.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:l.description})]}):null,e[18]=l.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==p||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:p})}),e[25]=f.formState.isDirty,e[26]=p,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(pe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const i=n;if(!i){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:i,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let i;e[3]!==o?(i=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let i;e[3]!==o?(i=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let i;e[3]!==o?(i=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function G(s){const e=y.c(10);let o,n,i;e[0]!==s?({asChild:o,className:n,...i}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=i):(o=e[1],n=e[2],i=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...i}),e[6]=r,e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let i;e[3]!==o?(i=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=i):i=e[4];let r;return e[5]!==n||e[6]!==i?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i,...n}),e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,i;e[0]!==s?({children:o,className:n,...i}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=i):(o=e[1],n=e[2],i=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==i||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...i,children:a}),e[8]=i,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:i,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const l=wt(c);if(!l.isAuthenticated){let m;return e[2]!==l.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(it,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let p;return e[5]!==n||e[6]!==r||e[7]!==i||e[8]!==u||e[9]!==o?(p=t.jsx(Vt,{toolName:o,connectionId:n,siblings:i,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=i,e[8]=u,e[9]=o,e[10]=p):p=e[10],p}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:i}=Ze({strict:!1}),r=(()=>{if(!i)return null;const d=`replay-${i}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,l]=T.useState(a??{}),[u,p]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,x]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=le(),k=Oe(e),N=Pt(),A=kt(),{openSidePanel:U}=Et(),z=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=Tt(d.content);h.content.length>0&&(U("chat"),N.sendMessage({tiptapDoc:h}))},[M,X]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(X("ui"),Le(!0));const xe=j?.inputSchema?.properties,fe=xe?Object.keys(xe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),x(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const D=u.trim();if(!D)return{};const B=JSON.parse(D);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([D,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[D]=="string")try{h[D]=JSON.parse(h[D])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[D]=="string"&&h[D]!==""){const je=Number(h[D]);Number.isNaN(je)||(h[D]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);x(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{l(v=>({...v,[d]:h}))},Be=()=>{x(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(Me,{children:[t.jsx(q,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(De,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-destructive",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-destructive text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>p(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(xt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&M==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(pt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(z,d),onTeardown:()=>A?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx($t,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(pe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success animate-pulse shrink-0"}):L.isLoading?t.jsx(Z,{size:10,className:"animate-spin text-warning shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-destructive shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:i}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(x=>x.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const l=c;if(!Oe(l||void 0)||!l){let x;return e[3]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=x):x=e[3],x}let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=p):p=e[4];let m;return e[5]!==l||e[6]!==i||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:p,children:t.jsx(Ft,{toolName:o,connectionId:l,siblings:n,onSelectInstance:a,onBack:i})}),e[5]=l,e[6]=i,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:i,description:r,buttonProps:a,buttonComponent:c,className:l,children:u}=s;let p;e[0]!==l?(p=V("flex flex-col items-center justify-center py-16 text-center",l),e[0]=l,e[1]=p):p=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let x;e[5]!==i?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i}),e[5]=i,e[6]=x):x=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==x||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[x,f]}),e[9]=x,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==p||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:p,children:[m,g,S,u]}),e[15]=u,e[16]=p,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),i=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const l=c,u=Wt;let p;return s[5]!==l||s[6]!==i||s[7]!==a?(p=t.jsx(Jt,{itemId:i,siblings:a,onBack:l,onUpdate:u}),s[5]=l,s[6]=i,s[7]=a,s[8]=p):p=s[8],p}async function Wt(s){return Promise.resolve()}function Qt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Gt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),i=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:l}=le();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,x=m?.id??"",f=x||"no-connection",g=x??null;let S;s[5]!==l.id||s[6]!==l.slug||s[7]!==g?(S={connectionId:g,orgId:l.id,orgSlug:l.slug},s[5]=l.id,s[6]=l.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,i,I);let $;s[9]!==R||s[10]!==r?($=async M=>{r&&await R.update.mutateAsync({id:r,data:M})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==i?(P=i?.toLowerCase(),s[12]=i,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==i?(C=Qt(i),s[14]=i,s[15]=C):C=s[15];const k=C;let N;s[16]!==l.slug?(N=t.jsx(q,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:l.slug},children:"Connections"})})}),s[16]=l.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==i||s[20]!==m||s[21]!==l.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:l.slug,appSlug:n.appSlug},search:{tab:i},children:m.title})})}),t.jsx(Y,{})]}),s[19]=i,s[20]=m,s[21]=l.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let z;s[24]!==k?(z=t.jsx(q,{children:t.jsx(De,{children:k})}),s[24]=k,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(Me,{children:[N,A,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let M;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(M=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=M):M=s[34],M}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(pe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Gt,{}),s[2]=r):r=s[2],r}function Gn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Gn as default};
@@ -1 +0,0 @@
1
- import{c as E,j as o,u as Ie,o as De,p as se,r as M,a as Se,b as Fe,q as qe,d as Te,s as Le,Q as He,E as Ve,K as _e,v as Ue,B as je,N as Be}from"./index-BEqdT-CX.js";import{L as Ke,s as ve,S as Pe,a as Ne,b as Ce,c as be,i as Qe,n as pe,C as we,p as xe}from"./self-tool-result-BkP7cEqy.js";import{A as We}from"./auth-entry-CsuZU0Hz.js";import{A as Ge}from"./auth-split-layout-HOd3Qhyr.js";import{O as Re}from"./organization-choice-D3k9ZPpO.js";import{I as Ye}from"./input-CqfDyI-C.js";import{u as Je}from"./use-mcp-client-DvvHwezb.js";import{S as Xe,W as Ze,g as et,a as tt}from"./constants-D_FQAPnt.js";import{i as it}from"./XCircle-CiVL5z-e.js";import"./integration-icon-Dhyv93zr.js";import"./Tool02-csu1mOp1.js";import"./agent-icon-jdj2JAEm.js";import"./AlertCircle-DFFB807G.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./ZoomOut-CvmU5uj5.js";import"./Users03-Iz-TpUuJ.js";import"./CheckCircle-BwwAyNzV.js";import"./Check-BAiULwRg.js";import"./ChevronDown-Cpk84lU5.js";import"./ChevronRight-UlscOqp6.js";import"./ChevronUp-CqCnswy_.js";import"./Circle-pOPoWDQn.js";import"./Stars02-CzKVb8lE.js";import"./Copy01-BEB5hDKQ.js";import"./DotsVertical-BFfMlorx.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LayoutLeft-CNWN8tpf.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./Plus-C8FiAr3i.js";import"./SearchLg-CMWIHllt.js";import"./SearchMd-Gwm-384G.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Trash01-DZTkGJqE.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./XClose-DxMKQUUD.js";import"./X-CTTK5Zj2.js";import"./Zap-CrYnUVJy.js";import"./dialog-BboVhzku.js";import"./tooltip-C7c-Tgru.js";import"./companions-core-Zwoux9HO.js";import"./extract-connection-data-DEmXsdA0.js";import"./provision-repo-scoped-github-connection-CB4ICKHq.js";import"./form-p6ZihW38.js";import"./label-DbwTUWd9.js";import"./use-debounced-value-BqHYI-kn.js";import"./authenticate-and-persist-oauth-BuaZSTeD.js";import"./mcp-oauth-CeGeftbL.js";import"./auth-BR_fNNK7.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DJpRqbqg.js";const ot={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function nt(l){return ot[l]}function ye(l){const e=E.c(4),{variant:i}=l;let t;e[0]!==i?(t=nt(i),e[0]=i,e[1]=t):t=e[1];let s;return e[2]!==t?(s=o.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:o.jsx(Ke,{label:t,className:"text-muted-foreground"})}),e[2]=t,e[3]=s):s=e[3],s}function $i(){const l=E.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(st,{}),l[0]=e):e=l[0],e}const Me=M.createContext(null),$e=()=>M.useContext(Me);function R(l){const e=E.c(13);let i,t;e[0]!==l?({visual:t,...i}=l,e[0]=l,e[1]=i,e[2]=t):(i=e[1],t=e[2]);let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/commerce-onboarding"},e[3]=s):s=e[3];const c=Ie(s),{data:a}=Se.useSession(),n=a?.user?.email;let m;e[4]!==c.siteUrl||e[5]!==n?(m=Ce({siteUrl:c.siteUrl,email:n}),e[4]=c.siteUrl,e[5]=n,e[6]=m):m=e[6];const d=m;let u;e[7]!==d||e[8]!==t?(u=t??o.jsx(be,{href:d}),e[7]=d,e[8]=t,e[9]=u):u=e[9];let v;return e[10]!==i||e[11]!==u?(v=o.jsx(Ge,{...i,visual:u}),e[10]=i,e[11]=u,e[12]=v):v=e[12],v}const rt={signUpFailed:"Falha ao criar conta",signInFailed:"Falha ao entrar",authenticationFailed:"Falha na autenticação",resetEmailFailed:"Não foi possível enviar o e-mail de redefinição",otpSendFailed:"Não foi possível enviar o código",invalidCode:"Código inválido",invalidEmail:"E-mail inválido",invalidEmailOrPassword:"E-mail ou senha inválidos. Tente novamente.",accountExists:"Já existe uma conta com este e-mail. Tente entrar em vez de criar uma nova conta.",networkError:"Erro de rede. Verifique sua conexão e tente novamente.",tooManyAttempts:"Muitas tentativas. Aguarde um momento e tente novamente.",invalidOrExpiredCode:"Código inválido ou expirado. Tente novamente.",genericError:"Algo deu errado. Tente novamente.",resetPasswordTitle:"Redefinir sua senha",verificationCodeTitle:"Informe o código de verificação",welcomeTitle:"Bem-vindo à deco",resetPasswordSubtitle:"Enviaremos um link de redefinição",codeSentTo:l=>`Código enviado para ${l}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:l=>`Continuar com ${l}`,divider:"ou",emailLabel:"E-mail",emailPlaceholder:"Endereço de e-mail",sending:"Enviando...",sendCode:"Enviar código",verificationCodeLabel:"Código de verificação",enterCodePlaceholder:"Informe o código",verifying:"Verificando...",verify:"Verificar",useDifferentEmail:"Usar outro e-mail",sendResetLink:"Enviar link de redefinição",nameLabel:"Nome",namePlaceholder:"Seu nome",passwordLabel:"Senha",forgotPassword:"Esqueceu a senha?",creatingAccount:"Criando conta...",signingIn:"Entrando...",continue:"Continuar",backToSignIn:"Voltar para entrar",signInWithPassword:"Entrar com senha",alreadyHaveAccount:"Já tem uma conta? ",dontHaveAccount:"Não tem uma conta? ",signIn:"Entrar",signUp:"Criar conta",signInWithEmailCode:"Entrar com código por e-mail"};function Oe(l){switch(l){case"Enter a website URL.":return"Informe a URL de um site.";case"Use an HTTP or HTTPS website URL.":return"Use uma URL de site HTTP ou HTTPS.";case"Enter a valid website URL.":return"Informe uma URL de site válida.";default:return l}}let ze=!1;function st(){const l=Ie({from:"/commerce-onboarding"}),{org:e,siteUrl:i}=l,t=ve(i);return!ze&&De()&&(ze=!0,se("commerce_onboarding_viewed",{site_url:i,domain:t??void 0,...t?{$set:{last_scanned_domain:t}}:{}})),o.jsx(Me.Provider,{value:t,children:o.jsx(at,{requestedOrgSlug:e,siteUrl:i})})}function at(l){const e=E.c(8),{requestedOrgSlug:i,siteUrl:t}=l,{data:s,isPending:c}=Se.useSession(),a=$e();if(c){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(R,{children:o.jsx(ye,{variant:"generic"})}),e[0]=m):m=e[0],m}if(!s){const m=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let d;e[1]!==a?(d=a?o.jsx(Pe,{host:a}):void 0,e[1]=a,e[2]=d):d=e[2];let u;return e[3]!==d?(u=o.jsx(R,{children:o.jsx(We,{callbackUrl:m,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:d,copy:rt})}),e[3]=d,e[4]=u):u=e[4],u}let n;return e[5]!==i||e[6]!==t?(n=o.jsx(lt,{requestedOrgSlug:i,siteUrl:t}),e[5]=i,e[6]=t,e[7]=n):n=e[7],n}function lt(l){const e=E.c(43),{requestedOrgSlug:i,siteUrl:t}=l,s=Fe(),c=qe(),[a,n]=M.useState(null),[m,d]=M.useState(null),u=c.data?.map(mt)??[];let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={mutationFn:ct,retry:!1,onSuccess:r=>{d(r)}},e[0]=v):v=e[0];const p=Te(v);if(c.isPending){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(R,{children:o.jsx(ye,{variant:"workspace"})}),e[1]=r):r=e[1],r}if(c.error){let r;return e[2]!==c?(r=o.jsx(ae,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[2]=c,e[3]=r):r=e[3],r}const j=i?u.find(r=>r.slug===i):null;if(j){let r;return e[4]!==j||e[5]!==t?(r=o.jsx(re,{org:j,initialSiteUrl:t}),e[4]=j,e[5]=t,e[6]=r):r=e[6],r}if(i){let r;return e[7]!==c?(r=o.jsx(ae,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[7]=c,e[8]=r):r=e[8],r}if(a){let r;return e[9]!==a||e[10]!==t?(r=o.jsx(re,{org:a,initialSiteUrl:t}),e[9]=a,e[10]=t,e[11]=r):r=e[11],r}if(u.length===1&&u[0]){let r;return e[12]!==u[0]||e[13]!==t?(r=o.jsx(re,{org:u[0],initialSiteUrl:t}),e[12]=u[0],e[13]=t,e[14]=r):r=e[14],r}if(u.length>1){let r;e[15]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(k,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=r):r=e[15];let h;e[16]!==s||e[17]!==t?(h=O=>s({to:"/commerce-onboarding",search:{org:O.slug,siteUrl:t}}),e[16]=s,e[17]=t,e[18]=h):h=e[18];let C;return e[19]!==u||e[20]!==h?(C=o.jsx(R,{children:o.jsxs("div",{className:"grid gap-10",children:[r,o.jsx(Ne,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:o.jsx(Re,{organizations:u,selectLabel:"Continuar",onSelected:h})})]})}),e[19]=u,e[20]=h,e[21]=C):C=e[21],C}if(!m){let r;e[22]!==p?(r=()=>{p.reset(),p.mutate()},e[22]=p,e[23]=r):r=e[23];let h;return e[24]!==p||e[25]!==r?(h=o.jsx(dt,{mutation:p,onRetry:r}),e[24]=p,e[25]=r,e[26]=h):h=e[26],h}const g=m;if(g?.success&&(g.status==="created"||g.status==="joined"||g.status==="already_has_organization")&&g.organization){let r;return e[27]!==g.organization||e[28]!==t?(r=o.jsx(re,{org:g.organization,initialSiteUrl:t}),e[27]=g.organization,e[28]=t,e[29]=r):r=e[29],r}if(g?.status==="ambiguous"&&g.organizations&&g.organizations.length>0){let r;e[30]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(k,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[30]=r):r=e[30];const h=g.domain??void 0;let C;e[31]!==s||e[32]!==t?(C=($,P)=>{Le(),n({...$,slug:P}),s({to:"/commerce-onboarding",search:{org:P,siteUrl:t}})},e[31]=s,e[32]=t,e[33]=C):C=e[33];let O;return e[34]!==g.organizations||e[35]!==h||e[36]!==C?(O=o.jsx(R,{children:o.jsxs("div",{className:"grid gap-10",children:[r,o.jsx(Ne,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:o.jsx(Re,{organizations:g.organizations,domain:h,onJoined:C})})]})}),e[34]=g.organizations,e[35]=h,e[36]=C,e[37]=O):O=e[37],O}const S=g?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let _;e[38]!==p?(_=()=>{d(null),p.reset()},e[38]=p,e[39]=_):_=e[39];let I;return e[40]!==S||e[41]!==_?(I=o.jsx(ae,{title:"O onboarding de commerce precisa de suporte",description:S,actionLabel:"Tentar novamente",onRetry:_}),e[40]=S,e[41]=_,e[42]=I):I=e[42],I}async function ct(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&Le(),e}function mt(l){return{id:l.id,name:l.name,slug:l.slug,logo:l.logo??null}}function dt(l){const e=E.c(7),{mutation:i,onRetry:t}=l,s=M.useRef(!1);let c;e[0]!==i?(c=d=>{!d||s.current||(s.current=!0,i.mutate())},e[0]=i,e[1]=c):c=e[1];const a=c;if(i.error){let d;return e[2]!==t?(d=o.jsx(ae,{title:"Onboarding de commerce indisponível",description:"Não foi possível preparar uma organização para a configuração de commerce. Tente novamente por esta página ou fale com o suporte.",actionLabel:"Tentar novamente",onRetry:t}),e[2]=t,e[3]=d):d=e[3],d}let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(ye,{variant:"generic"}),e[4]=n):n=e[4];let m;return e[5]!==a?(m=o.jsx(R,{children:o.jsx("div",{ref:a,children:n})}),e[5]=a,e[6]=m):m=e[6],m}function k(l){const e=E.c(8),{title:i,description:t}=l,s=$e();let c;e[0]!==s?(c=s?o.jsx(Pe,{host:s}):o.jsxs("div",{children:[o.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),o.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=s,e[1]=c):c=e[1];let a;e[2]!==t||e[3]!==i?(a=(i||t)&&o.jsxs("div",{className:"space-y-2",children:[i&&o.jsx("h1",{className:"text-2xl font-medium leading-8",children:i}),t&&o.jsx("p",{className:"text-base text-muted-foreground leading-6",children:t})]}),e[2]=t,e[3]=i,e[4]=a):a=e[4];let n;return e[5]!==c||e[6]!==a?(n=o.jsxs("div",{className:"grid gap-10",children:[c,a]}),e[5]=c,e[6]=a,e[7]=n):n=e[7],n}function ae(l){const e=E.c(9),{title:i,description:t,actionLabel:s,onRetry:c}=l;let a;e[0]!==t||e[1]!==i?(a=o.jsx(k,{title:i,description:t}),e[0]=t,e[1]=i,e[2]=a):a=e[2];let n;e[3]!==s||e[4]!==c?(n=o.jsx(je,{type:"button",size:"xl",className:"w-full",onClick:c,children:s}),e[3]=s,e[4]=c,e[5]=n):n=e[5];let m;return e[6]!==a||e[7]!==n?(m=o.jsx(R,{children:o.jsxs("div",{className:"grid gap-10",children:[a,n]})}),e[6]=a,e[7]=n,e[8]=m):m=e[8],m}function re(l){const e=E.c(11),{org:i,initialSiteUrl:t}=l,{data:s}=Se.useSession(),c=s?.user?.email;let a;e[0]!==t||e[1]!==c?(a=Ce({siteUrl:t,email:c}),e[0]=t,e[1]=c,e[2]=a):a=e[2];const n=a;let m;e[3]!==n||e[4]!==i.id?(m=o.jsx(be,{href:n,orgId:i.id}),e[3]=n,e[4]=i.id,e[5]=m):m=e[5];const d=m;let u;return e[6]!==t||e[7]!==d||e[8]!==i||e[9]!==s?.user?.email?(u=o.jsx(He,{children:v=>{const{reset:p}=v;return o.jsx(Ve,{fallback:j=>{const{error:g,resetError:S}=j;return o.jsx(R,{visual:d,children:o.jsx(ut,{orgName:i.name,message:g instanceof Error?g.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{p(),S()}})})},children:o.jsx(M.Suspense,{fallback:o.jsx(ke,{visual:d}),children:o.jsx(ft,{org:i,initialSiteUrl:t,sessionEmail:s?.user?.email},`${i.id}:${t??""}`)})})}}),e[6]=t,e[7]=d,e[8]=i,e[9]=s?.user?.email,e[10]=u):u=e[10],u}function ke(l){const e=E.c(3),{visual:i}=l;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[o.jsx(k,{}),o.jsx(we,{})]}),e[0]=t):t=e[0];let s;return e[1]!==i?(s=o.jsx(R,{align:"fill",visual:i,children:t}),e[1]=i,e[2]=s):s=e[2],s}function ut(l){const e=E.c(10),{orgName:i,message:t,onRetry:s}=l,c=`A configuração de commerce continuará em ${i}.`;let a;e[0]!==c?(a=o.jsx(k,{title:"Diagnóstico de commerce",description:c}),e[0]=c,e[1]=a):a=e[1];let n;e[2]!==t?(n=o.jsx(le,{message:t}),e[2]=t,e[3]=n):n=e[3];let m;e[4]!==s?(m=o.jsx(je,{type:"button",size:"xl",className:"w-full",onClick:s,children:"Tentar novamente"}),e[4]=s,e[5]=m):m=e[5];let d;return e[6]!==a||e[7]!==n||e[8]!==m?(d=o.jsxs("div",{className:"grid gap-10",children:[a,n,m]}),e[6]=a,e[7]=n,e[8]=m,e[9]=d):d=e[9],d}function ft(l){const e=E.c(109),{org:i,initialSiteUrl:t,sessionEmail:s}=l;let c;e[0]!==i.id||e[1]!==i.slug?(c={connectionId:Xe,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=c):c=e[2];const a=Je(c),[n,m]=M.useState(t??""),[d,u]=M.useState(null),v=M.useRef(!1),p=Ze.COMMERCE_DISCOVERY(i.id),j=et(i.id),g=_e.commerceDiscoveryConnection(i.id,p);let S;e[3]!==p||e[4]!==a?(S=async()=>{const f=await a.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:p}});return xe(f)},e[3]=p,e[4]=a,e[5]=S):S=e[5];let _;e[6]!==g||e[7]!==S?(_={queryKey:g,queryFn:S,retry:!1},e[6]=g,e[7]=S,e[8]=_):_=e[8];const I=Ue(_),r=_e.commerceDiscoveryVirtualMcp(i.id,j);let h;e[9]!==a||e[10]!==j?(h=async()=>{const f=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:j}});return xe(f)},e[9]=a,e[10]=j,e[11]=h):h=e[11];let C;e[12]!==r||e[13]!==h?(C={queryKey:r,queryFn:h,retry:!1},e[12]=r,e[13]=h,e[14]=C):C=e[14];const O=Ue(C);let $;e[15]!==a?($=async f=>{const x=await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:f}});return xe(x)},e[15]=a,e[16]=$):$=e[16];let P;e[17]!==I||e[18]!==i.id||e[19]!==O?(P=(f,x)=>{se("commerce_onboarding_setup_succeeded",{domain:ve(x)??void 0,organization_id:i.id}),u(null),I.refetch(),O.refetch()},e[17]=I,e[18]=i.id,e[19]=O,e[20]=P):P=e[20];let A;e[21]!==i.id?(A=(f,x)=>{se("commerce_onboarding_setup_failed",{domain:ve(x)??void 0,organization_id:i.id,error:f instanceof Error?f.message:String(f)}),u(f instanceof Error?f.message:"A configuração do Commerce Discovery falhou.")},e[21]=i.id,e[22]=A):A=e[22];let Q;e[23]!==A||e[24]!==$||e[25]!==P?(Q={mutationFn:$,retry:!1,onSuccess:P,onError:A},e[23]=A,e[24]=$,e[25]=P,e[26]=Q):Q=e[26];const b=Te(Q),Ae=!!I.data.item&&!!O.data.item,Ee=I.data.item,W=typeof Ee?.metadata?.siteUrl=="string"?Ee.metadata.siteUrl:void 0,ce=t||n||"";let G;e[27]!==W||e[28]!==ce?(G=Qe(ce,W),e[27]=W,e[28]=ce,e[29]=G):G=e[29];const Y=Ae&&G,J=t||n||W||"";let X;e[30]!==J||e[31]!==s?(X=Ce({siteUrl:J,email:s}),e[30]=J,e[31]=s,e[32]=X):X=e[32];const me=X;let Z;e[33]!==me||e[34]!==i.id?(Z=o.jsx(be,{href:me,orgId:i.id}),e[33]=me,e[34]=i.id,e[35]=Z):Z=e[35];const y=Z;let ee;e[36]!==b?(ee=f=>{const x=pe(f);if(!x.ok){u(Oe(x.error));return}u(null),b.mutate(x.value)},e[36]=b,e[37]=ee):ee=e[37];const D=ee;let te;e[38]!==t||e[39]!==D||e[40]!==Y?(te=f=>{!f||v.current||Y||!t||(v.current=!0,D(t))},e[38]=t,e[39]=D,e[40]=Y,e[41]=te):te=e[41];const de=te;let ie;e[42]!==i.id||e[43]!==D||e[44]!==n?(ie=f=>{f.preventDefault();const x=pe(n);x.ok&&se("commerce_onboarding_site_url_submitted",{domain:new URL(x.value).hostname,organization_id:i.id}),D(n)},e[42]=i.id,e[43]=D,e[44]=n,e[45]=ie):ie=e[45];const z=ie;if(Y){const f=i.slug;let x;e[46]===Symbol.for("react.memo_cache_sentinel")?(x=crypto.randomUUID(),e[46]=x):x=e[46];let T;e[47]!==i.slug?(T={org:f,taskId:x},e[47]=i.slug,e[48]=T):T=e[48];let U;e[49]!==i.id?(U=tt(i.id),e[49]=i.id,e[50]=U):U=e[50];const L=J||void 0;let N;e[51]!==U.id||e[52]!==L?(N={virtualmcpid:U.id,connect:"1",siteUrl:L},e[51]=U.id,e[52]=L,e[53]=N):N=e[53];let w;return e[54]!==T||e[55]!==N?(w=o.jsx(Be,{to:"/$org/$taskId",params:T,search:N,replace:!0}),e[54]=T,e[55]=N,e[56]=w):w=e[56],w}if(b.isPending){let f;return e[57]!==y?(f=o.jsx(ke,{visual:y}),e[57]=y,e[58]=f):f=e[58],f}if(t){let f,x;if(e[59]!==y||e[60]!==z||e[61]!==t||e[62]!==d||e[63]!==i.name||e[64]!==b.isPending||e[65]!==n){x=Symbol.for("react.early_return_sentinel");e:if(f=pe(t),!f.ok){const fe=`A configuração de commerce continuará em ${i.name}.`;let V;e[68]!==fe?(V=o.jsx(k,{title:"Diagnóstico de commerce",description:fe}),e[68]=fe,e[69]=V):V=e[69];const ge=o.jsx(le,{message:Oe(f.error)});let B;e[70]!==z||e[71]!==d||e[72]!==b.isPending||e[73]!==n?(B=o.jsx(he,{siteUrl:n,error:d,isSubmitting:b.isPending,onSiteUrlChange:m,onSubmit:z}),e[70]=z,e[71]=d,e[72]=b.isPending,e[73]=n,e[74]=B):B=e[74];let K;e[75]!==V||e[76]!==ge||e[77]!==B?(K=o.jsxs("div",{className:"grid gap-10",children:[V,ge,B]}),e[75]=V,e[76]=ge,e[77]=B,e[78]=K):K=e[78];let ne;e[79]!==y||e[80]!==K?(ne=o.jsx(R,{visual:y,children:K}),e[79]=y,e[80]=K,e[81]=ne):ne=e[81],x=ne;break e}e[59]=y,e[60]=z,e[61]=t,e[62]=d,e[63]=i.name,e[64]=b.isPending,e[65]=n,e[66]=f,e[67]=x}else f=e[66],x=e[67];if(x!==Symbol.for("react.early_return_sentinel"))return x;const T=`O Commerce Discovery está sendo preparado para ${f.value}.`;let U;e[82]!==T?(U=o.jsx(k,{title:"Diagnóstico de commerce",description:T}),e[82]=T,e[83]=U):U=e[83];let L;e[84]!==z||e[85]!==d||e[86]!==b.isPending||e[87]!==n?(L=d?o.jsxs(o.Fragment,{children:[o.jsx(le,{message:d}),o.jsx(he,{siteUrl:n,error:null,isSubmitting:b.isPending,onSiteUrlChange:m,onSubmit:z})]}):o.jsx(we,{}),e[84]=z,e[85]=d,e[86]=b.isPending,e[87]=n,e[88]=L):L=e[88];let N;e[89]!==U||e[90]!==L||e[91]!==de?(N=o.jsxs("div",{ref:de,className:"grid gap-10",children:[U,L]}),e[89]=U,e[90]=L,e[91]=de,e[92]=N):N=e[92];let w;return e[93]!==y||e[94]!==N?(w=o.jsx(R,{visual:y,children:N}),e[93]=y,e[94]=N,e[95]=w):w=e[95],w}const ue=`A configuração de commerce continuará em ${i.name}.`;let F;e[96]!==ue?(F=o.jsx(k,{title:"Diagnóstico de commerce",description:ue}),e[96]=ue,e[97]=F):F=e[97];let q;e[98]!==z||e[99]!==d||e[100]!==b.isPending||e[101]!==n?(q=o.jsx(he,{siteUrl:n,error:d,isSubmitting:b.isPending,onSiteUrlChange:m,onSubmit:z}),e[98]=z,e[99]=d,e[100]=b.isPending,e[101]=n,e[102]=q):q=e[102];let H;e[103]!==F||e[104]!==q?(H=o.jsxs("div",{className:"grid gap-10",children:[F,q]}),e[103]=F,e[104]=q,e[105]=H):H=e[105];let oe;return e[106]!==y||e[107]!==H?(oe=o.jsx(R,{visual:y,children:H}),e[106]=y,e[107]=H,e[108]=oe):oe=e[108],oe}function he(l){const e=E.c(20),{siteUrl:i,error:t,isSubmitting:s,onSiteUrlChange:c,onSubmit:a}=l;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=n):n=e[0];let m;e[1]!==c?(m=_=>c(_.target.value),e[1]=c,e[2]=m):m=e[2];const d=!!t;let u;e[3]!==s||e[4]!==i||e[5]!==m||e[6]!==d?(u=o.jsx(Ye,{id:"commerce-site-url",type:"text",inputMode:"url",value:i,onChange:m,placeholder:"https://example.com","aria-invalid":d,disabled:s}),e[3]=s,e[4]=i,e[5]=m,e[6]=d,e[7]=u):u=e[7];let v;e[8]!==t?(v=t?o.jsx(le,{message:t}):null,e[8]=t,e[9]=v):v=e[9];let p;e[10]!==u||e[11]!==v?(p=o.jsxs("div",{className:"grid gap-2",children:[n,u,v]}),e[10]=u,e[11]=v,e[12]=p):p=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(it,{size:16}),e[13]=j):j=e[13];let g;e[14]!==s?(g=o.jsxs(je,{type:"submit",size:"xl",className:"w-full",disabled:s,children:["Continuar",j]}),e[14]=s,e[15]=g):g=e[15];let S;return e[16]!==a||e[17]!==p||e[18]!==g?(S=o.jsxs("form",{className:"grid gap-4",onSubmit:a,children:[p,g]}),e[16]=a,e[17]=p,e[18]=g,e[19]=S):S=e[19],S}function le(l){const e=E.c(2),{message:i}=l;let t;return e[0]!==i?(t=o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:i}),e[0]=i,e[1]=t):t=e[1],t}export{$i as default};
@@ -1 +0,0 @@
1
- import{b as m}from"./extract-connection-data-DEmXsdA0.js";import{b as g}from"./provision-repo-scoped-github-connection-CB4ICKHq.js";function I(n){const e=n.properties;if(!e)return[];const t=[];for(const[r,i]of Object.entries(e)){const a=i?.properties?.__type?.const;typeof a=="string"&&a.length>0&&t.push({fieldKey:r,bindingType:a})}return t}const N=[{fieldKey:"vtex",bindingType:"vtex"},{fieldKey:"ga4",bindingType:"google-analytics"},{fieldKey:"gsc",bindingType:"google-search-console"},{fieldKey:"github",bindingType:"github"}];function S(n,e){const t=[];if(n.length&&t.push({field:["id"],operator:"in",value:n}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function w(n){const e=n;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??n}function R(n,e,t,r){return{...n??{},[e]:{__type:t,value:r}}}function p(n){return n==null?!1:typeof n=="string"?n.trim().length>0:typeof n=="number"||typeof n=="boolean"?!0:Array.isArray(n)?n.some(p):typeof n=="object"?Object.entries(n).some(([e,t])=>!e.startsWith("__")&&p(t)):!1}function h(n){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[n]?e[n]:n.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function b(n){return p(n)?typeof n=="string"?n.trim():typeof n=="number"||typeof n=="boolean"?String(n):JSON.stringify(n):null}function B(n){return n?Object.entries(n).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const r=b(t);return r?[{key:e,label:h(e),value:r}]:[]}):[]}function O({autoOpenFieldKey:n,card:e}){return n===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function _(n,e,t){const r=n.filter(i=>(i.app_name===e||!!t&&i.app_id===t)&&g(i)===null);return r.length===0?null:(r.sort((i,o)=>{const s=a=>a.status==="active"?0:1;return s(i)!==s(o)?s(i)-s(o):(o.updated_at??"").localeCompare(i.updated_at??"")}),r[0].id)}function C(n){return n.server?.icons?.[0]?.src??m(n.server?.repository)??null}function T(n,e){const t=n._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||n.title||n.server?.title||n.server?.name||e}function E(n){const e=[],t=new Map(n.connections.map(r=>[r.id,r]));for(const r of n.requirements){const i=n.curated[r.bindingType],o=i?n.itemsById[i.registryAppId]:n.itemsByName[r.bindingType];if(!o)continue;const s=n.configurationState?.[r.fieldKey]?.value,a=s?t.get(s):void 0,u=s&&a?s:null,d=u?n.connectionReadiness?.[u]!==!1:!1,c=!!u&&d,l=c?void 0:n.saBindings?.[r.bindingType],f=c||!!l,y=c?"oauth":l?"sa":null;e.push({fieldKey:r.fieldKey,bindingType:r.bindingType,registryItem:o,title:T(o,r.bindingType),icon:C(o),headline:i?.headline??o._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,candidateConnectionId:f?null:u||_(n.connections,r.bindingType,i?.registryAppId),linkedConnectionId:u,configurationState:a?.configuration_state??null,boundVia:y,boundResource:l?.resource??null})}return e}function U(n,e){if(!n)return null;const t=i=>{const o=i.startsWith("sc-domain:")?i.substring(10):(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`).hostname}catch{return null}})();return o===null?i:o.startsWith("www.")?o.substring(4):o},r=t(n);for(const i of e)if(t(i.siteUrl)===r)return i.siteUrl;return null}function W(n){return(n?.response?.accountSummaries??[]).map(r=>({account:r.account,options:(r.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${r.displayName})`}))}))}export{N as F,E as a,S as b,R as c,B as g,U as m,I as p,O as s,W as t,w as u};
@@ -1,2 +0,0 @@
1
- import{c as Y,r as u,j as r,i as oe,B as pe,d$ as jt,aO as Nt,aU as re,e0 as St,e1 as Mt,e2 as Dt,e3 as Rt,bO as Pt,e4 as Et,e5 as Be,aQ as kt,e6 as Tt,e7 as Ot,e8 as At,e9 as Lt,ea as Ft,eb as $t,ec as It,ed as _t,ee as zt,l as ie,n as Gt,t as Q,K as Le}from"./index-BEqdT-CX.js";import{F as Kt,l as Bt}from"./index-BTfVRtBq.js";import{d as Vt,ax as Ut,ay as Wt}from"./agent-icon-jdj2JAEm.js";import{s as Qt}from"./XClose-DxMKQUUD.js";import{A as qt}from"./automation-runs-nQ99AMoV.js";import{b as Fe,T as $e,a as Ie}from"./tooltip-C7c-Tgru.js";import{b as Ht}from"./chat-context-CAoh3qxf.js";import{u as Xt}from"./shell-layout-CcPRSmgX.js";import{s as de,a as _e,f as Yt}from"./index-Bnro1Vjb.js";import{a as Jt,h as Zt,D as en,c as tn,d as nn,e as rn}from"./dialog-BboVhzku.js";import{I as ze}from"./input-CqfDyI-C.js";import{c as on,d as an,b as sn,A as ln,g as cn,e as dn,a as un,f as fn}from"./alert-dialog-DtmlB9JL.js";import{t as mn}from"./ChevronDown-Cpk84lU5.js";import{i as pn}from"./ChevronRight-UlscOqp6.js";import{a as xn}from"./ZoomOut-CvmU5uj5.js";import{v as hn,E as gn,w as Ge,x as ve,y as vn,z as yn,A as Cn,C as H,D as ue,G as wn,g as ye,I as Ce,J as bn,K as jn,M as we,N as fe,O as be,P as Nn,Q as Sn}from"./index-S6xdCjXr.js";import"./AlertCircle-DFFB807G.js";import"./UserPlus01-DjFNU1Mn.js";import"./Tool01-CSravChF.js";import"./ArrowUp-CFU7eduC.js";import"./Settings02-D5c8FtUa.js";import"./Tool02-csu1mOp1.js";import"./XCircle-CiVL5z-e.js";import"./ArrowUpRight-D37SsWBk.js";import"./TrendUp01-Dw2DNRxA.js";import"./ZapSquare-BDp8YrcS.js";import"./Users03-Iz-TpUuJ.js";import"./CheckCircle-BwwAyNzV.js";import"./Check-BAiULwRg.js";import"./ChevronUp-CqCnswy_.js";import"./Circle-pOPoWDQn.js";import"./Stars02-CzKVb8lE.js";import"./Copy01-BEB5hDKQ.js";import"./DotsVertical-BFfMlorx.js";import"./Globe01-DVm51A__.js";import"./Eye-Bbh_ejV6.js";import"./FilterLines-Dm0WP1zI.js";import"./Flag01-e55mynPF.js";import"./Star01-C32-NjaL.js";import"./Globe04-DA8QsMrW.js";import"./SwitchHorizontal01-C8Rnw5uG.js";import"./HardDrive-BJ2MS6we.js";import"./Image01-Y4d3ZI2r.js";import"./Key01-xPUeBTf6.js";import"./LayoutLeft-CNWN8tpf.js";import"./LinkExternal01-B6bTrNoI.js";import"./List-gTaMGV9z.js";import"./Monitor01-BdI_dCjX.js";import"./Sun-BPhwV-Eh.js";import"./Package-WlP_SelV.js";import"./Palette-DwivsXKp.js";import"./Play-BPQdBfbt.js";import"./Plus-C8FiAr3i.js";import"./SearchLg-CMWIHllt.js";import"./SearchMd-Gwm-384G.js";import"./Shield01-Dn6encQp.js";import"./Stars01-C8WemEnv.js";import"./Trash01-DZTkGJqE.js";import"./Upload01-s2ES1URH.js";import"./User01-D0_zDlJM.js";import"./Users01-CAC4FOXB.js";import"./X-CTTK5Zj2.js";import"./Zap-CrYnUVJy.js";import"./select-Bh2Z8rK3.js";import"./useInfiniteQuery-BnNR1NVs.js";import"./use-infinite-scroll-DYbbFqLK.js";import"./use-connection-DUpx0NEA.js";import"./use-collections-Dy7WD_eH.js";import"./use-mcp-client-DvvHwezb.js";import"./constants-D_FQAPnt.js";import"./auth-BR_fNNK7.js";import"./use-virtual-mcp-CNKe_WaY.js";import"./card-CEUspnmz.js";import"./sidebar-CRtkHPvX.js";import"./use-mobile-DbBFg2WD.js";import"./table-VOE9WRkg.js";import"./empty-state-C6JrR5eZ.js";import"./use-members-BZPSqMOT.js";import"./use-org-auth-client-PHOIKqSH.js";import"./use-clock-tick-F8Oybd0p.js";import"./use-automations-CELpHT79.js";import"./studio-tools-Cdt3UzXo.js";import"./useSuspenseInfiniteQuery-3QrNhYz_.js";import"./avatar-DJpRqbqg.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-C0FUXmsm.js";import"./file-type-icon-BR1G8n26.js";import"./tab-id-BijBBRwE.js";import"./hooks-DYM3Q-Vq.js";import"./decopilot-sse-pool-pi1pVqbX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./monaco-editor-YwujFe9g.js";import"./index-BXfKOYdf.js";import"./integration-icon-Dhyv93zr.js";import"./use-navigate-to-agent-CBi1-FBB.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-oIJCSonG.js";import"./form-p6ZihW38.js";import"./label-DbwTUWd9.js";import"./autosend-CIDdvZqc.js";import"./use-ai-providers-C7iVrgY-.js";import"./use-decopilot-events-btxE-D2k.js";import"./use-organization-settings-CpbybQHD.js";import"./required-auth-layout-BXaZVxWQ.js";import"./use-org-sso-BA_UxewI.js";import"./drawer-D5XLtSzP.js";import"./collection-search-BLJH2aa6.js";import"./tabs-DPmfTv0c.js";import"./toggle-group-BnuMLJr8.js";import"./use-deco-credits-56-eyw-E.js";import"./extract-connection-data-DEmXsdA0.js";import"./connection-card-DPw_9IvV.js";import"./use-registry-connections-CX_dlku1.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-B9g6Z2-r.js";import"./connection-form-helpers-svNTHB1P.js";import"./authenticate-and-persist-oauth-BuaZSTeD.js";import"./mcp-oauth-CeGeftbL.js";import"./collection-tabs-D10lR104.js";import"./badge-zT-Fh3qN.js";import"./connect-desktop-dialog-B4c48mz3.js";import"./select-model-BHB_Fir_.js";import"./checkbox-C7atZRmN.js";import"./skeleton-C-LbiBGP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-HiisdE7T.js";import"./command-Cih9cb-G.js";import"./index-Dz8rxMiO.js";import"./popover-BJYBT3EY.js";import"./dropdown-menu-DcV4HAvf.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BrRSDeZW.js";import"./toolbar-65iromlk.js";import"./use-mcp-tools-Be4djRS3.js";import"./use-capability-DsC1r5oD.js";import"./use-debounced-autosave-IEMI4Muz.js";import"./index-BXTPhNSj.js";import"./search-input-CYwO2ZSV.js";import"./use-mcp-auth-status-Dy_Y2kKR.js";import"./switch-BL8XQR8K.js";import"./github-repo-picker-B_QoRL-b.js";import"./use-debounced-value-BqHYI-kn.js";import"./provision-repo-scoped-github-connection-CB4ICKHq.js";import"./use-secrets-ChIMRFxc.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./companions-core-Zwoux9HO.js";import"./index-CbMrlBFr.js";import"./get-initials-D-f_fDFw.js";import"./calendar-CibxNjt0.js";import"./toolbar-icon-button-BBh2Csxi.js";import"./use-file-configs-CYmkQ98g.js";import"./automation-list-row-BuCXNsSo.js";const Mn={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function Dn(s){const e=Y.c(51),{open:i,mode:a,initialName:c,parentLabel:f,isPending:h,onSubmit:p,onOpenChange:v}=s,y=c===void 0?"":c,d=h===void 0?!1:h,[x,C]=u.useState(y),[D,k]=u.useState(i),g=Mn[a];i!==D&&(k(i),i&&C(y));let b;e[0]!==d||e[1]!==v?(b=V=>{!V&&!d&&v(!1)},e[0]=d,e[1]=v,e[2]=b):b=e[2];const U=b;let T;e[3]!==d||e[4]!==x||e[5]!==p?(T=async V=>{V.preventDefault();const q=x.trim();!q||d||await p(q)},e[3]=d,e[4]=x,e[5]=p,e[6]=T):T=e[6];const O=T;let j;e[7]!==g.title?(j=r.jsx(Jt,{children:g.title}),e[7]=g.title,e[8]=j):j=e[8];let w;e[9]!==g.description?(w=r.jsx(Zt,{children:g.description}),e[9]=g.description,e[10]=w):w=e[10];let A;e[11]!==j||e[12]!==w?(A=r.jsxs(en,{children:[j,w]}),e[11]=j,e[12]=w,e[13]=A):A=e[13];let L;e[14]!==f?(L=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),r.jsx(ze,{value:f,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=f,e[15]=L):L=e[15];let G;e[16]===Symbol.for("react.memo_cache_sentinel")?(G=r.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=G):G=e[16];let $;e[17]===Symbol.for("react.memo_cache_sentinel")?($=V=>C(V.target.value),e[17]=$):$=e[17];let I;e[18]!==g.placeholder||e[19]!==d||e[20]!==x?(I=r.jsxs("div",{className:"space-y-1.5",children:[G,r.jsx(ze,{id:"file-explorer-name",value:x,onChange:$,placeholder:g.placeholder,autoFocus:!0,disabled:d})]}),e[18]=g.placeholder,e[19]=d,e[20]=x,e[21]=I):I=e[21];let R;e[22]!==I||e[23]!==L?(R=r.jsxs("div",{className:"space-y-4 py-4",children:[L,I]}),e[22]=I,e[23]=L,e[24]=R):R=e[24];let P;e[25]!==v?(P=()=>v(!1),e[25]=v,e[26]=P):P=e[26];let _;e[27]!==d||e[28]!==P?(_=r.jsx(pe,{type:"button",variant:"outline",onClick:P,disabled:d,children:"Cancel"}),e[27]=d,e[28]=P,e[29]=_):_=e[29];let z;e[30]!==d||e[31]!==x?(z=!x.trim()||d,e[30]=d,e[31]=x,e[32]=z):z=e[32];let N;e[33]!==g.submit||e[34]!==d?(N=d?r.jsxs(r.Fragment,{children:[r.jsx(oe,{size:14,className:"animate-spin"}),"Saving…"]}):g.submit,e[33]=g.submit,e[34]=d,e[35]=N):N=e[35];let K;e[36]!==z||e[37]!==N?(K=r.jsx(pe,{type:"submit",disabled:z,children:N}),e[36]=z,e[37]=N,e[38]=K):K=e[38];let S;e[39]!==_||e[40]!==K?(S=r.jsxs(tn,{children:[_,K]}),e[39]=_,e[40]=K,e[41]=S):S=e[41];let E;e[42]!==O||e[43]!==R||e[44]!==S||e[45]!==A?(E=r.jsx(nn,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:O,children:[A,R,S]})}),e[42]=O,e[43]=R,e[44]=S,e[45]=A,e[46]=E):E=e[46];let W;return e[47]!==U||e[48]!==i||e[49]!==E?(W=r.jsx(rn,{open:i,onOpenChange:U,children:E}),e[47]=U,e[48]=i,e[49]=E,e[50]=W):W=e[50],W}function Rn(s){const e=Y.c(31),{deleteTarget:i,deleteDirtyPaths:a,fsActionPending:c,onOpenChange:f,onConfirm:h}=s,p=i!==null,v=i?.kind==="directory"?"folder":"file";let y;e[0]!==v?(y=r.jsxs(on,{children:["Delete ",v,"?"]}),e[0]=v,e[1]=y):y=e[1];const d=i?.name;let x;e[2]!==d?(x=r.jsx("span",{className:"font-mono",children:d}),e[2]=d,e[3]=x):x=e[3];const C=i?.kind==="directory"?" and everything inside it.":".";let D;e[4]!==a.length?(D=a.length>0&&r.jsxs(r.Fragment,{children:[" ",a.length===1?"One open file has unsaved changes that will be lost.":`${a.length} open files have unsaved changes that will be lost.`]}),e[4]=a.length,e[5]=D):D=e[5];let k;e[6]!==x||e[7]!==C||e[8]!==D?(k=r.jsxs(an,{children:["This will permanently delete"," ",x,C,D]}),e[6]=x,e[7]=C,e[8]=D,e[9]=k):k=e[9];let g;e[10]!==y||e[11]!==k?(g=r.jsxs(sn,{children:[y,k]}),e[10]=y,e[11]=k,e[12]=g):g=e[12];let b;e[13]!==c?(b=r.jsx(ln,{disabled:c,children:"Cancel"}),e[13]=c,e[14]=b):b=e[14];const U=c||!i;let T;e[15]!==i||e[16]!==h?(T=L=>{L.preventDefault(),i&&h(i)},e[15]=i,e[16]=h,e[17]=T):T=e[17];let O;e[18]!==U||e[19]!==T?(O=r.jsx(cn,{disabled:U,onClick:T,children:"Delete"}),e[18]=U,e[19]=T,e[20]=O):O=e[20];let j;e[21]!==b||e[22]!==O?(j=r.jsxs(dn,{children:[b,O]}),e[21]=b,e[22]=O,e[23]=j):j=e[23];let w;e[24]!==j||e[25]!==g?(w=r.jsxs(un,{children:[g,j]}),e[24]=j,e[25]=g,e[26]=w):w=e[26];let A;return e[27]!==f||e[28]!==p||e[29]!==w?(A=r.jsx(fn,{open:p,onOpenChange:f,children:w}),e[27]=f,e[28]=p,e[29]=w,e[30]=A):A=e[30],A}var je="ContextMenu",[Pn]=kt(je,[Be]),B=Be(),[En,Ve]=Pn(je),Ue=s=>{const{__scopeContextMenu:e,children:i,onOpenChange:a,dir:c,modal:f=!0}=s,[h,p]=u.useState(!1),v=B(e),y=Pt(a),d=u.useCallback(x=>{p(x),y(x)},[y]);return r.jsx(En,{scope:e,open:h,onOpenChange:d,modal:f,children:r.jsx(Et,{...v,dir:c,open:h,onOpenChange:d,modal:f,children:i})})};Ue.displayName=je;var We="ContextMenuTrigger",Qe=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,disabled:a=!1,...c}=s,f=Ve(We,i),h=B(i),p=u.useRef({x:0,y:0}),v=u.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...p.current})}),y=u.useRef(0),d=u.useCallback(()=>window.clearTimeout(y.current),[]),x=C=>{p.current={x:C.clientX,y:C.clientY},f.onOpenChange(!0)};return u.useEffect(()=>d,[d]),u.useEffect(()=>{a&&d()},[a,d]),r.jsxs(r.Fragment,{children:[r.jsx(jt,{...h,virtualRef:v}),r.jsx(Nt.span,{"data-state":f.open?"open":"closed","data-disabled":a?"":void 0,...c,ref:e,style:{WebkitTouchCallout:"none",...s.style},onContextMenu:a?s.onContextMenu:re(s.onContextMenu,C=>{d(),x(C),C.preventDefault()}),onPointerDown:a?s.onPointerDown:re(s.onPointerDown,me(C=>{d(),y.current=window.setTimeout(()=>x(C),700)})),onPointerMove:a?s.onPointerMove:re(s.onPointerMove,me(d)),onPointerCancel:a?s.onPointerCancel:re(s.onPointerCancel,me(d)),onPointerUp:a?s.onPointerUp:re(s.onPointerUp,me(d))})]})});Qe.displayName=We;var kn="ContextMenuPortal",qe=s=>{const{__scopeContextMenu:e,...i}=s,a=B(e);return r.jsx(Dt,{...a,...i})};qe.displayName=kn;var He="ContextMenuContent",Xe=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=Ve(He,i),f=B(i),h=u.useRef(!1);return r.jsx(Rt,{...f,...a,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:p=>{s.onCloseAutoFocus?.(p),!p.defaultPrevented&&h.current&&p.preventDefault(),h.current=!1},onInteractOutside:p=>{s.onInteractOutside?.(p),!p.defaultPrevented&&!c.modal&&(h.current=!0)},style:{...s.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xe.displayName=He;var Tn="ContextMenuGroup",On=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(Tt,{...c,...a,ref:e})});On.displayName=Tn;var An="ContextMenuLabel",Ln=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(Ot,{...c,...a,ref:e})});Ln.displayName=An;var Fn="ContextMenuItem",Ye=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(St,{...c,...a,ref:e})});Ye.displayName=Fn;var $n="ContextMenuCheckboxItem",In=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(At,{...c,...a,ref:e})});In.displayName=$n;var _n="ContextMenuRadioGroup",zn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(Lt,{...c,...a,ref:e})});zn.displayName=_n;var Gn="ContextMenuRadioItem",Kn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(Ft,{...c,...a,ref:e})});Kn.displayName=Gn;var Bn="ContextMenuItemIndicator",Vn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx($t,{...c,...a,ref:e})});Vn.displayName=Bn;var Un="ContextMenuSeparator",Je=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(Mt,{...c,...a,ref:e})});Je.displayName=Un;var Wn="ContextMenuArrow",Qn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(It,{...c,...a,ref:e})});Qn.displayName=Wn;var qn="ContextMenuSubTrigger",Hn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(_t,{...c,...a,ref:e})});Hn.displayName=qn;var Xn="ContextMenuSubContent",Yn=u.forwardRef((s,e)=>{const{__scopeContextMenu:i,...a}=s,c=B(i);return r.jsx(zt,{...c,...a,ref:e,style:{...s.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Yn.displayName=Xn;function me(s){return e=>e.pointerType!=="mouse"?s(e):void 0}var Jn=Ue,Zn=Qe,er=qe,tr=Xe,nr=Ye,rr=Je;function or(s){const e=Y.c(4);let i;e[0]!==s?({...i}=s,e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==i?(a=r.jsx(Jn,{"data-slot":"context-menu",...i}),e[2]=i,e[3]=a):a=e[3],a}function ir(s){const e=Y.c(4);let i;e[0]!==s?({...i}=s,e[0]=s,e[1]=i):i=e[1];let a;return e[2]!==i?(a=r.jsx(Zn,{"data-slot":"context-menu-trigger",...i}),e[2]=i,e[3]=a):a=e[3],a}function ar(s){const e=Y.c(8);let i,a;e[0]!==s?({className:i,...a}=s,e[0]=s,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let c;e[3]!==i?(c=ie("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",i),e[3]=i,e[4]=c):c=e[4];let f;return e[5]!==a||e[6]!==c?(f=r.jsx(er,{children:r.jsx(tr,{"data-slot":"context-menu-content",className:c,...a})}),e[5]=a,e[6]=c,e[7]=f):f=e[7],f}function ee(s){const e=Y.c(12);let i,a,c,f;e[0]!==s?({className:i,inset:a,variant:f,...c}=s,e[0]=s,e[1]=i,e[2]=a,e[3]=c,e[4]=f):(i=e[1],a=e[2],c=e[3],f=e[4]);const h=f===void 0?"default":f;let p;e[5]!==i?(p=ie("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),e[5]=i,e[6]=p):p=e[6];let v;return e[7]!==a||e[8]!==c||e[9]!==p||e[10]!==h?(v=r.jsx(nr,{"data-slot":"context-menu-item","data-inset":a,"data-variant":h,className:p,...c}),e[7]=a,e[8]=c,e[9]=p,e[10]=h,e[11]=v):v=e[11],v}function Ke(s){const e=Y.c(8);let i,a;e[0]!==s?({className:i,...a}=s,e[0]=s,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let c;e[3]!==i?(c=ie("bg-border -mx-1 my-1 h-px",i),e[3]=i,e[4]=c):c=e[4];let f;return e[5]!==a||e[6]!==c?(f=r.jsx(rr,{"data-slot":"context-menu-separator",className:c,...a}),e[5]=a,e[6]=c,e[7]=f):f=e[7],f}const sr="#d9a441";function lr(s){const e=Y.c(45),{node:i,depth:a,isExpanded:c,isSelected:f,isLoading:h,fileVisual:p,onOpen:v,onSelect:y,onNewFile:d,onNewFolder:x,onCopyPath:C,onCopyRelativePath:D,onRename:k,onDelete:g}=s,b=h===void 0?!1:h,U=i.kind==="directory",{Icon:T,color:O}=p,j=f&&"bg-accent";let w;e[0]!==j?(w=ie("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",j),e[0]=j,e[1]=w):w=e[1];const A=`${a*14+8}px`;let L;e[2]!==A?(L={paddingLeft:A},e[2]=A,e[3]=L):L=e[3];let G;e[4]!==v||e[5]!==y?(G=()=>{y(),v()},e[4]=v,e[5]=y,e[6]=G):G=e[6];let $;e[7]!==T||e[8]!==O||e[9]!==U||e[10]!==c||e[11]!==b?($=U?r.jsxs(r.Fragment,{children:[b?r.jsx(oe,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):c?r.jsx(mn,{size:14,className:"shrink-0 text-muted-foreground"}):r.jsx(pn,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx(xn,{size:16,className:"shrink-0",style:{color:sr}})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"w-3.5 shrink-0"}),r.jsx(T,{size:16,className:"shrink-0",style:{color:O}})]}),e[7]=T,e[8]=O,e[9]=U,e[10]=c,e[11]=b,e[12]=$):$=e[12];let I;e[13]!==i.name?(I=r.jsx("span",{className:"truncate",children:i.name}),e[13]=i.name,e[14]=I):I=e[14];let R;e[15]!==w||e[16]!==L||e[17]!==G||e[18]!==$||e[19]!==I?(R=r.jsx(ir,{asChild:!0,children:r.jsxs("button",{type:"button",className:w,style:L,onClick:G,children:[$,I]})}),e[15]=w,e[16]=L,e[17]=G,e[18]=$,e[19]=I,e[20]=R):R=e[20];let P;e[21]!==d?(P=r.jsx(ee,{onSelect:d,children:"New File"}),e[21]=d,e[22]=P):P=e[22];let _;e[23]!==x?(_=r.jsx(ee,{onSelect:x,children:"New Folder"}),e[23]=x,e[24]=_):_=e[24];let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=r.jsx(Ke,{}),e[25]=z):z=e[25];let N;e[26]!==C?(N=r.jsx(ee,{onSelect:C,children:"Copy Path"}),e[26]=C,e[27]=N):N=e[27];let K;e[28]!==D?(K=r.jsx(ee,{onSelect:D,children:"Copy Relative Path"}),e[28]=D,e[29]=K):K=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Ke,{}),e[30]=S):S=e[30];let E;e[31]!==k?(E=r.jsx(ee,{onSelect:k,children:"Rename"}),e[31]=k,e[32]=E):E=e[32];let W;e[33]!==g?(W=r.jsx(ee,{variant:"destructive",onSelect:g,children:"Delete"}),e[33]=g,e[34]=W):W=e[34];let V;e[35]!==P||e[36]!==_||e[37]!==N||e[38]!==K||e[39]!==E||e[40]!==W?(V=r.jsxs(ar,{className:"w-52",children:[P,_,z,N,K,S,E,W]}),e[35]=P,e[36]=_,e[37]=N,e[38]=K,e[39]=E,e[40]=W,e[41]=V):V=e[41];let q;return e[42]!==V||e[43]!==R?(q=r.jsxs(or,{children:[R,V]}),e[42]=V,e[43]=R,e[44]=q):q=e[44],q}Bt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function cr(s,e,i,a){return`/api/${s}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(i)}/${a}`}function oa({orgSlug:s,virtualMcpId:e,branch:i,openPath:a}){const[c,f]=u.useState({files:[],directories:[],truncated:!1}),{files:h,directories:p}=c,[v,y]=u.useState(new Set),[d,x]=u.useState(null),[C,D]=u.useState(null),[k,g]=u.useState([]),[b,U]=u.useState(""),[T,O]=u.useState(!1),[j,w]=u.useState(!1),[,A]=u.useState(new Set),[L,G]=u.useState(new Set),$=u.useRef(0),I=u.useRef(null),R=u.useRef(new Set),P=u.useRef(new Map);function _(t){A(n=>{const o=typeof t=="function"?t(n):t;return R.current=o,o})}const[z,N]=u.useState(new Map),K=u.useRef(null),[S,E]=u.useState(null),{sendMessage:W}=Ht(),{openSidePanel:V}=Xt(),q=Gt(),[F,X]=u.useState(null),[xe,he]=u.useState(null),[ae,se]=u.useState(!1);async function J(t,n){const o=await fetch(cr(s,e,i,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error??`Request failed (${o.status})`)}return o.json()}async function le(){q.invalidateQueries({queryKey:_e(s,e,i)})}function Ne(t,n){navigator.clipboard.writeText(n).then(()=>Q.success(`${t} copied`),()=>Q.error(`Failed to copy ${t.toLowerCase()}`))}function Ze(t){const n=Nn(t);if(!n)return;const o=`${s}/${e}/${i}`;q.setQueryData(Le.decofile(o),l=>{if(!l)return l;const{[n]:m,...M}=l;return M}),q.invalidateQueries({queryKey:Le.liveMeta(s,e,i)})}function et(t){const n=t.kind==="file"?[t.path]:h.filter(o=>o.startsWith(".deco/blocks/")).map(o=>ue(o)).filter(o=>o===t.path||o.startsWith(`${t.path}/`));for(const o of n)Ze(o)}function tt(t){const n=ue(t);return k.filter(o=>{if(o!==n&&!o.startsWith(`${n}/`))return!1;const l=z.get(o);return!!(l?.loaded&&l.editorValue!==l.savedContent)})}function Se(t){g(n=>n.map(o=>t(o)).filter(o=>o!==null)),x(n=>n&&t(n)),N(n=>{const o=new Map;for(const[l,m]of n){const M=t(l);M&&o.set(M,m)}return o}),D(n=>{if(!n)return n;const o=t(n.path);return o?o===n.path?n:{...n,path:o,name:o.split("/").pop()??o}:null})}function nt(t){const n=ue(t);D(o=>o&&(o.path===n||o.path.startsWith(`${n}/`)?null:o)),Se(o=>o===n||o.startsWith(`${n}/`)?null:o)}async function rt(t){if(!F)return;const n=fe(F.parentDir,t);if(be(n,h,p))throw new Error(`"${t}" already exists`);await J("write",{path:H(n),content:""}),await te(),await le(),X(null),ge(n)}async function ot(t){if(!F)return;const n=fe(F.parentDir,t);if(be(n,h,p))throw new Error(`"${t}" already exists`);const o=H(n);await J("mkdir",{path:o}),f(l=>({...l,directories:l.directories.includes(o)?l.directories:[...l.directories,o]})),await te(),await le(),X(null),y(l=>{const m=new Set(l);for(const M of ve(n))m.add(M);return m.add(n),m}),D({name:t,path:n,kind:"directory",children:[]})}async function it(t){if(!F)return;const n=F.node.path,o=we(n),l=fe(o,t);if(l===n){X(null);return}if(be(l,h,p))throw new Error(`"${t}" already exists`);await J("rename",{from:H(n),to:H(l)}),Se(m=>m===n?l:m.startsWith(`${n}/`)?fe(l,m.slice(n.length+1)):m),await te(),await le(),X(null)}async function at(t){se(!0);try{await J("unlink",{path:H(t.path),recursive:t.kind==="directory"}),et(t),nt(t.path),await te(),await le(),he(null),Q.success(`Deleted "${t.name}"`)}catch(n){Q.error(n instanceof Error?n.message:"Delete failed")}finally{se(!1)}}async function st(t){const n=jn(t);if(n){Q.error(n);return}se(!0);try{F?.mode==="new-file"?(await rt(t),Q.success(`Created "${t}"`)):F?.mode==="new-folder"?(await ot(t),Q.success(`Created folder "${t}"`)):F?.mode==="rename"&&(await it(t),Q.success(`Renamed to "${t}"`))}catch(o){Q.error(o instanceof Error?o.message:"Operation failed")}finally{se(!1)}}const Me=u.useRef(!1);Me.current||(Me.current=!0,I.current=te());const[lt,ct]=u.useState(null);if(a&&a!==lt){ct(a);const t=a;queueMicrotask(()=>{hn(t)&&ge(t).catch(n=>{Q.error(n instanceof Error?n.message:"Failed to open file")})})}async function De(t){const n=await J("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Re(t,n,o){if(o!==$.current)return!1;let l=!1;return f(m=>{const M=n?Sn(m.files,m.directories,t,m.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return l=!!M.truncated,{files:M.files,directories:M.directories,truncated:l}}),l&&Q.warning("File list truncated — some files may be hidden"),l}async function dt(t){const n=P.current.get(t);if(n)return n;const o=$.current,l=(async()=>{const m=await De({pattern:"**/*",path:H(t),limit:Ge}),M=Re(m,!0,o);return!M&&o===$.current&&_(ne=>{const ce=new Set(ne);return ce.add(t),ce}),M})();P.current.set(t,l);try{return await l}finally{P.current.delete(t)}}async function Pe(t){if(!Ce(t,R.current))return!1;G(n=>new Set(n).add(t));try{return await dt(t)}finally{G(n=>{const o=new Set(n);return o.delete(t),o})}}async function ut(t){const n=new Set(R.current);for(const o of ve(t)){if(!Ce(o,n))continue;if(await Pe(o))throw new Error("Folder listing truncated — expand again to load more");n.add(o)}}async function te(){const t=++$.current;P.current.clear(),O(!0),_(new Set),y(new Set),G(new Set);try{const n=await De({pattern:"**/*",limit:Ge,maxDepth:gn});Re(n,!1,t),w(!0)}catch{j&&Q.error("Failed to refresh file tree")}finally{O(!1)}}async function Ee(t){if(!z.get(t)?.loaded){N(o=>{const l=new Map(o);return l.set(t,{savedContent:"",editorValue:"",loaded:!1}),l});try{const o=await J("read",{path:H(t),full:!0}),l=bn(o.content??"");N(m=>{const M=new Map(m);return M.set(t,{savedContent:l,editorValue:l,loaded:!0}),M})}catch{}}}async function ft(t,n){try{await J("write",{path:H(t),content:n}),de("file saved via sandbox /write",{path:t}),q.invalidateQueries({queryKey:_e(s,e,i)});try{const o=await Yt(s,e,i);de("git status after save",o)}catch(o){de("git status after save failed",{path:t,error:o instanceof Error?o.message:String(o)})}N(o=>{const l=new Map(o),m=l.get(t);return m&&l.set(t,{...m,savedContent:n}),l})}catch(o){de("file save failed",{path:t,error:o instanceof Error?o.message:String(o)})}}function mt(t){x(t),D({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),E(null),k.includes(t)||g(n=>[...n,t]),Ee(t)}function pt(t){g(n=>{const o=n.filter(l=>l!==t);return d===t&&x(o[o.length-1]??null),o}),N(n=>{const o=new Map(n);return o.delete(t),o})}function ke(t){y(n=>{const o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o})}async function xt(t){if(Ce(t,R.current))try{if(await Pe(t))return}catch(n){Q.error(n instanceof Error?n.message:"Failed to load folder");return}ke(t)}async function ht(t,n){if(n){ke(t);return}await xt(t)}async function ge(t){await I.current,await ut(t);const n=ve(t);y(o=>{const l=new Set(o);for(const m of n)l.add(m);return l}),mt(t)}function gt(){return C?.kind==="directory"?C.path:C?.kind==="file"?we(C.path):d?we(d):"/"}function Te(t){const n=gt();X({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const vt=vn(h,p),Oe=yn(vt,v),Ae=b?Oe.filter(t=>t.node.name.toLowerCase().includes(b.toLowerCase())):Oe,Z=d?z.get(d):null,yt=Z?.loaded&&Z.editorValue!==Z.savedContent,Ct=xe?tt(xe.path):[],wt=(t,n)=>{K.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!d)return;const o=t.getValue();await ft(d,o)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const o=t.getSelection(),l=t.getModel();if(!o||!l||!d)return;const m=l.getValueInRange(o);E({filePath:d,lineStart:o.startLineNumber,lineEnd:o.endLineNumber,selectedCode:m})})};function bt(t){if(!S)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${S.filePath}\``,`**Lines:** ${S.lineStart}–${S.lineEnd}`];if(S.selectedCode){const o=ye(S.filePath),l=S.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+o,l,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),V("chat"),W({parts:[{type:"text",text:n.join(`
2
- `)}]}),E(null)}return T&&!j?r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(oe,{size:20,className:"animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[r.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[r.jsxs("div",{className:"relative min-w-0 flex-1",children:[r.jsx(Vt,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",value:b,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),r.jsxs(Fe,{children:[r.jsx($e,{asChild:!0,children:r.jsx(pe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Te("new-file"),children:r.jsx(Ut,{size:14})})}),r.jsx(Ie,{side:"bottom",children:"New file"})]}),r.jsxs(Fe,{children:[r.jsx($e,{asChild:!0,children:r.jsx(pe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Te("new-folder"),children:r.jsx(Wt,{size:14})})}),r.jsx(Ie,{side:"bottom",children:"New folder"})]})]}),r.jsx(qt,{className:"flex-1",children:r.jsxs("div",{className:"py-1",children:[Ae.map(t=>{const{node:n,depth:o}=t,l=n.kind==="directory",m=v.has(n.path),M=C?.path===n.path,ne=Cn(n.path,n.kind),ce=l&&L.has(n.path);return r.jsx(lr,{node:n,depth:o,isExpanded:m,isSelected:M,isLoading:ce,fileVisual:wn(n.name),onSelect:()=>D(n),onOpen:()=>{l?ht(n.path,m):ge(n.path)},onNewFile:()=>X({mode:"new-file",node:n,parentDir:ne}),onNewFolder:()=>X({mode:"new-folder",node:n,parentDir:ne}),onCopyPath:()=>Ne("Path",ue(n.path)),onCopyRelativePath:()=>Ne("Relative path",H(n.path)),onRename:()=>X({mode:"rename",node:n,parentDir:ne}),onDelete:()=>he(n)},n.path)}),j&&Ae.length===0&&r.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:b?`No files match "${b}"`:"No files found"})]})})]}),r.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[k.length>0&&r.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:k.map(t=>{const n=z.get(t),o=n?.loaded&&n.editorValue!==n.savedContent,l=d===t,m=t.split("/").pop()??t;return r.jsxs("div",{className:ie("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",l?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{x(t),Ee(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":l,children:[r.jsx("span",{className:"truncate max-w-32",children:m}),o&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),r.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:M=>{M.stopPropagation(),pt(t)},children:r.jsx(Qt,{size:12})})]},t)})}),S&&r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:r.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const o=t.currentTarget.elements.namedItem("askAiInput");o.value.trim()&&bt(o.value)},children:[r.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&E(null)}}),r.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[r.jsx("title",{children:"Send"}),r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),r.jsx("div",{className:"flex-1 overflow-hidden",children:d&&Z?.loaded?r.jsx(Kt,{language:ye(d),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:d,onChange:t=>{const n=d;n&&N(o=>{const l=new Map(o),m=l.get(n);return m&&l.set(n,{...m,editorValue:t??""}),l})},onMount:wt,loading:r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(oe,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},d):d&&!Z?.loaded?r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx(oe,{size:20,className:"animate-spin text-muted-foreground"})}):r.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),d&&r.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[r.jsx("span",{className:"truncate",children:d}),r.jsxs("span",{children:[yt?"Modified":"Saved"," ·"," ",ye(d)]})]})]}),r.jsx(Dn,{open:F!==null,mode:F?.mode??"new-file",initialName:F?.mode==="rename"?F.node.name:"",parentLabel:F&&F.mode!=="rename"?F.parentDir==="/"?"/":H(F.parentDir):void 0,isPending:ae,onSubmit:st,onOpenChange:t=>{!t&&!ae&&X(null)}}),r.jsx(Rn,{deleteTarget:xe,deleteDirtyPaths:Ct,fsActionPending:ae,onOpenChange:t=>{!t&&!ae&&he(null)},onConfirm:t=>{at(t)}})]})}export{oa as FileExplorer};