"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect, useState } from "react";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../components/ui/dialog";
import { Button } from "../../components/ui/button";
import { ParheliaIcon } from "../ui/ParheliaIcon";
export function SessionExpiredOverlay() {
    const [expired, setExpired] = useState(false);
    useEffect(() => {
        if (typeof window === "undefined")
            return;
        const handleExpired = () => setExpired(true);
        window.addEventListener("parhelia:session-expired", handleExpired);
        return () => {
            window.removeEventListener("parhelia:session-expired", handleExpired);
        };
    }, []);
    const goToLogin = () => {
        window.location.href = "/sitecore/login";
    };
    return (_jsx(Dialog, { open: expired, 
        // Block dismissal — the only way out is to log in again.
        onOpenChange: () => undefined, children: _jsxs(DialogContent, { "data-testid": "session-expired-overlay", showCloseButton: false, className: "sm:max-w-[460px]", onEscapeKeyDown: (event) => event.preventDefault(), onPointerDownOutside: (event) => event.preventDefault(), onInteractOutside: (event) => event.preventDefault(), children: [_jsx(DialogHeader, { children: _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "bg-neutral-grey-5 ring-border-default flex size-10 shrink-0 items-center justify-center rounded-full ring-1", children: _jsx(ParheliaIcon, { size: 22 }) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsx(DialogTitle, { children: "Your session has expired" }), _jsx(DialogDescription, { children: "For your security you have been signed out. Please log in again to continue." })] })] }) }), _jsx(DialogFooter, { children: _jsx(Button, { onClick: goToLogin, autoFocus: true, className: "min-w-[120px]", children: "Login" }) })] }) }));
}
//# sourceMappingURL=SessionExpiredOverlay.js.map