import{z as p,L as b,aQ as h,aR as w,aY as l}from"./index-a0da86f0.js";function O(e){return h()?(w(e),!0):!1}const g=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const y=Object.prototype.toString,A=e=>y.call(e)==="[object Object]",m=()=>{};function S(e,n){function t(...r){return new Promise((o,i)=>{Promise.resolve(e(()=>n.apply(this,r),{fn:n,thisArg:this,args:r})).then(o).catch(i)})}return t}function T(e,n={}){let t,r,o=m;const i=a=>{clearTimeout(a),o(),o=m};let c;return a=>{const f=l(e),s=l(n.maxWait);return t&&i(t),f<=0||s!==void 0&&s<=0?(r&&(i(r),r=void 0),Promise.resolve(a())):new Promise((u,d)=>{o=n.rejectOnCancel?d:u,c=a,s&&!r&&(r=setTimeout(()=>{t&&i(t),r=void 0,u(c())},s)),t=setTimeout(()=>{r&&i(r),r=void 0,u(a())},f)})}}function D(e){return Array.isArray(e)?e:[e]}function P(e,n=200,t={}){return S(T(n,t),e)}function W(e,n,t){return p(e,n,{...t,immediate:!0})}function C(e,n,t){const r=p(e,(o,i,c)=>{o&&(t!=null&&t.once&&b(()=>r()),n(o,i,c))},{...t,once:!1});return r}export{O as a,A as b,C as c,g as i,m as n,D as t,P as u,W as w};
