import { isPressing as u } from "./state.es.js";
function d(r) {
  return (n) => {
    n.key === "Enter" && r(n);
  };
}
function t(r, n) {
  r.dispatchEvent(new PointerEvent("pointer" + n, { isPrimary: !0, bubbles: !0 }));
}
const c = (r, n) => {
  const e = r.currentTarget;
  if (!e)
    return;
  const i = d(() => {
    if (u.has(e))
      return;
    t(e, "down");
    const s = d(() => {
      t(e, "up");
    }), o = () => t(e, "cancel");
    e.addEventListener("keyup", s, n), e.addEventListener("blur", o, n);
  });
  e.addEventListener("keydown", i, n), e.addEventListener("blur", () => e.removeEventListener("keydown", i), n);
};
export {
  c as enableKeyboardPress
};
//# sourceMappingURL=keyboard.es.js.map
