import{_ as a,f as e,s as l}from"./index105.js?v=1764233927359";import{_ as s}from"./index99.js?v=1764233927359";import{_ as n,m as t,S as i,aW as o,bM as r,aV as f,bC as c,bN as u,d as p,aX as v,p as d}from"./page_layout.js?v=1764233927359";import{k as m,P as x,r as _,a5 as g,R as w,V as b,S as C,W as S,l as y,a4 as h,a3 as $,ak as k,U as j,v as P,j as U}from"./vue.js?v=1764233927359";import{dV as V,au as K}from"./naive.js?v=1764233927359";const N={class:"px-40px py-24px"},R={class:"flex-center mb-20px"},W={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"},X={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=t.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 t.error(Y("Config.Safe.index_33")),!1;if(2===aa.value&&!i(ea.value))return t.error(Y("Config.Safe.index_34")),!1;if(3===aa.value&&(""===la.value.trim()||""===sa.value.trim()))return t.error(Y("Config.Safe.index_35")),!1;const a=t.loading(Y("Config.Safe.index_36"));try{3===aa.value&&await o({privateKey:la.value,certPem:sa.value}),await r((()=>{const a=2===aa.value?{email:ea.value}:{};return{cert_type:aa.value,...a}})(),!1),await f(),setTimeout(()=>{if(c){const a="http:"===location.protocol?"https":"http";window.location.href="".concat(a,"://").concat(window.location.host).concat(l.value.adminPath)}},1500)}finally{a.close()}return!1}}),(l,t)=>{const i=n,o=g("i18n-t"),r=a,f=V,c=K,u=s,p=e;return b(),w("div",N,[C("div",R,[C("div",W,[S(i,{name:"scan-success",size:"32"})]),C("span",z,h(l.$t("Config.Safe.index_18")),1)]),S(r,{class:"mb-20px"},{default:$(()=>[C("li",E,h(l.$t("Config.Safe.index_19")),1),C("li",null,h(l.$t("Config.Safe.index_20")),1),S(o,{tag:"li",scope:"global",keypath:"Config.Safe.index_21"},{link_:$(()=>[C("a",I,h(l.$t("Config.Safe.index_22")),1)]),_:1})]),_:1}),C("div",L,[C("span",M,h(l.$t("Config.Safe.index_24")),1),C("div",T,[S(f,{value:j(aa),"onUpdate:value":t[0]||(t[0]=a=>k(aa)?aa.value=a:null),options:na},null,8,["value"])])]),y(C("div",X,[C("span",q,h(l.$t("Config.Safe.index_25")),1),C("div",A,[S(c,{value:j(ea),"onUpdate:value":t[1]||(t[1]=a=>k(ea)?ea.value=a:null),placeholder:l.$t("Config.Safe.index_26")},null,8,["value","placeholder"])])],512),[[P,2===j(aa)]]),y(C("div",B,[C("span",D,h(l.$t("Config.Safe.index_27")),1),C("div",F,[S(u,{value:j(la),"onUpdate:value":t[2]||(t[2]=a=>k(la)?la.value=a:null),rows:4,placeholder:""},null,8,["value"])])],512),[[P,3===j(aa)]]),y(C("div",G,[C("span",H,h(l.$t("Config.Safe.index_28")),1),C("div",J,[S(u,{value:j(sa),"onUpdate:value":t[3]||(t[3]=a=>k(sa)?sa.value=a:null),rows:4,placeholder:""},null,8,["value"])])],512),[[P,3===j(aa)]]),C("div",O,[S(p,{ref_key:"riskRef",ref:Z},{default:$(()=>[U(h(l.$t("Config.Safe.index_29")),1)]),_:1},512),C("a",Q,h(l.$t("Config.Safe.index_167")),1)])])}}}),[["__scopeId","data-v-02bc9a9f"]]);export{Y as P};
