import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { ElementFactory } from "./ElementFactory";
import { ObserveState } from "./StateManagement/ObserveState";
export class EditableUtilities {
    static getEditor(target) {
        if (target === null || target === void 0 ? void 0 : target.renderEditUI) {
            return new ElementFactory(target === null || target === void 0 ? void 0 : target.renderEditUI.bind(target), {});
        }
        return new ElementFactory(this.renderEmpty.bind(target), {});
        // return new ElementFactory(
        //
        //     this.getRenderEditUIComponent.bind(target,target), {});
    }
    static renderEmpty() {
        return _jsx(_Fragment, {}, void 0);
    }
    // adds observer
    static getRenderEditUIComponent(target) {
        if (target) {
            let renderUI = target.renderEditUI();
            if (renderUI) {
                return (_jsx(ObserveState, { listenTo: target, control: () => { return renderUI; } }, void 0));
            }
        }
        return _jsx(_Fragment, {}, void 0);
    }
}
//# sourceMappingURL=IEditable.js.map