import { createContext, useContext } from "react";
/**
 * Provides a DOM element that dialog/alert-dialog portals render into.
 * When set, `position: fixed` inside the container is relative to that
 * element (because it has `transform: translateZ(0)` which creates a
 * new containing block for fixed-position descendants).
 *
 * Falls back to `undefined` (i.e. default Radix behaviour = document.body).
 */
const AppPortalContainerContext = createContext(null);
export const AppPortalContainerProvider = AppPortalContainerContext.Provider;
export const APP_PORTAL_CONTAINER_ID = "parhelia-app-portal-container";
export function useAppPortalContainer() {
    const container = useContext(AppPortalContainerContext);
    if (container) {
        return container;
    }
    if (typeof document === "undefined") {
        return undefined;
    }
    return document.getElementById(APP_PORTAL_CONTAINER_ID) ?? undefined;
}
//# sourceMappingURL=portal-container-context.js.map