import{O as u}from"./ossApi-DWfEXZHN.js";const l="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let b=(n=21)=>{let t="",s=crypto.getRandomValues(new Uint8Array(n));for(;n--;)t+=l[s[n]&63];return t};var a=null;function p(){return a?a.expiration-180*1e3<new Date().getTime()?(a=null,null):a:null}async function d(n){var t=p();if(t)return t;const e=(await n()).data;var c=Date.parse(e.expiration);return t=new u({endpoint:e.ossEndpoint,accessKeyId:e.accessKeyId,accessKeySecret:e.accessKeySecret,bucket:e.bucket,stsToken:e.securityToken}),a={client:t,expiration:c,domain:e.domain,ossObjectNamePrefix:e.ossObjectNamePrefix,bucket:e.bucket},a}function f(n,t,s){const e=s.lastIndexOf("."),c=s.substr(e),r=s.substr(0,e),o=`${n}${b()}${c}`,i=t+"/"+o;return{objectName:o,fileName:r,objectUrl:i}}const y={oss:d,getRandomObjectName:f};export{y as a};