import { useState as i, useEffect as w } from "react";
function c(s) {
  const [r, d] = i(!1);
  function e(o) {
    const { code: t } = o;
    t === s && d(!0);
  }
  const n = (o) => {
    const { code: t } = o;
    t === s && d(!1);
  };
  return w(() => (window.addEventListener("keydown", e), window.addEventListener("keyup", n), () => {
    window.removeEventListener("keydown", e), window.removeEventListener("keyup", n);
  }), [e, n]), r;
}
export {
  c as useWindowKeyPress
};
