import{u as e,K as a,k as t,c4 as l,bq as r,c5 as s,c6 as p}from"./utils-lib.js?v=1761009159";import{c as o,r as n,t as u,g as i,e as m,az as d,C as v,q as w,v as c,N as f,y as _}from"./base-lib.js?v=1761009159";import{l as b}from"./form-item.js?v=1761009159";import{a as g,o as h}from"./index76.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./index105.js?v=1761009159";import"./index.vue_vue_type_script_setup_true_lang6.js?v=1761009159";import"./index133.js?v=1761009159";import"./validator.js?v=1761009159";import"./column.js?v=1761009159";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1761009159";import"./useStore4.js?v=1761009159";import"./site.js?v=1761009159";import"./index134.js?v=1761009159";import"./index143.js?v=1761009159";import"./index127.js?v=1761009159";import"./useController6.js?v=1761009159";const y=o({__name:"index",setup(o,{expose:y}){const j=n(!1),{panel:x}=e(),{sitePath:P}=u(x.value),F=i(()=>{var e;return P.value?null==(e=P.value+"/")?void 0:e.replace(/\/\//g,"/"):"/www/wwwroot/"}),T=n({webname:"",path:"/www/wwwroot",ftp:!1,ps:"",port:80,ftp_username:"",ftp_password:""}),{BtForm:V,submit:k}=a({data:T.value,options:e=>i(()=>(e.value.hasOwnProperty("ftp")||(e.value.ftp=!1),[{type:"custom",render:a=>(a.value.hasOwnProperty("webname")||(a.value.webname=""),m(r,{label:"绑定域名",prop:"webname"},{default:()=>[m(d,{ref:"popover",placement:"top-start","popper-class":"green-tips-popover !p-0",title:"",width:"370",visible:j.value,"onUpdate:visible":e=>j.value=e,"trigger-keys":[],trigger:"focus"},{default:()=>m("div",{class:"!p-[12px] bg-primary text-white"},[v("如需填写多个域名，请换行填写，每行一个域名，默认为80端口"),m("br",null,null),v("IP地址格式：192.168.1.199"),m("br",null,null),v("泛解析添加方法 *.domain.com"),m("br",null,null),v("如另加端口格式为 www.domain.com:88")]),reference:()=>m(t,{rows:6,resize:"none",width:"42rem",modelValue:e.value.webname,"onUpdate:modelValue":a=>e.value.webname=a,onInput:a=>{var t,r,s,p,o;"string"==typeof a&&(e.value.ps=a.split("\n")[0],e.value.path=(null==(t=F.value)?void 0:t.replace(/\/\//g,"/"))+(null==(s=null==(r=a.split("\n")[0])?void 0:r.replace(/:/g,"_"))?void 0:s.trim()),e.value.ftp_username=null==(o=null==(p=a.split("\n")[0])?void 0:p.toString())?void 0:o.replace(/\W/g,"_").substring(0,16),e.value.ftp_password=l(12))},onFocus:()=>{j.value=!0},type:"textarea",placeholder:"如需填写多个域名，请换行填写，每行一个域名，默认为80端口\nIP地址格式：192.168.1.199\n泛解析添加方法 *.domain.com\n如另加端口格式为 www.domain.com:88"},null)})]})),key:"webname",rules:{webname:[s({message:"请输入域名",trigger:"blur"}),p()]}},{type:"input",label:"备注",key:"ps",attrs:{placeholder:"请输入备注，可为空",width:"42rem"}},b("根目录","path",{attrs:{width:"42rem",placeholder:"请输入根目录"},rules:[s({message:"请选择路径"})]},()=>{h(e.value.path,a=>{e.value.path=a})}),{type:"select",label:"FTP",key:"ftp",options:[{label:"不创建",value:!1},{label:"创建",value:!0}],attrs:{style:"width: 16rem;"}},...e.value.ftp?[{type:"custom",render:a=>(a.value.hasOwnProperty("ftp_username")||(a.value.ftp_username="",a.value.ftp_password=""),m(r,{label:"FTP账号"},{default:()=>[m("div",{class:"flex items-center mb-[12px]"},[m(r,{prop:"ftp_username"},{default:()=>[m(t,{placeholder:"创建FTP账号",width:"16rem",modelValue:e.value.ftp_username,"onUpdate:modelValue":a=>e.value.ftp_username=a},null)]}),m(r,{label:"密码",class:"!mt-0",prop:"ftp_password"},{default:()=>[m(t,{width:"16rem",placeholder:"FTP密码",modelValue:e.value.ftp_password,"onUpdate:modelValue":a=>e.value.ftp_password=a},null)]})]),m("span",{class:"text-tertiary text-small"},[v("创建站点的同时，为站点创建一个对应FTP帐户，并且FTP目录指向站点所在目录。")])]})),rules:{ftp_username:[{validator:(a,t,l)=>{e.value.ftp?0===t.length?l(new Error("FTP用户名不能为空！")):/^[a-zA-Z0-9_]+$/g.test(t)?t.length<=3?l(new Error("FTP用户名长度错误，不能少于3个字符！")):l():l(new Error("FTP用户名只能包含字母、数字和下划线！")):l()},trigger:["blur","change"]}],ftp_password:[{validator:(a,t,l)=>{""===t&&e.value.ftp?l(new Error("FTP密码不能为空！")):l()},trigger:["blur","change"]}]}}]:[]])),submit:async(e,a)=>(await a(),await g(e.value))});return w(()=>{P.value&&Object.assign(T.value,{path:P.value})}),y({onConfirm:k}),(e,a)=>(c(),f(_(V),{class:"p-2rem"}))}});export{y as default};
