@decocms/mesh 2.4.2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/client/assets/{AlertCircle-CZPV4eTQ.js → AlertCircle-DAyHhLS6.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-DQOG1GuJ.js → ArrowLeft-Bpp_SsGd.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-Cdy__m-8.js → ChevronDown-CsOv8W2I.js} +1 -1
  4. package/dist/client/assets/{ChevronRight-SzPzGSNO.js → ChevronRight-Boh94iyZ.js} +1 -1
  5. package/dist/client/assets/{Copy01-DS49wIzW.js → Copy01-BrkhNqAw.js} +1 -1
  6. package/dist/client/assets/{DotsHorizontal-BSoB0mo2.js → DotsHorizontal-Bv4IcguS.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-eZBspOrA.js → DotsVertical-cXTBD68H.js} +1 -1
  8. package/dist/client/assets/{File06-CUqAuIUq.js → File06-l4-3IHqa.js} +1 -1
  9. package/dist/client/assets/{FilterLines-BTBF9JAn.js → FilterLines-D2prJuZ_.js} +1 -1
  10. package/dist/client/assets/{FlipBackward-BRcPqCms.js → FlipBackward-Cuwh5H4e.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-DovnqKJf.js → GitBranch01-DDKUuZMu.js} +1 -1
  12. package/dist/client/assets/{Grid01-R-k411L-.js → Grid01-COCXYn3t.js} +1 -1
  13. package/dist/client/assets/{Inbox01-bvdCozgs.js → Inbox01-CEyXxA8m.js} +1 -1
  14. package/dist/client/assets/{InfoCircle-r2yyYHHv.js → InfoCircle-C2iaXmlJ.js} +1 -1
  15. package/dist/client/assets/{Key01-BWe_1dg2.js → Key01-CcMWzP51.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-BklnopGx.js → LinkExternal01-31BeOzKc.js} +1 -1
  17. package/dist/client/assets/{Loading01-C0_l8AxO.js → Loading01-BqUL1Os2.js} +1 -1
  18. package/dist/client/assets/{Lock01-C7_8eECJ.js → Lock01-BfDepLwB.js} +1 -1
  19. package/dist/client/assets/{Play-CWJY4nY_.js → Play-DqaoplmY.js} +1 -1
  20. package/dist/client/assets/{Plus-KTlOMNSY.js → Plus-CJASgavw.js} +1 -1
  21. package/dist/client/assets/Stop-CRrts02X.js +1 -0
  22. package/dist/client/assets/{Terminal-DDfP4x2i.js → Terminal-e-eRty6Q.js} +1 -1
  23. package/dist/client/assets/{Trash01-BMJLKtdF.js → Trash01-C3O36hTP.js} +1 -1
  24. package/dist/client/assets/{X-BFdZnqth.js → X-D4fwyn55.js} +1 -1
  25. package/dist/client/assets/{XClose-DTyQuBBY.js → XClose-Bfbqr-bg.js} +1 -1
  26. package/dist/client/assets/{alert-dialog-Dz8Vs8_m.js → alert-dialog-F5nkQKBj.js} +1 -1
  27. package/dist/client/assets/{auth-catchall-qU76xBKm.js → auth-catchall-BAZuaH8l.js} +1 -1
  28. package/dist/client/assets/{auth-CJNQiaii.js → auth-m66JRmI1.js} +1 -1
  29. package/dist/client/assets/{avatar-D4SXwEgs.js → avatar-MdaY7dDq.js} +1 -1
  30. package/dist/client/assets/{badge-99kEJDtp.js → badge-BRpJ4D36.js} +1 -1
  31. package/dist/client/assets/{card-DZuxbKf1.js → card-DPsjHi5_.js} +1 -1
  32. package/dist/client/assets/{checkbox-Bp9oZUjM.js → checkbox-dB50xYpN.js} +1 -1
  33. package/dist/client/assets/{collection-detail-BB7cjHq1.js → collection-detail-glRN62L4.js} +3 -3
  34. package/dist/client/assets/{collection-display-button-CqzsQ6A1.js → collection-display-button-BEkWecO6.js} +1 -1
  35. package/dist/client/assets/{collection-header-BQqQNO9q.js → collection-header-DS84Dz-Z.js} +1 -1
  36. package/dist/client/assets/{collection-page-DlOERJnr.js → collection-page-Dw7iXEq1.js} +1 -1
  37. package/dist/client/assets/{collection-search-CIs95Rnw.js → collection-search-Dwhflp6J.js} +1 -1
  38. package/dist/client/assets/{collection-tab-BPPicFWO.js → collection-tab-CQ_V1h26.js} +1 -1
  39. package/dist/client/assets/{collection-table-wrapper-D1OlmFUL.js → collection-table-wrapper-Tc6aoQU4.js} +1 -1
  40. package/dist/client/assets/{connection-card-Dm43-Wul.js → connection-card-BOHNc6OM.js} +1 -1
  41. package/dist/client/assets/connection-detail-yed7lEwn.js +1 -0
  42. package/dist/client/assets/{connections-BB4IEP_5.js → connections-Cyw4vKCR.js} +1 -1
  43. package/dist/client/assets/constants-DgMd8oVj.js +1 -0
  44. package/dist/client/assets/{create-organization-dialog-miyo8zQR.js → create-organization-dialog-BW64m1n3.js} +1 -1
  45. package/dist/client/assets/{dialog-DK6VaggX.js → dialog-dVO4tnyX.js} +1 -1
  46. package/dist/client/assets/{dropdown-menu-DTGJCwi0.js → dropdown-menu-Dl6PURsy.js} +1 -1
  47. package/dist/client/assets/{empty-state-DVGQ1BWZ.js → empty-state-Ctkb5o27.js} +1 -1
  48. package/dist/client/assets/{env-vars-editor-BG99RDNZ.js → env-vars-editor-BH1jNoL-.js} +1 -1
  49. package/dist/client/assets/{error-boundary-9rVpFVah.js → error-boundary-NRHN5Y9-.js} +1 -1
  50. package/dist/client/assets/{extract-connection-data-E0zDRO9-.js → extract-connection-data-BaLXzQ_k.js} +1 -1
  51. package/dist/client/assets/{form-BGufVhpJ.js → form-BYRg0fLZ.js} +1 -1
  52. package/dist/client/assets/{gateway-detail-IUdVxLB4.js → gateway-detail-BfXnCLYA.js} +1 -1
  53. package/dist/client/assets/gateway-selector-DAEirbF5.js +1 -0
  54. package/dist/client/assets/{gateways-BA7lpBES.js → gateways-BJBU4jqZ.js} +1 -1
  55. package/dist/client/assets/{home-B5o9i0BD.js → home-4Azy8yCf.js} +1 -1
  56. package/dist/client/assets/{index-CaBiIG-r.js → index-CiFNe-N2.js} +1 -1
  57. package/dist/client/assets/index-DJlsJ8uo.js +25 -0
  58. package/dist/client/assets/{index-DHr9tFb0.js → index-DsWTyaMI.js} +31 -31
  59. package/dist/client/assets/{input-C4WvdKkR.js → input-Bjw47IqN.js} +1 -1
  60. package/dist/client/assets/{layout-9R3rtCy3.js → layout-CSrwjVH6.js} +1 -1
  61. package/dist/client/assets/{lazy-highlighter-rNRrmjMV.js → lazy-highlighter-3jMk7DX6.js} +1 -1
  62. package/dist/client/assets/{localstorage-keys-DrIZl-Oa.js → localstorage-keys-mgwVhAgB.js} +1 -1
  63. package/dist/client/assets/{login-CaUUYoaL.js → login-B4k1yizo.js} +1 -1
  64. package/dist/client/assets/{mcp-oauth-BPterAhB.js → mcp-oauth-CYe4lbkF.js} +1 -1
  65. package/dist/client/assets/{mcp-server-detail-BmtUegeN.js → mcp-server-detail-BncapnIe.js} +1 -1
  66. package/dist/client/assets/{members-Dha-TTi3.js → members-CvcRBE7N.js} +1 -1
  67. package/dist/client/assets/{monaco-editor-fWj67pSD.js → monaco-editor-CiWfYNhn.js} +1 -1
  68. package/dist/client/assets/{monitoring-BHqKCRpc.js → monitoring-C2NQS-B1.js} +1 -1
  69. package/dist/client/assets/{oauth-callback-C8SrcUYM.js → oauth-callback-CVfImHX4.js} +1 -1
  70. package/dist/client/assets/{page-D_pWRusE.js → page-4Om70maF.js} +1 -1
  71. package/dist/client/assets/{page-CB2Kbqif.js → page-DWpNpeBI.js} +2 -2
  72. package/dist/client/assets/{pin-to-sidebar-button-Bau5uIKK.js → pin-to-sidebar-button-B_8L8Vb0.js} +1 -1
  73. package/dist/client/assets/{popover-B1hj_ypq.js → popover-BAqz8iCu.js} +1 -1
  74. package/dist/client/assets/project-context-provider-4_jnbmhf.js +1 -0
  75. package/dist/client/assets/{resizable-oOXY1Kb2.js → resizable-BQxIvKty.js} +1 -1
  76. package/dist/client/assets/{resource-tabs-DXcOsIua.js → resource-tabs-N7R8QmbK.js} +1 -1
  77. package/dist/client/assets/{select-58kzPmSH.js → select-D0sx2072.js} +1 -1
  78. package/dist/client/assets/{settings-C8uZUL9P.js → settings-DBVtWxtX.js} +1 -1
  79. package/dist/client/assets/shell-layout-yGeudWHM.js +1 -0
  80. package/dist/client/assets/{spinner-BmiYLJkt.js → spinner-DZG16LrV.js} +1 -1
  81. package/dist/client/assets/{switch-D3qS-cJT.js → switch-BRK3ymGn.js} +1 -1
  82. package/dist/client/assets/{textarea-KpHZNzGY.js → textarea-Ct5hMebK.js} +1 -1
  83. package/dist/client/assets/{thread-history-popover-DrZ24omE.js → thread-history-popover-CUQ7xqpL.js} +65 -65
  84. package/dist/client/assets/{tools-list-BQ6I_zS0.js → tools-list-B6Grd2aY.js} +1 -1
  85. package/dist/client/assets/{use-binding-DxCldqD_.js → use-binding-CocjKJdo.js} +1 -1
  86. package/dist/client/assets/{use-connection-gZqQ1FAI.js → use-connection-BRzCmTOd.js} +1 -1
  87. package/dist/client/assets/{use-connection-resources-CBnleHDw.js → use-connection-resources-AWPWi-RH.js} +1 -1
  88. package/dist/client/assets/{use-gateway-BAeublLm.js → use-gateway-LBTVY8TW.js} +1 -1
  89. package/dist/client/assets/{use-gateway-system-prompt-DcPNvMKK.js → use-gateway-system-prompt-DscZjM_A.js} +1 -1
  90. package/dist/client/assets/{use-list-state-_DXZxdCV.js → use-list-state-C9bMHTQK.js} +1 -1
  91. package/dist/client/assets/{use-mcp-DVQixgJB.js → use-mcp-Xq1C6Xb8.js} +1 -1
  92. package/dist/client/assets/{use-members-Ba-WS8jO.js → use-members-DwaDlN2k.js} +1 -1
  93. package/dist/client/assets/{use-mobile-CXfyAVoY.js → use-mobile-b2I183jd.js} +1 -1
  94. package/dist/client/assets/{use-organization-settings-g1OUF8Uc.js → use-organization-settings-D21MRe-D.js} +1 -1
  95. package/dist/client/assets/{use-tool-call-DYbV_cs9.js → use-tool-call-DWmlWS7M.js} +1 -1
  96. package/dist/client/assets/{useQueries-DAJGlQiv.js → useQueries-BLLM0cVq.js} +1 -1
  97. package/dist/client/assets/useQuery-BXYZ1U8o.js +1 -0
  98. package/dist/client/assets/{value-DqDh9HyF.js → value-D6kCdY90.js} +1 -1
  99. package/dist/client/assets/{view-mode-toggle-DAKbBF5Z.js → view-mode-toggle-DlhHZSZ6.js} +1 -1
  100. package/dist/client/assets/{workflow-BO9cHs1L.js → workflow-DufdLkFQ.js} +1 -1
  101. package/dist/client/index.html +1 -1
  102. package/dist/server/cli.js +89 -89
  103. package/dist/server/server.js +88 -88
  104. package/package.json +1 -1
  105. package/dist/client/assets/connection-detail-DXNZMYLL.js +0 -1
  106. package/dist/client/assets/constants-BSLIcG1u.js +0 -1
  107. package/dist/client/assets/gateway-selector-CuwGVcxw.js +0 -1
  108. package/dist/client/assets/index-Rcp5vvtf.js +0 -25
  109. package/dist/client/assets/project-context-provider-SYQQWwHt.js +0 -1
  110. package/dist/client/assets/shell-layout-BXan9A9l.js +0 -1
  111. package/dist/client/assets/useQuery--jXLy0yb.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aH as qe,r as M,s as Ch,v as uo,c as I,j as m,i as Ti,x as Nh,f as Eh,d as Et,b as Th,t as jc,z as ee,y as Mh,aI as Dc,a8 as Ah,a7 as Oh,aJ as Ih,ae as Mi,at as Pc,aw as Rh,af as On,ah as Ve,ag as Ai,ax as jh,ak as Ds,au as Dh,ac as Oi,aD as Ph,aE as Lh,aF as $h,aK as Ii,aL as _h,av as Lc,aj as zh,aM as Bh,ad as Fh,aN as Vh,aG as $c}from"./index-DHr9tFb0.js";import{U as qt,E as _c,e as Ri,f as ji,c as Ue,d as Di,I as Ps,u as Hh,n as Wh}from"./use-connection-gZqQ1FAI.js";import{E as zc}from"./error-boundary-9rVpFVah.js";import{P as Pi}from"./pin-to-sidebar-button-Bau5uIKK.js";import{B as me,I as Li,c as J}from"./input-C4WvdKkR.js";import{F as fo,a as qh,b as $i,d as _i}from"./form-BGufVhpJ.js";import{T as Uo}from"./textarea-KpHZNzGY.js";import{b as Lt,T as $t,a as _t,c as zt,i as zi}from"./project-context-provider-SYQQWwHt.js";import{i as Bc}from"./FlipBackward-BRcPqCms.js";import{a as Fc,V as Bi,b as Sn}from"./layout-9R3rtCy3.js";import{i as Uh}from"./AlertCircle-CZPV4eTQ.js";import{s as Kh,M as In}from"./monaco-editor-fWj67pSD.js";import{i as Fi,a as Jh,n as Gh}from"./Play-CWJY4nY_.js";import{a as Xh}from"./Copy01-DS49wIzW.js";import{i as nr}from"./Loading01-C0_l8AxO.js";import{s as Vi}from"./XClose-DTyQuBBY.js";import{u as Yh,O as Qh,M as Zh,F as ep,v as tp}from"./index-Rcp5vvtf.js";import{u as Hi}from"./use-mcp-DVQixgJB.js";import{E as Wi}from"./empty-state-DVGQ1BWZ.js";import{D as np,u as rp}from"./use-binding-DxCldqD_.js";import{u as sp}from"./use-gateway-BAeublLm.js";import{b as op,R as Kl,a as ip}from"./resizable-oOXY1Kb2.js";import{G as lp,i as ap}from"./gateway-selector-CuwGVcxw.js";import{S as Ls}from"./spinner-BmiYLJkt.js";import{V as cp}from"./view-mode-toggle-DAKbBF5Z.js";import{i as dp}from"./GitBranch01-DovnqKJf.js";import{a as qi,b as Ui}from"./use-tool-call-DYbV_cs9.js";import{D as up,a as fp,b as hp,f as pp,c as mp,d as gp}from"./dialog-DK6VaggX.js";import"./index-CaBiIG-r.js";import{s as Vc}from"./Plus-KTlOMNSY.js";import{i as yp}from"./DotsHorizontal-BSoB0mo2.js";import{b as xp,D as bp,a as kp,c as Jl}from"./dropdown-menu-DTGJCwi0.js";import{i as Sp}from"./ChevronRight-SzPzGSNO.js";import{B as un}from"./badge-99kEJDtp.js";import{i as Hc}from"./X-BFdZnqth.js";import"./use-organization-settings-g1OUF8Uc.js";import"./ArrowLeft-DQOG1GuJ.js";import"./mcp-oauth-BPterAhB.js";import"./auth-CJNQiaii.js";import"./env-vars-editor-BG99RDNZ.js";import"./Trash01-BMJLKtdF.js";import"./File06-CUqAuIUq.js";import"./Key01-BWe_1dg2.js";import"./select-58kzPmSH.js";import"./ChevronDown-Cdy__m-8.js";import"./Terminal-DDfP4x2i.js";import"./useQueries-DAJGlQiv.js";import"./constants-BSLIcG1u.js";import"./registry-utils-B7t_ZBUi.js";import"./extract-connection-data-E0zDRO9-.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./useQuery--jXLy0yb.js";import"./use-mobile-CXfyAVoY.js";const Wc=qe("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 qc=qe("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 Ki=qe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Ji=qe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const wp=qe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const vp=qe("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 Uc=qe("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 Kc=qe("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 Jc=qe("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 Gc=qe("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 Xc=qe("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"}]]),Gi=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Gi.displayName="AlertOctagon";const Yc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Yc.displayName="Box";const Qc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Qc.displayName="ClockFastForward";const Zc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Zc.displayName="Code02";const Dr=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Dr.displayName="Columns01";const ed=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));ed.displayName="CornerDownRight";const td=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));td.displayName="Database01";const nd=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));nd.displayName="Repeat03";const Xi=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Xi.displayName="Save02";const rd=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));rd.displayName="Tool01";const{getOwnPropertyNames:Cp,getOwnPropertySymbols:Np}=Object,{hasOwnProperty:Ep}=Object.prototype;function ho(n,e){return function(r,s,o){return n(r,s,o)&&e(r,s,o)}}function Sr(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:o}=s,i=o.get(t),l=o.get(r);if(i&&l)return i===r&&l===t;o.set(t,r),o.set(r,t);const a=n(t,r,s);return o.delete(t),o.delete(r),a}}function Tp(n){return n?.[Symbol.toStringTag]}function Gl(n){return Cp(n).concat(Np(n))}const Mp=Object.hasOwn||((n,e)=>Ep.call(n,e));function Yt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const Ap="__v",Op="__o",Ip="_owner",{getOwnPropertyDescriptor:Xl,keys:Yl}=Object;function Rp(n,e){return n.byteLength===e.byteLength&&Fr(new Uint8Array(n),new Uint8Array(e))}function jp(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function Dp(n,e){return n.byteLength===e.byteLength&&Fr(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Pp(n,e){return Yt(n.getTime(),e.getTime())}function Lp(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function $p(n,e){return n===e}function Ql(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=n.entries();let i,l,a=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let d=!1,u=0;for(;(l=c.next())&&!l.done;){if(s[u]){u++;continue}const f=i.value,h=l.value;if(t.equals(f[0],h[0],a,u,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){d=s[u]=!0;break}u++}if(!d)return!1;a++}return!0}const _p=Yt;function zp(n,e,t){const r=Yl(n);let s=r.length;if(Yl(e).length!==s)return!1;for(;s-- >0;)if(!sd(n,e,t,r[s]))return!1;return!0}function zn(n,e,t){const r=Gl(n);let s=r.length;if(Gl(e).length!==s)return!1;let o,i,l;for(;s-- >0;)if(o=r[s],!sd(n,e,t,o)||(i=Xl(n,o),l=Xl(e,o),(i||l)&&(!i||!l||i.configurable!==l.configurable||i.enumerable!==l.enumerable||i.writable!==l.writable)))return!1;return!0}function Bp(n,e){return Yt(n.valueOf(),e.valueOf())}function Fp(n,e){return n.source===e.source&&n.flags===e.flags}function Zl(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=n.values();let i,l;for(;(i=o.next())&&!i.done;){const a=e.values();let c=!1,d=0;for(;(l=a.next())&&!l.done;){if(!s[d]&&t.equals(i.value,l.value,i.value,l.value,n,e,t)){c=s[d]=!0;break}d++}if(!c)return!1}return!0}function Fr(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function Vp(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function sd(n,e,t,r){return(r===Ip||r===Op||r===Ap)&&(n.$$typeof||e.$$typeof)?!0:Mp(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const Hp="[object ArrayBuffer]",Wp="[object Arguments]",qp="[object Boolean]",Up="[object DataView]",Kp="[object Date]",Jp="[object Error]",Gp="[object Map]",Xp="[object Number]",Yp="[object Object]",Qp="[object RegExp]",Zp="[object Set]",em="[object String]",tm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},nm="[object URL]",rm=Object.prototype.toString;function sm({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,x,b){if(y===x)return!0;if(y==null||x==null)return!1;const k=typeof y;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(y,x,b):k==="function"?o(y,x,b):!1;const C=y.constructor;if(C!==x.constructor)return!1;if(C===Object)return a(y,x,b);if(Array.isArray(y))return e(y,x,b);if(C===Date)return r(y,x,b);if(C===RegExp)return d(y,x,b);if(C===Map)return i(y,x,b);if(C===Set)return u(y,x,b);const S=rm.call(y);if(S===Kp)return r(y,x,b);if(S===Qp)return d(y,x,b);if(S===Gp)return i(y,x,b);if(S===Zp)return u(y,x,b);if(S===Yp)return typeof y.then!="function"&&typeof x.then!="function"&&a(y,x,b);if(S===nm)return h(y,x,b);if(S===Jp)return s(y,x,b);if(S===Wp)return a(y,x,b);if(tm[S])return f(y,x,b);if(S===Hp)return n(y,x,b);if(S===Up)return t(y,x,b);if(S===qp||S===Xp||S===em)return c(y,x,b);if(p){let w=p[S];if(!w){const v=Tp(y);v&&(w=p[v])}if(w)return w(y,x,b)}return!1}}function om({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:Rp,areArraysEqual:t?zn:jp,areDataViewsEqual:Dp,areDatesEqual:Pp,areErrorsEqual:Lp,areFunctionsEqual:$p,areMapsEqual:t?ho(Ql,zn):Ql,areNumbersEqual:_p,areObjectsEqual:t?zn:zp,arePrimitiveWrappersEqual:Bp,areRegExpsEqual:Fp,areSetsEqual:t?ho(Zl,zn):Zl,areTypedArraysEqual:t?ho(Fr,zn):Fr,areUrlsEqual:Vp,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=Sr(r.areArraysEqual),o=Sr(r.areMapsEqual),i=Sr(r.areObjectsEqual),l=Sr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:l})}return r}function im(n){return function(e,t,r,s,o,i,l){return n(e,t,l)}}function lm({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(l,a){const{cache:c=n?new WeakMap:void 0,meta:d}=t();return e(l,a,{cache:c,equals:r,meta:d,strict:s})};if(n)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,o)}}const am=Tt();Tt({strict:!0});Tt({circular:!0});Tt({circular:!0,strict:!0});Tt({createInternalComparator:()=>Yt});Tt({strict:!0,createInternalComparator:()=>Yt});Tt({circular:!0,createInternalComparator:()=>Yt});Tt({circular:!0,createInternalComparator:()=>Yt,strict:!0});function Tt(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,o=om(n),i=sm(o),l=t?t(i):im(i);return lm({circular:e,comparator:i,createState:r,equals:l,strict:s})}Ch({title:uo().min(1),description:uo().nullable(),body:uo()});function po(n){for(const e of n.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function cm(){const n=window.location.pathname.split("/").filter(Boolean),e=n.findIndex(r=>r==="mcps"),t=e>=0?n[e+1]:void 0;return t?decodeURIComponent(t):void 0}function dm(n){const e=I.c(13),{form:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=r):r=e[0];let s;e[1]!==t.control?(s=m.jsxs("div",{className:"flex flex-col gap-4",children:[r,m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[m.jsx(fo,{control:t.control,name:"title",render:hm}),m.jsx(fo,{control:t.control,name:"description",render:fm})]})]}),e[1]=t.control,e[2]=s):s=e[2];let o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),i=m.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=o,e[4]=i):(o=e[3],i=e[4]);let l;e[5]!==t.control?(l=m.jsxs("div",{className:"flex flex-col gap-2",children:[o,i,m.jsx(fo,{control:t.control,name:"body",render:um})]}),e[5]=t.control,e[6]=l):l=e[6];let a;e[7]!==s||e[8]!==l?(a=m.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:[s,l]}),e[7]=s,e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==a?(c=m.jsx(qh,{...t,children:a}),e[10]=t,e[11]=a,e[12]=c):c=e[12],c}function um(n){const{field:e}=n;return m.jsx($i,{children:m.jsx(_i,{children:m.jsx(Uo,{...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 fm(n){const{field:e}=n;return m.jsxs($i,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(_i,{children:m.jsx(Li,{...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 hm(n){const{field:e}=n;return m.jsxs($i,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx(_i,{children:m.jsx(Li,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function pm(n){const e=I.c(51),{providerId:t,promptId:r,onBack:s}=n,i=Ti().location.href,l=t||qt;let a;e[0]!==l?(a=Ue(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=Ri(t,"PROMPT",r,c),u=ji(t,"PROMPT",c),f=u.update.isPending;let h;e[2]!==d?(h=d?{title:d.title,description:d.description??null,body:po(d)}:void 0,e[2]=d,e[3]=h):h=e[3];let p;e[4]!==h?(p={values:h},e[4]=h,e[5]=p):p=e[5];const g=Nh(p);let y;e[6]!==g||e[7]!==d?(y=()=>{d&&g.reset({title:d.title,description:d.description??null,body:po(d)})},e[6]=g,e[7]=d,e[8]=y):y=e[8];const x=y;let b;e[9]!==u.update||e[10]!==g||e[11]!==r?(b=g.handleSubmit(async X=>{const fe=await u.update.mutateAsync({id:r,data:{title:X.title,description:X.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:X.body}}]}});g.reset({title:fe.title,description:fe.description??null,body:po(fe)})}),e[9]=u.update,e[10]=g,e[11]=r,e[12]=b):b=e[12];const k=b;if(!d){let X;return e[13]===Symbol.for("react.memo_cache_sentinel")?(X=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(_c,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[13]=X):X=e[13],X}let C;e[14]!==d.title?(C=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:d.title}),e[14]=d.title,e[15]=C):C=e[15];let S;e[16]!==d.description?(S=d.description?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:d.description})]}):null,e[16]=d.description,e[17]=S):S=e[17];let w;e[18]!==C||e[19]!==S?(w=m.jsx(Fc,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,S]})}),e[18]=C,e[19]=S,e[20]=w):w=e[20];let v;e[21]!==d.title||e[22]!==i?(v=m.jsx(Pi,{title:d.title,url:i,icon:"description"}),e[21]=d.title,e[22]=i,e[23]=v):v=e[23];const T=!g.formState.isDirty||f;let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=m.jsx(Bc,{size:14}),e[24]=O):O=e[24];let D;e[25]!==x||e[26]!==T?(D=m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:x,"aria-label":"Cancel",children:O})})}),e[25]=x,e[26]=T,e[27]=D):D=e[27];let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=m.jsx($t,{side:"bottom",children:"Cancel"}),e[28]=j):j=e[28];let z;e[29]!==D?(z=m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[D,j]})}),e[29]=D,e[30]=z):z=e[30];const V=!g.formState.isDirty||f;let B;e[31]!==k?(B=()=>{k()},e[31]=k,e[32]=B):B=e[32];let H;e[33]===Symbol.for("react.memo_cache_sentinel")?(H=m.jsx(Xi,{size:14}),e[33]=H):H=e[33];let N;e[34]!==V||e[35]!==B?(N=m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:V,onClick:B,"aria-label":"Save",children:H})})}),e[34]=V,e[35]=B,e[36]=N):N=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=m.jsx($t,{side:"bottom",children:"Save"}),e[37]=_):_=e[37];let P;e[38]!==N?(P=m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[N,_]})}),e[38]=N,e[39]=P):P=e[39];let U;e[40]!==v||e[41]!==z||e[42]!==P?(U=m.jsxs(Bi,{children:[v,z,P]}),e[40]=v,e[41]=z,e[42]=P,e[43]=U):U=e[43];let Q;e[44]!==g?(Q=m.jsx("div",{className:"h-full",children:m.jsx(dm,{form:g})}),e[44]=g,e[45]=Q):Q=e[45];let le;return e[46]!==s||e[47]!==U||e[48]!==Q||e[49]!==w?(le=m.jsxs(Sn,{onBack:s,children:[w,U,Q]}),e[46]=s,e[47]=U,e[48]=Q,e[49]=w,e[50]=le):le=e[50],le}function mm(n){const e=I.c(5),{itemId:t,onBack:r}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=cm()??qt,e[0]=s):s=e[0];const o=s;if(!o||o===qt){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(_c,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let i;return e[2]!==t||e[3]!==r?(i=m.jsx(zc,{children:m.jsx(M.Suspense,{fallback:null,children:m.jsx(pm,{providerId:o,promptId:t,onBack:r})})}),e[2]=t,e[3]=r,e[4]=i):i=e[4],i}const gm=Eh("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 ym(n){const e=I.c(10);let t,r,s;e[0]!==n?({className:t,variant:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==t||e[5]!==s?(o=J(gm({variant:s}),t),e[4]=t,e[5]=s,e[6]=o):o=e[6];let i;return e[7]!==r||e[8]!==o?(i=m.jsx("div",{"data-slot":"alert",role:"alert",className:o,...r}),e[7]=r,e[8]=o,e[9]=i):i=e[9],i}function xm(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function bm(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}const km=n=>n.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Sm(n){const e=I.c(13),{toolName:t,connectionId:r,onBack:s}=n,o=`/mcp/${r}`;let i;e[0]!==o?(i=new URL(o,window.location.origin),e[0]=o,e[1]=i):i=e[1];const l=i;let a;e[2]!==r?(a={connectionId:r},e[2]=r,e[3]=a):a=e[3];const c=Yh(a);if(!c.isAuthenticated){let f;return e[4]!==c.supportsOAuth||e[5]!==s?(f=m.jsx("div",{className:"flex h-full items-center justify-center",children:c.supportsOAuth?m.jsx(Qh,{onAuthenticate:()=>s(),buttonText:"Go back to authenticate"}):m.jsx(Zh,{hasReadme:!1})}),e[4]=c.supportsOAuth,e[5]=s,e[6]=f):f=e[6],f}const d=`${r}:${t}`;let u;return e[7]!==r||e[8]!==l||e[9]!==s||e[10]!==d||e[11]!==t?(u=m.jsx(wm,{toolName:t,connectionId:r,mcpProxyUrl:l,onBack:s},d),e[7]=r,e[8]=l,e[9]=s,e[10]=d,e[11]=t,e[12]=u):u=e[12],u}function wm({toolName:n,connectionId:e,mcpProxyUrl:t,onBack:r}){const o=Ti().location.href,{replayId:i}=Th({strict:!1}),l=(()=>{if(!i)return null;const N=`replay-${i}`,_=sessionStorage.getItem(N);if(!_)return null;sessionStorage.removeItem(N);try{return JSON.parse(_)}catch{return null}})(),a=(()=>{if(!l)return null;const N={};for(const[_,P]of Object.entries(l))P!==null&&typeof P=="object"?N[_]=JSON.stringify(P,null,2):N[_]=P;return N})(),[c,d]=M.useState(a??{}),[u,f]=M.useState(l?JSON.stringify(l,null,2):"{}"),[h,p]=M.useState(null),[g,y]=M.useState(null),[x,b]=M.useState(!1),[k,C]=M.useState(null),S=Di(e),w=Hi({url:t.href});M.useEffect(()=>{w.error&&console.error("MCP Error:",w.error)},[w.error]);const v=w.tools?.find(N=>N.name===n),T=v?.inputSchema?.properties,O=T?Object.keys(T):[],D=O.length>0,j={};if(D&&v?.inputSchema?.properties)for(const N of O)j[N]=v.inputSchema.required?.includes(N)?"":void 0;const z=N=>Object.prototype.hasOwnProperty.call(c,N),V=async()=>{b(!0),y(null),p(null),C(null);const N=performance.now(),_=Ue(e);try{const P=D?{...j,...c}:(()=>{const se=u.trim();if(!se)return{};const K=JSON.parse(se);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();D&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([se,K])=>{if((K.type==="object"||K.type==="array")&&typeof P[se]=="string")try{P[se]=JSON.parse(P[se])}catch{}});const U=await _(n,P),Q=performance.now(),le=Math.round(Q-N);p(U);const X=JSON.stringify(U),fe=new TextEncoder().encode(X).length;C({duration:`${le}ms`,bytes:`${fe} bytes`,tokens:`~${Math.ceil(fe/4)} tokens`,cost:"$0.0000"})}catch(P){const U=P instanceof Error?P.message:String(P);y(U||"Unknown error occurred");const Q=performance.now();C({duration:`${Math.round(Q-N)}ms`})}finally{b(!1)}},B=(N,_)=>{d(P=>({...P,[N]:_}))},H=()=>{p(null),y(null),C(null)};return m.jsxs(Sn,{onBack:r,children:[m.jsx(Bi,{children:m.jsx(Pi,{title:v?.name??km(n),url:o,icon:"build"})}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[m.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:m.jsxs("div",{className:"flex-1 overflow-auto",children:[m.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Ps,{icon:S?.icon||null,name:S?.title||n,size:"sm",className:"shadow-sm shrink-0"}),m.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:n}),m.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.state==="ready"?m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.state==="connecting"?m.jsx(nr,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),m.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.state.replace("_"," ")})]})]}),m.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.description||"No description available"})]})}),m.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),m.jsx("div",{className:"space-y-4",children:D&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([N,_])=>m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[N,v.inputSchema?.required?.includes(N)&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),m.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:_.type})]}),_.description&&m.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:_.description}),_.type==="object"||_.type==="array"?m.jsx(Uo,{className:"font-mono text-xs",value:z(N)?c[N]??"":j[N]??"",onChange:P=>B(N,P.target.value),placeholder:`Enter ${N} as JSON...`,rows:3}):m.jsx(Li,{value:z(N)?c[N]??"":j[N]??"",onChange:P=>B(N,P.target.value),placeholder:`Enter ${N}...`})]},N)):v?.inputSchema&&!D?m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),m.jsx(Uo,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:N=>f(N.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):m.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.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:[m.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),k&&m.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Kh,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.duration})]}),k.tokens&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Yc,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.tokens})]}),k.bytes&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(td,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.bytes})]}),k.cost&&m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"font-mono text-foreground",children:k.cost})})]})]}),m.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:m.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[m.jsx(me,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:V,disabled:x,children:x?m.jsxs(m.Fragment,{children:[m.jsx(nr,{size:14,className:"animate-spin"}),"Executing..."]}):m.jsxs(m.Fragment,{children:[m.jsx(Fi,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),m.jsx(_t,{children:m.jsxs(zt,{children:[m.jsx(Lt,{asChild:!0,children:m.jsx(me,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:H,disabled:!h&&!g,children:m.jsx(Vi,{size:14})})}),m.jsx($t,{children:m.jsx("p",{children:"Clear results"})})]})})]})}),g&&m.jsx("div",{className:"px-6 py-4 bg-background",children:m.jsx(ym,{variant:"destructive",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Uh,{className:"h-4 w-4"}),m.jsx(xm,{className:"mb-0",children:"Execution Failed"})]}),m.jsx(bm,{className:"text-xs text-destructive",children:g})]})})}),m.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:h?m.jsxs(m.Fragment,{children:[m.jsx(In,{code:JSON.stringify(h,null,2),language:"json",height:"100%",readOnly:!0}),m.jsx(me,{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(h,null,2)),jc.success("Copied to clipboard")},children:m.jsx(Xh,{className:"h-3.5 w-3.5"})})]}):m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[m.jsx(Jh,{className:"h-12 w-12 mb-3 opacity-40"}),m.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function vm(n){const e=I.c(7),{itemId:t,onBack:r}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const i=Et(s).connectionId??qt;if(!Di(i)){let d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[m.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=d):d=e[1],d}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(nr,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let c;return e[3]!==i||e[4]!==r||e[5]!==t?(c=m.jsx(M.Suspense,{fallback:a,children:m.jsx(Sm,{toolName:t,connectionId:i,onBack:r})}),e[3]=i,e[4]=r,e[5]=t,e[6]=c):c=e[6],c}const ea=n=>{let e;const t=new Set,r=(c,d)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const f=e;e=d??(typeof u!="object"||u===null)?u:Object.assign({},e,u),t.forEach(h=>h(e,f))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>a,subscribe:c=>(t.add(c),()=>t.delete(c))},a=e=n(r,s,l);return l},Yi=(n=>n?ea(n):ea),Cm=n=>n;function Ko(n,e=Cm){const t=ee.useSyncExternalStore(n.subscribe,ee.useCallback(()=>e(n.getState()),[n,e]),ee.useCallback(()=>e(n.getInitialState()),[n,e]));return ee.useDebugValue(t),t}const Nm=n=>{const e=Yi(n),t=r=>Ko(e,r);return Object.assign(t,e),t},Em=(n=>Nm);function od(n,e){let t;try{t=n()}catch{return}return{getItem:s=>{var o;const i=a=>a===null?null:JSON.parse(a,void 0),l=(o=t.getItem(s))!=null?o:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,o)=>t.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>t.removeItem(s)}}const Jo=n=>e=>{try{const t=n(e);return t instanceof Promise?t:{then(r){return Jo(r)(t)},catch(r){return this}}}catch(t){return{then(r){return this},catch(r){return Jo(r)(t)}}}},Tm=(n,e)=>(t,r,s)=>{let o={storage:od(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...e},i=!1;const l=new Set,a=new Set;let c=o.storage;if(!c)return n((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(...g)},r,s);const d=()=>{const g=o.partialize({...r()});return c.setItem(o.name,{state:g,version:o.version})},u=s.setState;s.setState=(g,y)=>(u(g,y),d());const f=n((...g)=>(t(...g),d()),r,s);s.getInitialState=()=>f;let h;const p=()=>{var g,y;if(!c)return;i=!1,l.forEach(b=>{var k;return b((k=r())!=null?k:f)});const x=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(g=r())!=null?g:f))||void 0;return Jo(c.getItem.bind(c))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate){const k=o.migrate(b.state,b.version);return k instanceof Promise?k.then(C=>[!0,C]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var k;const[C,S]=b;if(h=o.merge(S,(k=r())!=null?k:f),t(h,!0),C)return d()}).then(()=>{x?.(h,void 0),h=r(),i=!0,a.forEach(b=>b(h))}).catch(b=>{x?.(void 0,b)})};return s.persist={setOptions:g=>{o={...o,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>i,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(a.add(g),()=>{a.delete(g)})},o.skipHydration||p(),h||f},id=Tm,{useSyncExternalStoreWithSelector:Mm}=Mh,Am=n=>n;function Om(n,e=Am,t){const r=Mm(n.subscribe,n.getState,n.getInitialState,e,t);return ee.useDebugValue(r),r}const ta=n=>Symbol.iterator in n,na=n=>"entries"in n,ra=(n,e)=>{const t=n instanceof Map?n:new Map(n.entries()),r=e instanceof Map?e:new Map(e.entries());if(t.size!==r.size)return!1;for(const[s,o]of t)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0},Im=(n,e)=>{const t=n[Symbol.iterator](),r=e[Symbol.iterator]();let s=t.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=t.next(),o=r.next()}return!!s.done&&!!o.done};function Rm(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e)?!1:ta(n)&&ta(e)?na(n)&&na(e)?ra(n,e):Im(n,e):ra({entries:()=>Object.entries(n)},{entries:()=>Object.entries(e)})}function jm(n,e="Output"){if(!n)return`interface ${e} {}`;function t(o){if(!o||typeof o!="object")return"unknown";const i=o.type;if(Array.isArray(i))return i.map(l=>r(l)).join(" | ");switch(i){case"string":return o.enum?o.enum.map(l=>`"${l}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const l=o.items;return l?`${t(l)}[]`:"unknown[]"}case"object":return s(o);default:return o.anyOf?o.anyOf.map(t).join(" | "):o.oneOf?o.oneOf.map(t).join(" | "):o.allOf?o.allOf.map(t).join(" & "):"unknown"}}function r(o){switch(o){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function s(o){const i=o.properties;if(!i)return"Record<string, unknown>";const l=new Set(o.required||[]);return`{
1
+ import{aH as qe,r as M,s as Ch,v as uo,c as I,j as m,i as Ti,x as Nh,f as Eh,d as Et,b as Th,t as jc,z as ee,y as Mh,aI as Dc,a8 as Ah,a7 as Oh,aJ as Ih,ae as Mi,at as Pc,aw as Rh,af as On,ah as Ve,ag as Ai,ax as jh,ak as Ds,au as Dh,ac as Oi,aD as Ph,aE as Lh,aF as $h,aK as Ii,aL as _h,av as Lc,aj as zh,aM as Bh,ad as Fh,aN as Vh,aG as $c}from"./index-DsWTyaMI.js";import{U as qt,E as _c,e as Ri,f as ji,c as Ue,d as Di,I as Ps,u as Hh,n as Wh}from"./use-connection-BRzCmTOd.js";import{E as zc}from"./error-boundary-NRHN5Y9-.js";import{P as Pi}from"./pin-to-sidebar-button-B_8L8Vb0.js";import{B as me,I as Li,c as J}from"./input-Bjw47IqN.js";import{F as fo,a as qh,b as $i,d as _i}from"./form-BYRg0fLZ.js";import{T as Uo}from"./textarea-Ct5hMebK.js";import{b as Lt,T as $t,a as _t,c as zt,i as zi}from"./project-context-provider-4_jnbmhf.js";import{i as Bc}from"./FlipBackward-Cuwh5H4e.js";import{a as Fc,V as Bi,b as Sn}from"./layout-CSrwjVH6.js";import{i as Uh}from"./AlertCircle-DAyHhLS6.js";import{s as Kh,M as In}from"./monaco-editor-CiWfYNhn.js";import{i as Fi,a as Jh,n as Gh}from"./Play-DqaoplmY.js";import{a as Xh}from"./Copy01-BrkhNqAw.js";import{i as nr}from"./Loading01-BqUL1Os2.js";import{s as Vi}from"./XClose-Bfbqr-bg.js";import{u as Yh,O as Qh,M as Zh,F as ep,v as tp}from"./index-DJlsJ8uo.js";import{u as Hi}from"./use-mcp-Xq1C6Xb8.js";import{E as Wi}from"./empty-state-Ctkb5o27.js";import{D as np,u as rp}from"./use-binding-CocjKJdo.js";import{u as sp}from"./use-gateway-LBTVY8TW.js";import{b as op,R as Kl,a as ip}from"./resizable-BQxIvKty.js";import{G as lp}from"./gateway-selector-DAEirbF5.js";import{S as Ls}from"./spinner-DZG16LrV.js";import{V as ap}from"./view-mode-toggle-DlhHZSZ6.js";import{i as cp}from"./GitBranch01-DDKUuZMu.js";import{i as dp}from"./Stop-CRrts02X.js";import{a as qi,b as Ui}from"./use-tool-call-DWmlWS7M.js";import{D as up,a as fp,b as hp,f as pp,c as mp,d as gp}from"./dialog-dVO4tnyX.js";import"./index-CiFNe-N2.js";import{s as Vc}from"./Plus-CJASgavw.js";import{i as yp}from"./DotsHorizontal-Bv4IcguS.js";import{b as xp,D as bp,a as kp,c as Jl}from"./dropdown-menu-Dl6PURsy.js";import{i as Sp}from"./ChevronRight-Boh94iyZ.js";import{B as un}from"./badge-BRpJ4D36.js";import{i as Hc}from"./X-D4fwyn55.js";import"./use-organization-settings-D21MRe-D.js";import"./ArrowLeft-Bpp_SsGd.js";import"./mcp-oauth-CYe4lbkF.js";import"./auth-m66JRmI1.js";import"./env-vars-editor-BH1jNoL-.js";import"./Trash01-C3O36hTP.js";import"./File06-l4-3IHqa.js";import"./Key01-CcMWzP51.js";import"./select-D0sx2072.js";import"./ChevronDown-CsOv8W2I.js";import"./Terminal-e-eRty6Q.js";import"./useQueries-BLLM0cVq.js";import"./constants-DgMd8oVj.js";import"./registry-utils-B7t_ZBUi.js";import"./extract-connection-data-BaLXzQ_k.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./useQuery-BXYZ1U8o.js";import"./use-mobile-b2I183jd.js";const Wc=qe("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 qc=qe("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 Ki=qe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Ji=qe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const wp=qe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const vp=qe("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 Uc=qe("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 Kc=qe("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 Jc=qe("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 Gc=qe("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 Xc=qe("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"}]]),Gi=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Gi.displayName="AlertOctagon";const Yc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Yc.displayName="Box";const Qc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Qc.displayName="ClockFastForward";const Zc=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Zc.displayName="Code02";const Dr=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Dr.displayName="Columns01";const ed=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));ed.displayName="CornerDownRight";const td=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));td.displayName="Database01";const nd=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));nd.displayName="Repeat03";const Xi=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));Xi.displayName="Save02";const rd=({size:n=24,color:e="currentColor",...t})=>M.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},M.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"}));rd.displayName="Tool01";const{getOwnPropertyNames:Cp,getOwnPropertySymbols:Np}=Object,{hasOwnProperty:Ep}=Object.prototype;function ho(n,e){return function(r,s,o){return n(r,s,o)&&e(r,s,o)}}function Sr(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:o}=s,i=o.get(t),l=o.get(r);if(i&&l)return i===r&&l===t;o.set(t,r),o.set(r,t);const a=n(t,r,s);return o.delete(t),o.delete(r),a}}function Tp(n){return n?.[Symbol.toStringTag]}function Gl(n){return Cp(n).concat(Np(n))}const Mp=Object.hasOwn||((n,e)=>Ep.call(n,e));function Yt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const Ap="__v",Op="__o",Ip="_owner",{getOwnPropertyDescriptor:Xl,keys:Yl}=Object;function Rp(n,e){return n.byteLength===e.byteLength&&Fr(new Uint8Array(n),new Uint8Array(e))}function jp(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function Dp(n,e){return n.byteLength===e.byteLength&&Fr(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Pp(n,e){return Yt(n.getTime(),e.getTime())}function Lp(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function $p(n,e){return n===e}function Ql(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=n.entries();let i,l,a=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let d=!1,u=0;for(;(l=c.next())&&!l.done;){if(s[u]){u++;continue}const f=i.value,h=l.value;if(t.equals(f[0],h[0],a,u,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){d=s[u]=!0;break}u++}if(!d)return!1;a++}return!0}const _p=Yt;function zp(n,e,t){const r=Yl(n);let s=r.length;if(Yl(e).length!==s)return!1;for(;s-- >0;)if(!sd(n,e,t,r[s]))return!1;return!0}function zn(n,e,t){const r=Gl(n);let s=r.length;if(Gl(e).length!==s)return!1;let o,i,l;for(;s-- >0;)if(o=r[s],!sd(n,e,t,o)||(i=Xl(n,o),l=Xl(e,o),(i||l)&&(!i||!l||i.configurable!==l.configurable||i.enumerable!==l.enumerable||i.writable!==l.writable)))return!1;return!0}function Bp(n,e){return Yt(n.valueOf(),e.valueOf())}function Fp(n,e){return n.source===e.source&&n.flags===e.flags}function Zl(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=n.values();let i,l;for(;(i=o.next())&&!i.done;){const a=e.values();let c=!1,d=0;for(;(l=a.next())&&!l.done;){if(!s[d]&&t.equals(i.value,l.value,i.value,l.value,n,e,t)){c=s[d]=!0;break}d++}if(!c)return!1}return!0}function Fr(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function Vp(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function sd(n,e,t,r){return(r===Ip||r===Op||r===Ap)&&(n.$$typeof||e.$$typeof)?!0:Mp(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const Hp="[object ArrayBuffer]",Wp="[object Arguments]",qp="[object Boolean]",Up="[object DataView]",Kp="[object Date]",Jp="[object Error]",Gp="[object Map]",Xp="[object Number]",Yp="[object Object]",Qp="[object RegExp]",Zp="[object Set]",em="[object String]",tm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},nm="[object URL]",rm=Object.prototype.toString;function sm({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,x,b){if(y===x)return!0;if(y==null||x==null)return!1;const k=typeof y;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(y,x,b):k==="function"?o(y,x,b):!1;const C=y.constructor;if(C!==x.constructor)return!1;if(C===Object)return a(y,x,b);if(Array.isArray(y))return e(y,x,b);if(C===Date)return r(y,x,b);if(C===RegExp)return d(y,x,b);if(C===Map)return i(y,x,b);if(C===Set)return u(y,x,b);const S=rm.call(y);if(S===Kp)return r(y,x,b);if(S===Qp)return d(y,x,b);if(S===Gp)return i(y,x,b);if(S===Zp)return u(y,x,b);if(S===Yp)return typeof y.then!="function"&&typeof x.then!="function"&&a(y,x,b);if(S===nm)return h(y,x,b);if(S===Jp)return s(y,x,b);if(S===Wp)return a(y,x,b);if(tm[S])return f(y,x,b);if(S===Hp)return n(y,x,b);if(S===Up)return t(y,x,b);if(S===qp||S===Xp||S===em)return c(y,x,b);if(p){let w=p[S];if(!w){const v=Tp(y);v&&(w=p[v])}if(w)return w(y,x,b)}return!1}}function om({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:Rp,areArraysEqual:t?zn:jp,areDataViewsEqual:Dp,areDatesEqual:Pp,areErrorsEqual:Lp,areFunctionsEqual:$p,areMapsEqual:t?ho(Ql,zn):Ql,areNumbersEqual:_p,areObjectsEqual:t?zn:zp,arePrimitiveWrappersEqual:Bp,areRegExpsEqual:Fp,areSetsEqual:t?ho(Zl,zn):Zl,areTypedArraysEqual:t?ho(Fr,zn):Fr,areUrlsEqual:Vp,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=Sr(r.areArraysEqual),o=Sr(r.areMapsEqual),i=Sr(r.areObjectsEqual),l=Sr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:l})}return r}function im(n){return function(e,t,r,s,o,i,l){return n(e,t,l)}}function lm({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(l,a){const{cache:c=n?new WeakMap:void 0,meta:d}=t();return e(l,a,{cache:c,equals:r,meta:d,strict:s})};if(n)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,o)}}const am=Tt();Tt({strict:!0});Tt({circular:!0});Tt({circular:!0,strict:!0});Tt({createInternalComparator:()=>Yt});Tt({strict:!0,createInternalComparator:()=>Yt});Tt({circular:!0,createInternalComparator:()=>Yt});Tt({circular:!0,createInternalComparator:()=>Yt,strict:!0});function Tt(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,o=om(n),i=sm(o),l=t?t(i):im(i);return lm({circular:e,comparator:i,createState:r,equals:l,strict:s})}Ch({title:uo().min(1),description:uo().nullable(),body:uo()});function po(n){for(const e of n.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function cm(){const n=window.location.pathname.split("/").filter(Boolean),e=n.findIndex(r=>r==="mcps"),t=e>=0?n[e+1]:void 0;return t?decodeURIComponent(t):void 0}function dm(n){const e=I.c(13),{form:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=r):r=e[0];let s;e[1]!==t.control?(s=m.jsxs("div",{className:"flex flex-col gap-4",children:[r,m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[m.jsx(fo,{control:t.control,name:"title",render:hm}),m.jsx(fo,{control:t.control,name:"description",render:fm})]})]}),e[1]=t.control,e[2]=s):s=e[2];let o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),i=m.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=o,e[4]=i):(o=e[3],i=e[4]);let l;e[5]!==t.control?(l=m.jsxs("div",{className:"flex flex-col gap-2",children:[o,i,m.jsx(fo,{control:t.control,name:"body",render:um})]}),e[5]=t.control,e[6]=l):l=e[6];let a;e[7]!==s||e[8]!==l?(a=m.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:[s,l]}),e[7]=s,e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==a?(c=m.jsx(qh,{...t,children:a}),e[10]=t,e[11]=a,e[12]=c):c=e[12],c}function um(n){const{field:e}=n;return m.jsx($i,{children:m.jsx(_i,{children:m.jsx(Uo,{...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 fm(n){const{field:e}=n;return m.jsxs($i,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(_i,{children:m.jsx(Li,{...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 hm(n){const{field:e}=n;return m.jsxs($i,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx(_i,{children:m.jsx(Li,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function pm(n){const e=I.c(51),{providerId:t,promptId:r,onBack:s}=n,i=Ti().location.href,l=t||qt;let a;e[0]!==l?(a=Ue(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=Ri(t,"PROMPT",r,c),u=ji(t,"PROMPT",c),f=u.update.isPending;let h;e[2]!==d?(h=d?{title:d.title,description:d.description??null,body:po(d)}:void 0,e[2]=d,e[3]=h):h=e[3];let p;e[4]!==h?(p={values:h},e[4]=h,e[5]=p):p=e[5];const g=Nh(p);let y;e[6]!==g||e[7]!==d?(y=()=>{d&&g.reset({title:d.title,description:d.description??null,body:po(d)})},e[6]=g,e[7]=d,e[8]=y):y=e[8];const x=y;let b;e[9]!==u.update||e[10]!==g||e[11]!==r?(b=g.handleSubmit(async X=>{const fe=await u.update.mutateAsync({id:r,data:{title:X.title,description:X.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:X.body}}]}});g.reset({title:fe.title,description:fe.description??null,body:po(fe)})}),e[9]=u.update,e[10]=g,e[11]=r,e[12]=b):b=e[12];const k=b;if(!d){let X;return e[13]===Symbol.for("react.memo_cache_sentinel")?(X=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(_c,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[13]=X):X=e[13],X}let C;e[14]!==d.title?(C=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:d.title}),e[14]=d.title,e[15]=C):C=e[15];let S;e[16]!==d.description?(S=d.description?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:d.description})]}):null,e[16]=d.description,e[17]=S):S=e[17];let w;e[18]!==C||e[19]!==S?(w=m.jsx(Fc,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,S]})}),e[18]=C,e[19]=S,e[20]=w):w=e[20];let v;e[21]!==d.title||e[22]!==i?(v=m.jsx(Pi,{title:d.title,url:i,icon:"description"}),e[21]=d.title,e[22]=i,e[23]=v):v=e[23];const T=!g.formState.isDirty||f;let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=m.jsx(Bc,{size:14}),e[24]=O):O=e[24];let D;e[25]!==x||e[26]!==T?(D=m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:x,"aria-label":"Cancel",children:O})})}),e[25]=x,e[26]=T,e[27]=D):D=e[27];let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=m.jsx($t,{side:"bottom",children:"Cancel"}),e[28]=j):j=e[28];let z;e[29]!==D?(z=m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[D,j]})}),e[29]=D,e[30]=z):z=e[30];const V=!g.formState.isDirty||f;let B;e[31]!==k?(B=()=>{k()},e[31]=k,e[32]=B):B=e[32];let H;e[33]===Symbol.for("react.memo_cache_sentinel")?(H=m.jsx(Xi,{size:14}),e[33]=H):H=e[33];let N;e[34]!==V||e[35]!==B?(N=m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:V,onClick:B,"aria-label":"Save",children:H})})}),e[34]=V,e[35]=B,e[36]=N):N=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=m.jsx($t,{side:"bottom",children:"Save"}),e[37]=_):_=e[37];let P;e[38]!==N?(P=m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[N,_]})}),e[38]=N,e[39]=P):P=e[39];let U;e[40]!==v||e[41]!==z||e[42]!==P?(U=m.jsxs(Bi,{children:[v,z,P]}),e[40]=v,e[41]=z,e[42]=P,e[43]=U):U=e[43];let Q;e[44]!==g?(Q=m.jsx("div",{className:"h-full",children:m.jsx(dm,{form:g})}),e[44]=g,e[45]=Q):Q=e[45];let le;return e[46]!==s||e[47]!==U||e[48]!==Q||e[49]!==w?(le=m.jsxs(Sn,{onBack:s,children:[w,U,Q]}),e[46]=s,e[47]=U,e[48]=Q,e[49]=w,e[50]=le):le=e[50],le}function mm(n){const e=I.c(5),{itemId:t,onBack:r}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=cm()??qt,e[0]=s):s=e[0];const o=s;if(!o||o===qt){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(_c,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let i;return e[2]!==t||e[3]!==r?(i=m.jsx(zc,{children:m.jsx(M.Suspense,{fallback:null,children:m.jsx(pm,{providerId:o,promptId:t,onBack:r})})}),e[2]=t,e[3]=r,e[4]=i):i=e[4],i}const gm=Eh("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 ym(n){const e=I.c(10);let t,r,s;e[0]!==n?({className:t,variant:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==t||e[5]!==s?(o=J(gm({variant:s}),t),e[4]=t,e[5]=s,e[6]=o):o=e[6];let i;return e[7]!==r||e[8]!==o?(i=m.jsx("div",{"data-slot":"alert",role:"alert",className:o,...r}),e[7]=r,e[8]=o,e[9]=i):i=e[9],i}function xm(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function bm(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}const km=n=>n.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Sm(n){const e=I.c(13),{toolName:t,connectionId:r,onBack:s}=n,o=`/mcp/${r}`;let i;e[0]!==o?(i=new URL(o,window.location.origin),e[0]=o,e[1]=i):i=e[1];const l=i;let a;e[2]!==r?(a={connectionId:r},e[2]=r,e[3]=a):a=e[3];const c=Yh(a);if(!c.isAuthenticated){let f;return e[4]!==c.supportsOAuth||e[5]!==s?(f=m.jsx("div",{className:"flex h-full items-center justify-center",children:c.supportsOAuth?m.jsx(Qh,{onAuthenticate:()=>s(),buttonText:"Go back to authenticate"}):m.jsx(Zh,{hasReadme:!1})}),e[4]=c.supportsOAuth,e[5]=s,e[6]=f):f=e[6],f}const d=`${r}:${t}`;let u;return e[7]!==r||e[8]!==l||e[9]!==s||e[10]!==d||e[11]!==t?(u=m.jsx(wm,{toolName:t,connectionId:r,mcpProxyUrl:l,onBack:s},d),e[7]=r,e[8]=l,e[9]=s,e[10]=d,e[11]=t,e[12]=u):u=e[12],u}function wm({toolName:n,connectionId:e,mcpProxyUrl:t,onBack:r}){const o=Ti().location.href,{replayId:i}=Th({strict:!1}),l=(()=>{if(!i)return null;const N=`replay-${i}`,_=sessionStorage.getItem(N);if(!_)return null;sessionStorage.removeItem(N);try{return JSON.parse(_)}catch{return null}})(),a=(()=>{if(!l)return null;const N={};for(const[_,P]of Object.entries(l))P!==null&&typeof P=="object"?N[_]=JSON.stringify(P,null,2):N[_]=P;return N})(),[c,d]=M.useState(a??{}),[u,f]=M.useState(l?JSON.stringify(l,null,2):"{}"),[h,p]=M.useState(null),[g,y]=M.useState(null),[x,b]=M.useState(!1),[k,C]=M.useState(null),S=Di(e),w=Hi({url:t.href});M.useEffect(()=>{w.error&&console.error("MCP Error:",w.error)},[w.error]);const v=w.tools?.find(N=>N.name===n),T=v?.inputSchema?.properties,O=T?Object.keys(T):[],D=O.length>0,j={};if(D&&v?.inputSchema?.properties)for(const N of O)j[N]=v.inputSchema.required?.includes(N)?"":void 0;const z=N=>Object.prototype.hasOwnProperty.call(c,N),V=async()=>{b(!0),y(null),p(null),C(null);const N=performance.now(),_=Ue(e);try{const P=D?{...j,...c}:(()=>{const se=u.trim();if(!se)return{};const K=JSON.parse(se);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();D&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([se,K])=>{if((K.type==="object"||K.type==="array")&&typeof P[se]=="string")try{P[se]=JSON.parse(P[se])}catch{}});const U=await _(n,P),Q=performance.now(),le=Math.round(Q-N);p(U);const X=JSON.stringify(U),fe=new TextEncoder().encode(X).length;C({duration:`${le}ms`,bytes:`${fe} bytes`,tokens:`~${Math.ceil(fe/4)} tokens`,cost:"$0.0000"})}catch(P){const U=P instanceof Error?P.message:String(P);y(U||"Unknown error occurred");const Q=performance.now();C({duration:`${Math.round(Q-N)}ms`})}finally{b(!1)}},B=(N,_)=>{d(P=>({...P,[N]:_}))},H=()=>{p(null),y(null),C(null)};return m.jsxs(Sn,{onBack:r,children:[m.jsx(Bi,{children:m.jsx(Pi,{title:v?.name??km(n),url:o,icon:"build"})}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[m.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:m.jsxs("div",{className:"flex-1 overflow-auto",children:[m.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Ps,{icon:S?.icon||null,name:S?.title||n,size:"sm",className:"shadow-sm shrink-0"}),m.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:n}),m.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.state==="ready"?m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.state==="connecting"?m.jsx(nr,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),m.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.state.replace("_"," ")})]})]}),m.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.description||"No description available"})]})}),m.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),m.jsx("div",{className:"space-y-4",children:D&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([N,_])=>m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[N,v.inputSchema?.required?.includes(N)&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),m.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:_.type})]}),_.description&&m.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:_.description}),_.type==="object"||_.type==="array"?m.jsx(Uo,{className:"font-mono text-xs",value:z(N)?c[N]??"":j[N]??"",onChange:P=>B(N,P.target.value),placeholder:`Enter ${N} as JSON...`,rows:3}):m.jsx(Li,{value:z(N)?c[N]??"":j[N]??"",onChange:P=>B(N,P.target.value),placeholder:`Enter ${N}...`})]},N)):v?.inputSchema&&!D?m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),m.jsx(Uo,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:N=>f(N.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):m.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.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:[m.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),k&&m.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Kh,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.duration})]}),k.tokens&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Yc,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.tokens})]}),k.bytes&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(td,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.bytes})]}),k.cost&&m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"font-mono text-foreground",children:k.cost})})]})]}),m.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:m.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[m.jsx(me,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:V,disabled:x,children:x?m.jsxs(m.Fragment,{children:[m.jsx(nr,{size:14,className:"animate-spin"}),"Executing..."]}):m.jsxs(m.Fragment,{children:[m.jsx(Fi,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),m.jsx(_t,{children:m.jsxs(zt,{children:[m.jsx(Lt,{asChild:!0,children:m.jsx(me,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:H,disabled:!h&&!g,children:m.jsx(Vi,{size:14})})}),m.jsx($t,{children:m.jsx("p",{children:"Clear results"})})]})})]})}),g&&m.jsx("div",{className:"px-6 py-4 bg-background",children:m.jsx(ym,{variant:"destructive",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Uh,{className:"h-4 w-4"}),m.jsx(xm,{className:"mb-0",children:"Execution Failed"})]}),m.jsx(bm,{className:"text-xs text-destructive",children:g})]})})}),m.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:h?m.jsxs(m.Fragment,{children:[m.jsx(In,{code:JSON.stringify(h,null,2),language:"json",height:"100%",readOnly:!0}),m.jsx(me,{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(h,null,2)),jc.success("Copied to clipboard")},children:m.jsx(Xh,{className:"h-3.5 w-3.5"})})]}):m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[m.jsx(Jh,{className:"h-12 w-12 mb-3 opacity-40"}),m.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function vm(n){const e=I.c(7),{itemId:t,onBack:r}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const i=Et(s).connectionId??qt;if(!Di(i)){let d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[m.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=d):d=e[1],d}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(nr,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let c;return e[3]!==i||e[4]!==r||e[5]!==t?(c=m.jsx(M.Suspense,{fallback:a,children:m.jsx(Sm,{toolName:t,connectionId:i,onBack:r})}),e[3]=i,e[4]=r,e[5]=t,e[6]=c):c=e[6],c}const ea=n=>{let e;const t=new Set,r=(c,d)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const f=e;e=d??(typeof u!="object"||u===null)?u:Object.assign({},e,u),t.forEach(h=>h(e,f))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>a,subscribe:c=>(t.add(c),()=>t.delete(c))},a=e=n(r,s,l);return l},Yi=(n=>n?ea(n):ea),Cm=n=>n;function Ko(n,e=Cm){const t=ee.useSyncExternalStore(n.subscribe,ee.useCallback(()=>e(n.getState()),[n,e]),ee.useCallback(()=>e(n.getInitialState()),[n,e]));return ee.useDebugValue(t),t}const Nm=n=>{const e=Yi(n),t=r=>Ko(e,r);return Object.assign(t,e),t},Em=(n=>Nm);function od(n,e){let t;try{t=n()}catch{return}return{getItem:s=>{var o;const i=a=>a===null?null:JSON.parse(a,void 0),l=(o=t.getItem(s))!=null?o:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,o)=>t.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>t.removeItem(s)}}const Jo=n=>e=>{try{const t=n(e);return t instanceof Promise?t:{then(r){return Jo(r)(t)},catch(r){return this}}}catch(t){return{then(r){return this},catch(r){return Jo(r)(t)}}}},Tm=(n,e)=>(t,r,s)=>{let o={storage:od(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...e},i=!1;const l=new Set,a=new Set;let c=o.storage;if(!c)return n((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(...g)},r,s);const d=()=>{const g=o.partialize({...r()});return c.setItem(o.name,{state:g,version:o.version})},u=s.setState;s.setState=(g,y)=>(u(g,y),d());const f=n((...g)=>(t(...g),d()),r,s);s.getInitialState=()=>f;let h;const p=()=>{var g,y;if(!c)return;i=!1,l.forEach(b=>{var k;return b((k=r())!=null?k:f)});const x=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(g=r())!=null?g:f))||void 0;return Jo(c.getItem.bind(c))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate){const k=o.migrate(b.state,b.version);return k instanceof Promise?k.then(C=>[!0,C]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var k;const[C,S]=b;if(h=o.merge(S,(k=r())!=null?k:f),t(h,!0),C)return d()}).then(()=>{x?.(h,void 0),h=r(),i=!0,a.forEach(b=>b(h))}).catch(b=>{x?.(void 0,b)})};return s.persist={setOptions:g=>{o={...o,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>i,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(a.add(g),()=>{a.delete(g)})},o.skipHydration||p(),h||f},id=Tm,{useSyncExternalStoreWithSelector:Mm}=Mh,Am=n=>n;function Om(n,e=Am,t){const r=Mm(n.subscribe,n.getState,n.getInitialState,e,t);return ee.useDebugValue(r),r}const ta=n=>Symbol.iterator in n,na=n=>"entries"in n,ra=(n,e)=>{const t=n instanceof Map?n:new Map(n.entries()),r=e instanceof Map?e:new Map(e.entries());if(t.size!==r.size)return!1;for(const[s,o]of t)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0},Im=(n,e)=>{const t=n[Symbol.iterator](),r=e[Symbol.iterator]();let s=t.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=t.next(),o=r.next()}return!!s.done&&!!o.done};function Rm(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e)?!1:ta(n)&&ta(e)?na(n)&&na(e)?ra(n,e):Im(n,e):ra({entries:()=>Object.entries(n)},{entries:()=>Object.entries(e)})}function jm(n,e="Output"){if(!n)return`interface ${e} {}`;function t(o){if(!o||typeof o!="object")return"unknown";const i=o.type;if(Array.isArray(i))return i.map(l=>r(l)).join(" | ");switch(i){case"string":return o.enum?o.enum.map(l=>`"${l}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const l=o.items;return l?`${t(l)}[]`:"unknown[]"}case"object":return s(o);default:return o.anyOf?o.anyOf.map(t).join(" | "):o.oneOf?o.oneOf.map(t).join(" | "):o.allOf?o.allOf.map(t).join(" & "):"unknown"}}function r(o){switch(o){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function s(o){const i=o.properties;if(!i)return"Record<string, unknown>";const l=new Set(o.required||[]);return`{
2
2
  ${Object.entries(i).map(([c,d])=>{const u=l.has(c)?"":"?";return`${d.description?` /** ${d.description} */
3
3
  `:""} ${c}${u}: ${t(d)};`}).join(`
4
4
  `)}
@@ -143,7 +143,7 @@ ${h.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
143
143
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(`
144
144
  `),[o,i]=Ek(s);if(o.length===0)return;const l=Vf(o,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,i).join(`
145
145
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Mk,this.editor.getAttributes(Nc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=An({find:Ec,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=An({find:Ec,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Ak=/^\s*(\[([( |x])?\])\s$/,Ok=Ie.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ne(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return El(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};c(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{s.setAttribute(u,f)}),s.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(e).forEach(([u,f])=>{s.setAttribute(u,f)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:u=>{if(u.type!==this.type)return!1;s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u);const f=r.extensionManager.attributes,h=Tn(u,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(y=>{p.has(y)||(y in g?s.setAttribute(y,g[y]):s.removeAttribute(y))}),Object.entries(h).forEach(([y,x])=>{x==null?y in g?s.setAttribute(y,g[y]):s.removeAttribute(y):s.setAttribute(y,x)}),d=p,!0}}}},addInputRules(){return[An({find:Ak,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Ik=Ie.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ne(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
146
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=pi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=pi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ce.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Df.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Pf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Ff.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Hf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Ok.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Ik.configure(this.options.taskList)),n}});var Rk=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ne(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),jk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Dk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pk=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ne(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Mn({find:jk,type:this.type})]},addPasteRules(){return[Xt({find:Dk,type:this.type})]}}),Lk=Ie.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),$k=Zt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ne(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function _k(n={}){return new re({view(e){return new zk(e,n)}})}class zk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=u?p.bottom:p.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!o){let i=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=zd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ie extends q{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ie.valid(r)?new ie(r):q.near(r)}content(){return R.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(t.pos))}getBookmark(){return new $l(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Bk(e)||!Fk(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(t>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(t>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=t;let a=e.doc.resolve(s);if(ie.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!$.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*t),r=!1;continue e}break}o=i,s+=t;let l=e.doc.resolve(s);if(ie.valid(l))return l}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;q.jsonID("gapcursor",ie);class $l{constructor(e){this.pos=e}map(e){return new $l(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ie.valid(t)?new ie(t):q.near(t)}}function Wf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Bk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Wf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Fk(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Wf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Vk(){return new re({props:{decorations:Uk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ie.valid(t)?new ie(t):null},handleClick:Wk,handleKeyDown:Hk,handleDOMEvents:{beforeinput:qk}}})}const Hk=Bu({ArrowLeft:jr("horiz",-1),ArrowRight:jr("horiz",1),ArrowUp:jr("vert",-1),ArrowDown:jr("vert",1)});function jr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof F){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ie.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new ie(c))),!0):!1}}function Wk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&$.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ie(r))),!0)}function qk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ie))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=E.empty;for(let i=r.length-1;i>=0;i--)s=E.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new R(s,0,0));return o.setSelection(F.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Uk(n){if(!(n.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",te.create(n.doc,[ve.widget(n.selection.head,e,{key:"gapcursor"})])}var Os=200,ye=function(){};ye.prototype.append=function(e){return e.length?(e=ye.from(e),!this.length&&e||e.length<Os&&this.leafAppend(e)||this.length<Os&&e.leafPrepend(this)||this.appendInner(e)):this};ye.prototype.prepend=function(e){return e.length?ye.from(e).append(this):this};ye.prototype.appendInner=function(e){return new Kk(this,e)};ye.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ye.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ye.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},t,r),s};ye.from=function(e){return e instanceof ye?e:e&&e.length?new qf(e):ye.empty};var qf=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Os)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Os)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ye);ye.empty=new qf([]);var Kk=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ye);const Jk=500;class He{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;t&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,d.push(u);return}if(s){d.push(new dt(u.map));let h=u.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+d.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(u.step);if(u.selection)return l=s?u.selection.map(s.slice(o)):u.selection,a=new He(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new dt(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(i++,t=void 0),s||(a=f)}let c=i-r.depth;return c>Xk&&(l=Gk(l,c),i-=c),new He(l.append(o),i)}remapping(e,t){let r=new or;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,t),r}addMaps(e){return this.eventCount==0?this:new He(this.items.append(e.map(t=>new dt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new dt(p,g,y))}else r.push(new dt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new dt(o.maps[f]));let d=this.items.slice(0,s).append(c).append(r),u=new He(d,l);return u.emptyItemCount()>Jk&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=i.selection&&i.selection.map(t.slice(r));d&&o++;let u=new dt(c.invert(),a,d),f,h=s.length-1;(f=s.length&&s[h].merge(u))?s[h]=f:s.push(u)}}else i.map&&r--},this.items.length,0),new He(ye.from(s.reverse()),o)}}He.empty=new He(ye.empty,0);function Gk(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}let dt=class Uf{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Uf(t.getMap().invert(),t,this.selection)}}};class pt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const Xk=20;function Yk(n,e,t,r){let s=t.getMeta(Wt),o;if(s)return s.historyState;t.getMeta(eS)&&(n=new pt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(Wt))return i.getMeta(Wt).redo?new pt(n.done.addTransform(t,void 0,r,zr(e)),n.undone,Tc(t.mapping.maps),n.prevTime,n.prevComposition):new pt(n.done,n.undone.addTransform(t,void 0,r,zr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Qk(t,n.prevRanges)),c=i?Fo(n.prevRanges,t.mapping):Tc(t.mapping.maps);return new pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,zr(e)),He.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new pt(n.done.rebased(t,o),n.undone.rebased(t,o),Fo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Fo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Qk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(t=!0)}),t}function Tc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,o,i)=>e.push(o,i));return e}function Fo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),o=e.map(n[r+1],-1);s<=o&&t.push(s,o)}return t}function Zk(n,e,t){let r=zr(e),s=Wt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new pt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(Wt,{redo:t,historyState:a})}let Vo=!1,Mc=null;function zr(n){let e=n.plugins;if(Mc!=e){Vo=!1,Mc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Vo=!0;break}}return Vo}const Wt=new ae("history"),eS=new ae("closeHistory");function tS(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new re({key:Wt,state:{init(){return new pt(He.empty,He.empty,null,0,-1)},apply(e,t,r){return Yk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Jf:r=="historyRedo"?Gf:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Kf(n,e){return(t,r)=>{let s=Wt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=Zk(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Jf=Kf(!1,!0),Gf=Kf(!0,!0);ce.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new re({key:new ae("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var nS=ce.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_k(this.options)]}});ce.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new re({key:new ae("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return te.create(n,[]);let i=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(ve.node(c,c+a.nodeSize,{class:this.options.className}))}),te.create(n,o)}}})]}});var rS=ce.create({name:"gapCursor",addProseMirrorPlugins(){return[Vk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(L(n,"allowGapCursor",t)))!=null?e:null}}});ce.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new re({key:new ae("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&Js(i);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const u=ve.node(l,l+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(u)}return this.options.includeChildren}),te.create(n,s)}}})]}});ce.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new re({key:new ae("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||nf(t.selection)||n.view.dragging?null:te.create(t.doc,[ve.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ac({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var sS=ce.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ae(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new re({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,d=e.getState(i),u=l.content.size,f=c.nodes[t];if(d)return a.insert(u,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Ac({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!Ac({node:i,types:r})}}})]}}),oS=ce.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Jf(n,e),redo:()=>({state:n,dispatch:e})=>Gf(n,e)}},addProseMirrorPlugins(){return[tS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),iS=ce.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(jb.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Mb.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Df.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Lb.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(zb.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Bb.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(nS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(rS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Fb.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Vb.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(oS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Hb.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Jb.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Pf.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Ff.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(bk.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Hf.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Rk.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Pk.configure(this.options.strike)),this.options.text!==!1&&s.push(Lk.configure(this.options.text)),this.options.underline!==!1&&s.push($k.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(sS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),lS=iS;function aS(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:l}=n,a=r&&!s,c=Zx(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",f=s?"":c,h=a?new RegExp(`${u}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),b=new RegExp(`^[${o?.join("")}\0]?$`).test(x);if(o!==null&&!b)return null;const k=g+y.index;let C=k+y[0].length;return a&&d.test(p.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(t.length),text:y[0]}:null}var cS=new ae("suggestion");function dS({pluginKey:n=cS,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:f=()=>[],render:h=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=aS,shouldShow:y}){let x;const b=h?.(),k=()=>{const v=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(v),{top:O,right:D,bottom:j,left:z}=T;try{return new DOMRect(z,O,D-z,j-O)}catch{return null}},C=(v,T)=>T?()=>{const O=n.getState(e.state),D=O?.decorationId,j=v.dom.querySelector(`[data-decoration-id="${D}"]`);return j?.getBoundingClientRect()||null}:k;function S(v,T){var O;try{const j=n.getState(v.state),z=j?.decorationId?v.dom.querySelector(`[data-decoration-id="${j.decorationId}"]`):null,V={editor:e,range:j?.range||{from:0,to:0},query:j?.query||null,text:j?.text||null,items:[],command:B=>u({editor:e,range:j?.range||{from:0,to:0},props:B}),decorationNode:z,clientRect:C(v,z)};(O=b?.onExit)==null||O.call(b,V)}catch{}const D=v.state.tr.setMeta(T,{exit:!0});v.dispatch(D)}const w=new re({key:n,view(){return{update:async(v,T)=>{var O,D,j,z,V,B,H;const N=(O=this.key)==null?void 0:O.getState(T),_=(D=this.key)==null?void 0:D.getState(v.state),P=N.active&&_.active&&N.range.from!==_.range.from,U=!N.active&&_.active,Q=N.active&&!_.active,le=!U&&!Q&&N.query!==_.query,X=U||P&&le,fe=le||P,se=Q||P&&le;if(!X&&!fe&&!se)return;const K=se&&!X?N:_,Fe=v.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);x={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:at=>u({editor:e,range:K.range,props:at}),decorationNode:Fe,clientRect:C(v,Fe)},X&&((j=b?.onBeforeStart)==null||j.call(b,x)),fe&&((z=b?.onBeforeUpdate)==null||z.call(b,x)),(fe||X)&&(x.items=await f({editor:e,query:K.query})),se&&((V=b?.onExit)==null||V.call(b,x)),fe&&((B=b?.onUpdate)==null||B.call(b,x)),X&&((H=b?.onStart)==null||H.call(b,x))},destroy:()=>{var v;x&&((v=b?.onExit)==null||v.call(b,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(v,T,O,D){const{isEditable:j}=e,{composing:z}=e.view,{selection:V}=v,{empty:B,from:H}=V,N={...T},_=v.getMeta(n);if(_&&_.exit)return N.active=!1,N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null,N;if(N.composing=z,j&&(B||e.view.composing)){(H<T.range.from||H>T.range.to)&&!z&&!T.composing&&(N.active=!1);const P=g({char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:V.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;P&&p({editor:e,state:D,range:P.range,isActive:T.active})&&(!y||y({editor:e,range:P.range,query:P.query,text:P.text,transaction:v}))?(N.active=!0,N.decorationId=T.decorationId?T.decorationId:U,N.range=P.range,N.query=P.query,N.text=P.text):N.active=!1}else N.active=!1;return N.active||(N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null),N}},props:{handleKeyDown(v,T){var O,D,j,z;const{active:V,range:B}=w.getState(v.state);if(!V)return!1;if(T.key==="Escape"||T.key==="Esc"){const N=w.getState(v.state),_=(O=x?.decorationNode)!=null?O:null,P=_??(N?.decorationId?v.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null);if(((D=b?.onKeyDown)==null?void 0:D.call(b,{view:v,event:T,range:N.range}))||!1)return!0;const Q={editor:e,range:N.range,query:N.query,text:N.text,items:[],command:le=>u({editor:e,range:N.range,props:le}),decorationNode:P,clientRect:P?()=>P.getBoundingClientRect()||null:null};return(j=b?.onExit)==null||j.call(b,Q),S(v,n),!0}return((z=b?.onKeyDown)==null?void 0:z.call(b,{view:v,event:T,range:B}))||!1},decorations(v){const{active:T,range:O,decorationId:D,query:j}=w.getState(v);if(!T)return null;const z=!j?.length,V=[a];return z&&V.push(d),te.create(v.doc,[ve.inline(O.from,O.to,{nodeName:l,class:V.join(" "),"data-decoration-id":D,"data-decoration-content":c})])}}});return w}function uS({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){const s=new ae;return{editor:n,char:r,pluginKey:s,command:({editor:o,range:i,props:l})=>{var a,c,d;const u=o.view.state.selection.$to.nodeAfter;(a=u?.text)!=null&&a.startsWith(" ")&&(i.to+=1),o.chain().focus().insertContentAt(i,[{type:t,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(d=(c=o.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||d.collapseToEnd()},allow:({state:o,range:i})=>{const l=o.doc.resolve(i.from),a=o.schema.nodes[t];return!!l.parent.type.contentMatch.matchType(a)},...e}}function Xf(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>uS({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Oc(n,e){const t=Xf(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}var fS=Ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!=null?t:"@"}${(r=n.attrs.label)!=null?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,s;return["span",ne(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=Oc(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",ne({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=ne({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",ne({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...kf({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,o,i]=r,l=o??i;e[s==="char"?"mentionSuggestionChar":s]=l,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:Oc(this,n.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:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:s,anchor:o}=r;if(!s)return!1;let i=new _e,l=0;return e.doc.nodesBetween(o-1,o,(a,c)=>{if(a.type.name===this.name)return t=!0,i=a,l=c,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":i.attrs.mentionSuggestionChar,l,l+i.nodeSize),t})}},addProseMirrorPlugins(){return Xf(this).map(dS)}}),hS=fS,Ho,Qs="HoverCard",[Yf]=Mi(Qs,[Pc]),Zs=Pc(),[pS,eo]=Yf(Qs),Qf=n=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:s,onOpenChange:o,openDelay:i=700,closeDelay:l=300}=n,a=Zs(e),c=M.useRef(0),d=M.useRef(0),u=M.useRef(!1),f=M.useRef(!1),[h,p]=Ds({prop:r,defaultProp:s??!1,onChange:o,caller:Qs}),g=M.useCallback(()=>{clearTimeout(d.current),c.current=window.setTimeout(()=>p(!0),i)},[i,p]),y=M.useCallback(()=>{clearTimeout(c.current),!u.current&&!f.current&&(d.current=window.setTimeout(()=>p(!1),l))},[l,p]),x=M.useCallback(()=>p(!1),[p]);return M.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(d.current)},[]),m.jsx(pS,{scope:e,open:h,onOpenChange:p,onOpen:g,onClose:y,onDismiss:x,hasSelectionRef:u,isPointerDownOnContentRef:f,children:m.jsx(Dh,{...a,children:t})})};Qf.displayName=Qs;var Zf="HoverCardTrigger",eh=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,...r}=n,s=eo(Zf,t),o=Zs(t);return m.jsx(Rh,{asChild:!0,...o,children:m.jsx(On.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:Ve(n.onPointerEnter,Rs(s.onOpen)),onPointerLeave:Ve(n.onPointerLeave,Rs(s.onClose)),onFocus:Ve(n.onFocus,s.onOpen),onBlur:Ve(n.onBlur,s.onClose),onTouchStart:Ve(n.onTouchStart,i=>i.preventDefault())})})});eh.displayName=Zf;var _l="HoverCardPortal",[mS,gS]=Yf(_l,{forceMount:void 0}),th=n=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:s}=n,o=eo(_l,e);return m.jsx(mS,{scope:e,forceMount:t,children:m.jsx(Ai,{present:t||o.open,children:m.jsx(jh,{asChild:!0,container:s,children:r})})})};th.displayName=_l;var Is="HoverCardContent",nh=M.forwardRef((n,e)=>{const t=gS(Is,n.__scopeHoverCard),{forceMount:r=t.forceMount,...s}=n,o=eo(Is,n.__scopeHoverCard);return m.jsx(Ai,{present:r||o.open,children:m.jsx(yS,{"data-state":o.open?"open":"closed",...s,onPointerEnter:Ve(n.onPointerEnter,Rs(o.onOpen)),onPointerLeave:Ve(n.onPointerLeave,Rs(o.onClose)),ref:e})})});nh.displayName=Is;var yS=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,...l}=n,a=eo(Is,t),c=Zs(t),d=M.useRef(null),u=Oi(e,d),[f,h]=M.useState(!1);return M.useEffect(()=>{if(f){const p=document.body;return Ho=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Ho,p.style.webkitUserSelect=Ho}}},[f]),M.useEffect(()=>{if(d.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),M.useEffect(()=>{d.current&&kS(d.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(Ph,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:Ve(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(Lh,{...c,...l,onPointerDown:Ve(l.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:u,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"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)"}})})}),xS="HoverCardArrow",bS=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,...r}=n,s=Zs(t);return m.jsx($h,{...s,...r,ref:e})});bS.displayName=xS;function Rs(n){return e=>e.pointerType==="touch"?void 0:n()}function kS(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var SS=Qf,wS=eh,vS=th,CS=nh;function NS(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(SS,{"data-slot":"hover-card",...t}),e[2]=t,e[3]=r):r=e[3],r}function ES(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(wS,{"data-slot":"hover-card-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function TS(n){const e=I.c(12);let t,r,s,o;e[0]!==n?({className:t,align:s,sideOffset:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"center":s,l=o===void 0?4:o;let a;e[5]!==t?(a=J("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",t),e[5]=t,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==a?(c=m.jsx(vS,{"data-slot":"hover-card-portal",children:m.jsx(CS,{"data-slot":"hover-card-content",align:i,sideOffset:l,className:a,...r})}),e[7]=i,e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11],c}const rh=M.createContext(void 0);function MS(n,e){const t=e.split("."),r=t[0];if(!r)return;let s=n[r];for(let o=1;o<t.length&&s!==void 0;o++){const i=t[o];if(i)if(typeof s=="object"&&s!==null)s=s[i];else return}return s}function AS(n){const e=I.c(20),{node:t}=n,r=M.useContext(rh),s=t.attrs.id??"",o=r!==void 0;let i;if(e[0]!==o||e[1]!==s||e[2]!==r){const g=o?MS(r,s):void 0;i=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):void 0,e[0]=o,e[1]=s,e[2]=r,e[3]=i}else i=e[3];const l=i;let a;e[4]!==s?(a=m.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",s]}),e[4]=s,e[5]=a):a=e[5];const c=a;if(!o||l===void 0){let g;return e[6]!==c?(g=m.jsx(fc,{as:"span",children:c}),e[6]=c,e[7]=g):g=e[7],g}let d;e[8]!==c?(d=m.jsx(ES,{asChild:!0,children:c}),e[8]=c,e[9]=d):d=e[9];let u;e[10]!==s?(u=m.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",s]}),e[10]=s,e[11]=u):u=e[11];let f;e[12]!==l?(f=m.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:l}),e[12]=l,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==f?(h=m.jsx(TS,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:m.jsxs("div",{className:"space-y-1.5",children:[u,f]})}),e[14]=u,e[15]=f,e[16]=h):h=e[16];let p;return e[17]!==d||e[18]!==h?(p=m.jsx(fc,{as:"span",children:m.jsxs(NS,{openDelay:200,children:[d,h]})}),e[17]=d,e[18]=h,e[19]=p):p=e[19],p}function sh(n){const e=[];function t(r){for(const s of r)s.children?.length||e.push(s),s.children&&t(s.children)}return t(n),e}let Xe=oh();function oh(){return Yi(()=>({items:[],selectedIndex:0,command:null}))}function Ic(n,e){Xe.setState({items:n,command:e,selectedIndex:0})}function OS(){const{items:n,selectedIndex:e}=Xe.getState();n.length&&Xe.setState({selectedIndex:(e-1+n.length)%n.length})}function IS(){const{items:n,selectedIndex:e}=Xe.getState();n.length&&Xe.setState({selectedIndex:(e+1)%n.length})}function ih(){const{items:n,selectedIndex:e,command:t}=Xe.getState(),r=n[e];return r?(t?.(r),!0):!1}function Rc(){Xe=oh()}function RS(){const n=I.c(7),e=Ko(Xe,DS),t=Ko(Xe,jS);if(!e.length)return null;let r;if(n[0]!==e||n[1]!==t){let o;n[3]!==t?(o=(i,l)=>m.jsx("button",{type:"button",onClick:()=>{Xe.setState({selectedIndex:l}),ih()},className:J("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",l===t?"bg-accent text-accent-foreground":"hover:bg-muted"),children:i.label},i.id),n[3]=t,n[4]=o):o=n[4],r=e.map(o),n[0]=e,n[1]=t,n[2]=r}else r=n[2];let s;return n[5]!==r?(s=m.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:m.jsx("div",{className:"p-1",children:r})}),n[5]=r,n[6]=s):s=n[6],s}function jS(n){return n.selectedIndex}function DS(n){return n.items}function PS(){let n=null,e=null;return{onStart:t=>{Ic(t.items,t.command),n=new Cf(RS,{editor:t.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const r=t.clientRect?.();r&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`),e.appendChild(n.element),document.body.appendChild(e)},onUpdate:t=>{Ic(t.items,t.command);const r=t.clientRect?.();r&&e&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`)},onKeyDown:({event:t})=>t.key==="Escape"?(e?.remove(),n?.destroy(),Rc(),!0):t.key==="ArrowUp"?(OS(),!0):t.key==="ArrowDown"?(IS(),!0):t.key==="Enter"?ih():!1,onExit:()=>{e?.remove(),n?.destroy(),Rc()}}}const Wo=/@([\w.]+)/g;function LS(n,e){if(!n)return null;const t=sh(e),r=new Map(t.map(a=>[a.id,a]));if(!Wo.test(n))return n;Wo.lastIndex=0;const o=[];let i=0,l;for(;(l=Wo.exec(n))!==null;){const a=l[1]??"",c=l.index;c>i&&o.push({type:"text",text:n.slice(i,c)});const d=r.get(a);d?o.push({type:"mention",attrs:{id:d.id,label:d.label}}):o.push({type:"text",text:l[0]}),i=c+l[0].length}return i<n.length&&o.push({type:"text",text:n.slice(i)}),{type:"doc",content:[{type:"paragraph",content:o.length>0?o:void 0}]}}function zl(n){const e=I.c(31),{mentions:t,value:r,onChange:s,placeholder:o,className:i,readOnly:l}=n,a=eg();let c;e[0]!==t||e[1]!==r?(c=LS(r,t),e[0]=t,e[1]=r,e[2]=c):c=e[2];const d=c,u=a!==void 0,f=!l;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=lS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==t||e[5]!==u){let O;e[7]!==t?(O=D=>{const{query:j}=D;return sh(t).filter(V=>V.label.toLowerCase().includes(j.toLowerCase())||V.id.toLowerCase().includes(j.toLowerCase()))},e[7]=t,e[8]=O):O=e[8],p=hS.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:BS,renderHTML:zS,suggestion:{items:O,render:PS,command:_S}}).extend(u?{addNodeView(){return Eb(AS)}}:{}),e[4]=t,e[5]=u,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[h,p],e[9]=p,e[10]=g):g=e[10];const y=o??"";let x;e[11]!==y?(x={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":y},handleKeyDown:$S},e[11]=y,e[12]=x):x=e[12];let b;e[13]!==s?(b=O=>{const{editor:D}=O;return s?.(D.getText().trim())},e[13]=s,e[14]=b):b=e[14];let k;e[15]!==d||e[16]!==f||e[17]!==g||e[18]!==x||e[19]!==b?(k={content:d,editable:f,extensions:g,editorProps:x,onUpdate:b},e[15]=d,e[16]=f,e[17]=g,e[18]=x,e[19]=b,e[20]=k):k=e[20];const C=bb(k);let S;e[21]!==i?(S=J("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",i),e[21]=i,e[22]=S):S=e[22];let w;e[23]!==C?(w=m.jsx(fb,{editor:C}),e[23]=C,e[24]=w):w=e[24];let v;e[25]!==S||e[26]!==w?(v=m.jsx("div",{className:S,children:w}),e[25]=S,e[26]=w,e[27]=v):v=e[27];const T=v;if(a!==void 0){let O;return e[28]!==T||e[29]!==a?(O=m.jsx(rh.Provider,{value:a,children:T}),e[28]=T,e[29]=a,e[30]=O):O=e[30],O}return T}function $S(n,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function _S(n){const{editor:e,range:t,props:r}=n;e.chain().focus().insertContentAt(t,[{type:"mention",attrs:r}]).run()}function zS(n){const{options:e,node:t}=n;return["span",e.HTMLAttributes,`@${t.attrs.id}`]}function BS(n){const{node:e}=n;return`@${e.attrs.id}`}function FS(n){const e=I.c(8),{value:t,onChange:r,placeholder:s,readonly:o}=n,i=fd(),l=t??"";let a;e[0]!==r?(a=u=>r(u),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let d;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(d=m.jsx(zl,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d):d=e[7],d}function VS(n){const e=I.c(8),{value:t,onChange:r,placeholder:s,readonly:o}=n,i=fd(),l=t??"";let a;e[0]!==r?(a=u=>r(u),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let d;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(d=m.jsx(zl,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o,className:"min-h-[80px]"}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d):d=e[7],d}function HS(n){const e=I.c(8),{value:t,onChange:r,readonly:s,id:o}=n,i=t??"";let l;e[0]!==r?(l=d=>r(d.target.value===""?void 0:Number(d.target.value)),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=J("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 c;return e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==l?(c=m.jsx("input",{id:o,type:"number",value:i,onChange:l,disabled:s,className:a}),e[3]=o,e[4]=s,e[5]=i,e[6]=l,e[7]=c):c=e[7],c}function WS(n){const e=I.c(13),{value:t,onChange:r,readonly:s,id:o,label:i}=n,l=t??!1;let a;e[0]!==r?(a=f=>r(f.target.checked),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o||e[3]!==s||e[4]!==l||e[5]!==a?(c=m.jsx("input",{id:o,type:"checkbox",checked:l,onChange:a,disabled:s,className:"h-4 w-4 rounded border-input"}),e[2]=o,e[3]=s,e[4]=l,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==i?(d=m.jsx("span",{className:"text-sm",children:i}),e[7]=i,e[8]=d):d=e[8];let u;return e[9]!==o||e[10]!==c||e[11]!==d?(u=m.jsxs("label",{htmlFor:o,className:"flex items-center gap-2 cursor-pointer",children:[c,d]}),e[9]=o,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function qS(n){const e=I.c(14),{value:t,onChange:r,readonly:s,id:o,options:i}=n;let l;e[0]!==i.enumOptions?(l=i.enumOptions??[],e[0]=i.enumOptions,e[1]=l):l=e[1];const a=l,c=t??"";let d;e[2]!==r?(d=g=>r(g.target.value),e[2]=r,e[3]=d):d=e[3];let u,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=J("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"),f=m.jsx("option",{value:"",children:"Select..."}),e[4]=u,e[5]=f):(u=e[4],f=e[5]);let h;e[6]!==a?(h=a.map(US),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==o||e[9]!==s||e[10]!==c||e[11]!==d||e[12]!==h?(p=m.jsxs("select",{id:o,value:c,onChange:d,disabled:s,className:u,children:[f,h]}),e[8]=o,e[9]=s,e[10]=c,e[11]=d,e[12]=h,e[13]=p):p=e[13],p}function US(n){return m.jsx("option",{value:String(n.value),children:String(n.label)},String(n.value))}const KS={TextWidget:FS,TextareaWidget:VS,NumberWidget:HS,CheckboxWidget:WS,SelectWidget:qS};function JS(n){switch(Array.isArray(n)?n[0]:n??"unknown"){case"string":return{Icon:Xc,color:"text-blue-500"};case"number":case"integer":return{Icon:Jc,color:"text-blue-500"};case"array":return{Icon:qc,color:"text-purple-500"};case"object":return{Icon:Wc,color:"text-orange-500"};case"boolean":return{Icon:Gc,color:"text-pink-500"};case"null":return{Icon:Ii,color:"text-gray-500"};default:return{Icon:Uc,color:"text-muted-foreground"}}}function GS(n){const e=I.c(36),{id:t,label:r,required:s,description:o,children:i,schema:l,hidden:a}=n;if(a){let S;return e[0]!==i?(S=m.jsx("div",{className:"hidden",children:i}),e[0]=i,e[1]=S):S=e[1],S}if(t==="root"){let S;return e[2]!==i?(S=m.jsx("div",{className:"space-y-4",children:i}),e[2]=i,e[3]=S):S=e[3],S}const c=Array.isArray(l.type)?l.type[0]:l.type??"string";let d,u,f,h,p,g,y;if(e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==c){const{Icon:S,color:w}=JS(c);y="space-y-2",h="flex items-center gap-2",e[15]!==t||e[16]!==r?(p=m.jsx("label",{htmlFor:t,className:"text-sm font-medium leading-none",children:r}),e[15]=t,e[16]=r,e[17]=p):p=e[17],e[18]!==s?(g=s&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=s,e[19]=g):g=e[19],d=S,u=14,f=J(w,"ml-auto"),e[4]=t,e[5]=r,e[6]=s,e[7]=c,e[8]=d,e[9]=u,e[10]=f,e[11]=h,e[12]=p,e[13]=g,e[14]=y}else d=e[8],u=e[9],f=e[10],h=e[11],p=e[12],g=e[13],y=e[14];let x;e[20]!==d||e[21]!==u||e[22]!==f?(x=m.jsx(d,{size:u,className:f}),e[20]=d,e[21]=u,e[22]=f,e[23]=x):x=e[23];let b;e[24]!==h||e[25]!==p||e[26]!==g||e[27]!==x?(b=m.jsxs("div",{className:h,children:[p,g,x]}),e[24]=h,e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28];let k;e[29]!==o?(k=o&&m.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o}),e[29]=o,e[30]=k):k=e[30];let C;return e[31]!==i||e[32]!==y||e[33]!==b||e[34]!==k?(C=m.jsxs("div",{className:y,children:[b,k,i]}),e[31]=i,e[32]=y,e[33]=b,e[34]=k,e[35]=C):C=e[35],C}function XS(n){const e=I.c(8),{properties:t,title:r}=n;if(!r||r==="Root"){let l;e[0]!==t?(l=t.map(QS),e[0]=t,e[1]=l):l=e[1];let a;return e[2]!==l?(a=m.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=a):a=e[3],a}let o;e[4]!==t?(o=t.map(YS),e[4]=t,e[5]=o):o=e[5];let i;return e[6]!==o?(i=m.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:o}),e[6]=o,e[7]=i):i=e[7],i}function YS(n){return m.jsx("div",{children:n.content},n.name)}function QS(n){return m.jsx("div",{children:n.content},n.name)}function ZS(n){const e=I.c(11),{items:t,canAdd:r,onAddClick:s,title:o}=n;let i;e[0]!==t?(i=t.map(ew),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=m.jsx("div",{className:"space-y-2",children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==s||e[6]!==o?(a=r&&m.jsxs(me,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:s,children:["+ Add ",o||"item"]}),e[4]=r,e[5]=s,e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==a?(c=m.jsxs("div",{className:"space-y-2",children:[l,a]}),e[8]=l,e[9]=a,e[10]=c):c=e[10],c}function ew(n){return m.jsx("div",{className:"flex gap-2 items-start",children:m.jsx("div",{className:"flex-1",children:n})},n.key||n.index)}function tw(){return null}function nw(){return null}const rw={FieldTemplate:GS,ObjectFieldTemplate:XS,ArrayFieldTemplate:ZS,UnsupportedFieldTemplate:tw,ErrorListTemplate:nw};function sw(n){const e=I.c(6),{inputSchema:t,inputParams:r,mentions:s}=n;if(!t?.properties||!r)return null;let o;e[0]!==s?(o=(a,c,d)=>{const u=typeof c=="object"&&c!==null?JSON.stringify(c,null,2):String(c??""),f=Array.isArray(d.type)?d.type.join(" | "):d.type??"string";return m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),m.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:f})]}),d.description&&m.jsx("div",{className:"text-xs text-muted-foreground",children:d.description}),m.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:m.jsx(zl,{mentions:s,value:u,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=s,e[1]=o):o=e[1];const i=o;let l;return e[2]!==r||e[3]!==t.properties||e[4]!==i?(l=m.jsx("div",{className:"space-y-4",children:Object.entries(t.properties).map(a=>{const[c,d]=a,u=r[c];return i(c,u,d)})}),e[2]=r,e[3]=t.properties,e[4]=i,e[5]=l):l=e[5],l}function lh({inputSchema:n,inputParams:e,setInputParams:t,handleInputChange:r,mentions:s,readOnly:o}){const i=s??[];if(!n)return m.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(o)return m.jsx(sw,{inputSchema:n,inputParams:e,mentions:i});const l=n,a=M.useRef(e??{}),c=d=>{const u=d.formData??{},f=a.current;if(t?.(u),r){for(const[h,p]of Object.entries(u))f[h]!==p&&r(h,p);for(const h of Object.keys(f))h in u||r(h,void 0)}a.current=u};return m.jsx(ud.Provider,{value:i,children:m.jsx(ep,{schema:l,formData:e,onChange:c,validator:tp,widgets:KS,templates:rw,readonly:o,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:m.jsx(m.Fragment,{})})})}function ow(n){const e=I.c(33),{open:t,onOpenChange:r,inputSchema:s,onSubmit:o,isPending:i}=n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[a,c]=M.useState(l);let d;e[1]!==a||e[2]!==r||e[3]!==o?(d=async()=>{await o(a),r(!1),c({})},e[1]=a,e[2]=r,e[3]=o,e[4]=d):d=e[4];const u=d;let f;e[5]!==r?(f=T=>{T||c({}),r(T)},e[5]=r,e[6]=f):f=e[6];const h=f;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsxs(up,{children:[m.jsx(fp,{children:"Workflow Input"}),m.jsx(hp,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let y;e[9]!==a||e[10]!==s?(y=m.jsx("div",{className:"py-4",children:m.jsx(lh,{inputSchema:s,inputParams:a,setInputParams:c,mentions:g})}),e[9]=a,e[10]=s,e[11]=y):y=e[11];let x;e[12]!==h?(x=()=>h(!1),e[12]=h,e[13]=x):x=e[13];let b;e[14]!==i||e[15]!==x?(b=m.jsx(me,{variant:"outline",onClick:x,disabled:i,children:"Cancel"}),e[14]=i,e[15]=x,e[16]=b):b=e[16];let k;e[17]!==i?(k=i?m.jsx(Ls,{size:"xs"}):m.jsx(Fi,{size:14}),e[17]=i,e[18]=k):k=e[18];let C;e[19]!==u||e[20]!==i||e[21]!==k?(C=m.jsxs(me,{onClick:u,disabled:i,className:"gap-2",children:[k,"Run Workflow"]}),e[19]=u,e[20]=i,e[21]=k,e[22]=C):C=e[22];let S;e[23]!==C||e[24]!==b?(S=m.jsxs(pp,{children:[b,C]}),e[23]=C,e[24]=b,e[25]=S):S=e[25];let w;e[26]!==S||e[27]!==y?(w=m.jsxs(mp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,y,S]}),e[26]=S,e[27]=y,e[28]=w):w=e[28];let v;return e[29]!==h||e[30]!==t||e[31]!==w?(v=m.jsx(gp,{open:t,onOpenChange:h,children:w}),e[29]=h,e[30]=t,e[31]=w,e[32]=v):v=e[32],v}function iw(n){const e=I.c(26),{title:t,description:r,onSave:s}=n,i=Ti().location.href,{viewMode:l,setViewMode:a,showExecutionsList:c,toggleExecutionsList:d}=Qi(),{resetToOriginalWorkflow:u,setSelectedGatewayId:f}=Me(),h=cd(),p=Dn(),g=Se();let y;e[0]!==t?(y=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t}),e[0]=t,e[1]=y):y=e[1];let x;e[2]!==r?(x=r?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:r})]}):null,e[2]=r,e[3]=x):x=e[3];let b;e[4]!==y||e[5]!==x?(b=m.jsx(Fc,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,x]})}),e[4]=y,e[5]=x,e[6]=b):b=e[6];let k;e[7]!==h||e[8]!==s||e[9]!==u||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==c||e[14]!==t||e[15]!==d||e[16]!==g||e[17]!==i||e[18]!==l?(k=!g&&m.jsxs(m.Fragment,{children:[m.jsx(Pi,{title:t,url:i,icon:"workflow"}),m.jsx(M.Suspense,{fallback:m.jsx(Ls,{size:"xs"}),children:m.jsx(lp,{selectedGatewayId:p??void 0,onGatewayChange:f,variant:"bordered",placeholder:"Select Agent"})}),m.jsx(cp,{value:l,onValueChange:a,size:"sm",options:[{value:"visual",icon:m.jsx(dp,{})},{value:"code",icon:m.jsx(Zc,{})}]}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:u,disabled:!h,"aria-label":"Reset changes",children:m.jsx(Bc,{size:14})})})}),m.jsx($t,{side:"bottom",children:"Reset changes"})]})}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:s,disabled:!h,"aria-label":"Save workflow",children:m.jsx(Xi,{size:14})})})}),m.jsx($t,{side:"bottom",children:"Save workflow"})]})}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:c?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:d,"aria-label":c?"Hide runs":"Show runs",children:m.jsx(Qc,{size:14})})})}),m.jsx($t,{side:"bottom",children:c?"Hide runs":"Show runs"})]})})]}),e[7]=h,e[8]=s,e[9]=u,e[10]=p,e[11]=f,e[12]=a,e[13]=c,e[14]=t,e[15]=d,e[16]=g,e[17]=i,e[18]=l,e[19]=k):k=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=m.jsx(cw,{}),e[20]=C):C=e[20];let S;e[21]!==k?(S=m.jsxs(Bi,{children:[k,C]}),e[21]=k,e[22]=S):S=e[22];let w;return e[23]!==b||e[24]!==S?(w=m.jsxs(m.Fragment,{children:[b,S]}),e[23]=b,e[24]=S,e[25]=w):w=e[25],w}function lw(){const n=Se(),{item:e}=Ln(n);return e?.completed_at_epoch_ms!=null}function aw(){const n=Se(),{item:e}=Ln(n);return e?.status==="cancelled"}function cw(){const n=I.c(57),e=cd(),t=lw(),r=aw(),s=Se(),o=Dn(),{handleRunWorkflow:i,isPending:l,requiresInput:a,inputSchema:c}=Ym(),d=mr(),[u,f]=M.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=Qm(),{handleResumeWorkflow:g,isResuming:y}=Zm(),x=s&&!t;let b;n[0]!==d?(b=d.some(dw),n[0]=d,n[1]=b):b=n[1];const k=b,C=!o,S=e||k||C||l||p,w=x||l;let v;n[2]!==k||n[3]!==C||n[4]!==e||n[5]!==r||n[6]!==w?(v=()=>r?"Workflow is currently cancelled":w?"Workflow is currently running":e?"Save your changes before running":C?"Select an Agent first":k?"Add at least one step to the workflow":null,n[2]=k,n[3]=C,n[4]=e,n[5]=r,n[6]=w,n[7]=v):v=n[7];const O=v();let D;n[8]!==h||n[9]!==g||n[10]!==i||n[11]!==c||n[12]!==r||n[13]!==w||n[14]!==a||n[15]!==s?(D=async()=>{if(a&&c){f(!0);return}if(r&&s){await g(s);return}if(w&&s){await h(s);return}await i({})},n[8]=h,n[9]=g,n[10]=i,n[11]=c,n[12]=r,n[13]=w,n[14]=a,n[15]=s,n[16]=D):D=n[16];const j=D;let z;n[17]!==i?(z=async Fe=>{await i(Fe)},n[17]=i,n[18]=z):z=n[18];const V=z,B=r?"Resume":s?t?"Replay":"Running...":a?"Run with input...":"Run workflow",H=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;n[19]!==H?(N=J("gap-2 h-7 px-3",H),n[19]=H,n[20]=N):N=n[20];let _;n[21]!==p||n[22]!==r||n[23]!==l||n[24]!==y||n[25]!==x?(_=(!x&&!l&&!p&&!y||r)&&m.jsx(Fi,{size:14}),n[21]=p,n[22]=r,n[23]=l,n[24]=y,n[25]=x,n[26]=_):_=n[26];let P;n[27]!==p||n[28]!==r||n[29]!==l||n[30]!==y||n[31]!==x?(P=x&&!l&&!p&&!y&&!r&&m.jsx(ap,{size:14}),n[27]=p,n[28]=r,n[29]=l,n[30]=y,n[31]=x,n[32]=P):P=n[32];let U;n[33]!==p||n[34]!==l||n[35]!==y?(U=(l||p||y)&&m.jsx(Ls,{size:"xs"}),n[33]=p,n[34]=l,n[35]=y,n[36]=U):U=n[36];let Q;n[37]!==B||n[38]!==j||n[39]!==S||n[40]!==N||n[41]!==_||n[42]!==P||n[43]!==U?(Q=m.jsxs(me,{variant:"default",size:"sm",className:N,disabled:S,onClick:j,children:[_,P,U,B]}),n[37]=B,n[38]=j,n[39]=S,n[40]=N,n[41]=_,n[42]=P,n[43]=U,n[44]=Q):Q=n[44];const le=Q;let X;n[45]!==le||n[46]!==O?(X=O?m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:le})}),m.jsx($t,{side:"bottom",children:O})]})}):le,n[45]=le,n[46]=O,n[47]=X):X=n[47];const fe=X;let se;n[48]!==V||n[49]!==c||n[50]!==l||n[51]!==a||n[52]!==u?(se=a&&c&&m.jsx(ow,{open:u,onOpenChange:f,inputSchema:c,onSubmit:V,isPending:l}),n[48]=V,n[49]=c,n[50]=l,n[51]=a,n[52]=u,n[53]=se):se=n[53];let K;return n[54]!==fe||n[55]!==se?(K=m.jsxs(m.Fragment,{children:[fe,se]}),n[54]=fe,n[55]=se,n[56]=K):K=n[56],K}function dw(n){return"toolName"in n.action&&(!n.action.toolName||n.action.toolName==="")}function uw(){const n=I.c(17),e=Se(),t=mr(),{item:r}=Ln(e);if(!e||!r)return;let s;if(n[0]!==r.completed_steps?.error||n[1]!==r.completed_steps?.success||n[2]!==r.status||n[3]!==t){s={};let o;n[5]!==r.completed_steps?.success?(o=r.completed_steps?.success??[],n[5]=r.completed_steps?.success,n[6]=o):o=n[6];let i;n[7]!==o?(i=new Set(o),n[7]=o,n[8]=i):i=n[8];const l=i;let a;n[9]!==r.completed_steps?.error?(a=r.completed_steps?.error??[],n[9]=r.completed_steps?.error,n[10]=a):a=n[10];let c;n[11]!==a?(c=new Set(a),n[11]=a,n[12]=c):c=n[12];const d=c;let u;n[13]!==d||n[14]!==t||n[15]!==l?(u=-1,t.forEach((f,h)=>{(l.has(f.name)||d.has(f.name))&&(u=h)}),n[13]=d,n[14]=t,n[15]=l,n[16]=u):u=n[16],t.forEach((f,h)=>{let p="pending";d.has(f.name)?p="error":l.has(f.name)?p="success":r.status==="running"&&h===u+1&&(p="running"),s[f.name]={status:p,output:void 0,error:void 0,stepIndex:h}}),n[0]=r.completed_steps?.error,n[1]=r.completed_steps?.success,n[2]=r.status,n[3]=t,n[4]=s}else s=n[4];return s}function fw(n){const e=I.c(119),{step:t,index:r,isSelected:s,executionStatus:o,isSkipped:i,isLastStep:l,onSelect:a,onDelete:c,onDuplicate:d}=n,u=Se(),{item:f}=Ln(u),h=f?.completed_at_epoch_ms;let p;e[0]!==f?.completed_steps?.success||e[1]!==t.name?(p=f?.completed_steps?.success?.includes(t.name)??!1,e[0]=f?.completed_steps?.success,e[1]=t.name,e[2]=p):p=e[2];const g=p;let y;e[3]!==f?.completed_steps?.error||e[4]!==t.name?(y=f?.completed_steps?.error?.includes(t.name)??!1,e[3]=f?.completed_steps?.error,e[4]=t.name,e[5]=y):y=e[5];const x=y,b="toolName"in t.action,k=b&&"connectionId"in t.action?t.action.connectionId:null,S=!!(b&&"toolName"in t.action?t.action.toolName:null);let w,v,T,O,D,j,z,V,B,H,N;if(e[6]!==k||e[7]!==o||e[8]!==S||e[9]!==r||e[10]!==g||e[11]!==x||e[12]!==l||e[13]!==s||e[14]!==i||e[15]!==b||e[16]!==c||e[17]!==d||e[18]!==a||e[19]!==t||e[20]!==u){const le=vw(t);w=g?"success":x?"error":o?.status;const X=o!==void 0,fe=w==="success"||w==="error";let se=le.length>0?60:12;(w==="success"||w==="error")&&(se=se+32);let K,Fe,at;if(e[32]!==s||e[33]!==i||e[34]!==a||e[35]!==w){const _n=mw(w);let kr;e[44]!==w?(kr=gw(w),e[44]=w,e[45]=kr):kr=e[45],K=kr;const io=s&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lo=w==="running"&&"bg-accent/50",ao=i&&"opacity-50";e[46]!==io||e[47]!==lo||e[48]!==ao?(V=J("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",io,lo,ao),e[46]=io,e[47]=lo,e[48]=ao,e[49]=V):V=e[49],B=a,H="button",N=0,e[50]!==a?(v=co=>{(co.key==="Enter"||co.key===" ")&&(co.preventDefault(),a())},e[50]=a,e[51]=v):v=e[51],at="w-5 flex flex-col items-center justify-center shrink-0 pt-3",Fe=J("text-xs font-mono opacity-75 h-8 flex items-center",_n),e[32]=s,e[33]=i,e[34]=a,e[35]=w,e[36]=K,e[37]=v,e[38]=Fe,e[39]=at,e[40]=V,e[41]=B,e[42]=H,e[43]=N}else K=e[36],v=e[37],Fe=e[38],at=e[39],V=e[40],B=e[41],H=e[42],N=e[43];const so=r+1;let en;e[52]!==Fe||e[53]!==so?(en=m.jsxs("span",{className:Fe,children:[so,"."]}),e[52]=Fe,e[53]=so,e[54]=en):en=e[54],e[55]!==at||e[56]!==en?(T=m.jsx("div",{className:at,children:en}),e[55]=at,e[56]=en,e[57]=T):T=e[57];let tn;e[58]!==K||e[59]!==r?(tn=r>0?m.jsx(qo,{height:12,color:K}):m.jsx("div",{className:"h-3"}),e[58]=K,e[59]=r,e[60]=tn):tn=e[60];let nn;e[61]!==k||e[62]!==S||e[63]!==b||e[64]!==t.name?(nn=m.jsx(Sw,{connectionId:k,isToolStep:b,hasToolSelected:S,stepName:t.name}),e[61]=k,e[62]=S,e[63]=b,e[64]=t.name,e[65]=nn):nn=e[65];let rn;e[66]!==K||e[67]!==fe||e[68]!==w?(rn=fe&&m.jsxs(m.Fragment,{children:[m.jsx(qo,{height:8,color:K}),m.jsx(yw,{status:w})]}),e[66]=K,e[67]=fe,e[68]=w,e[69]=rn):rn=e[69];let sn;e[70]!==K||e[71]!==se||e[72]!==l||e[73]!==u?(sn=l&&u?null:m.jsx(qo,{height:se,color:K}),e[70]=K,e[71]=se,e[72]=l,e[73]=u,e[74]=sn):sn=e[74],e[75]!==tn||e[76]!==nn||e[77]!==rn||e[78]!==sn?(O=m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[tn,nn,rn,sn]}),e[75]=tn,e[76]=nn,e[77]=rn,e[78]=sn,e[79]=O):O=e[79],D="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const oo=S?"font-medium text-foreground":"text-foreground";let on;e[80]!==oo?(on=J("text-sm truncate flex-1",oo),e[80]=oo,e[81]=on):on=e[81];let ln;e[82]!==t?(ln=ww(t),e[82]=t,e[83]=ln):ln=e[83];let an;e[84]!==on||e[85]!==ln?(an=m.jsx("span",{className:on,children:ln}),e[84]=on,e[85]=ln,e[86]=an):an=e[86];let cn;e[87]!==X||e[88]!==w?(cn=X&&m.jsx(xw,{status:w}),e[87]=X,e[88]=w,e[89]=cn):cn=e[89];let dn;e[90]!==X||e[91]!==c||e[92]!==d?(dn=!X&&m.jsxs(xp,{children:[m.jsx(bp,{asChild:!0,children:m.jsx(me,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:pw,children:m.jsx(yp,{size:14})})}),m.jsxs(kp,{align:"end",children:[m.jsxs(Jl,{onClick:_n=>{_n.stopPropagation(),d()},children:[m.jsx(vp,{size:14}),"Duplicate"]}),m.jsxs(Jl,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:_n=>{_n.stopPropagation(),c()},children:[m.jsx(_h,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=X,e[91]=c,e[92]=d,e[93]=dn):dn=e[93],e[94]!==an||e[95]!==cn||e[96]!==dn?(j=m.jsxs("div",{className:"flex items-center h-8",children:[an,cn,dn]}),e[94]=an,e[95]=cn,e[96]=dn,e[97]=j):j=e[97],z=le.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(hw)}),e[6]=k,e[7]=o,e[8]=S,e[9]=r,e[10]=g,e[11]=x,e[12]=l,e[13]=s,e[14]=i,e[15]=b,e[16]=c,e[17]=d,e[18]=a,e[19]=t,e[20]=u,e[21]=w,e[22]=v,e[23]=T,e[24]=O,e[25]=D,e[26]=j,e[27]=z,e[28]=V,e[29]=B,e[30]=H,e[31]=N}else w=e[21],v=e[22],T=e[23],O=e[24],D=e[25],j=e[26],z=e[27],V=e[28],B=e[29],H=e[30],N=e[31];let _;e[98]!==h||e[99]!==w?(_=w==="success"&&m.jsx(bw,{completedAtEpochMs:h}),e[98]=h,e[99]=w,e[100]=_):_=e[100];let P;e[101]!==o?.error||e[102]!==w?(P=w==="error"&&m.jsx(kw,{error:o?.error}),e[101]=o?.error,e[102]=w,e[103]=P):P=e[103];let U;e[104]!==_||e[105]!==P||e[106]!==D||e[107]!==j||e[108]!==z?(U=m.jsxs("div",{className:D,children:[j,z,_,P]}),e[104]=_,e[105]=P,e[106]=D,e[107]=j,e[108]=z,e[109]=U):U=e[109];let Q;return e[110]!==v||e[111]!==T||e[112]!==O||e[113]!==U||e[114]!==V||e[115]!==B||e[116]!==H||e[117]!==N?(Q=m.jsxs("div",{className:V,onClick:B,role:H,tabIndex:N,onKeyDown:v,children:[T,O,U]}),e[110]=v,e[111]=T,e[112]=O,e[113]=U,e[114]=V,e[115]=B,e[116]=H,e[117]=N,e[118]=Q):Q=e[118],Q}function hw(n){return m.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:n},n)}function pw(n){return n.stopPropagation()}function mw(n){switch(n){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function gw(n){switch(n){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function yw(n){const e=I.c(2),{status:t}=n;if(t==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:m.jsx(zi,{size:8,className:"text-success-foreground"})}),e[0]=r):r=e[0],r}if(t==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:m.jsx(Vi,{size:8,className:"text-destructive-foreground"})}),e[1]=r):r=e[1],r}return null}function xw(n){const e=I.c(3),{status:t}=n;if(t==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(zi,{size:11,className:"text-success"})}),e[0]=r):r=e[0],r}if(t==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(Vi,{size:11,className:"text-destructive"})}),e[1]=r):r=e[1],r}if(t==="running"){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(nr,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=r):r=e[2],r}return null}function bw(n){const e=I.c(8),{completedAtEpochMs:t}=n;let r,s;if(e[0]!==t){const a=t!=null?new Date(t):null;r=a?a.toISOString().split("T")[0]:null,s=a?a.toTimeString().split(" ")[0]:null,e[0]=t,e[1]=r,e[2]=s}else r=e[1],s=e[2];const o=s;let i;e[3]!==r||e[4]!==o?(i=r&&o&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Gh,{size:16,className:"text-success"}),m.jsx("span",{className:"text-xs text-success",children:r}),m.jsx("span",{className:"text-xs text-success",children:o})]}),e[3]=r,e[4]=o,e[5]=i):i=e[5];let l;return e[6]!==i?(l=m.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:i}),e[6]=i,e[7]=l):l=e[7],l}function kw(n){const e=I.c(3),{error:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx(Gi,{size:16,className:"text-destructive"}),e[0]=r):r=e[0];const s=t||"Execution failed";let o;return e[1]!==s?(o=m.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[r,m.jsx("span",{className:"text-xs text-destructive",children:s})]}),e[1]=s,e[2]=o):o=e[2],o}function Sw(n){const e=I.c(5),{connectionId:t,isToolStep:r,hasToolSelected:s,stepName:o}=n,i=Di(t??"");if(r&&s&&i?.icon){let a;return e[0]!==i.icon||e[1]!==o?(a=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:m.jsx(Ps,{icon:i.icon,name:o,size:"xs",className:"border-0 rounded-none"})}),e[0]=i.icon,e[1]=o,e[2]=a):a=e[2],a}let l;return e[3]!==r?(l=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:r?m.jsx(rd,{size:16,className:"text-muted-foreground"}):m.jsx(wp,{size:16,className:"text-muted-foreground"})}),e[3]=r,e[4]=l):l=e[4],l}function qo(n){const e=I.c(7),{height:t,color:r}=n,s=r===void 0?"bg-border":r;let o;e[0]!==s?(o=J("w-px",s),e[0]=s,e[1]=o):o=e[1];let i;e[2]!==t?(i={height:t},e[2]=t,e[3]=i):i=e[3];let l;return e[4]!==o||e[5]!==i?(l=m.jsx("div",{className:o,style:i}),e[4]=o,e[5]=i,e[6]=l):l=e[6],l}function ww(n){return n.name?n.name:"toolName"in n.action&&n.action.toolName?n.action.toolName:"code"in n.action?n.name||"Code Step":"Select tool..."}function vw(n){const e=n.outputSchema;if(!e||typeof e!="object")return[];const t=e.properties;return!t||typeof t!="object"?[]:Object.keys(t).slice(0,5)}function Cw(n){const e=I.c(32),{className:t}=n,r=mr(),s=ad(),o=uw(),{setCurrentStepName:i,deleteStep:l,duplicateStep:a}=Me(),c=Se();let d;e[0]!==o||e[1]!==r?(d=o?r.findIndex(k=>o[k.name]?.status==="error"):-1,e[0]=o,e[1]=r,e[2]=d):d=e[2];const u=d;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{children:"Loading..."}),e[3]=f):f=e[3];let h;e[4]!==t?(h=J("h-full flex flex-col p-8 overflow-auto",t),e[4]=t,e[5]=h):h=e[5];let p;if(e[6]!==s||e[7]!==l||e[8]!==a||e[9]!==u||e[10]!==i||e[11]!==o||e[12]!==r){let k;e[14]!==s||e[15]!==l||e[16]!==a||e[17]!==u||e[18]!==i||e[19]!==o||e[20]!==r.length?(k=(C,S)=>{const w=o?.[C.name],v=u!==-1&&S>u&&w?.status==="pending",T=S===r.length-1;return m.jsx(fw,{step:C,index:S,isSelected:C.name===s,executionStatus:w,isSkipped:v,isLastStep:T,onSelect:()=>i(C.name),onDelete:()=>l(C.name),onDuplicate:()=>a(C.name)},C.name)},e[14]=s,e[15]=l,e[16]=a,e[17]=u,e[18]=i,e[19]=o,e[20]=r.length,e[21]=k):k=e[21],p=r.map(k),e[6]=s,e[7]=l,e[8]=a,e[9]=u,e[10]=i,e[11]=o,e[12]=r,e[13]=p}else p=e[13];let g;e[22]!==p?(g=m.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let y;e[24]!==c?(y=c?null:m.jsx(Nw,{}),e[24]=c,e[25]=y):y=e[25];let x;e[26]!==g||e[27]!==y?(x=m.jsxs("div",{className:"w-full -space-y-1",children:[g,y]}),e[26]=g,e[27]=y,e[28]=x):x=e[28];let b;return e[29]!==h||e[30]!==x?(b=m.jsx(M.Suspense,{fallback:f,children:m.jsx("div",{className:h,children:x})}),e[29]=h,e[30]=x,e[31]=b):b=e[31],b}function Nw(){const n=I.c(8),{addToolStep:e}=Me();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=m.jsx("div",{className:"w-5 shrink-0"}),n[0]=t):t=n[0];let r;n[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"w-px h-3 bg-border"}),n[1]=r):r=n[1];let s;n[2]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx(Vc,{size:14}),n[2]=s):s=n[2];let o;n[3]!==e?(o=m.jsx(me,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:s}),n[3]=e,n[4]=o):o=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=m.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%"}}),n[5]=i):i=n[5];let l;return n[6]!==o?(l=m.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[t,m.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[r,o,i]})]}),n[6]=o,n[7]=l):l=n[7],l}function Ew(){const n=I.c(5),e=Dn();let t;n[0]!==e?(t=e?new URL(`/mcp/gateway/${e}`,window.location.origin).href:"",n[0]=e,n[1]=t):t=n[1];const r=t,s=!!e;let o;return n[2]!==r||n[3]!==s?(o={url:r,enabled:s},n[2]=r,n[3]=s,n[4]=o):o=n[4],Hi(o)}function Tw(n){const e=I.c(7),{className:t}=n;if(!Dn()){let o;e[0]!==t?(o=J("flex flex-col h-full bg-sidebar",t),e[0]=t,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select a gateway to see available tools"}),e[2]=i):i=e[2];let l;return e[3]!==o?(l=m.jsx("div",{className:o,children:i}),e[3]=o,e[4]=l):l=e[4],l}let s;return e[5]!==t?(s=m.jsx(Mw,{className:t}),e[5]=t,e[6]=s):s=e[6],s}function Mw(n){const e=I.c(38),{className:t}=n,{tools:r,isLoading:s,error:o}=Ew(),i=pr(),{updateStep:l}=Me(),c=i&&"toolName"in i.action&&"toolName"in i.action?i.action.toolName:null;let d;if(e[0]!==c||e[1]!==r){let S;e[3]!==c?(S=w=>w.name===c,e[3]=c,e[4]=S):S=e[4],d=r.find(S),e[0]=c,e[1]=r,e[2]=d}else d=e[2];const f=tg(r,d??null,Ow,Aw);let h;e[5]!==i||e[6]!==l?(h=S=>{i&&l(i.name,{action:{...i.action,toolName:S.name},outputSchema:S.outputSchema??{}})},e[5]=i,e[6]=l,e[7]=h):h=e[7];const p=h;if(s){let S;e[8]!==t?(S=J("flex flex-col h-full bg-sidebar",t),e[8]=t,e[9]=S):S=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(Ls,{size:"sm"})}),e[10]=w):w=e[10];let v;return e[11]!==S?(v=m.jsx("div",{className:S,children:w}),e[11]=S,e[12]=v):v=e[12],v}if(o){let S;e[13]!==t?(S=J("flex flex-col h-full bg-sidebar",t),e[13]=t,e[14]=S):S=e[14];let w;e[15]!==o.message?(w=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",o.message]}),e[15]=o.message,e[16]=w):w=e[16];let v;return e[17]!==S||e[18]!==w?(v=m.jsx("div",{className:S,children:w}),e[17]=S,e[18]=w,e[19]=v):v=e[19],v}let g;e[20]!==t?(g=J("flex flex-col h-full bg-sidebar",t),e[20]=t,e[21]=g):g=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=m.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=y):y=e[22];let x;e[23]!==r.length?(x=m.jsx("div",{className:"flex items-start border-b border-border",children:m.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[y,m.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",r.length,")"]})]})}),e[23]=r.length,e[24]=x):x=e[24];let b;if(e[25]!==p||e[26]!==f||e[27]!==c){let S;e[29]!==p||e[30]!==c?(S=w=>m.jsx(Iw,{icon:null,title:w.name,description:w.description,isSelected:w.name===c,onClick:()=>p(w)},w.name),e[29]=p,e[30]=c,e[31]=S):S=e[31],b=f.map(S),e[25]=p,e[26]=f,e[27]=c,e[28]=b}else b=e[28];let k;e[32]!==b?(k=m.jsx("div",{className:"flex-1 overflow-auto",children:b}),e[32]=b,e[33]=k):k=e[33];let C;return e[34]!==g||e[35]!==x||e[36]!==k?(C=m.jsxs("div",{className:g,children:[x,k]}),e[34]=g,e[35]=x,e[36]=k,e[37]=C):C=e[37],C}function Aw(n,e){return n.name.localeCompare(e.name)}function Ow(n){return n.name}function Iw(n){const e=I.c(20),{icon:t,title:r,description:s,isSelected:o,onClick:i}=n,l=o&&"bg-muted/50";let a;e[0]!==l?(a=J("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i?(c=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i())},e[2]=i,e[3]=c):c=e[3];let d;e[4]!==t||e[5]!==r?(d=m.jsx(Ps,{icon:t,name:r,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=t,e[5]=r,e[6]=d):d=e[6];let u;e[7]!==r?(u=m.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:r}),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==s?(f=s&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s}),e[9]=s,e[10]=f):f=e[10];let h;e[11]!==u||e[12]!==f?(h=m.jsxs("div",{className:"flex-1 min-w-0",children:[u,f]}),e[11]=u,e[12]=f,e[13]=h):h=e[13];let p;return e[14]!==i||e[15]!==a||e[16]!==c||e[17]!==d||e[18]!==h?(p=m.jsxs("div",{className:a,onClick:i,role:"button",tabIndex:0,onKeyDown:c,children:[d,h]}),e[14]=i,e[15]=a,e[16]=c,e[17]=d,e[18]=h,e[19]=p):p=e[19],p}var to="Collapsible",[Rw,ah]=Mi(to),[jw,Bl]=Rw(to),ch=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...l}=n,[a,c]=Ds({prop:r,defaultProp:s??!1,onChange:i,caller:to});return m.jsx(jw,{scope:t,disabled:o,contentId:Lc(),open:a,onOpenToggle:M.useCallback(()=>c(d=>!d),[c]),children:m.jsx(On.div,{"data-state":Vl(a),"data-disabled":o?"":void 0,...l,ref:e})})});ch.displayName=to;var dh="CollapsibleTrigger",uh=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,...r}=n,s=Bl(dh,t);return m.jsx(On.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Vl(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Ve(n.onClick,s.onOpenToggle)})});uh.displayName=dh;var Fl="CollapsibleContent",fh=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Bl(Fl,n.__scopeCollapsible);return m.jsx(Ai,{present:t||s.open,children:({present:o})=>m.jsx(Dw,{...r,ref:e,present:o})})});fh.displayName=Fl;var Dw=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:r,children:s,...o}=n,i=Bl(Fl,t),[l,a]=M.useState(r),c=M.useRef(null),d=Oi(e,c),u=M.useRef(0),f=u.current,h=M.useRef(0),p=h.current,g=i.open||l,y=M.useRef(g),x=M.useRef(void 0);return M.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),zh(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();u.current=k.height,h.current=k.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),a(r)}},[i.open,r]),m.jsx(On.div,{"data-state":Vl(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...n.style},children:g&&s})});function Vl(n){return n?"open":"closed"}var Pw=ch,Lw=uh,$w=fh,Ke="Accordion",_w=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Hl,zw,Bw]=Bh(Ke),[no]=Mi(Ke,[Bw,ah]),Wl=ah(),hh=ee.forwardRef((n,e)=>{const{type:t,...r}=n,s=r,o=r;return m.jsx(Hl.Provider,{scope:n.__scopeAccordion,children:t==="multiple"?m.jsx(Ww,{...o,ref:e}):m.jsx(Hw,{...s,ref:e})})});hh.displayName=Ke;var[ph,Fw]=no(Ke),[mh,Vw]=no(Ke,{collapsible:!1}),Hw=ee.forwardRef((n,e)=>{const{value:t,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=n,[l,a]=Ds({prop:t,defaultProp:r??"",onChange:s,caller:Ke});return m.jsx(ph,{scope:n.__scopeAccordion,value:ee.useMemo(()=>l?[l]:[],[l]),onItemOpen:a,onItemClose:ee.useCallback(()=>o&&a(""),[o,a]),children:m.jsx(mh,{scope:n.__scopeAccordion,collapsible:o,children:m.jsx(gh,{...i,ref:e})})})}),Ww=ee.forwardRef((n,e)=>{const{value:t,defaultValue:r,onValueChange:s=()=>{},...o}=n,[i,l]=Ds({prop:t,defaultProp:r??[],onChange:s,caller:Ke}),a=ee.useCallback(d=>l((u=[])=>[...u,d]),[l]),c=ee.useCallback(d=>l((u=[])=>u.filter(f=>f!==d)),[l]);return m.jsx(ph,{scope:n.__scopeAccordion,value:i,onItemOpen:a,onItemClose:c,children:m.jsx(mh,{scope:n.__scopeAccordion,collapsible:!0,children:m.jsx(gh,{...o,ref:e})})})}),[qw,ro]=no(Ke),gh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,disabled:r,dir:s,orientation:o="vertical",...i}=n,l=ee.useRef(null),a=Oi(l,e),c=zw(t),u=Fh(s)==="ltr",f=Ve(n.onKeyDown,h=>{if(!_w.includes(h.key))return;const p=h.target,g=c().filter(T=>!T.ref.current?.disabled),y=g.findIndex(T=>T.ref.current===p),x=g.length;if(y===-1)return;h.preventDefault();let b=y;const k=0,C=x-1,S=()=>{b=y+1,b>C&&(b=k)},w=()=>{b=y-1,b<k&&(b=C)};switch(h.key){case"Home":b=k;break;case"End":b=C;break;case"ArrowRight":o==="horizontal"&&(u?S():w());break;case"ArrowDown":o==="vertical"&&S();break;case"ArrowLeft":o==="horizontal"&&(u?w():S());break;case"ArrowUp":o==="vertical"&&w();break}const v=b%x;g[v].ref.current?.focus()});return m.jsx(qw,{scope:t,disabled:r,direction:s,orientation:o,children:m.jsx(Hl.Slot,{scope:t,children:m.jsx(On.div,{...i,"data-orientation":o,ref:a,onKeyDown:r?void 0:f})})})}),js="AccordionItem",[Uw,ql]=no(js),yh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,value:r,...s}=n,o=ro(js,t),i=Fw(js,t),l=Wl(t),a=Lc(),c=r&&i.value.includes(r)||!1,d=o.disabled||n.disabled;return m.jsx(Uw,{scope:t,open:c,disabled:d,triggerId:a,children:m.jsx(Pw,{"data-orientation":o.orientation,"data-state":vh(c),...l,...s,ref:e,disabled:d,open:c,onOpenChange:u=>{u?i.onItemOpen(r):i.onItemClose(r)}})})});yh.displayName=js;var xh="AccordionHeader",bh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(xh,t);return m.jsx(On.h3,{"data-orientation":s.orientation,"data-state":vh(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:e})});bh.displayName=xh;var Ei="AccordionTrigger",kh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(Ei,t),i=Vw(Ei,t),l=Wl(t);return m.jsx(Hl.ItemSlot,{scope:t,children:m.jsx(Lw,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...r,ref:e})})});kh.displayName=Ei;var Sh="AccordionContent",wh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(Sh,t),i=Wl(t);return m.jsx($w,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...n.style}})});wh.displayName=Sh;function vh(n){return n?"open":"closed"}var Kw=hh,Jw=yh,Gw=bh,Xw=kh,Yw=wh;function Qw(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(Kw,{"data-slot":"accordion",...t}),e[2]=t,e[3]=r):r=e[3],r}function Zw(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("border-b last:border-b-0",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx(Jw,{"data-slot":"accordion-item",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function ev(n){const e=I.c(11);let t,r,s;e[0]!==n?({className:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=J("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",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Sp,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=i):i=e[6];let l;return e[7]!==t||e[8]!==s||e[9]!==o?(l=m.jsx(Gw,{className:"flex",children:m.jsxs(Xw,{"data-slot":"accordion-trigger",className:o,...s,children:[t,i]})}),e[7]=t,e[8]=s,e[9]=o,e[10]=l):l=e[10],l}function tv(n){const e=I.c(12);let t,r,s;e[0]!==n?({className:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=J("pt-0 pb-4",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]!==t||e[7]!==o?(i=m.jsx("div",{className:o,children:t}),e[6]=t,e[7]=o,e[8]=i):i=e[8];let l;return e[9]!==s||e[10]!==i?(l=m.jsx(Yw,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...s,children:i}),e[9]=s,e[10]=i,e[11]=l):l=e[11],l}var nv=(n,e,t,r,s,o,i,l)=>{let a=document.documentElement,c=["light","dark"];function d(h){(Array.isArray(n)?n:[n]).forEach(p=>{let g=p==="class",y=g&&o?s.map(x=>o[x]||x):s;g?(a.classList.remove(...y),a.classList.add(o&&o[h]?o[h]:h)):a.setAttribute(p,h)}),u(h)}function u(h){l&&c.includes(h)&&(a.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)d(r);else try{let h=localStorage.getItem(e)||t,p=i&&h==="system"?f():h;d(p)}catch{}};M.createContext(void 0);M.memo(({forcedTheme:n,storageKey:e,attribute:t,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,themes:l,nonce:a,scriptProps:c})=>{let d=JSON.stringify([t,e,o,n,l,i,r,s]).slice(1,-1);return M.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?a:"",dangerouslySetInnerHTML:{__html:`(${nv.toString()})(${d})`}})});function rv(n){const{updateStep:e}=Me(),r=n&&"toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,{tool:s}=Ul(r??"");n&&r&&s?.outputSchema&&(!n.outputSchema||Object.keys(n.outputSchema).length===0)&&queueMicrotask(()=>{e(n.name,{outputSchema:s.outputSchema})})}function sv(n){const e=I.c(25),{className:t}=n,r=pr(),{appendStep:s}=Me();if(rv(r),!r){let f;e[0]!==t?(f=J("flex flex-col h-full bg-sidebar",t),e[0]=t,e[1]=f):f=e[1];let h;e[2]!==s?(h=()=>{s({type:"tool"})},e[2]=s,e[3]=h):h=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Vc,{size:14}),e[4]=p):p=e[4];let g;e[5]!==h?(g=m.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",m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:h,children:p})]}),e[5]=h,e[6]=g):g=e[6];let y;return e[7]!==f||e[8]!==g?(y=m.jsx("div",{className:f,children:g}),e[7]=f,e[8]=g,e[9]=y):y=e[9],y}let o;e[10]!==t?(o=J("flex flex-col h-full bg-sidebar overflow-scroll",t),e[10]=t,e[11]=o):o=e[11];let i,l,a,c,d;e[12]!==r?(i=m.jsx(ov,{step:r}),l=m.jsx(lv,{step:r}),a=m.jsx(av,{step:r}),c=m.jsx(fv,{step:r}),d=m.jsx(mv,{step:r}),e[12]=r,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=d):(i=e[13],l=e[14],a=e[15],c=e[16],d=e[17]);let u;return e[18]!==o||e[19]!==i||e[20]!==l||e[21]!==a||e[22]!==c||e[23]!==d?(u=m.jsxs("div",{className:o,children:[i,l,a,c,d]}),e[18]=o,e[19]=i,e[20]=l,e[21]=a,e[22]=c,e[23]=d,e[24]=u):u=e[24],u}function ov(n){const e=I.c(15),{step:t}=n,s="toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,o=Se(),i=s??"";let l;e[0]!==i?(l=m.jsx(Ps,{icon:null,name:i,size:"xs",className:"shadow-sm"}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s?(a=m.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==o?(c=o?null:m.jsx(iv,{}),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d=m.jsxs("div",{className:"flex items-center gap-2",children:[l,a,c]}),e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];let u;e[10]!==t.description?(u=t.description&&m.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[10]=t.description,e[11]=u):u=e[11];let f;return e[12]!==d||e[13]!==u?(f=m.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14],f}function iv(){const n=I.c(9),e=pr(),{updateStep:t,startReplacingTool:r}=Me(),s=Se(),i=e&&"toolName"in e.action?e.action.toolName:null;let l;n[0]!==e||n[1]!==r||n[2]!==i||n[3]!==s||n[4]!==t?(l=()=>{if(e){if(s){jc.error("You cannot replace a tool while a workflow is executing.");return}i&&r(i),t(e.name,{action:{...e.action,toolName:""}})}},n[0]=e,n[1]=r,n[2]=i,n[3]=s,n[4]=t,n[5]=l):l=n[5];const a=l;let c;n[6]===Symbol.for("react.memo_cache_sentinel")?(c=m.jsx(nd,{size:14}),n[6]=c):c=n[6];let d;return n[7]!==a?(d=m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:c}),n[7]=a,n[8]=d):d=n[8],d}function Ul(n){const e=I.c(13),t=Dn();let r;e[0]!==t?(r=t?new URL(`/mcp/gateway/${t}`,window.location.origin).href:"",e[0]=t,e[1]=r):r=e[1];const s=r,o=!!t;let i;e[2]!==s||e[3]!==o?(i={url:s,enabled:o},e[2]=s,e[3]=o,e[4]=i):i=e[4];const l=Hi(i);let a;e[5]!==l.tools||e[6]!==n?(a=l.tools?.find(h=>h.name===n),e[5]=l.tools,e[6]=n,e[7]=a):a=e[7];const c=a,d=l.state==="connecting",u=l.state==="ready";let f;return e[8]!==l.error||e[9]!==d||e[10]!==u||e[11]!==c?(f={tool:c,isLoading:d,isReady:u,error:l.error},e[8]=l.error,e[9]=d,e[10]=u,e[11]=c,e[12]=f):f=e[12],f}function lv(n){const e=I.c(13),{step:t}=n,{updateStep:r}=Me(),o="toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,i=Se(),{tool:l}=Ul(o??"");if(!l||!l.inputSchema)return null;let a;e[0]!==t.name||e[1]!==r?(a=x=>{r(t.name,{input:x})},e[0]=t.name,e[1]=r,e[2]=a):a=e[2];const c=a,d=i?"output":"input";let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx(ev,{className:"px-5 py-5",children:m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=u):u=e[3];const f=l.inputSchema,h=t.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==c||e[6]!==t.name||e[7]!==f||e[8]!==h?(g=m.jsxs(Zw,{value:"input",className:"border-b-0",children:[u,m.jsx(tv,{className:"px-5 pt-2",children:m.jsx(lh,{inputSchema:f,inputParams:h,setInputParams:c,mentions:p},t.name)})]}),e[5]=c,e[6]=t.name,e[7]=f,e[8]=h,e[9]=g):g=e[9];let y;return e[10]!==d||e[11]!==g?(y=m.jsx(Qw,{type:"single",collapsible:!0,defaultValue:d,className:"border-b border-border shrink-0",children:g}),e[10]=d,e[11]=g,e[12]=y):y=e[12],y}function av(n){const e=I.c(24),{step:t}=n,r=t.outputSchema,[s,o]=M.useState(!1),i=Se(),{item:l}=Ln(i),a=!!(l?.completed_steps?.success?.includes(t.name)||l?.completed_steps?.error?.includes(t.name)),{output:c,error:d}=qm(i,a?t.name:void 0);let u;e[0]!==d||e[1]!==c?(u=c||(d?{error:d}:void 0),e[0]=d,e[1]=c,e[2]=u):u=e[2];const f=u,h=r&&typeof r=="object"?r.properties:void 0;let p;e[3]!==h?(p=h?Object.entries(h):[],e[3]=h,e[4]=p):p=e[4];const g=p,y=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let x;e[5]!==y?(x=J("flex flex-col border-b border-border",y),e[5]=y,e[6]=x):x=e[6];let b;e[7]!==s?(b=()=>o(!s),e[7]=s,e[8]=b):b=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=k):k=e[9];let C;e[10]!==s?(C=m.jsxs("div",{className:"flex items-center justify-between",children:[k,s?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[10]=s,e[11]=C):C=e[11];let S;e[12]!==b||e[13]!==C?(S=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:b,children:C}),e[12]=b,e[13]=C,e[14]=S):S=e[14];let w;e[15]!==f||e[16]!==s||e[17]!==g||e[18]!==i?(w=s&&m.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[i&&f?m.jsx(In,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}):null,!i&&g.map(cv)]}),e[15]=f,e[16]=s,e[17]=g,e[18]=i,e[19]=w):w=e[19];let v;return e[20]!==x||e[21]!==S||e[22]!==w?(v=m.jsxs("div",{className:x,children:[S,w]}),e[20]=x,e[21]=S,e[22]=w,e[23]=v):v=e[23],v}function cv(n){const[e,t]=n;return m.jsx(uv,{name:e,schema:t},e)}function dv(n){switch(n){case"string":return{Icon:Xc,color:"text-blue-500"};case"number":case"integer":return{Icon:Jc,color:"text-blue-500"};case"array":return{Icon:qc,color:"text-purple-500"};case"object":return{Icon:Wc,color:"text-orange-500"};case"boolean":return{Icon:Gc,color:"text-pink-500"};case"null":return{Icon:Ii,color:"text-gray-500"};default:return{Icon:Uc,color:"text-muted-foreground"}}}function uv(n){const e=I.c(28),{name:t,schema:r}=n,s=pr(),o=r.type??"unknown";let i,l,a,c,d;if(e[0]!==o){const{Icon:C,color:S}=dv(o);d="flex items-center gap-2",c="flex-1 flex items-center gap-2",i=C,l=14,a=J(S),e[0]=o,e[1]=i,e[2]=l,e[3]=a,e[4]=c,e[5]=d}else i=e[1],l=e[2],a=e[3],c=e[4],d=e[5];let u;e[6]!==i||e[7]!==l||e[8]!==a?(u=m.jsx(i,{size:l,className:a}),e[6]=i,e[7]=l,e[8]=a,e[9]=u):u=e[9];let f;e[10]!==t?(f=m.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[10]=t,e[11]=f):f=e[11];let h;e[12]!==c||e[13]!==u||e[14]!==f?(h=m.jsxs("div",{className:c,children:[u,f]}),e[12]=c,e[13]=u,e[14]=f,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(ed,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=s?.name;let y;e[17]!==g?(y=m.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=y):y=e[18];let x;e[19]!==t?(x=m.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:t}),e[19]=t,e[20]=x):x=e[20];let b;e[21]!==y||e[22]!==x?(b=m.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,y,x]}),e[21]=y,e[22]=x,e[23]=b):b=e[23];let k;return e[24]!==b||e[25]!==d||e[26]!==h?(k=m.jsxs("div",{className:d,children:[h,b]}),e[24]=b,e[25]=d,e[26]=h,e[27]=k):k=e[27],k}function fv(n){const e=I.c(29),{step:t}=n,{updateStep:r}=Me(),s=Se(),[o,i]=M.useState(!1),l="toolName"in t.action,a=l&&"toolName"in t.action?t.action.toolName:null,{tool:c}=Ul(a??""),d=l&&"transformCode"in t.action?t.action.transformCode??null:null;let u;e[0]!==c?(u=()=>{if(!c?.outputSchema)return`interface Input {
146
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=pi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=pi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ce.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Df.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Pf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Ff.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Hf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Ok.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Ik.configure(this.options.taskList)),n}});var Rk=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ne(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),jk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Dk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pk=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ne(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Mn({find:jk,type:this.type})]},addPasteRules(){return[Xt({find:Dk,type:this.type})]}}),Lk=Ie.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),$k=Zt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ne(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function _k(n={}){return new re({view(e){return new zk(e,n)}})}class zk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=u?p.bottom:p.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!o){let i=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=zd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ie extends q{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ie.valid(r)?new ie(r):q.near(r)}content(){return R.empty}eq(e){return e instanceof ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ie(e.resolve(t.pos))}getBookmark(){return new $l(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Bk(e)||!Fk(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ie.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(t>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(t>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=t;let a=e.doc.resolve(s);if(ie.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!$.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*t),r=!1;continue e}break}o=i,s+=t;let l=e.doc.resolve(s);if(ie.valid(l))return l}return null}}}ie.prototype.visible=!1;ie.findFrom=ie.findGapCursorFrom;q.jsonID("gapcursor",ie);class $l{constructor(e){this.pos=e}map(e){return new $l(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ie.valid(t)?new ie(t):q.near(t)}}function Wf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Bk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Wf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Fk(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Wf(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Vk(){return new re({props:{decorations:Uk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ie.valid(t)?new ie(t):null},handleClick:Wk,handleKeyDown:Hk,handleDOMEvents:{beforeinput:qk}}})}const Hk=Bu({ArrowLeft:jr("horiz",-1),ArrowRight:jr("horiz",1),ArrowUp:jr("vert",-1),ArrowDown:jr("vert",1)});function jr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof F){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ie.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new ie(c))),!0):!1}}function Wk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ie.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&$.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ie(r))),!0)}function qk(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ie))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=E.empty;for(let i=r.length-1;i>=0;i--)s=E.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new R(s,0,0));return o.setSelection(F.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Uk(n){if(!(n.selection instanceof ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",te.create(n.doc,[ve.widget(n.selection.head,e,{key:"gapcursor"})])}var Os=200,ye=function(){};ye.prototype.append=function(e){return e.length?(e=ye.from(e),!this.length&&e||e.length<Os&&this.leafAppend(e)||this.length<Os&&e.leafPrepend(this)||this.appendInner(e)):this};ye.prototype.prepend=function(e){return e.length?ye.from(e).append(this):this};ye.prototype.appendInner=function(e){return new Kk(this,e)};ye.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ye.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ye.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},t,r),s};ye.from=function(e){return e instanceof ye?e:e&&e.length?new qf(e):ye.empty};var qf=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Os)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Os)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ye);ye.empty=new qf([]);var Kk=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ye);const Jk=500;class He{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;t&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,d.push(u);return}if(s){d.push(new dt(u.map));let h=u.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+d.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(u.step);if(u.selection)return l=s?u.selection.map(s.slice(o)):u.selection,a=new He(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new dt(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(i++,t=void 0),s||(a=f)}let c=i-r.depth;return c>Xk&&(l=Gk(l,c),i-=c),new He(l.append(o),i)}remapping(e,t){let r=new or;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,t),r}addMaps(e){return this.eventCount==0?this:new He(this.items.append(e.map(t=>new dt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new dt(p,g,y))}else r.push(new dt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new dt(o.maps[f]));let d=this.items.slice(0,s).append(c).append(r),u=new He(d,l);return u.emptyItemCount()>Jk&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=i.selection&&i.selection.map(t.slice(r));d&&o++;let u=new dt(c.invert(),a,d),f,h=s.length-1;(f=s.length&&s[h].merge(u))?s[h]=f:s.push(u)}}else i.map&&r--},this.items.length,0),new He(ye.from(s.reverse()),o)}}He.empty=new He(ye.empty,0);function Gk(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}let dt=class Uf{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Uf(t.getMap().invert(),t,this.selection)}}};class pt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const Xk=20;function Yk(n,e,t,r){let s=t.getMeta(Wt),o;if(s)return s.historyState;t.getMeta(eS)&&(n=new pt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(Wt))return i.getMeta(Wt).redo?new pt(n.done.addTransform(t,void 0,r,zr(e)),n.undone,Tc(t.mapping.maps),n.prevTime,n.prevComposition):new pt(n.done,n.undone.addTransform(t,void 0,r,zr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Qk(t,n.prevRanges)),c=i?Fo(n.prevRanges,t.mapping):Tc(t.mapping.maps);return new pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,zr(e)),He.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new pt(n.done.rebased(t,o),n.undone.rebased(t,o),Fo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Fo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Qk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(t=!0)}),t}function Tc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,o,i)=>e.push(o,i));return e}function Fo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),o=e.map(n[r+1],-1);s<=o&&t.push(s,o)}return t}function Zk(n,e,t){let r=zr(e),s=Wt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new pt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(Wt,{redo:t,historyState:a})}let Vo=!1,Mc=null;function zr(n){let e=n.plugins;if(Mc!=e){Vo=!1,Mc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Vo=!0;break}}return Vo}const Wt=new ae("history"),eS=new ae("closeHistory");function tS(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new re({key:Wt,state:{init(){return new pt(He.empty,He.empty,null,0,-1)},apply(e,t,r){return Yk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Jf:r=="historyRedo"?Gf:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Kf(n,e){return(t,r)=>{let s=Wt.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=Zk(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Jf=Kf(!1,!0),Gf=Kf(!0,!0);ce.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new re({key:new ae("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var nS=ce.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_k(this.options)]}});ce.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new re({key:new ae("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return te.create(n,[]);let i=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(ve.node(c,c+a.nodeSize,{class:this.options.className}))}),te.create(n,o)}}})]}});var rS=ce.create({name:"gapCursor",addProseMirrorPlugins(){return[Vk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(L(n,"allowGapCursor",t)))!=null?e:null}}});ce.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new re({key:new ae("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&Js(i);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const u=ve.node(l,l+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(u)}return this.options.includeChildren}),te.create(n,s)}}})]}});ce.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new re({key:new ae("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||nf(t.selection)||n.view.dragging?null:te.create(t.doc,[ve.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ac({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var sS=ce.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ae(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new re({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,d=e.getState(i),u=l.content.size,f=c.nodes[t];if(d)return a.insert(u,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Ac({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!Ac({node:i,types:r})}}})]}}),oS=ce.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Jf(n,e),redo:()=>({state:n,dispatch:e})=>Gf(n,e)}},addProseMirrorPlugins(){return[tS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),iS=ce.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(jb.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Mb.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Df.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Lb.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(zb.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Bb.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(nS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(rS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Fb.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Vb.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(oS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Hb.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Jb.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Pf.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Ff.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(bk.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Hf.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Rk.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Pk.configure(this.options.strike)),this.options.text!==!1&&s.push(Lk.configure(this.options.text)),this.options.underline!==!1&&s.push($k.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(sS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),lS=iS;function aS(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:l}=n,a=r&&!s,c=Zx(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",f=s?"":c,h=a?new RegExp(`${u}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),b=new RegExp(`^[${o?.join("")}\0]?$`).test(x);if(o!==null&&!b)return null;const k=g+y.index;let C=k+y[0].length;return a&&d.test(p.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(t.length),text:y[0]}:null}var cS=new ae("suggestion");function dS({pluginKey:n=cS,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:f=()=>[],render:h=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=aS,shouldShow:y}){let x;const b=h?.(),k=()=>{const v=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(v),{top:O,right:D,bottom:j,left:z}=T;try{return new DOMRect(z,O,D-z,j-O)}catch{return null}},C=(v,T)=>T?()=>{const O=n.getState(e.state),D=O?.decorationId,j=v.dom.querySelector(`[data-decoration-id="${D}"]`);return j?.getBoundingClientRect()||null}:k;function S(v,T){var O;try{const j=n.getState(v.state),z=j?.decorationId?v.dom.querySelector(`[data-decoration-id="${j.decorationId}"]`):null,V={editor:e,range:j?.range||{from:0,to:0},query:j?.query||null,text:j?.text||null,items:[],command:B=>u({editor:e,range:j?.range||{from:0,to:0},props:B}),decorationNode:z,clientRect:C(v,z)};(O=b?.onExit)==null||O.call(b,V)}catch{}const D=v.state.tr.setMeta(T,{exit:!0});v.dispatch(D)}const w=new re({key:n,view(){return{update:async(v,T)=>{var O,D,j,z,V,B,H;const N=(O=this.key)==null?void 0:O.getState(T),_=(D=this.key)==null?void 0:D.getState(v.state),P=N.active&&_.active&&N.range.from!==_.range.from,U=!N.active&&_.active,Q=N.active&&!_.active,le=!U&&!Q&&N.query!==_.query,X=U||P&&le,fe=le||P,se=Q||P&&le;if(!X&&!fe&&!se)return;const K=se&&!X?N:_,Fe=v.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);x={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:at=>u({editor:e,range:K.range,props:at}),decorationNode:Fe,clientRect:C(v,Fe)},X&&((j=b?.onBeforeStart)==null||j.call(b,x)),fe&&((z=b?.onBeforeUpdate)==null||z.call(b,x)),(fe||X)&&(x.items=await f({editor:e,query:K.query})),se&&((V=b?.onExit)==null||V.call(b,x)),fe&&((B=b?.onUpdate)==null||B.call(b,x)),X&&((H=b?.onStart)==null||H.call(b,x))},destroy:()=>{var v;x&&((v=b?.onExit)==null||v.call(b,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(v,T,O,D){const{isEditable:j}=e,{composing:z}=e.view,{selection:V}=v,{empty:B,from:H}=V,N={...T},_=v.getMeta(n);if(_&&_.exit)return N.active=!1,N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null,N;if(N.composing=z,j&&(B||e.view.composing)){(H<T.range.from||H>T.range.to)&&!z&&!T.composing&&(N.active=!1);const P=g({char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:V.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;P&&p({editor:e,state:D,range:P.range,isActive:T.active})&&(!y||y({editor:e,range:P.range,query:P.query,text:P.text,transaction:v}))?(N.active=!0,N.decorationId=T.decorationId?T.decorationId:U,N.range=P.range,N.query=P.query,N.text=P.text):N.active=!1}else N.active=!1;return N.active||(N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null),N}},props:{handleKeyDown(v,T){var O,D,j,z;const{active:V,range:B}=w.getState(v.state);if(!V)return!1;if(T.key==="Escape"||T.key==="Esc"){const N=w.getState(v.state),_=(O=x?.decorationNode)!=null?O:null,P=_??(N?.decorationId?v.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null);if(((D=b?.onKeyDown)==null?void 0:D.call(b,{view:v,event:T,range:N.range}))||!1)return!0;const Q={editor:e,range:N.range,query:N.query,text:N.text,items:[],command:le=>u({editor:e,range:N.range,props:le}),decorationNode:P,clientRect:P?()=>P.getBoundingClientRect()||null:null};return(j=b?.onExit)==null||j.call(b,Q),S(v,n),!0}return((z=b?.onKeyDown)==null?void 0:z.call(b,{view:v,event:T,range:B}))||!1},decorations(v){const{active:T,range:O,decorationId:D,query:j}=w.getState(v);if(!T)return null;const z=!j?.length,V=[a];return z&&V.push(d),te.create(v.doc,[ve.inline(O.from,O.to,{nodeName:l,class:V.join(" "),"data-decoration-id":D,"data-decoration-content":c})])}}});return w}function uS({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){const s=new ae;return{editor:n,char:r,pluginKey:s,command:({editor:o,range:i,props:l})=>{var a,c,d;const u=o.view.state.selection.$to.nodeAfter;(a=u?.text)!=null&&a.startsWith(" ")&&(i.to+=1),o.chain().focus().insertContentAt(i,[{type:t,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(d=(c=o.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||d.collapseToEnd()},allow:({state:o,range:i})=>{const l=o.doc.resolve(i.from),a=o.schema.nodes[t];return!!l.parent.type.contentMatch.matchType(a)},...e}}function Xf(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>uS({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Oc(n,e){const t=Xf(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}var fS=Ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!=null?t:"@"}${(r=n.attrs.label)!=null?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,s;return["span",ne(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=Oc(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",ne({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=ne({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",ne({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...kf({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,o,i]=r,l=o??i;e[s==="char"?"mentionSuggestionChar":s]=l,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:Oc(this,n.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:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:s,anchor:o}=r;if(!s)return!1;let i=new _e,l=0;return e.doc.nodesBetween(o-1,o,(a,c)=>{if(a.type.name===this.name)return t=!0,i=a,l=c,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":i.attrs.mentionSuggestionChar,l,l+i.nodeSize),t})}},addProseMirrorPlugins(){return Xf(this).map(dS)}}),hS=fS,Ho,Qs="HoverCard",[Yf]=Mi(Qs,[Pc]),Zs=Pc(),[pS,eo]=Yf(Qs),Qf=n=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:s,onOpenChange:o,openDelay:i=700,closeDelay:l=300}=n,a=Zs(e),c=M.useRef(0),d=M.useRef(0),u=M.useRef(!1),f=M.useRef(!1),[h,p]=Ds({prop:r,defaultProp:s??!1,onChange:o,caller:Qs}),g=M.useCallback(()=>{clearTimeout(d.current),c.current=window.setTimeout(()=>p(!0),i)},[i,p]),y=M.useCallback(()=>{clearTimeout(c.current),!u.current&&!f.current&&(d.current=window.setTimeout(()=>p(!1),l))},[l,p]),x=M.useCallback(()=>p(!1),[p]);return M.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(d.current)},[]),m.jsx(pS,{scope:e,open:h,onOpenChange:p,onOpen:g,onClose:y,onDismiss:x,hasSelectionRef:u,isPointerDownOnContentRef:f,children:m.jsx(Dh,{...a,children:t})})};Qf.displayName=Qs;var Zf="HoverCardTrigger",eh=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,...r}=n,s=eo(Zf,t),o=Zs(t);return m.jsx(Rh,{asChild:!0,...o,children:m.jsx(On.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:Ve(n.onPointerEnter,Rs(s.onOpen)),onPointerLeave:Ve(n.onPointerLeave,Rs(s.onClose)),onFocus:Ve(n.onFocus,s.onOpen),onBlur:Ve(n.onBlur,s.onClose),onTouchStart:Ve(n.onTouchStart,i=>i.preventDefault())})})});eh.displayName=Zf;var _l="HoverCardPortal",[mS,gS]=Yf(_l,{forceMount:void 0}),th=n=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:s}=n,o=eo(_l,e);return m.jsx(mS,{scope:e,forceMount:t,children:m.jsx(Ai,{present:t||o.open,children:m.jsx(jh,{asChild:!0,container:s,children:r})})})};th.displayName=_l;var Is="HoverCardContent",nh=M.forwardRef((n,e)=>{const t=gS(Is,n.__scopeHoverCard),{forceMount:r=t.forceMount,...s}=n,o=eo(Is,n.__scopeHoverCard);return m.jsx(Ai,{present:r||o.open,children:m.jsx(yS,{"data-state":o.open?"open":"closed",...s,onPointerEnter:Ve(n.onPointerEnter,Rs(o.onOpen)),onPointerLeave:Ve(n.onPointerLeave,Rs(o.onClose)),ref:e})})});nh.displayName=Is;var yS=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,...l}=n,a=eo(Is,t),c=Zs(t),d=M.useRef(null),u=Oi(e,d),[f,h]=M.useState(!1);return M.useEffect(()=>{if(f){const p=document.body;return Ho=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Ho,p.style.webkitUserSelect=Ho}}},[f]),M.useEffect(()=>{if(d.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),M.useEffect(()=>{d.current&&kS(d.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(Ph,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:Ve(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(Lh,{...c,...l,onPointerDown:Ve(l.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:u,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"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)"}})})}),xS="HoverCardArrow",bS=M.forwardRef((n,e)=>{const{__scopeHoverCard:t,...r}=n,s=Zs(t);return m.jsx($h,{...s,...r,ref:e})});bS.displayName=xS;function Rs(n){return e=>e.pointerType==="touch"?void 0:n()}function kS(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var SS=Qf,wS=eh,vS=th,CS=nh;function NS(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(SS,{"data-slot":"hover-card",...t}),e[2]=t,e[3]=r):r=e[3],r}function ES(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(wS,{"data-slot":"hover-card-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function TS(n){const e=I.c(12);let t,r,s,o;e[0]!==n?({className:t,align:s,sideOffset:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"center":s,l=o===void 0?4:o;let a;e[5]!==t?(a=J("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",t),e[5]=t,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==a?(c=m.jsx(vS,{"data-slot":"hover-card-portal",children:m.jsx(CS,{"data-slot":"hover-card-content",align:i,sideOffset:l,className:a,...r})}),e[7]=i,e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11],c}const rh=M.createContext(void 0);function MS(n,e){const t=e.split("."),r=t[0];if(!r)return;let s=n[r];for(let o=1;o<t.length&&s!==void 0;o++){const i=t[o];if(i)if(typeof s=="object"&&s!==null)s=s[i];else return}return s}function AS(n){const e=I.c(20),{node:t}=n,r=M.useContext(rh),s=t.attrs.id??"",o=r!==void 0;let i;if(e[0]!==o||e[1]!==s||e[2]!==r){const g=o?MS(r,s):void 0;i=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):void 0,e[0]=o,e[1]=s,e[2]=r,e[3]=i}else i=e[3];const l=i;let a;e[4]!==s?(a=m.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",s]}),e[4]=s,e[5]=a):a=e[5];const c=a;if(!o||l===void 0){let g;return e[6]!==c?(g=m.jsx(fc,{as:"span",children:c}),e[6]=c,e[7]=g):g=e[7],g}let d;e[8]!==c?(d=m.jsx(ES,{asChild:!0,children:c}),e[8]=c,e[9]=d):d=e[9];let u;e[10]!==s?(u=m.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",s]}),e[10]=s,e[11]=u):u=e[11];let f;e[12]!==l?(f=m.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:l}),e[12]=l,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==f?(h=m.jsx(TS,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:m.jsxs("div",{className:"space-y-1.5",children:[u,f]})}),e[14]=u,e[15]=f,e[16]=h):h=e[16];let p;return e[17]!==d||e[18]!==h?(p=m.jsx(fc,{as:"span",children:m.jsxs(NS,{openDelay:200,children:[d,h]})}),e[17]=d,e[18]=h,e[19]=p):p=e[19],p}function sh(n){const e=[];function t(r){for(const s of r)s.children?.length||e.push(s),s.children&&t(s.children)}return t(n),e}let Xe=oh();function oh(){return Yi(()=>({items:[],selectedIndex:0,command:null}))}function Ic(n,e){Xe.setState({items:n,command:e,selectedIndex:0})}function OS(){const{items:n,selectedIndex:e}=Xe.getState();n.length&&Xe.setState({selectedIndex:(e-1+n.length)%n.length})}function IS(){const{items:n,selectedIndex:e}=Xe.getState();n.length&&Xe.setState({selectedIndex:(e+1)%n.length})}function ih(){const{items:n,selectedIndex:e,command:t}=Xe.getState(),r=n[e];return r?(t?.(r),!0):!1}function Rc(){Xe=oh()}function RS(){const n=I.c(7),e=Ko(Xe,DS),t=Ko(Xe,jS);if(!e.length)return null;let r;if(n[0]!==e||n[1]!==t){let o;n[3]!==t?(o=(i,l)=>m.jsx("button",{type:"button",onClick:()=>{Xe.setState({selectedIndex:l}),ih()},className:J("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",l===t?"bg-accent text-accent-foreground":"hover:bg-muted"),children:i.label},i.id),n[3]=t,n[4]=o):o=n[4],r=e.map(o),n[0]=e,n[1]=t,n[2]=r}else r=n[2];let s;return n[5]!==r?(s=m.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:m.jsx("div",{className:"p-1",children:r})}),n[5]=r,n[6]=s):s=n[6],s}function jS(n){return n.selectedIndex}function DS(n){return n.items}function PS(){let n=null,e=null;return{onStart:t=>{Ic(t.items,t.command),n=new Cf(RS,{editor:t.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const r=t.clientRect?.();r&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`),e.appendChild(n.element),document.body.appendChild(e)},onUpdate:t=>{Ic(t.items,t.command);const r=t.clientRect?.();r&&e&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`)},onKeyDown:({event:t})=>t.key==="Escape"?(e?.remove(),n?.destroy(),Rc(),!0):t.key==="ArrowUp"?(OS(),!0):t.key==="ArrowDown"?(IS(),!0):t.key==="Enter"?ih():!1,onExit:()=>{e?.remove(),n?.destroy(),Rc()}}}const Wo=/@([\w.]+)/g;function LS(n,e){if(!n)return null;const t=sh(e),r=new Map(t.map(a=>[a.id,a]));if(!Wo.test(n))return n;Wo.lastIndex=0;const o=[];let i=0,l;for(;(l=Wo.exec(n))!==null;){const a=l[1]??"",c=l.index;c>i&&o.push({type:"text",text:n.slice(i,c)});const d=r.get(a);d?o.push({type:"mention",attrs:{id:d.id,label:d.label}}):o.push({type:"text",text:l[0]}),i=c+l[0].length}return i<n.length&&o.push({type:"text",text:n.slice(i)}),{type:"doc",content:[{type:"paragraph",content:o.length>0?o:void 0}]}}function zl(n){const e=I.c(31),{mentions:t,value:r,onChange:s,placeholder:o,className:i,readOnly:l}=n,a=eg();let c;e[0]!==t||e[1]!==r?(c=LS(r,t),e[0]=t,e[1]=r,e[2]=c):c=e[2];const d=c,u=a!==void 0,f=!l;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=lS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==t||e[5]!==u){let O;e[7]!==t?(O=D=>{const{query:j}=D;return sh(t).filter(V=>V.label.toLowerCase().includes(j.toLowerCase())||V.id.toLowerCase().includes(j.toLowerCase()))},e[7]=t,e[8]=O):O=e[8],p=hS.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:BS,renderHTML:zS,suggestion:{items:O,render:PS,command:_S}}).extend(u?{addNodeView(){return Eb(AS)}}:{}),e[4]=t,e[5]=u,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[h,p],e[9]=p,e[10]=g):g=e[10];const y=o??"";let x;e[11]!==y?(x={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":y},handleKeyDown:$S},e[11]=y,e[12]=x):x=e[12];let b;e[13]!==s?(b=O=>{const{editor:D}=O;return s?.(D.getText().trim())},e[13]=s,e[14]=b):b=e[14];let k;e[15]!==d||e[16]!==f||e[17]!==g||e[18]!==x||e[19]!==b?(k={content:d,editable:f,extensions:g,editorProps:x,onUpdate:b},e[15]=d,e[16]=f,e[17]=g,e[18]=x,e[19]=b,e[20]=k):k=e[20];const C=bb(k);let S;e[21]!==i?(S=J("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",i),e[21]=i,e[22]=S):S=e[22];let w;e[23]!==C?(w=m.jsx(fb,{editor:C}),e[23]=C,e[24]=w):w=e[24];let v;e[25]!==S||e[26]!==w?(v=m.jsx("div",{className:S,children:w}),e[25]=S,e[26]=w,e[27]=v):v=e[27];const T=v;if(a!==void 0){let O;return e[28]!==T||e[29]!==a?(O=m.jsx(rh.Provider,{value:a,children:T}),e[28]=T,e[29]=a,e[30]=O):O=e[30],O}return T}function $S(n,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function _S(n){const{editor:e,range:t,props:r}=n;e.chain().focus().insertContentAt(t,[{type:"mention",attrs:r}]).run()}function zS(n){const{options:e,node:t}=n;return["span",e.HTMLAttributes,`@${t.attrs.id}`]}function BS(n){const{node:e}=n;return`@${e.attrs.id}`}function FS(n){const e=I.c(8),{value:t,onChange:r,placeholder:s,readonly:o}=n,i=fd(),l=t??"";let a;e[0]!==r?(a=u=>r(u),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let d;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(d=m.jsx(zl,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d):d=e[7],d}function VS(n){const e=I.c(8),{value:t,onChange:r,placeholder:s,readonly:o}=n,i=fd(),l=t??"";let a;e[0]!==r?(a=u=>r(u),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let d;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(d=m.jsx(zl,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o,className:"min-h-[80px]"}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d):d=e[7],d}function HS(n){const e=I.c(8),{value:t,onChange:r,readonly:s,id:o}=n,i=t??"";let l;e[0]!==r?(l=d=>r(d.target.value===""?void 0:Number(d.target.value)),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=J("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 c;return e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==l?(c=m.jsx("input",{id:o,type:"number",value:i,onChange:l,disabled:s,className:a}),e[3]=o,e[4]=s,e[5]=i,e[6]=l,e[7]=c):c=e[7],c}function WS(n){const e=I.c(13),{value:t,onChange:r,readonly:s,id:o,label:i}=n,l=t??!1;let a;e[0]!==r?(a=f=>r(f.target.checked),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o||e[3]!==s||e[4]!==l||e[5]!==a?(c=m.jsx("input",{id:o,type:"checkbox",checked:l,onChange:a,disabled:s,className:"h-4 w-4 rounded border-input"}),e[2]=o,e[3]=s,e[4]=l,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==i?(d=m.jsx("span",{className:"text-sm",children:i}),e[7]=i,e[8]=d):d=e[8];let u;return e[9]!==o||e[10]!==c||e[11]!==d?(u=m.jsxs("label",{htmlFor:o,className:"flex items-center gap-2 cursor-pointer",children:[c,d]}),e[9]=o,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function qS(n){const e=I.c(14),{value:t,onChange:r,readonly:s,id:o,options:i}=n;let l;e[0]!==i.enumOptions?(l=i.enumOptions??[],e[0]=i.enumOptions,e[1]=l):l=e[1];const a=l,c=t??"";let d;e[2]!==r?(d=g=>r(g.target.value),e[2]=r,e[3]=d):d=e[3];let u,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=J("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"),f=m.jsx("option",{value:"",children:"Select..."}),e[4]=u,e[5]=f):(u=e[4],f=e[5]);let h;e[6]!==a?(h=a.map(US),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==o||e[9]!==s||e[10]!==c||e[11]!==d||e[12]!==h?(p=m.jsxs("select",{id:o,value:c,onChange:d,disabled:s,className:u,children:[f,h]}),e[8]=o,e[9]=s,e[10]=c,e[11]=d,e[12]=h,e[13]=p):p=e[13],p}function US(n){return m.jsx("option",{value:String(n.value),children:String(n.label)},String(n.value))}const KS={TextWidget:FS,TextareaWidget:VS,NumberWidget:HS,CheckboxWidget:WS,SelectWidget:qS};function JS(n){switch(Array.isArray(n)?n[0]:n??"unknown"){case"string":return{Icon:Xc,color:"text-blue-500"};case"number":case"integer":return{Icon:Jc,color:"text-blue-500"};case"array":return{Icon:qc,color:"text-purple-500"};case"object":return{Icon:Wc,color:"text-orange-500"};case"boolean":return{Icon:Gc,color:"text-pink-500"};case"null":return{Icon:Ii,color:"text-gray-500"};default:return{Icon:Uc,color:"text-muted-foreground"}}}function GS(n){const e=I.c(36),{id:t,label:r,required:s,description:o,children:i,schema:l,hidden:a}=n;if(a){let S;return e[0]!==i?(S=m.jsx("div",{className:"hidden",children:i}),e[0]=i,e[1]=S):S=e[1],S}if(t==="root"){let S;return e[2]!==i?(S=m.jsx("div",{className:"space-y-4",children:i}),e[2]=i,e[3]=S):S=e[3],S}const c=Array.isArray(l.type)?l.type[0]:l.type??"string";let d,u,f,h,p,g,y;if(e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==c){const{Icon:S,color:w}=JS(c);y="space-y-2",h="flex items-center gap-2",e[15]!==t||e[16]!==r?(p=m.jsx("label",{htmlFor:t,className:"text-sm font-medium leading-none",children:r}),e[15]=t,e[16]=r,e[17]=p):p=e[17],e[18]!==s?(g=s&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=s,e[19]=g):g=e[19],d=S,u=14,f=J(w,"ml-auto"),e[4]=t,e[5]=r,e[6]=s,e[7]=c,e[8]=d,e[9]=u,e[10]=f,e[11]=h,e[12]=p,e[13]=g,e[14]=y}else d=e[8],u=e[9],f=e[10],h=e[11],p=e[12],g=e[13],y=e[14];let x;e[20]!==d||e[21]!==u||e[22]!==f?(x=m.jsx(d,{size:u,className:f}),e[20]=d,e[21]=u,e[22]=f,e[23]=x):x=e[23];let b;e[24]!==h||e[25]!==p||e[26]!==g||e[27]!==x?(b=m.jsxs("div",{className:h,children:[p,g,x]}),e[24]=h,e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28];let k;e[29]!==o?(k=o&&m.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o}),e[29]=o,e[30]=k):k=e[30];let C;return e[31]!==i||e[32]!==y||e[33]!==b||e[34]!==k?(C=m.jsxs("div",{className:y,children:[b,k,i]}),e[31]=i,e[32]=y,e[33]=b,e[34]=k,e[35]=C):C=e[35],C}function XS(n){const e=I.c(8),{properties:t,title:r}=n;if(!r||r==="Root"){let l;e[0]!==t?(l=t.map(QS),e[0]=t,e[1]=l):l=e[1];let a;return e[2]!==l?(a=m.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=a):a=e[3],a}let o;e[4]!==t?(o=t.map(YS),e[4]=t,e[5]=o):o=e[5];let i;return e[6]!==o?(i=m.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:o}),e[6]=o,e[7]=i):i=e[7],i}function YS(n){return m.jsx("div",{children:n.content},n.name)}function QS(n){return m.jsx("div",{children:n.content},n.name)}function ZS(n){const e=I.c(11),{items:t,canAdd:r,onAddClick:s,title:o}=n;let i;e[0]!==t?(i=t.map(ew),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=m.jsx("div",{className:"space-y-2",children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==s||e[6]!==o?(a=r&&m.jsxs(me,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:s,children:["+ Add ",o||"item"]}),e[4]=r,e[5]=s,e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==a?(c=m.jsxs("div",{className:"space-y-2",children:[l,a]}),e[8]=l,e[9]=a,e[10]=c):c=e[10],c}function ew(n){return m.jsx("div",{className:"flex gap-2 items-start",children:m.jsx("div",{className:"flex-1",children:n})},n.key||n.index)}function tw(){return null}function nw(){return null}const rw={FieldTemplate:GS,ObjectFieldTemplate:XS,ArrayFieldTemplate:ZS,UnsupportedFieldTemplate:tw,ErrorListTemplate:nw};function sw(n){const e=I.c(6),{inputSchema:t,inputParams:r,mentions:s}=n;if(!t?.properties||!r)return null;let o;e[0]!==s?(o=(a,c,d)=>{const u=typeof c=="object"&&c!==null?JSON.stringify(c,null,2):String(c??""),f=Array.isArray(d.type)?d.type.join(" | "):d.type??"string";return m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),m.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:f})]}),d.description&&m.jsx("div",{className:"text-xs text-muted-foreground",children:d.description}),m.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:m.jsx(zl,{mentions:s,value:u,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=s,e[1]=o):o=e[1];const i=o;let l;return e[2]!==r||e[3]!==t.properties||e[4]!==i?(l=m.jsx("div",{className:"space-y-4",children:Object.entries(t.properties).map(a=>{const[c,d]=a,u=r[c];return i(c,u,d)})}),e[2]=r,e[3]=t.properties,e[4]=i,e[5]=l):l=e[5],l}function lh({inputSchema:n,inputParams:e,setInputParams:t,handleInputChange:r,mentions:s,readOnly:o}){const i=s??[];if(!n)return m.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(o)return m.jsx(sw,{inputSchema:n,inputParams:e,mentions:i});const l=n,a=M.useRef(e??{}),c=d=>{const u=d.formData??{},f=a.current;if(t?.(u),r){for(const[h,p]of Object.entries(u))f[h]!==p&&r(h,p);for(const h of Object.keys(f))h in u||r(h,void 0)}a.current=u};return m.jsx(ud.Provider,{value:i,children:m.jsx(ep,{schema:l,formData:e,onChange:c,validator:tp,widgets:KS,templates:rw,readonly:o,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:m.jsx(m.Fragment,{})})})}function ow(n){const e=I.c(33),{open:t,onOpenChange:r,inputSchema:s,onSubmit:o,isPending:i}=n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[a,c]=M.useState(l);let d;e[1]!==a||e[2]!==r||e[3]!==o?(d=async()=>{await o(a),r(!1),c({})},e[1]=a,e[2]=r,e[3]=o,e[4]=d):d=e[4];const u=d;let f;e[5]!==r?(f=T=>{T||c({}),r(T)},e[5]=r,e[6]=f):f=e[6];const h=f;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsxs(up,{children:[m.jsx(fp,{children:"Workflow Input"}),m.jsx(hp,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let y;e[9]!==a||e[10]!==s?(y=m.jsx("div",{className:"py-4",children:m.jsx(lh,{inputSchema:s,inputParams:a,setInputParams:c,mentions:g})}),e[9]=a,e[10]=s,e[11]=y):y=e[11];let x;e[12]!==h?(x=()=>h(!1),e[12]=h,e[13]=x):x=e[13];let b;e[14]!==i||e[15]!==x?(b=m.jsx(me,{variant:"outline",onClick:x,disabled:i,children:"Cancel"}),e[14]=i,e[15]=x,e[16]=b):b=e[16];let k;e[17]!==i?(k=i?m.jsx(Ls,{size:"xs"}):m.jsx(Fi,{size:14}),e[17]=i,e[18]=k):k=e[18];let C;e[19]!==u||e[20]!==i||e[21]!==k?(C=m.jsxs(me,{onClick:u,disabled:i,className:"gap-2",children:[k,"Run Workflow"]}),e[19]=u,e[20]=i,e[21]=k,e[22]=C):C=e[22];let S;e[23]!==C||e[24]!==b?(S=m.jsxs(pp,{children:[b,C]}),e[23]=C,e[24]=b,e[25]=S):S=e[25];let w;e[26]!==S||e[27]!==y?(w=m.jsxs(mp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,y,S]}),e[26]=S,e[27]=y,e[28]=w):w=e[28];let v;return e[29]!==h||e[30]!==t||e[31]!==w?(v=m.jsx(gp,{open:t,onOpenChange:h,children:w}),e[29]=h,e[30]=t,e[31]=w,e[32]=v):v=e[32],v}function iw(n){const e=I.c(26),{title:t,description:r,onSave:s}=n,i=Ti().location.href,{viewMode:l,setViewMode:a,showExecutionsList:c,toggleExecutionsList:d}=Qi(),{resetToOriginalWorkflow:u,setSelectedGatewayId:f}=Me(),h=cd(),p=Dn(),g=Se();let y;e[0]!==t?(y=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t}),e[0]=t,e[1]=y):y=e[1];let x;e[2]!==r?(x=r?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:r})]}):null,e[2]=r,e[3]=x):x=e[3];let b;e[4]!==y||e[5]!==x?(b=m.jsx(Fc,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,x]})}),e[4]=y,e[5]=x,e[6]=b):b=e[6];let k;e[7]!==h||e[8]!==s||e[9]!==u||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==c||e[14]!==t||e[15]!==d||e[16]!==g||e[17]!==i||e[18]!==l?(k=!g&&m.jsxs(m.Fragment,{children:[m.jsx(Pi,{title:t,url:i,icon:"workflow"}),m.jsx(M.Suspense,{fallback:m.jsx(Ls,{size:"xs"}),children:m.jsx(lp,{selectedGatewayId:p??void 0,onGatewayChange:f,variant:"bordered",placeholder:"Select Agent"})}),m.jsx(ap,{value:l,onValueChange:a,size:"sm",options:[{value:"visual",icon:m.jsx(cp,{})},{value:"code",icon:m.jsx(Zc,{})}]}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:u,disabled:!h,"aria-label":"Reset changes",children:m.jsx(Bc,{size:14})})})}),m.jsx($t,{side:"bottom",children:"Reset changes"})]})}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:s,disabled:!h,"aria-label":"Save workflow",children:m.jsx(Xi,{size:14})})})}),m.jsx($t,{side:"bottom",children:"Save workflow"})]})}),m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:c?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:d,"aria-label":c?"Hide runs":"Show runs",children:m.jsx(Qc,{size:14})})})}),m.jsx($t,{side:"bottom",children:c?"Hide runs":"Show runs"})]})})]}),e[7]=h,e[8]=s,e[9]=u,e[10]=p,e[11]=f,e[12]=a,e[13]=c,e[14]=t,e[15]=d,e[16]=g,e[17]=i,e[18]=l,e[19]=k):k=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=m.jsx(cw,{}),e[20]=C):C=e[20];let S;e[21]!==k?(S=m.jsxs(Bi,{children:[k,C]}),e[21]=k,e[22]=S):S=e[22];let w;return e[23]!==b||e[24]!==S?(w=m.jsxs(m.Fragment,{children:[b,S]}),e[23]=b,e[24]=S,e[25]=w):w=e[25],w}function lw(){const n=Se(),{item:e}=Ln(n);return e?.completed_at_epoch_ms!=null}function aw(){const n=Se(),{item:e}=Ln(n);return e?.status==="cancelled"}function cw(){const n=I.c(57),e=cd(),t=lw(),r=aw(),s=Se(),o=Dn(),{handleRunWorkflow:i,isPending:l,requiresInput:a,inputSchema:c}=Ym(),d=mr(),[u,f]=M.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=Qm(),{handleResumeWorkflow:g,isResuming:y}=Zm(),x=s&&!t;let b;n[0]!==d?(b=d.some(dw),n[0]=d,n[1]=b):b=n[1];const k=b,C=!o,S=e||k||C||l||p,w=x||l;let v;n[2]!==k||n[3]!==C||n[4]!==e||n[5]!==r||n[6]!==w?(v=()=>r?"Workflow is currently cancelled":w?"Workflow is currently running":e?"Save your changes before running":C?"Select an Agent first":k?"Add at least one step to the workflow":null,n[2]=k,n[3]=C,n[4]=e,n[5]=r,n[6]=w,n[7]=v):v=n[7];const O=v();let D;n[8]!==h||n[9]!==g||n[10]!==i||n[11]!==c||n[12]!==r||n[13]!==w||n[14]!==a||n[15]!==s?(D=async()=>{if(a&&c){f(!0);return}if(r&&s){await g(s);return}if(w&&s){await h(s);return}await i({})},n[8]=h,n[9]=g,n[10]=i,n[11]=c,n[12]=r,n[13]=w,n[14]=a,n[15]=s,n[16]=D):D=n[16];const j=D;let z;n[17]!==i?(z=async Fe=>{await i(Fe)},n[17]=i,n[18]=z):z=n[18];const V=z,B=r?"Resume":s?t?"Replay":"Running...":a?"Run with input...":"Run workflow",H=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;n[19]!==H?(N=J("gap-2 h-7 px-3",H),n[19]=H,n[20]=N):N=n[20];let _;n[21]!==p||n[22]!==r||n[23]!==l||n[24]!==y||n[25]!==x?(_=(!x&&!l&&!p&&!y||r)&&m.jsx(Fi,{size:14}),n[21]=p,n[22]=r,n[23]=l,n[24]=y,n[25]=x,n[26]=_):_=n[26];let P;n[27]!==p||n[28]!==r||n[29]!==l||n[30]!==y||n[31]!==x?(P=x&&!l&&!p&&!y&&!r&&m.jsx(dp,{size:14}),n[27]=p,n[28]=r,n[29]=l,n[30]=y,n[31]=x,n[32]=P):P=n[32];let U;n[33]!==p||n[34]!==l||n[35]!==y?(U=(l||p||y)&&m.jsx(Ls,{size:"xs"}),n[33]=p,n[34]=l,n[35]=y,n[36]=U):U=n[36];let Q;n[37]!==B||n[38]!==j||n[39]!==S||n[40]!==N||n[41]!==_||n[42]!==P||n[43]!==U?(Q=m.jsxs(me,{variant:"default",size:"sm",className:N,disabled:S,onClick:j,children:[_,P,U,B]}),n[37]=B,n[38]=j,n[39]=S,n[40]=N,n[41]=_,n[42]=P,n[43]=U,n[44]=Q):Q=n[44];const le=Q;let X;n[45]!==le||n[46]!==O?(X=O?m.jsx(_t,{children:m.jsxs(zt,{delayDuration:0,children:[m.jsx(Lt,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:le})}),m.jsx($t,{side:"bottom",children:O})]})}):le,n[45]=le,n[46]=O,n[47]=X):X=n[47];const fe=X;let se;n[48]!==V||n[49]!==c||n[50]!==l||n[51]!==a||n[52]!==u?(se=a&&c&&m.jsx(ow,{open:u,onOpenChange:f,inputSchema:c,onSubmit:V,isPending:l}),n[48]=V,n[49]=c,n[50]=l,n[51]=a,n[52]=u,n[53]=se):se=n[53];let K;return n[54]!==fe||n[55]!==se?(K=m.jsxs(m.Fragment,{children:[fe,se]}),n[54]=fe,n[55]=se,n[56]=K):K=n[56],K}function dw(n){return"toolName"in n.action&&(!n.action.toolName||n.action.toolName==="")}function uw(){const n=I.c(17),e=Se(),t=mr(),{item:r}=Ln(e);if(!e||!r)return;let s;if(n[0]!==r.completed_steps?.error||n[1]!==r.completed_steps?.success||n[2]!==r.status||n[3]!==t){s={};let o;n[5]!==r.completed_steps?.success?(o=r.completed_steps?.success??[],n[5]=r.completed_steps?.success,n[6]=o):o=n[6];let i;n[7]!==o?(i=new Set(o),n[7]=o,n[8]=i):i=n[8];const l=i;let a;n[9]!==r.completed_steps?.error?(a=r.completed_steps?.error??[],n[9]=r.completed_steps?.error,n[10]=a):a=n[10];let c;n[11]!==a?(c=new Set(a),n[11]=a,n[12]=c):c=n[12];const d=c;let u;n[13]!==d||n[14]!==t||n[15]!==l?(u=-1,t.forEach((f,h)=>{(l.has(f.name)||d.has(f.name))&&(u=h)}),n[13]=d,n[14]=t,n[15]=l,n[16]=u):u=n[16],t.forEach((f,h)=>{let p="pending";d.has(f.name)?p="error":l.has(f.name)?p="success":r.status==="running"&&h===u+1&&(p="running"),s[f.name]={status:p,output:void 0,error:void 0,stepIndex:h}}),n[0]=r.completed_steps?.error,n[1]=r.completed_steps?.success,n[2]=r.status,n[3]=t,n[4]=s}else s=n[4];return s}function fw(n){const e=I.c(119),{step:t,index:r,isSelected:s,executionStatus:o,isSkipped:i,isLastStep:l,onSelect:a,onDelete:c,onDuplicate:d}=n,u=Se(),{item:f}=Ln(u),h=f?.completed_at_epoch_ms;let p;e[0]!==f?.completed_steps?.success||e[1]!==t.name?(p=f?.completed_steps?.success?.includes(t.name)??!1,e[0]=f?.completed_steps?.success,e[1]=t.name,e[2]=p):p=e[2];const g=p;let y;e[3]!==f?.completed_steps?.error||e[4]!==t.name?(y=f?.completed_steps?.error?.includes(t.name)??!1,e[3]=f?.completed_steps?.error,e[4]=t.name,e[5]=y):y=e[5];const x=y,b="toolName"in t.action,k=b&&"connectionId"in t.action?t.action.connectionId:null,S=!!(b&&"toolName"in t.action?t.action.toolName:null);let w,v,T,O,D,j,z,V,B,H,N;if(e[6]!==k||e[7]!==o||e[8]!==S||e[9]!==r||e[10]!==g||e[11]!==x||e[12]!==l||e[13]!==s||e[14]!==i||e[15]!==b||e[16]!==c||e[17]!==d||e[18]!==a||e[19]!==t||e[20]!==u){const le=vw(t);w=g?"success":x?"error":o?.status;const X=o!==void 0,fe=w==="success"||w==="error";let se=le.length>0?60:12;(w==="success"||w==="error")&&(se=se+32);let K,Fe,at;if(e[32]!==s||e[33]!==i||e[34]!==a||e[35]!==w){const _n=mw(w);let kr;e[44]!==w?(kr=gw(w),e[44]=w,e[45]=kr):kr=e[45],K=kr;const io=s&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lo=w==="running"&&"bg-accent/50",ao=i&&"opacity-50";e[46]!==io||e[47]!==lo||e[48]!==ao?(V=J("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",io,lo,ao),e[46]=io,e[47]=lo,e[48]=ao,e[49]=V):V=e[49],B=a,H="button",N=0,e[50]!==a?(v=co=>{(co.key==="Enter"||co.key===" ")&&(co.preventDefault(),a())},e[50]=a,e[51]=v):v=e[51],at="w-5 flex flex-col items-center justify-center shrink-0 pt-3",Fe=J("text-xs font-mono opacity-75 h-8 flex items-center",_n),e[32]=s,e[33]=i,e[34]=a,e[35]=w,e[36]=K,e[37]=v,e[38]=Fe,e[39]=at,e[40]=V,e[41]=B,e[42]=H,e[43]=N}else K=e[36],v=e[37],Fe=e[38],at=e[39],V=e[40],B=e[41],H=e[42],N=e[43];const so=r+1;let en;e[52]!==Fe||e[53]!==so?(en=m.jsxs("span",{className:Fe,children:[so,"."]}),e[52]=Fe,e[53]=so,e[54]=en):en=e[54],e[55]!==at||e[56]!==en?(T=m.jsx("div",{className:at,children:en}),e[55]=at,e[56]=en,e[57]=T):T=e[57];let tn;e[58]!==K||e[59]!==r?(tn=r>0?m.jsx(qo,{height:12,color:K}):m.jsx("div",{className:"h-3"}),e[58]=K,e[59]=r,e[60]=tn):tn=e[60];let nn;e[61]!==k||e[62]!==S||e[63]!==b||e[64]!==t.name?(nn=m.jsx(Sw,{connectionId:k,isToolStep:b,hasToolSelected:S,stepName:t.name}),e[61]=k,e[62]=S,e[63]=b,e[64]=t.name,e[65]=nn):nn=e[65];let rn;e[66]!==K||e[67]!==fe||e[68]!==w?(rn=fe&&m.jsxs(m.Fragment,{children:[m.jsx(qo,{height:8,color:K}),m.jsx(yw,{status:w})]}),e[66]=K,e[67]=fe,e[68]=w,e[69]=rn):rn=e[69];let sn;e[70]!==K||e[71]!==se||e[72]!==l||e[73]!==u?(sn=l&&u?null:m.jsx(qo,{height:se,color:K}),e[70]=K,e[71]=se,e[72]=l,e[73]=u,e[74]=sn):sn=e[74],e[75]!==tn||e[76]!==nn||e[77]!==rn||e[78]!==sn?(O=m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[tn,nn,rn,sn]}),e[75]=tn,e[76]=nn,e[77]=rn,e[78]=sn,e[79]=O):O=e[79],D="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const oo=S?"font-medium text-foreground":"text-foreground";let on;e[80]!==oo?(on=J("text-sm truncate flex-1",oo),e[80]=oo,e[81]=on):on=e[81];let ln;e[82]!==t?(ln=ww(t),e[82]=t,e[83]=ln):ln=e[83];let an;e[84]!==on||e[85]!==ln?(an=m.jsx("span",{className:on,children:ln}),e[84]=on,e[85]=ln,e[86]=an):an=e[86];let cn;e[87]!==X||e[88]!==w?(cn=X&&m.jsx(xw,{status:w}),e[87]=X,e[88]=w,e[89]=cn):cn=e[89];let dn;e[90]!==X||e[91]!==c||e[92]!==d?(dn=!X&&m.jsxs(xp,{children:[m.jsx(bp,{asChild:!0,children:m.jsx(me,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:pw,children:m.jsx(yp,{size:14})})}),m.jsxs(kp,{align:"end",children:[m.jsxs(Jl,{onClick:_n=>{_n.stopPropagation(),d()},children:[m.jsx(vp,{size:14}),"Duplicate"]}),m.jsxs(Jl,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:_n=>{_n.stopPropagation(),c()},children:[m.jsx(_h,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=X,e[91]=c,e[92]=d,e[93]=dn):dn=e[93],e[94]!==an||e[95]!==cn||e[96]!==dn?(j=m.jsxs("div",{className:"flex items-center h-8",children:[an,cn,dn]}),e[94]=an,e[95]=cn,e[96]=dn,e[97]=j):j=e[97],z=le.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(hw)}),e[6]=k,e[7]=o,e[8]=S,e[9]=r,e[10]=g,e[11]=x,e[12]=l,e[13]=s,e[14]=i,e[15]=b,e[16]=c,e[17]=d,e[18]=a,e[19]=t,e[20]=u,e[21]=w,e[22]=v,e[23]=T,e[24]=O,e[25]=D,e[26]=j,e[27]=z,e[28]=V,e[29]=B,e[30]=H,e[31]=N}else w=e[21],v=e[22],T=e[23],O=e[24],D=e[25],j=e[26],z=e[27],V=e[28],B=e[29],H=e[30],N=e[31];let _;e[98]!==h||e[99]!==w?(_=w==="success"&&m.jsx(bw,{completedAtEpochMs:h}),e[98]=h,e[99]=w,e[100]=_):_=e[100];let P;e[101]!==o?.error||e[102]!==w?(P=w==="error"&&m.jsx(kw,{error:o?.error}),e[101]=o?.error,e[102]=w,e[103]=P):P=e[103];let U;e[104]!==_||e[105]!==P||e[106]!==D||e[107]!==j||e[108]!==z?(U=m.jsxs("div",{className:D,children:[j,z,_,P]}),e[104]=_,e[105]=P,e[106]=D,e[107]=j,e[108]=z,e[109]=U):U=e[109];let Q;return e[110]!==v||e[111]!==T||e[112]!==O||e[113]!==U||e[114]!==V||e[115]!==B||e[116]!==H||e[117]!==N?(Q=m.jsxs("div",{className:V,onClick:B,role:H,tabIndex:N,onKeyDown:v,children:[T,O,U]}),e[110]=v,e[111]=T,e[112]=O,e[113]=U,e[114]=V,e[115]=B,e[116]=H,e[117]=N,e[118]=Q):Q=e[118],Q}function hw(n){return m.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:n},n)}function pw(n){return n.stopPropagation()}function mw(n){switch(n){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function gw(n){switch(n){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function yw(n){const e=I.c(2),{status:t}=n;if(t==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:m.jsx(zi,{size:8,className:"text-success-foreground"})}),e[0]=r):r=e[0],r}if(t==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:m.jsx(Vi,{size:8,className:"text-destructive-foreground"})}),e[1]=r):r=e[1],r}return null}function xw(n){const e=I.c(3),{status:t}=n;if(t==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(zi,{size:11,className:"text-success"})}),e[0]=r):r=e[0],r}if(t==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(Vi,{size:11,className:"text-destructive"})}),e[1]=r):r=e[1],r}if(t==="running"){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(nr,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=r):r=e[2],r}return null}function bw(n){const e=I.c(8),{completedAtEpochMs:t}=n;let r,s;if(e[0]!==t){const a=t!=null?new Date(t):null;r=a?a.toISOString().split("T")[0]:null,s=a?a.toTimeString().split(" ")[0]:null,e[0]=t,e[1]=r,e[2]=s}else r=e[1],s=e[2];const o=s;let i;e[3]!==r||e[4]!==o?(i=r&&o&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Gh,{size:16,className:"text-success"}),m.jsx("span",{className:"text-xs text-success",children:r}),m.jsx("span",{className:"text-xs text-success",children:o})]}),e[3]=r,e[4]=o,e[5]=i):i=e[5];let l;return e[6]!==i?(l=m.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:i}),e[6]=i,e[7]=l):l=e[7],l}function kw(n){const e=I.c(3),{error:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx(Gi,{size:16,className:"text-destructive"}),e[0]=r):r=e[0];const s=t||"Execution failed";let o;return e[1]!==s?(o=m.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[r,m.jsx("span",{className:"text-xs text-destructive",children:s})]}),e[1]=s,e[2]=o):o=e[2],o}function Sw(n){const e=I.c(5),{connectionId:t,isToolStep:r,hasToolSelected:s,stepName:o}=n,i=Di(t??"");if(r&&s&&i?.icon){let a;return e[0]!==i.icon||e[1]!==o?(a=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:m.jsx(Ps,{icon:i.icon,name:o,size:"xs",className:"border-0 rounded-none"})}),e[0]=i.icon,e[1]=o,e[2]=a):a=e[2],a}let l;return e[3]!==r?(l=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:r?m.jsx(rd,{size:16,className:"text-muted-foreground"}):m.jsx(wp,{size:16,className:"text-muted-foreground"})}),e[3]=r,e[4]=l):l=e[4],l}function qo(n){const e=I.c(7),{height:t,color:r}=n,s=r===void 0?"bg-border":r;let o;e[0]!==s?(o=J("w-px",s),e[0]=s,e[1]=o):o=e[1];let i;e[2]!==t?(i={height:t},e[2]=t,e[3]=i):i=e[3];let l;return e[4]!==o||e[5]!==i?(l=m.jsx("div",{className:o,style:i}),e[4]=o,e[5]=i,e[6]=l):l=e[6],l}function ww(n){return n.name?n.name:"toolName"in n.action&&n.action.toolName?n.action.toolName:"code"in n.action?n.name||"Code Step":"Select tool..."}function vw(n){const e=n.outputSchema;if(!e||typeof e!="object")return[];const t=e.properties;return!t||typeof t!="object"?[]:Object.keys(t).slice(0,5)}function Cw(n){const e=I.c(32),{className:t}=n,r=mr(),s=ad(),o=uw(),{setCurrentStepName:i,deleteStep:l,duplicateStep:a}=Me(),c=Se();let d;e[0]!==o||e[1]!==r?(d=o?r.findIndex(k=>o[k.name]?.status==="error"):-1,e[0]=o,e[1]=r,e[2]=d):d=e[2];const u=d;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{children:"Loading..."}),e[3]=f):f=e[3];let h;e[4]!==t?(h=J("h-full flex flex-col p-8 overflow-auto",t),e[4]=t,e[5]=h):h=e[5];let p;if(e[6]!==s||e[7]!==l||e[8]!==a||e[9]!==u||e[10]!==i||e[11]!==o||e[12]!==r){let k;e[14]!==s||e[15]!==l||e[16]!==a||e[17]!==u||e[18]!==i||e[19]!==o||e[20]!==r.length?(k=(C,S)=>{const w=o?.[C.name],v=u!==-1&&S>u&&w?.status==="pending",T=S===r.length-1;return m.jsx(fw,{step:C,index:S,isSelected:C.name===s,executionStatus:w,isSkipped:v,isLastStep:T,onSelect:()=>i(C.name),onDelete:()=>l(C.name),onDuplicate:()=>a(C.name)},C.name)},e[14]=s,e[15]=l,e[16]=a,e[17]=u,e[18]=i,e[19]=o,e[20]=r.length,e[21]=k):k=e[21],p=r.map(k),e[6]=s,e[7]=l,e[8]=a,e[9]=u,e[10]=i,e[11]=o,e[12]=r,e[13]=p}else p=e[13];let g;e[22]!==p?(g=m.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let y;e[24]!==c?(y=c?null:m.jsx(Nw,{}),e[24]=c,e[25]=y):y=e[25];let x;e[26]!==g||e[27]!==y?(x=m.jsxs("div",{className:"w-full -space-y-1",children:[g,y]}),e[26]=g,e[27]=y,e[28]=x):x=e[28];let b;return e[29]!==h||e[30]!==x?(b=m.jsx(M.Suspense,{fallback:f,children:m.jsx("div",{className:h,children:x})}),e[29]=h,e[30]=x,e[31]=b):b=e[31],b}function Nw(){const n=I.c(8),{addToolStep:e}=Me();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=m.jsx("div",{className:"w-5 shrink-0"}),n[0]=t):t=n[0];let r;n[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"w-px h-3 bg-border"}),n[1]=r):r=n[1];let s;n[2]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx(Vc,{size:14}),n[2]=s):s=n[2];let o;n[3]!==e?(o=m.jsx(me,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:s}),n[3]=e,n[4]=o):o=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=m.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%"}}),n[5]=i):i=n[5];let l;return n[6]!==o?(l=m.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[t,m.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[r,o,i]})]}),n[6]=o,n[7]=l):l=n[7],l}function Ew(){const n=I.c(5),e=Dn();let t;n[0]!==e?(t=e?new URL(`/mcp/gateway/${e}`,window.location.origin).href:"",n[0]=e,n[1]=t):t=n[1];const r=t,s=!!e;let o;return n[2]!==r||n[3]!==s?(o={url:r,enabled:s},n[2]=r,n[3]=s,n[4]=o):o=n[4],Hi(o)}function Tw(n){const e=I.c(7),{className:t}=n;if(!Dn()){let o;e[0]!==t?(o=J("flex flex-col h-full bg-sidebar",t),e[0]=t,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select a gateway to see available tools"}),e[2]=i):i=e[2];let l;return e[3]!==o?(l=m.jsx("div",{className:o,children:i}),e[3]=o,e[4]=l):l=e[4],l}let s;return e[5]!==t?(s=m.jsx(Mw,{className:t}),e[5]=t,e[6]=s):s=e[6],s}function Mw(n){const e=I.c(38),{className:t}=n,{tools:r,isLoading:s,error:o}=Ew(),i=pr(),{updateStep:l}=Me(),c=i&&"toolName"in i.action&&"toolName"in i.action?i.action.toolName:null;let d;if(e[0]!==c||e[1]!==r){let S;e[3]!==c?(S=w=>w.name===c,e[3]=c,e[4]=S):S=e[4],d=r.find(S),e[0]=c,e[1]=r,e[2]=d}else d=e[2];const f=tg(r,d??null,Ow,Aw);let h;e[5]!==i||e[6]!==l?(h=S=>{i&&l(i.name,{action:{...i.action,toolName:S.name},outputSchema:S.outputSchema??{}})},e[5]=i,e[6]=l,e[7]=h):h=e[7];const p=h;if(s){let S;e[8]!==t?(S=J("flex flex-col h-full bg-sidebar",t),e[8]=t,e[9]=S):S=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(Ls,{size:"sm"})}),e[10]=w):w=e[10];let v;return e[11]!==S?(v=m.jsx("div",{className:S,children:w}),e[11]=S,e[12]=v):v=e[12],v}if(o){let S;e[13]!==t?(S=J("flex flex-col h-full bg-sidebar",t),e[13]=t,e[14]=S):S=e[14];let w;e[15]!==o.message?(w=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",o.message]}),e[15]=o.message,e[16]=w):w=e[16];let v;return e[17]!==S||e[18]!==w?(v=m.jsx("div",{className:S,children:w}),e[17]=S,e[18]=w,e[19]=v):v=e[19],v}let g;e[20]!==t?(g=J("flex flex-col h-full bg-sidebar",t),e[20]=t,e[21]=g):g=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=m.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=y):y=e[22];let x;e[23]!==r.length?(x=m.jsx("div",{className:"flex items-start border-b border-border",children:m.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[y,m.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",r.length,")"]})]})}),e[23]=r.length,e[24]=x):x=e[24];let b;if(e[25]!==p||e[26]!==f||e[27]!==c){let S;e[29]!==p||e[30]!==c?(S=w=>m.jsx(Iw,{icon:null,title:w.name,description:w.description,isSelected:w.name===c,onClick:()=>p(w)},w.name),e[29]=p,e[30]=c,e[31]=S):S=e[31],b=f.map(S),e[25]=p,e[26]=f,e[27]=c,e[28]=b}else b=e[28];let k;e[32]!==b?(k=m.jsx("div",{className:"flex-1 overflow-auto",children:b}),e[32]=b,e[33]=k):k=e[33];let C;return e[34]!==g||e[35]!==x||e[36]!==k?(C=m.jsxs("div",{className:g,children:[x,k]}),e[34]=g,e[35]=x,e[36]=k,e[37]=C):C=e[37],C}function Aw(n,e){return n.name.localeCompare(e.name)}function Ow(n){return n.name}function Iw(n){const e=I.c(20),{icon:t,title:r,description:s,isSelected:o,onClick:i}=n,l=o&&"bg-muted/50";let a;e[0]!==l?(a=J("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i?(c=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i())},e[2]=i,e[3]=c):c=e[3];let d;e[4]!==t||e[5]!==r?(d=m.jsx(Ps,{icon:t,name:r,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=t,e[5]=r,e[6]=d):d=e[6];let u;e[7]!==r?(u=m.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:r}),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==s?(f=s&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s}),e[9]=s,e[10]=f):f=e[10];let h;e[11]!==u||e[12]!==f?(h=m.jsxs("div",{className:"flex-1 min-w-0",children:[u,f]}),e[11]=u,e[12]=f,e[13]=h):h=e[13];let p;return e[14]!==i||e[15]!==a||e[16]!==c||e[17]!==d||e[18]!==h?(p=m.jsxs("div",{className:a,onClick:i,role:"button",tabIndex:0,onKeyDown:c,children:[d,h]}),e[14]=i,e[15]=a,e[16]=c,e[17]=d,e[18]=h,e[19]=p):p=e[19],p}var to="Collapsible",[Rw,ah]=Mi(to),[jw,Bl]=Rw(to),ch=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...l}=n,[a,c]=Ds({prop:r,defaultProp:s??!1,onChange:i,caller:to});return m.jsx(jw,{scope:t,disabled:o,contentId:Lc(),open:a,onOpenToggle:M.useCallback(()=>c(d=>!d),[c]),children:m.jsx(On.div,{"data-state":Vl(a),"data-disabled":o?"":void 0,...l,ref:e})})});ch.displayName=to;var dh="CollapsibleTrigger",uh=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,...r}=n,s=Bl(dh,t);return m.jsx(On.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Vl(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Ve(n.onClick,s.onOpenToggle)})});uh.displayName=dh;var Fl="CollapsibleContent",fh=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Bl(Fl,n.__scopeCollapsible);return m.jsx(Ai,{present:t||s.open,children:({present:o})=>m.jsx(Dw,{...r,ref:e,present:o})})});fh.displayName=Fl;var Dw=M.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:r,children:s,...o}=n,i=Bl(Fl,t),[l,a]=M.useState(r),c=M.useRef(null),d=Oi(e,c),u=M.useRef(0),f=u.current,h=M.useRef(0),p=h.current,g=i.open||l,y=M.useRef(g),x=M.useRef(void 0);return M.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),zh(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();u.current=k.height,h.current=k.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),a(r)}},[i.open,r]),m.jsx(On.div,{"data-state":Vl(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...n.style},children:g&&s})});function Vl(n){return n?"open":"closed"}var Pw=ch,Lw=uh,$w=fh,Ke="Accordion",_w=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Hl,zw,Bw]=Bh(Ke),[no]=Mi(Ke,[Bw,ah]),Wl=ah(),hh=ee.forwardRef((n,e)=>{const{type:t,...r}=n,s=r,o=r;return m.jsx(Hl.Provider,{scope:n.__scopeAccordion,children:t==="multiple"?m.jsx(Ww,{...o,ref:e}):m.jsx(Hw,{...s,ref:e})})});hh.displayName=Ke;var[ph,Fw]=no(Ke),[mh,Vw]=no(Ke,{collapsible:!1}),Hw=ee.forwardRef((n,e)=>{const{value:t,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=n,[l,a]=Ds({prop:t,defaultProp:r??"",onChange:s,caller:Ke});return m.jsx(ph,{scope:n.__scopeAccordion,value:ee.useMemo(()=>l?[l]:[],[l]),onItemOpen:a,onItemClose:ee.useCallback(()=>o&&a(""),[o,a]),children:m.jsx(mh,{scope:n.__scopeAccordion,collapsible:o,children:m.jsx(gh,{...i,ref:e})})})}),Ww=ee.forwardRef((n,e)=>{const{value:t,defaultValue:r,onValueChange:s=()=>{},...o}=n,[i,l]=Ds({prop:t,defaultProp:r??[],onChange:s,caller:Ke}),a=ee.useCallback(d=>l((u=[])=>[...u,d]),[l]),c=ee.useCallback(d=>l((u=[])=>u.filter(f=>f!==d)),[l]);return m.jsx(ph,{scope:n.__scopeAccordion,value:i,onItemOpen:a,onItemClose:c,children:m.jsx(mh,{scope:n.__scopeAccordion,collapsible:!0,children:m.jsx(gh,{...o,ref:e})})})}),[qw,ro]=no(Ke),gh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,disabled:r,dir:s,orientation:o="vertical",...i}=n,l=ee.useRef(null),a=Oi(l,e),c=zw(t),u=Fh(s)==="ltr",f=Ve(n.onKeyDown,h=>{if(!_w.includes(h.key))return;const p=h.target,g=c().filter(T=>!T.ref.current?.disabled),y=g.findIndex(T=>T.ref.current===p),x=g.length;if(y===-1)return;h.preventDefault();let b=y;const k=0,C=x-1,S=()=>{b=y+1,b>C&&(b=k)},w=()=>{b=y-1,b<k&&(b=C)};switch(h.key){case"Home":b=k;break;case"End":b=C;break;case"ArrowRight":o==="horizontal"&&(u?S():w());break;case"ArrowDown":o==="vertical"&&S();break;case"ArrowLeft":o==="horizontal"&&(u?w():S());break;case"ArrowUp":o==="vertical"&&w();break}const v=b%x;g[v].ref.current?.focus()});return m.jsx(qw,{scope:t,disabled:r,direction:s,orientation:o,children:m.jsx(Hl.Slot,{scope:t,children:m.jsx(On.div,{...i,"data-orientation":o,ref:a,onKeyDown:r?void 0:f})})})}),js="AccordionItem",[Uw,ql]=no(js),yh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,value:r,...s}=n,o=ro(js,t),i=Fw(js,t),l=Wl(t),a=Lc(),c=r&&i.value.includes(r)||!1,d=o.disabled||n.disabled;return m.jsx(Uw,{scope:t,open:c,disabled:d,triggerId:a,children:m.jsx(Pw,{"data-orientation":o.orientation,"data-state":vh(c),...l,...s,ref:e,disabled:d,open:c,onOpenChange:u=>{u?i.onItemOpen(r):i.onItemClose(r)}})})});yh.displayName=js;var xh="AccordionHeader",bh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(xh,t);return m.jsx(On.h3,{"data-orientation":s.orientation,"data-state":vh(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:e})});bh.displayName=xh;var Ei="AccordionTrigger",kh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(Ei,t),i=Vw(Ei,t),l=Wl(t);return m.jsx(Hl.ItemSlot,{scope:t,children:m.jsx(Lw,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...r,ref:e})})});kh.displayName=Ei;var Sh="AccordionContent",wh=ee.forwardRef((n,e)=>{const{__scopeAccordion:t,...r}=n,s=ro(Ke,t),o=ql(Sh,t),i=Wl(t);return m.jsx($w,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...n.style}})});wh.displayName=Sh;function vh(n){return n?"open":"closed"}var Kw=hh,Jw=yh,Gw=bh,Xw=kh,Yw=wh;function Qw(n){const e=I.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let r;return e[2]!==t?(r=m.jsx(Kw,{"data-slot":"accordion",...t}),e[2]=t,e[3]=r):r=e[3],r}function Zw(n){const e=I.c(8);let t,r;e[0]!==n?({className:t,...r}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=J("border-b last:border-b-0",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx(Jw,{"data-slot":"accordion-item",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function ev(n){const e=I.c(11);let t,r,s;e[0]!==n?({className:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=J("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",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Sp,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=i):i=e[6];let l;return e[7]!==t||e[8]!==s||e[9]!==o?(l=m.jsx(Gw,{className:"flex",children:m.jsxs(Xw,{"data-slot":"accordion-trigger",className:o,...s,children:[t,i]})}),e[7]=t,e[8]=s,e[9]=o,e[10]=l):l=e[10],l}function tv(n){const e=I.c(12);let t,r,s;e[0]!==n?({className:r,children:t,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=J("pt-0 pb-4",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]!==t||e[7]!==o?(i=m.jsx("div",{className:o,children:t}),e[6]=t,e[7]=o,e[8]=i):i=e[8];let l;return e[9]!==s||e[10]!==i?(l=m.jsx(Yw,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...s,children:i}),e[9]=s,e[10]=i,e[11]=l):l=e[11],l}var nv=(n,e,t,r,s,o,i,l)=>{let a=document.documentElement,c=["light","dark"];function d(h){(Array.isArray(n)?n:[n]).forEach(p=>{let g=p==="class",y=g&&o?s.map(x=>o[x]||x):s;g?(a.classList.remove(...y),a.classList.add(o&&o[h]?o[h]:h)):a.setAttribute(p,h)}),u(h)}function u(h){l&&c.includes(h)&&(a.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)d(r);else try{let h=localStorage.getItem(e)||t,p=i&&h==="system"?f():h;d(p)}catch{}};M.createContext(void 0);M.memo(({forcedTheme:n,storageKey:e,attribute:t,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,themes:l,nonce:a,scriptProps:c})=>{let d=JSON.stringify([t,e,o,n,l,i,r,s]).slice(1,-1);return M.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?a:"",dangerouslySetInnerHTML:{__html:`(${nv.toString()})(${d})`}})});function rv(n){const{updateStep:e}=Me(),r=n&&"toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,{tool:s}=Ul(r??"");n&&r&&s?.outputSchema&&(!n.outputSchema||Object.keys(n.outputSchema).length===0)&&queueMicrotask(()=>{e(n.name,{outputSchema:s.outputSchema})})}function sv(n){const e=I.c(25),{className:t}=n,r=pr(),{appendStep:s}=Me();if(rv(r),!r){let f;e[0]!==t?(f=J("flex flex-col h-full bg-sidebar",t),e[0]=t,e[1]=f):f=e[1];let h;e[2]!==s?(h=()=>{s({type:"tool"})},e[2]=s,e[3]=h):h=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Vc,{size:14}),e[4]=p):p=e[4];let g;e[5]!==h?(g=m.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",m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:h,children:p})]}),e[5]=h,e[6]=g):g=e[6];let y;return e[7]!==f||e[8]!==g?(y=m.jsx("div",{className:f,children:g}),e[7]=f,e[8]=g,e[9]=y):y=e[9],y}let o;e[10]!==t?(o=J("flex flex-col h-full bg-sidebar overflow-scroll",t),e[10]=t,e[11]=o):o=e[11];let i,l,a,c,d;e[12]!==r?(i=m.jsx(ov,{step:r}),l=m.jsx(lv,{step:r}),a=m.jsx(av,{step:r}),c=m.jsx(fv,{step:r}),d=m.jsx(mv,{step:r}),e[12]=r,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=d):(i=e[13],l=e[14],a=e[15],c=e[16],d=e[17]);let u;return e[18]!==o||e[19]!==i||e[20]!==l||e[21]!==a||e[22]!==c||e[23]!==d?(u=m.jsxs("div",{className:o,children:[i,l,a,c,d]}),e[18]=o,e[19]=i,e[20]=l,e[21]=a,e[22]=c,e[23]=d,e[24]=u):u=e[24],u}function ov(n){const e=I.c(15),{step:t}=n,s="toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,o=Se(),i=s??"";let l;e[0]!==i?(l=m.jsx(Ps,{icon:null,name:i,size:"xs",className:"shadow-sm"}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s?(a=m.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==o?(c=o?null:m.jsx(iv,{}),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d=m.jsxs("div",{className:"flex items-center gap-2",children:[l,a,c]}),e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];let u;e[10]!==t.description?(u=t.description&&m.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[10]=t.description,e[11]=u):u=e[11];let f;return e[12]!==d||e[13]!==u?(f=m.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[d,u]}),e[12]=d,e[13]=u,e[14]=f):f=e[14],f}function iv(){const n=I.c(9),e=pr(),{updateStep:t,startReplacingTool:r}=Me(),s=Se(),i=e&&"toolName"in e.action?e.action.toolName:null;let l;n[0]!==e||n[1]!==r||n[2]!==i||n[3]!==s||n[4]!==t?(l=()=>{if(e){if(s){jc.error("You cannot replace a tool while a workflow is executing.");return}i&&r(i),t(e.name,{action:{...e.action,toolName:""}})}},n[0]=e,n[1]=r,n[2]=i,n[3]=s,n[4]=t,n[5]=l):l=n[5];const a=l;let c;n[6]===Symbol.for("react.memo_cache_sentinel")?(c=m.jsx(nd,{size:14}),n[6]=c):c=n[6];let d;return n[7]!==a?(d=m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:c}),n[7]=a,n[8]=d):d=n[8],d}function Ul(n){const e=I.c(13),t=Dn();let r;e[0]!==t?(r=t?new URL(`/mcp/gateway/${t}`,window.location.origin).href:"",e[0]=t,e[1]=r):r=e[1];const s=r,o=!!t;let i;e[2]!==s||e[3]!==o?(i={url:s,enabled:o},e[2]=s,e[3]=o,e[4]=i):i=e[4];const l=Hi(i);let a;e[5]!==l.tools||e[6]!==n?(a=l.tools?.find(h=>h.name===n),e[5]=l.tools,e[6]=n,e[7]=a):a=e[7];const c=a,d=l.state==="connecting",u=l.state==="ready";let f;return e[8]!==l.error||e[9]!==d||e[10]!==u||e[11]!==c?(f={tool:c,isLoading:d,isReady:u,error:l.error},e[8]=l.error,e[9]=d,e[10]=u,e[11]=c,e[12]=f):f=e[12],f}function lv(n){const e=I.c(13),{step:t}=n,{updateStep:r}=Me(),o="toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,i=Se(),{tool:l}=Ul(o??"");if(!l||!l.inputSchema)return null;let a;e[0]!==t.name||e[1]!==r?(a=x=>{r(t.name,{input:x})},e[0]=t.name,e[1]=r,e[2]=a):a=e[2];const c=a,d=i?"output":"input";let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx(ev,{className:"px-5 py-5",children:m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=u):u=e[3];const f=l.inputSchema,h=t.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==c||e[6]!==t.name||e[7]!==f||e[8]!==h?(g=m.jsxs(Zw,{value:"input",className:"border-b-0",children:[u,m.jsx(tv,{className:"px-5 pt-2",children:m.jsx(lh,{inputSchema:f,inputParams:h,setInputParams:c,mentions:p},t.name)})]}),e[5]=c,e[6]=t.name,e[7]=f,e[8]=h,e[9]=g):g=e[9];let y;return e[10]!==d||e[11]!==g?(y=m.jsx(Qw,{type:"single",collapsible:!0,defaultValue:d,className:"border-b border-border shrink-0",children:g}),e[10]=d,e[11]=g,e[12]=y):y=e[12],y}function av(n){const e=I.c(24),{step:t}=n,r=t.outputSchema,[s,o]=M.useState(!1),i=Se(),{item:l}=Ln(i),a=!!(l?.completed_steps?.success?.includes(t.name)||l?.completed_steps?.error?.includes(t.name)),{output:c,error:d}=qm(i,a?t.name:void 0);let u;e[0]!==d||e[1]!==c?(u=c||(d?{error:d}:void 0),e[0]=d,e[1]=c,e[2]=u):u=e[2];const f=u,h=r&&typeof r=="object"?r.properties:void 0;let p;e[3]!==h?(p=h?Object.entries(h):[],e[3]=h,e[4]=p):p=e[4];const g=p,y=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let x;e[5]!==y?(x=J("flex flex-col border-b border-border",y),e[5]=y,e[6]=x):x=e[6];let b;e[7]!==s?(b=()=>o(!s),e[7]=s,e[8]=b):b=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=k):k=e[9];let C;e[10]!==s?(C=m.jsxs("div",{className:"flex items-center justify-between",children:[k,s?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[10]=s,e[11]=C):C=e[11];let S;e[12]!==b||e[13]!==C?(S=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:b,children:C}),e[12]=b,e[13]=C,e[14]=S):S=e[14];let w;e[15]!==f||e[16]!==s||e[17]!==g||e[18]!==i?(w=s&&m.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[i&&f?m.jsx(In,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}):null,!i&&g.map(cv)]}),e[15]=f,e[16]=s,e[17]=g,e[18]=i,e[19]=w):w=e[19];let v;return e[20]!==x||e[21]!==S||e[22]!==w?(v=m.jsxs("div",{className:x,children:[S,w]}),e[20]=x,e[21]=S,e[22]=w,e[23]=v):v=e[23],v}function cv(n){const[e,t]=n;return m.jsx(uv,{name:e,schema:t},e)}function dv(n){switch(n){case"string":return{Icon:Xc,color:"text-blue-500"};case"number":case"integer":return{Icon:Jc,color:"text-blue-500"};case"array":return{Icon:qc,color:"text-purple-500"};case"object":return{Icon:Wc,color:"text-orange-500"};case"boolean":return{Icon:Gc,color:"text-pink-500"};case"null":return{Icon:Ii,color:"text-gray-500"};default:return{Icon:Uc,color:"text-muted-foreground"}}}function uv(n){const e=I.c(28),{name:t,schema:r}=n,s=pr(),o=r.type??"unknown";let i,l,a,c,d;if(e[0]!==o){const{Icon:C,color:S}=dv(o);d="flex items-center gap-2",c="flex-1 flex items-center gap-2",i=C,l=14,a=J(S),e[0]=o,e[1]=i,e[2]=l,e[3]=a,e[4]=c,e[5]=d}else i=e[1],l=e[2],a=e[3],c=e[4],d=e[5];let u;e[6]!==i||e[7]!==l||e[8]!==a?(u=m.jsx(i,{size:l,className:a}),e[6]=i,e[7]=l,e[8]=a,e[9]=u):u=e[9];let f;e[10]!==t?(f=m.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[10]=t,e[11]=f):f=e[11];let h;e[12]!==c||e[13]!==u||e[14]!==f?(h=m.jsxs("div",{className:c,children:[u,f]}),e[12]=c,e[13]=u,e[14]=f,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(ed,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=s?.name;let y;e[17]!==g?(y=m.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=y):y=e[18];let x;e[19]!==t?(x=m.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:t}),e[19]=t,e[20]=x):x=e[20];let b;e[21]!==y||e[22]!==x?(b=m.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,y,x]}),e[21]=y,e[22]=x,e[23]=b):b=e[23];let k;return e[24]!==b||e[25]!==d||e[26]!==h?(k=m.jsxs("div",{className:d,children:[h,b]}),e[24]=b,e[25]=d,e[26]=h,e[27]=k):k=e[27],k}function fv(n){const e=I.c(29),{step:t}=n,{updateStep:r}=Me(),s=Se(),[o,i]=M.useState(!1),l="toolName"in t.action,a=l&&"toolName"in t.action?t.action.toolName:null,{tool:c}=Ul(a??""),d=l&&"transformCode"in t.action?t.action.transformCode??null:null;let u;e[0]!==c?(u=()=>{if(!c?.outputSchema)return`interface Input {
147
147
  // Tool output schema not available
148
148
  }`;const T=c.outputSchema,O=T.properties;return O?`interface Input {
149
149
  ${Object.entries(O).map(j=>{const[z,V]=j,B=Br(V),H=!T.required?.includes(z);return` ${z}${H?"?":""}: ${B};`}).join(`
@@ -162,4 +162,4 @@ export default async function(input: Input): Promise<Output> {
162
162
  return {
163
163
  result: input,
164
164
  };
165
- }`;r(t.name,{action:{...t.action,transformCode:O}}),i(hv)},e[2]=f,e[3]=t.action,e[4]=t.name,e[5]=r,e[6]=h):h=e[6];const p=h;let g;e[7]!==t.action||e[8]!==t.name||e[9]!==r?(g=(T,O)=>{r(t.name,{action:{...t.action,transformCode:T},...O?{outputSchema:O}:{}})},e[7]=t.action,e[8]=t.name,e[9]=r,e[10]=g):g=e[10];const y=g;if("code"in t.action&&t.action.code)return null;const x=o?"flex-1 min-h-0 overflow-hidden":"shrink-0";let b;e[11]!==x?(b=J("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",x),e[11]=x,e[12]=b):b=e[12];let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=k):k=e[13];let C;e[14]!==o?(C=m.jsxs("div",{className:"flex items-center justify-between",children:[k,o?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[14]=o,e[15]=C):C=e[15];let S;e[16]!==C||e[17]!==p?(S=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:C}),e[16]=C,e[17]=p,e[18]=S):S=e[18];let w;e[19]!==y||e[20]!==o||e[21]!==t.name||e[22]!==s||e[23]!==d?(w=o&&m.jsx("div",{className:"flex-1 min-h-0",children:m.jsx(In,{code:d,language:"typescript",readOnly:s!==void 0,onSave:y,height:"100%"},`transform-code-${t.name}-${s}`)}),e[19]=y,e[20]=o,e[21]=t.name,e[22]=s,e[23]=d,e[24]=w):w=e[24];let v;return e[25]!==b||e[26]!==S||e[27]!==w?(v=m.jsxs("div",{className:b,children:[S,w]}),e[25]=b,e[26]=S,e[27]=w,e[28]=v):v=e[28],v}function hv(n){return!n}function pv(n){return!n}function mv(n){const e=I.c(24),{step:t}=n,[r,s]=M.useState(!1),{updateStep:o}=Me(),i="code"in t.action&&t.action.code?t.action.code:null,l=Se();let a;e[0]!==t.action||e[1]!==t.name||e[2]!==o?(a=(b,k)=>{o(t.name,{action:{...t.action,code:b},...k?{outputSchema:k}:{}})},e[0]=t.action,e[1]=t.name,e[2]=o,e[3]=a):a=e[3];const c=a;if(!i)return null;const d=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let u;e[4]!==d?(u=J("flex flex-col border-b border-border",d),e[4]=d,e[5]=u):u=e[5];let f;e[6]!==r?(f=()=>s(!r),e[6]=r,e[7]=f):f=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==r?(p=m.jsxs("div",{className:"flex items-center justify-between",children:[h,r?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:f,children:p}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let y;e[14]!==i||e[15]!==c||e[16]!==r||e[17]!==t.name||e[18]!==l?(y=r&&m.jsx("div",{className:"flex-1 min-h-0",children:m.jsx(In,{onSave:(b,k)=>c(b,k),code:i,language:"typescript",height:"100%",readOnly:l!==void 0},`step-code-${t.name}-${l}`)}),e[14]=i,e[15]=c,e[16]=r,e[17]=t.name,e[18]=l,e[19]=y):y=e[19];let x;return e[20]!==u||e[21]!==g||e[22]!==y?(x=m.jsxs("div",{className:u,children:[g,y]}),e[20]=u,e[21]=g,e[22]=y,e[23]=x):x=e[23],x}function Br(n){if(Array.isArray(n.type))return n.type.map(t=>Br({...n,type:t})).join(" | ");switch(n.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return n.items?`${Br(n.items)}[]`:"unknown[]";case"object":return n.properties?`{ ${Object.entries(n.properties).map(([r,s])=>{const o=Br(s),i=!n.required?.includes(r);return`${r}${i?"?":""}: ${o}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function gv(n){switch(n){case"success":return m.jsxs(un,{variant:"success",className:"gap-1",children:[m.jsx(zi,{size:11}),"Success"]});case"error":case"failed":return m.jsxs(un,{variant:"destructive",className:"gap-1",children:[m.jsx(Gi,{size:11}),"Error"]});case"running":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),"Running"]});case"enqueued":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),"On hold"]});case"cancelled":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Hc,{size:11}),"Cancelled"]});default:return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),n]})}}function yv(n){return`Run #${n.slice(-4).toUpperCase()}`}function xv(n){const e=I.c(21),{className:t}=n,{executions:r,isLoading:s}=Um(),{setShowExecutionsList:o}=Qi(),{setTrackingExecutionId:i}=Me(),l=Se();let a;e[0]!==i?(a=k=>{i(k)},e[0]=i,e[1]=a):a=e[1];const c=a;let d;e[2]!==o?(d=()=>{o(!1)},e[2]=o,e[3]=d):d=e[3];const u=d;let f;e[4]!==t?(f=J("flex flex-col h-full bg-sidebar border-l border-border",t),e[4]=t,e[5]=f):f=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Hc,{size:11}),e[7]=p):p=e[7];let g;e[8]!==u?(g=m.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:u,children:p})]}),e[8]=u,e[9]=g):g=e[9];let y;e[10]!==r||e[11]!==c||e[12]!==s||e[13]!==l?(y=s?m.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):r.map((k,C)=>m.jsx(bv,{execution:k,isSelected:k.id===l,isFirst:C===0,onSelect:()=>c(k.id)},k.id)),e[10]=r,e[11]=c,e[12]=s,e[13]=l,e[14]=y):y=e[14];let x;e[15]!==y?(x=m.jsx("div",{className:"flex-1 overflow-auto",children:y}),e[15]=y,e[16]=x):x=e[16];let b;return e[17]!==f||e[18]!==g||e[19]!==x?(b=m.jsxs("div",{className:f,children:[g,x]}),e[17]=f,e[18]=g,e[19]=x,e[20]=b):b=e[20],b}function bv(n){const e=I.c(17),{execution:t,isSelected:r,isFirst:s,onSelect:o}=n,i=r&&"bg-accent/50",l=s&&r&&"bg-accent/50",a=!r&&"hover:bg-accent/30";let c;e[0]!==i||e[1]!==l||e[2]!==a?(c=J("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",i,l,a),e[0]=i,e[1]=l,e[2]=a,e[3]=c):c=e[3];let d;e[4]!==t.status?(d=gv(t.status),e[4]=t.status,e[5]=d):d=e[5];let u;e[6]!==t.id?(u=yv(t.id),e[6]=t.id,e[7]=u):u=e[7];let f;e[8]!==u?(f=m.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:u}),e[8]=u,e[9]=f):f=e[9];let h;e[10]!==d||e[11]!==f?(h=m.jsxs("div",{className:"flex items-center gap-2 w-full",children:[d,f]}),e[10]=d,e[11]=f,e[12]=h):h=e[12];let p;return e[13]!==o||e[14]!==c||e[15]!==h?(p=m.jsx("div",{className:c,onClick:o,children:h}),e[13]=o,e[14]=c,e[15]=h,e[16]=p):p=e[16],p}function kv(n){const e=I.c(9),{itemId:t}=n;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:s}=Et(r),o=s??qt;let i;e[1]!==o?(i=Ue(o),e[1]=o,e[2]=i):i=e[2];const l=i,a=Ri(o,"WORKFLOW",t,l),c=ji(o,"WORKFLOW",l);let d;e[3]!==c||e[4]!==t?(d=async h=>{await c.update.mutateAsync({id:t,data:h})},e[3]=c,e[4]=t,e[5]=d):d=e[5];const u=d;let f;return e[6]!==a||e[7]!==u?(f={item:a,update:u},e[6]=a,e[7]=u,e[8]=f):f=e[8],f}function Sv(n){const e=I.c(18),{workflow:t,onUpdate:r}=n,{setWorkflow:s}=Me();let o,i,l,a;if(e[0]!==t.description||e[1]!==t.id||e[2]!==t.steps||e[3]!==t.title){const u={title:t.title,description:t.description,steps:t.steps};o=In,i=`workflow-${t.id}`,l="100%",a=JSON.stringify(u,null,2),e[0]=t.description,e[1]=t.id,e[2]=t.steps,e[3]=t.title,e[4]=o,e[5]=i,e[6]=l,e[7]=a}else o=e[4],i=e[5],l=e[6],a=e[7];let c;e[8]!==r||e[9]!==s||e[10]!==t?(c=u=>{const f=JSON.parse(u);s({...t,...f}),r(f)},e[8]=r,e[9]=s,e[10]=t,e[11]=c):c=e[11];let d;return e[12]!==o||e[13]!==i||e[14]!==l||e[15]!==a||e[16]!==c?(d=m.jsx(o,{height:l,code:a,language:"json",onSave:c},i),e[12]=o,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=d):d=e[17],d}function wv(){const n=I.c(12),{setTrackingExecutionId:e}=Me(),t=Se();let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"flex items-center justify-center h-full w-12",children:m.jsx(Vh,{className:"w-4 h-4 text-muted-foreground"})}),n[0]=r):r=n[0];let s;n[1]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("strong",{className:"text-base text-foreground",children:"Run"}),n[1]=s):s=n[1];let o;n[2]!==t?(o=m.jsxs("div",{className:"flex items-center h-full",children:[r,m.jsxs("p",{className:"flex gap-3 items-center h-full",children:[s,m.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",t]})]})]}),n[2]=t,n[3]=o):o=n[3];let i;n[4]!==e?(i=()=>e(void 0),n[4]=e,n[5]=i):i=n[5];let l;n[6]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx(Ii,{className:"w-4 h-4 text-muted-foreground"}),n[6]=l):l=n[6];let a;n[7]!==i?(a=m.jsx(me,{variant:"ghost",size:"xs",onClick:i,children:l}),n[7]=i,n[8]=a):a=n[8];let c;return n[9]!==o||n[10]!==a?(c=m.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[o,a]}),n[9]=o,n[10]=a,n[11]=c):c=n[11],c}function vv(n){const e=I.c(17),{onBack:t}=n;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{itemId:s}=Et(r);let o;e[1]!==s?(o={itemId:s},e[1]=s,e[2]=o):o=e[2];const{item:i,update:l}=kv(o);let a;e[3]!==i?(a=JSON.stringify(i),e[3]=i,e[4]=a):a=e[4];const c=a;if(!i){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Wi,{icon:m.jsx(Kc,{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]=h):h=e[5];let p;return e[6]!==t?(p=m.jsx(Sn,{onBack:t,children:h}),e[6]=t,e[7]=p):p=e[7],p}let d;e[8]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=i,e[9]=d):d=e[9];let u;e[10]!==t||e[11]!==l?(u=m.jsx(Cv,{onBack:t,onUpdate:l}),e[10]=t,e[11]=l,e[12]=u):u=e[12];let f;return e[13]!==c||e[14]!==d||e[15]!==u?(f=m.jsx(Lm,{initialState:d,children:u},c),e[13]=c,e[14]=d,e[15]=u,e[16]=f):f=e[16],f}function Cv(n){const e=I.c(24),{onBack:t,onUpdate:r}=n,s=jn(),o=Se(),{setOriginalWorkflow:i}=Me(),{viewMode:l,showExecutionsList:a}=Qi(),c=pr();let d;e[0]!==r||e[1]!==i||e[2]!==s?(d=async()=>{await r(s),i(s)},e[0]=r,e[1]=i,e[2]=s,e[3]=d):d=e[3];const u=d,f=c&&"toolName"in c.action,h=f?c.action.toolName:null,p=f&&!h&&!o,g=!p&&(c||o||!a);let y;e[4]!==u||e[5]!==s.description||e[6]!==s.title?(y=m.jsx(iw,{title:s.title,description:s.description,onSave:u}),e[4]=u,e[5]=s.description,e[6]=s.title,e[7]=y):y=e[7];let x;e[8]!==o?(x=o&&m.jsx(wv,{}),e[8]=o,e[9]=x):x=e[9];let b;e[10]!==r||e[11]!==a||e[12]!==g||e[13]!==p||e[14]!==l||e[15]!==s?(b=m.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?m.jsx(Sv,{workflow:s,onUpdate:r}):m.jsxs(op,{direction:"horizontal",className:"flex w-full h-full",children:[m.jsx(Kl,{defaultSize:50,minSize:30,children:m.jsx(Cw,{})}),m.jsx(ip,{}),m.jsxs(Kl,{defaultSize:50,minSize:25,children:[p&&m.jsx(Tw,{className:"border-l border-border"}),a&&m.jsx(xv,{}),g&&m.jsx(sv,{className:"border-l border-border"})]})]})}),e[10]=r,e[11]=a,e[12]=g,e[13]=p,e[14]=l,e[15]=s,e[16]=b):b=e[16];let k;e[17]!==y||e[18]!==x||e[19]!==b?(k=m.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[y,x,b]}),e[17]=y,e[18]=x,e[19]=b,e[20]=k):k=e[20];let C;return e[21]!==t||e[22]!==k?(C=m.jsx(Sn,{onBack:t,children:k}),e[21]=t,e[22]=k,e[23]=C):C=e[23],C}function Nv(n){const e=I.c(5),{itemId:t}=n;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:s}=Et(r),o=s??qt;let i;e[1]!==o?(i=Ue(o),e[1]=o,e[2]=i):i=e[2];const a=Ri(o,"WORKFLOW_EXECUTION",t,i);let c;return e[3]!==a?(c={item:a},e[3]=a,e[4]=c):c=e[4],c}function Ev(n){const e=I.c(13),{onBack:t}=n;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{itemId:s}=Et(r);let o;e[1]!==s?(o={itemId:s},e[1]=s,e[2]=o):o=e[2];const{item:i}=Nv(o);if(!i){let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Wi,{icon:m.jsx(Kc,{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]=d):d=e[3];let u;return e[4]!==t?(u=m.jsx(Sn,{onBack:t,children:d}),e[4]=t,e[5]=u):u=e[5],u}let l;e[6]!==i?(l=JSON.stringify(i,null,2),e[6]=i,e[7]=l):l=e[7];let a;e[8]!==l?(a=m.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:m.jsx(In,{height:"100%",code:l,language:"json",readOnly:!0})}),e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==a?(c=m.jsx(Sn,{onBack:t,children:a}),e[10]=t,e[11]=a,e[12]=c):c=e[12],c}const Tv={workflow:vv,workflow_execution:Ev,prompt:mm};function Mv(){const n=I.c(6),e=$c();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=t):t=n[0];const r=Et(t),s=decodeURIComponent(r.itemId);let o;n[1]!==e.history?(o=()=>{e.history.back()},n[1]=e.history,n[2]=o):o=n[2];const i=o,l=Av;let a;return n[3]!==i||n[4]!==s?(a=m.jsx(vm,{itemId:s,onBack:i,onUpdate:l}),n[3]=i,n[4]=s,n[5]=a):a=n[5],a}async function Av(n){return Promise.resolve()}function Ov(){const n=I.c(18),e=$c();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=t):t=n[0];const r=Et(t),s=r.connectionId,o=decodeURIComponent(r.collectionName),i=decodeURIComponent(r.itemId);let l;n[1]!==e.history?(l=()=>{e.history.back()},n[1]=e.history,n[2]=l):l=n[2];const a=l,c=s??qt;let d;n[3]!==c?(d=Ue(c),n[3]=c,n[4]=d):d=n[4];const f=ji(c,o,d);let h;n[5]!==f||n[6]!==i?(h=async C=>{i&&await f.update.mutateAsync({id:i,data:C})},n[5]=f,n[6]=i,n[7]=h):h=n[7];const p=h;let g;n[8]!==o?(g=o?.toLowerCase(),n[8]=o,n[9]=g):g=n[9];const y=g,x=y&&Tv[y];if(x){let C;return n[10]!==x||n[11]!==a||n[12]!==p||n[13]!==i?(C=m.jsx(x,{itemId:i,onBack:a,onUpdate:p}),n[10]=x,n[11]=a,n[12]=p,n[13]=i,n[14]=C):C=n[14],C}let b;n[15]===Symbol.for("react.memo_cache_sentinel")?(b=m.jsx(Wh,{size:36,className:"text-muted-foreground"}),n[15]=b):b=n[15];let k;return n[16]!==a?(k=m.jsx(Wi,{icon:b,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),n[16]=a,n[17]=k):k=n[17],k}function Iv(){const n=I.c(3);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=e):e=n[0];const t=Et(e);if(decodeURIComponent(t.collectionName)==="tools"){let i;return n[1]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Mv,{}),n[1]=i):i=n[1],i}let o;return n[2]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx(Ov,{}),n[2]=o):o=n[2],o}function R2(){const n=I.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.jsx(zc,{children:m.jsx(M.Suspense,{fallback:m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(nr,{size:32,className:"animate-spin text-muted-foreground"})}),children:m.jsx(Iv,{})})}),n[0]=e):e=n[0],e}export{R2 as default};
165
+ }`;r(t.name,{action:{...t.action,transformCode:O}}),i(hv)},e[2]=f,e[3]=t.action,e[4]=t.name,e[5]=r,e[6]=h):h=e[6];const p=h;let g;e[7]!==t.action||e[8]!==t.name||e[9]!==r?(g=(T,O)=>{r(t.name,{action:{...t.action,transformCode:T},...O?{outputSchema:O}:{}})},e[7]=t.action,e[8]=t.name,e[9]=r,e[10]=g):g=e[10];const y=g;if("code"in t.action&&t.action.code)return null;const x=o?"flex-1 min-h-0 overflow-hidden":"shrink-0";let b;e[11]!==x?(b=J("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",x),e[11]=x,e[12]=b):b=e[12];let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=k):k=e[13];let C;e[14]!==o?(C=m.jsxs("div",{className:"flex items-center justify-between",children:[k,o?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[14]=o,e[15]=C):C=e[15];let S;e[16]!==C||e[17]!==p?(S=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:C}),e[16]=C,e[17]=p,e[18]=S):S=e[18];let w;e[19]!==y||e[20]!==o||e[21]!==t.name||e[22]!==s||e[23]!==d?(w=o&&m.jsx("div",{className:"flex-1 min-h-0",children:m.jsx(In,{code:d,language:"typescript",readOnly:s!==void 0,onSave:y,height:"100%"},`transform-code-${t.name}-${s}`)}),e[19]=y,e[20]=o,e[21]=t.name,e[22]=s,e[23]=d,e[24]=w):w=e[24];let v;return e[25]!==b||e[26]!==S||e[27]!==w?(v=m.jsxs("div",{className:b,children:[S,w]}),e[25]=b,e[26]=S,e[27]=w,e[28]=v):v=e[28],v}function hv(n){return!n}function pv(n){return!n}function mv(n){const e=I.c(24),{step:t}=n,[r,s]=M.useState(!1),{updateStep:o}=Me(),i="code"in t.action&&t.action.code?t.action.code:null,l=Se();let a;e[0]!==t.action||e[1]!==t.name||e[2]!==o?(a=(b,k)=>{o(t.name,{action:{...t.action,code:b},...k?{outputSchema:k}:{}})},e[0]=t.action,e[1]=t.name,e[2]=o,e[3]=a):a=e[3];const c=a;if(!i)return null;const d=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let u;e[4]!==d?(u=J("flex flex-col border-b border-border",d),e[4]=d,e[5]=u):u=e[5];let f;e[6]!==r?(f=()=>s(!r),e[6]=r,e[7]=f):f=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==r?(p=m.jsxs("div",{className:"flex items-center justify-between",children:[h,r?m.jsx(Ji,{size:14,className:"text-muted-foreground"}):m.jsx(Ki,{size:14,className:"text-muted-foreground"})]}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:f,children:p}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let y;e[14]!==i||e[15]!==c||e[16]!==r||e[17]!==t.name||e[18]!==l?(y=r&&m.jsx("div",{className:"flex-1 min-h-0",children:m.jsx(In,{onSave:(b,k)=>c(b,k),code:i,language:"typescript",height:"100%",readOnly:l!==void 0},`step-code-${t.name}-${l}`)}),e[14]=i,e[15]=c,e[16]=r,e[17]=t.name,e[18]=l,e[19]=y):y=e[19];let x;return e[20]!==u||e[21]!==g||e[22]!==y?(x=m.jsxs("div",{className:u,children:[g,y]}),e[20]=u,e[21]=g,e[22]=y,e[23]=x):x=e[23],x}function Br(n){if(Array.isArray(n.type))return n.type.map(t=>Br({...n,type:t})).join(" | ");switch(n.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return n.items?`${Br(n.items)}[]`:"unknown[]";case"object":return n.properties?`{ ${Object.entries(n.properties).map(([r,s])=>{const o=Br(s),i=!n.required?.includes(r);return`${r}${i?"?":""}: ${o}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function gv(n){switch(n){case"success":return m.jsxs(un,{variant:"success",className:"gap-1",children:[m.jsx(zi,{size:11}),"Success"]});case"error":case"failed":return m.jsxs(un,{variant:"destructive",className:"gap-1",children:[m.jsx(Gi,{size:11}),"Error"]});case"running":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),"Running"]});case"enqueued":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),"On hold"]});case"cancelled":return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Hc,{size:11}),"Cancelled"]});default:return m.jsxs(un,{variant:"secondary",className:"gap-1",children:[m.jsx(Dr,{size:11}),n]})}}function yv(n){return`Run #${n.slice(-4).toUpperCase()}`}function xv(n){const e=I.c(21),{className:t}=n,{executions:r,isLoading:s}=Um(),{setShowExecutionsList:o}=Qi(),{setTrackingExecutionId:i}=Me(),l=Se();let a;e[0]!==i?(a=k=>{i(k)},e[0]=i,e[1]=a):a=e[1];const c=a;let d;e[2]!==o?(d=()=>{o(!1)},e[2]=o,e[3]=d):d=e[3];const u=d;let f;e[4]!==t?(f=J("flex flex-col h-full bg-sidebar border-l border-border",t),e[4]=t,e[5]=f):f=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Hc,{size:11}),e[7]=p):p=e[7];let g;e[8]!==u?(g=m.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:u,children:p})]}),e[8]=u,e[9]=g):g=e[9];let y;e[10]!==r||e[11]!==c||e[12]!==s||e[13]!==l?(y=s?m.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):r.map((k,C)=>m.jsx(bv,{execution:k,isSelected:k.id===l,isFirst:C===0,onSelect:()=>c(k.id)},k.id)),e[10]=r,e[11]=c,e[12]=s,e[13]=l,e[14]=y):y=e[14];let x;e[15]!==y?(x=m.jsx("div",{className:"flex-1 overflow-auto",children:y}),e[15]=y,e[16]=x):x=e[16];let b;return e[17]!==f||e[18]!==g||e[19]!==x?(b=m.jsxs("div",{className:f,children:[g,x]}),e[17]=f,e[18]=g,e[19]=x,e[20]=b):b=e[20],b}function bv(n){const e=I.c(17),{execution:t,isSelected:r,isFirst:s,onSelect:o}=n,i=r&&"bg-accent/50",l=s&&r&&"bg-accent/50",a=!r&&"hover:bg-accent/30";let c;e[0]!==i||e[1]!==l||e[2]!==a?(c=J("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",i,l,a),e[0]=i,e[1]=l,e[2]=a,e[3]=c):c=e[3];let d;e[4]!==t.status?(d=gv(t.status),e[4]=t.status,e[5]=d):d=e[5];let u;e[6]!==t.id?(u=yv(t.id),e[6]=t.id,e[7]=u):u=e[7];let f;e[8]!==u?(f=m.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:u}),e[8]=u,e[9]=f):f=e[9];let h;e[10]!==d||e[11]!==f?(h=m.jsxs("div",{className:"flex items-center gap-2 w-full",children:[d,f]}),e[10]=d,e[11]=f,e[12]=h):h=e[12];let p;return e[13]!==o||e[14]!==c||e[15]!==h?(p=m.jsx("div",{className:c,onClick:o,children:h}),e[13]=o,e[14]=c,e[15]=h,e[16]=p):p=e[16],p}function kv(n){const e=I.c(9),{itemId:t}=n;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:s}=Et(r),o=s??qt;let i;e[1]!==o?(i=Ue(o),e[1]=o,e[2]=i):i=e[2];const l=i,a=Ri(o,"WORKFLOW",t,l),c=ji(o,"WORKFLOW",l);let d;e[3]!==c||e[4]!==t?(d=async h=>{await c.update.mutateAsync({id:t,data:h})},e[3]=c,e[4]=t,e[5]=d):d=e[5];const u=d;let f;return e[6]!==a||e[7]!==u?(f={item:a,update:u},e[6]=a,e[7]=u,e[8]=f):f=e[8],f}function Sv(n){const e=I.c(18),{workflow:t,onUpdate:r}=n,{setWorkflow:s}=Me();let o,i,l,a;if(e[0]!==t.description||e[1]!==t.id||e[2]!==t.steps||e[3]!==t.title){const u={title:t.title,description:t.description,steps:t.steps};o=In,i=`workflow-${t.id}`,l="100%",a=JSON.stringify(u,null,2),e[0]=t.description,e[1]=t.id,e[2]=t.steps,e[3]=t.title,e[4]=o,e[5]=i,e[6]=l,e[7]=a}else o=e[4],i=e[5],l=e[6],a=e[7];let c;e[8]!==r||e[9]!==s||e[10]!==t?(c=u=>{const f=JSON.parse(u);s({...t,...f}),r(f)},e[8]=r,e[9]=s,e[10]=t,e[11]=c):c=e[11];let d;return e[12]!==o||e[13]!==i||e[14]!==l||e[15]!==a||e[16]!==c?(d=m.jsx(o,{height:l,code:a,language:"json",onSave:c},i),e[12]=o,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=d):d=e[17],d}function wv(){const n=I.c(12),{setTrackingExecutionId:e}=Me(),t=Se();let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"flex items-center justify-center h-full w-12",children:m.jsx(Vh,{className:"w-4 h-4 text-muted-foreground"})}),n[0]=r):r=n[0];let s;n[1]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("strong",{className:"text-base text-foreground",children:"Run"}),n[1]=s):s=n[1];let o;n[2]!==t?(o=m.jsxs("div",{className:"flex items-center h-full",children:[r,m.jsxs("p",{className:"flex gap-3 items-center h-full",children:[s,m.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",t]})]})]}),n[2]=t,n[3]=o):o=n[3];let i;n[4]!==e?(i=()=>e(void 0),n[4]=e,n[5]=i):i=n[5];let l;n[6]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx(Ii,{className:"w-4 h-4 text-muted-foreground"}),n[6]=l):l=n[6];let a;n[7]!==i?(a=m.jsx(me,{variant:"ghost",size:"xs",onClick:i,children:l}),n[7]=i,n[8]=a):a=n[8];let c;return n[9]!==o||n[10]!==a?(c=m.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[o,a]}),n[9]=o,n[10]=a,n[11]=c):c=n[11],c}function vv(n){const e=I.c(17),{onBack:t}=n;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{itemId:s}=Et(r);let o;e[1]!==s?(o={itemId:s},e[1]=s,e[2]=o):o=e[2];const{item:i,update:l}=kv(o);let a;e[3]!==i?(a=JSON.stringify(i),e[3]=i,e[4]=a):a=e[4];const c=a;if(!i){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Wi,{icon:m.jsx(Kc,{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]=h):h=e[5];let p;return e[6]!==t?(p=m.jsx(Sn,{onBack:t,children:h}),e[6]=t,e[7]=p):p=e[7],p}let d;e[8]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=i,e[9]=d):d=e[9];let u;e[10]!==t||e[11]!==l?(u=m.jsx(Cv,{onBack:t,onUpdate:l}),e[10]=t,e[11]=l,e[12]=u):u=e[12];let f;return e[13]!==c||e[14]!==d||e[15]!==u?(f=m.jsx(Lm,{initialState:d,children:u},c),e[13]=c,e[14]=d,e[15]=u,e[16]=f):f=e[16],f}function Cv(n){const e=I.c(24),{onBack:t,onUpdate:r}=n,s=jn(),o=Se(),{setOriginalWorkflow:i}=Me(),{viewMode:l,showExecutionsList:a}=Qi(),c=pr();let d;e[0]!==r||e[1]!==i||e[2]!==s?(d=async()=>{await r(s),i(s)},e[0]=r,e[1]=i,e[2]=s,e[3]=d):d=e[3];const u=d,f=c&&"toolName"in c.action,h=f?c.action.toolName:null,p=f&&!h&&!o,g=!p&&(c||o||!a);let y;e[4]!==u||e[5]!==s.description||e[6]!==s.title?(y=m.jsx(iw,{title:s.title,description:s.description,onSave:u}),e[4]=u,e[5]=s.description,e[6]=s.title,e[7]=y):y=e[7];let x;e[8]!==o?(x=o&&m.jsx(wv,{}),e[8]=o,e[9]=x):x=e[9];let b;e[10]!==r||e[11]!==a||e[12]!==g||e[13]!==p||e[14]!==l||e[15]!==s?(b=m.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?m.jsx(Sv,{workflow:s,onUpdate:r}):m.jsxs(op,{direction:"horizontal",className:"flex w-full h-full",children:[m.jsx(Kl,{defaultSize:50,minSize:30,children:m.jsx(Cw,{})}),m.jsx(ip,{}),m.jsxs(Kl,{defaultSize:50,minSize:25,children:[p&&m.jsx(Tw,{className:"border-l border-border"}),a&&m.jsx(xv,{}),g&&m.jsx(sv,{className:"border-l border-border"})]})]})}),e[10]=r,e[11]=a,e[12]=g,e[13]=p,e[14]=l,e[15]=s,e[16]=b):b=e[16];let k;e[17]!==y||e[18]!==x||e[19]!==b?(k=m.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[y,x,b]}),e[17]=y,e[18]=x,e[19]=b,e[20]=k):k=e[20];let C;return e[21]!==t||e[22]!==k?(C=m.jsx(Sn,{onBack:t,children:k}),e[21]=t,e[22]=k,e[23]=C):C=e[23],C}function Nv(n){const e=I.c(5),{itemId:t}=n;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:s}=Et(r),o=s??qt;let i;e[1]!==o?(i=Ue(o),e[1]=o,e[2]=i):i=e[2];const a=Ri(o,"WORKFLOW_EXECUTION",t,i);let c;return e[3]!==a?(c={item:a},e[3]=a,e[4]=c):c=e[4],c}function Ev(n){const e=I.c(13),{onBack:t}=n;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{itemId:s}=Et(r);let o;e[1]!==s?(o={itemId:s},e[1]=s,e[2]=o):o=e[2];const{item:i}=Nv(o);if(!i){let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Wi,{icon:m.jsx(Kc,{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]=d):d=e[3];let u;return e[4]!==t?(u=m.jsx(Sn,{onBack:t,children:d}),e[4]=t,e[5]=u):u=e[5],u}let l;e[6]!==i?(l=JSON.stringify(i,null,2),e[6]=i,e[7]=l):l=e[7];let a;e[8]!==l?(a=m.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:m.jsx(In,{height:"100%",code:l,language:"json",readOnly:!0})}),e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==a?(c=m.jsx(Sn,{onBack:t,children:a}),e[10]=t,e[11]=a,e[12]=c):c=e[12],c}const Tv={workflow:vv,workflow_execution:Ev,prompt:mm};function Mv(){const n=I.c(6),e=$c();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=t):t=n[0];const r=Et(t),s=decodeURIComponent(r.itemId);let o;n[1]!==e.history?(o=()=>{e.history.back()},n[1]=e.history,n[2]=o):o=n[2];const i=o,l=Av;let a;return n[3]!==i||n[4]!==s?(a=m.jsx(vm,{itemId:s,onBack:i,onUpdate:l}),n[3]=i,n[4]=s,n[5]=a):a=n[5],a}async function Av(n){return Promise.resolve()}function Ov(){const n=I.c(18),e=$c();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=t):t=n[0];const r=Et(t),s=r.connectionId,o=decodeURIComponent(r.collectionName),i=decodeURIComponent(r.itemId);let l;n[1]!==e.history?(l=()=>{e.history.back()},n[1]=e.history,n[2]=l):l=n[2];const a=l,c=s??qt;let d;n[3]!==c?(d=Ue(c),n[3]=c,n[4]=d):d=n[4];const f=ji(c,o,d);let h;n[5]!==f||n[6]!==i?(h=async C=>{i&&await f.update.mutateAsync({id:i,data:C})},n[5]=f,n[6]=i,n[7]=h):h=n[7];const p=h;let g;n[8]!==o?(g=o?.toLowerCase(),n[8]=o,n[9]=g):g=n[9];const y=g,x=y&&Tv[y];if(x){let C;return n[10]!==x||n[11]!==a||n[12]!==p||n[13]!==i?(C=m.jsx(x,{itemId:i,onBack:a,onUpdate:p}),n[10]=x,n[11]=a,n[12]=p,n[13]=i,n[14]=C):C=n[14],C}let b;n[15]===Symbol.for("react.memo_cache_sentinel")?(b=m.jsx(Wh,{size:36,className:"text-muted-foreground"}),n[15]=b):b=n[15];let k;return n[16]!==a?(k=m.jsx(Wi,{icon:b,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),n[16]=a,n[17]=k):k=n[17],k}function Iv(){const n=I.c(3);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},n[0]=e):e=n[0];const t=Et(e);if(decodeURIComponent(t.collectionName)==="tools"){let i;return n[1]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Mv,{}),n[1]=i):i=n[1],i}let o;return n[2]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx(Ov,{}),n[2]=o):o=n[2],o}function j2(){const n=I.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.jsx(zc,{children:m.jsx(M.Suspense,{fallback:m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(nr,{size:32,className:"animate-spin text-muted-foreground"})}),children:m.jsx(Iv,{})})}),n[0]=e):e=n[0],e}export{j2 as default};