import{_ as a,a as t}from"./index.js?v=1763625242172";import{_ as e,k as s,c as i,e as l,a as n,d as o,h as r}from"./public.js?v=1763625242172";import{c as d,m as c}from"./page_layout.js?v=1763625242172";import{ak as m,al as u,am as p,an as _,ao as f}from"./mail.js?v=1763625242172";import{_ as h}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{k as x,P as v,r as g,e as w,R as y,S as b,X as S,a3 as j,U as k,V as M,a4 as P,N as R,am as C,a2 as $,j as B}from"./vue.js?v=1763625242172";import{au as U,dP as z,aC as E}from"./naive.js?v=1763625242172";import{_ as H}from"./index104.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const N={class:"p-20px"},O={class:"w-260px"},V=x({__name:"hostname",emits:["refresh"],setup(a,{expose:t,emit:s}){const i=s,{t:l}=v(),n=g(null),o=w({hostname:""}),r={hostname:{trigger:["input","blur"],validator:()=>""!==o.hostname.trim()||new Error(l("Mail.Setting.index_50"))}};return t({onConfirm:async()=>{var a;await(null==(a=n.value)?void 0:a.validate()),await m(R(o)),i("refresh")}}),(a,t)=>{const s=U,i=z,l=h,d=e;return y(),b("div",N,[S(l,{ref_key:"formRef",ref:n,model:M(o),rules:r},{default:j((()=>[S(i,{label:a.$t("Mail.Setting.index_48"),path:"hostname"},{default:j((()=>[k("div",O,[S(s,{value:M(o).hostname,"onUpdate:value":t[0]||(t[0]=a=>M(o).hostname=a)},null,8,["value"])])])),_:1},8,["label"])])),_:1},8,["model"]),S(d,{class:"mt-8px"},{default:j((()=>[k("li",null,P(a.$t("Mail.Setting.index_49")),1)])),_:1})])}}}),q=x({__name:"log",emits:["close","close-env"],setup(a,{emit:t}){const e=t,{t:i}=v(),l=g(i("Mail.Setting.index_47")),n=async()=>{const{message:a}=await u();d(a)&&(l.value=a.result||i("Mail.Setting.index_47"))},{loop:o}=s((async()=>{await n()}),1),r=C();return(async()=>{(async()=>{await p(),e("close"),e("close-env"),r.push("/mail/domain")})(),await n(),o()})(),(a,t)=>{const e=H;return y(),$(e,{log:M(l)},null,8,["log"])}}}),A={class:"flex flex-col h-full overflow-hidden"},D={class:"flex-1 p-20px overflow-auto"},L=x({__name:"index",emits:["close"],setup(s,{emit:m}){const u=m,{t:p}=v(),h=["Redis-install","Redis-Passwd","SElinux"],{table:x,columns:g}=i([{key:"env",title:p("Mail.Setting.index_39"),width:150},{key:"details",title:p("Mail.Setting.index_40"),ellipsis:{tooltip:!0},render:a=>{let t="";const{env:e,status:s,details:i}=a,l=h.includes(e);return t=i&&l?s?"Ready":i:s?"Ready":""!=i?i:"Abnormity",S("span",{class:s?"text-primary":"text-error"},[t])}},{key:"action",title:p("Public.Table.Operation"),width:120,render:a=>{const{env:t,status:e,details:s}=a;return h.includes(t)||!s||e?p("Mail.Setting.index_41"):S("a",{class:"bt-link",href:"javascript:;",onClick:()=>{"HostName"===a.env?R(a):C(a)}},[p("Public.Btn.Repair")])}}]),w=l(p("Mail.Setting.index_42"),{onRefresh:()=>{z()}}),R=a=>{w.data.row=a,w.show=!0},C=a=>{n({title:p("Mail.Setting.index_43"),content:p("Mail.Setting.index_44"),onConfirm:async()=>{const{env:t}=a;let e="";switch(t){case"Postfix-Version":case"Postfix-install":case"Sqlite-support":e="repair_postfix";break;case"Rspamd-install":e="install_rspamd";break;case"Dovecot-install":e="repair_dovecot"}await _(t,e),z()}})},{loading:$,setLoading:U}=o(),z=async()=>{try{U(!0);const{message:a}=await f();d(a)&&(x.data=Object.entries(a).map((([a,t])=>({env:a,details:t.msg,status:t.status}))))}finally{U(!1)}},H=()=>{u("close")},N=l(p("Mail.Setting.index_45"),{onCloseEnv:()=>{H()}}),O=async()=>{x.data.every((a=>a.status))?N.show=!0:c.error(p("Mail.Setting.index_46"))};return z(),(s,i)=>{const l=r,n=e,o=a,d=E,c=t;return y(),b("div",A,[k("div",D,[S(l,{"max-height":364,"single-line":!1,loading:M($),data:M(x).data,columns:M(g)},null,8,["loading","data","columns"]),S(n,{class:"mt-20px"},{default:j((()=>[k("li",null,P(s.$t("Mail.Setting.index_38")),1)])),_:1}),S(o,{show:M(w).show,"onUpdate:show":i[0]||(i[0]=a=>M(w).show=a),title:M(w).title,data:M(w).data,width:500,footer:!0,component:V},null,8,["show","title","data"]),S(o,{show:M(N).show,"onUpdate:show":i[1]||(i[1]=a=>M(N).show=a),title:M(N).title,data:M(N).data,"hide-close":!0,width:700,height:490,component:q},null,8,["show","title","data"])]),S(c,null,{default:j((()=>[S(d,{class:"cancel-btn",color:"#cbcbcb",size:"small",onClick:H},{default:j((()=>[B(P(s.$t("Public.Btn.Cancel")),1)])),_:1}),S(d,{type:"primary",size:"small",onClick:z},{default:j((()=>[B(P(s.$t("Public.Btn.Refresh")),1)])),_:1}),S(d,{type:"primary",size:"small",onClick:O},{default:j((()=>[B(P(s.$t("Public.Btn.Submit")),1)])),_:1})])),_:1})])}}});export{L as default};
