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