@decocms/mesh 1.10.0 → 1.11.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.
- package/dist/client/assets/{AlertCircle-DxJIdkjA.js → AlertCircle-DIUuKH85.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CrgZDDUZ.js → ArrowLeft-CkUzXRaI.js} +1 -1
- package/dist/client/assets/{ChevronDown-B2VaHCqC.js → ChevronDown-BvW0ckZD.js} +1 -1
- package/dist/client/assets/ChevronRight-CZtzKGIu.js +1 -0
- package/dist/client/assets/{Copy01-DfnjsOeR.js → Copy01-CuJ0g2xO.js} +1 -1
- package/dist/client/assets/DotsHorizontal-DYEmF2Ja.js +1 -0
- package/dist/client/assets/{DotsVertical-DIWcHGKr.js → DotsVertical-BeEwh9bI.js} +1 -1
- package/dist/client/assets/{File06-DSeIH9xM.js → File06-CRLpAcG8.js} +1 -1
- package/dist/client/assets/FilterLines-Dunahtdb.js +1 -0
- package/dist/client/assets/{FlipBackward-s0RSv_vj.js → FlipBackward-BNVbTeUf.js} +1 -1
- package/dist/client/assets/{GitBranch01-CeFBxnqq.js → GitBranch01-C6HWIzG8.js} +1 -1
- package/dist/client/assets/{Grid01-Ch9rI6P9.js → Grid01-abxNmH9m.js} +1 -1
- package/dist/client/assets/{Inbox01-7z9hTUsw.js → Inbox01-BgT9AcaM.js} +1 -1
- package/dist/client/assets/{InfoCircle-DQaxWpv9.js → InfoCircle-BsiOwq0l.js} +1 -1
- package/dist/client/assets/{Key01-CH9qCC00.js → Key01-B5WpAxl2.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DZDUBWQO.js → LinkExternal01-CZ9G6wJu.js} +1 -1
- package/dist/client/assets/{Loading01-B0dLQInZ.js → Loading01-moxMTYJZ.js} +1 -1
- package/dist/client/assets/{Lock01-wpG8qO-9.js → Lock01-DK8m996z.js} +1 -1
- package/dist/client/assets/Play-ZrtDSXtF.js +1 -0
- package/dist/client/assets/{Plus-D_XbrIfI.js → Plus-CmJGP3Pi.js} +1 -1
- package/dist/client/assets/{Terminal-BSL9-A7C.js → Terminal-D78hWJeY.js} +1 -1
- package/dist/client/assets/{Trash01-aTCf1hVv.js → Trash01-D5RX1AvX.js} +1 -1
- package/dist/client/assets/{X-BgwVwwIy.js → X-DYwfZFnc.js} +1 -1
- package/dist/client/assets/XClose-Blj-z_Lg.js +1 -0
- package/dist/client/assets/{alert-dialog-DIexFXOj.js → alert-dialog-2_Xl_cUo.js} +3 -3
- package/dist/client/assets/auth-CPKE7Qi_.js +1 -0
- package/dist/client/assets/{auth-catchall-Cp5vKmTi.js → auth-catchall-asPM_Gpt.js} +1 -1
- package/dist/client/assets/{avatar-Bf0qQU4w.js → avatar-NJ2X4Ohl.js} +1 -1
- package/dist/client/assets/{badge-CgEtLuTw.js → badge-CSFb4yoL.js} +1 -1
- package/dist/client/assets/button-B6d9pLjw.js +1 -0
- package/dist/client/assets/{card-ciO_SNWh.js → card-D98cnfOH.js} +1 -1
- package/dist/client/assets/checkbox-B3KsIzSA.js +1 -0
- package/dist/client/assets/{collection-detail-msiVYwQa.js → collection-detail-7jpdrsjG.js} +4 -4
- package/dist/client/assets/collection-display-button-B_3aOLS4.js +1 -0
- package/dist/client/assets/{collection-header-BkZGWAxm.js → collection-header-Dofk8u1h.js} +1 -1
- package/dist/client/assets/{collection-page-CREYFoHa.js → collection-page-B1QnvJAf.js} +1 -1
- package/dist/client/assets/collection-search-DT3IVSbs.js +1 -0
- package/dist/client/assets/collection-tab-2aj2IyYN.js +1 -0
- package/dist/client/assets/{collection-table-wrapper-Dnmr37nE.js → collection-table-wrapper-DzYv1LYJ.js} +1 -1
- package/dist/client/assets/{connection-card-Dcrw1pJ1.js → connection-card-DoZG4KYv.js} +1 -1
- package/dist/client/assets/connection-detail-CG5F7eYm.js +1 -0
- package/dist/client/assets/connections-DBqko-au.js +1 -0
- package/dist/client/assets/constants-CRMW04Tq.js +1 -0
- package/dist/client/assets/{create-organization-dialog-CYQoklT3.js → create-organization-dialog-chOw1gL3.js} +1 -1
- package/dist/client/assets/{dialog-D4dy2US8.js → dialog-CaCpZWVz.js} +1 -1
- package/dist/client/assets/dropdown-menu-DKq7y9Ab.js +1 -0
- package/dist/client/assets/{empty-state-CA7indKP.js → empty-state-xLD9BV9Z.js} +1 -1
- package/dist/client/assets/env-vars-editor-BIyKC4Rz.js +1 -0
- package/dist/client/assets/{error-boundary-Ba_T3BIS.js → error-boundary-ZHp5NunN.js} +1 -1
- package/dist/client/assets/extract-connection-data-DaYEiIhd.js +1 -0
- package/dist/client/assets/{form-rbCVC2Lc.js → form-C_Mz-Re1.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-Bsssu-td.js → formatDistanceToNow-CxfQwfjE.js} +1 -1
- package/dist/client/assets/gateway-detail-BH34ou9a.js +1 -0
- package/dist/client/assets/gateway-selector-DgKTRIKP.js +1 -0
- package/dist/client/assets/gateways-D_z8EWpe.js +1 -0
- package/dist/client/assets/github-icon-BrF3LMLL.js +1 -0
- package/dist/client/assets/{home-0xYKq0nN.js → home-DwiZZ6Lk.js} +1 -1
- package/dist/client/assets/index-BjKus4OW.css +1 -0
- package/dist/client/assets/{index-BGmLHZvN.js → index-CjDpnJWb.js} +5 -5
- package/dist/client/assets/{index-B9fZ40p9.js → index-CytkXEgd.js} +21 -21
- package/dist/client/assets/index-DFBaadWa.js +1 -0
- package/dist/client/assets/{input-C3lfdgit.js → input-hiMZ1V63.js} +1 -1
- package/dist/client/assets/{layout-BgUF9JkX.js → layout-DEsRSKAp.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-Buv6v3mS.js → lazy-highlighter-CgR5ZMfY.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BGRuWcRT.js → localstorage-keys-CpCKetOn.js} +1 -1
- package/dist/client/assets/{login-fFNSXfGP.js → login-9yN2SgKi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DacADfyW.js → mcp-oauth-D_E4Op0m.js} +1 -1
- package/dist/client/assets/mcp-server-detail-DPNY9vgF.js +1 -0
- package/dist/client/assets/members-VwgW_g24.js +3 -0
- package/dist/client/assets/{monaco-editor-uZe9l_bJ.js → monaco-editor-DAqCldiN.js} +4 -4
- package/dist/client/assets/monitoring-BdaWFgQZ.js +49 -0
- package/dist/client/assets/{oauth-callback-zUOuo71p.js → oauth-callback-C_lwUhYa.js} +1 -1
- package/dist/client/assets/page-BH17Xeeo.js +35 -0
- package/dist/client/assets/page-CRqZQKSl.js +1 -0
- package/dist/client/assets/pin-to-sidebar-button-Dmct01St.js +1 -0
- package/dist/client/assets/popover-Clubonj7.js +1 -0
- package/dist/client/assets/project-context-provider-DtvnTwVB.js +1 -0
- package/dist/client/assets/resizable-BPaAYZlg.js +1 -0
- package/dist/client/assets/{resource-tabs-ltvgVmlK.js → resource-tabs-D70FgHGt.js} +1 -1
- package/dist/client/assets/select-DSYJVHKu.js +1 -0
- package/dist/client/assets/settings-D8ofqvqO.js +1 -0
- package/dist/client/assets/shell-layout-GW5ptB5d.js +19 -0
- package/dist/client/assets/{spinner-CDnZnQfr.js → spinner-wRRUlECI.js} +1 -1
- package/dist/client/assets/switch-DBKcBjJ4.js +1 -0
- package/dist/client/assets/{textarea-CvmD-TCl.js → textarea-YnyjDZNX.js} +1 -1
- package/dist/client/assets/{thread-history-popover-BQKKEP-v.js → thread-history-popover-MOKjUScw.js} +37 -37
- package/dist/client/assets/tools-list-CurlBMu7.js +1 -0
- package/dist/client/assets/{use-binding-BWHEOuVA.js → use-binding-DQAwqqzW.js} +1 -1
- package/dist/client/assets/use-connection-CD_z3y8h.js +2 -0
- package/dist/client/assets/{use-connection-resources-DbXXhKLF.js → use-connection-resources-vGIbHphJ.js} +1 -1
- package/dist/client/assets/use-gateway-DTR5dTeA.js +1 -0
- package/dist/client/assets/{use-list-state-vrSW0egR.js → use-list-state-Da9AxEO9.js} +1 -1
- package/dist/client/assets/{use-mcp-BXJqKT0W.js → use-mcp-BX-QiIqs.js} +1 -1
- package/dist/client/assets/use-members-CCurAGbi.js +1 -0
- package/dist/client/assets/{use-mobile-CG0P5-tt.js → use-mobile-h7BkfBcD.js} +1 -1
- package/dist/client/assets/{use-organization-settings-jxyxG3Do.js → use-organization-settings-B9z0BdMT.js} +1 -1
- package/dist/client/assets/{use-tool-call-vWU--CYB.js → use-tool-call-NuFBLRMj.js} +1 -1
- package/dist/client/assets/useQuery-DUm3_rZs.js +1 -0
- package/dist/client/assets/value-BH4rnske.js +1 -0
- package/dist/client/assets/{view-mode-toggle-CTKggGXJ.js → view-mode-toggle-DZJhL4Oe.js} +1 -1
- package/dist/client/assets/{well-known-mcp-VNRT0JrW.js → well-known-mcp-D13f-8h2.js} +1 -1
- package/dist/client/assets/workflow-Btak9-NU.js +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +2 -3
- package/dist/client/assets/Clock-CafJ8d76.js +0 -1
- package/dist/client/assets/Code01-BHMAmoGH.js +0 -1
- package/dist/client/assets/CpuChip02-qVpLCR0_.js +0 -1
- package/dist/client/assets/Play-DSXQEflq.js +0 -1
- package/dist/client/assets/SearchMd-BJbLhbUT.js +0 -1
- package/dist/client/assets/XClose-sskkBH5X.js +0 -1
- package/dist/client/assets/auth-BnF0Tfz9.js +0 -1
- package/dist/client/assets/button-O0CudEuW.js +0 -1
- package/dist/client/assets/checkbox-DUc30Qpz.js +0 -1
- package/dist/client/assets/collection-display-button-BVgPIpv0.js +0 -1
- package/dist/client/assets/collection-search-s9G5Psps.js +0 -1
- package/dist/client/assets/collection-tab-T_hhyR7G.js +0 -1
- package/dist/client/assets/connection-detail-ByP6chqW.js +0 -1
- package/dist/client/assets/connections-DYOzkJYx.js +0 -1
- package/dist/client/assets/constants-BG4081pg.js +0 -1
- package/dist/client/assets/dropdown-menu-DjELCVXr.js +0 -1
- package/dist/client/assets/env-vars-editor-CFmirc3J.js +0 -1
- package/dist/client/assets/extract-connection-data-Bm1qZWCV.js +0 -1
- package/dist/client/assets/gateway-detail-JYrV5S3_.js +0 -1
- package/dist/client/assets/gateways--haP9jLk.js +0 -1
- package/dist/client/assets/index-BNguAQBW.js +0 -1
- package/dist/client/assets/index-C9WZdaPe.js +0 -1
- package/dist/client/assets/index-CmUsR6rx.css +0 -1
- package/dist/client/assets/members-CAufZALX.js +0 -3
- package/dist/client/assets/monitoring-DTJtueom.js +0 -4
- package/dist/client/assets/page-BP6lcPxY.js +0 -21
- package/dist/client/assets/pin-to-sidebar-button-DcWM6FTO.js +0 -1
- package/dist/client/assets/popover-BRnyFKtN.js +0 -1
- package/dist/client/assets/registry-utils-ulDDT0d8.js +0 -1
- package/dist/client/assets/resizable-Bcc9SJfZ.js +0 -1
- package/dist/client/assets/responsive-select-BbaQnOfE.js +0 -1
- package/dist/client/assets/select-Dsuiuagq.js +0 -1
- package/dist/client/assets/settings-Br4mx_yy.js +0 -1
- package/dist/client/assets/shell-layout-CM_S8ji4.js +0 -19
- package/dist/client/assets/store-CJqU95FV.js +0 -1
- package/dist/client/assets/store-app-detail-Bb4mx26e.js +0 -1
- package/dist/client/assets/switch-DhyQ2_hE.js +0 -1
- package/dist/client/assets/tools-list-zpc-T8zT.js +0 -1
- package/dist/client/assets/tooltip-DaImUyOX.js +0 -1
- package/dist/client/assets/types-BDHiECry.js +0 -46
- package/dist/client/assets/use-connection-9XNP6qUi.js +0 -2
- package/dist/client/assets/use-gateway-BU92tNo7.js +0 -1
- package/dist/client/assets/use-members-eTAFi1HF.js +0 -1
- package/dist/client/assets/useQuery-nlt5lRkW.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-o35GYPjZ.js +0 -1
- package/dist/client/assets/workflow-DTYA39cO.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{aj as qe,r as M,v as Ch,w as uo,c as I,j as m,g as Ti,y as Nh,i as Eh,d as Et,b as Th,t as jc,F as ee,Q as Mh,ak as Dc,a5 as Ah,a4 as Oh,al as Ih,H as Mi,am as Pc,an as Rh,B as On,E as He,$ as Ai,ao as jh,z as Ds,ap as Dh,Z as Oi,aq as Ph,ar as Lh,as as $h,at as Ii,au as _h,av as Lc,a1 as zh,aw as Bh,L as Fh,ax as Hh,af as $c}from"./index-B9fZ40p9.js";import{U as qt,f as Ri,d as ji,c as Ue,b as Di,I as Ps,u as Vh,n as Wh}from"./use-connection-9XNP6qUi.js";import{E as _c}from"./SearchMd-BJbLhbUT.js";import{E as zc}from"./error-boundary-Ba_T3BIS.js";import{P as Pi}from"./pin-to-sidebar-button-DcWM6FTO.js";import{B as me,c as J}from"./button-O0CudEuW.js";import{F as fo,a as qh,b as Li,d as $i}from"./form-rbCVC2Lc.js";import{I as _i}from"./input-C3lfdgit.js";import{T as Uo}from"./textarea-CvmD-TCl.js";import{b as Lt,T as $t,a as _t,c as zt,i as zi,d as Uh}from"./tooltip-DaImUyOX.js";import{i as Bc}from"./FlipBackward-s0RSv_vj.js";import{a as Fc,V as Bi,b as Sn}from"./layout-BgUF9JkX.js";import{i as Kh}from"./AlertCircle-DxJIdkjA.js";import{s as Jh}from"./Clock-CafJ8d76.js";import{i as Gh,n as Xh}from"./Code01-BHMAmoGH.js";import{a as Yh}from"./Copy01-DfnjsOeR.js";import{i as nr}from"./Loading01-B0dLQInZ.js";import{i as Fi}from"./Play-DSXQEflq.js";import{s as Hi,i as Qh}from"./XClose-sskkBH5X.js";import{u as Zh,O as ep,M as tp,F as np,v as rp}from"./index-BGmLHZvN.js";import{u as Vi}from"./use-mcp-BXJqKT0W.js";import{M as In}from"./monaco-editor-uZe9l_bJ.js";import{E as Wi}from"./empty-state-CA7indKP.js";import{D as sp,u as op}from"./use-binding-BWHEOuVA.js";import{u as ip}from"./use-gateway-BU92tNo7.js";import{G as lp,b as ap,R as Kl,a as cp}from"./resizable-Bcc9SJfZ.js";import{S as Ls}from"./spinner-CDnZnQfr.js";import{V as dp}from"./view-mode-toggle-CTKggGXJ.js";import{i as up}from"./GitBranch01-CeFBxnqq.js";import{i as fp}from"./responsive-select-BbaQnOfE.js";import{a as qi,b as Ui}from"./use-tool-call-vWU--CYB.js";import{D as hp,a as pp,b as mp,f as gp,c as yp,d as xp}from"./dialog-D4dy2US8.js";import"./index-C9WZdaPe.js";import{s as Hc}from"./Plus-D_XbrIfI.js";import{b as bp,D as kp,a as Sp,c as Jl}from"./dropdown-menu-DjELCVXr.js";import{B as un}from"./badge-CgEtLuTw.js";import{i as Vc}from"./X-BgwVwwIy.js";import"./use-organization-settings-jxyxG3Do.js";import"./ArrowLeft-CrgZDDUZ.js";import"./mcp-oauth-DacADfyW.js";import"./auth-BnF0Tfz9.js";import"./env-vars-editor-CFmirc3J.js";import"./Trash01-aTCf1hVv.js";import"./File06-DSeIH9xM.js";import"./Key01-CH9qCC00.js";import"./select-Dsuiuagq.js";import"./ChevronDown-B2VaHCqC.js";import"./Terminal-BSL9-A7C.js";import"./CpuChip02-qVpLCR0_.js";import"./formatDistanceToNow-Bsssu-td.js";import"./constants-BG4081pg.js";import"./registry-utils-ulDDT0d8.js";import"./extract-connection-data-Bm1qZWCV.js";import"./generate-id-Dyweu44Y.js";import"./index-BNguAQBW.js";import"./useQuery-nlt5lRkW.js";import"./use-mobile-CG0P5-tt.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 Hp(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 Vp="[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===Vp)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:Hp,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(Li,{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(Li,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx($i,{children:m.jsx(_i,{...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(Li,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx($i,{children:m.jsx(_i,{...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 H=!g.formState.isDirty||f;let B;e[31]!==k?(B=()=>{k()},e[31]=k,e[32]=B):B=e[32];let V;e[33]===Symbol.for("react.memo_cache_sentinel")?(V=m.jsx(Xi,{size:14}),e[33]=V):V=e[33];let N;e[34]!==H||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:H,onClick:B,"aria-label":"Save",children:V})})}),e[34]=H,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=Zh(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(ep,{onAuthenticate:()=>s(),buttonText:"Go back to authenticate"}):m.jsx(tp,{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=Vi({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),H=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]:_}))},V=()=>{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(_i,{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(Jh,{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:H,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:V,disabled:!h&&!g,children:m.jsx(Hi,{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(Kh,{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(Yh,{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(Gh,{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 He,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 Hh,aG as $c}from"./index-CytkXEgd.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 Vh,n as Wh}from"./use-connection-CD_z3y8h.js";import{E as zc}from"./error-boundary-ZHp5NunN.js";import{P as Pi}from"./pin-to-sidebar-button-Dmct01St.js";import{B as me,c as J}from"./button-B6d9pLjw.js";import{F as fo,a as qh,b as Li,d as $i}from"./form-C_Mz-Re1.js";import{I as _i}from"./input-hiMZ1V63.js";import{T as Uo}from"./textarea-YnyjDZNX.js";import{b as Lt,T as $t,a as _t,c as zt,i as zi}from"./project-context-provider-DtvnTwVB.js";import{i as Bc}from"./FlipBackward-BNVbTeUf.js";import{a as Fc,V as Bi,b as Sn}from"./layout-DEsRSKAp.js";import{i as Uh}from"./AlertCircle-DIUuKH85.js";import{s as Kh,M as In}from"./monaco-editor-DAqCldiN.js";import{i as Fi,a as Jh,n as Gh}from"./Play-ZrtDSXtF.js";import{a as Xh}from"./Copy01-CuJ0g2xO.js";import{i as nr}from"./Loading01-moxMTYJZ.js";import{s as Hi}from"./XClose-Blj-z_Lg.js";import{u as Yh,O as Qh,M as Zh,F as ep,v as tp}from"./index-CjDpnJWb.js";import{u as Vi}from"./use-mcp-BX-QiIqs.js";import{E as Wi}from"./empty-state-xLD9BV9Z.js";import{D as np,u as rp}from"./use-binding-DQAwqqzW.js";import{u as sp}from"./use-gateway-DTR5dTeA.js";import{b as op,R as Kl,a as ip}from"./resizable-BPaAYZlg.js";import{G as lp,i as ap}from"./gateway-selector-DgKTRIKP.js";import{S as Ls}from"./spinner-wRRUlECI.js";import{V as cp}from"./view-mode-toggle-DZJhL4Oe.js";import{i as dp}from"./GitBranch01-C6HWIzG8.js";import{a as qi,b as Ui}from"./use-tool-call-NuFBLRMj.js";import{D as up,a as fp,b as hp,f as pp,c as mp,d as gp}from"./dialog-CaCpZWVz.js";import"./index-DFBaadWa.js";import{s as Hc}from"./Plus-CmJGP3Pi.js";import{i as yp}from"./DotsHorizontal-DYEmF2Ja.js";import{b as xp,D as bp,a as kp,c as Jl}from"./dropdown-menu-DKq7y9Ab.js";import{i as Sp}from"./ChevronRight-CZtzKGIu.js";import{B as un}from"./badge-CSFb4yoL.js";import{i as Vc}from"./X-DYwfZFnc.js";import"./use-organization-settings-B9z0BdMT.js";import"./ArrowLeft-CkUzXRaI.js";import"./mcp-oauth-D_E4Op0m.js";import"./auth-CPKE7Qi_.js";import"./env-vars-editor-BIyKC4Rz.js";import"./Trash01-D5RX1AvX.js";import"./File06-CRLpAcG8.js";import"./Key01-B5WpAxl2.js";import"./select-DSYJVHKu.js";import"./ChevronDown-BvW0ckZD.js";import"./Terminal-D78hWJeY.js";import"./formatDistanceToNow-CxfQwfjE.js";import"./constants-CRMW04Tq.js";import"./github-icon-BrF3LMLL.js";import"./extract-connection-data-DaYEiIhd.js";import"./generate-id-Dyweu44Y.js";import"./useQuery-DUm3_rZs.js";import"./use-mobile-h7BkfBcD.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 Hp(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 Vp="[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===Vp)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:Hp,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(Li,{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(Li,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx($i,{children:m.jsx(_i,{...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(Li,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx($i,{children:m.jsx(_i,{...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 H=!g.formState.isDirty||f;let B;e[31]!==k?(B=()=>{k()},e[31]=k,e[32]=B):B=e[32];let V;e[33]===Symbol.for("react.memo_cache_sentinel")?(V=m.jsx(Xi,{size:14}),e[33]=V):V=e[33];let N;e[34]!==H||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:H,onClick:B,"aria-label":"Save",children:V})})}),e[34]=H,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=Vi({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),H=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]:_}))},V=()=>{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(_i,{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:H,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:V,disabled:!h&&!g,children:m.jsx(Hi,{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
|
`)}
|
|
5
5
|
}`}return`interface ${e} ${t(n)}`}function mo(n,e){const t=n.trim();return e.some(s=>s.name.toLowerCase()===t.toLowerCase())?`${t}_${Math.random().toString(36).substring(2,6)}`:t}function Dm(n,e){const t=n.match(/interface\s+Input\s*\{/);if(!t||t.index===void 0)return`${e}
|
|
6
6
|
|
|
7
|
-
${n.trimStart()}`;const r=t.index,s=r+t[0].length-1;let o=1,i=s+1;for(;i<n.length&&o>0;)n[i]==="{"?o++:n[i]==="}"&&o--,i++;return n.slice(0,r)+e+n.slice(i)}function go(n,e){switch(n){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...sp,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${n}`)}}const ld=M.createContext(null),Pm=n=>Yi()(id(e=>({...n,actions:{setIsAddingStep:t=>e(r=>({...r,isAddingStep:t})),setCurrentStepTab:t=>e(r=>({...r,currentStepTab:t})),setToolAction:t=>e(r=>({workflow:{...r.workflow,steps:r.workflow.steps.map(s=>"toolName"in s.action&&s.action.toolName===t.toolName?{...s,action:t}:s)}})),appendStep:({step:t,type:r})=>e(s=>{const o=t??go(r,s.workflow.steps.length),i=s.workflow.steps.find(a=>a.name===o.name),l=i?`${o.name} ${parseInt(i.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:o.name;return{workflow:{...s.workflow,steps:[...s.workflow.steps,{...o,name:l}]}}}),deleteStep:t=>e(r=>({workflow:{...r.workflow,steps:r.workflow.steps.filter(s=>s.name!==t)}})),duplicateStep:t=>e(r=>{const s=r.workflow.steps.findIndex(a=>a.name===t);if(s===-1)return r;const o=r.workflow.steps[s];if(!o)return r;const i={...o,name:mo(o.name,r.workflow.steps)},l=[...r.workflow.steps];return l.splice(s+1,0,i),{workflow:{...r.workflow,steps:l},currentStepName:i.name}}),setCurrentStepName:t=>e(r=>({...r,currentStepName:t})),updateStep:(t,r)=>e(s=>({...s,workflow:{...s.workflow,steps:s.workflow.steps.map(o=>o.name===t?{...o,...r}:o)}})),setTrackingExecutionId:t=>e(r=>({...r,trackingExecutionId:t})),resetToOriginalWorkflow:()=>e(t=>({...t,workflow:t.localWorkflow})),startAddingStep:t=>e(r=>({...r,isAddingStep:!0,addingStepType:t})),cancelAddingStep:()=>e(t=>({...t,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:t=>e(r=>{const s=r.selectedParentSteps.includes(t);return{...r,selectedParentSteps:s?r.selectedParentSteps.filter(o=>o!==t):[...r.selectedParentSteps,t]}}),confirmAddCodeStep:()=>e(t=>{const{selectedParentSteps:r,addingStepType:s,workflow:o}=t;if(s!=="code"||r.length===0)return t;const i={};for(const u of r)i[u]=`@${u}`;const l={};for(const u of r){const f=o.steps.find(h=>h.name===u);f?.outputSchema&&(l[u]=f.outputSchema)}const a=Object.keys(l).length>0?{type:"object",properties:l,required:Object.keys(l)}:void 0;let c=go("code",Number((Math.random()*1e6).toFixed(0)));if(c={...c,input:i},a){const u=jm(a,"Input"),f=c.action,h=Dm(f.code,u);c={...c,action:{...f,code:h}}}const d=mo(c.name,o.steps);return{...t,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...o,steps:[...o.steps,{...c,name:d}]},currentStepName:d}}),addToolStep:()=>e(t=>{let r=go("tool",Number((Math.random()*1e6).toFixed(0)));const s=mo(r.name,t.workflow.steps);return{...t,isAddingStep:!1,addingStepType:null,workflow:{...t.workflow,steps:[...t.workflow.steps,{...r,name:s}]},currentStepName:s}}),setOriginalWorkflow:t=>e(r=>({...r,localWorkflow:t})),setWorkflow:t=>e(r=>({...r,workflow:t})),startReplacingTool:t=>e(r=>({...r,replacingToolInfo:{toolName:t}})),cancelReplacingTool:()=>e(t=>({...t,replacingToolInfo:null})),setSelectedGatewayId:t=>e(r=>({...r,selectedGatewayId:t}))}}),{name:`workflow-store-${encodeURIComponent(n.workflow.id)}`,storage:od(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,localWorkflow:e.localWorkflow,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedGatewayId:e.selectedGatewayId})}));function Lm(n){const e=I.c(8),{children:t,initialState:r}=n,s=ip();let o;e[0]!==s?.[0]?.id||e[1]!==r.currentStepTab||e[2]!==r.trackingExecutionId||e[3]!==r.workflow?(o=()=>Pm({workflow:r.workflow,localWorkflow:r.workflow,selectedGatewayId:s?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:r.trackingExecutionId,currentStepName:r.workflow.steps[0]?.name,currentStepTab:r.currentStepTab??"input"}),e[0]=s?.[0]?.id,e[1]=r.currentStepTab,e[2]=r.trackingExecutionId,e[3]=r.workflow,e[4]=o):o=e[4];const[i]=M.useState(o);let l;return e[5]!==t||e[6]!==i?(l=m.jsx(ld.Provider,{value:i,children:t}),e[5]=t,e[6]=i,e[7]=l):l=e[7],l}function Rn(n,e){const t=M.useContext(ld);if(!t)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Om(t,n,Rm)}function jn(){return Rn($m)}function $m(n){return n.workflow}function Me(){return Rn(_m)}function _m(n){return n.actions}function ad(){const n=mr();return Rn(zm)??n[0]?.name}function zm(n){return n.currentStepName}function pr(){const n=I.c(5),e=ad(),t=mr();let r;if(n[0]!==e||n[1]!==t){let o;n[3]!==e?(o=i=>i.name===e,n[3]=e,n[4]=o):o=n[4],r=t.find(o),n[0]=e,n[1]=t,n[2]=r}else r=n[2];const s=r;return s||t[0]}function mr(){return jn().steps}function cd(){const n=I.c(8),e=jn(),t=Rn(Hm);let r,s;if(n[0]!==t.description||n[1]!==t.steps||n[2]!==t.title||n[3]!==e.description||n[4]!==e.steps||n[5]!==e.title){const o={title:e.title,description:e.description,steps:e.steps.map(Fm)},i={title:t.title,description:t.description,steps:t.steps.map(Bm)};r=JSON.stringify(o),s=JSON.stringify(i),n[0]=t.description,n[1]=t.steps,n[2]=t.title,n[3]=e.description,n[4]=e.steps,n[5]=e.title,n[6]=r,n[7]=s}else r=n[6],s=n[7];return r!==s}function Bm(n){return{...n,outputSchema:void 0}}function Fm(n){return{...n,outputSchema:void 0}}function Hm(n){return n.localWorkflow}function Se(){return Rn(Vm)}function Vm(n){return n.trackingExecutionId}function Dn(){return Rn(Wm)}function Wm(n){return n.selectedGatewayId}function Pn(){const n=I.c(2),e=Vh();let t;n[0]!==e?(t={connections:e,binding:"WORKFLOW"},n[0]=e,n[1]=t):t=n[1];const r=op(t);if(!r||r.length===0||!r[0])throw new Error("No workflow connection found");return r[0]}const sa=[100,1e3,2e3];function Ln(n){const e=I.c(15),t=Pn();let r;e[0]!==t.id?(r=Ue(t.id),e[0]=t.id,e[1]=r):r=e[1];const s=r,o=M.useRef(0);let i;e[2]!==n?(i={id:n},e[2]=n,e[3]=i):i=e[3];const l=!!n;let a;e[4]!==n?(a=n?p=>{const g=p.state?.data?.item?.status;if(g==="running"||g==="enqueued"){const y=sa[o.current]??1;return o.current=(o.current+1)%sa.length,y}return o.current=0,!1}:!1,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==t.id||e[7]!==i||e[8]!==l||e[9]!==a||e[10]!==s?(c={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolInputParams:i,scope:t.id,staleTime:0,gcTime:0,enabled:l,refetchInterval:a},e[6]=t.id,e[7]=i,e[8]=l,e[9]=a,e[10]=s,e[11]=c):c=e[11];const{data:d,isLoading:u}=qi(c),f=d?.item;let h;return e[12]!==u||e[13]!==f?(h={item:f,isLoading:u},e[12]=u,e[13]=f,e[14]=h):h=e[14],h}function qm(n,e){const t=I.c(14),r=Pn();let s;t[0]!==r.id?(s=Ue(r.id),t[0]=r.id,t[1]=s):s=t[1];const o=s;let i;t[2]!==n||t[3]!==e?(i={executionId:n,stepId:e},t[2]=n,t[3]=e,t[4]=i):i=t[4];const l=!!n&&!!e;let a;t[5]!==r.id||t[6]!==i||t[7]!==l||t[8]!==o?(a={toolCaller:o,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolInputParams:i,scope:r.id,enabled:l},t[5]=r.id,t[6]=i,t[7]=l,t[8]=o,t[9]=a):a=t[9];const{data:c,isLoading:d}=qi(a),u=c?.output,f=c?.error;let h;return t[10]!==d||t[11]!==u||t[12]!==f?(h={output:u,error:f,isLoading:d},t[10]=d,t[11]=u,t[12]=f,t[13]=h):h=t[13],h}function Um(){const n=I.c(19),e=Pn(),t=jn();let r;n[0]!==e.id?(r=Ue(e.id),n[0]=e.id,n[1]=r):r=n[1];const s=r;let o;n[2]===Symbol.for("react.memo_cache_sentinel")?(o=["workflow"],n[2]=o):o=n[2];let i;n[3]!==t.id?(i={field:o,operator:"eq",value:t.id},n[3]=t.id,n[4]=i):i=n[4];let l;n[5]===Symbol.for("react.memo_cache_sentinel")?(l=[{field:["created_at"],direction:"desc"}],n[5]=l):l=n[5];let a;n[6]!==i?(a={where:i,orderBy:l,limit:100},n[6]=i,n[7]=a):a=n[7];const c=`${e.id}-executions-${t.id}`,d=!!t.id;let u;n[8]!==a||n[9]!==c||n[10]!==d||n[11]!==s?(u={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolInputParams:a,scope:c,enabled:d,staleTime:5e3},n[8]=a,n[9]=c,n[10]=d,n[11]=s,n[12]=u):u=n[12];const{data:f,isLoading:h,refetch:p}=qi(u),g=f;let y;n[13]!==g?.items?(y=g?.items??[],n[13]=g?.items,n[14]=y):y=n[14];let x;return n[15]!==h||n[16]!==p||n[17]!==y?(x={executions:y,isLoading:h,refetch:p},n[15]=h,n[16]=p,n[17]=y,n[18]=x):x=n[18],x}function dd(n){const e=[];function t(r){if(typeof r=="string"){const s=r.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(s)for(const o of s)if(o==="@input")e.push("__entire_input__");else{const i=o.replace("@input.","");e.push(i)}}else Array.isArray(r)?r.forEach(t):typeof r=="object"&&r!==null&&Object.values(r).forEach(t)}return t(n),[...new Set(e)]}function Km(n){const e=[];for(const t of n){const r=dd(t.input);e.push(...r)}return[...new Set(e)].filter(t=>t!=="__entire_input__")}function Jm(n){for(const e of n)if(dd(e.input).includes("__entire_input__"))return!0;return!1}function Gm(n){const e=Km(n);if(e.length===0)return Jm(n)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const t={},r=[];for(const s of e){const o=s.split(".");if(o.length===1)t[s]={type:"string",description:`Input field: ${s}`},r.push(s);else{const i=o[0];i&&!t[i]&&(t[i]={type:"object",description:`Input object: ${i}`,additionalProperties:!0},r.push(i))}}return{type:"object",properties:t,required:r,description:"Workflow execution input"}}function Xm(){const n=I.c(2),e=jn();let t;return n[0]!==e.steps?(t=Gm(e.steps),n[0]=e.steps,n[1]=t):t=n[1],t}function Ym(){const n=I.c(14),{id:e}=Pn(),{setTrackingExecutionId:t}=Me();let r;n[0]!==e?(r=Ue(e),n[0]=e,n[1]=r):r=n[1];const s=r,o=jn(),i=Dn(),l=Xm();let a;n[2]!==s?(a={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_CREATE"},n[2]=s,n[3]=a):a=n[3];const{mutateAsync:c,isPending:d}=Ui(a);let u;n[4]!==i||n[5]!==t||n[6]!==c||n[7]!==o?(u=async g=>{const y=g===void 0?{}:g;if(!i)throw new Error("Please select a Hub before running the workflow");const x=Date.now(),b=await c({input:y,gateway_id:i,start_at_epoch_ms:x,workflow_collection_id:o.id}),k=b?.item?.id??b?.structuredContent?.item?.id;return t(k),k},n[4]=i,n[5]=t,n[6]=c,n[7]=o,n[8]=u):u=n[8];const f=u,h=l!==null;let p;return n[9]!==f||n[10]!==l||n[11]!==d||n[12]!==h?(p={handleRunWorkflow:f,isPending:d,requiresInput:h,inputSchema:l},n[9]=f,n[10]=l,n[11]=d,n[12]=h,n[13]=p):p=n[13],p}function Qm(){const n=I.c(9),{id:e}=Pn();let t;n[0]!==e?(t=Ue(e),n[0]=e,n[1]=t):t=n[1];const r=t;let s;n[2]!==r?(s={toolCaller:r,toolName:"CANCEL_EXECUTION"},n[2]=r,n[3]=s):s=n[3];const{mutateAsync:o,isPending:i}=Ui(s);let l;n[4]!==o?(l=async d=>await o({executionId:d}),n[4]=o,n[5]=l):l=n[5];const a=l;let c;return n[6]!==a||n[7]!==i?(c={handleCancelWorkflow:a,isCancelling:i},n[6]=a,n[7]=i,n[8]=c):c=n[8],c}function Zm(){const n=I.c(9),{id:e}=Pn();let t;n[0]!==e?(t=Ue(e),n[0]=e,n[1]=t):t=n[1];const r=t;let s;n[2]!==r?(s={toolCaller:r,toolName:"RESUME_EXECUTION"},n[2]=r,n[3]=s):s=n[3];const{mutateAsync:o,isPending:i}=Ui(s);let l;n[4]!==o?(l=async d=>(await o({executionId:d})).success,n[4]=o,n[5]=l):l=n[5];const a=l;let c;return n[6]!==a||n[7]!==i?(c={handleResumeWorkflow:a,isResuming:i},n[6]=a,n[7]=i,n[8]=c):c=n[8],c}function eg(){const n=I.c(3),e=Se(),{item:t}=Ln(e);let r;return n[0]!==t||n[1]!==e?(r=e&&t?(()=>{const o={};return t?.input&&(o.input=t.input),o})():void 0,n[0]=t,n[1]=e,n[2]=r):r=n[2],r}function tg(n,e,t,r){if(!e)return[...n].sort(r);const s=t(e);return[...n].sort((o,i)=>{const l=t(o),a=t(i);return l===s?-1:a===s?1:r?r(o,i):0})}const Qi=Em()(id(n=>({viewMode:"visual",setViewMode:e=>n({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>n({showExecutionsList:e}),toggleExecutionsList:()=>n(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),ud=M.createContext([]);function fd(){return M.useContext(ud)}function xe(n){this.content=n}xe.prototype={constructor:xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new xe(t)},addToStart:function(n,e){return new xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new xe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new xe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=xe.from(n),n.size?new xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=xe.from(n),n.size?new xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};xe.from=function(n){if(n instanceof xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new xe(e)};function hd(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=hd(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function pd(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,d=Math.min(i.text.length,l.text.length);for(;c<d&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=pd(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class E{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new E(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new E(r,s)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new E(s,o)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return hd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return pd(this,e,t,r)}findIndex(e){if(e==0)return wr(0,e);if(e==this.size)return wr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?wr(t+1,o):wr(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const yo={index:0,offset:0};function wr(n,e){return yo.index=n,yo.offset=e,yo}function Hr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Hr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Hr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Y=class Go{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Go.none;if(e instanceof Go)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Y.none=[];class Vr extends Error{}class R{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=gd(this.content,e+this.openStart,t);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,t){return new R(md(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return R.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(E.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new R(e,r,s)}}R.empty=new R(E.empty,0,0);function md(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(md(o.content,e-s-1,t-s-1)))}function gd(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=gd(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function ng(n,e,t){if(t.openStart>n.depth)throw new Vr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Vr("Inconsistent open depths");return yd(n,e,t,0)}function yd(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=yd(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Ft(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=rg(t,n);return Ft(o,bd(n,i,l,e,r))}else return Ft(o,Wr(n,e,r))}function xd(n,e){if(!e.type.compatibleContent(n.type))throw new Vr("Cannot join "+e.type.name+" onto "+n.type.name)}function Xo(n,e,t){let r=n.node(t);return xd(r,e.node(t)),r}function Bt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Un(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Bt(n.nodeAfter,r),o++));for(let l=o;l<i;l++)Bt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Bt(e.nodeBefore,r)}function Ft(n,e){return n.type.checkContent(e),n.copy(e)}function bd(n,e,t,r,s){let o=n.depth>s&&Xo(n,e,s+1),i=r.depth>s&&Xo(t,r,s+1),l=[];return Un(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(xd(o,i),Bt(Ft(o,bd(n,e,t,r,s+1)),l)):(o&&Bt(Ft(o,Wr(n,e,s+1)),l),Un(e,t,s,l),i&&Bt(Ft(i,Wr(t,r,s+1)),l)),Un(r,null,s,l),new E(l)}function Wr(n,e,t){let r=[];if(Un(null,n,t,r),n.depth>t){let s=Xo(n,e,t+1);Bt(Ft(s,Wr(n,e,t+1)),r)}return Un(e,null,t,r),new E(r)}function rg(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(E.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class rr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Y.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new rr(t,r,o)}static resolveCached(e,t){let r=oa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else oa.set(e,r=new sg);let s=r.elts[r.i]=rr.resolve(e,t);return r.i=(r.i+1)%og,s}}class sg{constructor(){this.elts=[],this.i=0}}const og=12,oa=new WeakMap;class qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ig=Object.create(null);class _e{constructor(e,t,r,s=Y.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||E.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Hr(this.attrs,t||e.defaultAttrs||ig)&&Y.sameSet(this.marks,r||Y.none)}copy(e=null){return e==this.content?this:new _e(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _e(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return R.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new R(c,s.depth-i,o.depth-i)}replace(e,t,r){return ng(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return rr.resolveCached(this,e)}resolveNoCache(e){return rr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),kd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=E.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Y.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=E.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}_e.prototype.text=void 0;class Ur extends _e{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ur(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ur(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function kd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new lg(e,t);if(r.next==null)return Ut.empty;let s=Sd(r);r.next&&r.err("Unexpected trailing text");let o=pg(hg(s));return mg(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return E.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:u}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let f=o(u,l.concat(d));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
7
|
+
${n.trimStart()}`;const r=t.index,s=r+t[0].length-1;let o=1,i=s+1;for(;i<n.length&&o>0;)n[i]==="{"?o++:n[i]==="}"&&o--,i++;return n.slice(0,r)+e+n.slice(i)}function go(n,e){switch(n){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...np,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${n}`)}}const ld=M.createContext(null),Pm=n=>Yi()(id(e=>({...n,actions:{setIsAddingStep:t=>e(r=>({...r,isAddingStep:t})),setCurrentStepTab:t=>e(r=>({...r,currentStepTab:t})),setToolAction:t=>e(r=>({workflow:{...r.workflow,steps:r.workflow.steps.map(s=>"toolName"in s.action&&s.action.toolName===t.toolName?{...s,action:t}:s)}})),appendStep:({step:t,type:r})=>e(s=>{const o=t??go(r,s.workflow.steps.length),i=s.workflow.steps.find(a=>a.name===o.name),l=i?`${o.name} ${parseInt(i.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:o.name;return{workflow:{...s.workflow,steps:[...s.workflow.steps,{...o,name:l}]}}}),deleteStep:t=>e(r=>({workflow:{...r.workflow,steps:r.workflow.steps.filter(s=>s.name!==t)}})),duplicateStep:t=>e(r=>{const s=r.workflow.steps.findIndex(a=>a.name===t);if(s===-1)return r;const o=r.workflow.steps[s];if(!o)return r;const i={...o,name:mo(o.name,r.workflow.steps)},l=[...r.workflow.steps];return l.splice(s+1,0,i),{workflow:{...r.workflow,steps:l},currentStepName:i.name}}),setCurrentStepName:t=>e(r=>({...r,currentStepName:t})),updateStep:(t,r)=>e(s=>({...s,workflow:{...s.workflow,steps:s.workflow.steps.map(o=>o.name===t?{...o,...r}:o)}})),setTrackingExecutionId:t=>e(r=>({...r,trackingExecutionId:t})),resetToOriginalWorkflow:()=>e(t=>({...t,workflow:t.localWorkflow})),startAddingStep:t=>e(r=>({...r,isAddingStep:!0,addingStepType:t})),cancelAddingStep:()=>e(t=>({...t,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:t=>e(r=>{const s=r.selectedParentSteps.includes(t);return{...r,selectedParentSteps:s?r.selectedParentSteps.filter(o=>o!==t):[...r.selectedParentSteps,t]}}),confirmAddCodeStep:()=>e(t=>{const{selectedParentSteps:r,addingStepType:s,workflow:o}=t;if(s!=="code"||r.length===0)return t;const i={};for(const u of r)i[u]=`@${u}`;const l={};for(const u of r){const f=o.steps.find(h=>h.name===u);f?.outputSchema&&(l[u]=f.outputSchema)}const a=Object.keys(l).length>0?{type:"object",properties:l,required:Object.keys(l)}:void 0;let c=go("code",Number((Math.random()*1e6).toFixed(0)));if(c={...c,input:i},a){const u=jm(a,"Input"),f=c.action,h=Dm(f.code,u);c={...c,action:{...f,code:h}}}const d=mo(c.name,o.steps);return{...t,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...o,steps:[...o.steps,{...c,name:d}]},currentStepName:d}}),addToolStep:()=>e(t=>{let r=go("tool",Number((Math.random()*1e6).toFixed(0)));const s=mo(r.name,t.workflow.steps);return{...t,isAddingStep:!1,addingStepType:null,workflow:{...t.workflow,steps:[...t.workflow.steps,{...r,name:s}]},currentStepName:s}}),setOriginalWorkflow:t=>e(r=>({...r,localWorkflow:t})),setWorkflow:t=>e(r=>({...r,workflow:t})),startReplacingTool:t=>e(r=>({...r,replacingToolInfo:{toolName:t}})),cancelReplacingTool:()=>e(t=>({...t,replacingToolInfo:null})),setSelectedGatewayId:t=>e(r=>({...r,selectedGatewayId:t}))}}),{name:`workflow-store-${encodeURIComponent(n.workflow.id)}`,storage:od(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,localWorkflow:e.localWorkflow,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedGatewayId:e.selectedGatewayId})}));function Lm(n){const e=I.c(8),{children:t,initialState:r}=n,s=sp();let o;e[0]!==s?.[0]?.id||e[1]!==r.currentStepTab||e[2]!==r.trackingExecutionId||e[3]!==r.workflow?(o=()=>Pm({workflow:r.workflow,localWorkflow:r.workflow,selectedGatewayId:s?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:r.trackingExecutionId,currentStepName:r.workflow.steps[0]?.name,currentStepTab:r.currentStepTab??"input"}),e[0]=s?.[0]?.id,e[1]=r.currentStepTab,e[2]=r.trackingExecutionId,e[3]=r.workflow,e[4]=o):o=e[4];const[i]=M.useState(o);let l;return e[5]!==t||e[6]!==i?(l=m.jsx(ld.Provider,{value:i,children:t}),e[5]=t,e[6]=i,e[7]=l):l=e[7],l}function Rn(n,e){const t=M.useContext(ld);if(!t)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Om(t,n,Rm)}function jn(){return Rn($m)}function $m(n){return n.workflow}function Me(){return Rn(_m)}function _m(n){return n.actions}function ad(){const n=mr();return Rn(zm)??n[0]?.name}function zm(n){return n.currentStepName}function pr(){const n=I.c(5),e=ad(),t=mr();let r;if(n[0]!==e||n[1]!==t){let o;n[3]!==e?(o=i=>i.name===e,n[3]=e,n[4]=o):o=n[4],r=t.find(o),n[0]=e,n[1]=t,n[2]=r}else r=n[2];const s=r;return s||t[0]}function mr(){return jn().steps}function cd(){const n=I.c(8),e=jn(),t=Rn(Hm);let r,s;if(n[0]!==t.description||n[1]!==t.steps||n[2]!==t.title||n[3]!==e.description||n[4]!==e.steps||n[5]!==e.title){const o={title:e.title,description:e.description,steps:e.steps.map(Fm)},i={title:t.title,description:t.description,steps:t.steps.map(Bm)};r=JSON.stringify(o),s=JSON.stringify(i),n[0]=t.description,n[1]=t.steps,n[2]=t.title,n[3]=e.description,n[4]=e.steps,n[5]=e.title,n[6]=r,n[7]=s}else r=n[6],s=n[7];return r!==s}function Bm(n){return{...n,outputSchema:void 0}}function Fm(n){return{...n,outputSchema:void 0}}function Hm(n){return n.localWorkflow}function Se(){return Rn(Vm)}function Vm(n){return n.trackingExecutionId}function Dn(){return Rn(Wm)}function Wm(n){return n.selectedGatewayId}function Pn(){const n=I.c(2),e=Vh();let t;n[0]!==e?(t={connections:e,binding:"WORKFLOW"},n[0]=e,n[1]=t):t=n[1];const r=rp(t);if(!r||r.length===0||!r[0])throw new Error("No workflow connection found");return r[0]}const sa=[100,1e3,2e3];function Ln(n){const e=I.c(15),t=Pn();let r;e[0]!==t.id?(r=Ue(t.id),e[0]=t.id,e[1]=r):r=e[1];const s=r,o=M.useRef(0);let i;e[2]!==n?(i={id:n},e[2]=n,e[3]=i):i=e[3];const l=!!n;let a;e[4]!==n?(a=n?p=>{const g=p.state?.data?.item?.status;if(g==="running"||g==="enqueued"){const y=sa[o.current]??1;return o.current=(o.current+1)%sa.length,y}return o.current=0,!1}:!1,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==t.id||e[7]!==i||e[8]!==l||e[9]!==a||e[10]!==s?(c={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolInputParams:i,scope:t.id,staleTime:0,gcTime:0,enabled:l,refetchInterval:a},e[6]=t.id,e[7]=i,e[8]=l,e[9]=a,e[10]=s,e[11]=c):c=e[11];const{data:d,isLoading:u}=qi(c),f=d?.item;let h;return e[12]!==u||e[13]!==f?(h={item:f,isLoading:u},e[12]=u,e[13]=f,e[14]=h):h=e[14],h}function qm(n,e){const t=I.c(14),r=Pn();let s;t[0]!==r.id?(s=Ue(r.id),t[0]=r.id,t[1]=s):s=t[1];const o=s;let i;t[2]!==n||t[3]!==e?(i={executionId:n,stepId:e},t[2]=n,t[3]=e,t[4]=i):i=t[4];const l=!!n&&!!e;let a;t[5]!==r.id||t[6]!==i||t[7]!==l||t[8]!==o?(a={toolCaller:o,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolInputParams:i,scope:r.id,enabled:l},t[5]=r.id,t[6]=i,t[7]=l,t[8]=o,t[9]=a):a=t[9];const{data:c,isLoading:d}=qi(a),u=c?.output,f=c?.error;let h;return t[10]!==d||t[11]!==u||t[12]!==f?(h={output:u,error:f,isLoading:d},t[10]=d,t[11]=u,t[12]=f,t[13]=h):h=t[13],h}function Um(){const n=I.c(19),e=Pn(),t=jn();let r;n[0]!==e.id?(r=Ue(e.id),n[0]=e.id,n[1]=r):r=n[1];const s=r;let o;n[2]===Symbol.for("react.memo_cache_sentinel")?(o=["workflow"],n[2]=o):o=n[2];let i;n[3]!==t.id?(i={field:o,operator:"eq",value:t.id},n[3]=t.id,n[4]=i):i=n[4];let l;n[5]===Symbol.for("react.memo_cache_sentinel")?(l=[{field:["created_at"],direction:"desc"}],n[5]=l):l=n[5];let a;n[6]!==i?(a={where:i,orderBy:l,limit:100},n[6]=i,n[7]=a):a=n[7];const c=`${e.id}-executions-${t.id}`,d=!!t.id;let u;n[8]!==a||n[9]!==c||n[10]!==d||n[11]!==s?(u={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolInputParams:a,scope:c,enabled:d,staleTime:5e3},n[8]=a,n[9]=c,n[10]=d,n[11]=s,n[12]=u):u=n[12];const{data:f,isLoading:h,refetch:p}=qi(u),g=f;let y;n[13]!==g?.items?(y=g?.items??[],n[13]=g?.items,n[14]=y):y=n[14];let x;return n[15]!==h||n[16]!==p||n[17]!==y?(x={executions:y,isLoading:h,refetch:p},n[15]=h,n[16]=p,n[17]=y,n[18]=x):x=n[18],x}function dd(n){const e=[];function t(r){if(typeof r=="string"){const s=r.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(s)for(const o of s)if(o==="@input")e.push("__entire_input__");else{const i=o.replace("@input.","");e.push(i)}}else Array.isArray(r)?r.forEach(t):typeof r=="object"&&r!==null&&Object.values(r).forEach(t)}return t(n),[...new Set(e)]}function Km(n){const e=[];for(const t of n){const r=dd(t.input);e.push(...r)}return[...new Set(e)].filter(t=>t!=="__entire_input__")}function Jm(n){for(const e of n)if(dd(e.input).includes("__entire_input__"))return!0;return!1}function Gm(n){const e=Km(n);if(e.length===0)return Jm(n)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const t={},r=[];for(const s of e){const o=s.split(".");if(o.length===1)t[s]={type:"string",description:`Input field: ${s}`},r.push(s);else{const i=o[0];i&&!t[i]&&(t[i]={type:"object",description:`Input object: ${i}`,additionalProperties:!0},r.push(i))}}return{type:"object",properties:t,required:r,description:"Workflow execution input"}}function Xm(){const n=I.c(2),e=jn();let t;return n[0]!==e.steps?(t=Gm(e.steps),n[0]=e.steps,n[1]=t):t=n[1],t}function Ym(){const n=I.c(14),{id:e}=Pn(),{setTrackingExecutionId:t}=Me();let r;n[0]!==e?(r=Ue(e),n[0]=e,n[1]=r):r=n[1];const s=r,o=jn(),i=Dn(),l=Xm();let a;n[2]!==s?(a={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_CREATE"},n[2]=s,n[3]=a):a=n[3];const{mutateAsync:c,isPending:d}=Ui(a);let u;n[4]!==i||n[5]!==t||n[6]!==c||n[7]!==o?(u=async g=>{const y=g===void 0?{}:g;if(!i)throw new Error("Please select a Hub before running the workflow");const x=Date.now(),b=await c({input:y,gateway_id:i,start_at_epoch_ms:x,workflow_collection_id:o.id}),k=b?.item?.id??b?.structuredContent?.item?.id;return t(k),k},n[4]=i,n[5]=t,n[6]=c,n[7]=o,n[8]=u):u=n[8];const f=u,h=l!==null;let p;return n[9]!==f||n[10]!==l||n[11]!==d||n[12]!==h?(p={handleRunWorkflow:f,isPending:d,requiresInput:h,inputSchema:l},n[9]=f,n[10]=l,n[11]=d,n[12]=h,n[13]=p):p=n[13],p}function Qm(){const n=I.c(9),{id:e}=Pn();let t;n[0]!==e?(t=Ue(e),n[0]=e,n[1]=t):t=n[1];const r=t;let s;n[2]!==r?(s={toolCaller:r,toolName:"CANCEL_EXECUTION"},n[2]=r,n[3]=s):s=n[3];const{mutateAsync:o,isPending:i}=Ui(s);let l;n[4]!==o?(l=async d=>await o({executionId:d}),n[4]=o,n[5]=l):l=n[5];const a=l;let c;return n[6]!==a||n[7]!==i?(c={handleCancelWorkflow:a,isCancelling:i},n[6]=a,n[7]=i,n[8]=c):c=n[8],c}function Zm(){const n=I.c(9),{id:e}=Pn();let t;n[0]!==e?(t=Ue(e),n[0]=e,n[1]=t):t=n[1];const r=t;let s;n[2]!==r?(s={toolCaller:r,toolName:"RESUME_EXECUTION"},n[2]=r,n[3]=s):s=n[3];const{mutateAsync:o,isPending:i}=Ui(s);let l;n[4]!==o?(l=async d=>(await o({executionId:d})).success,n[4]=o,n[5]=l):l=n[5];const a=l;let c;return n[6]!==a||n[7]!==i?(c={handleResumeWorkflow:a,isResuming:i},n[6]=a,n[7]=i,n[8]=c):c=n[8],c}function eg(){const n=I.c(3),e=Se(),{item:t}=Ln(e);let r;return n[0]!==t||n[1]!==e?(r=e&&t?(()=>{const o={};return t?.input&&(o.input=t.input),o})():void 0,n[0]=t,n[1]=e,n[2]=r):r=n[2],r}function tg(n,e,t,r){if(!e)return[...n].sort(r);const s=t(e);return[...n].sort((o,i)=>{const l=t(o),a=t(i);return l===s?-1:a===s?1:r?r(o,i):0})}const Qi=Em()(id(n=>({viewMode:"visual",setViewMode:e=>n({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>n({showExecutionsList:e}),toggleExecutionsList:()=>n(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),ud=M.createContext([]);function fd(){return M.useContext(ud)}function xe(n){this.content=n}xe.prototype={constructor:xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new xe(t)},addToStart:function(n,e){return new xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new xe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new xe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=xe.from(n),n.size?new xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=xe.from(n),n.size?new xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};xe.from=function(n){if(n instanceof xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new xe(e)};function hd(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=hd(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function pd(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,d=Math.min(i.text.length,l.text.length);for(;c<d&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=pd(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class E{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new E(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new E(r,s)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new E(s,o)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return hd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return pd(this,e,t,r)}findIndex(e){if(e==0)return wr(0,e);if(e==this.size)return wr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?wr(t+1,o):wr(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const yo={index:0,offset:0};function wr(n,e){return yo.index=n,yo.offset=e,yo}function Hr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Hr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Hr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Y=class Go{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Go.none;if(e instanceof Go)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Y.none=[];class Vr extends Error{}class R{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=gd(this.content,e+this.openStart,t);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,t){return new R(md(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return R.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(E.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new R(e,r,s)}}R.empty=new R(E.empty,0,0);function md(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(md(o.content,e-s-1,t-s-1)))}function gd(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=gd(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function ng(n,e,t){if(t.openStart>n.depth)throw new Vr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Vr("Inconsistent open depths");return yd(n,e,t,0)}function yd(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=yd(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Ft(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=rg(t,n);return Ft(o,bd(n,i,l,e,r))}else return Ft(o,Wr(n,e,r))}function xd(n,e){if(!e.type.compatibleContent(n.type))throw new Vr("Cannot join "+e.type.name+" onto "+n.type.name)}function Xo(n,e,t){let r=n.node(t);return xd(r,e.node(t)),r}function Bt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Un(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Bt(n.nodeAfter,r),o++));for(let l=o;l<i;l++)Bt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Bt(e.nodeBefore,r)}function Ft(n,e){return n.type.checkContent(e),n.copy(e)}function bd(n,e,t,r,s){let o=n.depth>s&&Xo(n,e,s+1),i=r.depth>s&&Xo(t,r,s+1),l=[];return Un(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(xd(o,i),Bt(Ft(o,bd(n,e,t,r,s+1)),l)):(o&&Bt(Ft(o,Wr(n,e,s+1)),l),Un(e,t,s,l),i&&Bt(Ft(i,Wr(t,r,s+1)),l)),Un(r,null,s,l),new E(l)}function Wr(n,e,t){let r=[];if(Un(null,n,t,r),n.depth>t){let s=Xo(n,e,t+1);Bt(Ft(s,Wr(n,e,t+1)),r)}return Un(e,null,t,r),new E(r)}function rg(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(E.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class rr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Y.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new rr(t,r,o)}static resolveCached(e,t){let r=oa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else oa.set(e,r=new sg);let s=r.elts[r.i]=rr.resolve(e,t);return r.i=(r.i+1)%og,s}}class sg{constructor(){this.elts=[],this.i=0}}const og=12,oa=new WeakMap;class qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ig=Object.create(null);class _e{constructor(e,t,r,s=Y.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||E.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Hr(this.attrs,t||e.defaultAttrs||ig)&&Y.sameSet(this.marks,r||Y.none)}copy(e=null){return e==this.content?this:new _e(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _e(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return R.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new R(c,s.depth-i,o.depth-i)}replace(e,t,r){return ng(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return rr.resolveCached(this,e)}resolveNoCache(e){return rr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),kd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=E.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Y.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=E.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}_e.prototype.text=void 0;class Ur extends _e{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ur(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ur(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function kd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new lg(e,t);if(r.next==null)return Ut.empty;let s=Sd(r);r.next&&r.err("Unexpected trailing text");let o=pg(hg(s));return mg(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return E.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:u}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let f=o(u,l.concat(d));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
8
8
|
`)}}Ut.empty=new Ut(!0);class lg{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Sd(n){let e=[];do e.push(ag(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ag(n){let e=[];do e.push(cg(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cg(n){let e=fg(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=dg(n,e);else break;return e}function ia(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function dg(n,e){let t=ia(n),r=t;return n.eat(",")&&(n.next!="}"?r=ia(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ug(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let o in t){let i=t[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function fg(n){if(n.eat("(")){let e=Sd(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ug(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hg(n){let e=[[]];return s(o(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=t())}else if(i.type=="star"){let a=t();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let d=t();s(o(i.expr,a),d),a=d}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let d=t();r(a,d),s(o(i.expr,a),d),a=d}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function wd(n,e){return e-n}function la(n,e){let t=[];return r(e),t.sort(wd);function r(s){let o=n[s];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&t.indexOf(a)==-1&&r(a)}}}function pg(n){let e=Object.create(null);return t(la(n,0));function t(r){let s=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<s.length;d++)s[d][0]==l&&(c=s[d][1]);la(n,a).forEach(d=>{c||s.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=e[r.join(",")]=new Ut(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(wd);o.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return o}}function mg(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vd(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Cd(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let o=n[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Nd(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let o=n[s];o.validate&&o.validate(e[s])}}function Ed(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new yg(n,r,e[r]);return t}let aa=class Td{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ed(e,r.attrs),this.defaultAttrs=vd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ut.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Cd(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _e(this,this.computeAttrs(e),E.from(t),Y.setFrom(r))}createChecked(e=null,t,r){return t=E.from(t),this.checkContent(t),new _e(this,this.computeAttrs(e),t,Y.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=E.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let s=this.contentMatch.matchFragment(t),o=s&&s.fillBefore(E.empty,!0);return o?new _e(this,e,t.append(o),Y.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Nd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Y.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new Td(o,t,i));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function gg(n,e,t){let r=t.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class yg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?gg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class $s{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Ed(e,s.attrs),this.excluded=null;let o=vd(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Cd(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new $s(o,s++,t,i)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Nd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Md{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=xe.from(e.nodes),t.marks=xe.from(e.marks||{}),this.nodes=aa.compile(this.spec.nodes,this),this.marks=$s.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=Ut.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ca(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:ca(this,i.split(" "))}this.nodeFromJSON=s=>_e.fromJSON(this,s),this.markFromJSON=s=>Y.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof aa){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Ur(r,r.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ca(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],o=n.marks[s],i=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function xg(n){return n.tag!=null}function bg(n){return n.style!=null}class kt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(xg(s))this.tags.push(s);else if(bg(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new ua(this,t,!1);return r.addAll(e,Y.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ua(this,t,!0);return r.addAll(e,Y.none,t.from,t.to),R.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(wg(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,t,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<o)break}t.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=fa(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=fa(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new kt(e,kt.schemaRules(e)))}}const Ad={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Od={ol:!0,ul:!0},sr=1,Yo=2,Kn=4;function da(n,e,t){return e!=null?(e?sr:0)|(e==="full"?Yo:0):n&&n.whitespace=="pre"?sr|Yo:t&~Kn}class vr{constructor(e,t,r,s,o,i){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=Y.none,this.match=o||(i&Kn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&sr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ad.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ua{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,o,i=da(null,t.preserveWhitespace,0)|(r?Kn:0);s?o=new vr(s.type,s.attrs,Y.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new vr(null,null,Y.none,!0,null,i):o=new vr(e.schema.topNodeType,null,Y.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,o=s.options&Yo?"full":this.localPreserveWS||(s.options&sr)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
9
9
|
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(i.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;Od.hasOwnProperty(i)&&this.parser.normalizeLists&&Sg(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:kg.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Ad.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(o),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
10
10
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=Y.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):ha(l.type,e.type))&&(i=l.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,r,s){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,s)),o}enterInner(e,t,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=da(e,o,i.options);i.options&Kn&&i.content.length==0&&(l|=Kn);let a=Y.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):ha(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new vr(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=sr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(i(l-1,a))return!0;return!1}else{let d=a>0||a==0&&s?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Sg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Od.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function wg(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fa(n){let e={};for(let t in n)e[t]=n[t];return e}function ha(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let o=[],i=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||o.indexOf(d)<0&&i(d))return!0}};if(i(s.contentMatch))return!0}}class Qt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=xo(t).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],d=this.serializeMark(c,i.isInline,t);d&&(o.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Pr(xo(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Pr(xo(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Pr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Qt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=pa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return pa(e.marks)}}function pa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function xo(n){return n.document||window.document}const ma=new WeakMap;function vg(n){let e=ma.get(n);return e===void 0&&ma.set(n,e=Cg(n)),e}function Cg(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Pr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=vg(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(t=s.slice(0,i),s=s.slice(i+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Pr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Id=65535,Rd=Math.pow(2,16);function Ng(n,e){return n+e*Rd}function ga(n){return n&Id}function Eg(n){return(n-(n&Id))/Rd}const jd=1,Dd=2,Lr=4,Pd=8;class Qo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Pd)>0}get deletedBefore(){return(this.delInfo&(jd|Lr))>0}get deletedAfter(){return(this.delInfo&(Dd|Lr))>0}get deletedAcross(){return(this.delInfo&Lr)>0}}class Re{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Re.empty)return Re.empty}recover(e){let t=0,r=ga(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Eg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+o],d=this.ranges[l+i],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:t:t,h=a+s+(f<0?0:d);if(r)return h;let p=e==(t<0?a:u)?null:Ng(l/3,e-a),g=e==a?Dd:e==u?jd:Lr;return(t<0?e!=a:e!=u)&&(g|=Pd),new Qo(h,g,p)}s+=d-c}return r?e+s:new Qo(e+s,0,null)}touches(e,t){let r=0,s=ga(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],d=a+c;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+t],d=this.ranges[s+r];e(l,l+c,a,a+d),o+=d-c}}invert(){return new Re(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Re.empty:new Re(e<0?[0,-e,0]:[0,0,e])}}Re.empty=new Re([]);class or{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new or(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new or;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Qo(e,s,null)}}const bo=Object.create(null);class Ne{getMap(){return Re.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=bo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in bo)throw new RangeError("Duplicate use of step JSON ID "+e);return bo[e]=t,t.prototype.jsonID=e,t}}class de{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new de(e,null)}static fail(e){return new de(null,e)}static fromReplace(e,t,r,s){try{return de.ok(e.replace(t,r,s))}catch(o){if(o instanceof Vr)return de.fail(o.message);throw o}}}function Zi(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(Zi(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return E.fromArray(r)}class yt extends Ne{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new R(Zi(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),t.openStart,t.openEnd);return de.fromReplace(e,this.from,this.to,o)}invert(){return new We(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yt(t.pos,r.pos,this.mark)}merge(e){return e instanceof yt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new yt(t.from,t.to,e.markFromJSON(t.mark))}}Ne.jsonID("addMark",yt);class We extends Ne{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new R(Zi(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return de.fromReplace(e,this.from,this.to,r)}invert(){return new yt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new We(t.pos,r.pos,this.mark)}merge(e){return e instanceof We&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new We(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new We(t.from,t.to,e.markFromJSON(t.mark))}}Ne.jsonID("removeMark",We);class xt extends Ne{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return de.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return de.fromReplace(e,this.pos,this.pos+1,new R(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new xt(this.pos,t.marks[s]);return new xt(this.pos,this.mark)}}return new Kt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xt(t.pos,e.markFromJSON(t.mark))}}Ne.jsonID("addNodeMark",xt);class Kt extends Ne{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return de.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return de.fromReplace(e,this.pos,this.pos+1,new R(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Kt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Kt(t.pos,e.markFromJSON(t.mark))}}Ne.jsonID("removeNodeMark",Kt);class he extends Ne{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Zo(e,this.from,this.to)?de.fail("Structure replace would overwrite content"):de.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Re([this.from,this.to-this.from,this.slice.size])}invert(e){return new he(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new he(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof he)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new he(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new he(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new he(t.from,t.to,R.fromJSON(e,t.slice),!!t.structure)}}Ne.jsonID("replace",he);class ge extends Ne{constructor(e,t,r,s,o,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Zo(e,this.from,this.gapFrom)||Zo(e,this.gapTo,this.to)))return de.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return de.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?de.fromReplace(e,this.from,this.to,r):de.fail("Content does not fit in gap")}getMap(){return new Re([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ge(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||o>r.pos?null:new ge(t.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ge(t.from,t.to,t.gapFrom,t.gapTo,R.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ne.jsonID("replaceAround",ge);function Zo(n,e,t){let r=n.resolve(e),s=t-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function Tg(n,e,t,r){let s=[],o=[],i,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(i&&i.to==f&&i.mark.eq(u[g])?i.to=h:s.push(i=new We(f,h,u[g])));l&&l.to==f?l.to=h:o.push(l=new yt(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Mg(n,e,t,r){let s=[],o=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof $s){let c=i.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==o-1&&u.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=o):s.push({style:u,from:Math.max(l,e),to:c,step:o})}}}),s.forEach(i=>n.step(new We(i.from,i.to,i.style)))}function el(n,e,t,r=t.contentMatch,s=!0){let o=n.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)i.push(new he(l,d,R.empty));else{r=u;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new We(l,d,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new R(E.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new he(l+f.index,l+f.index+f[0].length,p))}}l=d}if(!r.validEnd){let a=r.fillBefore(E.empty,!0);n.replace(l,l,new R(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function Ag(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function $n(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,o=0;;--r){let i=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-o;if(r<n.depth&&i.canReplace(l,a,t))return r;if(r==0||i.type.spec.isolating||!Ag(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function Og(n,e,t){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),l=s.after(o+1),a=i,c=l,d=E.empty,u=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,d=E.from(r.node(p).copy(d)),u++):a--;let f=E.empty,h=0;for(let p=o,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=E.from(s.node(p).copy(f)),h++):c++;n.step(new ge(a,c,i,l,new R(d.append(f),u,h),d.size-u,!0))}function tl(n,e,t=null,r=n){let s=Ig(n,e),o=s&&Rg(r,e);return o?s.map(ya).concat({type:e,attrs:t}).concat(o.map(ya)):null}function ya(n){return{type:n,attrs:null}}function Ig(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return t.canReplaceWith(r,s,i)?o:null}function Rg(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:i}function jg(n,e,t){let r=E.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new ge(s,o,s,o,new R(r,0,0),t.length,!0))}function Dg(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&Pg(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&$d(n,i,l,o),el(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let d=n.mapping.slice(o),u=d.map(l,1),f=d.map(l+i.nodeSize,1);return n.step(new ge(u,f,u+1,f-1,new R(E.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&Ld(n,i,l,o),!1}})}function Ld(n,e,t,r){e.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+o+i.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function $d(n,e,t,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=n.mapping.slice(r).map(t+1+o);n.replaceWith(i,i+1,e.type.schema.text(`
|
|
@@ -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=Hf(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(Vf.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 Hk(){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:Vk,handleDOMEvents:{beforeinput:qk}}})}const Vk=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 Ve{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 Ve(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 Ve(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 Ve(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 Ve(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 Ve(ye.from(s.reverse()),o)}}Ve.empty=new Ve(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)),Ve.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 Ho=!1,Mc=null;function zr(n){let e=n.plugins;if(Mc!=e){Ho=!1,Mc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ho=!0;break}}return Ho}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(Ve.empty,Ve.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[Hk()]},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(Hb.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(oS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Vb.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(Vf.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,H={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,H)}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,H,B,V;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&≤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&&((H=b?.onExit)==null||H.call(b,x)),fe&&((B=b?.onUpdate)==null||B.call(b,x)),X&&((V=b?.onStart)==null||V.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:H}=v,{empty:B,from:V}=H,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)){(V<T.range.from||V>T.range.to)&&!z&&!T.composing&&(N.active=!1);const P=g({char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:H.$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:H,range:B}=w.getState(v.state);if(!H)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,H=[a];return z&&H.push(d),te.create(v.doc,[ve.inline(O.from,O.to,{nodeName:l,class:H.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,Vo,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:He(n.onPointerEnter,Rs(s.onOpen)),onPointerLeave:He(n.onPointerLeave,Rs(s.onClose)),onFocus:He(n.onFocus,s.onOpen),onBlur:He(n.onBlur,s.onClose),onTouchStart:He(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:He(n.onPointerEnter,Rs(o.onOpen)),onPointerLeave:He(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 Vo=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Vo,p.style.webkitUserSelect=Vo}}},[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:He(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(Lh,{...c,...l,onPointerDown:He(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(H=>H.label.toLowerCase().includes(j.toLowerCase())||H.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 HS(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 VS(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:HS,NumberWidget:VS,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(np,{schema:l,formData:e,onChange:c,validator:rp,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(hp,{children:[m.jsx(pp,{children:"Workflow Input"}),m.jsx(mp,{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(gp,{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(yp,{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(xp,{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 Hub"})}),m.jsx(dp,{value:l,onValueChange:a,size:"sm",options:[{value:"visual",icon:m.jsx(up,{})},{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 a Hub 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 H=z,B=r?"Resume":s?t?"Replay":"Running...":a?"Run with input...":"Run workflow",V=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;n[19]!==V?(N=J("gap-2 h-7 px-3",V),n[19]=V,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(fp,{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]!==H||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:H,isPending:l}),n[48]=H,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,H,B,V,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?(H=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]=H):H=e[49],B=a,V="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]=H,e[41]=B,e[42]=V,e[43]=N}else K=e[36],v=e[37],Fe=e[38],at=e[39],H=e[40],B=e[41],V=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(bp,{children:[m.jsx(kp,{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(Qh,{size:14})})}),m.jsxs(Sp,{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]=H,e[29]=B,e[30]=V,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],H=e[28],B=e[29],V=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]!==H||e[115]!==B||e[116]!==V||e[117]!==N?(Q=m.jsxs("div",{className:H,onClick:B,role:V,tabIndex:N,onKeyDown:v,children:[T,O,U]}),e[110]=v,e[111]=T,e[112]=O,e[113]=U,e[114]=H,e[115]=B,e[116]=V,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(Hi,{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(Hi,{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(Xh,{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(Hc,{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],Vi(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":Hl(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":Hl(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:He(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":Hl(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 Hl(n){return n?"open":"closed"}var Pw=ch,Lw=uh,$w=fh,Ke="Accordion",_w=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Vl,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(Vl.Provider,{scope:n.__scopeAccordion,children:t==="multiple"?m.jsx(Ww,{...o,ref:e}):m.jsx(Vw,{...s,ref:e})})});hh.displayName=Ke;var[ph,Fw]=no(Ke),[mh,Hw]=no(Ke,{collapsible:!1}),Vw=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=He(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(Vl.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=Hw(Ei,t),l=Wl(t);return m.jsx(Vl.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(Uh,{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(Hc,{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=Vi(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(Vf.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 Hk(){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:Vk,handleDOMEvents:{beforeinput:qk}}})}const Vk=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 Ve{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 Ve(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 Ve(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 Ve(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 Ve(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 Ve(ye.from(s.reverse()),o)}}Ve.empty=new Ve(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)),Ve.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 Ho=!1,Mc=null;function zr(n){let e=n.plugins;if(Mc!=e){Ho=!1,Mc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ho=!0;break}}return Ho}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(Ve.empty,Ve.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[Hk()]},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(Hb.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(oS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Vb.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(Vf.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,H={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,H)}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,H,B,V;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&≤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&&((H=b?.onExit)==null||H.call(b,x)),fe&&((B=b?.onUpdate)==null||B.call(b,x)),X&&((V=b?.onStart)==null||V.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:H}=v,{empty:B,from:V}=H,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)){(V<T.range.from||V>T.range.to)&&!z&&!T.composing&&(N.active=!1);const P=g({char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:H.$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:H,range:B}=w.getState(v.state);if(!H)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,H=[a];return z&&H.push(d),te.create(v.doc,[ve.inline(O.from,O.to,{nodeName:l,class:H.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,Vo,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:He(n.onPointerEnter,Rs(s.onOpen)),onPointerLeave:He(n.onPointerLeave,Rs(s.onClose)),onFocus:He(n.onFocus,s.onOpen),onBlur:He(n.onBlur,s.onClose),onTouchStart:He(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:He(n.onPointerEnter,Rs(o.onOpen)),onPointerLeave:He(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 Vo=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Vo,p.style.webkitUserSelect=Vo}}},[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:He(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(Lh,{...c,...l,onPointerDown:He(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(H=>H.label.toLowerCase().includes(j.toLowerCase())||H.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 HS(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 VS(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:HS,NumberWidget:VS,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 Hub"})}),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 a Hub 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 H=z,B=r?"Resume":s?t?"Replay":"Running...":a?"Run with input...":"Run workflow",V=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;n[19]!==V?(N=J("gap-2 h-7 px-3",V),n[19]=V,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]!==H||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:H,isPending:l}),n[48]=H,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,H,B,V,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?(H=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]=H):H=e[49],B=a,V="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]=H,e[41]=B,e[42]=V,e[43]=N}else K=e[36],v=e[37],Fe=e[38],at=e[39],H=e[40],B=e[41],V=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]=H,e[29]=B,e[30]=V,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],H=e[28],B=e[29],V=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]!==H||e[115]!==B||e[116]!==V||e[117]!==N?(Q=m.jsxs("div",{className:H,onClick:B,role:V,tabIndex:N,onKeyDown:v,children:[T,O,U]}),e[110]=v,e[111]=T,e[112]=O,e[113]=U,e[114]=H,e[115]=B,e[116]=V,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(Hi,{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(Hi,{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(Hc,{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],Vi(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":Hl(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":Hl(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:He(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":Hl(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 Hl(n){return n?"open":"closed"}var Pw=ch,Lw=uh,$w=fh,Ke="Accordion",_w=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Vl,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(Vl.Provider,{scope:n.__scopeAccordion,children:t==="multiple"?m.jsx(Ww,{...o,ref:e}):m.jsx(Vw,{...s,ref:e})})});hh.displayName=Ke;var[ph,Fw]=no(Ke),[mh,Hw]=no(Ke,{collapsible:!1}),Vw=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=He(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(Vl.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=Hw(Ei,t),l=Wl(t);return m.jsx(Vl.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(Hc,{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=Vi(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,H]=j,B=Br(H),V=!T.required?.includes(z);return` ${z}${V?"?":""}: ${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(Vc,{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(Vc,{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(Hh,{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(ap,{direction:"horizontal",className:"flex w-full h-full",children:[m.jsx(Kl,{defaultSize:50,minSize:30,children:m.jsx(Cw,{})}),m.jsx(cp,{}),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 P2(){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{P2 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(Vc,{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(Vc,{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(Hh,{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};
|