import{u as a,l as e,bH as s,K as l,t,aX as r,H as o,x as i,M as n}from"./utils-lib.js?v=20260328163632";import{B as u}from"./index85.js?v=20260328163632";import{bG as p}from"./site.js?v=20260328163632";import{u as m}from"./store4.js?v=20260328163632";import{k as c,a9 as d,c as v,r as h,O as g,o as b,V as w,_ as f,Y as y}from"./base-lib.js?v=20260328163632";import{b as x,g as j}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const _=c({__name:"index",setup(c,{expose:_}){const{panel:C,plugin:I}=a(),{sitePath:k}=d(C.value),{isRefreshList:H}=m(),K=v((()=>((k.value||"C:/wwwroot")+"/").replace(/\/\//g,"/")));let O=!1;h("php"),h([]);const P={labelStyle:"min-width: 100px"},V=h({formAttrs:{labelWidth:"auto"},formItems:[]}),S=a=>{var e,s,l;L.value.domains=a;const t=r(a)?null==a?void 0:a.split("\n"):[a];O||(L.value.path="".concat(null==(e=K.value)?void 0:e.replace(/\/\//g,"/")).concat(null==(l=null==(s=t[0])?void 0:s.replace(/:/g,"_"))?void 0:l.trim())),L.value.ps=t[0]},U=h({label:e("绑定域名"),attrs:P,ruleKey:"domains",rules:[s()],children:[{type:"custom",render:()=>g(j,{placement:"top-start",class:"popper-primary",width:400,trigger:"focus"},{default:()=>g("div",{class:"bg-primary text-white"},[e("如需填写多个域名，请换行填写，每行一个域名，默认为80端口"),g("br",null,null),e("IP地址格式：192.168.1.199"),g("br",null,null),e("泛解析添加方法：先添加一个域名 domain.com，后换行添加*.domain.com"),g("br",null,null),e("如另加端口格式为 www.domain.com:88")]),trigger:()=>g(x,{value:L.value.domains,"onUpdate:value":[a=>L.value.domains=a,S],placeholder:e("如需填写多个域名，请换行填写，每行一个域名，默认为80端口")+"\n"+e("IP地址格式：192.168.1.199")+"\n"+e("泛解析添加方法 *.domain.com")+"\n"+e("如另加端口格式为 www.domain.com:88"),type:"textarea",rows:4,class:"!w-500px"},null)})}]}),q=h({label:e("备注"),attrs:P,children:[{type:"input",key:"ps",attrs:{class:"!w-330px",placeholder:e("请输入网站备注，可为空")}}]}),A=()=>{o({type:"dir",path:K.value,change:a=>{O=!0,L.value.path=a}})},B=h({label:e("根目录"),attrs:P,ruleKey:"path",rules:[l({message:e("请选择根目录"),trigger:["blur","input"]})],children:[{type:"custom",key:"path",render:()=>g(u,{modelValue:L.value.path,"onUpdate:modelValue":a=>L.value.path=a,onIconClick:A,placeholder:e("请选择根目录"),width:"290px",icon:"el-folder-opened"},null)}]}),G=v((()=>(V.value.formItems=[U.value,B.value,q.value],V.value))),[J,L,M]=t(G);return b((()=>{Object.assign(L.value,{domains:"",path:K.value,ps:""})})),_({onConfirm:async a=>{await M.value.validate();const{domains:s,...l}=L.value;let t={domains:JSON.stringify(s.split("\n")),type_id:0,...l};return(await i({loading:e("正在添加项目，请稍候..."),request:p(t),success:a=>{n.msg({customClass:"bt-message-error-html",isHtml:!0,message:a.msg,type:a.status?"success":"error",duration:a.status?3e3:0,showClose:!a.status}),H.value=!0}})).status}}),(a,e)=>(w(),f(y(J),{class:"p-20px pr-40px"}))}});export{_ as default};
