"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.getHierarchyOffset = void 0;

const vutils_1 = require("@visactor/vutils");

function getHierarchyOffset(col, row, table) {
    var _a, _b, _c;
    let cellHierarchyIndent = 0;
    const layoutMap = table.internalProps.layoutMap;
    if (layoutMap.isHeader(col, row)) {
        const hd = layoutMap.getHeader(col, row);
        (0, vutils_1.isValid)(null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_a = hd.hierarchyLevel) && void 0 !== _a ? _a : 0) * (null !== (_b = layoutMap.rowHierarchyIndent) && void 0 !== _b ? _b : 0));
    } else {
        const define = table.getBodyColumnDefine(col, row);
        if (null == define ? void 0 : define.tree) {
            const indexArr = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row));
            cellHierarchyIndent = Array.isArray(indexArr) && "none" !== table.getHierarchyState(col, row) ? (indexArr.length - 1) * (null !== (_c = layoutMap.hierarchyIndent) && void 0 !== _c ? _c : 0) : 0;
        }
    }
    return cellHierarchyIndent;
}

exports.getHierarchyOffset = getHierarchyOffset;
//# sourceMappingURL=indent.js.map
