import { isCombination, isPivot } from "../../../../utils/index.js";
import { isNullish } from "remeda";
const pivotGridStyle = (spec, context)=>{
    const { vseed, advancedVSeed } = context;
    const { config, chartType } = advancedVSeed;
    const chartConfig = config?.[chartType] ?? {};
    const themConfig = chartConfig?.pivotGrid ?? {};
    const fontFamily = chartConfig?.fontFamily;
    const onlyCombination = !isPivot(vseed) && isCombination(vseed);
    const result = {
        ...spec
    };
    const transparent = 'rgba(0,0,0,0)';
    const borderColor = themConfig.borderColor ?? '#e3e5eb';
    const bodyFontSize = themConfig.bodyFontSize ?? 12;
    const bodyFontColor = themConfig.bodyFontColor ?? '#141414';
    const headerFontSize = themConfig.headerFontSize ?? 12;
    const headerFontColor = themConfig.headerFontColor ?? '#21252c';
    const headerBackgroundColor = themConfig.headerBackgroundColor ?? 'rgba(0,0,0,0)';
    const hoverHeaderBackgroundColor = onlyCombination ? transparent : themConfig.hoverHeaderBackgroundColor ?? '#D9DDE4';
    const hoverHeaderInlineBackgroundColor = onlyCombination ? transparent : themConfig.hoverHeaderInlineBackgroundColor ?? '#D9DDE455';
    const outlineBorderLineWidth = themConfig.outlineBorderLineWidth ?? 0;
    const frameCornerRadius = themConfig.frameCornerRadius ?? 0;
    if (!isNullish(themConfig.minChartWidth)) result.defaultColWidth = themConfig.minChartWidth;
    if (!isNullish(themConfig.minChartHeight)) result.defaultRowHeight = themConfig.minChartHeight;
    return {
        ...result,
        theme: {
            underlayBackgroundColor: transparent,
            bodyStyle: {
                borderColor,
                color: bodyFontColor,
                fontSize: bodyFontSize,
                fontFamily,
                borderLineWidth: (arg)=>{
                    const noYAxis = 'pie' === chartType || 'rose' === chartType || 'donut' === chartType || 'radar' === chartType || 'roseParallel' === chartType;
                    return [
                        0 === arg.row || 'funnel' === chartType && 1 === arg.row && arg.table.rowCount <= 2 ? outlineBorderLineWidth : 1,
                        outlineBorderLineWidth,
                        0,
                        0 === arg.col || noYAxis && 1 === arg.col && arg.table.colCount <= 2 ? outlineBorderLineWidth : 1
                    ];
                },
                bgColor: transparent,
                hover: {
                    cellBgColor: 'transparent'
                }
            },
            headerStyle: {
                borderColor,
                fontSize: headerFontSize,
                fontFamily,
                borderLineWidth: (arg)=>[
                        outlineBorderLineWidth,
                        outlineBorderLineWidth,
                        1,
                        0 === arg.col ? outlineBorderLineWidth : 1
                    ],
                color: headerFontColor,
                textAlign: 'center',
                bgColor: headerBackgroundColor,
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor,
                    inlineRowBgColor: hoverHeaderInlineBackgroundColor || void 0,
                    inlineColumnBgColor: hoverHeaderInlineBackgroundColor || void 0
                }
            },
            rowHeaderStyle: {
                borderColor,
                fontSize: headerFontSize,
                fontFamily,
                color: headerFontColor,
                padding: [
                    0,
                    12,
                    0,
                    4
                ],
                borderLineWidth: (arg)=>[
                        0 === arg.row ? outlineBorderLineWidth : 1,
                        1,
                        0,
                        outlineBorderLineWidth
                    ],
                bgColor: headerBackgroundColor,
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor,
                    inlineRowBgColor: hoverHeaderInlineBackgroundColor || void 0,
                    inlineColumnBgColor: hoverHeaderInlineBackgroundColor || void 0
                }
            },
            cornerHeaderStyle: {
                borderColor,
                textAlign: 'center',
                fontSize: headerFontSize,
                fontFamily,
                color: headerFontColor,
                padding: [
                    0,
                    12,
                    0,
                    4
                ],
                fontWeight: 'bold',
                borderLineWidth: [
                    outlineBorderLineWidth,
                    1,
                    1,
                    outlineBorderLineWidth
                ],
                bgColor: headerBackgroundColor,
                frameStyle: {
                    borderColor
                },
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor,
                    inlineRowBgColor: hoverHeaderInlineBackgroundColor || void 0,
                    inlineColumnBgColor: hoverHeaderInlineBackgroundColor || void 0
                }
            },
            cornerLeftBottomCellStyle: {
                borderColor,
                borderLineWidth: [
                    outlineBorderLineWidth,
                    0,
                    outlineBorderLineWidth,
                    outlineBorderLineWidth
                ],
                bgColor: headerBackgroundColor,
                frameStyle: {
                    borderColor,
                    borderLineWidth: [
                        1,
                        0,
                        outlineBorderLineWidth,
                        outlineBorderLineWidth
                    ]
                },
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor
                }
            },
            cornerRightTopCellStyle: {
                borderColor,
                borderLineWidth: [
                    outlineBorderLineWidth,
                    outlineBorderLineWidth,
                    1,
                    1
                ],
                frameStyle: {
                    borderColor,
                    borderLineWidth: 0
                },
                bgColor: headerBackgroundColor,
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor
                }
            },
            rightFrozenStyle: {
                borderColor,
                bgColor: headerBackgroundColor,
                borderLineWidth: (arg)=>[
                        0 === arg.row ? outlineBorderLineWidth : 1,
                        outlineBorderLineWidth,
                        0,
                        1
                    ],
                frameStyle: {
                    borderLineWidth: 0
                },
                hover: {
                    borderLineWidth: 0,
                    cellBgColor: hoverHeaderBackgroundColor
                }
            },
            cornerRightBottomCellStyle: {
                borderColor,
                bgColor: headerBackgroundColor,
                borderLineWidth: [
                    1,
                    outlineBorderLineWidth,
                    outlineBorderLineWidth,
                    1
                ],
                frameStyle: {
                    borderColor,
                    borderLineWidth: [
                        1,
                        outlineBorderLineWidth,
                        outlineBorderLineWidth,
                        1
                    ]
                },
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor
                }
            },
            bottomFrozenStyle: {
                borderColor,
                fontSize: headerFontSize,
                color: headerFontColor,
                fontFamily,
                borderLineWidth: [
                    1,
                    outlineBorderLineWidth,
                    outlineBorderLineWidth,
                    1
                ],
                bgColor: headerBackgroundColor,
                hover: {
                    cellBgColor: hoverHeaderBackgroundColor
                }
            },
            selectionStyle: {
                cellBgColor: '',
                cellBorderColor: ''
            },
            frameStyle: {
                borderColor,
                cornerRadius: frameCornerRadius,
                borderLineWidth: outlineBorderLineWidth
            },
            axisStyle: {
                leftAxisStyle: {
                    cellPaddingLeft: 10
                },
                bottomAxisStyle: {
                    cellPaddingBottom: 4
                },
                rightAxisStyle: {
                    cellPaddingRight: 4
                }
            },
            scrollStyle: {
                visible: 'scrolling',
                hoverOn: false
            }
        }
    };
};
export { pivotGridStyle };

//# sourceMappingURL=pivotGridStyle.js.map