import{s as e,t}from"./rolldown-runtime-C5c2KzVm.js";import{$P as n}from"./lucide-C4oWPzu4.js";var r=t(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(x(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&p.call(e)==i}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=_})),i=e(n(),1),a=e(r(),1);function o(e){let t=(0,i.useRef)(e);t.current=e,(0,i.useEffect)(()=>()=>{t.current()},[])}function s(e,t=500,n){let r=(0,i.useRef)();o(()=>{r.current&&r.current.cancel()});let s=(0,i.useMemo)(()=>{let i=(0,a.default)(e,t,n),o=(...e)=>i(...e);return o.cancel=()=>{i.cancel()},o.isPending=()=>!!r.current,o.flush=()=>i.flush(),o},[e,t,n]);return(0,i.useEffect)(()=>{r.current=(0,a.default)(e,t,n)},[e,t,n]),s}function c(e,t,n){let r=n?.equalityFn??((e,t)=>e===t),a=e instanceof Function?e():e,[o,c]=(0,i.useState)(a),l=(0,i.useRef)(a),u=s(c,t,n);return r(l.current,a)||(u(a),l.current=a),[o,u]}export{c as n,s as t};