import{l as F,q as O,U as S,al as j,ar as T,r as m,ak as A,W as w,as as C,aj as P,m as W,at as x}from"./entry.2xM5grDS.js";function V(e,t){let o,n,s;const i=m(!0),u=()=>{i.value=!0,s()};w(e,u,{flush:"sync"});const a=typeof t=="function"?t:t.get,c=typeof t=="function"?void 0:t.set,r=x((l,f)=>(n=l,s=f,{get(){return i.value&&(o=a(),i.value=!1),n(),o},set(y){c==null||c(y)}}));return Object.isExtensible(r)&&(r.trigger=u),r}function d(e){return j()?(T(e),!0):!1}function q(e){let t=0,o,n;const s=()=>{t-=1,n&&t<=0&&(n.stop(),o=void 0,n=void 0)};return(...i)=>(t+=1,o||(n=C(!0),o=n.run(()=>e(...i))),d(s),o)}function p(e){return typeof e=="function"?e():F(e)}const v=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const E=e=>typeof e<"u",I=Object.prototype.toString,L=e=>I.call(e)==="[object Object]",U=()=>+Date.now(),g=()=>{},z=D();function D(){var e,t;return v&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function h(e,t){function o(...n){return new Promise((s,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(s).catch(i)})}return o}const b=e=>e();function k(e,t={}){let o,n,s=g;const i=a=>{clearTimeout(a),s(),s=g};return a=>{const c=p(e),r=p(t.maxWait);return o&&i(o),c<=0||r!==void 0&&r<=0?(n&&(i(n),n=null),Promise.resolve(a())):new Promise((l,f)=>{s=t.rejectOnCancel?f:l,r&&!n&&(n=setTimeout(()=>{o&&i(o),n=null,l(a())},r)),o=setTimeout(()=>{n&&i(n),n=null,l(a())},c)})}}function M(e=b){const t=m(!0);function o(){t.value=!1}function n(){t.value=!0}const s=(...i)=>{t.value&&e(...i)};return{isActive:A(t),pause:o,resume:n,eventFilter:s}}function R(e){return e||P()}function B(e,t=200,o={}){return h(k(t,o),e)}function _(e,t,o={}){const{eventFilter:n=b,...s}=o;return w(e,h(n,t),s)}function H(e,t,o={}){const{eventFilter:n,...s}=o,{eventFilter:i,pause:u,resume:a,isActive:c}=M(n);return{stop:_(e,t,{...s,eventFilter:i}),pause:u,resume:a,isActive:c}}function J(e,t=!0,o){R()?O(e,o):t?e():S(e)}function K(e,t=1e3,o={}){const{immediate:n=!0,immediateCallback:s=!1}=o;let i=null;const u=m(!1);function a(){i&&(clearInterval(i),i=null)}function c(){u.value=!1,a()}function r(){const l=p(t);l<=0||(u.value=!0,s&&e(),a(),i=setInterval(e,l))}if(n&&v&&r(),W(t)||typeof t=="function"){const l=w(t,()=>{u.value&&v&&r()});d(l)}return d(c),{isActive:u,pause:c,resume:r}}export{J as a,z as b,d as c,L as d,U as e,K as f,E as g,V as h,v as i,q as j,g as n,p as t,B as u,H as w};
