"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addComponent = void 0;
const utils_1 = require("../utils");
/**
 * add component
 * @param component component detail
 * @returns new node
 */
const addComponent = (component, opt) => {
    const node = (0, utils_1.initNode)(component);
    const nodeComponent = opt.componentMap[node.name] || {};
    // if use style editor ,will wrapper a styleContainer
    if (nodeComponent.useStyleEditor) {
        return (0, utils_1.initStyleWrapper)(node, opt.componentMap);
    }
    return node;
};
exports.addComponent = addComponent;
