@decocms/mesh 2.59.2 → 2.59.3
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.
- package/dist/client/assets/{AlertCircle--GzH2vta.js → AlertCircle-xn5rFX2T.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DzpTEYvO.js → ArrowLeft-Bb6bw7wO.js} +1 -1
- package/dist/client/assets/{ArrowUp-BfBrilbk.js → ArrowUp-DmmjiRhr.js} +1 -1
- package/dist/client/assets/Calendar-DjDp3sZ6.js +1 -0
- package/dist/client/assets/{Check-CXkamnnr.js → Check-CP3euUrF.js} +1 -1
- package/dist/client/assets/{ChevronDown-DaqG_J6Z.js → ChevronDown-sM8LyvvZ.js} +1 -1
- package/dist/client/assets/{Code01-BNQVP8-g.js → Code01-DR-jbECo.js} +1 -1
- package/dist/client/assets/{Copy01-CpBgXJFP.js → Copy01-Ds6kUzpe.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BDAFctKq.js → DotsHorizontal-DZRRv704.js} +1 -1
- package/dist/client/assets/{DotsVertical-D5MnD2QZ.js → DotsVertical-DZEGrhum.js} +1 -1
- package/dist/client/assets/{Download01-4Tu3o0-K.js → Download01-BxIh__MC.js} +1 -1
- package/dist/client/assets/{Edit01-7Ak8JL9W.js → Edit01-BVZvpfR8.js} +1 -1
- package/dist/client/assets/File02-Dh_9xh7Q.js +1 -0
- package/dist/client/assets/{File06-C7QVLRp6.js → File06-B5Dv7-Oa.js} +1 -1
- package/dist/client/assets/{FilterLines-UNZ5Kk_X.js → FilterLines-DH_DosQX.js} +1 -1
- package/dist/client/assets/{Grid01-C_dMOr-7.js → Grid01-BRgRtmbs.js} +1 -1
- package/dist/client/assets/{Home02-Cfg1gm8U.js → Home02-lEMcKcn1.js} +1 -1
- package/dist/client/assets/{Image01-C6IcS9Ip.js → Image01-DoUr5ERm.js} +1 -1
- package/dist/client/assets/{Inbox01-D1IW7Je7.js → Inbox01-DGDxlReT.js} +1 -1
- package/dist/client/assets/{InfoCircle-Dwuc2RiH.js → InfoCircle-BzAYvvO0.js} +1 -1
- package/dist/client/assets/{Key01-CrwOIsjX.js → Key01-DYMhbAB1.js} +1 -1
- package/dist/client/assets/{LinkExternal01-yVEf-2cT.js → LinkExternal01-CG-vKoro.js} +1 -1
- package/dist/client/assets/{List-d88_8fTd.js → List-7uuZoLIU.js} +1 -1
- package/dist/client/assets/{Loading01-Bf56vlFv.js → Loading01-CaAuMuYs.js} +1 -1
- package/dist/client/assets/{Lock01-CQ0bp8OP.js → Lock01-B3UR0GHM.js} +1 -1
- package/dist/client/assets/{Pin01-DBKe5RmK.js → Pin01-YRdxhSee.js} +1 -1
- package/dist/client/assets/Play-CUJHUsFq.js +1 -0
- package/dist/client/assets/{Plus-CcqPpwU0.js → Plus-BfTBbS63.js} +1 -1
- package/dist/client/assets/{SearchMd-Ns-pswyj.js → SearchMd-DVKxUKrX.js} +1 -1
- package/dist/client/assets/{Share07-B5yrbjwk.js → Share07-DC87ym6H.js} +1 -1
- package/dist/client/assets/{Terminal-qZhwvVsv.js → Terminal-Csxea4Ut.js} +1 -1
- package/dist/client/assets/Tool01-ChloSpuN.js +1 -0
- package/dist/client/assets/{Trash01-DVYV3BJw.js → Trash01-DFo133oe.js} +1 -1
- package/dist/client/assets/{Upload01-CCAaxnrW.js → Upload01-D1Hk2Al6.js} +1 -1
- package/dist/client/assets/{Users03-CSRHEIl2.js → Users03-D4Z1AQ9s.js} +1 -1
- package/dist/client/assets/{X-Dz8JZ2ZX.js → X-DhTQLdE5.js} +1 -1
- package/dist/client/assets/{XClose-BhgPfyG3.js → XClose-DnQCXbLq.js} +1 -1
- package/dist/client/assets/agent-detail-ByBpnMWY.js +1 -0
- package/dist/client/assets/{agents-4MJAHJGV.js → agents-EruM84S0.js} +1 -1
- package/dist/client/assets/{alert-dialog-5t1wq8Xl.js → alert-dialog-DZDASW_Y.js} +3 -3
- package/dist/client/assets/{auth-catchall-CTOFzXVU.js → auth-catchall-DMglr4vj.js} +1 -1
- package/dist/client/assets/{avatar-Cx4ORVtq.js → avatar-D8fhy6Ww.js} +1 -1
- package/dist/client/assets/{badge-DfeUgg96.js → badge-DUUncEQr.js} +1 -1
- package/dist/client/assets/{binder-Dh-m11Sm.js → binder-BPAsHHtz.js} +1 -1
- package/dist/client/assets/{button-C83AQWC1.js → button-CrpAre8y.js} +1 -1
- package/dist/client/assets/{card-CbXWWn3M.js → card-DFAR9fdq.js} +1 -1
- package/dist/client/assets/{checkbox-DcPieRc5.js → checkbox-C3_7sazf.js} +1 -1
- package/dist/client/assets/{circle-alert-ChrxIBwd.js → circle-alert-CKX7xMwa.js} +1 -1
- package/dist/client/assets/collapsible-CNHksBot.js +23 -0
- package/dist/client/assets/{collection-detail-B_qs3xwg.js → collection-detail-P4xS7bsU.js} +4 -4
- package/dist/client/assets/{collection-display-button-DlAEKbje.js → collection-display-button-Bg3dpeu8.js} +1 -1
- package/dist/client/assets/{collection-header-Fc9BtUxQ.js → collection-header-otDJIXED.js} +1 -1
- package/dist/client/assets/{collection-page-DvzZtNQd.js → collection-page-CUjvCEL-.js} +1 -1
- package/dist/client/assets/collection-search-DCaFQu6x.js +1 -0
- package/dist/client/assets/{collection-tab-BB_A78nH.js → collection-tab-CzmKWGIs.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Ch8oh2UW.js → collection-table-wrapper-DGYtCyoO.js} +1 -1
- package/dist/client/assets/connect-BdCEolcr.js +1 -0
- package/dist/client/assets/{connection-card-BZU7F7-m.js → connection-card-rs_E5lwE.js} +1 -1
- package/dist/client/assets/connection-detail-DmZtLLGV.js +1 -0
- package/dist/client/assets/{connections-dluTnyJM.js → connections-cBCnIsVT.js} +1 -1
- package/dist/client/assets/constants-AccVhxEg.js +1 -0
- package/dist/client/assets/{constants-ytntCGH9.js → constants-CAezfWK1.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-GjXRxTaj.js → create-organization-dialog-BPmyxFH3.js} +1 -1
- package/dist/client/assets/{dialog-D_ebnPDF.js → dialog-DHQqGK7g.js} +1 -1
- package/dist/client/assets/dropdown-menu-C8F0EsLR.js +1 -0
- package/dist/client/assets/{dynamic-plugin-layout-DrCIvG61.js → dynamic-plugin-layout-D4RjVErB.js} +1 -1
- package/dist/client/assets/{empty-state-Cr5g6Vh9.js → empty-state--pBjJrWJ.js} +1 -1
- package/dist/client/assets/{empty-state-CxA9hap0.js → empty-state-DrxI6i2r.js} +1 -1
- package/dist/client/assets/{env-vars-editor-DXJo5cdV.js → env-vars-editor-B2cK0oXN.js} +1 -1
- package/dist/client/assets/{error-boundary-Dg0Af8BA.js → error-boundary-C4ZiBZqG.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BYPMZtVW.js → extract-connection-data-BQo5YaFM.js} +1 -1
- package/dist/client/assets/file-browser-DsCPH1Ag.js +2 -0
- package/dist/client/assets/{form-BISYEAnP.js → form-DQQrIzsV.js} +1 -1
- package/dist/client/assets/grid-view-DW981ZW7.js +1 -0
- package/dist/client/assets/home-D-N7CfPC.js +1 -0
- package/dist/client/assets/index-BVCaXPqJ.js +1 -0
- package/dist/client/assets/{index-B-pYSGnK.js → index-CYuJPFs9.js} +1 -1
- package/dist/client/assets/index-CqeIU8-o.css +1 -0
- package/dist/client/assets/index-CsFpv8QQ.js +233 -0
- package/dist/client/assets/index-D55GsjfR.js +25 -0
- package/dist/client/assets/index-DaTQM6wc.js +1 -0
- package/dist/client/assets/{index-C8OOnmm1.js → index-M3wOD-T-.js} +2 -2
- package/dist/client/assets/{infiniteQueryObserver-B1N6PF-z.js → infiniteQueryObserver-CfX1I4Ag.js} +1 -1
- package/dist/client/assets/{input-CrR0FEof.js → input-YM08EPCC.js} +1 -1
- package/dist/client/assets/layout-BHkRlBCz.js +1 -0
- package/dist/client/assets/localstorage-keys-hwI1e15G.js +1 -0
- package/dist/client/assets/{login-BFXWEB6t.js → login-DST3z8Qq.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BkqLXiLL.js → mcp-oauth-PtJaIBSs.js} +1 -1
- package/dist/client/assets/{mcp-server-card-CkDDvd5o.js → mcp-server-card-BGCxJtFs.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-CuItqIIY.js → mcp-server-detail-CLu2K73s.js} +2 -2
- package/dist/client/assets/members-DdELhmRF.js +3 -0
- package/dist/client/assets/{monaco-editor-gim9RLZ3.js → monaco-editor-i9oMLTE9.js} +4 -4
- package/dist/client/assets/{monitoring-AmN2oTrM.js → monitoring-CVIH1wIi.js} +5 -5
- package/dist/client/assets/{oauth-callback-BO8hRY4t.js → oauth-callback-BHMg2ciL.js} +1 -1
- package/dist/client/assets/{page-BcZkyr2a.js → page-DAZ87OMt.js} +1 -1
- package/dist/client/assets/page-DVKYkPd1.js +1 -0
- package/dist/client/assets/{pin-to-sidebar-button-DbV8w54G.js → pin-to-sidebar-button-CnJDDpqU.js} +1 -1
- package/dist/client/assets/plugin-empty-state-CRXDez4A.js +1 -0
- package/dist/client/assets/plugin-header-BW0ZqJ9r.js +1 -0
- package/dist/client/assets/plugins-Ciz3DPby.js +1 -0
- package/dist/client/assets/popover-B_5ZVJni.js +1 -0
- package/dist/client/assets/{registry-utils-DekIcM3F.js → registry-utils-CcsfK0rU.js} +1 -1
- package/dist/client/assets/{resizable-V4jINWPU.js → resizable-rgbJMlXu.js} +1 -1
- package/dist/client/assets/{resource-tabs-BsRvwnyx.js → resource-tabs-DnsGbVCQ.js} +1 -1
- package/dist/client/assets/select-D2wMncj-.js +1 -0
- package/dist/client/assets/settings-CLiZONWL.js +1 -0
- package/dist/client/assets/shell-layout-Cjy6ltJC.js +3 -0
- package/dist/client/assets/{spinner-CwfYynNt.js → spinner-B3atGTOQ.js} +1 -1
- package/dist/client/assets/{store-invite-BErtY6PV.js → store-invite-Ckjal6E8.js} +1 -1
- package/dist/client/assets/switch-DKUU5EKy.js +1 -0
- package/dist/client/assets/{textarea-DRMuRqUv.js → textarea-55XlgpLZ.js} +1 -1
- package/dist/client/assets/{tools-list-DesNUyav.js → tools-list-ENMGYPBW.js} +1 -1
- package/dist/client/assets/tooltip-D1Jc2Tgr.js +1 -0
- package/dist/client/assets/typewriter-title-1wCftG4E.js +16 -0
- package/dist/client/assets/use-binding-DdMe4omo.js +23 -0
- package/dist/client/assets/use-collections-COu7mzCX.js +1 -0
- package/dist/client/assets/{use-connection-TLrid9RM.js → use-connection-D5-dSK3A.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Bi6QQFl1.js → use-create-virtual-mcp-BaTDfij5.js} +1 -1
- package/dist/client/assets/use-deco-chat-open-BRCU7WzQ.js +1 -0
- package/dist/client/assets/{use-list-state-DuKw_MMV.js → use-list-state-xhqAqE-A.js} +1 -1
- package/dist/client/assets/use-mcp-prompts-BLDzHD20.js +1 -0
- package/dist/client/assets/{use-members-g_5Yt7ve.js → use-members-IqhuQTuW.js} +1 -1
- package/dist/client/assets/{use-mobile-DQ806XzQ.js → use-mobile-DIZjLJK7.js} +1 -1
- package/dist/client/assets/use-organization-settings-D9D-nJ5w.js +1 -0
- package/dist/client/assets/{use-virtual-mcp-C8lLKpyG.js → use-virtual-mcp-Ciz726kq.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DZakeCfr.js +1 -0
- package/dist/client/assets/useMutation-i3JyomhH.js +1 -0
- package/dist/client/assets/useQuery-BQUu3Rwx.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-aRxFMhU5.js +1 -0
- package/dist/client/assets/{view-mode-toggle-jPeow5hv.js → view-mode-toggle-DWoBF8kY.js} +1 -1
- package/dist/client/assets/{workflow-pPSpZECL.js → workflow-BQn7VIZF.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +169 -169
- package/dist/server/migrate.js +176 -176
- package/dist/server/server.js +160 -160
- package/package.json +1 -1
- package/dist/client/assets/FlipBackward-Cc_OirbM.js +0 -1
- package/dist/client/assets/Play-l95VP5u9.js +0 -1
- package/dist/client/assets/agent-detail-nBBUtMd0.js +0 -1
- package/dist/client/assets/collection-search-bOTNZP0b.js +0 -1
- package/dist/client/assets/connect-DYIKCRWy.js +0 -1
- package/dist/client/assets/connection-detail-D3-I_W38.js +0 -1
- package/dist/client/assets/constants-CnfPGmdA.js +0 -1
- package/dist/client/assets/dropdown-menu-CzQCi3DZ.js +0 -1
- package/dist/client/assets/file-browser-2RP-n1Xp.js +0 -2
- package/dist/client/assets/grid-view-BzgHSliB.js +0 -1
- package/dist/client/assets/home-CZ1MSx2E.js +0 -1
- package/dist/client/assets/index-CIvJ2wFV.js +0 -255
- package/dist/client/assets/index-CmUKmcyS.js +0 -1
- package/dist/client/assets/index-HgNYu27A.js +0 -1
- package/dist/client/assets/index-c6ju_hIh.js +0 -25
- package/dist/client/assets/index-cFLiAqt_.css +0 -1
- package/dist/client/assets/layout-BGZtLEwK.js +0 -1
- package/dist/client/assets/localstorage-keys-N4jrVxvr.js +0 -1
- package/dist/client/assets/members-C3Nvqq2t.js +0 -3
- package/dist/client/assets/page-D-IBJ4SW.js +0 -1
- package/dist/client/assets/plugin-empty-state-Df2LAyPv.js +0 -1
- package/dist/client/assets/plugin-header-e5FObvvx.js +0 -1
- package/dist/client/assets/plugins-BOsIh96E.js +0 -1
- package/dist/client/assets/popover-B2yKs5LA.js +0 -1
- package/dist/client/assets/select-BlFReF6r.js +0 -1
- package/dist/client/assets/settings-cRTESMAX.js +0 -1
- package/dist/client/assets/shell-layout-BfC0vVyw.js +0 -3
- package/dist/client/assets/switch-DjW_2nBx.js +0 -1
- package/dist/client/assets/tool-set-selector-Btgo2YwH.js +0 -1
- package/dist/client/assets/tooltip-aHeHMhKh.js +0 -1
- package/dist/client/assets/typewriter-title-DRU6uRKP.js +0 -16
- package/dist/client/assets/use-binding-C2mDgpbB.js +0 -23
- package/dist/client/assets/use-collections-CkAaybvR.js +0 -1
- package/dist/client/assets/use-mcp-prompts-D5tApqEs.js +0 -1
- package/dist/client/assets/use-organization-settings-C-IzAdi1.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BUOCgX3w.js +0 -1
- package/dist/client/assets/useMutation-C4aXMLv3.js +0 -1
- package/dist/client/assets/useQuery-DNOH3p7p.js +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{bI as Q,r as C,o as As,s as mt,c as N,j as o,bj as It,u as Y,k as Ps,t as Ls,a as oe,f as zs,ab as gn,bE as F,bJ as Ds,an as Ws,al as _t,am as ne,ao as bn,ap as Hs,ah as Tt,ai as Fs,aq as jn,ak as vn,ax as Vs,ay as Bs,at as yn,az as Us,bK as $t,bL as qs,aj as Ks,bf as Js,b9 as Gs,bM as Zs,bt as wn}from"./index-C8OOnmm1.js";import{E as Sn,I as Ye,n as Xs}from"./empty-state-Cr5g6Vh9.js";import{E as Nn}from"./error-boundary-Dg0Af8BA.js";import{a as Et,u as Ot,f as Rt,e as Mt,d as At}from"./use-collections-CkAaybvR.js";import{u as ee,i as Qs}from"./constants-ytntCGH9.js";import{P as Pt}from"./pin-to-sidebar-button-DbV8w54G.js";import{B as V,c as O}from"./button-C83AQWC1.js";import{F as pt,a as Ys,b as Lt,d as zt}from"./form-BISYEAnP.js";import{I as Dt}from"./input-CrR0FEof.js";import{T as yt}from"./textarea-DRMuRqUv.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-aHeHMhKh.js";import{i as kn}from"./FlipBackward-Cc_OirbM.js";import{a as Cn,V as Wt,b as Ee}from"./layout-BGZtLEwK.js";import{S as In,a as _n,b as Tn,c as $n,d as wt}from"./select-BlFReF6r.js";import{i as eo}from"./AlertCircle--GzH2vta.js";import{s as to,M as Oe}from"./monaco-editor-gim9RLZ3.js";import{i as no}from"./Code01-BNQVP8-g.js";import{a as so}from"./Copy01-CpBgXJFP.js";import{i as ze}from"./Loading01-Bf56vlFv.js";import{i as Ht,n as oo}from"./Play-l95VP5u9.js";import{s as Ft}from"./XClose-BhgPfyG3.js";import{u as ro,O as io,M as lo,F as co,v as ao}from"./index-c6ju_hIh.js";import{u as Vt,b as uo}from"./use-connection-TLrid9RM.js";import{E as Bt}from"./empty-state-CxA9hap0.js";import{D as fo,a as mo}from"./use-binding-C2mDgpbB.js";import{b as En}from"./use-virtual-mcp-C8lLKpyG.js";import{b as po,R as rn,a as xo}from"./resizable-V4jINWPU.js";import{S as De}from"./spinner-CwfYynNt.js";import{V as ho}from"./view-mode-toggle-jPeow5hv.js";import{N as go,b as bo,c as jo,d as vo,m as Ke,P as yo,e as wo,R as So,f as No,g as ko,h as ln,E as Co,j as Io,T as _o,k as To,l as $o,n as On}from"./index-CIvJ2wFV.js";import{b as Eo,c as Oo,d as Ro,e as Mo,a as Ao,D as Po}from"./dialog-D_ebnPDF.js";import"./index-B-pYSGnK.js";import{s as Rn}from"./Plus-CcqPpwU0.js";import{i as Ut}from"./Check-CXkamnnr.js";import{i as Lo}from"./DotsHorizontal-BDAFctKq.js";import{D as zo,a as Do,b as Wo,c as cn}from"./dropdown-menu-CzQCi3DZ.js";import{i as Ho}from"./Grid01-C_dMOr-7.js";import{B as $e}from"./badge-DfeUgg96.js";import{i as Mn}from"./X-Dz8JZ2ZX.js";import"./useMutation-C4aXMLv3.js";import"./useQuery-DNOH3p7p.js";import"./Pin01-DBKe5RmK.js";import"./use-organization-settings-C-IzAdi1.js";import"./ArrowLeft-DzpTEYvO.js";import"./ChevronDown-DaqG_J6Z.js";import"./infiniteQueryObserver-B1N6PF-z.js";import"./mcp-oauth-BkqLXiLL.js";import"./env-vars-editor-DXJo5cdV.js";import"./Trash01-DVYV3BJw.js";import"./File06-C7QVLRp6.js";import"./Key01-CrwOIsjX.js";import"./extract-connection-data-BYPMZtVW.js";import"./constants-CnfPGmdA.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-DekIcM3F.js";import"./generate-id-Dyweu44Y.js";import"./Terminal-qZhwvVsv.js";import"./Users03-CSRHEIl2.js";import"./index-CmUKmcyS.js";import"./circle-alert-ChrxIBwd.js";import"./binder-Dh-m11Sm.js";import"./localstorage-keys-N4jrVxvr.js";import"./popover-B2yKs5LA.js";import"./Image01-C6IcS9Ip.js";import"./SearchMd-Ns-pswyj.js";import"./use-mcp-prompts-D5tApqEs.js";import"./ArrowUp-BfBrilbk.js";import"./Edit01-7Ak8JL9W.js";import"./use-create-virtual-mcp-Bi6QQFl1.js";const An=Q("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 Pn=Q("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 qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Fo=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Vo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Bo=Q("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 Ln=Q("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 zn=Q("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 Dn=Q("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 Wn=Q("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 Hn=Q("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"}]]),Jt=({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"}));Jt.displayName="AlertOctagon";const Fn=({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"}));Fn.displayName="Box";const Vn=({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"}));Vn.displayName="ClockFastForward";const Bn=({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"}));Bn.displayName="Code02";const Je=({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"}));Je.displayName="Columns01";const Un=({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"}));Un.displayName="CornerDownRight";const qn=({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"}));qn.displayName="Database01";const Kn=({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"}));Kn.displayName="GitBranch01";const Jn=({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"}));Jn.displayName="Repeat03";const Gt=({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:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";const Gn=({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:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));Gn.displayName="Tool01";As({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Uo(){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 qo(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(pt,{control:n.control,name:"title",render:Go}),o.jsx(pt,{control:n.control,name:"description",render:Jo})]})]}),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(pt,{control:n.control,name:"body",render:Ko})]}),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(Ys,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function Ko(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...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 Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...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 Go(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Zo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),m=Ot(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let h;e[5]!==p?(h={values:p},e[5]=p,e[6]=h):h=e[6];const g=Ps(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==m.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await m.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=m.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const w=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let S;e[17]!==f.description?(S=f.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:f.description})]}):null,e[17]=f.description,e[18]=S):S=e[18];let k;e[19]!==v||e[20]!==S?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,S]})}),e[19]=v,e[20]=S,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let A;e[25]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(kn,{size:14}),e[25]=A):A=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:A})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let M;e[32]!==w?(M=()=>{w()},e[32]=w,e[33]=M):M=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==M?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:M,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=M,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(qo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let X;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(X=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=X):X=e[51],X}function Xo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Uo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Zo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Qo=Ls("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 Yo(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=O(Qo({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=O("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 tr(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=O("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 nr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function sr(t){const e=N.c(10),{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=ro(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(lo,{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]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(or,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function or({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=zs({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:w}=Y(),v=Vt(e),S=ee({connectionId:e,orgId:w.id}),k=Rt({client:S}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,A=T?Object.keys(T):[],R=A.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of A)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!S)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await S.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),X=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${X}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},M=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??nr(t),url:i,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ye,{icon:v?.icon||null,name:v?.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:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{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:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.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"}),I?.inputSchema?.required&&I.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:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>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:[_,I.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>M(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>M(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(wt,{value:"true",children:"true"}),o.jsx(wt,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>M(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),j&&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(to,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!m&&!p,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Yo,{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(eo,{className:"h-4 w-4"}),o.jsx(er,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(tr,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),gn.success("Copied to clipboard")},children:o.jsx(so,{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(no,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function rr(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=oe(i).connectionId;if(!Vt(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(ze,{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(sr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=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},Zt=(t=>t?an(t):an),ir=t=>t;function St(t,e=ir){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const lr=t=>{const e=Zt(t),n=s=>St(e,s);return Object.assign(n,e),n},cr=(t=>lr);function Zn(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 Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},ar=(t,e)=>(n,s,i)=>{let r={storage:Zn(()=>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(w=>{var v;return w((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==r.version){if(r.migrate){const v=r.migrate(w.state,w.version);return v instanceof Promise?v.then(S=>[!0,S]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var v;if(j!==c)return;const[S,k]=w;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),S)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(w=>w(p)))}).catch(w=>{j===c&&y?.(void 0,w)})};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},Xn=ar,{useSyncExternalStoreWithSelector:dr}=Ds,ur=t=>t;function fr(t,e=ur,n){const s=dr(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):mr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function xr(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{bD as Q,r as C,o as As,s as mt,c as N,j as o,b9 as It,u as Y,k as Ms,t as Ps,a as oe,f as Ls,an as gn,bt as F,bE as zs,aA as Ds,x as _t,z as ne,D as bn,aB as Ws,w as Tt,ay as Hs,aC as jn,y as vn,aI as Fs,aJ as Vs,E as yn,aK as Bs,bF as $t,bG as Us,az as qs,b5 as Ks,v as Js,bH as Gs,bm as Sn}from"./index-M3wOD-T-.js";import{E as wn,I as Ye,n as Xs}from"./empty-state--pBjJrWJ.js";import{E as Nn}from"./error-boundary-C4ZiBZqG.js";import{a as Et,u as Ot,g as Rt,e as At,d as Mt}from"./use-collections-COu7mzCX.js";import{u as ee,i as Zs}from"./constants-CAezfWK1.js";import{P as Pt}from"./pin-to-sidebar-button-CnJDDpqU.js";import{B as V,c as O}from"./button-CrpAre8y.js";import{F as pt,a as Qs,b as Lt,d as zt}from"./form-DQQrIzsV.js";import{I as Dt}from"./input-YM08EPCC.js";import{T as yt}from"./textarea-55XlgpLZ.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-D1Jc2Tgr.js";import{i as kn,a as Ys}from"./Tool01-ChloSpuN.js";import{a as Cn,V as Wt,b as Ee}from"./layout-BHkRlBCz.js";import{S as In,a as _n,b as Tn,c as $n,d as St}from"./select-D2wMncj-.js";import{i as eo}from"./AlertCircle-xn5rFX2T.js";import{s as to,M as Oe}from"./monaco-editor-i9oMLTE9.js";import{i as no}from"./Code01-DR-jbECo.js";import{a as so}from"./Copy01-Ds6kUzpe.js";import{i as ze}from"./Loading01-CaAuMuYs.js";import{i as Ht}from"./Play-CUJHUsFq.js";import{s as Ft}from"./XClose-DnQCXbLq.js";import{u as oo,O as ro,M as io,F as lo,v as co}from"./index-D55GsjfR.js";import{u as Vt,b as ao}from"./use-connection-D5-dSK3A.js";import{E as Bt}from"./empty-state-DrxI6i2r.js";import{D as uo,a as fo}from"./use-binding-DdMe4omo.js";import{b as En}from"./use-virtual-mcp-Ciz726kq.js";import{b as mo,a as rn,R as po}from"./resizable-rgbJMlXu.js";import{S as De}from"./spinner-B3atGTOQ.js";import{V as xo}from"./view-mode-toggle-DWoBF8kY.js";import{N as ho,S as go,a as bo,c as jo,m as Ke,P as vo,i as yo,R as So,b as wo,d as No,e as ln,E as ko,f as Co}from"./index-CsFpv8QQ.js";import{b as Io,c as _o,d as To,e as $o,a as Eo,D as Oo}from"./dialog-DHQqGK7g.js";import"./index-CYuJPFs9.js";import{s as On}from"./Plus-BfTBbS63.js";import{n as Ro}from"./Calendar-DjDp3sZ6.js";import{i as Ut}from"./Check-CP3euUrF.js";import{i as Ao}from"./DotsHorizontal-DZRRv704.js";import{D as Mo,a as Po,b as Lo,c as cn}from"./dropdown-menu-C8F0EsLR.js";import{T as zo,R as Do,b as Wo,c as Rn}from"./collapsible-CNHksBot.js";import{i as Ho}from"./Grid01-BRgRtmbs.js";import{B as $e}from"./badge-DUUncEQr.js";import{i as An}from"./X-DhTQLdE5.js";import"./useMutation-i3JyomhH.js";import"./useQuery-BQUu3Rwx.js";import"./Pin01-YRdxhSee.js";import"./use-organization-settings-D9D-nJ5w.js";import"./ArrowLeft-Bb6bw7wO.js";import"./ChevronDown-sM8LyvvZ.js";import"./mcp-oauth-PtJaIBSs.js";import"./env-vars-editor-B2cK0oXN.js";import"./Trash01-DFo133oe.js";import"./File06-B5Dv7-Oa.js";import"./Key01-DYMhbAB1.js";import"./extract-connection-data-BQo5YaFM.js";import"./constants-AccVhxEg.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CcsfK0rU.js";import"./generate-id-Dyweu44Y.js";import"./Terminal-Csxea4Ut.js";import"./Users03-D4Z1AQ9s.js";import"./circle-alert-CKX7xMwa.js";import"./index-BVCaXPqJ.js";import"./binder-BPAsHHtz.js";import"./popover-B_5ZVJni.js";import"./use-mcp-prompts-BLDzHD20.js";import"./ArrowUp-DmmjiRhr.js";import"./Edit01-BVZvpfR8.js";import"./localstorage-keys-hwI1e15G.js";import"./SearchMd-DVKxUKrX.js";import"./use-create-virtual-mcp-BaTDfij5.js";import"./useSuspenseInfiniteQuery-aRxFMhU5.js";import"./infiniteQueryObserver-CfX1I4Ag.js";import"./Image01-DoUr5ERm.js";const Mn=Q("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 Pn=Q("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 qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Fo=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Vo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Bo=Q("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 Ln=Q("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 zn=Q("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 Dn=Q("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 Wn=Q("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 Hn=Q("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"}]]),Jt=({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"}));Jt.displayName="AlertOctagon";const Fn=({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"}));Fn.displayName="Box";const Vn=({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"}));Vn.displayName="ClockFastForward";const Bn=({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"}));Bn.displayName="Code02";const Je=({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"}));Je.displayName="Columns01";const Un=({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"}));Un.displayName="CornerDownRight";const qn=({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"}));qn.displayName="Database01";const Kn=({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"}));Kn.displayName="GitBranch01";const Jn=({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"}));Jn.displayName="Repeat03";const Gt=({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:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";As({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Uo(){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 qo(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(pt,{control:n.control,name:"title",render:Go}),o.jsx(pt,{control:n.control,name:"description",render:Jo})]})]}),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(pt,{control:n.control,name:"body",render:Ko})]}),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(Qs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function Ko(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...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 Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...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 Go(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Xo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),m=Ot(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let h;e[5]!==p?(h={values:p},e[5]=p,e[6]=h):h=e[6];const g=Ms(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==m.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await m.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=m.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const S=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let w;e[17]!==f.description?(w=f.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:f.description})]}):null,e[17]=f.description,e[18]=w):w=e[18];let k;e[19]!==v||e[20]!==w?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,w]})}),e[19]=v,e[20]=w,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kn,{size:14}),e[25]=M):M=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:M})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let A;e[32]!==S?(A=()=>{S()},e[32]=S,e[33]=A):A=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==A?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:A,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=A,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(qo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let Z;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(Z=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=Z):Z=e[51],Z}function Zo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Uo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Xo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Qo=Ps("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 Yo(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=O(Qo({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=O("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 tr(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=O("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 nr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function sr(t){const e=N.c(10),{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=oo(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(ro,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(or,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function or({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=Ls({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:S}=Y(),v=Vt(e),w=ee({connectionId:e,orgId:S.id}),k=Rt({client:w}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,M=T?Object.keys(T):[],R=M.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of M)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!w)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await w.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),Z=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${Z}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},A=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??nr(t),url:i,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ye,{icon:v?.icon||null,name:v?.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:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{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:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.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"}),I?.inputSchema?.required&&I.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:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>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:[_,I.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>A(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(St,{value:"true",children:"true"}),o.jsx(St,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),j&&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(to,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!m&&!p,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Yo,{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(eo,{className:"h-4 w-4"}),o.jsx(er,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(tr,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),gn.success("Copied to clipboard")},children:o.jsx(so,{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(no,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function rr(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=oe(i).connectionId;if(!Vt(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(ze,{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(sr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=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},Xt=(t=>t?an(t):an),ir=t=>t;function wt(t,e=ir){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const lr=t=>{const e=Xt(t),n=s=>wt(e,s);return Object.assign(n,e),n},cr=(t=>lr);function Gn(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 Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},ar=(t,e)=>(n,s,i)=>{let r={storage:Gn(()=>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(S=>{var v;return S((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[w,k]=S;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&y?.(void 0,S)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},Xn=ar,{useSyncExternalStoreWithSelector:dr}=zs,ur=t=>t;function fr(t,e=ur,n){const s=dr(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):mr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function xr(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 ht(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 hr(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 gt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...fo,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const Qn=C.createContext(null),gr=t=>Zt()(Xn(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??gt(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:ht(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=gt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=xr(a,"Input"),m=d.action,x=hr(m.code,f);d={...d,action:{...m,code:x}}}const u=ht(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=gt("tool",Number((Math.random()*1e6).toFixed(0)));const i=ht(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:Zn(()=>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 br(t){const e=N.c(8),{children:n,initialState:s}=t,i=En();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>gr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:i?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[0]=s.currentStepTab,e[1]=s.trackingExecutionId,e[2]=s.workflow,e[3]=i?.[0]?.id,e[4]=r):r=e[4];const[l]=C.useState(r);let c;return e[5]!==n||e[6]!==l?(c=o.jsx(Qn.Provider,{value:l,children:n}),e[5]=n,e[6]=l,e[7]=c):c=e[7],c}function We(t,e){const n=C.useContext(Qn);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return fr(n,t,pr)}function Re(){return We(jr)}function jr(t){return t.workflow}function Z(){return We(vr)}function vr(t){return t.actions}function Yn(){const t=Fe();return We(yr)??t[0]?.name}function yr(t){return t.currentStepName}function He(){const t=N.c(5),e=Yn(),n=Fe();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 Fe(){return Re().steps}function kt(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(!kt(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)||!kt(n[l],s[l]))return!1;return!0}return!1}function es(){const t=N.c(5),e=Re();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=_s(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=kt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function W(){return We(wr)}function wr(t){return t.trackingExecutionId}function Me(){return We(Sr)}function Sr(t){return t.selectedVirtualMcpId}function Nr(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=En()??[],a=In,d=n??void 0;let u;e[0]!==s?(u=j=>s(j===""?void 0:j),e[0]=s,e[1]=u):u=e[1];let f;e[2]!==i?(f=O("text-xs",i),e[2]=i,e[3]=f):f=e[3];let m;e[4]!==l?(m=o.jsx(Tn,{placeholder:l}),e[4]=l,e[5]=m):m=e[5];let x;e[6]!==f||e[7]!==m?(x=o.jsx(_n,{size:"sm",className:f,children:m}),e[6]=f,e[7]=m,e[8]=x):x=e[8];const p=$n,h=c.filter(Cr).map(kr);let g;e[9]!==p||e[10]!==h?(g=o.jsx(p,{children:h}),e[9]=p,e[10]=h,e[11]=g):g=e[11];let b;return e[12]!==a||e[13]!==d||e[14]!==u||e[15]!==x||e[16]!==g?(b=o.jsxs(a,{value:d,onValueChange:u,children:[x,g]}),e[12]=a,e[13]=d,e[14]=u,e[15]=x,e[16]=g,e[17]=b):b=e[17],b}function kr(t){return o.jsx(wt,{value:t.id,children:t.title},t.id)}function Cr(t){return t.id!==null&&!Qs(t.id)}function Ae(){const t=N.c(2),e=uo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=mo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const mn=[100,1e3,2e3];function re(t){const e=N.c(15),{org:n}=Y(),s=Ae(),i=C.useRef(0);let r;e[0]!==s.id||e[1]!==n.id?(r={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==t?(c={id:t},e[3]=t,e[4]=c):c=e[4];const a=!!t;let d;e[5]!==t?(d=t?h=>{const b=h.state?.data,y=(b?.structuredContent??b)?.item?.status;if(y==="running"||y==="enqueued"){const w=mn[i.current]??1;return i.current=(i.current+1)%mn.length,w}return i.current=0,!1}:!1,e[5]=t,e[6]=d):d=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==a||e[10]!==d?(u={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:c,gcTime:0,enabled:a,select:Ir,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:m}=Mt(u),x=f?.item;let p;return e[12]!==m||e[13]!==x?(p={item:x,isLoading:m},e[12]=m,e[13]=x,e[14]=p):p=e[14],p}function Ir(t){return t.structuredContent??t}function ts(t,e,n){const s=N.c(15),{org:i}=Y(),r=Ae();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=ee(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];const u=n?.refetchInterval;let f;s[6]!==c||s[7]!==a||s[8]!==d||s[9]!==u?(f={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,refetchInterval:u,select:_r},s[6]=c,s[7]=a,s[8]=d,s[9]=u,s[10]=f):f=s[10];const{data:m,isLoading:x}=Mt(f),p=m?.output,h=m?.error;let g;return s[11]!==x||s[12]!==p||s[13]!==h?(g={output:p,error:h,isLoading:x},s[11]=x,s[12]=p,s[13]=h,s[14]=g):g=s[14],g}function _r(t){return t.structuredContent??t}function Tr(){const t=N.c(19),{org:e}=Y(),n=Ae(),s=Re();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=ee(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:$r},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=Mt(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 $r(t){return t.structuredContent??t}function ns(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 Er(t){const e=[];for(const n of t){const s=ns(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function Or(t){for(const e of t)if(ns(e.input).includes("__entire_input__"))return!0;return!1}function Rr(t){const e=Er(t);if(e.length===0)return Or(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 Mr(){const t=N.c(2),e=Re();let n;return t[0]!==e.steps?(n=Rr(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function Ar(){const t=N.c(15),{org:e}=Y(),{id:n}=Ae(),{setTrackingExecutionId:s}=Z(),i=Re(),r=Me(),l=Mr();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=ee(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=At(d);let m;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(m=async g=>{const b=g===void 0?{}:g;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:r,start_at_epoch_ms:j,workflow_collection_id:i.id}}),v=(y.structuredContent??y)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=m):m=t[9];const x=m,p=l!==null;let h;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==p?(h={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=p,t[14]=h):h=t[14],h}function Pr(){const t=N.c(10),{org:e}=Y(),{id:n}=Ae();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=At(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 Lr(){const t=N.c(10),{org:e}=Y(),{id:n}=Ae();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=At(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 zr(){const t=N.c(3),e=W(),{item:n}=re(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 Dr(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 Xt=cr()(Xn(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 os(){return C.useContext(ss)}function Wr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new yo;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 rs(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Wr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function pn(t,e){const n=rs(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var Hr=go.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",Ke(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=pn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ke({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...vo({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:pn(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 jo,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 rs(this).map(bo)}}),Fr=Hr,bt,et="HoverCard",[is]=yn(et,[jn]),tt=jn(),[Vr,nt]=is(et),ls=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=tt(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),m=C.useRef(!1),[x,p]=Tt({prop:s,defaultProp:i??!1,onChange:r,caller:et}),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(Vr,{scope:e,open:x,onOpenChange:p,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(Fs,{...a,children:n})})};ls.displayName=et;var cs="HoverCardTrigger",as=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=nt(cs,n),r=tt(n);return o.jsx(Ws,{asChild:!0,...r,children:o.jsx(_t.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:ne(t.onPointerEnter,Xe(i.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(i.onClose)),onFocus:ne(t.onFocus,i.onOpen),onBlur:ne(t.onBlur,i.onClose),onTouchStart:ne(t.onTouchStart,l=>l.preventDefault())})})});as.displayName=cs;var Qt="HoverCardPortal",[Br,Ur]=is(Qt,{forceMount:void 0}),ds=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=nt(Qt,e);return o.jsx(Br,{scope:e,forceMount:n,children:o.jsx(bn,{present:n||r.open,children:o.jsx(Hs,{asChild:!0,container:i,children:s})})})};ds.displayName=Qt;var Ze="HoverCardContent",us=C.forwardRef((t,e)=>{const n=Ur(Ze,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=nt(Ze,t.__scopeHoverCard);return o.jsx(bn,{present:s||r.open,children:o.jsx(qr,{"data-state":r.open?"open":"closed",...i,onPointerEnter:ne(t.onPointerEnter,Xe(r.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(r.onClose)),ref:e})})});us.displayName=Ze;var qr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=nt(Ze,n),d=tt(n),u=C.useRef(null),f=vn(e,u),[m,x]=C.useState(!1);return C.useEffect(()=>{if(m){const p=document.body;return bt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=bt,p.style.webkitUserSelect=bt}}},[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&&Gr(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(Vs,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ne(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(Bs,{...d,...c,onPointerDown:ne(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)"}})})}),Kr="HoverCardArrow",Jr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=tt(n);return o.jsx(Us,{...i,...s,ref:e})});Jr.displayName=Kr;function Xe(t){return e=>e.pointerType==="touch"?void 0:t()}function Gr(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 Zr=ls,Xr=as,Qr=ds,Yr=us;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(Zr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function ti(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(Xr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function ni(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=O("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(Qr,{"data-slot":"hover-card-portal",children:o.jsx(Yr,{"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 fs=C.createContext(void 0);function si(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 oi(t){const e=N.c(20),{node:n}=t,s=C.useContext(fs),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?si(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(ln,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx(ti,{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(ni,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(ln,{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 ms(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 se=ps();function ps(){return Zt(()=>({items:[],selectedIndex:0,command:null}))}function xn(t,e){se.setState({items:t,command:e,selectedIndex:0})}function ri(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e-1+t.length)%t.length})}function ii(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e+1)%t.length})}function xs(){const{items:t,selectedIndex:e,command:n}=se.getState(),s=t[e];return s?(n?.(s),!0):!1}function hn(){se=ps()}function li(){const t=N.c(7),e=St(se,ai),n=St(se,ci);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:()=>{se.setState({selectedIndex:c}),xs()},className:O("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 ci(t){return t.selectedIndex}function ai(t){return t.items}function di(){let t=null,e=null;return{onStart:n=>{xn(n.items,n.command),t=new ko(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=>{xn(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(),hn(),!0):n.key==="ArrowUp"?(ri(),!0):n.key==="ArrowDown"?(ii(),!0):n.key==="Enter"?xs():!1,onExit:()=>{e?.remove(),t?.destroy(),hn()}}}const jt=/@([\w.]+)/g;function ui(t,e){if(!t)return null;const n=ms(e),s=new Map(n.map(a=>[a.id,a]));if(!jt.test(t))return t;jt.lastIndex=0;const r=[];let l=0,c;for(;(c=jt.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 Yt(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=zr();let d;e[0]!==n||e[1]!==s?(d=ui(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=wo.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 T;e[7]!==n?(T=A=>{const{query:R}=A;return ms(n).filter(z=>z.label.toLowerCase().includes(R.toLowerCase())||z.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=Fr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:xi,renderHTML:pi,suggestion:{items:T,render:di,command:mi}}).extend(f?{addNodeView(){return So(oi)}}:{}),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:fi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:A}=T;return i?.(A.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==m||e[17]!==h||e[18]!==b||e[19]!==j?(y={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]=y):y=e[20];const w=No(y);let v;e[21]!==l?(v=O("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 S;e[23]!==w?(S=o.jsx(Co,{editor:w}),e[23]=w,e[24]=S):S=e[24];let k;e[25]!==v||e[26]!==S?(k=o.jsx("div",{className:v,children:S}),e[25]=v,e[26]=S,e[27]=k):k=e[27];const I=k;if(a!==void 0){let T;return e[28]!==I||e[29]!==a?(T=o.jsx(fs.Provider,{value:a,children:I}),e[28]=I,e[29]=a,e[30]=T):T=e[30],T}return I}function fi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function mi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function pi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function xi(t){const{node:e}=t;return`@${e.attrs.id}`}function hi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 gi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 bi(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=O("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 ji(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 vi(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=O("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(yi),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 yi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const wi={TextWidget:hi,TextareaWidget:gi,NumberWidget:bi,CheckboxWidget:ji,SelectWidget:vi};function Si(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:An,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Ni(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:S}=Si(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=O(S,"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 y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let w;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(w=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=w):w=e[35],w}function ki(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Ii),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(Ci),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 Ci(t){return o.jsx("div",{children:t.content},t.name)}function Ii(t){return o.jsx("div",{children:t.content},t.name)}function _i(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Ti),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(V,{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 Ti(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 $i(){return null}function Ei(){return null}const Oi={FieldTemplate:Ni,ObjectFieldTemplate:ki,ArrayFieldTemplate:_i,UnsupportedFieldTemplate:$i,ErrorListTemplate:Ei};function Ri(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(Yt,{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 hs({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(Ri,{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(co,{schema:c,formData:e,onChange:d,validator:ao,widgets:wi,templates:Oi,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function Mi(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=I=>{I||d({}),s(I)},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(Eo,{children:[o.jsx(Oo,{children:"Workflow Input"}),o.jsx(Ro,{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(hs,{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(V,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(De,{size:"xs"}):o.jsx(Ht,{size:14}),e[17]=l,e[18]=y):y=e[18];let w;e[19]!==f||e[20]!==l||e[21]!==y?(w=o.jsxs(V,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=w):w=e[22];let v;e[23]!==w||e[24]!==j?(v=o.jsxs(Mo,{children:[j,w]}),e[23]=w,e[24]=j,e[25]=v):v=e[25];let S;e[26]!==v||e[27]!==g?(S=o.jsxs(Ao,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,g,v]}),e[26]=v,e[27]=g,e[28]=S):S=e[28];let k;return e[29]!==x||e[30]!==n||e[31]!==S?(k=o.jsx(Po,{open:n,onOpenChange:x,children:S}),e[29]=x,e[30]=n,e[31]=S,e[32]=k):k=e[32],k}function Ai(t){const e=N.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=It().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=Xt(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:x}=Z(),p=es(),h=Me(),g=W();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let y;e[4]!==b||e[5]!==j?(y=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let w;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==h||e[12]!==x||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(w=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Pt,{title:n,url:c,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Nr,{selectedVirtualMcpId:h,onVirtualMcpChange:x,placeholder:"Select Agent"})}),o.jsx(ho,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(Kn,{})},{value:"code",icon:o.jsx(Bn,{})}]}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:m,disabled:!p,"aria-label":"Reset changes",children:o.jsx(kn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!p||r,"aria-label":"Save workflow",children:r?o.jsx(De,{size:"xs"}):o.jsx(Gt,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(Vn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=h,e[12]=x,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=w):w=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(zi,{}),e[21]=v):v=e[21];let S;e[22]!==w?(S=o.jsxs(Wt,{children:[w,v]}),e[22]=w,e[23]=S):S=e[23];let k;return e[24]!==y||e[25]!==S?(k=o.jsxs(o.Fragment,{children:[y,S]}),e[24]=y,e[25]=S,e[26]=k):k=e[26],k}function Pi(){const t=W(),{item:e}=re(t);return e?.completed_at_epoch_ms!=null}function Li(){const t=W(),{item:e}=re(t);return e?.status==="cancelled"}function zi(){const t=N.c(58),e=es(),n=Pi(),s=Li(),i=W(),r=Me(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=Ar(),u=Fe(),[f,m]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=Pr(),{handleResumeWorkflow:h,isResuming:g}=Lr(),b=i&&!n;let j;t[0]!==u?(j=u.some(Di),t[0]=u,t[1]=j):j=t[1];const y=j,w=!r,v=u.length===0,S=e||v||y||w||c||p,k=b||c;let I;t[2]!==y||t[3]!==w||t[4]!==e||t[5]!==s||t[6]!==k||t[7]!==v?(I=()=>s?"Workflow is currently cancelled":k?"Workflow is currently running":e?"Save your changes before running":w?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=w,t[4]=e,t[5]=s,t[6]=k,t[7]=v,t[8]=I):I=t[8];const A=I();let R;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==k||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){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]=R):R=t[17];const P=R;let z;t[18]!==l?(z=async Pe=>{await l(Pe)},t[18]=l,t[19]=z):z=t[19];const q=z,M=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",J=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let _;t[20]!==J?(_=O("gap-2 h-7 px-3",J),t[20]=J,t[21]=_):_=t[21];let $;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?($=(!b&&!c&&!p&&!g||s)&&o.jsx(Ht,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=$):$=t[27];let E;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(E=b&&!c&&!p&&!g&&!s&&o.jsx(Io,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=E):E=t[33];let L;t[34]!==p||t[35]!==c||t[36]!==g?(L=(c||p||g)&&o.jsx(De,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=L):L=t[37];let H;t[38]!==M||t[39]!==P||t[40]!==S||t[41]!==_||t[42]!==$||t[43]!==E||t[44]!==L?(H=o.jsxs(V,{variant:"default",size:"sm",className:_,disabled:S,onClick:P,children:[$,E,L,M]}),t[38]=M,t[39]=P,t[40]=S,t[41]=_,t[42]=$,t[43]=E,t[44]=L,t[45]=H):H=t[45];const X=H;let D;t[46]!==X||t[47]!==A?(D=A?o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:X})}),o.jsx(ce,{side:"bottom",children:A})]})}):X,t[46]=X,t[47]=A,t[48]=D):D=t[48];const G=D;let B;t[49]!==q||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(Mi,{open:f,onOpenChange:m,inputSchema:d,onSubmit:q,isPending:c}),t[49]=q,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let K;return t[55]!==G||t[56]!==B?(K=o.jsxs(o.Fragment,{children:[G,B]}),t[55]=G,t[56]=B,t[57]=K):K=t[57],K}function Di(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Wi(){const t=N.c(15),e=W(),n=Fe(),{item:s}=re(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.status||t[3]!==n){i={};let r;t[5]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(Hi)??[]),t[5]=s.completed_steps?.success,t[6]=r):r=t[6];const l=r;let c;t[7]!==s.completed_steps?.error?(c=s.completed_steps?.error??[],t[7]=s.completed_steps?.error,t[8]=c):c=t[8];let a;t[9]!==c?(a=new Set(c),t[9]=c,t[10]=a):a=t[10];const d=a;let u;t[11]!==d||t[12]!==n||t[13]!==l?(u=-1,n.forEach((f,m)=>{(l.has(f.name)||d.has(f.name))&&(u=m)}),t[11]=d,t[12]=n,t[13]=l,t[14]=u):u=t[14],n.forEach((f,m)=>{let x="pending";d.has(f.name)?x="error":l.has(f.name)?x="success":s.status==="running"&&m===u+1&&(x="running"),i[f.name]={status:x,output:void 0,error:void 0,stepIndex:m}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.status,t[3]=n,t[4]=i}else i=t[4];return i}function Hi(t){return t.name}function Fi(t){const e=N.c(94),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=W(),{item:m}=re(f),x=m?.completed_steps,p=x?.success;let h;e[0]!==n.name||e[1]!==p?(h=p?.find(U=>U.name===n.name),e[0]=n.name,e[1]=p,e[2]=h):h=e[2];const g=h,b=g?.completed_at_epoch_ms,j=g!=null,y=x?.error?.includes(n.name),w="toolName"in n.action,v=w&&"connectionId"in n.action?n.action.connectionId:null,k=!!(w&&"toolName"in n.action?n.action.toolName:null),I=Yi(n),T=j?"success":y?"error":r?.status,A=r!==void 0,R=T==="success"||T==="error";let P=I.length>0?60:12;(T==="success"||T==="error")&&(P=P+32);const z=Ui(T);let q;e[3]!==T?(q=qi(T),e[3]=T,e[4]=q):q=e[4];const M=q;let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=function(qe,Rs){const on=Rs.split(".").slice(1);if(on.length===0)return Array.isArray(qe)?qe:void 0;let ie=qe;for(const Ms of on){if(ie==null)return;if(typeof ie=="object")ie=ie[Ms];else return}return Array.isArray(ie)?ie:void 0},e[5]=J):J=e[5];const _=J,$=n.forEach!==void 0,E=n.forEach?.ref;let L;e[6]!==E?(L=E?.replace("@","").split(".")[0],e[6]=E,e[7]=L):L=e[7];const H=L,X=m?.status==="running"||m?.status==="enqueued";let D;e[8]!==p||e[9]!==H?(D=p?.some(U=>U.name===H),e[8]=p,e[9]=H,e[10]=D):D=e[10];const G=D,B=X?500:!1;let K;e[11]!==G||e[12]!==B?(K={refetchInterval:B,enabled:G},e[11]=G,e[12]=B,e[13]=K):K=e[13];const{output:Pe}=ts(f,H,K);let Ve;if(e[14]!==Pe||e[15]!==E){const U=E?.replace("@","");Ve=U?_(Pe,U):void 0,e[14]=Pe,e[15]=E,e[16]=Ve}else Ve=e[16];const Le=Ve;let Be;e[17]!==m?.completed_steps?.success||e[18]!==n.name?(Be=m?.completed_steps?.success?.filter(U=>new RegExp(`^${n.name}\\[\\d+\\]$`).test(U.name)),e[17]=m?.completed_steps?.success,e[18]=n.name,e[19]=Be):Be=e[19];const rt=Be,it=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lt=T==="running"&&"bg-accent/50",ct=l&&"opacity-50";let ue;e[20]!==it||e[21]!==lt||e[22]!==ct?(ue=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",it,lt,ct),e[20]=it,e[21]=lt,e[22]=ct,e[23]=ue):ue=e[23];const Ts="button",$s=0;let fe;e[24]!==a?(fe=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),a())},e[24]=a,e[25]=fe):fe=e[25];const Es="w-5 flex flex-col items-center justify-center shrink-0 pt-3",at=O("text-xs font-mono opacity-75 h-8 flex items-center",z),dt=s+1;let me;e[26]!==at||e[27]!==dt?(me=o.jsx("div",{className:Es,children:o.jsxs("span",{className:at,children:[dt,"."]})}),e[26]=at,e[27]=dt,e[28]=me):me=e[28];let pe;e[29]!==M||e[30]!==s?(pe=s>0?o.jsx(vt,{height:12,color:M}):o.jsx("div",{className:"h-3"}),e[29]=M,e[30]=s,e[31]=pe):pe=e[31];let xe;e[32]!==v||e[33]!==k||e[34]!==w||e[35]!==n.name?(xe=o.jsx(Xi,{connectionId:v,isToolStep:w,hasToolSelected:k,stepName:n.name}),e[32]=v,e[33]=k,e[34]=w,e[35]=n.name,e[36]=xe):xe=e[36];let he;e[37]!==M||e[38]!==R||e[39]!==T?(he=R&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{height:8,color:M}),o.jsx(Ki,{status:T})]}),e[37]=M,e[38]=R,e[39]=T,e[40]=he):he=e[40];let ge;e[41]!==M||e[42]!==P||e[43]!==c||e[44]!==f?(ge=c&&f?null:o.jsx(vt,{height:P,color:M}),e[41]=M,e[42]=P,e[43]=c,e[44]=f,e[45]=ge):ge=e[45];let be;e[46]!==pe||e[47]!==xe||e[48]!==he||e[49]!==ge?(be=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[pe,xe,he,ge]}),e[46]=pe,e[47]=xe,e[48]=he,e[49]=ge,e[50]=be):be=e[50];const Os="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",ut=k?"font-medium text-foreground":"text-foreground";let je;e[51]!==ut?(je=O("text-sm truncate flex-1",ut),e[51]=ut,e[52]=je):je=e[52];let ve;e[53]!==n?(ve=Qi(n),e[53]=n,e[54]=ve):ve=e[54];let ye;e[55]!==je||e[56]!==ve?(ye=o.jsx("span",{className:je,children:ve}),e[55]=je,e[56]=ve,e[57]=ye):ye=e[57];let we;e[58]!==rt?.length||e[59]!==$||e[60]!==Le?(we=$&&Le&&Le.length>0&&o.jsx("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center",children:`${rt?.length??0} / ${Le.length}`}),e[58]=rt?.length,e[59]=$,e[60]=Le,e[61]=we):we=e[61];let Se;e[62]!==A||e[63]!==T?(Se=A&&o.jsx(Ji,{status:T}),e[62]=A,e[63]=T,e[64]=Se):Se=e[64];let Ne;e[65]!==we||e[66]!==Se?(Ne=o.jsxs("div",{className:"flex items-center gap-2",children:[we,Se]}),e[65]=we,e[66]=Se,e[67]=Ne):Ne=e[67];let ke;e[68]!==A||e[69]!==d||e[70]!==u?(ke=!A&&o.jsxs(zo,{children:[o.jsx(Do,{asChild:!0,children:o.jsx(V,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:Bi,children:o.jsx(Lo,{size:14})})}),o.jsxs(Wo,{align:"end",children:[o.jsxs(cn,{onClick:U=>{U.stopPropagation(),u()},children:[o.jsx(Bo,{size:14}),"Duplicate"]}),o.jsxs(cn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:U=>{U.stopPropagation(),d()},children:[o.jsx(qs,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[68]=A,e[69]=d,e[70]=u,e[71]=ke):ke=e[71];let Ce;e[72]!==ye||e[73]!==Ne||e[74]!==ke?(Ce=o.jsxs("div",{className:"flex items-center h-8",children:[ye,Ne,ke]}),e[72]=ye,e[73]=Ne,e[74]=ke,e[75]=Ce):Ce=e[75];const ft=I.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(Vi)});let Ie;e[76]!==T||e[77]!==b?(Ie=T==="success"&&o.jsx(Gi,{completedAtEpochMs:b}),e[76]=T,e[77]=b,e[78]=Ie):Ie=e[78];let _e;e[79]!==r?.error||e[80]!==T?(_e=T==="error"&&o.jsx(Zi,{error:r?.error}),e[79]=r?.error,e[80]=T,e[81]=_e):_e=e[81];let Te;e[82]!==Ce||e[83]!==ft||e[84]!==Ie||e[85]!==_e?(Te=o.jsxs("div",{className:Os,children:[Ce,ft,Ie,_e]}),e[82]=Ce,e[83]=ft,e[84]=Ie,e[85]=_e,e[86]=Te):Te=e[86];let Ue;return e[87]!==a||e[88]!==ue||e[89]!==fe||e[90]!==me||e[91]!==be||e[92]!==Te?(Ue=o.jsxs("div",{className:ue,onClick:a,role:Ts,tabIndex:$s,onKeyDown:fe,children:[me,be,Te]}),e[87]=a,e[88]=ue,e[89]=fe,e[90]=me,e[91]=be,e[92]=Te,e[93]=Ue):Ue=e[93],Ue}function Vi(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 Bi(t){return t.stopPropagation()}function Ui(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function qi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function Ki(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(Ut,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(Ft,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function Ji(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(Ut,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(Ft,{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(ze,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Gi(t){const e=N.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null?new Date(n):null;s=a?a.toISOString().split("T")[0]:null,i=a?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(oo,{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 Zi(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Jt,{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 Xi(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=Vt(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(Ye,{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(Gn,{size:16,className:"text-muted-foreground"}):o.jsx(Vo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function vt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=O("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 Qi(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 Yi(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=Fe(),i=Yn(),r=Wi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=Z(),d=W();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let x;e[4]!==n?(x=O("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 y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(w,v)=>{const S=r?.[w.name],k=f!==-1&&v>f&&S?.status==="pending",I=v===s.length-1;return o.jsx(Fi,{step:w,index:v,isSelected:w.name===i,executionStatus:S,isSkipped:k,isLastStep:I,onSelect:()=>l(w.name),onDelete:()=>c(w.name),onDuplicate:()=>a(w.name)},w.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=y):y=e[21],p=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let 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(tl,{}),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 tl(){const t=N.c(8),{addToolStep:e}=Z();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(Rn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(V,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function nl(){const t=N.c(11),{org:e}=Y(),s=Me()??null;let i;t[0]!==e.id||t[1]!==s?(i={connectionId:s,orgId:e.id},t[0]=e.id,t[1]=s,t[2]=i):i=t[2];const r=ee(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=Rt(l);let a;t[5]!==c.data?.tools?(a=c.data?.tools??[],t[5]=c.data?.tools,t[6]=a):a=t[6];let d;return t[7]!==a||t[8]!==c.error||t[9]!==c.isLoading?(d={tools:a,isLoading:c.isLoading,error:c.error},t[7]=a,t[8]=c.error,t[9]=c.isLoading,t[10]=d):d=t[10],d}function sl(t){const e=N.c(7),{className:n}=t;if(!Me()){let r;e[0]!==n?(r=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select an agent to see available tools"}),e[2]=l):l=e[2];let c;return e[3]!==r?(c=o.jsx("div",{className:r,children:l}),e[3]=r,e[4]=c):c=e[4],c}let i;return e[5]!==n?(i=o.jsx(ol,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function ol(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=nl(),l=He(),{updateStep:c}=Z(),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=S=>S.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=Dr(s,u??null,il,rl);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=O("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(De,{size:"sm"})}),e[10]=S):S=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:S}),e[11]=v,e[12]=k):k=e[12],k}if(r){let v;e[13]!==n?(v=O("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let S;e[15]!==r.message?(S=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]=S):S=e[16];let k;return e[17]!==v||e[18]!==S?(k=o.jsx("div",{className:v,children:S}),e[17]=v,e[18]=S,e[19]=k):k=e[19],k}let h;e[20]!==n?(h=O("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=S=>o.jsx(ll,{icon:null,title:S.name,description:S.description,isSelected:S.name===d,onClick:()=>p(S)},S.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let w;return e[34]!==h||e[35]!==b||e[36]!==y?(w=o.jsxs("div",{className:h,children:[b,y]}),e[34]=h,e[35]=b,e[36]=y,e[37]=w):w=e[37],w}function rl(t,e){return t.name.localeCompare(e.name)}function il(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=O("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(Ye,{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 te="Accordion",cl=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[en,al,dl]=Js(te),[st]=yn(te,[dl,On]),tn=On(),gs=F.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(en.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(pl,{...r,ref:e}):o.jsx(ml,{...i,ref:e})})});gs.displayName=te;var[bs,ul]=st(te),[js,fl]=st(te,{collapsible:!1}),ml=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Tt({prop:n,defaultProp:s??"",onChange:i,caller:te});return o.jsx(bs,{scope:t.__scopeAccordion,value:F.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:F.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(vs,{...l,ref:e})})})}),pl=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Tt({prop:n,defaultProp:s??[],onChange:i,caller:te}),a=F.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=F.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(bs,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(vs,{...r,ref:e})})})}),[xl,ot]=st(te),vs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=F.useRef(null),a=vn(c,e),d=al(n),f=Gs(i)==="ltr",m=ne(t.onKeyDown,x=>{if(!cl.includes(x.key))return;const p=x.target,h=d().filter(I=>!I.ref.current?.disabled),g=h.findIndex(I=>I.ref.current===p),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const y=0,w=b-1,v=()=>{j=g+1,j>w&&(j=y)},S=()=>{j=g-1,j<y&&(j=w)};switch(x.key){case"Home":j=y;break;case"End":j=w;break;case"ArrowRight":r==="horizontal"&&(f?v():S());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?S():v());break;case"ArrowUp":r==="vertical"&&S();break}const k=j%b;h[k].ref.current?.focus()});return o.jsx(xl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(en.Slot,{scope:n,children:o.jsx(_t.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),Qe="AccordionItem",[hl,nn]=st(Qe),ys=F.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ot(Qe,n),l=ul(Qe,n),c=tn(n),a=Ks(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(hl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(To,{"data-orientation":r.orientation,"data-state":Is(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});ys.displayName=Qe;var ws="AccordionHeader",Ss=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ws,n);return o.jsx(_t.h3,{"data-orientation":i.orientation,"data-state":Is(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Ss.displayName=ws;var Ct="AccordionTrigger",Ns=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(Ct,n),l=fl(Ct,n),c=tn(n);return o.jsx(en.ItemSlot,{scope:n,children:o.jsx(_o,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Ns.displayName=Ct;var ks="AccordionContent",Cs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ks,n),l=tn(n);return o.jsx($o,{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}})});Cs.displayName=ks;function Is(t){return t?"open":"closed"}var gl=gs,bl=ys,jl=Ss,vl=Ns,yl=Cs;function wl(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(gl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Sl(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=O("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(bl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Nl(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=O("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(Ho,{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(jl,{className:"flex",children:o.jsxs(vl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function kl(t){const e=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=O("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(yl,{"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 Cl(t){const{updateStep:e}=Z(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=sn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Il(t){const e=N.c(32),{className:n}=t,s=He(),{appendStep:i}=Z();Cl(s);const r=W(),{item:l}=re(r);if(!s){let b;e[0]!==n?(b=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==i?(j=()=>{i({type:"tool"})},e[2]=i,e[3]=j):j=e[3];let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Rn,{size:14}),e[4]=y):y=e[4];let w;e[5]!==j?(w=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(V,{variant:"ghost",size:"icon",className:"size-7",onClick:j,children:y})]}),e[5]=j,e[6]=w):w=e[6];let v;return e[7]!==b||e[8]!==w?(v=o.jsx("div",{className:b,children:w}),e[7]=b,e[8]=w,e[9]=v):v=e[9],v}const c=s?.name,a=!!(l?.completed_steps?.success?.some(b=>b.name===c)||l?.completed_steps?.error?.includes(c));let d;e[10]!==n?(d=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=d):d=e[11];let u,f;e[12]!==s?(u=o.jsx(_l,{step:s}),f=o.jsx($l,{step:s}),e[12]=s,e[13]=u,e[14]=f):(u=e[13],f=e[14]);const m=a?"open":"closed";let x;e[15]!==s||e[16]!==a||e[17]!==m?(x=o.jsx(Ol,{step:s,defaultOpen:a},m),e[15]=s,e[16]=a,e[17]=m,e[18]=x):x=e[18];let p;e[19]!==s||e[20]!==r?(p=!r&&o.jsx(Pl,{step:s}),e[19]=s,e[20]=r,e[21]=p):p=e[21];let h;e[22]!==s||e[23]!==r?(h=!r&&o.jsx(Dl,{step:s}),e[22]=s,e[23]=r,e[24]=h):h=e[24];let g;return e[25]!==d||e[26]!==u||e[27]!==f||e[28]!==x||e[29]!==p||e[30]!==h?(g=o.jsxs("div",{className:d,children:[u,f,x,p,h]}),e[25]=d,e[26]=u,e[27]=f,e[28]=x,e[29]=p,e[30]=h,e[31]=g):g=e[31],g}function _l(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=W(),l=i??"";let c;e[0]!==l?(c=o.jsx(Ye,{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(Tl,{}),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 Tl(){const t=N.c(9),e=He(),{updateStep:n,startReplacingTool:s}=Z(),i=W(),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){gn.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(Jn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(V,{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 sn(t){const e=N.c(13),{org:n}=Y(),i=Me()??null;let r;e[0]!==n.id||e[1]!==i?(r={connectionId:i,orgId:n.id},e[0]=n.id,e[1]=i,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=Rt(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(m=>m.name===t),e[5]=t,e[6]=a.data?.tools,e[7]=d):d=e[7];const u=d;let f;return e[8]!==u||e[9]!==a.error||e[10]!==a.isLoading||e[11]!==a.isSuccess?(f={tool:u,isLoading:a.isLoading,isReady:a.isSuccess,error:a.error},e[8]=u,e[9]=a.error,e[10]=a.isLoading,e[11]=a.isSuccess,e[12]=f):f=e[12],f}function $l(t){const e=N.c(18),{step:n}=t,{updateStep:s}=Z(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=W(),{tool:c}=sn(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?El(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(Nl,{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 y;e[9]!==d||e[10]!==p||e[11]!==h||e[12]!==g||e[13]!==b?(y=o.jsxs(Sl,{value:"input",className:"border-b-0",children:[x,o.jsx(kl,{className:"px-5 pt-2",children:o.jsx(hs,{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]=y):y=e[14];let w;return e[15]!==y||e[16]!==m?(w=o.jsx(wl,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=m,e[17]=w):w=e[17],w}function El(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function Ol(t){const e=N.c(24),{step:n,defaultOpen:s}=t,i=n.outputSchema,r=W(),{item:l}=re(r),c=!!(l?.completed_steps?.success?.some(T=>T.name===n.name)||l?.completed_steps?.error?.includes(n.name)),[a,d]=C.useState(s),{output:u,error:f}=ts(r,c?n.name:void 0);let m;e[0]!==f||e[1]!==u?(m=u||(f?{error:f}:void 0),e[0]=f,e[1]=u,e[2]=m):m=e[2];const x=m,p=i&&typeof i=="object"?i.properties:void 0;let h;e[3]!==p?(h=p?Object.entries(p):[],e[3]=p,e[4]=h):h=e[4];const g=h,b=a?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[5]!==b?(j=O("flex flex-col border-b border-border",b),e[5]=b,e[6]=j):j=e[6];let y;e[7]!==a?(y=()=>d(!a),e[7]=a,e[8]=y):y=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=w):w=e[9];let v;e[10]!==a?(v=o.jsxs("div",{className:"flex items-center justify-between",children:[w,a?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[10]=a,e[11]=v):v=e[11];let S;e[12]!==y||e[13]!==v?(S=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:v}),e[12]=y,e[13]=v,e[14]=S):S=e[14];let k;e[15]!==x||e[16]!==a||e[17]!==g||e[18]!==r?(k=a&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[r&&x?o.jsx(Oe,{code:JSON.stringify(x,null,2),language:"json",height:"100%",readOnly:!0}):null,!r&&g.map(Rl)]}),e[15]=x,e[16]=a,e[17]=g,e[18]=r,e[19]=k):k=e[19];let I;return e[20]!==j||e[21]!==S||e[22]!==k?(I=o.jsxs("div",{className:j,children:[S,k]}),e[20]=j,e[21]=S,e[22]=k,e[23]=I):I=e[23],I}function Rl(t){const[e,n]=t;return o.jsx(Al,{name:e,schema:n},e)}function Ml(t){switch(t){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:An,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Al(t){const e=N.c(28),{name:n,schema:s}=t,i=He(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:w,color:v}=Ml(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=w,c=14,a=O(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(Un,{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 y;return e[24]!==j||e[25]!==u||e[26]!==x?(y=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=y):y=e[27],y}function Pl(t){const e=N.c(29),{step:n}=t,{updateStep:s}=Z(),i=W(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=sn(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 gt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...uo,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const Zn=C.createContext(null),gr=t=>Xt()(Xn(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??gt(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:ht(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=gt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=xr(a,"Input"),m=d.action,x=hr(m.code,f);d={...d,action:{...m,code:x}}}const u=ht(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=gt("tool",Number((Math.random()*1e6).toFixed(0)));const i=ht(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:Gn(()=>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 br(t){const e=N.c(8),{children:n,initialState:s}=t,i=En();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>gr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:i?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[0]=s.currentStepTab,e[1]=s.trackingExecutionId,e[2]=s.workflow,e[3]=i?.[0]?.id,e[4]=r):r=e[4];const[l]=C.useState(r);let c;return e[5]!==n||e[6]!==l?(c=o.jsx(Zn.Provider,{value:l,children:n}),e[5]=n,e[6]=l,e[7]=c):c=e[7],c}function We(t,e){const n=C.useContext(Zn);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return fr(n,t,pr)}function Re(){return We(jr)}function jr(t){return t.workflow}function X(){return We(vr)}function vr(t){return t.actions}function Qn(){const t=Fe();return We(yr)??t[0]?.name}function yr(t){return t.currentStepName}function He(){const t=N.c(5),e=Qn(),n=Fe();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 Fe(){return Re().steps}function kt(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(!kt(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)||!kt(n[l],s[l]))return!1;return!0}return!1}function Yn(){const t=N.c(5),e=Re();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=Is(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=kt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function W(){return We(Sr)}function Sr(t){return t.trackingExecutionId}function Ae(){return We(wr)}function wr(t){return t.selectedVirtualMcpId}function Nr(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=En()??[],a=In,d=n??void 0;let u;e[0]!==s?(u=j=>s(j===""?void 0:j),e[0]=s,e[1]=u):u=e[1];let f;e[2]!==i?(f=O("text-xs",i),e[2]=i,e[3]=f):f=e[3];let m;e[4]!==l?(m=o.jsx(Tn,{placeholder:l}),e[4]=l,e[5]=m):m=e[5];let x;e[6]!==f||e[7]!==m?(x=o.jsx(_n,{size:"sm",className:f,children:m}),e[6]=f,e[7]=m,e[8]=x):x=e[8];const p=$n,h=c.filter(Cr).map(kr);let g;e[9]!==p||e[10]!==h?(g=o.jsx(p,{children:h}),e[9]=p,e[10]=h,e[11]=g):g=e[11];let b;return e[12]!==a||e[13]!==d||e[14]!==u||e[15]!==x||e[16]!==g?(b=o.jsxs(a,{value:d,onValueChange:u,children:[x,g]}),e[12]=a,e[13]=d,e[14]=u,e[15]=x,e[16]=g,e[17]=b):b=e[17],b}function kr(t){return o.jsx(St,{value:t.id,children:t.title},t.id)}function Cr(t){return t.id!==null&&!Zs(t.id)}function Me(){const t=N.c(2),e=ao();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=fo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const mn=[100,1e3,2e3];function re(t){const e=N.c(15),{org:n}=Y(),s=Me(),i=C.useRef(0);let r;e[0]!==s.id||e[1]!==n.id?(r={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==t?(c={id:t},e[3]=t,e[4]=c):c=e[4];const a=!!t;let d;e[5]!==t?(d=t?h=>{const b=h.state?.data,y=(b?.structuredContent??b)?.item?.status;if(y==="running"||y==="enqueued"){const S=mn[i.current]??1;return i.current=(i.current+1)%mn.length,S}return i.current=0,!1}:!1,e[5]=t,e[6]=d):d=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==a||e[10]!==d?(u={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:c,gcTime:0,enabled:a,select:Ir,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:m}=At(u),x=f?.item;let p;return e[12]!==m||e[13]!==x?(p={item:x,isLoading:m},e[12]=m,e[13]=x,e[14]=p):p=e[14],p}function Ir(t){return t.structuredContent??t}function es(t,e,n){const s=N.c(15),{org:i}=Y(),r=Me();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=ee(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];const u=n?.refetchInterval;let f;s[6]!==c||s[7]!==a||s[8]!==d||s[9]!==u?(f={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,refetchInterval:u,select:_r},s[6]=c,s[7]=a,s[8]=d,s[9]=u,s[10]=f):f=s[10];const{data:m,isLoading:x}=At(f),p=m?.output,h=m?.error;let g;return s[11]!==x||s[12]!==p||s[13]!==h?(g={output:p,error:h,isLoading:x},s[11]=x,s[12]=p,s[13]=h,s[14]=g):g=s[14],g}function _r(t){return t.structuredContent??t}function Tr(){const t=N.c(19),{org:e}=Y(),n=Me(),s=Re();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=ee(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:$r},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=At(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 $r(t){return t.structuredContent??t}function ts(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 Er(t){const e=[];for(const n of t){const s=ts(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function Or(t){for(const e of t)if(ts(e.input).includes("__entire_input__"))return!0;return!1}function Rr(t){const e=Er(t);if(e.length===0)return Or(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 Ar(){const t=N.c(2),e=Re();let n;return t[0]!==e.steps?(n=Rr(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function Mr(){const t=N.c(15),{org:e}=Y(),{id:n}=Me(),{setTrackingExecutionId:s}=X(),i=Re(),r=Ae(),l=Ar();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=ee(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=Mt(d);let m;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(m=async g=>{const b=g===void 0?{}:g;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:r,start_at_epoch_ms:j,workflow_collection_id:i.id}}),v=(y.structuredContent??y)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=m):m=t[9];const x=m,p=l!==null;let h;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==p?(h={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=p,t[14]=h):h=t[14],h}function Pr(){const t=N.c(10),{org:e}=Y(),{id:n}=Me();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=Mt(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 Lr(){const t=N.c(10),{org:e}=Y(),{id:n}=Me();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=Mt(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 zr(){const t=N.c(3),e=W(),{item:n}=re(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 Dr(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 Zt=cr()(Xn(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"})),ns=C.createContext([]);function ss(){return C.useContext(ns)}function Wr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new vo;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 os(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Wr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function pn(t,e){const n=os(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var Hr=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",Ke(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=pn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ke({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...jo({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:pn(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 bo,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 os(this).map(go)}}),Fr=Hr,bt,et="HoverCard",[rs]=yn(et,[jn]),tt=jn(),[Vr,nt]=rs(et),is=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=tt(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),m=C.useRef(!1),[x,p]=Tt({prop:s,defaultProp:i??!1,onChange:r,caller:et}),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(Vr,{scope:e,open:x,onOpenChange:p,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(Hs,{...a,children:n})})};is.displayName=et;var ls="HoverCardTrigger",cs=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=nt(ls,n),r=tt(n);return o.jsx(Ds,{asChild:!0,...r,children:o.jsx(_t.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:ne(t.onPointerEnter,Ze(i.onOpen)),onPointerLeave:ne(t.onPointerLeave,Ze(i.onClose)),onFocus:ne(t.onFocus,i.onOpen),onBlur:ne(t.onBlur,i.onClose),onTouchStart:ne(t.onTouchStart,l=>l.preventDefault())})})});cs.displayName=ls;var Qt="HoverCardPortal",[Br,Ur]=rs(Qt,{forceMount:void 0}),as=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=nt(Qt,e);return o.jsx(Br,{scope:e,forceMount:n,children:o.jsx(bn,{present:n||r.open,children:o.jsx(Ws,{asChild:!0,container:i,children:s})})})};as.displayName=Qt;var Xe="HoverCardContent",ds=C.forwardRef((t,e)=>{const n=Ur(Xe,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=nt(Xe,t.__scopeHoverCard);return o.jsx(bn,{present:s||r.open,children:o.jsx(qr,{"data-state":r.open?"open":"closed",...i,onPointerEnter:ne(t.onPointerEnter,Ze(r.onOpen)),onPointerLeave:ne(t.onPointerLeave,Ze(r.onClose)),ref:e})})});ds.displayName=Xe;var qr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=nt(Xe,n),d=tt(n),u=C.useRef(null),f=vn(e,u),[m,x]=C.useState(!1);return C.useEffect(()=>{if(m){const p=document.body;return bt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=bt,p.style.webkitUserSelect=bt}}},[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&&Gr(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(Fs,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ne(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(Vs,{...d,...c,onPointerDown:ne(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)"}})})}),Kr="HoverCardArrow",Jr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=tt(n);return o.jsx(Bs,{...i,...s,ref:e})});Jr.displayName=Kr;function Ze(t){return e=>e.pointerType==="touch"?void 0:t()}function Gr(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 Xr=is,Zr=cs,Qr=as,Yr=ds;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(Xr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function ti(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(Zr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function ni(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=O("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(Qr,{"data-slot":"hover-card-portal",children:o.jsx(Yr,{"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 us=C.createContext(void 0);function si(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 oi(t){const e=N.c(20),{node:n}=t,s=C.useContext(us),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?si(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(ln,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx(ti,{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(ni,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(ln,{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 fs(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 se=ms();function ms(){return Xt(()=>({items:[],selectedIndex:0,command:null}))}function xn(t,e){se.setState({items:t,command:e,selectedIndex:0})}function ri(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e-1+t.length)%t.length})}function ii(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e+1)%t.length})}function ps(){const{items:t,selectedIndex:e,command:n}=se.getState(),s=t[e];return s?(n?.(s),!0):!1}function hn(){se=ms()}function li(){const t=N.c(7),e=wt(se,ai),n=wt(se,ci);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:()=>{se.setState({selectedIndex:c}),ps()},className:O("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 ci(t){return t.selectedIndex}function ai(t){return t.items}function di(){let t=null,e=null;return{onStart:n=>{xn(n.items,n.command),t=new No(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=>{xn(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(),hn(),!0):n.key==="ArrowUp"?(ri(),!0):n.key==="ArrowDown"?(ii(),!0):n.key==="Enter"?ps():!1,onExit:()=>{e?.remove(),t?.destroy(),hn()}}}const jt=/@([\w.]+)/g;function ui(t,e){if(!t)return null;const n=fs(e),s=new Map(n.map(a=>[a.id,a]));if(!jt.test(t))return t;jt.lastIndex=0;const r=[];let l=0,c;for(;(c=jt.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 Yt(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=zr();let d;e[0]!==n||e[1]!==s?(d=ui(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=yo.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 T;e[7]!==n?(T=M=>{const{query:R}=M;return fs(n).filter(z=>z.label.toLowerCase().includes(R.toLowerCase())||z.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=Fr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:xi,renderHTML:pi,suggestion:{items:T,render:di,command:mi}}).extend(f?{addNodeView(){return So(oi)}}:{}),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:fi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:M}=T;return i?.(M.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==m||e[17]!==h||e[18]!==b||e[19]!==j?(y={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]=y):y=e[20];const S=wo(y);let v;e[21]!==l?(v=O("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",l),e[21]=l,e[22]=v):v=e[22];let w;e[23]!==S?(w=o.jsx(ko,{editor:S}),e[23]=S,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 I=k;if(a!==void 0){let T;return e[28]!==I||e[29]!==a?(T=o.jsx(us.Provider,{value:a,children:I}),e[28]=I,e[29]=a,e[30]=T):T=e[30],T}return I}function fi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function mi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function pi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function xi(t){const{node:e}=t;return`@${e.attrs.id}`}function hi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(Yt,{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 gi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ss(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(Yt,{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 bi(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=O("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 ji(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 vi(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=O("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(yi),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 yi(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Si={TextWidget:hi,TextareaWidget:gi,NumberWidget:bi,CheckboxWidget:ji,SelectWidget:vi};function wi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:Mn,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Ni(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}=wi(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=O(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 y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let S;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(S=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=S):S=e[35],S}function ki(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Ii),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(Ci),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 Ci(t){return o.jsx("div",{children:t.content},t.name)}function Ii(t){return o.jsx("div",{children:t.content},t.name)}function _i(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Ti),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(V,{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 Ti(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 $i(){return null}function Ei(){return null}const Oi={FieldTemplate:Ni,ObjectFieldTemplate:ki,ArrayFieldTemplate:_i,UnsupportedFieldTemplate:$i,ErrorListTemplate:Ei};function Ri(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(Yt,{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 xs({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(Ri,{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(ns.Provider,{value:l,children:o.jsx(lo,{schema:c,formData:e,onChange:d,validator:co,widgets:Si,templates:Oi,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function Ai(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=I=>{I||d({}),s(I)},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(Io,{children:[o.jsx(_o,{children:"Workflow Input"}),o.jsx(To,{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(xs,{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(V,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(De,{size:"xs"}):o.jsx(Ht,{size:14}),e[17]=l,e[18]=y):y=e[18];let S;e[19]!==f||e[20]!==l||e[21]!==y?(S=o.jsxs(V,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=S):S=e[22];let v;e[23]!==S||e[24]!==j?(v=o.jsxs($o,{children:[j,S]}),e[23]=S,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(Eo,{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(Oo,{open:n,onOpenChange:x,children:w}),e[29]=x,e[30]=n,e[31]=w,e[32]=k):k=e[32],k}function Mi(t){const e=N.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=It().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=Zt(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:x}=X(),p=Yn(),h=Ae(),g=W();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let y;e[4]!==b||e[5]!==j?(y=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let S;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==h||e[12]!==x||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(S=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Pt,{title:n,url:c,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Nr,{selectedVirtualMcpId:h,onVirtualMcpChange:x,placeholder:"Select Agent"})}),o.jsx(xo,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(Kn,{})},{value:"code",icon:o.jsx(Bn,{})}]}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:m,disabled:!p,"aria-label":"Reset changes",children:o.jsx(kn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!p||r,"aria-label":"Save workflow",children:r?o.jsx(De,{size:"xs"}):o.jsx(Gt,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(Vn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=h,e[12]=x,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=S):S=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(zi,{}),e[21]=v):v=e[21];let w;e[22]!==S?(w=o.jsxs(Wt,{children:[S,v]}),e[22]=S,e[23]=w):w=e[23];let k;return e[24]!==y||e[25]!==w?(k=o.jsxs(o.Fragment,{children:[y,w]}),e[24]=y,e[25]=w,e[26]=k):k=e[26],k}function Pi(){const t=W(),{item:e}=re(t);return e?.completed_at_epoch_ms!=null}function Li(){const t=W(),{item:e}=re(t);return e?.status==="cancelled"}function zi(){const t=N.c(58),e=Yn(),n=Pi(),s=Li(),i=W(),r=Ae(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=Mr(),u=Fe(),[f,m]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=Pr(),{handleResumeWorkflow:h,isResuming:g}=Lr(),b=i&&!n;let j;t[0]!==u?(j=u.some(Di),t[0]=u,t[1]=j):j=t[1];const y=j,S=!r,v=u.length===0,w=e||v||y||S||c||p,k=b||c;let I;t[2]!==y||t[3]!==S||t[4]!==e||t[5]!==s||t[6]!==k||t[7]!==v?(I=()=>s?"Workflow is currently cancelled":k?"Workflow is currently running":e?"Save your changes before running":S?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=S,t[4]=e,t[5]=s,t[6]=k,t[7]=v,t[8]=I):I=t[8];const M=I();let R;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==k||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){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]=R):R=t[17];const P=R;let z;t[18]!==l?(z=async Pe=>{await l(Pe)},t[18]=l,t[19]=z):z=t[19];const q=z,A=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",J=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let _;t[20]!==J?(_=O("gap-2 h-7 px-3",J),t[20]=J,t[21]=_):_=t[21];let $;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?($=(!b&&!c&&!p&&!g||s)&&o.jsx(Ht,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=$):$=t[27];let E;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(E=b&&!c&&!p&&!g&&!s&&o.jsx(Co,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=E):E=t[33];let L;t[34]!==p||t[35]!==c||t[36]!==g?(L=(c||p||g)&&o.jsx(De,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=L):L=t[37];let H;t[38]!==A||t[39]!==P||t[40]!==w||t[41]!==_||t[42]!==$||t[43]!==E||t[44]!==L?(H=o.jsxs(V,{variant:"default",size:"sm",className:_,disabled:w,onClick:P,children:[$,E,L,A]}),t[38]=A,t[39]=P,t[40]=w,t[41]=_,t[42]=$,t[43]=E,t[44]=L,t[45]=H):H=t[45];const Z=H;let D;t[46]!==Z||t[47]!==M?(D=M?o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Z})}),o.jsx(ce,{side:"bottom",children:M})]})}):Z,t[46]=Z,t[47]=M,t[48]=D):D=t[48];const G=D;let B;t[49]!==q||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(Ai,{open:f,onOpenChange:m,inputSchema:d,onSubmit:q,isPending:c}),t[49]=q,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let K;return t[55]!==G||t[56]!==B?(K=o.jsxs(o.Fragment,{children:[G,B]}),t[55]=G,t[56]=B,t[57]=K):K=t[57],K}function Di(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Wi(){const t=N.c(15),e=W(),n=Fe(),{item:s}=re(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.status||t[3]!==n){i={};let r;t[5]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(Hi)??[]),t[5]=s.completed_steps?.success,t[6]=r):r=t[6];const l=r;let c;t[7]!==s.completed_steps?.error?(c=s.completed_steps?.error??[],t[7]=s.completed_steps?.error,t[8]=c):c=t[8];let a;t[9]!==c?(a=new Set(c),t[9]=c,t[10]=a):a=t[10];const d=a;let u;t[11]!==d||t[12]!==n||t[13]!==l?(u=-1,n.forEach((f,m)=>{(l.has(f.name)||d.has(f.name))&&(u=m)}),t[11]=d,t[12]=n,t[13]=l,t[14]=u):u=t[14],n.forEach((f,m)=>{let x="pending";d.has(f.name)?x="error":l.has(f.name)?x="success":s.status==="running"&&m===u+1&&(x="running"),i[f.name]={status:x,output:void 0,error:void 0,stepIndex:m}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.status,t[3]=n,t[4]=i}else i=t[4];return i}function Hi(t){return t.name}function Fi(t){const e=N.c(94),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=W(),{item:m}=re(f),x=m?.completed_steps,p=x?.success;let h;e[0]!==n.name||e[1]!==p?(h=p?.find(U=>U.name===n.name),e[0]=n.name,e[1]=p,e[2]=h):h=e[2];const g=h,b=g?.completed_at_epoch_ms,j=g!=null,y=x?.error?.includes(n.name),S="toolName"in n.action,v=S&&"connectionId"in n.action?n.action.connectionId:null,k=!!(S&&"toolName"in n.action?n.action.toolName:null),I=Yi(n),T=j?"success":y?"error":r?.status,M=r!==void 0,R=T==="success"||T==="error";let P=I.length>0?60:12;(T==="success"||T==="error")&&(P=P+32);const z=Ui(T);let q;e[3]!==T?(q=qi(T),e[3]=T,e[4]=q):q=e[4];const A=q;let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=function(qe,Os){const on=Os.split(".").slice(1);if(on.length===0)return Array.isArray(qe)?qe:void 0;let ie=qe;for(const Rs of on){if(ie==null)return;if(typeof ie=="object")ie=ie[Rs];else return}return Array.isArray(ie)?ie:void 0},e[5]=J):J=e[5];const _=J,$=n.forEach!==void 0,E=n.forEach?.ref;let L;e[6]!==E?(L=E?.replace("@","").split(".")[0],e[6]=E,e[7]=L):L=e[7];const H=L,Z=m?.status==="running"||m?.status==="enqueued";let D;e[8]!==p||e[9]!==H?(D=p?.some(U=>U.name===H),e[8]=p,e[9]=H,e[10]=D):D=e[10];const G=D,B=Z?500:!1;let K;e[11]!==G||e[12]!==B?(K={refetchInterval:B,enabled:G},e[11]=G,e[12]=B,e[13]=K):K=e[13];const{output:Pe}=es(f,H,K);let Ve;if(e[14]!==Pe||e[15]!==E){const U=E?.replace("@","");Ve=U?_(Pe,U):void 0,e[14]=Pe,e[15]=E,e[16]=Ve}else Ve=e[16];const Le=Ve;let Be;e[17]!==m?.completed_steps?.success||e[18]!==n.name?(Be=m?.completed_steps?.success?.filter(U=>new RegExp(`^${n.name}\\[\\d+\\]$`).test(U.name)),e[17]=m?.completed_steps?.success,e[18]=n.name,e[19]=Be):Be=e[19];const rt=Be,it=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lt=T==="running"&&"bg-accent/50",ct=l&&"opacity-50";let ue;e[20]!==it||e[21]!==lt||e[22]!==ct?(ue=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",it,lt,ct),e[20]=it,e[21]=lt,e[22]=ct,e[23]=ue):ue=e[23];const _s="button",Ts=0;let fe;e[24]!==a?(fe=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),a())},e[24]=a,e[25]=fe):fe=e[25];const $s="w-5 flex flex-col items-center justify-center shrink-0 pt-3",at=O("text-xs font-mono opacity-75 h-8 flex items-center",z),dt=s+1;let me;e[26]!==at||e[27]!==dt?(me=o.jsx("div",{className:$s,children:o.jsxs("span",{className:at,children:[dt,"."]})}),e[26]=at,e[27]=dt,e[28]=me):me=e[28];let pe;e[29]!==A||e[30]!==s?(pe=s>0?o.jsx(vt,{height:12,color:A}):o.jsx("div",{className:"h-3"}),e[29]=A,e[30]=s,e[31]=pe):pe=e[31];let xe;e[32]!==v||e[33]!==k||e[34]!==S||e[35]!==n.name?(xe=o.jsx(Zi,{connectionId:v,isToolStep:S,hasToolSelected:k,stepName:n.name}),e[32]=v,e[33]=k,e[34]=S,e[35]=n.name,e[36]=xe):xe=e[36];let he;e[37]!==A||e[38]!==R||e[39]!==T?(he=R&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{height:8,color:A}),o.jsx(Ki,{status:T})]}),e[37]=A,e[38]=R,e[39]=T,e[40]=he):he=e[40];let ge;e[41]!==A||e[42]!==P||e[43]!==c||e[44]!==f?(ge=c&&f?null:o.jsx(vt,{height:P,color:A}),e[41]=A,e[42]=P,e[43]=c,e[44]=f,e[45]=ge):ge=e[45];let be;e[46]!==pe||e[47]!==xe||e[48]!==he||e[49]!==ge?(be=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[pe,xe,he,ge]}),e[46]=pe,e[47]=xe,e[48]=he,e[49]=ge,e[50]=be):be=e[50];const Es="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",ut=k?"font-medium text-foreground":"text-foreground";let je;e[51]!==ut?(je=O("text-sm truncate flex-1",ut),e[51]=ut,e[52]=je):je=e[52];let ve;e[53]!==n?(ve=Qi(n),e[53]=n,e[54]=ve):ve=e[54];let ye;e[55]!==je||e[56]!==ve?(ye=o.jsx("span",{className:je,children:ve}),e[55]=je,e[56]=ve,e[57]=ye):ye=e[57];let Se;e[58]!==rt?.length||e[59]!==$||e[60]!==Le?(Se=$&&Le&&Le.length>0&&o.jsx("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center",children:`${rt?.length??0} / ${Le.length}`}),e[58]=rt?.length,e[59]=$,e[60]=Le,e[61]=Se):Se=e[61];let we;e[62]!==M||e[63]!==T?(we=M&&o.jsx(Ji,{status:T}),e[62]=M,e[63]=T,e[64]=we):we=e[64];let Ne;e[65]!==Se||e[66]!==we?(Ne=o.jsxs("div",{className:"flex items-center gap-2",children:[Se,we]}),e[65]=Se,e[66]=we,e[67]=Ne):Ne=e[67];let ke;e[68]!==M||e[69]!==d||e[70]!==u?(ke=!M&&o.jsxs(Mo,{children:[o.jsx(Po,{asChild:!0,children:o.jsx(V,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:Bi,children:o.jsx(Ao,{size:14})})}),o.jsxs(Lo,{align:"end",children:[o.jsxs(cn,{onClick:U=>{U.stopPropagation(),u()},children:[o.jsx(Bo,{size:14}),"Duplicate"]}),o.jsxs(cn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:U=>{U.stopPropagation(),d()},children:[o.jsx(Us,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[68]=M,e[69]=d,e[70]=u,e[71]=ke):ke=e[71];let Ce;e[72]!==ye||e[73]!==Ne||e[74]!==ke?(Ce=o.jsxs("div",{className:"flex items-center h-8",children:[ye,Ne,ke]}),e[72]=ye,e[73]=Ne,e[74]=ke,e[75]=Ce):Ce=e[75];const ft=I.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(Vi)});let Ie;e[76]!==T||e[77]!==b?(Ie=T==="success"&&o.jsx(Gi,{completedAtEpochMs:b}),e[76]=T,e[77]=b,e[78]=Ie):Ie=e[78];let _e;e[79]!==r?.error||e[80]!==T?(_e=T==="error"&&o.jsx(Xi,{error:r?.error}),e[79]=r?.error,e[80]=T,e[81]=_e):_e=e[81];let Te;e[82]!==Ce||e[83]!==ft||e[84]!==Ie||e[85]!==_e?(Te=o.jsxs("div",{className:Es,children:[Ce,ft,Ie,_e]}),e[82]=Ce,e[83]=ft,e[84]=Ie,e[85]=_e,e[86]=Te):Te=e[86];let Ue;return e[87]!==a||e[88]!==ue||e[89]!==fe||e[90]!==me||e[91]!==be||e[92]!==Te?(Ue=o.jsxs("div",{className:ue,onClick:a,role:_s,tabIndex:Ts,onKeyDown:fe,children:[me,be,Te]}),e[87]=a,e[88]=ue,e[89]=fe,e[90]=me,e[91]=be,e[92]=Te,e[93]=Ue):Ue=e[93],Ue}function Vi(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 Bi(t){return t.stopPropagation()}function Ui(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function qi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function Ki(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(Ut,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(Ft,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function Ji(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(Ut,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(Ft,{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(ze,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Gi(t){const e=N.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null?new Date(n):null;s=a?a.toISOString().split("T")[0]:null,i=a?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(Ro,{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 Xi(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Jt,{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 Zi(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=Vt(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(Ye,{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(Ys,{size:16,className:"text-muted-foreground"}):o.jsx(Vo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function vt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=O("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 Qi(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 Yi(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=Fe(),i=Qn(),r=Wi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=X(),d=W();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let x;e[4]!==n?(x=O("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 y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(S,v)=>{const w=r?.[S.name],k=f!==-1&&v>f&&w?.status==="pending",I=v===s.length-1;return o.jsx(Fi,{step:S,index:v,isSelected:S.name===i,executionStatus:w,isSkipped:k,isLastStep:I,onSelect:()=>l(S.name),onDelete:()=>c(S.name),onDuplicate:()=>a(S.name)},S.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=y):y=e[21],p=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let 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(tl,{}),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 tl(){const t=N.c(8),{addToolStep:e}=X();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(On,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(V,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function nl(){const t=N.c(11),{org:e}=Y(),s=Ae()??null;let i;t[0]!==e.id||t[1]!==s?(i={connectionId:s,orgId:e.id},t[0]=e.id,t[1]=s,t[2]=i):i=t[2];const r=ee(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=Rt(l);let a;t[5]!==c.data?.tools?(a=c.data?.tools??[],t[5]=c.data?.tools,t[6]=a):a=t[6];let d;return t[7]!==a||t[8]!==c.error||t[9]!==c.isLoading?(d={tools:a,isLoading:c.isLoading,error:c.error},t[7]=a,t[8]=c.error,t[9]=c.isLoading,t[10]=d):d=t[10],d}function sl(t){const e=N.c(7),{className:n}=t;if(!Ae()){let r;e[0]!==n?(r=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select an agent to see available tools"}),e[2]=l):l=e[2];let c;return e[3]!==r?(c=o.jsx("div",{className:r,children:l}),e[3]=r,e[4]=c):c=e[4],c}let i;return e[5]!==n?(i=o.jsx(ol,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function ol(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=nl(),l=He(),{updateStep:c}=X(),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=Dr(s,u??null,il,rl);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=O("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(De,{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=O("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=O("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 y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let S;return e[34]!==h||e[35]!==b||e[36]!==y?(S=o.jsxs("div",{className:h,children:[b,y]}),e[34]=h,e[35]=b,e[36]=y,e[37]=S):S=e[37],S}function rl(t,e){return t.name.localeCompare(e.name)}function il(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=O("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(Ye,{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 te="Accordion",cl=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[en,al,dl]=Ks(te),[st]=yn(te,[dl,Rn]),tn=Rn(),hs=F.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(en.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(pl,{...r,ref:e}):o.jsx(ml,{...i,ref:e})})});hs.displayName=te;var[gs,ul]=st(te),[bs,fl]=st(te,{collapsible:!1}),ml=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Tt({prop:n,defaultProp:s??"",onChange:i,caller:te});return o.jsx(gs,{scope:t.__scopeAccordion,value:F.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:F.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(bs,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(js,{...l,ref:e})})})}),pl=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Tt({prop:n,defaultProp:s??[],onChange:i,caller:te}),a=F.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=F.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(gs,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(bs,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(js,{...r,ref:e})})})}),[xl,ot]=st(te),js=F.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=F.useRef(null),a=vn(c,e),d=al(n),f=Js(i)==="ltr",m=ne(t.onKeyDown,x=>{if(!cl.includes(x.key))return;const p=x.target,h=d().filter(I=>!I.ref.current?.disabled),g=h.findIndex(I=>I.ref.current===p),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const y=0,S=b-1,v=()=>{j=g+1,j>S&&(j=y)},w=()=>{j=g-1,j<y&&(j=S)};switch(x.key){case"Home":j=y;break;case"End":j=S;break;case"ArrowRight":r==="horizontal"&&(f?v():w());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?w():v());break;case"ArrowUp":r==="vertical"&&w();break}const k=j%b;h[k].ref.current?.focus()});return o.jsx(xl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(en.Slot,{scope:n,children:o.jsx(_t.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),Qe="AccordionItem",[hl,nn]=st(Qe),vs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ot(Qe,n),l=ul(Qe,n),c=tn(n),a=qs(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(hl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(Do,{"data-orientation":r.orientation,"data-state":Cs(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});vs.displayName=Qe;var ys="AccordionHeader",Ss=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ys,n);return o.jsx(_t.h3,{"data-orientation":i.orientation,"data-state":Cs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Ss.displayName=ys;var Ct="AccordionTrigger",ws=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(Ct,n),l=fl(Ct,n),c=tn(n);return o.jsx(en.ItemSlot,{scope:n,children:o.jsx(zo,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});ws.displayName=Ct;var Ns="AccordionContent",ks=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(Ns,n),l=tn(n);return o.jsx(Wo,{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}})});ks.displayName=Ns;function Cs(t){return t?"open":"closed"}var gl=hs,bl=vs,jl=Ss,vl=ws,yl=ks;function Sl(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(gl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function wl(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=O("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(bl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Nl(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=O("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(Ho,{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(jl,{className:"flex",children:o.jsxs(vl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function kl(t){const e=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=O("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(yl,{"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 Cl(t){const{updateStep:e}=X(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=sn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Il(t){const e=N.c(32),{className:n}=t,s=He(),{appendStep:i}=X();Cl(s);const r=W(),{item:l}=re(r);if(!s){let b;e[0]!==n?(b=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==i?(j=()=>{i({type:"tool"})},e[2]=i,e[3]=j):j=e[3];let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(On,{size:14}),e[4]=y):y=e[4];let S;e[5]!==j?(S=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(V,{variant:"ghost",size:"icon",className:"size-7",onClick:j,children:y})]}),e[5]=j,e[6]=S):S=e[6];let v;return e[7]!==b||e[8]!==S?(v=o.jsx("div",{className:b,children:S}),e[7]=b,e[8]=S,e[9]=v):v=e[9],v}const c=s?.name,a=!!(l?.completed_steps?.success?.some(b=>b.name===c)||l?.completed_steps?.error?.includes(c));let d;e[10]!==n?(d=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=d):d=e[11];let u,f;e[12]!==s?(u=o.jsx(_l,{step:s}),f=o.jsx($l,{step:s}),e[12]=s,e[13]=u,e[14]=f):(u=e[13],f=e[14]);const m=a?"open":"closed";let x;e[15]!==s||e[16]!==a||e[17]!==m?(x=o.jsx(Ol,{step:s,defaultOpen:a},m),e[15]=s,e[16]=a,e[17]=m,e[18]=x):x=e[18];let p;e[19]!==s||e[20]!==r?(p=!r&&o.jsx(Pl,{step:s}),e[19]=s,e[20]=r,e[21]=p):p=e[21];let h;e[22]!==s||e[23]!==r?(h=!r&&o.jsx(Dl,{step:s}),e[22]=s,e[23]=r,e[24]=h):h=e[24];let g;return e[25]!==d||e[26]!==u||e[27]!==f||e[28]!==x||e[29]!==p||e[30]!==h?(g=o.jsxs("div",{className:d,children:[u,f,x,p,h]}),e[25]=d,e[26]=u,e[27]=f,e[28]=x,e[29]=p,e[30]=h,e[31]=g):g=e[31],g}function _l(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=W(),l=i??"";let c;e[0]!==l?(c=o.jsx(Ye,{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(Tl,{}),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 Tl(){const t=N.c(9),e=He(),{updateStep:n,startReplacingTool:s}=X(),i=W(),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){gn.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(Jn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(V,{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 sn(t){const e=N.c(13),{org:n}=Y(),i=Ae()??null;let r;e[0]!==n.id||e[1]!==i?(r={connectionId:i,orgId:n.id},e[0]=n.id,e[1]=i,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=Rt(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(m=>m.name===t),e[5]=t,e[6]=a.data?.tools,e[7]=d):d=e[7];const u=d;let f;return e[8]!==u||e[9]!==a.error||e[10]!==a.isLoading||e[11]!==a.isSuccess?(f={tool:u,isLoading:a.isLoading,isReady:a.isSuccess,error:a.error},e[8]=u,e[9]=a.error,e[10]=a.isLoading,e[11]=a.isSuccess,e[12]=f):f=e[12],f}function $l(t){const e=N.c(18),{step:n}=t,{updateStep:s}=X(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=W(),{tool:c}=sn(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?El(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(Nl,{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 y;e[9]!==d||e[10]!==p||e[11]!==h||e[12]!==g||e[13]!==b?(y=o.jsxs(wl,{value:"input",className:"border-b-0",children:[x,o.jsx(kl,{className:"px-5 pt-2",children:o.jsx(xs,{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]=y):y=e[14];let S;return e[15]!==y||e[16]!==m?(S=o.jsx(Sl,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=m,e[17]=S):S=e[17],S}function El(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function Ol(t){const e=N.c(24),{step:n,defaultOpen:s}=t,i=n.outputSchema,r=W(),{item:l}=re(r),c=!!(l?.completed_steps?.success?.some(T=>T.name===n.name)||l?.completed_steps?.error?.includes(n.name)),[a,d]=C.useState(s),{output:u,error:f}=es(r,c?n.name:void 0);let m;e[0]!==f||e[1]!==u?(m=u||(f?{error:f}:void 0),e[0]=f,e[1]=u,e[2]=m):m=e[2];const x=m,p=i&&typeof i=="object"?i.properties:void 0;let h;e[3]!==p?(h=p?Object.entries(p):[],e[3]=p,e[4]=h):h=e[4];const g=h,b=a?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[5]!==b?(j=O("flex flex-col border-b border-border",b),e[5]=b,e[6]=j):j=e[6];let y;e[7]!==a?(y=()=>d(!a),e[7]=a,e[8]=y):y=e[8];let S;e[9]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=S):S=e[9];let v;e[10]!==a?(v=o.jsxs("div",{className:"flex items-center justify-between",children:[S,a?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[10]=a,e[11]=v):v=e[11];let w;e[12]!==y||e[13]!==v?(w=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:v}),e[12]=y,e[13]=v,e[14]=w):w=e[14];let k;e[15]!==x||e[16]!==a||e[17]!==g||e[18]!==r?(k=a&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[r&&x?o.jsx(Oe,{code:JSON.stringify(x,null,2),language:"json",height:"100%",readOnly:!0}):null,!r&&g.map(Rl)]}),e[15]=x,e[16]=a,e[17]=g,e[18]=r,e[19]=k):k=e[19];let I;return e[20]!==j||e[21]!==w||e[22]!==k?(I=o.jsxs("div",{className:j,children:[w,k]}),e[20]=j,e[21]=w,e[22]=k,e[23]=I):I=e[23],I}function Rl(t){const[e,n]=t;return o.jsx(Ml,{name:e,schema:n},e)}function Al(t){switch(t){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:Mn,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Ml(t){const e=N.c(28),{name:n,schema:s}=t,i=He(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:S,color:v}=Al(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=S,c=14,a=O(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(Un,{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 y;return e[24]!==j||e[25]!==u||e[26]!==x?(y=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=y):y=e[27],y}function Pl(t){const e=N.c(29),{step:n}=t,{updateStep:s}=X(),i=W(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=sn(a??""),u=c&&"transformCode"in n.action?n.action.transformCode??null:null;let f;e[0]!==d?(f=()=>{if(!d?.outputSchema)return`interface Input {
|
|
8
8
|
// Tool output schema not available
|
|
9
9
|
}`;const I=d.outputSchema,T=I.properties;return T?`interface Input {
|
|
10
|
-
${Object.entries(T).map(R=>{const[P,z]=R,q=Ge(z),
|
|
10
|
+
${Object.entries(T).map(R=>{const[P,z]=R,q=Ge(z),A=!I.required?.includes(P);return` ${P}${A?"?":""}: ${q};`}).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:T}}),l(Ll)},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=(I,T)=>{s(n.name,{action:{...n.action,transformCode:I},...T?{outputSchema:T}:{}})},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=O("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let w;e[14]!==r?(w=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=w):w=e[15];let v;e[16]!==w||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:w}),e[16]=w,e[17]=p,e[18]=v):v=e[18];let S;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(S=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Oe,{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]=S):S=e[24];let k;return e[25]!==j||e[26]!==v||e[27]!==S?(k=o.jsxs("div",{className:j,children:[v,S]}),e[25]=j,e[26]=v,e[27]=S,e[28]=k):k=e[28],k}function Ll(t){return!t}function zl(t){return!t}function Dl(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=Z(),l="code"in n.action&&n.action.code?n.action.code:null,c=W();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=O("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(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{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(Oe,{onSave:(j,y)=>d(j,y),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==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 Ge(t){if(Array.isArray(t.type))return t.type.map(n=>Ge({...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?`${Ge(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ge(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function Wl(t){switch(t){case"success":return o.jsxs($e,{variant:"success",className:"gap-1",children:[o.jsx(Ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs($e,{variant:"destructive",className:"gap-1",children:[o.jsx(Jt,{size:11}),"Error"]});case"running":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"Running"]});case"enqueued":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"On hold"]});case"cancelled":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Mn,{size:11}),"Cancelled"]});default:return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),t]})}}function Hl(t){return`Run #${t.slice(-4).toUpperCase()}`}function Fl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=Tr(),{setShowExecutionsList:r}=Xt(),{setTrackingExecutionId:l}=Z(),c=W();let a;e[0]!==l?(a=y=>{l(y)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=O("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(Mn,{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(V,{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((y,w)=>o.jsx(Vl,{execution:y,isSelected:y.id===c,isFirst:w===0,onSelect:()=>d(y.id)},y.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==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 Vl(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=O("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=Wl(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=Hl(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}function _s(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/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=oe(r),c=l??"no-connection",{org:a}=Y(),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=ee(u),m=Et(c,"WORKFLOW",n,f),x=Ot(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 Bl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=Z();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=Oe,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 Ul(){const t=N.c(9),e=W(),{item:n}=re(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 ql;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 ql(){}function Kl(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 Jl(){const t=N.c(20),{setTrackingExecutionId:e}=Z(),n=W(),s=Ul();let i;t[0]!==s?(i=s!=null?Kl(s):null,t[0]=s,t[1]=i):i=t[1];const r=i;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(Zs,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=l):l=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=c):c=t[3];let a;t[4]!==n?(a=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[c,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=a):a=t[5];let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Fo,{className:"w-4 h-4 text-muted-foreground"}),t[6]=d):d=t[6];let u;t[7]!==r?(u=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[d,o.jsx("span",{className:"text-sm text-muted-foreground",children:r})]}),t[7]=r,t[8]=u):u=t[8];let f;t[9]!==a||t[10]!==u?(f=o.jsxs("div",{className:"flex items-center h-full",children:[l,a,u]}),t[9]=a,t[10]=u,t[11]=f):f=t[11];let m;t[12]!==e?(m=()=>e(void 0),t[12]=e,t[13]=m):m=t[13];let x;t[14]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx($t,{className:"w-4 h-4 text-muted-foreground"}),t[14]=x):x=t[14];let p;t[15]!==m?(p=o.jsx(V,{variant:"ghost",size:"xs",onClick:m,children:x}),t[15]=m,t[16]=p):p=t[16];let h;return t[17]!==f||t[18]!==p?(h=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[f,p]}),t[17]=f,t[18]=p,t[19]=h):h=t[19],h}function Gl(t){const e=N.c(18),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c,isUpdating:a}=_s(r);let d;e[3]!==l?(d=JSON.stringify(l),e[3]=l,e[4]=d):d=e[4];const u=d;if(!l){let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[5]=p):p=e[5];let h;return e[6]!==n?(h=o.jsx(Ee,{onBack:n,children:p}),e[6]=n,e[7]=h):h=e[7],h}let f;e[8]!==l?(f={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==n||e[12]!==c?(m=o.jsx(Zl,{onBack:n,onUpdate:c,isUpdating:a}),e[10]=a,e[11]=n,e[12]=c,e[13]=m):m=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==m?(x=o.jsx(br,{initialState:f,children:m},u),e[14]=u,e[15]=f,e[16]=m,e[17]=x):x=e[17],x}function Zl(t){const e=N.c(24),{onBack:n,onUpdate:s,isUpdating:i}=t,r=Re(),l=W(),{viewMode:c,showExecutionsList:a}=Xt(),d=He();let u;e[0]!==s||e[1]!==r?(u=async()=>{await s(r)},e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,m=d&&"toolName"in d.action,x=m?d.action.toolName:null,p=m&&!x&&!l,h=!p&&(d||l||!a);let g;e[3]!==f||e[4]!==i||e[5]!==r.description||e[6]!==r.title?(g=o.jsx(Ai,{title:r.title,description:r.description,onSave:f,isSaving:i}),e[3]=f,e[4]=i,e[5]=r.description,e[6]=r.title,e[7]=g):g=e[7];let b;e[8]!==l?(b=l&&o.jsx(Jl,{}),e[8]=l,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==h||e[13]!==p||e[14]!==c||e[15]!==r?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(Bl,{workflow:r,onUpdate:s}):o.jsxs(po,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(rn,{defaultSize:50,minSize:30,children:o.jsx(el,{})}),o.jsx(xo,{}),o.jsxs(rn,{defaultSize:50,minSize:25,children:[p&&o.jsx(sl,{className:"border-l border-border"}),a&&o.jsx(Fl,{}),h&&o.jsx(Il,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=h,e[13]=p,e[14]=c,e[15]=r,e[16]=j):j=e[16];let y;e[17]!==g||e[18]!==b||e[19]!==j?(y=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[g,b,j]}),e[17]=g,e[18]=b,e[19]=j,e[20]=y):y=e[20];let w;return e[21]!==n||e[22]!==y?(w=o.jsx(Ee,{onBack:n,children:y}),e[21]=n,e[22]=y,e[23]=w):w=e[23],w}function Xl(t){const e=N.c(3),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=oe(s),l=Et(i??"no-connection","WORKFLOW_EXECUTION",n,i);let c;return e[1]!==l?(c={item:l},e[1]=l,e[2]=c):c=e[2],c}function Ql(t){const e=N.c(13),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=Xl(r);if(!l){let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[3]=u):u=e[3];let f;return e[4]!==n?(f=o.jsx(Ee,{onBack:n,children:u}),e[4]=n,e[5]=f):f=e[5],f}let c;e[6]!==l?(c=JSON.stringify(l,null,2),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==c?(a=o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Oe,{height:"100%",code:c,language:"json",readOnly:!0})}),e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Ee,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Yl={workflow:Gl,workflow_execution:Ql,prompt:Xo};function ec(){const t=N.c(6),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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=tc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(rr,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function tc(t){return Promise.resolve()}function nc(){const t=N.c(19),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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}=Y(),f=i??null;let m;t[3]!==u.id||t[4]!==f?(m={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=m):m=t[5];const x=ee(m),p=Ot(d,r,x);let h;t[6]!==p||t[7]!==l?(h=async S=>{l&&await p.update.mutateAsync({id:l,data:S})},t[6]=p,t[7]=l,t[8]=h):h=t[8];const g=h;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,y=j&&Yl[j];if(y){let S;return t[11]!==y||t[12]!==a||t[13]!==g||t[14]!==l?(S=o.jsx(y,{itemId:l,onBack:a,onUpdate:g}),t[11]=y,t[12]=a,t[13]=g,t[14]=l,t[15]=S):S=t[15],S}let w;t[16]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Xs,{size:36,className:"text-muted-foreground"}),t[16]=w):w=t[16];let v;return t[17]!==a?(v=o.jsx(Bt,{icon:w,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[17]=a,t[18]=v):v=t[18],v}function sc(){const t=N.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=oe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ec,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(nc,{}),t[2]=r):r=t[2],r}function va(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(sc,{})})}),t[0]=e):e=t[0],e}export{va as default};
|
|
26
|
+
}`;s(n.name,{action:{...n.action,transformCode:T}}),l(Ll)},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=(I,T)=>{s(n.name,{action:{...n.action,transformCode:I},...T?{outputSchema:T}:{}})},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=O("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let S;e[14]!==r?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=S):S=e[15];let v;e[16]!==S||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:S}),e[16]=S,e[17]=p,e[18]=v):v=e[18];let w;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(w=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Oe,{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 Ll(t){return!t}function zl(t){return!t}function Dl(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=X(),l="code"in n.action&&n.action.code?n.action.code:null,c=W();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=O("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(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{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(Oe,{onSave:(j,y)=>d(j,y),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==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 Ge(t){if(Array.isArray(t.type))return t.type.map(n=>Ge({...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?`${Ge(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ge(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function Wl(t){switch(t){case"success":return o.jsxs($e,{variant:"success",className:"gap-1",children:[o.jsx(Ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs($e,{variant:"destructive",className:"gap-1",children:[o.jsx(Jt,{size:11}),"Error"]});case"running":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"Running"]});case"enqueued":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"On hold"]});case"cancelled":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(An,{size:11}),"Cancelled"]});default:return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),t]})}}function Hl(t){return`Run #${t.slice(-4).toUpperCase()}`}function Fl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=Tr(),{setShowExecutionsList:r}=Zt(),{setTrackingExecutionId:l}=X(),c=W();let a;e[0]!==l?(a=y=>{l(y)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=O("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(An,{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(V,{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((y,S)=>o.jsx(Vl,{execution:y,isSelected:y.id===c,isFirst:S===0,onSelect:()=>d(y.id)},y.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==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 Vl(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=O("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=Wl(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=Hl(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}function Is(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/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=oe(r),c=l??"no-connection",{org:a}=Y(),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=ee(u),m=Et(c,"WORKFLOW",n,f),x=Ot(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 Bl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=X();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=Oe,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 Ul(){const t=N.c(9),e=W(),{item:n}=re(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 ql;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 ql(){}function Kl(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 Jl(){const t=N.c(20),{setTrackingExecutionId:e}=X(),n=W(),s=Ul();let i;t[0]!==s?(i=s!=null?Kl(s):null,t[0]=s,t[1]=i):i=t[1];const r=i;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(Gs,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=l):l=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=c):c=t[3];let a;t[4]!==n?(a=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[c,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=a):a=t[5];let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Fo,{className:"w-4 h-4 text-muted-foreground"}),t[6]=d):d=t[6];let u;t[7]!==r?(u=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[d,o.jsx("span",{className:"text-sm text-muted-foreground",children:r})]}),t[7]=r,t[8]=u):u=t[8];let f;t[9]!==a||t[10]!==u?(f=o.jsxs("div",{className:"flex items-center h-full",children:[l,a,u]}),t[9]=a,t[10]=u,t[11]=f):f=t[11];let m;t[12]!==e?(m=()=>e(void 0),t[12]=e,t[13]=m):m=t[13];let x;t[14]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx($t,{className:"w-4 h-4 text-muted-foreground"}),t[14]=x):x=t[14];let p;t[15]!==m?(p=o.jsx(V,{variant:"ghost",size:"xs",onClick:m,children:x}),t[15]=m,t[16]=p):p=t[16];let h;return t[17]!==f||t[18]!==p?(h=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[f,p]}),t[17]=f,t[18]=p,t[19]=h):h=t[19],h}function Gl(t){const e=N.c(18),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c,isUpdating:a}=Is(r);let d;e[3]!==l?(d=JSON.stringify(l),e[3]=l,e[4]=d):d=e[4];const u=d;if(!l){let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[5]=p):p=e[5];let h;return e[6]!==n?(h=o.jsx(Ee,{onBack:n,children:p}),e[6]=n,e[7]=h):h=e[7],h}let f;e[8]!==l?(f={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==n||e[12]!==c?(m=o.jsx(Xl,{onBack:n,onUpdate:c,isUpdating:a}),e[10]=a,e[11]=n,e[12]=c,e[13]=m):m=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==m?(x=o.jsx(br,{initialState:f,children:m},u),e[14]=u,e[15]=f,e[16]=m,e[17]=x):x=e[17],x}function Xl(t){const e=N.c(24),{onBack:n,onUpdate:s,isUpdating:i}=t,r=Re(),l=W(),{viewMode:c,showExecutionsList:a}=Zt(),d=He();let u;e[0]!==s||e[1]!==r?(u=async()=>{await s(r)},e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,m=d&&"toolName"in d.action,x=m?d.action.toolName:null,p=m&&!x&&!l,h=!p&&(d||l||!a);let g;e[3]!==f||e[4]!==i||e[5]!==r.description||e[6]!==r.title?(g=o.jsx(Mi,{title:r.title,description:r.description,onSave:f,isSaving:i}),e[3]=f,e[4]=i,e[5]=r.description,e[6]=r.title,e[7]=g):g=e[7];let b;e[8]!==l?(b=l&&o.jsx(Jl,{}),e[8]=l,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==h||e[13]!==p||e[14]!==c||e[15]!==r?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(Bl,{workflow:r,onUpdate:s}):o.jsxs(mo,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(rn,{defaultSize:50,minSize:30,children:o.jsx(el,{})}),o.jsx(po,{}),o.jsxs(rn,{defaultSize:50,minSize:25,children:[p&&o.jsx(sl,{className:"border-l border-border"}),a&&o.jsx(Fl,{}),h&&o.jsx(Il,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=h,e[13]=p,e[14]=c,e[15]=r,e[16]=j):j=e[16];let y;e[17]!==g||e[18]!==b||e[19]!==j?(y=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[g,b,j]}),e[17]=g,e[18]=b,e[19]=j,e[20]=y):y=e[20];let S;return e[21]!==n||e[22]!==y?(S=o.jsx(Ee,{onBack:n,children:y}),e[21]=n,e[22]=y,e[23]=S):S=e[23],S}function Zl(t){const e=N.c(3),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=oe(s),l=Et(i??"no-connection","WORKFLOW_EXECUTION",n,i);let c;return e[1]!==l?(c={item:l},e[1]=l,e[2]=c):c=e[2],c}function Ql(t){const e=N.c(13),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=Zl(r);if(!l){let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[3]=u):u=e[3];let f;return e[4]!==n?(f=o.jsx(Ee,{onBack:n,children:u}),e[4]=n,e[5]=f):f=e[5],f}let c;e[6]!==l?(c=JSON.stringify(l,null,2),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==c?(a=o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Oe,{height:"100%",code:c,language:"json",readOnly:!0})}),e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Ee,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Yl={workflow:Gl,workflow_execution:Ql,prompt:Zo};function ec(){const t=N.c(6),e=Sn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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=tc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(rr,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function tc(t){return Promise.resolve()}function nc(){const t=N.c(19),e=Sn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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}=Y(),f=i??null;let m;t[3]!==u.id||t[4]!==f?(m={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=m):m=t[5];const x=ee(m),p=Ot(d,r,x);let h;t[6]!==p||t[7]!==l?(h=async w=>{l&&await p.update.mutateAsync({id:l,data:w})},t[6]=p,t[7]=l,t[8]=h):h=t[8];const g=h;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,y=j&&Yl[j];if(y){let w;return t[11]!==y||t[12]!==a||t[13]!==g||t[14]!==l?(w=o.jsx(y,{itemId:l,onBack:a,onUpdate:g}),t[11]=y,t[12]=a,t[13]=g,t[14]=l,t[15]=w):w=t[15],w}let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Xs,{size:36,className:"text-muted-foreground"}),t[16]=S):S=t[16];let v;return t[17]!==a?(v=o.jsx(Bt,{icon:S,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[17]=a,t[18]=v):v=t[18],v}function sc(){const t=N.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=oe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ec,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(nc,{}),t[2]=r):r=t[2],r}function wa(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(sc,{})})}),t[0]=e):e=t[0],e}export{wa as default};
|