"use strict";var n=require("electron"),s=new WeakMap;n.contextBridge.exposeInMainWorld("desktopApi",{send:(e,t)=>{["setMenu","locale","appConfig","pluginsLoaded","run-command","plugin-manager","request-backend-token","request-plugin-permission-secrets","open-plugin-folder","request-backend-port","request-tray-icon","set-tray-icon","cluster-changed"].includes(e)&&n.ipcRenderer.send(e,t)},receive:(e,t)=>{if(["currentMenu","setMenu","locale","appConfig","command-stdout","command-stderr","command-exit","plugin-manager","backend-token","plugin-permission-secrets","open-about-dialog","backend-port","tray-icon"].includes(e)){let i=(a,...r)=>t(...r);return n.ipcRenderer.on(e,i),s.set(t,{channel:e,wrapped:i}),()=>{n.ipcRenderer.removeListener(e,i),s.delete(t)}}},removeListener:(e,t)=>{let o=s.get(t);if(o&&o.channel===e){n.ipcRenderer.removeListener(e,o.wrapped),s.delete(t);return}n.ipcRenderer.removeListener(e,t)},mcp:{executeTool:(e,t,o)=>n.ipcRenderer.invoke("mcp-execute-tool",{toolName:e,args:t,toolCallId:o}),getStatus:()=>n.ipcRenderer.invoke("mcp-get-status"),resetClient:()=>n.ipcRenderer.invoke("mcp-reset-client"),getConfig:()=>n.ipcRenderer.invoke("mcp-get-config"),updateConfig:e=>n.ipcRenderer.invoke("mcp-update-config",e),getToolsConfig:()=>n.ipcRenderer.invoke("mcp-get-tools-config"),updateToolsConfig:e=>n.ipcRenderer.invoke("mcp-update-tools-config",e),setToolEnabled:(e,t,o)=>n.ipcRenderer.invoke("mcp-set-tool-enabled",{serverName:e,toolName:t,enabled:o}),getToolStats:(e,t)=>n.ipcRenderer.invoke("mcp-get-tool-stats",{serverName:e,toolName:t}),clusterChange:e=>n.ipcRenderer.invoke("mcp-cluster-change",{cluster:e})},notifyClusterChange:e=>{n.ipcRenderer.send("cluster-changed",e)}});
