@decocms/mesh 2.64.0 → 2.64.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-B7sqll3Z.js → AlertCircle-CyK0Qw5h.js} +1 -1
- package/dist/client/assets/{ArrowUp-D8YYlj5b.js → ArrowUp-BzVEz2lB.js} +1 -1
- package/dist/client/assets/{Calendar-Cn4v8JwE.js → Calendar-DtGnvM8B.js} +1 -1
- package/dist/client/assets/{Check-lN7sUZo8.js → Check-Dzm8t_lx.js} +1 -1
- package/dist/client/assets/CheckCircle-Dq1sA0pv.js +1 -0
- package/dist/client/assets/{ChevronDown-En_P43wp.js → ChevronDown-Z3Dyyuvx.js} +1 -1
- package/dist/client/assets/{ChevronRight-BB2YL4K4.js → ChevronRight-DDdY_PC7.js} +1 -1
- package/dist/client/assets/{Code01-Dgx2dgXr.js → Code01-BWP8EmsE.js} +1 -1
- package/dist/client/assets/{Copy01-daHVbD8K.js → Copy01-C6IJYSqu.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DT2O2EOj.js → DotsHorizontal-lop24UEO.js} +1 -1
- package/dist/client/assets/{DotsVertical-D1ZY49Um.js → DotsVertical-BpzYqYSl.js} +1 -1
- package/dist/client/assets/{Download01-oP6u6TmF.js → Download01-DkL2eEzP.js} +1 -1
- package/dist/client/assets/{Edit01-C_JM_ANM.js → Edit01-BObRJWWQ.js} +1 -1
- package/dist/client/assets/{File02-DlRIy2xF.js → File02-D8LncylE.js} +1 -1
- package/dist/client/assets/{File06-2dtWfDa_.js → File06-Bwnj0Jvb.js} +1 -1
- package/dist/client/assets/{FilterLines-BCtAjuvO.js → FilterLines-Tzhosng2.js} +1 -1
- package/dist/client/assets/Globe02-DudYvjwY.js +1 -0
- package/dist/client/assets/{Grid01-DHptyetH.js → Grid01-DB4psHwp.js} +1 -1
- package/dist/client/assets/{Home02-CwpXJj-n.js → Home02-C9yoONyT.js} +1 -1
- package/dist/client/assets/{Image01-CILGPgam.js → Image01-BIunU3ME.js} +1 -1
- package/dist/client/assets/{Inbox01-BTvTBHN2.js → Inbox01-Dn_ZLwmj.js} +1 -1
- package/dist/client/assets/{InfoCircle-COTflZ7n.js → InfoCircle-p3x1ZyEw.js} +1 -1
- package/dist/client/assets/{Key01-DFKkR5uc.js → Key01-Bycaiiyx.js} +1 -1
- package/dist/client/assets/{LinkExternal01-WHnCc-Ds.js → LinkExternal01-DQ9drSdh.js} +1 -1
- package/dist/client/assets/{List-Dl-Bi1Os.js → List-BeVMnZSE.js} +1 -1
- package/dist/client/assets/{Loading01-D8raUT2q.js → Loading01-DCWQbhnz.js} +1 -1
- package/dist/client/assets/{Lock01-0pDC11sR.js → Lock01-Cnn8kQG1.js} +1 -1
- package/dist/client/assets/{Pin01-C3nTzsY2.js → Pin01-WkOPKnTb.js} +1 -1
- package/dist/client/assets/{Play-B3d026b0.js → Play-D6BmScpI.js} +1 -1
- package/dist/client/assets/{Plus-BcqTpnxy.js → Plus-CG8dB40n.js} +1 -1
- package/dist/client/assets/{SearchMd-DVuLBPJW.js → SearchMd-BWXZ4bVC.js} +1 -1
- package/dist/client/assets/{Share07-DW8M4mUv.js → Share07-DSoplUP9.js} +1 -1
- package/dist/client/assets/{Terminal-BOgtpg9n.js → Terminal-CdMAejVo.js} +1 -1
- package/dist/client/assets/{Tool01-D95FDZLP.js → Tool01-BDUyIGto.js} +1 -1
- package/dist/client/assets/{Trash01-CR6s5yrj.js → Trash01-C_hJOK44.js} +1 -1
- package/dist/client/assets/{Upload01-CkSc1CyA.js → Upload01-CnMM-V_T.js} +1 -1
- package/dist/client/assets/{Users03-CCWN1VQn.js → Users03-DkIVbHWT.js} +1 -1
- package/dist/client/assets/{X-BsLffR19.js → X-8UbCzOSY.js} +1 -1
- package/dist/client/assets/{XClose-D9VL7Fhs.js → XClose-BDdig6o8.js} +1 -1
- package/dist/client/assets/agent-connections-preview-CC_R-LrZ.js +1 -0
- package/dist/client/assets/agent-detail-yfEWcbsQ.js +1 -0
- package/dist/client/assets/agents-BLmykWZD.js +1 -0
- package/dist/client/assets/alert-dialog-CHAGlLFb.js +7 -0
- package/dist/client/assets/{auth-catchall-B3lc_CZ9.js → auth-catchall-B-Mu7VlE.js} +1 -1
- package/dist/client/assets/badge-BMiZ-mom.js +1 -0
- package/dist/client/assets/{binder-CwgOa4SG.js → binder-DC5jbVcK.js} +1 -1
- package/dist/client/assets/{breadcrumb-BuFIEIOz.js → breadcrumb-BjHn0dWR.js} +1 -1
- package/dist/client/assets/{button-BNRw8VbO.js → button-nyR0JH2l.js} +1 -1
- package/dist/client/assets/{card-B2_21gZH.js → card-DVnhjUGd.js} +1 -1
- package/dist/client/assets/{checkbox-D0Zw7dGS.js → checkbox-TpL0D3NW.js} +1 -1
- package/dist/client/assets/{circle-alert-DepalnIB.js → circle-alert-D0fEJodr.js} +1 -1
- package/dist/client/assets/{collapsible-Dg-5RnYq.js → collapsible-DJK4gRv1.js} +7 -7
- package/dist/client/assets/{collection-detail-DFH_vpkO.js → collection-detail-GbUt_XKS.js} +3 -3
- package/dist/client/assets/{collection-search-D5gi0-bL.js → collection-search-DgJbkAZh.js} +1 -1
- package/dist/client/assets/collection-tab-BTzm3KZ6.js +1 -0
- package/dist/client/assets/collection-table-wrapper-Ad_-F1tG.js +1 -0
- package/dist/client/assets/collection-tabs-UYd1fkoS.js +1 -0
- package/dist/client/assets/connect-BCgu89pq.js +1 -0
- package/dist/client/assets/connection-card-ByjFlujM.js +1 -0
- package/dist/client/assets/connection-detail-CuLe29i_.js +1 -0
- package/dist/client/assets/connections-BKV3JOBI.js +1 -0
- package/dist/client/assets/{constants-Cpe-c81c.js → constants-CJQnv32m.js} +1 -1
- package/dist/client/assets/constants-DpsR0LZe.js +1 -0
- package/dist/client/assets/{create-organization-dialog-7bdcAksX.js → create-organization-dialog-WB_1M15V.js} +1 -1
- package/dist/client/assets/{dialog-Csoqe4hG.js → dialog-DobMZv-a.js} +1 -1
- package/dist/client/assets/differenceInSeconds-NQ4PDo0z.js +1 -0
- package/dist/client/assets/dropdown-menu-BUrC7H_I.js +1 -0
- package/dist/client/assets/dynamic-plugin-layout-yJKJv0tx.js +1 -0
- package/dist/client/assets/{empty-state-Cn1CRUZO.js → empty-state-C0f9rz3s.js} +1 -1
- package/dist/client/assets/{empty-state-CpRLw49r.js → empty-state-Z8nGys2S.js} +1 -1
- package/dist/client/assets/{env-vars-editor-0JsZHlg0.js → env-vars-editor-CGiYkoF6.js} +1 -1
- package/dist/client/assets/{error-boundary-DQ5uRgdY.js → error-boundary-_n4elsYx.js} +1 -1
- package/dist/client/assets/extract-connection-data-DS_2GbRy.js +1 -0
- package/dist/client/assets/file-browser-BQ5LNDAg.js +2 -0
- package/dist/client/assets/{form-DAoJifFq.js → form-8XJyhmpO.js} +1 -1
- package/dist/client/assets/grid-view-D_Aa-emn.js +1 -0
- package/dist/client/assets/home-uc024wOV.js +1 -0
- package/dist/client/assets/index--OStx8iM.js +1 -0
- package/dist/client/assets/{index-yjsBu7QA.js → index-BAZLm9w0.js} +2 -2
- package/dist/client/assets/index-BQzGssjd.js +25 -0
- package/dist/client/assets/index-Bj5Q4dXx.css +1 -0
- package/dist/client/assets/{index-DJLvIq1X.js → index-Diri8Ct6.js} +1 -1
- package/dist/client/assets/index-Dl8GoNj7.js +1 -0
- package/dist/client/assets/{index-P_cUV9l9.js → index-LE1qlbhg.js} +1 -1
- package/dist/client/assets/{index-Bos_CuhY.js → index-ZeDSkwHv.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-D_8FFQdU.js → infiniteQueryObserver-yv2IwJ75.js} +1 -1
- package/dist/client/assets/{input-C-GM7dsu.js → input-DHWQboe4.js} +1 -1
- package/dist/client/assets/layout-DsaX6gcJ.js +1 -0
- package/dist/client/assets/localstorage-keys-Ciabbhpd.js +1 -0
- package/dist/client/assets/login-BoFTpuW0.js +1 -0
- package/dist/client/assets/{mcp-oauth-l77m3IWF.js → mcp-oauth-Cik_32Ma.js} +1 -1
- package/dist/client/assets/mcp-server-card-C9lXz3j7.js +1 -0
- package/dist/client/assets/mcp-server-detail-CKjLUZ8-.js +2 -0
- package/dist/client/assets/members-B7KaOevg.js +3 -0
- package/dist/client/assets/{monaco-editor-p_EFt-aT.js → monaco-editor-CyfxpBLo.js} +1 -1
- package/dist/client/assets/{monitoring-CFkcXam_.js → monitoring-71UNkDku.js} +5 -5
- package/dist/client/assets/{oauth-callback-DN_uk9hh.js → oauth-callback-B66O8BPw.js} +1 -1
- package/dist/client/assets/page-BTGK2JIy.js +1 -0
- package/dist/client/assets/page-CJ03HOIm.js +1 -0
- package/dist/client/assets/{plugin-empty-state-CuuSx5zh.js → plugin-empty-state-Dn9tQuRR.js} +1 -1
- package/dist/client/assets/{plugin-header-BpBy7iT0.js → plugin-header-CNqlEglT.js} +1 -1
- package/dist/client/assets/{plugins-CEFWqcJY.js → plugins-Vjr6K9Js.js} +1 -1
- package/dist/client/assets/{popover-u_i609j_.js → popover-CZsr9YrL.js} +1 -1
- package/dist/client/assets/registry-utils-DGqTJkDv.js +1 -0
- package/dist/client/assets/{resizable-Bac7VXSC.js → resizable-kmnSMXLy.js} +1 -1
- package/dist/client/assets/select-CrjtUXd1.js +1 -0
- package/dist/client/assets/settings-BupAfFFs.js +1 -0
- package/dist/client/assets/shell-layout-Ckg9pQSt.js +12 -0
- package/dist/client/assets/{spinner-Duo6KesX.js → spinner-CQdhmUjg.js} +1 -1
- package/dist/client/assets/{store-invite-CyZGTGUz.js → store-invite-C-ESgBdT.js} +1 -1
- package/dist/client/assets/{switch-DBMrpKuB.js → switch-DT-s9pj3.js} +1 -1
- package/dist/client/assets/table-oiEqEhps.js +1 -0
- package/dist/client/assets/{textarea-ByvgxbRE.js → textarea-wjx2NJJH.js} +1 -1
- package/dist/client/assets/tools-list-BIhDDkg5.js +1 -0
- package/dist/client/assets/{typewriter-title-CZvcEhZW.js → typewriter-title-BfWKHlUW.js} +2 -2
- package/dist/client/assets/use-binding-C5bwm3GP.js +23 -0
- package/dist/client/assets/use-connection-k5RUrkjP.js +1 -0
- package/dist/client/assets/use-create-virtual-mcp-BfrhVnN1.js +1 -0
- package/dist/client/assets/{use-deco-chat-open-C4y7eW_U.js → use-deco-chat-open-BwQGL7z_.js} +1 -1
- package/dist/client/assets/use-list-state-CCCWL8bD.js +1 -0
- package/dist/client/assets/{use-mcp-prompts-SKr2e7l0.js → use-mcp-prompts-DeryV1GR.js} +1 -1
- package/dist/client/assets/{use-members-C8R91dOK.js → use-members-Brv-Zo51.js} +1 -1
- package/dist/client/assets/{use-mobile-CS2zVR4m.js → use-mobile-MoR_lOMO.js} +1 -1
- package/dist/client/assets/use-organization-settings-DtbIWln6.js +1 -0
- package/dist/client/assets/use-virtual-mcp-DfnzITXx.js +1 -0
- package/dist/client/assets/useInfiniteQuery-5yIodymH.js +1 -0
- package/dist/client/assets/useMutation-ffySYpQB.js +1 -0
- package/dist/client/assets/useQuery-Da0DsMDg.js +1 -0
- package/dist/client/assets/{view-mode-toggle-zGyN0eoT.js → view-mode-toggle-DsKf8ZTT.js} +1 -1
- package/dist/client/assets/workflow-BxPDjOre.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +149 -149
- package/dist/server/migrate.js +128 -128
- package/dist/server/node_modules/kysely/dist/cjs/kysely.js +4 -1
- package/dist/server/node_modules/kysely/dist/cjs/query-compiler/default-query-compiler.js +4 -4
- package/dist/server/node_modules/kysely/dist/esm/kysely.js +4 -1
- package/dist/server/node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js +4 -4
- package/dist/server/node_modules/kysely/package.json +9 -9
- package/dist/server/server.js +130 -130
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-DEjCff0P.js +0 -1
- package/dist/client/assets/agents-C0Oa7sFF.js +0 -1
- package/dist/client/assets/alert-dialog-BYFUia7V.js +0 -7
- package/dist/client/assets/avatar-B6WhQiHI.js +0 -1
- package/dist/client/assets/badge-D19NcG12.js +0 -1
- package/dist/client/assets/collection-tab-DxItkIfa.js +0 -1
- package/dist/client/assets/collection-table-wrapper-igJ5OqPc.js +0 -1
- package/dist/client/assets/connect-CtxQyDSW.js +0 -1
- package/dist/client/assets/connection-card-GHfjxhQ1.js +0 -1
- package/dist/client/assets/connection-detail-sqbtlWZ0.js +0 -1
- package/dist/client/assets/connections-DeNXDjso.js +0 -1
- package/dist/client/assets/constants-gYpJq1UH.js +0 -1
- package/dist/client/assets/dropdown-menu-CsYNL9oo.js +0 -1
- package/dist/client/assets/dynamic-plugin-layout-bKoth3Ne.js +0 -1
- package/dist/client/assets/extract-connection-data-B6LHMHtn.js +0 -1
- package/dist/client/assets/file-browser-xiIO0qLw.js +0 -2
- package/dist/client/assets/grid-view-Bj9WDB_-.js +0 -1
- package/dist/client/assets/home-BgLX6VJQ.js +0 -1
- package/dist/client/assets/index-BhNLW4h1.js +0 -1
- package/dist/client/assets/index-CU94_QoM.css +0 -1
- package/dist/client/assets/index-CsOz92iP.js +0 -25
- package/dist/client/assets/index-GUdoiFzV.js +0 -1
- package/dist/client/assets/layout-D8G7uVC8.js +0 -1
- package/dist/client/assets/localstorage-keys-C_mtBNzA.js +0 -1
- package/dist/client/assets/login-FPJg9vSY.js +0 -1
- package/dist/client/assets/mcp-server-card-D5sj_LDb.js +0 -1
- package/dist/client/assets/mcp-server-detail-BFJxlaGZ.js +0 -2
- package/dist/client/assets/members-D6XXyYMu.js +0 -3
- package/dist/client/assets/page-BityQMBs.js +0 -1
- package/dist/client/assets/page-D2S0EYIA.js +0 -1
- package/dist/client/assets/pin-to-sidebar-button-qPJJKT8U.js +0 -1
- package/dist/client/assets/registry-utils-BNFgymSf.js +0 -1
- package/dist/client/assets/resource-tabs-CE-63rPp.js +0 -1
- package/dist/client/assets/select-B4SPtD5h.js +0 -1
- package/dist/client/assets/settings-CoEwEtT9.js +0 -1
- package/dist/client/assets/shell-layout-BH2X3Yeb.js +0 -12
- package/dist/client/assets/table-NP0FOAI5.js +0 -1
- package/dist/client/assets/tools-list-gkMtCYZf.js +0 -1
- package/dist/client/assets/use-binding-CNR8kDE7.js +0 -23
- package/dist/client/assets/use-collections-Hp9XPnUY.js +0 -1
- package/dist/client/assets/use-connection-Dj100t8H.js +0 -1
- package/dist/client/assets/use-create-virtual-mcp-B01dvSQa.js +0 -1
- package/dist/client/assets/use-list-state-DsM4HMGd.js +0 -1
- package/dist/client/assets/use-organization-settings-ClYOYczD.js +0 -1
- package/dist/client/assets/use-virtual-mcp-XGRCLjSr.js +0 -1
- package/dist/client/assets/useInfiniteQuery-C34Ot4VI.js +0 -1
- package/dist/client/assets/useMutation-VOj1VEf8.js +0 -1
- package/dist/client/assets/useQuery-C5RIveiE.js +0 -1
- package/dist/client/assets/workflow-BRSWFGSV.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P,c as ae,o as Wx,h as uR,k as cR,j as S,s as jb,b$ as Yx,c0 as Kx,c1 as Xx,c2 as Zx,c3 as Qx,c4 as Jx,c5 as ev,c6 as tv,c7 as nv,a2 as wo,c8 as rv,bY as dR,bs as lt,c9 as pR,u as fi,v as Rn,ca as fR,aX as iv,cb as hR,cc as dn,cd as fl,ce as mR,cf as hl,cg as gR,ch as bR,ci as ER,cj as yR,x as TR,K as eg,ck as SR,cl as AR,cm as kR,cn as xR,a1 as av,l as sv,bp as tg,bX as xs,g as vR}from"./index-yjsBu7QA.js";import{B as et,c as fe}from"./button-BNRw8VbO.js";import{i as CR}from"./X-BsLffR19.js";import{u as Ca,S as Gb,a as wR,i as _R,m as ov,M as IR,b as NR,f as RR,C as OR,t as lv,g as LR}from"./collapsible-Dg-5RnYq.js";import{b as hi,P as mi,a as gi}from"./popover-u_i609j_.js";import{S as _o}from"./spinner-Duo6KesX.js";import{c as Dn,T as Mn,a as Pn,b as Io,I as ng,E as DR}from"./empty-state-CpRLw49r.js";import{d as uv,u as rg,i as ti,f as MR}from"./constants-Cpe-c81c.js";import{u as PR,g as cv,l as Vb,a as Wb,r as FR}from"./use-mcp-prompts-SKr2e7l0.js";import{E as BR,i as UR}from"./error-boundary-DQ5uRgdY.js";import{c as HR,b as $R,e as zR,a as qR,D as jR}from"./dialog-Csoqe4hG.js";import{a as GR,F as VR,b as WR,c as YR,d as KR,f as XR}from"./form-DAoJifFq.js";import{I as dv}from"./input-C-GM7dsu.js";import{i as pv}from"./AlertCircle-B7sqll3Z.js";import{i as ZR}from"./ArrowUp-D8YYlj5b.js";import{t as Kh}from"./ChevronDown-En_P43wp.js";import{i as QR}from"./Edit01-C_JM_ANM.js";import{t as oa}from"./Users03-CCWN1VQn.js";import{i as fv}from"./ChevronRight-BB2YL4K4.js";import{i as wa}from"./Check-lN7sUZo8.js";import{a as ig}from"./Copy01-daHVbD8K.js";import{i as JR}from"./Terminal-BOgtpg9n.js";import{M as hv,s as Yb}from"./monaco-editor-p_EFt-aT.js";import{u as eO,L as tO}from"./localstorage-keys-C_mtBNzA.js";import{a as nO,b as rO}from"./use-connection-Dj100t8H.js";import{g as iO}from"./generate-id-Dyweu44Y.js";import{i as mv}from"./SearchMd-DVuLBPJW.js";import{s as aO}from"./Trash01-CR6s5yrj.js";import{B as sO}from"./badge-D19NcG12.js";import{i as oO}from"./Code01-Dgx2dgXr.js";import{b as lO}from"./use-virtual-mcp-XGRCLjSr.js";import{u as uO}from"./use-create-virtual-mcp-B01dvSQa.js";const gv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));gv.displayName="Atom02";const bv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));bv.displayName="Attachment01";const Ev=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Ev.displayName="Coins01";const yv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));yv.displayName="Lightbulb01";const Tv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 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.8Z"}));Tv.displayName="Stop";const Sv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));Sv.displayName="Target04";const Av=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Av.displayName="XCircle";function cO(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?jb().min(1,"Required"):jb();return Wx(e)}function dO(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function kv(t){const e=ae.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=P.useId();let s;if(e[0]!==n){const H=n?cO(n):Wx({});s=uR(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?dO(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=cR(c);let p;e[7]!==n?.arguments?(p=n?.arguments??[],e[7]=n?.arguments,e[8]=p):p=e[8];const f=p;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let T;e[19]!==y?(T=S.jsx(HR,{children:y}),e[19]=y,e[20]=T):T=e[20];let k;e[21]!==n.description?(k=n.description&&S.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==T?(x=S.jsxs($R,{children:[T,k]}),e[23]=k,e[24]=T,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==f||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=J=>S.jsx(VR,{control:d.control,name:J.name,render:I=>{const{field:X}=I;return S.jsxs(WR,{children:[S.jsxs(YR,{className:"text-xs",children:[J.name,J.required?null:S.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),S.jsx(KR,{children:S.jsx(dv,{...X,value:X.value??"",required:J.required,placeholder:J.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),S.jsx(XR,{})]})}},J.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=f.map(H),e[29]=f,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let N;e[36]!==E?(N=()=>E(!1),e[36]=E,e[37]=N):N=e[37];let _;e[38]!==d.formState.isSubmitting||e[39]!==N?(_=S.jsx(et,{type:"button",variant:"ghost",onClick:N,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=N,e[40]=_):_=e[40];const w=!d.formState.isValid||d.formState.isSubmitting;let D;e[41]!==d.formState.isSubmitting?(D=d.formState.isSubmitting?S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(_o,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=D):D=e[42];let M;e[43]!==a||e[44]!==w||e[45]!==D?(M=S.jsx(et,{type:"submit",form:a,disabled:w,children:D}),e[43]=a,e[44]=w,e[45]=D,e[46]=M):M=e[46];let q;e[47]!==_||e[48]!==M?(q=S.jsxs(zR,{children:[_,M]}),e[47]=_,e[48]=M,e[49]=q):q=e[49];let F;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==q?(F=S.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,q]}),e[50]=a,e[51]=A,e[52]=v,e[53]=q,e[54]=F):F=e[54];let B;e[55]!==d||e[56]!==F?(B=S.jsx(GR,{...d,children:F}),e[55]=d,e[56]=F,e[57]=B):B=e[57];let $;e[58]!==x||e[59]!==B?($=S.jsxs(qR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,B]}),e[58]=x,e[59]=B,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=S.jsx(jR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function at(t){this.content=t}at.prototype={constructor:at,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new at(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new at(n)},addToStart:function(t,e){return new at([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new at(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new at(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=at.from(t),t.size?new at(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=at.from(t),t.size?new at(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=at.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};at.from=function(t){if(t instanceof at)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new at(e)};function xv(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=xv(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function vv(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=vv(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new V(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new V(r,i)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new V(i,a)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return xv(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return vv(this,e,n,r)}findIndex(e){if(e==0)return Ha(0,e);if(e==this.size)return Ha(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Ha(n+1,a):Ha(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const ml={index:0,offset:0};function Ha(t,e){return ml.index=t,ml.offset=e,ml}function vs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!vs(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!vs(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class Xh{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&vs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Xh.none;if(e instanceof Xh)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class Cs extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=wv(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Cv(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(V.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(V.empty,0,0);function Cv(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Cv(a.content,e-i-1,n-i-1)))}function wv(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=wv(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function pO(t,e,n){if(n.openStart>t.depth)throw new Cs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Cs("Inconsistent open depths");return _v(t,e,n,0)}function _v(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=_v(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Tr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=fO(n,t);return Tr(a,Nv(t,s,o,e,r))}else return Tr(a,ws(t,e,r))}function Iv(t,e){if(!e.type.compatibleContent(t.type))throw new Cs("Cannot join "+e.type.name+" onto "+t.type.name)}function Zh(t,e,n){let r=t.node(n);return Iv(r,e.node(n)),r}function yr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function zi(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(yr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)yr(i.child(o),r);e&&e.depth==n&&e.textOffset&&yr(e.nodeBefore,r)}function Tr(t,e){return t.type.checkContent(e),t.copy(e)}function Nv(t,e,n,r,i){let a=t.depth>i&&Zh(t,e,i+1),s=r.depth>i&&Zh(n,r,i+1),o=[];return zi(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(Iv(a,s),yr(Tr(a,Nv(t,e,n,r,i+1)),o)):(a&&yr(Tr(a,ws(t,e,i+1)),o),zi(e,n,i,o),s&&yr(Tr(s,ws(n,r,i+1)),o)),zi(r,null,i,o),new V(o)}function ws(t,e,n){let r=[];if(zi(null,t,n,r),t.depth>n){let i=Zh(t,e,n+1);yr(Tr(i,ws(t,e,n+1)),r)}return zi(e,null,n,r),new V(r)}function fO(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(V.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class la{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new _s(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new la(n,r,a)}static resolveCached(e,n){let r=Kb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Kb.set(e,r=new hO);let i=r.elts[r.i]=la.resolve(e,n);return r.i=(r.i+1)%mO,i}}class hO{constructor(){this.elts=[],this.i=0}}const mO=12,Kb=new WeakMap;class _s{constructor(e,n,r){this.$from=e,this.$to=n,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 gO=Object.create(null);let er=class Qh{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||V.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&vs(this.attrs,n||e.defaultAttrs||gO)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new Qh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Qh(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return pO(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return la.resolveCached(this,e)}resolveNoCache(e){return la.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),Rv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=V.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};er.prototype.text=void 0;class Is extends er{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Is(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Cr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new bO(e,n);if(r.next==null)return Cr.empty;let i=Ov(r);r.next&&r.err("Unexpected trailing text");let a=xO(kO(i));return vO(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let p=a(d,o.concat(c));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
1
|
+
import{r as P,c as ae,o as Wx,h as uR,k as cR,j as S,s as jb,c0 as Yx,c1 as Kx,c2 as Xx,c3 as Zx,c4 as Qx,c5 as Jx,c6 as ev,c7 as tv,c8 as nv,$ as wo,c9 as rv,bZ as dR,bt as lt,ca as pR,u as fi,t as Rn,cb as fR,aR as iv,cc as hR,cd as dn,ce as fl,cf as mR,cg as hl,ch as gR,ci as bR,cj as ER,ck as yR,q as TR,K as eg,cl as SR,cm as AR,cn as kR,co as xR,F as av,w as sv,bo as tg,bY as xs,g as vR}from"./index-BAZLm9w0.js";import{B as et,c as fe}from"./button-nyR0JH2l.js";import{i as CR}from"./X-8UbCzOSY.js";import{u as Ca,S as Gb,a as wR,i as _R,m as ov,M as IR,b as NR,f as RR,C as OR,t as lv,g as LR}from"./collapsible-DJK4gRv1.js";import{b as hi,P as mi,a as gi}from"./popover-CZsr9YrL.js";import{S as _o}from"./spinner-CQdhmUjg.js";import{b as Dn,T as Mn,a as Pn,c as Io,I as ng,E as DR}from"./empty-state-Z8nGys2S.js";import{d as uv,u as rg,i as ti,f as MR}from"./constants-CJQnv32m.js";import{u as PR,g as cv,l as Vb,a as Wb,r as FR}from"./use-mcp-prompts-DeryV1GR.js";import{E as BR,i as UR}from"./error-boundary-_n4elsYx.js";import{c as HR,b as $R,e as zR,a as qR,D as jR}from"./dialog-DobMZv-a.js";import{a as GR,F as VR,b as WR,c as YR,d as KR,f as XR}from"./form-8XJyhmpO.js";import{I as dv}from"./input-DHWQboe4.js";import{i as pv}from"./AlertCircle-CyK0Qw5h.js";import{i as ZR}from"./ArrowUp-BzVEz2lB.js";import{t as Kh}from"./ChevronDown-Z3Dyyuvx.js";import{i as QR}from"./Edit01-BObRJWWQ.js";import{t as oa}from"./Users03-DkIVbHWT.js";import{i as fv}from"./ChevronRight-DDdY_PC7.js";import{i as wa}from"./Check-Dzm8t_lx.js";import{a as ig}from"./Copy01-C6IJYSqu.js";import{i as JR}from"./Terminal-CdMAejVo.js";import{M as hv,s as Yb}from"./monaco-editor-CyfxpBLo.js";import{u as eO,L as tO}from"./localstorage-keys-Ciabbhpd.js";import{d as nO,e as rO}from"./use-connection-k5RUrkjP.js";import{g as iO}from"./generate-id-Dyweu44Y.js";import{i as mv}from"./SearchMd-BWXZ4bVC.js";import{s as aO}from"./Trash01-C_hJOK44.js";import{B as sO}from"./badge-BMiZ-mom.js";import{i as oO}from"./Code01-BWP8EmsE.js";import{b as lO}from"./use-virtual-mcp-DfnzITXx.js";import{u as uO}from"./use-create-virtual-mcp-BfrhVnN1.js";const gv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));gv.displayName="Atom02";const bv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));bv.displayName="Attachment01";const Ev=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Ev.displayName="Coins01";const yv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));yv.displayName="Lightbulb01";const Tv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 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.8Z"}));Tv.displayName="Stop";const Sv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));Sv.displayName="Target04";const Av=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Av.displayName="XCircle";function cO(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?jb().min(1,"Required"):jb();return Wx(e)}function dO(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function kv(t){const e=ae.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=P.useId();let s;if(e[0]!==n){const H=n?cO(n):Wx({});s=uR(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?dO(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=cR(c);let p;e[7]!==n?.arguments?(p=n?.arguments??[],e[7]=n?.arguments,e[8]=p):p=e[8];const f=p;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let T;e[19]!==y?(T=S.jsx(HR,{children:y}),e[19]=y,e[20]=T):T=e[20];let k;e[21]!==n.description?(k=n.description&&S.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==T?(x=S.jsxs($R,{children:[T,k]}),e[23]=k,e[24]=T,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==f||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=J=>S.jsx(VR,{control:d.control,name:J.name,render:I=>{const{field:X}=I;return S.jsxs(WR,{children:[S.jsxs(YR,{className:"text-xs",children:[J.name,J.required?null:S.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),S.jsx(KR,{children:S.jsx(dv,{...X,value:X.value??"",required:J.required,placeholder:J.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),S.jsx(XR,{})]})}},J.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=f.map(H),e[29]=f,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let N;e[36]!==E?(N=()=>E(!1),e[36]=E,e[37]=N):N=e[37];let _;e[38]!==d.formState.isSubmitting||e[39]!==N?(_=S.jsx(et,{type:"button",variant:"ghost",onClick:N,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=N,e[40]=_):_=e[40];const w=!d.formState.isValid||d.formState.isSubmitting;let D;e[41]!==d.formState.isSubmitting?(D=d.formState.isSubmitting?S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(_o,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=D):D=e[42];let M;e[43]!==a||e[44]!==w||e[45]!==D?(M=S.jsx(et,{type:"submit",form:a,disabled:w,children:D}),e[43]=a,e[44]=w,e[45]=D,e[46]=M):M=e[46];let q;e[47]!==_||e[48]!==M?(q=S.jsxs(zR,{children:[_,M]}),e[47]=_,e[48]=M,e[49]=q):q=e[49];let F;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==q?(F=S.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,q]}),e[50]=a,e[51]=A,e[52]=v,e[53]=q,e[54]=F):F=e[54];let B;e[55]!==d||e[56]!==F?(B=S.jsx(GR,{...d,children:F}),e[55]=d,e[56]=F,e[57]=B):B=e[57];let $;e[58]!==x||e[59]!==B?($=S.jsxs(qR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,B]}),e[58]=x,e[59]=B,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=S.jsx(jR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function at(t){this.content=t}at.prototype={constructor:at,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new at(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new at(n)},addToStart:function(t,e){return new at([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new at(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new at(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=at.from(t),t.size?new at(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=at.from(t),t.size?new at(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=at.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};at.from=function(t){if(t instanceof at)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new at(e)};function xv(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=xv(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function vv(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=vv(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new V(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new V(r,i)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new V(i,a)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return xv(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return vv(this,e,n,r)}findIndex(e){if(e==0)return Ha(0,e);if(e==this.size)return Ha(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Ha(n+1,a):Ha(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const ml={index:0,offset:0};function Ha(t,e){return ml.index=t,ml.offset=e,ml}function vs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!vs(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!vs(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class Xh{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&vs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Xh.none;if(e instanceof Xh)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class Cs extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=wv(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Cv(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(V.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(V.empty,0,0);function Cv(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Cv(a.content,e-i-1,n-i-1)))}function wv(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=wv(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function pO(t,e,n){if(n.openStart>t.depth)throw new Cs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Cs("Inconsistent open depths");return _v(t,e,n,0)}function _v(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=_v(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Tr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=fO(n,t);return Tr(a,Nv(t,s,o,e,r))}else return Tr(a,ws(t,e,r))}function Iv(t,e){if(!e.type.compatibleContent(t.type))throw new Cs("Cannot join "+e.type.name+" onto "+t.type.name)}function Zh(t,e,n){let r=t.node(n);return Iv(r,e.node(n)),r}function yr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function zi(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(yr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)yr(i.child(o),r);e&&e.depth==n&&e.textOffset&&yr(e.nodeBefore,r)}function Tr(t,e){return t.type.checkContent(e),t.copy(e)}function Nv(t,e,n,r,i){let a=t.depth>i&&Zh(t,e,i+1),s=r.depth>i&&Zh(n,r,i+1),o=[];return zi(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(Iv(a,s),yr(Tr(a,Nv(t,e,n,r,i+1)),o)):(a&&yr(Tr(a,ws(t,e,i+1)),o),zi(e,n,i,o),s&&yr(Tr(s,ws(n,r,i+1)),o)),zi(r,null,i,o),new V(o)}function ws(t,e,n){let r=[];if(zi(null,t,n,r),t.depth>n){let i=Zh(t,e,n+1);yr(Tr(i,ws(t,e,n+1)),r)}return zi(e,null,n,r),new V(r)}function fO(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(V.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class la{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new _s(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new la(n,r,a)}static resolveCached(e,n){let r=Kb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Kb.set(e,r=new hO);let i=r.elts[r.i]=la.resolve(e,n);return r.i=(r.i+1)%mO,i}}class hO{constructor(){this.elts=[],this.i=0}}const mO=12,Kb=new WeakMap;class _s{constructor(e,n,r){this.$from=e,this.$to=n,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 gO=Object.create(null);let er=class Qh{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||V.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&vs(this.attrs,n||e.defaultAttrs||gO)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new Qh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Qh(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return pO(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return la.resolveCached(this,e)}resolveNoCache(e){return la.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),Rv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=V.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};er.prototype.text=void 0;class Is extends er{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Is(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Cr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new bO(e,n);if(r.next==null)return Cr.empty;let i=Ov(r);r.next&&r.err("Unexpected trailing text");let a=xO(kO(i));return vO(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let p=a(d,o.concat(c));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
2
2
|
`)}}Cr.empty=new Cr(!0);class bO{constructor(e,n){this.string=e,this.nodeTypes=n,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 Ov(t){let e=[];do e.push(EO(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function EO(t){let e=[];do e.push(yO(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yO(t){let e=AO(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=TO(t,e);else break;return e}function Xb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function TO(t,e){let n=Xb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Xb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function SO(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let s=n[a];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function AO(t){if(t.eat("(")){let e=Ov(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=SO(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function kO(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let u={term:l,to:o};return e[s].push(u),u}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(a(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=a(s.exprs[l],o);if(l==s.exprs.length-1)return u;i(u,o=n())}else if(s.type=="star"){let l=n();return r(o,l),i(a(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(a(s.expr,o),l),i(a(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u<s.min;u++){let c=n();i(a(s.expr,l),c),l=c}if(s.max==-1)i(a(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(a(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Lv(t,e){return e-t}function Zb(t,e){let n=[];return r(e),n.sort(Lv);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);n.push(i);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&r(l)}}}function xO(t){let e=Object.create(null);return n(Zb(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let c=0;c<i.length;c++)i[c][0]==o&&(u=i[c][1]);Zb(t,l).forEach(c=>{u||i.push([o,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let a=e[r.join(",")]=new Cr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(Lv);a.next.push({type:i[s][0],next:e[o.join(",")]||n(o)})}return a}}function vO(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:l,next:u}=i.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),r.indexOf(u)==-1&&r.push(u)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Dv(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Mv(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Pv(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function Fv(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new wO(t,r,e[r]);return n}let Qb=class Bv{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fv(e,r.attrs),this.defaultAttrs=Dv(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==Cr.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:Mv(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new er(this,this.computeAttrs(e),V.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=V.from(n),this.checkContent(n),new er(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=V.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(V.empty,!0);return a?new er(this,e,n.append(a),_e.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){Pv(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((a,s)=>r[a]=new Bv(a,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function CO(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class wO{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?CO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class No{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Fv(e,i.attrs),this.excluded=null;let a=Dv(this.attrs);this.instance=a?new _e(this,a):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,Mv(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,s)=>r[a]=new No(a,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Pv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Uv=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=at.from(e.nodes),n.marks=at.from(e.marks||{}),this.nodes=Qb.compile(this.spec.nodes,this),this.marks=No.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=r[s]||(r[s]=Cr.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?Jb(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Jb(this,s.split(" "))}this.nodeFromJSON=i=>er.fromJSON(this,i),this.markFromJSON=i=>_e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Qb){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Is(r,r.defaultAttrs,e,_e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Jb(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function _O(t){return t.tag!=null}function IO(t){return t.style!=null}class tr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(_O(i))this.tags.push(i);else if(IO(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new tE(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new tE(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(OO(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(s=>{r(s=nE(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(s=>{r(s=nE(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new tr(e,tr.schemaRules(e)))}}const Hv={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},NO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$v={ol:!0,ul:!0},ua=1,Jh=2,qi=4;function eE(t,e,n){return e!=null?(e?ua:0)|(e==="full"?Jh:0):t&&t.whitespace=="pre"?ua|Jh:n&~qi}class $a{constructor(e,n,r,i,a,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_e.none,this.match=a||(s&qi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(V.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ua)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=V.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class tE{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,s=eE(null,n.preserveWhitespace,0)|(r?qi:0);i?a=new $a(i.type,i.attrs,_e.none,!0,n.topMatch||i.type.contentMatch,s):r?a=new $a(null,null,_e.none,!0,null,s):a=new $a(e.schema.topNodeType,null,_e.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&Jh?"full":this.localPreserveWS||(i.options&ua)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));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 o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;$v.hasOwnProperty(s)&&this.parser.normalizeLists&&RO(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:NO.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Hv.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),u=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(a),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=r.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,i){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+o)&&(i=u,a=l,!u.length))break;if(l.solid){if(r)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=_e.none;for(let o of i.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):rE(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let a=this.findPlace(e.create(n),r,!1);return a&&(a=this.enterInner(e,n,r,!0,i)),a}enterInner(e,n,r,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=eE(e,a,s.options);s.options&qi&&s.content.length==0&&(o|=qi);let l=_e.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):rE(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new $a(e,n,l,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ua)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let u=n[o];if(u==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function RO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$v.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function OO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function nE(t){let e={};for(let n in t)e[n]=t[n];return e}function rE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:c}=o.edge(l);if(u==e||a.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class Lr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=gl(n).createDocumentFragment());let i=r,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(a[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)i=a.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(a.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=ps(gl(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&ps(gl(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return ps(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Lr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=iE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return iE(e.marks)}}function iE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function gl(t){return t.document||window.document}const aE=new WeakMap;function LO(t){let e=aE.get(t);return e===void 0&&aE.set(t,e=DO(t)),e}function DO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function ps(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=LO(r))&&a.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 s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=ps(t,p,n,r);if(l.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}const zv=65535,qv=Math.pow(2,16);function MO(t,e){return t+e*qv}function sE(t){return t&zv}function PO(t){return(t-(t&zv))/qv}const jv=1,Gv=2,fs=4,Vv=8;class em{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Vv)>0}get deletedBefore(){return(this.delInfo&(jv|fs))>0}get deletedAfter(){return(this.delInfo&(Gv|fs))>0}get deletedAcross(){return(this.delInfo&fs)>0}}class Ut{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ut.empty)return Ut.empty}recover(e){let n=0,r=sE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+PO(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[o+a],c=this.ranges[o+s],d=l+u;if(e<=d){let p=u?e==l?-1:e==d?1:n:n,f=l+i+(p<0?0:c);if(r)return f;let h=e==(n<0?l:d)?null:MO(o/3,e-l),g=e==l?Gv:e==d?jv:fs;return(n<0?e!=l:e!=d)&&(g|=Vv),new em(f,g,h)}i+=c-u}return r?e+i:new em(e+i,0,null)}touches(e,n){let r=0,i=sE(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[o+a],c=l+u;if(e<=c&&o==i*3)return!0;r+=this.ranges[o+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),u=this.ranges[i+n],c=this.ranges[i+r];e(o,o+u,l,l+c),a+=c-u}}invert(){return new Ut(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ut.empty:new Ut(e<0?[0,-e,0]:[0,0,e])}}Ut.empty=new Ut([]);class ca{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ca(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new ca;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new em(e,i,null)}}const bl=Object.create(null);class mt{getMap(){return Ut.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=bl[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in bl)throw new RangeError("Duplicate use of step JSON ID "+e);return bl[e]=n,n.prototype.jsonID=e,n}}class Ge{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ge(e,null)}static fail(e){return new Ge(null,e)}static fromReplace(e,n,r,i){try{return Ge.ok(e.replace(n,r,i))}catch(a){if(a instanceof Cs)return Ge.fail(a.message);throw a}}}function ag(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(ag(a.content,e,a))),a.isInline&&(a=e(a,n,i)),r.push(a)}return V.fromArray(r)}class Kn extends mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new ee(ag(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Ge.fromReplace(e,this.from,this.to,a)}invert(){return new tn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kn(n.from,n.to,e.markFromJSON(n.mark))}}mt.jsonID("addMark",Kn);class tn extends mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(ag(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ge.fromReplace(e,this.from,this.to,r)}invert(){return new Kn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new tn(n.pos,r.pos,this.mark)}merge(e){return e instanceof tn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tn(n.from,n.to,e.markFromJSON(n.mark))}}mt.jsonID("removeMark",tn);class Xn extends mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ge.fromReplace(e,this.pos,this.pos+1,new ee(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Xn(this.pos,n.marks[i]);return new Xn(this.pos,this.mark)}}return new wr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Xn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Xn(n.pos,e.markFromJSON(n.mark))}}mt.jsonID("addNodeMark",Xn);class wr extends mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ge.fromReplace(e,this.pos,this.pos+1,new ee(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Xn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new wr(n.pos,e.markFromJSON(n.mark))}}mt.jsonID("removeNodeMark",wr);class Qe extends mt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&tm(e,this.from,this.to)?Ge.fail("Structure replace would overwrite content"):Ge.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ut([this.from,this.to-this.from,this.slice.size])}invert(e){return new Qe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Qe(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Qe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Qe(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Qe(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Qe(n.from,n.to,ee.fromJSON(e,n.slice),!!n.structure)}}mt.jsonID("replace",Qe);class nt extends mt{constructor(e,n,r,i,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(tm(e,this.from,this.gapFrom)||tm(e,this.gapTo,this.to)))return Ge.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ge.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ge.fromReplace(e,this.from,this.to,r):Ge.fail("Content does not fit in gap")}getMap(){return new Ut([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new nt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new nt(n.pos,r.pos,i,a,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new nt(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}mt.jsonID("replaceAround",nt);function tm(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let s=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function FO(t,e,n,r){let i=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let p=Math.max(u,e),f=Math.min(u+l.nodeSize,n),h=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(h)||(s&&s.to==p&&s.mark.eq(d[g])?s.to=f:i.push(s=new tn(p,f,d[g])));o&&o.to==p?o.to=f:a.push(o=new Kn(p,f,r))}}),i.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function BO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(r instanceof No){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],p;for(let f=0;f<i.length;f++){let h=i[f];h.step==a-1&&d.eq(i[f].style)&&(p=h)}p?(p.to=u,p.step=a):i.push({style:d,from:Math.max(o,e),to:u,step:a})}}}),i.forEach(s=>t.step(new tn(s.from,s.to,s.style)))}function sg(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let u=a.child(l),c=o+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new Qe(o,c,ee.empty));else{r=d;for(let p=0;p<u.marks.length;p++)n.allowsMarkType(u.marks[p].type)||t.step(new tn(o,c,u.marks[p]));if(i&&u.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(u.text);)h||(h=new ee(V.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Qe(o+p.index,o+p.index+p[0].length,h))}}o=c}if(!r.validEnd){let l=r.fillBefore(V.empty,!0);t.replace(o,o,new ee(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function UO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function bi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+i,l=t.$to.indexAfter(r)-a;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!UO(s,o,l))break;o&&(i=1),l<s.childCount&&(a=1)}return null}function HO(t,e,n){let{$from:r,$to:i,depth:a}=e,s=r.before(a+1),o=i.after(a+1),l=s,u=o,c=V.empty,d=0;for(let h=a,g=!1;h>n;h--)g||r.index(h)>0?(g=!0,c=V.from(r.node(h).copy(c)),d++):l--;let p=V.empty,f=0;for(let h=a,g=!1;h>n;h--)g||i.after(h+1)<i.end(h)?(g=!0,p=V.from(i.node(h).copy(p)),f++):u++;t.step(new nt(l,u,s,o,new ee(c.append(p),d,f),c.size-d,!0))}function og(t,e,n=null,r=t){let i=$O(t,e),a=i&&zO(r,e);return a?i.map(oE).concat({type:e,attrs:n}).concat(a.map(oE)):null}function oE(t){return{type:t,attrs:null}}function $O(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.contentMatchAt(r).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(r,i,s)?a:null}function zO(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.child(r),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function qO(t,e,n){let r=V.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(n[s].type.create(n[s].attrs,r))}let i=e.start,a=e.end;t.step(new nt(i,a,i,a,new ee(r,0,0),n.length,!0))}function jO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&GO(t.doc,t.mapping.slice(a).map(o),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?u=!1:!f&&h&&(u=!0)}u===!1&&Yv(t,s,o,a),sg(t,t.mapping.slice(a).map(o,1),r,void 0,u===null);let c=t.mapping.slice(a),d=c.map(o,1),p=c.map(o+s.nodeSize,1);return t.step(new nt(d,p,d+1,p-1,new ee(V.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Wv(t,s,o,a),!1}})}function Wv(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=t.mapping.slice(r).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Yv(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
|
package/dist/client/assets/{infiniteQueryObserver-D_8FFQdU.js → infiniteQueryObserver-yv2IwJ75.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a4 as d,a5 as f,a6 as v,a7 as b}from"./index-BAZLm9w0.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s,j as a}from"./index-
|
|
1
|
+
import{c as s,j as a}from"./index-BAZLm9w0.js";import{c as d}from"./button-nyR0JH2l.js";function p(l){const e=s.c(10);let i,r,t;e[0]!==l?({className:i,type:t,...r}=l,e[0]=l,e[1]=i,e[2]=r,e[3]=t):(i=e[1],r=e[2],t=e[3]);let n;e[4]!==i?(n=d("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-lg border bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] bg-background","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n||e[8]!==t?(o=a.jsx("input",{type:t,"data-slot":"input",className:n,...r}),e[6]=r,e[7]=n,e[8]=t,e[9]=o):o=e[9],o}export{p as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as x,c as b,$ as j,j as n}from"./index-BAZLm9w0.js";import{P as f}from"./index-LE1qlbhg.js";const h=x.createContext(null);function g(u){const e=b.c(3),{children:l}=u,t=x.useContext(h);if(!t?.tabsEl)return null;let s;return e[0]!==l||e[1]!==t.tabsEl?(s=j.createPortal(l,t.tabsEl),e[0]=l,e[1]=t.tabsEl,e[2]=s):s=e[2],s}function v(u){const e=b.c(3),{children:l}=u,t=x.useContext(h);if(!t?.actionsEl)return null;let s;return e[0]!==l||e[1]!==t.actionsEl?(s=j.createPortal(l,t.actionsEl),e[0]=l,e[1]=t.actionsEl,e[2]=s):s=e[2],s}function P(u){const e=b.c(16),{children:l,breadcrumb:t}=u,[s,p]=x.useState(null),[d,w]=x.useState(null);let c;e[0]!==d||e[1]!==s?(c={tabsEl:s,actionsEl:d},e[0]=d,e[1]=s,e[2]=c):c=e[2];let r;e[3]!==t?(r=n.jsx(f.Header.Left,{children:t}),e[3]=t,e[4]=r):r=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs(f.Header.Right,{children:[n.jsx("div",{ref:p,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),n.jsx("div",{ref:w,className:"flex items-center gap-2 shrink-0"})]}),e[5]=m):m=e[5];let a;e[6]!==r?(a=n.jsxs(f.Header,{children:[r,m]}),e[6]=r,e[7]=a):a=e[7];let o;e[8]!==l?(o=n.jsx(f.Content,{children:l}),e[8]=l,e[9]=o):o=e[9];let i;e[10]!==a||e[11]!==o?(i=n.jsxs(f,{children:[a,o]}),e[10]=a,e[11]=o,e[12]=i):i=e[12];let E;return e[13]!==c||e[14]!==i?(E=n.jsx(h,{value:c,children:i}),e[13]=c,e[14]=i,e[15]=E):E=e[15],E}export{v as V,P as a,g as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as O,F as I}from"./index-BAZLm9w0.js";import{u as M}from"./useQuery-Da0DsMDg.js";import{u as x}from"./useMutation-ffySYpQB.js";function L(t){try{return JSON.parse(t)}catch{return}}function y(t,s){const e=localStorage.getItem(t),o=e?L(e):void 0,n=typeof s=="function"?s(o):o??s;if(o===void 0||n!==o)try{const a=JSON.stringify(n);localStorage.setItem(t,a)}catch{}return n}function F(t,s){const e=O.c(25),o=I();let n;e[0]!==t?(n=["localStorage",t],e[0]=t,e[1]=n):n=e[1];const a=n;let r,i;e[2]!==s||e[3]!==t?(r=()=>y(t,s),i=()=>y(t,s),e[2]=s,e[3]=t,e[4]=r,e[5]=i):(r=e[4],i=e[5]);let m;e[6]!==a||e[7]!==r||e[8]!==i?(m={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},e[6]=a,e[7]=r,e[8]=i,e[9]=m):m=e[9];const{data:v}=M(m);let l;e[10]!==t?(l=async c=>{const $=JSON.stringify(c);return localStorage.setItem(t,$),c},e[10]=t,e[11]=l):l=e[11];let h;e[12]!==o||e[13]!==a?(h=c=>{o.setQueryData(a,c)},e[12]=o,e[13]=a,e[14]=h):h=e[14];let u;e[15]!==l||e[16]!==h?(u={mutationFn:l,onSuccess:h},e[15]=l,e[16]=h,e[17]=u):u=e[17];const g=x(u);let d;e[18]!==g||e[19]!==o||e[20]!==a?(d=c=>{const $=o.getQueryData(a),C=typeof c=="function"?c($):c;g.mutate(C)},e[18]=g,e[19]=o,e[20]=a,e[21]=d):d=e[21];const S=d,p=v;let f;return e[22]!==S||e[23]!==p?(f=[p,S],e[22]=S,e[23]=p,e[24]=f):f=e[24],f}const A={assistantChatThreads:t=>`mesh:assistant-chat:threads:${t}`,messages:(t,s)=>`mesh:messages:${t}:${s}`,decoChatOpen:()=>"mesh:decochat:open",chatSelectedModel:t=>`mesh:chat:selectedModel:${t}`,chatSelectedMode:t=>`mesh:chat:selectedMode:${t}`,assistantChatActiveThread:t=>`mesh:assistant-chat:active-thread:${t}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:t=>`mesh:store:selected-registry:${t}`,orgHomeQuickstart:t=>`mesh:org-home:quickstart:${t}`,storeShowStdio:()=>"mesh:store:show-stdio",developerMode:()=>"mesh:user:developer-mode",pluginConnection:(t,s)=>`mesh:plugin:connection:${t}:${s}`};export{A as L,F as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ac as k,r as p,g as j,j as e,f as z,S as L,N as R,c as U}from"./index-BAZLm9w0.js";import{u as T}from"./useMutation-ffySYpQB.js";import{c as b,B as P}from"./button-nyR0JH2l.js";import{I as E}from"./input-DHWQboe4.js";function B({redirectUrl:r}){const{emailAndPassword:t}=k(),[s,d]=p.useState(""),[o,u]=p.useState(""),[l,v]=p.useState(""),[i,N]=p.useState(()=>globalThis.localStorage?.getItem("hasLoggedIn")!=="true"),[m,h]=p.useState(""),g=T({mutationFn:async({email:a,password:n,name:C})=>{try{if(i){const c=await j.signUp.email({email:a,password:n,name:C||""});if(c.error)throw new Error(c.error.message||"Sign up failed");return c}else{const c=await j.signIn.email({email:a,password:n});if(c.error)throw new Error(c.error.message||"Sign in failed");return c}}catch(c){throw c instanceof Error?c:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),r&&(window.location.href=r)}}),y=a=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),x=()=>{s.trim()&&!y(s)&&h("Invalid email address")},S=a=>{if(a.preventDefault(),!y(s)){h("Invalid email address");return}g.mutate({email:s,password:o,name:l})},_=a=>n=>{a(n.target.value),I&&g.reset(),a===d&&m&&h("")},f=g.isPending,I=g.error,w=i?s.trim()&&o.trim()&&l.trim():s.trim()&&o.trim(),A=a=>{if(!a)return null;const n=a.message.toLowerCase();return n.includes("unauthorized")||n.includes("401")?"Invalid email or password. Please try again.":n.includes("already exists")||n.includes("409")?"An account with this email already exists. Try signing in instead.":n.includes("network")||n.includes("fetch")?"Network error. Please check your connection and try again.":n.includes("rate limit")||n.includes("429")?"Too many attempts. Please wait a moment and try again.":a.message||"An error occurred. Please try again."};return e.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:i?"Create your account":"Login or signup below"})}),I&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:A(I)}),t.enabled&&e.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[e.jsx("div",{className:b("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",i?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:b("p-1",!i&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(E,{type:"text",placeholder:"Your name",value:l,onChange:_(v),required:!0,disabled:f||!i,"aria-hidden":!i})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(E,{type:"email",placeholder:"you@example.com",value:s,onChange:_(d),onBlur:x,required:!0,disabled:f,"aria-invalid":!!m}),m&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:m})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Password"}),e.jsx(E,{type:"password",placeholder:"••••••••",value:o,onChange:_(u),required:!0,disabled:f})]}),e.jsx("div",{className:b("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",w?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:b("p-1",!w&&"pointer-events-none"),children:e.jsx(P,{type:"submit",disabled:f||!w,className:b("w-full font-semibold"),size:"lg","aria-hidden":!w,children:f?i?"Creating account...":"Signing in...":"Continue"})})})]}),e.jsx("div",{className:"text-center",children:e.jsx(P,{type:"button",variant:"link",onClick:()=>{N(!i),v(""),h(""),g.reset()},disabled:f,className:"text-sm text-muted-foreground hover:text-foreground",children:i?"Already have an account? Sign in":"Don't have an account? Sign up"})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function M(r){if(!r.client_id||r.response_type!=="code")return null;const t=new URLSearchParams;return r.client_id&&t.set("client_id",r.client_id),r.redirect_uri&&t.set("redirect_uri",r.redirect_uri),r.response_type&&t.set("response_type",r.response_type),r.state&&t.set("state",r.state),r.scope&&t.set("scope",r.scope),r.code_challenge&&t.set("code_challenge",r.code_challenge),r.code_challenge_method&&t.set("code_challenge_method",r.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function q(r){const t=U.c(5),{callbackURL:s,providerId:d}=r;let o,u;t[0]!==s||t[1]!==d?(o=()=>{(async()=>await j.signIn.sso({providerId:d,callbackURL:s}))()},u=[d,s],t[0]=s,t[1]=d,t[2]=o,t[3]=u):(o=t[2],u=t[3]),p.useEffect(o,u);let l;return t[4]===Symbol.for("react.memo_cache_sentinel")?(l=e.jsx(L,{}),t[4]=l):l=t[4],l}function Y(){const r=j.useSession(),t=z({from:"/login"}),{next:s="/",client_id:d,redirect_uri:o,response_type:u,state:l,scope:v,code_challenge:i,code_challenge_method:N}=t,{sso:m,emailAndPassword:h,magicLink:g,socialProviders:y}=k(),x=M({client_id:d,redirect_uri:o,response_type:u,state:l,scope:v,code_challenge:i,code_challenge_method:N}),S=x||s;return r.data?x?(window.location.href=x,e.jsx(L,{})):e.jsx(R,{to:s}):m.enabled?e.jsx(q,{callbackURL:S,providerId:m.providerId}):h.enabled||g.enabled||y.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx(B,{redirectUrl:x})]})]}):e.jsx("div",{children:"No login options available"})}export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a8 as P,a9 as $,aa as V,ab as x}from"./index-BAZLm9w0.js";function I(n){let e=0;for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}const T=new Map,O="mcp:oauth:callback:";class N{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${window.location.origin}/oauth/callback`,this._windowMode=e.windowMode??"popup";const t=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...t&&{scope:t}},T.set(I(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const s=window.screenX+(window.outerWidth-600)/2,o=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${s},top=${o},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){T.delete(I(this.serverUrl))}}async function K(n){const e=n.meshUrl??window.location.origin,t=new URL(`/mcp/${n.connectionId}`,e),r=new N({serverUrl:t.href,clientName:n.clientName,clientUri:n.clientUri,callbackUrl:n.callbackUrl,scope:n.scope,windowMode:n.windowMode}),s={fn:null};try{const o=new Promise((l,u)=>{const w=n.timeout||12e4;let m,h=!1;const M=r.state(),g=`${O}${M}`,d=()=>{window.removeEventListener("message",A),window.removeEventListener("storage",b),clearTimeout(m);try{localStorage.removeItem(g)}catch{}};s.fn=a=>{h||(h=!0,d(),u(a))};const S=async a=>{if(h)return;if(h=!0,!a.success){d(),u(new Error(a.error||"OAuth authentication failed"));return}const{code:k,state:C}=a;if(!k){d(),u(new Error("Missing authorization code"));return}if(r.getStoredState()!==C){d(),u(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const y=(await P(t))?.authorization_servers?.[0]||t,U=await $(y),p=r.clientInformation();if(!p){d(),u(new Error("Client information not found"));return}const L=r.codeVerifier(),R=await V(y,{metadata:U,clientInformation:p,authorizationCode:k,codeVerifier:L,redirectUri:r.redirectUrl,resource:new URL(t)});d(),l({tokens:R,clientId:p.client_id??null,clientSecret:"client_secret"in p?p.client_secret:null,tokenEndpoint:U?.token_endpoint??null})}catch(v){d(),u(v)}},A=async a=>{a.origin===window.location.origin&&a.data?.type==="mcp:oauth:callback"&&await S(a.data)},b=async a=>{if(!(a.key!==g||!a.newValue))try{const k=JSON.parse(a.newValue);await S(k)}catch{}};window.addEventListener("message",A),window.addEventListener("storage",b),m=setTimeout(()=>{h||(h=!0,d(),u(new Error("OAuth authentication timeout")))},w)});if(o.catch(()=>{}),await x(r,{serverUrl:t})==="REDIRECT"){const l=await o;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint},error:null}}const i=r.tokens(),c=r.clientInformation();return{token:i?.access_token||null,tokenInfo:i?{accessToken:i.access_token,refreshToken:i.refresh_token??null,expiresIn:i.expires_in??null,scope:i.scope??null,clientId:c?.client_id??null,clientSecret:c&&"client_secret"in c?c.client_secret:null,tokenEndpoint:null}:null,error:null}}catch(o){return s.fn&&s.fn(o instanceof Error?o:new Error(String(o))),{token:null,tokenInfo:null,error:o instanceof Error?o.message:String(o)}}finally{r.cleanup()}}function _(n,e){if(window.opener&&!window.opener.closed)return window.opener.postMessage(n,window.location.origin),!0;if(e)try{const t=`${O}${e}`;return localStorage.setItem(t,JSON.stringify(n)),!0}catch{}return!1}async function W(){const n=new URLSearchParams(window.location.search),e=n.get("code");let t=n.get("state");const r=n.get("error"),s=n.get("error_description");let o=t;if(t)try{const i=atob(t),c=JSON.parse(i);c.clientState&&(o=c.clientState)}catch{}if(r){const i=s||r;return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}if(!e||!t){const i="Missing code or state parameter";return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}return t=o||t,_({type:"mcp:oauth:callback",success:!0,code:e,state:t},t)?{success:!0}:{success:!1,error:"Parent window not available"}}function E(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function z(n){try{const e=E();return(e?new URL(n,e):new URL(n)).pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}async function H(n,e){try{const t=`/api/connections/${n}/oauth-token/status`,r=e?new URL(t,e).href:t,s=await fetch(r,{credentials:e?"omit":"include"});return s.ok?{hasToken:(await s.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function j({url:n,token:e,meshUrl:t}){try{const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json, text/event-stream");const s=await fetch(n,{method:"POST",headers:r,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),o=z(n),f=E(),i=t??(f?new URL(n,f).origin:new URL(n).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(o?await H(o,i):{hasToken:!1}).hasToken};let c;try{const w=await s.json();c=w.error||w.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:c||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:c||`HTTP ${s.status}`}}catch(r){return console.error("[isConnectionAuthenticated] Error:",r),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:r.message}}}export{K as a,W as h,j as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as B,c as V,j as a}from"./index-BAZLm9w0.js";import{I as O,T as q,a as J,b as K}from"./empty-state-Z8nGys2S.js";import{c as M,B as Q}from"./button-nyR0JH2l.js";import{s as X}from"./Globe02-DudYvjwY.js";import{i as Y}from"./Lock01-Cnn8kQG1.js";import{s as ee}from"./Plus-CG8dB40n.js";import{i as te}from"./Terminal-CdMAejVo.js";import{C as se}from"./card-DVnhjUGd.js";import{g as le}from"./github-icon-Dp3wHhYE.js";const U=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";const W=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 10 4.08 10 5.2 10Zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 22 4.08 22 5.2 22Z"}));W.displayName="Server01";function ie(s){if(!s.includes("/"))return s;const e=s.split("/"),l=e[0],i=e[1];if(!l||!i)return s;if(l.includes(".")){const n=l.split("."),r=n[n.length-1]||l,o=i.replace(/^mcp-?/,"").replace(/-?mcp$/,"").replace(/^server-?/,"").replace(/-?server$/,"");return!o||o.length<2?r:o}return i}function ae(s){const e=V.c(2),{protocol:l,className:i}=s;let n;return e[0]!==i?(n={http:a.jsx(X,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(te,{className:i})},e[0]=i,e[1]=n):n=e[1],n[l]}function ne(s){switch(s){case"http":return"HTTP";case"sse":return"SSE";case"stdio":return"STDIO"}}function re(s){const e=V.c(9),{protocol:l}=s;let i;e[0]!==l?(i=M("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium shrink-0",{http:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",sse:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",stdio:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"}[l]),e[0]=l,e[1]=i):i=e[1];let n,r;e[2]!==l?(n=a.jsx(ae,{protocol:l,className:"w-3 h-3"}),r=ne(l),e[2]=l,e[3]=n,e[4]=r):(n=e[3],r=e[4]);let o;return e[5]!==i||e[6]!==n||e[7]!==r?(o=a.jsxs("div",{className:i,children:[n,r]}),e[5]=i,e[6]=n,e[7]=r,e[8]=o):o=e[8],o}function oe(s){const e=V.c(68),{icon:l,displayName:i,description:n,onClick:r}=s,t=(s.variant??"store")==="server",f=t?s.hostname:null,d=t?s.protocol:null,c=t?s.isInstalling:!1,m=t?s.actionLabel:void 0,p=t?null:s.scopeName,_=t?!1:s.isVerified,x=t?!0:s.canInstall,H=t?"p-4":"p-6";let u;e[0]!==H?(u=M("cursor-pointer hover:bg-muted/50 transition-colors",H),e[0]=H,e[1]=u):u=e[1];const R=t?"gap-3":"gap-4";let h;e[2]!==R?(h=M("flex flex-col h-full relative",R),e[2]=R,e[3]=h):h=e[3];const Z=t?"sm":"md";let g;e[4]!==i||e[5]!==l||e[6]!==Z?(g=a.jsx(O,{icon:l,name:i,size:Z,className:"shadow-sm shrink-0"}),e[4]=i,e[5]=l,e[6]=Z,e[7]=g):g=e[7];const G=t?"text-sm":"text-base";let v;e[8]!==G?(v=M("flex items-center gap-2 font-medium min-w-0",G),e[8]=G,e[9]=v):v=e[9];let j;e[10]!==i?(j=a.jsx("span",{className:"truncate",children:i}),e[10]=i,e[11]=j):j=e[11];let N;e[12]!==t||e[13]!==_?(N=!t&&_&&a.jsx(U,{size:16,className:"text-success shrink-0"}),e[12]=t,e[13]=_,e[14]=N):N=e[14];let C;e[15]!==x||e[16]!==t?(C=!t&&!x&&a.jsx(Y,{size:16,className:"text-muted-foreground shrink-0"}),e[15]=x,e[16]=t,e[17]=C):C=e[17];let k;e[18]!==t||e[19]!==d?(k=t&&d&&a.jsx(re,{protocol:d}),e[18]=t,e[19]=d,e[20]=k):k=e[20];let b;e[21]!==C||e[22]!==k||e[23]!==v||e[24]!==j||e[25]!==N?(b=a.jsx(q,{asChild:!0,children:a.jsxs("div",{className:v,children:[j,N,C,k]})}),e[21]=C,e[22]=k,e[23]=v,e[24]=j,e[25]=N,e[26]=b):b=e[26];let w;e[27]!==i?(w=a.jsx("p",{children:i}),e[27]=i,e[28]=w):w=e[28];let y;e[29]!==x||e[30]!==t?(y=!t&&!x&&a.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[29]=x,e[30]=t,e[31]=y):y=e[31];let I;e[32]!==w||e[33]!==y?(I=a.jsxs(J,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(K,{children:[b,I]}),e[35]=b,e[36]=I,e[37]=$):$=e[37];let L;e[38]!==f||e[39]!==t||e[40]!==p?(L=(p||f)&&a.jsx("div",{className:M("text-muted-foreground truncate",t?"text-xs mt-0.5":"text-sm"),children:p||f}),e[38]=f,e[39]=t,e[40]=p,e[41]=L):L=e[41];let P;e[42]!==$||e[43]!==L?(P=a.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[$,L]})}),e[42]=$,e[43]=L,e[44]=P):P=e[44];let S;e[45]!==P||e[46]!==g?(S=a.jsxs("div",{className:"flex gap-3",children:[g,P]}),e[45]=P,e[46]=g,e[47]=S):S=e[47];let T;e[48]!==n?(T=n&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:n}),e[48]=n,e[49]=T):T=e[49];let E;e[50]!==n||e[51]!==t?(E=!n&&!t&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:"No description available"}),e[50]=n,e[51]=t,e[52]=E):E=e[52];let z;e[53]!==m||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(Q,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(ee,{size:16}),c?"Connecting...":m||"Connect"]}),e[53]=m,e[54]=c,e[55]=t,e[56]=r,e[57]=z):z=e[57];let D;e[58]!==S||e[59]!==T||e[60]!==E||e[61]!==z||e[62]!==h?(D=a.jsxs("div",{className:h,children:[S,T,E,z]}),e[58]=S,e[59]=T,e[60]=E,e[61]=z,e[62]=h,e[63]=D):D=e[63];let A;return e[64]!==r||e[65]!==u||e[66]!==D?(A=a.jsx(se,{className:u,onClick:r,children:D}),e[64]=r,e[65]=u,e[66]=D,e[67]=A):A=e[67],A}function ce(s){const e=s.title||s.server.title||s.id||"Unnamed Item",l=s._meta?.["mcp.mesh"],i=l?.short_description||l?.mesh_description||s.server.description||null,n=s.server.icons?.[0]?.src||le(s.server.repository)||null,r=l?.verified??!1,o=(s.server.remotes?.length??0)>0,t=(s.server.packages?.length??0)>0,f=o||t;let d=e,c=null;if(e.includes("/")){const m=e.split("/");m.length>=2&&(c=m[0]||null,d=ie(e))}if(!c){const m=l?.scopeName,p=l?.appName;m&&p?c=`${m}/${p}`:m&&(c=m)}return l?.friendly_name&&(d=l.friendly_name),{icon:n,scopeName:c,displayName:d,description:i,isVerified:r,canInstall:f}}function je(s){const e=V.c(12),{items:l,title:i,onItemClick:n}=s;if(l.length===0)return null;let r;e[0]!==i?(r=i&&a.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:a.jsx("h2",{className:"text-lg font-medium",children:i})}),e[0]=i,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==n){let d;e[5]!==n?(d=c=>{const m=ce(c);return a.jsx(oe,{...m,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=d):d=e[6],o=l.map(d),e[2]=l,e[3]=n,e[4]=o}else o=e[4];let t;e[7]!==o?(t=a.jsx("div",{className:"grid grid-cols-4 gap-4",children:o}),e[7]=o,e[8]=t):t=e[8];let f;return e[9]!==r||e[10]!==t?(f=a.jsxs("div",{className:"flex flex-col gap-4",children:[r,t]}),e[9]=r,e[10]=t,e[11]=f):f=e[11],f}export{je as M,oe as a,W as b,ie as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BAZLm9w0.js","assets/index-Bj5Q4dXx.css","assets/index--OStx8iM.js","assets/use-connection-k5RUrkjP.js","assets/useMutation-ffySYpQB.js","assets/constants-CJQnv32m.js","assets/useQuery-Da0DsMDg.js","assets/use-mcp-prompts-DeryV1GR.js","assets/use-virtual-mcp-DfnzITXx.js","assets/mcp-oauth-Cik_32Ma.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as F,c as E,j as t,u as he,w as ge,a as ke,f as Le,g as Pe,bl as ce,K as Me,l as Ve,t as de}from"./index-BAZLm9w0.js";import{i as De}from"./AlertCircle-CyK0Qw5h.js";import{i as ve}from"./Loading01-DCWQbhnz.js";import{P as me}from"./index-LE1qlbhg.js";import{I as be,E as Ee}from"./empty-state-Z8nGys2S.js";import{B as te,c as $e}from"./button-nyR0JH2l.js";import{i as Re}from"./CheckCircle-Dq1sA0pv.js";import{t as Ae}from"./ChevronDown-Z3Dyyuvx.js";import{s as fe}from"./Plus-CG8dB40n.js";import{a as Be,c as Ue,b as ze,D as Oe}from"./dropdown-menu-BUrC7H_I.js";import{n as ue}from"./LinkExternal01-DQ9drSdh.js";import{T as Fe,R as He}from"./tools-list-BIhDDkg5.js";import{C as Ge}from"./collection-tabs-UYd1fkoS.js";import{s as We}from"./Globe02-DudYvjwY.js";import{a as qe,b as Ke,e as Qe}from"./mcp-server-card-C9lXz3j7.js";import{i as Ye}from"./Terminal-CdMAejVo.js";import{B as Xe,a as Ze,b as pe,c as Je,d as et,e as tt}from"./breadcrumb-BjHn0dWR.js";import{u as st}from"./use-binding-C5bwm3GP.js";import{u as ot}from"./useQuery-Da0DsMDg.js";import{d as rt,e as nt,c as it,f as lt}from"./use-connection-k5RUrkjP.js";import{u as at}from"./constants-CJQnv32m.js";import{u as ct,L as dt}from"./localstorage-keys-Ciabbhpd.js";import{e as mt}from"./extract-connection-data-DS_2GbRy.js";import{s as ft}from"./slugify-CEUa2lfQ.js";import{e as ut,g as pt}from"./github-icon-Dp3wHhYE.js";import{f as xt,g as ht,c as gt}from"./registry-utils-DGqTJkDv.js";import{i as vt}from"./InfoCircle-p3x1ZyEw.js";import"./ChevronRight-DDdY_PC7.js";import"./File06-Bwnj0Jvb.js";import"./collection-table-wrapper-Ad_-F1tG.js";import"./ArrowUp-BzVEz2lB.js";import"./Check-Dzm8t_lx.js";import"./Grid01-DB4psHwp.js";import"./List-BeVMnZSE.js";import"./view-mode-toggle-DsKf8ZTT.js";import"./table-oiEqEhps.js";import"./collection-search-DgJbkAZh.js";import"./SearchMd-BWXZ4bVC.js";import"./input-DHWQboe4.js";import"./card-DVnhjUGd.js";import"./layout-DsaX6gcJ.js";import"./badge-BMiZ-mom.js";import"./Lock01-Cnn8kQG1.js";import"./binder-DC5jbVcK.js";import"./useMutation-ffySYpQB.js";import"./constants-DpsR0LZe.js";import"./generate-id-Dyweu44Y.js";const je=({size:o=24,color:e="currentColor",...s})=>F.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},F.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));je.displayName="SearchLg";function bt(o){const e=E.c(3),{message:s}=o,r=s===void 0?"Loading MCP Server details...":s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ve,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,t.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function jt(o){const e=E.c(9),{error:s,onBack:r}=o,n=s instanceof Error?s.message:s;let i,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(De,{size:48,className:"text-destructive mb-4"}),c=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=c):(i=e[0],c=e[1]);let u;e[2]!==n?(u=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=u):u=e[3];let d;e[4]!==r?(d=t.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==u||e[7]!==d?(m=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,c,u,d]}),e[6]=u,e[7]=d,e[8]=m):m=e[8],m}function yt(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(je,{size:48,className:"text-muted-foreground mb-4"}),n=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The MCP Server you're looking for doesn't exist in this store."}),e[0]=r,e[1]=n,e[2]=i):(r=e[0],n=e[1],i=e[2]);let c;return e[3]!==s?(c=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=s,e[4]=c):c=e[4],c}function Nt(o){const e=E.c(2),{breadcrumb:s}=o;let r;return e[0]!==s?(r=t.jsx(me.Header,{children:t.jsx(me.Header.Left,{children:s})}),e[0]=s,e[1]=r):r=e[1],r}function xe(o){const e=E.c(28),{versions:s,selectedIndex:r,onSelect:n,isInstalling:i,variant:c,showLabel:u}=o,d=i===void 0?!1:i,m=c===void 0?"brand":c,I=u===void 0?!1:u,p=s[r],S=I?"sm":"default",j=m==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let y;e[0]!==j?(y=$e("shrink-0 cursor-pointer",j),e[0]=j,e[1]=y):y=e[1];let f;e[2]!==p?.server?.version||e[3]!==I?(f=I&&t.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=I,e[4]=f):f=e[4];const N=I?14:20;let h;e[5]!==N?(h=t.jsx(Ae,{size:N}),e[5]=N,e[6]=h):h=e[6];let x;e[7]!==d||e[8]!==S||e[9]!==y||e[10]!==f||e[11]!==h||e[12]!==m?(x=t.jsx(Be,{asChild:!0,children:t.jsxs(te,{variant:m,disabled:d,size:S,className:y,children:[f,h]})}),e[7]=d,e[8]=S,e[9]=y,e[10]=f,e[11]=h,e[12]=m,e[13]=x):x=e[13];let g;if(e[14]!==d||e[15]!==n||e[16]!==r||e[17]!==s){let C;e[19]!==d||e[20]!==n||e[21]!==r?(C=(v,b)=>{const P=v._meta?.["io.modelcontextprotocol.registry/official"];return t.jsx(Ue,{onClick:()=>n(b),disabled:d,className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"font-medium text-sm",children:["v",v.server?.version||"unknown"]}),P?.isLatest&&t.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),b===r&&t.jsx(Re,{size:16,className:"text-muted-foreground shrink-0"})]})},b)},e[19]=d,e[20]=n,e[21]=r,e[22]=C):C=e[22],g=s.map(C),e[14]=d,e[15]=n,e[16]=r,e[17]=s,e[18]=g}else g=e[18];let _;e[23]!==g?(_=t.jsx(ze,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:g}),e[23]=g,e[24]=_):_=e[24];let w;return e[25]!==x||e[26]!==_?(w=t.jsxs(Oe,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function Ct(o){const e=E.c(46),{data:s,itemVersions:r,onInstall:n,canInstall:i,isInstalling:c,hideInstallControls:u,selectedVersionIndex:d,onVersionChange:m}=o,I=i===void 0?!0:i,p=c===void 0?!1:c,S=u===void 0?!1:u,[j,y]=F.useState(0),f=d??j;let N;e[0]!==m?(N=B=>{y(B),m?.(B)},e[0]=m,e[1]=N):N=e[1];const h=N,x=r[f]||r[0];let g;e[2]!==x?.server?.remotes?(g=x?.server?.remotes??[],e[2]=x?.server?.remotes,e[3]=g):g=e[3];const _=g;let w;e[4]!==x?.server?.packages?(w=x?.server?.packages??[],e[4]=x?.server?.packages,e[5]=w):w=e[5];const v=w.length>0,b=_.length>0,P=_.findIndex(wt),a=P>=0?P:0;let M;e[6]!==a||e[7]!==v||e[8]!==b||e[9]!==n||e[10]!==f?(M=()=>{b?n(f,a,void 0):v&&n(f,void 0,0)},e[6]=a,e[7]=v,e[8]=b,e[9]=n,e[10]=f,e[11]=M):M=e[11];const V=M;let H;e[12]!==r||e[13]!==n||e[14]!==h?(H=B=>{h(B);const X=r[B],Z=X?.server?.remotes??[],se=X?.server?.packages??[];if(Z.length>0){const J=Z.findIndex(St);n(B,J>=0?J:0,void 0)}else se.length>0&&n(B,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=H):H=e[15];const K=H;let R;e[16]!==s.icon||e[17]!==s.name?(R=t.jsx(be,{icon:s.icon,name:s.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=s.icon,e[17]=s.name,e[18]=R):R=e[18];let k;e[19]!==s.name?(k=t.jsx("h1",{className:"text-3xl font-medium",children:s.name}),e[19]=s.name,e[20]=k):k=e[20];let T;e[21]!==s.verified?(T=s.verified&&t.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=s.verified,e[22]=T):T=e[22];let A;e[23]!==k||e[24]!==T?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[k,T]}),e[23]=k,e[24]=T,e[25]=A):A=e[25];let D;e[26]!==s.shortDescription?(D=s.shortDescription&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.shortDescription}),e[26]=s.shortDescription,e[27]=D):D=e[27];let U;e[28]!==A||e[29]!==D?(U=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=U):U=e[30];let z;e[31]!==I||e[32]!==V||e[33]!==K||e[34]!==S||e[35]!==p||e[36]!==r||e[37]!==f||e[38]!==h?(z=I&&!S?t.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?t.jsxs("div",{className:"flex",children:[t.jsxs(te,{variant:"brand",onClick:V,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]}),t.jsx(xe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(te,{variant:"brand",onClick:V,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]})}):S?r.length>1?t.jsx("div",{className:"shrink-0",children:t.jsx(xe,{versions:r,selectedIndex:f,onSelect:h,isInstalling:p,variant:"outline",showLabel:!0})}):null:t.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=I,e[32]=V,e[33]=K,e[34]=S,e[35]=p,e[36]=r,e[37]=f,e[38]=h,e[39]=z):z=e[39];let O;e[40]!==U||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[U,z]}),e[40]=U,e[41]=z,e[42]=O):O=e[42];let G;return e[43]!==O||e[44]!==R?(G=t.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[R,O]}),e[43]=O,e[44]=R,e[45]=G):G=e[45],G}function St(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function wt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function It(o){if(!o)return"—";try{const e=new Date(o);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function _t(o){const e=E.c(47),{data:s,publisherInfo:r,selectedItem:n}=o;let i;e[0]!==s.description?(i=s.description&&t.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[t.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.description})]}),e[0]=s.description,e[1]=i):i=e[1];const c=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher;let u;e[2]!==r.logo||e[3]!==c?(u=t.jsx(be,{icon:r.logo,name:c,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=c,e[4]=u):u=e[4];let d;e[5]!==s.publisher?(d=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher.charAt(0).toUpperCase()+s.publisher.slice(1),e[5]=s.publisher,e[6]=d):d=e[6];let m;e[7]!==d?(m=t.jsx("div",{className:"font-medium",children:d}),e[7]=d,e[8]=m):m=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=I):I=e[9];let p;e[10]!==m?(p=t.jsxs("div",{children:[m,I]}),e[10]=m,e[11]=p):p=e[11];let S;e[12]!==u||e[13]!==p?(S=t.jsx("div",{className:"px-5 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-3 py-5",children:[u,p]})}),e[12]=u,e[13]=p,e[14]=S):S=e[14];let j;e[15]!==s.version?(j=s.version&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Version"}),t.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",s.version]})]}),e[15]=s.version,e[16]=j):j=e[16];let y;e[17]!==s.tags?(y=s.tags&&s.tags.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.tags.map(kt)})]}),e[17]=s.tags,e[18]=y):y=e[18];let f;e[19]!==s.categories?(f=s.categories&&s.categories.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.categories.map(Tt)})]}),e[19]=s.categories,e[20]=f):f=e[20];let N;e[21]!==s.connectionType?(N=s.connectionType&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:s.connectionType})]}),e[21]=s.connectionType,e[22]=N):N=e[22];let h;e[23]!==s.schemaVersion?(h=s.schemaVersion&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),t.jsx("span",{className:"text-muted-foreground text-xs",children:s.schemaVersion})]}),e[23]=s.schemaVersion,e[24]=h):h=e[24];let x;e[25]!==s.websiteUrl?(x=s.websiteUrl&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Website"}),t.jsxs("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"Visit"}),t.jsx(ue,{size:14})]})]}),e[25]=s.websiteUrl,e[26]=x):x=e[26];let g;e[27]!==s.repository?(g=s.repository?.url&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Source"}),t.jsxs("a",{href:s.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"GitHub"}),t.jsx(ue,{size:14})]})]}),e[27]=s.repository,e[28]=g):g=e[28];let _;e[29]!==y||e[30]!==f||e[31]!==N||e[32]!==h||e[33]!==x||e[34]!==g||e[35]!==j?(_=t.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[j,y,f,N,h,x,g]}),e[29]=y,e[30]=f,e[31]=N,e[32]=h,e[33]=x,e[34]=g,e[35]=j,e[36]=_):_=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=w):w=e[37];let C;e[38]!==n.updated_at?(C=It(n.updated_at),e[38]=n.updated_at,e[39]=C):C=e[39];let v;e[40]!==C?(v=t.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[w,t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:C})]}),e[40]=C,e[41]=v):v=e[41];let b;return e[42]!==i||e[43]!==_||e[44]!==v||e[45]!==S?(b=t.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,S,_,v]}),e[42]=i,e[43]=_,e[44]=v,e[45]=S,e[46]=b):b=e[46],b}function Tt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function kt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Lt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Pt={docs:"Documentation",bindings:"Workers Bindings",builds:"Workers Builds",observability:"Observability",radar:"Radar",containers:"Containers",browser:"Browser Rendering",logs:"Logpush",autorag:"AutoRAG",auditlogs:"Audit Logs",graphql:"GraphQL",dex:"DEX Monitoring",casb:"CASB"};function Mt(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function Vt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Dt(o){const e=Pt[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Et(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function $t(o){return o.map((e,s)=>{const r=Et(e.type),n=Mt(e.url),i=Vt(e.url),c=e.title||e.name||Dt(i);return{index:s,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:c,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function Rt(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(We,{className:r}),sse:t.jsx(Ke,{className:r}),stdio:t.jsx(Ye,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function At(o){const e=E.c(10),{options:s,selected:r,onSelect:n}=o;if(s.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let c;if(e[1]!==n||e[2]!==s||e[3]!==r){let d;e[5]!==n||e[6]!==r?(d=m=>t.jsxs(te,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx(Rt,{protocol:m.value==="all"?"http":m.value,className:"w-4 h-4 mr-1"}),m.label]},m.value),e[5]=n,e[6]=r,e[7]=d):d=e[7],c=s.map(d),e[1]=n,e[2]=s,e[3]=r,e[4]=c}else c=e[4];let u;return e[8]!==c?(u=t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,t.jsx("div",{className:"flex gap-1",children:c})]}),e[8]=c,e[9]=u):u=e[9],u}function Bt(o){const e=E.c(11),{servers:s,onInstall:r,isInstalling:n,icon:i,mcpName:c,showStdio:u}=o,d=n===void 0?!1:n,m=u===void 0?!1:u,I=m?s:s.filter(Ft),p=$t(I),S=p.length<13?"all":"http",[j,y]=F.useState(S);let f;e:{if(j==="all"){f="all";break e}let a;if(e[0]!==j?(a=V=>V.protocol===j,e[0]=j,e[1]=a):a=e[1],p.some(a)){f=j;break e}if(p.length<13){f="all";break e}f=p[0]?.protocol??"http"}const N=f,h=N==="all"?p:p.filter(a=>a.protocol===N),x=new Set(p.map(Ot));let g=Lt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(zt));const _=x.size<=1?g.filter(Ut):g,w="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let C;e[2]!==i||e[3]!==d||e[4]!==c||e[5]!==r?(C=a=>t.jsx(qe,{variant:"server",icon:i??null,displayName:a.displayName,description:a.description??null,hostname:a.hostname,protocol:a.protocol,isInstalling:d,onClick:()=>r({type:a.protocol,url:a.url,name:a.name,title:a.title,description:a.description,_type:a._type,_index:a._index})},`${a.hostname}-${a.protocol}-${a.index}`),e[2]=i,e[3]=d,e[4]=c,e[5]=r,e[6]=C):C=e[6];const v=h.map(C);let b;e[7]!==v?(b=t.jsx("div",{className:w,children:v}),e[7]=v,e[8]=b):b=e[8];let P;return e[9]!==h.length?(P=h.length===0&&t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=h.length,e[10]=P):P=e[10],t.jsxs("div",{className:"p-5",children:[t.jsx(At,{options:_,selected:N,onSelect:y}),b,P]})}function Ut(o){return o.value!=="all"}function zt(o){return o.value!=="stdio"}function Ot(o){return o.protocol}function Ft(o){return o.type?.toLowerCase()!=="stdio"}function Ht(o){const e=E.c(29),{data:s,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:c,onTabChange:u,servers:d,onInstallServer:m,isInstalling:I,mcpIcon:p,mcpName:S,showStdio:j}=o,y=c===void 0?!1:c;let f;e[0]!==d?(f=d===void 0?[]:d,e[0]=d,e[1]=f):f=e[1];const N=f,h=I===void 0?!1:I,x=j===void 0?!1:j;let g;e[2]!==i?(g=i.map(Gt),e[2]=i,e[3]=g):g=e[3];const _=g;let w;e[4]!==r||e[5]!==n||e[6]!==u?(w=r.length>0&&t.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:t.jsx(Ge,{tabs:r,activeTab:n,onTabChange:u})}),e[4]=r,e[5]=n,e[6]=u,e[7]=w):w=e[7];let C;e[8]!==n||e[9]!==h||e[10]!==p||e[11]!==S||e[12]!==m||e[13]!==N||e[14]!==x?(C=n==="servers"&&N.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(Bt,{servers:N,onInstall:a=>m?.(a),isInstalling:h,icon:p,mcpName:S,showStdio:x})}),e[8]=n,e[9]=h,e[10]=p,e[11]=S,e[12]=m,e[13]=N,e[14]=x,e[15]=C):C=e[15];let v;e[16]!==n||e[17]!==i.length||e[18]!==y||e[19]!==_?(v=n==="tools"&&t.jsx("div",{className:"flex flex-col flex-1",children:y?t.jsxs("div",{className:"flex items-center justify-center p-8",children:[t.jsx(ve,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(Fe,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ee,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=y,e[19]=_,e[20]=v):v=e[20];let b;e[21]!==s?.repository||e[22]!==n?(b=n==="readme"&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(He,{repository:s?.repository})}),e[21]=s?.repository,e[22]=n,e[23]=b):b=e[23];let P;return e[24]!==b||e[25]!==w||e[26]!==C||e[27]!==v?(P=t.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[w,C,v,b]}),e[24]=b,e[25]=w,e[26]=C,e[27]=v,e[28]=P):P=e[28],P}function Gt(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function Wt(o,e){if(!o||!e)return;const s=e.toLowerCase();return o.find(r=>r.app_name?.toLowerCase()===s||r.app_id?.toLowerCase()===s||r.title.toLowerCase()===s)||o.find(r=>r.title.toLowerCase().includes(s))}function qt(o,e,s,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??o.length};const i=e.toLowerCase(),c=o.filter(d=>(d._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":d.publisher||d._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:s?.icon||c[0]?.publisher_logo||c[0]?.icon||void 0,count:c.length}}function Kt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=ht(r.remotes?.[0]?.type),i=gt(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=pt(r.repository),d=o.icon||o.image||o.logo||r.icons?.[0]?.src||u||null,m=o.name||o.title||o.server?.title||"Unnamed Item",I=Qe(m),p=e?.friendly_name||I,S=e?.mesh_description||o.description||o.summary||r?.description||"",j=e?.short_description||null,y=e?.tags||[],f=e?.categories||[];return{name:p,description:S,shortDescription:j,icon:d,verified:o.verified||e?.verified,publisher:c,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:y,categories:f,tools:o.tools||r.tools||e?.tools||[],models:o.models||r.models||e?.models||[],emails:o.emails||r.emails||e?.emails||[],analytics:o.analytics||r.analytics||e?.analytics,cdn:o.cdn||r.cdn||e?.cdn}}class Qt extends F.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("Store MCP server detail error:",e,s)}render(){return this.state.hasError?t.jsx(jt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Yt(){const{org:o}=he(),e=ge(),{appName:s}=ke({strict:!1}),{registryId:r,serverName:n,stdio:i}=Le({strict:!1}),[c,u]=ct(dt.storeShowStdio(),()=>!1),d=i==="true"?!0:i==="false"?!1:c;i!==void 0&&i==="true"!==c&&u(i==="true");const[m,I]=F.useState(null),[p,S]=F.useState(null),j=rt(),y=nt(),{data:f}=Pe.useSession(),N=st(y),h=r||N[0]?.id||"",x=it(h),g=xt(x?.tools),_=x?.tools&&x.tools.find(L=>L.name.endsWith("_VERSIONS"))?.name||"",w=x?.tools&&x.tools.find(L=>L.name.endsWith("_GET"))?.name||"",C=!!n;let v="",b={};C?(v=_||w,b={name:n}):(v=g,b={});const P=at({connectionId:h||null,orgId:o.id}),{data:a}=lt({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],H=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(H=a.totalCount),"item"in a&&a.item){const l=a.item;M=[{id:l.id||"",title:l.title,server:l.server,_meta:l._meta}]}else{let l;"versions"in a&&Array.isArray(a.versions)?l="versions":"servers"in a&&Array.isArray(a.servers)?l="servers":l=Object.keys(a).find(L=>Array.isArray(a[L])),l&&(M=a[l],(l==="versions"||v?.includes("VERSIONS"))&&(V=M))}}const K=(()=>{const l=V.findIndex(L=>L._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0);return l>=0?l:0})(),R=p??K;let k=M.find(l=>{const L=l.name||l.title||l.server.title||"";return ft(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Kt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,U=!A&&!!D,z=ot({queryKey:Me.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await ce(async()=>{const{Client:$}=await import("./index-BAZLm9w0.js").then(q=>q.cp);return{Client:$}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await ce(async()=>{const{StreamableHTTPClientTransport:$}=await import("./index--OStx8iM.js");return{StreamableHTTPClientTransport:$}},__vite__mapDeps([2,0,1,3,4,5,6,7,8,9])),W=new l({name:"mesh-store",version:"1.0.0"}),ee=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(ee),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:U}),O=U&&z.isLoading,G=z.data??[],B=A?T?.tools||[]:G,X=Wt(y,T?.publisher),Z=T?qt(M,T.publisher,X,x??null,H):{count:0},se=T?.repository?ut(T.repository):null,ne=k?.server?.remotes??[],J=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...J.map((l,L)=>({type:"stdio",url:void 0,name:l.name||l.identifier,title:l.name||l.identifier?.replace(/^@[^/]+\//,""),description:l.environmentVariables?.length?`Requires ${l.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:L}))],ie=d?oe:oe.filter(l=>l.type?.toLowerCase()!=="stdio"),le=ie.length>1,Q=[{id:"servers",label:"Servers",count:ie.length,visible:le},{id:"readme",label:"README",visible:!!T?.repository&&!!se},{id:"tools",label:"Tools",count:B.length,visible:A||G.length>0||O&&!!D}].filter(l=>l.visible),ye=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",Ne=m&&Q.find(l=>l.id===m)?m:ye,re=async(l,L,W)=>{const ee=V[l??0]||k;if(!ee||!o||!f?.user?.id)return;const $=mt(ee,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=$.connection_type==="STDIO",_e=!!$.connection_url,Te=q&&$.connection_headers&&typeof $.connection_headers=="object"&&"command"in $.connection_headers;if(!_e&&!Te){de.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Y}=await j.create.mutateAsync($);e({to:"/$org/mcps/$connectionId",params:{org:o.slug,connectionId:Y}})}catch(Y){de.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},Ce=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(yt,{onBack:Ce});if(!T)return null;const Se=(k?.server?.remotes?.length??0)>0,we=(k?.server?.packages?.length??0)>0,ae=Se||we,Ie=t.jsx(Xe,{children:t.jsxs(Ze,{children:[t.jsx(pe,{children:t.jsx(Je,{asChild:!0,children:t.jsx(Ve,{to:"/$org/store",params:{org:o.slug},children:"Store"})})}),t.jsx(et,{}),t.jsx(pe,{children:t.jsx(tt,{children:T.name})})]})});return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(Nt,{breadcrumb:Ie}),t.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.jsx("div",{className:"h-full",children:t.jsxs("div",{className:"h-full",children:[!ae&&t.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[t.jsx(vt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(Ct,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ae,isInstalling:j.create.isPending,hideInstallControls:le,selectedVersionIndex:R,onVersionChange:S}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[t.jsx(_t,{data:T,publisherInfo:Z,selectedItem:k}),t.jsx(Ht,{data:T,availableTabs:Q,effectiveActiveTabId:Ne,effectiveTools:B,isLoadingTools:O,onTabChange:I,servers:oe,onInstallServer:l=>{l._type==="remote"?re(R,l._index,void 0):re(R,void 0,l._index)},isInstalling:j.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:d})]})]})})})]})}function Hs(){const o=E.c(6),{org:e}=he(),s=ge();let r;o[0]!==s||o[1]!==e.slug?(r=()=>{s({to:"/$org/store",params:{org:e.slug}})},o[0]=s,o[1]=e.slug,o[2]=r):r=o[2];const n=r;let i;o[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(F.Suspense,{fallback:t.jsx(bt,{}),children:t.jsx(Yt,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(Qt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Hs as default};
|