import{cI as a,M as t,P as s,p as e,aK as o}from"./utils-lib.js?v=1761009159";import{u as i}from"./useController5.js?v=1761009159";import{u as r}from"./useStore13.js?v=1761009159";import{s as l}from"./base-lib.js?v=1761009159";import{addDomain as n,removeDomain as u}from"./site.js?v=1761009159";import{o as m}from"./useController6.js?v=1761009159";const{localRow:c}=l(i()),{isRefreshDomain:d,domain:v,tabActive:p}=l(r()),y=async()=>{try{const{data:t}=await a({table:"domain",list:"True",search:c.value.id});return{data:t,total:0}}catch(t){return{data:[],total:0,other:{}}}},h=async()=>{""!==v.value.trim()?s({loading:"正在添加域名，请稍后...",request:n({id:c.value.id,webname:c.value.name,domain:v.value.trim().split("\n").join(",")}),success:a=>{var t,s;m({title:"域名添加结果",resultData:(null==(t=null==a?void 0:a.data)?void 0:t.domains)||(null==(s=null==a?void 0:a.data)?void 0:s.data)||[],autoTitle:"添加域名完成"}),v.value="",d.value=!0}}):t.error("域名不能为空!")},w=async a=>{try{await e({icon:"warning-filled",title:"批量删除",content:"同时删除选中的域名，是否继续？",type:"calc"});let t=[];return await Promise.all(a.map(async a=>{const s={id:c.value.id,webname:c.value.name,domain:a.name,port:a.port};try{const e=await u(s);t.push({name:a.name,msg:e.msg,status:e.status})}catch(e){o(e)}})),m({resultData:t,autoTitle:"删除域名完成"}),d.value=!0,{status:!0,msg:"删除域名成功"}}catch(t){return{status:!1,msg:"删除域名失败"}}},b=async a=>{try{const s=await u({id:c.value.id,webname:c.value.name,domain:a.name,port:a.port});t.request(s),d.value=!0}catch(s){}},f=async()=>{c.value.php_version_status||(p.value="php")},g=async()=>{c.value.php_version_status=!0};export{w as a,b as d,y as g,f as i,h as o,g as u};
