import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{u as a,db as r,h0 as l}from"./page_layout.js?v=1763625242172";import{a as o,t,h as d,e as s}from"./utils3.js?v=1763625242172";import{au as p,dP as i,dV as u,aC as n,d9 as c,df as _,dj as v}from"./naive.js?v=1763625242172";import{k as m,c as y,P as x,r as h,e as b,R as f,a2 as S,a3 as g,X as w,U as j,V as L,j as D,an as U}from"./vue.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./public.js?v=1763625242172";const $={class:"w-300px"},P=m({__name:"domain-form",props:{row:{},isEdit:{type:Boolean},onRefresh:{}},setup(m,{expose:P}){const k=a(),C=m,{isEdit:X,row:M,onRefresh:q}=C,E=y((()=>X&&M?M.provider_name.includes("CloudFlare"):o.value.includes("CloudFlare"))),{t:R}=x(),T=h(null),F=b({record_type:"A",record_value:"",ttl:1,ps:"",proxy:0,priority:10,record:""}),V={record:{required:!0,trigger:"change",message:R("SSL.Domain.index_12")},record_value:{required:!0,trigger:["blur","change"],message:R("SSL.Domain.index_14")},ttl:{required:!0,trigger:"blur",type:"number",message:R("SSL.Domain.index_15")},priority:{required:!0,trigger:"blur",type:"number",message:"Please enter the priority"}},z=()=>{F.record_value=k.address},A=()=>({id:X&&M?M.id:null,pid:d.value,domain:s.value,record:F.record,record_type:F.record_type,record_value:F.record_value,ttl:F.ttl,ps:F.ps,proxy:E.value&&"MX"!==F.record_type?F.proxy:-1,priority:"MX"===F.record_type?F.priority:-1});return(()=>{const{row:e,isEdit:a}=C;a&&e&&(F.record=e.record,F.record_type=e.record_type,F.record_value=e.record_value,F.ttl=e.ttl,F.ps=e.ps,F.proxy=e.proxy,F.priority="MX"===F.record_type?e.priority:-1)})(),P({onConfirm:async()=>{var e;await(null==(e=T.value)?void 0:e.validate()),X&&M?await r(A()):await l(A()),q()}}),(a,r)=>{const l=p,o=i,d=u,s=n,m=c,y=_,x=v,h=e;return f(),S(h,{class:"p-20px",ref_key:"formRef",ref:T,model:L(F),rules:V},{default:g((()=>[w(o,{label:a.$t("SSL.Domain.index_11"),path:"record"},{default:g((()=>[j("div",$,[w(l,{value:L(F).record,"onUpdate:value":r[0]||(r[0]=e=>L(F).record=e),placeholder:a.$t("SSL.Domain.index_12")},null,8,["value","placeholder"])])])),_:1},8,["label"]),w(o,{label:a.$t("Ftp.Table.index_3"),path:"record_type"},{default:g((()=>[w(d,{class:"w-300px",value:L(F).record_type,"onUpdate:value":r[1]||(r[1]=e=>L(F).record_type=e),options:L(t),disabled:L(X)},null,8,["value","options","disabled"])])),_:1},8,["label"]),w(o,{label:a.$t("SSL.Domain.index_13"),path:"record_value"},{default:g((()=>[w(m,{class:"flex-nowrap!",size:5},{default:g((()=>[w(l,{class:"w-300px!",value:L(F).record_value,"onUpdate:value":r[2]||(r[2]=e=>L(F).record_value=e),placeholder:a.$t("SSL.Domain.index_14")},null,8,["value","placeholder"]),w(s,{onClick:z},{default:g((()=>r[7]||(r[7]=[D(" USE IP ")]))),_:1,__:[7]})])),_:1})])),_:1},8,["label"]),w(o,{label:"TTL",path:"ttl"},{default:g((()=>[w(y,{"show-button":!1,class:"w-300px!",value:L(F).ttl,"onUpdate:value":r[3]||(r[3]=e=>L(F).ttl=e),placeholder:a.$t("SSL.Domain.index_15")},null,8,["value","placeholder"])])),_:1}),"MX"===L(F).record_type?(f(),S(o,{key:0,label:"Priority",path:"priority"},{default:g((()=>[w(y,{"show-button":!1,class:"w-300px!",value:L(F).priority,"onUpdate:value":r[4]||(r[4]=e=>L(F).priority=e),placeholder:"Please enter the priority",min:1,max:65535},null,8,["value"])])),_:1})):U("",!0),w(o,{label:a.$t("Public.Table.Ps"),path:"ps"},{default:g((()=>[w(l,{class:"w-300px!",value:L(F).ps,"onUpdate:value":r[5]||(r[5]=e=>L(F).ps=e),placeholder:a.$t("Crontab.arrange.index_27")},null,8,["value","placeholder"])])),_:1},8,["label"]),L(E)&&"MX"!==L(F).record_type?(f(),S(o,{key:1,label:a.$t("SSL.Domain.index_16"),path:"proxy"},{default:g((()=>[w(x,{value:L(F).proxy,"onUpdate:value":r[6]||(r[6]=e=>L(F).proxy=e),"checked-value":1,"unchecked-value":0},null,8,["value"])])),_:1},8,["label"])):U("",!0)])),_:1},8,["model"])}}});export{P as default};
