@seira-bot/seira 0.1.180 → 0.1.181
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/assets/{ActivityPanel-DpipGqnm.js → ActivityPanel-tZLxRHYi.js} +1 -1
- package/dist/assets/{AnnouncementsPage-GCXia4xK.js → AnnouncementsPage-BrGYAaS0.js} +1 -1
- package/dist/assets/{App-BIllYA_e.js → App-h8WTNY4l.js} +136 -136
- package/dist/assets/{AppEventEditor-DYdUkpiM.js → AppEventEditor-CLpZ2lyb.js} +1 -1
- package/dist/assets/{BotSettingsDialog-DxRMUwAP.js → BotSettingsDialog-COjDhP9V.js} +1 -1
- package/dist/assets/{BrowserPanel-Cu_GqDA1.js → BrowserPanel-D_kPeSZ3.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-CL3TIl73.js → BrowserProfilesManager-haN8RgPf.js} +1 -1
- package/dist/assets/{CloudAddDialog-DUk6i4df.js → CloudAddDialog-vwGwJIYN.js} +1 -1
- package/dist/assets/{ComputerFilesPane-HvpeAXhL.js → ComputerFilesPane-DJu1k1Ap.js} +1 -1
- package/dist/assets/{ComputerPanel-CozzFQeF.js → ComputerPanel-D9bTedHq.js} +2 -2
- package/dist/assets/{DataPanel-DGqcWB1O.js → DataPanel-CsuS_ybT.js} +1 -1
- package/dist/assets/{DesktopViewer-BoBSIDfB.js → DesktopViewer-YvIV04Lf.js} +1 -1
- package/dist/assets/{EnginesSettings-D643-yZk.js → EnginesSettings-C27xDaBN.js} +1 -1
- package/dist/assets/{FilesView-b5DFlMDt.js → FilesView-Dsxj73nW.js} +1 -1
- package/dist/assets/{GrokMoveDialog-gGTLfrGg.js → GrokMoveDialog-DEgRQW9G.js} +1 -1
- package/dist/assets/{ImportDialog-Bu5X6qOF.js → ImportDialog-DLVTgN-h.js} +1 -1
- package/dist/assets/{InspectorPanel-DU7_iwQR.js → InspectorPanel-gvFj5wfe.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-Wxnn1d66.js → KeyboardShortcutsModal-aF0vhD29.js} +1 -1
- package/dist/assets/{LiveDesktop-D9PC-iAT.js → LiveDesktop-Bca91cEb.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-0YxB-I-X.js → LocalVmWorkspace-CVLDY3ws.js} +1 -1
- package/dist/assets/{MacLocalControl-DoEGcs3V.js → MacLocalControl-BeNWQ9oY.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-CAlARwd0.js → MarkdownFilePreview-CYw3CQ3T.js} +1 -1
- package/dist/assets/{MenuMotion-DfjnHTCi.js → MenuMotion-CHp-hB40.js} +1 -1
- package/dist/assets/{NewBotDialog-D3i7j_KP.js → NewBotDialog-BxeQktoI.js} +1 -1
- package/dist/assets/{PhoneAppDialog-OeXLO0Wb.js → PhoneAppDialog-CIlw_m5U.js} +1 -1
- package/dist/assets/{PlacesRail-3RaNlpug.js → PlacesRail-Df-jNTHn.js} +1 -1
- package/dist/assets/PluginsPanel-CMqZcDkC.js +8 -0
- package/dist/assets/{ProIntroduction-B3phUWnc.js → ProIntroduction-D8hWm9R5.js} +1 -1
- package/dist/assets/{PublishedAppsPage-BXWDYkhG.js → PublishedAppsPage-BMn3C64O.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-vgrEf5B7.js → RemoteAgentSettingsPanel-B7QJizjx.js} +1 -1
- package/dist/assets/{RoomPanel-BmXypXPv.js → RoomPanel-CyWZ4kkq.js} +1 -1
- package/dist/assets/RoutinesPage-B9kKyfFp.js +2 -0
- package/dist/assets/{ServerPairingCard-c2fKq1gh.js → ServerPairingCard-D21dP5Bc.js} +1 -1
- package/dist/assets/SettingsModal-afRPXeYI.js +2 -0
- package/dist/assets/{ShareDepartmentDialog-CJITsmAd.js → ShareDepartmentDialog-CwErWDth.js} +1 -1
- package/dist/assets/{SignedInSites-B2pCMdic.js → SignedInSites-CFyvOLSc.js} +1 -1
- package/dist/assets/{TeamFilesPage-B10cdbwa.js → TeamFilesPage-BvhXs2O5.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-CRmTfBOI.js → TeamLibraryPanel-Dm8wjNB4.js} +1 -1
- package/dist/assets/{TeamMapPage-BoTNppEy.js → TeamMapPage-jCSzFPvB.js} +1 -1
- package/dist/assets/{ToolPageShell-BPd_nyJ8.js → ToolPageShell-DKZUregg.js} +1 -1
- package/dist/assets/{TriggersPage-DDxtJMT4.js → TriggersPage-wSB6z1cp.js} +1 -1
- package/dist/assets/{VisibilitySection-Cd3TZvS_.js → VisibilitySection-CFr6fOzq.js} +1 -1
- package/dist/assets/{WebhookTrigger-AJduidiC.js → WebhookTrigger-BJN-V-bx.js} +1 -1
- package/dist/assets/{WorksOnGrid-DHo10o0j.js → WorksOnGrid-B3wYro9M.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DnIZyeSK.js → abnfDiagram-YUKMZFIV-DRhWKTiz.js} +1 -1
- package/dist/assets/{activity-DrX2_Hm9.js → activity-l0oTqbd6.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DHdulT2e.js → architectureDiagram-47P4ROYG-C_qnTvJF.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BGReDH4k.js → blockDiagram-E7TT5TSB-DzLSloVY.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-BV9zDZsL.js → c4Diagram-CRA5TL53-BzVViHCA.js} +1 -1
- package/dist/assets/{calendar-days-Ddhxf1PV.js → calendar-days-DFd3GKf_.js} +1 -1
- package/dist/assets/channel-B2D6cAE5.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DAj16syq.js → chunk-2Q5K7J3B-hR-bQJHo.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CMyoXW_3.js → chunk-5VM5RSS4-BWmBW1XC.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW--z54G8Jv.js → chunk-7TKQ45FW-DuUk7RXl.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-CPPbUHIj.js → chunk-AW2ZBBNX-Madgl1uv.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-pKEz9wbK.js → chunk-FVRAUYC3-WSgsvIGA.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-DIOqwx2X.js → chunk-HTAEGDNF-CfoPR2yG.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BW474-Li.js → chunk-JWPE2WC7-tLRHdBom.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DjAEB-Df.js → chunk-KQW6MTUR-BqwuNuVY.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CMZz2xNV.js → chunk-XXDRQBXY-BOeb8xE4.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-7GYDWs2n.js → classDiagram-v2-K4WV4PDN-CFeH5trZ.js} +1 -1
- package/dist/assets/{core-Dq4LUz6X.js → core-CnInZb-o.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Dy2zOVu3.js → cose-bilkent-JH36ORCC-BEg68hhI.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-C7I3qmqf.js → cynefin-EF2NZ3EQ-B_Xq3hQ3.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-CsPcUXHD.js → cynefinDiagram-3GCD6N5R-DN1o2ihW.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-DxvGlifm.js → dagre-W4DXFKR2-BFf83-nP.js} +1 -1
- package/dist/assets/{de-CrlnmnfQ.js → de-BpsYkrLY.js} +1 -1
- package/dist/assets/{desktop-connection-Df-k5QBM.js → desktop-connection-CU6jsy2e.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-Qz2-e2_u.js → diagram-2UJZ2QOL-_qwbS5JH.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-D1u4ioUX.js → diagram-OVF4WLC6-9sq9EfiF.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-DZiCtcMI.js → diagram-PFPMY2P6-Ow1v5ZhK.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-DmVn9h1H.js → diagram-UMYRVEAY-DDTBFPls.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-CJK2ajcB.js → diagram-YEKJPTXX-D1zZ8KqI.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-NoYT_JX9.js → diagram-ZIFT7M5P-C_vZWUw8.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BooF3Pem.js → ebnfDiagram-VR2GEFS7-D_1GvBDx.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-4Ai0igvq.js → elk-IJKZMXRS-CV-PzspH.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-CdhhzqVX.js → erDiagram-O2IAPWRE-CnKVd0av.js} +1 -1
- package/dist/assets/{es-BIPy8tP9.js → es-COLCGADa.js} +1 -1
- package/dist/assets/{file-up-Bs5NWcjw.js → file-up-Bjx5Vcmk.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-SeyZJAiT.js → flowDiagram-OXPTDLAJ-CGJh171P.js} +1 -1
- package/dist/assets/{fr-CCbXz1Dc.js → fr-CJ1x1iRl.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-rmA_SJlC.js → ganttDiagram-R7TSEDQI-CygoACFs.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-Coc2oeHo.js → gitGraphDiagram-XJZIOB7I-ByxErzHV.js} +1 -1
- package/dist/assets/{hi-DmCL9a_Y.js → hi-BC0iO7jD.js} +1 -1
- package/dist/assets/{index-uiyAwyX1.js → index-BRfvYRb5.js} +1 -1
- package/dist/assets/{index-D69O3YiA.js → index-DQZxP2c4.js} +2 -2
- package/dist/assets/{index-C1PEx1tc.js → index-DtDQrExn.js} +3 -3
- package/dist/assets/{infoDiagram-5W2HQ5XZ-DScYPtht.js → infoDiagram-5W2HQ5XZ-BlzjfTwq.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-Cf7mJB_l.js → ishikawaDiagram-K3B6WC7H-2rf_4lR_.js} +1 -1
- package/dist/assets/{it-BWkdcVfm.js → it-BIwsqdpz.js} +2 -2
- package/dist/assets/{ja-BaOL6cSA.js → ja-BJYXkO5E.js} +2 -2
- package/dist/assets/{journeyDiagram-COXZFDF6-Dtmolw3A.js → journeyDiagram-COXZFDF6-mGgPoETt.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-CSL1-s5L.js → kanban-definition-P3RFRI5V-j2hU8Bw4.js} +1 -1
- package/dist/assets/{kit-Cjq8TV0N.js → kit-qjammJR4.js} +1 -1
- package/dist/assets/{ko-ebMBLBXv.js → ko-7QtaPFvf.js} +2 -2
- package/dist/assets/{livekit-KT4NEVZO-B3DA1PsD.js → livekit-KT4NEVZO-DbFoU2r9.js} +1 -1
- package/dist/assets/{mcp-servers-DoMFsds6.js → mcp-servers-Tb2cnkiM.js} +1 -1
- package/dist/assets/{memory-BR-ujoQY.js → memory-BNaMRI5v.js} +1 -1
- package/dist/assets/{mermaid.core-BK1qxlD4.js → mermaid.core-B1mlFiOp.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-Cb7ESZ0y.js → mindmap-definition-LZFPQGKD-C7XLkIzZ.js} +1 -1
- package/dist/assets/{minimize-msM7mbil.js → minimize-Dga3UCb8.js} +1 -1
- package/dist/assets/{monitor-DpsqT1_R.js → monitor-DMPjQDZP.js} +1 -1
- package/dist/assets/{org-library-alRyzCTE.js → org-library-IKFXm7D6.js} +1 -1
- package/dist/assets/{package-format-BFXbXHk8.js → package-format-COujx3jP.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-CqmJQKhe.js → pegDiagram-BGZESJAR-BS2zKH6g.js} +1 -1
- package/dist/assets/{phones-J7mYR-fY.js → phones-CINpTjZv.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-w_QuumOv.js → pieDiagram-CAPJLFHJ-DVAuLXem.js} +1 -1
- package/dist/assets/{pl-CSbinyb5.js → pl-CLa2ta1_.js} +2 -2
- package/dist/assets/{pt-br-BkWykL5e.js → pt-br-8RQzCbpg.js} +3 -3
- package/dist/assets/{quadrantDiagram-GDMTTRAM-248q9C3h.js → quadrantDiagram-GDMTTRAM-H7QRxmHt.js} +1 -1
- package/dist/assets/{rail-DRr_33Fe.js → rail-DNpLzOxa.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-BLzQ_5t7.js → railroadDiagram-SM67HX2B-dq6Rokc9.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BPK6Q0O6.js → remote-desktop-panel-Cxv6Qt3x.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-Bgi1TLdN.js → requirementDiagram-X7JNWC4A-BeWeL_-r.js} +1 -1
- package/dist/assets/{ru-DD01Hb1S.js → ru-CIdzvRVZ.js} +2 -2
- package/dist/assets/{sankeyDiagram-UM26HJRW-CrZgn-Cf.js → sankeyDiagram-UM26HJRW-BmJ-9lt-.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-gAwq1ZfG.js → sequenceDiagram-ZO4K6R2Y-Uuh1hEOh.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BlXmG_DJ.js → sizeCapture-INFHLROL-mKDf6lys.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CEFB1Iaq.js → stateDiagram-v2-TBUQTH76-BaEihzov.js} +1 -1
- package/dist/assets/{styles-DOJOOIp4.js → styles-3g-ZPS7M.js} +5 -5
- package/dist/assets/styles-CsrDURJH.css +1 -0
- package/dist/assets/{swimlanes-N4OXWK64-BtJmWAOz.js → swimlanes-N4OXWK64-CpP-NKGz.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-C50Dm6LQ.js +8 -0
- package/dist/assets/{template-add-BcTS64TG.js → template-add-CHwGLPet.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-BZ270zxf.js → timeline-definition-YOQAKGHF-Ca3rjetv.js} +1 -1
- package/dist/assets/{tr-Bw35A32w.js → tr-BhclavHM.js} +1 -1
- package/dist/assets/{uk-DsPsCgp4.js → uk-Or5wmf6s.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-D5yZb3KQ.js → usecaseDiagram-VIAY4XPW-BuuYl689.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-OFx2qTzp.js → vennDiagram-BLWOH2XV-C__pWnnE.js} +1 -1
- package/dist/assets/{vi-DhPdzwW-.js → vi-CYbGVqh-.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-DzSmrVKa.js → wardleyDiagram-YMQ3BMBF-yWcEHD-N.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-UP1H1u5V.js → xychartDiagram-TAQBALBS-CvcdOA7A.js} +1 -1
- package/dist/assets/{zh-CzC3CUQA.js → zh-iptM1e_T.js} +2 -2
- package/dist/assets/{zh-tw-DeXHnAvy.js → zh-tw-BaO1c--E.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/container-mcp.js +18 -17
- package/dist-server/index.js +1136 -1114
- package/dist-server/openmausbot.js +182 -180
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +182 -180
- package/dist-server/server/ai-pool.js +72 -0
- package/dist-server/server/cloud-connected-apps.js +33 -16
- package/dist-server/server/composio-broker-access.js +1 -1
- package/dist-server/server/composio.js +3 -2
- package/dist-server/server/config.js +5 -7
- package/dist-server/server/connector-auth-config-hint.js +5 -0
- package/dist-server/server/drivers/claude.js +14 -11
- package/dist-server/server/flatpak-host.js +5 -2
- package/dist-server/server/host/ai-pool.js +109 -0
- package/dist-server/server/host/app-suggestions.js +2 -1
- package/dist-server/server/host/limit-takeover.js +11 -4
- package/dist-server/server/index.js +33 -26
- package/dist-server/server/limit-failover.js +3 -0
- package/dist-server/server/model-selection-schema.js +9 -0
- package/dist-server/server/routes/ai-pool-patch.js +24 -0
- package/dist-server/server/routes/config.js +8 -1
- package/dist-server/server/routine-dispatch.js +21 -0
- package/dist-server/server/routines.js +4 -18
- package/dist-server/server/tailscale.js +16 -6
- package/dist-server/server/workspace-backup-http.js +2 -2
- package/dist-server/shared/limit-backup.js +1 -1
- package/dist-server/shared/settings-places.js +1 -0
- package/dist-server/shared/toolkit-card.js +1 -0
- package/dist-server/vps-container-mcp.js +18 -17
- package/dist-server/workspace-backup.worker.js +18 -17
- package/package.json +1 -1
- package/dist/assets/PluginsPanel-B5Q70eO8.js +0 -8
- package/dist/assets/RoutinesPage-CLXohizn.js +0 -2
- package/dist/assets/SettingsModal-BlX9XoBu.js +0 -2
- package/dist/assets/channel-DZM5KU--.js +0 -1
- package/dist/assets/styles-9UFSdSaJ.css +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-pBTtzroP.js +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as dn,t as n,r as d,j as e,X as ss,an as as,a as q,w as Ye,o as Xt,b as Mt,aM as Cs,d as Rs,i as Vt}from"./styles-3g-ZPS7M.js";import{S as un,g as w,u as et,eL as Es,eM as zs,eN as Is,eO as gt,y as Ts,eP as Os,eq as Bs,l as Ps,G as zn,eQ as Ms,eR as Ls,a9 as Us,T as $s,aU as en,bQ as Fs,eS as zt,eT as is,eU as It,eV as os,eW as cs,eX as Tt,eY as Ks,eZ as rs,e_ as Ot,e$ as ls,f0 as Ds,f1 as In,f2 as Qs,al as ds,f3 as St,f4 as Hs,f5 as _s,f6 as Js,f7 as Vs,f8 as Gs,f9 as qs,fa as dt,fb as Tn,fc as Zs,fd as On,el as Bn,fe as Ct,ff as Ws,fg as Ys,C as Xs,fh as ea,fi as ta,fj as Gt,fk as na,fl as sa,fm as aa,fn as ia,fo as oa,fp as ca,fq as ra,fr as la,fs as da,ft as ua}from"./App-h8WTNY4l.js";import{L as ae,P as us,x as pa,e as ma,k as pn,E as ha,F as fa,B as xa}from"./PlacesRail-Df-jNTHn.js";import{u as qt}from"./mcp-servers-Tb2cnkiM.js";import"./index-DtDQrExn.js";import{C as ps,R as tn}from"./MenuMotion-CHp-hB40.js";import{u as ga}from"./ProIntroduction-D8hWm9R5.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";const ba=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],ya=dn("phone-call",ba);const ka=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],ja=dn("radio-tower",ka);const va=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],Zt=dn("server-cog",va),wa=new Set(["twitter","x"]);function Pn(t,s){return t!=="managed"||!wa.has(s.trim().toLowerCase())?null:"Twitter/X needs your own X Developer app and Composio auth config. Use self-hosted connected apps for now."}const Na=5,Aa=3,Bt=4;function Sa(t,s=Na,o=[]){const c=new Map;for(const x of t)for(const y of new Set(x.categories??[]))c.set(y,(c.get(y)??0)+1);const r=[...c].sort((x,y)=>y[1]-x[1]||x[0].localeCompare(y[0])).map(([x])=>x),l=o.filter(x=>r.indexOf(x)>=s),b=[...r.slice(0,Math.max(0,s-l.length)),...l];return{inline:b,more:r.filter(x=>!b.includes(x))}}function nn(t,s){return s===null||(t.categories??[]).includes(s)}function Ca(t,s,o){const c=[],r=t.filter(l=>s(l.slug));r.length&&c.push({kind:"connected",cards:r});for(const l of o.slice(0,Aa)){const b=t.filter(x=>!s(x.slug)&&nn(x,l));b.length&&c.push({kind:"category",category:l,cards:b.slice(0,Bt),more:b.length>Bt})}return c.push({kind:"all",cards:t.filter(l=>!s(l.slug))}),c}const Ra={productivity:"productivity","developer tools":"developerTools",communication:"communication",files:"files","sales and crm":"salesCrm",design:"design",marketing:"marketing",analytics:"analytics",social:"social"},Ea={"google calendar":"googleCalendar","google sheets":"googleSheets","google docs":"googleDocs",notion:"notion",github:"github",linear:"linear",sentry:"sentry",jira:"jira",slack:"slack",gmail:"gmail",discord:"discord","google drive":"googleDrive",posthog:"posthog","x (twitter)":"xTwitter",reddit:"reddit",zapier:"zapier",hubspot:"hubspot",salesforce:"salesforce",asana:"asana",trello:"trello",dropbox:"dropbox",airtable:"airtable",figma:"figma",stripe:"stripe"};function ut(t){const s=Ra[t.trim().toLowerCase()];return s?n(`apps.category.${s}`):t}function Mn(t){const s=Ea[t.label.trim().toLowerCase()];return s?n(`apps.catalog.${s}.blurb`):t.blurb}function za({server:t,disabled:s,onSaved:o}){const[c,r]=d.useState(!1),[l,b]=d.useState(null);if(typeof t.apps!="boolean"||t.apps&&t.hasApps!==!0)return null;const x=t.apps,y=async()=>{r(!0),b(null);try{const p=await w(`/api/mcp/servers/${encodeURIComponent(t.name)}`,{method:"PATCH",body:JSON.stringify({apps:!x})});o(p.servers??[])}catch(p){b(p instanceof Error?p.message:String(p))}finally{r(!1)}};return e.jsxs("div",{"data-mcp-apps":t.name,className:"mt-3 flex items-center gap-3 border-t border-hairline/40 pt-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("mcp.apps.title")}),e.jsx("div",{role:l?"alert":void 0,className:l?"mt-0.5 text-[12px] text-danger":"mt-0.5 text-[12px] text-ink-secondary",children:l??n("mcp.apps.desc")})]}),c&&e.jsx(ae,{"aria-hidden":"true",size:13,className:"animate-spin text-ink-secondary"}),e.jsx(un,{checked:x,disabled:s||c,onClick:()=>{y()},"aria-label":n("mcp.apps.toggleAria",{name:t.name}),className:"disabled:opacity-40"})]})}function Ln({feature:t,enabled:s,prefix:o}){const{dispatch:c}=et(),[r,l]=d.useState(!1),[b,x]=d.useState(!1),y=async()=>{if(!r){l(!0),x(!1);try{const p=await w("/api/config",{method:"PATCH",body:JSON.stringify({features:{[t]:!s}})});c({type:"configStatus",config:p})}catch{x(!0)}finally{l(!1)}}};return e.jsxs("div",{className:"mt-4 flex items-start justify-between gap-4 rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(`${o}.title`)}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:n(`${o}.desc`)}),b&&e.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:n("mcp.claude.error")})]}),e.jsx(un,{checked:s,"aria-label":n(`${o}.aria`),disabled:r,onClick:()=>{y()},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}function Ia(){const{state:t}=et();return e.jsxs(e.Fragment,{children:[e.jsx(Ln,{feature:"claudeUserMcp",enabled:Es(t.config),prefix:"mcp.claude"}),e.jsx(Ln,{feature:"claudeUserSkills",enabled:zs(t.config),prefix:"mcp.claudeSkills"})]})}function Un({app:t}){if("image"in t.icon)return e.jsx("img",{src:t.icon.image,alt:"",className:"size-10 shrink-0 rounded-xl object-contain"});const s=t.icon.glyph;return e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(s,{size:19,"aria-hidden":"true"})})}class me extends Error{key;constructor(s){super(s),this.key=s}}const sn=/^https?:\/\//i,ms=/^[A-Za-z_][A-Za-z0-9_]*=/,Ta=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+:/,Oa=new Set(["npx","uvx","bunx"]),Ba=new Set(["pnpm","yarn"]);function Pa(t,s=[]){const o=Ma(t).trim();if(!o)return null;try{const c=/^[{[]/.test(o)?Qa(o):sn.test(o)&&!/\s/.test(o)?[mn(void 0,o,void 0,[])]:La(o);return{ok:!0,servers:Ga(c,s)}}catch(c){if(c instanceof me)return{ok:!1,error:c.key};throw c}}function Ma(t){return t.replace(/[“”„]/g,'"').replace(/[‘’]/g,"'").replace(/(^|\s)[–—](?=[a-z])/g,"$1--")}function hs(t){const s=[];let o=[],c="",r=!1;const l=()=>{r&&o.push(c),c="",r=!1},b=()=>{l(),o.length&&s.push(o),o=[]},x=y=>t[y]===`
|
|
2
|
+
`?1:t[y]==="\r"&&t[y+1]===`
|
|
3
|
+
`?2:0;for(let y=0;y<t.length;y+=1){const p=t[y];if(p==="\\"||(p==="`"||p==="^")&&x(y+1)){const m=x(y+1);if(m){y+=m;continue}y+1<t.length&&(c+=t[y+1],r=!0,y+=1);continue}if(p==="'"){const m=t.indexOf("'",y+1);if(m<0)throw new me("mcp.paste.notRecognized");c+=t.slice(y+1,m),r=!0,y=m;continue}if(p==='"'){let m=y+1;for(;m<t.length&&t[m]!=='"';m+=1){if(t[m]==="\\"&&m+1<t.length){const N=x(m+1);if(N){m+=N;continue}if('"\\$`'.includes(t[m+1])){c+=t[m+1],m+=1;continue}}c+=t[m]}if(m>=t.length)throw new me("mcp.paste.notRecognized");r=!0,y=m;continue}if(p==="$"&&t[y+1]==="("){const m=t.indexOf(")",y+2);if(m<0)throw new me("mcp.paste.notRecognized");c+=t.slice(y,m+1),r=!0,y=m;continue}if(p==="#"&&!r){for(;y+1<t.length&&t[y+1]!==`
|
|
4
|
+
`;)y+=1;continue}if(p===`
|
|
5
|
+
`||p===";"){b();continue}if(p==="&"&&t[y+1]==="&"){b(),y+=1;continue}if(/\s/.test(p)){l();continue}c+=p,r=!0}return b(),s}function La(t){const s=hs(t);if(!s.length)throw new me("mcp.paste.notRecognized");return s.map(o=>{const c=o[0]==="$"||o[0]===">"?o.slice(1):o;return c[0]==="claude"&&c[1]==="mcp"&&c[2]==="add"?Ua(c.slice(3)):c[0]==="claude"&&c[1]==="mcp"&&c[2]==="add-json"?$a(c.slice(3)):Fa(c)})}function Ua(t){let s,o;const c=[],r=[],l=[];let b=[];for(let m=0;m<t.length;m+=1){const N=t[m];if(N==="--"){b=t.slice(m+1);break}const H=/^(--[a-z][a-z-]*|-[a-zA-Z])(?:=([\s\S]*))?$/.exec(N);if(!H){l.push(N);continue}const A=()=>H[2]??t[++m]??"",M=(J,D)=>{for(;m+1<t.length&&J.test(t[m+1])&&!sn.test(t[m+1]);)D.push(t[++m])};switch(H[1]){case"--transport":case"-t":s=A().toLowerCase();break;case"--header":case"-H":c.push(A()),H[2]===void 0&&M(Ta,c);break;case"--env":case"-e":r.push(A()),H[2]===void 0&&M(ms,r);break;case"--client-id":o=A();break;case"--scope":case"-s":case"--callback-port":A();break}}const[x,y,...p]=[...l,...b];if(!x||!y)throw new me("mcp.paste.incomplete");if(s!=="stdio"&&(s==="http"||s==="sse"||sn.test(y))){const m=mn(x,y,s==="sse"?"sse":s==="http"?"http":void 0,c.map(Ha));return o?{...m,oauthClientId:o}:m}return{transport:"stdio",name:gt(x),command:y,args:p,env:r.map(hn)}}function $a(t){const s=[];for(let l=0;l<t.length;l+=1){const b=t[l];if(b==="--scope"||b==="-s"){l+=1;continue}b.startsWith("-")&&!b.startsWith("{")||s.push(b)}const[o,c]=s;if(!o||!c)throw new me("mcp.paste.incomplete");const r=an(o,fs(c));if(!r)throw new me("mcp.paste.notRecognized");return r}function Fa(t){let s=0;const o=[];for(;s<t.length&&ms.test(t[s]);)o.push(hn(t[s++]));const[c,...r]=t.slice(s);if(!c)throw new me("mcp.paste.notRecognized");if(c==="docker"&&r[0]==="run")return Da(r,o);if(!Oa.has(c)&&!(Ba.has(c)&&r[0]==="dlx"))throw new me("mcp.paste.notRecognized");const l=r.find((b,x)=>!b.startsWith("-")&&!(x===0&&b==="dlx"));if(!l)throw new me("mcp.paste.incomplete");return{transport:"stdio",name:xn(l),command:c,args:r,env:o}}const Ka=new Set(["-i","-t","-it","-ti","-d","--rm","--init","--interactive","--tty","--detach","--privileged"]);function Da(t,s){const o=[t[0]];let c;for(let r=1;r<t.length;r+=1){const l=t[r];if(c||!l.startsWith("-"))c??=l,o.push(l);else if((l==="-e"||l==="--env")&&r+1<t.length){const b=t[++r],x=b.split("=")[0];s.push(b.includes("=")?hn(b):{name:x,value:"",gap:{kind:"variable",names:[x],before:"",after:""}}),o.push(l,x)}else l.includes("=")||Ka.has(l)||r+1>=t.length?o.push(l):o.push(l,t[++r])}if(!c)throw new me("mcp.paste.incomplete");return{transport:"stdio",name:xn(c.replace(/:[^/:]*$/,"")),command:"docker",args:o,env:s}}function fs(t){try{return JSON.parse(t)}catch{throw new me("mcp.paste.badJson")}}const ht=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Qa(t){const s=fs(t);if(!ht(s))throw new me("mcp.paste.notRecognized");const o=an(typeof s.name=="string"?s.name:void 0,s);if(o)return[o];const c=ht(s.mcpServers)?s.mcpServers:ht(s.servers)?s.servers:s,r=Object.entries(c).map(([l,b])=>an(l,b));if(!r.length||r.some(l=>!l))throw new me("mcp.paste.notRecognized");return r}const $n=t=>ht(t)?Object.entries(t).filter(s=>typeof s[1]=="string"):[];function an(t,s){if(!ht(s))return null;const o=typeof s.url=="string"?s.url:typeof s.serverUrl=="string"?s.serverUrl:void 0,c=typeof s.type=="string"?s.type.toLowerCase():"";if(o!==void 0){const p=$n(s.headers).map(([m,N])=>Pt(m,N));return mn(t,o,c==="sse"?"sse":c?"http":void 0,p)}if(typeof s.command!="string"||!s.command.trim())return null;const r=Array.isArray(s.args)?s.args.filter(p=>typeof p=="string"):[],[l,...b]=r.length?[s.command.trim()]:hs(s.command)[0]??[s.command],x=$n(s.env).map(([p,m])=>Pt(p,m)),y=[...b,...r];return{transport:"stdio",name:t?gt(t):xn(y.find(p=>!p.startsWith("-"))??l??""),command:l,args:y,env:x}}function mn(t,s,o,c){const r=fn(s);return{transport:"remote",name:t?gt(t):Va(s),type:o??(/\/sse\/?(?:[?#]|$)/i.test(s)?"sse":"http"),url:s,...r?{urlGap:r}:{},headers:c}}function Ha(t){const s=t.indexOf(":");if(s<=0)throw new me("mcp.paste.badPair");return Pt(t.slice(0,s).trim(),t.slice(s+1).trim())}function hn(t){const s=t.indexOf("=");if(s<=0)throw new me("mcp.paste.badPair");return Pt(t.slice(0,s),t.slice(s+1))}function Pt(t,s){const o=fn(s);return o?{name:t,value:"",gap:o}:{name:t,value:s}}const _a=/\$\{([^}]*)\}|\$\(([^)]*)\)|\$([A-Za-z_][A-Za-z0-9_]*)/g,Ja=/<([^<>\s][^<>]{0,63})>|\b(YOUR[_-][A-Za-z0-9_-]+|your[_-][a-z0-9_-]+)\b/g;function fn(t){const s=[];for(const l of t.matchAll(_a)){const b=(l[1]??l[2]??l[3]??"").replace(/^(?:env|input):/,"").replace(/:-[\s\S]*$/,"").trim();s.push({start:l.index,end:l.index+l[0].length,name:b||l[0],kind:"variable"})}for(const l of t.matchAll(Ja))s.some(b=>l.index<b.end&&l.index+l[0].length>b.start)||s.push({start:l.index,end:l.index+l[0].length,name:(l[1]??l[2]??"").trim(),kind:"placeholder"});if(!s.length)return;const o=[...new Set(s.map(l=>l.name))],c=s.some(l=>l.kind==="variable")?"variable":"placeholder",r=s.length===1?s[0]:null;return{kind:c,names:o,before:r?t.slice(0,r.start):"",after:r?t.slice(r.end):""}}const xs=new Set(["www","mcp","api","server","servers","app","remote","sse","gateway","co","com","org","net","ac","gov"]);function Va(t){let s;try{s=new URL(t).hostname}catch{return""}if(/^[\d.]+$/.test(s)||s.includes(":"))return"server";const o=s.split(".").filter(Boolean);return o.length>1&&o.pop(),gt(o.filter(c=>!xs.has(c)).at(-1)??o.at(-1)??"server")}function xn(t){const s=t.replace(/(?!^)@[^/@]*$/,"").split("/"),o=s.at(-1)??t,c=o.replace(/^(?:mcp-server-|server-|mcp-)/,"").replace(/(?:-mcp-server|-mcp|-server)$/,""),r=(s.at(-2)??"").replace(/^@/,"");return gt(xs.has(c)&&r?r:c||o)||"server"}function Ga(t,s){const o=new Set(s);return t.map(c=>{let r=c.name||"server";if(o.has(r))for(let l=2;o.has(r);l+=1)r=Is(`${c.name.slice(0,29)}-${l}`);return o.add(r),r===c.name?c:{...c,name:r}})}const qa=2e6;function Za(t){const s=t.trim(),c=/^\d{1,3}([\s,._ '])\d{3}(?:\1\d{3})*$/.test(s)?s.replace(/\D/g,""):s;return c?!/^\d+$/.test(c)||Number(c)>qa?{ok:!1,error:{key:"mcp.err.resultBudget"}}:{ok:!0,value:Number(c)}:{ok:!0,value:void 0}}function Fn(t){return t.resultBudget===void 0?"":String(t.resultBudget)}function Wa(t,s){const o=Za(t);if(!o.ok)return o;const c=s();return!c.ok||o.value===void 0?c:{ok:!0,body:{...c.body,resultBudget:o.value}}}function Ya({value:t,onChange:s}){return e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:n("mcp.field.resultBudget")}),e.jsx("input",{value:t,onChange:o=>s(o.target.value),inputMode:"numeric",placeholder:"8000",className:"mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent"}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:n("mcp.resultBudgetHint")})]})}function pe(t){return"url"in t}let Kn=0;function Oe(t={name:"",value:""}){return Kn+=1,{id:Kn,...t}}function Xe(){return{name:"",transport:"remote",command:"",args:"",env:[Oe()],type:"http",url:"",headers:[Oe()],oauthClientId:"",oauthClientSecret:"",oauthScopes:"",oauthForgetSecret:!1,resultBudget:""}}const Dn=t=>t.length?t.map(s=>Oe({name:s,value:"",saved:!0})):[Oe()],Qn=t=>t.length?t.map(s=>Oe({...s})):[Oe()];function Xa(t){return pe(t)?{...Xe(),name:t.name,type:t.type,url:t.url,headers:Dn(t.headerKeys),oauthClientId:t.oauth?.clientId??"",oauthScopes:t.oauth?.scopes.join(" ")??"",resultBudget:Fn(t)}:{...Xe(),name:t.name,transport:"stdio",command:t.command,args:t.args.join(`
|
|
6
|
+
`),env:Dn(t.envKeys),resultBudget:Fn(t)}}function ei(t){return t.transport==="remote"?{...Xe(),name:t.name,type:t.type,url:t.url,...t.urlGap?{urlGap:t.urlGap}:{},headers:Qn(t.headers),oauthClientId:t.oauthClientId??""}:{...Xe(),name:t.name,transport:"stdio",command:t.command,args:t.args.join(`
|
|
7
|
+
`),env:Qn(t.env)}}function on(t){const s=t.value.trim();if(!t.gap||!s)return t.value;const{before:o,after:c}=t.gap;return o.trim()&&s.toLowerCase().startsWith(o.trim().toLowerCase())?s:`${o}${s}${c}`}const ti=/^[A-Za-z_][A-Za-z0-9_]*$/,ni=/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,128}$/;function Hn(t,s){const o={};for(const c of t){const r=c.name.trim(),l=s==="header"?on(c).trim():on(c);if(!(!r&&!l)){if(!r)return{ok:!1,error:{key:"mcp.err.rowName"}};if(!(s==="header"?ni:ti).test(r))return{ok:!1,error:{key:s==="header"?"mcp.headers.invalidName":"mcp.env.invalidName",params:{key:r}}};if(Object.hasOwn(o,r))return{ok:!1,error:{key:s==="header"?"mcp.headers.duplicate":"mcp.env.duplicate",params:{key:r}}};if(l)o[r]=l;else if(c.saved)o[r]=!0;else return{ok:!1,error:{key:"mcp.err.missingValue",params:{name:r}}}}}return{ok:!0,values:o}}function si(t){return t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean)}function ai(t,s){const o=t.clientId.trim();if(!o)return;const c=t.clientSecret.trim(),r=t.scopes.split(/[\s,]+/).filter(Boolean);return{clientId:o,...c?{clientSecret:c}:s?.clientSecretConfigured&&!t.forgetSecret?{clientSecret:!0}:{},...r.length?{scopes:r}:{}}}function ii(t,s){const o=t.name.trim();if(t.transport==="remote"){const l=t.url.trim();if(!o||!/^https?:\/\/\S+$/i.test(l))return{ok:!1,error:{key:"mcp.err.nameAndUrl"}};if(fn(l))return{ok:!1,error:{key:"mcp.paste.urlMissing"}};const b=Hn(t.headers,"header");if(!b.ok)return b;const x=ai({clientId:t.oauthClientId,clientSecret:t.oauthClientSecret,scopes:t.oauthScopes,forgetSecret:t.oauthForgetSecret},s&&pe(s)?s.oauth:void 0);return{ok:!0,body:{type:t.type,url:l,headers:b.values,...x?{oauth:x}:{}}}}const c=t.command.trim();if(!o||!c)return{ok:!1,error:{key:"mcp.err.nameAndCommand"}};const r=Hn(t.env,"env");return r.ok?{ok:!0,body:{command:c,args:si(t.args),env:r.values}}:r}function _n(t){if(t.transport!=="remote"||t.oauthClientId.trim())return null;const s=t.headers.filter(o=>o.name.trim());return s.length===1&&on(s[0]).trim()||null}function oi(t){return n(t.kind==="variable"?"mcp.paste.variable":"mcp.paste.placeholder",{name:t.names.join(", ")})}const Jn="w-full min-w-0 rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent";function Ge({kind:t,rows:s,onChange:o,valuesOf:c,placeholder:r}){const l=(p,m)=>o(s.map(N=>N.id===p?{...N,...m}:N)),b=t==="header"?":":"=",x=(p,m)=>{const N=m.clipboardData.getData("text"),H=N.indexOf(b);H<=0||(m.preventDefault(),l(p.id,{name:N.slice(0,H).trim(),value:N.slice(H+1).trim()}))},y=p=>e.jsx("input",{type:"password","aria-label":p.name.trim()||n("mcp.row.value"),value:p.value,autoComplete:"new-password",spellCheck:!1,placeholder:r??(p.saved?n("mcp.oauth.secretSaved"):n("mcp.row.value")),onChange:m=>l(p.id,{value:m.target.value}),className:Jn});return e.jsxs("div",{className:"space-y-2",children:[s.filter(p=>c==="gaps"?p.gap:c==="named"?p.name.trim():!0).map(p=>e.jsxs("div",{children:[c?e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block font-mono text-[12px] font-medium text-ink-secondary",children:p.name}),y(p)]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{"aria-label":n(t==="header"?"mcp.row.headerName":"mcp.row.envName"),value:p.name,spellCheck:!1,autoComplete:"off",placeholder:t==="header"?"Authorization":"API_KEY",onChange:m=>l(p.id,{name:m.target.value}),onPaste:m=>x(p,m),className:`${Jn} max-w-[42%]`}),y(p),e.jsx("button",{type:"button","aria-label":n("mcp.row.remove",{name:p.name.trim()||n("mcp.row.value")}),onClick:()=>o(s.length>1?s.filter(m=>m.id!==p.id):[Oe()]),className:"shrink-0 rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(ss,{size:14})})]}),p.gap&&!p.value.trim()&&e.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-warning",children:oi(p.gap)})]},p.id)),!c&&e.jsxs("button",{type:"button",onClick:()=>o([...s,Oe()]),className:"inline-flex items-center gap-1 rounded-lg px-1 py-1 text-[12px] font-medium text-accent hover:underline",children:[e.jsx(us,{size:13})," ",n("mcp.row.add")]})]})}const Te="mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent",Re="text-[12px] font-medium text-ink-secondary";function ci(t){if(t.transport==="stdio")return t.command;try{return new URL(t.url).host}catch{return t.url}}function ri({server:t,fixKeys:s=!1,taken:o,team:c,busy:r,onCancel:l,onSubmit:b}){const x=!t,[y,p]=d.useState(""),[m,N]=d.useState(()=>t?[Xa(t)]:[]),[H,A]=d.useState(null),M=s&&t!==void 0&&pe(t),[J,D]=d.useState(!x&&!M),[_,F]=d.useState(!1),[L,de]=d.useState(null),v=m.length===1?m[0]:null,V=g=>N(f=>f.length===1?[g(f[0])]:f),W=t&&pe(t)?t.oauth:void 0,he=!!(W?.clientSecretConfigured&&!v?.oauthForgetSecret),ee=c&&x&&v!==null&&_n(v)!==null,te=g=>{p(g),de(null);const f=Pa(g,o);A(f&&!f.ok?f.error:null),N(S=>f?.ok?f.servers.map(ei):J?S.length===1?S:[Xe()]:[])},ke=()=>{const g=[];for(const f of m){const S=Wa(f.resultBudget,()=>ii(f,t));if(!S.ok){de(S.error);return}const E=ee&&_?_n(f):null;g.push({name:f.name.trim(),body:S.body,...E?{ownKey:E}:{}})}de(null),b(g)},Y=!J&&m.some(g=>g.urlGap||g.headers.some(f=>f.gap)||g.env.some(f=>f.gap));return e.jsxs("div",{"data-mcp-editor":!0,className:"mt-4 rounded-2xl border border-hairline/60 bg-card p-4 sm:p-5",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:x?n("mcp.editorNew"):n(M?"mcp.fixKeys.title":"mcp.editorEdit",{name:t.name})}),M&&v&&!J&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:n("mcp.fixKeys.hint")}),v.headers.some(g=>g.name.trim())?e.jsx(Ge,{kind:"header",valuesOf:"named",placeholder:n("mcp.fixKeys.placeholder"),rows:v.headers,onChange:g=>V(f=>({...f,headers:g}))}):e.jsx(Ge,{kind:"header",rows:v.headers,onChange:g=>V(f=>({...f,headers:g}))})]}),x&&e.jsxs("label",{className:"mt-3 block",children:[e.jsx("span",{className:"text-[13px] text-ink",children:n("mcp.paste.prompt")}),e.jsx("textarea",{autoFocus:!0,"aria-label":n("mcp.paste.label"),value:y,onChange:g=>te(g.target.value),spellCheck:!1,rows:3,placeholder:"https://mcp.example.com/mcp",className:"mt-2 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] leading-relaxed text-ink outline-none focus:border-accent"})]}),H&&e.jsx("p",{role:"alert",className:"mt-2 text-[12px] leading-relaxed text-danger",children:n(H)}),x&&y.trim()&&m.length>0&&!H&&e.jsx("p",{role:"status",className:"mt-2 text-[12px] text-ink-secondary",children:v?n("mcp.paste.foundOne",{name:v.name,where:ci(v)}):n("mcp.paste.foundMany",{count:m.length,names:m.map(g=>g.name).join(", ")})}),Y&&e.jsx("div",{className:"mt-3 space-y-3",children:m.map((g,f)=>e.jsxs("div",{className:"space-y-3",children:[m.length>1&&(g.urlGap||g.headers.some(S=>S.gap)||g.env.some(S=>S.gap))&&e.jsx("div",{className:"text-[12px] font-medium text-ink",children:g.name}),g.urlGap&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.field.url")}),e.jsx("input",{value:g.url,spellCheck:!1,onChange:S=>N(E=>E.map((U,P)=>P===f?{...U,url:S.target.value}:U)),className:Te}),e.jsx("span",{className:"mt-1 block text-[11px] text-warning",children:n("mcp.paste.urlMissing")})]}),e.jsx(Ge,{kind:"header",valuesOf:"gaps",rows:g.headers,onChange:S=>N(E=>E.map((U,P)=>P===f?{...U,headers:S}:U))}),e.jsx(Ge,{kind:"env",valuesOf:"gaps",rows:g.env,onChange:S=>N(E=>E.map((U,P)=>P===f?{...U,env:S}:U))})]},f))}),(x||M)&&m.length<=1&&e.jsxs("button",{type:"button","aria-expanded":J,onClick:()=>{D(!J),m.length||N([Xe()])},className:"mt-3 inline-flex items-center gap-1 text-[12px] font-medium text-ink-secondary hover:text-ink",children:[J?e.jsx(as,{size:14}):e.jsx(ps,{size:14})," ",n("mcp.details")]}),J&&v&&e.jsxs("div",{className:"mt-3",children:[x&&e.jsx("div",{className:"inline-flex rounded-lg bg-raised p-0.5",role:"radiogroup","aria-label":n("mcp.field.type"),children:["remote","stdio"].map(g=>e.jsx("button",{type:"button",role:"radio","aria-checked":v.transport===g,onClick:()=>V(f=>({...f,transport:g})),className:q("rounded-md px-3 py-1.5 text-[12px] font-medium transition-colors",v.transport===g?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:n(g==="stdio"?"mcp.transport.stdio":"mcp.transport.remote")},g))}),e.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.field.name")}),e.jsx("input",{disabled:!x,value:v.name,maxLength:32,placeholder:"github",className:q(Te,"disabled:opacity-60"),onChange:g=>V(f=>({...f,name:g.target.value.toLowerCase()}))})]}),v.transport==="remote"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.field.url")}),e.jsx("input",{autoFocus:!x,value:v.url,spellCheck:!1,placeholder:"https://mcp.example.com/mcp",className:Te,onChange:g=>V(f=>({...f,url:g.target.value}))}),v.urlGap&&e.jsx("span",{className:"mt-1 block text-[11px] text-warning",children:n("mcp.paste.urlMissing")})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.field.type")}),e.jsxs(Ts,{className:"mt-1.5 w-full",value:v.type,onChange:g=>V(f=>({...f,type:g.target.value==="sse"?"sse":"http"})),children:[e.jsx("option",{value:"http",children:n("mcp.type.http")}),e.jsx("option",{value:"sse",children:n("mcp.type.sse")})]})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("div",{className:q(Re,"mb-1.5"),children:n("mcp.field.headerRows")}),e.jsx(Ge,{kind:"header",rows:v.headers,onChange:g=>V(f=>({...f,headers:g}))}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:n("mcp.headersHint")})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("div",{className:"text-[12px] font-medium text-ink",children:n("mcp.oauth.title")}),e.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-ink-secondary",children:W?n("mcp.oauth.hintRedirect",{uri:W.redirectUri}):n("mcp.oauth.hint")}),e.jsxs("div",{className:"mt-2 grid gap-4 sm:grid-cols-2",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.oauth.clientId")}),e.jsx("input",{value:v.oauthClientId,spellCheck:!1,autoComplete:"off",className:q(Te,"font-mono text-[12px]"),onChange:g=>V(f=>({...f,oauthClientId:g.target.value}))})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"flex items-center justify-between gap-2 text-[12px] font-medium text-ink-secondary",children:[n("mcp.oauth.clientSecret"),he&&e.jsx("button",{type:"button",onClick:()=>V(g=>({...g,oauthClientSecret:"",oauthForgetSecret:!0})),className:"text-[11px] font-normal text-ink-secondary underline-offset-2 hover:text-ink hover:underline",children:n("mcp.oauth.removeSecret")})]}),e.jsx("input",{type:"password",value:v.oauthClientSecret,autoComplete:"new-password",className:q(Te,"font-mono text-[12px]"),placeholder:he?n("mcp.oauth.secretSaved"):n("mcp.oauth.secretOptional"),onChange:g=>V(f=>({...f,oauthClientSecret:g.target.value}))})]}),e.jsxs("label",{className:"block sm:col-span-2",children:[e.jsx("span",{className:Re,children:n("mcp.oauth.scopes")}),e.jsx("input",{value:v.oauthScopes,placeholder:"offline_access api://my-app/mcp.read",spellCheck:!1,className:q(Te,"font-mono text-[12px]"),onChange:g=>V(f=>({...f,oauthScopes:g.target.value}))})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:Re,children:n("mcp.field.command")}),e.jsx("input",{autoFocus:!x,value:v.command,placeholder:"npx",className:Te,onChange:g=>V(f=>({...f,command:g.target.value}))})]}),e.jsxs("label",{className:"block sm:col-span-2",children:[e.jsx("span",{className:Re,children:n("mcp.field.args")}),e.jsx("textarea",{value:v.args,placeholder:`-y
|
|
8
|
+
@modelcontextprotocol/server-github`,rows:4,className:q(Te,"resize-y font-mono text-[12px]"),onChange:g=>V(f=>({...f,args:g.target.value}))})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("div",{className:q(Re,"mb-1.5"),children:n("mcp.field.envRows")}),e.jsx(Ge,{kind:"env",rows:v.env,onChange:g=>V(f=>({...f,env:g}))})]})]}),e.jsx(Ya,{value:v.resultBudget,onChange:g=>V(f=>({...f,resultBudget:g}))})]})]}),c&&x&&m.length>0&&e.jsxs("div",{"data-mcp-team-scope":!0,className:"mt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-lg bg-raised/50 px-3 py-2 text-[12px]",children:[e.jsx("span",{className:"text-ink-secondary",children:n(ee&&_?"mcp.team.onlyMeOn":"mcp.team.everyone")}),ee&&e.jsxs("label",{className:"flex items-center gap-1.5 text-ink",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:g=>F(g.target.checked)})," ",n("mcp.team.onlyMe")]})]}),L&&e.jsx("p",{role:"alert",className:"mt-3 text-[12px] text-danger",children:n(L.key,L.params)}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:l,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:n("mcp.cancel")}),e.jsxs("button",{type:"button",disabled:r||!m.length,onClick:ke,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3.5 py-2 text-[13px] font-medium text-white disabled:opacity-50",children:[r&&e.jsx(ae,{size:13,className:"animate-spin"})," ",n(x?"mcp.add":"mcp.save")]})]})]})}const li="/assets/logo-DDbLpTdV.png",di="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaEAAAGhCAMAAAD/dvvwAAACf1BMVEX////6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6Rhb6RhYZ6Qt0AAAA1XRSTlMAFThdfpaqwNbl8P/74dKwjmxDDgsvUXWMpLjM4Oz4/OLYtpRyTRg9X4CXq8LX5vH60K5qPgVilcj+1Z0iVYi7qW4jBzVom83z/dGZWREEOny/JiisjTsBBj/EdyEPrfRpR5jk3BRjtPbBDGH5ni0CSKPvuRC+JySE1GREpgllQGCC69oZi7UuF2eQ915m6CztJc57HaUTRXDKA0IaU+dYS3axTuq9N1Leicm3w8+i0xLZvAoxMoZzcRxP9VRaFjxbDVaDKcayTFwgnOma43i6CEF6bTOoblYlAAAHlElEQVR4AezBxQECMBAAsOJwh7s73X9ExugnSQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoJFOt9cfDEfjSURmTmM2XyxX601pabvbH46n8+V6i3vmI56v9+f7q6Wp+meuHhQrZ+IogJ81ztq2dbP12qjdpLaxtm3bts267/XZuDeTzEz6e4DBnxMnTZ4yddr0GV19JI2uw2YGDQoO6QeFQvuHhUf4+J9mzZ4zqQ08MHfe/AVd+N+GLVy0GB5YsnTZ8hUr+Z8io6JjYqFAXHxC4gj6NysiIQk6JQenDGcAo1PTTGhkpU/OMOhf5LTMLEiV3S4nl/ZE5MVCi9D8gkLaU9Q+C3oUl5SW0Z7ysL6QpKJySDcKqKqugWqrVq9ZSxHr8k2otj5vQyQFlE3ZCPfMidW5FLYgHypt2lxIYVu2WlBo1bbtIyhqVmk63NmxcwudidgFRcz8dXRm2O44KFLRu4jObGgL54r37KVznZZCAWvrFjq3b54JBfYf6ErnDh5ymp/5uXRlVvVhSBZ3ZBTdKe8vPz9Hj9GVkWNjIa5ici5d842Lg0SrjhfRtZHh6yFTbK9jdG34CRNiVoWdpBRDT0GaiUMpRZfxkCZu0WlK0ekMRKSdpSxV50IhxfmplObCRchxaTplKbu8CnZlF8yiRFcWw72ri1ZSohnXIEGbwZQp8TrsuXGTcvluwa2aK5QrcnMc3Np9mnINvw0b1q+hfMuXwI1Vd6ooXcZ+uNLmLuVLvYpAro2iChFuwpE1jSrcbAsX7t2nCg8uwq+rm2dRjZsP4dQjH9WoqoRT1lEq8vgQ/JiQSGWq5qmPhbAnJhzJukJlclfjf6WdpEKzLsOB60+p0mALDqxeS4W67cb/2GlQrVQTotrepFoLsiFsYCTVOof/cjWcyk0xIWZSFVV7KpqiJReo3Hz8W8UzalB9FQLMPRSlPkUXn1OchAV5/QW1uHAVtlkvqcWr17Bv7htqEY6/SxpFTabArn5vqcnTd7Dr/V5qshl/9WEvtfkIe4qfUpu3FuwJ8VGbT/jTLh81+gw7vmyhRjmrYMf4Mmq0G7+7VEadIr8isDb7qNUT2HDPoE5Gujf3kt/eB07QK2oWhoC+G9TrdBJ+VmtQt8K6VpcgGvUIoCGSur1p9OZe8u1V+JM9k/rNqBNOkHopQFMkvdDsN0FP6YUHV4UTpN5lPKcn9lmtLkEsa2l9CeIaj8JR9OVH9u5BV7IsDKDwHjueYGzbtm172rbdYdu2bdt29/u0ouafunX3qVo3WesRzhecbSDQeCDQyHFnPggLaPlOgc4DOkOEAmov0AVAp4k+FggJdO24jKMPgfK365eUAiICkEABEQFIoICIACRQQAQBEigmEggAFBMJNP1uAFBAJNAzAKCASCAAUEAkEAAoIBIIABQQCQQAiokEAgDFRAIBgGIigQBAMZFAAKCYSCAAUEwkEAAoJhIIABQQCQQAiokEAgDFRAIBgGIigQBAMZFAAKCYSCAAUEwkEAAoJhIIABQTCQQAiokEAgDlJroHCPTMbixQ5Yn+7wgEmg4FykkkEAAoJhIIABQTCQQAiokEAgDFRAIBgGKi8oF+WSZQDFQ8UQy0S6AAKA+RQACgmEggAFBMJBAAKCYSCAAUEi0ViAAUtLaeQFyggEggAlBAVOeAxqOB8hPVPaBGN1Wl+XmBAiKByqr98pQqTyQQAyggEogAFBAJRAAKiAQiAAVEAhGAAiKBCEABkUAIoIDoPYGgQHECCSSQQAIJJJBAAgkkkEACCSSQQAIJlKGbBWIDfbpFoNK6XyAiULzVUSCJBCqfSCCJBCqH6A6Blid0Hf8XKEkkUH4igWBEAkkkEJxIIDiRQHAigeBEAsGJQqArBao6UQg062mBiicSiE8kEJ9IID6RQHwigfhEAvGJBOITsYF+OwMkERdo3p8pSSQQn0ggPpFAcCKB4EQCwYkEghMJBCcSCE4kEJxIIDiRQHSiAQKxif4RiE0kEJxIIDiRQHAigeBEApGJBOITCQQnEghOJBCEaIZA8Fr0EYhPJBCfSCA+kUB8IoHQRCUC3Vp9IIn+KVVSoMoTCcQnEohOJBCcSCA40Ut1F8gEEkgggQQSSCATSCCBBOInkEACCfSsQGygxVckEwiQQAoJBCASSKIMQBIJJFEGIIkEkkigcokEkqi2QBIJJJFAcCKB4EQCoYkEAhAJBCASCEA0oxCgeaOSkR+wbvxnsmyNeDY70A/dk2Vs632Zgeb+nCxr497K6bN+T7LsrbsxG1DfFqmAbG/jTED7mqRCspZT78rgs396Kiz7bmatgQ58mQrMft54sFY+t/+UCs66f/NJ2T637Pk5FZ/V731jWT73fPhLssrU7tDBGvssfESfSvbVm4dfrQFP/24PJ6t0a4cvLI3n05kD/0xVyd5bc7jRTXFDrn1pSapiduTosV2TLqNTr9vxEy2TAVrywsBVI6/r/NTfZ2GePvjs4eaPPvKBczun2oNjAQAAAIBB/taz2FUBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJcA09LUTxlsWtoAAAAASUVORK5CYII=",Fe="postiz",pt="https://api.postiz.com",ui="https://platform.postiz.com/settings";function pi(t){if(!t||typeof t!="object")return!1;const s=t;return typeof s.state=="string"&&typeof s.address=="string"&&typeof s.host=="string"&&(s.how===null||s.how==="sign-in"||s.how==="key")}const ft=[{id:"whop",label:"Whop",url:"https://mcp.whop.com/mcp",icon:{image:di},description:"whop.description",notice:"whop.notice",keywords:"whop checkout memberships"},{id:"agentcard",label:"Agentcard",url:"https://mcp.agentcard.sh/mcp",icon:{glyph:Os},description:"agentcard.description",notice:"agentcard.notice",keywords:"agentcard agent card opencommerce shopping payments buy virtual debit card"},{id:"agentmail",label:"AgentMail",url:"https://mcp.agentmail.to/mcp",icon:{glyph:Bs},description:"agentmail.description",notice:"agentmail.notice",keywords:"agentmail email inbox mail address send reply"},{id:"vapi",label:"Vapi",url:"https://mcp.vapi.ai/mcp",key:{url:"https://dashboard.vapi.ai"},icon:{glyph:ya},description:"vapi.description",notice:"vapi.notice",keywords:"vapi phone call calls voice dial assistant"},{id:"telnyx",label:"Telnyx",url:"https://api.telnyx.com/v2/mcp",key:{url:"https://portal.telnyx.com/#/api-keys"},icon:{glyph:ja},description:"telnyx.description",notice:"telnyx.notice",keywords:"telnyx phone number numbers sms text call calls international"},{id:"agentphone",label:"AgentPhone",url:"https://mcp.agentphone.ai/mcp",icon:{glyph:pa},description:"agentphone.description",notice:"agentphone.notice",keywords:"agentphone phone number sms text call calls"},{id:"bubblav",label:"BubblaV",url:"https://www.bubblav.com/mcp",icon:{image:li},description:"bubblav.description",notice:"bubblav.notice",keywords:"bubblav chatbot chat widget website customer support service knowledge base conversations leads analytics"}];function gn(t){if(t.type!=="http"||!t.url)return;let s;try{s=new URL(t.url)}catch{return}if(!(s.search||s.hash||s.username||s.password))return ft.find(o=>{const c=new URL(o.url);return s.origin===c.origin&&(s.pathname===c.pathname||s.pathname===`${c.pathname}/`)})}function Vn(t,s){const o=new Set(s.map(r=>r.name));let c=t.id;for(let r=2;o.has(c);r++)c=`${t.id}-${r}`;return c}const gs="Authorization";function mi(t){const s=o=>o.headerKeys?.some(c=>c.toLowerCase()===gs.toLowerCase())===!0;return Object.fromEntries(ft.map(o=>[o.id,t.some(c=>gn(c)===o&&c.enabled&&("key"in o?s(c):c.auth==="signed-in"))]))}function cn(t){return t.url===void 0||!(gn(t)||t.name===Fe)}function bs(t){return t.enabled&&t.auth!=="needs-sign-in"}const ys=128;function hi(t,s=ys){return t>=s?"exceeds":t*2>=s?"crowds":"fits"}const fi=1500;async function Et(t,s,o){try{return await s(`/api/mcp/servers/${encodeURIComponent(t)}/test`,{method:"POST",signal:o})}catch(c){if(o?.aborted)throw c;return{ok:!1,error:c instanceof Error?c.message:String(c),reason:"unreachable"}}}async function Gn(t,s,o,c,r="hostedMcp.testFailed"){const l=await Et(t,s,o);if(l.ok)return l;const b=(l.error??"").trim();return{...l,error:n(r,{service:c,reason:b&&!/[.!?]$/.test(b)?`${b}.`:b})}}function qn(t,s){if(s.reason!=="keys"||!pe(t))return s.error??"";const o=s.status?`HTTP ${s.status}`:n("mcp.check.unauthorized");return t.headerKeys.length?n("mcp.check.keysRefused",{reason:o,names:new Intl.ListFormat(Mt(),{style:"long",type:"conjunction"}).format(t.headerKeys)}):n("mcp.check.keysNeeded",{reason:o})}function xi(t){const s=Math.max(t.total??0,t.tools?.length??0);if(!s)return n("mcp.check.connectedNone");const o=s===1?n("mcp.check.connectedOne"):n("mcp.check.connectedMany",{count:s}),c=hi(s);return c==="fits"?o:`${o}. ${n(c==="exceeds"?"mcp.check.overLimit":"mcp.check.crowdsLimit",{count:s,limit:ys})}`}function Zn({embedded:t=!1,hostedCards:s,hideHosted:o=!1,refreshKey:c=0}={}){const{state:r,dispatch:l}=et(),b=a=>r.bots?.find(u=>u.id===a)?.name??a,x=r.config?.managedPolicy,y=!!(x&&!x.mcp.allowCustom),[p,m]=d.useState(null),[N,H]=d.useState(null),[A,M]=d.useState(null),[J,D]=d.useState(null),[_,F]=d.useState(null),[L,de]=d.useState({}),[v,V]=d.useState(null),W=d.useRef(null),he=d.useRef(null),[ee,te]=d.useState(null),[ke,Y]=d.useState(""),[g,f]=d.useState(null),[S,E]=d.useState(!1),[U,P]=d.useState(!1),ie=d.useRef({}),[Be,Pe]=d.useState(null),[Me,Ne]=d.useState(null),[Ee,Le]=d.useState({}),ne=d.useRef(0),Z=d.useRef(!0),fe=a=>pe(a)?gn(a):void 0,G=d.useMemo(()=>p&&mi(p),[p]),je=s?.onConnections;d.useEffect(()=>{G&&je?.(G)},[G,je]);const Ue=s?.onServers;d.useEffect(()=>{p&&Ue?.(p)},[p,Ue]);const ce=a=>(m(a??[]),qt(a??[]),a??[]),ve=a=>de(u=>{const h={...u};return delete h[a],h}),Ae=d.useCallback(()=>{const a=++ne.current;return M("load"),D(null),w("/api/mcp/servers").then(u=>{a===ne.current&&(m(u.servers??[]),qt(u.servers??[]))}).catch(u=>{a===ne.current&&D(u instanceof Error?u.message:String(u))}).finally(()=>{a===ne.current&&M(null)})},[]);d.useEffect(()=>(Z.current=!0,Ae(),()=>{Z.current=!1,ne.current+=1}),[Ae,c]);const C=d.useRef(null);C.current=A,d.useEffect(()=>{const a=()=>{if(C.current!==null)return;const u=ne.current;w("/api/mcp/servers").then(h=>{!Z.current||C.current!==null||u!==ne.current||(m(h.servers??[]),qt(h.servers??[]))}).catch(()=>{})};return Ps({onFrame:u=>{u.kind==="mcp.changed"&&a()},onMissedFrames:a})},[]);const T=()=>{H(null),P(!1)},re=(a,u=!1)=>{H(a),P(u),D(null),F(null)},se=async(a,u=!1)=>{M(`test:${a}`),Pe(a),ne.current+=1,ve(a);let h=await Et(a,w);if(h.ok)try{ce((await w(`/api/mcp/servers/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})).servers),ie.current[a]=Date.now()}catch(k){h={ok:!1,error:k instanceof Error?k.message:String(k)}}return u&&(h={...h,saved:!0}),Z.current&&(de(k=>({...k,[a]:h})),M(null),Pe(null)),h},be=async a=>{M("save"),ne.current+=1,D(null),F(null);const u=[];let h=p??[];try{for(const k of a){const $=k.ownKey?{...k.body,headers:Object.fromEntries(Object.keys(k.body.headers??{}).map(z=>[z,""]))}:k.body;h=ce((await w("/api/mcp/servers",{method:"POST",body:JSON.stringify({name:k.name,...$})})).servers),k.ownKey&&(await w("/api/team/connection-scopes",{method:"PUT",body:JSON.stringify({kind:"mcp",id:k.name,scope:"person"})}),await w(`/api/team/my-connections/mcp/${encodeURIComponent(k.name)}/key`,{method:"PUT",body:JSON.stringify({value:k.ownKey,url:$.url})}),h=ce((await w(`/api/mcp/servers/${encodeURIComponent(k.name)}`,{method:"PUT",body:JSON.stringify({...$,enabled:!1})})).servers)),u.push(k.name)}}catch(k){D(k instanceof Error?k.message:String(k))}M(null),u.length&&T();for(const k of u){const $=await se(k,!0),z=h.find(X=>X.name===k);$.auth==="required"&&z&&u.length===1&&Z.current&&await oe(z)}},ue=async([a])=>{const u=p?.find(h=>h.name===N);if(!(!a||!u)){M("save"),ne.current+=1,D(null),F(null);try{let h=a.body,k;if(r.config?.team&&u.scope!=="team"&&typeof h.url=="string"&&!h.oauth&&(await w("/api/team/my-connections")).mcp.some(z=>z.name===a.name)){const z=h.headers??{};if(Object.keys(z).length>1)throw new Error(n("mcp.personal.oneHeader"));const X=Object.values(z)[0];k=typeof X=="string"?X:void 0,h={...h,headers:Object.fromEntries(Object.keys(z).map(R=>[R,""]))}}ce((await w(`/api/mcp/servers/${encodeURIComponent(a.name)}`,{method:"PUT",body:JSON.stringify({...h,enabled:u.enabled})})).servers),k&&await w(`/api/team/my-connections/mcp/${encodeURIComponent(a.name)}/key`,{method:"PUT",body:JSON.stringify({value:k,url:h.url})}),T()}catch(h){D(h instanceof Error?h.message:String(h)),M(null);return}M(null),u.runsOn||await se(a.name,!0)}},ye=async a=>{if(a.enabled&&Date.now()-(ie.current[a.name]??0)<fi){F({key:"mcp.switchedOnByTest",params:{name:a.name}});return}M(`toggle:${a.name}`),ne.current+=1,D(null);try{ce((await w(`/api/mcp/servers/${a.name}`,{method:"PATCH",body:JSON.stringify({enabled:!a.enabled})})).servers),F({key:"mcp.toggled",params:{name:a.name},stateKey:a.enabled?"mcp.state.off":"mcp.state.on"})}catch(u){D(u instanceof Error?u.message:String(u))}finally{M(null)}},tt=async a=>{M(`test:${a.name}`),ne.current+=1,D(null),ve(a.name);const u=await Et(a.name,w);de(h=>({...h,[a.name]:u})),M(null)};async function oe(a){const u=zt(),h=new AbortController;W.current=h,V(a.name),te(null),Y(""),f(null),D(null),Ne(null),F(null),ve(a.name);const k=fe(a);try{const $=async X=>{!await u.open(X)&&Z.current&&!h.signal.aborted&&f(n("connectors.card.popupBlocked"))},z=await is(a.name,{api:w,open:$,signal:h.signal,onStarted:(X,R)=>{te(X),he.current=R}});if(!Z.current||h.signal.aborted)return;if(z.phase==="succeeded"){te({...z,flowId:null,authorizationUrl:null});const X=k?await Gn(a.name,w,h.signal,k.label):await Et(a.name,w,h.signal);if(h.signal.aborted||!Z.current||(de(ze=>({...ze,[a.name]:X})),!X.ok))return;const R=await w(`/api/mcp/servers/${a.name}`,{method:"PATCH",body:JSON.stringify({enabled:!0})});if(!Z.current)return;ce(R.servers),k&&F({key:"hostedMcp.connected",params:{service:k.label}})}else z.phase!=="cancelled"&&de(X=>({...X,[a.name]:{ok:!1,error:z.message||n("mcp.auth.failed")}}))}catch($){Z.current&&!h.signal.aborted&&de(z=>({...z,[a.name]:{ok:!1,error:$ instanceof Error?$.message:String($)}}))}finally{u.cancel(),W.current===h&&(W.current=null,he.current=null,E(!1),V(null),te(null),Y(""),f(null),Z.current&&Ae())}}const nt=async a=>{if(!p||A!==null||v!==null)return;const u=p.find(k=>fe(k)===a);if("key"in a){await bt(a,u);return}if(u){await oe(u);return}M(`hosted:${a.id}`),ne.current+=1,D(null),Ne(null),F(null);let h;try{const k=Vn(a,p),$=await w("/api/mcp/servers",{method:"POST",body:JSON.stringify({name:k,type:"http",url:a.url,enabled:!1})});if(!Z.current)return;if(h=ce($.servers).find(z=>z.name===k&&fe(z)===a),!h)throw new Error(n("hostedMcp.setupFailed",{service:a.label}))}catch(k){Z.current&&Ne({id:a.id,message:k instanceof Error?k.message:String(k)})}finally{Z.current&&M(null)}h&&Z.current&&await oe(h)},bt=async(a,u)=>{const h=Ee[a.id]?.trim();if(!p||!h)return;M(`hosted:${a.id}`),ne.current+=1,D(null),Ne(null),F(null);const k=u?.name??Vn(a,p);ve(k);try{const $={type:"http",url:a.url,headers:{[gs]:`Bearer ${h}`},enabled:!1};ce((await w(u?`/api/mcp/servers/${k}`:"/api/mcp/servers",{method:u?"PUT":"POST",body:JSON.stringify(u?$:{name:k,...$})})).servers);const z=await Gn(k,w,void 0,a.label,"hostedMcp.keyTestFailed");if(!Z.current||(de(X=>({...X,[k]:z.reason==="keys"?{...z,error:n("hostedMcp.keyRefused",{service:a.label})}:z})),!z.ok))return;ce((await w(`/api/mcp/servers/${k}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})).servers),Le(X=>({...X,[a.id]:""})),F({key:"hostedMcp.connected",params:{service:a.label}})}catch($){Z.current&&Ne({id:a.id,message:$ instanceof Error?$.message:String($)})}finally{Z.current&&M(null)}},st=async()=>{if(!v||!ee?.flowId||S)return;const a=W.current;E(!0),f(null);try{const u=await os(v,ee.flowId,ke,w);W.current===a&&he.current?.(u)}catch(u){W.current===a&&f(u instanceof Error?u.message:String(u))}finally{W.current===a&&E(!1)}},at=async(a,u)=>{M(`signout:${a.name}`),ne.current+=1,D(null),Ne(null),F(null),ve(a.name);try{if(u&&"key"in u){ce((await w(`/api/mcp/servers/${a.name}`,{method:"DELETE"})).servers);return}fe(a)&&ce((await w(`/api/mcp/servers/${a.name}`,{method:"PATCH",body:JSON.stringify({enabled:!1})})).servers),ce((await w(`/api/mcp/servers/${a.name}/sign-out`,{method:"POST"})).servers)}catch(h){const k=h instanceof Error?h.message:String(h);u?Ne({id:u.id,message:k}):D(k)}finally{M(null)}};d.useEffect(()=>()=>W.current?.abort(),[]);const Ke=async a=>{if(window.confirm(n("mcp.removeConfirm",{name:a.name}))){M(`delete:${a.name}`),ne.current+=1,D(null);try{ce((await w(`/api/mcp/servers/${a.name}`,{method:"DELETE"})).servers),ve(a.name),N===a.name&&T()}catch(u){D(u instanceof Error?u.message:String(u))}finally{M(null)}}},xe=N&&N!=="new"?p?.find(a=>a.name===N):void 0;function $e(a){return e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"mt-3 block",htmlFor:`mcp-callback-${a.name}`,children:n("mcp.auth.callbackUrl")}),e.jsx("input",{id:`mcp-callback-${a.name}`,type:"text",value:ke,disabled:S,onChange:u=>Y(u.target.value),autoComplete:"off",spellCheck:!1,placeholder:"http://127.0.0.1:…/mcp-oauth/callback?…",className:"mt-1 w-full rounded-lg border border-hairline bg-inset px-3 py-2 text-ink outline-none focus:border-accent"}),e.jsxs("button",{type:"button",disabled:!ke.trim()||S,"aria-busy":S,onClick:()=>{st()},className:"mt-2 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 font-medium text-white disabled:opacity-40",children:[S&&e.jsx(ae,{size:14,className:"animate-spin","aria-hidden":"true"}),n(S?"mcp.auth.completing":"mcp.auth.complete")]})]})}function it(a){const u=fe(a);return v===a.name&&e.jsxs("div",{className:"mt-3 space-y-3 rounded-lg bg-raised px-3 py-3 text-[12px] text-ink-secondary",children:[e.jsxs("div",{role:"status",className:"flex items-center gap-2",children:[e.jsx(ae,{size:13,className:"animate-spin"})," ",ee?.phase!=="succeeded"?n("mcp.auth.waiting"):u?n("hostedMcp.loadingTools",{service:u.label}):n("mcp.auth.loadingTools")]}),ee?.authorizationUrl&&It(ee.authorizationUrl)&&e.jsx("button",{type:"button",onClick:()=>{f(null),Xt(ee.authorizationUrl).catch(()=>f(n("mcp.auth.openFailed")))},className:"text-accent hover:underline",children:n("mcp.auth.openAgain")}),ee?.flowId&&(ee.pasteBack?e.jsxs("div",{children:[e.jsx("p",{className:"leading-relaxed text-ink",children:n("mcp.auth.pasteBackHint")}),$e(a)]}):e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium text-ink",children:n("mcp.auth.otherComputer")}),e.jsx("p",{className:"mt-2 leading-relaxed",children:n("mcp.auth.otherComputerHint")}),$e(a)]})),g&&e.jsx("p",{role:"alert",className:"text-danger",children:g})]})}function Lt(a){const u=p?.find(R=>fe(R)===a),h=!!G?.[a.id],k=u&&L[u.name],$=J||(Me?.id===a.id?Me.message:null)||(k&&!k.ok?k.error:null),z=A!==null||v!==null,X=A===`hosted:${a.id}`||u!==void 0&&(v===u.name||A===`signout:${u.name}`);return e.jsxs("div",{"data-app-tile":a.id,className:"flex min-w-0 flex-col rounded-xl px-2 py-2 transition-colors hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Un,{app:a}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold leading-5 text-ink",children:a.label}),h&&e.jsx(Ye,{size:13,strokeWidth:2.5,className:"shrink-0 text-success","aria-label":n("apps.connected")})]}),e.jsx("p",{className:"truncate text-[13px] leading-[18px] text-ink-secondary",title:n(a.description),children:n(a.description)})]}),u&&v===u.name?e.jsx("button",{type:"button",onClick:()=>W.current?.abort(),className:"inline-flex h-7 shrink-0 items-center rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink",children:n("mcp.auth.cancel")}):e.jsx("button",{type:"button","aria-label":n(h?"hostedMcp.disconnect":"hostedMcp.connect",{service:a.label}),disabled:z||p!==null&&!h&&(!!u?.managedBy||y&&!x?.mcp.allowlist.length||"key"in a&&!Ee[a.id]?.trim()),onClick:()=>{p===null?Ae():h&&u?at(u,a):nt(a)},className:"inline-flex h-7 min-w-[64px] shrink-0 items-center justify-center gap-2 rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink hover:bg-raised-hover disabled:opacity-40",children:z&&(X||A==="load")?e.jsx(ae,{size:14,className:"animate-spin"}):p===null?n("connectors.action.retry"):n(h?"connectors.disconnect":"connectors.action.connect")})]}),e.jsxs("div",{className:"ps-[52px]",children:["key"in a&&!h&&p!==null&&e.jsxs("div",{className:"mt-2 flex flex-col items-start gap-2",children:[e.jsx("input",{type:"password",value:Ee[a.id]??"",disabled:z,autoComplete:"off",spellCheck:!1,"aria-label":n("hostedMcp.keyLabel",{service:a.label}),placeholder:n("hostedMcp.keyPlaceholder",{service:a.label}),onChange:R=>{const ze=R.target.value;Le(ot=>({...ot,[a.id]:ze}))},onKeyDown:R=>{R.key==="Enter"&&nt(a)},className:"h-8 w-full min-w-0 rounded-lg bg-inset px-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none focus:ring-1 focus:ring-accent/50"}),e.jsxs("button",{type:"button",onClick:()=>{Xt(a.key.url)},className:"inline-flex items-center gap-1 text-[12px] font-medium text-accent-text hover:underline",children:[n("hostedMcp.getKey",{service:a.label}),e.jsx(pn,{size:11,"aria-hidden":"true"})]})]}),$&&e.jsx("p",{role:"alert",className:"mt-1.5 text-[12px] text-danger",children:typeof $=="string"?$:n($.key,$.params)}),u&&it(u),e.jsxs("details",{className:"mt-1 text-[12px] text-ink-secondary",children:[e.jsx("summary",{className:"cursor-pointer",children:n("hostedMcp.access")}),e.jsx("p",{className:"mt-2 leading-relaxed",children:n(a.notice)}),e.jsx("p",{className:"mt-2 leading-relaxed",children:n("hostedMcp.accessHint")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(r.bots??[]).filter(R=>!R.hidden).map(R=>e.jsx("button",{type:"button",onClick:()=>{l({type:"togglePlugins",open:!1}),en(l,"access",{botId:R.id,page:"mcp"})},className:"rounded-lg bg-control px-2.5 py-1.5 text-ink hover:bg-raised-hover",children:n("hostedMcp.botSettings",{name:R.name})},R.id))})]})]})]})}function Ce(a,u){const h=pe(a)&&a.auth==="needs-sign-in",k=L[a.name],$=k&&!k.ok&&!k.auth?n("mcp.check.failed",{reason:qn(a,k)}):null,z=h?n("mcp.auth.needsSignIn"):a.offFor?.length?n("mcp.offFor",{bots:a.offFor.map(b).join(", ")}):pe(a)?a.url:[a.command,...a.args].join(" ");return e.jsxs("div",{"data-app-tile":a.name,"data-mcp-tile":"",className:"flex min-w-0 flex-col rounded-xl px-2 py-2 transition-colors hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-[8px] bg-raised text-ink-secondary",children:pe(a)?e.jsx(zn,{size:19}):e.jsx(Zt,{size:19})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold leading-5 text-ink",children:a.name}),bs(a)&&e.jsx(Ye,{size:13,strokeWidth:2.5,className:"shrink-0 text-success","aria-label":n("apps.connected")})]}),e.jsx("p",{className:q("truncate text-[13px] leading-[18px]",h?"text-warning":"text-ink-secondary"),title:z,children:z})]}),v===a.name?e.jsx("button",{type:"button",onClick:()=>W.current?.abort(),className:"inline-flex h-7 shrink-0 items-center rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink",children:n("mcp.auth.cancel")}):e.jsx("button",{type:"button",disabled:h&&(A!==null||v!==null||!!a.managedBy),onClick:()=>{h?oe(a):u()},className:"inline-flex h-7 min-w-[64px] shrink-0 items-center justify-center rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink hover:bg-raised-hover disabled:opacity-40",children:n(h?"mcp.auth.signIn":"apps.mcp.manage")})]}),e.jsxs("div",{className:"ps-[52px]",children:[$&&e.jsx("p",{role:"alert",className:"mt-1.5 text-[12px] text-danger",children:$}),it(a)]})]},a.name)}if(s){const a=s.ownServers;return e.jsxs(e.Fragment,{children:[ft.map(u=>e.jsx("div",{className:s.shown(u.id)?"contents":"hidden",children:Lt(u)},u.id)),a&&p?.filter(u=>u.enabled&&cn(u)&&a.shown(u)).map(u=>Ce(u,a.manage))]})}const De=p?.filter(a=>!o||cn(a));return e.jsx("section",{"data-mcp-servers":!0,"aria-labelledby":"mcp-servers-title",className:t?"":"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:e.jsxs("div",{className:t?"":"mx-auto max-w-[840px]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-[1_1_280px]",children:[e.jsx("h3",{id:"mcp-servers-title",className:"text-[15px] font-semibold text-ink",children:n("mcp.title")}),e.jsx("p",{className:"mt-1 max-w-[610px] break-words text-[13px] leading-relaxed text-ink-secondary",children:n("mcp.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{Ae()},disabled:A!==null,className:"rounded-lg p-2 text-ink-secondary transition-colors hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":n("mcp.refreshAria"),children:e.jsx(tn,{size:16,className:q(A==="load"&&"animate-spin")})}),e.jsxs("button",{type:"button",disabled:A!==null||y&&!x?.mcp.allowlist.length,title:y&&x?n("policy.managedBy",{organization:x.organizationName}):void 0,onClick:()=>re("new"),className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[e.jsx(us,{size:14})," ",n(t?"apps.mcp.add":"mcp.addServer")]})]})]}),y&&x&&e.jsx("p",{role:"status",className:"mt-3 text-[13px] leading-relaxed text-ink-secondary",children:n("policy.mcpRestricted",{organization:x.organizationName})}),(N==="new"||xe)&&e.jsx(ri,{server:xe,fixKeys:U,taken:(p??[]).map(a=>a.name),team:!!r.config?.team,busy:A!==null,onCancel:T,onSubmit:a=>{N==="new"?be(a):ue(a)}},`${N}${U?":keys":""}`),J&&e.jsx("div",{role:"alert",className:"mt-3 rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger",children:typeof J=="string"?J:n(J.key,J.params)}),_&&e.jsx("div",{role:"status",className:"mt-3 rounded-lg bg-success/10 px-3 py-2 text-[12px] text-success",children:n(_.key,{..._.params,..._.stateKey?{state:n(_.stateKey)}:{}})}),e.jsx(Ia,{}),e.jsx("div",{className:"mt-4 rounded-xl border border-hairline/50 bg-raised/35 px-4 py-3 text-[12px] leading-relaxed text-ink-secondary",children:n("mcp.trustNotice")}),p===null?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(ae,{size:14,className:"animate-spin"})," ",n("mcp.loading")]}):De?.length===0&&!N?e.jsxs("div",{className:"mt-5 flex min-h-32 flex-col items-center justify-center rounded-2xl border border-dashed border-hairline/60 text-center",children:[e.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(Zt,{size:21})}),e.jsx("div",{className:"mt-3 text-[14px] font-medium text-ink",children:n("mcp.empty.title")}),e.jsx("div",{className:"mt-1 max-w-sm text-[13px] text-ink-secondary",children:n("mcp.empty.desc")})]}):e.jsx("div",{className:"mt-5 space-y-3",children:De?.map(a=>{const u=fe(a),h=L[a.name],k=pe(a)?a.auth:void 0,$=pe(a)&&!a.runsOn&&(k==="needs-sign-in"||h?.auth==="required"||(!!u||!!a.oauth)&&k!=="signed-in");return e.jsxs("div",{"data-hosted-server":u?.id,className:"rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[e.jsxs("div",{"data-mcp-row":!0,className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:q("flex size-10 shrink-0 items-center justify-center rounded-xl",a.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:u?e.jsx(Un,{app:u}):pe(a)?e.jsx(zn,{size:19}):e.jsx(Zt,{size:19})}),e.jsxs("div",{className:"min-w-0 flex-[1_1_220px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-[14px] font-medium text-ink",children:u?u.label:a.name}),e.jsx("span",{className:q("rounded-full px-2 py-0.5 text-[11px]",a.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:n(a.enabled?"mcp.badge.on":"mcp.badge.off")}),k&&e.jsx("span",{className:q("rounded-full px-2 py-0.5 text-[11px]",k==="signed-in"?"bg-success/10 text-success":"bg-warning/10 text-warning"),children:n(k==="signed-in"?"mcp.auth.signedIn":"mcp.auth.needsSignIn")}),a.managedBy&&e.jsx("span",{className:"rounded-full bg-raised px-2 py-0.5 text-[11px] text-ink-secondary",children:n("policy.managedBy",{organization:a.managedBy})})]}),a.managedBy&&e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:n("policy.mcpBlocked",{organization:a.managedBy})}),a.runsOn&&e.jsx("div",{"data-mcp-runs-on":!0,className:"mt-1 text-[12px] text-ink-secondary",children:n("mcp.runsOn",{computer:a.runsOn.label})}),a.bot&&e.jsx("div",{"data-mcp-own-bot":!0,className:"mt-1 text-[12px] text-ink-secondary",children:n("mcp.ownBot",{bot:b(a.bot)})}),a.offFor?.length?e.jsx("div",{"data-mcp-off-for":!0,className:"mt-1 text-[12px] text-ink-secondary",children:n("mcp.offFor",{bots:a.offFor.map(b).join(", ")})}):null,a.keyOff&&e.jsx("div",{"data-mcp-key-off":!0,className:"mt-1 text-[12px] text-warning",children:n("mcp.keyOff")}),e.jsx("div",{className:"mt-1 truncate font-mono text-[12px] text-ink-secondary",children:pe(a)?a.url:[a.command,...a.args].join(" ")}),pe(a)?a.headerKeys.length>0&&e.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:n("mcp.headersSaved",{keys:a.headerKeys.join(", ")})}):a.envKeys.length>0&&e.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:n("mcp.secretsSaved",{keys:a.envKeys.join(", ")})}),pe(a)&&a.oauth&&e.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:n(a.oauth.clientSecretConfigured?"mcp.oauth.savedWithSecret":"mcp.oauth.saved",{clientId:a.oauth.clientId})})]}),e.jsxs("div",{"data-mcp-row-actions":!0,className:"ml-auto flex flex-wrap items-center justify-end gap-1",children:[v===a.name?e.jsxs("button",{type:"button",onClick:()=>W.current?.abort(),className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(ae,{size:14,className:"animate-spin"})," ",n("mcp.auth.cancel")]}):$?e.jsxs("button",{type:"button",disabled:A!==null||v!==null||!!a.managedBy,onClick:()=>{oe(a)},className:"flex items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[e.jsx(Ms,{size:14})," ",u?n("hostedMcp.connect",{service:u.label}):n("mcp.auth.signIn")]}):k==="signed-in"?e.jsxs("button",{type:"button",disabled:A!==null||v!==null,onClick:()=>{at(a)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[A===`signout:${a.name}`?e.jsx(ae,{size:14,className:"animate-spin"}):e.jsx(ma,{size:14})," ",u?n("hostedMcp.disconnect",{service:u.label}):n("mcp.auth.signOut")]}):null,e.jsxs("button",{type:"button",disabled:A!==null||v!==null,onClick:()=>{tt(a)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[A===`test:${a.name}`?e.jsx(ae,{size:14,className:"animate-spin"}):e.jsx(Ls,{size:14})," ",n("mcp.test")]}),e.jsx("button",{type:"button",disabled:A!==null||v!==null,onClick:()=>re(a.name),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":n("mcp.editAria",{name:a.name}),children:e.jsx(Us,{size:14})}),e.jsx("button",{type:"button",disabled:A!==null||v!==null,onClick:()=>{Ke(a)},className:"rounded-lg p-2 text-ink-secondary hover:bg-danger/10 hover:text-danger disabled:opacity-40","aria-label":n("mcp.removeAria",{name:a.name}),children:e.jsx($s,{size:14})}),e.jsxs("span",{className:"ml-1 flex items-center",children:[A===`toggle:${a.name}`&&e.jsx(ae,{size:13,className:"mr-1.5 animate-spin text-ink-secondary"}),e.jsx(un,{checked:a.enabled,disabled:A!==null||v!==null,onClick:()=>{ye(a)},"aria-label":n("mcp.toggleAria",{name:a.name,state:n(a.enabled?"mcp.state.off":"mcp.state.on")}),className:"disabled:opacity-40"})]})]})]}),u&&e.jsxs("div",{className:"mt-3 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx("p",{children:n(u.notice)}),e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"cursor-pointer font-medium text-ink",children:n("hostedMcp.access")}),e.jsx("p",{className:"mt-2",children:n("hostedMcp.accessHint")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(r.bots??[]).filter(z=>!z.hidden).map(z=>e.jsx("button",{type:"button",onClick:()=>{l({type:"togglePlugins",open:!1}),en(l,"access",{botId:z.id,page:"mcp"})},className:"rounded-lg bg-control px-2.5 py-1.5 text-ink hover:bg-raised-hover",children:n("hostedMcp.botSettings",{name:z.name})},z.id))})]})]}),e.jsx(za,{server:a,disabled:A!==null||v!==null,onSaved:z=>{ne.current+=1,ce(z)}}),it(a),Be===a.name&&!a.enabled&&!h&&e.jsxs("div",{role:"status","data-mcp-testing":!0,className:"mt-3 flex items-center gap-2 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink-secondary",children:[e.jsx(ae,{size:13,className:"animate-spin","aria-hidden":"true"})," ",n("mcp.check.testingOff")]}),h&&v!==a.name&&e.jsx("div",{role:"status",className:q("mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg px-3 py-2 text-[12px]",h.ok?"bg-success/10 text-success":h.auth==="required"?"bg-warning/10 text-warning":"bg-danger/10 text-danger"),children:h.auth==="required"?n("mcp.auth.required"):h.ok?e.jsxs("span",{className:"flex items-start gap-2",children:[e.jsx(Fs,{size:14,className:"mt-px shrink-0"})," ",xi(h)]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"min-w-0 flex-1",children:n(a.enabled?"mcp.check.failed":h.saved?"mcp.check.savedOff":"mcp.check.failedOff",{reason:qn(a,h)})}),h.reason==="keys"&&pe(a)||h.reason==="unreachable"||h.reason==="timeout"?e.jsx("button",{type:"button",disabled:A!==null||v!==null,onClick:()=>h.reason==="keys"?re(a.name,!0):void se(a.name),className:"shrink-0 rounded-lg bg-card px-2.5 py-1.5 font-medium text-ink hover:bg-raised-hover disabled:opacity-40",children:n(h.reason==="keys"?"mcp.check.fixKeys":"mcp.check.tryAgain")}):null]})})]},a.name)})})]})})}const qe="/api/postiz",gi="postiz social media posts schedule linkedin instagram facebook tiktok threads bluesky",bi={categories:["Social"]};function xt(t){try{return new URL(t.trim()).host}catch{return t.trim()}}function rn(t,s){const o=t?.body,c=typeof o?.code=="string"?o.code:null,r=xt(s);return c==="key_rejected"?n("postiz.error.keyRejected"):c==="unreachable"?n("postiz.error.unreachable",{host:r}):c==="not_postiz"?n("postiz.error.notPostiz",{host:r}):c==="address"?n("postiz.error.address"):c==="taken"?n("postiz.taken"):typeof o?.error=="string"&&o.error?o.error:t instanceof Error?t.message:String(t)}function yi(t,s){const o=t instanceof Error?t.message:"";return/didn't accept this API key/u.test(o)||t?.name==="KeyRejected"?n("postiz.error.keyRejected"):/Couldn't reach a Postiz server/u.test(o)?n("postiz.error.unreachable",{host:xt(s)}):/didn't answer like Postiz/u.test(o)?n("postiz.error.notPostiz",{host:xt(s)}):rn(t,s)}const Ze="inline-flex h-7 min-w-[64px] shrink-0 items-center justify-center gap-2 rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink transition-colors hover:bg-raised-hover disabled:opacity-40",Wt="h-8 w-full min-w-0 rounded-lg bg-inset px-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none focus:ring-1 focus:ring-accent/50",Wn="text-[12px] text-accent-text underline underline-offset-2",We=encodeURIComponent(Fe),ki=1500,ji=5*6e4;function vi(){return e.jsxs("svg",{viewBox:"0 0 40 40",className:"size-10 shrink-0 rounded-[8px]","aria-hidden":"true",children:[e.jsx("rect",{width:"40",height:"40",rx:"10",fill:"#612bd3"}),e.jsx("path",{d:"M14 29V11h7.2c4.1 0 6.8 2.3 6.8 5.9s-2.7 5.9-6.8 5.9h-3.1V29zm4.1-9.7h2.8c1.9 0 3-0.9 3-2.4s-1.1-2.4-3-2.4h-2.8z",fill:"#fff",fillRule:"evenodd"})]})}function wi({refreshKey:t=0,onConnection:s}){const{state:o,dispatch:c}=et(),[r,l]=d.useState(null),[b,x]=d.useState(!1),[y,p]=d.useState(!1),[m,N]=d.useState(null),[H,A]=d.useState(null),[M,J]=d.useState(!1),[D,_]=d.useState(""),[F,L]=d.useState(null),[de,v]=d.useState(!1),[V,W]=d.useState(""),[he,ee]=d.useState(""),[te,ke]=d.useState(!1),[Y,g]=d.useState(null),f=d.useRef(!0),S=d.useRef(null),E=d.useCallback(async()=>{const T=(await w("/api/team/my-connections").catch(()=>null))?.mcp?.find(re=>re.name===Fe);return T?{connected:T.connected,how:T.how}:{connected:!1,how:null}},[]),U=d.useCallback(async(C=!1)=>{try{const T=await w(C?`${qe}/check`:qe,C?{method:"POST"}:void 0);if(!f.current)return null;if(!pi(T))throw new Error("unexpected Postiz status");return l(T),p(!1),T.team&&T.scope==="person"&&g(await E()),T}catch(T){return f.current&&(T.status===403?x(!0):p(!0)),null}},[E]);d.useEffect(()=>(f.current=!0,U().then(C=>{C?.state==="connected"&&C.scope==="team"&&U(!0)}),()=>{f.current=!1,S.current?.controller.abort(),S.current=null}),[U,t]);const P=r?.team===!0&&r.scope==="person",ie=P?Y?.connected===!0:r?.state==="connected";d.useEffect(()=>{s?.(r?ie:null)},[r,ie,s]);const Be=C=>c({type:"configStatus",config:C}),Pe=async()=>{await w("/api/team/connection-scopes",{method:"PUT",body:JSON.stringify({kind:"mcp",id:Fe,scope:"person"})}),await w(`/api/mcp/servers/${We}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})},Me=async(C,T)=>{const re=await w(`/api/team/my-connections/mcp/${We}/sign-in`,{method:"POST"}),se=It(re.auth.authorizationUrl);if(!se)throw new Error(n("mcp.auth.failed"));A({...re.auth,flowId:null,pasteBack:!1}),!await T(se)&&f.current&&L(n("connectors.popupBlockedContinue"));const be=Date.now()+ji;for(;!C.signal.aborted&&Date.now()<be;)if(await new Promise(ye=>setTimeout(ye,ki)),(await E())?.connected)return;if(!C.signal.aborted)throw new Error(n("postiz.signInExpired"))},Ne=async()=>{if(m||S.current)return;const C=zt(),T=new AbortController;S.current={controller:T},N("sign-in"),L(null),_("");const re=async se=>{const be=await C.open(se);return C.cancel(),be};try{if(await w(`${qe}/sign-in`,{method:"POST"}),te||P){te&&!P&&await Pe(),await Me(T,re);return}const se=await is(Fe,{api:w,signal:T.signal,open:async ue=>{!await re(ue)&&f.current&&!T.signal.aborted&&L(n("connectors.popupBlockedContinue"))},onStarted:(ue,ye)=>{S.current?.controller===T&&(S.current.complete=ye),f.current&&A(ue)}});if(T.signal.aborted||!f.current)return;if(se.phase!=="succeeded"){se.phase!=="cancelled"&&L(se.message||n("mcp.auth.failed"));return}J(!0);const be=await w(`/api/mcp/servers/${We}/test`,{method:"POST",signal:T.signal});if(!be.ok){const ue=(be.error??"").trim();L(n("postiz.error.testFailed",{reason:ue&&!/[.!?]$/u.test(ue)?`${ue}.`:ue}));return}await w(`/api/mcp/servers/${We}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})}catch(se){f.current&&!T.signal.aborted&&L(rn(se,pt))}finally{C.cancel(),S.current?.controller===T&&(S.current=null),f.current&&(A(null),J(!1),N(null),await U())}},Ee=async()=>{const C=S.current;if(!(!C||!H?.flowId||!D.trim()))try{C.complete?.(await os(Fe,H.flowId,D,w))}catch(T){f.current&&L(T instanceof Error?T.message:String(T))}},Le=async()=>{const C=Ks(V),T=P||te?"":he.trim();if(!m){if(!rs(C))return L(n("keys.notAKey"));N("key"),L(null);try{if(await w(`${qe}/key-check`,{method:"POST",body:JSON.stringify({key:C,...T?{address:T}:{}})}),te||P){await w(`${qe}/sign-in`,{method:"POST"}),P||await Pe();const se=(await w("/api/mcp/servers")).servers?.find(be=>be.name===Fe)?.url;await w(`/api/team/my-connections/mcp/${We}/key`,{method:"PUT",body:JSON.stringify({value:C,url:se})})}else{const re=o.config?.postiz?.url??"",se=T&&xt(T)!==xt(pt)?T:"";se!==re&&Be(await w("/api/config",{method:"PUT",body:JSON.stringify({postiz:{url:se}})})),Be(await Tt("postiz",C,o.config?.postiz?.configured!==!0))}if(Ot("postiz","apps","ok"),!f.current)return;W(""),v(!1)}catch(re){Ot("postiz","apps",ls(re)),f.current&&L(yi(re,T||pt))}finally{f.current&&(N(null),await U())}}},ne=async()=>{if(!(m||!window.confirm(n("postiz.disconnectConfirm")))){N("disconnect"),L(null);try{P?await w(`/api/team/my-connections/mcp/${We}`,{method:"DELETE"}):(r?.keySaved&&Be(await Tt("postiz","",!1)),await w(qe,{method:"DELETE"}))}catch(C){f.current&&L(rn(C,r?.address??pt))}finally{f.current&&(N(null),await U())}}},Z=()=>S.current?.controller.abort();if(b)return null;const fe=m==="sign-in",G=!P&&r?.state==="needs-sign-in",je=!P&&r?.state==="key-refused",Ue=r?.state==="blocked"||r?.state==="taken",ce=r?.state==="taken"?n("postiz.taken"):r?.state==="blocked"?r.message??n("postiz.description"):ie?P?n("postiz.connectedOwn"):r?.how==="key"?n("postiz.connectedKey",{host:r.host}):n("postiz.connectedTo",{host:r?.host??""}):G?n("connectors.signedOut"):je?n("postiz.keyRefused"):n("postiz.description"),ve=(ie||G||je)&&e.jsx(cs,{placement:"below",ariaLabel:n("postiz.menu"),triggerClassName:"shrink-0",items:[{key:"disconnect",label:n("connectors.disconnect"),disabled:m!==null,onSelect:()=>{ne()}}],renderTrigger:()=>e.jsx("span",{className:"inline-flex size-7 items-center justify-center rounded-full bg-control/80 text-ink hover:bg-raised-hover",children:m==="disconnect"?e.jsx(ae,{size:14,className:"animate-spin"}):e.jsx(ha,{size:15,"aria-hidden":"true"})})}),Ae=r!==null&&!ie&&!Ue;return e.jsxs("div",{"data-app-tile":"postiz","data-postiz-state":r?.state??"loading",className:"flex min-w-0 flex-col rounded-xl px-2 py-2 transition-colors hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(vi,{}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold leading-5 text-ink",children:"Postiz"}),ie&&e.jsx(Ye,{size:13,strokeWidth:2.5,className:"shrink-0 text-success","aria-label":n("apps.connected")})]}),e.jsx("p",{className:"truncate text-[13px] leading-[18px] text-ink-secondary",title:ce,children:ce})]}),fe?e.jsx("button",{type:"button",onClick:Z,className:Ze,children:n("mcp.auth.cancel")}):r===null?y?e.jsx("button",{type:"button",onClick:()=>{U()},className:Ze,children:n("connectors.action.retry")}):e.jsx("button",{type:"button",disabled:!0,className:Ze,"aria-label":n("common.checking"),children:e.jsx(ae,{size:14,className:"animate-spin"})}):ie?ve:Ae&&!de?e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx("button",{type:"button","aria-label":n(G||je?"postiz.reconnect":"postiz.connect"),disabled:m!==null,onClick:()=>je?(v(!0),L(null)):void Ne(),className:Ze,children:n(G||je?"connectors.action.reconnect":"connectors.action.connect")}),ve]}):null]}),e.jsxs("div",{className:"ps-[52px]",children:[fe&&e.jsxs("div",{role:"status",className:"mt-1.5 flex flex-col gap-1.5 text-[12px] text-ink-secondary",children:[e.jsxs("p",{className:"flex items-center gap-2",children:[e.jsx(ae,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}),e.jsx("span",{children:n(M?"postiz.loadingTools":"postiz.finishInBrowser")}),H?.authorizationUrl&&It(H.authorizationUrl)&&e.jsx("button",{type:"button",onClick:()=>{Xt(H.authorizationUrl).catch(()=>L(n("mcp.auth.openFailed")))},className:Wn,children:n("mcp.auth.openAgain")})]}),H?.flowId&&H.pasteBack&&e.jsxs("form",{"data-postiz-paste":!0,className:"flex flex-col gap-1.5",onSubmit:C=>{C.preventDefault(),Ee()},children:[e.jsx("span",{className:"leading-relaxed text-ink",children:n("mcp.auth.pasteBackHint")}),e.jsx("input",{type:"text",value:D,onChange:C=>_(C.target.value),autoComplete:"off",spellCheck:!1,"aria-label":n("mcp.auth.callbackUrl"),placeholder:"http://127.0.0.1:…/mcp-oauth/callback?…",className:Wt}),e.jsx("button",{type:"submit",disabled:!D.trim(),className:Ze,children:n("mcp.auth.complete")})]})]}),F&&e.jsx("p",{role:"alert",className:"mt-1.5 text-[12px] text-danger",children:F}),Ae&&!fe&&r.team&&!P&&e.jsxs("label",{"data-postiz-only-me":!0,className:"mt-1.5 flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:te,onChange:C=>ke(C.target.checked)})," ",n("mcp.team.onlyMe")]}),P&&!ie&&!fe&&e.jsx("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:n("postiz.personScope")}),Ae&&!fe&&(de?e.jsxs("form",{"data-postiz-key-form":!0,className:"mt-2 flex flex-col gap-2",onSubmit:C=>{C.preventDefault(),Le()},children:[e.jsx("input",{type:"password",autoComplete:"off",spellCheck:!1,"aria-label":n("postiz.keyField"),placeholder:n("keys.postiz.placeholder"),value:V,disabled:m==="key",onChange:C=>{L(null),W(C.target.value)},className:Wt}),!P&&!te&&e.jsx("input",{type:"url",autoComplete:"off",spellCheck:!1,"aria-label":n("postiz.addressField"),placeholder:pt,value:he,disabled:m==="key",onChange:C=>{L(null),ee(C.target.value)},className:Wt}),e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:n(P||te?"postiz.keyHelp":"postiz.keyAndAddressHelp")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[e.jsx("button",{type:"submit",disabled:m!==null||!V.trim(),className:Ze,children:m==="key"?e.jsx(ae,{size:14,className:"animate-spin"}):n("connectors.action.connect")}),e.jsxs("a",{href:ui,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[12px] font-medium text-accent-text hover:underline",children:[n("postiz.keyLink"),e.jsx(pn,{size:11,"aria-hidden":"true"})]}),e.jsx("button",{type:"button",onClick:()=>{v(!1),L(null)},className:"text-[12px] text-ink-secondary underline underline-offset-2 hover:text-ink",children:n("postiz.useSignIn")})]})]}):e.jsx("button",{type:"button",onClick:()=>{v(!0),L(null),ee(r.selfHosted?r.address:"")},className:`mt-1.5 inline-block ${Wn}`,children:n("postiz.useKey")}))]})]})}const Yn=t=>typeof t=="number"&&Number.isSafeInteger(t)&&t>=0,Xn=t=>typeof t=="string"&&t.length<=40&&!Number.isNaN(Date.parse(t));function Ni(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const{calls:s,max:o,usedUp:c,resetsAt:r,trialEndsAt:l}=t;return!Yn(s)||!Yn(o)||!Xn(r)||l!==void 0&&!Xn(l)?null:{calls:Math.min(s,o),max:o,...c===!0||s>=o?{usedUp:!0}:{},resetsAt:r,...l!==void 0?{trialEndsAt:l}:{}}}function Ai(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t;return(s.using==="own"||s.using==="included"||s.using===null)&&typeof s.ownKey=="boolean"&&typeof s.included=="boolean"&&(s.usage===void 0||Ni(s.usage)!==null)}const Si="https://treg.to",Rt="inline-flex h-7 min-w-[64px] shrink-0 items-center justify-center gap-2 rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink transition-colors hover:bg-raised-hover disabled:opacity-40",Ci="h-8 w-full min-w-0 rounded-lg bg-inset px-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none focus:ring-1 focus:ring-accent/50",Ri="x twitter treg tweets posts";function Ei(){return e.jsxs("svg",{viewBox:"0 0 40 40",className:"size-10 shrink-0 rounded-[8px]","aria-hidden":"true",children:[e.jsx("rect",{width:"40",height:"40",rx:"10",fill:"#000"}),e.jsx("path",{transform:"translate(9 9) scale(0.9167)",fill:"#fff",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})]})}const Yt=t=>new Intl.DateTimeFormat(Mt(),{day:"numeric",month:"long",timeZone:"UTC"}).format(new Date(t)),es=t=>t.toLocaleString(Mt());function zi(t){const s={used:es(t.calls),max:es(t.max)};return t.trialEndsAt?t.usedUp?{line:n("apps.x.usedUpTrial",{date:Yt(t.trialEndsAt)}),usedUp:!0}:{line:n("apps.x.usageTrial",s),usedUp:!1}:t.usedUp?{line:n("apps.x.usedUp",{date:Yt(t.resetsAt)}),usedUp:!0}:{line:`${n("apps.x.usage",s)} ${n("apps.x.resets",{date:Yt(t.resetsAt)})}`,usedUp:!1}}function Ii({refreshKey:t=0,onConnection:s}){const{state:o,dispatch:c}=et(),[r,l]=d.useState(null),[b,x]=d.useState(!1),[y,p]=d.useState(null),[m,N]=d.useState(""),[H,A]=d.useState(null),[M,J]=d.useState(null),[D,_]=d.useState(!1),F=d.useRef(!0),L=d.useRef(!1),de=Cs(ga()?.view??null)==="connecting",v=o.config?.treg?.configured===!0,V=o.config?.xResearch?.included===!0,W=d.useCallback(async(E=!1)=>{try{const U=await w(`/api/x/status${E?"?refresh=1":""}`);if(!F.current)return;if(!Ai(U))throw new Error("unexpected X status");l(U),x(!1)}catch{F.current&&x(!0)}},[]);d.useEffect(()=>(F.current=!0,W(t>0),()=>{F.current=!1}),[W,t,v,V]),d.useEffect(()=>{s?.(r?r.using!==null:null)},[r,s]);const he=E=>(c({type:"configStatus",config:E}),W(!0)),ee=async()=>{p("test"),J(null);try{const E=await w("/api/keys/test",{method:"POST",body:JSON.stringify({provider:"treg"})});return F.current&&J(Ds(E)),In(E)}catch(E){return F.current&&J(E instanceof Error?E.message:String(E)),In(null)}finally{F.current&&p(null)}},te=async()=>{const E=m.trim();if(!(y||!E)){if(!rs(E))return A(n("keys.notAKey"));p("save"),A(null),J(null);try{if(await he(await Tt("treg",E,!v)),!F.current)return;N(""),_(!1),Ot("treg","apps",await ee())}catch(U){F.current&&A(U instanceof Error?U.message:String(U)),Ot("treg","apps",ls(U))}finally{F.current&&p(U=>U==="save"?null:U)}}},ke=async()=>{if(!y){p("remove"),A(null),J(null);try{await he(await Tt("treg","",!1)),Qs("treg","apps")}catch(E){F.current&&A(E instanceof Error?E.message:String(E))}finally{F.current&&p(null)}}};d.useEffect(()=>{L.current&&(L.current=!1,te())});const Y=r?.using??null,g=r?.usage?zi(r.usage):null,f=r!==null&&Y!=="own"&&(Y===null||D||g?.usedUp===!0),S=r===null?n("apps.x.description"):Y==="own"?n("apps.x.own"):Y==="included"?n("apps.x.included"):de&&!r.unavailable?n("apps.x.connecting"):n("apps.x.addKey");return e.jsxs("div",{"data-app-tile":"x","data-x-state":r===null?"loading":Y??"none",className:"flex min-w-0 flex-col rounded-xl px-2 py-2 transition-colors hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ei,{}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold leading-5 text-ink",children:n("apps.x.title")}),Y!==null&&e.jsx(Ye,{size:13,strokeWidth:2.5,className:"shrink-0 text-success","aria-label":n("apps.connected")})]}),e.jsx("p",{className:"truncate text-[13px] leading-[18px] text-ink-secondary",title:S,children:S})]}),r===null?b?e.jsx("button",{type:"button",onClick:()=>{W(!0)},className:Rt,children:n("connectors.action.retry")}):e.jsx("button",{type:"button",disabled:!0,className:Rt,"aria-label":n("common.checking"),children:e.jsx(ae,{size:14,className:"animate-spin"})}):Y==="own"?e.jsx("button",{type:"button",disabled:y!==null,onClick:()=>{ee()},className:Rt,children:y==="test"?e.jsx(ae,{size:14,className:"animate-spin"}):n("keys.test")}):null]}),e.jsxs("div",{className:"ps-[52px]",children:[Y==="own"&&e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:r?.included?n("apps.x.ownFirst"):n("apps.x.ownBilled")}),Y==="included"&&g&&e.jsx("p",{"data-x-usage":!0,className:g.usedUp?"mt-1 text-[12px] leading-relaxed text-warning":"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:g.line}),Y==="own"&&e.jsxs("button",{type:"button",disabled:y!==null,onClick:()=>{ke()},className:"mt-1.5 inline-flex items-center gap-1.5 text-[12px] text-danger underline underline-offset-2 disabled:opacity-50",children:[y==="remove"&&e.jsx(ae,{size:12,className:"animate-spin","aria-hidden":"true"}),n("apps.x.remove")]}),Y==="included"&&!f&&e.jsx("button",{type:"button",onClick:()=>{_(!0),A(null)},className:"mt-1.5 inline-block text-[12px] text-accent-text underline underline-offset-2",children:n("apps.x.useOwnKey")}),f&&e.jsxs("form",{"data-x-key-form":!0,className:"mt-2 flex flex-col gap-2",onSubmit:E=>{E.preventDefault(),te()},children:[Y===null&&e.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:n("apps.x.addKeyHelp")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"password",autoComplete:"off",spellCheck:!1,"aria-label":n("keys.treg.label"),placeholder:n("keys.treg.placeholder"),value:m,disabled:y==="save",onChange:E=>{A(null),N(E.target.value)},onPaste:()=>{L.current=!0},className:Ci}),e.jsx("button",{type:"submit",disabled:y!==null||!m.trim(),className:Rt,children:y==="save"?e.jsx(ae,{size:14,className:"animate-spin"}):n("common.save")})]}),e.jsxs("a",{href:Si,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[12px] font-medium text-accent-text hover:underline",children:[n("keys.treg.link"),e.jsx(pn,{size:11,"aria-hidden":"true"})]})]}),M&&e.jsx("p",{role:"status",className:"mt-1.5 text-[12px] text-ink-secondary",children:M}),H&&e.jsx("p",{role:"alert",className:"mt-1.5 text-[12px] text-danger",children:H})]})]})}function ln(t,s,o,c){const r={...t};for(const[l,b]of Object.entries(s))(o.get(l)??0)===(c.get(l)??0)&&(r[l]=b);return r}function Ti(t,s,o,c,r=!0){const l={...t};if(!r)return ln(l,s,o,c);for(const[b,x]of Object.entries(t))s[b]||!x.connected&&!x.accounts?.length||(o.get(b)??0)===(c.get(b)??0)&&(l[b]={connected:!1,pending:!1,status:"not_connected",accounts:[]});return ln(l,s,o,c)}function Oi(t,s,o){return Object.fromEntries(Object.entries(t).filter(([c])=>(s.get(c)??0)===(o.get(c)??0)))}async function Bi(t=window.ogb){if(!t?.credentialStore||t.remoteClient?.active===!0)return!1;try{return await t.credentialStore.unreadable()===!0}catch{return!1}}let mt=null;function ts({notice:t=!1}){const[s,o]=d.useState(!1),[c,r]=d.useState(()=>mt!==null);if(d.useEffect(()=>{let x=!0;return Bi().then(y=>{x&&o(y)}),mt?.finally(()=>{x&&r(!1)}),()=>{x=!1}},[]),!s)return null;const l=()=>{if(mt)return;r(!0),mt=Promise.resolve(window.ogb?.credentialStore?.reset()).then(()=>{},()=>{}).finally(()=>{mt=null,r(!1)})},b=e.jsx("button",{type:"button",onClick:l,disabled:c,className:"ms-2 font-medium underline underline-offset-2 hover:opacity-80 disabled:opacity-60",children:n("connectors.resetSavedKeys")});return t?e.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl bg-warning/10 px-3 py-2 text-[13px] text-warning",children:[e.jsx(ds,{size:14,className:"mt-px shrink-0"}),e.jsxs("span",{children:[n("connectors.savedKeysUnreadable"),b]})]}):b}function Pi(t,s){const o=s.alias?`“${s.alias}” (${s.id})`:`“${s.id}”`;return n("connectors.disconnectConfirm",{identity:o,service:t})}function Mi(t,s,o){return t.filter(c=>{if(c.hidden||c.composio===!1||!s.find(b=>b.instanceId===c.modelSelection.instanceId)?.capabilities?.composioMcp)return!1;const r=c.connectorTools;if(!r||typeof r!="object"||Array.isArray(r))return!1;const l=r[o];return l===void 0?!0:!la(l)||l.tools!=="*"})}function Li(t,s,o){return(!s||`${t.label} ${t.keywords} ${n(t.description)}`.toLowerCase().includes(s.toLowerCase().trim()))&&o?.[t.id]===!0}function Ui(t){return t.configured||t.stale?null:t.setup==="needs-setup"?{key:t.remoteClient?"connectors.setupNeededRemote":"connectors.setupNeeded",tone:"info"}:{key:"connectors.notConfigured",tone:"warning"}}const ns=48,$i=16;function Fi(t,s,o){return ia(t,s).filter(c=>oa(c,o)!==null)}function Zi(){const{state:t,dispatch:s}=et(),o=window.ogb?.remoteClient?.active===!0,c=d.useRef(null),r=t.pluginsSurface,[l,b]=d.useState(null),[x,y]=d.useState("curated"),[p,m]=d.useState(null),[N,H]=d.useState(!1),[A,M]=d.useState("unavailable"),[J,D]=d.useState(void 0),[_,F]=d.useState(()=>St()?.services??Hs()?.services??{}),[L,de]=d.useState(St()?.authoritative===!1),[v,V]=d.useState({}),[W,he]=d.useState(null),[ee,te]=d.useState(""),[ke,Y]=d.useState(null),[g,f]=d.useState(!1),[S,E]=d.useState(St()===null?"loading":"ready"),[U,P]=d.useState(null),[ie,Be]=d.useState(""),[Pe,Me]=d.useState("marketplace"),[Ne,Ee]=d.useState(!1),[Le,ne]=d.useState(null),[Z,fe]=d.useState(0),[G,je]=d.useState(null),[Ue,ce]=d.useState(null),[ve,Ae]=d.useState(null),[C,T]=d.useState(null),[re,se]=d.useState([]),be=d.useRef(null),ue=d.useRef(new Map),ye=d.useRef(new Map),tt=d.useRef(new Map),oe=d.useRef(null),nt=d.useRef(new Set),bt=(i,j)=>{const B=Object.entries(i).filter(([I,K])=>(ye.current.get(I)??0)===(j.get(I)??0)&&(K.connected&&!K.pending||/^(expired|failed)$/i.test(K.status??""))).map(([I])=>I);B.length&&V(I=>B.some(K=>I[K])?Object.fromEntries(Object.entries(I).filter(([K])=>!B.includes(K))):I)},st=d.useCallback(i=>{if(!i.length)return Promise.resolve({});const j=new Map(i.map(I=>[I,ye.current.get(I)??0])),B=new Map(i.map(I=>{const K=(tt.current.get(I)??0)+1;return tt.current.set(I,K),[I,K]}));return w(`/api/connectors?services=${i.join(",")}`).then(I=>{const K=Oi(I.services??{},tt.current,B);return F(Q=>ln(Q,K,ye.current,j)),bt(K,j),K}).catch(()=>({}))},[]),at=d.useCallback((i=!1)=>{const j=new Map(ye.current);return f(!0),_s(i).then(({services:B,authoritative:I,refused:K})=>(de(!I),K&&P({key:"connectors.adminOnly"}),F(Q=>Ti(Q,B,ye.current,j,I)),bt(B,j),B)).finally(()=>f(!1))},[]),Ke=d.useCallback((i=!1)=>{const j=St()!==null;return j||E("loading"),P(null),at(i).then(B=>(E("ready"),B)).catch(B=>(j||E("error"),P(B instanceof Error?B.message:String(B)),{}))},[at]);d.useEffect(()=>()=>{oe.current?.cancel(),oe.current=null;for(const i of ue.current.values())i();ue.current.clear()},[]);const xe=Js({status:_,emailConnected:C,inventoryReady:S==="ready"&&!L});d.useEffect(()=>{S==="ready"&&Vs(_,!L)},[S,L,_]),d.useEffect(()=>{let i=!0;return Ke(),w("/api/connectors/catalog").then(j=>{i&&(b(j.cards??[]),y(j.source??"curated"),m(j.pagination??null),H(!!j.configured),M(j.mode??"unavailable"),D(j.setup))}).catch(j=>{i&&(b(B=>B??[]),P(Gs(j)?{key:"connectors.adminOnly"}:j.message))}),()=>{i=!1}},[Ke]),d.useEffect(()=>{const i=document.activeElement instanceof HTMLElement?document.activeElement:null,j=c.current,B=()=>Array.from(j?.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]).filter(Q=>Q.getClientRects().length>0),I=B();(I.find(Q=>Q.matches("input"))??I[0]??j)?.focus();const K=Q=>{if(be.current)return;if(Q.key==="Escape"){Q.preventDefault(),s({type:"togglePlugins",open:!1});return}if(Q.key!=="Tab"||!j)return;const le=B();if(le.length===0){Q.preventDefault(),j.focus();return}const we=le[0],Se=le.at(-1);le.some(ge=>ge===document.activeElement)?Q.shiftKey&&document.activeElement===we?(Q.preventDefault(),Se.focus()):!Q.shiftKey&&document.activeElement===Se&&(Q.preventDefault(),we.focus()):(Q.preventDefault(),(Q.shiftKey?Se:we).focus())};return window.addEventListener("keydown",K),()=>{window.removeEventListener("keydown",K),i?.focus()}},[s]);const{suggestions:$e,picking:it,pick:Lt}=qs(l!==null&&N&&S==="ready",`${Z}:${Object.keys(_).filter(i=>_[i]?.connected).sort().join()}`),[Ce,De]=d.useState(null);be.current=Ce;const a=async i=>{if(oe.current)return;const j=zt();oe.current=j;try{!await j.open(i)&&oe.current===j&&P({key:"connectors.popupBlockedContinue"})}finally{j.cancel(),oe.current===j&&(oe.current=null)}},u=(i,j,B)=>{ue.current.get(i)?.();const I=da(j,()=>st([i]).then(K=>K[i]),K=>{ue.current.get(i)===I&&ue.current.delete(i),ua(i,K),K==="connected"&&B&&xe.appConnected(i,l?.find(Q=>Q.slug===i)?.label??i)});ue.current.set(i,I)},h=async(i,j,B)=>{if(ke||oe.current)return;const I=zt();oe.current=I,ye.current.set(i,(ye.current.get(i)??0)+1),Y(i),P(null),B&&nt.current.add(i);const K=!nt.current.has(i)&&!dt(_[i]);try{const Q=Date.now();B&&await w(`/api/connectors/${i}/accounts/${encodeURIComponent(B.id)}`,{method:"DELETE"});const le={method:"POST"};j&&(le.body=JSON.stringify({alias:j}));const we=await w(`/api/connectors/${i}/authorize`,le);if(oe.current!==I)return;const Se=It(typeof we.url=="string"?we.url:null);if(!Se)throw new Error(n("connectors.invalidAuthorizationUrl"));V(ge=>({...ge,[i]:{url:Se,createdAt:Q}})),F(ge=>({...ge,[i]:{...ge[i],connected:ge[i]?.connected??!1,pending:!0,status:"INITIATED"}})),he(null),te(""),u(i,_[i],K),!await I.open(Se)&&oe.current===I&&P({key:"connectors.popupBlockedContinue"})}catch(Q){if(oe.current!==I)return;const le=Q instanceof Error?Q.message:String(Q);ca(le)?(he(i),te(""),P({key:"connectors.aliasNeeded"}),st([i])):P(ra(le)?{key:"connectors.aliasTaken"}:le)}finally{I.cancel(),oe.current===I&&(oe.current=null,Y(null))}},k=(i,j)=>{Y(i),w(`/api/connectors/${i}/accounts/${encodeURIComponent(j)}`,{method:"DELETE"}).then(()=>st([i])).catch(B=>P(B.message)).finally(()=>Y(null))},$=(l??[]).filter(i=>dt(_[i.slug])||!i.needsOwnAuth&&!Pn(A,i.slug)),z=$.filter(i=>Tn(`${i.label} ${i.slug} ${Mn(i)} ${(i.categories??[]).join(" ")}`,ie)),X=i=>!!(_[i]?.connected||_[i]?.accounts?.length),R=r==="mcp"?"mcp":Pe==="connected"?"connected":"all",ze=ie.trim().length>0,ot=ze&&R==="connected"?"all":R,bn=new Set(ft.filter(i=>Li(i,ie,Le)).map(i=>i.id)),Ut=i=>!ie||i.toLowerCase().includes(ie.toLowerCase().trim()),yn=C===!0&&Ut(`email mail imap smtp mailbox ${n("email.description")}`),kn=Ue===!0&&Ut(`${Ri} ${n("apps.x.description")}`),ks=ve===!0&&Ut(`${gi} ${n("postiz.description")}`),$t=(ot==="connected"?z.filter(i=>X(i.slug)):z).map((i,j)=>({card:i,index:j})).sort((i,j)=>Number(X(j.card.slug))-Number(X(i.card.slug))||i.index-j.index).map(({card:i})=>i),Ft=ft.filter(i=>Le?.[i.id]),jn=re.filter(i=>cn(i)),vn=i=>Tn(`${i.name} ${pe(i)?i.url:[i.command,...i.args].join(" ")}`,ie),wn=Object.values(_).filter(dt).length+Ft.length+jn.filter(bs).length+ +(C===!0)+ +(Ue===!0)+ +(ve===!0),Nn=Zs(S),Qe=()=>s({type:"togglePlugins",open:!1}),yt=Ui({configured:N,stale:L,setup:J,remoteClient:o}),ct=i=>{if(je(null),i==="mcp"){s({type:"togglePlugins",open:!0,surface:"mcp"});return}Me(i==="connected"?"connected":"marketplace"),r!=="apps"&&s({type:"togglePlugins",open:!0,surface:"apps"})},Kt=Sa($),Dt=Kt.more,Qt=G!==null&&Dt.includes(G),He=R==="all"&&G!==null&&!ze,An=ks&&(!He||nn(bi,G)),js=!He&&(bn.size>0||yn||kn)||An||R==="connected"&&jn.some(i=>i.enabled&&vn(i)),vs=He?$t.filter(i=>nn(i,G)):$t,kt=R==="all"&&!ze&&G===null,rt=kt?Ca($t,X,Kt.inline):[],ws=rt.find(i=>i.kind==="all"),jt=kt?ws?.cards??[]:vs,Ht=kt&&!Ne&&jt.length>ns,Sn=Ht?jt.slice(0,ns):jt,Cn=(l??[]).filter(i=>dt(_[i.slug])),_t=i=>{je(i),Me("marketplace"),r!=="apps"&&s({type:"togglePlugins",open:!0,surface:"apps"})},Ns=ze?n("connectors.section.results"):R==="connected"?n("connectors.section.yours"):G?ut(G):rt.length>1?n("apps.section.all"):n("connectors.section.available"),_e="inline-flex h-7 shrink-0 items-center justify-center gap-2 rounded-full px-3 text-[13px] font-medium leading-5 transition-colors",Jt=i=>i?"bg-ink text-app":"bg-control/70 text-ink-secondary hover:bg-raised-hover hover:text-ink";return e.jsxs("div",{className:"glass-popup-frame",style:ta(),onMouseDown:i=>i.target===i.currentTarget&&Qe(),children:[e.jsx("div",{"aria-hidden":"true",className:"glass-scrim pointer-events-none absolute inset-0"}),e.jsxs("div",{ref:c,"data-tour":"apps-panel",role:"dialog","data-look":"dialog","aria-modal":"true","aria-labelledby":"plugins-title",tabIndex:-1,className:"glass-surface glass-popup animate-pop-in relative flex max-w-[780px] flex-col overflow-hidden rounded-2xl",children:[e.jsxs("header",{className:"flex flex-col gap-4 px-5 pb-4 pt-5 sm:px-7 sm:pt-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{id:"plugins-title",className:"min-w-0 truncate text-[20px] font-semibold leading-7 tracking-[-0.01em] text-ink",children:n("apps.title")}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs("button",{type:"button","data-apps-filter":"connected","aria-pressed":R==="connected",onClick:()=>ct(R==="connected"?"all":"connected"),className:q("inline-flex h-8 items-center gap-2 rounded-full ps-1.5 pe-2 text-[13px] font-medium leading-5 transition-colors",R==="connected"?"bg-raised text-ink":"text-ink-secondary hover:bg-raised/60 hover:text-ink"),children:[Cn.length>0&&e.jsx("span",{"aria-hidden":"true",className:"flex -space-x-1.5 rtl:space-x-reverse",children:Cn.slice(0,4).map(i=>e.jsx("span",{className:"flex size-5 items-center justify-center overflow-hidden rounded-md bg-menu ring-2 ring-menu",children:e.jsx(On,{card:i,className:"size-5 rounded-md"})},i.slug))}),e.jsx("span",{className:"whitespace-nowrap",children:wn>0?n("apps.connectedCount",{count:wn}):n("apps.filter.connected")}),e.jsx(ps,{size:14,"aria-hidden":"true",className:"shrink-0 rtl:-scale-x-100"})]}),e.jsx("button",{onClick:()=>{fe(i=>i+1),Ke(!0)},disabled:g,className:"flex size-8 items-center justify-center rounded-full text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50",title:n("connectors.refreshTitle"),"aria-label":n("connectors.refreshTitle"),children:e.jsx(tn,{size:16,className:q(g&&"animate-spin")})}),e.jsx("button",{"data-tour":"apps-close",onClick:Qe,"aria-label":n("connectors.closeAria"),className:"flex size-8 items-center justify-center rounded-full text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(ss,{size:18})})]})]}),e.jsx("p",{className:"mt-0.5 text-[13px] leading-5 text-ink-secondary",children:n("apps.subtitle")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-full bg-control/70 px-3.5 focus-within:ring-1 focus-within:ring-accent",children:[e.jsx(Rs,{size:15,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:ie,onChange:i=>Be(i.target.value),placeholder:n("connectors.searchPlaceholder"),"aria-label":n("connectors.searchPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("button",{type:"button","data-apps-filter":"mcp","aria-pressed":R==="mcp",onClick:()=>ct(R==="mcp"?"all":"mcp"),className:q(_e,"h-9 border border-hairline/40 px-3.5",R==="mcp"?"bg-ink text-app":"text-ink hover:bg-raised"),children:[e.jsx(fa,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"hidden sm:inline",children:n("apps.filter.mcp")}),e.jsx("span",{className:"sr-only sm:hidden",children:n("apps.filter.mcp")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":n("apps.categoriesAria"),children:[e.jsx("button",{type:"button","data-apps-filter":"all","aria-pressed":R==="all"&&G===null,onClick:()=>{ct("all"),je(null)},className:q(_e,Jt(R==="all"&&G===null)),children:n("apps.filter.all")}),Kt.inline.map(i=>e.jsx("button",{type:"button","data-apps-category":i,"aria-pressed":R==="all"&&G===i,onClick:()=>_t(G===i?null:i),className:q(_e,Jt(R==="all"&&G===i)),children:ut(i)},i)),Dt.length>0&&e.jsx(cs,{ariaLabel:n("apps.moreCategories"),items:Dt.map(i=>({key:i,label:ut(i),active:G===i,onSelect:()=>_t(i)})),renderTrigger:({open:i})=>e.jsxs("span",{className:q(_e,Jt(R==="all"&&Qt),i&&!Qt&&"bg-raised-hover text-ink"),children:[Qt?ut(G):n("apps.more"),e.jsx(as,{size:14,"aria-hidden":"true"})]})})]})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 pb-7 sm:px-7",children:[L?e.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl bg-warning/10 px-3 py-2 text-[13px] text-warning",children:[e.jsx(ds,{size:14,className:"mt-px shrink-0"}),e.jsxs("span",{children:[n("connectors.stale"),e.jsx(ts,{})]})]}):e.jsx(ts,{notice:!0}),yt&&R!=="mcp"&&e.jsxs("div",{className:q("mb-3 rounded-xl px-4 py-3 text-[13px]",yt.tone==="warning"?"bg-warning/10 text-warning":"bg-control/50 text-ink-secondary"),children:[Ft.length>0?n("hostedMcp.otherAppsSetup",{services:new Intl.ListFormat(Mt(),{style:"long",type:"conjunction"}).format(Ft.map(i=>i.label))}):n(yt.key)," ",e.jsx("button",{className:q("font-medium underline underline-offset-2",yt.tone==="info"&&"text-ink",o&&"hidden"),onClick:()=>{Qe(),s(Bn("composio"))},children:n("connectors.openSettings")})]}),N&&!o&&x==="curated"&&A==="self-hosted"&&R!=="mcp"&&e.jsxs("div",{className:"mb-3 text-[12px] text-ink-secondary",children:[n("connectors.featuredBefore")," ",e.jsx("button",{className:"underline underline-offset-2 hover:text-ink",onClick:()=>{Qe(),s({type:"toggleAppSettings",open:!0})},children:n("connectors.updateKey")})," ",n("connectors.featuredAfter")]}),U&&e.jsx("div",{role:"alert",className:"mb-3 rounded-xl bg-danger/10 px-3 py-2 text-[12px] text-danger",children:typeof U=="string"?U:n(U.key)}),R!=="mcp"&&e.jsxs("div",{"data-apps-grid":!0,className:"@container flex flex-col gap-7 pt-1",children:[!rt.some(i=>i.kind==="connected")&&Rn(),rt.filter(i=>i.kind!=="all").map(i=>i.kind==="connected"?e.jsxs(d.Fragment,{children:[e.jsx(Ct,{id:"apps-section-connected",title:n("apps.section.connected"),viewAll:i.cards.length>Bt?{label:n("apps.viewAll"),onClick:()=>ct("connected")}:void 0,children:i.cards.slice(0,Bt).map(j=>vt(j))}),Rn()]},"connected"):e.jsx(Ct,{id:`apps-section-${i.category}`,title:ut(i.category),viewAll:i.more?{label:n("apps.viewAll"),onClick:()=>_t(i.category)}:void 0,children:i.cards.map(j=>vt(j))},i.category)),e.jsxs(Ct,{id:"apps-grid-title",title:Ns,note:R==="all"&&!ie&&G===null&&p&&(p.stalled||p.totalItems!==void 0&&p.items<p.totalItems)?`${p.totalItems!==void 0&&p.items<p.totalItems?n("connectors.marketplace.partialCount",{shown:p.items.toLocaleString(Vt()),total:p.totalItems.toLocaleString(Vt())}):n("connectors.marketplace.partialStalled")}${p.reason?` — ${n("connectors.marketplace.partialReason",{reason:p.reason})}`:""}`:void 0,viewAll:Ht?{label:n("apps.viewAll"),onClick:()=>Ee(!0)}:void 0,after:e.jsxs(e.Fragment,{children:[l===null&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(ae,{size:14,className:"animate-spin"})," ",n("connectors.loadingCatalog")]}),Ht&&e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>Ee(!0),className:q(_e,"bg-control/70 px-4 text-ink hover:bg-raised-hover"),children:n("apps.showAll",{count:jt.length.toLocaleString(Vt())})})}),l!==null&&Sn.length===0&&!js&&rt.length<=1&&e.jsxs("div",{className:"flex min-h-40 flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:ot==="connected"?Nn.title:n("connectors.noAppsFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:ot==="connected"?Nn.description:n("connectors.tryDifferentSearch")}),R==="connected"&&S==="error"&&e.jsxs("button",{type:"button",disabled:g,onClick:()=>{Ke(!0)},className:q(_e,"mt-4 bg-raised text-ink hover:bg-raised-hover disabled:opacity-50"),children:[e.jsx(tn,{size:14,className:q(g&&"animate-spin")}),n("connectors.action.retry")]})]})]}),children:[e.jsx(Zn,{hostedCards:{shown:i=>!He&&bn.has(i),onConnections:ne,onServers:se,...R==="connected"?{ownServers:{shown:vn,manage:()=>ct("mcp")}}:{}},refreshKey:Z}),e.jsx("div",{"data-native-card":"x",className:kn&&!He?"contents":"hidden",children:e.jsx(Ii,{refreshKey:Z,onConnection:ce})}),e.jsx("div",{"data-native-card":"email",className:yn&&!He?"contents":"hidden",children:e.jsx(Ws,{refreshKey:Z,onConnection:T})}),e.jsx("div",{"data-native-card":"postiz",className:An?"contents":"hidden",children:e.jsx(wi,{refreshKey:Z,onConnection:Ae})}),Sn.map(i=>vt(i))]})]}),R!=="connected"&&G===null&&e.jsx("div",{className:q(R==="all"&&"mt-8 border-t border-hairline/30 pt-6",R==="mcp"&&"pt-1"),children:e.jsx(Zn,{embedded:!0,hideHosted:R==="all"})}),e.jsx("nav",{"aria-label":n("legal.label"),className:"mt-10 flex justify-center gap-x-4 text-[12px]",children:e.jsx(Ys,{})})]}),e.jsx(Xs,{open:Ce!==null,layer:"z-[60]",tone:"danger",title:n("connectors.disconnect"),confirmLabel:n("connectors.disconnect"),body:Ce?Pi(Ce.label,Ce.account):"",onCancel:()=>De(null),onConfirm:()=>{Ce&&k(Ce.slug,Ce.account.id),De(null)}}),xe.changing&&e.jsx(ea,{app:l?.find(i=>i.slug===xe.changing)?.label??xe.changing,slug:xe.changing,bots:xe.bots,onDone:xe.done,onDismiss:xe.dismiss},xe.changing)]})]});function Rn(){const i=$e.cards.filter(B=>!X(B.slug));if(!kt||i.length===0)return null;const j=$e.pick==="available"?{label:n(it?"apps.suggested.picking":"apps.suggested.show"),onClick:Lt}:$e.pick==="needs-key"&&!o?{label:n("apps.suggested.addKey"),onClick:()=>{Qe(),s(Bn("jev"))}}:void 0;return e.jsx(Ct,{id:"apps-section-suggested",title:n("apps.section.suggested"),note:$e.pick==="picked"?n("apps.suggested.picked"):void 0,viewAll:j,children:i.map(B=>vt(B))})}function vt(i){const j=_[i.slug],B=j?.status&&/^(expired|failed)$/i.test(j.status),I=j?.pending&&!B,K=I&&!B?v[i.slug]:void 0,Q=Gt(K),le=j?.accounts??[],we=i.noAuth===!0||j?.connected===!0&&!le.length&&!I&&!B,Se=dt(j),ge=I?void 0:na(j),As=W===i.slug&&!we,Je=ke===i.slug,wt=t.config?.managedPolicy,Nt=wt?.apps&&!wt.apps.allowAll&&!wt.apps.allowlist.includes(i.slug)?n("policy.managedBy",{organization:wt.organizationName}):Pn(A,i.slug)?n("connectors.selfHostOnlyReason"):null,lt=Se||we?Fi(t.bots,t.instances,i.slug):[],At=n("apps.usedBy",{names:lt.map(O=>O.name).join(", ")}),En=Nt??(I?Q?n("connectors.finishSetup"):n("connectors.finishSetupOrDisconnect"):ge?n("connectors.signedOut"):B&&!le.length?n("connectors.authExpired"):Mn(i));return e.jsxs("div",{"data-app-tile":i.slug,className:"flex min-w-0 flex-col rounded-xl px-2 py-2 transition-colors hover:bg-raised/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(On,{card:i,className:"size-10 shrink-0 rounded-[8px]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[14px] font-semibold leading-5 text-ink",children:i.label}),Se&&!I&&e.jsx(Ye,{size:13,strokeWidth:2.5,className:"shrink-0 text-success","aria-label":n("apps.connected")}),lt.length>0&&e.jsx("span",{className:"ms-1 flex shrink-0 -space-x-1.5 rtl:space-x-reverse",title:At,"aria-label":At,role:"img",children:lt.slice(0,3).map(O=>e.jsx("span",{"data-used-by-avatar":O.id,className:"flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full bg-menu ring-2 ring-menu",children:e.jsx(xa,{bot:O,size:$i,animated:!1})},O.id))})]}),e.jsx("div",{className:"truncate text-[13px] leading-[18px] text-ink-secondary",title:En,children:En})]}),e.jsx("button",{type:"button",disabled:!N||S!=="ready"||Je||we||!!Nt,title:Nt??void 0,onClick:()=>{if(I&&!B){const O=Gt(K);O?(P(null),a(O).catch(Ie=>P(Ie.message))):h(i.slug)}else ge?h(i.slug,ge.alias,ge):le.length===0?h(i.slug):(he(O=>O===i.slug?null:i.slug),te(""))},className:"inline-flex h-7 min-w-[64px] shrink-0 items-center justify-center gap-2 rounded-full bg-control/80 px-3 text-[13px] font-medium leading-5 text-ink transition-colors hover:bg-raised-hover disabled:opacity-40",children:Nt?n("connectors.selfHostOnly"):Je?e.jsx(ae,{size:14,className:"animate-spin"}):sa(S,{busy:Je,included:we,canContinue:!!K,pending:I,reconnect:!!ge,hasAccounts:le.length>0,failed:!!B})})]}),e.jsxs("div",{className:"ps-[52px]",children:[Q&&e.jsx("a",{href:Q,target:"_blank",rel:"noopener noreferrer",onClick:O=>{Gt(K)||(O.preventDefault(),h(i.slug))},className:"mt-1.5 inline-block text-[12px] text-accent-text underline underline-offset-2",children:n("connectors.openAuthorizationPage")}),Se&&!I&&e.jsxs("div",{"data-app-bots":i.slug,className:"mt-1.5 flex min-w-0 items-center gap-2 text-[12px] leading-5 text-ink-secondary",children:[e.jsx("span",{className:"min-w-0 truncate",title:lt.length?At:void 0,children:lt.length?At:n("apps.usedByNone")}),xe.canChange&&e.jsx("button",{type:"button",onClick:()=>xe.change(i.slug),"aria-label":n("apps.whichBots",{app:i.label}),className:"ms-auto shrink-0 rounded-full px-2 text-[12px] font-medium leading-5 text-accent-text transition-colors hover:bg-raised-hover",children:n("apps.usedByChange")})]}),le.length>0&&e.jsx("div",{className:"mt-1.5 space-y-0.5",children:le.map(O=>{const Ie=/^active$/i.test(O.status),Ve=aa(O)&&O.id!==ge?.id;return e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-[12px] leading-5",children:[Ie?e.jsx(Ye,{size:12,className:"shrink-0 text-success"}):e.jsx("span",{className:"size-3 shrink-0"}),e.jsxs("span",{className:"min-w-0 truncate text-ink",title:`${O.alias?`${O.id} · `:""}${O.status.toLowerCase()}`,children:[O.alias||O.id,e.jsxs("span",{className:"text-ink-secondary",children:[" · ",O.status.toLowerCase()]})]}),Ve&&e.jsx("button",{type:"button",disabled:Je,onClick:()=>{h(i.slug,O.alias,O)},className:"ms-auto shrink-0 rounded-full px-2 text-[12px] font-medium leading-5 text-accent-text transition-colors hover:bg-raised-hover disabled:opacity-40","aria-label":n("connectors.reconnectAria",{account:O.alias||O.id,service:i.label}),children:n("connectors.action.reconnect")}),e.jsx("button",{type:"button",disabled:Je,onClick:()=>De({slug:i.slug,label:i.label,account:O}),className:q("shrink-0 rounded-full px-2 text-[12px] font-medium leading-5 text-ink-secondary transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40",!Ve&&"ms-auto"),"aria-label":n("connectors.disconnectAria",{account:O.alias||O.id,service:i.label}),children:n("connectors.disconnect")})]},O.id)})}),(j?.connected||we)&&(()=>{const O=Mi(t.bots,t.instances,i.slug);if(!O.length)return null;const Ie=O.slice(0,4).map((Ve,Ss)=>e.jsxs("span",{children:[Ss>0&&", ",e.jsx("button",{type:"button",onClick:()=>{Qe(),en(s,"access",{botId:Ve.id,page:"apps"})},className:"font-medium text-ink underline underline-offset-2 hover:text-accent-text",children:Ve.name})]},Ve.id));return e.jsxs("div",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx("span",{children:n("connectors.grants.limited",{count:O.length})})," ",Ie,O.length>4&&e.jsx("span",{children:n("connectors.grants.more",{count:O.length-4})})]})})(),As&&e.jsxs("form",{className:"mt-2 flex items-center gap-2",onSubmit:O=>{O.preventDefault();const Ie=ee.trim();if(!Ie){P({key:"connectors.aliasRequired"});return}h(i.slug,Ie)},children:[e.jsx("input",{autoFocus:!0,value:ee,maxLength:64,onChange:O=>te(O.target.value),placeholder:n("connectors.aliasPlaceholder"),"aria-label":le.length>0?n("connectors.aliasAriaAnother",{service:i.label}):n("connectors.aliasAriaNew",{service:i.label}),className:"h-8 min-w-0 flex-1 rounded-full bg-inset px-3 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("button",{type:"submit",disabled:Je||!ee.trim(),className:"inline-flex h-7 shrink-0 items-center rounded-full bg-accent px-3 text-[13px] font-medium leading-5 text-accent-ink disabled:opacity-40",children:n("connectors.action.continue")})]})]})]},i.slug)}}export{ns as APPS_PREVIEW_COUNT,Zi as PluginsPanel,On as ServiceIcon,$i as USED_BY_AVATAR_SIZE,Fi as botsUsingService,Mi as botsWithLimitedServiceTools,Ui as connectorSetupNotice,Pi as disconnectAccountConfirmation,Li as hostedShown,_s as preloadConnectedApps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,g as i,j as c,t as l}from"./styles-
|
|
1
|
+
import{r,g as i,j as c,t as l}from"./styles-3g-ZPS7M.js";import{u as d,h as p}from"./App-h8WTNY4l.js";import"./PlacesRail-Df-jNTHn.js";function g(){const t=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[n,s]=r.useState(null);return r.useEffect(()=>{if(!t)return;let e=!0,a=!1;const u=t.onState(o=>{a=!0,e&&s(o)});return t.state().then(o=>{e&&!a&&s(o)}).catch(()=>{}),()=>{e=!1,u()}},[t]),t?{view:i(n),account:n}:null}function b(){const{dispatch:t}=d();return c.jsx(p,{title:l("pro.seePlans"),onClick:()=>t({type:"openCloudAdd",source:"app_settings"}),data:{"data-plan-compare":""}})}export{b as P,g as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as S,r as o,j as e,t as l,w as T,S as E,o as I}from"./styles-
|
|
1
|
+
import{c as S,r as o,j as e,t as l,w as T,S as E,o as I}from"./styles-3g-ZPS7M.js";import{ba as A,ad as U,bb as L,bc as O,T as P,C as _,u as z,g as N,bd as R,A as D,be as $}from"./App-h8WTNY4l.js";import{T as B,a as F,b as M}from"./ToolPageShell-DKZUregg.js";import{j as H,C as q}from"./PlacesRail-Df-jNTHn.js";import{r as G}from"./memory-BNaMRI5v.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";const J=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],K=S("settings-2",J),Q={public:"publishedApps.access.public","netlify-team":"publishedApps.access.netlifyTeam",link:"publishedApps.access.link",unknown:null},V={included:"publishedApps.source.included",netlify:"publishedApps.source.netlify",page:"publishedApps.source.page"},W={taken_down:"publishedApps.status.takenDown",not_live:"publishedApps.status.notLive"};function X({app:t,onOpen:n,onPreview:i,onAsk:u,onDelete:c}){const{state:d,copy:g}=H(t.url),[j,m]=o.useState(!1),[h,p]=o.useState(!1),[x,y]=o.useState(null),k=Q[t.access],f=!t.status&&!!t.url,s="inline-block rounded-full bg-inset px-2 py-0.5 text-[12px]",a=[t.bot.name,G(t.publishedAt)].filter(Boolean).join(" · "),r=async()=>{p(!0);const w=await c();p(!1),m(!1),y(w)},b="ui-icon-button shrink-0 hover:bg-raised hover:text-ink";return e.jsxs("li",{"data-published-app":t.id,"data-source":t.source,className:"flex flex-col overflow-hidden rounded-2xl border border-hairline/40 bg-card",children:[f?e.jsx("button",{type:"button",onClick:i,"aria-label":l("publishedApps.card.previewOf",{name:t.title}),className:"block w-full border-b border-hairline/30 text-left focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus",children:e.jsx(A,{url:t.url,title:t.title,loginOnly:t.access==="netlify-team"})}):e.jsx("div",{className:"border-b border-hairline/30",children:e.jsx(A,{url:"",title:t.title,loginOnly:!0})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 p-3.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{dir:"auto",className:"truncate text-[15px] font-semibold text-ink",title:t.title,children:t.title}),e.jsx("p",{dir:"auto",className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:a}),e.jsxs("p",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[e.jsx("span",{"data-app-source":t.source,className:`${s} text-ink-secondary`,children:l(V[t.source])}),t.status?e.jsx("span",{"data-app-status":t.status,className:`${s} text-danger`,children:l(W[t.status])}):k&&e.jsx("span",{"data-app-access":t.access,className:`${s} text-ink-secondary`,children:l(k)})]})]}),e.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-1.5 pt-1",children:[f&&e.jsxs("button",{type:"button",className:"ui-button ui-button-md",onClick:i,children:[e.jsx(U,{size:14,"aria-hidden":"true"}),l("publishedApps.card.preview")]}),f&&e.jsxs("button",{type:"button",className:"ui-button ui-button-md",onClick:()=>n(t.url),children:[e.jsx(L,{size:14,"aria-hidden":"true"}),l("chat.page.open")]}),e.jsxs("span",{className:"ml-auto flex items-center",children:[f&&e.jsx("button",{type:"button",className:b,onClick:g,"aria-label":l("chat.page.copyLink"),title:l(d==="copied"?"chat.page.copied":"chat.page.copyLink"),children:d==="copied"?e.jsx(T,{size:15}):e.jsx(q,{size:15})}),u&&e.jsx("button",{type:"button",className:b,onClick:u,"aria-label":l("publishedApps.card.ask",{bot:t.bot.name}),title:l("publishedApps.card.ask",{bot:t.bot.name}),children:e.jsx(O,{size:15})}),t.manageUrl&&e.jsx("button",{type:"button",className:b,onClick:()=>n(t.manageUrl),"aria-label":l("publishedApps.card.manage"),title:l("publishedApps.card.manage"),children:e.jsx(K,{size:15})}),t.canDelete&&e.jsx("button",{type:"button",className:`${b} hover:text-danger`,onClick:()=>{y(null),m(!0)},"aria-label":l("publishedApps.card.delete",{name:t.title}),title:l("common.delete"),children:e.jsx(P,{size:15})})]})]}),x&&e.jsxs("p",{role:"alert",className:"text-[12px] leading-snug text-danger",children:[x.text," ",x.manageUrl&&e.jsx("button",{type:"button",className:"font-medium underline underline-offset-2",onClick:()=>n(x.manageUrl),children:l("publishedApps.card.manage")})]})]}),e.jsx(_,{open:j,title:l("publishedApps.delete.title",{name:t.title}),body:l("publishedApps.delete.body"),confirmLabel:l("common.delete"),pending:h,onCancel:()=>{h||m(!1)},onConfirm:()=>{r()}})]})}const v={gone:"publishedApps.delete.failed",failed:"publishedApps.delete.failed",forbidden:"publishedApps.delete.forbidden",no_token:"publishedApps.delete.noToken",token_refused:"publishedApps.delete.tokenRefused"};function C(t,n){const i=n.bots.find(d=>d.id===t.bot.id),u=d=>d.threadId===t.threadId||(d.tasks??[]).some(g=>g.threadId===t.threadId);if(i&&t.threadId&&u(i))return{type:"switchTask",botId:i.id,threadId:t.threadId};const c=t.threadId?n.groups.find(u):void 0;return c?{type:"select",id:c.id}:i?{type:"select",id:i.id}:null}function oe(){const{state:t,dispatch:n}=z(),[i,u]=o.useState(null),[c,d]=o.useState(),[g,j]=o.useState(!1),m=o.useRef(null),h=o.useRef(null),p=o.useCallback(async()=>{h.current?.abort();const s=new AbortController;h.current=s;try{const a=await N("/api/published-apps",{signal:s.signal});if(s.signal.aborted)return;R(a.apps),u(a.apps),d(a.included),j(!1)}catch{s.signal.aborted||j(!0)}},[]);o.useEffect(()=>(p(),()=>h.current?.abort()),[p]),o.useEffect(()=>{m.current?.focus({preventScroll:!0})},[]);const x=s=>{I(s).catch(()=>{})},y=s=>{const a=C(s,t);return a&&n(a),a!==null},k=s=>{y(s)||n({type:"showChat"}),$(n,{url:s.url,title:s.title,...s.access==="netlify-team"?{loginOnly:!0}:{}})},f=async s=>{try{await N("/api/published-apps/delete",{method:"POST",body:JSON.stringify({id:s.id})})}catch(a){const r=a instanceof D?a.body:void 0,b=typeof r?.code=="string"&&Object.hasOwn(v,r.code)?r.code:"failed";if(b!=="gone")return{text:l(v[b]),...typeof r?.manageUrl=="string"&&r.manageUrl===s.manageUrl?{manageUrl:s.manageUrl}:{}}}return u(a=>a?.filter(r=>r.id!==s.id)??a),p(),null};return e.jsxs(B,{label:l("publishedApps.title"),children:[e.jsx(F,{backLabel:l("automations.back"),onBack:()=>n({type:"showChat"}),backRef:m,children:e.jsx("h1",{className:M,children:l("publishedApps.title")})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-published-apps":i?i.length:"loading",children:e.jsxs("div",{className:"mx-auto w-full max-w-5xl p-4 sm:p-6",children:[i&&c&&e.jsx("p",{"data-included-apps":`${c.used}/${c.max}`,className:"mb-3 text-[13px] text-ink-secondary",children:l("publishedApps.included.used",c)}),g&&!i?e.jsxs("section",{role:"alert",className:"px-6 py-16 text-center",children:[e.jsx("p",{className:"text-[14px] text-ink-secondary",children:l("publishedApps.loadFailed")}),e.jsx("button",{type:"button",className:"ui-button mt-4",onClick:()=>{p()},children:l("common.tryAgain")})]}):i&&i.length===0?e.jsxs("section",{"aria-label":l("publishedApps.empty.title"),className:"px-6 py-16 text-center",children:[e.jsx(E,{state:"sleep",size:96,className:"mx-auto mb-2"}),e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:l("publishedApps.empty.title")}),e.jsx("p",{className:"mx-auto mt-2 max-w-sm text-[14px] leading-relaxed text-ink-secondary",children:l("publishedApps.empty.body")})]}):i?e.jsx("ul",{"aria-label":l("publishedApps.title"),className:"grid grid-cols-[repeat(auto-fill,minmax(min(340px,100%),1fr))] gap-4",children:i.map(s=>e.jsx(X,{app:s,onOpen:x,onPreview:()=>k(s),onAsk:s.bot.name&&C(s,t)?()=>{y(s)}:void 0,onDelete:()=>f(s)},s.id))}):null]})})]})}export{oe as PublishedAppsPage,C as chatFor};
|
package/dist/assets/{RemoteAgentSettingsPanel-vgrEf5B7.js → RemoteAgentSettingsPanel-B7QJizjx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e,C as w,t as n,X as C,a as S}from"./styles-
|
|
1
|
+
import{r,j as e,C as w,t as n,X as C,a as S}from"./styles-3g-ZPS7M.js";import{u as A,I as z,T,B as p,V as L,f as P,S as B,i as E,g as I}from"./App-h8WTNY4l.js";import{u as R,B as F,L as U,b as V}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";function Q({bot:t,overlay:b=!1}){const{dispatch:f}=A(),{dragProps:k}=R(),[x,g]=r.useState(!1),[h,l]=r.useState(""),[v,j]=r.useState(!1),d=r.useRef(null),o=r.useRef(null),c=r.useRef(null),y=()=>f({type:"toggleSettings",open:!1}),i=a=>{if(o.current={...o.current,...a},c.current)return c.current;g(!0),l("");const s=async()=>{for(;o.current;){const u=o.current;o.current=null,l("");try{const m=await I(`/api/bots/${t.id}/profile`,{method:"PATCH",body:JSON.stringify(u)});f({type:"botPatched",bot:m.bot})}catch(m){l(m instanceof Error?m.message:n("remoteAgent.updateFailed"))}}};return c.current=s().finally(()=>{c.current=null,g(!1)}),c.current},N=async a=>{if(a){j(!0),l("");try{const s=await E(a),u=s?V(s.path):null;if(!u)throw new Error(n("settings.profile.avatar.invalidType"));await i({avatarUrl:u,avatarCrop:t.avatarCrop==="square"?"square":"circle"})}catch(s){l(s instanceof Error?s.message:String(s))}finally{j(!1),d.current&&(d.current.value="")}}};return e.jsxs("aside",{className:S("animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel",b?"md:left-auto md:w-[400px] md:shadow-2xl":"md:relative md:z-20 md:w-[400px] md:shrink-0"),children:[e.jsxs("div",{...k,className:"flex items-center justify-between px-4 py-3",children:[e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.collapse"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(w,{size:18})}),e.jsx("span",{className:"text-[15px] font-semibold text-ink",children:n("remoteAgent.title")}),e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.close"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(C,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:e.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(F,{bot:t,state:"idle",size:64,motion:"none",motionKey:0,animated:!1}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:d,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:a=>{N(a.target.files?.[0])}}),e.jsxs("button",{type:"button",disabled:v||x,onClick:()=>d.current?.click(),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[v?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(z,{size:14})," ",n("botIdentity.avatar")]}),t.avatarUrl&&e.jsx("button",{type:"button",disabled:x,onClick:()=>{i({avatarUrl:null,avatarCrop:"mascot"})},"aria-label":n("remoteAgent.removeAvatar"),className:"flex size-9 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(T,{size:14})})]})]}),e.jsxs("label",{className:"block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.name"),e.jsx("input",{defaultValue:t.name,maxLength:p.name,onBlur:a=>{const s=a.currentTarget.value.trim();s&&s!==t.name&&i({name:s})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.title"),e.jsx("input",{defaultValue:t.title??"",maxLength:p.title,onBlur:a=>{a.currentTarget.value!==(t.title??"")&&i({title:a.currentTarget.value})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("remoteAgent.description"),e.jsx("textarea",{defaultValue:t.description??"",maxLength:p.description,rows:4,onBlur:a=>{a.currentTarget.value!==(t.description??"")&&i({description:a.currentTarget.value})},className:"mt-1 w-full resize-y rounded-lg bg-inset px-3 py-2 text-[13px] leading-relaxed text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]})]}),e.jsx(L,{bot:t,workspaceConfigurationLocked:!0,onPatch:a=>{i(a)}}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(P,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("notifications.title")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteAgent.notificationsHint")})]})]}),e.jsx(B,{checked:t.notifications,disabled:x,"aria-label":n("remoteAgent.notifications"),onClick:()=>{i({notifications:!t.notifications})}})]}),h?e.jsx("div",{role:"alert",className:"text-[12px] text-danger",children:h}):null]})})]})}export{Q as RemoteAgentSettingsPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as d,j as e,t as n,a as y,N as W,X as Y}from"./styles-
|
|
1
|
+
import{r as d,j as e,t as n,a as y,N as W,X as Y}from"./styles-3g-ZPS7M.js";import{T as J,B as w,u as V,r as X}from"./PlacesRail-Df-jNTHn.js";import{bf as _,bg as Z,bh as R,bi as ee,a7 as te,bj as C,bk as F,bl as se,bm as N,bn as k,bo as O,bp as A,bq as E,br as ne,d as K,bs as ae,bt as T,bu as oe,bv as re,bc as le,u as P,bw as ie,bx as ce,by as de,bz as ue,bA as M,bB as pe,bC as me,bD as xe,bE as fe,bF as B,bG as he,bH as be,bI as je,bJ as ge,bK as ke}from"./App-h8WTNY4l.js";import{C as $}from"./MenuMotion-CHp-hB40.js";import"./placement-BKtVnQht.js";import"./monitor-DMPjQDZP.js";import"./index-DtDQrExn.js";function H({group:s}){const t=_(s),o=d.useRef(null),l=d.useRef(!1);d.useEffect(()=>{t.open||!l.current||(l.current=!1,o.current?.focus())},[t.open]);const u=r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation()),(r.key==="Escape"||r.key==="Enter"&&(r.metaKey||r.ctrlKey))&&(l.current=!0),t.onKeyDown(r)};if(t.open)return e.jsxs(Z,{"data-panel-row":"instructions",children:[e.jsx(R,{title:n("room.panel.instructions")}),e.jsx("textarea",{autoFocus:!0,dir:"auto","aria-label":n("room.panel.instructions"),value:t.draft,onChange:r=>t.setDraft(r.target.value),onBlur:t.save,onKeyDown:u,placeholder:n("room.bulletin.placeholder"),rows:6,className:"w-full resize-y rounded-lg border border-hairline bg-inset px-2.5 py-2 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent-border"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-panel-done":"instructions",onMouseDown:r=>r.preventDefault(),onClick:()=>{l.current=!0,t.save()},className:ee,children:n("botSettings.simple.done")})})]});const i=s.bulletin.split(`
|
|
2
2
|
`)[0]?.trim();return e.jsxs("button",{ref:o,type:"button","data-panel-edit":"instructions","aria-label":`${n("botSettings.simple.edit")}: ${n("room.panel.instructions")}`,onClick:t.start,className:y(C,"w-full text-left hover:bg-ink/[0.03]"),children:[e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-ink/[0.05] text-ink-secondary max-md:size-8 max-md:rounded-full","aria-hidden":"true",children:e.jsx(te,{size:15})}),e.jsx(R,{title:n("room.panel.instructions"),hint:e.jsx("span",{dir:"auto",className:"line-clamp-1",children:i||n("room.panel.instructionsHint")})}),e.jsx($,{size:15,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]})}function ye({group:s,members:t}){const[o,l]=t;return e.jsxs("div",{className:"flex items-center gap-3.5 px-1",children:[e.jsxs("div",{"data-room-panel-faces":!0,className:"relative size-14 shrink-0",children:[o&&e.jsx("span",{className:"absolute start-0 top-0 flex rounded-full",children:e.jsx(w,{bot:o,state:"happy",size:36,animated:!1})}),l&&e.jsx("span",{className:"absolute bottom-0 end-0 flex rounded-full ring-2 ring-panel",children:e.jsx(w,{bot:l,state:"happy",size:36,animated:!1})})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{id:"room-panel-title",className:"truncate text-[17px] font-semibold leading-[22px] text-ink",children:s.name}),e.jsx("p",{className:"text-[13px] text-ink-secondary",children:n(t.length===1?"room.panel.botsAndYouOne":"room.panel.botsAndYouMany",{count:t.length})})]})]})}const q={message:{Icon:le,label:"botPanel.quick.message"},addBot:{Icon:re,label:"room.panel.addBot"},settings:{Icon:oe,label:"botPanel.quick.settings"}};function we({onAction:s}){return e.jsx("div",{"data-panel-quick":!0,className:"mt-4 grid w-full grid-cols-3 gap-1.5",children:Object.keys(q).map(t=>{const{Icon:o,label:l}=q[t];return e.jsxs("button",{type:"button","data-panel-quick-action":t,onClick:()=>s(t),className:"flex h-16 min-w-0 flex-col items-center justify-center gap-1.5 rounded-xl bg-ink/[0.04] px-1 text-[12px] leading-4 text-ink-secondary transition-colors hover:bg-ink/[0.08] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",children:[e.jsx(o,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink"}),e.jsx("span",{className:"max-w-full truncate",children:n(l)})]},t)})})}function Ne(s,t){const o=T(s,t);return o.kind==="member"?o.botId:o.kind==="auto"?o.fallbackBotId:void 0}function ve({group:s,member:t,lead:o}){const{dispatch:l}=P(),u=s.busyBotId===t.id,i=!!s.holds?.[t.id],r=n("chat.chiefOfStaff"),p=t.title.trim()||(t.chiefOfStaff?r:"");return e.jsxs("button",{type:"button","data-panel-member":t.id,title:i?n("room.holds.avatarHeld",{name:t.name}):u?`${t.name} — ${n("room.member.working")}`:void 0,"aria-label":n("chat.openProfileAria",{name:t.name}),onClick:()=>l({type:"toggleSettings",open:!0,botId:t.id}),className:y(C,"h-11 min-h-0 w-full py-0 text-left hover:bg-ink/[0.03]"),children:[e.jsxs("span",{className:"relative flex shrink-0",children:[e.jsx(w,{bot:t,state:"happy",size:24,animated:!1}),(u||i)&&e.jsx("span",{"data-member-status":u?"working":"held","aria-hidden":"true",className:y("absolute -bottom-0.5 -end-0.5 size-2.5 rounded-full ring-2 ring-panel",u?"bg-success":"bg-warning")})]}),e.jsx("span",{dir:"auto",className:"min-w-0 truncate text-[14px] text-ink",children:t.name}),o&&e.jsxs("span",{title:n("room.panel.lead"),className:"flex shrink-0 text-warning",children:[e.jsx(ie,{size:13,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:n("room.panel.lead")})]}),e.jsx("span",{className:"min-w-0 flex-1"}),p&&e.jsx("span",{dir:"auto",className:"min-w-0 max-w-[170px] truncate text-[13px] text-ink-tertiary",children:p}),e.jsx($,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-tertiary rtl:-scale-x-100"})]})}function Re({group:s,members:t,settingsRef:o,onMessage:l,onAddBot:u,onSettings:i,onOpenPage:r}){const p=Ne(s,t),x=F(s),m=se(s.usage),f=a=>(a==="message"?l:a==="addBot"?u:i)();return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-3.5",children:e.jsx(ye,{group:s,members:t})}),e.jsx(we,{onAction:f}),e.jsx(N,{label:n("room.panel.members"),anchor:"members",children:t.map(a=>e.jsx(ve,{group:s,member:a,lead:a.id===p},a.id))}),e.jsx("div",{ref:o,"data-panel-settings":!0,className:"scroll-mt-2",children:e.jsxs(N,{label:n("botPanel.quick.settings"),anchor:"settings",children:[e.jsx(k,{"data-panel-page":"responder",icon:O,title:n("room.panel.whoResponds"),value:A(s,t),onClick:()=>r("responder")}),e.jsxs("div",{"data-panel-row":"turn-limit",className:C,children:[e.jsx(E,{icon:J}),e.jsx(R,{title:n("room.panel.turnLimit")}),e.jsx(ne,{group:s})]}),e.jsx(k,{"data-panel-page":"folder",icon:K,title:n("room.folder.title"),value:x?.name??n("room.panel.folder.own"),tooltip:x?.path,onClick:()=>r("folder")}),e.jsx(H,{group:s}),m&&e.jsxs("div",{"data-panel-row":"usage",className:C,children:[e.jsx(E,{icon:ae}),e.jsx(R,{title:n("chat.usage.menu")}),e.jsx("span",{title:m.title,tabIndex:0,"data-testid":"group-usage-chip",className:"text-[13px] tabular-nums text-ink-secondary",children:m.short})]})]})})]})}const Ce=["1","2","3","4","5"];function Se({group:s,members:t}){const{state:o,dispatch:l}=P(),u=ce(o.config),i=T(s,t),r=de(i),p=a=>{a!==r&&l({type:"patchGroup",groupId:s.id,patch:{defaultResponder:me(a,i)}})},x=[{choice:"auto",title:n("room.panel.responder.autoOption"),hint:u?void 0:n("room.responder.autoOff",{name:ue(s,t)??n("room.responder.leadFallback")})},{choice:"everyone",title:n("room.panel.responder.everyone")},{choice:"mentions",title:n("room.panel.responder.mentions")}],m=String(s.turnsPerMember??1),f=a=>{a!==m&&l({type:"patchGroup",groupId:s.id,patch:{turnsPerMember:Number(a)}})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"radiogroup","aria-label":n("room.panel.whoResponds"),children:e.jsxs(N,{children:[t.map(a=>e.jsx(M,{"data-panel-choice":`member:${a.id}`,title:e.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(w,{bot:a,state:W(a.mascotExpression)??"happy",size:22,animated:!1}),e.jsx("span",{className:"truncate",children:a.name})]}),checked:r===`member:${a.id}`,onClick:()=>p(`member:${a.id}`)},a.id)),x.map(({choice:a,title:b,hint:h})=>e.jsx(M,{"data-panel-choice":a,title:b,hint:h,checked:r===a,onClick:()=>p(a)},a))]})}),e.jsx(N,{children:e.jsx(pe,{attr:"data-panel-turns",title:n("room.panel.turns.title"),hint:n("room.panel.turns.hint"),label:n("room.panel.turns.title"),options:Ce.map(a=>({value:a,label:a})),value:m,onChange:f})})]})}const D={responder:{title:"room.panel.whoResponds",intro:"room.panel.responder.intro"},folder:{title:"room.folder.title",intro:"room.folder.detail"}};function Pe({group:s,members:t}){return e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{"data-room-panel-faces":!0,className:"mt-0.5 flex",children:t.slice(0,3).map((o,l)=>e.jsx("span",{className:y("rounded-full ring-[3px] ring-app",l>0&&"-ms-4"),children:e.jsx(w,{bot:o,state:"happy",size:56,animated:!1})},o.id))}),e.jsx("h2",{id:"room-panel-title",className:"mt-2.5 max-w-full truncate px-1.5 text-[18px] font-semibold text-ink",children:s.name}),s.description&&e.jsx("p",{className:"mt-px line-clamp-2 max-w-full text-[13px] text-ink-secondary",children:s.description})]})}function Fe({group:s,overlay:t=!1,advanced:o=!1}){const{state:l}=P(),{dragProps:u}=V(),[i,r]=d.useState(null),[p,x]=d.useState(!1),m=d.useRef(null),f=d.useRef(null),a=d.useRef(null),b=d.useRef(null),h=d.useRef(null),j=d.useMemo(()=>s.memberIds.map(c=>l.bots.find(v=>v.id===c)).filter(c=>!!c),[s.memberIds,l.bots]),I=F(s),L=d.useCallback(()=>x(!1),[]),S=c=>{r(c),f.current?.scrollTo({top:0})},z=()=>{h.current=i,r(null)},G=()=>requestAnimationFrame(()=>document.querySelector('[data-tour="composer"] textarea')?.focus()),U=()=>{b.current?.scrollIntoView({block:"start"}),b.current?.querySelector("button, select, input")?.focus()};d.useEffect(()=>{i!==null?f.current?.querySelector("[data-panel-back]")?.focus():h.current&&(f.current?.querySelector(`[data-panel-page="${h.current}"]`)?.focus(),h.current=null)},[i]),d.useEffect(()=>{const c=m.current;c?.focus();const v=g=>{g.key!=="Escape"||g.defaultPrevented||c&&g.target instanceof Node&&!c.contains(g.target)||(g.preventDefault(),B({refocus:!0}))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]);const Q=c=>{c.key!=="Escape"||c.defaultPrevented||i===null||(c.preventDefault(),c.stopPropagation(),z())};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{ref:m,role:"dialog","aria-labelledby":"room-panel-title",tabIndex:-1,"data-room-panel":!0,onKeyDown:Q,className:ge(t,!o),children:[e.jsxs("div",{...u,className:"flex h-[52px] shrink-0 items-center justify-end gap-1.5 px-3",children:[!o&&e.jsx(xe,{group:s}),e.jsx("button",{type:"button",onClick:()=>B({refocus:!0}),"aria-label":n("botSettings.simple.close"),className:fe,children:e.jsx(Y,{size:16,className:"pointer-events-none"})})]}),e.jsx("div",{ref:f,className:y("@container relative min-h-0 flex-1 overflow-y-auto pb-7",o?"px-4":"px-5"),children:i===null&&o?e.jsx(Re,{group:s,members:j,settingsRef:b,onMessage:G,onAddBot:()=>x(!0),onSettings:U,onOpenPage:S}):i===null?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{group:s,members:j}),e.jsxs(N,{children:[e.jsx(k,{"data-panel-page":"responder",icon:O,title:n("room.panel.whoResponds"),value:A(s,j),onClick:()=>S("responder")}),e.jsx(k,{"data-panel-page":"folder",icon:K,title:n("room.folder.title"),value:I?.name??n("room.panel.folder.own"),tooltip:I?.path,onClick:()=>S("folder")}),e.jsx(H,{group:s}),e.jsx(k,{ref:a,"data-panel-row":"members",icon:he,title:n("room.panel.members"),value:String(j.length),onClick:()=>x(!0)})]})]}):e.jsxs("div",{"data-panel-page-view":i,children:[e.jsx("span",{id:"room-panel-title",className:"sr-only",children:s.name}),e.jsx(be,{back:s.name,title:n(D[i].title),intro:n(D[i].intro),onBack:z}),e.jsx("div",{className:"mt-4 flex flex-col gap-3",children:i==="responder"?e.jsx(Se,{group:s,members:j}):e.jsx(je,{group:s,heading:!1})})]})})]}),p&&X.createPortal(e.jsx(ke,{group:s,onClose:L,triggerRef:a}),document.body)]})}export{Fe as RoomPanel};
|