"use client";
import * as a from "react";
import { useCallbackRef as r } from "../../react-use-callback-ref/dist/index.js";
function u(s, e = globalThis?.document) {
  const t = r(s);
  a.useEffect(() => {
    const n = (o) => {
      o.key === "Escape" && t(o);
    };
    return e.addEventListener("keydown", n, { capture: !0 }), () => e.removeEventListener("keydown", n, { capture: !0 });
  }, [t, e]);
}
export {
  u as useEscapeKeydown
};
