"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.componentClassFromSpecId = componentClassFromSpecId;
const f_1 = require("../system/f/object/Merge/f");
const object_1 = require("../util/object");
const componentClassFromSpec_1 = require("./componentClassFromSpec");
const id_1 = require("./id");
const spec_1 = require("./spec");
function componentClassFromSpecId(components, specs, id, memory, subComponentMap = {}, element = undefined) {
    var _a;
    var _b;
    const spec = (0, spec_1.getSpec)(specs, id);
    if ((0, id_1.isBaseSpec)(spec)) {
        const Class = components[id];
        const props = (0, object_1.mapObjVK)((_a = memory === null || memory === void 0 ? void 0 : memory.input) !== null && _a !== void 0 ? _a : {}, ({ _register }) => {
            return _register;
        });
        return _b = class NewClass extends Class {
                constructor($props, $system) {
                    super((0, f_1.default)(props, $props), $system, element);
                }
            },
            _b.id = id,
            _b;
    }
    else {
        return (0, componentClassFromSpec_1.componentClassFromSpec)(spec, specs, subComponentMap, memory);
    }
}
//# sourceMappingURL=componentClassFromSpecId.js.map