var e=e=>setTimeout(e,16),t=e=>clearTimeout(e);typeof window<`u`&&`requestAnimationFrame`in window&&(e=e=>window.requestAnimationFrame(e),t=e=>window.cancelAnimationFrame(e));var n=0,r=new Map;function i(e){r.delete(e)}function a(t,a=1){n+=1;let o=n;function s(n){if(n===0)i(o),t();else{let t=e(()=>{s(n-1)});r.set(o,t)}}return s(a),o}a.cancel=e=>{let n=r.get(e);return i(n),t(n)},exports.default=a;