import{E as i}from"./p-c9a42c5a.js";import"./p-d6eb762b.js";import{a as t}from"./p-05b65720.js";import"./p-9b3f323d.js";import"./p-be8a42cb.js";import"./p-90edb445.js";import"./p-427c7543.js";class s{static register(i,t,o){this.client=o,this.callbacks.push(i),i(this.states,this.logs,this.merchants,this.settlements,this.conversion),s.timer||(this.download(t),s.timer=setInterval(s.download,6e5))}static async download(o){var r,e,a,p,d;if(!this.downloading)try{this.downloading=!0;const l=await(null===(r=s.client)||void 0===r?void 0:r.merchant.list()),[n,v,c]=await Promise.all([l&&!i.is(l)?Promise.all(l.map((i=>{var t;return null===(t=s.client)||void 0===t?void 0:t.authorization.list(!0,i.id)}))).then((t=>t.reduce(((t,s)=>null!=s&&Array.isArray(s)&&t&&!i.is(t)?[...t,...s]:t),[]))):null===(e=s.client)||void 0===e?void 0:e.authorization.list(!0),"test"!=o?null===(a=s.client)||void 0===a?void 0:a.settlement.list():[],null===(p=s.client)||void 0===p?void 0:p.settlement.connection.get("currency/conversion")]),h="developer"==o?null===(d=s.client)||void 0===d?void 0:d.log.list():Promise.resolve([]);i.is(n)||!n||n.some(t.is)||(s.states=n),s.logs=h,i.is(l)||"string"==typeof l||(s.merchants=l),i.is(v)||"string"==typeof v||(s.settlements=v),i.is(c)||"string"==typeof c||(s.conversion=c),s.callbacks.forEach((i=>i(s.states,s.logs,s.merchants,s.settlements,s.conversion))),this.downloading=!1}catch(i){this.downloading=!1}}}s.downloading=!1,s.callbacks=[];export{s as H}