import{a as o,b as c}from"./tslib.es6-e2qAPn_M.js";import{g as f,r as s}from"./index-C54fwk-Q.js";import{e as g,i as m}from"./traverse-react-node-BNrm-tGM.js";import{b as d,c as v}from"./use-isomorphic-update-layout-effect-Bl9jh5eH.js";var h=g,_=m,b="Expected a function";function p(n,t,r){var e=!0,a=!0;if(typeof n!="function")throw new TypeError(b);return _(r)&&(e="leading"in r?!!r.leading:e,a="trailing"in r?!!r.trailing:a),h(n,t,{leading:e,maxWait:t,trailing:a})}var E=p;const x=f(E);function w(n,t){var r,e=d(n),a=(r=t==null?void 0:t.wait)!==null&&r!==void 0?r:1e3,u=s.useMemo(function(){return x(function(){for(var i=[],l=0;l<arguments.length;l++)i[l]=arguments[l];return e.current.apply(e,o([],c(i),!1))},a,t)},[]);return v(function(){u.cancel()}),{run:u,cancel:u.cancel,flush:u.flush}}export{w as u};
