"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getValueLabelStyle = void 0;
const savedCharts_1 = require("../../../types/savedCharts");
const colors_1 = require("../../../utils/colors");
const themeColors_1 = require("./themeColors");
/**
 * Get value label styling for any chart series (line, bar, area, scatter, etc.)
 * Size: 11px
 * @param position - Label position relative to data point
 * @param type - Series type
 * @param backgroundColor - Optional series color
 */
const getValueLabelStyle = (position, type, backgroundColor) => {
    const isInside = position === 'inside';
    const base = {
        fontSize: 11,
        fontWeight: isInside ? '400' : '500',
        color: themeColors_1.FOREGROUND,
    };
    // For bar charts with inside labels, use contrasting color based on bar color
    if (isInside && type === savedCharts_1.CartesianSeriesType.BAR && backgroundColor) {
        return {
            ...base,
            fontSize: 10,
            color: (0, colors_1.getReadableTextColor)(backgroundColor),
            backgroundColor,
            borderRadius: 4,
            padding: [1, 2],
        };
    }
    // For line and area charts with inside labels, use border for legibility
    if (isInside &&
        (type === savedCharts_1.CartesianSeriesType.LINE || type === savedCharts_1.CartesianSeriesType.AREA)) {
        return {
            ...base,
            textBorderColor: themeColors_1.BACKGROUND,
            textBorderWidth: 1.5,
            textBorderType: 'solid',
        };
    }
    return base;
};
exports.getValueLabelStyle = getValueLabelStyle;
//# sourceMappingURL=valueLabelStyles.js.map