import { useEffect as o } from "react";
let d = 0;
function c() {
  o(() => {
    var e, t;
    const a = document.querySelectorAll("[data-radix-focus-guard]");
    return document.body.insertAdjacentElement("afterbegin", (e = a[0]) !== null && e !== void 0 ? e : n()), document.body.insertAdjacentElement("beforeend", (t = a[1]) !== null && t !== void 0 ? t : n()), d++, () => {
      d === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach(
        (r) => r.remove()
      ), d--;
    };
  }, []);
}
function n() {
  const e = document.createElement("span");
  return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
}
export {
  c as useFocusGuards
};
