import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{h as t}from"./vendor-react-nmZsNlRz.js";var n=e(t(),1);function r(e,t=!0){let r=(0,n.useRef)(e);r.current=e,(0,n.useEffect)(()=>{if(!t)return;let e=e=>{if(e.key!==`r`&&e.key!==`R`||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat)return;let t=e.target;t?.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||(e.preventDefault(),r.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t])}export{r as t};