import{t as e}from"./browser-1D2tZwAR.js";var t=(t,n)=>{let r=(t,...n)=>e.debug(`[sleep] ${t}`,...n),i=AbortSignal.timeout(t),a=AbortSignal.any([i,...n===void 0?[]:[n]]);return new Promise((e,n)=>{let o=()=>{i.aborted?(r(`timed out`),e()):(r(`aborted`),n(a.reason??Error(`AbortError`)))};if(a.aborted){o();return}r(`sleeping for ${t}...`),a.addEventListener(`abort`,o,{once:!0})})};export{t};