import{m as F,k as O,Y as S,an as C,at as T,r as m,am as j,l as w,au as A,i as P,C as x,av as I}from"./entry.RGd0w9hd.js";function V(e,t){let o,n,s;const i=m(!0),a=()=>{i.value=!0,s()};w(e,a,{flush:"sync"});const u=typeof t=="function"?t:t.get,c=typeof t=="function"?void 0:t.set,r=I((l,f)=>(n=l,s=f,{get(){return i.value&&(o=u(),i.value=!1),n(),o},set(y){c==null||c(y)}}));return Object.isExtensible(r)&&(r.trigger=a),r}function d(e){return C()?(T(e),!0):!1}function E(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=A(!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 L=e=>typeof e<"u",W=Object.prototype.toString,Y=e=>W.call(e)==="[object Object]",q=()=>+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=u=>{clearTimeout(u),s(),s=g};return u=>{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(u())):new Promise((l,f)=>{s=t.rejectOnCancel?f:l,r&&!n&&(n=setTimeout(()=>{o&&i(o),n=null,l(u())},r)),o=setTimeout(()=>{n&&i(n),n=null,l(u())},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:j(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:a,resume:u,isActive:c}=M(n);return{stop:_(e,t,{...s,eventFilter:i}),pause:a,resume:u,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 a=m(!1);function u(){i&&(clearInterval(i),i=null)}function c(){a.value=!1,u()}function r(){const l=p(t);l<=0||(a.value=!0,s&&e(),u(),i=setInterval(e,l))}if(n&&v&&r(),x(t)||typeof t=="function"){const l=w(t,()=>{a.value&&v&&r()});d(l)}return d(c),{isActive:a,pause:c,resume:r}}export{J as a,z as b,d as c,Y as d,q as e,K as f,L as g,V as h,v as i,E as j,g as n,p as t,B as u,H as w};
