import { FoldYMeasureId } from "../../../../../dataReshape/constant.js";
const pivotRowDimensions = (spec, context)=>{
    const result = {
        ...spec
    };
    const { advancedVSeed } = context;
    const dimensions = advancedVSeed.dimensions;
    const measures = advancedVSeed.measures ?? [];
    if (!dimensions) return result;
    const rowDimensions = dimensions.filter((dim)=>'row' === dim.encoding);
    const rows = rowDimensions.map((dim)=>{
        const baseConfig = {
            dimensionKey: dim.id,
            title: dim.alias ?? dim.id
        };
        if (dim.id === FoldYMeasureId) baseConfig.headerFormat = (title)=>{
            const measure = measures.find((m)=>m.id === title);
            return measure ? measure.alias ?? measure.id : title;
        };
        return baseConfig;
    });
    return {
        ...result,
        rows: rows
    };
};
export { pivotRowDimensions };

//# sourceMappingURL=pivotRowDimensions.js.map