import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{_ as a}from"./index99.js?v=1763625242172";import{k as r,P as l,r as s,e as o,R as t,S as n,X as p,a3 as d,j as u,a4 as i,U as c,H as v,V as _,au as f,N as m}from"./vue.js?v=1763625242172";import{m as x,e2 as S,p as g}from"./page_layout.js?v=1763625242172";import{dk as h,dP as y,d9 as w}from"./naive.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./common.js?v=1763625242172";import"./public.js?v=1763625242172";const k={class:"p-20px"},L=g(r({__name:"index",props:{onRefresh:{}},setup(r,{expose:g}){const{t:L}=l(),b=r,{onRefresh:j}=b,D=s(!1),R=s(!1),$=(e,a)=>{var r,l;a.preventDefault(),D.value="key"!==e&&D.value,R.value="cert"!==e&&R.value;const s=null==(r=a.dataTransfer)?void 0:r.files;if(!s||0===s.length)return x.error(L("SSL.index_38"));const o=s[0],t=null==(l=o.name.split(".").pop())?void 0:l.toLowerCase();if(![".pem",".crt",".cer",".key",".der",".pfx",".p12",".p7b",".p7c",".csr"].includes(".".concat(t)))return x.error(L("SSL.index_38"));if(window.FileReader){const a=new FileReader;a.onload=a=>{var r;(null==(r=a.target)?void 0:r.result)&&(C[e]=a.target.result)},a.onerror=()=>{x.error(L("SSL.index_39"))},a.readAsText(o)}else x.error(L("SSL.index_40"))},U=s(null),C=o({key:"",cert:""}),F={key:{required:!0,trigger:"change",message:L("SSL.index_35")},cert:{required:!0,trigger:"change",message:L("SSL.index_37")}};return g({onConfirm:async()=>{var e;await(null==(e=U.value)?void 0:e.validate()),await S(m(C)),x.success(L("Component.UploadFile.index_9")),null==j||j()}}),(r,l)=>{const s=h,o=a,m=y,x=w,S=e;return t(),n("div",k,[p(s,{type:"success","show-icon":!1},{default:d((()=>[u(i(r.$t("SSL.index_33"))+" ",1),l[8]||(l[8]=c("div",{class:"pt-5px"},"Supported formats: pem, crt, cer, key, der, pfx, p12, p7b, p7c, csr. ",-1))])),_:1,__:[8]}),p(S,{ref_key:"formRef",ref:U,model:_(C),rules:F,"label-placement":"top"},{default:d((()=>[p(x,{class:"w-full flex-nowrap!"},{default:d((()=>[p(m,{label:r.$t("SSL.index_34"),path:"key",class:"w-full"},{default:d((()=>[c("div",{class:v(["drag-box",{hover:_(D)}]),onDrop:l[1]||(l[1]=e=>$("key",e)),onDragover:l[2]||(l[2]=f((e=>D.value=!0),["prevent"])),onDragleave:l[3]||(l[3]=f((e=>D.value=!1),["prevent"]))},[p(o,{value:_(C).key,"onUpdate:value":l[0]||(l[0]=e=>_(C).key=e),rows:16,placeholder:r.$t("SSL.index_35")},null,8,["value","placeholder"])],34)])),_:1},8,["label"]),p(m,{label:r.$t("SSL.index_36"),path:"cert",class:"w-full"},{default:d((()=>[c("div",{class:v(["drag-box",{hover:_(R)}]),onDrop:l[5]||(l[5]=e=>$("cert",e)),onDragover:l[6]||(l[6]=f((e=>R.value=!0),["prevent"])),onDragleave:l[7]||(l[7]=f((e=>R.value=!1),["prevent"]))},[p(o,{value:_(C).cert,"onUpdate:value":l[4]||(l[4]=e=>_(C).cert=e),rows:16,placeholder:r.$t("SSL.index_37")},null,8,["value","placeholder"])],34)])),_:1},8,["label"])])),_:1})])),_:1},8,["model"])])}}}),[["__scopeId","data-v-a1f4ee4d"]]);export{L as default};
