@decocms/mesh 2.113.0 → 2.114.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 (209) hide show
  1. package/dist/client/assets/{AlertCircle-CooHa8Dx.js → AlertCircle-FL98lGLa.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-Dbg9uZyB.js → AlertOctagon-B33KdaLi.js} +1 -1
  3. package/dist/client/assets/{AlertTriangle-Ca8IB5bL.js → AlertTriangle-DteHmOG1.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-DIF2VO2W.js → ArrowLeft-CMuGBwkE.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DgvOdNkG.js → ArrowUp-xougxkbC.js} +1 -1
  6. package/dist/client/assets/{Check-DGXJXTap.js → Check-BY-DCpO_.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DDajcDWB.js → CheckCircle-CpXx2avT.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-CnxPjvi4.js → CheckDone01-DJLuFHxJ.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-Iy-LVhoI.js → CheckVerified02-Cqu-AawR.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-Di42C1UO.js → ChevronDown-FdgQzkaa.js} +1 -1
  11. package/dist/client/assets/{ChevronRight-BNn59ko7.js → ChevronRight-DYxU3E_q.js} +1 -1
  12. package/dist/client/assets/{Clock-BLkZwDYw.js → Clock-Drw10Mc_.js} +1 -1
  13. package/dist/client/assets/{Code01-DooPA--K.js → Code01-CowHxp14.js} +1 -1
  14. package/dist/client/assets/{Container-C1CLnDNL.js → Container-B7qKC3EI.js} +1 -1
  15. package/dist/client/assets/{Copy01-rucQ3PSp.js → Copy01-B_7d0dwb.js} +1 -1
  16. package/dist/client/assets/{Dataflow03-DY9MPHye.js → Dataflow03-Cf4yDkKR.js} +1 -1
  17. package/dist/client/assets/{DotsHorizontal-CxkCXGJv.js → DotsHorizontal-CqtaWGEh.js} +1 -1
  18. package/dist/client/assets/{DotsVertical-NXfqoXCN.js → DotsVertical-qEJ2g9HJ.js} +1 -1
  19. package/dist/client/assets/{Download01-f5vnFohs.js → Download01-IPqVm26W.js} +1 -1
  20. package/dist/client/assets/{Edit01-CxGjhFGJ.js → Edit01-CUcmwNxC.js} +1 -1
  21. package/dist/client/assets/{Eye-CmK33jvc.js → Eye-Rq15dwoo.js} +1 -1
  22. package/dist/client/assets/{File02-Bs24RCQ6.js → File02-DPSlzBxh.js} +1 -1
  23. package/dist/client/assets/{File06-XfbhoM8r.js → File06-xsY7vCFb.js} +1 -1
  24. package/dist/client/assets/{FilterLines-Gpro-d22.js → FilterLines-CJgE2bmA.js} +1 -1
  25. package/dist/client/assets/{Globe01-CspKYhQJ.js → Globe01-BuKzbzrx.js} +1 -1
  26. package/dist/client/assets/{Globe02-DcNEoN4R.js → Globe02-BIRPCTiD.js} +1 -1
  27. package/dist/client/assets/{Grid01-DkGxNKPL.js → Grid01-CcUd9dpu.js} +1 -1
  28. package/dist/client/assets/{Hash02-DFSzHnWN.js → Hash02-BAkYwsUS.js} +1 -1
  29. package/dist/client/assets/{Home02-CccWHOVS.js → Home02-CyX62jfB.js} +1 -1
  30. package/dist/client/assets/{Image01-F0dDnjWb.js → Image01-CiGMIZf1.js} +1 -1
  31. package/dist/client/assets/{Inbox01-rhXjoTLG.js → Inbox01-CxlDy_Yy.js} +1 -1
  32. package/dist/client/assets/{InfoCircle-DDMndy6f.js → InfoCircle-BBQwzN3e.js} +1 -1
  33. package/dist/client/assets/{Key01-BoEk45CQ.js → Key01-CcfhRF0P.js} +1 -1
  34. package/dist/client/assets/{LinkExternal01-6fiITYn6.js → LinkExternal01-CHfE9mil.js} +1 -1
  35. package/dist/client/assets/{List-DLWOvAOP.js → List-BkcTlONj.js} +1 -1
  36. package/dist/client/assets/{Loading01-BGpLDRYx.js → Loading01-CWwskqmx.js} +1 -1
  37. package/dist/client/assets/{Lock01-CkEZCQ8T.js → Lock01-C-e30A69.js} +1 -1
  38. package/dist/client/assets/{Pin01-CSZOSQvf.js → Pin01-DNrhTTs3.js} +1 -1
  39. package/dist/client/assets/{Play-Ck339o9D.js → Play-sMJsBLST.js} +1 -1
  40. package/dist/client/assets/{Plus-BB0XqcsP.js → Plus-7gpDbhJy.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-BlblCD0d.js → RefreshCcw01-BzY8N8T3.js} +1 -1
  42. package/dist/client/assets/{RefreshCw01-C2HUNviY.js → RefreshCw01-dI5kYugT.js} +1 -1
  43. package/dist/client/assets/{Save01-j7EMqYuR.js → Save01-C9jVAZgo.js} +1 -1
  44. package/dist/client/assets/{SearchMd-CguhhQVb.js → SearchMd-BMO4jqwv.js} +1 -1
  45. package/dist/client/assets/{Settings01-jz5w4e3w.js → Settings01-CRoxTuTO.js} +1 -1
  46. package/dist/client/assets/{Share07-DA5hMI-c.js → Share07-DFdDYoqj.js} +1 -1
  47. package/dist/client/assets/Shield01-DymehiLu.js +1 -0
  48. package/dist/client/assets/{Terminal-B6KzedA2.js → Terminal-zi42zfXM.js} +1 -1
  49. package/dist/client/assets/{Tool01-BPh57jnm.js → Tool01-lC4M_AmN.js} +1 -1
  50. package/dist/client/assets/{Trash01-DGjvH5rG.js → Trash01-BKhksYCP.js} +1 -1
  51. package/dist/client/assets/{Upload01-BWKtoN2l.js → Upload01-CorstXj2.js} +1 -1
  52. package/dist/client/assets/{Users03-DWNrz1Vr.js → Users03-B6oew679.js} +1 -1
  53. package/dist/client/assets/{XCircle-VzD2IKvZ.js → XCircle-WTPrrNWD.js} +1 -1
  54. package/dist/client/assets/{XClose-quksRQbf.js → XClose-DoKE29TG.js} +1 -1
  55. package/dist/client/assets/{agent-connections-preview-DO3HZtWQ.js → agent-connections-preview-DybZ18X5.js} +1 -1
  56. package/dist/client/assets/agent-detail-DncXhd81.js +1 -0
  57. package/dist/client/assets/agents-D-4jcSt1.js +1 -0
  58. package/dist/client/assets/{alert-dialog-BobozgbA.js → alert-dialog-Dm7Md3Yk.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-Bg2u42FQ.js → auth-catchall-DHQTu60x.js} +1 -1
  60. package/dist/client/assets/avatar-B-mPVtLH.js +1 -0
  61. package/dist/client/assets/{badge-Ba42zrft.js → badge-Bt6C7wEJ.js} +1 -1
  62. package/dist/client/assets/{binder-XSlHh33G.js → binder-BvXUsKRF.js} +1 -1
  63. package/dist/client/assets/breadcrumb-Cipoy1eR.js +1 -0
  64. package/dist/client/assets/button-Bl7hMmCe.js +1 -0
  65. package/dist/client/assets/card-BMQBEGUR.js +1 -0
  66. package/dist/client/assets/{checkbox-BgqFPCG8.js → checkbox-C-nrBu1T.js} +1 -1
  67. package/dist/client/assets/{circle-alert-D1V0DFvr.js → circle-alert-DYoRV5F7.js} +1 -1
  68. package/dist/client/assets/{collection-detail-tuOZUkEg.js → collection-detail-x0pDfnG2.js} +3 -3
  69. package/dist/client/assets/{collection-tab-DpQw4w-_.js → collection-tab-CMJJpUjs.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-Dwsrv-is.js → collection-table-wrapper-DS44ibQ8.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BxPjmpup.js → collection-tabs-Dyc14WST.js} +1 -1
  72. package/dist/client/assets/{command-eII6FM4T.js → command-DGGP5Edh.js} +1 -1
  73. package/dist/client/assets/{connect-CjbgNw43.js → connect-BqPwKrDp.js} +1 -1
  74. package/dist/client/assets/{connection-card-B-vaA7In.js → connection-card-B_yTVrCB.js} +1 -1
  75. package/dist/client/assets/connection-detail-BHwcydrH.js +1 -0
  76. package/dist/client/assets/connections-C2FniOCy.js +1 -0
  77. package/dist/client/assets/constants-B9b2QjkO.js +1 -0
  78. package/dist/client/assets/{constants-DTZgxhQr.js → constants-DY_BU6PR.js} +1 -1
  79. package/dist/client/assets/{create-organization-dialog-_ENRfzh2.js → create-organization-dialog-BmtVHISe.js} +1 -1
  80. package/dist/client/assets/{create-project-dialog-CkoSW_Yw.js → create-project-dialog-DFYOBIMM.js} +1 -1
  81. package/dist/client/assets/dialog-BTs7spED.js +1 -0
  82. package/dist/client/assets/{dropdown-menu-DwhvTSoj.js → dropdown-menu-Dk3PdiLq.js} +1 -1
  83. package/dist/client/assets/dynamic-plugin-layout-C8tDNw7E.js +1 -0
  84. package/dist/client/assets/empty-state-BrrA9jzc.js +1 -0
  85. package/dist/client/assets/{empty-state-CUSdR_G_.js → empty-state-yzpNvfA-.js} +1 -1
  86. package/dist/client/assets/{env-vars-editor-CX-fJfxt.js → env-vars-editor-CxFtbjNH.js} +1 -1
  87. package/dist/client/assets/{error-boundary-Di0tQXdv.js → error-boundary-GB3TovJQ.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Dd3BvcTW.js → extract-connection-data-Cjm6QMzJ.js} +1 -1
  89. package/dist/client/assets/{file-browser-CyYYn3HQ.js → file-browser-CeBgj9Bh.js} +2 -2
  90. package/dist/client/assets/{form-DIsigMsk.js → form-Dxe8J4dP.js} +1 -1
  91. package/dist/client/assets/{grid-view-BsAPFz5e.js → grid-view-qfkYjNIX.js} +1 -1
  92. package/dist/client/assets/{home-DoBwFvBu.js → home-C39nGjR7.js} +1 -1
  93. package/dist/client/assets/index-48TFsA2Q.css +1 -0
  94. package/dist/client/assets/{index-BVrm4rGn.js → index-B2KxLjHq.js} +1 -1
  95. package/dist/client/assets/{index-CMu5spRk.js → index-BOlMuTYA.js} +6 -6
  96. package/dist/client/assets/index-BrH9wXxf.js +1 -0
  97. package/dist/client/assets/{index-qSvnMMX3.js → index-BuPkfOh7.js} +1 -1
  98. package/dist/client/assets/{index-Cs0vYfu9.js → index-CLUeNS9F.js} +1 -1
  99. package/dist/client/assets/{index-DeBwK236.js → index-CSf23Q8F.js} +5 -5
  100. package/dist/client/assets/index-CzSiUwwv.js +218 -0
  101. package/dist/client/assets/{index-NEbz2HQu.js → index-DVHOzh7f.js} +1 -1
  102. package/dist/client/assets/{index-CDwFwb7Q.js → index-Dps5khDb.js} +1 -1
  103. package/dist/client/assets/{infiniteQueryObserver-DbZCUgr5.js → infiniteQueryObserver-Ctmp4byY.js} +1 -1
  104. package/dist/client/assets/{input-Cw77piS4.js → input-CAPxG1rh.js} +1 -1
  105. package/dist/client/assets/{integration-icon-D3fWRQzh.js → integration-icon-jbm4PmZt.js} +1 -1
  106. package/dist/client/assets/{label-CUy1x9Fc.js → label-A7ibpcPd.js} +1 -1
  107. package/dist/client/assets/{layout-BPYuOiPI.js → layout-DHncYg0M.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-DRPmjZks.js → localstorage-keys-Cc9e53sU.js} +1 -1
  109. package/dist/client/assets/{login-CUcM51_h.js → login-C4VFa6jD.js} +1 -1
  110. package/dist/client/assets/{markdown-BUX5ABnz.js → markdown-DTO-ngpn.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-Da77-kcD.js → mcp-oauth-lMxJpMMH.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-DcZS4AhS.js → mcp-server-card-C-sPhXVX.js} +1 -1
  113. package/dist/client/assets/mcp-server-detail-BtO9BwQ6.js +2 -0
  114. package/dist/client/assets/members-Dh31vMll.js +3 -0
  115. package/dist/client/assets/{monitoring-DINJ4pYy.js → monitoring-D0DgTEcy.js} +1 -1
  116. package/dist/client/assets/monitoring-dashboard-edit-DCcFalwQ.js +1 -0
  117. package/dist/client/assets/{monitoring-dashboard-view-B53vWJlZ.js → monitoring-dashboard-view-CuFcYaD_.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-Dsqe_oXS.js → oauth-callback-DKWROL5U.js} +1 -1
  119. package/dist/client/assets/{page-BKBuf2HE.js → page-BpCfHp43.js} +1 -1
  120. package/dist/client/assets/page-CoIEp87I.js +1 -0
  121. package/dist/client/assets/{plugin-empty-state-D_Z6xsRD.js → plugin-empty-state-DMdw5AKa.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-Cdi0lxlF.js → plugin-empty-state-DfPCNHNV.js} +1 -1
  123. package/dist/client/assets/{plugin-header-D_XJF06t.js → plugin-header-CVaBr8-j.js} +1 -1
  124. package/dist/client/assets/{plugin-header-DGLeYRv9.js → plugin-header-DqwJE7vc.js} +1 -1
  125. package/dist/client/assets/{popover-C8z2ljXJ.js → popover-Ca9Cyzf7.js} +1 -1
  126. package/dist/client/assets/{project-layout-gRYIrnzO.js → project-layout-F2YJOnzp.js} +1 -1
  127. package/dist/client/assets/project-settings-DwtLH_vq.js +1 -0
  128. package/dist/client/assets/projects-list-DPMlGsBe.js +1 -0
  129. package/dist/client/assets/{readme-viewer-DSTuLgLE.js → readme-viewer-D5RieYNW.js} +1 -1
  130. package/dist/client/assets/registry-layout-BrhYm9Dr.js +5 -0
  131. package/dist/client/assets/{registry-utils-D8FLO1oI.js → registry-utils--fif7P3x.js} +1 -1
  132. package/dist/client/assets/{reports-layout-NWBpDTNI.js → reports-layout-9yNTvI9o.js} +1 -1
  133. package/dist/client/assets/{reset-password-BEvAUHxp.js → reset-password-FRWYt8ap.js} +1 -1
  134. package/dist/client/assets/{resizable-Q_6VrAvM.js → resizable-DKtpdeB3.js} +1 -1
  135. package/dist/client/assets/{save-actions-DnatwzCI.js → save-actions-DH-J_-0b.js} +1 -1
  136. package/dist/client/assets/{scroll-area--Dl42eG7.js → scroll-area-BfJ2ZkbI.js} +1 -1
  137. package/dist/client/assets/{select-DmOdy-_2.js → select-CKDoCTJO.js} +1 -1
  138. package/dist/client/assets/shell-layout-DkuDKL8p.js +3 -0
  139. package/dist/client/assets/{spinner-BFe5KsON.js → spinner-B-FWJ8nx.js} +1 -1
  140. package/dist/client/assets/{store-invite-B6QzkY9D.js → store-invite-1HxdtnDC.js} +1 -1
  141. package/dist/client/assets/{switch-BTNdX6uT.js → switch-ySGmS6Zx.js} +1 -1
  142. package/dist/client/assets/{table-m7xKes0i.js → table-DGDNn7mH.js} +1 -1
  143. package/dist/client/assets/tasks-BuxJd7k9.js +1 -0
  144. package/dist/client/assets/{textarea-1ZAkAqPs.js → textarea-COGwSIgK.js} +1 -1
  145. package/dist/client/assets/{time-range-picker-S5DXdK6J.js → time-range-picker-hBuoR0m0.js} +1 -1
  146. package/dist/client/assets/{toggle-group-B4gd2g4g.js → toggle-group-RO8j2kDd.js} +1 -1
  147. package/dist/client/assets/{tools-list-BYJP7wdj.js → tools-list-CBpacE22.js} +1 -1
  148. package/dist/client/assets/tooltip-CLbmwjfd.js +1 -0
  149. package/dist/client/assets/topbar-portal-BHxVS8Tl.js +1 -0
  150. package/dist/client/assets/typewriter-title-C4OcGX3b.js +16 -0
  151. package/dist/client/assets/{use-binding-CAtjL1rr.js → use-binding-D36c91MK.js} +1 -1
  152. package/dist/client/assets/{use-connection-BRwTI0xk.js → use-connection-CdIwTzRh.js} +1 -1
  153. package/dist/client/assets/{use-copy-BnGNgGbL.js → use-copy-BZqI2HfR.js} +1 -1
  154. package/dist/client/assets/{use-create-virtual-mcp-BIn6DTPa.js → use-create-virtual-mcp-DKrayFIg.js} +1 -1
  155. package/dist/client/assets/{use-deco-chat-open-CWPuucLF.js → use-deco-chat-open-BuMsTBnv.js} +3 -3
  156. package/dist/client/assets/{use-install-from-registry-GZkHb-J_.js → use-install-from-registry-kn39eg4d.js} +1 -1
  157. package/dist/client/assets/{use-list-state-CLqJqhda.js → use-list-state-CYucxtoX.js} +1 -1
  158. package/dist/client/assets/{use-llm-BToIG9lg.js → use-llm-CX9QGbjZ.js} +1 -1
  159. package/dist/client/assets/{use-mcp-prompts-C28zFdyF.js → use-mcp-prompts-DMC1gnwj.js} +1 -1
  160. package/dist/client/assets/{use-mcp-tools-CnGq7c_h.js → use-mcp-tools-SZ1hgrkZ.js} +1 -1
  161. package/dist/client/assets/{use-organization-settings-BVsgnOKP.js → use-organization-settings-1mU06z41.js} +1 -1
  162. package/dist/client/assets/{use-project-pPGjnPtH.js → use-project-CsuhSK50.js} +1 -1
  163. package/dist/client/assets/use-view-mode-CVN4cPaD.js +1 -0
  164. package/dist/client/assets/{use-virtual-mcp-C67SrK4s.js → use-virtual-mcp-CqdRLJoL.js} +1 -1
  165. package/dist/client/assets/useInfiniteQuery-Bd_PpC7_.js +1 -0
  166. package/dist/client/assets/{useMutation-BLWSoXAi.js → useMutation-BYl8vvsl.js} +1 -1
  167. package/dist/client/assets/useQuery-CTct6gOY.js +1 -0
  168. package/dist/client/assets/useSuspenseInfiniteQuery-DJZPFUMY.js +1 -0
  169. package/dist/client/assets/workflow-CMJomw9A.js +1 -0
  170. package/dist/client/index.html +2 -2
  171. package/dist/server/cli.js +3 -3
  172. package/dist/server/migrate.js +3 -3
  173. package/dist/server/server.js +3 -3
  174. package/package.json +1 -1
  175. package/dist/client/assets/Settings02-BEGJoXOf.js +0 -1
  176. package/dist/client/assets/X-hlRWRdLd.js +0 -1
  177. package/dist/client/assets/agent-detail-Dm90C1dq.js +0 -1
  178. package/dist/client/assets/agents-Dp1lzRWx.js +0 -1
  179. package/dist/client/assets/avatar-DzNBuwvQ.js +0 -1
  180. package/dist/client/assets/breadcrumb-DVboj9hZ.js +0 -1
  181. package/dist/client/assets/button-BvpGJmwj.js +0 -1
  182. package/dist/client/assets/card-DUyr2anf.js +0 -1
  183. package/dist/client/assets/connection-detail-1_ZQMYvG.js +0 -1
  184. package/dist/client/assets/connections-DSsqgW7V.js +0 -1
  185. package/dist/client/assets/constants-BXsR0e2f.js +0 -1
  186. package/dist/client/assets/dialog-Djb2_yQ3.js +0 -1
  187. package/dist/client/assets/dynamic-plugin-layout-gS11xmZg.js +0 -1
  188. package/dist/client/assets/empty-state-CfAcFJ3T.js +0 -1
  189. package/dist/client/assets/index-hmLeN6Cx.css +0 -1
  190. package/dist/client/assets/index-p5ek_T2U.js +0 -218
  191. package/dist/client/assets/index-r3RmHcg-.js +0 -1
  192. package/dist/client/assets/mcp-server-detail-BsuSFuH9.js +0 -2
  193. package/dist/client/assets/members-Dt-WMWXs.js +0 -3
  194. package/dist/client/assets/monitoring-dashboard-edit-ViuWKC7f.js +0 -1
  195. package/dist/client/assets/page-BLmopBsr.js +0 -1
  196. package/dist/client/assets/project-settings-iakvSAMp.js +0 -1
  197. package/dist/client/assets/projects-list-BTf0o0Dw.js +0 -1
  198. package/dist/client/assets/registry-layout-D0ZI3R-w.js +0 -5
  199. package/dist/client/assets/shell-layout-DaVrqTvl.js +0 -12
  200. package/dist/client/assets/tasks-B817iTsv.js +0 -1
  201. package/dist/client/assets/tooltip-w4nyO9EM.js +0 -1
  202. package/dist/client/assets/topbar-portal-DFijBXBE.js +0 -1
  203. package/dist/client/assets/typewriter-title-fwTbDCyQ.js +0 -16
  204. package/dist/client/assets/use-mobile-Dl83qL71.js +0 -1
  205. package/dist/client/assets/use-view-mode-BC3VVzlU.js +0 -1
  206. package/dist/client/assets/useInfiniteQuery-CL1DQ1B_.js +0 -1
  207. package/dist/client/assets/useQuery-CoMTdc_B.js +0 -1
  208. package/dist/client/assets/useSuspenseInfiniteQuery-BEcP523_.js +0 -1
  209. package/dist/client/assets/workflow-D3d1tCTr.js +0 -1
