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