import{e}from"./utils-lib.js?v=1761009159";import{a as t}from"./statusbar2.js?v=1761009159";import{s as a,j as s,u as r}from"./api2.js?v=1761009159";import{c as l,v as o,x as c,N as d,y as i,D as m,z as n,e as p,C as u,B as y}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const f={class:"tx_key_bind px-[2rem] py-[4rem]"},_={class:"tx_key_title"},b={class:"flex items-center justify-center"},I={class:"flex items-center gap-1rem"},w={class:"leading-2rem text-base px-[2rem]"},g=l({__name:"bind-api",props:{compData:{default:()=>({})}},setup(l){const g=l,{unref:h,ref:x,reactive:D}=g.compData.dependencies.vueMethods,{BtInput:K,ElForm:v,ElFormItem:k,ElAlert:j,ElButton:A}=h(g.compData.dependencies.components),{useAxios:E,useMessage:S,useConfirm:P}=h(g.compData.dependencies.hooks),V=S(),C=x(),q=D({secretId:g.compData.secretId||"",secretKey:g.compData.secretKey||""}),B=D({secretId:[{validator:(e,t,a)=>{q.secretId?a():a(new Error("请输入SecretId"))},message:"请输入SecretId",trigger:"blur"}],secretKey:[{validator:(e,t,a)=>{q.secretKey?a():a(new Error("请输入secretKey"))},message:"请输入SecretKey",trigger:"blur"}]}),F=async()=>{await C.value.validate();try{const e=V.load("正在关联密钥，请稍后..."),t=await s({secretId:q.secretId,secretKey:q.secretKey});e.close(),V.request(t),window.location.reload()}catch(e){}};return a(E),(a,s)=>{const l=e;return o(),c("div",f,[a.compData.tips||a.compData.alert?(o(),d(i(j),{key:0,type:"error",description:a.compData.tips||a.compData.alert,class:"!mb-1.6rem",closable:!1},null,8,["description"])):m("",!0),n("div",_,[n("span",b,[p(t,{class:"mr-[0.5rem]"}),s[3]||(s[3]=u(" 关联阿里云API密钥 ",-1))])]),p(i(v),{ref_key:"configFormRef",ref:C,rules:i(B),"label-position":"right","label-width":"100px","hide-required-asterisk":true,"show-message":true,model:i(q),class:"demo-form-inline mb-2rem"},{default:y(()=>[p(i(k),{label:"SecretId",prop:"secretId"},{default:y(()=>[p(i(K),{modelValue:i(q).secretId,"onUpdate:modelValue":s[0]||(s[0]=e=>i(q).secretId=e),width:"24.8rem",placeholder:"请输入SecretId"},null,8,["modelValue"])]),_:1}),p(i(k),{label:"SecretKey",prop:"secretKey"},{default:y(()=>[p(i(K),{modelValue:i(q).secretKey,"onUpdate:modelValue":s[1]||(s[1]=e=>i(q).secretKey=e),width:"24.8rem",class:"password","show-password":"",placeholder:"请输入SecretKey"},null,8,["modelValue"])]),_:1}),p(i(k),{label:" "},{default:y(()=>[n("div",I,[p(i(A),{type:"primary",onClick:F},{default:y(()=>s[4]||(s[4]=[u("关联API密钥",-1)])),_:1,__:[4]}),g.compData.isEdit||a.compData.tips?(o(),d(i(A),{key:0,type:"define",onClick:s[2]||(s[2]=e=>(async()=>{await P({title:"解绑阿里云API密钥",content:"是否取消关联阿里云API密钥,是否继续？"});const e=V.load("正在取消关联密钥，请稍后..."),t=await r();e.close(),V.request(t),window.location.reload()})())},{default:y(()=>s[5]||(s[5]=[u("取消关联密钥",-1)])),_:1,__:[5]})):m("",!0)])]),_:1})]),_:1},8,["rules","model"]),s[8]||(s[8]=n("div",{class:"leading-2rem text-base mb-[0.5rem] px-[2rem]",style:{color:"red"}},"温馨提示：请确保当前关联的密钥是本服务器的，如果不一致，将会导致数据获取异常和不正确，请须知",-1)),n("div",w,[s[7]||(s[7]=u("您正在使用宝塔面板阿里云联合定制版，请关联您的阿里云API密钥，如何获取阿里云API密钥，",-1)),p(l,{href:"https://console.cloud.tencent.com/cam/capi",target:"_blank",class:"btlink"},{default:y(()=>s[6]||(s[6]=[u("点击查看",-1)])),_:1,__:[6]})])])}}});export{g as default};
