import { useEffect as d } from "react";
const o = (e) => e.length === 1 && /^[a-z]$/i.test(e), s = (e) => e.length === 1 && /^[0-9]$/.test(e), a = (e) => o(e) || s(e), f = (e, t, u = [], r) => {
  d(() => {
    if (r?.enabled === !1)
      return;
    const i = (n) => {
      if (!n.defaultPrevented) {
        if (e === "Alphanumeric" && a(n.key)) {
          t(n.key);
          return;
        }
        n.key === e && t(e);
      }
    };
    return window.addEventListener("keydown", i), () => {
      window.removeEventListener("keydown", i);
    };
  }, [e, r?.enabled, ...u]);
};
export {
  f as useHandleKeyDown
};
//# sourceMappingURL=useHandleKeyDown.js.map
