"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useThinkingMessage = useThinkingMessage;
const react_1 = require("react");
const utils_1 = require("../../../utils/index.js");
const i18n_1 = require("./i18n/index.js");
function useThinkingMessage(options) {
    const { defaultExpanded = true, showStatusIndicator = true, status, content, onCopyClick, enabledCopy = false, } = options;
    const [isExpanded, setIsExpanded] = (0, react_1.useState)(defaultExpanded);
    const buttonTitle = (0, react_1.useMemo)(() => {
        return (0, i18n_1.i18n)(`title-${status}`);
    }, [status]);
    const contentArray = (0, react_1.useMemo)(() => {
        return Array.isArray(content) ? content : [content];
    }, [content]);
    const toggleExpanded = (0, react_1.useCallback)(() => {
        setIsExpanded((prev) => !prev);
    }, []);
    const handleCopy = (0, react_1.useCallback)(() => {
        if (onCopyClick) {
            // Priority 1: Use custom handler for backward compatibility
            onCopyClick();
        }
        else if (enabledCopy) {
            // Priority 2: Use default copy logic
            (0, utils_1.copyToClipboard)(content);
        }
    }, [onCopyClick, enabledCopy, content]);
    const showCopyButton = Boolean(onCopyClick || enabledCopy);
    return {
        isExpanded,
        toggleExpanded,
        buttonTitle,
        content: contentArray,
        showLoader: showStatusIndicator && status === 'thinking',
        handleCopy,
        showCopyButton,
    };
}
//# sourceMappingURL=useThinkingMessage.js.map
