import{ba as b,aL as w,ah as y,bq as T,a3 as C,aC as D}from"./entry.816e6e91.js";function m(e){return C()?(D(e),!0):!1}function f(e){return typeof e=="function"?e():b(e)}const p=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const x=()=>+Date.now(),d=()=>{};function S(e,n){function i(...t){return new Promise((s,o)=>{Promise.resolve(e(()=>n.apply(this,t),{fn:n,thisArg:this,args:t})).then(s).catch(o)})}return i}function W(e,n={}){let i,t,s=d;const o=r=>{clearTimeout(r),s(),s=d};return r=>{const l=f(e),a=f(n.maxWait);return i&&o(i),l<=0||a!==void 0&&a<=0?(t&&(o(t),t=null),Promise.resolve(r())):new Promise((u,h)=>{s=n.rejectOnCancel?h:u,a&&!t&&(t=setTimeout(()=>{i&&o(i),t=null,u(r())},a)),i=setTimeout(()=>{t&&o(t),t=null,u(r())},l)})}}function F(e,n=200,i={}){return S(W(n,i),e)}function P(e,n=1e3,i={}){const{immediate:t=!0,immediateCallback:s=!1}=i;let o=null;const c=w(!1);function r(){o&&(clearInterval(o),o=null)}function l(){c.value=!1,r()}function a(){const u=f(n);u<=0||(c.value=!0,s&&e(),r(),o=setInterval(e,u))}if(t&&p&&a(),y(n)||typeof n=="function"){const u=T(n,()=>{c.value&&p&&a()});m(u)}return m(l),{isActive:c,pause:l,resume:a}}export{x as a,P as b,m as c,p as i,f as t,F as u};
