decocms 2.175.0 → 2.175.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/dist/client/assets/{AlertCircle-5ZbLDi3s.js → AlertCircle-CnfwZdxb.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-D4ghzTQG.js → AlignLeft-zj1VrWVO.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-B5WC3D5H.js → ArrowDown-BnnQhLmg.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-D0Lalw4x.js → ArrowLeft-C3_bzjZf.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-tKKJvEkq.js → ArrowUp-BuKX1RSZ.js} +1 -1
  6. package/dist/client/assets/{Check-CuWDIJeM.js → Check-7kB05ju_.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-wz1RfkCA.js → CheckCircle-DrGaevdP.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-UsIketHR.js → CheckDone01-CVJEgdwq.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-cu3amtx9.js → CheckVerified02-DmV5dzDn.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-D0TXudCx.js → ChevronDown-DHeagNGb.js} +1 -1
  11. package/dist/client/assets/{ChevronLeft-BZsszCLQ.js → ChevronLeft-W2gkpjgL.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-UJRwW9xN.js → ChevronRight-Blv21S_7.js} +1 -1
  13. package/dist/client/assets/{ChevronUp-DXMXl76b.js → ChevronUp-J7upZD3-.js} +1 -1
  14. package/dist/client/assets/{Clock-DKQ7EGj-.js → Clock-9Mm0U0Dg.js} +1 -1
  15. package/dist/client/assets/{Code01-DZzuHJh9.js → Code01-DDbKsccR.js} +1 -1
  16. package/dist/client/assets/{Coins01-DWo6Ypxq.js → Coins01-DTz6uYyF.js} +1 -1
  17. package/dist/client/assets/{Container-YdffBHg3.js → Container-Ci_1Xm4L.js} +1 -1
  18. package/dist/client/assets/{Copy01-CPHBT83w.js → Copy01-BexEalI-.js} +1 -1
  19. package/dist/client/assets/{Dataflow03-CUuQJ-m_.js → Dataflow03-CKfLDuKw.js} +1 -1
  20. package/dist/client/assets/{DotsHorizontal-DUoeCjzn.js → DotsHorizontal-3xIvFzgk.js} +1 -1
  21. package/dist/client/assets/{DotsVertical-BaBvJOuP.js → DotsVertical-7N_NB6wt.js} +1 -1
  22. package/dist/client/assets/{Download01-D5-Ilwwi.js → Download01-D-oC1d8d.js} +1 -1
  23. package/dist/client/assets/{Edit01-Dpq6F4lk.js → Edit01-gYPHsLoC.js} +1 -1
  24. package/dist/client/assets/{Edit05-h0OeCHXT.js → Edit05-BA2Lz_6R.js} +1 -1
  25. package/dist/client/assets/{Eye-DDwMVcxZ.js → Eye-Cn6YseXl.js} +1 -1
  26. package/dist/client/assets/{EyeOff-D8njwIM7.js → EyeOff-L-SLicw9.js} +1 -1
  27. package/dist/client/assets/{File02-Bc8tH3v5.js → File02-Dx1Iz50W.js} +1 -1
  28. package/dist/client/assets/{File06-ZV5CfSHG.js → File06-Dqc-K1-5.js} +1 -1
  29. package/dist/client/assets/{FilterLines-aqS8nu95.js → FilterLines-DCrzLWfV.js} +1 -1
  30. package/dist/client/assets/{Globe01-BdWDm7Ni.js → Globe01-DW2rHI0i.js} +1 -1
  31. package/dist/client/assets/{Globe02-Cn3qFriL.js → Globe02-CyGtzZ8k.js} +1 -1
  32. package/dist/client/assets/{Grid01-Gq7hBl7S.js → Grid01-Dqz--q3o.js} +1 -1
  33. package/dist/client/assets/{Hash02-CmJ0Y9N4.js → Hash02-pqCZ_ykD.js} +1 -1
  34. package/dist/client/assets/{Home02-Dz88FEOV.js → Home02-D2W6xjpZ.js} +1 -1
  35. package/dist/client/assets/{Image01-DBWShOGl.js → Image01-U7ZIAIPc.js} +1 -1
  36. package/dist/client/assets/{Inbox01-CJphqD3y.js → Inbox01-DpRIO4ZY.js} +1 -1
  37. package/dist/client/assets/{InfoCircle-uEl5PLW5.js → InfoCircle-CvSmMU6H.js} +1 -1
  38. package/dist/client/assets/{Key01-IptFTL_3.js → Key01-Dq5b7fdA.js} +1 -1
  39. package/dist/client/assets/{LayersTwo01-B5fVqAUB.js → LayersTwo01-Li6JqY2K.js} +1 -1
  40. package/dist/client/assets/{LayoutLeft-B8-msEGR.js → LayoutLeft-BAk65lFq.js} +1 -1
  41. package/dist/client/assets/{Link01-BpjSsBky.js → Link01-NJWLnzFs.js} +1 -1
  42. package/dist/client/assets/{LinkExternal01-B21lACin.js → LinkExternal01-B8e_Oa3I.js} +1 -1
  43. package/dist/client/assets/{List-ySIwqood.js → List-Cc_Ri6eQ.js} +1 -1
  44. package/dist/client/assets/{Loading01-WTkiPysv.js → Loading01-Cbk1oNZ2.js} +1 -1
  45. package/dist/client/assets/{Lock01-DqO9uSP7.js → Lock01-dP10fLup.js} +1 -1
  46. package/dist/client/assets/{Play-D72BHSXn.js → Play-DqxAqUbl.js} +1 -1
  47. package/dist/client/assets/{Plus-Dto-8y6a.js → Plus-CqWob4tu.js} +1 -1
  48. package/dist/client/assets/{RefreshCcw01-DckyCUMd.js → RefreshCcw01-B6R5Js1R.js} +1 -1
  49. package/dist/client/assets/{Save01-C2uk3LpG.js → Save01-BfieBu6m.js} +1 -1
  50. package/dist/client/assets/{SearchMd-Kap2MdR9.js → SearchMd-DJI6OMcD.js} +1 -1
  51. package/dist/client/assets/{Settings01-CYUXeHtK.js → Settings01-BWkL3Bf9.js} +1 -1
  52. package/dist/client/assets/{Shield01-CJ-f24yL.js → Shield01-DMT1motk.js} +1 -1
  53. package/dist/client/assets/{Terminal-BQ1GlFmm.js → Terminal-zNrinv6B.js} +1 -1
  54. package/dist/client/assets/Tool01-CUx5BAY-.js +1 -0
  55. package/dist/client/assets/{Trash01-DkXbOnbi.js → Trash01-C0891dQq.js} +1 -1
  56. package/dist/client/assets/{Upload01-BasmYIL8.js → Upload01-ngHWsp64.js} +1 -1
  57. package/dist/client/assets/{Users03-BXwEsNFj.js → Users03-FsZwQwZq.js} +1 -1
  58. package/dist/client/assets/{X-CNbskBah.js → X-CeRZ6ROs.js} +1 -1
  59. package/dist/client/assets/XAxis-B4Pxztvn.js +1 -0
  60. package/dist/client/assets/{XCircle-DvUvQRq1.js → XCircle-X3Ds2fko.js} +1 -1
  61. package/dist/client/assets/{XClose-B0FgAxIQ.js → XClose-BieEiV6P.js} +1 -1
  62. package/dist/client/assets/{Zap-BgjTj76q.js → Zap-B-qa654H.js} +1 -1
  63. package/dist/client/assets/{agent-connections-preview-Bh6ijP_X.js → agent-connections-preview-BXeLz6mJ.js} +1 -1
  64. package/dist/client/assets/agent-detail-2cFCKx9t.js +2 -0
  65. package/dist/client/assets/agents-DS-16MLo.js +1 -0
  66. package/dist/client/assets/ai-providers-logos-Bb5LHAPU.js +1 -0
  67. package/dist/client/assets/{alert-dialog-DtAWdTyc.js → alert-dialog-DgTufZ_p.js} +3 -3
  68. package/dist/client/assets/{auth-catchall-5qyXxzaS.js → auth-catchall-zO2o6cw1.js} +1 -1
  69. package/dist/client/assets/automation-detail-CyiDphKi.js +1 -0
  70. package/dist/client/assets/automations-CBvKrAy1.js +1 -0
  71. package/dist/client/assets/{avatar-ChRCLY4k.js → avatar-w6QMWHVj.js} +1 -1
  72. package/dist/client/assets/{badge-C4uZcq7J.js → badge-B-_hRtCy.js} +1 -1
  73. package/dist/client/assets/{binder-hd3C3mvD.js → binder-BEJ4wRzw.js} +1 -1
  74. package/dist/client/assets/{breadcrumb-pLMl4xjy.js → breadcrumb-Dk9kRV2t.js} +1 -1
  75. package/dist/client/assets/card-BSGld6G2.js +1 -0
  76. package/dist/client/assets/chart-CEfru1MQ.js +15 -0
  77. package/dist/client/assets/{checkbox-D2IG7klY.js → checkbox-COsQJsO9.js} +1 -1
  78. package/dist/client/assets/{collapsible-ttq3VbhQ.js → collapsible-BCGKc4Wz.js} +1 -1
  79. package/dist/client/assets/{collection-detail-DoRLjPv6.js → collection-detail-BimbOEiL.js} +5 -5
  80. package/dist/client/assets/collection-display-button-CuyLh-NC.js +1 -0
  81. package/dist/client/assets/{collection-search-Mtc1qP5K.js → collection-search-aJlY7LHs.js} +1 -1
  82. package/dist/client/assets/collection-table-wrapper-CcbJTCba.js +1 -0
  83. package/dist/client/assets/{collection-tabs-CHem1-m4.js → collection-tabs-B2Xeppc1.js} +1 -1
  84. package/dist/client/assets/{command-DRBqjkmt.js → command-CyHipwcz.js} +1 -1
  85. package/dist/client/assets/{connect-CRbH1TYm.js → connect-3nC8bK4k.js} +1 -1
  86. package/dist/client/assets/connection-card-iA_b7WBI.js +1 -0
  87. package/dist/client/assets/connection-detail-B4CoR-IH.js +1 -0
  88. package/dist/client/assets/{connection-status-COvhqytZ.js → connection-status-BddpcBJZ.js} +1 -1
  89. package/dist/client/assets/connections-B-zXLcDP.js +1 -0
  90. package/dist/client/assets/{constants-B9t4Nuz_.js → constants-CDL9XClm.js} +1 -1
  91. package/dist/client/assets/constants-DxY-8FrK.js +1 -0
  92. package/dist/client/assets/{context-CiizXS06.js → context-DDV_uL9a.js} +1 -1
  93. package/dist/client/assets/{create-organization-dialog-BCMxp6fo.js → create-organization-dialog-CG01zre5.js} +1 -1
  94. package/dist/client/assets/{create-project-dialog-BvxMRX5X.js → create-project-dialog-5e-piQzY.js} +1 -1
  95. package/dist/client/assets/{danger-BjSxZinj.js → danger-_ZcnVgTL.js} +1 -1
  96. package/dist/client/assets/{danger-zone-B2z3wTq9.js → danger-zone-e3foS_su.js} +1 -1
  97. package/dist/client/assets/{dependencies-BkOdHYmE.js → dependencies-DUviAtSp.js} +1 -1
  98. package/dist/client/assets/dialog-DxTRqiug.js +1 -0
  99. package/dist/client/assets/{dropdown-menu-Cp0O2jCN.js → dropdown-menu-CdjuOUR6.js} +1 -1
  100. package/dist/client/assets/dynamic-plugin-layout-DszdejBu.js +1 -0
  101. package/dist/client/assets/{editable-task-title-COr46zxY.js → editable-task-title-44X_8A19.js} +1 -1
  102. package/dist/client/assets/{empty-state-DbRFhzf6.js → empty-state-Bj_isc1T.js} +1 -1
  103. package/dist/client/assets/{empty-state-SBIKV11G.js → empty-state-v8jdj56V.js} +1 -1
  104. package/dist/client/assets/env-vars-editor-Bs6jziXp.js +1 -0
  105. package/dist/client/assets/extract-connection-data-Cyjq-Q5I.js +1 -0
  106. package/dist/client/assets/{file-browser-B2cQNHIN.js → file-browser-4NMlO2k_.js} +2 -2
  107. package/dist/client/assets/{form-DPPO-3Tw.js → form-BV3tSlED.js} +1 -1
  108. package/dist/client/assets/{general-DDQcxBFZ.js → general-LSfgt8-y.js} +1 -1
  109. package/dist/client/assets/{grid-view-BhmPSvr_.js → grid-view-BD9vYk3H.js} +1 -1
  110. package/dist/client/assets/home-Ck605SqF.js +1 -0
  111. package/dist/client/assets/{index-B3fUA0k0.js → index-B70G5L15.js} +1 -1
  112. package/dist/client/assets/{index-Bmxys2UV.js → index-BE93ZIdg.js} +1 -1
  113. package/dist/client/assets/{index-DO8fUd54.js → index-BXUNq6d7.js} +4 -4
  114. package/dist/client/assets/{index-D-NeGwUy.js → index-CZ7yh8sQ.js} +1 -1
  115. package/dist/client/assets/index-Ci8WAd55.css +1 -0
  116. package/dist/client/assets/index-Dg_kVhT7.js +1 -0
  117. package/dist/client/assets/index-DlhaGZnK.js +1 -0
  118. package/dist/client/assets/{index-COM-PDLy.js → index-L6huQtcJ.js} +1 -1
  119. package/dist/client/assets/index-rWegviRE.js +1 -0
  120. package/dist/client/assets/{index-BVSHvvtZ.js → index-uQDoUdMq.js} +1 -1
  121. package/dist/client/assets/{index-C6XH6ylF.js → index-zJEaoyYS.js} +12 -12
  122. package/dist/client/assets/{infiniteQueryObserver-x0ce-nmx.js → infiniteQueryObserver-DXFe0xIV.js} +1 -1
  123. package/dist/client/assets/{input-BM9bdg-F.js → input-BFH8rk50.js} +1 -1
  124. package/dist/client/assets/integration-icon-D6SJHU0f.js +1 -0
  125. package/dist/client/assets/{label-CnT8WAQY.js → label-DE7vX487.js} +1 -1
  126. package/dist/client/assets/{layout-ubFJ5DPd.js → layout-B2GnF_Vp.js} +1 -1
  127. package/dist/client/assets/layout-B_GGomJW.js +1 -0
  128. package/dist/client/assets/login-CgzRmuxY.js +1 -0
  129. package/dist/client/assets/{logo-upload-Bb5Ay7-T.js → logo-upload-Bfzj_LQV.js} +1 -1
  130. package/dist/client/assets/{markdown-ZobUYaB1.js → markdown-Da-6gcG9.js} +8 -8
  131. package/dist/client/assets/{mcp-app-renderer-CLfglV2_.js → mcp-app-renderer-CNc9yMN5.js} +2 -2
  132. package/dist/client/assets/mcp-server-card-s9NGsKpt.js +1 -0
  133. package/dist/client/assets/mcp-server-detail-fMXGyX4W.js +2 -0
  134. package/dist/client/assets/members-BvBWfv9e.js +3 -0
  135. package/dist/client/assets/{monaco-editor-kjafc2y3.js → monaco-editor-VspAvYbk.js} +1 -1
  136. package/dist/client/assets/monitoring-B1jfqgQN.js +4 -0
  137. package/dist/client/assets/monitoring-dashboard-edit-Bdujw4Ym.js +1 -0
  138. package/dist/client/assets/{monitoring-dashboard-view-FD-yc8mV.js → monitoring-dashboard-view-CSfkxnkl.js} +2 -2
  139. package/dist/client/assets/monitoring-stats-row-Ds_uiyYJ.js +28 -0
  140. package/dist/client/assets/{oauth-callback-wHI3TkEb.js → oauth-callback-BNPNdlSW.js} +1 -1
  141. package/dist/client/assets/{oauth-callback-ai-provider-DHfWQd6C.js → oauth-callback-ai-provider-CODmoIp9.js} +1 -1
  142. package/dist/client/assets/org-ai-providers-CQKU4ds_.js +1 -0
  143. package/dist/client/assets/page-Bbbh0c0Z.js +1 -0
  144. package/dist/client/assets/page-BfphKBfj.js +1 -0
  145. package/dist/client/assets/{plugin-empty-state-Bh1khfVy.js → plugin-empty-state-BWhKyfJ8.js} +1 -1
  146. package/dist/client/assets/{plugin-empty-state-C0KzvXIH.js → plugin-empty-state-Cx_CuKe3.js} +1 -1
  147. package/dist/client/assets/{plugin-header-DJbwn5SE.js → plugin-header-ET8DV5kQ.js} +1 -1
  148. package/dist/client/assets/{plugin-header-ydYJ1Vj6.js → plugin-header-ncr8MkbN.js} +1 -1
  149. package/dist/client/assets/plugins-BdyM0ZUw.js +1 -0
  150. package/dist/client/assets/{popover-D1WG-emQ.js → popover-BcyJids_.js} +1 -1
  151. package/dist/client/assets/project-app-view-BdLdOYqG.js +1 -0
  152. package/dist/client/assets/project-layout-DReK69oR.js +1 -0
  153. package/dist/client/assets/{project-plugins-BVdloqBu.js → project-plugins-CXWguN_r.js} +1 -1
  154. package/dist/client/assets/projects-list-CZANuMq5.js +1 -0
  155. package/dist/client/assets/{registry-layout-B5XpbAHd.js → registry-layout-CqXQ571U.js} +1 -1
  156. package/dist/client/assets/registry-utils-CaVl1vKg.js +1 -0
  157. package/dist/client/assets/{reports-layout-Ct8yUpC8.js → reports-layout-CQyNOFqA.js} +1 -1
  158. package/dist/client/assets/{reset-password-BXrkGw9C.js → reset-password-Bt_v8_59.js} +1 -1
  159. package/dist/client/assets/{resizable-CqLBllsV.js → resizable-B4X_WbHf.js} +1 -1
  160. package/dist/client/assets/{save-actions-MbSzUbWU.js → save-actions-Py9YKTe0.js} +1 -1
  161. package/dist/client/assets/{scroll-area-BcJ1ckdt.js → scroll-area-R7PT492V.js} +1 -1
  162. package/dist/client/assets/{select-RxUFw6pZ.js → select-B-f7jgVG.js} +1 -1
  163. package/dist/client/assets/{select-virtual-mcp-DU8qBWLM.js → select-virtual-mcp-YanYQUBn.js} +1 -1
  164. package/dist/client/assets/sheet-7nFLkS7G.js +1 -0
  165. package/dist/client/assets/shell-layout-Dp8xiQMR.js +3 -0
  166. package/dist/client/assets/{sidebar-settings-DICq5I_K.js → sidebar-settings-w0p27D0n.js} +1 -1
  167. package/dist/client/assets/{skeleton-CU7LuZGk.js → skeleton-CK2-6UkT.js} +1 -1
  168. package/dist/client/assets/{spinner-CpOteR2a.js → spinner-B1-EIDBS.js} +1 -1
  169. package/dist/client/assets/{store-invite-D2k0Vn6N.js → store-invite-DVPM6U-x.js} +1 -1
  170. package/dist/client/assets/{switch-DyxdcdWl.js → switch-4UL4iV3X.js} +1 -1
  171. package/dist/client/assets/{table-DyNKuHyS.js → table-Bu98B5a-.js} +1 -1
  172. package/dist/client/assets/{tabs-XMAGaWgq.js → tabs-Cif80TZ4.js} +1 -1
  173. package/dist/client/assets/{task-status-DJB3YbbO.js → task-status-BWKjAgiX.js} +16 -16
  174. package/dist/client/assets/{tasks-panel-XTVNkW83.js → tasks-panel-D6Bb-wiS.js} +1 -1
  175. package/dist/client/assets/tasks-tenjlvFT.js +1 -0
  176. package/dist/client/assets/{textarea-BLuscN8X.js → textarea-DPLd5P1K.js} +1 -1
  177. package/dist/client/assets/{time-range-picker-Bd3fku3n.js → time-range-picker-FJd_w9AH.js} +1 -1
  178. package/dist/client/assets/{toggle-group-BrL6C5fG.js → toggle-group-B4QQy8X1.js} +1 -1
  179. package/dist/client/assets/tools-list-BgmW-tI4.js +1 -0
  180. package/dist/client/assets/{tooltip-BLTgyg7W.js → tooltip-BGPUMzDS.js} +1 -1
  181. package/dist/client/assets/{topbar-portal-_Qqzdv9B.js → topbar-portal-CLOTo-7w.js} +1 -1
  182. package/dist/client/assets/{types-BPYct9bF.js → types-DZ5M-eMJ.js} +5 -5
  183. package/dist/client/assets/{use-automations-BeAHZecx.js → use-automations-D7j59hRT.js} +1 -1
  184. package/dist/client/assets/use-binding-CZ8osTa1.js +1 -0
  185. package/dist/client/assets/{use-collections-C8rLdQUN.js → use-collections-yY78nnLx.js} +1 -1
  186. package/dist/client/assets/{use-connection-BNGXvSqD.js → use-connection-lXrlfojY.js} +1 -1
  187. package/dist/client/assets/{use-copy-DPJ8nWWs.js → use-copy-DZJI58oZ.js} +1 -1
  188. package/dist/client/assets/{use-create-virtual-mcp-BfS4KaKE.js → use-create-virtual-mcp-DK_WDS9Y.js} +1 -1
  189. package/dist/client/assets/use-infinite-scroll-C-TK62Eo.js +1 -0
  190. package/dist/client/assets/{use-install-from-registry-BEC7S-53.js → use-install-from-registry-C24f0cqa.js} +1 -1
  191. package/dist/client/assets/{use-list-state-DsQajLIu.js → use-list-state-D6LU1koz.js} +1 -1
  192. package/dist/client/assets/{use-mcp-prompts-D_02f3uO.js → use-mcp-prompts-DT9l3i02.js} +1 -1
  193. package/dist/client/assets/{use-mcp-resources-BNoK6dDS.js → use-mcp-resources-DhBJVSsg.js} +1 -1
  194. package/dist/client/assets/{use-mcp-tools-BCCglZve.js → use-mcp-tools-CwVNqTmj.js} +1 -1
  195. package/dist/client/assets/{use-members-Cqa4gqXV.js → use-members-fpZqw1dy.js} +1 -1
  196. package/dist/client/assets/{use-mobile-kAkblq0-.js → use-mobile-B0lEbMk3.js} +1 -1
  197. package/dist/client/assets/{use-project-DNZXkIib.js → use-project-BnRSDoVD.js} +1 -1
  198. package/dist/client/assets/use-store-discovery-C9fJhQ4Y.js +1 -0
  199. package/dist/client/assets/{use-view-mode-Bl6DaWwW.js → use-view-mode-0w9n1sJ-.js} +1 -1
  200. package/dist/client/assets/{use-virtual-mcp-DoDJBE5n.js → use-virtual-mcp-CyoGC0aH.js} +1 -1
  201. package/dist/client/assets/useInfiniteQuery-BlrmUHYA.js +1 -0
  202. package/dist/client/assets/{useMutation-CNVq636e.js → useMutation-CkdHuTyE.js} +1 -1
  203. package/dist/client/assets/useQuery-Bmc4jnG2.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-DD4jjrsx.js +1 -0
  205. package/dist/client/assets/{user-6WV0RuBu.js → user-sbKkVV9F.js} +1 -1
  206. package/dist/client/assets/workflow-CpP3zoVI.js +1 -0
  207. package/dist/client/index.html +2 -2
  208. package/dist/server/node_modules/{postgres-bytea/license → pg/LICENSE} +6 -6
  209. package/dist/server/node_modules/pg/README.md +95 -0
  210. package/dist/server/node_modules/pg/esm/index.mjs +20 -0
  211. package/dist/server/node_modules/pg/lib/client.js +743 -0
  212. package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
  213. package/dist/server/node_modules/pg/lib/connection.js +221 -0
  214. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  215. package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  216. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  217. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  218. package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
  219. package/dist/server/node_modules/pg/lib/defaults.js +91 -0
  220. package/dist/server/node_modules/pg/lib/index.js +73 -0
  221. package/dist/server/node_modules/pg/lib/native/client.js +323 -0
  222. package/dist/server/node_modules/pg/lib/native/index.js +2 -0
  223. package/dist/server/node_modules/pg/lib/native/query.js +165 -0
  224. package/dist/server/node_modules/pg/lib/query.js +252 -0
  225. package/dist/server/node_modules/pg/lib/result.js +109 -0
  226. package/dist/server/node_modules/pg/lib/stream.js +83 -0
  227. package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
  228. package/dist/server/node_modules/pg/lib/utils.js +217 -0
  229. package/dist/server/node_modules/pg/package.json +76 -0
  230. package/package.json +1 -1
  231. package/dist/client/assets/agent-detail-Cda1RjKX.js +0 -2
  232. package/dist/client/assets/agents-DNXSTqTl.js +0 -1
  233. package/dist/client/assets/ai-providers-logos-W57Qm-EN.js +0 -1
  234. package/dist/client/assets/automation-detail-BV87rs7m.js +0 -1
  235. package/dist/client/assets/automations-Dp0qrLbX.js +0 -1
  236. package/dist/client/assets/card-B4dTtsmd.js +0 -1
  237. package/dist/client/assets/chart-Caf0jSbB.js +0 -15
  238. package/dist/client/assets/collection-display-button-C0A6ba73.js +0 -1
  239. package/dist/client/assets/collection-tab-CTog7m1d.js +0 -1
  240. package/dist/client/assets/collection-table-wrapper-Ccujw2gS.js +0 -1
  241. package/dist/client/assets/connection-card-DXMFAvSL.js +0 -1
  242. package/dist/client/assets/connection-detail-D-M6vj9q.js +0 -1
  243. package/dist/client/assets/connections-BZmayWR_.js +0 -1
  244. package/dist/client/assets/constants-Dr5R1EQY.js +0 -1
  245. package/dist/client/assets/dialog-CTFHRhvl.js +0 -1
  246. package/dist/client/assets/dynamic-plugin-layout-CcrlbNZV.js +0 -1
  247. package/dist/client/assets/env-vars-editor-1feSU4JA.js +0 -1
  248. package/dist/client/assets/extract-connection-data-adtLKfGW.js +0 -1
  249. package/dist/client/assets/github-icon-Dp3wHhYE.js +0 -1
  250. package/dist/client/assets/home-Dxpbp1Bj.js +0 -1
  251. package/dist/client/assets/icon-picker-BKKuKn6y.js +0 -1
  252. package/dist/client/assets/index-B1uuY7UL.js +0 -1
  253. package/dist/client/assets/index-B_m3AdpY.js +0 -1
  254. package/dist/client/assets/index-BqlWbrG0.js +0 -1
  255. package/dist/client/assets/index-DmrxmdhV.css +0 -1
  256. package/dist/client/assets/integration-icon-BrOdBipR.js +0 -1
  257. package/dist/client/assets/layout-C4PDA52F.js +0 -1
  258. package/dist/client/assets/login-CTOJXY_r.js +0 -1
  259. package/dist/client/assets/mcp-server-card-AL30DdJr.js +0 -1
  260. package/dist/client/assets/mcp-server-detail-CN2kEGgD.js +0 -2
  261. package/dist/client/assets/members-CpLusvJM.js +0 -3
  262. package/dist/client/assets/monitoring-BNAsqD0Y.js +0 -31
  263. package/dist/client/assets/monitoring-dashboard-edit-CtIPN7nQ.js +0 -1
  264. package/dist/client/assets/org-ai-providers-Cu3Y8hG7.js +0 -1
  265. package/dist/client/assets/page-BWMoYp-g.js +0 -1
  266. package/dist/client/assets/page-Ch5Qzmi-.js +0 -1
  267. package/dist/client/assets/plugins-D5THwapv.js +0 -1
  268. package/dist/client/assets/project-app-view-D-VHvgqy.js +0 -1
  269. package/dist/client/assets/project-layout-Cd8cNifU.js +0 -1
  270. package/dist/client/assets/projects-list-Z8HiWxIk.js +0 -1
  271. package/dist/client/assets/readme-viewer-MbTGGbgZ.js +0 -1
  272. package/dist/client/assets/registry-utils-oSXyNc33.js +0 -1
  273. package/dist/client/assets/shell-layout-0dnPJSNe.js +0 -3
  274. package/dist/client/assets/tasks-BJvBlQqj.js +0 -1
  275. package/dist/client/assets/tools-list-BeUwtNiH.js +0 -1
  276. package/dist/client/assets/use-binding-DSWv53zN.js +0 -1
  277. package/dist/client/assets/use-llm-IG8InXvX.js +0 -1
  278. package/dist/client/assets/use-local-storage-C3Bo802w.js +0 -1
  279. package/dist/client/assets/useInfiniteQuery-BBGNgnIc.js +0 -1
  280. package/dist/client/assets/useQuery-BeFLqBun.js +0 -1
  281. package/dist/client/assets/useSuspenseInfiniteQuery-CdVyznmA.js +0 -1
  282. package/dist/client/assets/workflow-DUYpxPLh.js +0 -1
  283. package/dist/server/node_modules/pg-int8/LICENSE +0 -13
  284. package/dist/server/node_modules/pg-int8/README.md +0 -16
  285. package/dist/server/node_modules/pg-int8/index.js +0 -100
  286. package/dist/server/node_modules/pg-int8/package.json +0 -24
  287. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  288. package/dist/server/node_modules/postgres-array/index.js +0 -97
  289. package/dist/server/node_modules/postgres-array/license +0 -21
  290. package/dist/server/node_modules/postgres-array/package.json +0 -35
  291. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  292. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  293. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  294. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  295. package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
  296. package/dist/server/node_modules/postgres-interval/index.js +0 -125
  297. package/dist/server/node_modules/postgres-interval/license +0 -21
  298. package/dist/server/node_modules/postgres-interval/package.json +0 -36
  299. package/dist/server/node_modules/postgres-interval/readme.md +0 -48
  300. /package/dist/client/assets/{readme-viewer-DWnTz46N.css → mcp-server-detail-DWnTz46N.css} +0 -0
