"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSpecsById = getSpecsById;
exports.getAxesSpecForSpecId = getAxesSpecForSpecId;
exports.getSpecDomainGroupId = getSpecDomainGroupId;
const specs_1 = require("../../../../specs");
const axis_utils_1 = require("../../utils/axis_utils");
function getSpecsById(specs, id) {
    return specs.find((spec) => spec.id === id);
}
function getAxesSpecForSpecId(axesSpecs, groupId, chartRotation) {
    return axesSpecs.reduce((result, spec) => {
        if (spec.groupId === groupId && (0, axis_utils_1.isXDomain)(spec.position, chartRotation))
            result.xAxis = spec;
        else if (spec.groupId === groupId && !(0, axis_utils_1.isXDomain)(spec.position, chartRotation))
            result.yAxis = spec;
        return result;
    }, {});
}
function getSpecDomainGroupId(spec) {
    if (!spec.useDefaultGroupDomain) {
        return spec.groupId;
    }
    return typeof spec.useDefaultGroupDomain === 'boolean' ? specs_1.DEFAULT_GLOBAL_ID : spec.useDefaultGroupDomain;
}
//# sourceMappingURL=spec.js.map