import{_ as B}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{_ as E}from"./index-CZps0rIN.js?v=1773287522785";import{k as F,R as I,r as S,e as T,$ as U,Z as V,a0 as a,a9 as u,j,aa as q,_ as w,aj as c,L as b,S as s,N as z}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{I as A}from"./ssl-Bm8jcneQ.js?v=1773287522785";import{m as f,c as K}from"./index-BTglIPU2.js?v=1773287522785";import{ad as M,k as Z,a1 as G}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const H={class:"p-20px"},J=F({__name:"index",props:{onRefresh:{}},setup(D,{expose:C}){const{t:n}=I(),R=D,{onRefresh:v}=R,l=S(!1),i=S(!1),k=(o,e)=>{var _,r;e.preventDefault(),l.value=o==="key"?!1:l.value,i.value=o==="cert"?!1:i.value;const p=(_=e.dataTransfer)==null?void 0:_.files;if(!p||p.length===0)return f.error(n("SSL.index_38"));const d=p[0],m=[".pem",".crt",".cer",".key",".der",".pfx",".p12",".p7b",".p7c",".csr"],g=(r=d.name.split(".").pop())==null?void 0:r.toLowerCase();if(!m.includes(".".concat(g)))return f.error(n("SSL.index_38"));if(window.FileReader){const x=new FileReader;x.onload=y=>{var $;($=y.target)!=null&&$.result&&(t[o]=y.target.result)},x.onerror=()=>{f.error(n("SSL.index_39"))},x.readAsText(d)}else f.error(n("SSL.index_40"))},L=S(null),t=T({key:"",cert:""}),N={key:{required:!0,trigger:"change",message:n("SSL.index_35")},cert:{required:!0,trigger:"change",message:n("SSL.index_37")}};return C({onConfirm:async()=>{var o;await((o=L.value)==null?void 0:o.validate()),await A(z(t)),f.success(n("Component.UploadFile.index_9")),v==null||v()}}),(o,e)=>{const p=M,d=E,m=G,g=Z,_=B;return U(),V("div",H,[a(p,{type:"success","show-icon":!1},{default:u(()=>[j(q(o.$t("SSL.index_33"))+" ",1),e[8]||(e[8]=w("div",{class:"pt-5px"},"Supported formats: pem, crt, cer, key, der, pfx, p12, p7b, p7c, csr. ",-1))]),_:1,__:[8]}),a(_,{ref_key:"formRef",ref:L,model:s(t),rules:N,"label-placement":"top"},{default:u(()=>[a(g,{class:"w-full flex-nowrap!"},{default:u(()=>[a(m,{label:o.$t("SSL.index_34"),path:"key",class:"w-full"},{default:u(()=>[w("div",{class:b(["drag-box",{hover:s(l)}]),onDrop:e[1]||(e[1]=r=>k("key",r)),onDragover:e[2]||(e[2]=c(r=>l.value=!0,["prevent"])),onDragleave:e[3]||(e[3]=c(r=>l.value=!1,["prevent"]))},[a(d,{value:s(t).key,"onUpdate:value":e[0]||(e[0]=r=>s(t).key=r),rows:16,placeholder:o.$t("SSL.index_35")},null,8,["value","placeholder"])],34)]),_:1},8,["label"]),a(m,{label:o.$t("SSL.index_36"),path:"cert",class:"w-full"},{default:u(()=>[w("div",{class:b(["drag-box",{hover:s(i)}]),onDrop:e[5]||(e[5]=r=>k("cert",r)),onDragover:e[6]||(e[6]=c(r=>i.value=!0,["prevent"])),onDragleave:e[7]||(e[7]=c(r=>i.value=!1,["prevent"]))},[a(d,{value:s(t).cert,"onUpdate:value":e[4]||(e[4]=r=>s(t).cert=r),rows:16,placeholder:o.$t("SSL.index_37")},null,8,["value","placeholder"])],34)]),_:1},8,["label"])]),_:1})]),_:1},8,["model"])])}}}),re=K(J,[["__scopeId","data-v-74e286a3"]]);export{re as default};
