@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
|
@@ -1545,7 +1545,9 @@ strict()]).superRefine((value,ctx)=>{if(value.type==="cron")try{normalizeCronSch
|
|
|
1545
1545
|
string().trim().min(1).max(80),prompt:external_exports.string().trim().min(1).max(2e4),schedule:scheduleSchema,enabled:external_exports.boolean().optional(),runOn:external_exports.enum(["maus","cloud"]).optional(),durationMinutes:external_exports.number().int().min(5).max(240).optional(),timeoutMinutes:external_exports.number().min(1).max(1440).nullable().optional(),overlap:external_exports.enum(["skip","queue"]).optional(),attachments:external_exports.array(external_exports.object({id:external_exports.
|
|
1546
1546
|
string().min(1).max(200),kind:external_exports.enum(["file","image"]),name:external_exports.string().min(1).max(255),path:external_exports.string().min(1).max(4096),size:external_exports.number().nonnegative()}).strict()).max(50).optional()}).strict(),botSkillTemplateSchema=external_exports.object({name:external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),description:external_exports.string().max(1024),warnings:strings(100,2e3).default([]),source:external_exports.string().min(1).
|
|
1547
1547
|
max(2e3),text:external_exports.string().refine(value=>Buffer.byteLength(value,"utf8")<=262144,"Skill exceeds 256 KiB"),enabled:external_exports.boolean()}).strict(),newBotDefaultsSchema=external_exports.object({profile:botDefaultsProfileSchema.default({}),memory:external_exports.record(external_exports.string().regex(/^(?:MEMORY\.md|memory\/[a-zA-Z0-9_-]+\.md)$/),external_exports.string().refine(value=>Buffer.byteLength(value,"utf8")<=262144,"Memory file exceeds 256 KiB")).refine(value=>Object.keys(
|
|
1548
|
-
value).length<=100,"At most 100 memory files").default({}),skills:external_exports.array(botSkillTemplateSchema).max(100).default([]),routines:external_exports.array(botRoutineTemplateSchema).max(100).default([])}).strict().refine(value=>Buffer.byteLength(JSON.stringify(value),"utf8")<=9e5,"Bot defaults must fit within 900 KB");var replaySettings={rebuildBytes:external_exports.number().int().min(1024).max(1e6).optional(),replayToolHistory:external_exports.boolean().optional()};var
|
|
1548
|
+
value).length<=100,"At most 100 memory files").default({}),skills:external_exports.array(botSkillTemplateSchema).max(100).default([]),routines:external_exports.array(botRoutineTemplateSchema).max(100).default([])}).strict().refine(value=>Buffer.byteLength(JSON.stringify(value),"utf8")<=9e5,"Bot defaults must fit within 900 KB");var replaySettings={rebuildBytes:external_exports.number().int().min(1024).max(1e6).optional(),replayToolHistory:external_exports.boolean().optional()};var defaultModelSelectionSchema=external_exports.object({instanceId:external_exports.string().trim().min(1).max(200),model:external_exports.string().trim().min(1).max(500),effort:external_exports.enum(EFFORT_LEVELS).optional(),variant:external_exports.string().refine(isModelVariant,"invalid model variant").optional()}).refine(selection=>selection.variant===void 0||selection.effort===void 0,"choose either a model variant or an effort level");var AI_POOL_LEVELS=[90,80,70,60,50,40,30,20,10],aiPoolSchema=external_exports.object({enabled:external_exports.boolean(),mode:external_exports.enum(["even","inOrder"]).default("even"),members:external_exports.array(defaultModelSelectionSchema).max(10).default([]),levels:external_exports.array(external_exports.number().int().min(1).max(99)).min(1).max(9).optional(),floor:external_exports.number().int().min(0).max(98).optional()}).strict().superRefine((pool,ctx)=>{let issue2=(message,path)=>ctx.addIssue(
|
|
1549
|
+
{code:"custom",message,path});pool.enabled&&pool.members.length<2&&issue2("Choose at least two AIs before you turn on the AI pool.",["members"]),new Set(pool.members.map(member=>member.instanceId)).size!==pool.members.length&&issue2("Each AI can join the pool once.",["members"]);let levels=pool.levels;levels?.some((level,index)=>index>0&&level>=levels[index-1])&&issue2("Each level must be lower than the one before it.",["levels"]),pool.floor!==void 0&&pool.floor>=(levels??AI_POOL_LEVELS).at(-1)&&
|
|
1550
|
+
issue2("The floor must be lower than the last level.",["floor"])});var OPENAI_API_INSTANCE="openai",OPENROUTER_API_INSTANCE="openrouter",XAI_API_INSTANCE="xaiApi",CLAUDE_API_INSTANCE="claudeApi",API_KEY_FLEET={[OPENAI_API_INSTANCE]:{driver:"openai-compat",displayName:"OpenAI",access:"api",icon:{kind:"preset",preset:"openai"},config:{url:"https://api.openai.com/v1",apiKeyEnv:"OMB_OPENAI_API_KEY",catalog:"openai"}},[CLAUDE_API_INSTANCE]:{driver:"claudeAgent",displayName:"Claude (API key)",access:"api",icon:{kind:"preset",preset:"anthropic"},config:{requireApiKey:!0}},
|
|
1549
1551
|
[XAI_API_INSTANCE]:{driver:"grok",displayName:"xAI",access:"api",icon:{kind:"preset",preset:"xai"}},[OPENROUTER_API_INSTANCE]:{driver:"openai-compat",displayName:"OpenRouter",access:"api",icon:{kind:"preset",preset:"openrouter"},config:{url:"https://openrouter.ai/api/v1",apiKeyEnv:"OMB_OPENROUTER_API_KEY"}}},DEFAULT_FLEET={grok:{driver:"grokAgent"},kimi:{driver:"kimiAgent"},droid:{driver:"droidAgent"},cursor:{driver:"cursorAgent"},githubCopilot:{driver:"copilotAgent"},commandCode:{driver:"comman\
|
|
1550
1552
|
dCodeAgent"},kiro:{driver:"kiroAgent"},devin:{driver:"devinAgent"},claude:{driver:"claudeAgent"},codex:{driver:"codex"},chatgpt:{driver:"codex",displayName:"ChatGPT plan",config:{authMode:"chatgpt-plan"}},antigravity:{driver:"antigravityAgent"},opencodeGo:{driver:"opencodeGo"},openaiCompat:{driver:"openai-compat"},mistral:{driver:"mistral"},mistralVibe:{driver:"mistralVibeAgent"},cerebras:{driver:"cerebras"},groq:{driver:"groq"},greenference:{driver:"greenference"},modelgo:{driver:"modelgo"},meta:{
|
|
1551
1553
|
driver:"meta"},deepseek:{driver:"deepseekAgent"},museCode:{driver:"museCode"},...API_KEY_FLEET,qwen:{driver:"qwenAgent"},hermes:{driver:"hermesAgent"},cline:{driver:"clineAgent"},pi:{driver:"piAgent"},omp:{driver:"ompAgent"}},CUSTOM_ONLY={qwen:{driver:"qwenAgent"},hermes:{driver:"hermesAgent"},cline:{driver:"clineAgent"},pi:{driver:"piAgent"},omp:{driver:"ompAgent"},mistralVibe:{driver:"mistralVibeAgent"}},PRODUCT_FLEET_ADDITIONS={chatgpt:{driver:"codex",displayName:"ChatGPT plan",config:{authMode:"\
|
|
@@ -1590,22 +1592,21 @@ boolean().optional(),claudeUserMcp:external_exports.boolean().optional(),claudeU
|
|
|
1590
1592
|
boolean().optional(),acpPlanLines:external_exports.boolean().optional()}).extend({agentsToolBridge:external_exports.boolean().optional(),savedSteps:external_exports.boolean().optional(),usbPhoneTakeover:external_exports.boolean().optional(),cloudComputerAutoReplace:external_exports.boolean().optional(),phonePush:external_exports.boolean().optional()}),onboardingConfigSchema=external_exports.object({completedAt:external_exports.string().trim().max(40).optional(),version:external_exports.number().
|
|
1591
1593
|
int().min(0).max(1e3).optional(),reelSeen:external_exports.boolean().optional(),hintsSeen:external_exports.array(external_exports.string().trim().min(1).max(60)).max(100).optional(),firstTurnAt:external_exports.string().trim().max(40).optional()}).strict(),instanceConfigSchema=external_exports.object({driver:external_exports.string().min(1),displayName:optionalText2,accentColor:optionalText2,icon:external_exports.discriminatedUnion("kind",[external_exports.object({kind:external_exports.literal("\
|
|
1592
1594
|
preset"),preset:external_exports.enum(PROVIDER_ICON_PRESETS)}).strict(),external_exports.object({kind:external_exports.literal("custom"),dataUrl:external_exports.string()}).strict().refine(icon=>providerIconError(icon)===null,{message:"Invalid provider icon"})]).optional(),environment:external_exports.record(external_exports.string(),external_exports.string()).optional(),enabled:external_exports.boolean().optional(),hidden:external_exports.boolean().optional(),access:external_exports.enum(["subs\
|
|
1593
|
-
cription","custom","api"]).optional(),config:external_exports.json().optional()}),instanceConfigMapSchema=external_exports.record(external_exports.string(),instanceConfigSchema),
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
object({
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
string().
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
omit({instances:!0,mcpServers:!0,cliStartup:!0,customDomain:!0}).extend({threads:threadsPatchSchema.optional(),newBots:newBotsPatchSchema.optional(),imageGen:imageGenPatchSchema.optional()}),CONFIG_PATCH_FIELDS=appConfigPatchSchema.shape,jsonObjectSchema2=external_exports.record(external_exports.string(),external_exports.json());function parseStoredConfig(value){let parsed=storedAppConfigSchema.safeParse(value);if(!parsed.success)throw new Error(schemaIssue(parsed.error,"Invalid stored configuration"));return parsed.data}var DEFAULT_CAPTURE_QUIET_MS=2*6e4;var DATA_DIR=process.env.OMB_DATA_DIR||join3(dataHome(),".openmausbot"),LEGACY_DATA_DIR=join3(dataHome(),".opengrokbot"),EVENTS_DIR=join3(DATA_DIR,"events"),NATIVE_DIR=join3(DATA_DIR,"native");var storedConfig=settledFileCache(()=>join3(DATA_DIR,"config.json"),()=>parseStoredConfig(parseJson(readFileSync6(join3(DATA_DIR,"config.json"),"utf8"))));var SECRET_FOLDER=".openmausbot-secrets";function inSecretFolder(path){return path.split(/[\\/]/).includes(SECRET_FOLDER)}var PORTABLE_CONFIG_KEYS=["profile","language","budgets","billing","rooms","threads","localVm","features","browserProfiles"];function portableWorkspaceConfig(value){if(!value||typeof value!="object"||Array.isArray(value))throw new Error("Invalid workspace configuration in backup.");let config2=parseStoredConfig(value);return Object.fromEntries(PORTABLE_CONFIG_KEYS.filter(key=>config2[key]!==void 0).map(key=>[key,config2[key]]))}function excludedWorkspaceAuthPath(path){return inSecretFolder(path)||/^command-allowlist\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^mcp-oauth\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^(?:logins\.json\.enc|member-secrets\.json\.enc|logins-key|webhook-key)(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^connected-apps-installation\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^team-policy\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^people-connections(?:\/|$)/.test(path)||/^config\.json\.(?:bak\.\d{8}-\d{6}(?:-\d+)?|unreadable-[0-9a-f]{12})(?:\.\d+\.[0-9a-f-]+\.tmp)?$/.
|
|
1595
|
+
cription","custom","api"]).optional(),config:external_exports.json().optional()}),instanceConfigMapSchema=external_exports.record(external_exports.string(),instanceConfigSchema),automaticRecoverySchema=external_exports.object({enabled:external_exports.boolean(),backup:defaultModelSelectionSchema.optional()}).strict().refine(recovery=>!recovery.enabled||recovery.backup!==void 0,{message:"Choose a backup model before enabling automatic recovery",path:["backup"]}),cacheKeepWarmSchema=external_exports.
|
|
1596
|
+
object({enabled:external_exports.boolean(),windowMinutes:external_exports.number().int().min(15).max(1440).optional()}).strict(),threadsConfigSchema=external_exports.object({maxConcurrentPerBot:external_exports.number().int().min(1).max(MAX_CONCURRENT_BOT_THREADS),eventLogMaxBytes:external_exports.number().int().min(MIN_THREAD_EVENT_LOG_BYTES).max(MAX_THREAD_EVENT_LOG_BYTES).optional(),eventLogRetentionDays:external_exports.number().int().min(1).max(3650).optional()}).strict(),newBotsConfigSchema=external_exports.
|
|
1597
|
+
object({effort:external_exports.enum(EFFORT_LEVELS).optional()}).strict(),newBotsPatchSchema=external_exports.object({effort:newBotsConfigSchema.shape.effort.nullable()}).strict(),threadsPatchSchema=threadsConfigSchema.extend({maxConcurrentPerBot:threadsConfigSchema.shape.maxConcurrentPerBot.optional(),eventLogMaxBytes:threadsConfigSchema.shape.eventLogMaxBytes.nullable(),eventLogRetentionDays:threadsConfigSchema.shape.eventLogRetentionDays.nullable()}),appConfigSchema=external_exports.object({customDomain:external_exports.
|
|
1598
|
+
string().optional(),signIn:external_exports.object({admins:external_exports.array(external_exports.string().max(320)).max(500).optional(),members:external_exports.array(external_exports.string().max(320)).max(5e3).optional()}).optional(),defaultModelSelection:defaultModelSelectionSchema.optional(),automaticRecovery:automaticRecoverySchema.optional(),aiPool:aiPoolSchema.optional(),cacheKeepWarm:cacheKeepWarmSchema.optional(),newBotDefaults:newBotDefaultsSchema.optional(),newBots:newBotsConfigSchema.
|
|
1599
|
+
optional(),cliStartup:external_exports.object({access:external_exports.enum(["local","tunnel","tailscale","public-url"]),publicUrl:external_exports.string().url().optional(),phone:external_exports.enum(["ios","android"]).optional()}).optional(),mistral:external_exports.object({key:optionalText2}).optional(),cerebras:external_exports.object({key:optionalText2}).optional(),treg:external_exports.object({key:optionalText2}).optional(),postiz:external_exports.object({key:optionalText2,url:optionalText2}).
|
|
1600
|
+
optional(),groq:external_exports.object({key:optionalText2,url:optionalText2}).optional(),greenference:external_exports.object({key:optionalText2}).optional(),modelgo:external_exports.object({key:optionalText2}).optional(),meta:external_exports.object({key:optionalText2,url:optionalText2}).optional(),deepseek:external_exports.object({key:optionalText2}).optional(),xai:external_exports.object({key:optionalText2,url:optionalText2}).optional(),anthropic:external_exports.object({key:optionalText2,url:optionalText2,
|
|
1601
|
+
everyClaudeBot:external_exports.boolean().optional()}).optional(),openai:external_exports.object({key:optionalText2}).optional(),openrouter:external_exports.object({key:optionalText2}).optional(),budgets:external_exports.object({monthlyUsd:external_exports.number().min(0).max(1e6).optional(),warnAtPercent:external_exports.number().int().min(1).max(100).optional()}).optional(),usageCaps:usageCapsSchema.optional(),billing:external_exports.object({currency:external_exports.string().regex(/^[A-Z]{3}$/).
|
|
1602
|
+
optional(),prices:external_exports.record(external_exports.string().min(1).max(160),external_exports.object({inputPerMillion:external_exports.number().min(0).max(1e6),outputPerMillion:external_exports.number().min(0).max(1e6),cachedInputPerMillion:external_exports.number().min(0).max(1e6).optional()})).optional()}).optional(),openaiCompat:external_exports.object({key:optionalText2,url:optionalText2,model:optionalText2,provider:optionalText2}).optional(),composio:external_exports.object({apiKey:optionalText2,
|
|
1603
|
+
userId:optionalText2,sessionId:optionalText2}).optional(),box:external_exports.object({token:optionalText2}).optional(),vps:vpsConfigSchema.optional(),opencodeGo:external_exports.object({apiKey:optionalText2,providerKeys:external_exports.record(external_exports.string(),external_exports.string()).optional()}).optional(),tts:external_exports.object({key:optionalText2,fishKey:optionalText2,geminiKey:optionalText2,voice:optionalText2,provider:external_exports.enum(["elevenlabs","fish","system","cha\
|
|
1604
|
+
tterbox","xai","gemini","openai","deepseek"]).optional(),baseUrl:external_exports.string().trim().max(2048).refine(value=>!value||/^https?:\/\//i.test(value),"the Chatterbox server address must start with http:// or https://").optional(),model:optionalText2,fishModel:external_exports.enum(FISH_TTS_MODELS).optional(),everyReply:external_exports.boolean().optional()}).optional(),decider:deciderConfigSchema.optional(),live:liveConfigSchema.optional(),imageGen:imageGenConfigSchema.optional(),everyBotRules:external_exports.
|
|
1605
|
+
string().max(24e3).optional(),profile:external_exports.object({name:optionalText2,email:optionalText2,aboutMe:external_exports.string().max(24e3).optional(),avatarUrl:external_exports.union([external_exports.literal(""),botAvatarUrlSchema]).optional()}).optional(),language:optionalText2,computerName:external_exports.string().trim().max(63).optional(),rooms:roomConfigSchema.optional(),mcp:mcpConfigSchema.optional(),context:external_exports.object({compactAt:external_exports.number().positive().max(
|
|
1606
|
+
1e7).optional(),autoCompact:external_exports.boolean().optional()}).extend(roomContextSettings).extend(replaySettings).optional(),memory:external_exports.object({captureQuietMs:external_exports.number().int().min(1e3).max(1440*6e4).optional(),tidyHour:external_exports.number().int().min(0).max(23).optional()}).strict().optional(),threads:threadsConfigSchema.optional(),burst:external_exports.object({maxParallel:external_exports.number().int().min(1).max(100).optional()}).strict().optional(),decisions:external_exports.
|
|
1607
|
+
object({retentionDays:external_exports.number().int().min(1).max(3650).optional()}).strict().optional(),loopGuard:loopGuardConfigSchema.optional(),safetyFloor:external_exports.object({enabled:external_exports.boolean().optional()}).strict().optional(),localVm:localVmConfigSchema.optional(),features:featureConfigSchema.optional(),onboarding:onboardingConfigSchema.optional(),browserEngine:browserEngineConfigSchema.optional(),browserProfiles:browserProfilesSchema.optional(),instances:instanceConfigMapSchema.
|
|
1608
|
+
optional(),mcpServers:external_exports.record(external_exports.string(),external_exports.unknown()).optional()}),storedAppConfigSchema=appConfigSchema.extend(helperStoredShape).extend({browserProfiles:storedBrowserProfilesSchema.optional(),opencodeGo:external_exports.object({apiKey:optionalText2,providerKeys:external_exports.record(external_exports.string(),external_exports.unknown()).catch({}).transform(keys=>Object.fromEntries(Object.entries(keys).filter(entry=>typeof entry[1]=="string"))).optional()}).
|
|
1609
|
+
optional()}),appConfigPatchSchema=appConfigSchema.omit({instances:!0,mcpServers:!0,cliStartup:!0,customDomain:!0}).extend({threads:threadsPatchSchema.optional(),newBots:newBotsPatchSchema.optional(),imageGen:imageGenPatchSchema.optional()}),CONFIG_PATCH_FIELDS=appConfigPatchSchema.shape,jsonObjectSchema2=external_exports.record(external_exports.string(),external_exports.json());function parseStoredConfig(value){let parsed=storedAppConfigSchema.safeParse(value);if(!parsed.success)throw new Error(schemaIssue(parsed.error,"Invalid stored configuration"));return parsed.data}var DEFAULT_CAPTURE_QUIET_MS=2*6e4;var DATA_DIR=process.env.OMB_DATA_DIR||join3(dataHome(),".openmausbot"),LEGACY_DATA_DIR=join3(dataHome(),".opengrokbot"),EVENTS_DIR=join3(DATA_DIR,"events"),NATIVE_DIR=join3(DATA_DIR,"native");var storedConfig=settledFileCache(()=>join3(DATA_DIR,"config.json"),()=>parseStoredConfig(parseJson(readFileSync6(join3(DATA_DIR,"config.json"),"utf8"))));var SECRET_FOLDER=".openmausbot-secrets";function inSecretFolder(path){return path.split(/[\\/]/).includes(SECRET_FOLDER)}var PORTABLE_CONFIG_KEYS=["profile","language","budgets","billing","rooms","threads","localVm","features","browserProfiles"];function portableWorkspaceConfig(value){if(!value||typeof value!="object"||Array.isArray(value))throw new Error("Invalid workspace configuration in backup.");let config2=parseStoredConfig(value);return Object.fromEntries(PORTABLE_CONFIG_KEYS.filter(key=>config2[key]!==void 0).map(key=>[key,config2[key]]))}function excludedWorkspaceAuthPath(path){return inSecretFolder(path)||/^command-allowlist\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^mcp-oauth\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^(?:logins\.json\.enc|member-secrets\.json\.enc|logins-key|webhook-key)(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^connected-apps-installation\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^team-policy\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^people-connections(?:\/|$)/.test(path)||/^config\.json\.(?:bak\.\d{8}-\d{6}(?:-\d+)?|unreadable-[0-9a-f]{12})(?:\.\d+\.[0-9a-f-]+\.tmp)?$/.
|
|
1609
1610
|
test(path)?!0:/^(?:(?:providers|caddy|chrome-profile|\.agent-browser)(?:\/|$)|workspace-credentials\.json$|external-runtimes\.json$|browser-engine-key$)/.test(path)||/^(?:config\.json|webhooks\.json|workspace-credentials\.json|external-runtimes\.json|browser-engine-key|sessions\.json|tunnel-account\.json)\.\d+(?:\.[0-9a-f-]+)?\.tmp$/.test(path)||/^(?:vm-home|vm-homes\/[^/]+)\/\.browser-profiles(?:\/|$)/.test(path)}function redownloadedOrgLibraryPath(path){return/^org-library\/(?:catalog\.json(?:\.[0-9a-f-]{36}\.tmp)?$|blobs(?:\/|$))/.
|
|
1610
1611
|
test(path)}function ephemeralWorkspaceTokenPath(path){return/^(?:hook-tokens(?:\/|$)|sessions\.json\.open$)/.test(path)}function liveDataEnginePath(path){return/^bots\/[^/]+\/(?:data\.duckdb(?:\.wal)?$|data-tmp(?:\/|$))/.test(path)}function managedTaskSkillLink(source,path,roots){let match=/^task-workspaces\/([^/]+)\/[^/]+\/\.(?:claude|agents|grok)\/skills\/([^/]+)$/.exec(path);if(!match)return!1;let target;try{target=resolve(dirname(source),readlinkSync(source).replace(/^\\\\\?\\/,""))}catch{return!1}
|
|
1611
1612
|
return roots.some(root=>{let rel=relative(join4(root,"workspaces",match[1],"skills"),target);return rel!==""&&!rel.startsWith("..")&&!isAbsolute2(rel)||relative(join4(root,"imported-skills",match[2]),target)===""})}import{existsSync as existsSync2,readdirSync as readdirSync4,readFileSync as readFileSync7}from"node:fs";import{join as join13}from"node:path";import{DatabaseSync as DatabaseSync2}from"node:sqlite";import{createHash}from"node:crypto";var CLOUD_OUTSIDE_KEY=`p_${createHash("sha256").update("cloud-outside").digest("base64url").slice(0,22)}`,CLOUD_NOBODY_KEY=`p_${createHash("sha256").update("cloud-nobody").digest("base64url").slice(0,22)}`;import{join as join12}from"node:path";import{join as join5}from"node:path";var BOTS_FILE=join5(DATA_DIR,"bots.json"),GROUPS_FILE=join5(DATA_DIR,"groups.json");import{appendFileSync}from"node:fs";import{join as join6}from"node:path";import{closeSync as closeSync2,fstatSync as fstatSync2,openSync as openSync2,readSync,renameSync as renameSync3,rmSync,statSync as statSync2,writeSync}from"node:fs";var DEFAULT_THREAD_EVENT_LOG_MAX_BYTES=256*1024*1024;var capProvider=()=>null;function currentThreadLogCap(){try{return capProvider()}catch{return null}}function capThreadLog(file2,maxBytes){if(typeof maxBytes!="number"||!Number.isFinite(maxBytes)||maxBytes<=0)return;let size;try{size=statSync2(file2).size}catch{return}size<=maxBytes||trimToTail(file2,Math.max(1,Math.floor(maxBytes/2)))}function trimToTail(file2,keepBytes){let staging=`${file2}.trim`;try{let source=openSync2(file2,"r");try{let size=fstatSync2(source).size,start=Math.max(0,size-keepBytes),window=Buffer.allocUnsafe(
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as dn,t as n,r as d,j as e,X as ns,an as ss,a as q,w as Ye,o as Xt,b as Mt,aM as Cs,d as Ss,i as Jt}from"./styles-DOJOOIp4.js";import{S as un,g as w,u as et,eL as Rs,eM as Es,eN as zs,eO as xt,y as Is,eP as Ts,eq as Os,l as Bs,G as En,eQ as Ps,eR as Ms,a9 as Ls,T as Us,aU as en,bQ as $s,eS as zt,eT as as,eU as It,eV as is,eW as os,eX as Tt,eY as Fs,eZ as cs,e_ as Ot,e$ as rs,f0 as Ks,f1 as zn,f2 as Ds,al as ls,f3 as Ct,f4 as Qs,f5 as Hs,f6 as _s,f7 as Js,f8 as Vs,f9 as Gs,fa as lt,fb as In,fc as qs,fd as Tn,el as On,fe as St,ff as Zs,fg as Ws,C as Ys,fh as Xs,fi as ea,fj as Vt,fk as ta,fl as na,fm as sa,fn as aa,fo as ia,fp as oa,fq as ca,fr as ra,fs as la,ft as da}from"./App-BIllYA_e.js";import{L as ie,P as ds,x as ua,e as pa,k as pn,E as ma,F as ha,B as fa}from"./PlacesRail-3RaNlpug.js";import{u as Gt}from"./mcp-servers-DoMFsds6.js";import"./index-C1PEx1tc.js";import{C as us,R as tn}from"./MenuMotion-DfjnHTCi.js";import{u as xa}from"./ProIntroduction-B3phUWnc.js";import"./monitor-DpsqT1_R.js";import"./placement-BKtVnQht.js";const ga=[["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"}]],ba=dn("phone-call",ga);const ya=[["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"}]],ka=dn("radio-tower",ya);const ja=[["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"}]],qt=dn("server-cog",ja),va=new Set(["twitter","x"]);function Bn(t,s){return t!=="managed"||!va.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 wa=5,Na=3,Bt=4;function Aa(t,s=wa,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,Na)){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 Sa={productivity:"productivity","developer tools":"developerTools",communication:"communication",files:"files","sales and crm":"salesCrm",design:"design",marketing:"marketing",analytics:"analytics",social:"social"},Ra={"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 dt(t){const s=Sa[t.trim().toLowerCase()];return s?n(`apps.category.${s}`):t}function Pn(t){const s=Ra[t.label.trim().toLowerCase()];return s?n(`apps.catalog.${s}.blurb`):t.blurb}function Ea({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(ie,{"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 Mn({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 za(){const{state:t}=et();return e.jsxs(e.Fragment,{children:[e.jsx(Mn,{feature:"claudeUserMcp",enabled:Rs(t.config),prefix:"mcp.claude"}),e.jsx(Mn,{feature:"claudeUserSkills",enabled:Es(t.config),prefix:"mcp.claudeSkills"})]})}function Ln({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,ps=/^[A-Za-z_][A-Za-z0-9_]*=/,Ia=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+:/,Ta=new Set(["npx","uvx","bunx"]),Oa=new Set(["pnpm","yarn"]);function Ba(t,s=[]){const o=Pa(t).trim();if(!o)return null;try{const c=/^[{[]/.test(o)?Da(o):sn.test(o)&&!/\s/.test(o)?[mn(void 0,o,void 0,[])]:Ma(o);return{ok:!0,servers:Va(c,s)}}catch(c){if(c instanceof me)return{ok:!1,error:c.key};throw c}}function Pa(t){return t.replace(/[“”„]/g,'"').replace(/[‘’]/g,"'").replace(/(^|\s)[–—](?=[a-z])/g,"$1--")}function ms(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 Ma(t){const s=ms(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"?La(c.slice(3)):c[0]==="claude"&&c[1]==="mcp"&&c[2]==="add-json"?Ua(c.slice(3)):$a(c)})}function La(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 C=()=>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=C().toLowerCase();break;case"--header":case"-H":c.push(C()),H[2]===void 0&&M(Ia,c);break;case"--env":case"-e":r.push(C()),H[2]===void 0&&M(ps,r);break;case"--client-id":o=C();break;case"--scope":case"-s":case"--callback-port":C();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(Qa));return o?{...m,oauthClientId:o}:m}return{transport:"stdio",name:xt(x),command:y,args:p,env:r.map(hn)}}function Ua(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,hs(c));if(!r)throw new me("mcp.paste.notRecognized");return r}function $a(t){let s=0;const o=[];for(;s<t.length&&ps.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 Ka(r,o);if(!Ta.has(c)&&!(Oa.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 Fa=new Set(["-i","-t","-it","-ti","-d","--rm","--init","--interactive","--tty","--detach","--privileged"]);function Ka(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("=")||Fa.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 hs(t){try{return JSON.parse(t)}catch{throw new me("mcp.paste.badJson")}}const mt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Da(t){const s=hs(t);if(!mt(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=mt(s.mcpServers)?s.mcpServers:mt(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 Un=t=>mt(t)?Object.entries(t).filter(s=>typeof s[1]=="string"):[];function an(t,s){if(!mt(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=Un(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()]:ms(s.command)[0]??[s.command],x=Un(s.env).map(([p,m])=>Pt(p,m)),y=[...b,...r];return{transport:"stdio",name:t?xt(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?xt(t):Ja(s),type:o??(/\/sse\/?(?:[?#]|$)/i.test(s)?"sse":"http"),url:s,...r?{urlGap:r}:{},headers:c}}function Qa(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 Ha=/\$\{([^}]*)\}|\$\(([^)]*)\)|\$([A-Za-z_][A-Za-z0-9_]*)/g,_a=/<([^<>\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(Ha)){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(_a))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 fs=new Set(["www","mcp","api","server","servers","app","remote","sse","gateway","co","com","org","net","ac","gov"]);function Ja(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(),xt(o.filter(c=>!fs.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 xt(fs.has(c)&&r?r:c||o)||"server"}function Va(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=zs(`${c.name.slice(0,29)}-${l}`);return o.add(r),r===c.name?c:{...c,name:r}})}const Ga=2e6;function qa(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)>Ga?{ok:!1,error:{key:"mcp.err.resultBudget"}}:{ok:!0,value:Number(c)}:{ok:!0,value:void 0}}function $n(t){return t.resultBudget===void 0?"":String(t.resultBudget)}function Za(t,s){const o=qa(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 Wa({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 Fn=0;function Be(t={name:"",value:""}){return Fn+=1,{id:Fn,...t}}function Xe(){return{name:"",transport:"remote",command:"",args:"",env:[Be()],type:"http",url:"",headers:[Be()],oauthClientId:"",oauthClientSecret:"",oauthScopes:"",oauthForgetSecret:!1,resultBudget:""}}const Kn=t=>t.length?t.map(s=>Be({name:s,value:"",saved:!0})):[Be()],Dn=t=>t.length?t.map(s=>Be({...s})):[Be()];function Ya(t){return pe(t)?{...Xe(),name:t.name,type:t.type,url:t.url,headers:Kn(t.headerKeys),oauthClientId:t.oauth?.clientId??"",oauthScopes:t.oauth?.scopes.join(" ")??"",resultBudget:$n(t)}:{...Xe(),name:t.name,transport:"stdio",command:t.command,args:t.args.join(`
|
|
6
|
-
`),env:Kn(t.envKeys),resultBudget:$n(t)}}function Xa(t){return t.transport==="remote"?{...Xe(),name:t.name,type:t.type,url:t.url,...t.urlGap?{urlGap:t.urlGap}:{},headers:Dn(t.headers),oauthClientId:t.oauthClientId??""}:{...Xe(),name:t.name,transport:"stdio",command:t.command,args:t.args.join(`
|
|
7
|
-
`),env:Dn(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 ei=/^[A-Za-z_][A-Za-z0-9_]*$/,ti=/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,128}$/;function Qn(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"?ti:ei).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 ni(t){return t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean)}function si(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 ai(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=Qn(t.headers,"header");if(!b.ok)return b;const x=si({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=Qn(t.env,"env");return r.ok?{ok:!0,body:{command:c,args:ni(t.args),env:r.values}}:r}function Hn(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 ii(t){return n(t.kind==="variable"?"mcp.paste.variable":"mcp.paste.placeholder",{name:t.names.join(", ")})}const _n="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:_n});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:`${_n} 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):[Be()]),className:"shrink-0 rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(ns,{size:14})})]}),p.gap&&!p.value.trim()&&e.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-warning",children:ii(p.gap)})]},p.id)),!c&&e.jsxs("button",{type:"button",onClick:()=>o([...s,Be()]),className:"inline-flex items-center gap-1 rounded-lg px-1 py-1 text-[12px] font-medium text-accent hover:underline",children:[e.jsx(ds,{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",Ee="text-[12px] font-medium text-ink-secondary";function oi(t){if(t.transport==="stdio")return t.command;try{return new URL(t.url).host}catch{return t.url}}function ci({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?[Ya(t)]:[]),[H,C]=d.useState(null),M=s&&t!==void 0&&pe(t),[J,D]=d.useState(!x&&!M),[_,F]=d.useState(!1),[L,le]=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&&Hn(v)!==null,te=g=>{p(g),le(null);const f=Ba(g,o);C(f&&!f.ok?f.error:null),N(S=>f?.ok?f.servers.map(Xa):J?S.length===1?S:[Xe()]:[])},je=()=>{const g=[];for(const f of m){const S=Za(f.resultBudget,()=>ai(f,t));if(!S.ok){le(S.error);return}const z=ee&&_?Hn(f):null;g.push({name:f.name.trim(),body:S.body,...z?{ownKey:z}:{}})}le(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:oi(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:Ee,children:n("mcp.field.url")}),e.jsx("input",{value:g.url,spellCheck:!1,onChange:S=>N(z=>z.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(z=>z.map((U,P)=>P===f?{...U,headers:S}:U))}),e.jsx(Ge,{kind:"env",valuesOf:"gaps",rows:g.env,onChange:S=>N(z=>z.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(ss,{size:14}):e.jsx(us,{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:Ee,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:Ee,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:Ee,children:n("mcp.field.type")}),e.jsxs(Is,{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(Ee,"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:Ee,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:Ee,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:Ee,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:Ee,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(Ee,"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(Wa,{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:je,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(ie,{size:13,className:"animate-spin"})," ",n(x?"mcp.add":"mcp.save")]})]})]})}const ri="/assets/logo-DDbLpTdV.png",li="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=",Oe="postiz",ut="https://api.postiz.com",di="https://platform.postiz.com/settings";function ui(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 ht=[{id:"whop",label:"Whop",url:"https://mcp.whop.com/mcp",icon:{image:li},description:"whop.description",notice:"whop.notice",keywords:"whop checkout memberships"},{id:"agentcard",label:"Agentcard",url:"https://mcp.agentcard.sh/mcp",icon:{glyph:Ts},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:Os},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:ba},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:ka},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:ua},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:ri},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 ht.find(o=>{const c=new URL(o.url);return s.origin===c.origin&&(s.pathname===c.pathname||s.pathname===`${c.pathname}/`)})}function Jn(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 xs="Authorization";function pi(t){const s=o=>o.headerKeys?.some(c=>c.toLowerCase()===xs.toLowerCase())===!0;return Object.fromEntries(ht.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===Oe)}function gs(t){return t.enabled&&t.auth!=="needs-sign-in"}const bs=128;function mi(t,s=bs){return t>=s?"exceeds":t*2>=s?"crowds":"fits"}const hi=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 Vn(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 Gn(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 fi(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=mi(s);return c==="fits"?o:`${o}. ${n(c==="exceeds"?"mcp.check.overLimit":"mcp.check.crowdsLimit",{count:s,limit:bs})}`}function qn({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),[C,M]=d.useState(null),[J,D]=d.useState(null),[_,F]=d.useState(null),[L,le]=d.useState({}),[v,V]=d.useState(null),W=d.useRef(null),he=d.useRef(null),[ee,te]=d.useState(null),[je,Y]=d.useState(""),[g,f]=d.useState(null),[S,z]=d.useState(!1),[U,P]=d.useState(!1),X=d.useRef({}),[Pe,Me]=d.useState(null),[Le,Ae]=d.useState(null),[ze,Ue]=d.useState({}),se=d.useRef(0),Z=d.useRef(!0),fe=a=>pe(a)?gn(a):void 0,G=d.useMemo(()=>p&&pi(p),[p]),ve=s?.onConnections;d.useEffect(()=>{G&&ve?.(G)},[G,ve]);const $e=s?.onServers;d.useEffect(()=>{p&&$e?.(p)},[p,$e]);const ce=a=>(m(a??[]),Gt(a??[]),a??[]),we=a=>le(u=>{const h={...u};return delete h[a],h}),Ce=d.useCallback(()=>{const a=++se.current;return M("load"),D(null),w("/api/mcp/servers").then(u=>{a===se.current&&(m(u.servers??[]),Gt(u.servers??[]))}).catch(u=>{a===se.current&&D(u instanceof Error?u.message:String(u))}).finally(()=>{a===se.current&&M(null)})},[]);d.useEffect(()=>(Z.current=!0,Ce(),()=>{Z.current=!1,se.current+=1}),[Ce,c]);const E=d.useRef(null);E.current=C,d.useEffect(()=>{const a=()=>{if(E.current!==null)return;const u=se.current;w("/api/mcp/servers").then(h=>{!Z.current||E.current!==null||u!==se.current||(m(h.servers??[]),Gt(h.servers??[]))}).catch(()=>{})};return Bs({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)},ae=async(a,u=!1)=>{M(`test:${a}`),Me(a),se.current+=1,we(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),X.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&&(le(k=>({...k,[a]:h})),M(null),Me(null)),h},ye=async a=>{M("save"),se.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(R=>[R,""]))}: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 ae(k,!0),R=h.find(A=>A.name===k);$.auth==="required"&&R&&u.length===1&&Z.current&&await oe(R)}},de=async([a])=>{const u=p?.find(h=>h.name===N);if(!(!a||!u)){M("save"),se.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(R=>R.name===a.name)){const R=h.headers??{};if(Object.keys(R).length>1)throw new Error(n("mcp.personal.oneHeader"));const A=Object.values(R)[0];k=typeof A=="string"?A:void 0,h={...h,headers:Object.fromEntries(Object.keys(R).map(ne=>[ne,""]))}}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 ae(a.name,!0)}},ke=async a=>{if(a.enabled&&Date.now()-(X.current[a.name]??0)<hi){F({key:"mcp.switchedOnByTest",params:{name:a.name}});return}M(`toggle:${a.name}`),se.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}`),se.current+=1,D(null),we(a.name);const u=await Et(a.name,w);le(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),Ae(null),F(null),we(a.name);const k=fe(a);try{const $=async A=>{!await u.open(A)&&Z.current&&!h.signal.aborted&&f(n("connectors.card.popupBlocked"))},R=await as(a.name,{api:w,open:$,signal:h.signal,onStarted:(A,ne)=>{te(A),he.current=ne}});if(!Z.current||h.signal.aborted)return;if(R.phase==="succeeded"){te({...R,flowId:null,authorizationUrl:null});const A=k?await Vn(a.name,w,h.signal,k.label):await Et(a.name,w,h.signal);if(h.signal.aborted||!Z.current||(le(ge=>({...ge,[a.name]:A})),!A.ok))return;const ne=await w(`/api/mcp/servers/${a.name}`,{method:"PATCH",body:JSON.stringify({enabled:!0})});if(!Z.current)return;ce(ne.servers),k&&F({key:"hostedMcp.connected",params:{service:k.label}})}else R.phase!=="cancelled"&&le(A=>({...A,[a.name]:{ok:!1,error:R.message||n("mcp.auth.failed")}}))}catch($){Z.current&&!h.signal.aborted&&le(R=>({...R,[a.name]:{ok:!1,error:$ instanceof Error?$.message:String($)}}))}finally{u.cancel(),W.current===h&&(W.current=null,he.current=null,z(!1),V(null),te(null),Y(""),f(null),Z.current&&Ce())}}const nt=async a=>{if(!p||C!==null||v!==null)return;const u=p.find(k=>fe(k)===a);if("key"in a){await gt(a,u);return}if(u){await oe(u);return}M(`hosted:${a.id}`),se.current+=1,D(null),Ae(null),F(null);let h;try{const k=Jn(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(R=>R.name===k&&fe(R)===a),!h)throw new Error(n("hostedMcp.setupFailed",{service:a.label}))}catch(k){Z.current&&Ae({id:a.id,message:k instanceof Error?k.message:String(k)})}finally{Z.current&&M(null)}h&&Z.current&&await oe(h)},gt=async(a,u)=>{const h=ze[a.id]?.trim();if(!p||!h)return;M(`hosted:${a.id}`),se.current+=1,D(null),Ae(null),F(null);const k=u?.name??Jn(a,p);we(k);try{const $={type:"http",url:a.url,headers:{[xs]:`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 R=await Vn(k,w,void 0,a.label,"hostedMcp.keyTestFailed");if(!Z.current||(le(A=>({...A,[k]:R.reason==="keys"?{...R,error:n("hostedMcp.keyRefused",{service:a.label})}:R})),!R.ok))return;ce((await w(`/api/mcp/servers/${k}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})).servers),Ue(A=>({...A,[a.id]:""})),F({key:"hostedMcp.connected",params:{service:a.label}})}catch($){Z.current&&Ae({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;z(!0),f(null);try{const u=await is(v,ee.flowId,je,w);W.current===a&&he.current?.(u)}catch(u){W.current===a&&f(u instanceof Error?u.message:String(u))}finally{W.current===a&&z(!1)}},at=async(a,u)=>{M(`signout:${a.name}`),se.current+=1,D(null),Ae(null),F(null),we(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?Ae({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}`),se.current+=1,D(null);try{ce((await w(`/api/mcp/servers/${a.name}`,{method:"DELETE"})).servers),we(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 Fe(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:je,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:!je.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(ie,{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(ie,{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")}),Fe(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")}),Fe(a)]})),g&&e.jsx("p",{role:"alert",className:"text-danger",children:g})]})}function Lt(a){const u=p?.find(ne=>fe(ne)===a),h=!!G?.[a.id],k=u&&L[u.name],$=J||(Le?.id===a.id?Le.message:null)||(k&&!k.ok?k.error:null),R=C!==null||v!==null,A=C===`hosted:${a.id}`||u!==void 0&&(v===u.name||C===`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(Ln,{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:R||p!==null&&!h&&(!!u?.managedBy||y&&!x?.mcp.allowlist.length||"key"in a&&!ze[a.id]?.trim()),onClick:()=>{p===null?Ce():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:R&&(A||C==="load")?e.jsx(ie,{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:ze[a.id]??"",disabled:R,autoComplete:"off",spellCheck:!1,"aria-label":n("hostedMcp.keyLabel",{service:a.label}),placeholder:n("hostedMcp.keyPlaceholder",{service:a.label}),onChange:ne=>{const ge=ne.target.value;Ue(bt=>({...bt,[a.id]:ge}))},onKeyDown:ne=>{ne.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(ne=>!ne.hidden).map(ne=>e.jsx("button",{type:"button",onClick:()=>{l({type:"togglePlugins",open:!1}),en(l,"access",{botId:ne.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:ne.name})},ne.id))})]})]})]})}function Re(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:Gn(a,k)}):null,R=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(En,{size:19}):e.jsx(qt,{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}),gs(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:R,children:R})]}),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&&(C!==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:[ht.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=>Re(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:()=>{Ce()},disabled:C!==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(C==="load"&&"animate-spin")})}),e.jsxs("button",{type:"button",disabled:C!==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(ds,{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(ci,{server:xe,fixKeys:U,taken:(p??[]).map(a=>a.name),team:!!r.config?.team,busy:C!==null,onCancel:T,onSubmit:a=>{N==="new"?ye(a):de(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(za,{}),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(ie,{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(qt,{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(Ln,{app:u}):pe(a)?e.jsx(En,{size:19}):e.jsx(qt,{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(ie,{size:14,className:"animate-spin"})," ",n("mcp.auth.cancel")]}):$?e.jsxs("button",{type:"button",disabled:C!==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(Ps,{size:14})," ",u?n("hostedMcp.connect",{service:u.label}):n("mcp.auth.signIn")]}):k==="signed-in"?e.jsxs("button",{type:"button",disabled:C!==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:[C===`signout:${a.name}`?e.jsx(ie,{size:14,className:"animate-spin"}):e.jsx(pa,{size:14})," ",u?n("hostedMcp.disconnect",{service:u.label}):n("mcp.auth.signOut")]}):null,e.jsxs("button",{type:"button",disabled:C!==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:[C===`test:${a.name}`?e.jsx(ie,{size:14,className:"animate-spin"}):e.jsx(Ms,{size:14})," ",n("mcp.test")]}),e.jsx("button",{type:"button",disabled:C!==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(Ls,{size:14})}),e.jsx("button",{type:"button",disabled:C!==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(Us,{size:14})}),e.jsxs("span",{className:"ml-1 flex items-center",children:[C===`toggle:${a.name}`&&e.jsx(ie,{size:13,className:"mr-1.5 animate-spin text-ink-secondary"}),e.jsx(un,{checked:a.enabled,disabled:C!==null||v!==null,onClick:()=>{ke(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(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))})]})]}),e.jsx(Ea,{server:a,disabled:C!==null||v!==null,onSaved:R=>{se.current+=1,ce(R)}}),it(a),Pe===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(ie,{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($s,{size:14,className:"mt-px shrink-0"})," ",fi(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:Gn(a,h)})}),h.reason==="keys"&&pe(a)||h.reason==="unreachable"||h.reason==="timeout"?e.jsx("button",{type:"button",disabled:C!==null||v!==null,onClick:()=>h.reason==="keys"?re(a.name,!0):void ae(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",xi="postiz social media posts schedule linkedin instagram facebook tiktok threads bluesky",Zt={slug:Oe,categories:["Social"]};function ft(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=ft(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 gi(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:ft(s)}):/didn't answer like Postiz/u.test(o)?n("postiz.error.notPostiz",{host:ft(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",Zn="text-[12px] text-accent-text underline underline-offset-2",We=encodeURIComponent(Oe),bi=1500,yi=5*6e4;function ki(){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 ji({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,C]=d.useState(null),[M,J]=d.useState(!1),[D,_]=d.useState(""),[F,L]=d.useState(null),[le,v]=d.useState(!1),[V,W]=d.useState(""),[he,ee]=d.useState(""),[te,je]=d.useState(!1),[Y,g]=d.useState(null),f=d.useRef(!0),S=d.useRef(null),z=d.useCallback(async()=>{const T=(await w("/api/team/my-connections").catch(()=>null))?.mcp?.find(re=>re.name===Oe);return T?{connected:T.connected,how:T.how}:{connected:!1,how:null}},[]),U=d.useCallback(async(E=!1)=>{try{const T=await w(E?`${qe}/check`:qe,E?{method:"POST"}:void 0);if(!f.current)return null;if(!ui(T))throw new Error("unexpected Postiz status");return l(T),p(!1),T.team&&T.scope==="person"&&g(await z()),T}catch(T){return f.current&&(T.status===403?x(!0):p(!0)),null}},[z]);d.useEffect(()=>(f.current=!0,U().then(E=>{E?.state==="connected"&&E.scope==="team"&&U(!0)}),()=>{f.current=!1,S.current?.controller.abort(),S.current=null}),[U,t]);const P=r?.team===!0&&r.scope==="person",X=P?Y?.connected===!0:r?.state==="connected";d.useEffect(()=>{s?.(r?X:null)},[r,X,s]);const Pe=E=>c({type:"configStatus",config:E}),Me=async()=>{await w("/api/team/connection-scopes",{method:"PUT",body:JSON.stringify({kind:"mcp",id:Oe,scope:"person"})}),await w(`/api/mcp/servers/${We}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})},Le=async(E,T)=>{const re=await w(`/api/team/my-connections/mcp/${We}/sign-in`,{method:"POST"}),ae=It(re.auth.authorizationUrl);if(!ae)throw new Error(n("mcp.auth.failed"));C({...re.auth,flowId:null,pasteBack:!1}),!await T(ae)&&f.current&&L(n("connectors.popupBlockedContinue"));const ye=Date.now()+yi;for(;!E.signal.aborted&&Date.now()<ye;)if(await new Promise(ke=>setTimeout(ke,bi)),(await z())?.connected)return;if(!E.signal.aborted)throw new Error(n("postiz.signInExpired"))},Ae=async()=>{if(m||S.current)return;const E=zt(),T=new AbortController;S.current={controller:T},N("sign-in"),L(null),_("");const re=async ae=>{const ye=await E.open(ae);return E.cancel(),ye};try{if(await w(`${qe}/sign-in`,{method:"POST"}),te||P){te&&!P&&await Me(),await Le(T,re);return}const ae=await as(Oe,{api:w,signal:T.signal,open:async de=>{!await re(de)&&f.current&&!T.signal.aborted&&L(n("connectors.popupBlockedContinue"))},onStarted:(de,ke)=>{S.current?.controller===T&&(S.current.complete=ke),f.current&&C(de)}});if(T.signal.aborted||!f.current)return;if(ae.phase!=="succeeded"){ae.phase!=="cancelled"&&L(ae.message||n("mcp.auth.failed"));return}J(!0);const ye=await w(`/api/mcp/servers/${We}/test`,{method:"POST",signal:T.signal});if(!ye.ok){const de=(ye.error??"").trim();L(n("postiz.error.testFailed",{reason:de&&!/[.!?]$/u.test(de)?`${de}.`:de}));return}await w(`/api/mcp/servers/${We}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})}catch(ae){f.current&&!T.signal.aborted&&L(rn(ae,ut))}finally{E.cancel(),S.current?.controller===T&&(S.current=null),f.current&&(C(null),J(!1),N(null),await U())}},ze=async()=>{const E=S.current;if(!(!E||!H?.flowId||!D.trim()))try{E.complete?.(await is(Oe,H.flowId,D,w))}catch(T){f.current&&L(T instanceof Error?T.message:String(T))}},Ue=async()=>{const E=Fs(V),T=P||te?"":he.trim();if(!m){if(!cs(E))return L(n("keys.notAKey"));N("key"),L(null);try{if(await w(`${qe}/key-check`,{method:"POST",body:JSON.stringify({key:E,...T?{address:T}:{}})}),te||P){await w(`${qe}/sign-in`,{method:"POST"}),P||await Me();const ae=(await w("/api/mcp/servers")).servers?.find(ye=>ye.name===Oe)?.url;await w(`/api/team/my-connections/mcp/${We}/key`,{method:"PUT",body:JSON.stringify({value:E,url:ae})})}else{const re=o.config?.postiz?.url??"",ae=T&&ft(T)!==ft(ut)?T:"";ae!==re&&Pe(await w("/api/config",{method:"PUT",body:JSON.stringify({postiz:{url:ae}})})),Pe(await Tt("postiz",E,o.config?.postiz?.configured!==!0))}if(Ot("postiz","apps","ok"),!f.current)return;W(""),v(!1)}catch(re){Ot("postiz","apps",rs(re)),f.current&&L(gi(re,T||ut))}finally{f.current&&(N(null),await U())}}},se=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&&Pe(await Tt("postiz","",!1)),await w(qe,{method:"DELETE"}))}catch(E){f.current&&L(rn(E,r?.address??ut))}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",ve=!P&&r?.state==="key-refused",$e=r?.state==="blocked"||r?.state==="taken",ce=r?.state==="taken"?n("postiz.taken"):r?.state==="blocked"?r.message??n("postiz.description"):X?P?n("postiz.connectedOwn"):r?.how==="key"?n("postiz.connectedKey",{host:r.host}):n("postiz.connectedTo",{host:r?.host??""}):G?n("connectors.signedOut"):ve?n("postiz.keyRefused"):n("postiz.description"),we=(X||G||ve)&&e.jsx(os,{placement:"below",ariaLabel:n("postiz.menu"),triggerClassName:"shrink-0",items:[{key:"disconnect",label:n("connectors.disconnect"),disabled:m!==null,onSelect:()=>{se()}}],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(ie,{size:14,className:"animate-spin"}):e.jsx(ma,{size:15,"aria-hidden":"true"})})}),Ce=r!==null&&!X&&!$e;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(ki,{}),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"}),X&&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(ie,{size:14,className:"animate-spin"})}):X?we:Ce&&!le?e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx("button",{type:"button","aria-label":n(G||ve?"postiz.reconnect":"postiz.connect"),disabled:m!==null,onClick:()=>ve?(v(!0),L(null)):void Ae(),className:Ze,children:n(G||ve?"connectors.action.reconnect":"connectors.action.connect")}),we]}):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(ie,{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:Zn,children:n("mcp.auth.openAgain")})]}),H?.flowId&&H.pasteBack&&e.jsxs("form",{"data-postiz-paste":!0,className:"flex flex-col gap-1.5",onSubmit:E=>{E.preventDefault(),ze()},children:[e.jsx("span",{className:"leading-relaxed text-ink",children:n("mcp.auth.pasteBackHint")}),e.jsx("input",{type:"text",value:D,onChange:E=>_(E.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}),Ce&&!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:E=>je(E.target.checked)})," ",n("mcp.team.onlyMe")]}),P&&!X&&!fe&&e.jsx("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:n("postiz.personScope")}),Ce&&!fe&&(le?e.jsxs("form",{"data-postiz-key-form":!0,className:"mt-2 flex flex-col gap-2",onSubmit:E=>{E.preventDefault(),Ue()},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:E=>{L(null),W(E.target.value)},className:Wt}),!P&&!te&&e.jsx("input",{type:"url",autoComplete:"off",spellCheck:!1,"aria-label":n("postiz.addressField"),placeholder:ut,value:he,disabled:m==="key",onChange:E=>{L(null),ee(E.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(ie,{size:14,className:"animate-spin"}):n("connectors.action.connect")}),e.jsxs("a",{href:di,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 ${Zn}`,children:n("postiz.useKey")}))]})]})}const Wn=t=>typeof t=="number"&&Number.isSafeInteger(t)&&t>=0,Yn=t=>typeof t=="string"&&t.length<=40&&!Number.isNaN(Date.parse(t));function vi(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const{calls:s,max:o,usedUp:c,resetsAt:r,trialEndsAt:l}=t;return!Wn(s)||!Wn(o)||!Yn(r)||l!==void 0&&!Yn(l)?null:{calls:Math.min(s,o),max:o,...c===!0||s>=o?{usedUp:!0}:{},resetsAt:r,...l!==void 0?{trialEndsAt:l}:{}}}function wi(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||vi(s.usage)!==null)}const Ni="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",Ai="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",Ci="x twitter treg tweets posts";function Si(){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)),Xn=t=>t.toLocaleString(Mt());function Ri(t){const s={used:Xn(t.calls),max:Xn(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 Ei({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,C]=d.useState(null),[M,J]=d.useState(null),[D,_]=d.useState(!1),F=d.useRef(!0),L=d.useRef(!1),le=Cs(xa()?.view??null)==="connecting",v=o.config?.treg?.configured===!0,V=o.config?.xResearch?.included===!0,W=d.useCallback(async(z=!1)=>{try{const U=await w(`/api/x/status${z?"?refresh=1":""}`);if(!F.current)return;if(!wi(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=z=>(c({type:"configStatus",config:z}),W(!0)),ee=async()=>{p("test"),J(null);try{const z=await w("/api/keys/test",{method:"POST",body:JSON.stringify({provider:"treg"})});return F.current&&J(Ks(z)),zn(z)}catch(z){return F.current&&J(z instanceof Error?z.message:String(z)),zn(null)}finally{F.current&&p(null)}},te=async()=>{const z=m.trim();if(!(y||!z)){if(!cs(z))return C(n("keys.notAKey"));p("save"),C(null),J(null);try{if(await he(await Tt("treg",z,!v)),!F.current)return;N(""),_(!1),Ot("treg","apps",await ee())}catch(U){F.current&&C(U instanceof Error?U.message:String(U)),Ot("treg","apps",rs(U))}finally{F.current&&p(U=>U==="save"?null:U)}}},je=async()=>{if(!y){p("remove"),C(null),J(null);try{await he(await Tt("treg","",!1)),Ds("treg","apps")}catch(z){F.current&&C(z instanceof Error?z.message:String(z))}finally{F.current&&p(null)}}};d.useEffect(()=>{L.current&&(L.current=!1,te())});const Y=r?.using??null,g=r?.usage?Ri(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"):le&&!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(Si,{}),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(ie,{size:14,className:"animate-spin"})}):Y==="own"?e.jsx("button",{type:"button",disabled:y!==null,onClick:()=>{ee()},className:Rt,children:y==="test"?e.jsx(ie,{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:()=>{je()},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(ie,{size:12,className:"animate-spin","aria-hidden":"true"}),n("apps.x.remove")]}),Y==="included"&&!f&&e.jsx("button",{type:"button",onClick:()=>{_(!0),C(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:z=>{z.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:z=>{C(null),N(z.target.value)},onPaste:()=>{L.current=!0},className:Ai}),e.jsx("button",{type:"submit",disabled:y!==null||!m.trim(),className:Rt,children:y==="save"?e.jsx(ie,{size:14,className:"animate-spin"}):n("common.save")})]}),e.jsxs("a",{href:Ni,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 zi(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 Ii(t,s,o){return Object.fromEntries(Object.entries(t).filter(([c])=>(s.get(c)??0)===(o.get(c)??0)))}async function Ti(t=window.ogb){if(!t?.credentialStore||t.remoteClient?.active===!0)return!1;try{return await t.credentialStore.unreadable()===!0}catch{return!1}}let pt=null;function es({notice:t=!1}){const[s,o]=d.useState(!1),[c,r]=d.useState(()=>pt!==null);if(d.useEffect(()=>{let x=!0;return Ti().then(y=>{x&&o(y)}),pt?.finally(()=>{x&&r(!1)}),()=>{x=!1}},[]),!s)return null;const l=()=>{if(pt)return;r(!0),pt=Promise.resolve(window.ogb?.credentialStore?.reset()).then(()=>{},()=>{}).finally(()=>{pt=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(ls,{size:14,className:"mt-px shrink-0"}),e.jsxs("span",{children:[n("connectors.savedKeysUnreadable"),b]})]}):b}function Oi(t,s){const o=s.alias?`“${s.alias}” (${s.id})`:`“${s.id}”`;return n("connectors.disconnectConfirm",{identity:o,service:t})}function Bi(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:!ra(l)||l.tools!=="*"})}function Pi(t,s,o,c){return(!s||`${t.label} ${t.keywords} ${n(t.description)}`.toLowerCase().includes(s.toLowerCase().trim()))&&(o==="all"||o==="connected"&&c?.[t.id]!==!1)}function Mi(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 ts=48,Li=16;function Ui(t,s,o){return aa(t,s).filter(c=>ia(c,o)!==null)}function Gi(){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),[C,M]=d.useState("unavailable"),[J,D]=d.useState(void 0),[_,F]=d.useState(()=>Ct()?.services??Qs()?.services??{}),[L,le]=d.useState(Ct()?.authoritative===!1),[v,V]=d.useState({}),[W,he]=d.useState(null),[ee,te]=d.useState(""),[je,Y]=d.useState(null),[g,f]=d.useState(!1),[S,z]=d.useState(Ct()===null?"loading":"ready"),[U,P]=d.useState(null),[X,Pe]=d.useState(""),[Me,Le]=d.useState("marketplace"),[Ae,ze]=d.useState(!1),[Ue,se]=d.useState(null),[Z,fe]=d.useState(0),[G,ve]=d.useState(null),[$e,ce]=d.useState(null),[we,Ce]=d.useState(null),[E,T]=d.useState(null),[re,ae]=d.useState([]),ye=d.useRef(null),de=d.useRef(new Map),ke=d.useRef(new Map),tt=d.useRef(new Map),oe=d.useRef(null),nt=d.useRef(new Set),gt=(i,j)=>{const B=Object.entries(i).filter(([I,K])=>(ke.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,ke.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=Ii(I.services??{},tt.current,B);return F(Q=>ln(Q,K,ke.current,j)),gt(K,j),K}).catch(()=>({}))},[]),at=d.useCallback((i=!1)=>{const j=new Map(ke.current);return f(!0),Hs(i).then(({services:B,authoritative:I,refused:K})=>(le(!I),K&&P({key:"connectors.adminOnly"}),F(Q=>zi(Q,B,ke.current,j,I)),gt(B,j),B)).finally(()=>f(!1))},[]),Ke=d.useCallback((i=!1)=>{const j=Ct()!==null;return j||z("loading"),P(null),at(i).then(B=>(z("ready"),B)).catch(B=>(j||z("error"),P(B instanceof Error?B.message:String(B)),{}))},[at]);d.useEffect(()=>()=>{oe.current?.cancel(),oe.current=null;for(const i of de.current.values())i();de.current.clear()},[]);const xe=_s({status:_,emailConnected:E,inventoryReady:S==="ready"&&!L});d.useEffect(()=>{S==="ready"&&Js(_,!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(Vs(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(ye.current)return;if(Q.key==="Escape"){Q.preventDefault(),s({type:"togglePlugins",open:!1});return}if(Q.key!=="Tab"||!j)return;const ue=B();if(ue.length===0){Q.preventDefault(),j.focus();return}const Ne=ue[0],Se=ue.at(-1);ue.some(be=>be===document.activeElement)?Q.shiftKey&&document.activeElement===Ne?(Q.preventDefault(),Se.focus()):!Q.shiftKey&&document.activeElement===Se&&(Q.preventDefault(),Ne.focus()):(Q.preventDefault(),(Q.shiftKey?Se:Ne).focus())};return window.addEventListener("keydown",K),()=>{window.removeEventListener("keydown",K),i?.focus()}},[s]);const{suggestions:Fe,picking:it,pick:Lt}=Gs(l!==null&&N&&S==="ready",`${Z}:${Object.keys(_).filter(i=>_[i]?.connected).sort().join()}`),[Re,De]=d.useState(null);ye.current=Re;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)=>{de.current.get(i)?.();const I=la(j,()=>st([i]).then(K=>K[i]),K=>{de.current.get(i)===I&&de.current.delete(i),da(i,K),K==="connected"&&B&&xe.appConnected(i,l?.find(Q=>Q.slug===i)?.label??i)});de.current.set(i,I)},h=async(i,j,B)=>{if(je||oe.current)return;const I=zt();oe.current=I,ke.current.set(i,(ke.current.get(i)??0)+1),Y(i),P(null),B&&nt.current.add(i);const K=!nt.current.has(i)&&!lt(_[i]);try{const Q=Date.now();B&&await w(`/api/connectors/${i}/accounts/${encodeURIComponent(B.id)}`,{method:"DELETE"});const ue={method:"POST"};j&&(ue.body=JSON.stringify({alias:j}));const Ne=await w(`/api/connectors/${i}/authorize`,ue);if(oe.current!==I)return;const Se=It(typeof Ne.url=="string"?Ne.url:null);if(!Se)throw new Error(n("connectors.invalidAuthorizationUrl"));V(be=>({...be,[i]:{url:Se,createdAt:Q}})),F(be=>({...be,[i]:{...be[i],connected:be[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 ue=Q instanceof Error?Q.message:String(Q);oa(ue)?(he(i),te(""),P({key:"connectors.aliasNeeded"}),st([i])):P(ca(ue)?{key:"connectors.aliasTaken"}:ue)}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=>(!Bn(C,i.slug)||lt(_[i.slug]))&&In(`${i.label} ${i.slug} ${Pn(i)} ${(i.categories??[]).join(" ")}`,X)),R=i=>!!(_[i]?.connected||_[i]?.accounts?.length),A=r==="mcp"?"mcp":Me==="connected"?"connected":"all",ne=X.trim().length>0,ge=ne&&A==="connected"?"all":A,bt=new Set(ht.filter(i=>Pi(i,X,ge,Ue)).map(i=>i.id)),bn=(!X||`email mail imap smtp mailbox ${n("email.description")}`.toLowerCase().includes(X.toLowerCase().trim()))&&(ge==="all"||ge==="connected"&&E!==!1),yn=(!X||`${Ci} ${n("apps.x.description")}`.toLowerCase().includes(X.toLowerCase().trim()))&&(ge==="all"||ge==="connected"&&$e!==!1),ys=(!X||`${xi} ${n("postiz.description")}`.toLowerCase().includes(X.toLowerCase().trim()))&&(ge==="all"||ge==="connected"&&we!==!1),Ut=(ge==="connected"?$.filter(i=>R(i.slug)):$).map((i,j)=>({card:i,index:j})).sort((i,j)=>Number(R(j.card.slug))-Number(R(i.card.slug))||i.index-j.index).map(({card:i})=>i),$t=ht.filter(i=>Ue?.[i.id]),kn=re.filter(i=>cn(i)),jn=i=>In(`${i.name} ${pe(i)?i.url:[i.command,...i.args].join(" ")}`,X),vn=Object.values(_).filter(lt).length+$t.length+kn.filter(gs).length+ +(E===!0)+ +($e===!0)+ +(we===!0),wn=qs(S),Qe=()=>s({type:"togglePlugins",open:!1}),yt=Mi({configured:N,stale:L,setup:J,remoteClient:o}),ot=i=>{if(ve(null),i==="mcp"){s({type:"togglePlugins",open:!0,surface:"mcp"});return}Le(i==="connected"?"connected":"marketplace"),r!=="apps"&&s({type:"togglePlugins",open:!0,surface:"apps"})},Ft=Aa([...l??[],Zt],void 0,Zt.categories),Kt=Ft.more,Dt=G!==null&&Kt.includes(G),He=A==="all"&&G!==null&&!ne,Nn=ys&&(!He||nn(Zt,G)),ks=!He&&(bt.size>0||bn||yn)||Nn||A==="connected"&&kn.some(i=>i.enabled&&jn(i)),js=He?Ut.filter(i=>nn(i,G)):Ut,kt=A==="all"&&!ne&&G===null,ct=kt?Ca(Ut,R,Ft.inline):[],vs=ct.find(i=>i.kind==="all"),jt=kt?vs?.cards??[]:js,Qt=kt&&!Ae&&jt.length>ts,An=Qt?jt.slice(0,ts):jt,Cn=(l??[]).filter(i=>lt(_[i.slug])),Ht=i=>{ve(i),Le("marketplace"),r!=="apps"&&s({type:"togglePlugins",open:!0,surface:"apps"})},ws=ne?n("connectors.section.results"):A==="connected"?n("connectors.section.yours"):G?dt(G):ct.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",_t=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:ea(),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":A==="connected",onClick:()=>ot(A==="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",A==="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(Tn,{card:i,className:"size-5 rounded-md"})},i.slug))}),e.jsx("span",{className:"whitespace-nowrap",children:vn>0?n("apps.connectedCount",{count:vn}):n("apps.filter.connected")}),e.jsx(us,{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(ns,{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(Ss,{size:15,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:X,onChange:i=>Pe(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":A==="mcp",onClick:()=>ot(A==="mcp"?"all":"mcp"),className:q(_e,"h-9 border border-hairline/40 px-3.5",A==="mcp"?"bg-ink text-app":"text-ink hover:bg-raised"),children:[e.jsx(ha,{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":A==="all"&&G===null,onClick:()=>{ot("all"),ve(null)},className:q(_e,_t(A==="all"&&G===null)),children:n("apps.filter.all")}),Ft.inline.map(i=>e.jsx("button",{type:"button","data-apps-category":i,"aria-pressed":A==="all"&&G===i,onClick:()=>Ht(G===i?null:i),className:q(_e,_t(A==="all"&&G===i)),children:dt(i)},i)),Kt.length>0&&e.jsx(os,{ariaLabel:n("apps.moreCategories"),items:Kt.map(i=>({key:i,label:dt(i),active:G===i,onSelect:()=>Ht(i)})),renderTrigger:({open:i})=>e.jsxs("span",{className:q(_e,_t(A==="all"&&Dt),i&&!Dt&&"bg-raised-hover text-ink"),children:[Dt?dt(G):n("apps.more"),e.jsx(ss,{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(ls,{size:14,className:"mt-px shrink-0"}),e.jsxs("span",{children:[n("connectors.stale"),e.jsx(es,{})]})]}):e.jsx(es,{notice:!0}),yt&&A!=="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:[$t.length>0?n("hostedMcp.otherAppsSetup",{services:new Intl.ListFormat(Mt(),{style:"long",type:"conjunction"}).format($t.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(On("composio"))},children:n("connectors.openSettings")})]}),N&&!o&&x==="curated"&&C==="self-hosted"&&A!=="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)}),A!=="mcp"&&e.jsxs("div",{"data-apps-grid":!0,className:"@container flex flex-col gap-7 pt-1",children:[!ct.some(i=>i.kind==="connected")&&Sn(),ct.filter(i=>i.kind!=="all").map(i=>i.kind==="connected"?e.jsxs(d.Fragment,{children:[e.jsx(St,{id:"apps-section-connected",title:n("apps.section.connected"),viewAll:i.cards.length>Bt?{label:n("apps.viewAll"),onClick:()=>ot("connected")}:void 0,children:i.cards.slice(0,Bt).map(j=>vt(j))}),Sn()]},"connected"):e.jsx(St,{id:`apps-section-${i.category}`,title:dt(i.category),viewAll:i.more?{label:n("apps.viewAll"),onClick:()=>Ht(i.category)}:void 0,children:i.cards.map(j=>vt(j))},i.category)),e.jsxs(St,{id:"apps-grid-title",title:ws,note:A==="all"&&!X&&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(Jt()),total:p.totalItems.toLocaleString(Jt())}):n("connectors.marketplace.partialStalled")}${p.reason?` — ${n("connectors.marketplace.partialReason",{reason:p.reason})}`:""}`:void 0,viewAll:Qt?{label:n("apps.viewAll"),onClick:()=>ze(!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(ie,{size:14,className:"animate-spin"})," ",n("connectors.loadingCatalog")]}),Qt&&e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>ze(!0),className:q(_e,"bg-control/70 px-4 text-ink hover:bg-raised-hover"),children:n("apps.showAll",{count:jt.length.toLocaleString(Jt())})})}),l!==null&&An.length===0&&!ks&&ct.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:ge==="connected"?wn.title:n("connectors.noAppsFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:ge==="connected"?wn.description:n("connectors.tryDifferentSearch")}),A==="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(qn,{hostedCards:{shown:i=>!He&&bt.has(i),onConnections:se,onServers:ae,...A==="connected"?{ownServers:{shown:jn,manage:()=>ot("mcp")}}:{}},refreshKey:Z}),e.jsx("div",{"data-native-card":"x",className:yn&&!He?"contents":"hidden",children:e.jsx(Ei,{refreshKey:Z,onConnection:ce})}),e.jsx("div",{"data-native-card":"email",className:bn&&!He?"contents":"hidden",children:e.jsx(Zs,{refreshKey:Z,onConnection:T})}),e.jsx("div",{"data-native-card":"postiz",className:Nn?"contents":"hidden",children:e.jsx(ji,{refreshKey:Z,onConnection:Ce})}),An.map(i=>vt(i))]})]}),A!=="connected"&&G===null&&e.jsx("div",{className:q(A==="all"&&"mt-8 border-t border-hairline/30 pt-6",A==="mcp"&&"pt-1"),children:e.jsx(qn,{embedded:!0,hideHosted:A==="all"})}),e.jsx("nav",{"aria-label":n("legal.label"),className:"mt-10 flex justify-center gap-x-4 text-[12px]",children:e.jsx(Ws,{})})]}),e.jsx(Ys,{open:Re!==null,layer:"z-[60]",tone:"danger",title:n("connectors.disconnect"),confirmLabel:n("connectors.disconnect"),body:Re?Oi(Re.label,Re.account):"",onCancel:()=>De(null),onConfirm:()=>{Re&&k(Re.slug,Re.account.id),De(null)}}),xe.changing&&e.jsx(Xs,{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 Sn(){const i=Fe.cards.filter(B=>!R(B.slug));if(!kt||i.length===0)return null;const j=Fe.pick==="available"?{label:n(it?"apps.suggested.picking":"apps.suggested.show"),onClick:Lt}:Fe.pick==="needs-key"&&!o?{label:n("apps.suggested.addKey"),onClick:()=>{Qe(),s(On("jev"))}}:void 0;return e.jsx(St,{id:"apps-section-suggested",title:n("apps.section.suggested"),note:Fe.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=Vt(K),ue=j?.accounts??[],Ne=i.noAuth===!0||j?.connected===!0&&!ue.length&&!I&&!B,Se=lt(j),be=I?void 0:ta(j),Ns=W===i.slug&&!Ne,Je=je===i.slug,wt=t.config?.managedPolicy,Nt=wt?.apps&&!wt.apps.allowAll&&!wt.apps.allowlist.includes(i.slug)?n("policy.managedBy",{organization:wt.organizationName}):Bn(C,i.slug)?n("connectors.selfHostOnlyReason"):null,rt=Se||Ne?Ui(t.bots,t.instances,i.slug):[],At=n("apps.usedBy",{names:rt.map(O=>O.name).join(", ")}),Rn=Nt??(I?Q?n("connectors.finishSetup"):n("connectors.finishSetupOrDisconnect"):be?n("connectors.signedOut"):B&&!ue.length?n("connectors.authExpired"):Pn(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(Tn,{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")}),rt.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:rt.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(fa,{bot:O,size:Li,animated:!1})},O.id))})]}),e.jsx("div",{className:"truncate text-[13px] leading-[18px] text-ink-secondary",title:Rn,children:Rn})]}),e.jsx("button",{type:"button",disabled:!N||S!=="ready"||Je||Ne||!!Nt,title:Nt??void 0,onClick:()=>{if(I&&!B){const O=Vt(K);O?(P(null),a(O).catch(Ie=>P(Ie.message))):h(i.slug)}else be?h(i.slug,be.alias,be):(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(ie,{size:14,className:"animate-spin"}):na(S,{busy:Je,included:Ne,canContinue:!!K,pending:I,reconnect:!!be,hasAccounts:ue.length>0,failed:!!B})})]}),e.jsxs("div",{className:"ps-[52px]",children:[Q&&e.jsx("a",{href:Q,target:"_blank",rel:"noopener noreferrer",onClick:O=>{Vt(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:rt.length?At:void 0,children:rt.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")})]}),ue.length>0&&e.jsx("div",{className:"mt-1.5 space-y-0.5",children:ue.map(O=>{const Ie=/^active$/i.test(O.status),Ve=sa(O)&&O.id!==be?.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||Ne)&&(()=>{const O=Bi(t.bots,t.instances,i.slug);if(!O.length)return null;const Ie=O.slice(0,4).map((Ve,As)=>e.jsxs("span",{children:[As>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})})]})})(),Ns&&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":ue.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{ts as APPS_PREVIEW_COUNT,Gi as PluginsPanel,Tn as ServiceIcon,Li as USED_BY_AVATAR_SIZE,Ui as botsUsingService,Bi as botsWithLimitedServiceTools,Mi as connectorSetupNotice,Oi as disconnectAccountConfirmation,Pi as hostedShown,Hs as preloadConnectedApps};
|