import { useLayoutEffect } from "react";
export function useAgentSummaryQuestionnaireScroll(input) {
    const { displayMode, isQuestionnaireDialogOpen, getMessagesContainer } = input;
    useLayoutEffect(() => {
        if (displayMode !== "summary" || !isQuestionnaireDialogOpen) {
            return;
        }
        const scrollSummaryTerminalToTop = () => {
            const container = getMessagesContainer();
            if (!container) {
                return;
            }
            container.scrollTop = 0;
        };
        scrollSummaryTerminalToTop();
        const frame1 = requestAnimationFrame(() => {
            scrollSummaryTerminalToTop();
        });
        let frame3 = 0;
        const frame2 = requestAnimationFrame(() => {
            frame3 = requestAnimationFrame(() => {
                scrollSummaryTerminalToTop();
            });
        });
        return () => {
            cancelAnimationFrame(frame1);
            cancelAnimationFrame(frame2);
            cancelAnimationFrame(frame3);
        };
    }, [displayMode, isQuestionnaireDialogOpen]);
}
//# sourceMappingURL=useAgentSummaryQuestionnaireScroll.js.map