import{z as w}from"./index-F5308wi0.js";var l=typeof window>"u"?w||{}:window,r={times:1,duration:1e3/30,update:function(i){var e=Math.max(8.333333333333334,Math.min(33.333333333333336,i));this.times+=1,this.duration=(this.duration+e)/2},correct:function(){var i=0,e;return new Promise(function(t){(function a(){typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(function(o){var m=o||new Date().getTime();e&&r.update(m-e),e=m,++i<15?a():t(r.duration)})})()})}};r.correct();var d={hidden:!1};function b(n){if(typeof document<"u"){var i="hidden"in document?"hidden":"webkitHidden"in document?"webkitHidden":"mozHidden"in document?"mozHidden":null;if(i){var e=i.replace(/hidden/i,"visibilitychange");window.addEventListener(e,function(){d.hidden=document[i],n(d.hidden)})}}}r.duration=1e3/60;var u=function(){return new Date().getTime()},h=u();function v(){return Math.max(0,r.duration-(u()-h))}function g(n){return{didTimeout:n,timeRemaining:function(){return v()*50/r.duration}}}var s;function f(n){cancelAnimationFrame(s);var i=function(){setTimeout(function(){for(var t=0;v()&&t<n.length;t+=1){var a=n[t];if(!a.canceled&&!a.done){try{a.callback(g(!1))}catch(o){setTimeout(function(){throw o},0)}a.done=!0}}n.splice(0,t),h=u(),n.length&&f(n)})};d.hidden?i():s=requestAnimationFrame(i)}var p=0;function T(n){return{id:++p,canceled:!1,done:!1,callback:function(e){try{n(e)}catch(t){setTimeout(function(){throw t},0)}}}}var c=[];function F(n,i){var e=T(n);return c.push(e),f(c),e.id}b(function(n){n&&f(c)});export{F as r};