import{o as r,p as t,k as n,K as i}from"./p-9811c98c.js";var o="[object Symbol]",e=/\s/,u=/^\s+/;var f=NaN,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,v=/^0o[0-7]+$/i,s=parseInt;function m(i){if("number"==typeof i)return i;if(function(n){return"symbol"==typeof n||r(n)&&t(n)==o}(i))return f;if(n(i)){var m="function"==typeof i.valueOf?i.valueOf():i;i=n(m)?m+"":m}if("string"!=typeof i)return 0===i?i:+i;var p;i=(p=i)?p.slice(0,function(r){for(var t=r.length;t--&&e.test(r.charAt(t)););return t}(p)+1).replace(u,""):p;var d=c.test(i);return d||v.test(i)?s(i.slice(2),d?2:8):a.test(i)?f:+i}const p=function(){return i.Date.now()};var d=Math.max,y=Math.min;function T(r,t,i){var o,e,u,f,a,c,v=0,s=!1,T=!1,b=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function l(t){var n=o,i=e;return o=e=void 0,v=t,f=r.apply(i,n)}function h(r){var n=r-c;return void 0===c||n>=t||n<0||T&&r-v>=u}function x(){var r=p();if(h(r))return $(r);a=setTimeout(x,function(r){var n=t-(r-c);return T?y(n,u-(r-v)):n}(r))}function $(r){return a=void 0,b&&o?l(r):(o=e=void 0,f)}function g(){var r=p(),n=h(r);if(o=arguments,e=this,c=r,n){if(void 0===a)return function(r){return v=r,a=setTimeout(x,t),s?l(r):f}(c);if(T)return clearTimeout(a),a=setTimeout(x,t),l(c)}return void 0===a&&(a=setTimeout(x,t)),f}return t=m(t)||0,n(i)&&(s=!!i.leading,u=(T="maxWait"in i)?d(m(i.maxWait)||0,t):u,b="trailing"in i?!!i.trailing:b),g.cancel=function(){void 0!==a&&clearTimeout(a),v=0,o=c=e=a=void 0},g.flush=function(){return void 0===a?f:$(p())},g}export{T as d}