import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Transition } from "@headlessui/react";
import { Fragment, useEffect, useState } from "react";
import { useUserSession } from "@vertesia/ui/session";
export function SplashScreen({ icon: Icon }) {
    const { isLoading } = useUserSession();
    const [show, setShow] = useState(true);
    useEffect(() => {
        if (!isLoading) {
            setShow(false);
        }
        // setTimeout(() => {
        //     setShow(false)
        // }, 2000)
    }, [isLoading]);
    // 300 500 700 1000
    return (_jsx(Transition, { appear: true, show: show, as: Fragment, unmount: true, leave: "transition ease-in duration-500", leaveFrom: "opacity-100", leaveTo: "opacity-0", children: _jsx("div", { style: { zIndex: 999999 }, className: 'fixed inset-x-0 inset-y-0', children: _jsx("div", { className: "flex w-full h-full items-center justify-center", children: _jsx("div", { className: "animate-[spin_4s_linear_infinite]", children: _jsx("div", { className: 'animate-pulse rounded-full bg-transparent', children: Icon || _jsx(LoadingIcon, {}) }) }) }) }) }));
}
function LoadingIcon() {
    const stopColor1 = "currentColor";
    const stopColor2 = "currentColor";
    // const stopColor1 = "#4F46E5";
    // const stopColor2 = "#4F46E5";
    return (_jsxs("svg", { className: "w-8 h-8 text-indigo-600", viewBox: "0 0 50 50", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("defs", { children: _jsxs("linearGradient", { id: "spinner-gradient", x1: "1", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: stopColor1, stopOpacity: "1" }), _jsx("stop", { offset: "100%", stopColor: stopColor2, stopOpacity: "0" })] }) }), _jsx("circle", { cx: "25", cy: "25", r: "20", stroke: "url(#spinner-gradient)", strokeWidth: "5", fill: "none", strokeLinecap: "round" })] }));
}
//# sourceMappingURL=SplashScreen.js.map