import{an as n,aX as t,ao as i,a8 as r}from"./chunk-5b723e6e.js";function e(){if(f)return u;f=1;var r=i(),e=function(){if(o)return a;o=1;var t=n();return a=function(){return t.Date.now()}}(),c=t(),v=Math.max,d=Math.min;return u=function(n,t,i){var a,o,u,f,l,m,s=0,p=!1,g=!1,h=!0;if("function"!=typeof n)throw TypeError("Expected a function");function T(t){var i=a,r=o;return a=o=void 0,s=t,f=n.apply(r,i)}t=c(t)||0,r(i)&&(p=!!i.leading,u=(g="maxWait"in i)?v(c(i.maxWait)||0,t):u,h="trailing"in i?!!i.trailing:h);function x(n){var i=n-m,r=n-s;return void 0===m||i>=t||i<0||g&&r>=u}function y(){var n,i,r,a,o=e();if(x(o))return E(o);l=setTimeout(y,(i=(n=o)-m,r=n-s,a=t-i,g?d(a,u-r):a))}function E(n){return(l=void 0,h&&a)?T(n):(a=o=void 0,f)}function w(){var n,i=e(),r=x(i);if(a=arguments,o=this,m=i,r){if(void 0===l){return s=n=m,l=setTimeout(y,t),p?T(n):f}if(g)return clearTimeout(l),l=setTimeout(y,t),T(m)}return void 0===l&&(l=setTimeout(y,t)),f}return w.cancel=function(){void 0!==l&&clearTimeout(l),s=0,a=m=o=l=void 0},w.flush=function(){return void 0===l?f:E(e())},w}}var a,o,u,f,c,v,d=r(function(){if(v)return c;v=1;var n=e(),t=i();return c=function(i,r,e){var a=!0,o=!0;if("function"!=typeof i)throw TypeError("Expected a function");return t(e)&&(a="leading"in e?!!e.leading:a,o="trailing"in e?!!e.trailing:o),n(i,r,{leading:a,maxWait:r,trailing:o})}}());export{e as r,d as t};
