import{getSslInfo as t,buyService as a,getCertAdminInfo as s,applyCertOrderRenw as e,setCertOrder as r,getBusSslOrderList as i,getVerifyResult as n,getBusSslProductList as o,getDomainList as u,deployTrustAsiaCert as l}from"./site.js?v=1761009159";import{M as d,P as c}from"./utils-lib.js?v=1761009159";import{s as g,j as m,r as p,g as y}from"./base-lib.js?v=1761009159";import{u as v}from"./useStore4.js?v=1761009159";const f=m("site-ssl-store",()=>{var g,m;const{siteInfo:f,siteType:S}=v(),h=p(),b=p(),A=p({isCertInfo:!1,https:!1,type:0,key:"",csr:"",index:"",oid:-1,dns:[],subject:"",issuer:"",endtime:"",push:{},pushAlarm:"",isSupportRenewal:!1,isStart:!1,notAfter:"",authType:""}),I=p("busSslList"),w=p({address:"",city:"",country:"",email:"",firstName:"",job:"",lastName:"",mobile:"",organation:"",postCode:"",state:""}),q=p(),j=p({result:{},info:{index:"",type:""},dnsTable:[],verifyDialog:!1}),E=p({}),C=p({domain:(null==(g=f.value)?void 0:g.name)||"",orgName:"",orgRegion:"",orgCity:"",orgAddress:"",orgPhone:"",orgPostalCode:"",orgDivision:"总务",path:(null==(m=f.value)?void 0:m.path)||""}),L=p(!1),N=p(!1),x=p({typeList:[],activityList:"",activeTypeInfo:{},productName:"",totalPrice:0,install:!1,years:1}),T=p({pid:0,oid:0,title:"",limit:1,type:"dv",install:!1,isWildcard:!1,isMulti:!1,isIp:!1}),O=y(()=>{var t,a,s;return!(null==(t=A.value)?void 0:t.isStart)||(null==(a=A.value)?void 0:a.isSupportRenewal)&&(null==(s=A.value)?void 0:s.isStart)});return{sslInfo:A,otherPopup:b,pollingPopup:h,sslTabActive:I,sslApplicationInfo:w,isRefreshSSL:L,isRefreshLetSSL:N,sslDnsApiInfo:q,letApplyInfo:j,setApplyInfo:(t,a)=>{j.value.dnsTable=t.auths,j.value.info.index=t.index,j.value.info.type=a.auth_type},productInfo:x,orderInfo:T,sslAlertState:O,certVerifyInfo:E,applySslInfo:C,jumpSslTabEvent:t=>{I.value=t},getSSLInfoEvent:async a=>{try{const{data:s}=await t(a);return s.hasOwnProperty("msg")?(d.error("获取证书信息失败"),{data:{},status:!1,msg:"获取证书信息失败"}):{data:s,status:!0,msg:"获取证书信息成功"}}catch(s){return{status:!1,msg:"获取证书信息失败"}}},buyArtificialServiceEvent:async t=>{try{return{data:await c({loading:"正在生成支付订单，请稍后...",request:a(t),data:{alicode:String,oid:Number,price:Number,qq:String,wxcode:String,wxoid:Number}}),status:!0}}catch(s){return{status:!1,msg:"购买人工服务失败"}}},getCertAdminInfoEvent:async()=>{try{return{data:(await c({loading:"正在获取证书默认信息，请稍后...",request:s()})).data,status:!0,msg:"获取证书默认信息成功"}}catch(t){return{status:!1,msg:"获取证书默认信息失败"}}},submitCertInfoEvent:async t=>{try{return{data:(await c({loading:"正在提交证书信息，请稍后...",request:e(t),data:{status:Boolean,msg:[Object,t=>t]}})).data.msg,status:!0,msg:"提交证书信息成功"}}catch(a){return{status:!1,msg:"提交证书信息失败"}}},setBusSslDeployEvent:async t=>{try{return{data:(await c({loading:"正在部署证书，请稍候...",request:r(t,S.value),message:!0})).data,status:!0,msg:"设置证书部署成功"}}catch(a){return{status:!1,msg:"设置证书部署失败"}}},getSslListEvent:async t=>{try{const a=await c({request:i(t),data:Array});return{data:a,total:a.length,other:{}}}catch(a){return{data:[],total:0,other:{}}}},verifyBusCertEvent:async(t,a,s)=>{try{const e=await c({loading:"正在验证商用证书，请稍后...",request:n({oid:t,cert_ssl_type:a,pid:s}),data:{status:[String,t=>t],paths:Array,kfqq:String,hosts:Array,data:[Object,"data"],code:Number,certStatus:String,msg:String,...1===a?{res:[Object,"res"]}:{}}});return e.status?{data:{oid:t,...e,isCNAME:e.data.dcvList[0].dcvMethod.indexOf("CNAME_")>-1},status:!0,msg:"验证商用证书成功"}:(d.request(e),{status:!1,msg:"验证商用证书失败"})}catch(e){return{status:!1,msg:"验证商用证书失败"}}},getCertSslListEvent:async()=>{try{const t=await c({request:o(),data:{info:[Object,"info"],data:[Array,"data"],administrator:[Object,"administrator"]}});return w.value={...t.administrator},{data:t,status:!0,msg:"获取商业证书列表成功"}}catch(t){return{status:!1,msg:"获取商业证书列表失败"}}},getDomainListEvent:async()=>{try{return{data:(await c({loading:"正在获取域名列表，请稍后...",request:u(),data:{data:Array}})).data,status:!0,msg:"获取域名列表成功"}}catch(t){return{status:!1,msg:"获取域名列表失败"}}},useDeployTrustAsiaCert:async(t,a)=>await c({loading:"正在部署证书，请稍后...",request:l(t,S.value),message:!1})}}),S=()=>{const t=f();return{...t,...g(t)}};export{f as S,S as u};
