import{j as f,F as l}from"./index-b983ad9b.js";import{r}from"./react-b0e0d18a.js";function E({timeout:i=500,value:s,onChange:n,children:a}){const[m,o]=r.useState(),u=r.useRef(),c=(t,e=!1)=>{o(t),u.current&&window.clearTimeout(u.current),e?n&&n(t):u.current=window.setTimeout(()=>{n&&n(t)},i)};return r.useEffect(()=>{o(s)},[s]),f(l,{children:r.Children.map(a,t=>r.isValidElement(t)?r.cloneElement(t,{value:m,onChange(e){c(e&&e.target?e.target.value:e)}}):t)})}export{E as T};
