import{dq as e,dm as l}from"./index-DjbVAZHL.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 m=e.useCallback(r=>{s(r.target.value)},[]),p=e.useCallback(r=>{r.key==="Escape"&&(r.preventDefault(),s(""))},[]);return l.jsx("input",{...f,type:"text",value:t,onChange:m,onKeyDown:p})});export{x as D};
