import{w as p,k as v,l as b,p as A,q as h,v as S,x as P,r as O}from"./index-DOFLUERq.js";function D(t){return b()?(A(t),!0):!1}const C=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const R=t=>t!=null,F=Object.prototype.toString,W=t=>F.call(t)==="[object Object]",_=()=>+Date.now(),m=()=>{},k=T();function T(){var t,e;return C&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function j(...t){if(t.length!==1)return S(...t);const e=t[0];return typeof e=="function"?h(P(()=>({get:e,set:m}))):O(e)}function g(t,e){function o(...n){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(i).catch(s)})}return o}const y=t=>t();function x(t,e={}){let o,n,i=m;const s=l=>{clearTimeout(l),i(),i=m};let a;return l=>{const c=v(t),r=v(e.maxWait);return o&&s(o),c<=0||r!==void 0&&r<=0?(n&&(s(n),n=void 0),Promise.resolve(l())):new Promise((u,f)=>{i=e.rejectOnCancel?f:u,a=l,r&&!n&&(n=setTimeout(()=>{o&&s(o),n=void 0,u(a())},r)),o=setTimeout(()=>{n&&s(n),n=void 0,u(l())},c)})}}function G(t=y,e={}){const{initialState:o="active"}=e,n=j(o==="active");function i(){n.value=!1}function s(){n.value=!0}const a=(...d)=>{n.value&&t(...d)};return{isActive:h(n),pause:i,resume:s,eventFilter:a}}function U(t){return Array.isArray(t)?t:[t]}function q(t,e=200,o={}){return g(x(e,o),t)}function E(t,e,o={}){const{eventFilter:n=y,...i}=o,s=g(n,e);let a,d,l;if(i.flush==="sync"){let c=!1;d=()=>{},a=r=>{c=!0,r(),c=!1},l=p(t,(...r)=>{c||s(...r)},i)}else{const c=[];let r=0,u=0;d=()=>{r=u},c.push(p(t,()=>{u++},{...i,flush:"sync"})),a=f=>{const w=u;f(),r+=u-w},c.push(p(t,(...f)=>{const w=r>0&&r===u;r=0,u=0,!w&&s(...f)},i)),l=()=>{c.forEach(f=>f())}}return{stop:l,ignoreUpdates:a,ignorePrevAsyncUpdates:d}}function M(t,e,o){return p(t,e,{...o,immediate:!0})}function N(t,e,o){return p(t,(i,s,a)=>{i&&e(i,s,a)},{...o,once:!1})}export{C as a,W as b,D as c,x as d,E as e,_ as f,R as g,N as h,k as i,m as n,G as p,U as t,q as u,M as w};
