import{useEffect as o,useRef as c}from"react";functionf(e,n=!0){const t=c(e);o(()=>{t.current=e}),o(()=>{if(!n)return;constr=u=>{u.key==="Escape"&&t.current()};returndocument.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n])}exportdefault f;