import { Keys as a } from "../components/keyboard.js";
import { useEventListener as r } from "./use-event-listener.js";
import { useIsTopLayer as u } from "./use-is-top-layer.js";
function m(o, t = typeof document < "u" ? document.defaultView : null, s) {
  let n = u(o, "escape");
  r(t, "keydown", (e) => {
    n && (e.defaultPrevented || e.key === a.Escape && s(e));
  });
}
export {
  m as useEscape
};
