"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditableUtilities = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const ElementFactory_1 = require("./ElementFactory");
const ObserveState_1 = require("./StateManagement/ObserveState");
class EditableUtilities {
    static getEditor(target) {
        if (target?.renderEditUI) {
            return new ElementFactory_1.ElementFactory(target?.renderEditUI.bind(target), {});
        }
        return new ElementFactory_1.ElementFactory(this.renderEmpty.bind(target), {});
        // return new ElementFactory(
        //
        //     this.getRenderEditUIComponent.bind(target,target), {});
    }
    static renderEmpty() {
        return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
    }
    // adds observer
    static getRenderEditUIComponent(target) {
        if (target) {
            let renderUI = target.renderEditUI();
            if (renderUI) {
                return ((0, jsx_runtime_1.jsx)(ObserveState_1.ObserveState, { listenTo: target, control: () => {
                        return renderUI;
                    } }));
            }
        }
        return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
    }
}
exports.EditableUtilities = EditableUtilities;
//# sourceMappingURL=IEditable.js.map