import{u as a,l as s,a4 as e,$ as t,M as n,z as l,A as o,a7 as i,x as r,bK as c,a2 as u,v as m}from"./utils-lib.js?v=20260328163632";import{B as p}from"./index91.js?v=20260328163632";import{B as d}from"./index97.js?v=20260328163632";import{u as g,s as _,g as S,a as y,b as k,c as w,d as L,o as b}from"./wsl.js?v=20260328163632";import{u as W}from"./index92.js?v=20260328163632";import{r as h,O as f,j as v,k as x,o as j,J as C,V as q,W as O,X as R,a3 as A,Y as E,_ as H,a1 as I,F as P,Z as V}from"./base-lib.js?v=20260328163632";const{panel:B}=a(),D=h(!1),F=h(!0),T=h(null),z=[{content:f("span",null,[s("WSL 子系统是“按需启动、空闲即停”机制："),s("只要没有前台/后台进程在运行，WSL 子系统会在一段时间后自动停止（释放资源）。")])},{content:s("WSL所有子系统无法公用一个端口，如需多个WLS开启多个SSH，请更换其他端口")},{content:f("span",{class:"text-danger"},[v("* "),s("Wsl需要桌面权限，如无法正常使用，请远程桌面后运行"),v(" [")," ",B.value.paths.panel,v("/script/wsl_agent.exe ]")])},{content:f("span",{class:"text-danger"},[s("！！！云服务器请勿操作"),v(", "),f("a",{class:"bt-link",href:"https://www.asus.com.cn/support/faq/1045141/",target:"_blank"},[s("本地服务器开启BIOS虚拟化教程")])])}],M=async a=>{const e=n.load(s("正在获取SSH信息，请稍后...")),t=await Q(a.name);if(e.close(),t.status)o({title:"[ ".concat(a.name," ] - ")+s("终端"),area:[1e3,544],customClass:"bt-wsl-terminal",component:()=>i((()=>import("./index187.js?v=20260328163632")),[],import.meta.url),compData:{host:a.ip,ps:a.hostname,port:t.port,username:"root",pkey:t.key_info.key,ostype:"linux"},showFooter:!1});else{await l({title:s("提示"),content:s("当前WSL的SSH服务未开启，是否开启后查看终端？")});(await U(a.name,1)).status&&M(a)}},J=h({columns:[{title:s("子系统名称"),key:"name"},{title:s("版本"),key:"os_version"},{title:s("状态"),key:"state",width:100,render:a=>{let e="Running"===a.state;return f(c,{modelValue:e,onClick:()=>(a=>{r({loading:s("正在设置WSL子系统状态，请稍后..."),request:w({name:a.name,status:"Running"===a.state?0:1}),message:!0,success:a=>{Y()}})})(a)},null)}},{title:s("主机名"),key:"hostname"},{title:s("IP地址"),key:"ip"},{title:s("启动时间"),key:"boot_time"},e([{onClick:M,title:s("终端")},{onClick:a=>{T.value=a,o({title:"[ ".concat(a.name," ] - ")+s("设置"),area:[800,530],component:()=>i((()=>import("./index188.js?v=20260328163632")),[],import.meta.url),showFooter:!1})},title:s("设置")},{onClick:async a=>{await l({title:s("卸载WSL版本")+" [".concat(a.name,"]"),content:s("是否确认卸载该WSL版本？")}),r({loading:s("正在卸载，请稍后..."),request:g({name:a.name}),message:!0,success:()=>{Y()}})},title:s("卸载"),type:"danger"}])],data:[]}),[K,N]=t(J),{BtOperation:X}=W({options:[{active:!0,label:s("安装WSL"),onClick:()=>{o({title:s("安装WSL子系统"),area:500,component:()=>i((()=>import("./index189.js?v=20260328163632")),[],import.meta.url),showFooter:!0})}},{label:s("关闭所有WSL"),onClick:async()=>{await l({title:s("关闭所有WSL子系统"),content:s("是否确认关闭所有WSL子系统？")}),r({loading:s("正在关闭所有WSL子系统，请稍后..."),request:_(),message:!0,success:a=>{Y()}})}}]}),Y=async()=>r({loading:D,request:S(),success:a=>{J.value.data=Array.isArray(a.data)?a.data:[]}}),Z=()=>{r({loading:s("正在打开WSL管理界面，请稍后..."),request:b(),success:a=>{var s;n.msg({customClass:"bt-message-error-html",isHtml:!0,message:null==(s=a.msg)?void 0:s.replace(/\n/g,"<br/>"),type:a.status?"success":"error",duration:a.status?3e3:0,showClose:!a.status}),Y()}})},$=async()=>{await r({loading:D,request:L(),success:a=>{F.value=a.data.status.status}}),Y()},G=()=>{T.value=null,D.value=!1,J.value.data=[]},Q=async a=>(await r({request:y({name:a}),success:a=>{}})).data,U=async(a,e)=>await r({loading:s("正在{0}SSH服务，请稍后...",[s(e?"开启":"关闭")]),request:k({name:a,status:Number(e)}),message:!0}),aa={class:"relative"},sa=x({__name:"index",setup:a=>(j($),C(G),(a,e)=>(q(),O(P,null,[R("div",aa,[f(E(u),null,{"header-left":A((()=>[f(E(X),{class:"gap-10px"})])),"header-right":A((()=>[f(E(p),{onRefresh:E(Y)},null,8,["onRefresh"])])),content:A((()=>[f(E(K),{loading:E(D)},null,8,["loading"])])),_:1}),E(F)?I("",!0):(q(),H(d,{key:0},{content:A((()=>[R("p",null,[v(V(E(s)("当前未开启WSL管理"))+" ",1),R("span",{class:"bt-link",onClick:e[0]||(e[0]=(...a)=>E(Z)&&E(Z)(...a))},V(E(s)("点击开启")),1)])])),_:1}))]),f(E(m),{class:"mt-20px",options:E(z)},null,8,["options"])],64)))}),ea=Object.freeze(Object.defineProperty({__proto__:null,default:sa},Symbol.toStringTag,{value:"Module"}));export{Q as a,Y as g,ea as i,T as r,U as s};
