import{d as s,y as i}from"./index-73815609.js";const r=s({id:"common",state:()=>({websocket:null,log_cache:[],log_cache_max_len:1e3,startTime:-1,tutorial_map:{qq_official_webhook:"https://astrbot.app/deploy/platform/qqofficial/webhook.html",qq_official:"https://astrbot.app/deploy/platform/qqofficial/websockets.html",aiocqhttp:"https://astrbot.app/deploy/platform/aiocqhttp/napcat.html",wecom:"https://astrbot.app/deploy/platform/wecom.html",gewechat:"https://astrbot.app/deploy/platform/gewechat.html",lark:"https://astrbot.app/deploy/platform/lark.html",telegram:"https://astrbot.app/deploy/platform/telegram.html"}}),actions:{createWebSocket(){if(this.websocket)return;let t=window.location.protocol==="https:"?"wss":"ws",e="/api/live-log",a=window.location.port,o=`${t}://${window.location.hostname}:${a}${e}`;console.log("websocket url:",o),this.websocket=new WebSocket(o),this.websocket.onmessage=l=>{this.log_cache.push(l.data),this.log_cache.length>this.log_cache_max_len&&this.log_cache.shift()}},getLogCache(){return this.log_cache},getStartTime(){if(this.startTime!==-1)return this.startTime;i.get("/api/stat/start-time").then(t=>{this.startTime=t.data.data.start_time})},getTutorialLink(t){return this.tutorial_map[t]}}});export{r as u};
