import { useMemo } from "react";
/**
 * 样式计算 Hook
 * 计算组件所需的样式值
 */ export var useMarkdownInputFieldStyles = function(param) {
    var toolsRender = param.toolsRender, maxHeight = param.maxHeight, style = param.style, attachment = param.attachment, isEnlarged = param.isEnlarged, rightPadding = param.rightPadding, topRightPadding = param.topRightPadding, quickRightOffset = param.quickRightOffset, hasEnlargeAction = param.hasEnlargeAction, hasRefineAction = param.hasRefineAction, totalActionCount = param.totalActionCount, isMultiRowLayout = param.isMultiRowLayout;
    var computedRightPadding = useMemo(function() {
        var bottomOverlayPadding = toolsRender ? 0 : rightPadding || 52;
        var topOverlayPadding = (topRightPadding || 0) + (quickRightOffset || 0);
        return Math.max(bottomOverlayPadding, topOverlayPadding);
    }, [
        toolsRender,
        rightPadding,
        topRightPadding,
        quickRightOffset
    ]);
    var collapsedHeight = useMemo(function() {
        // 优先使用 maxHeight prop，其次使用 style.maxHeight，最后使用默认值
        var maxHeightValue = maxHeight !== null && maxHeight !== void 0 ? maxHeight : style === null || style === void 0 ? void 0 : style.maxHeight;
        var base = typeof maxHeightValue === 'number' ? maxHeightValue : maxHeightValue ? parseFloat(String(maxHeightValue)) || 114 : 114;
        return base;
    }, [
        maxHeight,
        style === null || style === void 0 ? void 0 : style.maxHeight,
        attachment === null || attachment === void 0 ? void 0 : attachment.enable
    ]);
    var collapsedHeightPx = useMemo(function() {
        var extra = (attachment === null || attachment === void 0 ? void 0 : attachment.enable) ? 90 : 0;
        return collapsedHeight + extra;
    }, [
        collapsedHeight,
        attachment === null || attachment === void 0 ? void 0 : attachment.enable
    ]);
    var computedMinHeight = useMemo(function() {
        if (isEnlarged) return 'auto';
        if ((style === null || style === void 0 ? void 0 : style.minHeight) !== undefined) return style.minHeight;
        // 如果同时有放大按钮和提示词优化按钮，最小高度为 140px
        if (hasEnlargeAction && hasRefineAction) return 140;
        if (totalActionCount === 1) return 90;
        // 其他多行布局情况，最小高度为 106px
        if (isMultiRowLayout) return 106;
        // 默认使用传入的 minHeight 或 0
        return (style === null || style === void 0 ? void 0 : style.minHeight) || 0;
    }, [
        isEnlarged,
        hasEnlargeAction,
        hasRefineAction,
        isMultiRowLayout,
        totalActionCount,
        style === null || style === void 0 ? void 0 : style.minHeight
    ]);
    var enlargedStyle = useMemo(function() {
        if (!isEnlarged) return {};
        return {
            maxHeight: '980px',
            minHeight: '280px'
        };
    }, [
        isEnlarged
    ]);
    return {
        computedRightPadding: computedRightPadding,
        collapsedHeight: collapsedHeight,
        collapsedHeightPx: collapsedHeightPx,
        computedMinHeight: computedMinHeight,
        enlargedStyle: enlargedStyle
    };
};