@@ -1,10 +1,10 @@
1
- import{b4 as te,r as k,o as Zs,s as kt,c as C,j as o,bz as Wt,u as G,l as Ys,y as eo,e as pe,a as to,aE as Ye,O as et,t as On,bm as q,bP as no,bQ as so,aH as oo,a9 as Ft,av as de,ax as Rn,aI as ro,ar as Ht,aG as io,aJ as An,at as Mn,aP as lo,aQ as co,ay as Pn,aR as ao,bR as Vt,bS as uo,an as fo,bo as mo,aq as po,z as xo,bT as ho,bU as go,bV as Ln}from"./index-p5ek_T2U.js";import{E as Dn}from"./empty-state-CUSdR_G_.js";import{E as zn}from"./error-boundary-Di0tQXdv.js";import{d as Ut,u as Bt,f as lt,h as bo}from"./use-connection-BRwTI0xk.js";import{u as ne,g as Ve,i as jo}from"./constants-DTZgxhQr.js";import{P as qt}from"./index-qSvnMMX3.js";import{F as It,a as vo,b as Kt,d as Jt}from"./form-DIsigMsk.js";import{I as Gt}from"./input-Cw77piS4.js";import{T as At}from"./textarea-1ZAkAqPs.js";import{b as Wn,V as Xt,a as he}from"./layout-BPYuOiPI.js";import{S as Fn}from"./save-actions-DnatwzCI.js";import{c as M,B as Y}from"./button-BvpGJmwj.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as tt}from"./select-DmOdy-_2.js";import{c as Qt,T as Zt,a as Yt,b as en}from"./tooltip-w4nyO9EM.js";import{i as yo}from"./AlertCircle-CooHa8Dx.js";import{s as So}from"./Clock-BLkZwDYw.js";import{i as wo}from"./Code01-DooPA--K.js";import{a as No}from"./Copy01-rucQ3PSp.js";import{i as He}from"./Loading01-BGpLDRYx.js";import{i as tn}from"./Play-Ck339o9D.js";import{s as ct}from"./XClose-quksRQbf.js";import{B as qn,a as Kn,b as Pe,d as nt,e as st,c as Jn}from"./breadcrumb-DVboj9hZ.js";import{u as Co,O as ko,M as Io,F as _o,v as To}from"./index-CMu5spRk.js";import{d as nn,b as sn,a as on}from"./use-mcp-tools-CnGq7c_h.js";import{I as at}from"./integration-icon-D3fWRQzh.js";import{M as Le,n as Eo,S as $o,a as Oo}from"./scroll-area--Dl42eG7.js";import{E as rn}from"./empty-state-CfAcFJ3T.js";import{n as Ro}from"./Container-C1CLnDNL.js";import{b as Gn}from"./use-virtual-mcp-C67SrK4s.js";import{b as Ao,a as jn,R as Mo}from"./resizable-Q_6VrAvM.js";import{B as me}from"./badge-Ba42zrft.js";import{S as dt}from"./spinner-BFe5KsON.js";import{V as Po}from"./collection-table-wrapper-Dwsrv-is.js";import{N as Lo,S as Do,a as zo,c as Wo,m as Ge,P as Fo,b as Ho,R as Vo,u as Uo,d as Bo,e as vn,E as qo,f as Ko}from"./index-DeBwK236.js";import{a as Jo}from"./use-binding-CAtjL1rr.js";import{b as Go,c as Xo,d as Qo,e as Zo,a as Yo,D as er}from"./dialog-Djb2_yQ3.js";import"./index-BVrm4rGn.js";import{s as Xn}from"./Plus-BB0XqcsP.js";import{c as Qn}from"./AlertOctagon-Dbg9uZyB.js";import{i as ut}from"./Check-DGXJXTap.js";import{i as tr}from"./DotsHorizontal-CxkCXGJv.js";import{a as nr}from"./Tool01-BPh57jnm.js";import{D as sr,a as or,b as rr,c as yn}from"./dropdown-menu-DwhvTSoj.js";import{k as ir,R as lr,l as cr,m as Zn}from"./use-deco-chat-open-CWPuucLF.js";import{i as ar}from"./ChevronRight-BNn59ko7.js";import{i as Yn}from"./X-hlRWRdLd.js";import"./SearchMd-CguhhQVb.js";import"./AlertTriangle-Ca8IB5bL.js";import"./useMutation-BLWSoXAi.js";import"./Pin01-CSZOSQvf.js";import"./use-organization-settings-BVsgnOKP.js";import"./label-CUy1x9Fc.js";import"./index-r3RmHcg-.js";import"./Save01-j7EMqYuR.js";import"./index-CDwFwb7Q.js";import"./ChevronDown-Di42C1UO.js";import"./mcp-oauth-Da77-kcD.js";import"./File06-XfbhoM8r.js";import"./Key01-BoEk45CQ.js";import"./constants-BXsR0e2f.js";import"./registry-utils-D8FLO1oI.js";import"./extract-connection-data-Dd3BvcTW.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-GZkHb-J_.js";import"./circle-alert-D1V0DFvr.js";import"./index-NEbz2HQu.js";import"./useQuery-CoMTdc_B.js";import"./ArrowUp-DgvOdNkG.js";import"./Grid01-DkGxNKPL.js";import"./List-DLWOvAOP.js";import"./table-m7xKes0i.js";import"./popover-C8z2ljXJ.js";import"./use-mcp-prompts-C28zFdyF.js";import"./usage-B8eRkRZY.js";import"./Edit01-CxGjhFGJ.js";import"./Users03-DWNrz1Vr.js";import"./XCircle-VzD2IKvZ.js";import"./ArrowLeft-DIF2VO2W.js";import"./use-copy-BnGNgGbL.js";import"./use-create-virtual-mcp-BIn6DTPa.js";import"./marked.esm-BaswSlok.js";import"./markdown-BUX5ABnz.js";import"./tools-list-BYJP7wdj.js";import"./card-DUyr2anf.js";import"./Eye-CmK33jvc.js";import"./Globe02-DcNEoN4R.js";import"./RefreshCw01-C2HUNviY.js";import"./Trash01-DGjvH5rG.js";import"./binder-XSlHh33G.js";import"./use-llm-BToIG9lg.js";import"./localstorage-keys-DRPmjZks.js";import"./Image01-F0dDnjWb.js";import"./RefreshCcw01-BlblCD0d.js";import"./Settings01-jz5w4e3w.js";import"./useSuspenseInfiniteQuery-BEcP523_.js";import"./infiniteQueryObserver-DbZCUgr5.js";const es=te("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const ts=te("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ln=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const cn=te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const dr=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const ur=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const fr=te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ns=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ss=te("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const os=te("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const mr=te("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const rs=te("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const is=te("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));ls.displayName="Box";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));cs.displayName="ClockFastForward";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));as.displayName="Code02";const Xe=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Xe.displayName="Columns01";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));ds.displayName="CornerDownRight";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));us.displayName="Database01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));fs.displayName="GitBranch01";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));ms.displayName="Repeat03";Zs({title:kt().min(1),description:kt().nullable(),body:kt()});function _t(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function pr(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function xr(t){const e=C.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(It,{control:n.control,name:"title",render:br}),o.jsx(It,{control:n.control,name:"description",render:gr})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(It,{control:n.control,name:"body",render:hr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.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]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function hr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(At,{...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 gr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...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 br(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function jr(t){const e=C.c(41),{providerId:n,promptId:s}=t,r=Wt().location.href,{org:l}=G(),c=n||null;let a;e[0]!==l.id||e[1]!==c?(a={connectionId:c,orgId:l.id},e[0]=l.id,e[1]=c,e[2]=a):a=e[2];const d=ne(a),u=Ut(n,"PROMPT",s,d),f=Bt(n,"PROMPT",d),m=f.update.isPending;let h;e[3]!==u?(h=u?{title:u.title,description:u.description??null,body:_t(u)}:void 0,e[3]=u,e[4]=h):h=e[4];let p;e[5]!==h?(p={values:h},e[5]=h,e[6]=p):p=e[6];const x=Ys(p);let g;e[7]!==x||e[8]!==u?(g=()=>{u&&x.reset({title:u.title,description:u.description??null,body:_t(u)})},e[7]=x,e[8]=u,e[9]=g):g=e[9];const b=g;let j;e[10]!==f.update||e[11]!==x||e[12]!==s?(j=x.handleSubmit(async I=>{const A=await f.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:A.title,description:A.description??null,body:_t(A)})}),e[10]=f.update,e[11]=x,e[12]=s,e[13]=j):j=e[13];const y=j;if(!u){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let S;e[15]!==u.title?(S=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[15]=u.title,e[16]=S):S=e[16];let v;e[17]!==u.description?(v=u.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[17]=u.description,e[18]=v):v=e[18];let w;e[19]!==S||e[20]!==v?(w=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[S,v]})}),e[19]=S,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==y?(N=()=>{y()},e[22]=y,e[23]=N):N=e[23];let T;e[24]!==x.formState.isDirty||e[25]!==m||e[26]!==b||e[27]!==N?(T=o.jsx(Fn,{onSave:N,onUndo:b,isDirty:x.formState.isDirty,isSaving:m}),e[24]=x.formState.isDirty,e[25]=m,e[26]=b,e[27]=N,e[28]=T):T=e[28];let E;e[29]!==u.title||e[30]!==r?(E=o.jsx(qt,{title:u.title,url:r,icon:"description"}),e[29]=u.title,e[30]=r,e[31]=E):E=e[31];let $;e[32]!==T||e[33]!==E?($=o.jsxs(Xt,{children:[T,E]}),e[32]=T,e[33]=E,e[34]=$):$=e[34];let R;e[35]!==x?(R=o.jsx("div",{className:"h-full",children:o.jsx(xr,{form:x})}),e[35]=x,e[36]=R):R=e[36];let L;return e[37]!==$||e[38]!==R||e[39]!==w?(L=o.jsxs(he,{children:[w,$,R]}),e[37]=$,e[38]=R,e[39]=w,e[40]=L):L=e[40],L}function vr(t){const e=C.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pr(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(jr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const yr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Sr(t){const e=C.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=M(yr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function wr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Nr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const Sn=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Cr(t){const e=C.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Co(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ko,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx(kr,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function kr({toolName:t,connectionId:e}){const s=Wt().location.href,{replayId:i}=to({strict:!1}),r=(()=>{if(!i)return null;const _=`replay-${i}`,O=sessionStorage.getItem(_);if(!O)return null;sessionStorage.removeItem(_);try{return JSON.parse(O)}catch{return null}})(),l=(()=>{if(!r)return null;const _={};for(const[O,P]of Object.entries(r))P!==null&&typeof P=="object"?_[O]=JSON.stringify(P,null,2):_[O]=P;return _})(),[c,a]=k.useState(l??{}),[d,u]=k.useState(r?JSON.stringify(r,null,2):"{}"),[f,m]=k.useState(null),[h,p]=k.useState(null),[x,g]=k.useState(!1),[b,j]=k.useState(null),{org:y}=G(),S=lt(e),v=ne({connectionId:e,orgId:y.id}),w=nn({client:v}),N=w.data?.tools?.find(_=>_.name===t),T=N?.inputSchema?.properties,E=T?Object.keys(T):[],$=E.length>0,R={};if($&&N?.inputSchema?.properties)for(const _ of E)R[_]=N.inputSchema.required?.includes(_)?"":void 0;const L=_=>Object.prototype.hasOwnProperty.call(c,_),I=async()=>{g(!0),p(null),m(null),j(null);const _=performance.now();try{if(!v)throw new Error("MCP client is not available");const O=$?{...R,...c}:(()=>{const H=d.trim();if(!H)return{};const J=JSON.parse(H);if(J&&typeof J=="object")return J;throw new Error("Raw JSON input must be an object.")})();$&&N?.inputSchema?.properties&&Object.entries(N.inputSchema.properties).forEach(([H,J])=>{if((J.type==="object"||J.type==="array")&&typeof O[H]=="string")try{O[H]=JSON.parse(O[H])}catch{}});const P=await v.callTool({name:t,arguments:O}),Q=P.structuredContent??P,Z=performance.now(),F=Math.round(Z-_);m(Q);const K=JSON.stringify(Q),B=new TextEncoder().encode(K).length;j({duration:`${F}ms`,bytes:`${B} bytes`,tokens:`~${Math.ceil(B/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);p(P||"Unknown error occurred");const Q=performance.now();j({duration:`${Math.round(Q-_)}ms`})}finally{g(!1)}},A=(_,O)=>{a(P=>({...P,[_]:O}))},W=()=>{m(null),p(null),j(null)},z=N?.name??Sn(t),X=o.jsx(qn,{children:o.jsxs(Kn,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:y.slug,project:et},children:"Connections"})})}),o.jsx(st,{}),S&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:y.slug,project:et,connectionId:e},search:{tab:"tools"},children:S.title})})}),o.jsx(st,{})]}),o.jsx(Pe,{children:o.jsx(Jn,{children:z})})]})});return o.jsxs(he,{breadcrumb:X,children:[o.jsx(Xt,{children:o.jsx(qt,{title:N?.name??Sn(t),url:s,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(at,{icon:S?.icon||null,name:S?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.isLoading?o.jsx(He,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.isSuccess?"ready":w.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:N?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),N?.inputSchema?.required&&N.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:$&&N?.inputSchema?.properties?Object.entries(N.inputSchema.properties).map(([_,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,N.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(At,{className:"font-mono text-xs",value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:L(_)?String(c[_]??""):"",onValueChange:P=>A(_,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(tt,{value:"true",children:"true"}),o.jsx(tt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_}...`})]},_)):N?.inputSchema&&!$?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(At,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:_=>u(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),b&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(So,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ls,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(us,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(Y,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:I,disabled:x,children:x?o.jsxs(o.Fragment,{children:[o.jsx(He,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(tn,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(Qt,{children:o.jsxs(Zt,{children:[o.jsx(Yt,{asChild:!0,children:o.jsx(Y,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:W,disabled:!f&&!h,children:o.jsx(ct,{size:14})})}),o.jsx(en,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Sr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(yo,{className:"h-4 w-4"}),o.jsx(wr,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Nr,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(Y,{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(f,null,2)),On.success("Copied to clipboard")},children:o.jsx(No,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(wo,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function Ir(t){const e=C.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!lt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(He,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(Cr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const wn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(h=>h(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},an=(t=>t?wn(t):wn),_r=t=>t;function Mt(t,e=_r){const n=q.useSyncExternalStore(t.subscribe,q.useCallback(()=>e(t.getState()),[t,e]),q.useCallback(()=>e(t.getInitialState()),[t,e]));return q.useDebugValue(n),n}const Tr=t=>{const e=an(t),n=s=>Mt(e,s);return Object.assign(n,e),n},Er=(t=>Tr);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Pt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Pt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Pt(s)(n)}}}},$r=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const h=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>h;let p;const x=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:h)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:h))||void 0;return Pt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[w,N]=S;if(p=r.merge(N,(v=s())!=null?v:h),n(p,!0),w)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&y?.(void 0,S)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>x(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||x(),p||h},xs=$r,{useSyncExternalStoreWithSelector:Or}=no,Rr=t=>t;function Ar(t,e=Rr,n){const s=Or(t.subscribe,t.getState,t.getInitialState,e,n);return q.useDebugValue(s),s}const Nn=t=>Symbol.iterator in t,Cn=t=>"entries"in t,kn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Nn(t)&&Nn(e)?Cn(t)&&Cn(e)?kn(t,e):Mr(t,e):kn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Lr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
1
+ import{b4 as te,r as k,o as Zs,s as kt,c as C,j as o,bz as Wt,u as G,l as Ys,y as eo,e as pe,a as to,aE as Ye,O as et,t as On,bm as q,bN as no,bO as so,aH as oo,a9 as Ft,av as de,ax as Rn,aI as ro,ar as Ht,aG as io,aJ as An,at as Mn,aP as lo,aQ as co,ay as Pn,aR as ao,bP as Vt,bQ as uo,an as fo,bo as mo,aq as po,z as xo,bR as ho,bS as go,bT as Ln}from"./index-CzSiUwwv.js";import{E as Dn}from"./empty-state-yzpNvfA-.js";import{E as zn}from"./error-boundary-GB3TovJQ.js";import{d as Ut,u as Bt,f as lt,h as bo}from"./use-connection-CdIwTzRh.js";import{u as ne,g as Ve,i as jo}from"./constants-DY_BU6PR.js";import{P as qt}from"./index-BuPkfOh7.js";import{F as It,a as vo,b as Kt,d as Jt}from"./form-Dxe8J4dP.js";import{I as Gt}from"./input-CAPxG1rh.js";import{T as At}from"./textarea-COGwSIgK.js";import{b as Wn,V as Xt,a as he}from"./layout-DHncYg0M.js";import{S as Fn}from"./save-actions-DH-J_-0b.js";import{c as M,B as Y}from"./button-Bl7hMmCe.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as tt}from"./select-CKDoCTJO.js";import{c as Qt,T as Zt,a as Yt,b as en,i as qn}from"./tooltip-CLbmwjfd.js";import{i as yo}from"./AlertCircle-FL98lGLa.js";import{s as So}from"./Clock-Drw10Mc_.js";import{i as wo}from"./Code01-CowHxp14.js";import{a as No}from"./Copy01-B_7d0dwb.js";import{i as He}from"./Loading01-CWwskqmx.js";import{i as tn}from"./Play-sMJsBLST.js";import{s as ct}from"./XClose-DoKE29TG.js";import{B as Kn,a as Jn,b as Pe,d as nt,e as st,c as Gn}from"./breadcrumb-Cipoy1eR.js";import{u as Co,O as ko,M as Io,F as _o,v as To}from"./index-BOlMuTYA.js";import{d as nn,b as sn,a as on}from"./use-mcp-tools-SZ1hgrkZ.js";import{I as at}from"./integration-icon-jbm4PmZt.js";import{M as Le,n as Eo,S as $o,a as Oo}from"./scroll-area-BfJ2ZkbI.js";import{E as rn}from"./empty-state-BrrA9jzc.js";import{n as Ro}from"./Container-B7qKC3EI.js";import{b as Xn}from"./use-virtual-mcp-CqdRLJoL.js";import{b as Ao,a as jn,R as Mo}from"./resizable-DKtpdeB3.js";import{B as me}from"./badge-Bt6C7wEJ.js";import{S as dt}from"./spinner-B-FWJ8nx.js";import{V as Po}from"./collection-table-wrapper-DS44ibQ8.js";import{N as Lo,S as Do,a as zo,c as Wo,m as Ge,P as Fo,b as Ho,R as Vo,u as Uo,d as Bo,e as vn,E as qo,f as Ko}from"./index-CSf23Q8F.js";import{a as Jo}from"./use-binding-D36c91MK.js";import{b as Go,c as Xo,d as Qo,e as Zo,a as Yo,D as er}from"./dialog-BTs7spED.js";import"./index-B2KxLjHq.js";import{s as Qn}from"./Plus-7gpDbhJy.js";import{c as Zn}from"./AlertOctagon-B33KdaLi.js";import{i as ut}from"./Check-BY-DCpO_.js";import{i as tr}from"./DotsHorizontal-CqtaWGEh.js";import{a as nr}from"./Tool01-lC4M_AmN.js";import{D as sr,a as or,b as rr,c as yn}from"./dropdown-menu-Dk3PdiLq.js";import{k as ir,R as lr,l as cr,m as Yn}from"./use-deco-chat-open-BuMsTBnv.js";import{i as ar}from"./ChevronRight-DYxU3E_q.js";import"./SearchMd-BMO4jqwv.js";import"./AlertTriangle-DteHmOG1.js";import"./useMutation-BYl8vvsl.js";import"./Pin01-DNrhTTs3.js";import"./use-organization-settings-1mU06z41.js";import"./label-A7ibpcPd.js";import"./index-BrH9wXxf.js";import"./Save01-C9jVAZgo.js";import"./index-Dps5khDb.js";import"./ChevronDown-FdgQzkaa.js";import"./mcp-oauth-lMxJpMMH.js";import"./File06-xsY7vCFb.js";import"./Key01-CcfhRF0P.js";import"./constants-B9b2QjkO.js";import"./registry-utils--fif7P3x.js";import"./extract-connection-data-Cjm6QMzJ.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-kn39eg4d.js";import"./circle-alert-DYoRV5F7.js";import"./index-DVHOzh7f.js";import"./useQuery-CTct6gOY.js";import"./ArrowUp-xougxkbC.js";import"./Grid01-CcUd9dpu.js";import"./List-BkcTlONj.js";import"./table-DGDNn7mH.js";import"./popover-Ca9Cyzf7.js";import"./use-mcp-prompts-DMC1gnwj.js";import"./usage-B8eRkRZY.js";import"./Edit01-CUcmwNxC.js";import"./Users03-B6oew679.js";import"./XCircle-WTPrrNWD.js";import"./ArrowLeft-CMuGBwkE.js";import"./use-copy-BZqI2HfR.js";import"./use-create-virtual-mcp-DKrayFIg.js";import"./marked.esm-BaswSlok.js";import"./markdown-DTO-ngpn.js";import"./tools-list-CBpacE22.js";import"./card-BMQBEGUR.js";import"./Eye-Rq15dwoo.js";import"./Globe02-BIRPCTiD.js";import"./RefreshCw01-dI5kYugT.js";import"./Trash01-BKhksYCP.js";import"./binder-BvXUsKRF.js";import"./use-llm-CX9QGbjZ.js";import"./localstorage-keys-Cc9e53sU.js";import"./Image01-CiGMIZf1.js";import"./RefreshCcw01-BzY8N8T3.js";import"./Settings01-CRoxTuTO.js";import"./useSuspenseInfiniteQuery-DJZPFUMY.js";import"./infiniteQueryObserver-Ctmp4byY.js";const es=te("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const ts=te("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ln=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const cn=te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const dr=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const ur=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const fr=te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ns=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ss=te("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const os=te("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const mr=te("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const rs=te("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const is=te("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));ls.displayName="Box";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));cs.displayName="ClockFastForward";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));as.displayName="Code02";const Xe=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Xe.displayName="Columns01";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));ds.displayName="CornerDownRight";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));us.displayName="Database01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));fs.displayName="GitBranch01";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));ms.displayName="Repeat03";Zs({title:kt().min(1),description:kt().nullable(),body:kt()});function _t(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function pr(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function xr(t){const e=C.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(It,{control:n.control,name:"title",render:br}),o.jsx(It,{control:n.control,name:"description",render:gr})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(It,{control:n.control,name:"body",render:hr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.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]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function hr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(At,{...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 gr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...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 br(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function jr(t){const e=C.c(41),{providerId:n,promptId:s}=t,r=Wt().location.href,{org:l}=G(),c=n||null;let a;e[0]!==l.id||e[1]!==c?(a={connectionId:c,orgId:l.id},e[0]=l.id,e[1]=c,e[2]=a):a=e[2];const d=ne(a),u=Ut(n,"PROMPT",s,d),f=Bt(n,"PROMPT",d),m=f.update.isPending;let h;e[3]!==u?(h=u?{title:u.title,description:u.description??null,body:_t(u)}:void 0,e[3]=u,e[4]=h):h=e[4];let p;e[5]!==h?(p={values:h},e[5]=h,e[6]=p):p=e[6];const x=Ys(p);let g;e[7]!==x||e[8]!==u?(g=()=>{u&&x.reset({title:u.title,description:u.description??null,body:_t(u)})},e[7]=x,e[8]=u,e[9]=g):g=e[9];const b=g;let j;e[10]!==f.update||e[11]!==x||e[12]!==s?(j=x.handleSubmit(async I=>{const A=await f.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:A.title,description:A.description??null,body:_t(A)})}),e[10]=f.update,e[11]=x,e[12]=s,e[13]=j):j=e[13];const y=j;if(!u){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let S;e[15]!==u.title?(S=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[15]=u.title,e[16]=S):S=e[16];let v;e[17]!==u.description?(v=u.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[17]=u.description,e[18]=v):v=e[18];let w;e[19]!==S||e[20]!==v?(w=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[S,v]})}),e[19]=S,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==y?(N=()=>{y()},e[22]=y,e[23]=N):N=e[23];let T;e[24]!==x.formState.isDirty||e[25]!==m||e[26]!==b||e[27]!==N?(T=o.jsx(Fn,{onSave:N,onUndo:b,isDirty:x.formState.isDirty,isSaving:m}),e[24]=x.formState.isDirty,e[25]=m,e[26]=b,e[27]=N,e[28]=T):T=e[28];let E;e[29]!==u.title||e[30]!==r?(E=o.jsx(qt,{title:u.title,url:r,icon:"description"}),e[29]=u.title,e[30]=r,e[31]=E):E=e[31];let $;e[32]!==T||e[33]!==E?($=o.jsxs(Xt,{children:[T,E]}),e[32]=T,e[33]=E,e[34]=$):$=e[34];let R;e[35]!==x?(R=o.jsx("div",{className:"h-full",children:o.jsx(xr,{form:x})}),e[35]=x,e[36]=R):R=e[36];let L;return e[37]!==$||e[38]!==R||e[39]!==w?(L=o.jsxs(he,{children:[w,$,R]}),e[37]=$,e[38]=R,e[39]=w,e[40]=L):L=e[40],L}function vr(t){const e=C.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pr(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(jr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const yr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Sr(t){const e=C.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=M(yr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function wr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Nr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const Sn=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Cr(t){const e=C.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Co(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ko,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx(kr,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function kr({toolName:t,connectionId:e}){const s=Wt().location.href,{replayId:i}=to({strict:!1}),r=(()=>{if(!i)return null;const _=`replay-${i}`,O=sessionStorage.getItem(_);if(!O)return null;sessionStorage.removeItem(_);try{return JSON.parse(O)}catch{return null}})(),l=(()=>{if(!r)return null;const _={};for(const[O,P]of Object.entries(r))P!==null&&typeof P=="object"?_[O]=JSON.stringify(P,null,2):_[O]=P;return _})(),[c,a]=k.useState(l??{}),[d,u]=k.useState(r?JSON.stringify(r,null,2):"{}"),[f,m]=k.useState(null),[h,p]=k.useState(null),[x,g]=k.useState(!1),[b,j]=k.useState(null),{org:y}=G(),S=lt(e),v=ne({connectionId:e,orgId:y.id}),w=nn({client:v}),N=w.data?.tools?.find(_=>_.name===t),T=N?.inputSchema?.properties,E=T?Object.keys(T):[],$=E.length>0,R={};if($&&N?.inputSchema?.properties)for(const _ of E)R[_]=N.inputSchema.required?.includes(_)?"":void 0;const L=_=>Object.prototype.hasOwnProperty.call(c,_),I=async()=>{g(!0),p(null),m(null),j(null);const _=performance.now();try{if(!v)throw new Error("MCP client is not available");const O=$?{...R,...c}:(()=>{const H=d.trim();if(!H)return{};const J=JSON.parse(H);if(J&&typeof J=="object")return J;throw new Error("Raw JSON input must be an object.")})();$&&N?.inputSchema?.properties&&Object.entries(N.inputSchema.properties).forEach(([H,J])=>{if((J.type==="object"||J.type==="array")&&typeof O[H]=="string")try{O[H]=JSON.parse(O[H])}catch{}});const P=await v.callTool({name:t,arguments:O}),Q=P.structuredContent??P,Z=performance.now(),F=Math.round(Z-_);m(Q);const K=JSON.stringify(Q),B=new TextEncoder().encode(K).length;j({duration:`${F}ms`,bytes:`${B} bytes`,tokens:`~${Math.ceil(B/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);p(P||"Unknown error occurred");const Q=performance.now();j({duration:`${Math.round(Q-_)}ms`})}finally{g(!1)}},A=(_,O)=>{a(P=>({...P,[_]:O}))},W=()=>{m(null),p(null),j(null)},z=N?.name??Sn(t),X=o.jsx(Kn,{children:o.jsxs(Jn,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:y.slug,project:et},children:"Connections"})})}),o.jsx(st,{}),S&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:y.slug,project:et,connectionId:e},search:{tab:"tools"},children:S.title})})}),o.jsx(st,{})]}),o.jsx(Pe,{children:o.jsx(Gn,{children:z})})]})});return o.jsxs(he,{breadcrumb:X,children:[o.jsx(Xt,{children:o.jsx(qt,{title:N?.name??Sn(t),url:s,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(at,{icon:S?.icon||null,name:S?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.isLoading?o.jsx(He,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.isSuccess?"ready":w.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:N?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),N?.inputSchema?.required&&N.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:$&&N?.inputSchema?.properties?Object.entries(N.inputSchema.properties).map(([_,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,N.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(At,{className:"font-mono text-xs",value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:L(_)?String(c[_]??""):"",onValueChange:P=>A(_,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(tt,{value:"true",children:"true"}),o.jsx(tt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_}...`})]},_)):N?.inputSchema&&!$?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(At,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:_=>u(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),b&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(So,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ls,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(us,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(Y,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:I,disabled:x,children:x?o.jsxs(o.Fragment,{children:[o.jsx(He,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(tn,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(Qt,{children:o.jsxs(Zt,{children:[o.jsx(Yt,{asChild:!0,children:o.jsx(Y,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:W,disabled:!f&&!h,children:o.jsx(ct,{size:14})})}),o.jsx(en,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Sr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(yo,{className:"h-4 w-4"}),o.jsx(wr,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Nr,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(Y,{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(f,null,2)),On.success("Copied to clipboard")},children:o.jsx(No,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(wo,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function Ir(t){const e=C.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!lt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(He,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(Cr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const wn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(h=>h(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},an=(t=>t?wn(t):wn),_r=t=>t;function Mt(t,e=_r){const n=q.useSyncExternalStore(t.subscribe,q.useCallback(()=>e(t.getState()),[t,e]),q.useCallback(()=>e(t.getInitialState()),[t,e]));return q.useDebugValue(n),n}const Tr=t=>{const e=an(t),n=s=>Mt(e,s);return Object.assign(n,e),n},Er=(t=>Tr);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Pt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Pt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Pt(s)(n)}}}},$r=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const h=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>h;let p;const x=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:h)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:h))||void 0;return Pt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[w,N]=S;if(p=r.merge(N,(v=s())!=null?v:h),n(p,!0),w)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&y?.(void 0,S)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>x(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||x(),p||h},xs=$r,{useSyncExternalStoreWithSelector:Or}=no,Rr=t=>t;function Ar(t,e=Rr,n){const s=Or(t.subscribe,t.getState,t.getInitialState,e,n);return q.useDebugValue(s),s}const Nn=t=>Symbol.iterator in t,Cn=t=>"entries"in t,kn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Nn(t)&&Nn(e)?Cn(t)&&Cn(e)?kn(t,e):Mr(t,e):kn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Lr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
2
2
  ${Object.entries(l).map(([d,u])=>{const f=c.has(d)?"":"?";return`${u.description?` /** ${u.description} */
3
3
  `:""} ${d}${f}: ${n(u)};`}).join(`
4
4
  `)}