@@ -1,13 +1,13 @@
1
- import{be as oe,r as C,o as Qs,n as Et,c as N,j as o,E as $n,u as Z,t as Ys,z as A,T as eo,g as ge,d as to,F as st,O as ot,B as X,w as On,bP as J,co as no,cp as so,aW as oo,a8 as Vt,am as fe,ao as Rn,aX as ro,ai as Ut,aY as io,aZ as An,ak as Mn,a_ as lo,a$ as co,ap as Pn,b1 as ao,cq as Bt,cr as uo,av as fo,b8 as mo,ah as po,x as xo,cs as ho,ct as go,cu as Ln}from"./index-DO8fUd54.js";import{E as Dn}from"./empty-state-SBIKV11G.js";import{d as qt,u as Kt}from"./use-collections-C8rLdQUN.js";import{u as re,g as Ke,i as bo}from"./constants-B9t4Nuz_.js";import{F as $t,a as jo,b as Jt,d as Gt}from"./form-DPPO-3Tw.js";import{I as Xt}from"./input-BM9bdg-F.js";import{T as Dt}from"./textarea-BLuscN8X.js";import{V as zn,b as Wn,a as ve}from"./layout-ubFJ5DPd.js";import{S as Fn}from"./save-actions-MbSzUbWU.js";import{M as vo}from"./mcp-app-renderer-CLfglV2_.js";import{g as So,M as gn}from"./types-BPYct9bF.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as rt}from"./select-RxUFw6pZ.js";import{b as Zt,c as it,a as lt,T as ct}from"./tooltip-BLTgyg7W.js";import{i as yo}from"./AlertCircle-5ZbLDi3s.js";import{s as wo}from"./Clock-DKQ7EGj-.js";import{i as bn}from"./Code01-DZzuHJh9.js";import{a as No}from"./Copy01-CPHBT83w.js";import{s as Co}from"./LayersTwo01-B5fVqAUB.js";import{i as pt}from"./Loading01-WTkiPysv.js";import{i as Qt}from"./Play-D72BHSXn.js";import{B as qn,a as Kn,b as We,d as at,e as dt,c as Jn}from"./breadcrumb-pLMl4xjy.js";import{u as ko,O as Io,M as _o,F as To,v as Eo}from"./index-C6XH6ylF.js";import{u as xt,b as $o}from"./use-connection-BNGXvSqD.js";import{d as Yt,b as en,a as tn}from"./use-mcp-tools-BCCglZve.js";import{c as Oo}from"./content-blocks-o63cs2vh.js";import{I as ht}from"./integration-icon-BrOdBipR.js";import{T as Ro}from"./tools-list-BeUwtNiH.js";import{u as Ao,c as Mo}from"./context-CiizXS06.js";import{u as Po}from"./index-B1uuY7UL.js";import{M as Fe,n as Lo}from"./monaco-editor-kjafc2y3.js";import{E as nn}from"./empty-state-DbRFhzf6.js";import{n as Do}from"./Container-YdffBHg3.js";import{b as Gn}from"./use-virtual-mcp-DoDJBE5n.js";import{b as zo,R as jn,a as Wo}from"./resizable-CqLBllsV.js";import{B as he}from"./badge-C4uZcq7J.js";import{S as gt}from"./spinner-CpOteR2a.js";import{V as Fo}from"./collection-display-button-C0A6ba73.js";import{N as Ho,S as Vo,a as Uo,c as Bo,m as et,P as qo,i as Ko,R as Jo,u as Go,b as Xo,d as vn,E as Zo,e as Qo}from"./index-B3fUA0k0.js";import{a as Yo}from"./use-binding-DSWv53zN.js";import{b as er,c as tr,d as nr,e as sr,a as or,D as rr}from"./dialog-CTFHRhvl.js";import"./index-Bmxys2UV.js";import{s as Xn}from"./Plus-Dto-8y6a.js";import{i as bt}from"./Check-CuWDIJeM.js";import{i as ir}from"./DotsHorizontal-DUoeCjzn.js";import{b as lr,T as cr,R as ar,c as dr,d as Zn}from"./index-BqlWbrG0.js";import{s as sn}from"./XClose-B0FgAxIQ.js";import{D as ur,a as fr,b as mr,c as Sn}from"./dropdown-menu-Cp0O2jCN.js";import{i as pr}from"./ChevronRight-UJRwW9xN.js";import{a as xr,S as hr}from"./scroll-area-BcJ1ckdt.js";import{i as Qn}from"./X-CNbskBah.js";import"./useMutation-CNVq636e.js";import"./label-CnT8WAQY.js";import"./Save01-C2uk3LpG.js";import"./use-mcp-resources-BNoK6dDS.js";import"./useQuery-BeFLqBun.js";import"./ChevronUp-DXMXl76b.js";import"./index-COM-PDLy.js";import"./ChevronDown-D0TXudCx.js";import"./File06-ZV5CfSHG.js";import"./Key01-IptFTL_3.js";import"./constants-Dr5R1EQY.js";import"./registry-utils-oSXyNc33.js";import"./extract-connection-data-adtLKfGW.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-BEC7S-53.js";import"./index-D-NeGwUy.js";import"./index-B_m3AdpY.js";import"./select-virtual-mcp-DU8qBWLM.js";import"./popover-D1WG-emQ.js";import"./SearchMd-Kap2MdR9.js";import"./Users03-BXwEsNFj.js";import"./use-create-virtual-mcp-BfS4KaKE.js";import"./collection-search-Mtc1qP5K.js";import"./collection-table-wrapper-Ccujw2gS.js";import"./table-DyNKuHyS.js";import"./ArrowDown-B5WC3D5H.js";import"./ArrowUp-tKKJvEkq.js";import"./card-B4dTtsmd.js";import"./Eye-DDwMVcxZ.js";import"./Globe02-Cn3qFriL.js";import"./decopilot-events-Brt4gAR6.js";import"./use-local-storage-C3Bo802w.js";import"./Grid01-Gq7hBl7S.js";import"./List-ySIwqood.js";import"./binder-hd3C3mvD.js";const Yn=oe("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 es=oe("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 on=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const rn=oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const gr=oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const br=oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const jr=oe("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 ts=oe("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 ns=oe("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 ss=oe("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 vr=oe("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 os=oe("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 rs=oe("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"}]]),ln=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));ln.displayName="AlertOctagon";const is=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));is.displayName="Box";const ls=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));ls.displayName="ClockFastForward";const cs=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));cs.displayName="Code02";const tt=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));tt.displayName="Columns01";const as=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));as.displayName="CornerDownRight";const ds=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));ds.displayName="Database01";const us=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));us.displayName="GitBranch01";const fs=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));fs.displayName="Repeat03";const ms=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),C.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));ms.displayName="StopCircle";Qs({title:Et().min(1),description:Et().nullable(),body:Et()});function Ot(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Sr(){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 yr(t){const e=N.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($t,{control:n.control,name:"title",render:Cr}),o.jsx($t,{control:n.control,name:"description",render:Nr})]})]}),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($t,{control:n.control,name:"body",render:wr})]}),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(jo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function wr(t){const{field:e}=t;return o.jsx(Jt,{children:o.jsx(Gt,{children:o.jsx(Dt,{...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 Nr(t){const{field:e}=t;return o.jsxs(Jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Gt,{children:o.jsx(Xt,{...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 Cr(t){const{field:e}=t;return o.jsxs(Jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Gt,{children:o.jsx(Xt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function kr(t){const e=N.c(35),{providerId:n,promptId:s}=t,{org:i}=Z(),r=n||null;let l;e[0]!==i.id||e[1]!==r?(l={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=l):l=e[2];const c=re(l),a=qt(n,"PROMPT",s,c),d=Kt(n,"PROMPT",c),u=d.update.isPending;let f;e[3]!==a?(f=a?{title:a.title,description:a.description??null,body:Ot(a)}:void 0,e[3]=a,e[4]=f):f=e[4];let m;e[5]!==f?(m={values:f},e[5]=f,e[6]=m):m=e[6];const x=Ys(m);let p;e[7]!==x||e[8]!==a?(p=()=>{a&&x.reset({title:a.title,description:a.description??null,body:Ot(a)})},e[7]=x,e[8]=a,e[9]=p):p=e[9];const h=p;let g;e[10]!==d.update||e[11]!==x||e[12]!==s?(g=x.handleSubmit(async _=>{const O=await d.update.mutateAsync({id:s,data:{title:_.title,description:_.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:_.body}}]}});x.reset({title:O.title,description:O.description??null,body:Ot(O)})}),e[10]=d.update,e[11]=x,e[12]=s,e[13]=g):g=e[13];const b=g;if(!a){let _;return e[14]===Symbol.for("react.memo_cache_sentinel")?(_=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]=_):_=e[14],_}let j;e[15]!==a.title?(j=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[15]=a.title,e[16]=j):j=e[16];let S;e[17]!==a.description?(S=a.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:a.description})]}):null,e[17]=a.description,e[18]=S):S=e[18];let y;e[19]!==j||e[20]!==S?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,S]})}),e[19]=j,e[20]=S,e[21]=y):y=e[21];let v;e[22]!==b?(v=()=>{b()},e[22]=b,e[23]=v):v=e[23];let w;e[24]!==x.formState.isDirty||e[25]!==u||e[26]!==h||e[27]!==v?(w=o.jsx(zn,{children:o.jsx(Fn,{onSave:v,onUndo:h,isDirty:x.formState.isDirty,isSaving:u})}),e[24]=x.formState.isDirty,e[25]=u,e[26]=h,e[27]=v,e[28]=w):w=e[28];let k;e[29]!==x?(k=o.jsx("div",{className:"h-full",children:o.jsx(yr,{form:x})}),e[29]=x,e[30]=k):k=e[30];let E;return e[31]!==w||e[32]!==k||e[33]!==y?(E=o.jsxs(ve,{children:[y,w,k]}),e[31]=w,e[32]=k,e[33]=y,e[34]=E):E=e[34],E}function Ir(t){const e=N.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Sr(),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($n,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(kr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const _r=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 Tr(t){const e=N.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=A(_r({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 Er(t){const e=N.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=A("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 $r(t){const e=N.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=A("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 Or=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Rr(t){const e=N.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=ko(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(Io,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(_o,{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(Ar,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function Ar({toolName:t,connectionId:e}){const{replayId:n}=to({strict:!1}),s=(()=>{if(!n)return null;const T=`replay-${n}`,R=sessionStorage.getItem(T);if(!R)return null;sessionStorage.removeItem(T);try{return JSON.parse(R)}catch{return null}})(),i=(()=>{if(!s)return null;const T={};for(const[R,P]of Object.entries(s))P!==null&&typeof P=="object"?T[R]=JSON.stringify(P,null,2):T[R]=P;return T})(),[r,l]=C.useState(i??{}),[c,a]=C.useState(s?JSON.stringify(s,null,2):"{}"),[d,u]=C.useState(null),[f,m]=C.useState(null),[x,p]=C.useState(null),[h,g]=C.useState(null),[b,j]=C.useState(!1),[S,y]=C.useState(null),{org:v}=Z(),w=xt(e),{sendMessage:k,setAppContext:E,clearAppContext:_}=Ao(),[,O]=Po(),M=`${e}:${t}`,D=re({connectionId:e,orgId:v.id}),I=Yt({client:D}),$=I.data?.tools?.find(T=>T.name===t),z=So($?._meta),H=T=>{const R=Oo(T.content);R.content.length>0&&(O(!0),k(R))},[G,U]=C.useState("json"),[V,Q]=C.useState(!1);z&&!V&&(U("ui"),Q(!0));const ie=$?.inputSchema?.properties,Y=ie?Object.keys(ie):[],W=Y.length>0,B={};if(W&&$?.inputSchema?.properties)for(const T of Y)B[T]=$.inputSchema.required?.includes(T)?"":void 0;const q=T=>Object.prototype.hasOwnProperty.call(r,T),ee=async()=>{j(!0),g(null),u(null),m(null),p(null),y(null);const T=performance.now();try{if(!D)throw new Error("MCP client is not available");const R=W?{...B,...r}:(()=>{const de=c.trim();if(!de)return{};const ue=JSON.parse(de);if(ue&&typeof ue=="object")return ue;throw new Error("Raw JSON input must be an object.")})();W&&$?.inputSchema?.properties&&Object.entries($.inputSchema.properties).forEach(([de,ue])=>{if((ue.type==="object"||ue.type==="array")&&typeof R[de]=="string")try{R[de]=JSON.parse(R[de])}catch{}});const P=await D.callTool({name:t,arguments:R}),F=P.structuredContent??P,be=performance.now(),Qe=Math.round(be-T);u(F),m(P),p(R);const Ue=JSON.stringify(F),xe=new TextEncoder().encode(Ue).length;y({duration:`${Qe}ms`,bytes:`${xe} bytes`,tokens:`~${Math.ceil(xe/4)} tokens`,cost:"$0.0000"})}catch(R){const P=R instanceof Error?R.message:String(R);g(P||"Unknown error occurred");const F=performance.now();y({duration:`${Math.round(F-T)}ms`})}finally{j(!1)}},te=(T,R)=>{l(P=>({...P,[T]:R}))},le=()=>{u(null),m(null),p(null),g(null),y(null)},ce=$?.name??Or(t),se=o.jsx(qn,{children:o.jsxs(Kn,{children:[o.jsx(We,{children:o.jsx(at,{asChild:!0,children:o.jsx(st,{to:"/$org/$project/mcps",params:{org:v.slug,project:ot},children:"Connections"})})}),o.jsx(dt,{}),w&&o.jsxs(o.Fragment,{children:[o.jsx(We,{children:o.jsx(at,{asChild:!0,children:o.jsx(st,{to:"/$org/$project/mcps/$connectionId",params:{org:v.slug,project:ot,connectionId:e},search:{tab:"tools"},children:w.title})})}),o.jsx(dt,{})]}),o.jsx(We,{children:o.jsx(Jn,{children:ce})})]})});return o.jsx(ve,{breadcrumb:se,children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[30%_70%] 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(ht,{icon:w?.icon||null,name:w?.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:[I.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):I.isLoading?o.jsx(pt,{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:I.isSuccess?"ready":I.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:$?.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"}),$?.inputSchema?.required&&$.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:W&&$?.inputSchema?.properties?Object.entries($.inputSchema.properties).map(([T,R])=>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:[T,$.inputSchema?.required?.includes(T)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:R.type})]}),R.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:R.description}),R.type==="object"||R.type==="array"?o.jsx(Dt,{className:"font-mono text-xs",value:q(T)?r[T]??"":B[T]??"",onChange:P=>te(T,P.target.value),placeholder:`Enter ${T} as JSON...`,rows:3}):R.type==="boolean"?o.jsxs(Hn,{value:q(T)?String(r[T]??""):"",onValueChange:P=>te(T,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(rt,{value:"true",children:"true"}),o.jsx(rt,{value:"false",children:"false"})]})]}):o.jsx(Xt,{value:q(T)?r[T]??"":B[T]??"",onChange:P=>te(T,P.target.value),placeholder:`Enter ${T}...`})]},T)):$?.inputSchema&&!W?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Dt,{className:"font-mono text-xs min-h-[120px]",value:c,onChange:T=>a(T.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.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),o.jsx(Ro,{annotations:$?.annotations,_meta:$?._meta})]}),S&&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(wo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.duration})]}),S.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(is,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.tokens})]}),S.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ds,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.bytes})]}),S.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:S.cost})})]})]}),o.jsxs("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:[o.jsx("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:b?o.jsxs(X,{size:"sm",variant:"destructive",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:le,children:[o.jsx(ms,{className:"h-3.5 w-3.5"}),"Cancel"]}):o.jsxs(X,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:ee,children:[o.jsx(Qt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),z&&o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(it,{children:[o.jsx(lt,{asChild:!0,children:o.jsx(X,{size:"icon",variant:G==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>U("ui"),children:o.jsx(Co,{size:14})})}),o.jsx(ct,{children:"Interactive view"})]}),o.jsxs(it,{children:[o.jsx(lt,{asChild:!0,children:o.jsx(X,{size:"icon",variant:G==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>U("json"),children:o.jsx(bn,{size:14})})}),o.jsx(ct,{children:"JSON view"})]})]})})]}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Tr,{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(Er,{className:"mb-0",children:"Execution Failed"})]}),o.jsx($r,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:z&&G==="ui"&&D?o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-48",children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),o.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:o.jsx(vo,{resourceURI:z,toolInfo:$?{tool:$}:void 0,toolInput:x??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:gn.view.minHeight,maxHeight:gn.view.maxHeight,client:D,onMessage:H,onUpdateModelContext:T=>E(M,T),onTeardown:()=>_(M),className:"h-full"})}):d?o.jsxs(o.Fragment,{children:[o.jsx(Fe,{code:JSON.stringify(d,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(X,{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(d,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(bn,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})})}function Mr(t){const e=N.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=ge(i).connectionId;if(!xt(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(pt,{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(C.Suspense,{fallback:a,children:o.jsx(Rr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const yn=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(x=>x(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},cn=(t=>t?yn(t):yn),Pr=t=>t;function zt(t,e=Pr){const n=J.useSyncExternalStore(t.subscribe,J.useCallback(()=>e(t.getState()),[t,e]),J.useCallback(()=>e(t.getInitialState()),[t,e]));return J.useDebugValue(n),n}const Lr=t=>{const e=cn(t),n=s=>zt(e,s);return Object.assign(n,e),n},Dr=(t=>Lr);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 Wt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Wt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Wt(s)(n)}}}},zr=(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 x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:x)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Wt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.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,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,k]=y;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},xs=zr,{useSyncExternalStoreWithSelector:Wr}=no,Fr=t=>t;function Hr(t,e=Fr,n){const s=Wr(t.subscribe,t.getState,t.getInitialState,e,n);return J.useDebugValue(s),s}const wn=t=>Symbol.iterator in t,Nn=t=>"entries"in t,Cn=(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},Vr=(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 Ur(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:wn(t)&&wn(e)?Nn(t)&&Nn(e)?Cn(t,e):Vr(t,e):Cn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Br(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{bi as oe,r as k,o as Zs,n as Tt,c as N,j as o,E as En,u as Q,t as Ys,y as A,_ as eo,g as ge,d as to,J as nt,O as st,B as X,w as On,bQ as J,co as no,cp as so,a$ as oo,a7 as Vt,a9 as fe,ab as Rn,b0 as ro,a6 as Ut,b1 as io,b2 as An,ac as Mn,b3 as lo,b4 as co,aa as Pn,b6 as ao,cq as Bt,cr as uo,a8 as fo,bc as mo,am as po,x as xo,cs as ho,ct as go,cu as Ln}from"./index-BXUNq6d7.js";import{E as Dn}from"./empty-state-v8jdj56V.js";import{d as qt,u as Kt}from"./use-collections-yY78nnLx.js";import{u as re,g as Ke,i as bo}from"./constants-CDL9XClm.js";import{F as $t,a as jo,b as Jt,d as Gt}from"./form-BV3tSlED.js";import{I as Xt}from"./input-BFH8rk50.js";import{T as Dt}from"./textarea-DPLd5P1K.js";import{V as zn,b as Wn,a as ve}from"./layout-B2GnF_Vp.js";import{S as Fn}from"./save-actions-Py9YKTe0.js";import{M as vo}from"./mcp-app-renderer-CNc9yMN5.js";import{g as So,M as gn}from"./types-DZ5M-eMJ.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as ot}from"./select-B-f7jgVG.js";import{c as Qt,T as rt,a as it,b as lt}from"./tooltip-BGPUMzDS.js";import{i as yo}from"./AlertCircle-CnfwZdxb.js";import{s as wo}from"./Clock-9Mm0U0Dg.js";import{i as bn}from"./Code01-DDbKsccR.js";import{a as No}from"./Copy01-BexEalI-.js";import{s as Co}from"./LayersTwo01-Li6JqY2K.js";import{i as mt}from"./Loading01-Cbk1oNZ2.js";import{i as Zt}from"./Play-DqxAqUbl.js";import{B as qn,a as Kn,b as We,d as ct,e as at,c as Jn}from"./breadcrumb-Dk9kRV2t.js";import{u as ko,O as Io,M as _o,F as To,v as $o,n as Et}from"./index-zJEaoyYS.js";import{u as pt,b as Eo}from"./use-connection-lXrlfojY.js";import{d as Yt,b as en,a as tn}from"./use-mcp-tools-CwVNqTmj.js";import{c as Oo}from"./content-blocks-o63cs2vh.js";import{I as xt}from"./integration-icon-D6SJHU0f.js";import{T as Ro}from"./tools-list-BgmW-tI4.js";import{u as Ao,c as Mo}from"./context-DDV_uL9a.js";import{u as Po}from"./index-rWegviRE.js";import{M as Fe,n as Lo}from"./monaco-editor-VspAvYbk.js";import{E as nn}from"./empty-state-Bj_isc1T.js";import{n as Do}from"./Container-Ci_1Xm4L.js";import{b as Gn}from"./use-virtual-mcp-CyoGC0aH.js";import{b as zo,R as jn,a as Wo}from"./resizable-B4X_WbHf.js";import{B as he}from"./badge-B-_hRtCy.js";import{S as ht}from"./spinner-B1-EIDBS.js";import{V as Fo}from"./collection-display-button-CuyLh-NC.js";import{N as Ho,S as Vo,a as Uo,c as Bo,m as et,P as qo,i as Ko,R as Jo,u as Go,b as Xo,d as vn,E as Qo,e as Zo}from"./index-B70G5L15.js";import{a as Yo}from"./use-binding-CZ8osTa1.js";import{b as er,D as tr,a as nr,e as sr,c as or,d as rr}from"./dialog-DxTRqiug.js";import"./index-BE93ZIdg.js";import{s as Xn}from"./Plus-CqWob4tu.js";import{i as gt}from"./Check-7kB05ju_.js";import{i as ir}from"./DotsHorizontal-3xIvFzgk.js";import{a as lr}from"./Tool01-CUx5BAY-.js";import{s as sn}from"./XClose-BieEiV6P.js";import{D as cr,a as ar,b as dr,c as Sn}from"./dropdown-menu-CdjuOUR6.js";import{T as ur,R as fr,b as mr,c as Qn}from"./index-Dg_kVhT7.js";import{i as pr}from"./ChevronRight-Blv21S_7.js";import{a as xr,S as hr}from"./scroll-area-R7PT492V.js";import{i as Zn}from"./X-CeRZ6ROs.js";import"./useMutation-CkdHuTyE.js";import"./label-DE7vX487.js";import"./Save01-BfieBu6m.js";import"./use-mcp-resources-DhBJVSsg.js";import"./useQuery-Bmc4jnG2.js";import"./ChevronUp-J7upZD3-.js";import"./index-L6huQtcJ.js";import"./ChevronDown-DHeagNGb.js";import"./File06-Dqc-K1-5.js";import"./Key01-Dq5b7fdA.js";import"./constants-DxY-8FrK.js";import"./registry-utils-CaVl1vKg.js";import"./extract-connection-data-Cyjq-Q5I.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-C24f0cqa.js";import"./index-CZ7yh8sQ.js";import"./index-DlhaGZnK.js";import"./select-virtual-mcp-YanYQUBn.js";import"./popover-BcyJids_.js";import"./SearchMd-DJI6OMcD.js";import"./Users03-FsZwQwZq.js";import"./use-create-virtual-mcp-DK_WDS9Y.js";import"./collection-search-aJlY7LHs.js";import"./collection-table-wrapper-CcbJTCba.js";import"./table-Bu98B5a-.js";import"./ArrowDown-BnnQhLmg.js";import"./ArrowUp-BuKX1RSZ.js";import"./card-BSGld6G2.js";import"./Eye-Cn6YseXl.js";import"./Globe02-CyGtzZ8k.js";import"./decopilot-events-Brt4gAR6.js";import"./Grid01-Dqz--q3o.js";import"./List-Cc_Ri6eQ.js";import"./binder-BEJ4wRzw.js";const Yn=oe("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 es=oe("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 on=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const rn=oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const gr=oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const br=oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const jr=oe("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 ts=oe("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 ns=oe("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 ss=oe("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 vr=oe("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 os=oe("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 rs=oe("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"}]]),ln=({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:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));ln.displayName="AlertOctagon";const is=({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"}));is.displayName="Box";const 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:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));ls.displayName="ClockFastForward";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:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));cs.displayName="Code02";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:"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"}));as.displayName="CornerDownRight";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:"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"}));ds.displayName="Database01";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:"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"}));us.displayName="GitBranch01";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:"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"}));fs.displayName="Repeat03";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:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),k.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));ms.displayName="StopCircle";Zs({title:Tt().min(1),description:Tt().nullable(),body:Tt()});function Ot(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Sr(){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 yr(t){const e=N.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($t,{control:n.control,name:"title",render:Cr}),o.jsx($t,{control:n.control,name:"description",render:Nr})]})]}),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($t,{control:n.control,name:"body",render:wr})]}),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(jo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function wr(t){const{field:e}=t;return o.jsx(Jt,{children:o.jsx(Gt,{children:o.jsx(Dt,{...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 Nr(t){const{field:e}=t;return o.jsxs(Jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Gt,{children:o.jsx(Xt,{...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 Cr(t){const{field:e}=t;return o.jsxs(Jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Gt,{children:o.jsx(Xt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function kr(t){const e=N.c(35),{providerId:n,promptId:s}=t,{org:i}=Q(),r=n||null;let l;e[0]!==i.id||e[1]!==r?(l={connectionId:r,orgId:i.id},e[0]=i.id,e[1]=r,e[2]=l):l=e[2];const c=re(l),a=qt(n,"PROMPT",s,c),d=Kt(n,"PROMPT",c),u=d.update.isPending;let f;e[3]!==a?(f=a?{title:a.title,description:a.description??null,body:Ot(a)}:void 0,e[3]=a,e[4]=f):f=e[4];let m;e[5]!==f?(m={values:f},e[5]=f,e[6]=m):m=e[6];const x=Ys(m);let p;e[7]!==x||e[8]!==a?(p=()=>{a&&x.reset({title:a.title,description:a.description??null,body:Ot(a)})},e[7]=x,e[8]=a,e[9]=p):p=e[9];const h=p;let g;e[10]!==d.update||e[11]!==x||e[12]!==s?(g=x.handleSubmit(async _=>{const O=await d.update.mutateAsync({id:s,data:{title:_.title,description:_.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:_.body}}]}});x.reset({title:O.title,description:O.description??null,body:Ot(O)})}),e[10]=d.update,e[11]=x,e[12]=s,e[13]=g):g=e[13];const b=g;if(!a){let _;return e[14]===Symbol.for("react.memo_cache_sentinel")?(_=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]=_):_=e[14],_}let j;e[15]!==a.title?(j=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[15]=a.title,e[16]=j):j=e[16];let S;e[17]!==a.description?(S=a.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:a.description})]}):null,e[17]=a.description,e[18]=S):S=e[18];let y;e[19]!==j||e[20]!==S?(y=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,S]})}),e[19]=j,e[20]=S,e[21]=y):y=e[21];let v;e[22]!==b?(v=()=>{b()},e[22]=b,e[23]=v):v=e[23];let w;e[24]!==x.formState.isDirty||e[25]!==u||e[26]!==h||e[27]!==v?(w=o.jsx(zn,{children:o.jsx(Fn,{onSave:v,onUndo:h,isDirty:x.formState.isDirty,isSaving:u})}),e[24]=x.formState.isDirty,e[25]=u,e[26]=h,e[27]=v,e[28]=w):w=e[28];let C;e[29]!==x?(C=o.jsx("div",{className:"h-full",children:o.jsx(yr,{form:x})}),e[29]=x,e[30]=C):C=e[30];let $;return e[31]!==w||e[32]!==C||e[33]!==y?($=o.jsxs(ve,{children:[y,w,C]}),e[31]=w,e[32]=C,e[33]=y,e[34]=$):$=e[34],$}function Ir(t){const e=N.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Sr(),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(En,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(kr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const _r=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 Tr(t){const e=N.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=A(_r({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 $r(t){const e=N.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=A("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 Er(t){const e=N.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=A("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 Or=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Rr(t){const e=N.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=ko(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(Io,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(_o,{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(Ar,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function Ar({toolName:t,connectionId:e}){const{replayId:n}=to({strict:!1}),s=(()=>{if(!n)return null;const T=`replay-${n}`,R=sessionStorage.getItem(T);if(!R)return null;sessionStorage.removeItem(T);try{return JSON.parse(R)}catch{return null}})(),i=(()=>{if(!s)return null;const T={};for(const[R,P]of Object.entries(s))P!==null&&typeof P=="object"?T[R]=JSON.stringify(P,null,2):T[R]=P;return T})(),[r,l]=k.useState(i??{}),[c,a]=k.useState(s?JSON.stringify(s,null,2):"{}"),[d,u]=k.useState(null),[f,m]=k.useState(null),[x,p]=k.useState(null),[h,g]=k.useState(null),[b,j]=k.useState(!1),[S,y]=k.useState(null),{org:v}=Q(),w=pt(e),{sendMessage:C,setAppContext:$,clearAppContext:_}=Ao(),[,O]=Po(),M=`${e}:${t}`,D=re({connectionId:e,orgId:v.id}),I=Yt({client:D}),E=I.data?.tools?.find(T=>T.name===t),z=So(E?._meta),H=T=>{const R=Oo(T.content);R.content.length>0&&(O(!0),C(R))},[G,U]=k.useState("json"),[V,Z]=k.useState(!1);z&&!V&&(U("ui"),Z(!0));const ie=E?.inputSchema?.properties,Y=ie?Object.keys(ie):[],W=Y.length>0,B={};if(W&&E?.inputSchema?.properties)for(const T of Y)B[T]=E.inputSchema.required?.includes(T)?"":void 0;const q=T=>Object.prototype.hasOwnProperty.call(r,T),ee=async()=>{j(!0),g(null),u(null),m(null),p(null),y(null);const T=performance.now();try{if(!D)throw new Error("MCP client is not available");const R=W?{...B,...r}:(()=>{const de=c.trim();if(!de)return{};const ue=JSON.parse(de);if(ue&&typeof ue=="object")return ue;throw new Error("Raw JSON input must be an object.")})();W&&E?.inputSchema?.properties&&Object.entries(E.inputSchema.properties).forEach(([de,ue])=>{if((ue.type==="object"||ue.type==="array")&&typeof R[de]=="string")try{R[de]=JSON.parse(R[de])}catch{}});const P=await D.callTool({name:t,arguments:R}),F=P.structuredContent??P,be=performance.now(),Ze=Math.round(be-T);u(F),m(P),p(R);const Ue=JSON.stringify(F),xe=new TextEncoder().encode(Ue).length;y({duration:`${Ze}ms`,bytes:`${xe} bytes`,tokens:`~${Math.ceil(xe/4)} tokens`,cost:"$0.0000"})}catch(R){const P=R instanceof Error?R.message:String(R);g(P||"Unknown error occurred");const F=performance.now();y({duration:`${Math.round(F-T)}ms`})}finally{j(!1)}},te=(T,R)=>{l(P=>({...P,[T]:R}))},le=()=>{u(null),m(null),p(null),g(null),y(null)},ce=E?.name??Or(t),se=o.jsx(qn,{children:o.jsxs(Kn,{children:[o.jsx(We,{children:o.jsx(ct,{asChild:!0,children:o.jsx(nt,{to:"/$org/$project/mcps",params:{org:v.slug,project:st},children:"Connections"})})}),o.jsx(at,{}),w&&o.jsxs(o.Fragment,{children:[o.jsx(We,{children:o.jsx(ct,{asChild:!0,children:o.jsx(nt,{to:"/$org/$project/mcps/$connectionId",params:{org:v.slug,project:st,connectionId:e},search:{tab:"tools"},children:w.title})})}),o.jsx(at,{})]}),o.jsx(We,{children:o.jsx(Jn,{children:ce})})]})});return o.jsx(ve,{breadcrumb:se,children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[30%_70%] 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(xt,{icon:w?.icon||null,name:w?.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:[I.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):I.isLoading?o.jsx(mt,{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:I.isSuccess?"ready":I.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:E?.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"}),E?.inputSchema?.required&&E.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:W&&E?.inputSchema?.properties?Object.entries(E.inputSchema.properties).map(([T,R])=>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:[T,E.inputSchema?.required?.includes(T)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:R.type})]}),R.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:R.description}),R.type==="object"||R.type==="array"?o.jsx(Dt,{className:"font-mono text-xs",value:q(T)?r[T]??"":B[T]??"",onChange:P=>te(T,P.target.value),placeholder:`Enter ${T} as JSON...`,rows:3}):R.type==="boolean"?o.jsxs(Hn,{value:q(T)?String(r[T]??""):"",onValueChange:P=>te(T,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(ot,{value:"true",children:"true"}),o.jsx(ot,{value:"false",children:"false"})]})]}):o.jsx(Xt,{value:q(T)?r[T]??"":B[T]??"",onChange:P=>te(T,P.target.value),placeholder:`Enter ${T}...`})]},T)):E?.inputSchema&&!W?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Dt,{className:"font-mono text-xs min-h-[120px]",value:c,onChange:T=>a(T.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.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),o.jsx(Ro,{annotations:E?.annotations,_meta:E?._meta})]}),S&&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(wo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.duration})]}),S.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(is,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.tokens})]}),S.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ds,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:S.bytes})]}),S.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:S.cost})})]})]}),o.jsxs("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:[o.jsx("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:b?o.jsxs(X,{size:"sm",variant:"destructive",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:le,children:[o.jsx(ms,{className:"h-3.5 w-3.5"}),"Cancel"]}):o.jsxs(X,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:ee,children:[o.jsx(Zt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),z&&o.jsx(Qt,{children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(rt,{children:[o.jsx(it,{asChild:!0,children:o.jsx(X,{size:"icon",variant:G==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>U("ui"),children:o.jsx(Co,{size:14})})}),o.jsx(lt,{children:"Interactive view"})]}),o.jsxs(rt,{children:[o.jsx(it,{asChild:!0,children:o.jsx(X,{size:"icon",variant:G==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>U("json"),children:o.jsx(bn,{size:14})})}),o.jsx(lt,{children:"JSON view"})]})]})})]}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Tr,{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($r,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Er,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:z&&G==="ui"&&D?o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-48",children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),o.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:o.jsx(vo,{resourceURI:z,toolInfo:E?{tool:E}:void 0,toolInput:x??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:gn.view.minHeight,maxHeight:gn.view.maxHeight,client:D,onMessage:H,onUpdateModelContext:T=>$(M,T),onTeardown:()=>_(M),className:"h-full"})}):d?o.jsxs(o.Fragment,{children:[o.jsx(Fe,{code:JSON.stringify(d,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(X,{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(d,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(bn,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})})}function Mr(t){const e=N.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=ge(i).connectionId;if(!pt(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(mt,{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(Rr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const yn=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(x=>x(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},cn=(t=>t?yn(t):yn),Pr=t=>t;function zt(t,e=Pr){const n=J.useSyncExternalStore(t.subscribe,J.useCallback(()=>e(t.getState()),[t,e]),J.useCallback(()=>e(t.getInitialState()),[t,e]));return J.useDebugValue(n),n}const Lr=t=>{const e=cn(t),n=s=>zt(e,s);return Object.assign(n,e),n},Dr=(t=>Lr);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 Wt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Wt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Wt(s)(n)}}}},zr=(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 x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:x)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Wt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.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,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,C]=y;if(p=r.merge(C,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},xs=zr,{useSyncExternalStoreWithSelector:Wr}=no,Fr=t=>t;function Hr(t,e=Fr,n){const s=Wr(t.subscribe,t.getState,t.getInitialState,e,n);return J.useDebugValue(s),s}const wn=t=>Symbol.iterator in t,Nn=t=>"entries"in t,Cn=(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},Vr=(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 Ur(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:wn(t)&&wn(e)?Nn(t)&&Nn(e)?Cn(t,e):Vr(t,e):Cn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Br(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 Rt(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 qr(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 At(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=C.createContext(null),Kr=t=>cn()(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??At(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:Rt(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(x=>x.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=At("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Br(a,"Input"),m=d.action,x=qr(m.code,f);d={...d,action:{...m,code:x}}}const u=Rt(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=At("tool",Number((Math.random()*1e6).toFixed(0)));const i=Rt(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 Jr(t){const e=N.c(11),{children:n,initialState:s}=t,i=Gn(),{org:r}=Z();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Ke(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=()=>Kr({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]=C.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 Je(t,e){const n=C.useContext(hs);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Hr(n,t,Ur)}function He(){return Je(Gr)}function Gr(t){return t.workflow}function ne(){return Je(Xr)}function Xr(t){return t.actions}function gs(){const t=Xe();return Je(Zr)??t[0]?.name}function Zr(t){return t.currentStepName}function Ge(){const t=N.c(5),e=gs(),n=Xe();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 Xe(){return He().steps}function Ft(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(!Ft(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)||!Ft(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=N.c(5),e=He();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=Ft(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function K(){return Je(Qr)}function Qr(t){return t.trackingExecutionId}function Ze(){return Je(Yr)}function Yr(t){return t.selectedVirtualMcpId}function ei(t){const e=N.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Gn()??[],{org:a}=Z();let d;e[0]!==a.id?(d=Ke(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(ni),m=Hn,x=n??u;let p;e[2]!==s?(p=k=>s(k===""?void 0:k),e[2]=s,e[3]=p):p=e[3];let h;e[4]!==i?(h=A("text-xs",i),e[4]=i,e[5]=h):h=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]!==h||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:h,children:g}),e[8]=h,e[9]=g,e[10]=b):b=e[10];const j=Bn;let S;e[11]!==u?(S=o.jsx(rt,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=S):S=e[12];const y=f.map(ti);let v;e[13]!==j||e[14]!==S||e[15]!==y?(v=o.jsxs(j,{children:[S,y]}),e[13]=j,e[14]=S,e[15]=y,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==x||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:x,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=x,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function ti(t){return o.jsx(rt,{value:t.id,children:t.title},t.id)}function ni(t){return t.id!==null&&!bo(t.id)}function Ve(){const t=N.c(2),e=$o();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Yo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function pe(t){const e=N.c(12),{org:n}=Z(),s=Ve();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=re(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:si},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=en(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 si(t){return t.structuredContent??t}function js(t,e,n){const s=N.c(14),{org:i}=Z(),r=Ve();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=re(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:oi},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=en(u),x=f?.output,p=f?.error;let h;return s[10]!==m||s[11]!==x||s[12]!==p?(h={output:x,error:p,isLoading:m},s[10]=m,s[11]=x,s[12]=p,s[13]=h):h=s[13],h}function oi(t){return t.structuredContent??t}function ri(){const t=N.c(19),{org:e}=Z(),n=Ve(),s=He();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=re(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:ii},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=en(f);let h;t[13]!==m?.items?(h=m?.items??[],t[13]=m?.items,t[14]=h):h=t[14];let g;return t[15]!==x||t[16]!==p||t[17]!==h?(g={executions:h,isLoading:x,refetch:p},t[15]=x,t[16]=p,t[17]=h,t[18]=g):g=t[18],g}function ii(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 li(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 ci(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ai(t){const e=li(t);if(e.length===0)return ci(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 di(){const t=N.c(2),e=He();let n;return t[0]!==e.steps?(n=ai(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function ui(){const t=N.c(16),{org:e}=Z(),{id:n}=Ve(),{setTrackingExecutionId:s}=ne(),i=He(),r=Ze(),l=di();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=re(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=tn(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??Ke(e.id),S=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:S,workflow_collection_id:i.id}}),w=(y.structuredContent??y)?.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 x=m,p=l!==null;let h;return t[11]!==x||t[12]!==l||t[13]!==f||t[14]!==p?(h={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[11]=x,t[12]=l,t[13]=f,t[14]=p,t[15]=h):h=t[15],h}function fi(){const t=N.c(10),{org:e}=Z(),{id:n}=Ve();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=re(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=tn(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 mi(){const t=N.c(10),{org:e}=Z(),{id:n}=Ve();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=re(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=tn(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 pi(){const t=N.c(3),e=K(),{item:n}=pe(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 xi(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 an=Dr()(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"})),Ss=C.createContext([]);function ys(){return C.useContext(Ss)}function hi({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new qo;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=>hi({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function kn(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var gi=Ho.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",et(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=kn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",et({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=et({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",et({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Bo({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:kn(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 Uo,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(Vo)}}),bi=gi,Mt,jt="HoverCard",[Ns]=Pn(jt,[An]),vt=An(),[ji,St]=Ns(jt),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=vt(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),m=C.useRef(!1),[x,p]=Ut({prop:s,defaultProp:i??!1,onChange:r,caller:jt}),h=C.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),g=C.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=C.useCallback(()=>p(!1),[p]);return C.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(ji,{scope:e,open:x,onOpenChange:p,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=jt;var ks="HoverCardTrigger",Is=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=St(ks,n),r=vt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Vt.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:fe(t.onPointerEnter,ft(i.onOpen)),onPointerLeave:fe(t.onPointerLeave,ft(i.onClose)),onFocus:fe(t.onFocus,i.onOpen),onBlur:fe(t.onBlur,i.onClose),onTouchStart:fe(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var dn="HoverCardPortal",[vi,Si]=Ns(dn,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=St(dn,e);return o.jsx(vi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=dn;var ut="HoverCardContent",Ts=C.forwardRef((t,e)=>{const n=Si(ut,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=St(ut,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(yi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:fe(t.onPointerEnter,ft(r.onOpen)),onPointerLeave:fe(t.onPointerLeave,ft(r.onClose)),ref:e})})});Ts.displayName=ut;var yi=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=St(ut,n),d=vt(n),u=C.useRef(null),f=Mn(e,u),[m,x]=C.useState(!1);return C.useEffect(()=>{if(m){const p=document.body;return Mt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Mt,p.style.webkitUserSelect=Mt}}},[m]),C.useEffect(()=>{if(u.current){const p=()=>{x(!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]),C.useEffect(()=>{u.current&&Ci(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:fe(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:fe(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&x(!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)"}})})}),wi="HoverCardArrow",Ni=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=vt(n);return o.jsx(ao,{...i,...s,ref:e})});Ni.displayName=wi;function ft(t){return e=>e.pointerType==="touch"?void 0:t()}function Ci(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 ki=Cs,Ii=Is,_i=_s,Ti=Ts;function Ei(t){const e=N.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(ki,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function $i(t){const e=N.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(Ii,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Oi(t){const e=N.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=A("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(_i,{"data-slot":"hover-card-portal",children:o.jsx(Ti,{"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=C.createContext(void 0);function Ri(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 Ai(t){const e=N.c(20),{node:n}=t,s=C.useContext(Es),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?Ri(s,i):void 0;l=h!==void 0?typeof h=="object"?JSON.stringify(h,null,2):String(h):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 h;return e[6]!==d?(h=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx($i,{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 x;e[14]!==f||e[15]!==m?(x=o.jsx(Oi,{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]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(vn,{as:"span",children:o.jsxs(Ei,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,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 me=Os();function Os(){return cn(()=>({items:[],selectedIndex:0,command:null}))}function In(t,e){me.setState({items:t,command:e,selectedIndex:0})}function Mi(){const{items:t,selectedIndex:e}=me.getState();t.length&&me.setState({selectedIndex:(e-1+t.length)%t.length})}function Pi(){const{items:t,selectedIndex:e}=me.getState();t.length&&me.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=me.getState(),s=t[e];return s?(n?.(s),!0):!1}function _n(){me=Os()}function Li(){const t=N.c(7),e=zt(me,zi),n=zt(me,Di);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:()=>{me.setState({selectedIndex:c}),Rs()},className:A("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 Di(t){return t.selectedIndex}function zi(t){return t.items}function Wi(){let t=null,e=null;return{onStart:n=>{In(n.items,n.command),t=new Xo(Li,{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=>{In(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(),_n(),!0):n.key==="ArrowUp"?(Mi(),!0):n.key==="ArrowDown"?(Pi(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),_n()}}}const Pt=/@([\w.]+)/g;function Fi(t,e){if(!t)return null;const n=$s(e),s=new Map(n.map(a=>[a.id,a]));if(!Pt.test(t))return t;Pt.lastIndex=0;const r=[];let l=0,c;for(;(c=Pt.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 un(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=pi();let d;e[0]!==n||e[1]!==s?(d=Fi(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=Ko.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let p;if(e[4]!==n||e[5]!==f){let _;e[7]!==n?(_=O=>{const{query:M}=O;return $s(n).filter(I=>I.label.toLowerCase().includes(M.toLowerCase())||I.id.toLowerCase().includes(M.toLowerCase()))},e[7]=n,e[8]=_):_=e[8],p=bi.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Bi,renderHTML:Ui,suggestion:{items:_,render:Wi,command:Vi}}).extend(f?{addNodeView(){return Jo(Ai)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let h;e[9]!==p?(h=[x,p],e[9]=p,e[10]=h):h=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:Hi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=_=>{const{editor:O}=_;return i?.(O.getText().trim())},e[13]=i,e[14]=j):j=e[14];let S;e[15]!==u||e[16]!==m||e[17]!==h||e[18]!==b||e[19]!==j?(S={content:u,editable:m,extensions:h,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=h,e[18]=b,e[19]=j,e[20]=S):S=e[20];const y=Go(S);let v;e[21]!==l?(v=A("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]!==y?(w=o.jsx(Zo,{editor:y}),e[23]=y,e[24]=w):w=e[24];let k;e[25]!==v||e[26]!==w?(k=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=k):k=e[27];const E=k;if(a!==void 0){let _;return e[28]!==E||e[29]!==a?(_=o.jsx(Es.Provider,{value:a,children:E}),e[28]=E,e[29]=a,e[30]=_):_=e[30],_}return E}function Hi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Vi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Ui(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Bi(t){const{node:e}=t;return`@${e.attrs.id}`}function qi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),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(un,{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 Ki(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),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(un,{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 Ji(t){const e=N.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=A("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 Gi(t){const e=N.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 Xi(t){const e=N.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=h=>s(h.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=A("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 x;e[6]!==a?(x=a.map(Zi),e[6]=a,e[7]=x):x=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=p):p=e[13],p}function Zi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Qi={TextWidget:qi,TextareaWidget:Ki,NumberWidget:Ji,CheckboxWidget:Gi,SelectWidget:Xi};function Yi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:rs,color:"text-blue-500"};case"number":case"integer":return{Icon:ss,color:"text-blue-500"};case"array":return{Icon:es,color:"text-purple-500"};case"object":return{Icon:Yn,color:"text-orange-500"};case"boolean":return{Icon:os,color:"text-pink-500"};case"null":return{Icon:Bt,color:"text-gray-500"};default:return{Icon:ts,color:"text-muted-foreground"}}}function el(t){const e=N.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,x,p,h,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=Yi(d);g="space-y-2",x="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?(h=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=h):h=e[19],u=v,f=14,m=A(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]=x,e[12]=p,e[13]=h,e[14]=g}else u=e[8],f=e[9],m=e[10],x=e[11],p=e[12],h=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]!==x||e[25]!==p||e[26]!==h||e[27]!==b?(j=o.jsxs("div",{className:x,children:[p,h,b]}),e[24]=x,e[25]=p,e[26]=h,e[27]=b,e[28]=j):j=e[28];let S;e[29]!==r?(S=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=S):S=e[30];let y;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==S?(y=o.jsxs("div",{className:g,children:[j,S,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=S,e[35]=y):y=e[35],y}function tl(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(sl),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(nl),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 nl(t){return o.jsx("div",{children:t.content},t.name)}function sl(t){return o.jsx("div",{children:t.content},t.name)}function ol(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(rl),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(X,{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 rl(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 il(){return null}function ll(){return null}const cl={FieldTemplate:el,ObjectFieldTemplate:tl,ArrayFieldTemplate:ol,UnsupportedFieldTemplate:il,ErrorListTemplate:ll};function al(t){const e=N.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(un,{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(al,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=C.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[x,p]of Object.entries(f))m[x]!==p&&s(x,p);for(const x of Object.keys(m))x in f||s(x,void 0)}a.current=f};return o.jsx(Ss.Provider,{value:l,children:o.jsx(To,{schema:c,formData:e,onChange:d,validator:Eo,widgets:Qi,templates:cl,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function dl(t){const e=N.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]=C.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=E=>{E||d({}),s(E)},e[5]=s,e[6]=m):m=e[6];const x=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(er,{children:[o.jsx(tr,{children:"Workflow Input"}),o.jsx(nr,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[8]=h):h=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:h})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==x?(b=()=>x(!1),e[12]=x,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(X,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let S;e[17]!==l?(S=l?o.jsx(gt,{size:"xs"}):o.jsx(Qt,{size:14}),e[17]=l,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==l||e[21]!==S?(y=o.jsxs(X,{onClick:f,disabled:l,className:"gap-2",children:[S,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=S,e[22]=y):y=e[22];let v;e[23]!==y||e[24]!==j?(v=o.jsxs(sr,{children:[j,y]}),e[23]=y,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(or,{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 k;return e[29]!==x||e[30]!==n||e[31]!==w?(k=o.jsx(rr,{open:n,onOpenChange:x,children:w}),e[29]=x,e[30]=n,e[31]=w,e[32]=k):k=e[32],k}function ul(t){const e=N.c(25),{title:n,description:s,onSave:i,isSaving:r}=t,{viewMode:l,setViewMode:c,showExecutionsList:a,toggleExecutionsList:d}=an(),{resetToOriginalWorkflow:u,setSelectedVirtualMcpId:f}=ne(),m=bs(),x=Ze(),p=K();let h;e[0]!==n?(h=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=h):h=e[1];let g;e[2]!==s?(g=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]=g):g=e[3];let b;e[4]!==h||e[5]!==g?(b=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h,g]})}),e[4]=h,e[5]=g,e[6]=b):b=e[6];let j;e[7]!==m||e[8]!==r||e[9]!==i||e[10]!==u||e[11]!==x||e[12]!==f||e[13]!==c||e[14]!==a||e[15]!==d||e[16]!==p||e[17]!==l?(j=!p&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:u,isDirty:m,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(C.Suspense,{fallback:o.jsx(gt,{size:"xs"}),children:o.jsx(ei,{selectedVirtualMcpId:x,onVirtualMcpChange:f,placeholder:"Select Agent"})}),o.jsx(Fo,{value:l,onValueChange:c,size:"sm",options:[{value:"visual",icon:o.jsx(us,{})},{value:"code",icon:o.jsx(cs,{})}]}),o.jsx(Zt,{children:o.jsxs(it,{delayDuration:0,children:[o.jsx(lt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(X,{variant:a?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:d,"aria-label":a?"Hide runs":"Show runs",children:o.jsx(ls,{size:14})})})}),o.jsx(ct,{side:"bottom",children:a?"Hide runs":"Show runs"})]})})]}),e[7]=m,e[8]=r,e[9]=i,e[10]=u,e[11]=x,e[12]=f,e[13]=c,e[14]=a,e[15]=d,e[16]=p,e[17]=l,e[18]=j):j=e[18];let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(pl,{}),e[19]=S):S=e[19];let y;e[20]!==j?(y=o.jsxs(zn,{children:[j,S]}),e[20]=j,e[21]=y):y=e[21];let v;return e[22]!==b||e[23]!==y?(v=o.jsxs(o.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v}function fl(){const t=K(),{item:e}=pe(t);return e?.completed_at_epoch_ms!=null}function ml(){const t=K(),{item:e}=pe(t);return e?.status==="cancelled"||e?.status==="error"||e?.status==="failed"}function pl(){const t=N.c(58),e=bs(),n=fl(),s=ml(),i=K(),r=Ze(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=ui(),u=Xe(),[f,m]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=fi(),{handleResumeWorkflow:h,isResuming:g}=mi(),b=i&&!n;let j;t[0]!==u?(j=u.some(xl),t[0]=u,t[1]=j):j=t[1];const S=j,y=!r,v=u.length===0,w=e||v||S||y||c||p,k=b||c;let E;t[2]!==S||t[3]!==y||t[4]!==e||t[5]!==s||t[6]!==k||t[7]!==v?(E=()=>s?"Resume will retry failed steps — succeeded steps are preserved":k?"Workflow is currently running":e?"Save your changes before running":y?"Select an Agent first":v||S?"Add at least one step to the workflow":null,t[2]=S,t[3]=y,t[4]=e,t[5]=s,t[6]=k,t[7]=v,t[8]=E):E=t[8];const O=E();let M;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==k||t[15]!==a||t[16]!==i?(M=async()=>{if(a&&d&&!s){m(!0);return}if(s&&i){await h(i);return}if(k&&i){await x(i);return}await l({})},t[9]=x,t[10]=h,t[11]=l,t[12]=d,t[13]=s,t[14]=k,t[15]=a,t[16]=i,t[17]=M):M=t[17];const D=M;let I;t[18]!==l?(I=async te=>{await l(te)},t[18]=l,t[19]=I):I=t[19];const $=I,z=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",H=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let G;t[20]!==H?(G=A("gap-2 h-7 px-3",H),t[20]=H,t[21]=G):G=t[21];let U;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(U=(!b&&!c&&!p&&!g||s)&&o.jsx(Qt,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=U):U=t[27];let V;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(V=b&&!c&&!p&&!g&&!s&&o.jsx(Qo,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=V):V=t[33];let Q;t[34]!==p||t[35]!==c||t[36]!==g?(Q=(c||p||g)&&o.jsx(gt,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=Q):Q=t[37];let ie;t[38]!==z||t[39]!==D||t[40]!==w||t[41]!==G||t[42]!==U||t[43]!==V||t[44]!==Q?(ie=o.jsxs(X,{variant:"default",size:"sm",className:G,disabled:w,onClick:D,children:[U,V,Q,z]}),t[38]=z,t[39]=D,t[40]=w,t[41]=G,t[42]=U,t[43]=V,t[44]=Q,t[45]=ie):ie=t[45];const Y=ie;let W;t[46]!==Y||t[47]!==O?(W=O?o.jsx(Zt,{children:o.jsxs(it,{delayDuration:0,children:[o.jsx(lt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Y})}),o.jsx(ct,{side:"bottom",children:O})]})}):Y,t[46]=Y,t[47]=O,t[48]=W):W=t[48];const B=W;let q;t[49]!==$||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(q=a&&d&&o.jsx(dl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:$,isPending:c}),t[49]=$,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=q):q=t[54];let ee;return t[55]!==B||t[56]!==q?(ee=o.jsxs(o.Fragment,{children:[B,q]}),t[55]=B,t[56]=q,t[57]=ee):ee=t[57],ee}function xl(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Tn(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function hl(){const t=N.c(13),e=K(),n=Xe(),{item:s}=pe(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(gl)??[]),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 x=-1;n.forEach((p,h)=>{(l.has(p.name)||Tn(p.name,c))&&(x=h)}),n.forEach((p,h)=>{let g="pending",b;Tn(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"&&h===x+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:h}}),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 gl(t){return t.name}function bl(t){const e=N.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=K(),{item:m}=pe(f),x=m?.completed_steps,p=x?.success,h=x?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(L=>L.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,S=b!=null;let y;e[3]!==n.name?(y=L=>L===n.name||L.startsWith(`${n.name}[`),e[3]=n.name,e[4]=y):y=e[4];const v=h.some(y),w="toolName"in n.action,k=w&&"connectionId"in n.action?n.action.connectionId:null,_=!!(w&&"toolName"in n.action?n.action.toolName:null),O=Tl(n),D=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=S?"success":v||D?"error":r?.status,$=r!==void 0,z=I==="success"||I==="error";let H=O.length>0?60:12;(I==="success"||I==="error")&&(H=H+32);const G=Sl(I);let U;e[5]!==I?(U=yl(I),e[5]=I,e[6]=U):U=e[6];const V=U;let Q;e[7]===Symbol.for("react.memo_cache_sentinel")?(Q=function(Tt,Xs){const hn=Xs.split(".").slice(1);if(hn.length===0)return Array.isArray(Tt)?Tt:void 0;let je=Tt;for(const Zs of hn){if(je==null)return;if(typeof je=="object")je=je[Zs];else return}return Array.isArray(je)?je:void 0},e[7]=Q):Q=e[7];const ie=Q,Y=n.forEach!==void 0,W=n.forEach?.ref;let B;e[8]!==W?(B=W?.replace("@","").split(".")[0],e[8]=W,e[9]=B):B=e[9];const q=B,ee=m?.status==="running"||m?.status==="enqueued";let te;e[10]!==p||e[11]!==q?(te=p?.some(L=>L.name===q),e[10]=p,e[11]=q,e[12]=te):te=e[12];const le=te,ce=ee?500:!1;let se;e[13]!==le||e[14]!==ce?(se={refetchInterval:ce,enabled:le},e[13]=le,e[14]=ce,e[15]=se):se=e[15];const{output:T}=js(f,q,se);let R;if(e[16]!==T||e[17]!==W){const L=W?.replace("@","");R=L?ie(T,L):void 0,e[16]=T,e[17]=W,e[18]=R}else R=e[18];const P=R;let F;if(e[19]!==n.name){let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=/[.*+?^${}()|[\]\\]/g,e[21]=L):L=e[21],F=n.name.replace(L,"\\$&"),e[19]=n.name,e[20]=F}else F=e[20];const be=F,Qe=new RegExp(`^${be}\\[\\d+\\]$`),Ue=m?.completed_steps?.success?.filter(L=>Qe.test(L.name)),xe=h.filter(L=>Qe.test(L)),de=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",ue=I==="running"&&"bg-accent/50",Nt=l&&"opacity-50";let Se;e[22]!==de||e[23]!==ue||e[24]!==Nt?(Se=A("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",de,ue,Nt),e[22]=de,e[23]=ue,e[24]=Nt,e[25]=Se):Se=e[25];const Ks="button",Js=0;let ye;e[26]!==a?(ye=L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),a())},e[26]=a,e[27]=ye):ye=e[27];const Ct=A("text-xs font-mono opacity-75 h-8 flex items-center",G),kt=s+1;let we;e[28]!==Ct||e[29]!==kt?(we=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:Ct,children:[kt,"."]})}),e[28]=Ct,e[29]=kt,e[30]=we):we=e[30];let Ne;e[31]!==V||e[32]!==s?(Ne=s>0?o.jsx(Lt,{height:12,color:V}):o.jsx("div",{className:"h-3"}),e[31]=V,e[32]=s,e[33]=Ne):Ne=e[33];let Ce;e[34]!==k||e[35]!==_||e[36]!==w||e[37]!==n.name?(Ce=o.jsx(Il,{connectionId:k,isToolStep:w,hasToolSelected:_,stepName:n.name}),e[34]=k,e[35]=_,e[36]=w,e[37]=n.name,e[38]=Ce):Ce=e[38];let ke;e[39]!==V||e[40]!==z||e[41]!==I?(ke=z&&o.jsxs(o.Fragment,{children:[o.jsx(Lt,{height:8,color:V}),o.jsx(wl,{status:I})]}),e[39]=V,e[40]=z,e[41]=I,e[42]=ke):ke=e[42];let Ie;e[43]!==V||e[44]!==H||e[45]!==c||e[46]!==f?(Ie=c&&f?null:o.jsx(Lt,{height:H,color:V}),e[43]=V,e[44]=H,e[45]=c,e[46]=f,e[47]=Ie):Ie=e[47];let _e;e[48]!==Ne||e[49]!==Ce||e[50]!==ke||e[51]!==Ie?(_e=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[Ne,Ce,ke,Ie]}),e[48]=Ne,e[49]=Ce,e[50]=ke,e[51]=Ie,e[52]=_e):_e=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",It=_?"font-medium text-foreground":"text-foreground";let Te;e[53]!==It?(Te=A("text-sm truncate flex-1",It),e[53]=It,e[54]=Te):Te=e[54];let Ee;e[55]!==n?(Ee=_l(n),e[55]=n,e[56]=Ee):Ee=e[56];let $e;e[57]!==Te||e[58]!==Ee?($e=o.jsx("span",{className:Te,children:Ee}),e[57]=Te,e[58]=Ee,e[59]=$e):$e=e[59];let Oe;e[60]!==Ue?.length||e[61]!==xe||e[62]!==Y||e[63]!==P?(Oe=Y&&P&&P.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(Ue?.length??0)+xe.length} / ${P.length}`,xe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",xe.length," failed)"]})]}),e[60]=Ue?.length,e[61]=xe,e[62]=Y,e[63]=P,e[64]=Oe):Oe=e[64];let Re;e[65]!==$||e[66]!==I?(Re=$&&o.jsx(Nl,{status:I}),e[65]=$,e[66]=I,e[67]=Re):Re=e[67];let Ae;e[68]!==Oe||e[69]!==Re?(Ae=o.jsxs("div",{className:"flex items-center gap-2",children:[Oe,Re]}),e[68]=Oe,e[69]=Re,e[70]=Ae):Ae=e[70];let Me;e[71]!==$||e[72]!==d||e[73]!==u?(Me=!$&&o.jsxs(ur,{children:[o.jsx(fr,{asChild:!0,children:o.jsx(X,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:vl,children:o.jsx(ir,{size:14})})}),o.jsxs(mr,{align:"end",children:[o.jsxs(Sn,{onClick:L=>{L.stopPropagation(),u()},children:[o.jsx(jr,{size:14}),"Duplicate"]}),o.jsxs(Sn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:L=>{L.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=$,e[72]=d,e[73]=u,e[74]=Me):Me=e[74];let Pe;e[75]!==$e||e[76]!==Ae||e[77]!==Me?(Pe=o.jsxs("div",{className:"flex items-center h-8",children:[$e,Ae,Me]}),e[75]=$e,e[76]=Ae,e[77]=Me,e[78]=Pe):Pe=e[78];const _t=O.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.map(jl)});let Le;e[79]!==I||e[80]!==j?(Le=I==="success"&&o.jsx(Cl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Le):Le=e[81];let De;e[82]!==r?.error||e[83]!==I?(De=I==="error"&&o.jsx(kl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=De):De=e[84];let ze;e[85]!==Pe||e[86]!==_t||e[87]!==Le||e[88]!==De?(ze=o.jsxs("div",{className:Gs,children:[Pe,_t,Le,De]}),e[85]=Pe,e[86]=_t,e[87]=Le,e[88]=De,e[89]=ze):ze=e[89];let Ye;return e[90]!==a||e[91]!==Se||e[92]!==ye||e[93]!==we||e[94]!==_e||e[95]!==ze?(Ye=o.jsxs("div",{className:Se,onClick:a,role:Ks,tabIndex:Js,onKeyDown:ye,children:[we,_e,ze]}),e[90]=a,e[91]=Se,e[92]=ye,e[93]=we,e[94]=_e,e[95]=ze,e[96]=Ye):Ye=e[96],Ye}function jl(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 vl(t){return t.stopPropagation()}function Sl(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function yl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function wl(t){const e=N.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(bt,{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(sn,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function Nl(t){const e=N.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(bt,{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(sn,{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(pt,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Cl(t){const e=N.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(Lo,{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 kl(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(ln,{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 Il(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=xt(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(ht,{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(lr,{size:16,className:"text-muted-foreground"}):o.jsx(br,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function Lt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=A("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 _l(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 Tl(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 El(t){const e=N.c(32),{className:n}=t,s=Xe(),i=gs(),r=hl(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ne(),d=K();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(S=>r[S.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 x;e[4]!==n?(x=A("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=x):x=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 S;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(S=(y,v)=>{const w=r?.[y.name],k=f!==-1&&v>f&&w?.status==="pending",E=v===s.length-1;return o.jsx(bl,{step:y,index:v,isSelected:y.name===i,executionStatus:w,isSkipped:k,isLastStep:E,onSelect:()=>l(y.name),onDelete:()=>c(y.name),onDuplicate:()=>a(y.name)},y.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]=S):S=e[21],p=s.map(S),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 h;e[22]!==p?(h=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=h):h=e[23];let g;e[24]!==d?(g=d?null:o.jsx($l,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==h||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[h,g]}),e[26]=h,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(C.Suspense,{fallback:m,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function $l(){const t=N.c(8),{addToolStep:e}=ne();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(X,{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 Ol(){const t=N.c(14),{org:e}=Z(),n=Ze();let s;t[0]!==e.id||t[1]!==n?(s=n??Ke(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=re(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=Yt(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 Rl(t){const e=N.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(Al,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function Al(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Ol(),l=Ge(),{updateStep:c}=ne(),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=xi(s,u??null,Pl,Ml);let x;e[5]!==l||e[6]!==c?(x=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=x):x=e[7];const p=x;if(i){let v;e[8]!==n?(v=A("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(gt,{size:"sm"})}),e[10]=w):w=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=k):k=e[12],k}if(r){let v;e[13]!==n?(v=A("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 k;return e[17]!==v||e[18]!==w?(k=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=k):k=e[19],k}let h;e[20]!==n?(h=A("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=h):h=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(Ll,{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 S;e[32]!==j?(S=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=S):S=e[33];let y;return e[34]!==h||e[35]!==b||e[36]!==S?(y=o.jsxs("div",{className:h,children:[b,S]}),e[34]=h,e[35]=b,e[36]=S,e[37]=y):y=e[37],y}function Ml(t,e){return t.name.localeCompare(e.name)}function Pl(t){return t.name}function Ll(t){const e=N.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=A("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=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(ht,{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 x;e[11]!==f||e[12]!==m?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=x):x=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,x]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=x,e[19]=p):p=e[19],p}var ae="Accordion",Dl=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fn,zl,Wl]=mo(ae),[yt]=Pn(ae,[Wl,Zn]),mn=Zn(),Ms=J.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(fn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Ul,{...r,ref:e}):o.jsx(Vl,{...i,ref:e})})});Ms.displayName=ae;var[Ps,Fl]=yt(ae),[Ls,Hl]=yt(ae,{collapsible:!1}),Vl=J.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ut({prop:n,defaultProp:s??"",onChange:i,caller:ae});return o.jsx(Ps,{scope:t.__scopeAccordion,value:J.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:J.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Ul=J.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ut({prop:n,defaultProp:s??[],onChange:i,caller:ae}),a=J.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=J.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})})})}),[Bl,wt]=yt(ae),Ds=J.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=J.useRef(null),a=Mn(c,e),d=zl(n),f=po(i)==="ltr",m=fe(t.onKeyDown,x=>{if(!Dl.includes(x.key))return;const p=x.target,h=d().filter(E=>!E.ref.current?.disabled),g=h.findIndex(E=>E.ref.current===p),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const S=0,y=b-1,v=()=>{j=g+1,j>y&&(j=S)},w=()=>{j=g-1,j<S&&(j=y)};switch(x.key){case"Home":j=S;break;case"End":j=y;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 k=j%b;h[k].ref.current?.focus()});return o.jsx(Bl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(fn.Slot,{scope:n,children:o.jsx(Vt.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),mt="AccordionItem",[ql,pn]=yt(mt),zs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=wt(mt,n),l=Fl(mt,n),c=mn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(ql,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(ar,{"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=mt;var Ws="AccordionHeader",Fs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=wt(ae,n),r=pn(Ws,n);return o.jsx(Vt.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var Ht="AccordionTrigger",Hs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=wt(ae,n),r=pn(Ht,n),l=Hl(Ht,n),c=mn(n);return o.jsx(fn.ItemSlot,{scope:n,children:o.jsx(cr,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=Ht;var Vs="AccordionContent",Us=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=wt(ae,n),r=pn(Vs,n),l=mn(n);return o.jsx(dr,{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 Kl=Ms,Jl=zs,Gl=Fs,Xl=Hs,Zl=Us;function Ql(t){const e=N.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(Kl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Yl(t){const e=N.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=A("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(Jl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function ec(t){const e=N.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=A("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(pr,{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(Gl,{className:"flex",children:o.jsxs(Xl,{"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 tc(t){const e=N.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=A("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(Zl,{"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 nc(t){const{updateStep:e}=ne(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=xn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function sc(t){const e=N.c(48),{className:n}=t,s=Ge(),{appendStep:i}=ne();nc(s);const r=K(),{item:l}=pe(r);if(!s){let O;e[0]!==n?(O=A("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=O):O=e[1];let M;e[2]!==i?(M=()=>{i({type:"tool"})},e[2]=i,e[3]=M):M=e[3];let D;e[4]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(Xn,{size:14}),e[4]=D):D=e[4];let I;e[5]!==M?(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(X,{variant:"ghost",size:"icon",className:"size-7",onClick:M,children:D})]}),e[5]=M,e[6]=I):I=e[6];let $;return e[7]!==O||e[8]!==I?($=o.jsx("div",{className:O,children:I}),e[7]=O,e[8]=I,e[9]=$):$=e[9],$}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 O;e[15]!==c?(O=M=>M===c||M.startsWith(`${c}[`),e[15]=c,e[16]=O):O=e[16],u=d.some(O),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let x;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(x=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=x):x=e[20];const p=x,h=!!(l?.completed_steps?.success?.some(O=>O.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=A("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,S;e[23]!==s?(j=o.jsx(oc,{step:s}),S=o.jsx(ic,{step:s}),e[23]=s,e[24]=j,e[25]=S):(j=e[24],S=e[25]);const y=`${c}-${h?"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]!==h||e[31]!==g||e[32]!==y||e[33]!==v?(w=o.jsx(cc,{step:s,defaultOpen:h,isStepErrored:g,executionError:v},y),e[29]=s,e[30]=h,e[31]=g,e[32]=y,e[33]=v,e[34]=w):w=e[34];let k;e[35]!==s||e[36]!==r?(k=!r&&o.jsx(pc,{step:s}),e[35]=s,e[36]=r,e[37]=k):k=e[37];let E;e[38]!==s||e[39]!==r?(E=!r&&o.jsx(gc,{step:s}),e[38]=s,e[39]=r,e[40]=E):E=e[40];let _;return e[41]!==k||e[42]!==E||e[43]!==b||e[44]!==j||e[45]!==S||e[46]!==w?(_=o.jsxs("div",{className:b,children:[j,S,w,k,E]}),e[41]=k,e[42]=E,e[43]=b,e[44]=j,e[45]=S,e[46]=w,e[47]=_):_=e[47],_}function oc(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=K(),l=i??"";let c;e[0]!==l?(c=o.jsx(ht,{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(rc,{}),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 rc(){const t=N.c(9),e=Ge(),{updateStep:n,startReplacingTool:s}=ne(),i=K(),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(fs,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(X,{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 xn(t){const e=N.c(16),{org:n}=Z(),s=Ze();let i;e[0]!==n.id||e[1]!==s?(i=s??Ke(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=re(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=Yt(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(x=>x.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 ic(t){const e=N.c(18),{step:n}=t,{updateStep:s}=ne(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=K(),{tool:c}=xn(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?lc(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 x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ec,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=x):x=e[7];const p=n.name+l,h=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let S;e[9]!==d||e[10]!==p||e[11]!==h||e[12]!==g||e[13]!==b?(S=o.jsxs(Yl,{value:"input",className:"border-b-0",children:[x,o.jsx(tc,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:h,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=h,e[12]=g,e[13]=b,e[14]=S):S=e[14];let y;return e[15]!==S||e[16]!==m?(y=o.jsx(Ql,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:S}),e[15]=S,e[16]=m,e[17]=y):y=e[17],y}function lc(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function cc(t){const e=N.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=K(),{item:a}=pe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=F=>F===n.name||F.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),x=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(F=>F.name===n.name)||f||x),[h,g]=C.useState(s),b=n.forEach!==void 0,[j,S]=C.useState("all"),y=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(F=>y.test(F.name)).map(F=>{const be=F.name.match(y);return{index:Number(be[1]),status:"success"}}):[],k=(b?d.filter(F=>y.test(F)):[]).map(F=>{const be=F.match(y);return{index:Number(be[1]),status:"error"}}),E=[...v,...k].sort(dc),_=E.length>0,O=b&&j!=="all"?`${n.name}[${j}]`:void 0,M=p?n.name:void 0,D=O??M,{output:I,error:$}=js(c,D);let z;e[2]!==$||e[3]!==r||e[4]!==i||e[5]!==I?(z=I||($?{error:$}:i&&r?{error:r}:void 0),e[2]=$,e[3]=r,e[4]=i,e[5]=I,e[6]=z):z=e[6];const H=z,G=l&&typeof l=="object"?l.properties:void 0;let U;e[7]!==G?(U=G?Object.entries(G):[],e[7]=G,e[8]=U):U=e[8];const V=U,Q=j!=="all"&&k.some(F=>F.index===j),ie=j==="all"?i||f||x:Q,Y=h?"flex-1 min-h-0 overflow-hidden":"shrink-0";let W;e[9]!==Y?(W=A("flex flex-col border-b border-border",Y),e[9]=Y,e[10]=W):W=e[10];let B;e[11]!==h||e[12]!==g?(B=()=>g(!h),e[11]=h,e[12]=g,e[13]=B):B=e[13];const q=ie?"text-destructive":"text-muted-foreground";let ee;e[14]!==q?(ee=A("text-sm font-medium",q),e[14]=q,e[15]=ee):ee=e[15];const te=ie?"Error":"Output";let le;e[16]!==ee||e[17]!==te?(le=o.jsx("h3",{className:ee,children:te}),e[16]=ee,e[17]=te,e[18]=le):le=e[18];let ce;e[19]!==h?(ce=h?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"}),e[19]=h,e[20]=ce):ce=e[20];let se;e[21]!==le||e[22]!==ce?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[le,ce]}),e[21]=le,e[22]=ce,e[23]=se):se=e[23];let T;e[24]!==se||e[25]!==B?(T=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:B,children:se}),e[24]=se,e[25]=B,e[26]=T):T=e[26];let R;e[27]!==E||e[28]!==H||e[29]!==_||e[30]!==b||e[31]!==h||e[32]!==V||e[33]!==j||e[34]!==S||e[35]!==n.name||e[36]!==c?(R=h&&o.jsxs(o.Fragment,{children:[c&&b&&_&&o.jsx(uc,{iterations:E,selectedIteration:j,onSelect:S}),c&&H?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Fe,{code:JSON.stringify(H,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&V.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:V.map(ac)})]}),e[27]=E,e[28]=H,e[29]=_,e[30]=b,e[31]=h,e[32]=V,e[33]=j,e[34]=S,e[35]=n.name,e[36]=c,e[37]=R):R=e[37];let P;return e[38]!==T||e[39]!==R||e[40]!==W?(P=o.jsxs("div",{className:W,children:[T,R]}),e[38]=T,e[39]=R,e[40]=W,e[41]=P):P=e[41],P}function ac(t){const[e,n]=t;return o.jsx(mc,{name:e,schema:n},e)}function dc(t,e){return t.index-e.index}function uc(t){const e=N.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=A("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=h=>{const g=s===h.index;return o.jsxs("button",{type:"button",className:A("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(h.index),children:[h.status==="success"?o.jsx(bt,{size:12,className:"text-success"}):o.jsx(sn,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",h.index]})]},h.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(xr,{orientation:"horizontal"}),e[18]=m):m=e[18];let x;return e[19]!==f?(x=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(hr,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=x):x=e[20],x}function fc(t){switch(t){case"string":return{Icon:rs,color:"text-blue-500"};case"number":case"integer":return{Icon:ss,color:"text-blue-500"};case"array":return{Icon:es,color:"text-purple-500"};case"object":return{Icon:Yn,color:"text-orange-500"};case"boolean":return{Icon:os,color:"text-pink-500"};case"null":return{Icon:Bt,color:"text-gray-500"};default:return{Icon:ts,color:"text-muted-foreground"}}}function mc(t){const e=N.c(28),{name:n,schema:s}=t,i=Ge(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:y,color:v}=fc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=y,c=14,a=A(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 x;e[12]!==d||e[13]!==f||e[14]!==m?(x=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=x):x=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(as,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const h=i?.name;let g;e[17]!==h?(g=o.jsxs("span",{className:"text-muted-foreground",children:[h,"."]}),e[17]=h,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 S;return e[24]!==j||e[25]!==u||e[26]!==x?(S=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=S):S=e[27],S}function pc(t){const e=N.c(29),{step:n}=t,{updateStep:s}=ne(),i=K(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=xn(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 At(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),Kr=t=>cn()(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??At(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:Rt(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(x=>x.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=At("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Br(a,"Input"),m=d.action,x=qr(m.code,f);d={...d,action:{...m,code:x}}}const u=Rt(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=At("tool",Number((Math.random()*1e6).toFixed(0)));const i=Rt(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 Jr(t){const e=N.c(11),{children:n,initialState:s}=t,i=Gn(),{org:r}=Q();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Ke(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=()=>Kr({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 Je(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 Hr(n,t,Ur)}function He(){return Je(Gr)}function Gr(t){return t.workflow}function ne(){return Je(Xr)}function Xr(t){return t.actions}function gs(){const t=Xe();return Je(Qr)??t[0]?.name}function Qr(t){return t.currentStepName}function Ge(){const t=N.c(5),e=gs(),n=Xe();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 Xe(){return He().steps}function Ft(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(!Ft(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)||!Ft(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=N.c(5),e=He();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=Ft(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function K(){return Je(Zr)}function Zr(t){return t.trackingExecutionId}function Qe(){return Je(Yr)}function Yr(t){return t.selectedVirtualMcpId}function ei(t){const e=N.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Gn()??[],{org:a}=Q();let d;e[0]!==a.id?(d=Ke(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(ni),m=Hn,x=n??u;let p;e[2]!==s?(p=C=>s(C===""?void 0:C),e[2]=s,e[3]=p):p=e[3];let h;e[4]!==i?(h=A("text-xs",i),e[4]=i,e[5]=h):h=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]!==h||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:h,children:g}),e[8]=h,e[9]=g,e[10]=b):b=e[10];const j=Bn;let S;e[11]!==u?(S=o.jsx(ot,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=S):S=e[12];const y=f.map(ti);let v;e[13]!==j||e[14]!==S||e[15]!==y?(v=o.jsxs(j,{children:[S,y]}),e[13]=j,e[14]=S,e[15]=y,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==x||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:x,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=x,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function ti(t){return o.jsx(ot,{value:t.id,children:t.title},t.id)}function ni(t){return t.id!==null&&!bo(t.id)}function Ve(){const t=N.c(2),e=Eo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Yo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function pe(t){const e=N.c(12),{org:n}=Q(),s=Ve();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=re(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:si},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=en(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 si(t){return t.structuredContent??t}function js(t,e,n){const s=N.c(14),{org:i}=Q(),r=Ve();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=re(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:oi},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=en(u),x=f?.output,p=f?.error;let h;return s[10]!==m||s[11]!==x||s[12]!==p?(h={output:x,error:p,isLoading:m},s[10]=m,s[11]=x,s[12]=p,s[13]=h):h=s[13],h}function oi(t){return t.structuredContent??t}function ri(){const t=N.c(19),{org:e}=Q(),n=Ve(),s=He();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=re(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:ii},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=en(f);let h;t[13]!==m?.items?(h=m?.items??[],t[13]=m?.items,t[14]=h):h=t[14];let g;return t[15]!==x||t[16]!==p||t[17]!==h?(g={executions:h,isLoading:x,refetch:p},t[15]=x,t[16]=p,t[17]=h,t[18]=g):g=t[18],g}function ii(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 li(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 ci(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ai(t){const e=li(t);if(e.length===0)return ci(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 di(){const t=N.c(2),e=He();let n;return t[0]!==e.steps?(n=ai(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function ui(){const t=N.c(16),{org:e}=Q(),{id:n}=Ve(),{setTrackingExecutionId:s}=ne(),i=He(),r=Qe(),l=di();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=re(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=tn(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??Ke(e.id),S=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:S,workflow_collection_id:i.id}}),w=(y.structuredContent??y)?.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 x=m,p=l!==null;let h;return t[11]!==x||t[12]!==l||t[13]!==f||t[14]!==p?(h={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[11]=x,t[12]=l,t[13]=f,t[14]=p,t[15]=h):h=t[15],h}function fi(){const t=N.c(10),{org:e}=Q(),{id:n}=Ve();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=re(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=tn(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 mi(){const t=N.c(10),{org:e}=Q(),{id:n}=Ve();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=re(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=tn(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 pi(){const t=N.c(3),e=K(),{item:n}=pe(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 xi(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 an=Dr()(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"})),Ss=k.createContext([]);function ys(){return k.useContext(Ss)}function hi({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new qo;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=>hi({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function kn(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var gi=Ho.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",et(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=kn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",et({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=et({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",et({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Bo({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:kn(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 Uo,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(Vo)}}),bi=gi,Mt,bt="HoverCard",[Ns]=Pn(bt,[An]),jt=An(),[ji,vt]=Ns(bt),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=jt(e),d=k.useRef(0),u=k.useRef(0),f=k.useRef(!1),m=k.useRef(!1),[x,p]=Ut({prop:s,defaultProp:i??!1,onChange:r,caller:bt}),h=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(ji,{scope:e,open:x,onOpenChange:p,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=bt;var ks="HoverCardTrigger",Is=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=vt(ks,n),r=jt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Vt.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:fe(t.onPointerEnter,ut(i.onOpen)),onPointerLeave:fe(t.onPointerLeave,ut(i.onClose)),onFocus:fe(t.onFocus,i.onOpen),onBlur:fe(t.onBlur,i.onClose),onTouchStart:fe(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var dn="HoverCardPortal",[vi,Si]=Ns(dn,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=vt(dn,e);return o.jsx(vi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=dn;var dt="HoverCardContent",Ts=k.forwardRef((t,e)=>{const n=Si(dt,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=vt(dt,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(yi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:fe(t.onPointerEnter,ut(r.onOpen)),onPointerLeave:fe(t.onPointerLeave,ut(r.onClose)),ref:e})})});Ts.displayName=dt;var yi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=vt(dt,n),d=jt(n),u=k.useRef(null),f=Mn(e,u),[m,x]=k.useState(!1);return k.useEffect(()=>{if(m){const p=document.body;return Mt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Mt,p.style.webkitUserSelect=Mt}}},[m]),k.useEffect(()=>{if(u.current){const p=()=>{x(!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&&Ci(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:fe(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:fe(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&x(!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)"}})})}),wi="HoverCardArrow",Ni=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=jt(n);return o.jsx(ao,{...i,...s,ref:e})});Ni.displayName=wi;function ut(t){return e=>e.pointerType==="touch"?void 0:t()}function Ci(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 ki=Cs,Ii=Is,_i=_s,Ti=Ts;function $i(t){const e=N.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(ki,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ei(t){const e=N.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(Ii,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Oi(t){const e=N.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=A("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(_i,{"data-slot":"hover-card-portal",children:o.jsx(Ti,{"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 $s=k.createContext(void 0);function Ri(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 Ai(t){const e=N.c(20),{node:n}=t,s=k.useContext($s),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?Ri(s,i):void 0;l=h!==void 0?typeof h=="object"?JSON.stringify(h,null,2):String(h):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 h;return e[6]!==d?(h=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx(Ei,{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 x;e[14]!==f||e[15]!==m?(x=o.jsx(Oi,{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]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(vn,{as:"span",children:o.jsxs($i,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,e[19]=p):p=e[19],p}function Es(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 me=Os();function Os(){return cn(()=>({items:[],selectedIndex:0,command:null}))}function In(t,e){me.setState({items:t,command:e,selectedIndex:0})}function Mi(){const{items:t,selectedIndex:e}=me.getState();t.length&&me.setState({selectedIndex:(e-1+t.length)%t.length})}function Pi(){const{items:t,selectedIndex:e}=me.getState();t.length&&me.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=me.getState(),s=t[e];return s?(n?.(s),!0):!1}function _n(){me=Os()}function Li(){const t=N.c(7),e=zt(me,zi),n=zt(me,Di);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:()=>{me.setState({selectedIndex:c}),Rs()},className:A("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 Di(t){return t.selectedIndex}function zi(t){return t.items}function Wi(){let t=null,e=null;return{onStart:n=>{In(n.items,n.command),t=new Xo(Li,{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=>{In(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(),_n(),!0):n.key==="ArrowUp"?(Mi(),!0):n.key==="ArrowDown"?(Pi(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),_n()}}}const Pt=/@([\w.]+)/g;function Fi(t,e){if(!t)return null;const n=Es(e),s=new Map(n.map(a=>[a.id,a]));if(!Pt.test(t))return t;Pt.lastIndex=0;const r=[];let l=0,c;for(;(c=Pt.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 un(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=pi();let d;e[0]!==n||e[1]!==s?(d=Fi(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=Ko.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let p;if(e[4]!==n||e[5]!==f){let _;e[7]!==n?(_=O=>{const{query:M}=O;return Es(n).filter(I=>I.label.toLowerCase().includes(M.toLowerCase())||I.id.toLowerCase().includes(M.toLowerCase()))},e[7]=n,e[8]=_):_=e[8],p=bi.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Bi,renderHTML:Ui,suggestion:{items:_,render:Wi,command:Vi}}).extend(f?{addNodeView(){return Jo(Ai)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let h;e[9]!==p?(h=[x,p],e[9]=p,e[10]=h):h=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:Hi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=_=>{const{editor:O}=_;return i?.(O.getText().trim())},e[13]=i,e[14]=j):j=e[14];let S;e[15]!==u||e[16]!==m||e[17]!==h||e[18]!==b||e[19]!==j?(S={content:u,editable:m,extensions:h,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=h,e[18]=b,e[19]=j,e[20]=S):S=e[20];const y=Go(S);let v;e[21]!==l?(v=A("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]!==y?(w=o.jsx(Qo,{editor:y}),e[23]=y,e[24]=w):w=e[24];let C;e[25]!==v||e[26]!==w?(C=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=C):C=e[27];const $=C;if(a!==void 0){let _;return e[28]!==$||e[29]!==a?(_=o.jsx($s.Provider,{value:a,children:$}),e[28]=$,e[29]=a,e[30]=_):_=e[30],_}return $}function Hi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Vi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Ui(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Bi(t){const{node:e}=t;return`@${e.attrs.id}`}function qi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),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(un,{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 Ki(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),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(un,{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 Ji(t){const e=N.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=A("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 Gi(t){const e=N.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 Xi(t){const e=N.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=h=>s(h.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=A("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 x;e[6]!==a?(x=a.map(Qi),e[6]=a,e[7]=x):x=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=p):p=e[13],p}function Qi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Zi={TextWidget:qi,TextareaWidget:Ki,NumberWidget:Ji,CheckboxWidget:Gi,SelectWidget:Xi};function Yi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:rs,color:"text-blue-500"};case"number":case"integer":return{Icon:ss,color:"text-blue-500"};case"array":return{Icon:es,color:"text-purple-500"};case"object":return{Icon:Yn,color:"text-orange-500"};case"boolean":return{Icon:os,color:"text-pink-500"};case"null":return{Icon:Bt,color:"text-gray-500"};default:return{Icon:ts,color:"text-muted-foreground"}}}function el(t){const e=N.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,x,p,h,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=Yi(d);g="space-y-2",x="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?(h=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=h):h=e[19],u=v,f=14,m=A(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]=x,e[12]=p,e[13]=h,e[14]=g}else u=e[8],f=e[9],m=e[10],x=e[11],p=e[12],h=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]!==x||e[25]!==p||e[26]!==h||e[27]!==b?(j=o.jsxs("div",{className:x,children:[p,h,b]}),e[24]=x,e[25]=p,e[26]=h,e[27]=b,e[28]=j):j=e[28];let S;e[29]!==r?(S=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=S):S=e[30];let y;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==S?(y=o.jsxs("div",{className:g,children:[j,S,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=S,e[35]=y):y=e[35],y}function tl(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(sl),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(nl),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 nl(t){return o.jsx("div",{children:t.content},t.name)}function sl(t){return o.jsx("div",{children:t.content},t.name)}function ol(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(rl),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(X,{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 rl(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 il(){return null}function ll(){return null}const cl={FieldTemplate:el,ObjectFieldTemplate:tl,ArrayFieldTemplate:ol,UnsupportedFieldTemplate:il,ErrorListTemplate:ll};function al(t){const e=N.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(un,{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(al,{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[x,p]of Object.entries(f))m[x]!==p&&s(x,p);for(const x of Object.keys(m))x in f||s(x,void 0)}a.current=f};return o.jsx(Ss.Provider,{value:l,children:o.jsx(To,{schema:c,formData:e,onChange:d,validator:$o,widgets:Zi,templates:cl,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function dl(t){const e=N.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=$=>{$||d({}),s($)},e[5]=s,e[6]=m):m=e[6];const x=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(er,{children:[o.jsx(tr,{children:"Workflow Input"}),o.jsx(nr,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[8]=h):h=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:h})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==x?(b=()=>x(!1),e[12]=x,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(X,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let S;e[17]!==l?(S=l?o.jsx(ht,{size:"xs"}):o.jsx(Zt,{size:14}),e[17]=l,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==l||e[21]!==S?(y=o.jsxs(X,{onClick:f,disabled:l,className:"gap-2",children:[S,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=S,e[22]=y):y=e[22];let v;e[23]!==y||e[24]!==j?(v=o.jsxs(sr,{children:[j,y]}),e[23]=y,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(or,{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 C;return e[29]!==x||e[30]!==n||e[31]!==w?(C=o.jsx(rr,{open:n,onOpenChange:x,children:w}),e[29]=x,e[30]=n,e[31]=w,e[32]=C):C=e[32],C}function ul(t){const e=N.c(25),{title:n,description:s,onSave:i,isSaving:r}=t,{viewMode:l,setViewMode:c,showExecutionsList:a,toggleExecutionsList:d}=an(),{resetToOriginalWorkflow:u,setSelectedVirtualMcpId:f}=ne(),m=bs(),x=Qe(),p=K();let h;e[0]!==n?(h=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=h):h=e[1];let g;e[2]!==s?(g=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]=g):g=e[3];let b;e[4]!==h||e[5]!==g?(b=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h,g]})}),e[4]=h,e[5]=g,e[6]=b):b=e[6];let j;e[7]!==m||e[8]!==r||e[9]!==i||e[10]!==u||e[11]!==x||e[12]!==f||e[13]!==c||e[14]!==a||e[15]!==d||e[16]!==p||e[17]!==l?(j=!p&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:u,isDirty:m,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(k.Suspense,{fallback:o.jsx(ht,{size:"xs"}),children:o.jsx(ei,{selectedVirtualMcpId:x,onVirtualMcpChange:f,placeholder:"Select Agent"})}),o.jsx(Fo,{value:l,onValueChange:c,size:"sm",options:[{value:"visual",icon:o.jsx(us,{})},{value:"code",icon:o.jsx(cs,{})}]}),o.jsx(Qt,{children:o.jsxs(rt,{delayDuration:0,children:[o.jsx(it,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(X,{variant:a?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:d,"aria-label":a?"Hide runs":"Show runs",children:o.jsx(ls,{size:14})})})}),o.jsx(lt,{side:"bottom",children:a?"Hide runs":"Show runs"})]})})]}),e[7]=m,e[8]=r,e[9]=i,e[10]=u,e[11]=x,e[12]=f,e[13]=c,e[14]=a,e[15]=d,e[16]=p,e[17]=l,e[18]=j):j=e[18];let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(pl,{}),e[19]=S):S=e[19];let y;e[20]!==j?(y=o.jsxs(zn,{children:[j,S]}),e[20]=j,e[21]=y):y=e[21];let v;return e[22]!==b||e[23]!==y?(v=o.jsxs(o.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v}function fl(){const t=K(),{item:e}=pe(t);return e?.completed_at_epoch_ms!=null}function ml(){const t=K(),{item:e}=pe(t);return e?.status==="cancelled"||e?.status==="error"||e?.status==="failed"}function pl(){const t=N.c(58),e=bs(),n=fl(),s=ml(),i=K(),r=Qe(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=ui(),u=Xe(),[f,m]=k.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=fi(),{handleResumeWorkflow:h,isResuming:g}=mi(),b=i&&!n;let j;t[0]!==u?(j=u.some(xl),t[0]=u,t[1]=j):j=t[1];const S=j,y=!r,v=u.length===0,w=e||v||S||y||c||p,C=b||c;let $;t[2]!==S||t[3]!==y||t[4]!==e||t[5]!==s||t[6]!==C||t[7]!==v?($=()=>s?"Resume will retry failed steps — succeeded steps are preserved":C?"Workflow is currently running":e?"Save your changes before running":y?"Select an Agent first":v||S?"Add at least one step to the workflow":null,t[2]=S,t[3]=y,t[4]=e,t[5]=s,t[6]=C,t[7]=v,t[8]=$):$=t[8];const O=$();let M;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==C||t[15]!==a||t[16]!==i?(M=async()=>{if(a&&d&&!s){m(!0);return}if(s&&i){await h(i);return}if(C&&i){await x(i);return}await l({})},t[9]=x,t[10]=h,t[11]=l,t[12]=d,t[13]=s,t[14]=C,t[15]=a,t[16]=i,t[17]=M):M=t[17];const D=M;let I;t[18]!==l?(I=async te=>{await l(te)},t[18]=l,t[19]=I):I=t[19];const E=I,z=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",H=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let G;t[20]!==H?(G=A("gap-2 h-7 px-3",H),t[20]=H,t[21]=G):G=t[21];let U;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(U=(!b&&!c&&!p&&!g||s)&&o.jsx(Zt,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=U):U=t[27];let V;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(V=b&&!c&&!p&&!g&&!s&&o.jsx(Zo,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=V):V=t[33];let Z;t[34]!==p||t[35]!==c||t[36]!==g?(Z=(c||p||g)&&o.jsx(ht,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=Z):Z=t[37];let ie;t[38]!==z||t[39]!==D||t[40]!==w||t[41]!==G||t[42]!==U||t[43]!==V||t[44]!==Z?(ie=o.jsxs(X,{variant:"default",size:"sm",className:G,disabled:w,onClick:D,children:[U,V,Z,z]}),t[38]=z,t[39]=D,t[40]=w,t[41]=G,t[42]=U,t[43]=V,t[44]=Z,t[45]=ie):ie=t[45];const Y=ie;let W;t[46]!==Y||t[47]!==O?(W=O?o.jsx(Qt,{children:o.jsxs(rt,{delayDuration:0,children:[o.jsx(it,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Y})}),o.jsx(lt,{side:"bottom",children:O})]})}):Y,t[46]=Y,t[47]=O,t[48]=W):W=t[48];const B=W;let q;t[49]!==E||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(q=a&&d&&o.jsx(dl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:E,isPending:c}),t[49]=E,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=q):q=t[54];let ee;return t[55]!==B||t[56]!==q?(ee=o.jsxs(o.Fragment,{children:[B,q]}),t[55]=B,t[56]=q,t[57]=ee):ee=t[57],ee}function xl(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Tn(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function hl(){const t=N.c(13),e=K(),n=Xe(),{item:s}=pe(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(gl)??[]),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 x=-1;n.forEach((p,h)=>{(l.has(p.name)||Tn(p.name,c))&&(x=h)}),n.forEach((p,h)=>{let g="pending",b;Tn(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"&&h===x+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:h}}),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 gl(t){return t.name}function bl(t){const e=N.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=K(),{item:m}=pe(f),x=m?.completed_steps,p=x?.success,h=x?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(L=>L.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,S=b!=null;let y;e[3]!==n.name?(y=L=>L===n.name||L.startsWith(`${n.name}[`),e[3]=n.name,e[4]=y):y=e[4];const v=h.some(y),w="toolName"in n.action,C=w&&"connectionId"in n.action?n.action.connectionId:null,_=!!(w&&"toolName"in n.action?n.action.toolName:null),O=Tl(n),D=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=S?"success":v||D?"error":r?.status,E=r!==void 0,z=I==="success"||I==="error";let H=O.length>0?60:12;(I==="success"||I==="error")&&(H=H+32);const G=Sl(I);let U;e[5]!==I?(U=yl(I),e[5]=I,e[6]=U):U=e[6];const V=U;let Z;e[7]===Symbol.for("react.memo_cache_sentinel")?(Z=function(_t,Xs){const hn=Xs.split(".").slice(1);if(hn.length===0)return Array.isArray(_t)?_t:void 0;let je=_t;for(const Qs of hn){if(je==null)return;if(typeof je=="object")je=je[Qs];else return}return Array.isArray(je)?je:void 0},e[7]=Z):Z=e[7];const ie=Z,Y=n.forEach!==void 0,W=n.forEach?.ref;let B;e[8]!==W?(B=W?.replace("@","").split(".")[0],e[8]=W,e[9]=B):B=e[9];const q=B,ee=m?.status==="running"||m?.status==="enqueued";let te;e[10]!==p||e[11]!==q?(te=p?.some(L=>L.name===q),e[10]=p,e[11]=q,e[12]=te):te=e[12];const le=te,ce=ee?500:!1;let se;e[13]!==le||e[14]!==ce?(se={refetchInterval:ce,enabled:le},e[13]=le,e[14]=ce,e[15]=se):se=e[15];const{output:T}=js(f,q,se);let R;if(e[16]!==T||e[17]!==W){const L=W?.replace("@","");R=L?ie(T,L):void 0,e[16]=T,e[17]=W,e[18]=R}else R=e[18];const P=R;let F;if(e[19]!==n.name){let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=/[.*+?^${}()|[\]\\]/g,e[21]=L):L=e[21],F=n.name.replace(L,"\\$&"),e[19]=n.name,e[20]=F}else F=e[20];const be=F,Ze=new RegExp(`^${be}\\[\\d+\\]$`),Ue=m?.completed_steps?.success?.filter(L=>Ze.test(L.name)),xe=h.filter(L=>Ze.test(L)),de=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",ue=I==="running"&&"bg-accent/50",wt=l&&"opacity-50";let Se;e[22]!==de||e[23]!==ue||e[24]!==wt?(Se=A("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",de,ue,wt),e[22]=de,e[23]=ue,e[24]=wt,e[25]=Se):Se=e[25];const Ks="button",Js=0;let ye;e[26]!==a?(ye=L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),a())},e[26]=a,e[27]=ye):ye=e[27];const Nt=A("text-xs font-mono opacity-75 h-8 flex items-center",G),Ct=s+1;let we;e[28]!==Nt||e[29]!==Ct?(we=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:Nt,children:[Ct,"."]})}),e[28]=Nt,e[29]=Ct,e[30]=we):we=e[30];let Ne;e[31]!==V||e[32]!==s?(Ne=s>0?o.jsx(Lt,{height:12,color:V}):o.jsx("div",{className:"h-3"}),e[31]=V,e[32]=s,e[33]=Ne):Ne=e[33];let Ce;e[34]!==C||e[35]!==_||e[36]!==w||e[37]!==n.name?(Ce=o.jsx(Il,{connectionId:C,isToolStep:w,hasToolSelected:_,stepName:n.name}),e[34]=C,e[35]=_,e[36]=w,e[37]=n.name,e[38]=Ce):Ce=e[38];let ke;e[39]!==V||e[40]!==z||e[41]!==I?(ke=z&&o.jsxs(o.Fragment,{children:[o.jsx(Lt,{height:8,color:V}),o.jsx(wl,{status:I})]}),e[39]=V,e[40]=z,e[41]=I,e[42]=ke):ke=e[42];let Ie;e[43]!==V||e[44]!==H||e[45]!==c||e[46]!==f?(Ie=c&&f?null:o.jsx(Lt,{height:H,color:V}),e[43]=V,e[44]=H,e[45]=c,e[46]=f,e[47]=Ie):Ie=e[47];let _e;e[48]!==Ne||e[49]!==Ce||e[50]!==ke||e[51]!==Ie?(_e=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[Ne,Ce,ke,Ie]}),e[48]=Ne,e[49]=Ce,e[50]=ke,e[51]=Ie,e[52]=_e):_e=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",kt=_?"font-medium text-foreground":"text-foreground";let Te;e[53]!==kt?(Te=A("text-sm truncate flex-1",kt),e[53]=kt,e[54]=Te):Te=e[54];let $e;e[55]!==n?($e=_l(n),e[55]=n,e[56]=$e):$e=e[56];let Ee;e[57]!==Te||e[58]!==$e?(Ee=o.jsx("span",{className:Te,children:$e}),e[57]=Te,e[58]=$e,e[59]=Ee):Ee=e[59];let Oe;e[60]!==Ue?.length||e[61]!==xe||e[62]!==Y||e[63]!==P?(Oe=Y&&P&&P.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(Ue?.length??0)+xe.length} / ${P.length}`,xe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",xe.length," failed)"]})]}),e[60]=Ue?.length,e[61]=xe,e[62]=Y,e[63]=P,e[64]=Oe):Oe=e[64];let Re;e[65]!==E||e[66]!==I?(Re=E&&o.jsx(Nl,{status:I}),e[65]=E,e[66]=I,e[67]=Re):Re=e[67];let Ae;e[68]!==Oe||e[69]!==Re?(Ae=o.jsxs("div",{className:"flex items-center gap-2",children:[Oe,Re]}),e[68]=Oe,e[69]=Re,e[70]=Ae):Ae=e[70];let Me;e[71]!==E||e[72]!==d||e[73]!==u?(Me=!E&&o.jsxs(cr,{children:[o.jsx(ar,{asChild:!0,children:o.jsx(X,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:vl,children:o.jsx(ir,{size:14})})}),o.jsxs(dr,{align:"end",children:[o.jsxs(Sn,{onClick:L=>{L.stopPropagation(),u()},children:[o.jsx(jr,{size:14}),"Duplicate"]}),o.jsxs(Sn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:L=>{L.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=E,e[72]=d,e[73]=u,e[74]=Me):Me=e[74];let Pe;e[75]!==Ee||e[76]!==Ae||e[77]!==Me?(Pe=o.jsxs("div",{className:"flex items-center h-8",children:[Ee,Ae,Me]}),e[75]=Ee,e[76]=Ae,e[77]=Me,e[78]=Pe):Pe=e[78];const It=O.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.map(jl)});let Le;e[79]!==I||e[80]!==j?(Le=I==="success"&&o.jsx(Cl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Le):Le=e[81];let De;e[82]!==r?.error||e[83]!==I?(De=I==="error"&&o.jsx(kl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=De):De=e[84];let ze;e[85]!==Pe||e[86]!==It||e[87]!==Le||e[88]!==De?(ze=o.jsxs("div",{className:Gs,children:[Pe,It,Le,De]}),e[85]=Pe,e[86]=It,e[87]=Le,e[88]=De,e[89]=ze):ze=e[89];let Ye;return e[90]!==a||e[91]!==Se||e[92]!==ye||e[93]!==we||e[94]!==_e||e[95]!==ze?(Ye=o.jsxs("div",{className:Se,onClick:a,role:Ks,tabIndex:Js,onKeyDown:ye,children:[we,_e,ze]}),e[90]=a,e[91]=Se,e[92]=ye,e[93]=we,e[94]=_e,e[95]=ze,e[96]=Ye):Ye=e[96],Ye}function jl(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 vl(t){return t.stopPropagation()}function Sl(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function yl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function wl(t){const e=N.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(gt,{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(sn,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function Nl(t){const e=N.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(gt,{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(sn,{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(mt,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Cl(t){const e=N.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(Lo,{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 kl(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(ln,{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 Il(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=pt(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(xt,{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(lr,{size:16,className:"text-muted-foreground"}):o.jsx(br,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function Lt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=A("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 _l(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 Tl(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 $l(t){const e=N.c(32),{className:n}=t,s=Xe(),i=gs(),r=hl(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ne(),d=K();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(S=>r[S.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 x;e[4]!==n?(x=A("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=x):x=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 S;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(S=(y,v)=>{const w=r?.[y.name],C=f!==-1&&v>f&&w?.status==="pending",$=v===s.length-1;return o.jsx(bl,{step:y,index:v,isSelected:y.name===i,executionStatus:w,isSkipped:C,isLastStep:$,onSelect:()=>l(y.name),onDelete:()=>c(y.name),onDuplicate:()=>a(y.name)},y.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]=S):S=e[21],p=s.map(S),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 h;e[22]!==p?(h=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=h):h=e[23];let g;e[24]!==d?(g=d?null:o.jsx(El,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==h||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[h,g]}),e[26]=h,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(k.Suspense,{fallback:m,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function El(){const t=N.c(8),{addToolStep:e}=ne();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(X,{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 Ol(){const t=N.c(14),{org:e}=Q(),n=Qe();let s;t[0]!==e.id||t[1]!==n?(s=n??Ke(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=re(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=Yt(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 Rl(t){const e=N.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(Al,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function Al(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Ol(),l=Ge(),{updateStep:c}=ne(),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=xi(s,u??null,Pl,Ml);let x;e[5]!==l||e[6]!==c?(x=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=x):x=e[7];const p=x;if(i){let v;e[8]!==n?(v=A("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(ht,{size:"sm"})}),e[10]=w):w=e[10];let C;return e[11]!==v?(C=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=C):C=e[12],C}if(r){let v;e[13]!==n?(v=A("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 C;return e[17]!==v||e[18]!==w?(C=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=C):C=e[19],C}let h;e[20]!==n?(h=A("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=h):h=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(Ll,{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 S;e[32]!==j?(S=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=S):S=e[33];let y;return e[34]!==h||e[35]!==b||e[36]!==S?(y=o.jsxs("div",{className:h,children:[b,S]}),e[34]=h,e[35]=b,e[36]=S,e[37]=y):y=e[37],y}function Ml(t,e){return t.name.localeCompare(e.name)}function Pl(t){return t.name}function Ll(t){const e=N.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=A("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=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(xt,{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 x;e[11]!==f||e[12]!==m?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=x):x=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,x]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=x,e[19]=p):p=e[19],p}var ae="Accordion",Dl=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fn,zl,Wl]=mo(ae),[St]=Pn(ae,[Wl,Qn]),mn=Qn(),Ms=J.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(fn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Ul,{...r,ref:e}):o.jsx(Vl,{...i,ref:e})})});Ms.displayName=ae;var[Ps,Fl]=St(ae),[Ls,Hl]=St(ae,{collapsible:!1}),Vl=J.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ut({prop:n,defaultProp:s??"",onChange:i,caller:ae});return o.jsx(Ps,{scope:t.__scopeAccordion,value:J.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:J.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Ul=J.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ut({prop:n,defaultProp:s??[],onChange:i,caller:ae}),a=J.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=J.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})})})}),[Bl,yt]=St(ae),Ds=J.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=J.useRef(null),a=Mn(c,e),d=zl(n),f=po(i)==="ltr",m=fe(t.onKeyDown,x=>{if(!Dl.includes(x.key))return;const p=x.target,h=d().filter($=>!$.ref.current?.disabled),g=h.findIndex($=>$.ref.current===p),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const S=0,y=b-1,v=()=>{j=g+1,j>y&&(j=S)},w=()=>{j=g-1,j<S&&(j=y)};switch(x.key){case"Home":j=S;break;case"End":j=y;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 C=j%b;h[C].ref.current?.focus()});return o.jsx(Bl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(fn.Slot,{scope:n,children:o.jsx(Vt.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),ft="AccordionItem",[ql,pn]=St(ft),zs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=yt(ft,n),l=Fl(ft,n),c=mn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(ql,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(fr,{"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=ft;var Ws="AccordionHeader",Fs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=yt(ae,n),r=pn(Ws,n);return o.jsx(Vt.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var Ht="AccordionTrigger",Hs=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=yt(ae,n),r=pn(Ht,n),l=Hl(Ht,n),c=mn(n);return o.jsx(fn.ItemSlot,{scope:n,children:o.jsx(ur,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=Ht;var Vs="AccordionContent",Us=J.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=yt(ae,n),r=pn(Vs,n),l=mn(n);return o.jsx(mr,{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 Kl=Ms,Jl=zs,Gl=Fs,Xl=Hs,Ql=Us;function Zl(t){const e=N.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(Kl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Yl(t){const e=N.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=A("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(Jl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function ec(t){const e=N.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=A("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(pr,{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(Gl,{className:"flex",children:o.jsxs(Xl,{"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 tc(t){const e=N.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=A("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(Ql,{"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 nc(t){const{updateStep:e}=ne(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=xn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function sc(t){const e=N.c(48),{className:n}=t,s=Ge(),{appendStep:i}=ne();nc(s);const r=K(),{item:l}=pe(r);if(!s){let O;e[0]!==n?(O=A("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=O):O=e[1];let M;e[2]!==i?(M=()=>{i({type:"tool"})},e[2]=i,e[3]=M):M=e[3];let D;e[4]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(Xn,{size:14}),e[4]=D):D=e[4];let I;e[5]!==M?(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(X,{variant:"ghost",size:"icon",className:"size-7",onClick:M,children:D})]}),e[5]=M,e[6]=I):I=e[6];let E;return e[7]!==O||e[8]!==I?(E=o.jsx("div",{className:O,children:I}),e[7]=O,e[8]=I,e[9]=E):E=e[9],E}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 O;e[15]!==c?(O=M=>M===c||M.startsWith(`${c}[`),e[15]=c,e[16]=O):O=e[16],u=d.some(O),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let x;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(x=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=x):x=e[20];const p=x,h=!!(l?.completed_steps?.success?.some(O=>O.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=A("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,S;e[23]!==s?(j=o.jsx(oc,{step:s}),S=o.jsx(ic,{step:s}),e[23]=s,e[24]=j,e[25]=S):(j=e[24],S=e[25]);const y=`${c}-${h?"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]!==h||e[31]!==g||e[32]!==y||e[33]!==v?(w=o.jsx(cc,{step:s,defaultOpen:h,isStepErrored:g,executionError:v},y),e[29]=s,e[30]=h,e[31]=g,e[32]=y,e[33]=v,e[34]=w):w=e[34];let C;e[35]!==s||e[36]!==r?(C=!r&&o.jsx(pc,{step:s}),e[35]=s,e[36]=r,e[37]=C):C=e[37];let $;e[38]!==s||e[39]!==r?($=!r&&o.jsx(gc,{step:s}),e[38]=s,e[39]=r,e[40]=$):$=e[40];let _;return e[41]!==C||e[42]!==$||e[43]!==b||e[44]!==j||e[45]!==S||e[46]!==w?(_=o.jsxs("div",{className:b,children:[j,S,w,C,$]}),e[41]=C,e[42]=$,e[43]=b,e[44]=j,e[45]=S,e[46]=w,e[47]=_):_=e[47],_}function oc(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=K(),l=i??"";let c;e[0]!==l?(c=o.jsx(xt,{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(rc,{}),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 rc(){const t=N.c(9),e=Ge(),{updateStep:n,startReplacingTool:s}=ne(),i=K(),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(fs,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(X,{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 xn(t){const e=N.c(16),{org:n}=Q(),s=Qe();let i;e[0]!==n.id||e[1]!==s?(i=s??Ke(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=re(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=Yt(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(x=>x.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 ic(t){const e=N.c(18),{step:n}=t,{updateStep:s}=ne(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=K(),{tool:c}=xn(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?lc(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 x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ec,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=x):x=e[7];const p=n.name+l,h=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let S;e[9]!==d||e[10]!==p||e[11]!==h||e[12]!==g||e[13]!==b?(S=o.jsxs(Yl,{value:"input",className:"border-b-0",children:[x,o.jsx(tc,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:h,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=h,e[12]=g,e[13]=b,e[14]=S):S=e[14];let y;return e[15]!==S||e[16]!==m?(y=o.jsx(Zl,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:S}),e[15]=S,e[16]=m,e[17]=y):y=e[17],y}function lc(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function cc(t){const e=N.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=K(),{item:a}=pe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=F=>F===n.name||F.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),x=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(F=>F.name===n.name)||f||x),[h,g]=k.useState(s),b=n.forEach!==void 0,[j,S]=k.useState("all"),y=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(F=>y.test(F.name)).map(F=>{const be=F.name.match(y);return{index:Number(be[1]),status:"success"}}):[],C=(b?d.filter(F=>y.test(F)):[]).map(F=>{const be=F.match(y);return{index:Number(be[1]),status:"error"}}),$=[...v,...C].sort(dc),_=$.length>0,O=b&&j!=="all"?`${n.name}[${j}]`:void 0,M=p?n.name:void 0,D=O??M,{output:I,error:E}=js(c,D);let z;e[2]!==E||e[3]!==r||e[4]!==i||e[5]!==I?(z=I||(E?{error:E}:i&&r?{error:r}:void 0),e[2]=E,e[3]=r,e[4]=i,e[5]=I,e[6]=z):z=e[6];const H=z,G=l&&typeof l=="object"?l.properties:void 0;let U;e[7]!==G?(U=G?Object.entries(G):[],e[7]=G,e[8]=U):U=e[8];const V=U,Z=j!=="all"&&C.some(F=>F.index===j),ie=j==="all"?i||f||x:Z,Y=h?"flex-1 min-h-0 overflow-hidden":"shrink-0";let W;e[9]!==Y?(W=A("flex flex-col border-b border-border",Y),e[9]=Y,e[10]=W):W=e[10];let B;e[11]!==h||e[12]!==g?(B=()=>g(!h),e[11]=h,e[12]=g,e[13]=B):B=e[13];const q=ie?"text-destructive":"text-muted-foreground";let ee;e[14]!==q?(ee=A("text-sm font-medium",q),e[14]=q,e[15]=ee):ee=e[15];const te=ie?"Error":"Output";let le;e[16]!==ee||e[17]!==te?(le=o.jsx("h3",{className:ee,children:te}),e[16]=ee,e[17]=te,e[18]=le):le=e[18];let ce;e[19]!==h?(ce=h?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"}),e[19]=h,e[20]=ce):ce=e[20];let se;e[21]!==le||e[22]!==ce?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[le,ce]}),e[21]=le,e[22]=ce,e[23]=se):se=e[23];let T;e[24]!==se||e[25]!==B?(T=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:B,children:se}),e[24]=se,e[25]=B,e[26]=T):T=e[26];let R;e[27]!==$||e[28]!==H||e[29]!==_||e[30]!==b||e[31]!==h||e[32]!==V||e[33]!==j||e[34]!==S||e[35]!==n.name||e[36]!==c?(R=h&&o.jsxs(o.Fragment,{children:[c&&b&&_&&o.jsx(uc,{iterations:$,selectedIteration:j,onSelect:S}),c&&H?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Fe,{code:JSON.stringify(H,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&V.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:V.map(ac)})]}),e[27]=$,e[28]=H,e[29]=_,e[30]=b,e[31]=h,e[32]=V,e[33]=j,e[34]=S,e[35]=n.name,e[36]=c,e[37]=R):R=e[37];let P;return e[38]!==T||e[39]!==R||e[40]!==W?(P=o.jsxs("div",{className:W,children:[T,R]}),e[38]=T,e[39]=R,e[40]=W,e[41]=P):P=e[41],P}function ac(t){const[e,n]=t;return o.jsx(mc,{name:e,schema:n},e)}function dc(t,e){return t.index-e.index}function uc(t){const e=N.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=A("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=h=>{const g=s===h.index;return o.jsxs("button",{type:"button",className:A("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(h.index),children:[h.status==="success"?o.jsx(gt,{size:12,className:"text-success"}):o.jsx(sn,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",h.index]})]},h.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(xr,{orientation:"horizontal"}),e[18]=m):m=e[18];let x;return e[19]!==f?(x=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(hr,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=x):x=e[20],x}function fc(t){switch(t){case"string":return{Icon:rs,color:"text-blue-500"};case"number":case"integer":return{Icon:ss,color:"text-blue-500"};case"array":return{Icon:es,color:"text-purple-500"};case"object":return{Icon:Yn,color:"text-orange-500"};case"boolean":return{Icon:os,color:"text-pink-500"};case"null":return{Icon:Bt,color:"text-gray-500"};default:return{Icon:ts,color:"text-muted-foreground"}}}function mc(t){const e=N.c(28),{name:n,schema:s}=t,i=Ge(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:y,color:v}=fc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=y,c=14,a=A(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 x;e[12]!==d||e[13]!==f||e[14]!==m?(x=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=x):x=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(as,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const h=i?.name;let g;e[17]!==h?(g=o.jsxs("span",{className:"text-muted-foreground",children:[h,"."]}),e[17]=h,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 S;return e[24]!==j||e[25]!==u||e[26]!==x?(S=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=S):S=e[27],S}function pc(t){const e=N.c(29),{step:n}=t,{updateStep:s}=ne(),i=K(),[r,l]=k.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=xn(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
- }`;const E=d.outputSchema,_=E.properties;return _?`interface Input {
10
- ${Object.entries(_).map(M=>{const[D,I]=M,$=nt(I),z=!E.required?.includes(D);return` ${D}${z?"?":""}: ${$};`}).join(`
9
+ }`;const $=d.outputSchema,_=$.properties;return _?`interface Input {
10
+ ${Object.entries(_).map(M=>{const[D,I]=M,E=tt(I),z=!$.required?.includes(D);return` ${D}${z?"?":""}: ${E};`}).join(`
11
11
  `)}
12
12
  }`:`interface Input {
13
13
  [key: string]: unknown;
@@ -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:_}}),l(xc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const p=x;let h;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(h=(E,_)=>{s(n.name,{action:{...n.action,transformCode:E},..._?{outputSchema:_}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=h):h=e[10];const g=h;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=A("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 S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=S):S=e[13];let y;e[14]!==r?(y=o.jsxs("div",{className:"flex items-center justify-between",children:[S,r?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=y):y=e[15];let v;e[16]!==y||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:y}),e[16]=y,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(Fe,{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 k;return e[25]!==j||e[26]!==v||e[27]!==w?(k=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=k):k=e[28],k}function xc(t){return!t}function hc(t){return!t}function gc(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=ne(),l="code"in n.action&&n.action.code?n.action.code:null,c=K();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,S)=>{r(n.name,{action:{...n.action,code:j},...S?{outputSchema:S}:{}})},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=A("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 x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=x):x=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let h;e[11]!==m||e[12]!==p?(h=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]=h):h=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(Fe,{onSave:(j,S)=>d(j,S),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]!==h||e[22]!==g?(b=o.jsxs("div",{className:f,children:[h,g]}),e[20]=f,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}function nt(t){if(Array.isArray(t.type))return t.type.map(n=>nt({...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?`${nt(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=nt(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function bc(t){switch(t){case"success":return o.jsxs(he,{variant:"success",className:"gap-1",children:[o.jsx(bt,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(he,{variant:"destructive",className:"gap-1",children:[o.jsx(ln,{size:11}),"Error"]});case"running":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(tt,{size:11}),"Running"]});case"enqueued":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(tt,{size:11}),"On hold"]});case"cancelled":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(Qn,{size:11}),"Cancelled"]});default:return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(tt,{size:11}),t]})}}function jc(t){return`Run #${t.slice(-4).toUpperCase()}`}function vc(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=ri(),{setShowExecutionsList:r}=an(),{setTrackingExecutionId:l}=ne(),c=K();let a;e[0]!==l?(a=S=>{l(S)},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=A("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=x):x=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 h;e[8]!==f?(h=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(X,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=h):h=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((S,y)=>o.jsx(Sc,{execution:S,isSelected:S.id===c,isFirst:y===0,onSelect:()=>d(S.id)},S.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]!==h||e[19]!==b?(j=o.jsxs("div",{className:m,children:[h,b]}),e[17]=m,e[18]=h,e[19]=b,e[20]=j):j=e[20],j}function Sc(t){const e=N.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=A("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=bc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=jc(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 x;e[10]!==u||e[11]!==m?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=x):x=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==x?(p=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=p):p=e[16],p}const yc=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],wc=Mo({buildUrl:t=>`/org/${t}/watch?types=workflow.*`,eventTypes:yc}),Nc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],Cc=500,qe=new Map,Be=new Map;function kc(t){const e=Be.get(t);if(e)for(const n of e)n.invalidateQueries({predicate:s=>s.queryKey.some(i=>typeof i=="string"&&Nc.includes(i))})}function Ic(t){qe.has(t)||qe.set(t,setTimeout(()=>{qe.delete(t),kc(t)},Cc))}const En=()=>0;function _c(){const t=N.c(3),{org:e}=Z(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{let c=Be.get(s);c||(c=new Set,Be.set(s,c)),c.add(n);const a=()=>{Ic(s),l()},d=wc.subscribe(s,a);return()=>{d(),c.delete(n),c.size===0&&Be.delete(s);const u=qe.get(s);u&&!Be.has(s)&&(clearTimeout(u),qe.delete(s))}},t[0]=s,t[1]=n,t[2]=i):i=t[2];const r=i;C.useSyncExternalStore(r,En,En)}function qs(t){const e=N.c(11),{itemId:n}=t,[s,i]=C.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}=ge(r),c=l??"no-connection",{org:a}=Z(),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=re(u),m=qt(c,"WORKFLOW",n,f),x=Kt(c,"WORKFLOW",f);let p;e[4]!==x||e[5]!==n?(p=async b=>{i(!0),await x.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=x,e[5]=n,e[6]=p):p=e[6];const h=p;let g;return e[7]!==s||e[8]!==m||e[9]!==h?(g={item:m,update:h,isUpdating:s},e[7]=s,e[8]=m,e[9]=h,e[10]=g):g=e[10],g}function Tc(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ne();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=Fe,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 Ec(){const t=N.c(9),e=K(),{item:n}=pe(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=C.useRef(l);let a;t[1]!==r?(a=h=>{if(!r)return $c;const g=setInterval(()=>{c.current=Date.now(),h()},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=C.useSyncExternalStore(d,f,f),x=i&&s?Math.max(0,i-s):null;let p=null;if(s){let h;t[5]!==s?(h=new Date(s).getTime(),t[5]=s,t[6]=h):h=t[6];const g=h;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??x}function $c(){}function Oc(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 Rc(){const t=N.c(26),{setTrackingExecutionId:e}=ne(),n=K(),{item:s}=pe(n),i=Ec();let r;t[0]!==i?(r=i!=null?Oc(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 x;t[6]!==d?(x=d&&o.jsxs(he,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=x):x=t[7];let p;t[8]!==a?(p=a&&o.jsxs(he,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(vr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let h;t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(gr,{className:"w-4 h-4 text-muted-foreground"}),t[10]=h):h=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[h,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]!==x||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,x,p,g]}),t[13]=m,t[14]=x,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 S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Bt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=S):S=t[20];let y;t[21]!==j?(y=o.jsx(X,{variant:"ghost",size:"xs",onClick:j,children:S}),t[21]=j,t[22]=y):y=t[22];let v;return t[23]!==y||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,y]})}),t[23]=y,t[24]=b,t[25]=v):v=t[25],v}function Ac(){const t=N.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}=ge(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(ve,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(nn,{icon:o.jsx(ns,{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(Mc,{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(Jr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function Mc(t){const e=N.c(21),{onUpdate:n,isUpdating:s}=t;_c();const i=He(),r=K(),{viewMode:l,showExecutionsList:c}=an(),a=Ge();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,x=f&&!m&&!r,p=!x&&(a||r||!c);let h;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(h=o.jsx(ul,{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]=h):h=e[7];let g;e[8]!==r?(g=r&&o.jsx(Rc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==x||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(Tc,{workflow:i,onUpdate:n}):o.jsxs(zo,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx(El,{})}),o.jsx(Wo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[x&&o.jsx(Rl,{className:"border-l border-border"}),c&&o.jsx(vc,{}),p&&o.jsx(sc,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=x,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==h||e[18]!==g||e[19]!==b?(j=o.jsx(ve,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[h,g,b]})}),e[17]=h,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Pc(t){const e=N.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}=ge(s),r=i??"no-connection",{org:l}=Z(),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=re(a),u=qt(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 Lc(){const t=N.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}=ge(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Pc(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ve,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(nn,{icon:o.jsx(ns,{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(ve,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Fe,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const Dc={workflow:Ac,workflow_execution:Lc,prompt:Ir};function zc(){const t=N.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=ge(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=Wc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Mr,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Wc(t){return Promise.resolve()}function Fc(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Hc(){const t=N.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=ge(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}=Z(),f=xt(i),m=i??null;let x;t[3]!==u.id||t[4]!==m?(x={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=x):x=t[5];const p=re(x),h=Kt(d,r,p);let g;t[6]!==h||t[7]!==l?(g=async H=>{l&&await h.update.mutateAsync({id:l,data:H})},t[6]=h,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 S=j,y=S&&Dc[S];let v;t[11]!==r?(v=Fc(r),t[11]=r,t[12]=v):v=t[12];const w=v;let k;t[13]!==u.slug?(k=o.jsx(We,{children:o.jsx(at,{asChild:!0,children:o.jsx(st,{to:"/$org/$project/mcps",params:{org:u.slug,project:ot},children:"Connections"})})}),t[13]=u.slug,t[14]=k):k=t[14];let E;t[15]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(dt,{}),t[15]=E):E=t[15];let _;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(_=f&&o.jsxs(o.Fragment,{children:[o.jsx(We,{children:o.jsx(at,{asChild:!0,children:o.jsx(st,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:ot,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(dt,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=_):_=t[20];let O;t[21]!==w?(O=o.jsx(We,{children:o.jsx(Jn,{children:w})}),t[21]=w,t[22]=O):O=t[22];let M;t[23]!==O||t[24]!==k||t[25]!==_?(M=o.jsx(qn,{children:o.jsxs(Kn,{children:[k,E,_,O]})}),t[23]=O,t[24]=k,t[25]=_,t[26]=M):M=t[26];const D=M;if(y){let H;return t[27]!==y||t[28]!==a||t[29]!==b||t[30]!==l?(H=o.jsx(y,{itemId:l,onBack:a,onUpdate:b}),t[27]=y,t[28]=a,t[29]=b,t[30]=l,t[31]=H):H=t[31],H}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Do,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let $;t[33]!==a?($=o.jsx(nn,{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]=$):$=t[34];let z;return t[35]!==D||t[36]!==$?(z=o.jsx(ve,{breadcrumb:D,children:$}),t[35]=D,t[36]=$,t[37]=z):z=t[37],z}function Vc(){const t=N.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=ge(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(zc,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Hc,{}),t[2]=r):r=t[2],r}function wd(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx($n,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(pt,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Vc,{})})}),t[0]=e):e=t[0],e}export{wd as default};
26
+ }`;s(n.name,{action:{...n.action,transformCode:_}}),l(xc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const p=x;let h;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(h=($,_)=>{s(n.name,{action:{...n.action,transformCode:$},..._?{outputSchema:_}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=h):h=e[10];const g=h;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=A("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 S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=S):S=e[13];let y;e[14]!==r?(y=o.jsxs("div",{className:"flex items-center justify-between",children:[S,r?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=y):y=e[15];let v;e[16]!==y||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:y}),e[16]=y,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(Fe,{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 C;return e[25]!==j||e[26]!==v||e[27]!==w?(C=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=C):C=e[28],C}function xc(t){return!t}function hc(t){return!t}function gc(t){const e=N.c(24),{step:n}=t,[s,i]=k.useState(!1),{updateStep:r}=ne(),l="code"in n.action&&n.action.code?n.action.code:null,c=K();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,S)=>{r(n.name,{action:{...n.action,code:j},...S?{outputSchema:S}:{}})},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=A("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 x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=x):x=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx(rn,{size:14,className:"text-muted-foreground"}):o.jsx(on,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let h;e[11]!==m||e[12]!==p?(h=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]=h):h=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(Fe,{onSave:(j,S)=>d(j,S),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]!==h||e[22]!==g?(b=o.jsxs("div",{className:f,children:[h,g]}),e[20]=f,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}function tt(t){if(Array.isArray(t.type))return t.type.map(n=>tt({...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?`${tt(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=tt(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function bc(t){switch(t){case"success":return o.jsxs(he,{variant:"success",className:"gap-1",children:[o.jsx(gt,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(he,{variant:"destructive",className:"gap-1",children:[o.jsx(ln,{size:11}),"Error"]});case"running":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(Et,{size:11}),"Running"]});case"enqueued":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(Et,{size:11}),"On hold"]});case"cancelled":return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(Zn,{size:11}),"Cancelled"]});default:return o.jsxs(he,{variant:"secondary",className:"gap-1",children:[o.jsx(Et,{size:11}),t]})}}function jc(t){return`Run #${t.slice(-4).toUpperCase()}`}function vc(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=ri(),{setShowExecutionsList:r}=an(),{setTrackingExecutionId:l}=ne(),c=K();let a;e[0]!==l?(a=S=>{l(S)},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=A("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=x):x=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Zn,{size:11}),e[7]=p):p=e[7];let h;e[8]!==f?(h=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(X,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=h):h=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((S,y)=>o.jsx(Sc,{execution:S,isSelected:S.id===c,isFirst:y===0,onSelect:()=>d(S.id)},S.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]!==h||e[19]!==b?(j=o.jsxs("div",{className:m,children:[h,b]}),e[17]=m,e[18]=h,e[19]=b,e[20]=j):j=e[20],j}function Sc(t){const e=N.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=A("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=bc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=jc(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 x;e[10]!==u||e[11]!==m?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=x):x=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==x?(p=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=p):p=e[16],p}const yc=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],wc=Mo({buildUrl:t=>`/org/${t}/watch?types=workflow.*`,eventTypes:yc}),Nc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],Cc=500,qe=new Map,Be=new Map;function kc(t){const e=Be.get(t);if(e)for(const n of e)n.invalidateQueries({predicate:s=>s.queryKey.some(i=>typeof i=="string"&&Nc.includes(i))})}function Ic(t){qe.has(t)||qe.set(t,setTimeout(()=>{qe.delete(t),kc(t)},Cc))}const $n=()=>0;function _c(){const t=N.c(3),{org:e}=Q(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{let c=Be.get(s);c||(c=new Set,Be.set(s,c)),c.add(n);const a=()=>{Ic(s),l()},d=wc.subscribe(s,a);return()=>{d(),c.delete(n),c.size===0&&Be.delete(s);const u=qe.get(s);u&&!Be.has(s)&&(clearTimeout(u),qe.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=N.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}=ge(r),c=l??"no-connection",{org:a}=Q(),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=re(u),m=qt(c,"WORKFLOW",n,f),x=Kt(c,"WORKFLOW",f);let p;e[4]!==x||e[5]!==n?(p=async b=>{i(!0),await x.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=x,e[5]=n,e[6]=p):p=e[6];const h=p;let g;return e[7]!==s||e[8]!==m||e[9]!==h?(g={item:m,update:h,isUpdating:s},e[7]=s,e[8]=m,e[9]=h,e[10]=g):g=e[10],g}function Tc(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ne();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=Fe,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 $c(){const t=N.c(9),e=K(),{item:n}=pe(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=h=>{if(!r)return Ec;const g=setInterval(()=>{c.current=Date.now(),h()},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),x=i&&s?Math.max(0,i-s):null;let p=null;if(s){let h;t[5]!==s?(h=new Date(s).getTime(),t[5]=s,t[6]=h):h=t[6];const g=h;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??x}function Ec(){}function Oc(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 Rc(){const t=N.c(26),{setTrackingExecutionId:e}=ne(),n=K(),{item:s}=pe(n),i=$c();let r;t[0]!==i?(r=i!=null?Oc(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 x;t[6]!==d?(x=d&&o.jsxs(he,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=x):x=t[7];let p;t[8]!==a?(p=a&&o.jsxs(he,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(vr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let h;t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(gr,{className:"w-4 h-4 text-muted-foreground"}),t[10]=h):h=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[h,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]!==x||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,x,p,g]}),t[13]=m,t[14]=x,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 S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Bt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=S):S=t[20];let y;t[21]!==j?(y=o.jsx(X,{variant:"ghost",size:"xs",onClick:j,children:S}),t[21]=j,t[22]=y):y=t[22];let v;return t[23]!==y||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,y]})}),t[23]=y,t[24]=b,t[25]=v):v=t[25],v}function Ac(){const t=N.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}=ge(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(ve,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(nn,{icon:o.jsx(ns,{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(Mc,{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(Jr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function Mc(t){const e=N.c(21),{onUpdate:n,isUpdating:s}=t;_c();const i=He(),r=K(),{viewMode:l,showExecutionsList:c}=an(),a=Ge();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,x=f&&!m&&!r,p=!x&&(a||r||!c);let h;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(h=o.jsx(ul,{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]=h):h=e[7];let g;e[8]!==r?(g=r&&o.jsx(Rc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==x||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(Tc,{workflow:i,onUpdate:n}):o.jsxs(zo,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx($l,{})}),o.jsx(Wo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[x&&o.jsx(Rl,{className:"border-l border-border"}),c&&o.jsx(vc,{}),p&&o.jsx(sc,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=x,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==h||e[18]!==g||e[19]!==b?(j=o.jsx(ve,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[h,g,b]})}),e[17]=h,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Pc(t){const e=N.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}=ge(s),r=i??"no-connection",{org:l}=Q(),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=re(a),u=qt(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 Lc(){const t=N.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}=ge(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Pc(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ve,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(nn,{icon:o.jsx(ns,{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(ve,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Fe,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const Dc={workflow:Ac,workflow_execution:Lc,prompt:Ir};function zc(){const t=N.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=ge(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=Wc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Mr,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Wc(t){return Promise.resolve()}function Fc(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Hc(){const t=N.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=ge(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}=Q(),f=pt(i),m=i??null;let x;t[3]!==u.id||t[4]!==m?(x={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=x):x=t[5];const p=re(x),h=Kt(d,r,p);let g;t[6]!==h||t[7]!==l?(g=async H=>{l&&await h.update.mutateAsync({id:l,data:H})},t[6]=h,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 S=j,y=S&&Dc[S];let v;t[11]!==r?(v=Fc(r),t[11]=r,t[12]=v):v=t[12];const w=v;let C;t[13]!==u.slug?(C=o.jsx(We,{children:o.jsx(ct,{asChild:!0,children:o.jsx(nt,{to:"/$org/$project/mcps",params:{org:u.slug,project:st},children:"Connections"})})}),t[13]=u.slug,t[14]=C):C=t[14];let $;t[15]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(at,{}),t[15]=$):$=t[15];let _;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(_=f&&o.jsxs(o.Fragment,{children:[o.jsx(We,{children:o.jsx(ct,{asChild:!0,children:o.jsx(nt,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:st,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(at,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=_):_=t[20];let O;t[21]!==w?(O=o.jsx(We,{children:o.jsx(Jn,{children:w})}),t[21]=w,t[22]=O):O=t[22];let M;t[23]!==O||t[24]!==C||t[25]!==_?(M=o.jsx(qn,{children:o.jsxs(Kn,{children:[C,$,_,O]})}),t[23]=O,t[24]=C,t[25]=_,t[26]=M):M=t[26];const D=M;if(y){let H;return t[27]!==y||t[28]!==a||t[29]!==b||t[30]!==l?(H=o.jsx(y,{itemId:l,onBack:a,onUpdate:b}),t[27]=y,t[28]=a,t[29]=b,t[30]=l,t[31]=H):H=t[31],H}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Do,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let E;t[33]!==a?(E=o.jsx(nn,{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]=E):E=t[34];let z;return t[35]!==D||t[36]!==E?(z=o.jsx(ve,{breadcrumb:D,children:E}),t[35]=D,t[36]=E,t[37]=z):z=t[37],z}function Vc(){const t=N.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=ge(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(zc,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Hc,{}),t[2]=r):r=t[2],r}function yd(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(En,{children:o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(mt,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Vc,{})})}),t[0]=e):e=t[0],e}export{yd as default};