import{e as o,b as c}from"./tslib.es6-CFMGCLkz.js";import{g as f,r as s}from"./index-Cjq2zQnM.js";import{e as d,i as g}from"./traverse-react-node-C1rM2d-r.js";import{c as m,d as v}from"./use-isomorphic-update-layout-effect-BPBx7ziv.js";var h=d,_=g,p="Expected a function";function E(n,e,r){var t=!0,a=!0;if(typeof n!="function")throw new TypeError(p);return _(r)&&(t="leading"in r?!!r.leading:t,a="trailing"in r?!!r.trailing:a),h(n,e,{leading:t,maxWait:e,trailing:a})}var b=E;const x=f(b);function w(n,e){var r,t=m(n),a=(r=e==null?void 0:e.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 t.current.apply(t,o([],c(i),!1))},a,e)},[]);return v(function(){u.cancel()}),{run:u,cancel:u.cancel,flush:u.flush}}export{w as u};
