"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getComponentSubComponentParentId = exports.getSubComponentParentId = void 0;
function getSubComponentParentId(spec, unitId) {
    return getComponentSubComponentParentId(spec.component, unitId);
}
exports.getSubComponentParentId = getSubComponentParentId;
function getComponentSubComponentParentId(componentSpec, unitId) {
    const { subComponents } = componentSpec;
    for (const subComponentId in subComponents) {
        const subComponent = subComponents[subComponentId];
        const { children = [] } = subComponent;
        for (const childId of children) {
            if (childId === unitId) {
                return subComponentId;
            }
        }
    }
    return null;
}
exports.getComponentSubComponentParentId = getComponentSubComponentParentId;
//# sourceMappingURL=component.js.map