import{_ as B}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{f as E,U as F}from"./ssl-Bm8jcneQ.js?v=1773287522785";import{a as M,t as N,e as T,h as X}from"./utils-DELCcnjr.js?v=1773287522785";import{t as q}from"./index-BTglIPU2.js?v=1773287522785";import{a1 as I,b as V,a6 as j,k as z,B as A,_ as G,a8 as O}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as H,c as J,R as K,r as Q,e as W,$ as _,a8 as c,a9 as n,a0 as a,_ as Y,S as r,j as Z,ak as x}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const ee={class:"w-300px"},de=H({__name:"domain-form",props:{row:{},isEdit:{type:Boolean},onRefresh:{}},setup(S,{expose:g}){const w=q(),m=S,{isEdit:p,row:i,onRefresh:h}=m,f=J(()=>p&&i?i.provider_name.includes("CloudFlare"):M.value.includes("CloudFlare")),{t:d}=K(),v=Q(null),e=W({record_type:"A",record_value:"",ttl:1,ps:"",proxy:0,priority:10,record:""}),$={record:{required:!0,trigger:"change",message:d("SSL.Domain.index_12")},record_value:{required:!0,trigger:["blur","change"],message:d("SSL.Domain.index_14")},ttl:{required:!0,trigger:"blur",type:"number",message:d("SSL.Domain.index_15")},priority:{required:!0,trigger:"blur",type:"number",message:"Please enter the priority"}},L=()=>{e.record_value=w.address},y=()=>({id:p&&i?i.id:null,pid:X.value,domain:T.value,record:e.record,record_type:e.record_type,record_value:e.record_value,ttl:e.ttl,ps:e.ps,proxy:f.value&&e.record_type!=="MX"?e.proxy:-1,priority:e.record_type==="MX"?e.priority:-1}),k=async()=>{var o;await((o=v.value)==null?void 0:o.validate()),p&&i?await E(y()):await F(y()),h()};return(()=>{const{row:o,isEdit:t}=m;t&&o&&(e.record=o.record,e.record_type=o.record_type,e.record_value=o.record_value,e.ttl=o.ttl,e.ps=o.ps,e.proxy=o.proxy,e.priority=e.record_type==="MX"?o.priority:-1)})(),g({onConfirm:k}),(o,t)=>{const u=V,s=I,D=j,U=A,C=z,b=G,P=O,R=B;return _(),c(R,{class:"p-20px",ref_key:"formRef",ref:v,model:r(e),rules:$},{default:n(()=>[a(s,{label:o.$t("SSL.Domain.index_11"),path:"record"},{default:n(()=>[Y("div",ee,[a(u,{value:r(e).record,"onUpdate:value":t[0]||(t[0]=l=>r(e).record=l),placeholder:o.$t("SSL.Domain.index_12"),disabled:r(p)},null,8,["value","placeholder","disabled"])])]),_:1},8,["label"]),a(s,{label:o.$t("Ftp.Table.index_3"),path:"record_type"},{default:n(()=>[a(D,{class:"w-300px",value:r(e).record_type,"onUpdate:value":t[1]||(t[1]=l=>r(e).record_type=l),options:r(N),disabled:r(p)},null,8,["value","options","disabled"])]),_:1},8,["label"]),a(s,{label:o.$t("SSL.Domain.index_13"),path:"record_value"},{default:n(()=>[a(C,{class:"flex-nowrap!",size:5},{default:n(()=>[a(u,{class:"w-300px!",value:r(e).record_value,"onUpdate:value":t[2]||(t[2]=l=>r(e).record_value=l),placeholder:o.$t("SSL.Domain.index_14")},null,8,["value","placeholder"]),a(U,{onClick:L},{default:n(()=>t[7]||(t[7]=[Z(" USE IP ")])),_:1,__:[7]})]),_:1})]),_:1},8,["label"]),a(s,{label:"TTL",path:"ttl"},{default:n(()=>[a(b,{"show-button":!1,class:"w-300px!",value:r(e).ttl,"onUpdate:value":t[3]||(t[3]=l=>r(e).ttl=l),placeholder:o.$t("SSL.Domain.index_15")},null,8,["value","placeholder"])]),_:1}),r(e).record_type==="MX"?(_(),c(s,{key:0,label:"Priority",path:"priority"},{default:n(()=>[a(b,{"show-button":!1,class:"w-300px!",value:r(e).priority,"onUpdate:value":t[4]||(t[4]=l=>r(e).priority=l),placeholder:"Please enter the priority",min:1,max:65535},null,8,["value"])]),_:1})):x("",!0),a(s,{label:o.$t("Public.Table.Ps"),path:"ps"},{default:n(()=>[a(u,{class:"w-300px!",value:r(e).ps,"onUpdate:value":t[5]||(t[5]=l=>r(e).ps=l),placeholder:o.$t("Crontab.arrange.index_27")},null,8,["value","placeholder"])]),_:1},8,["label"]),r(f)&&r(e).record_type!=="MX"?(_(),c(s,{key:1,label:o.$t("SSL.Domain.index_16"),path:"proxy"},{default:n(()=>[a(P,{value:r(e).proxy,"onUpdate:value":t[6]||(t[6]=l=>r(e).proxy=l),"checked-value":1,"unchecked-value":0},null,8,["value"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["model"])}}});export{de as default};
