import{a as e,i as t}from"./api-CqQWIBIg.js";async function n(n){let r=t(),i=await fetch(n,{headers:r?{Authorization:`Bearer ${r}`}:{}});if(i.status===401){let t=await e();t&&(i=await fetch(n,{headers:{Authorization:`Bearer ${t}`}}))}if(!i.ok)throw Error(`Could not load the document (${i.status}).`);let a=await i.blob(),o=URL.createObjectURL(a);if(!window.open(o,`_blank`)){let e=document.createElement(`a`);e.href=o,e.download=n.split(`/`).filter(Boolean).slice(-2,-1)[0]+`.pdf`,e.click()}setTimeout(()=>URL.revokeObjectURL(o),6e4)}export{n as t};