xiaozhi-client 1.6.4-beta.8 → 1.6.4
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/package.json +2 -3
- package/package.json +2 -3
- package/web/dist/assets/index-DXZqFLxf.js +31 -0
- package/web/dist/assets/index-DXZqFLxf.js.map +1 -0
- package/web/dist/assets/index-FjYZvnDD.css +1 -0
- package/web/dist/assets/{react-vendor-Bm2cC0fo.js → react-vendor-krhZvXtS.js} +41 -36
- package/web/dist/assets/react-vendor-krhZvXtS.js.map +1 -0
- package/web/dist/assets/{utils-DE0xezXx.js → utils-BWOcwU4X.js} +2 -2
- package/web/dist/assets/{utils-DE0xezXx.js.map → utils-BWOcwU4X.js.map} +1 -1
- package/web/dist/index.html +4 -4
- package/web/dist/assets/index-CCieCKu1.js +0 -31
- package/web/dist/assets/index-CCieCKu1.js.map +0 -1
- package/web/dist/assets/index-eZDZS6qd.css +0 -1
- package/web/dist/assets/react-vendor-Bm2cC0fo.js.map +0 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xiaozhi-client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "小智 AI 客户端 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
"spell:check": "cspell \"src/**/*.ts\" \"*.md\" \"*.json\"",
|
|
38
38
|
"duplicate:check": "jscpd src/",
|
|
39
39
|
"docker:update-version": "node scripts/update-dockerfile-version.js",
|
|
40
|
-
"publish": "npm publish",
|
|
41
|
-
"publish:beta": "npx tsx scripts/publish-beta.ts",
|
|
42
40
|
"example": "node --loader ts-node/esm"
|
|
43
41
|
},
|
|
44
42
|
"keywords": [
|
|
@@ -95,6 +93,7 @@
|
|
|
95
93
|
"supertest": "^7.1.4",
|
|
96
94
|
"ts-node": "^10.9.2",
|
|
97
95
|
"tsup": "^8.5.0",
|
|
96
|
+
"tsx": "^4.20.5",
|
|
98
97
|
"typescript": "^5.8.3",
|
|
99
98
|
"vitest": "^3.2.3"
|
|
100
99
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xiaozhi-client",
|
|
3
|
-
"version": "1.6.4
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "小智 AI 客户端 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
"spell:check": "cspell \"src/**/*.ts\" \"*.md\" \"*.json\"",
|
|
38
38
|
"duplicate:check": "jscpd src/",
|
|
39
39
|
"docker:update-version": "node scripts/update-dockerfile-version.js",
|
|
40
|
-
"publish": "npm publish",
|
|
41
|
-
"publish:beta": "npx tsx scripts/publish-beta.ts",
|
|
42
40
|
"example": "node --loader ts-node/esm"
|
|
43
41
|
},
|
|
44
42
|
"keywords": [
|
|
@@ -95,6 +93,7 @@
|
|
|
95
93
|
"supertest": "^7.1.4",
|
|
96
94
|
"ts-node": "^10.9.2",
|
|
97
95
|
"tsup": "^8.5.0",
|
|
96
|
+
"tsx": "^4.20.5",
|
|
98
97
|
"typescript": "^5.8.3",
|
|
99
98
|
"vitest": "^3.2.3"
|
|
100
99
|
},
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var Qt=Object.defineProperty;var es=(r,e,s)=>e in r?Qt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var k=(r,e,s)=>es(r,typeof e!="symbol"?e+"":e,s);import{c as Re,d as Pe,u as Me,r as i,t as S,j as t,S as _,R as at,O as de,P as ot,C as ue,a as We,X as nt,b as fe,D as me,e as it,f as ct,g as ts,h as ss,i as rs,k as as,l as os,L as lt,m as ns,n as ge,o as dt,p as is,q as ut,s as ft,v as mt,A as gt,w as pt,x as cs,y as ls,B as ds,E as us,F as ht,G as fs,H as Ie,I as xt,J as ms,K as gs,M as ps,N as pe,Q as he,U as hs,V as xs,W as Je,Y as Xe,Z as bs,_ as Ss,$ as ws,a0 as ye,a1 as vs,a2 as ys,a3 as js,a4 as Ns}from"./react-vendor-krhZvXtS.js";import{t as Cs,c as bt,a as te,T as ks}from"./utils-BWOcwU4X.js";import{z as I}from"./form-utils-BAESeaiO.js";import"./radix-ui-DW48STyt.js";import"./vendor-C4NtkA-O.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const n of o)if(n.type==="childList")for(const c of n.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function s(o){const n={};return o.integrity&&(n.integrity=o.integrity),o.referrerPolicy&&(n.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?n.credentials="include":o.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function a(o){if(o.ep)return;o.ep=!0;const n=s(o);fetch(o.href,n)}})();class Es{constructor(e){k(this,"baseUrl");if(e)this.baseUrl=e;else{const s=window.location.protocol,a=window.location.hostname,o=window.location.port;this.baseUrl=`${s}//${a}${o?`:${o}`:""}`}}async request(e,s={}){var c;const a=`${this.baseUrl}${e}`,o={headers:{"Content-Type":"application/json",...s.headers}},n=await fetch(a,{...o,...s});if(!n.ok){let m=`HTTP ${n.status}: ${n.statusText}`;try{m=((c=(await n.json()).error)==null?void 0:c.message)||m}catch{}throw new Error(m)}return n.json()}async getConfig(){const e=await this.request("/api/config");if(!e.success||!e.data)throw new Error("获取配置失败");return e.data}async updateConfig(e){const s=await this.request("/api/config",{method:"PUT",body:JSON.stringify(e)});if(!s.success)throw new Error(s.message||"配置更新失败")}async getMcpEndpoint(){const e=await this.request("/api/config/mcp-endpoint");if(!e.success||!e.data)throw new Error("获取 MCP 端点失败");return e.data.endpoint}async getMcpEndpoints(){const e=await this.request("/api/config/mcp-endpoints");if(!e.success||!e.data)throw new Error("获取 MCP 端点列表失败");return e.data.endpoints}async getMcpServers(){const e=await this.request("/api/config/mcp-servers");if(!e.success||!e.data)throw new Error("获取 MCP 服务配置失败");return e.data.servers}async getConnectionConfig(){const e=await this.request("/api/config/connection");if(!e.success||!e.data)throw new Error("获取连接配置失败");return e.data.connection}async reloadConfig(){const e=await this.request("/api/config/reload",{method:"POST"});if(!e.success||!e.data)throw new Error("重新加载配置失败");return e.data}async getConfigPath(){const e=await this.request("/api/config/path");if(!e.success||!e.data)throw new Error("获取配置文件路径失败");return e.data.path}async checkConfigExists(){var s;const e=await this.request("/api/config/exists");if(!e.success||((s=e.data)==null?void 0:s.exists)===void 0)throw new Error("检查配置是否存在失败");return e.data.exists}async getStatus(){const e=await this.request("/api/status");if(!e.success||!e.data)throw new Error("获取状态失败");return e.data}async getClientStatus(){const e=await this.request("/api/status/client");if(!e.success||!e.data)throw new Error("获取客户端状态失败");return e.data}async getRestartStatus(){const e=await this.request("/api/status/restart");if(!e.success)throw new Error("获取重启状态失败");return e.data||null}async checkClientConnected(){var s;const e=await this.request("/api/status/connected");if(!e.success||((s=e.data)==null?void 0:s.connected)===void 0)throw new Error("检查客户端连接失败");return e.data.connected}async getLastHeartbeat(){var s;const e=await this.request("/api/status/heartbeat");if(!e.success)throw new Error("获取最后心跳时间失败");return((s=e.data)==null?void 0:s.lastHeartbeat)||null}async getActiveMCPServers(){const e=await this.request("/api/status/mcp-servers");if(!e.success||!e.data)throw new Error("获取活跃 MCP 服务器失败");return e.data.servers}async updateClientStatus(e){const s=await this.request("/api/status/client",{method:"PUT",body:JSON.stringify(e)});if(!s.success)throw new Error(s.message||"更新客户端状态失败")}async setActiveMCPServers(e){const s=await this.request("/api/status/mcp-servers",{method:"PUT",body:JSON.stringify({servers:e})});if(!s.success)throw new Error(s.message||"设置活跃 MCP 服务器失败")}async resetStatus(){const e=await this.request("/api/status/reset",{method:"POST"});if(!e.success)throw new Error(e.message||"重置状态失败")}async restartService(){const e=await this.request("/api/services/restart",{method:"POST"});if(!e.success)throw new Error(e.message||"重启服务失败")}async stopService(){const e=await this.request("/api/services/stop",{method:"POST"});if(!e.success)throw new Error(e.message||"停止服务失败")}async startService(){const e=await this.request("/api/services/start",{method:"POST"});if(!e.success)throw new Error(e.message||"启动服务失败")}async getServiceStatus(){const e=await this.request("/api/services/status");if(!e.success||!e.data)throw new Error("获取服务状态失败");return e.data}async getServiceHealth(){const e=await this.request("/api/services/health");if(!e.success||!e.data)throw new Error("获取服务健康状态失败");return e.data}}const z=new Es;var W=(r=>(r.DISCONNECTED="disconnected",r.CONNECTING="connecting",r.CONNECTED="connected",r.RECONNECTING="reconnecting",r))(W||{});class Rs{constructor(){k(this,"listeners",new Map)}on(e,s){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s),()=>{this.off(e,s)}}off(e,s){const a=this.listeners.get(e);a&&(a.delete(s),a.size===0&&this.listeners.delete(e))}emit(e,s){const a=this.listeners.get(e);if(a)for(const o of a)try{o(s)}catch(n){console.error(`[EventBus] 事件监听器执行失败 (${e}):`,n)}}clear(){this.listeners.clear()}getListenerCount(e){var s;return e?((s=this.listeners.get(e))==null?void 0:s.size)||0:Array.from(this.listeners.values()).reduce((a,o)=>a+o.size,0)}}const M=class M{constructor(e={}){k(this,"ws",null);k(this,"url");k(this,"state","disconnected");k(this,"eventBus",new Rs);k(this,"legacyListeners",{});k(this,"reconnectAttempts",0);k(this,"maxReconnectAttempts");k(this,"reconnectInterval");k(this,"reconnectTimer");k(this,"heartbeatTimer");k(this,"heartbeatInterval");k(this,"heartbeatTimeout");k(this,"lastHeartbeat",0);this.url=e.url||this.getDefaultWebSocketUrl(),this.maxReconnectAttempts=e.maxReconnectAttempts||5,this.reconnectInterval=e.reconnectInterval||3e3,this.heartbeatInterval=e.heartbeatInterval||3e4,this.heartbeatTimeout=e.heartbeatTimeout||35e3,this.setupLegacyEventBridge()}static getInstance(e){if(M.instance)return M.instance;if(M.isCreating)throw new Error("[WebSocketManager] 检测到循环创建,请检查代码逻辑");M.isCreating=!0;try{return M.instance=new M(e),console.log("[WebSocketManager] 单例实例已创建"),M.instance}finally{M.isCreating=!1}}static resetInstance(){M.instance&&(M.instance.disconnect(),M.instance.eventBus.clear(),M.instance=null,console.log("[WebSocketManager] 单例实例已重置"))}setupLegacyEventBridge(){this.eventBus.on("connection:connected",()=>{var e,s;(s=(e=this.legacyListeners).connected)==null||s.call(e)}),this.eventBus.on("connection:disconnected",()=>{var e,s;(s=(e=this.legacyListeners).disconnected)==null||s.call(e)}),this.eventBus.on("connection:error",({error:e})=>{var s,a;(a=(s=this.legacyListeners).error)==null||a.call(s,e)}),this.eventBus.on("data:configUpdate",e=>{var s,a;(a=(s=this.legacyListeners).configUpdate)==null||a.call(s,e)}),this.eventBus.on("data:statusUpdate",e=>{var s,a;(a=(s=this.legacyListeners).statusUpdate)==null||a.call(s,e)}),this.eventBus.on("data:restartStatus",e=>{var s,a;(a=(s=this.legacyListeners).restartStatus)==null||a.call(s,e)})}getDefaultWebSocketUrl(){const e=localStorage.getItem("xiaozhi-ws-url");if(e)return e;const s=window.location.protocol==="https:"?"wss:":"ws:",a=window.location.hostname,o=window.location.port;return`${s}//${a}${o?`:${o}`:""}`}connect(){if(!(this.state==="connected"||this.state==="connecting")){this.state="connecting",console.log(`[WebSocket] 连接到: ${this.url}`),this.eventBus.emit("connection:connecting",void 0);try{this.ws=new WebSocket(this.url),this.setupEventHandlers()}catch(e){console.error("[WebSocket] 连接失败:",e),this.handleConnectionError(e)}}}disconnect(){console.log("[WebSocket] 主动断开连接"),this.clearTimers(),this.state="disconnected",this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}subscribe(e,s){return this.eventBus.on(e,s)}unsubscribe(e,s){this.eventBus.off(e,s)}getEventBus(){return this.eventBus}on(e,s){console.warn("[WebSocketManager] on() 方法已废弃,请使用 subscribe() 方法"),this.legacyListeners[e]=s}off(e){console.warn("[WebSocketManager] off() 方法已废弃,请使用 unsubscribe() 方法"),delete this.legacyListeners[e]}getState(){return this.state}isConnected(){var e;return this.state==="connected"&&((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN}setUrl(e){this.url!==e&&(this.url=e,localStorage.setItem("xiaozhi-ws-url",e),this.isConnected()&&(this.disconnect(),setTimeout(()=>this.connect(),1e3)))}send(e){if(!this.isConnected())return console.warn("[WebSocket] 连接未建立,无法发送消息"),!1;try{const s=typeof e=="string"?e:JSON.stringify(e);return this.ws.send(s),!0}catch(s){return console.error("[WebSocket] 发送消息失败:",s),this.eventBus.emit("connection:error",{error:s,context:"send_message"}),!1}}getUrl(){return this.url}getConnectionStats(){return{state:this.state,url:this.url,reconnectAttempts:this.reconnectAttempts,maxReconnectAttempts:this.maxReconnectAttempts,lastHeartbeat:this.lastHeartbeat,eventListenerCount:this.eventBus.getListenerCount()}}setupEventHandlers(){this.ws&&(this.ws.onopen=()=>{console.log("[WebSocket] 连接已建立"),this.state="connected",this.reconnectAttempts=0,this.startHeartbeat(),this.eventBus.emit("connection:connected",void 0)},this.ws.onmessage=e=>{try{const s=JSON.parse(e.data);this.handleMessage(s)}catch(s){console.error("[WebSocket] 消息解析失败:",s)}},this.ws.onclose=e=>{console.log(`[WebSocket] 连接已关闭 (code: ${e.code})`),this.handleConnectionClose()},this.ws.onerror=e=>{console.error("[WebSocket] 连接错误:",e),this.handleConnectionError(new Error("WebSocket 连接错误"))})}handleMessage(e){var s;console.log("[WebSocket] 收到消息:",e.type),this.eventBus.emit("system:message",e);try{switch(e.type){case"configUpdate":case"config":e.data&&this.eventBus.emit("data:configUpdate",e.data);break;case"statusUpdate":case"status":e.data&&this.eventBus.emit("data:statusUpdate",e.data);break;case"restartStatus":e.data&&this.eventBus.emit("data:restartStatus",e.data);break;case"heartbeatResponse":this.lastHeartbeat=Date.now(),this.eventBus.emit("system:heartbeat",{timestamp:this.lastHeartbeat});break;case"error":{const a=new Error(((s=e.error)==null?void 0:s.message)||"服务器错误");console.error("[WebSocket] 服务器错误:",e.error),this.eventBus.emit("system:error",{error:a,message:e}),this.eventBus.emit("connection:error",{error:a,context:"server_error"});break}default:console.log("[WebSocket] 未处理的消息类型:",e.type)}}catch(a){console.error("[WebSocket] 消息处理失败:",a),this.eventBus.emit("system:error",{error:a,message:e})}}handleConnectionClose(){this.state="disconnected",this.clearTimers(),this.eventBus.emit("connection:disconnected",void 0),this.reconnectAttempts<this.maxReconnectAttempts?this.scheduleReconnect():(console.error("[WebSocket] 达到最大重连次数,停止重连"),this.eventBus.emit("connection:error",{error:new Error("达到最大重连次数"),context:"max_reconnect_attempts"}))}handleConnectionError(e){this.state="disconnected",this.clearTimers(),this.eventBus.emit("connection:error",{error:e,context:"connection_error"}),this.reconnectAttempts<this.maxReconnectAttempts?this.scheduleReconnect():console.error("[WebSocket] 达到最大重连次数,停止重连")}scheduleReconnect(){this.reconnectAttempts++,this.state="reconnecting",console.log(`[WebSocket] 安排重连 (${this.reconnectAttempts}/${this.maxReconnectAttempts}) 在 ${this.reconnectInterval}ms 后`),this.eventBus.emit("connection:reconnecting",{attempt:this.reconnectAttempts,maxAttempts:this.maxReconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.connect()},this.reconnectInterval)}startHeartbeat(){this.lastHeartbeat=Date.now(),this.heartbeatTimer=setInterval(()=>{this.isConnected()&&(this.sendHeartbeat(),Date.now()-this.lastHeartbeat>this.heartbeatTimeout&&(console.warn("[WebSocket] 心跳超时,重新连接"),this.disconnect(),this.connect()))},this.heartbeatInterval)}sendHeartbeat(){var e;if(this.isConnected()){const s={type:"clientStatus",data:{status:"connected",timestamp:Date.now()}};(e=this.ws)==null||e.send(JSON.stringify(s))}}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}};k(M,"instance",null),k(M,"isCreating",!1);let ke=M;const y=ke.getInstance(),Ye={clientStatus:null,restartStatus:null,serviceStatus:null,serviceHealth:null,fullStatus:null,loading:{isLoading:!1,isRefreshing:!1,isRestarting:!1,lastUpdated:null,lastError:null},polling:{enabled:!1,interval:3e4,maxRetries:3,currentRetries:0},restartPolling:{enabled:!1,interval:1e3,maxAttempts:60,currentAttempts:0,timeout:6e4,startTime:null},lastSource:null};let ae=null,oe=null;const T=Re()(Pe((r,e)=>({...Ye,setClientStatus:(s,a="http")=>{console.log(`[StatusStore] 设置客户端状态,来源: ${a}`),r(o=>({clientStatus:s,lastSource:a,loading:{...o.loading,lastUpdated:Date.now(),lastError:null}}),!1,"setClientStatus")},setRestartStatus:(s,a="http")=>{console.log(`[StatusStore] 设置重启状态,来源: ${a}`),r(o=>({restartStatus:s,lastSource:a,loading:{...o.loading,lastUpdated:Date.now(),lastError:null}}),!1,"setRestartStatus")},setServiceStatus:s=>{console.log("[StatusStore] 设置服务状态"),r({serviceStatus:s},!1,"setServiceStatus")},setServiceHealth:s=>{console.log("[StatusStore] 设置服务健康状态"),r({serviceHealth:s},!1,"setServiceHealth")},setFullStatus:(s,a="http")=>{console.log(`[StatusStore] 设置完整状态,来源: ${a}`),r(o=>({fullStatus:s,clientStatus:s.client,restartStatus:s.restart||null,lastSource:a,loading:{...o.loading,lastUpdated:Date.now(),lastError:null}}),!1,"setFullStatus")},setLoading:s=>{r(a=>({loading:{...a.loading,...s}}),!1,"setLoading")},setError:s=>{r(a=>({loading:{...a.loading,lastError:s}}),!1,"setError")},getStatus:async()=>{const{fullStatus:s,loading:a}=e();return s&&a.lastUpdated&&Date.now()-a.lastUpdated<30*1e3?s:e().refreshStatus()},refreshStatus:async()=>{const{setLoading:s,setFullStatus:a,setError:o,polling:n}=e();try{s({isRefreshing:!0,lastError:null}),console.log("[StatusStore] 开始刷新状态");const c=await z.getStatus();return a(c,"http"),n.enabled&&e().setPollingConfig({currentRetries:0}),console.log("[StatusStore] 状态刷新成功"),c}catch(c){const m=c instanceof Error?c:new Error("状态刷新失败");if(console.error("[StatusStore] 状态刷新失败:",m),o(m),n.enabled){const l=n.currentRetries+1;e().setPollingConfig({currentRetries:l}),l>=n.maxRetries&&(console.warn("[StatusStore] 达到最大重试次数,停止轮询"),e().stopPolling())}throw m}finally{s({isRefreshing:!1})}},restartService:async()=>{const{setLoading:s,setRestartStatus:a,setError:o,startRestartPolling:n}=e();try{s({isRestarting:!0,lastError:null}),console.log("[StatusStore] 开始重启服务"),a({status:"restarting",timestamp:Date.now()},"http"),await z.restartService(),console.log("[StatusStore] 服务重启请求已发送,开始重连检查"),n()}catch(c){const m=c instanceof Error?c:new Error("服务重启失败");throw console.error("[StatusStore] 服务重启失败:",m),a({status:"failed",error:m.message,timestamp:Date.now()},"http"),o(m),s({isRestarting:!1}),m}},getServiceStatus:async()=>{try{console.log("[StatusStore] 获取服务状态");const s=await z.getServiceStatus();return e().setServiceStatus(s),s}catch(s){const a=s instanceof Error?s:new Error("获取服务状态失败");throw console.error("[StatusStore] 获取服务状态失败:",a),e().setError(a),a}},getServiceHealth:async()=>{try{console.log("[StatusStore] 获取服务健康状态");const s=await z.getServiceHealth();return e().setServiceHealth(s),s}catch(s){const a=s instanceof Error?s:new Error("获取服务健康状态失败");throw console.error("[StatusStore] 获取服务健康状态失败:",a),e().setError(a),a}},startPolling:(s=3e4)=>{const{polling:a,refreshStatus:o}=e();if(a.enabled){console.log("[StatusStore] 轮询已启用,跳过启动");return}console.log(`[StatusStore] 启动状态轮询,间隔: ${s}ms`),r(n=>({polling:{...n.polling,enabled:!0,interval:s,currentRetries:0}}),!1,"startPolling"),o().catch(n=>{console.error("[StatusStore] 轮询初始刷新失败:",n)}),ae=setInterval(()=>{e().polling.enabled&&o().catch(c=>{console.error("[StatusStore] 轮询刷新失败:",c)})},s)},stopPolling:()=>{console.log("[StatusStore] 停止状态轮询"),r(s=>({polling:{...s.polling,enabled:!1,currentRetries:0}}),!1,"stopPolling"),ae&&(clearInterval(ae),ae=null)},setPollingConfig:s=>{r(a=>({polling:{...a.polling,...s}}),!1,"setPollingConfig")},startRestartPolling:()=>{const{restartPolling:s,refreshStatus:a,setRestartStatus:o,setLoading:n}=e();if(s.enabled){console.log("[StatusStore] 重启轮询已启用,跳过启动");return}console.log("[StatusStore] 启动重启后重连检查轮询");const c=Date.now();r(m=>({restartPolling:{...m.restartPolling,enabled:!0,currentAttempts:0,startTime:c}}),!1,"startRestartPolling"),oe=setInterval(async()=>{var d;const m=e(),{restartPolling:l}=m;if(!l.enabled)return;const x=Date.now()-(l.startTime||0),f=l.currentAttempts+1;console.log(`[StatusStore] 重启重连检查 (第 ${f} 次,已用时 ${Math.round(x/1e3)}s)`);try{if(((d=(await a()).client)==null?void 0:d.status)==="connected"){console.log("[StatusStore] 服务重连成功,停止重启轮询"),o({status:"completed",timestamp:Date.now()},"polling"),m.stopRestartPolling(),n({isRestarting:!1});return}m.setRestartPollingConfig({currentAttempts:f}),(x>=l.timeout||f>=l.maxAttempts)&&(console.warn("[StatusStore] 重启重连检查超时或达到最大尝试次数"),o({status:"failed",error:"重连超时,服务可能未成功重启",timestamp:Date.now()},"polling"),m.stopRestartPolling(),n({isRestarting:!1}))}catch(p){console.log(`[StatusStore] 重启重连检查失败 (第 ${f} 次):`,p),m.setRestartPollingConfig({currentAttempts:f}),(x>=l.timeout||f>=l.maxAttempts)&&(console.error("[StatusStore] 重启重连检查超时或达到最大尝试次数"),o({status:"failed",error:"重连超时,服务可能未成功重启",timestamp:Date.now()},"polling"),m.stopRestartPolling(),n({isRestarting:!1}))}},s.interval)},stopRestartPolling:()=>{console.log("[StatusStore] 停止重启轮询"),r(s=>({restartPolling:{...s.restartPolling,enabled:!1,currentAttempts:0,startTime:null}}),!1,"stopRestartPolling"),oe&&(clearInterval(oe),oe=null)},setRestartPollingConfig:s=>{r(a=>({restartPolling:{...a.restartPolling,...s}}),!1,"setRestartPollingConfig")},reset:()=>{console.log("[StatusStore] 重置状态"),e().stopPolling(),e().stopRestartPolling(),r(Ye,!1,"reset")},initialize:async()=>{const{setLoading:s,refreshStatus:a}=e();try{s({isLoading:!0}),console.log("[StatusStore] 初始化状态 Store"),y.subscribe("data:statusUpdate",o=>{console.log("[StatusStore] 收到 WebSocket 状态更新"),e().setClientStatus(o,"websocket")}),y.subscribe("data:restartStatus",o=>{console.log("[StatusStore] 收到 WebSocket 重启状态更新"),e().setRestartStatus(o,"websocket")}),await a(),console.log("[StatusStore] 状态 Store 初始化完成")}catch(o){throw console.error("[StatusStore] 状态 Store 初始化失败:",o),o}finally{s({isLoading:!1})}}}),{name:"status-store"})),Ps=()=>T(r=>r.clientStatus),St=()=>T(r=>r.restartStatus),wt=()=>T(r=>r.restartPolling),Ms=()=>T(Me(r=>({getStatus:r.getStatus,refreshStatus:r.refreshStatus,restartService:r.restartService,getServiceStatus:r.getServiceStatus,getServiceHealth:r.getServiceHealth,startPolling:r.startPolling,stopPolling:r.stopPolling,setPollingConfig:r.setPollingConfig,startRestartPolling:r.startRestartPolling,stopRestartPolling:r.stopRestartPolling,setRestartPollingConfig:r.setRestartPollingConfig,reset:r.reset,initialize:r.initialize})));function Ws(){const r=St(),e=wt(),s=i.useRef(null),a=i.useRef(null);i.useEffect(()=>{if(!r)return;const{status:o,timestamp:n,error:c}=r;if(!(s.current===o&&a.current===n))switch(s.current=o,a.current=n,o){case"restarting":S.info("正在重启服务...",{id:"restart-status-progress",description:"请耐心等待",duration:0});break;case"completed":{const m=e.enabled?`服务重启成功!重连检查完成 (${e.currentAttempts}次检查)`:"服务重启成功!";S.dismiss("restart-status-progress"),S.success(m,{id:"restart-status-success",description:"服务已恢复正常运行"});break}case"failed":{const m=c||"服务重启失败",l=e.enabled?`重连检查超时 (${e.currentAttempts}/${e.maxAttempts}次)`:"请检查服务状态或稍后重试";S.dismiss("restart-status-progress"),S.error(m,{id:"restart-status-failed",description:l});break}}},[r,e]),i.useEffect(()=>()=>{s.current=null,a.current=null},[])}function Is(){return Ws(),null}function g(...r){return Cs(bt(r))}const Ae=te("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),C=i.forwardRef(({className:r,variant:e,size:s,asChild:a=!1,...o},n)=>{const c=a?_:"button";return t.jsx(c,{className:g(Ae({variant:e,size:s,className:r})),ref:n,...o})});C.displayName="Button";const $=i.forwardRef(({className:r,type:e,...s},a)=>t.jsx("input",{type:e,className:g("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:a,...s}));$.displayName="Input";const Te=i.forwardRef(({className:r,orientation:e="horizontal",decorative:s=!0,...a},o)=>t.jsx(at,{ref:o,decorative:s,orientation:e,className:g("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",r),...a}));Te.displayName=at.displayName;const As=it,Ts=ot,vt=i.forwardRef(({className:r,...e},s)=>t.jsx(de,{className:g("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...e,ref:s}));vt.displayName=de.displayName;const Ds=te("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),yt=i.forwardRef(({side:r="right",className:e,children:s,...a},o)=>t.jsxs(Ts,{children:[t.jsx(vt,{}),t.jsxs(ue,{ref:o,className:g(Ds({side:r}),e),...a,children:[s,t.jsxs(We,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(nt,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yt.displayName=ue.displayName;const jt=({className:r,...e})=>t.jsx("div",{className:g("flex flex-col space-y-2 text-center sm:text-left",r),...e});jt.displayName="SheetHeader";const Nt=i.forwardRef(({className:r,...e},s)=>t.jsx(fe,{ref:s,className:g("text-lg font-semibold text-foreground",r),...e}));Nt.displayName=fe.displayName;const Ct=i.forwardRef(({className:r,...e},s)=>t.jsx(me,{ref:s,className:g("text-sm text-muted-foreground",r),...e}));Ct.displayName=me.displayName;function Ze({className:r,...e}){return t.jsx("div",{className:g("animate-pulse rounded-md bg-muted",r),...e})}const zs=ts,$s=ss,Us=rs,kt=i.forwardRef(({className:r,sideOffset:e=4,...s},a)=>t.jsx(ct,{ref:a,sideOffset:e,className:g("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",r),...s}));kt.displayName=ct.displayName;const je=768;function Os(){const[r,e]=i.useState(void 0);return i.useEffect(()=>{const s=window.matchMedia(`(max-width: ${je-1}px)`),a=()=>{e(window.innerWidth<je)};return s.addEventListener("change",a),e(window.innerWidth<je),()=>s.removeEventListener("change",a)},[]),!!r}const Ls="sidebar_state",Bs=60*60*24*7,Hs="16rem",Fs="18rem",_s="3rem",qs="b",Et=i.createContext(null);function xe(){const r=i.useContext(Et);if(!r)throw new Error("useSidebar must be used within a SidebarProvider.");return r}const De=i.forwardRef(({defaultOpen:r=!0,open:e,onOpenChange:s,className:a,style:o,children:n,...c},m)=>{const l=Os(),[x,f]=i.useState(!1),[d,p]=i.useState(r),u=e??d,b=i.useCallback(j=>{const E=typeof j=="function"?j(u):j;s?s(E):p(E),document.cookie=`${Ls}=${E}; path=/; max-age=${Bs}`},[s,u]),w=i.useCallback(()=>l?f(j=>!j):b(j=>!j),[l,b]);i.useEffect(()=>{const j=E=>{E.key===qs&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[w]);const h=u?"expanded":"collapsed",v=i.useMemo(()=>({state:h,open:u,setOpen:b,isMobile:l,openMobile:x,setOpenMobile:f,toggleSidebar:w}),[h,u,b,l,x,w]);return t.jsx(Et.Provider,{value:v,children:t.jsx(zs,{delayDuration:0,children:t.jsx("div",{style:{"--sidebar-width":Hs,"--sidebar-width-icon":_s,...o},className:g("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",a),ref:m,...c,children:n})})})});De.displayName="SidebarProvider";const Rt=i.forwardRef(({side:r="left",variant:e="sidebar",collapsible:s="offcanvas",className:a,children:o,...n},c)=>{const{isMobile:m,state:l,openMobile:x,setOpenMobile:f}=xe();return s==="none"?t.jsx("div",{className:g("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",a),ref:c,...n,children:o}):m?t.jsx(As,{open:x,onOpenChange:f,...n,children:t.jsxs(yt,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Fs},side:r,children:[t.jsxs(jt,{className:"sr-only",children:[t.jsx(Nt,{children:"Sidebar"}),t.jsx(Ct,{children:"Displays the mobile sidebar."})]}),t.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):t.jsxs("div",{ref:c,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?s:"","data-variant":e,"data-side":r,children:[t.jsx("div",{className:g("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:g("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",r==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...n,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:o})})]})});Rt.displayName="Sidebar";const Pt=i.forwardRef(({className:r,onClick:e,...s},a)=>{const{toggleSidebar:o}=xe();return t.jsxs(C,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:g("h-7 w-7",r),onClick:n=>{e==null||e(n),o()},...s,children:[t.jsx(as,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Pt.displayName="SidebarTrigger";const Vs=i.forwardRef(({className:r,...e},s)=>{const{toggleSidebar:a}=xe();return t.jsx("button",{ref:s,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:g("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",r),...e})});Vs.displayName="SidebarRail";const ze=i.forwardRef(({className:r,...e},s)=>t.jsx("main",{ref:s,className:g("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",r),...e}));ze.displayName="SidebarInset";const Ks=i.forwardRef(({className:r,...e},s)=>t.jsx($,{ref:s,"data-sidebar":"input",className:g("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",r),...e}));Ks.displayName="SidebarInput";const Mt=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"header",className:g("flex flex-col gap-2 p-2",r),...e}));Mt.displayName="SidebarHeader";const Gs=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"footer",className:g("flex flex-col gap-2 p-2",r),...e}));Gs.displayName="SidebarFooter";const Js=i.forwardRef(({className:r,...e},s)=>t.jsx(Te,{ref:s,"data-sidebar":"separator",className:g("mx-2 w-auto bg-sidebar-border",r),...e}));Js.displayName="SidebarSeparator";const Wt=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"content",className:g("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",r),...e}));Wt.displayName="SidebarContent";const It=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"group",className:g("relative flex w-full min-w-0 flex-col p-2",r),...e}));It.displayName="SidebarGroup";const Xs=i.forwardRef(({className:r,asChild:e=!1,...s},a)=>{const o=e?_:"div";return t.jsx(o,{ref:a,"data-sidebar":"group-label",className:g("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",r),...s})});Xs.displayName="SidebarGroupLabel";const Ys=i.forwardRef(({className:r,asChild:e=!1,...s},a)=>{const o=e?_:"button";return t.jsx(o,{ref:a,"data-sidebar":"group-action",className:g("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",r),...s})});Ys.displayName="SidebarGroupAction";const At=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"group-content",className:g("w-full text-sm",r),...e}));At.displayName="SidebarGroupContent";const $e=i.forwardRef(({className:r,...e},s)=>t.jsx("ul",{ref:s,"data-sidebar":"menu",className:g("flex w-full min-w-0 flex-col gap-1",r),...e}));$e.displayName="SidebarMenu";const Ue=i.forwardRef(({className:r,...e},s)=>t.jsx("li",{ref:s,"data-sidebar":"menu-item",className:g("group/menu-item relative",r),...e}));Ue.displayName="SidebarMenuItem";const Zs=te("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Oe=i.forwardRef(({asChild:r=!1,isActive:e=!1,variant:s="default",size:a="default",tooltip:o,className:n,...c},m)=>{const l=r?_:"button",{isMobile:x,state:f}=xe(),d=t.jsx(l,{ref:m,"data-sidebar":"menu-button","data-size":a,"data-active":e,className:g(Zs({variant:s,size:a}),n),...c});return o?(typeof o=="string"&&(o={children:o}),t.jsxs($s,{children:[t.jsx(Us,{asChild:!0,children:d}),t.jsx(kt,{side:"right",align:"center",hidden:f!=="collapsed"||x,...o})]})):d});Oe.displayName="SidebarMenuButton";const Qs=i.forwardRef(({className:r,asChild:e=!1,showOnHover:s=!1,...a},o)=>{const n=e?_:"button";return t.jsx(n,{ref:o,"data-sidebar":"menu-action",className:g("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",r),...a})});Qs.displayName="SidebarMenuAction";const er=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,"data-sidebar":"menu-badge",className:g("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r),...e}));er.displayName="SidebarMenuBadge";const tr=i.forwardRef(({className:r,showIcon:e=!1,...s},a)=>{const o=i.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return t.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:g("flex h-8 items-center gap-2 rounded-md px-2",r),...s,children:[e&&t.jsx(Ze,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx(Ze,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":o}})]})});tr.displayName="SidebarMenuSkeleton";const sr=i.forwardRef(({className:r,...e},s)=>t.jsx("ul",{ref:s,"data-sidebar":"menu-sub",className:g("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",r),...e}));sr.displayName="SidebarMenuSub";const rr=i.forwardRef(({...r},e)=>t.jsx("li",{ref:e,...r}));rr.displayName="SidebarMenuSubItem";const ar=i.forwardRef(({asChild:r=!1,size:e="md",isActive:s,className:a,...o},n)=>{const c=r?_:"a";return t.jsx(c,{ref:n,"data-sidebar":"menu-sub-button","data-size":e,"data-active":s,className:g("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...o})});ar.displayName="SidebarMenuSubButton";function or({items:r}){const e=os();return t.jsx(It,{children:t.jsx(At,{className:"flex flex-col gap-2",children:t.jsx($e,{children:r.map(s=>{const o=e.pathname===s.url;return t.jsx(Ue,{children:t.jsx(Oe,{className:g("min-w-8 duration-200 ease-linear hover:bg-primary/5",o?"bg-primary text-primary-foreground duration-200 ease-linear hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground":"min-w-8 duration-200 ease-linear"),tooltip:s.title,asChild:!0,children:t.jsxs(lt,{to:s.url,children:[s.icon&&t.jsx(s.icon,{}),t.jsx("span",{children:s.title})]})})},s.title)})})})})}const nr={navMain:[{title:"仪表板",url:"/dashboard",icon:ns},{title:"全局配置",url:"/settings",icon:ge}]};function Tt({...r}){return t.jsxs(Rt,{collapsible:"offcanvas",...r,children:[t.jsx(Mt,{children:t.jsx($e,{children:t.jsx(Ue,{children:t.jsx(Oe,{asChild:!0,className:"data-[slot=sidebar-menu-button]:!p-1.5",children:t.jsx(lt,{to:"/",children:t.jsx("span",{className:"text-base font-semibold",children:"Xiaozhi Client"})})})})})}),t.jsx(Wt,{children:t.jsx(or,{items:nr.navMain})})]})}const Dt=cs,ir=ls,cr=is,zt=i.forwardRef(({className:r,...e},s)=>t.jsx(dt,{className:g("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...e,ref:s}));zt.displayName=dt.displayName;const Le=i.forwardRef(({className:r,...e},s)=>t.jsxs(cr,{children:[t.jsx(zt,{}),t.jsx(ut,{ref:s,className:g("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...e})]}));Le.displayName=ut.displayName;const Be=({className:r,...e})=>t.jsx("div",{className:g("flex flex-col space-y-2 text-center sm:text-left",r),...e});Be.displayName="AlertDialogHeader";const He=({className:r,...e})=>t.jsx("div",{className:g("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...e});He.displayName="AlertDialogFooter";const Fe=i.forwardRef(({className:r,...e},s)=>t.jsx(ft,{ref:s,className:g("text-lg font-semibold",r),...e}));Fe.displayName=ft.displayName;const _e=i.forwardRef(({className:r,...e},s)=>t.jsx(mt,{ref:s,className:g("text-sm text-muted-foreground",r),...e}));_e.displayName=mt.displayName;const qe=i.forwardRef(({className:r,...e},s)=>t.jsx(gt,{ref:s,className:g(Ae(),r),...e}));qe.displayName=gt.displayName;const Ve=i.forwardRef(({className:r,...e},s)=>t.jsx(pt,{ref:s,className:g(Ae({variant:"outline"}),"mt-2 sm:mt-0",r),...e}));Ve.displayName=pt.displayName;const ee=it,be=ds,lr=ot,Se=We,$t=i.forwardRef(({className:r,...e},s)=>t.jsx(de,{ref:s,className:g("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...e}));$t.displayName=de.displayName;const q=i.forwardRef(({className:r,children:e,...s},a)=>t.jsxs(lr,{children:[t.jsx($t,{}),t.jsxs(ue,{ref:a,className:g("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...s,children:[e,t.jsxs(We,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(nt,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));q.displayName=ue.displayName;const V=({className:r,...e})=>t.jsx("div",{className:g("flex flex-col space-y-1.5 text-center sm:text-left",r),...e});V.displayName="DialogHeader";const se=({className:r,...e})=>t.jsx("div",{className:g("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...e});se.displayName="DialogFooter";const K=i.forwardRef(({className:r,...e},s)=>t.jsx(fe,{ref:s,className:g("text-lg font-semibold leading-none tracking-tight",r),...e}));K.displayName=fe.displayName;const G=i.forwardRef(({className:r,...e},s)=>t.jsx(me,{ref:s,className:g("text-sm text-muted-foreground",r),...e}));G.displayName=me.displayName;const Qe={config:null,loading:{isLoading:!1,isUpdating:!1,isRefreshing:!1,lastUpdated:null,lastError:null},lastSource:null},D=Re()(Pe((r,e)=>({...Qe,setConfig:(s,a="http")=>{console.log(`[ConfigStore] 设置配置数据,来源: ${a}`),r(o=>({config:s,lastSource:a,loading:{...o.loading,lastUpdated:Date.now(),lastError:null}}),!1,"setConfig")},setLoading:s=>{r(a=>({loading:{...a.loading,...s}}),!1,"setLoading")},setError:s=>{r(a=>({loading:{...a.loading,lastError:s}}),!1,"setError")},getConfig:async()=>{const{config:s,loading:a}=e();return s&&a.lastUpdated&&Date.now()-a.lastUpdated<5*60*1e3?s:e().refreshConfig()},updateConfig:async s=>{const{setLoading:a,setConfig:o,setError:n}=e();try{a({isUpdating:!0,lastError:null}),console.log("[ConfigStore] 开始更新配置"),await z.updateConfig(s),o(s,"http"),console.log("[ConfigStore] 配置更新成功")}catch(c){const m=c instanceof Error?c:new Error("配置更新失败");throw console.error("[ConfigStore] 配置更新失败:",m),n(m),m}finally{a({isUpdating:!1})}},refreshConfig:async()=>{const{setLoading:s,setConfig:a,setError:o}=e();try{s({isRefreshing:!0,lastError:null}),console.log("[ConfigStore] 开始刷新配置");const n=await z.getConfig();return a(n,"http"),console.log("[ConfigStore] 配置刷新成功"),n}catch(n){const c=n instanceof Error?n:new Error("配置刷新失败");throw console.error("[ConfigStore] 配置刷新失败:",c),o(c),c}finally{s({isRefreshing:!1})}},reloadConfig:async()=>{const{setLoading:s,setConfig:a,setError:o}=e();try{s({isRefreshing:!0,lastError:null}),console.log("[ConfigStore] 开始重新加载配置");const n=await z.reloadConfig();return a(n,"http"),console.log("[ConfigStore] 配置重新加载成功"),n}catch(n){const c=n instanceof Error?n:new Error("配置重新加载失败");throw console.error("[ConfigStore] 配置重新加载失败:",c),o(c),c}finally{s({isRefreshing:!1})}},updateMcpEndpoint:async s=>{const{config:a,updateConfig:o}=e();if(!a)throw new Error("配置未加载,无法更新 MCP 端点");const n={...a,mcpEndpoint:s};await o(n)},updateMcpServers:async s=>{const{config:a,updateConfig:o}=e();if(!a)throw new Error("配置未加载,无法更新 MCP 服务");const n={...a,mcpServers:s};await o(n)},updateConnectionConfig:async s=>{const{config:a,updateConfig:o}=e();if(!a)throw new Error("配置未加载,无法更新连接配置");const n={...a,connection:s};await o(n)},updateModelScopeConfig:async s=>{const{config:a,updateConfig:o}=e();if(!a)throw new Error("配置未加载,无法更新 ModelScope 配置");const n={...a,modelscope:s};await o(n)},updateWebUIConfig:async s=>{const{config:a,updateConfig:o}=e();if(!a)throw new Error("配置未加载,无法更新 Web UI 配置");const n={...a,webUI:s};await o(n)},reset:()=>{console.log("[ConfigStore] 重置状态"),r(Qe,!1,"reset")},initialize:async()=>{const{setLoading:s,refreshConfig:a}=e();try{s({isLoading:!0}),console.log("[ConfigStore] 初始化配置 Store"),y.subscribe("data:configUpdate",o=>{console.log("[ConfigStore] 收到 WebSocket 配置更新"),e().setConfig(o,"websocket")}),await a(),console.log("[ConfigStore] 配置 Store 初始化完成")}catch(o){throw console.error("[ConfigStore] 配置 Store 初始化失败:",o),o}finally{s({isLoading:!1})}}}),{name:"config-store"})),H=()=>D(r=>r.config),Ut=()=>D(r=>{var e;return(e=r.config)==null?void 0:e.mcpEndpoint}),Ot=()=>D(r=>{var e;return(e=r.config)==null?void 0:e.mcpServers}),dr=()=>D(r=>{var e;return(e=r.config)==null?void 0:e.mcpServerConfig}),ur=()=>D(Me(r=>({getConfig:r.getConfig,updateConfig:r.updateConfig,refreshConfig:r.refreshConfig,reloadConfig:r.reloadConfig,updateMcpEndpoint:r.updateMcpEndpoint,updateMcpServers:r.updateMcpServers,updateConnectionConfig:r.updateConnectionConfig,updateModelScopeConfig:r.updateModelScopeConfig,updateWebUIConfig:r.updateWebUIConfig,reset:r.reset,initialize:r.initialize}))),et={connectionState:W.DISCONNECTED,wsUrl:"",connectionStats:{reconnectAttempts:0,maxReconnectAttempts:5,lastHeartbeat:0,eventListenerCount:0},portChangeStatus:void 0,lastError:null,connectedAt:null,disconnectedAt:null},re=Re()(Pe((r,e)=>({...et,setConnectionState:s=>{console.log("[WebSocketStore] 更新连接状态:",s);const a=Date.now(),o={connectionState:s};s===W.CONNECTED?(o.connectedAt=a,o.lastError=null):s===W.DISCONNECTED&&(o.disconnectedAt=a),r(o,!1,"setConnectionState");const n=y.getConnectionStats();e().setConnectionStats(n)},setWsUrl:s=>{console.log("[WebSocketStore] 更新 WebSocket URL:",s),r({wsUrl:s},!1,"setWsUrl")},setConnectionStats:s=>{r({connectionStats:s},!1,"setConnectionStats")},setLastError:s=>{console.log("[WebSocketStore] 更新连接错误:",s==null?void 0:s.message),r({lastError:s},!1,"setLastError")},setPortChangeStatus:s=>{console.log("[WebSocketStore] 更新端口变更状态:",s==null?void 0:s.status),r({portChangeStatus:s},!1,"setPortChangeStatus")},connect:async()=>{try{console.log("[WebSocketStore] 开始连接 WebSocket"),y.connect()}catch(s){const a=s instanceof Error?s:new Error("连接失败");throw console.error("[WebSocketStore] 连接失败:",a),e().setLastError(a),a}},disconnect:()=>{console.log("[WebSocketStore] 断开 WebSocket 连接"),y.disconnect()},reconnect:async()=>{try{console.log("[WebSocketStore] 重新连接 WebSocket"),y.disconnect(),await new Promise(s=>setTimeout(s,1e3)),y.connect()}catch(s){const a=s instanceof Error?s:new Error("重连失败");throw console.error("[WebSocketStore] 重连失败:",a),e().setLastError(a),a}},send:s=>{try{return y.send(s)}catch(a){const o=a instanceof Error?a:new Error("发送消息失败");return console.error("[WebSocketStore] 发送消息失败:",o),e().setLastError(o),!1}},updateUrl:s=>{console.log("[WebSocketStore] 更新 WebSocket URL:",s),y.setUrl(s),e().setWsUrl(s)},getConnectionInfo:()=>{const s=e();return{state:s.connectionState,url:s.wsUrl,stats:s.connectionStats,isConnected:s.connectionState===W.CONNECTED}},reset:()=>{console.log("[WebSocketStore] 重置状态"),r(et,!1,"reset")},initialize:()=>{console.log("[WebSocketStore] 初始化 WebSocket Store"),y.subscribe("connection:connecting",()=>{e().setConnectionState(W.CONNECTING)}),y.subscribe("connection:connected",()=>{e().setConnectionState(W.CONNECTED)}),y.subscribe("connection:disconnected",()=>{e().setConnectionState(W.DISCONNECTED)}),y.subscribe("connection:reconnecting",()=>{e().setConnectionState(W.RECONNECTING);const a=y.getConnectionStats();e().setConnectionStats(a)}),y.subscribe("connection:error",({error:a})=>{e().setLastError(a)}),y.subscribe("system:heartbeat",()=>{const a=y.getConnectionStats();e().setConnectionStats(a)});const s=y.getConnectionStats();e().setConnectionStats(s),e().setWsUrl(y.getUrl()),console.log("[WebSocketStore] WebSocket Store 初始化完成")},setConnected:s=>{console.warn("[WebSocketStore] setConnected 方法已废弃,请使用 setConnectionState");const a=s?W.CONNECTED:W.DISCONNECTED;e().setConnectionState(a)}}),{name:"websocket-store"})),Lt=()=>re(r=>r.connectionState===W.CONNECTED),fr=()=>re(r=>r.wsUrl),mr=()=>re(r=>r.portChangeStatus),Bt=()=>re(Me(r=>({setConnectionState:r.setConnectionState,setWsUrl:r.setWsUrl,setConnectionStats:r.setConnectionStats,setLastError:r.setLastError,setPortChangeStatus:r.setPortChangeStatus,connect:r.connect,disconnect:r.disconnect,reconnect:r.reconnect,send:r.send,updateUrl:r.updateUrl,reset:r.reset,initialize:r.initialize,getConnectionInfo:r.getConnectionInfo,setConnected:r.setConnected})));async function gr(r,e=3e3){try{const s=new AbortController,a=setTimeout(()=>s.abort(),e);let o;try{o=await fetch(`http://localhost:${r}/api/status`,{method:"GET",signal:s.signal})}catch{o=await fetch(`http://localhost:${r}/health`,{method:"GET",signal:s.signal})}return clearTimeout(a),o.ok}catch{return!1}}function tt(r,e){const s=window.location.protocol==="https:"?"wss:":"ws:",a=window.location.hostname||"localhost";return s==="ws:"&&r===80||s==="wss:"&&r===443?`${s}//${a}`:`${s}//${a}:${r}`}function pr(r){try{const e=new URL(r),s=Number.parseInt(e.port);return Number.isNaN(s)?null:s}catch{return null}}function J(){console.warn("[useWebSocket] 此 hook 已重构,建议使用新的专用 hooks:useWebSocketConnection()、useConfigData()、useStatusData()");const r=H(),e=Ps(),s=St(),a=Bt(),o=ur(),n=Ms(),[c,m]=i.useState(""),l=i.useRef(!1);i.useEffect(()=>{if(l.current)return;l.current=!0,console.log("[useWebSocket] 初始化 WebSocket 连接和数据加载"),y.isConnected()||y.connect();const h=y.getUrl();m(h),(async()=>{try{await Promise.allSettled([o.getConfig(),n.getStatus()]),console.log("[useWebSocket] 初始数据加载完成")}catch(j){console.error("[useWebSocket] 初始数据加载失败:",j)}})()},[o,n]);const x=i.useCallback(h=>{const v=localStorage.getItem("xiaozhi-ws-url");if(v)return v;let j=9999;if(h)j=h;else if(window.location.port){const E=Number.parseInt(window.location.port);Number.isNaN(E)||(j=E)}else window.location.protocol==="http:"&&!window.location.port?j=80:window.location.protocol==="https:"&&!window.location.port&&(j=443);return tt(j)},[]),f={connected:y.isConnected(),config:r,status:e,restartStatus:s||void 0},d=i.useCallback(async h=>{console.log("[useWebSocket] updateConfig 调用,使用新的 configActions");try{await o.updateConfig(h)}catch(v){throw console.error("[useWebSocket] 配置更新失败:",v),v}},[o]),p=i.useCallback(async()=>{console.log("[useWebSocket] refreshStatus 调用,使用新的 statusActions");try{await n.refreshStatus()}catch(h){throw console.error("[useWebSocket] 状态刷新失败:",h),h}},[n]),u=i.useCallback(async()=>{console.log("[useWebSocket] restartService 调用,使用新的 statusActions");try{await n.restartService()}catch(h){throw console.error("[useWebSocket] 服务重启失败:",h),h}},[n]),b=i.useCallback(h=>{if(console.log("[useWebSocket] setCustomWsUrl 调用,使用 WebSocketManager"),h)localStorage.setItem("xiaozhi-ws-url",h),y.setUrl(h);else{localStorage.removeItem("xiaozhi-ws-url");const v=x();y.setUrl(v)}m(y.getUrl())},[x]),w=i.useCallback(async h=>{if((pr(c)||9999)!==h){a.setPortChangeStatus({status:"checking",targetPort:h,timestamp:Date.now()});try{if(a.setPortChangeStatus({status:"checking",targetPort:h,timestamp:Date.now()}),!await gr(h))throw new Error(`端口 ${h} 不可用`);const E=tt(h);y.setUrl(E),m(E),console.log(`[WebSocket] 端口切换到 ${h} 成功完成`),a.setPortChangeStatus({status:"completed",targetPort:h,timestamp:Date.now()})}catch(j){const E=j instanceof Error?j.message:"端口切换失败";throw console.error(`[WebSocket] 端口切换到 ${h} 失败:`,E),a.setPortChangeStatus({status:"failed",targetPort:h,error:E,timestamp:Date.now()}),j}}},[c,a]);return{...f,updateConfig:d,refreshStatus:p,restartService:u,wsUrl:c,setCustomWsUrl:b,changePort:w}}const st=r=>`${r.slice(0,30)}...${r.slice(-10)}`,hr=r=>{if(!r.trim())return"请输入接入点地址";const e="wss://api.xiaozhi.me/mcp/?token=";if(!r.startsWith(e))return"接入点格式无效,请输入正确的小智服务端接入点地址";const s=r.substring(e.length);if(!s)return"接入点格式无效,缺少 token 参数";const a=s.split(".");if(a.length!==3)return"接入点格式无效,token 格式不正确";for(const o of a)if(!o||!/^[A-Za-z0-9_-]+$/.test(o))return"接入点格式无效,token 格式不正确";return null};function xr(){const[r,e]=i.useState(!1),[s,a]=i.useState(!1),[o,n]=i.useState(""),[c,m]=i.useState(!1),[l,x]=i.useState(!1),[f,d]=i.useState(""),[p,u]=i.useState(!1),[b,w]=i.useState(""),h=H(),v=Ut(),{updateConfig:j}=J(),E=async N=>{var A;try{if((A=navigator.clipboard)!=null&&A.writeText)await navigator.clipboard.writeText(N),S.success("接入点地址已复制到剪贴板");else{const P=document.createElement("textarea");P.value=N,P.style.position="fixed",P.style.opacity="0",document.body.appendChild(P),P.select();const X=document.execCommand("copy");if(document.body.removeChild(P),X)S.success("接入点地址已复制到剪贴板");else throw new Error("复制命令执行失败")}}catch(P){console.error("复制失败:",P),S.error("复制失败,请手动复制")}},Gt=async()=>{if(!h||!o){S.error("配置数据未加载或未选择要删除的接入点");return}m(!0);try{const A=(Array.isArray(v)?v:[v]).filter(Y=>Y!==o&&Y!==void 0),P=A.length>0?A.length===1?A[0]:A:"",X={...h,mcpEndpoint:P};await j(X),S.success("接入点已删除"),a(!1),n("")}catch(N){console.error("删除接入点失败:",N),S.error(N instanceof Error?N.message:"删除接入点失败")}finally{m(!1)}},Jt=async()=>{const N=hr(f);if(N){w(N);return}const A=Array.isArray(v)?v:[v];if(A.includes(f)){w("该接入点已存在");return}if(!h){S.error("配置数据未加载,请稍后重试");return}u(!0);try{const P=[f,...A.filter(Y=>Y!==void 0&&Y!=="")],X={...h,mcpEndpoint:P};await j(X),S.success("接入点添加成功"),x(!1),d(""),w("")}catch(P){console.error("添加接入点失败:",P),S.error(P instanceof Error?P.message:"添加接入点失败")}finally{u(!1)}},Xt=()=>{d(""),w(""),x(!0)},Yt=N=>{d(N),b&&w("")},Zt=N=>{n(N),a(!0)},Ge=i.useMemo(()=>{let N=[];return Array.isArray(v)&&(N=v),typeof v=="string"&&v.length&&N.push(v),N},[v]);return t.jsxs(ee,{open:r,onOpenChange:e,children:[t.jsx(be,{asChild:!0,children:t.jsx(C,{variant:"secondary",size:"icon",className:"size-8",children:t.jsx(ge,{className:"size-4"})})}),t.jsxs(q,{className:"sm:max-w-[600px]",children:[t.jsxs(V,{className:"mb-4",children:[t.jsx(K,{children:"配置小智服务端接入点"}),t.jsx(G,{children:"点击保存后,需要重启服务才会生效。"})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[Ge.map(N=>t.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 rounded-md font-mono",children:[t.jsx("span",{className:"flex-1 text-ellipsis overflow-hidden whitespace-nowrap",children:st(N)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(C,{variant:"outline",size:"icon",onClick:()=>E(N),title:"复制完整地址",children:t.jsx(us,{className:"size-4"})}),t.jsx(C,{variant:"outline",size:"icon",onClick:()=>Zt(N),title:"删除此接入点",children:t.jsx(ht,{className:"size-4 text-red-500"})})]})]},N)),Ge.length===0&&t.jsxs("div",{className:"flex flex-col items-center flex-1 text-sm text-muted-foreground text-center justify-center gap-2",children:[t.jsx(fs,{}),t.jsx("span",{children:"暂无接入点,请添加"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[t.jsxs(C,{size:"icon",className:"flex-1 flex items-center gap-2",onClick:Xt,children:[t.jsx(Ie,{className:"size-4"}),t.jsx("span",{children:"添加小智服务端接入点"})]}),t.jsx(C,{variant:"outline",size:"icon",className:"flex-1 flex items-center gap-2",onClick:()=>window.open("https://xiaozhi.me/console/agents","_blank"),children:t.jsx("span",{children:"打开小智服务端"})})]})]})]}),t.jsx(Dt,{open:s,onOpenChange:a,children:t.jsxs(Le,{children:[t.jsxs(Be,{children:[t.jsx(Fe,{children:"确认删除接入点"}),t.jsxs(_e,{children:['确定要删除接入点 "',st(o),'" 吗?此操作无法撤销。']})]}),t.jsxs(He,{children:[t.jsx(Ve,{disabled:c,children:"取消"}),t.jsx(qe,{onClick:Gt,disabled:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:c?"删除中...":"确定删除"})]})]})}),t.jsx(ee,{open:l,onOpenChange:x,children:t.jsxs(q,{className:"sm:max-w-[500px]",children:[t.jsxs(V,{children:[t.jsx(K,{children:"添加新的接入点"}),t.jsx(G,{children:"请输入小智服务端接入点地址"})]}),t.jsx("div",{className:"grid gap-4 py-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx($,{placeholder:"请输入接入点地址,例如:wss://api.xiaozhi.me/mcp/?token=...",value:f,onChange:N=>Yt(N.target.value),disabled:p,className:"font-mono text-sm"}),b&&t.jsx("p",{className:"text-sm text-red-500",children:b})]})}),t.jsxs(se,{children:[t.jsx(Se,{asChild:!0,children:t.jsx(C,{variant:"outline",disabled:p,children:"取消"})}),t.jsx(C,{onClick:Jt,disabled:p||!f.trim(),children:p?"添加中...":"确定"})]})]})})]})}const br=te("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ht=i.forwardRef(({className:r,...e},s)=>t.jsx(xt,{ref:s,className:g(br(),r),...e}));Ht.displayName=xt.displayName;const we=gs,Ft=i.createContext({}),F=({...r})=>t.jsx(Ft.Provider,{value:{name:r.name},children:t.jsx(ps,{...r})}),ve=()=>{const r=i.useContext(Ft),e=i.useContext(_t),{getFieldState:s,formState:a}=ms(),o=s(r.name,a);if(!r)throw new Error("useFormField should be used within <FormField>");const{id:n}=e;return{id:n,name:r.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...o}},_t=i.createContext({}),U=i.forwardRef(({className:r,...e},s)=>{const a=i.useId();return t.jsx(_t.Provider,{value:{id:a},children:t.jsx("div",{ref:s,className:g("space-y-2",r),...e})})});U.displayName="FormItem";const Z=i.forwardRef(({className:r,...e},s)=>{const{error:a,formItemId:o}=ve();return t.jsx(Ht,{ref:s,className:g(a&&"text-destructive",r),htmlFor:o,...e})});Z.displayName="FormLabel";const O=i.forwardRef(({...r},e)=>{const{error:s,formItemId:a,formDescriptionId:o,formMessageId:n}=ve();return t.jsx(_,{ref:e,id:a,"aria-describedby":s?`${o} ${n}`:`${o}`,"aria-invalid":!!s,...r})});O.displayName="FormControl";const Sr=i.forwardRef(({className:r,...e},s)=>{const{formDescriptionId:a}=ve();return t.jsx("p",{ref:s,id:a,className:g("text-sm text-muted-foreground",r),...e})});Sr.displayName="FormDescription";const L=i.forwardRef(({className:r,children:e,...s},a)=>{const{error:o,formMessageId:n}=ve(),c=o?String((o==null?void 0:o.message)??""):e;return c?t.jsx("p",{ref:a,id:n,className:g("text-sm font-medium text-destructive",r),...s,children:c}):null});L.displayName="FormMessage";const wr=I.object({port:I.string().min(1,{message:"端口号不能为空"}).refine(r=>!Number.isNaN(Number(r)),{message:"请输入有效的数字"}).refine(r=>Number(r)>=1&&Number(r)<=65535,{message:"端口号必须在 1-65535 之间"}).refine(r=>Number.isInteger(Number(r)),{message:"端口号必须是整数"})});function vr(){const[r,e]=i.useState(!1),[s,a]=i.useState(!1),o=H(),n=Lt(),c=mr(),{changePort:m}=J(),l=pe({resolver:he(wr),defaultValues:{port:"9999"}});i.useEffect(()=>{var d;(d=o==null?void 0:o.webUI)!=null&&d.port&&l.reset({port:o.webUI.port.toString()})},[o,l]);const x=()=>{if(s)return"处理中...";if((c==null?void 0:c.status)==="checking")return"检测端口...";if((c==null?void 0:c.status)==="polling"){const{currentAttempt:d,maxAttempts:p}=c;return`等待服务重启 (${d||0}/${p||45})`}return(c==null?void 0:c.status)==="connecting"?"连接中...":n?"保存并重启":"保存并连接"};async function f(d){var b;const p=Number(d.port),u=(b=o==null?void 0:o.webUI)==null?void 0:b.port;if(p===u){e(!1);return}console.log(`[WebUrlSettingButton] 开始端口切换: ${u} -> ${p}`),a(!0);try{S.info(n?`正在将端口从 ${u} 切换到 ${p}...`:`正在连接到端口 ${p}...`),await m(p),S.success(n?`端口已成功切换到 ${p},页面即将刷新...`:`已成功连接到端口 ${p},页面即将刷新...`),e(!1)}catch(w){console.error("端口切换失败:",w);const h=w instanceof Error?w.message:"端口切换失败";S.error(`端口切换失败: ${h}`)}finally{a(!1)}}return t.jsxs(ee,{open:r,onOpenChange:e,children:[t.jsx(be,{asChild:!0,children:t.jsx(C,{variant:"secondary",size:"icon",className:"size-8",children:t.jsx(ge,{className:"h-4 w-4"})})}),t.jsx(q,{className:"sm:max-w-[250px]",children:t.jsx(we,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(f),children:[t.jsxs(V,{className:"mb-4",children:[t.jsx(K,{children:"配置服务端端口"}),t.jsx(G,{children:n?"修改端口后将自动重启服务并重新连接。":"请输入服务端端口号,系统将尝试连接。"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{children:["ws://",window.location.hostname,":"]}),t.jsx("div",{className:"w-[100px]",children:t.jsx(F,{control:l.control,name:"port",render:({field:d})=>t.jsxs(U,{children:[t.jsx(O,{children:t.jsx($,{placeholder:"服务端端口,默认9999",className:"font-mono text-sm",disabled:s,type:"number",...d})}),t.jsx(L,{})]})})})]}),t.jsxs(se,{className:"mt-4",children:[t.jsx(Se,{asChild:!0,children:t.jsx(C,{variant:"outline",disabled:s,children:"取消"})}),t.jsx(C,{type:"submit",disabled:s||(c==null?void 0:c.status)==="polling",children:x()})]})]})})})]})}const B=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("rounded-lg border bg-card text-card-foreground shadow-sm",r),...e}));B.displayName="Card";const ne=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("flex flex-col space-y-1.5 p-6",r),...e}));ne.displayName="CardHeader";const ie=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("text-2xl font-semibold leading-none tracking-tight",r),...e}));ie.displayName="CardTitle";const ce=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("text-sm text-muted-foreground",r),...e}));ce.displayName="CardDescription";const Q=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("p-6 pt-0",r),...e}));Q.displayName="CardContent";const le=i.forwardRef(({className:r,...e},s)=>t.jsx("div",{ref:s,className:g("flex items-center p-6 pt-0",r),...e}));le.displayName="CardFooter";const Ne=({showValue:r=!0,value:e=0,maxValue:s=100,size:a=60,activeColor:o="#3b82f6",inactiveColor:n="#e5e7eb",symbol:c="%"})=>{const m=(a-6)/2,l=m*2*Math.PI,x=l,f=l-e/s*l;return t.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[t.jsxs("svg",{width:a,height:a,className:"transform -rotate-90",children:[t.jsx("circle",{cx:a/2,cy:a/2,r:m,stroke:n,strokeWidth:6,fill:"none"}),t.jsx("circle",{cx:a/2,cy:a/2,r:m,stroke:o,strokeWidth:6,fill:"none",strokeDasharray:x,strokeDashoffset:f,strokeLinecap:"round",className:"transition-all duration-300 ease-in-out"})]}),r&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-xs font-medium",children:[e,c]})})]})};function yr(){const r=Ot(),e=Lt(),s=Object.keys(r||{}).length,a=fr(),o=Ut();return t.jsxs("div",{className:"*:data-[slot=card]:shadow-xs @xl/main:grid-cols-2 @5xl/main:grid-cols-4 grid grid-cols-1 gap-4 px-4 *:data-[slot=card]:bg-gradient-to-t *:data-[slot=card]:from-primary/5 *:data-[slot=card]:to-card dark:*:data-[slot=card]:bg-card lg:px-6",children:[t.jsxs(B,{className:"@container/card",children:[t.jsxs(ne,{className:"relative",children:[t.jsx(ce,{children:"小智接入点"}),t.jsx(ie,{className:"@[250px]/card:text-3xl text-2xl font-semibold tabular-nums",children:Array.isArray(o)?o.length:o?1:0}),t.jsx("div",{className:"absolute right-4 top-4 flex flex-col items-center",children:t.jsx(Ne,{showValue:!1,value:Array.isArray(o)?o.length:o?1:0,maxValue:Math.max(Array.isArray(o)?o.length:1,1),activeColor:"#16a34a",inactiveColor:"#f87171",size:30,symbol:""})})]}),t.jsx(le,{className:"flex-col items-end gap-1 text-sm",children:t.jsx(xr,{})})]}),t.jsxs(B,{className:"@container/card",children:[t.jsxs(ne,{className:"relative",children:[t.jsx(ce,{children:"Xiaozhi Client"}),t.jsx(ie,{className:"@[250px]/card:text-3xl text-2xl font-semibold tabular-nums",children:e?"已连接":"未连接"}),t.jsx("div",{className:"absolute right-4 top-4",children:t.jsx(Ne,{showValue:!1,value:1,maxValue:1,activeColor:e?"#16a34a":"#f87171",inactiveColor:e?"#16a34a":"#f87171",size:30,symbol:""})})]}),t.jsxs(le,{className:"flex items-center justify-between gap-1 text-sm",children:[t.jsx("div",{className:"text-muted-foreground",children:a}),t.jsx(vr,{})]})]}),t.jsx(B,{className:"@container/card",children:t.jsxs(ne,{className:"relative",children:[t.jsx(ce,{children:"MCP服务"}),t.jsx(ie,{className:"@[250px]/card:text-3xl text-2xl font-semibold tabular-nums",children:s}),t.jsx("div",{className:"absolute right-4 top-4",children:t.jsx(Ne,{showValue:!1,value:s,maxValue:s,activeColor:"#16a34a",inactiveColor:"#f87171",size:30,symbol:""})})]})})]})}const jr=te("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ce({className:r,variant:e,...s}){return t.jsx("div",{className:g(jr({variant:e}),r),...s})}function Ee(r){if(!r||typeof r!="object")throw new Error("服务配置必须是一个有效的对象");if("command"in r&&typeof r.command=="string")return"stdio";if("type"in r&&r.type==="sse")return"sse";if("url"in r&&typeof r.url=="string")return"streamable-http";throw new Error("无法识别的 MCP 服务配置类型。配置必须包含 command 字段(stdio)、type: 'sse' 字段(sse)或 url 字段(streamable-http)")}const Ke=i.forwardRef(({className:r,...e},s)=>t.jsx("textarea",{className:g("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:s,...e}));Ke.displayName="Textarea";const Nr=I.object({config:I.string().min(2,{message:"配置不能为空"})});function rt(){const[r,e]=i.useState(!1),[s,a]=i.useState(!1),{updateConfig:o}=J(),n=H(),c=pe({resolver:he(Nr),defaultValues:{config:""}}),m=(f,d)=>{if(!d||typeof d!="object")return{valid:!1,error:`服务 "${f}" 的配置必须是一个对象`};const p="command"in d,u="type"in d,b="url"in d;if(p){if(!d.command||typeof d.command!="string")return{valid:!1,error:`服务 "${f}" 缺少必需的 command 字段或字段类型不正确`};if(!Array.isArray(d.args))return{valid:!1,error:`服务 "${f}" 的 args 字段必须是数组`}}else if(u&&d.type==="sse"){if(!d.url||typeof d.url!="string")return{valid:!1,error:`服务 "${f}" 缺少必需的 url 字段或字段类型不正确`}}else if(b){if(!d.url||typeof d.url!="string")return{valid:!1,error:`服务 "${f}" 缺少必需的 url 字段或字段类型不正确`};if(d.type&&d.type!=="streamable-http")return{valid:!1,error:`服务 "${f}" 的 type 字段如果存在,必须是 "streamable-http"`}}else return{valid:!1,error:`服务 "${f}" 的配置无效: 必须包含 command 字段(stdio)、type: 'sse' 字段(sse)或 url 字段(streamable-http)`};try{return Ee(d),{valid:!0}}catch(w){return{valid:!1,error:`服务 "${f}" 的配置无效: ${w instanceof Error?w.message:"未知错误"}`}}},l=f=>{try{const d=f.trim();if(!d)return{success:!1,error:"配置不能为空"};const p=JSON.parse(d);let u;if(p.mcpServers&&typeof p.mcpServers=="object")u=p.mcpServers;else if(typeof p=="object"&&!Array.isArray(p))try{Ee(p),u={[p.command?p.command.split("/").pop()||"mcp-server":p.type==="sse"?"sse-server":"http-server"]:p}}catch{u=p}else return{success:!1,error:"配置格式错误: 必须是对象格式"};for(const[b,w]of Object.entries(u)){const h=m(b,w);if(!h.valid)return{success:!1,error:h.error}}return{success:!0,data:u}}catch(d){return{success:!1,error:`JSON 格式错误: ${d instanceof Error?d.message:"无法解析 JSON"}`}}};async function x(f){if(!n){S.error("配置数据未加载,请稍后重试");return}a(!0);try{const d=l(f.config);if(!d.success){S.error(d.error||"配置验证失败");return}const p=d.data,u=Object.keys(p).filter(h=>h in(n.mcpServers||{}));if(u.length>0){S.error(`服务名称冲突: 以下服务已存在: ${u.join(", ")}`);return}const b={...n,mcpServers:{...p,...n.mcpServers}};await o(b);const w=Object.keys(p).length;S.success(w===1?`已添加 MCP 服务 "${Object.keys(p)[0]}"`:`已添加 ${w} 个 MCP 服务`),c.reset(),e(!1)}catch(d){console.error("更新配置失败:",d),S.error(d instanceof Error?d.message:"更新配置失败")}finally{a(!1)}}return t.jsxs(ee,{open:r,onOpenChange:e,children:[t.jsx(be,{asChild:!0,children:t.jsxs(C,{size:"icon",className:"w-full",children:[t.jsx(Ie,{className:"h-4 w-4"}),t.jsx("span",{children:"添加MCP服务"})]})}),t.jsx(q,{className:"sm:max-w-[500px]",children:t.jsx(we,{...c,children:t.jsxs("form",{onSubmit:c.handleSubmit(x),children:[t.jsxs(V,{className:"mb-4",children:[t.jsx(K,{children:"添加MCP服务"}),t.jsx(G,{children:"添加后,需要重启服务才会生效。"})]}),t.jsx("div",{className:"grid gap-4",children:t.jsx(F,{control:c.control,name:"config",render:({field:f})=>t.jsxs(U,{children:[t.jsx(O,{children:t.jsx(Ke,{className:"resize-none h-[300px] font-mono text-sm",disabled:s,placeholder:`支持三种通信方式:
|
|
2
|
+
|
|
3
|
+
1. 本地进程 (stdio):
|
|
4
|
+
{
|
|
5
|
+
"mcpServers": {
|
|
6
|
+
"local-server": {
|
|
7
|
+
"command": "npx",
|
|
8
|
+
"args": ["-y", "@example/mcp-server"]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
2. 服务器推送 (SSE):
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"sse-server": {
|
|
17
|
+
"type": "sse",
|
|
18
|
+
"url": "https://example.com/sse"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
3. 流式 HTTP:
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"http-server": {
|
|
27
|
+
"url": "https://example.com/mcp"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}`,...f})}),t.jsx(L,{})]})})}),t.jsxs(se,{className:"mt-4",children:[t.jsx(Se,{asChild:!0,children:t.jsx(C,{variant:"outline",disabled:s,children:"取消"})}),t.jsx(C,{type:"submit",disabled:s,children:s?"保存中...":"保存"})]})]})})})]})}const Cr=I.object({config:I.string().min(2,{message:"配置不能为空"})});function kr({mcpServer:r,mcpServerName:e}){const[s,a]=i.useState(!1),[o,n]=i.useState(!1),c=H(),{updateConfig:m}=J(),l=pe({resolver:he(Cr),defaultValues:{config:JSON.stringify(r,null,2)}});async function x(f){if(!c){S.error("配置数据未加载,请稍后重试");return}n(!0);try{let d;try{d=JSON.parse(f.config)}catch{S.error("JSON格式错误,请检查配置格式");return}if(!d||typeof d!="object"){S.error("配置格式无效");return}const p={...c,mcpServers:{...c.mcpServers,[e]:d}};await m(p),S.success("MCP服务器配置已更新"),a(!1)}catch(d){console.error("更新配置失败:",d),S.error(d instanceof Error?d.message:"更新配置失败")}finally{n(!1)}}return t.jsxs(ee,{open:s,onOpenChange:a,children:[t.jsx(be,{asChild:!0,children:t.jsx(C,{variant:"secondary",size:"icon",className:"size-8",children:t.jsx(ge,{className:"h-4 w-4"})})}),t.jsx(q,{className:"sm:max-w-[500px]",children:t.jsx(we,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(x),children:[t.jsxs(V,{className:"mb-4",children:[t.jsxs(K,{children:["配置 ",e," MCP"]}),t.jsx(G,{children:"点击保存后,需要重启服务才会生效。"})]}),t.jsx("div",{className:"grid gap-4",children:t.jsx(F,{control:l.control,name:"config",render:({field:f})=>t.jsxs(U,{children:[t.jsx(O,{children:t.jsx(Ke,{placeholder:"MCP服务配置",className:"resize-none h-[300px] font-mono text-sm",disabled:o,...f})}),t.jsx(L,{})]})})}),t.jsxs(se,{className:"mt-4",children:[t.jsx(Se,{asChild:!0,children:t.jsx(C,{variant:"outline",disabled:o,children:"取消"})}),t.jsx(C,{type:"submit",disabled:o,children:o?"保存中...":"保存"})]})]})})})]})}function Er({mcpServerName:r}){const[e,s]=i.useState(!1),{updateConfig:a}=J(),o=H(),n=async()=>{if(!o){S.error("配置未加载,无法删除服务");return}try{s(!0);const c={...o.mcpServers};delete c[r];const m=o.mcpServerConfig?{...o.mcpServerConfig}:void 0;m&&r in m&&delete m[r];const l={...o,mcpServers:c,mcpServerConfig:m};await a(l),S.success(`MCP 服务 "${r}" 已删除`)}catch(c){console.error("删除 MCP 服务失败:",c),S.error(`删除 MCP 服务失败: ${c instanceof Error?c.message:"未知错误"}`)}finally{s(!1)}};return t.jsxs(Dt,{children:[t.jsx(ir,{asChild:!0,children:t.jsx(C,{variant:"destructive",size:"icon",className:"size-8",children:t.jsx(ht,{className:"h-4 w-4"})})}),t.jsxs(Le,{children:[t.jsxs(Be,{children:[t.jsxs(Fe,{children:["确定要删除这个(",r,")MCP服务吗?"]}),t.jsx(_e,{children:"删除后,对应的工具列表也会移除。"})]}),t.jsxs(He,{children:[t.jsx(Ve,{children:"取消"}),t.jsx(qe,{onClick:n,disabled:e,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:e?"删除中...":"确定"})]})]})]})}function qt({disabled:r=!1,variant:e="outline",className:s="",restartingText:a="重启中...",defaultText:o="重启服务"}){const{loading:{isRestarting:n},restartService:c}=T(),m=wt(),l=async()=>{try{await c()}catch(f){console.error("[RestartButton] 重启失败:",f)}},x=()=>n?m.enabled&&m.startTime?"重连中...":a:o;return t.jsxs(C,{type:"button",onClick:l,variant:e,disabled:n||r,className:bt("flex items-center gap-2 w-[120px]",s),children:[n?t.jsx(xs,{className:"size-4 animate-spin"}):t.jsx(hs,{className:"size-4"}),x()]})}function Rr({updateConfig:r}){const e=dr(),s=Ot(),a=H(),o=i.useMemo(()=>Object.entries(e||{}).flatMap(([l,x])=>Object.entries((x==null?void 0:x.tools)||{}).map(([f,d])=>({serverName:l,toolName:f,...d}))),[e]),n=async(l,x,f)=>{var d,p,u,b,w,h;if(!r){S.error("updateConfig 方法未提供");return}if(!a){S.error("配置未加载");return}try{const v={...a,mcpServerConfig:{...a.mcpServerConfig,[l]:{...(d=a.mcpServerConfig)==null?void 0:d[l],tools:{...(u=(p=a.mcpServerConfig)==null?void 0:p[l])==null?void 0:u.tools,[x]:{...(h=(w=(b=a.mcpServerConfig)==null?void 0:b[l])==null?void 0:w.tools)==null?void 0:h[x],enable:!f}}}}};await r(v);const j=f?"禁用":"启用";S.success(`${j}工具 ${x} 成功`)}catch(v){console.error("切换工具状态失败:",v),S.error(v instanceof Error?v.message:"切换工具状态失败")}},c=o.filter(l=>l.enable),m=o.filter(l=>!l.enable);return!s||Object.keys(s).length===0?t.jsx("div",{className:"@container/main flex flex-1 flex-col gap-2",children:t.jsxs("div",{className:"flex flex-col gap-4 py-4 md:gap-6 md:py-6",children:[t.jsx("div",{className:"flex items-center justify-between px-4 lg:px-6",children:t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold",children:"你的聚合 MCP 服务"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"在这里管理你的 MCP 服务器和工具。"})]})}),t.jsx("div",{className:"px-4 lg:px-6",children:t.jsx(B,{className:"border-dashed",children:t.jsxs(Q,{className:"flex flex-col items-center justify-center py-12",children:[t.jsx(Je,{className:"h-12 w-12 text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"还没有 MCP 服务"}),t.jsx("p",{className:"text-sm text-muted-foreground text-center mb-4",children:"添加你的第一个 MCP 服务器来开始使用强大的工具集成功能。"}),t.jsx(rt,{})]})})})]})}):t.jsxs("div",{className:"flex flex-col gap-4 px-4 lg:px-6",children:[t.jsx("h2",{className:"text-2xl font-bold",children:"你的聚合 MCP 服务"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"你可以在这里管理你的 MCP 服务,包括启用/禁用工具,以及查看工具的详细信息。 最终暴露给小智服务端和其他MCP客户端的是这里聚合MCP"}),t.jsxs("div",{className:"*:data-[slot=card]:shadow-xs @xl/main:grid-cols-8 @5xl/main:grid-cols-8 grid grid-cols-1 gap-4 *:data-[slot=card]:bg-gradient-to-t *:data-[slot=card]:from-primary/5 *:data-[slot=card]:to-card dark:*:data-[slot=card]:bg-card",children:[t.jsx(B,{className:"transition-all duration-200 col-span-3",children:t.jsx(Q,{className:"p-4",children:t.jsxs("div",{className:"flex-col",children:[t.jsxs("h4",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[t.jsx(Xe,{className:"h-4 w-4"}),"使用中的工具 (",c.length,")"]}),t.jsx("div",{className:"flex-1 space-y-2",children:c.map(l=>t.jsxs("div",{className:"flex items-start justify-between p-4 bg-slate-50 rounded-md font-mono",children:[t.jsxs("div",{className:"text-md flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 justify-start",children:[t.jsx(Ce,{variant:"secondary",className:"rounded-md",children:l.serverName}),t.jsx("span",{children:l.toolName})]}),t.jsx("p",{className:"text-sm text-muted-foreground my-2",children:l.description}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.jsx("span",{className:"text-muted-foreground",children:"使用次数:"})," ",t.jsx("span",{className:"text-primary font-bold",children:l.usageCount||0})]}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.jsx("span",{className:"text-muted-foreground",children:"最后使用:"})," ",t.jsx("span",{className:"text-primary font-bold",children:l.lastUsedTime||"-"})]})]})]}),t.jsx("div",{className:"flex items-center gap-2 ml-4",children:t.jsx(C,{variant:"secondary",size:"icon",className:"size-8 hover:bg-red-500 hover:text-white",onClick:()=>n(l.serverName,l.toolName,!0),children:t.jsx(bs,{size:18})})})]},l.toolName))})]})})}),t.jsx(B,{className:"transition-all duration-200 col-span-3",children:t.jsx(Q,{className:"p-4",children:t.jsxs("div",{className:"flex-col",children:[t.jsxs("h4",{className:"text-sm font-medium mb-3 flex items-center gap-2",children:[t.jsx(Xe,{className:"h-4 w-4"}),"未使用的工具 (",m.length,")"]}),m.length===0&&t.jsxs("div",{className:"flex-1 flex flex-col items-center gap-4 py-20 px-4 bg-slate-50 rounded-md font-mono h-full",children:[t.jsx(Je,{strokeWidth:1.5,size:48,className:"text-muted-foreground"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"全部工具都已经启用"})]}),t.jsx("div",{className:"flex-1 space-y-2",children:m.map(l=>t.jsxs("div",{className:"flex items-start justify-between p-4 bg-slate-50 rounded-md font-mono",children:[t.jsxs("div",{className:"text-md flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 justify-start",children:[t.jsx(Ce,{variant:"secondary",className:"rounded-md",children:l.serverName}),t.jsx("span",{children:l.toolName})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:l.description}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.jsx("span",{className:"text-muted-foreground",children:"使用次数:"})," ",t.jsx("span",{className:"text-primary font-bold",children:l.usageCount||0})]}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.jsx("span",{className:"text-muted-foreground",children:"最后使用:"})," ",t.jsx("span",{className:"text-primary font-bold",children:l.lastUsedTime||"-"})]})]})]}),t.jsx("div",{className:"flex items-center gap-2 ml-4",children:t.jsx(C,{variant:"secondary",size:"icon",className:"size-8 hover:bg-green-500 hover:text-white",onClick:()=>n(l.serverName,l.toolName,!1),children:t.jsx(Ie,{className:"h-4 w-4"})})})]},l.toolName))})]})})}),t.jsxs("div",{className:"transition-all duration-200 gap-4 flex flex-col col-span-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(rt,{}),t.jsx(qt,{})]}),Object.entries(s||{}).map(([l,x])=>t.jsxs(B,{className:"transition-all duration-200",children:[t.jsx(Q,{className:"p-0",children:t.jsx("div",{className:"p-4 pb-2",children:t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx("div",{className:"flex items-start gap-4 flex-1",children:t.jsx("div",{className:"flex-1",children:t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("h3",{className:"text-lg font-semibold",children:l})})})}),t.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[t.jsx(kr,{mcpServerName:l,mcpServer:x}),t.jsx(Er,{mcpServerName:l})]})]})})}),t.jsx(le,{className:"p-4 pt-2",children:t.jsx(Ce,{variant:"outline",className:"text-xs",children:Ee(x)})})]},l))]})]})]})}function Vt({title:r}){return t.jsxs("header",{className:"group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear",children:[t.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[t.jsx(Pt,{className:"-ml-1"}),t.jsx(Te,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),t.jsx("h1",{className:"text-base font-medium",children:r})]}),t.jsx("div",{className:"flex w-full justify-end items-center gap-1 px-4 lg:gap-2 lg:px-6",children:t.jsx("a",{href:"https://github.com/shenjingnan/xiaozhi-client",target:"_blank",rel:"noopener noreferrer",children:t.jsx(Ss,{size:24,className:"text-slate-500",fill:"currentColor"})})})]})}class Pr{constructor(){k(this,"apiClient");k(this,"webSocketManager");k(this,"initialized",!1);this.apiClient=z,this.webSocketManager=y}async initialize(){this.initialized||(console.log("[NetworkService] 初始化网络服务"),this.webSocketManager.connect(),this.initialized=!0,console.log("[NetworkService] 网络服务初始化完成"))}destroy(){console.log("[NetworkService] 销毁网络服务"),this.webSocketManager.disconnect(),this.initialized=!1}async getConfig(){return this.apiClient.getConfig()}async updateConfig(e){return this.apiClient.updateConfig(e)}async getStatus(){return this.apiClient.getStatus()}async getClientStatus(){return this.apiClient.getClientStatus()}async restartService(){return this.apiClient.restartService()}async stopService(){return this.apiClient.stopService()}async startService(){return this.apiClient.startService()}async getServiceStatus(){return this.apiClient.getServiceStatus()}async getServiceHealth(){return this.apiClient.getServiceHealth()}async getMcpEndpoint(){return this.apiClient.getMcpEndpoint()}async getMcpEndpoints(){return this.apiClient.getMcpEndpoints()}async getMcpServers(){return this.apiClient.getMcpServers()}async getConnectionConfig(){return this.apiClient.getConnectionConfig()}async reloadConfig(){return this.apiClient.reloadConfig()}async getConfigPath(){return this.apiClient.getConfigPath()}async checkConfigExists(){return this.apiClient.checkConfigExists()}async getRestartStatus(){return this.apiClient.getRestartStatus()}async checkClientConnected(){return this.apiClient.checkClientConnected()}async getLastHeartbeat(){return this.apiClient.getLastHeartbeat()}async getActiveMCPServers(){return this.apiClient.getActiveMCPServers()}async updateClientStatus(e){return this.apiClient.updateClientStatus(e)}async setActiveMCPServers(e){return this.apiClient.setActiveMCPServers(e)}async resetStatus(){return this.apiClient.resetStatus()}getWebSocketState(){return this.webSocketManager.getState()}isWebSocketConnected(){return this.webSocketManager.isConnected()}setWebSocketUrl(e){this.webSocketManager.setUrl(e)}onWebSocketEvent(e,s){this.webSocketManager.on(e,s)}offWebSocketEvent(e){this.webSocketManager.off(e)}reconnectWebSocket(){this.webSocketManager.disconnect(),setTimeout(()=>{this.webSocketManager.connect()},1e3)}async getFullAppState(){const[e,s]=await Promise.all([this.getConfig(),this.getStatus()]);return{config:e,status:s,webSocketConnected:this.isWebSocketConnected()}}async updateConfigWithNotification(e,s=5e3){return new Promise((a,o)=>{const n=setTimeout(()=>{this.webSocketManager.off("configUpdate"),o(new Error("等待配置更新通知超时"))},s);this.webSocketManager.on("configUpdate",()=>{clearTimeout(n),this.webSocketManager.off("configUpdate"),a()}),this.updateConfig(e).catch(c=>{clearTimeout(n),this.webSocketManager.off("configUpdate"),o(c)})})}async restartServiceWithNotification(e=3e4){return new Promise((s,a)=>{const o=setTimeout(()=>{this.webSocketManager.off("restartStatus"),a(new Error("等待重启状态通知超时"))},e);this.webSocketManager.on("restartStatus",n=>{n.status==="completed"?(clearTimeout(o),this.webSocketManager.off("restartStatus"),s()):n.status==="failed"&&(clearTimeout(o),this.webSocketManager.off("restartStatus"),a(new Error(n.error||"服务重启失败")))}),this.restartService().catch(n=>{clearTimeout(o),this.webSocketManager.off("restartStatus"),a(n)})})}}const R=new Pr;function Mr(){const r=Bt(),e=i.useRef(!1);i.useEffect(()=>{if(!e.current)return console.log("[NetworkService] 初始化网络服务"),e.current=!0,R.initialize().catch(u=>{console.error("[NetworkService] 初始化失败:",u)}),R.onWebSocketEvent("connected",()=>{console.log("[NetworkService] WebSocket 已连接"),r.setConnectionState(W.CONNECTED),s()}),R.onWebSocketEvent("disconnected",()=>{console.log("[NetworkService] WebSocket 已断开"),r.setConnectionState(W.DISCONNECTED)}),R.onWebSocketEvent("configUpdate",u=>{console.log("[NetworkService] 收到配置更新通知"),D.getState().setConfig(u,"websocket")}),R.onWebSocketEvent("statusUpdate",u=>{console.log("[NetworkService] 收到状态更新通知"),T.getState().setClientStatus(u,"websocket")}),R.onWebSocketEvent("restartStatus",u=>{console.log("[NetworkService] 收到重启状态通知:",u),T.getState().setRestartStatus(u,"websocket")}),R.onWebSocketEvent("error",u=>{console.error("[NetworkService] WebSocket 错误:",u)}),()=>{console.log("[NetworkService] 清理网络服务"),R.destroy(),e.current=!1}},[r]);const s=i.useCallback(async()=>{try{console.log("[NetworkService] 加载初始数据");const[u,b]=await Promise.all([R.getConfig(),R.getClientStatus()]);console.log("[NetworkService] 初始数据加载成功"),D.getState().setConfig(u,"http"),T.getState().setClientStatus(b,"http")}catch(u){console.error("[NetworkService] 加载初始数据失败:",u)}},[]),a=i.useCallback(async()=>{try{const u=await R.getConfig();return D.getState().setConfig(u,"http"),u}catch(u){throw console.error("[NetworkService] 获取配置失败:",u),u}},[]),o=i.useCallback(async u=>{try{console.log("[NetworkService] 更新配置"),await R.updateConfig(u),D.getState().setConfig(u,"http"),console.log("[NetworkService] 配置更新成功")}catch(b){throw console.error("[NetworkService] 配置更新失败:",b),b}},[]),n=i.useCallback(async()=>{try{const u=await R.getStatus();return T.getState().setClientStatus(u.client,"http"),u}catch(u){throw console.error("[NetworkService] 获取状态失败:",u),u}},[]),c=i.useCallback(async()=>{try{await n()}catch(u){console.error("[NetworkService] 刷新状态失败:",u)}},[n]),m=i.useCallback(async()=>{try{console.log("[NetworkService] 重启服务"),await R.restartService(),console.log("[NetworkService] 重启请求已发送")}catch(u){throw console.error("[NetworkService] 重启服务失败:",u),u}},[]),l=i.useCallback(async(u=3e4)=>{try{console.log("[NetworkService] 重启服务并等待通知"),await R.restartServiceWithNotification(u),console.log("[NetworkService] 服务重启完成")}catch(b){throw console.error("[NetworkService] 重启服务失败:",b),b}},[]),x=i.useCallback(async(u,b=5e3)=>{try{console.log("[NetworkService] 更新配置并等待通知"),await R.updateConfigWithNotification(u,b),console.log("[NetworkService] 配置更新完成")}catch(w){throw console.error("[NetworkService] 配置更新失败:",w),w}},[]),f=i.useCallback(u=>{console.log("[NetworkService] 设置自定义 WebSocket URL:",u),R.setWebSocketUrl(u),r.setWsUrl(u)},[r]),d=i.useCallback(async u=>{try{console.log(`[NetworkService] 切换到端口 ${u}`),r.setPortChangeStatus({status:"checking",targetPort:u,timestamp:Date.now()});const b=window.location.protocol==="https:"?"wss:":"ws:",w=window.location.hostname,h=`${b}//${w}:${u}`;await m(),await new Promise(v=>setTimeout(v,5e3)),f(h),window.location.reload()}catch(b){throw console.error("[NetworkService] 端口切换失败:",b),r.setPortChangeStatus({status:"failed",targetPort:u,error:b instanceof Error?b.message:"端口切换失败",timestamp:Date.now()}),b}},[r,m,f]),p=i.useCallback(()=>{const u=localStorage.getItem("xiaozhi-ws-url");if(u)return u;const b=window.location.protocol==="https:"?"wss:":"ws:",w=window.location.hostname,h=window.location.port;return`${b}//${w}${h?`:${h}`:""}`},[]);return{getConfig:a,updateConfig:o,getStatus:n,refreshStatus:c,restartService:m,updateConfigWithNotification:x,restartServiceWithNotification:l,setCustomWsUrl:f,getWebSocketUrl:p,changePort:d,loadInitialData:s,isWebSocketConnected:()=>R.isWebSocketConnected(),getWebSocketState:()=>R.getWebSocketState()}}async function Wr(){console.log("[Stores] 开始初始化所有 stores");try{console.log("[Stores] 初始化 WebSocket store"),re.getState().initialize(),console.log("[Stores] 初始化配置 store"),await D.getState().initialize(),console.log("[Stores] 初始化状态 store"),await T.getState().initialize(),console.log("[Stores] 所有 stores 初始化完成")}catch(r){throw console.error("[Stores] Stores 初始化失败:",r),r}}const Kt=i.createContext(null);function Ir({children:r}){const e=Mr(),[s,a]=i.useState(!1);return i.useEffect(()=>{let o=!0;return(async()=>{try{console.log("[WebSocketProvider] 开始初始化 stores"),await Wr(),o&&(a(!0),console.log("[WebSocketProvider] Stores 初始化完成"))}catch(c){console.error("[WebSocketProvider] Stores 初始化失败:",c),o&&a(!0)}})(),()=>{o=!1}},[]),s?t.jsx(Kt.Provider,{value:e,children:r}):t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-2"}),t.jsx("p",{className:"text-sm text-gray-600",children:"正在初始化应用..."})]})})}function Ar(){const r=i.useContext(Kt);if(!r)throw new Error("useNetworkServiceActions must be used within a NetworkServiceProvider");return r}const Tr=Ir,Dr=Ar;function zr(){const{updateConfig:r}=Dr();return t.jsxs(De,{children:[t.jsx(Tt,{variant:"inset"}),t.jsxs(ze,{children:[t.jsx(Vt,{title:"看板"}),t.jsx("div",{className:"flex flex-1 flex-col",children:t.jsx("div",{className:"@container/main flex flex-1 flex-col gap-2",children:t.jsxs("div",{className:"flex flex-col gap-4 py-4 md:gap-6 md:py-6",children:[t.jsx(yr,{}),t.jsx(Rr,{updateConfig:r})]})})})]})]})}const $r=I.object({modelscope:I.object({apiKey:I.string().min(2,{message:"API Key不能为空"}).optional()}),connection:I.object({heartbeatInterval:I.number().min(1e3,{message:"心跳间隔不能小于1000毫秒"}),heartbeatTimeout:I.number().min(1e3,{message:"心跳超时不能小于1000毫秒"}),reconnectInterval:I.number().min(1e3,{message:"重连间隔不能小于1000毫秒"})})});function Ur(){var c,m,l,x;const r=H(),{updateConfig:e}=J(),[s,a]=i.useState(!1),o=pe({resolver:he($r),defaultValues:{modelscope:{apiKey:((c=r==null?void 0:r.modelscope)==null?void 0:c.apiKey)||""},connection:{heartbeatInterval:((m=r==null?void 0:r.connection)==null?void 0:m.heartbeatInterval)||3e4,heartbeatTimeout:((l=r==null?void 0:r.connection)==null?void 0:l.heartbeatTimeout)||1e4,reconnectInterval:((x=r==null?void 0:r.connection)==null?void 0:x.reconnectInterval)||5e3}}});i.useEffect(()=>{var f,d,p,u;o.reset({modelscope:{apiKey:((f=r==null?void 0:r.modelscope)==null?void 0:f.apiKey)||""},connection:{heartbeatInterval:((d=r==null?void 0:r.connection)==null?void 0:d.heartbeatInterval)||3e4,heartbeatTimeout:((p=r==null?void 0:r.connection)==null?void 0:p.heartbeatTimeout)||1e4,reconnectInterval:((u=r==null?void 0:r.connection)==null?void 0:u.reconnectInterval)||5e3}})},[r,o.reset]);async function n(f){if(!r){S.error("配置数据未加载,请稍后重试");return}a(!0);try{const d={...r,modelscope:{apiKey:f.modelscope.apiKey},connection:{heartbeatInterval:f.connection.heartbeatInterval,heartbeatTimeout:f.connection.heartbeatTimeout,reconnectInterval:f.connection.reconnectInterval}};await e(d),S.success("配置已更新")}catch(d){console.error("更新配置失败:",d),S.error(d instanceof Error?d.message:"更新配置失败")}finally{a(!1)}}return t.jsxs(De,{children:[t.jsx(Tt,{variant:"inset"}),t.jsxs(ze,{children:[t.jsx(Vt,{title:"设置"}),t.jsx("div",{className:"flex flex-1 flex-col p-4",children:t.jsx("div",{className:"@container/main flex flex-1 flex-col gap-2 items-center",children:t.jsx("div",{className:"flex flex-col gap-4 py-4 md:gap-6 md:py-6 w-[600px]",children:t.jsx(we,{...o,children:t.jsx("form",{onSubmit:o.handleSubmit(n),children:t.jsxs("div",{className:"grid gap-4",children:[t.jsx(F,{control:o.control,name:"modelscope.apiKey",render:({field:f})=>t.jsxs(U,{children:[t.jsx(Z,{children:"魔搭社区 API Key"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(O,{children:t.jsx($,{placeholder:"魔搭社区 API Key",className:"font-mono text-sm",type:"password",disabled:s,...f})}),t.jsx(C,{variant:"outline",onClick:()=>{window.open("https://www.modelscope.cn/my/myaccesstoken","_blank")},children:"打开魔搭社区"})]}),t.jsx(L,{})]})}),t.jsx(F,{control:o.control,name:"connection.heartbeatInterval",render:({field:f})=>t.jsxs(U,{children:[t.jsx(Z,{children:"心跳间隔(毫秒)"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(O,{children:t.jsx($,{placeholder:"心跳间隔(毫秒)",className:"font-mono text-sm",type:"number",disabled:s,...f,value:f.value||"",onChange:d=>{const p=d.target.value;f.onChange(p===""?"":Number(p))}})}),t.jsx("span",{className:"text-sm text-muted-foreground w-[50px]",children:"毫秒"})]}),t.jsx(L,{})]})}),t.jsx(F,{control:o.control,name:"connection.heartbeatTimeout",render:({field:f})=>t.jsxs(U,{children:[t.jsx(Z,{children:"心跳超时(毫秒)"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(O,{children:t.jsx($,{placeholder:"心跳超时(毫秒)",className:"font-mono text-sm",type:"number",disabled:s,...f,value:f.value||"",onChange:d=>{const p=d.target.value;f.onChange(p===""?"":Number(p))}})}),t.jsx("span",{className:"text-sm text-muted-foreground w-[50px]",children:"毫秒"})]}),t.jsx(L,{})]})}),t.jsx(F,{control:o.control,name:"connection.reconnectInterval",render:({field:f})=>t.jsxs(U,{children:[t.jsx(Z,{children:"重连间隔(毫秒)"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(O,{children:t.jsx($,{placeholder:"重连间隔(毫秒)",className:"font-mono text-sm",type:"number",disabled:s,...f,value:f.value||"",onChange:d=>{const p=d.target.value;f.onChange(p===""?"":Number(p))}})}),t.jsx("span",{className:"text-sm text-muted-foreground w-[50px]",children:"毫秒"})]}),t.jsx(L,{})]})}),t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsx(C,{type:"submit",disabled:s,className:"flex-1",children:s?"保存中...":"保存"}),t.jsx(qt,{})]})]})})})})})})]})]})}function Or(){return t.jsxs(Tr,{children:[t.jsx(Is,{}),t.jsxs(ws,{children:[t.jsx(ye,{path:"/",element:t.jsx(vs,{to:"/dashboard"})}),t.jsx(ye,{path:"/dashboard",element:t.jsx(zr,{})}),t.jsx(ye,{path:"/settings",element:t.jsx(Ur,{})})]}),t.jsx(ks,{richColors:!0,toastOptions:{classNames:{description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-white group-[.toast]:text-black",error:"group toast group-[.toaster]:bg-red group-[.toaster]:text-red-600 dark:group-[.toaster]:text-foreground group-[.toaster]:shadow-lg",success:"group toast group-[.toaster]:bg-green group-[.toaster]:text-green-600 dark:group-[.toaster]:text-foreground group-[.toaster]:shadow-lg",warning:"group toast group-[.toaster]:bg-yellow group-[.toaster]:text-yellow-600 dark:group-[.toaster]:text-foreground group-[.toaster]:shadow-lg",info:"group toast group-[.toaster]:bg-blue group-[.toaster]:text-blue-600 dark:group-[.toaster]:text-foreground group-[.toaster]:shadow-lg"}}})]})}ys.createRoot(document.getElementById("root")).render(t.jsx(js.StrictMode,{children:t.jsx(Ns,{children:t.jsx(Or,{})})}));
|
|
31
|
+
//# sourceMappingURL=index-DXZqFLxf.js.map
|