import { foldMeasures } from "./foldMeasures.js";
import { FoldMeasureId, FoldMeasureName, FoldMeasureValue, Separator } from "./constant.js";
import { unfoldDimensions } from "./unfoldDimensions.js";
import { createFormatterByDimension } from "../pipeline/utils/index.js";
const dataReshapeByEncoding = (dataset, dimensions, measures, encoding, options)=>{
    const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, colorItemAsId = false, colorMeasureId, locale, omitIds } = options || {};
    const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, {
        measureId: foldMeasureId,
        measureName: foldMeasureName,
        measureValue: foldMeasureValue,
        colorMeasureId,
        omitIds
    });
    const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dimensions, encoding, {
        foldMeasureId,
        separator: Separator,
        colorItemAsId,
        formatDimensionValue: (dimension, value)=>{
            const formatter = createFormatterByDimension(dimension, locale);
            return formatter(value);
        }
    });
    return {
        dataset: finalDataset,
        foldInfo,
        unfoldInfo
    };
};
export { dataReshapeByEncoding };

//# sourceMappingURL=dataReshapeByEncoding.js.map