import{aD as F,b5 as b,aC as y,Q as C,bF as P}from"./index-b1b92161-1694073636386.js";function g(e){return F()?(b(e),!0):!1}function w(e){return typeof e=="function"?e():P(e)}const R=typeof window<"u",m=()=>{};function h(e,i){function n(...t){return new Promise((o,r)=>{Promise.resolve(e(()=>i.apply(this,t),{fn:i,thisArg:this,args:t})).then(o).catch(r)})}return n}function j(e,i={}){let n,t,o=m;const r=u=>{clearTimeout(u),o(),o=m};return u=>{const a=w(e),s=w(i.maxWait);return n&&r(n),a<=0||s!==void 0&&s<=0?(t&&(r(t),t=null),Promise.resolve(u())):new Promise((c,p)=>{o=i.rejectOnCancel?p:c,s&&!t&&(t=setTimeout(()=>{n&&r(n),t=null,c(u())},s)),n=setTimeout(()=>{t&&r(t),t=null,c(u())},a)})}}function O(e,i=!0,n=!0,t=!1){let o=0,r,l=!0,u=m,a;const s=()=>{r&&(clearTimeout(r),r=void 0,u(),u=m)};return p=>{const f=w(e),D=Date.now()-o,d=()=>a=p();return s(),f<=0?(o=Date.now(),d()):(D>f&&(n||!l)?(o=Date.now(),d()):i&&(a=new Promise((T,x)=>{u=t?x:T,r=setTimeout(()=>{o=Date.now(),l=!0,T(d()),s()},Math.max(0,f-D))})),!n&&!r&&(r=setTimeout(()=>l=!0,f)),l=!1,a)}}function U(e,i=200,n={}){return h(j(i,n),e)}function V(e,i=200,n=!1,t=!0,o=!1){return h(O(i,n,t,o),e)}function W(e){y()&&C(e)}export{U as a,w as b,W as c,R as i,g as t,V as u};
