import{K as s,ar as a,aZ as r,c8 as e}from"./utils-lib.js?v=1761009159";import{c as l,g as t,v as o,N as p,y as u}from"./base-lib.js?v=1761009159";import{b as i,c as m,d as c,e as n,f as d}from"./form-item.js?v=1761009159";import{i as g,s as h,a as w,c as b}from"./useController2.js?v=1761009159";const x=l({__name:"add-host",setup(l,{expose:x}){const S=[{label:"密码认证",value:"password"},{label:"私钥验证",value:"private"}],{BtForm:v,submit:f,clearValidate:y}=s({data:g,options:s=>t(()=>{const l=[i("密码","password",{attrs:{placeholder:"请输入SSH密码",class:"mr-4 !w-[275px]"},rules:[{required:!0,message:"请输入SSH密码",trigger:["change","blur"]}]})],t=[m("私钥","pkey",{attrs:{placeholder:"请输入SSH私钥",class:"mr-4 !w-[275px]",autosize:{minRows:4,maxRows:4}},rules:[{required:!0,message:"请输入SSH私钥",trigger:["change","blur"]}]}),i("私钥密码","pkey_passwd",{attrs:{placeholder:"请输入私钥密码",class:"mr-4 !w-[275px]"}})];return[c([i("服务器信息","host",{attrs:{class:"mr-[8px] !w-[180px]",placeholder:"请输入服务器IP/域名",onInput:()=>{s.value.ps=s.value.host},onBlur:()=>w(s)},rules:[{required:!0,message:"请输入服务器IP/域名",trigger:["change","blur"]},{validator:(s,a,l)=>{""===(a=a.trim())?l(new Error("服务器信息不能为空")):r(a)||e(a)?l():l(new Error("服务器信息格式错误"))},trigger:["blur","change"]}]}),i("","port",{attrs:{placeholder:"端口",class:"!w-[84px]"},rules:[{required:!0,message:"请输入端口",trigger:["change","blur"]},a()]})]),i("账号","username",{attrs:{placeholder:"请输入SSH账号",class:"mr-4 !w-[275px]"},rules:[{required:!0,message:"请输入SSH账号",trigger:["change","blur"]}]}),n("验证方式","authType",S,{attrs:{class:"mr-4 !w-[275px]",onChange:()=>b(s,y)}}),..."password"===(null==s?void 0:s.value.authType)?l:t,i("备注","ps",{attrs:{placeholder:"请输入备注",class:"mr-4 !w-[275px]"}}),"password"===(null==s?void 0:s.value.authType)?d("",[{content:"支持快速填充主机信息，格式：[账号:密码@]服务器IP[:端口]"}]):[]]}),submit:async(s,a)=>(await a(),await h(s))});return x({onConfirm:f}),(s,a)=>(o(),p(u(v),{class:"p-[2rem]","label-width":"4rem"}))}});export{x as _};
