import{r as e,j as l}from"./index-VJpwYvBU.js";const x=e.memo(({value:n,onChange:o,debounce:c=500,...f})=>{const[t,s]=e.useState(n.toString()),a=e.useRef(!1),u=e.useRef(void 0);e.useEffect(()=>{s(n.toString())},[n]),e.useEffect(()=>{if(u.current===t)return;if(a.current===!1){u.current=t,a.current=!0;return}const r=setTimeout(()=>{u.current!==t&&(u.current=t,o(t))},c);return()=>clearTimeout(r)},[t,c,o]);const p=e.useCallback(r=>{s(r.target.value)},[]),m=e.useCallback(r=>{r.key==="Escape"&&(r.preventDefault(),s(""))},[]);return l.jsx("input",{...f,type:"text",value:t,onChange:p,onKeyDown:m})});export{x as D};