5
5
  }`}return`interface ${e} ${n(t)}`}function Tt(t,e){const n=t.trim();return e.some(i=>i.name.toLowerCase()===n.toLowerCase())?`${n}_${Math.random().toString(36).substring(2,6)}`:n}function Dr(t,e){const n=t.match(/interface\s+Input\s*\{/);if(!n||n.index===void 0)return`${e}
6
6
 
7
- ${t.trimStart()}`;const s=n.index,i=s+n[0].length-1;let r=1,l=i+1;for(;l<t.length&&r>0;)t[l]==="{"?r++:t[l]==="}"&&r--,l++;return t.slice(0,s)+e+t.slice(l)}function Et(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...so,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const hs=k.createContext(null),zr=t=>an()(xs(e=>({...t,actions:{setIsAddingStep:n=>e(s=>({...s,isAddingStep:n})),setCurrentStepTab:n=>e(s=>({...s,currentStepTab:n})),setToolAction:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.map(i=>"toolName"in i.action&&i.action.toolName===n.toolName?{...i,action:n}:i)}})),appendStep:({step:n,type:s})=>e(i=>{const r=n??Et(s,i.workflow.steps.length),l=i.workflow.steps.find(a=>a.name===r.name),c=l?`${r.name} ${parseInt(l.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:r.name;return{workflow:{...i.workflow,steps:[...i.workflow.steps,{...r,name:c}]}}}),deleteStep:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.filter(i=>i.name!==n)}})),duplicateStep:n=>e(s=>{const i=s.workflow.steps.findIndex(a=>a.name===n);if(i===-1)return s;const r=s.workflow.steps[i];if(!r)return s;const l={...r,name:Tt(r.name,s.workflow.steps)},c=[...s.workflow.steps];return c.splice(i+1,0,l),{workflow:{...s.workflow,steps:c},currentStepName:l.name}}),setCurrentStepName:n=>e(s=>({...s,currentStepName:n})),updateStep:(n,s)=>e(i=>({...i,workflow:{...i.workflow,steps:i.workflow.steps.map(r=>r.name===n?{...r,...s}:r)}})),setTrackingExecutionId:n=>e(s=>({...s,trackingExecutionId:n})),resetToOriginalWorkflow:()=>e(n=>({...n,workflow:n.originalWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(h=>h.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=Et("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Lr(a,"Input"),m=d.action,h=Dr(m.code,f);d={...d,action:{...m,code:h}}}const u=Tt(d.name,r.steps);return{...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...r,steps:[...r.steps,{...d,name:u}]},currentStepName:u}}),addToolStep:()=>e(n=>{let s=Et("tool",Number((Math.random()*1e6).toFixed(0)));const i=Tt(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setWorkflow:n=>e(s=>({...s,workflow:n})),startReplacingTool:n=>e(s=>({...s,replacingToolInfo:{toolName:n}})),cancelReplacingTool:()=>e(n=>({...n,replacingToolInfo:null})),setSelectedVirtualMcpId:n=>e(s=>({...s,selectedVirtualMcpId:n}))}}),{name:`workflow-store-${encodeURIComponent(t.workflow.id)}`,storage:ps(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Wr(t){const e=C.c(11),{children:n,initialState:s}=t,i=Gn(),{org:r}=G();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Ve(r.id),e[0]=r,e[1]=i?.[0]?.id,e[2]=l):l=e[2];const c=l;let a;e[3]!==c||e[4]!==s.currentStepTab||e[5]!==s.trackingExecutionId||e[6]!==s.workflow?(a=()=>zr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:c,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[3]=c,e[4]=s.currentStepTab,e[5]=s.trackingExecutionId,e[6]=s.workflow,e[7]=a):a=e[7];const[d]=k.useState(a);let u;return e[8]!==n||e[9]!==d?(u=o.jsx(hs.Provider,{value:d,children:n}),e[8]=n,e[9]=d,e[10]=u):u=e[10],u}function Ue(t,e){const n=k.useContext(hs);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Ar(n,t,Pr)}function De(){return Ue(Fr)}function Fr(t){return t.workflow}function ee(){return Ue(Hr)}function Hr(t){return t.actions}function gs(){const t=qe();return Ue(Vr)??t[0]?.name}function Vr(t){return t.currentStepName}function Be(){const t=C.c(5),e=gs(),n=qe();let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==e?(r=l=>l.name===e,t[3]=e,t[4]=r):r=t[4],s=n.find(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];const i=s;return i||n[0]}function qe(){return De().steps}function Lt(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!=typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Lt(t[n],e[n]))return!1;return!0}if(typeof t=="object"){const n=t,s=e,i=Object.keys(n),r=Object.keys(s);if(i.length!==r.length)return!1;for(const l of i)if(!(l in s)||!Lt(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=C.c(5),e=De();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=qs(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=Lt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function U(){return Ue(Ur)}function Ur(t){return t.trackingExecutionId}function Ke(){return Ue(Br)}function Br(t){return t.selectedVirtualMcpId}function qr(t){const e=C.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Gn()??[],{org:a}=G();let d;e[0]!==a.id?(d=Ve(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(Jr),m=Hn,h=n??u;let p;e[2]!==s?(p=N=>s(N===""?void 0:N),e[2]=s,e[3]=p):p=e[3];let x;e[4]!==i?(x=M("text-xs",i),e[4]=i,e[5]=x):x=e[5];let g;e[6]!==l?(g=o.jsx(Un,{placeholder:l}),e[6]=l,e[7]=g):g=e[7];let b;e[8]!==x||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:x,children:g}),e[8]=x,e[9]=g,e[10]=b):b=e[10];const j=Bn;let y;e[11]!==u?(y=o.jsx(tt,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=y):y=e[12];const S=f.map(Kr);let v;e[13]!==j||e[14]!==y||e[15]!==S?(v=o.jsxs(j,{children:[y,S]}),e[13]=j,e[14]=y,e[15]=S,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==h||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:h,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=h,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function Kr(t){return o.jsx(tt,{value:t.id,children:t.title},t.id)}function Jr(t){return t.id!==null&&!jo(t.id)}function ze(){const t=C.c(2),e=bo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Jo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function fe(t){const e=C.c(12),{org:n}=G(),s=ze();let i;e[0]!==s.id||e[1]!==n.id?(i={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=i):i=e[2];const r=ne(i);let l;e[3]!==t?(l={id:t},e[3]=t,e[4]=l):l=e[4];const c=!!t;let a;e[5]!==r||e[6]!==l||e[7]!==c?(a={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:l,enabled:c,select:Gr},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=sn(a),f=d?.item;let m;return e[9]!==u||e[10]!==f?(m={item:f,isLoading:u},e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Gr(t){return t.structuredContent??t}function js(t,e,n){const s=C.c(14),{org:i}=G(),r=ze();let l;s[0]!==r.id||s[1]!==i.id?(l={connectionId:r.id,orgId:i.id},s[0]=r.id,s[1]=i.id,s[2]=l):l=s[2];const c=ne(l),a=(n?.enabled??!0)&&!!t&&!!e;let d;s[3]!==t||s[4]!==e?(d={executionId:t,stepId:e},s[3]=t,s[4]=e,s[5]=d):d=s[5];let u;s[6]!==c||s[7]!==a||s[8]!==d?(u={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,select:Xr},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=sn(u),h=f?.output,p=f?.error;let x;return s[10]!==m||s[11]!==h||s[12]!==p?(x={output:h,error:p,isLoading:m},s[10]=m,s[11]=h,s[12]=p,s[13]=x):x=s[13],x}function Xr(t){return t.structuredContent??t}function Qr(){const t=C.c(19),{org:e}=G(),n=ze(),s=De();let i;t[0]!==n.id||t[1]!==e.id?(i={connectionId:n.id,orgId:e.id},t[0]=n.id,t[1]=e.id,t[2]=i):i=t[2];const r=ne(i);let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=["workflow"],t[3]=l):l=t[3];let c;t[4]!==s.id?(c={field:l,operator:"eq",value:s.id},t[4]=s.id,t[5]=c):c=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=[{field:["created_at"],direction:"desc"}],t[6]=a):a=t[6];let d;t[7]!==c?(d={where:c,orderBy:a,limit:100},t[7]=c,t[8]=d):d=t[8];const u=!!s.id;let f;t[9]!==r||t[10]!==d||t[11]!==u?(f={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolArguments:d,enabled:u,staleTime:5e3,select:Zr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:h,refetch:p}=sn(f);let x;t[13]!==m?.items?(x=m?.items??[],t[13]=m?.items,t[14]=x):x=t[14];let g;return t[15]!==h||t[16]!==p||t[17]!==x?(g={executions:x,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=x,t[18]=g):g=t[18],g}function Zr(t){return t.structuredContent??t}function vs(t){const e=[];function n(s){if(typeof s=="string"){const i=s.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(i)for(const r of i)if(r==="@input")e.push("__entire_input__");else{const l=r.replace("@input.","");e.push(l)}}else Array.isArray(s)?s.forEach(n):typeof s=="object"&&s!==null&&Object.values(s).forEach(n)}return n(t),[...new Set(e)]}function Yr(t){const e=[];for(const n of t){const s=vs(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function ei(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ti(t){const e=Yr(t);if(e.length===0)return ei(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},s=[];for(const i of e){const r=i.split(".");if(r.length===1)n[i]={type:"string",description:`Input field: ${i}`},s.push(i);else{const l=r[0];l&&!n[l]&&(n[l]={type:"object",description:`Input object: ${l}`,additionalProperties:!0},s.push(l))}}return{type:"object",properties:n,required:s,description:"Workflow execution input"}}function ni(){const t=C.c(2),e=De();let n;return t[0]!==e.steps?(n=ti(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function si(){const t=C.c(16),{org:e}=G(),{id:n}=ze(),{setTrackingExecutionId:s}=ee(),i=De(),r=Ke(),l=ni();let c;t[0]!==n||t[1]!==e.id?(c={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=c):c=t[2];const a=ne(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=on(d);let m;t[5]!==e.id||t[6]!==r||t[7]!==s||t[8]!==u||t[9]!==i?(m=async g=>{const b=g===void 0?{}:g,j=r??Ve(e.id),y=Date.now(),S=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:y,workflow_collection_id:i.id}}),w=(S.structuredContent??S)?.item?.id??void 0;return s(w),w},t[5]=e.id,t[6]=r,t[7]=s,t[8]=u,t[9]=i,t[10]=m):m=t[10];const h=m,p=l!==null;let x;return t[11]!==h||t[12]!==l||t[13]!==f||t[14]!==p?(x={handleRunWorkflow:h,isPending:f,requiresInput:p,inputSchema:l},t[11]=h,t[12]=l,t[13]=f,t[14]=p,t[15]=x):x=t[15],x}function oi(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>await l({name:"CANCEL_EXECUTION",arguments:{executionId:f}}),t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleCancelWorkflow:d,isCancelling:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ri(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ii(){const t=C.c(3),e=U(),{item:n}=fe(e);let s;return t[0]!==n||t[1]!==e?(s=e&&n?(()=>{const r={};return n?.input&&(r.input=n.input),r})():void 0,t[0]=n,t[1]=e,t[2]=s):s=t[2],s}function li(t,e,n,s){if(!e)return[...t].sort(s);const i=n(e);return[...t].sort((r,l)=>{const c=n(r),a=n(l);return c===i?-1:a===i?1:s?s(r,l):0})}const dn=Er()(xs(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),ys=k.createContext([]);function Ss(){return k.useContext(ys)}function ci({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Fo;return{editor:t,char:s,pluginKey:i,command:({editor:r,range:l,props:c})=>{var a,d,u;const f=r.view.state.selection.$to.nodeAfter;(a=f?.text)!=null&&a.startsWith(" ")&&(l.to+=1),r.chain().focus().insertContentAt(l,[{type:n,attrs:{...c,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(d=r.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:r,range:l})=>{const c=r.doc.resolve(l.from),a=r.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(a)},...e}}function ws(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>ci({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function In(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var ai=Lo.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,s;return`${(n=e?.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var s,i;return["span",Ge(this.HTMLAttributes,t.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=In(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ge({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Wo({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(t);for(;s!==null;){const[,i,r,l]=s,c=r??l;e[i==="char"?"mentionSuggestionChar":i]=c,s=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:In(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:s}=e,{empty:i,anchor:r}=s;if(!i)return!1;let l=new zo,c=0;return e.doc.nodesBetween(r-1,r,(a,d)=>{if(a.type.name===this.name)return n=!0,l=a,c=d,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,c,c+l.nodeSize),n})}},addProseMirrorPlugins(){return ws(this).map(Do)}}),di=ai,$t,ft="HoverCard",[Ns]=Pn(ft,[An]),mt=An(),[ui,pt]=Ns(ft),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=mt(e),d=k.useRef(0),u=k.useRef(0),f=k.useRef(!1),m=k.useRef(!1),[h,p]=Ht({prop:s,defaultProp:i??!1,onChange:r,caller:ft}),x=k.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),g=k.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=k.useCallback(()=>p(!1),[p]);return k.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(ui,{scope:e,open:h,onOpenChange:p,onOpen:x,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=ft;var ks="HoverCardTrigger",Is=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=pt(ks,n),r=mt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Ft.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:de(t.onPointerEnter,rt(i.onOpen)),onPointerLeave:de(t.onPointerLeave,rt(i.onClose)),onFocus:de(t.onFocus,i.onOpen),onBlur:de(t.onBlur,i.onClose),onTouchStart:de(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var un="HoverCardPortal",[fi,mi]=Ns(un,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=pt(un,e);return o.jsx(fi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=un;var ot="HoverCardContent",Ts=k.forwardRef((t,e)=>{const n=mi(ot,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=pt(ot,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(pi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:de(t.onPointerEnter,rt(r.onOpen)),onPointerLeave:de(t.onPointerLeave,rt(r.onClose)),ref:e})})});Ts.displayName=ot;var pi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=pt(ot,n),d=mt(n),u=k.useRef(null),f=Mn(e,u),[m,h]=k.useState(!1);return k.useEffect(()=>{if(m){const p=document.body;return $t=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=$t,p.style.webkitUserSelect=$t}}},[m]),k.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),k.useEffect(()=>{u.current&&gi(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:de(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:de(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),xi="HoverCardArrow",hi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=mt(n);return o.jsx(ao,{...i,...s,ref:e})});hi.displayName=xi;function rt(t){return e=>e.pointerType==="touch"?void 0:t()}function gi(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var bi=Cs,ji=Is,vi=_s,yi=Ts;function Si(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(bi,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function wi(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(ji,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ni(t){const e=C.c(12);let n,s,i,r;e[0]!==t?({className:n,align:i,sideOffset:r,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i,e[4]=r):(n=e[1],s=e[2],i=e[3],r=e[4]);const l=i===void 0?"center":i,c=r===void 0?4:r;let a;e[5]!==n?(a=M("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 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==s||e[9]!==c||e[10]!==a?(d=o.jsx(vi,{"data-slot":"hover-card-portal",children:o.jsx(yi,{"data-slot":"hover-card-content",align:l,sideOffset:c,className:a,...s})}),e[7]=l,e[8]=s,e[9]=c,e[10]=a,e[11]=d):d=e[11],d}const Es=k.createContext(void 0);function Ci(t,e){const n=e.split("."),s=n[0];if(!s)return;let i=t[s];for(let r=1;r<n.length&&i!==void 0;r++){const l=n[r];if(l)if(typeof i=="object"&&i!==null)i=i[l];else return}return i}function ki(t){const e=C.c(20),{node:n}=t,s=k.useContext(Es),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const x=r?Ci(s,i):void 0;l=x!==void 0?typeof x=="object"?JSON.stringify(x,null,2):String(x):void 0,e[0]=r,e[1]=i,e[2]=s,e[3]=l}else l=e[3];const c=l;let a;e[4]!==i?(a=o.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",i]}),e[4]=i,e[5]=a):a=e[5];const d=a;if(!r||c===void 0){let x;return e[6]!==d?(x=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=x):x=e[7],x}let u;e[8]!==d?(u=o.jsx(wi,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let h;e[14]!==f||e[15]!==m?(h=o.jsx(Ni,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=o.jsx(vn,{as:"span",children:o.jsxs(Si,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function $s(t){const e=[];function n(s){for(const i of s)i.children?.length||e.push(i),i.children&&n(i.children)}return n(t),e}let ue=Os();function Os(){return an(()=>({items:[],selectedIndex:0,command:null}))}function _n(t,e){ue.setState({items:t,command:e,selectedIndex:0})}function Ii(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e-1+t.length)%t.length})}function _i(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=ue.getState(),s=t[e];return s?(n?.(s),!0):!1}function Tn(){ue=Os()}function Ti(){const t=C.c(7),e=Mt(ue,$i),n=Mt(ue,Ei);if(!e.length)return null;let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==n?(r=(l,c)=>o.jsx("button",{type:"button",onClick:()=>{ue.setState({selectedIndex:c}),Rs()},className:M("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",c===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:l.label},l.id),t[3]=n,t[4]=r):r=t[4],s=e.map(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];let i;return t[5]!==s?(i=o.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:o.jsx("div",{className:"p-1",children:s})}),t[5]=s,t[6]=i):i=t[6],i}function Ei(t){return t.selectedIndex}function $i(t){return t.items}function Oi(){let t=null,e=null;return{onStart:n=>{_n(n.items,n.command),t=new Bo(Ti,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const s=n.clientRect?.();s&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{_n(n.items,n.command);const s=n.clientRect?.();s&&e&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),Tn(),!0):n.key==="ArrowUp"?(Ii(),!0):n.key==="ArrowDown"?(_i(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),Tn()}}}const Ot=/@([\w.]+)/g;function Ri(t,e){if(!t)return null;const n=$s(e),s=new Map(n.map(a=>[a.id,a]));if(!Ot.test(t))return t;Ot.lastIndex=0;const r=[];let l=0,c;for(;(c=Ot.exec(t))!==null;){const a=c[1]??"",d=c.index;d>l&&r.push({type:"text",text:t.slice(l,d)});const u=s.get(a);u?r.push({type:"mention",attrs:{id:u.id,label:u.label}}):r.push({type:"text",text:c[0]}),l=d+c[0].length}return l<t.length&&r.push({type:"text",text:t.slice(l)}),{type:"doc",content:[{type:"paragraph",content:r.length>0?r:void 0}]}}function fn(t){const e=C.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=ii();let d;e[0]!==n||e[1]!==s?(d=Ri(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=Ho.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==f){let E;e[7]!==n?(E=$=>{const{query:R}=$;return $s(n).filter(I=>I.label.toLowerCase().includes(R.toLowerCase())||I.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=E):E=e[8],p=di.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Li,renderHTML:Pi,suggestion:{items:E,render:Oi,command:Mi}}).extend(f?{addNodeView(){return Vo(ki)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let x;e[9]!==p?(x=[h,p],e[9]=p,e[10]=x):x=e[10];const g=r??"";let b;e[11]!==g?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":g},handleKeyDown:Ai},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=E=>{const{editor:$}=E;return i?.($.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==m||e[17]!==x||e[18]!==b||e[19]!==j?(y={content:u,editable:m,extensions:x,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=x,e[18]=b,e[19]=j,e[20]=y):y=e[20];const S=Uo(y);let v;e[21]!==l?(v=M("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",l),e[21]=l,e[22]=v):v=e[22];let w;e[23]!==S?(w=o.jsx(qo,{editor:S}),e[23]=S,e[24]=w):w=e[24];let N;e[25]!==v||e[26]!==w?(N=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=N):N=e[27];const T=N;if(a!==void 0){let E;return e[28]!==T||e[29]!==a?(E=o.jsx(Es.Provider,{value:a,children:T}),e[28]=T,e[29]=a,e[30]=E):E=e[30],E}return T}function Ai(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Mi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Pi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Li(t){const{node:e}=t;return`@${e.attrs.id}`}function Di(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function zi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r,className:"min-h-[80px]"}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Wi(t){const e=C.c(8),{value:n,onChange:s,readonly:i,id:r}=t,l=n??"";let c;e[0]!==s?(c=u=>s(u.target.value===""?void 0:Number(u.target.value)),e[0]=s,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let d;return e[3]!==r||e[4]!==i||e[5]!==l||e[6]!==c?(d=o.jsx("input",{id:r,type:"number",value:l,onChange:c,disabled:i,className:a}),e[3]=r,e[4]=i,e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Fi(t){const e=C.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Hi(t){const e=C.c(14),{value:n,onChange:s,readonly:i,id:r,options:l}=t;let c;e[0]!==l.enumOptions?(c=l.enumOptions??[],e[0]=l.enumOptions,e[1]=c):c=e[1];const a=c,d=n??"";let u;e[2]!==s?(u=x=>s(x.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let h;e[6]!==a?(h=a.map(Vi),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==h?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,h]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function Vi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Ui={TextWidget:Di,TextareaWidget:zi,NumberWidget:Wi,CheckboxWidget:Fi,SelectWidget:Hi};function Bi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function qi(t){const e=C.c(36),{id:n,label:s,required:i,description:r,children:l,schema:c,hidden:a}=t;if(a){let v;return e[0]!==l?(v=o.jsx("div",{className:"hidden",children:l}),e[0]=l,e[1]=v):v=e[1],v}if(n==="root"){let v;return e[2]!==l?(v=o.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=v):v=e[3],v}const d=Array.isArray(c.type)?c.type[0]:c.type??"string";let u,f,m,h,p,x,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=Bi(d);g="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(x=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=x):x=e[19],u=v,f=14,m=M(w,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=h,e[12]=p,e[13]=x,e[14]=g}else u=e[8],f=e[9],m=e[10],h=e[11],p=e[12],x=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==h||e[25]!==p||e[26]!==x||e[27]!==b?(j=o.jsxs("div",{className:h,children:[p,x,b]}),e[24]=h,e[25]=p,e[26]=x,e[27]=b,e[28]=j):j=e[28];let y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let S;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(S=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=S):S=e[35],S}function Ki(t){const e=C.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Gi),e[0]=n,e[1]=c):c=e[1];let a;return e[2]!==c?(a=o.jsx("div",{className:"space-y-4",children:c}),e[2]=c,e[3]=a):a=e[3],a}let r;e[4]!==n?(r=n.map(Ji),e[4]=n,e[5]=r):r=e[5];let l;return e[6]!==r?(l=o.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:r}),e[6]=r,e[7]=l):l=e[7],l}function Ji(t){return o.jsx("div",{children:t.content},t.name)}function Gi(t){return o.jsx("div",{children:t.content},t.name)}function Xi(t){const e=C.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Qi),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"space-y-2",children:l}),e[2]=l,e[3]=c):c=e[3];let a;e[4]!==s||e[5]!==i||e[6]!==r?(a=s&&o.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:i,children:["+ Add ",r||"item"]}),e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==c||e[9]!==a?(d=o.jsxs("div",{className:"space-y-2",children:[c,a]}),e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Qi(t){return o.jsx("div",{className:"flex gap-2 items-start",children:o.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function Zi(){return null}function Yi(){return null}const el={FieldTemplate:qi,ObjectFieldTemplate:Ki,ArrayFieldTemplate:Xi,UnsupportedFieldTemplate:Zi,ErrorListTemplate:Yi};function tl(t){const e=C.c(6),{inputSchema:n,inputParams:s,mentions:i}=t;if(!n?.properties||!s)return null;let r;e[0]!==i?(r=(a,d,u)=>{const f=typeof d=="object"&&d!==null?JSON.stringify(d,null,2):String(d??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(fn,{mentions:i,value:f,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=i,e[1]=r):r=e[1];const l=r;let c;return e[2]!==s||e[3]!==n.properties||e[4]!==l?(c=o.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[d,u]=a,f=s[d];return l(d,f,u)})}),e[2]=s,e[3]=n.properties,e[4]=l,e[5]=c):c=e[5],c}function As({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:s,mentions:i,readOnly:r}){const l=i??[];if(!t)return o.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(r)return o.jsx(tl,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=k.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[h,p]of Object.entries(f))m[h]!==p&&s(h,p);for(const h of Object.keys(m))h in f||s(h,void 0)}a.current=f};return o.jsx(ys.Provider,{value:l,children:o.jsx(_o,{schema:c,formData:e,onChange:d,validator:To,widgets:Ui,templates:el,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function nl(t){const e=C.c(33),{open:n,onOpenChange:s,inputSchema:i,onSubmit:r,isPending:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];const[a,d]=k.useState(c);let u;e[1]!==a||e[2]!==s||e[3]!==r?(u=async()=>{await r(a),s(!1),d({})},e[1]=a,e[2]=s,e[3]=r,e[4]=u):u=e[4];const f=u;let m;e[5]!==s?(m=T=>{T||d({}),s(T)},e[5]=s,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(Go,{children:[o.jsx(Xo,{children:"Workflow Input"}),o.jsx(Qo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[8]=x):x=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(As,{inputSchema:i,inputParams:a,setInputParams:d,mentions:x})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==h?(b=()=>h(!1),e[12]=h,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(Y,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(dt,{size:"xs"}):o.jsx(tn,{size:14}),e[17]=l,e[18]=y):y=e[18];let S;e[19]!==f||e[20]!==l||e[21]!==y?(S=o.jsxs(Y,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=S):S=e[22];let v;e[23]!==S||e[24]!==j?(v=o.jsxs(Zo,{children:[j,S]}),e[23]=S,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(Yo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,g,v]}),e[26]=v,e[27]=g,e[28]=w):w=e[28];let N;return e[29]!==h||e[30]!==n||e[31]!==w?(N=o.jsx(er,{open:n,onOpenChange:h,children:w}),e[29]=h,e[30]=n,e[31]=w,e[32]=N):N=e[32],N}function sl(t){const e=C.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=Wt().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=dn(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:h}=ee(),p=bs(),x=Ke(),g=U();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let y;e[4]!==b||e[5]!==j?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let S;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==x||e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(S=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:m,isDirty:p,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(k.Suspense,{fallback:o.jsx(dt,{size:"xs"}),children:o.jsx(qr,{selectedVirtualMcpId:x,onVirtualMcpChange:h,placeholder:"Select Agent"})}),o.jsx(Po,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(fs,{})},{value:"code",icon:o.jsx(as,{})}]}),o.jsx(qt,{title:n,url:c,icon:"workflow"}),o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(Y,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(cs,{size:14})})})}),o.jsx(en,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=x,e[12]=h,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=S):S=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(il,{}),e[21]=v):v=e[21];let w;e[22]!==S?(w=o.jsxs(Xt,{children:[S,v]}),e[22]=S,e[23]=w):w=e[23];let N;return e[24]!==y||e[25]!==w?(N=o.jsxs(o.Fragment,{children:[y,w]}),e[24]=y,e[25]=w,e[26]=N):N=e[26],N}function ol(){const t=U(),{item:e}=fe(t);return e?.completed_at_epoch_ms!=null}function rl(){const t=U(),{item:e}=fe(t);return e?.status==="cancelled"}function il(){const t=C.c(58),e=bs(),n=ol(),s=rl(),i=U(),r=Ke(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=si(),u=qe(),[f,m]=k.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=oi(),{handleResumeWorkflow:x,isResuming:g}=ri(),b=i&&!n;let j;t[0]!==u?(j=u.some(ll),t[0]=u,t[1]=j):j=t[1];const y=j,S=!r,v=u.length===0,w=e||v||y||S||c||p,N=b||c;let T;t[2]!==y||t[3]!==S||t[4]!==e||t[5]!==s||t[6]!==N||t[7]!==v?(T=()=>s?"Workflow is currently cancelled":N?"Workflow is currently running":e?"Save your changes before running":S?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=S,t[4]=e,t[5]=s,t[6]=N,t[7]=v,t[8]=T):T=t[8];const $=T();let R;t[9]!==h||t[10]!==x||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==N||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){m(!0);return}if(s&&i){await x(i);return}if(N&&i){await h(i);return}await l({})},t[9]=h,t[10]=x,t[11]=l,t[12]=d,t[13]=s,t[14]=N,t[15]=a,t[16]=i,t[17]=R):R=t[17];const L=R;let I;t[18]!==l?(I=async J=>{await l(J)},t[18]=l,t[19]=I):I=t[19];const A=I,W=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",z=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let X;t[20]!==z?(X=M("gap-2 h-7 px-3",z),t[20]=z,t[21]=X):X=t[21];let _;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(_=(!b&&!c&&!p&&!g||s)&&o.jsx(tn,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=_):_=t[27];let O;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(O=b&&!c&&!p&&!g&&!s&&o.jsx(Ko,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=O):O=t[33];let P;t[34]!==p||t[35]!==c||t[36]!==g?(P=(c||p||g)&&o.jsx(dt,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=P):P=t[37];let Q;t[38]!==W||t[39]!==L||t[40]!==w||t[41]!==X||t[42]!==_||t[43]!==O||t[44]!==P?(Q=o.jsxs(Y,{variant:"default",size:"sm",className:X,disabled:w,onClick:L,children:[_,O,P,W]}),t[38]=W,t[39]=L,t[40]=w,t[41]=X,t[42]=_,t[43]=O,t[44]=P,t[45]=Q):Q=t[45];const Z=Q;let F;t[46]!==Z||t[47]!==$?(F=$?o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Z})}),o.jsx(en,{side:"bottom",children:$})]})}):Z,t[46]=Z,t[47]=$,t[48]=F):F=t[48];const K=F;let B;t[49]!==A||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(nl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:A,isPending:c}),t[49]=A,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let H;return t[55]!==K||t[56]!==B?(H=o.jsxs(o.Fragment,{children:[K,B]}),t[55]=K,t[56]=B,t[57]=H):H=t[57],H}function ll(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function En(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function cl(){const t=C.c(13),e=U(),n=qe(),{item:s}=fe(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.error||t[3]!==s.running_steps||t[4]!==s.status||t[5]!==n){i={};let r;t[7]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(al)??[]),t[7]=s.completed_steps?.success,t[8]=r):r=t[8];const l=r,c=s.completed_steps?.error??[];let a;t[9]!==s.running_steps?(a=s.running_steps??[],t[9]=s.running_steps,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d,f=s.status,m=s.error!=null?typeof s.error=="string"?s.error:JSON.stringify(s.error):void 0;let h=-1;n.forEach((p,x)=>{(l.has(p.name)||En(p.name,c))&&(h=x)}),n.forEach((p,x)=>{let g="pending",b;En(p.name,c)?(g="error",b=m):l.has(p.name)?g="success":(f==="error"||f==="failed")&&u.has(p.name)?(g="error",b=m):f==="running"&&x===h+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:x}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.error,t[3]=s.running_steps,t[4]=s.status,t[5]=n,t[6]=i}else i=t[6];return i}function al(t){return t.name}function dl(t){const e=C.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=U(),{item:m}=fe(f),h=m?.completed_steps,p=h?.success,x=h?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(D=>D.name===n.name),e[0]=n.name,e[1]=p,e[2]=g):g=e[2];const b=g,j=b?.completed_at_epoch_ms,y=b!=null;let S;e[3]!==n.name?(S=D=>D===n.name||D.startsWith(`${n.name}[`),e[3]=n.name,e[4]=S):S=e[4];const v=x.some(S),w="toolName"in n.action,N=w&&"connectionId"in n.action?n.action.connectionId:null,E=!!(w&&"toolName"in n.action?n.action.toolName:null),$=yl(n),L=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=y?"success":v||L?"error":r?.status,A=r!==void 0,W=I==="success"||I==="error";let z=$.length>0?60:12;(I==="success"||I==="error")&&(z=z+32);const X=ml(I);let _;e[5]!==I?(_=pl(I),e[5]=I,e[6]=_):_=e[6];const O=_;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=function(Ct,Xs){const bn=Xs.split(".").slice(1);if(bn.length===0)return Array.isArray(Ct)?Ct:void 0;let xe=Ct;for(const Qs of bn){if(xe==null)return;if(typeof xe=="object")xe=xe[Qs];else return}return Array.isArray(xe)?xe:void 0},e[7]=P):P=e[7];const Q=P,Z=n.forEach!==void 0,F=n.forEach?.ref;let K;e[8]!==F?(K=F?.replace("@","").split(".")[0],e[8]=F,e[9]=K):K=e[9];const B=K,H=m?.status==="running"||m?.status==="enqueued";let J;e[10]!==p||e[11]!==B?(J=p?.some(D=>D.name===B),e[10]=p,e[11]=B,e[12]=J):J=e[12];const ie=J,le=H?500:!1;let se;e[13]!==ie||e[14]!==le?(se={refetchInterval:le,enabled:ie},e[13]=ie,e[14]=le,e[15]=se):se=e[15];const{output:ce}=js(f,B,se);let oe;if(e[16]!==ce||e[17]!==F){const D=F?.replace("@","");oe=D?Q(ce,D):void 0,e[16]=ce,e[17]=F,e[18]=oe}else oe=e[18];const ae=oe;let V;if(e[19]!==n.name){let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=/[.*+?^${}()|[\]\\]/g,e[21]=D):D=e[21],V=n.name.replace(D,"\\$&"),e[19]=n.name,e[20]=V}else V=e[20];const We=V,gn=new RegExp(`^${We}\\[\\d+\\]$`),gt=m?.completed_steps?.success?.filter(D=>gn.test(D.name)),Fe=x.filter(D=>gn.test(D)),bt=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",jt=I==="running"&&"bg-accent/50",vt=l&&"opacity-50";let ge;e[22]!==bt||e[23]!==jt||e[24]!==vt?(ge=M("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",bt,jt,vt),e[22]=bt,e[23]=jt,e[24]=vt,e[25]=ge):ge=e[25];const Ks="button",Js=0;let be;e[26]!==a?(be=D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),a())},e[26]=a,e[27]=be):be=e[27];const yt=M("text-xs font-mono opacity-75 h-8 flex items-center",X),St=s+1;let je;e[28]!==yt||e[29]!==St?(je=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:yt,children:[St,"."]})}),e[28]=yt,e[29]=St,e[30]=je):je=e[30];let ve;e[31]!==O||e[32]!==s?(ve=s>0?o.jsx(Rt,{height:12,color:O}):o.jsx("div",{className:"h-3"}),e[31]=O,e[32]=s,e[33]=ve):ve=e[33];let ye;e[34]!==N||e[35]!==E||e[36]!==w||e[37]!==n.name?(ye=o.jsx(jl,{connectionId:N,isToolStep:w,hasToolSelected:E,stepName:n.name}),e[34]=N,e[35]=E,e[36]=w,e[37]=n.name,e[38]=ye):ye=e[38];let Se;e[39]!==O||e[40]!==W||e[41]!==I?(Se=W&&o.jsxs(o.Fragment,{children:[o.jsx(Rt,{height:8,color:O}),o.jsx(xl,{status:I})]}),e[39]=O,e[40]=W,e[41]=I,e[42]=Se):Se=e[42];let we;e[43]!==O||e[44]!==z||e[45]!==c||e[46]!==f?(we=c&&f?null:o.jsx(Rt,{height:z,color:O}),e[43]=O,e[44]=z,e[45]=c,e[46]=f,e[47]=we):we=e[47];let Ne;e[48]!==ve||e[49]!==ye||e[50]!==Se||e[51]!==we?(Ne=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[ve,ye,Se,we]}),e[48]=ve,e[49]=ye,e[50]=Se,e[51]=we,e[52]=Ne):Ne=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",wt=E?"font-medium text-foreground":"text-foreground";let Ce;e[53]!==wt?(Ce=M("text-sm truncate flex-1",wt),e[53]=wt,e[54]=Ce):Ce=e[54];let ke;e[55]!==n?(ke=vl(n),e[55]=n,e[56]=ke):ke=e[56];let Ie;e[57]!==Ce||e[58]!==ke?(Ie=o.jsx("span",{className:Ce,children:ke}),e[57]=Ce,e[58]=ke,e[59]=Ie):Ie=e[59];let _e;e[60]!==gt?.length||e[61]!==Fe||e[62]!==Z||e[63]!==ae?(_e=Z&&ae&&ae.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(gt?.length??0)+Fe.length} / ${ae.length}`,Fe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",Fe.length," failed)"]})]}),e[60]=gt?.length,e[61]=Fe,e[62]=Z,e[63]=ae,e[64]=_e):_e=e[64];let Te;e[65]!==A||e[66]!==I?(Te=A&&o.jsx(hl,{status:I}),e[65]=A,e[66]=I,e[67]=Te):Te=e[67];let Ee;e[68]!==_e||e[69]!==Te?(Ee=o.jsxs("div",{className:"flex items-center gap-2",children:[_e,Te]}),e[68]=_e,e[69]=Te,e[70]=Ee):Ee=e[70];let $e;e[71]!==A||e[72]!==d||e[73]!==u?($e=!A&&o.jsxs(sr,{children:[o.jsx(or,{asChild:!0,children:o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:fl,children:o.jsx(tr,{size:14})})}),o.jsxs(rr,{align:"end",children:[o.jsxs(yn,{onClick:D=>{D.stopPropagation(),u()},children:[o.jsx(fr,{size:14}),"Duplicate"]}),o.jsxs(yn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:D=>{D.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=A,e[72]=d,e[73]=u,e[74]=$e):$e=e[74];let Oe;e[75]!==Ie||e[76]!==Ee||e[77]!==$e?(Oe=o.jsxs("div",{className:"flex items-center h-8",children:[Ie,Ee,$e]}),e[75]=Ie,e[76]=Ee,e[77]=$e,e[78]=Oe):Oe=e[78];const Nt=$.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:$.map(ul)});let Re;e[79]!==I||e[80]!==j?(Re=I==="success"&&o.jsx(gl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Re):Re=e[81];let Ae;e[82]!==r?.error||e[83]!==I?(Ae=I==="error"&&o.jsx(bl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=Ae):Ae=e[84];let Me;e[85]!==Oe||e[86]!==Nt||e[87]!==Re||e[88]!==Ae?(Me=o.jsxs("div",{className:Gs,children:[Oe,Nt,Re,Ae]}),e[85]=Oe,e[86]=Nt,e[87]=Re,e[88]=Ae,e[89]=Me):Me=e[89];let Je;return e[90]!==a||e[91]!==ge||e[92]!==be||e[93]!==je||e[94]!==Ne||e[95]!==Me?(Je=o.jsxs("div",{className:ge,onClick:a,role:Ks,tabIndex:Js,onKeyDown:be,children:[je,Ne,Me]}),e[90]=a,e[91]=ge,e[92]=be,e[93]=je,e[94]=Ne,e[95]=Me,e[96]=Je):Je=e[96],Je}function ul(t){return o.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function fl(t){return t.stopPropagation()}function ml(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function pl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function xl(t){const e=C.c(2),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:o.jsx(ut,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(ct,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function hl(t){const e=C.c(3),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ut,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ct,{size:11,className:"text-destructive"})}),e[1]=s):s=e[1],s}if(n==="running"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(He,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function gl(t){const e=C.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null&&n>0?new Date(n):null,d=a&&!Number.isNaN(a.getTime());s=d?a.toISOString().split("T")[0]:null,i=d?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];const r=i;let l;e[3]!==s||e[4]!==r?(l=s&&r&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Eo,{size:16,className:"text-success"}),o.jsx("span",{className:"text-xs text-success",children:s}),o.jsx("span",{className:"text-xs text-success",children:r})]}),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==l?(c=o.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:l}),e[6]=l,e[7]=c):c=e[7],c}function bl(t){const e=C.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Qn,{size:16,className:"text-destructive"}),e[0]=s):s=e[0];const i=n||"Execution failed";let r;return e[1]!==i?(r=o.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[s,o.jsx("span",{className:"text-xs text-destructive",children:i})]}),e[1]=i,e[2]=r):r=e[2],r}function jl(t){const e=C.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=lt(n??"");if(s&&i&&l?.icon){let a;return e[0]!==l.icon||e[1]!==r?(a=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:o.jsx(at,{icon:l.icon,name:r,size:"xs",className:"border-0 rounded-none"})}),e[0]=l.icon,e[1]=r,e[2]=a):a=e[2],a}let c;return e[3]!==s?(c=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:s?o.jsx(nr,{size:16,className:"text-muted-foreground"}):o.jsx(ur,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function Rt(t){const e=C.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=M("w-px",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l={height:n},e[2]=n,e[3]=l):l=e[3];let c;return e[4]!==r||e[5]!==l?(c=o.jsx("div",{className:r,style:l}),e[4]=r,e[5]=l,e[6]=c):c=e[6],c}function vl(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function yl(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties??e.items?.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function Sl(t){const e=C.c(32),{className:n}=t,s=qe(),i=gs(),r=cl(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ee(),d=U();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let h;e[4]!==n?(h=M("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(S,v)=>{const w=r?.[S.name],N=f!==-1&&v>f&&w?.status==="pending",T=v===s.length-1;return o.jsx(dl,{step:S,index:v,isSelected:S.name===i,executionStatus:w,isSkipped:N,isLastStep:T,onSelect:()=>l(S.name),onDelete:()=>c(S.name),onDuplicate:()=>a(S.name)},S.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=y):y=e[21],p=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let x;e[22]!==p?(x=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=x):x=e[23];let g;e[24]!==d?(g=d?null:o.jsx(wl,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==x||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[x,g]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==h||e[30]!==b?(j=o.jsx(k.Suspense,{fallback:m,children:o.jsx("div",{className:h,children:b})}),e[29]=h,e[30]=b,e[31]=j):j=e[31],j}function wl(){const t=C.c(8),{addToolStep:e}=ee();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Xn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(Y,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function Nl(){const t=C.c(14),{org:e}=G(),n=Ke();let s;t[0]!==e.id||t[1]!==n?(s=n??Ve(e.id),t[0]=e.id,t[1]=n,t[2]=s):s=t[2];const i=s;let r;t[3]!==e.id||t[4]!==i?(r={connectionId:i,orgId:e.id},t[3]=e.id,t[4]=i,t[5]=r):r=t[5];const l=ne(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=nn(c);let d;t[8]!==a.data?.tools?(d=a.data?.tools??[],t[8]=a.data?.tools,t[9]=d):d=t[9];let u;return t[10]!==d||t[11]!==a.error||t[12]!==a.isLoading?(u={tools:d,isLoading:a.isLoading,error:a.error},t[10]=d,t[11]=a.error,t[12]=a.isLoading,t[13]=u):u=t[13],u}function Cl(t){const e=C.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(kl,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function kl(t){const e=C.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Nl(),l=Be(),{updateStep:c}=ee(),d=l&&"toolName"in l.action&&"toolName"in l.action?l.action.toolName:null;let u;if(e[0]!==d||e[1]!==s){let v;e[3]!==d?(v=w=>w.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=li(s,u??null,_l,Il);let h;e[5]!==l||e[6]!==c?(h=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=h):h=e[7];const p=h;if(i){let v;e[8]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(dt,{size:"sm"})}),e[10]=w):w=e[10];let N;return e[11]!==v?(N=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=N):N=e[12],N}if(r){let v;e[13]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let w;e[15]!==r.message?(w=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",r.message]}),e[15]=r.message,e[16]=w):w=e[16];let N;return e[17]!==v||e[18]!==w?(N=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=N):N=e[19],N}let x;e[20]!==n?(x=M("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=x):x=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=g):g=e[22];let b;e[23]!==s.length?(b=o.jsx("div",{className:"flex items-start border-b border-border",children:o.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[g,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=w=>o.jsx(Tl,{icon:null,title:w.name,description:w.description,isSelected:w.name===d,onClick:()=>p(w)},w.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let S;return e[34]!==x||e[35]!==b||e[36]!==y?(S=o.jsxs("div",{className:x,children:[b,y]}),e[34]=x,e[35]=b,e[36]=y,e[37]=S):S=e[37],S}function Il(t,e){return t.name.localeCompare(e.name)}function _l(t){return t.name}function Tl(t){const e=C.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=M("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",c),e[0]=c,e[1]=a):a=e[1];let d;e[2]!==l?(d=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(at,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let h;e[11]!==f||e[12]!==m?(h=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,h]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var re="Accordion",El=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[mn,$l,Ol]=mo(re),[xt]=Pn(re,[Ol,Zn]),pn=Zn(),Ms=q.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(mn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Pl,{...r,ref:e}):o.jsx(Ml,{...i,ref:e})})});Ms.displayName=re;var[Ps,Rl]=xt(re),[Ls,Al]=xt(re,{collapsible:!1}),Ml=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ht({prop:n,defaultProp:s??"",onChange:i,caller:re});return o.jsx(Ps,{scope:t.__scopeAccordion,value:q.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:q.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Pl=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ht({prop:n,defaultProp:s??[],onChange:i,caller:re}),a=q.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=q.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Ps,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(Ds,{...r,ref:e})})})}),[Ll,ht]=xt(re),Ds=q.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=q.useRef(null),a=Mn(c,e),d=$l(n),f=po(i)==="ltr",m=de(t.onKeyDown,h=>{if(!El.includes(h.key))return;const p=h.target,x=d().filter(T=>!T.ref.current?.disabled),g=x.findIndex(T=>T.ref.current===p),b=x.length;if(g===-1)return;h.preventDefault();let j=g;const y=0,S=b-1,v=()=>{j=g+1,j>S&&(j=y)},w=()=>{j=g-1,j<y&&(j=S)};switch(h.key){case"Home":j=y;break;case"End":j=S;break;case"ArrowRight":r==="horizontal"&&(f?v():w());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?w():v());break;case"ArrowUp":r==="vertical"&&w();break}const N=j%b;x[N].ref.current?.focus()});return o.jsx(Ll,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(mn.Slot,{scope:n,children:o.jsx(Ft.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),it="AccordionItem",[Dl,xn]=xt(it),zs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ht(it,n),l=Rl(it,n),c=pn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(Dl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(lr,{"data-orientation":r.orientation,"data-state":Bs(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});zs.displayName=it;var Ws="AccordionHeader",Fs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Ws,n);return o.jsx(Ft.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var Dt="AccordionTrigger",Hs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Dt,n),l=Al(Dt,n),c=pn(n);return o.jsx(mn.ItemSlot,{scope:n,children:o.jsx(ir,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=Dt;var Vs="AccordionContent",Us=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Vs,n),l=pn(n);return o.jsx(cr,{role:"region","aria-labelledby":r.triggerId,"data-orientation":i.orientation,...l,...s,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Us.displayName=Vs;function Bs(t){return t?"open":"closed"}var zl=Ms,Wl=zs,Fl=Fs,Hl=Hs,Vl=Us;function Ul(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(zl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Bl(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("border-b last:border-b-0",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx(Wl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function ql(t){const e=C.c(11);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ar,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=l):l=e[6];let c;return e[7]!==n||e[8]!==i||e[9]!==r?(c=o.jsx(Fl,{className:"flex",children:o.jsxs(Hl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function Kl(t){const e=C.c(12);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("pt-0 pb-4",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==n||e[7]!==r?(l=o.jsx("div",{className:r,children:n}),e[6]=n,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==l?(c=o.jsx(Vl,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function Jl(t){const{updateStep:e}=ee(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=hn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Gl(t){const e=C.c(48),{className:n}=t,s=Be(),{appendStep:i}=ee();Jl(s);const r=U(),{item:l}=fe(r);if(!s){let $;e[0]!==n?($=M("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=$):$=e[1];let R;e[2]!==i?(R=()=>{i({type:"tool"})},e[2]=i,e[3]=R):R=e[3];let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Xn,{size:14}),e[4]=L):L=e[4];let I;e[5]!==R?(I=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:R,children:L})]}),e[5]=R,e[6]=I):I=e[6];let A;return e[7]!==$||e[8]!==I?(A=o.jsx("div",{className:$,children:I}),e[7]=$,e[8]=I,e[9]=A):A=e[9],A}const c=s?.name;let a;e[10]!==l?.completed_steps?.error?(a=l?.completed_steps?.error??[],e[10]=l?.completed_steps?.error,e[11]=a):a=e[11];const d=a;let u;if(e[12]!==c||e[13]!==d){let $;e[15]!==c?($=R=>R===c||R.startsWith(`${c}[`),e[15]=c,e[16]=$):$=e[16],u=d.some($),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let h;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(h=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=h):h=e[20];const p=h,x=!!(l?.completed_steps?.success?.some($=>$.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=M("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,y;e[23]!==s?(j=o.jsx(Xl,{step:s}),y=o.jsx(Zl,{step:s}),e[23]=s,e[24]=j,e[25]=y):(j=e[24],y=e[25]);const S=`${c}-${x?"open":"closed"}`;let v;e[26]!==l||e[27]!==g?(v=g&&l?.error!=null?typeof l.error=="string"?l.error:JSON.stringify(l.error):void 0,e[26]=l,e[27]=g,e[28]=v):v=e[28];let w;e[29]!==s||e[30]!==x||e[31]!==g||e[32]!==S||e[33]!==v?(w=o.jsx(ec,{step:s,defaultOpen:x,isStepErrored:g,executionError:v},S),e[29]=s,e[30]=x,e[31]=g,e[32]=S,e[33]=v,e[34]=w):w=e[34];let N;e[35]!==s||e[36]!==r?(N=!r&&o.jsx(ic,{step:s}),e[35]=s,e[36]=r,e[37]=N):N=e[37];let T;e[38]!==s||e[39]!==r?(T=!r&&o.jsx(ac,{step:s}),e[38]=s,e[39]=r,e[40]=T):T=e[40];let E;return e[41]!==N||e[42]!==T||e[43]!==b||e[44]!==j||e[45]!==y||e[46]!==w?(E=o.jsxs("div",{className:b,children:[j,y,w,N,T]}),e[41]=N,e[42]=T,e[43]=b,e[44]=j,e[45]=y,e[46]=w,e[47]=E):E=e[47],E}function Xl(t){const e=C.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=U(),l=i??"";let c;e[0]!==l?(c=o.jsx(at,{icon:null,name:l,size:"xs",className:"shadow-sm"}),e[0]=l,e[1]=c):c=e[1];let a;e[2]!==i?(a=o.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:i}),e[2]=i,e[3]=a):a=e[3];let d;e[4]!==r?(d=r?null:o.jsx(Ql,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function Ql(){const t=C.c(9),e=Be(),{updateStep:n,startReplacingTool:s}=ee(),i=U(),l=e&&"toolName"in e.action?e.action.toolName:null;let c;t[0]!==e||t[1]!==s||t[2]!==l||t[3]!==i||t[4]!==n?(c=()=>{if(e){if(i){On.error("You cannot replace a tool while a workflow is executing.");return}l&&s(l),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=s,t[2]=l,t[3]=i,t[4]=n,t[5]=c):c=t[5];const a=c;let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ms,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:d}),t[7]=a,t[8]=u):u=t[8],u}function hn(t){const e=C.c(16),{org:n}=G(),s=Ke();let i;e[0]!==n.id||e[1]!==s?(i=s??Ve(n.id),e[0]=n.id,e[1]=s,e[2]=i):i=e[2];const r=i;let l;e[3]!==n.id||e[4]!==r?(l={connectionId:r,orgId:n.id},e[3]=n.id,e[4]=r,e[5]=l):l=e[5];const c=ne(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=nn(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(h=>h.name===t),e[8]=t,e[9]=d.data?.tools,e[10]=u):u=e[10];const f=u;let m;return e[11]!==f||e[12]!==d.error||e[13]!==d.isLoading||e[14]!==d.isSuccess?(m={tool:f,isLoading:d.isLoading,isReady:d.isSuccess,error:d.error},e[11]=f,e[12]=d.error,e[13]=d.isLoading,e[14]=d.isSuccess,e[15]=m):m=e[15],m}function Zl(t){const e=C.c(18),{step:n}=t,{updateStep:s}=ee(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=U(),{tool:c}=hn(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=v=>{s(n.name,{input:v})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==n.input||e[4]!==c.inputSchema||e[5]!==l?(u=l?Yl(c.inputSchema,n.input):c.inputSchema,e[3]=n.input,e[4]=c.inputSchema,e[5]=l,e[6]=u):u=e[6];const f=u,m=l?"output":"input";let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ql,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=h):h=e[7];const p=n.name+l,x=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let y;e[9]!==d||e[10]!==p||e[11]!==x||e[12]!==g||e[13]!==b?(y=o.jsxs(Bl,{value:"input",className:"border-b-0",children:[h,o.jsx(Kl,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:x,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=y):y=e[14];let S;return e[15]!==y||e[16]!==m?(S=o.jsx(Ul,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=m,e[17]=S):S=e[17],S}function Yl(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function ec(t){const e=C.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=U(),{item:a}=fe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=V=>V===n.name||V.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),h=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(V=>V.name===n.name)||f||h),[x,g]=k.useState(s),b=n.forEach!==void 0,[j,y]=k.useState("all"),S=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(V=>S.test(V.name)).map(V=>{const We=V.name.match(S);return{index:Number(We[1]),status:"success"}}):[],N=(b?d.filter(V=>S.test(V)):[]).map(V=>{const We=V.match(S);return{index:Number(We[1]),status:"error"}}),T=[...v,...N].sort(nc),E=T.length>0,$=b&&j!=="all"?`${n.name}[${j}]`:void 0,R=p?n.name:void 0,L=$??R,{output:I,error:A}=js(c,L);let W;e[2]!==A||e[3]!==r||e[4]!==i||e[5]!==I?(W=I||(A?{error:A}:i&&r?{error:r}:void 0),e[2]=A,e[3]=r,e[4]=i,e[5]=I,e[6]=W):W=e[6];const z=W,X=l&&typeof l=="object"?l.properties:void 0;let _;e[7]!==X?(_=X?Object.entries(X):[],e[7]=X,e[8]=_):_=e[8];const O=_,P=j!=="all"&&N.some(V=>V.index===j),Q=j==="all"?i||f||h:P,Z=x?"flex-1 min-h-0 overflow-hidden":"shrink-0";let F;e[9]!==Z?(F=M("flex flex-col border-b border-border",Z),e[9]=Z,e[10]=F):F=e[10];let K;e[11]!==x||e[12]!==g?(K=()=>g(!x),e[11]=x,e[12]=g,e[13]=K):K=e[13];const B=Q?"text-destructive":"text-muted-foreground";let H;e[14]!==B?(H=M("text-sm font-medium",B),e[14]=B,e[15]=H):H=e[15];const J=Q?"Error":"Output";let ie;e[16]!==H||e[17]!==J?(ie=o.jsx("h3",{className:H,children:J}),e[16]=H,e[17]=J,e[18]=ie):ie=e[18];let le;e[19]!==x?(le=x?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"}),e[19]=x,e[20]=le):le=e[20];let se;e[21]!==ie||e[22]!==le?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,le]}),e[21]=ie,e[22]=le,e[23]=se):se=e[23];let ce;e[24]!==se||e[25]!==K?(ce=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:K,children:se}),e[24]=se,e[25]=K,e[26]=ce):ce=e[26];let oe;e[27]!==T||e[28]!==z||e[29]!==E||e[30]!==b||e[31]!==x||e[32]!==O||e[33]!==j||e[34]!==y||e[35]!==n.name||e[36]!==c?(oe=x&&o.jsxs(o.Fragment,{children:[c&&b&&E&&o.jsx(sc,{iterations:T,selectedIteration:j,onSelect:y}),c&&z?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:JSON.stringify(z,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&O.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:O.map(tc)})]}),e[27]=T,e[28]=z,e[29]=E,e[30]=b,e[31]=x,e[32]=O,e[33]=j,e[34]=y,e[35]=n.name,e[36]=c,e[37]=oe):oe=e[37];let ae;return e[38]!==ce||e[39]!==oe||e[40]!==F?(ae=o.jsxs("div",{className:F,children:[ce,oe]}),e[38]=ce,e[39]=oe,e[40]=F,e[41]=ae):ae=e[41],ae}function tc(t){const[e,n]=t;return o.jsx(rc,{name:e,schema:n},e)}function nc(t,e){return t.index-e.index}function sc(t){const e=C.c(21),{iterations:n,selectedIteration:s,onSelect:i}=t,r=s==="all"?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground";let l;e[0]!==r?(l=M("h-7 px-3 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",r),e[0]=r,e[1]=l):l=e[1];let c;e[2]!==i?(c=()=>i("all"),e[2]=i,e[3]=c):c=e[3];let a;e[4]!==l||e[5]!==c?(a=o.jsx("button",{type:"button",className:l,onClick:c,children:"All Results"}),e[4]=l,e[5]=c,e[6]=a):a=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e[7]=d):d=e[7];let u;if(e[8]!==n||e[9]!==i||e[10]!==s){let p;e[12]!==i||e[13]!==s?(p=x=>{const g=s===x.index;return o.jsxs("button",{type:"button",className:M("h-7 px-2.5 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",g?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(x.index),children:[x.status==="success"?o.jsx(ut,{size:12,className:"text-success"}):o.jsx(ct,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",x.index]})]},x.index)},e[12]=i,e[13]=s,e[14]=p):p=e[14],u=n.map(p),e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];let f;e[15]!==a||e[16]!==u?(f=o.jsxs("div",{className:"flex w-max items-center gap-2 pb-3",children:[a,d,u]}),e[15]=a,e[16]=u,e[17]=f):f=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($o,{orientation:"horizontal"}),e[18]=m):m=e[18];let h;return e[19]!==f?(h=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(Oo,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=h):h=e[20],h}function oc(t){switch(t){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function rc(t){const e=C.c(28),{name:n,schema:s}=t,i=Be(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:S,color:v}=oc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=S,c=14,a=M(v),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=u}else l=e[1],c=e[2],a=e[3],d=e[4],u=e[5];let f;e[6]!==l||e[7]!==c||e[8]!==a?(f=o.jsx(l,{size:c,className:a}),e[6]=l,e[7]=c,e[8]=a,e[9]=f):f=e[9];let m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let h;e[12]!==d||e[13]!==f||e[14]!==m?(h=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ds,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const x=i?.name;let g;e[17]!==x?(g=o.jsxs("span",{className:"text-muted-foreground",children:[x,"."]}),e[17]=x,e[18]=g):g=e[18];let b;e[19]!==n?(b=o.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=b):b=e[20];let j;e[21]!==g||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let y;return e[24]!==j||e[25]!==u||e[26]!==h?(y=o.jsxs("div",{className:u,children:[h,j]}),e[24]=j,e[25]=u,e[26]=h,e[27]=y):y=e[27],y}function ic(t){const e=C.c(29),{step:n}=t,{updateStep:s}=ee(),i=U(),[r,l]=k.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=hn(a??""),u=c&&"transformCode"in n.action?n.action.transformCode??null:null;let f;e[0]!==d?(f=()=>{if(!d?.outputSchema)return`interface Input {
7
+ ${t.trimStart()}`;const s=n.index,i=s+n[0].length-1;let r=1,l=i+1;for(;l<t.length&&r>0;)t[l]==="{"?r++:t[l]==="}"&&r--,l++;return t.slice(0,s)+e+t.slice(l)}function Et(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...so,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const hs=k.createContext(null),zr=t=>an()(xs(e=>({...t,actions:{setIsAddingStep:n=>e(s=>({...s,isAddingStep:n})),setCurrentStepTab:n=>e(s=>({...s,currentStepTab:n})),setToolAction:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.map(i=>"toolName"in i.action&&i.action.toolName===n.toolName?{...i,action:n}:i)}})),appendStep:({step:n,type:s})=>e(i=>{const r=n??Et(s,i.workflow.steps.length),l=i.workflow.steps.find(a=>a.name===r.name),c=l?`${r.name} ${parseInt(l.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:r.name;return{workflow:{...i.workflow,steps:[...i.workflow.steps,{...r,name:c}]}}}),deleteStep:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.filter(i=>i.name!==n)}})),duplicateStep:n=>e(s=>{const i=s.workflow.steps.findIndex(a=>a.name===n);if(i===-1)return s;const r=s.workflow.steps[i];if(!r)return s;const l={...r,name:Tt(r.name,s.workflow.steps)},c=[...s.workflow.steps];return c.splice(i+1,0,l),{workflow:{...s.workflow,steps:c},currentStepName:l.name}}),setCurrentStepName:n=>e(s=>({...s,currentStepName:n})),updateStep:(n,s)=>e(i=>({...i,workflow:{...i.workflow,steps:i.workflow.steps.map(r=>r.name===n?{...r,...s}:r)}})),setTrackingExecutionId:n=>e(s=>({...s,trackingExecutionId:n})),resetToOriginalWorkflow:()=>e(n=>({...n,workflow:n.originalWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(h=>h.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=Et("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Lr(a,"Input"),m=d.action,h=Dr(m.code,f);d={...d,action:{...m,code:h}}}const u=Tt(d.name,r.steps);return{...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...r,steps:[...r.steps,{...d,name:u}]},currentStepName:u}}),addToolStep:()=>e(n=>{let s=Et("tool",Number((Math.random()*1e6).toFixed(0)));const i=Tt(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setWorkflow:n=>e(s=>({...s,workflow:n})),startReplacingTool:n=>e(s=>({...s,replacingToolInfo:{toolName:n}})),cancelReplacingTool:()=>e(n=>({...n,replacingToolInfo:null})),setSelectedVirtualMcpId:n=>e(s=>({...s,selectedVirtualMcpId:n}))}}),{name:`workflow-store-${encodeURIComponent(t.workflow.id)}`,storage:ps(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Wr(t){const e=C.c(11),{children:n,initialState:s}=t,i=Xn(),{org:r}=G();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Ve(r.id),e[0]=r,e[1]=i?.[0]?.id,e[2]=l):l=e[2];const c=l;let a;e[3]!==c||e[4]!==s.currentStepTab||e[5]!==s.trackingExecutionId||e[6]!==s.workflow?(a=()=>zr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:c,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[3]=c,e[4]=s.currentStepTab,e[5]=s.trackingExecutionId,e[6]=s.workflow,e[7]=a):a=e[7];const[d]=k.useState(a);let u;return e[8]!==n||e[9]!==d?(u=o.jsx(hs.Provider,{value:d,children:n}),e[8]=n,e[9]=d,e[10]=u):u=e[10],u}function Ue(t,e){const n=k.useContext(hs);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Ar(n,t,Pr)}function De(){return Ue(Fr)}function Fr(t){return t.workflow}function ee(){return Ue(Hr)}function Hr(t){return t.actions}function gs(){const t=qe();return Ue(Vr)??t[0]?.name}function Vr(t){return t.currentStepName}function Be(){const t=C.c(5),e=gs(),n=qe();let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==e?(r=l=>l.name===e,t[3]=e,t[4]=r):r=t[4],s=n.find(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];const i=s;return i||n[0]}function qe(){return De().steps}function Lt(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!=typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Lt(t[n],e[n]))return!1;return!0}if(typeof t=="object"){const n=t,s=e,i=Object.keys(n),r=Object.keys(s);if(i.length!==r.length)return!1;for(const l of i)if(!(l in s)||!Lt(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=C.c(5),e=De();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=qs(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=Lt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function U(){return Ue(Ur)}function Ur(t){return t.trackingExecutionId}function Ke(){return Ue(Br)}function Br(t){return t.selectedVirtualMcpId}function qr(t){const e=C.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Xn()??[],{org:a}=G();let d;e[0]!==a.id?(d=Ve(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(Jr),m=Hn,h=n??u;let p;e[2]!==s?(p=N=>s(N===""?void 0:N),e[2]=s,e[3]=p):p=e[3];let x;e[4]!==i?(x=M("text-xs",i),e[4]=i,e[5]=x):x=e[5];let g;e[6]!==l?(g=o.jsx(Un,{placeholder:l}),e[6]=l,e[7]=g):g=e[7];let b;e[8]!==x||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:x,children:g}),e[8]=x,e[9]=g,e[10]=b):b=e[10];const j=Bn;let y;e[11]!==u?(y=o.jsx(tt,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=y):y=e[12];const S=f.map(Kr);let v;e[13]!==j||e[14]!==y||e[15]!==S?(v=o.jsxs(j,{children:[y,S]}),e[13]=j,e[14]=y,e[15]=S,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==h||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:h,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=h,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function Kr(t){return o.jsx(tt,{value:t.id,children:t.title},t.id)}function Jr(t){return t.id!==null&&!jo(t.id)}function ze(){const t=C.c(2),e=bo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Jo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function fe(t){const e=C.c(12),{org:n}=G(),s=ze();let i;e[0]!==s.id||e[1]!==n.id?(i={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=i):i=e[2];const r=ne(i);let l;e[3]!==t?(l={id:t},e[3]=t,e[4]=l):l=e[4];const c=!!t;let a;e[5]!==r||e[6]!==l||e[7]!==c?(a={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:l,enabled:c,select:Gr},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=sn(a),f=d?.item;let m;return e[9]!==u||e[10]!==f?(m={item:f,isLoading:u},e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Gr(t){return t.structuredContent??t}function js(t,e,n){const s=C.c(14),{org:i}=G(),r=ze();let l;s[0]!==r.id||s[1]!==i.id?(l={connectionId:r.id,orgId:i.id},s[0]=r.id,s[1]=i.id,s[2]=l):l=s[2];const c=ne(l),a=(n?.enabled??!0)&&!!t&&!!e;let d;s[3]!==t||s[4]!==e?(d={executionId:t,stepId:e},s[3]=t,s[4]=e,s[5]=d):d=s[5];let u;s[6]!==c||s[7]!==a||s[8]!==d?(u={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,select:Xr},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=sn(u),h=f?.output,p=f?.error;let x;return s[10]!==m||s[11]!==h||s[12]!==p?(x={output:h,error:p,isLoading:m},s[10]=m,s[11]=h,s[12]=p,s[13]=x):x=s[13],x}function Xr(t){return t.structuredContent??t}function Qr(){const t=C.c(19),{org:e}=G(),n=ze(),s=De();let i;t[0]!==n.id||t[1]!==e.id?(i={connectionId:n.id,orgId:e.id},t[0]=n.id,t[1]=e.id,t[2]=i):i=t[2];const r=ne(i);let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=["workflow"],t[3]=l):l=t[3];let c;t[4]!==s.id?(c={field:l,operator:"eq",value:s.id},t[4]=s.id,t[5]=c):c=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=[{field:["created_at"],direction:"desc"}],t[6]=a):a=t[6];let d;t[7]!==c?(d={where:c,orderBy:a,limit:100},t[7]=c,t[8]=d):d=t[8];const u=!!s.id;let f;t[9]!==r||t[10]!==d||t[11]!==u?(f={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolArguments:d,enabled:u,staleTime:5e3,select:Zr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:h,refetch:p}=sn(f);let x;t[13]!==m?.items?(x=m?.items??[],t[13]=m?.items,t[14]=x):x=t[14];let g;return t[15]!==h||t[16]!==p||t[17]!==x?(g={executions:x,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=x,t[18]=g):g=t[18],g}function Zr(t){return t.structuredContent??t}function vs(t){const e=[];function n(s){if(typeof s=="string"){const i=s.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(i)for(const r of i)if(r==="@input")e.push("__entire_input__");else{const l=r.replace("@input.","");e.push(l)}}else Array.isArray(s)?s.forEach(n):typeof s=="object"&&s!==null&&Object.values(s).forEach(n)}return n(t),[...new Set(e)]}function Yr(t){const e=[];for(const n of t){const s=vs(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function ei(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ti(t){const e=Yr(t);if(e.length===0)return ei(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},s=[];for(const i of e){const r=i.split(".");if(r.length===1)n[i]={type:"string",description:`Input field: ${i}`},s.push(i);else{const l=r[0];l&&!n[l]&&(n[l]={type:"object",description:`Input object: ${l}`,additionalProperties:!0},s.push(l))}}return{type:"object",properties:n,required:s,description:"Workflow execution input"}}function ni(){const t=C.c(2),e=De();let n;return t[0]!==e.steps?(n=ti(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function si(){const t=C.c(16),{org:e}=G(),{id:n}=ze(),{setTrackingExecutionId:s}=ee(),i=De(),r=Ke(),l=ni();let c;t[0]!==n||t[1]!==e.id?(c={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=c):c=t[2];const a=ne(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=on(d);let m;t[5]!==e.id||t[6]!==r||t[7]!==s||t[8]!==u||t[9]!==i?(m=async g=>{const b=g===void 0?{}:g,j=r??Ve(e.id),y=Date.now(),S=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:y,workflow_collection_id:i.id}}),w=(S.structuredContent??S)?.item?.id??void 0;return s(w),w},t[5]=e.id,t[6]=r,t[7]=s,t[8]=u,t[9]=i,t[10]=m):m=t[10];const h=m,p=l!==null;let x;return t[11]!==h||t[12]!==l||t[13]!==f||t[14]!==p?(x={handleRunWorkflow:h,isPending:f,requiresInput:p,inputSchema:l},t[11]=h,t[12]=l,t[13]=f,t[14]=p,t[15]=x):x=t[15],x}function oi(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>await l({name:"CANCEL_EXECUTION",arguments:{executionId:f}}),t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleCancelWorkflow:d,isCancelling:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ri(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ii(){const t=C.c(3),e=U(),{item:n}=fe(e);let s;return t[0]!==n||t[1]!==e?(s=e&&n?(()=>{const r={};return n?.input&&(r.input=n.input),r})():void 0,t[0]=n,t[1]=e,t[2]=s):s=t[2],s}function li(t,e,n,s){if(!e)return[...t].sort(s);const i=n(e);return[...t].sort((r,l)=>{const c=n(r),a=n(l);return c===i?-1:a===i?1:s?s(r,l):0})}const dn=Er()(xs(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),ys=k.createContext([]);function Ss(){return k.useContext(ys)}function ci({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Fo;return{editor:t,char:s,pluginKey:i,command:({editor:r,range:l,props:c})=>{var a,d,u;const f=r.view.state.selection.$to.nodeAfter;(a=f?.text)!=null&&a.startsWith(" ")&&(l.to+=1),r.chain().focus().insertContentAt(l,[{type:n,attrs:{...c,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(d=r.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:r,range:l})=>{const c=r.doc.resolve(l.from),a=r.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(a)},...e}}function ws(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>ci({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function In(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var ai=Lo.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,s;return`${(n=e?.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var s,i;return["span",Ge(this.HTMLAttributes,t.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=In(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ge({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ge({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Wo({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(t);for(;s!==null;){const[,i,r,l]=s,c=r??l;e[i==="char"?"mentionSuggestionChar":i]=c,s=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:In(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:s}=e,{empty:i,anchor:r}=s;if(!i)return!1;let l=new zo,c=0;return e.doc.nodesBetween(r-1,r,(a,d)=>{if(a.type.name===this.name)return n=!0,l=a,c=d,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,c,c+l.nodeSize),n})}},addProseMirrorPlugins(){return ws(this).map(Do)}}),di=ai,$t,ft="HoverCard",[Ns]=Pn(ft,[An]),mt=An(),[ui,pt]=Ns(ft),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=mt(e),d=k.useRef(0),u=k.useRef(0),f=k.useRef(!1),m=k.useRef(!1),[h,p]=Ht({prop:s,defaultProp:i??!1,onChange:r,caller:ft}),x=k.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),g=k.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=k.useCallback(()=>p(!1),[p]);return k.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(ui,{scope:e,open:h,onOpenChange:p,onOpen:x,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=ft;var ks="HoverCardTrigger",Is=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=pt(ks,n),r=mt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Ft.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:de(t.onPointerEnter,rt(i.onOpen)),onPointerLeave:de(t.onPointerLeave,rt(i.onClose)),onFocus:de(t.onFocus,i.onOpen),onBlur:de(t.onBlur,i.onClose),onTouchStart:de(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var un="HoverCardPortal",[fi,mi]=Ns(un,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=pt(un,e);return o.jsx(fi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=un;var ot="HoverCardContent",Ts=k.forwardRef((t,e)=>{const n=mi(ot,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=pt(ot,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(pi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:de(t.onPointerEnter,rt(r.onOpen)),onPointerLeave:de(t.onPointerLeave,rt(r.onClose)),ref:e})})});Ts.displayName=ot;var pi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=pt(ot,n),d=mt(n),u=k.useRef(null),f=Mn(e,u),[m,h]=k.useState(!1);return k.useEffect(()=>{if(m){const p=document.body;return $t=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=$t,p.style.webkitUserSelect=$t}}},[m]),k.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),k.useEffect(()=>{u.current&&gi(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:de(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:de(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),xi="HoverCardArrow",hi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=mt(n);return o.jsx(ao,{...i,...s,ref:e})});hi.displayName=xi;function rt(t){return e=>e.pointerType==="touch"?void 0:t()}function gi(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var bi=Cs,ji=Is,vi=_s,yi=Ts;function Si(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(bi,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function wi(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(ji,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ni(t){const e=C.c(12);let n,s,i,r;e[0]!==t?({className:n,align:i,sideOffset:r,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i,e[4]=r):(n=e[1],s=e[2],i=e[3],r=e[4]);const l=i===void 0?"center":i,c=r===void 0?4:r;let a;e[5]!==n?(a=M("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 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==s||e[9]!==c||e[10]!==a?(d=o.jsx(vi,{"data-slot":"hover-card-portal",children:o.jsx(yi,{"data-slot":"hover-card-content",align:l,sideOffset:c,className:a,...s})}),e[7]=l,e[8]=s,e[9]=c,e[10]=a,e[11]=d):d=e[11],d}const Es=k.createContext(void 0);function Ci(t,e){const n=e.split("."),s=n[0];if(!s)return;let i=t[s];for(let r=1;r<n.length&&i!==void 0;r++){const l=n[r];if(l)if(typeof i=="object"&&i!==null)i=i[l];else return}return i}function ki(t){const e=C.c(20),{node:n}=t,s=k.useContext(Es),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const x=r?Ci(s,i):void 0;l=x!==void 0?typeof x=="object"?JSON.stringify(x,null,2):String(x):void 0,e[0]=r,e[1]=i,e[2]=s,e[3]=l}else l=e[3];const c=l;let a;e[4]!==i?(a=o.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",i]}),e[4]=i,e[5]=a):a=e[5];const d=a;if(!r||c===void 0){let x;return e[6]!==d?(x=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=x):x=e[7],x}let u;e[8]!==d?(u=o.jsx(wi,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let h;e[14]!==f||e[15]!==m?(h=o.jsx(Ni,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=o.jsx(vn,{as:"span",children:o.jsxs(Si,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function $s(t){const e=[];function n(s){for(const i of s)i.children?.length||e.push(i),i.children&&n(i.children)}return n(t),e}let ue=Os();function Os(){return an(()=>({items:[],selectedIndex:0,command:null}))}function _n(t,e){ue.setState({items:t,command:e,selectedIndex:0})}function Ii(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e-1+t.length)%t.length})}function _i(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=ue.getState(),s=t[e];return s?(n?.(s),!0):!1}function Tn(){ue=Os()}function Ti(){const t=C.c(7),e=Mt(ue,$i),n=Mt(ue,Ei);if(!e.length)return null;let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==n?(r=(l,c)=>o.jsx("button",{type:"button",onClick:()=>{ue.setState({selectedIndex:c}),Rs()},className:M("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",c===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:l.label},l.id),t[3]=n,t[4]=r):r=t[4],s=e.map(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];let i;return t[5]!==s?(i=o.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:o.jsx("div",{className:"p-1",children:s})}),t[5]=s,t[6]=i):i=t[6],i}function Ei(t){return t.selectedIndex}function $i(t){return t.items}function Oi(){let t=null,e=null;return{onStart:n=>{_n(n.items,n.command),t=new Bo(Ti,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const s=n.clientRect?.();s&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{_n(n.items,n.command);const s=n.clientRect?.();s&&e&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),Tn(),!0):n.key==="ArrowUp"?(Ii(),!0):n.key==="ArrowDown"?(_i(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),Tn()}}}const Ot=/@([\w.]+)/g;function Ri(t,e){if(!t)return null;const n=$s(e),s=new Map(n.map(a=>[a.id,a]));if(!Ot.test(t))return t;Ot.lastIndex=0;const r=[];let l=0,c;for(;(c=Ot.exec(t))!==null;){const a=c[1]??"",d=c.index;d>l&&r.push({type:"text",text:t.slice(l,d)});const u=s.get(a);u?r.push({type:"mention",attrs:{id:u.id,label:u.label}}):r.push({type:"text",text:c[0]}),l=d+c[0].length}return l<t.length&&r.push({type:"text",text:t.slice(l)}),{type:"doc",content:[{type:"paragraph",content:r.length>0?r:void 0}]}}function fn(t){const e=C.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=ii();let d;e[0]!==n||e[1]!==s?(d=Ri(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=Ho.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==f){let E;e[7]!==n?(E=$=>{const{query:R}=$;return $s(n).filter(I=>I.label.toLowerCase().includes(R.toLowerCase())||I.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=E):E=e[8],p=di.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Li,renderHTML:Pi,suggestion:{items:E,render:Oi,command:Mi}}).extend(f?{addNodeView(){return Vo(ki)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let x;e[9]!==p?(x=[h,p],e[9]=p,e[10]=x):x=e[10];const g=r??"";let b;e[11]!==g?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":g},handleKeyDown:Ai},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=E=>{const{editor:$}=E;return i?.($.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==m||e[17]!==x||e[18]!==b||e[19]!==j?(y={content:u,editable:m,extensions:x,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=x,e[18]=b,e[19]=j,e[20]=y):y=e[20];const S=Uo(y);let v;e[21]!==l?(v=M("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",l),e[21]=l,e[22]=v):v=e[22];let w;e[23]!==S?(w=o.jsx(qo,{editor:S}),e[23]=S,e[24]=w):w=e[24];let N;e[25]!==v||e[26]!==w?(N=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=N):N=e[27];const T=N;if(a!==void 0){let E;return e[28]!==T||e[29]!==a?(E=o.jsx(Es.Provider,{value:a,children:T}),e[28]=T,e[29]=a,e[30]=E):E=e[30],E}return T}function Ai(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Mi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Pi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Li(t){const{node:e}=t;return`@${e.attrs.id}`}function Di(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function zi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r,className:"min-h-[80px]"}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Wi(t){const e=C.c(8),{value:n,onChange:s,readonly:i,id:r}=t,l=n??"";let c;e[0]!==s?(c=u=>s(u.target.value===""?void 0:Number(u.target.value)),e[0]=s,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let d;return e[3]!==r||e[4]!==i||e[5]!==l||e[6]!==c?(d=o.jsx("input",{id:r,type:"number",value:l,onChange:c,disabled:i,className:a}),e[3]=r,e[4]=i,e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Fi(t){const e=C.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Hi(t){const e=C.c(14),{value:n,onChange:s,readonly:i,id:r,options:l}=t;let c;e[0]!==l.enumOptions?(c=l.enumOptions??[],e[0]=l.enumOptions,e[1]=c):c=e[1];const a=c,d=n??"";let u;e[2]!==s?(u=x=>s(x.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let h;e[6]!==a?(h=a.map(Vi),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==h?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,h]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function Vi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Ui={TextWidget:Di,TextareaWidget:zi,NumberWidget:Wi,CheckboxWidget:Fi,SelectWidget:Hi};function Bi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function qi(t){const e=C.c(36),{id:n,label:s,required:i,description:r,children:l,schema:c,hidden:a}=t;if(a){let v;return e[0]!==l?(v=o.jsx("div",{className:"hidden",children:l}),e[0]=l,e[1]=v):v=e[1],v}if(n==="root"){let v;return e[2]!==l?(v=o.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=v):v=e[3],v}const d=Array.isArray(c.type)?c.type[0]:c.type??"string";let u,f,m,h,p,x,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=Bi(d);g="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(x=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=x):x=e[19],u=v,f=14,m=M(w,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=h,e[12]=p,e[13]=x,e[14]=g}else u=e[8],f=e[9],m=e[10],h=e[11],p=e[12],x=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==h||e[25]!==p||e[26]!==x||e[27]!==b?(j=o.jsxs("div",{className:h,children:[p,x,b]}),e[24]=h,e[25]=p,e[26]=x,e[27]=b,e[28]=j):j=e[28];let y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let S;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(S=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=S):S=e[35],S}function Ki(t){const e=C.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Gi),e[0]=n,e[1]=c):c=e[1];let a;return e[2]!==c?(a=o.jsx("div",{className:"space-y-4",children:c}),e[2]=c,e[3]=a):a=e[3],a}let r;e[4]!==n?(r=n.map(Ji),e[4]=n,e[5]=r):r=e[5];let l;return e[6]!==r?(l=o.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:r}),e[6]=r,e[7]=l):l=e[7],l}function Ji(t){return o.jsx("div",{children:t.content},t.name)}function Gi(t){return o.jsx("div",{children:t.content},t.name)}function Xi(t){const e=C.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Qi),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"space-y-2",children:l}),e[2]=l,e[3]=c):c=e[3];let a;e[4]!==s||e[5]!==i||e[6]!==r?(a=s&&o.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:i,children:["+ Add ",r||"item"]}),e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==c||e[9]!==a?(d=o.jsxs("div",{className:"space-y-2",children:[c,a]}),e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Qi(t){return o.jsx("div",{className:"flex gap-2 items-start",children:o.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function Zi(){return null}function Yi(){return null}const el={FieldTemplate:qi,ObjectFieldTemplate:Ki,ArrayFieldTemplate:Xi,UnsupportedFieldTemplate:Zi,ErrorListTemplate:Yi};function tl(t){const e=C.c(6),{inputSchema:n,inputParams:s,mentions:i}=t;if(!n?.properties||!s)return null;let r;e[0]!==i?(r=(a,d,u)=>{const f=typeof d=="object"&&d!==null?JSON.stringify(d,null,2):String(d??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(fn,{mentions:i,value:f,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=i,e[1]=r):r=e[1];const l=r;let c;return e[2]!==s||e[3]!==n.properties||e[4]!==l?(c=o.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[d,u]=a,f=s[d];return l(d,f,u)})}),e[2]=s,e[3]=n.properties,e[4]=l,e[5]=c):c=e[5],c}function As({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:s,mentions:i,readOnly:r}){const l=i??[];if(!t)return o.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(r)return o.jsx(tl,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=k.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[h,p]of Object.entries(f))m[h]!==p&&s(h,p);for(const h of Object.keys(m))h in f||s(h,void 0)}a.current=f};return o.jsx(ys.Provider,{value:l,children:o.jsx(_o,{schema:c,formData:e,onChange:d,validator:To,widgets:Ui,templates:el,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function nl(t){const e=C.c(33),{open:n,onOpenChange:s,inputSchema:i,onSubmit:r,isPending:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];const[a,d]=k.useState(c);let u;e[1]!==a||e[2]!==s||e[3]!==r?(u=async()=>{await r(a),s(!1),d({})},e[1]=a,e[2]=s,e[3]=r,e[4]=u):u=e[4];const f=u;let m;e[5]!==s?(m=T=>{T||d({}),s(T)},e[5]=s,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(Go,{children:[o.jsx(Xo,{children:"Workflow Input"}),o.jsx(Qo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[8]=x):x=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(As,{inputSchema:i,inputParams:a,setInputParams:d,mentions:x})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==h?(b=()=>h(!1),e[12]=h,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(Y,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(dt,{size:"xs"}):o.jsx(tn,{size:14}),e[17]=l,e[18]=y):y=e[18];let S;e[19]!==f||e[20]!==l||e[21]!==y?(S=o.jsxs(Y,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=S):S=e[22];let v;e[23]!==S||e[24]!==j?(v=o.jsxs(Zo,{children:[j,S]}),e[23]=S,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(Yo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,g,v]}),e[26]=v,e[27]=g,e[28]=w):w=e[28];let N;return e[29]!==h||e[30]!==n||e[31]!==w?(N=o.jsx(er,{open:n,onOpenChange:h,children:w}),e[29]=h,e[30]=n,e[31]=w,e[32]=N):N=e[32],N}function sl(t){const e=C.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=Wt().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=dn(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:h}=ee(),p=bs(),x=Ke(),g=U();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let y;e[4]!==b||e[5]!==j?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let S;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==x||e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(S=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:m,isDirty:p,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(k.Suspense,{fallback:o.jsx(dt,{size:"xs"}),children:o.jsx(qr,{selectedVirtualMcpId:x,onVirtualMcpChange:h,placeholder:"Select Agent"})}),o.jsx(Po,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(fs,{})},{value:"code",icon:o.jsx(as,{})}]}),o.jsx(qt,{title:n,url:c,icon:"workflow"}),o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(Y,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(cs,{size:14})})})}),o.jsx(en,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=x,e[12]=h,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=S):S=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(il,{}),e[21]=v):v=e[21];let w;e[22]!==S?(w=o.jsxs(Xt,{children:[S,v]}),e[22]=S,e[23]=w):w=e[23];let N;return e[24]!==y||e[25]!==w?(N=o.jsxs(o.Fragment,{children:[y,w]}),e[24]=y,e[25]=w,e[26]=N):N=e[26],N}function ol(){const t=U(),{item:e}=fe(t);return e?.completed_at_epoch_ms!=null}function rl(){const t=U(),{item:e}=fe(t);return e?.status==="cancelled"}function il(){const t=C.c(58),e=bs(),n=ol(),s=rl(),i=U(),r=Ke(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=si(),u=qe(),[f,m]=k.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=oi(),{handleResumeWorkflow:x,isResuming:g}=ri(),b=i&&!n;let j;t[0]!==u?(j=u.some(ll),t[0]=u,t[1]=j):j=t[1];const y=j,S=!r,v=u.length===0,w=e||v||y||S||c||p,N=b||c;let T;t[2]!==y||t[3]!==S||t[4]!==e||t[5]!==s||t[6]!==N||t[7]!==v?(T=()=>s?"Workflow is currently cancelled":N?"Workflow is currently running":e?"Save your changes before running":S?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=S,t[4]=e,t[5]=s,t[6]=N,t[7]=v,t[8]=T):T=t[8];const $=T();let R;t[9]!==h||t[10]!==x||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==N||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){m(!0);return}if(s&&i){await x(i);return}if(N&&i){await h(i);return}await l({})},t[9]=h,t[10]=x,t[11]=l,t[12]=d,t[13]=s,t[14]=N,t[15]=a,t[16]=i,t[17]=R):R=t[17];const L=R;let I;t[18]!==l?(I=async J=>{await l(J)},t[18]=l,t[19]=I):I=t[19];const A=I,W=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",z=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let X;t[20]!==z?(X=M("gap-2 h-7 px-3",z),t[20]=z,t[21]=X):X=t[21];let _;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(_=(!b&&!c&&!p&&!g||s)&&o.jsx(tn,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=_):_=t[27];let O;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(O=b&&!c&&!p&&!g&&!s&&o.jsx(Ko,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=O):O=t[33];let P;t[34]!==p||t[35]!==c||t[36]!==g?(P=(c||p||g)&&o.jsx(dt,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=P):P=t[37];let Q;t[38]!==W||t[39]!==L||t[40]!==w||t[41]!==X||t[42]!==_||t[43]!==O||t[44]!==P?(Q=o.jsxs(Y,{variant:"default",size:"sm",className:X,disabled:w,onClick:L,children:[_,O,P,W]}),t[38]=W,t[39]=L,t[40]=w,t[41]=X,t[42]=_,t[43]=O,t[44]=P,t[45]=Q):Q=t[45];const Z=Q;let F;t[46]!==Z||t[47]!==$?(F=$?o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Z})}),o.jsx(en,{side:"bottom",children:$})]})}):Z,t[46]=Z,t[47]=$,t[48]=F):F=t[48];const K=F;let B;t[49]!==A||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(nl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:A,isPending:c}),t[49]=A,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let H;return t[55]!==K||t[56]!==B?(H=o.jsxs(o.Fragment,{children:[K,B]}),t[55]=K,t[56]=B,t[57]=H):H=t[57],H}function ll(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function En(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function cl(){const t=C.c(13),e=U(),n=qe(),{item:s}=fe(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.error||t[3]!==s.running_steps||t[4]!==s.status||t[5]!==n){i={};let r;t[7]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(al)??[]),t[7]=s.completed_steps?.success,t[8]=r):r=t[8];const l=r,c=s.completed_steps?.error??[];let a;t[9]!==s.running_steps?(a=s.running_steps??[],t[9]=s.running_steps,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d,f=s.status,m=s.error!=null?typeof s.error=="string"?s.error:JSON.stringify(s.error):void 0;let h=-1;n.forEach((p,x)=>{(l.has(p.name)||En(p.name,c))&&(h=x)}),n.forEach((p,x)=>{let g="pending",b;En(p.name,c)?(g="error",b=m):l.has(p.name)?g="success":(f==="error"||f==="failed")&&u.has(p.name)?(g="error",b=m):f==="running"&&x===h+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:x}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.error,t[3]=s.running_steps,t[4]=s.status,t[5]=n,t[6]=i}else i=t[6];return i}function al(t){return t.name}function dl(t){const e=C.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=U(),{item:m}=fe(f),h=m?.completed_steps,p=h?.success,x=h?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(D=>D.name===n.name),e[0]=n.name,e[1]=p,e[2]=g):g=e[2];const b=g,j=b?.completed_at_epoch_ms,y=b!=null;let S;e[3]!==n.name?(S=D=>D===n.name||D.startsWith(`${n.name}[`),e[3]=n.name,e[4]=S):S=e[4];const v=x.some(S),w="toolName"in n.action,N=w&&"connectionId"in n.action?n.action.connectionId:null,E=!!(w&&"toolName"in n.action?n.action.toolName:null),$=yl(n),L=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=y?"success":v||L?"error":r?.status,A=r!==void 0,W=I==="success"||I==="error";let z=$.length>0?60:12;(I==="success"||I==="error")&&(z=z+32);const X=ml(I);let _;e[5]!==I?(_=pl(I),e[5]=I,e[6]=_):_=e[6];const O=_;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=function(Ct,Xs){const bn=Xs.split(".").slice(1);if(bn.length===0)return Array.isArray(Ct)?Ct:void 0;let xe=Ct;for(const Qs of bn){if(xe==null)return;if(typeof xe=="object")xe=xe[Qs];else return}return Array.isArray(xe)?xe:void 0},e[7]=P):P=e[7];const Q=P,Z=n.forEach!==void 0,F=n.forEach?.ref;let K;e[8]!==F?(K=F?.replace("@","").split(".")[0],e[8]=F,e[9]=K):K=e[9];const B=K,H=m?.status==="running"||m?.status==="enqueued";let J;e[10]!==p||e[11]!==B?(J=p?.some(D=>D.name===B),e[10]=p,e[11]=B,e[12]=J):J=e[12];const ie=J,le=H?500:!1;let se;e[13]!==ie||e[14]!==le?(se={refetchInterval:le,enabled:ie},e[13]=ie,e[14]=le,e[15]=se):se=e[15];const{output:ce}=js(f,B,se);let oe;if(e[16]!==ce||e[17]!==F){const D=F?.replace("@","");oe=D?Q(ce,D):void 0,e[16]=ce,e[17]=F,e[18]=oe}else oe=e[18];const ae=oe;let V;if(e[19]!==n.name){let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=/[.*+?^${}()|[\]\\]/g,e[21]=D):D=e[21],V=n.name.replace(D,"\\$&"),e[19]=n.name,e[20]=V}else V=e[20];const We=V,gn=new RegExp(`^${We}\\[\\d+\\]$`),gt=m?.completed_steps?.success?.filter(D=>gn.test(D.name)),Fe=x.filter(D=>gn.test(D)),bt=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",jt=I==="running"&&"bg-accent/50",vt=l&&"opacity-50";let ge;e[22]!==bt||e[23]!==jt||e[24]!==vt?(ge=M("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",bt,jt,vt),e[22]=bt,e[23]=jt,e[24]=vt,e[25]=ge):ge=e[25];const Ks="button",Js=0;let be;e[26]!==a?(be=D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),a())},e[26]=a,e[27]=be):be=e[27];const yt=M("text-xs font-mono opacity-75 h-8 flex items-center",X),St=s+1;let je;e[28]!==yt||e[29]!==St?(je=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:yt,children:[St,"."]})}),e[28]=yt,e[29]=St,e[30]=je):je=e[30];let ve;e[31]!==O||e[32]!==s?(ve=s>0?o.jsx(Rt,{height:12,color:O}):o.jsx("div",{className:"h-3"}),e[31]=O,e[32]=s,e[33]=ve):ve=e[33];let ye;e[34]!==N||e[35]!==E||e[36]!==w||e[37]!==n.name?(ye=o.jsx(jl,{connectionId:N,isToolStep:w,hasToolSelected:E,stepName:n.name}),e[34]=N,e[35]=E,e[36]=w,e[37]=n.name,e[38]=ye):ye=e[38];let Se;e[39]!==O||e[40]!==W||e[41]!==I?(Se=W&&o.jsxs(o.Fragment,{children:[o.jsx(Rt,{height:8,color:O}),o.jsx(xl,{status:I})]}),e[39]=O,e[40]=W,e[41]=I,e[42]=Se):Se=e[42];let we;e[43]!==O||e[44]!==z||e[45]!==c||e[46]!==f?(we=c&&f?null:o.jsx(Rt,{height:z,color:O}),e[43]=O,e[44]=z,e[45]=c,e[46]=f,e[47]=we):we=e[47];let Ne;e[48]!==ve||e[49]!==ye||e[50]!==Se||e[51]!==we?(Ne=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[ve,ye,Se,we]}),e[48]=ve,e[49]=ye,e[50]=Se,e[51]=we,e[52]=Ne):Ne=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",wt=E?"font-medium text-foreground":"text-foreground";let Ce;e[53]!==wt?(Ce=M("text-sm truncate flex-1",wt),e[53]=wt,e[54]=Ce):Ce=e[54];let ke;e[55]!==n?(ke=vl(n),e[55]=n,e[56]=ke):ke=e[56];let Ie;e[57]!==Ce||e[58]!==ke?(Ie=o.jsx("span",{className:Ce,children:ke}),e[57]=Ce,e[58]=ke,e[59]=Ie):Ie=e[59];let _e;e[60]!==gt?.length||e[61]!==Fe||e[62]!==Z||e[63]!==ae?(_e=Z&&ae&&ae.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(gt?.length??0)+Fe.length} / ${ae.length}`,Fe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",Fe.length," failed)"]})]}),e[60]=gt?.length,e[61]=Fe,e[62]=Z,e[63]=ae,e[64]=_e):_e=e[64];let Te;e[65]!==A||e[66]!==I?(Te=A&&o.jsx(hl,{status:I}),e[65]=A,e[66]=I,e[67]=Te):Te=e[67];let Ee;e[68]!==_e||e[69]!==Te?(Ee=o.jsxs("div",{className:"flex items-center gap-2",children:[_e,Te]}),e[68]=_e,e[69]=Te,e[70]=Ee):Ee=e[70];let $e;e[71]!==A||e[72]!==d||e[73]!==u?($e=!A&&o.jsxs(sr,{children:[o.jsx(or,{asChild:!0,children:o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:fl,children:o.jsx(tr,{size:14})})}),o.jsxs(rr,{align:"end",children:[o.jsxs(yn,{onClick:D=>{D.stopPropagation(),u()},children:[o.jsx(fr,{size:14}),"Duplicate"]}),o.jsxs(yn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:D=>{D.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=A,e[72]=d,e[73]=u,e[74]=$e):$e=e[74];let Oe;e[75]!==Ie||e[76]!==Ee||e[77]!==$e?(Oe=o.jsxs("div",{className:"flex items-center h-8",children:[Ie,Ee,$e]}),e[75]=Ie,e[76]=Ee,e[77]=$e,e[78]=Oe):Oe=e[78];const Nt=$.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:$.map(ul)});let Re;e[79]!==I||e[80]!==j?(Re=I==="success"&&o.jsx(gl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Re):Re=e[81];let Ae;e[82]!==r?.error||e[83]!==I?(Ae=I==="error"&&o.jsx(bl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=Ae):Ae=e[84];let Me;e[85]!==Oe||e[86]!==Nt||e[87]!==Re||e[88]!==Ae?(Me=o.jsxs("div",{className:Gs,children:[Oe,Nt,Re,Ae]}),e[85]=Oe,e[86]=Nt,e[87]=Re,e[88]=Ae,e[89]=Me):Me=e[89];let Je;return e[90]!==a||e[91]!==ge||e[92]!==be||e[93]!==je||e[94]!==Ne||e[95]!==Me?(Je=o.jsxs("div",{className:ge,onClick:a,role:Ks,tabIndex:Js,onKeyDown:be,children:[je,Ne,Me]}),e[90]=a,e[91]=ge,e[92]=be,e[93]=je,e[94]=Ne,e[95]=Me,e[96]=Je):Je=e[96],Je}function ul(t){return o.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function fl(t){return t.stopPropagation()}function ml(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function pl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function xl(t){const e=C.c(2),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:o.jsx(ut,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(ct,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function hl(t){const e=C.c(3),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ut,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ct,{size:11,className:"text-destructive"})}),e[1]=s):s=e[1],s}if(n==="running"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(He,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function gl(t){const e=C.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null&&n>0?new Date(n):null,d=a&&!Number.isNaN(a.getTime());s=d?a.toISOString().split("T")[0]:null,i=d?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];const r=i;let l;e[3]!==s||e[4]!==r?(l=s&&r&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Eo,{size:16,className:"text-success"}),o.jsx("span",{className:"text-xs text-success",children:s}),o.jsx("span",{className:"text-xs text-success",children:r})]}),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==l?(c=o.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:l}),e[6]=l,e[7]=c):c=e[7],c}function bl(t){const e=C.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zn,{size:16,className:"text-destructive"}),e[0]=s):s=e[0];const i=n||"Execution failed";let r;return e[1]!==i?(r=o.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[s,o.jsx("span",{className:"text-xs text-destructive",children:i})]}),e[1]=i,e[2]=r):r=e[2],r}function jl(t){const e=C.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=lt(n??"");if(s&&i&&l?.icon){let a;return e[0]!==l.icon||e[1]!==r?(a=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:o.jsx(at,{icon:l.icon,name:r,size:"xs",className:"border-0 rounded-none"})}),e[0]=l.icon,e[1]=r,e[2]=a):a=e[2],a}let c;return e[3]!==s?(c=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:s?o.jsx(nr,{size:16,className:"text-muted-foreground"}):o.jsx(ur,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function Rt(t){const e=C.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=M("w-px",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l={height:n},e[2]=n,e[3]=l):l=e[3];let c;return e[4]!==r||e[5]!==l?(c=o.jsx("div",{className:r,style:l}),e[4]=r,e[5]=l,e[6]=c):c=e[6],c}function vl(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function yl(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties??e.items?.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function Sl(t){const e=C.c(32),{className:n}=t,s=qe(),i=gs(),r=cl(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ee(),d=U();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let h;e[4]!==n?(h=M("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(S,v)=>{const w=r?.[S.name],N=f!==-1&&v>f&&w?.status==="pending",T=v===s.length-1;return o.jsx(dl,{step:S,index:v,isSelected:S.name===i,executionStatus:w,isSkipped:N,isLastStep:T,onSelect:()=>l(S.name),onDelete:()=>c(S.name),onDuplicate:()=>a(S.name)},S.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=y):y=e[21],p=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let x;e[22]!==p?(x=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=x):x=e[23];let g;e[24]!==d?(g=d?null:o.jsx(wl,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==x||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[x,g]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==h||e[30]!==b?(j=o.jsx(k.Suspense,{fallback:m,children:o.jsx("div",{className:h,children:b})}),e[29]=h,e[30]=b,e[31]=j):j=e[31],j}function wl(){const t=C.c(8),{addToolStep:e}=ee();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Qn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(Y,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function Nl(){const t=C.c(14),{org:e}=G(),n=Ke();let s;t[0]!==e.id||t[1]!==n?(s=n??Ve(e.id),t[0]=e.id,t[1]=n,t[2]=s):s=t[2];const i=s;let r;t[3]!==e.id||t[4]!==i?(r={connectionId:i,orgId:e.id},t[3]=e.id,t[4]=i,t[5]=r):r=t[5];const l=ne(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=nn(c);let d;t[8]!==a.data?.tools?(d=a.data?.tools??[],t[8]=a.data?.tools,t[9]=d):d=t[9];let u;return t[10]!==d||t[11]!==a.error||t[12]!==a.isLoading?(u={tools:d,isLoading:a.isLoading,error:a.error},t[10]=d,t[11]=a.error,t[12]=a.isLoading,t[13]=u):u=t[13],u}function Cl(t){const e=C.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(kl,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function kl(t){const e=C.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Nl(),l=Be(),{updateStep:c}=ee(),d=l&&"toolName"in l.action&&"toolName"in l.action?l.action.toolName:null;let u;if(e[0]!==d||e[1]!==s){let v;e[3]!==d?(v=w=>w.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=li(s,u??null,_l,Il);let h;e[5]!==l||e[6]!==c?(h=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=h):h=e[7];const p=h;if(i){let v;e[8]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(dt,{size:"sm"})}),e[10]=w):w=e[10];let N;return e[11]!==v?(N=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=N):N=e[12],N}if(r){let v;e[13]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let w;e[15]!==r.message?(w=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",r.message]}),e[15]=r.message,e[16]=w):w=e[16];let N;return e[17]!==v||e[18]!==w?(N=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=N):N=e[19],N}let x;e[20]!==n?(x=M("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=x):x=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=g):g=e[22];let b;e[23]!==s.length?(b=o.jsx("div",{className:"flex items-start border-b border-border",children:o.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[g,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=w=>o.jsx(Tl,{icon:null,title:w.name,description:w.description,isSelected:w.name===d,onClick:()=>p(w)},w.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let S;return e[34]!==x||e[35]!==b||e[36]!==y?(S=o.jsxs("div",{className:x,children:[b,y]}),e[34]=x,e[35]=b,e[36]=y,e[37]=S):S=e[37],S}function Il(t,e){return t.name.localeCompare(e.name)}function _l(t){return t.name}function Tl(t){const e=C.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=M("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",c),e[0]=c,e[1]=a):a=e[1];let d;e[2]!==l?(d=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(at,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let h;e[11]!==f||e[12]!==m?(h=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,h]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var re="Accordion",El=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[mn,$l,Ol]=mo(re),[xt]=Pn(re,[Ol,Yn]),pn=Yn(),Ms=q.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(mn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Pl,{...r,ref:e}):o.jsx(Ml,{...i,ref:e})})});Ms.displayName=re;var[Ps,Rl]=xt(re),[Ls,Al]=xt(re,{collapsible:!1}),Ml=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ht({prop:n,defaultProp:s??"",onChange:i,caller:re});return o.jsx(Ps,{scope:t.__scopeAccordion,value:q.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:q.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Pl=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ht({prop:n,defaultProp:s??[],onChange:i,caller:re}),a=q.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=q.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Ps,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(Ds,{...r,ref:e})})})}),[Ll,ht]=xt(re),Ds=q.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=q.useRef(null),a=Mn(c,e),d=$l(n),f=po(i)==="ltr",m=de(t.onKeyDown,h=>{if(!El.includes(h.key))return;const p=h.target,x=d().filter(T=>!T.ref.current?.disabled),g=x.findIndex(T=>T.ref.current===p),b=x.length;if(g===-1)return;h.preventDefault();let j=g;const y=0,S=b-1,v=()=>{j=g+1,j>S&&(j=y)},w=()=>{j=g-1,j<y&&(j=S)};switch(h.key){case"Home":j=y;break;case"End":j=S;break;case"ArrowRight":r==="horizontal"&&(f?v():w());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?w():v());break;case"ArrowUp":r==="vertical"&&w();break}const N=j%b;x[N].ref.current?.focus()});return o.jsx(Ll,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(mn.Slot,{scope:n,children:o.jsx(Ft.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),it="AccordionItem",[Dl,xn]=xt(it),zs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ht(it,n),l=Rl(it,n),c=pn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(Dl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(lr,{"data-orientation":r.orientation,"data-state":Bs(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});zs.displayName=it;var Ws="AccordionHeader",Fs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Ws,n);return o.jsx(Ft.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var Dt="AccordionTrigger",Hs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Dt,n),l=Al(Dt,n),c=pn(n);return o.jsx(mn.ItemSlot,{scope:n,children:o.jsx(ir,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=Dt;var Vs="AccordionContent",Us=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ht(re,n),r=xn(Vs,n),l=pn(n);return o.jsx(cr,{role:"region","aria-labelledby":r.triggerId,"data-orientation":i.orientation,...l,...s,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Us.displayName=Vs;function Bs(t){return t?"open":"closed"}var zl=Ms,Wl=zs,Fl=Fs,Hl=Hs,Vl=Us;function Ul(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(zl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Bl(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("border-b last:border-b-0",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx(Wl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function ql(t){const e=C.c(11);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ar,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=l):l=e[6];let c;return e[7]!==n||e[8]!==i||e[9]!==r?(c=o.jsx(Fl,{className:"flex",children:o.jsxs(Hl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function Kl(t){const e=C.c(12);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("pt-0 pb-4",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==n||e[7]!==r?(l=o.jsx("div",{className:r,children:n}),e[6]=n,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==l?(c=o.jsx(Vl,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function Jl(t){const{updateStep:e}=ee(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=hn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Gl(t){const e=C.c(48),{className:n}=t,s=Be(),{appendStep:i}=ee();Jl(s);const r=U(),{item:l}=fe(r);if(!s){let $;e[0]!==n?($=M("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=$):$=e[1];let R;e[2]!==i?(R=()=>{i({type:"tool"})},e[2]=i,e[3]=R):R=e[3];let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Qn,{size:14}),e[4]=L):L=e[4];let I;e[5]!==R?(I=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:R,children:L})]}),e[5]=R,e[6]=I):I=e[6];let A;return e[7]!==$||e[8]!==I?(A=o.jsx("div",{className:$,children:I}),e[7]=$,e[8]=I,e[9]=A):A=e[9],A}const c=s?.name;let a;e[10]!==l?.completed_steps?.error?(a=l?.completed_steps?.error??[],e[10]=l?.completed_steps?.error,e[11]=a):a=e[11];const d=a;let u;if(e[12]!==c||e[13]!==d){let $;e[15]!==c?($=R=>R===c||R.startsWith(`${c}[`),e[15]=c,e[16]=$):$=e[16],u=d.some($),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let h;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(h=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=h):h=e[20];const p=h,x=!!(l?.completed_steps?.success?.some($=>$.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=M("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,y;e[23]!==s?(j=o.jsx(Xl,{step:s}),y=o.jsx(Zl,{step:s}),e[23]=s,e[24]=j,e[25]=y):(j=e[24],y=e[25]);const S=`${c}-${x?"open":"closed"}`;let v;e[26]!==l||e[27]!==g?(v=g&&l?.error!=null?typeof l.error=="string"?l.error:JSON.stringify(l.error):void 0,e[26]=l,e[27]=g,e[28]=v):v=e[28];let w;e[29]!==s||e[30]!==x||e[31]!==g||e[32]!==S||e[33]!==v?(w=o.jsx(ec,{step:s,defaultOpen:x,isStepErrored:g,executionError:v},S),e[29]=s,e[30]=x,e[31]=g,e[32]=S,e[33]=v,e[34]=w):w=e[34];let N;e[35]!==s||e[36]!==r?(N=!r&&o.jsx(ic,{step:s}),e[35]=s,e[36]=r,e[37]=N):N=e[37];let T;e[38]!==s||e[39]!==r?(T=!r&&o.jsx(ac,{step:s}),e[38]=s,e[39]=r,e[40]=T):T=e[40];let E;return e[41]!==N||e[42]!==T||e[43]!==b||e[44]!==j||e[45]!==y||e[46]!==w?(E=o.jsxs("div",{className:b,children:[j,y,w,N,T]}),e[41]=N,e[42]=T,e[43]=b,e[44]=j,e[45]=y,e[46]=w,e[47]=E):E=e[47],E}function Xl(t){const e=C.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=U(),l=i??"";let c;e[0]!==l?(c=o.jsx(at,{icon:null,name:l,size:"xs",className:"shadow-sm"}),e[0]=l,e[1]=c):c=e[1];let a;e[2]!==i?(a=o.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:i}),e[2]=i,e[3]=a):a=e[3];let d;e[4]!==r?(d=r?null:o.jsx(Ql,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function Ql(){const t=C.c(9),e=Be(),{updateStep:n,startReplacingTool:s}=ee(),i=U(),l=e&&"toolName"in e.action?e.action.toolName:null;let c;t[0]!==e||t[1]!==s||t[2]!==l||t[3]!==i||t[4]!==n?(c=()=>{if(e){if(i){On.error("You cannot replace a tool while a workflow is executing.");return}l&&s(l),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=s,t[2]=l,t[3]=i,t[4]=n,t[5]=c):c=t[5];const a=c;let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ms,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:d}),t[7]=a,t[8]=u):u=t[8],u}function hn(t){const e=C.c(16),{org:n}=G(),s=Ke();let i;e[0]!==n.id||e[1]!==s?(i=s??Ve(n.id),e[0]=n.id,e[1]=s,e[2]=i):i=e[2];const r=i;let l;e[3]!==n.id||e[4]!==r?(l={connectionId:r,orgId:n.id},e[3]=n.id,e[4]=r,e[5]=l):l=e[5];const c=ne(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=nn(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(h=>h.name===t),e[8]=t,e[9]=d.data?.tools,e[10]=u):u=e[10];const f=u;let m;return e[11]!==f||e[12]!==d.error||e[13]!==d.isLoading||e[14]!==d.isSuccess?(m={tool:f,isLoading:d.isLoading,isReady:d.isSuccess,error:d.error},e[11]=f,e[12]=d.error,e[13]=d.isLoading,e[14]=d.isSuccess,e[15]=m):m=e[15],m}function Zl(t){const e=C.c(18),{step:n}=t,{updateStep:s}=ee(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=U(),{tool:c}=hn(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=v=>{s(n.name,{input:v})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==n.input||e[4]!==c.inputSchema||e[5]!==l?(u=l?Yl(c.inputSchema,n.input):c.inputSchema,e[3]=n.input,e[4]=c.inputSchema,e[5]=l,e[6]=u):u=e[6];const f=u,m=l?"output":"input";let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ql,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=h):h=e[7];const p=n.name+l,x=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let y;e[9]!==d||e[10]!==p||e[11]!==x||e[12]!==g||e[13]!==b?(y=o.jsxs(Bl,{value:"input",className:"border-b-0",children:[h,o.jsx(Kl,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:x,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=y):y=e[14];let S;return e[15]!==y||e[16]!==m?(S=o.jsx(Ul,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=m,e[17]=S):S=e[17],S}function Yl(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function ec(t){const e=C.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=U(),{item:a}=fe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=V=>V===n.name||V.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),h=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(V=>V.name===n.name)||f||h),[x,g]=k.useState(s),b=n.forEach!==void 0,[j,y]=k.useState("all"),S=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(V=>S.test(V.name)).map(V=>{const We=V.name.match(S);return{index:Number(We[1]),status:"success"}}):[],N=(b?d.filter(V=>S.test(V)):[]).map(V=>{const We=V.match(S);return{index:Number(We[1]),status:"error"}}),T=[...v,...N].sort(nc),E=T.length>0,$=b&&j!=="all"?`${n.name}[${j}]`:void 0,R=p?n.name:void 0,L=$??R,{output:I,error:A}=js(c,L);let W;e[2]!==A||e[3]!==r||e[4]!==i||e[5]!==I?(W=I||(A?{error:A}:i&&r?{error:r}:void 0),e[2]=A,e[3]=r,e[4]=i,e[5]=I,e[6]=W):W=e[6];const z=W,X=l&&typeof l=="object"?l.properties:void 0;let _;e[7]!==X?(_=X?Object.entries(X):[],e[7]=X,e[8]=_):_=e[8];const O=_,P=j!=="all"&&N.some(V=>V.index===j),Q=j==="all"?i||f||h:P,Z=x?"flex-1 min-h-0 overflow-hidden":"shrink-0";let F;e[9]!==Z?(F=M("flex flex-col border-b border-border",Z),e[9]=Z,e[10]=F):F=e[10];let K;e[11]!==x||e[12]!==g?(K=()=>g(!x),e[11]=x,e[12]=g,e[13]=K):K=e[13];const B=Q?"text-destructive":"text-muted-foreground";let H;e[14]!==B?(H=M("text-sm font-medium",B),e[14]=B,e[15]=H):H=e[15];const J=Q?"Error":"Output";let ie;e[16]!==H||e[17]!==J?(ie=o.jsx("h3",{className:H,children:J}),e[16]=H,e[17]=J,e[18]=ie):ie=e[18];let le;e[19]!==x?(le=x?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"}),e[19]=x,e[20]=le):le=e[20];let se;e[21]!==ie||e[22]!==le?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,le]}),e[21]=ie,e[22]=le,e[23]=se):se=e[23];let ce;e[24]!==se||e[25]!==K?(ce=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:K,children:se}),e[24]=se,e[25]=K,e[26]=ce):ce=e[26];let oe;e[27]!==T||e[28]!==z||e[29]!==E||e[30]!==b||e[31]!==x||e[32]!==O||e[33]!==j||e[34]!==y||e[35]!==n.name||e[36]!==c?(oe=x&&o.jsxs(o.Fragment,{children:[c&&b&&E&&o.jsx(sc,{iterations:T,selectedIteration:j,onSelect:y}),c&&z?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:JSON.stringify(z,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&O.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:O.map(tc)})]}),e[27]=T,e[28]=z,e[29]=E,e[30]=b,e[31]=x,e[32]=O,e[33]=j,e[34]=y,e[35]=n.name,e[36]=c,e[37]=oe):oe=e[37];let ae;return e[38]!==ce||e[39]!==oe||e[40]!==F?(ae=o.jsxs("div",{className:F,children:[ce,oe]}),e[38]=ce,e[39]=oe,e[40]=F,e[41]=ae):ae=e[41],ae}function tc(t){const[e,n]=t;return o.jsx(rc,{name:e,schema:n},e)}function nc(t,e){return t.index-e.index}function sc(t){const e=C.c(21),{iterations:n,selectedIteration:s,onSelect:i}=t,r=s==="all"?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground";let l;e[0]!==r?(l=M("h-7 px-3 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",r),e[0]=r,e[1]=l):l=e[1];let c;e[2]!==i?(c=()=>i("all"),e[2]=i,e[3]=c):c=e[3];let a;e[4]!==l||e[5]!==c?(a=o.jsx("button",{type:"button",className:l,onClick:c,children:"All Results"}),e[4]=l,e[5]=c,e[6]=a):a=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e[7]=d):d=e[7];let u;if(e[8]!==n||e[9]!==i||e[10]!==s){let p;e[12]!==i||e[13]!==s?(p=x=>{const g=s===x.index;return o.jsxs("button",{type:"button",className:M("h-7 px-2.5 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",g?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(x.index),children:[x.status==="success"?o.jsx(ut,{size:12,className:"text-success"}):o.jsx(ct,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",x.index]})]},x.index)},e[12]=i,e[13]=s,e[14]=p):p=e[14],u=n.map(p),e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];let f;e[15]!==a||e[16]!==u?(f=o.jsxs("div",{className:"flex w-max items-center gap-2 pb-3",children:[a,d,u]}),e[15]=a,e[16]=u,e[17]=f):f=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($o,{orientation:"horizontal"}),e[18]=m):m=e[18];let h;return e[19]!==f?(h=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(Oo,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=h):h=e[20],h}function oc(t){switch(t){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function rc(t){const e=C.c(28),{name:n,schema:s}=t,i=Be(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:S,color:v}=oc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=S,c=14,a=M(v),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=u}else l=e[1],c=e[2],a=e[3],d=e[4],u=e[5];let f;e[6]!==l||e[7]!==c||e[8]!==a?(f=o.jsx(l,{size:c,className:a}),e[6]=l,e[7]=c,e[8]=a,e[9]=f):f=e[9];let m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let h;e[12]!==d||e[13]!==f||e[14]!==m?(h=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ds,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const x=i?.name;let g;e[17]!==x?(g=o.jsxs("span",{className:"text-muted-foreground",children:[x,"."]}),e[17]=x,e[18]=g):g=e[18];let b;e[19]!==n?(b=o.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=b):b=e[20];let j;e[21]!==g||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let y;return e[24]!==j||e[25]!==u||e[26]!==h?(y=o.jsxs("div",{className:u,children:[h,j]}),e[24]=j,e[25]=u,e[26]=h,e[27]=y):y=e[27],y}function ic(t){const e=C.c(29),{step:n}=t,{updateStep:s}=ee(),i=U(),[r,l]=k.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=hn(a??""),u=c&&"transformCode"in n.action?n.action.transformCode??null:null;let f;e[0]!==d?(f=()=>{if(!d?.outputSchema)return`interface Input {
8
8
  // Tool output schema not available
9
9
  }`;const T=d.outputSchema,E=T.properties;return E?`interface Input {
10
10
  ${Object.entries(E).map(R=>{const[L,I]=R,A=Qe(I),W=!T.required?.includes(L);return` ${L}${W?"?":""}: ${A};`}).join(`
@@ -23,4 +23,4 @@ export default async function(input: Input): Promise<Output> {
23
23
  return {
24
24
  result: input,
25
25
  };
26
- }`;s(n.name,{action:{...n.action,transformCode:E}}),l(lc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=h):h=e[6];const p=h;let x;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(x=(T,E)=>{s(n.name,{action:{...n.action,transformCode:T},...E?{outputSchema:E}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=x):x=e[10];const g=x;if("code"in n.action&&n.action.code)return null;const b=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[11]!==b?(j=M("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let S;e[14]!==r?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=S):S=e[15];let v;e[16]!==S||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:S}),e[16]=S,e[17]=p,e[18]=v):v=e[18];let w;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(w=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:u,language:"typescript",readOnly:i!==void 0,onSave:g,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=g,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=w):w=e[24];let N;return e[25]!==j||e[26]!==v||e[27]!==w?(N=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=N):N=e[28],N}function lc(t){return!t}function cc(t){return!t}function ac(t){const e=C.c(24),{step:n}=t,[s,i]=k.useState(!1),{updateStep:r}=ee(),l="code"in n.action&&n.action.code?n.action.code:null,c=U();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=M("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[h,s?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let x;e[11]!==m||e[12]!==p?(x=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(g=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{onSave:(j,y)=>d(j,y),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==x||e[22]!==g?(b=o.jsxs("div",{className:f,children:[x,g]}),e[20]=f,e[21]=x,e[22]=g,e[23]=b):b=e[23],b}function Qe(t){if(Array.isArray(t.type))return t.type.map(n=>Qe({...t,type:n})).join(" | ");switch(t.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return t.items?`${Qe(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Qe(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function dc(t){switch(t){case"success":return o.jsxs(me,{variant:"success",className:"gap-1",children:[o.jsx(ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(me,{variant:"destructive",className:"gap-1",children:[o.jsx(Qn,{size:11}),"Error"]});case"running":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),"Running"]});case"enqueued":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),"On hold"]});case"cancelled":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Yn,{size:11}),"Cancelled"]});default:return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),t]})}}function uc(t){return`Run #${t.slice(-4).toUpperCase()}`}function fc(t){const e=C.c(21),{className:n}=t,{executions:s,isLoading:i}=Qr(),{setShowExecutionsList:r}=dn(),{setTrackingExecutionId:l}=ee(),c=U();let a;e[0]!==l?(a=y=>{l(y)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=M("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Yn,{size:11}),e[7]=p):p=e[7];let x;e[8]!==f?(x=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=x):x=e[9];let g;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(g=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((y,S)=>o.jsx(mc,{execution:y,isSelected:y.id===c,isFirst:S===0,onSelect:()=>d(y.id)},y.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==x||e[19]!==b?(j=o.jsxs("div",{className:m,children:[x,b]}),e[17]=m,e[18]=x,e[19]=b,e[20]=j):j=e[20],j}function mc(t){const e=C.c(17),{execution:n,isSelected:s,isFirst:i,onSelect:r}=t,l=s&&"bg-accent/50",c=i&&s&&"bg-accent/50",a=!s&&"hover:bg-accent/30";let d;e[0]!==l||e[1]!==c||e[2]!==a?(d=M("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",l,c,a),e[0]=l,e[1]=c,e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n.status?(u=dc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=uc(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==h?(p=o.jsx("div",{className:d,onClick:r,children:h}),e[13]=r,e[14]=d,e[15]=h,e[16]=p):p=e[16],p}const Ze=new Map,pc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],zt=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],xc=500;function hc(t){for(const e of t.queryClients)e.invalidateQueries({predicate:n=>n.queryKey.some(s=>typeof s=="string"&&pc.includes(s))})}function gc(t){t.debounceTimer===null&&(t.debounceTimer=setTimeout(()=>{t.debounceTimer=null,hc(t)},xc))}function bc(t){let e=Ze.get(t);if(!e){const n=`/org/${t}/watch?types=workflow.*`,s=new EventSource(n);e={es:s,refCount:0,queryClients:new Set,debounceTimer:null},Ze.set(t,e);const i=()=>gc(e);for(const r of zt)s.addEventListener(r,i);s.onerror=()=>{s.readyState===EventSource.CLOSED&&(e.debounceTimer!==null&&clearTimeout(e.debounceTimer),Ze.delete(t))}}return e}const $n=()=>0;function jc(){const t=C.c(3),{org:e}=G(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{const c=bc(s);c.refCount=c.refCount+1,c.queryClients.add(n);const a=()=>l();for(const d of zt)c.es.addEventListener(d,a);return()=>{for(const d of zt)c.es.removeEventListener(d,a);c.queryClients.delete(n),c.refCount=c.refCount-1,c.refCount<=0&&(c.debounceTimer!==null&&clearTimeout(c.debounceTimer),c.es.close(),Ze.delete(s))}},t[0]=s,t[1]=n,t[2]=i):i=t[2];const r=i;k.useSyncExternalStore(r,$n,$n)}function qs(t){const e=C.c(11),{itemId:n}=t,[s,i]=k.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=pe(r),c=l??"no-connection",{org:a}=G(),d=l??null;let u;e[1]!==a.id||e[2]!==d?(u={connectionId:d,orgId:a.id},e[1]=a.id,e[2]=d,e[3]=u):u=e[3];const f=ne(u),m=Ut(c,"WORKFLOW",n,f),h=Bt(c,"WORKFLOW",f);let p;e[4]!==h||e[5]!==n?(p=async b=>{i(!0),await h.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=h,e[5]=n,e[6]=p):p=e[6];const x=p;let g;return e[7]!==s||e[8]!==m||e[9]!==x?(g={item:m,update:x,isUpdating:s},e[7]=s,e[8]=m,e[9]=x,e[10]=g):g=e[10],g}function vc(t){const e=C.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ee();let r,l,c,a;if(e[0]!==n.description||e[1]!==n.id||e[2]!==n.steps||e[3]!==n.title){const f={title:n.title,description:n.description,steps:n.steps};r=Le,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function yc(){const t=C.c(9),e=U(),{item:n}=fe(e),s=n?.start_at_epoch_ms,i=n?.completed_at_epoch_ms,r=n?.status==="running"&&s&&!i;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=Date.now(),t[0]=l):l=t[0];const c=k.useRef(l);let a;t[1]!==r?(a=x=>{if(!r)return Sc;const g=setInterval(()=>{c.current=Date.now(),x()},50);return()=>clearInterval(g)},t[1]=r,t[2]=a):a=t[2];const d=a;let u;t[3]!==r?(u=()=>r?c.current:0,t[3]=r,t[4]=u):u=t[4];const f=u,m=k.useSyncExternalStore(d,f,f),h=i&&s?Math.max(0,i-s):null;let p=null;if(s){let x;t[5]!==s?(x=new Date(s).getTime(),t[5]=s,t[6]=x):x=t[6];const g=x;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],p=Math.max(0,b-g)}else r&&(p=Math.max(0,m-g))}return p??h}function Sc(){}function wc(t){if(t<1e3)return`${t}ms`;const e=t/1e3,n=e%60,s=Math.floor(e/60),i=s%60,r=Math.floor(s/60);return r>0?`${r}h ${i}m ${n.toFixed(3)}s`:i>0?`${i}m ${n.toFixed(3)}s`:`${n.toFixed(3)}s`}function Nc(){const t=C.c(26),{setTrackingExecutionId:e}=ee(),n=U(),{item:s}=fe(n),i=yc();let r;t[0]!==i?(r=i!=null?wc(i):null,t[0]=i,t[1]=r):r=t[1];const l=r,c=s?.status,a=c==="error"||c==="failed",d=c==="success";let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(ho,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=u):u=t[2];let f;t[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=f):f=t[3];let m;t[4]!==n?(m=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[f,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=m):m=t[5];let h;t[6]!==d?(h=d&&o.jsxs(me,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=h):h=t[7];let p;t[8]!==a?(p=a&&o.jsxs(me,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(mr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(dr,{className:"w-4 h-4 text-muted-foreground"}),t[10]=x):x=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[x,o.jsx("span",{className:"text-sm text-muted-foreground",children:l})]}),t[11]=l,t[12]=g):g=t[12];let b;t[13]!==m||t[14]!==h||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,h,p,g]}),t[13]=m,t[14]=h,t[15]=p,t[16]=g,t[17]=b):b=t[17];let j;t[18]!==e?(j=()=>e(void 0),t[18]=e,t[19]=j):j=t[19];let y;t[20]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Vt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=y):y=t[20];let S;t[21]!==j?(S=o.jsx(Y,{variant:"ghost",size:"xs",onClick:j,children:y}),t[21]=j,t[22]=S):S=t[22];let v;return t[23]!==S||t[24]!==b?(v=o.jsx("div",{className:"flex flex-col border-b border-border",children:o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between",children:[b,S]})}),t[23]=S,t[24]=b,t[25]=v):v=t[25],v}function Cc(){const t=C.c(15);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i,update:r,isUpdating:l}=qs(s);let c;t[3]!==i?(c=JSON.stringify(i),t[3]=i,t[4]=c):c=t[4];const a=c;if(!i){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow not found",description:"This workflow may have been deleted or you may not have access to it."})})}),t[5]=m):m=t[5],m}let d;t[6]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},t[6]=i,t[7]=d):d=t[7];let u;t[8]!==l||t[9]!==r?(u=o.jsx(kc,{onUpdate:r,isUpdating:l}),t[8]=l,t[9]=r,t[10]=u):u=t[10];let f;return t[11]!==a||t[12]!==d||t[13]!==u?(f=o.jsx(Wr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function kc(t){const e=C.c(21),{onUpdate:n,isUpdating:s}=t;jc();const i=De(),r=U(),{viewMode:l,showExecutionsList:c}=dn(),a=Be();let d;e[0]!==n||e[1]!==i?(d=async()=>{await n(i)},e[0]=n,e[1]=i,e[2]=d):d=e[2];const u=d,f=a&&"toolName"in a.action,m=f?a.action.toolName:null,h=f&&!m&&!r,p=!h&&(a||r||!c);let x;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(x=o.jsx(sl,{title:i.title,description:i.description,onSave:u,isSaving:s}),e[3]=u,e[4]=s,e[5]=i.description,e[6]=i.title,e[7]=x):x=e[7];let g;e[8]!==r?(g=r&&o.jsx(Nc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==h||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(vc,{workflow:i,onUpdate:n}):o.jsxs(Ao,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx(Sl,{})}),o.jsx(Mo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[h&&o.jsx(Cl,{className:"border-l border-border"}),c&&o.jsx(fc,{}),p&&o.jsx(Gl,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=h,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==x||e[18]!==g||e[19]!==b?(j=o.jsx(he,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[x,g,b]})}),e[17]=x,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Ic(t){const e=C.c(6),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=pe(s),r=i??"no-connection",{org:l}=G(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=ne(a),u=Ut(r,"WORKFLOW_EXECUTION",n,d);let f;return e[4]!==u?(f={item:u},e[4]=u,e[5]=f):f=e[5],f}function _c(){const t=C.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Ic(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow execution not found",description:"This workflow execution may have been deleted or you may not have access to it."})})}),t[3]=c):c=t[3],c}let r;t[4]!==i?(r=JSON.stringify(i,null,2),t[4]=i,t[5]=r):r=t[5];let l;return t[6]!==r?(l=o.jsx(he,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Le,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const Tc={workflow:Cc,workflow_execution:_c,prompt:vr};function Ec(){const t=C.c(6),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=decodeURIComponent(s.itemId);let r;t[1]!==e.history?(r=()=>{e.history.back()},t[1]=e.history,t[2]=r):r=t[2];const l=r,c=$c;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Ir,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function $c(t){return Promise.resolve()}function Oc(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Rc(){const t=C.c(38),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=s.connectionId,r=decodeURIComponent(s.collectionName),l=decodeURIComponent(s.itemId);let c;t[1]!==e.history?(c=()=>{e.history.back()},t[1]=e.history,t[2]=c):c=t[2];const a=c,d=i??"no-connection",{org:u}=G(),f=lt(i),m=i??null;let h;t[3]!==u.id||t[4]!==m?(h={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=h):h=t[5];const p=ne(h),x=Bt(d,r,p);let g;t[6]!==x||t[7]!==l?(g=async z=>{l&&await x.update.mutateAsync({id:l,data:z})},t[6]=x,t[7]=l,t[8]=g):g=t[8];const b=g;let j;t[9]!==r?(j=r?.toLowerCase(),t[9]=r,t[10]=j):j=t[10];const y=j,S=y&&Tc[y];let v;t[11]!==r?(v=Oc(r),t[11]=r,t[12]=v):v=t[12];const w=v;let N;t[13]!==u.slug?(N=o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:u.slug,project:et},children:"Connections"})})}),t[13]=u.slug,t[14]=N):N=t[14];let T;t[15]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(st,{}),t[15]=T):T=t[15];let E;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(E=f&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:et,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(st,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=E):E=t[20];let $;t[21]!==w?($=o.jsx(Pe,{children:o.jsx(Jn,{children:w})}),t[21]=w,t[22]=$):$=t[22];let R;t[23]!==$||t[24]!==N||t[25]!==E?(R=o.jsx(qn,{children:o.jsxs(Kn,{children:[N,T,E,$]})}),t[23]=$,t[24]=N,t[25]=E,t[26]=R):R=t[26];const L=R;if(S){let z;return t[27]!==S||t[28]!==a||t[29]!==b||t[30]!==l?(z=o.jsx(S,{itemId:l,onBack:a,onUpdate:b}),t[27]=S,t[28]=a,t[29]=b,t[30]=l,t[31]=z):z=t[31],z}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ro,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let A;t[33]!==a?(A=o.jsx(rn,{icon:I,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[33]=a,t[34]=A):A=t[34];let W;return t[35]!==L||t[36]!==A?(W=o.jsx(he,{breadcrumb:L,children:A}),t[35]=L,t[36]=A,t[37]=W):W=t[37],W}function Ac(){const t=C.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=pe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Ec,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Rc,{}),t[2]=r):r=t[2],r}function Cd(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(He,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Ac,{})})}),t[0]=e):e=t[0],e}export{Cd as default};
26
+ }`;s(n.name,{action:{...n.action,transformCode:E}}),l(lc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=h):h=e[6];const p=h;let x;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(x=(T,E)=>{s(n.name,{action:{...n.action,transformCode:T},...E?{outputSchema:E}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=x):x=e[10];const g=x;if("code"in n.action&&n.action.code)return null;const b=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[11]!==b?(j=M("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let S;e[14]!==r?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=S):S=e[15];let v;e[16]!==S||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:S}),e[16]=S,e[17]=p,e[18]=v):v=e[18];let w;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(w=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:u,language:"typescript",readOnly:i!==void 0,onSave:g,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=g,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=w):w=e[24];let N;return e[25]!==j||e[26]!==v||e[27]!==w?(N=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=N):N=e[28],N}function lc(t){return!t}function cc(t){return!t}function ac(t){const e=C.c(24),{step:n}=t,[s,i]=k.useState(!1),{updateStep:r}=ee(),l="code"in n.action&&n.action.code?n.action.code:null,c=U();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=M("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[h,s?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let x;e[11]!==m||e[12]!==p?(x=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(g=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{onSave:(j,y)=>d(j,y),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==x||e[22]!==g?(b=o.jsxs("div",{className:f,children:[x,g]}),e[20]=f,e[21]=x,e[22]=g,e[23]=b):b=e[23],b}function Qe(t){if(Array.isArray(t.type))return t.type.map(n=>Qe({...t,type:n})).join(" | ");switch(t.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return t.items?`${Qe(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Qe(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function dc(t){switch(t){case"success":return o.jsxs(me,{variant:"success",className:"gap-1",children:[o.jsx(ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(me,{variant:"destructive",className:"gap-1",children:[o.jsx(Zn,{size:11}),"Error"]});case"running":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),"Running"]});case"enqueued":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),"On hold"]});case"cancelled":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(qn,{size:11}),"Cancelled"]});default:return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Xe,{size:11}),t]})}}function uc(t){return`Run #${t.slice(-4).toUpperCase()}`}function fc(t){const e=C.c(21),{className:n}=t,{executions:s,isLoading:i}=Qr(),{setShowExecutionsList:r}=dn(),{setTrackingExecutionId:l}=ee(),c=U();let a;e[0]!==l?(a=y=>{l(y)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=M("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(qn,{size:11}),e[7]=p):p=e[7];let x;e[8]!==f?(x=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=x):x=e[9];let g;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(g=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((y,S)=>o.jsx(mc,{execution:y,isSelected:y.id===c,isFirst:S===0,onSelect:()=>d(y.id)},y.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==x||e[19]!==b?(j=o.jsxs("div",{className:m,children:[x,b]}),e[17]=m,e[18]=x,e[19]=b,e[20]=j):j=e[20],j}function mc(t){const e=C.c(17),{execution:n,isSelected:s,isFirst:i,onSelect:r}=t,l=s&&"bg-accent/50",c=i&&s&&"bg-accent/50",a=!s&&"hover:bg-accent/30";let d;e[0]!==l||e[1]!==c||e[2]!==a?(d=M("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",l,c,a),e[0]=l,e[1]=c,e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n.status?(u=dc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=uc(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==h?(p=o.jsx("div",{className:d,onClick:r,children:h}),e[13]=r,e[14]=d,e[15]=h,e[16]=p):p=e[16],p}const Ze=new Map,pc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],zt=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],xc=500;function hc(t){for(const e of t.queryClients)e.invalidateQueries({predicate:n=>n.queryKey.some(s=>typeof s=="string"&&pc.includes(s))})}function gc(t){t.debounceTimer===null&&(t.debounceTimer=setTimeout(()=>{t.debounceTimer=null,hc(t)},xc))}function bc(t){let e=Ze.get(t);if(!e){const n=`/org/${t}/watch?types=workflow.*`,s=new EventSource(n);e={es:s,refCount:0,queryClients:new Set,debounceTimer:null},Ze.set(t,e);const i=()=>gc(e);for(const r of zt)s.addEventListener(r,i);s.onerror=()=>{s.readyState===EventSource.CLOSED&&(e.debounceTimer!==null&&clearTimeout(e.debounceTimer),Ze.delete(t))}}return e}const $n=()=>0;function jc(){const t=C.c(3),{org:e}=G(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{const c=bc(s);c.refCount=c.refCount+1,c.queryClients.add(n);const a=()=>l();for(const d of zt)c.es.addEventListener(d,a);return()=>{for(const d of zt)c.es.removeEventListener(d,a);c.queryClients.delete(n),c.refCount=c.refCount-1,c.refCount<=0&&(c.debounceTimer!==null&&clearTimeout(c.debounceTimer),c.es.close(),Ze.delete(s))}},t[0]=s,t[1]=n,t[2]=i):i=t[2];const r=i;k.useSyncExternalStore(r,$n,$n)}function qs(t){const e=C.c(11),{itemId:n}=t,[s,i]=k.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=pe(r),c=l??"no-connection",{org:a}=G(),d=l??null;let u;e[1]!==a.id||e[2]!==d?(u={connectionId:d,orgId:a.id},e[1]=a.id,e[2]=d,e[3]=u):u=e[3];const f=ne(u),m=Ut(c,"WORKFLOW",n,f),h=Bt(c,"WORKFLOW",f);let p;e[4]!==h||e[5]!==n?(p=async b=>{i(!0),await h.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=h,e[5]=n,e[6]=p):p=e[6];const x=p;let g;return e[7]!==s||e[8]!==m||e[9]!==x?(g={item:m,update:x,isUpdating:s},e[7]=s,e[8]=m,e[9]=x,e[10]=g):g=e[10],g}function vc(t){const e=C.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ee();let r,l,c,a;if(e[0]!==n.description||e[1]!==n.id||e[2]!==n.steps||e[3]!==n.title){const f={title:n.title,description:n.description,steps:n.steps};r=Le,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function yc(){const t=C.c(9),e=U(),{item:n}=fe(e),s=n?.start_at_epoch_ms,i=n?.completed_at_epoch_ms,r=n?.status==="running"&&s&&!i;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=Date.now(),t[0]=l):l=t[0];const c=k.useRef(l);let a;t[1]!==r?(a=x=>{if(!r)return Sc;const g=setInterval(()=>{c.current=Date.now(),x()},50);return()=>clearInterval(g)},t[1]=r,t[2]=a):a=t[2];const d=a;let u;t[3]!==r?(u=()=>r?c.current:0,t[3]=r,t[4]=u):u=t[4];const f=u,m=k.useSyncExternalStore(d,f,f),h=i&&s?Math.max(0,i-s):null;let p=null;if(s){let x;t[5]!==s?(x=new Date(s).getTime(),t[5]=s,t[6]=x):x=t[6];const g=x;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],p=Math.max(0,b-g)}else r&&(p=Math.max(0,m-g))}return p??h}function Sc(){}function wc(t){if(t<1e3)return`${t}ms`;const e=t/1e3,n=e%60,s=Math.floor(e/60),i=s%60,r=Math.floor(s/60);return r>0?`${r}h ${i}m ${n.toFixed(3)}s`:i>0?`${i}m ${n.toFixed(3)}s`:`${n.toFixed(3)}s`}function Nc(){const t=C.c(26),{setTrackingExecutionId:e}=ee(),n=U(),{item:s}=fe(n),i=yc();let r;t[0]!==i?(r=i!=null?wc(i):null,t[0]=i,t[1]=r):r=t[1];const l=r,c=s?.status,a=c==="error"||c==="failed",d=c==="success";let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(ho,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=u):u=t[2];let f;t[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=f):f=t[3];let m;t[4]!==n?(m=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[f,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=m):m=t[5];let h;t[6]!==d?(h=d&&o.jsxs(me,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=h):h=t[7];let p;t[8]!==a?(p=a&&o.jsxs(me,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(mr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(dr,{className:"w-4 h-4 text-muted-foreground"}),t[10]=x):x=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[x,o.jsx("span",{className:"text-sm text-muted-foreground",children:l})]}),t[11]=l,t[12]=g):g=t[12];let b;t[13]!==m||t[14]!==h||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,h,p,g]}),t[13]=m,t[14]=h,t[15]=p,t[16]=g,t[17]=b):b=t[17];let j;t[18]!==e?(j=()=>e(void 0),t[18]=e,t[19]=j):j=t[19];let y;t[20]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Vt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=y):y=t[20];let S;t[21]!==j?(S=o.jsx(Y,{variant:"ghost",size:"xs",onClick:j,children:y}),t[21]=j,t[22]=S):S=t[22];let v;return t[23]!==S||t[24]!==b?(v=o.jsx("div",{className:"flex flex-col border-b border-border",children:o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between",children:[b,S]})}),t[23]=S,t[24]=b,t[25]=v):v=t[25],v}function Cc(){const t=C.c(15);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i,update:r,isUpdating:l}=qs(s);let c;t[3]!==i?(c=JSON.stringify(i),t[3]=i,t[4]=c):c=t[4];const a=c;if(!i){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow not found",description:"This workflow may have been deleted or you may not have access to it."})})}),t[5]=m):m=t[5],m}let d;t[6]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},t[6]=i,t[7]=d):d=t[7];let u;t[8]!==l||t[9]!==r?(u=o.jsx(kc,{onUpdate:r,isUpdating:l}),t[8]=l,t[9]=r,t[10]=u):u=t[10];let f;return t[11]!==a||t[12]!==d||t[13]!==u?(f=o.jsx(Wr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function kc(t){const e=C.c(21),{onUpdate:n,isUpdating:s}=t;jc();const i=De(),r=U(),{viewMode:l,showExecutionsList:c}=dn(),a=Be();let d;e[0]!==n||e[1]!==i?(d=async()=>{await n(i)},e[0]=n,e[1]=i,e[2]=d):d=e[2];const u=d,f=a&&"toolName"in a.action,m=f?a.action.toolName:null,h=f&&!m&&!r,p=!h&&(a||r||!c);let x;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(x=o.jsx(sl,{title:i.title,description:i.description,onSave:u,isSaving:s}),e[3]=u,e[4]=s,e[5]=i.description,e[6]=i.title,e[7]=x):x=e[7];let g;e[8]!==r?(g=r&&o.jsx(Nc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==h||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(vc,{workflow:i,onUpdate:n}):o.jsxs(Ao,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx(Sl,{})}),o.jsx(Mo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[h&&o.jsx(Cl,{className:"border-l border-border"}),c&&o.jsx(fc,{}),p&&o.jsx(Gl,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=h,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==x||e[18]!==g||e[19]!==b?(j=o.jsx(he,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[x,g,b]})}),e[17]=x,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Ic(t){const e=C.c(6),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=pe(s),r=i??"no-connection",{org:l}=G(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=ne(a),u=Ut(r,"WORKFLOW_EXECUTION",n,d);let f;return e[4]!==u?(f={item:u},e[4]=u,e[5]=f):f=e[5],f}function _c(){const t=C.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Ic(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow execution not found",description:"This workflow execution may have been deleted or you may not have access to it."})})}),t[3]=c):c=t[3],c}let r;t[4]!==i?(r=JSON.stringify(i,null,2),t[4]=i,t[5]=r):r=t[5];let l;return t[6]!==r?(l=o.jsx(he,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Le,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const Tc={workflow:Cc,workflow_execution:_c,prompt:vr};function Ec(){const t=C.c(6),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=decodeURIComponent(s.itemId);let r;t[1]!==e.history?(r=()=>{e.history.back()},t[1]=e.history,t[2]=r):r=t[2];const l=r,c=$c;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Ir,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function $c(t){return Promise.resolve()}function Oc(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Rc(){const t=C.c(38),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=s.connectionId,r=decodeURIComponent(s.collectionName),l=decodeURIComponent(s.itemId);let c;t[1]!==e.history?(c=()=>{e.history.back()},t[1]=e.history,t[2]=c):c=t[2];const a=c,d=i??"no-connection",{org:u}=G(),f=lt(i),m=i??null;let h;t[3]!==u.id||t[4]!==m?(h={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=h):h=t[5];const p=ne(h),x=Bt(d,r,p);let g;t[6]!==x||t[7]!==l?(g=async z=>{l&&await x.update.mutateAsync({id:l,data:z})},t[6]=x,t[7]=l,t[8]=g):g=t[8];const b=g;let j;t[9]!==r?(j=r?.toLowerCase(),t[9]=r,t[10]=j):j=t[10];const y=j,S=y&&Tc[y];let v;t[11]!==r?(v=Oc(r),t[11]=r,t[12]=v):v=t[12];const w=v;let N;t[13]!==u.slug?(N=o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps",params:{org:u.slug,project:et},children:"Connections"})})}),t[13]=u.slug,t[14]=N):N=t[14];let T;t[15]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(st,{}),t[15]=T):T=t[15];let E;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(E=f&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(nt,{asChild:!0,children:o.jsx(Ye,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:et,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(st,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=E):E=t[20];let $;t[21]!==w?($=o.jsx(Pe,{children:o.jsx(Gn,{children:w})}),t[21]=w,t[22]=$):$=t[22];let R;t[23]!==$||t[24]!==N||t[25]!==E?(R=o.jsx(Kn,{children:o.jsxs(Jn,{children:[N,T,E,$]})}),t[23]=$,t[24]=N,t[25]=E,t[26]=R):R=t[26];const L=R;if(S){let z;return t[27]!==S||t[28]!==a||t[29]!==b||t[30]!==l?(z=o.jsx(S,{itemId:l,onBack:a,onUpdate:b}),t[27]=S,t[28]=a,t[29]=b,t[30]=l,t[31]=z):z=t[31],z}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ro,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let A;t[33]!==a?(A=o.jsx(rn,{icon:I,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[33]=a,t[34]=A):A=t[34];let W;return t[35]!==L||t[36]!==A?(W=o.jsx(he,{breadcrumb:L,children:A}),t[35]=L,t[36]=A,t[37]=W):W=t[37],W}function Ac(){const t=C.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=pe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Ec,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Rc,{}),t[2]=r):r=t[2],r}function Nd(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(He,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Ac,{})})}),t[0]=e):e=t[0],e}export{Nd as default};