"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext, useMemo, useState } from "react";
const SplashScreenAgentContext = createContext(null);
/**
 * Holds the splash screen's chat/agent UI state above the workspace switching
 * boundary. ModernSplashScreen is unmounted when the user switches workspaces;
 * without this provider, a running agent's UI state would reset on return.
 */
export function SplashScreenAgentProvider({ children, }) {
    const [agent, setAgent] = useState(null);
    const [agentKey, setAgentKey] = useState(0);
    const [isTerminalVisible, setIsTerminalVisible] = useState(false);
    const [initialPrompt, setInitialPrompt] = useState(undefined);
    const [initialPromptDelivered, setInitialPromptDelivered] = useState(false);
    const [attachedDocs, setAttachedDocs] = useState([]);
    const [inputValue, setInputValue] = useState("");
    const value = useMemo(() => ({
        agent,
        setAgent,
        agentKey,
        setAgentKey,
        isTerminalVisible,
        setIsTerminalVisible,
        initialPrompt,
        setInitialPrompt,
        initialPromptDelivered,
        setInitialPromptDelivered,
        attachedDocs,
        setAttachedDocs,
        inputValue,
        setInputValue,
    }), [
        agent,
        agentKey,
        isTerminalVisible,
        initialPrompt,
        initialPromptDelivered,
        attachedDocs,
        inputValue,
    ]);
    return (_jsx(SplashScreenAgentContext.Provider, { value: value, children: children }));
}
export function useSplashScreenAgent() {
    const ctx = useContext(SplashScreenAgentContext);
    if (!ctx) {
        throw new Error("useSplashScreenAgent must be used within SplashScreenAgentProvider");
    }
    return ctx;
}
//# sourceMappingURL=SplashScreenAgentContext.js.map