import{s as a,_ as e,f as l}from"./index105.js?v=1763625242172";import{_ as s}from"./index99.js?v=1763625242172";import{m as n,S as t,aW as i,bM as o,aV as r,bC as f,_ as c,bN as u,c as p,aX as v,p as d}from"./page_layout.js?v=1763625242172";import{k as m,P as x,r as _,a5 as g,R as w,S as b,U as C,X as S,a4 as y,a3 as h,V as $,aj as k,l as j,v as P,j as U}from"./vue.js?v=1763625242172";import{dV as V,au as K}from"./naive.js?v=1763625242172";const N={class:"px-40px py-24px"},R={class:"flex-center mb-20px"},X={class:"min-w-32px"},z={class:"ml-4px text-21px"},E={class:"text-error"},I={class:"bt-link",href:"https://www.aapanel.com/forum/d/167-common-problems-after-opening-the-panel-certificate",target:"_blank"},L={class:"flex"},M={class:"form-label"},T={class:"w-280px"},W={class:"flex mt-16px"},q={class:"form-label"},A={class:"w-280px"},B={class:"flex mt-16px"},D={class:"form-label"},F={class:"w-280px"},G={class:"flex mt-16px"},H={class:"form-label"},J={class:"w-280px"},O={class:"flex justify-between mt-24px"},Q={class:"bt-link",href:"https://www.aapanel.com/forum/d/167-common-problems-after-opening-the-panel-certificate",target:"_blank"},Y=d(m({__name:"open",setup(d,{expose:m}){const{t:Y}=x(),Z=_(),aa=_(1),ea=_(""),la=_(""),sa=_(""),na=[{label:Y("Config.Safe.index_30"),value:1},{label:"Let's Encrypt",value:2},{label:Y("Config.Safe.index_31"),value:3}],ta=async()=>{const{message:a}=await u();p(a)&&(aa.value=a.cert_type?Number(a.cert_type):1,ea.value=a.email||"")},ia=async()=>{const{message:a}=await v();p(a)&&(la.value=a.privateKey||"",sa.value=a.certPem||"")};return(async()=>{const a=n.loading(Y("Config.Safe.index_32"));try{await Promise.all([ta(),ia()])}finally{a.close()}})(),m({onConfirm:async()=>{if(await Z.value.validate(),2===aa.value&&""===ea.value.trim())return n.error(Y("Config.Safe.index_33")),!1;if(2===aa.value&&!t(ea.value))return n.error(Y("Config.Safe.index_34")),!1;if(3===aa.value&&(""===la.value.trim()||""===sa.value.trim()))return n.error(Y("Config.Safe.index_35")),!1;const e=n.loading(Y("Config.Safe.index_36"));try{3===aa.value&&await i({privateKey:la.value,certPem:sa.value}),await o((()=>{const a=2===aa.value?{email:ea.value}:{};return{cert_type:aa.value,...a}})(),!1),await r(),setTimeout((()=>{if(f){const e="http:"===location.protocol?"https":"http";window.location.href="".concat(e,"://").concat(window.location.host).concat(a.value.adminPath)}}),1500)}finally{e.close()}return!1}}),(a,n)=>{const t=c,i=g("i18n-t"),o=e,r=V,f=K,u=s,p=l;return w(),b("div",N,[C("div",R,[C("div",X,[S(t,{name:"scan-success",size:"32"})]),C("span",z,y(a.$t("Config.Safe.index_18")),1)]),S(o,{class:"mb-20px"},{default:h((()=>[C("li",E,y(a.$t("Config.Safe.index_19")),1),C("li",null,y(a.$t("Config.Safe.index_20")),1),S(i,{tag:"li",scope:"global",keypath:"Config.Safe.index_21"},{link_:h((()=>[C("a",I,y(a.$t("Config.Safe.index_22")),1)])),_:1})])),_:1}),C("div",L,[C("span",M,y(a.$t("Config.Safe.index_24")),1),C("div",T,[S(r,{value:$(aa),"onUpdate:value":n[0]||(n[0]=a=>k(aa)?aa.value=a:null),options:na},null,8,["value"])])]),j(C("div",W,[C("span",q,y(a.$t("Config.Safe.index_25")),1),C("div",A,[S(f,{value:$(ea),"onUpdate:value":n[1]||(n[1]=a=>k(ea)?ea.value=a:null),placeholder:a.$t("Config.Safe.index_26")},null,8,["value","placeholder"])])],512),[[P,2===$(aa)]]),j(C("div",B,[C("span",D,y(a.$t("Config.Safe.index_27")),1),C("div",F,[S(u,{value:$(la),"onUpdate:value":n[2]||(n[2]=a=>k(la)?la.value=a:null),rows:4,placeholder:""},null,8,["value"])])],512),[[P,3===$(aa)]]),j(C("div",G,[C("span",H,y(a.$t("Config.Safe.index_28")),1),C("div",J,[S(u,{value:$(sa),"onUpdate:value":n[3]||(n[3]=a=>k(sa)?sa.value=a:null),rows:4,placeholder:""},null,8,["value"])])],512),[[P,3===$(aa)]]),C("div",O,[S(p,{ref_key:"riskRef",ref:Z},{default:h((()=>[U(y(a.$t("Config.Safe.index_29")),1)])),_:1},512),C("a",Q,y(a.$t("Config.Safe.index_167")),1)])])}}}),[["__scopeId","data-v-02bc9a9f"]]);export{Y as P};
