import { j as f } from "../../node_modules/react/jsx-runtime.mjs";
import { useRef as c, useEffect as n } from "react";
import d from "./config.mjs";
const p = ({ id: e, value: s, height: i = 500, onBlur: r }) => {
  const o = c(null);
  return n(() => {
    if (!e)
      return;
    const t = UE == null ? void 0 : UE.getEditor(e, d);
    return o.current = t, t.ready(() => {
      t.addListener("blur", () => {
        r == null || r(t.getContent());
      });
    }), () => {
      t.destroy();
    };
  }, [e]), n(() => {
    const t = o.current;
    t.ready(() => {
      t.setContent(s || "");
    });
  }, [s, o.current]), f.jsx("div", { id: e, style: { width: "100%", height: i } });
};
export {
  p as default
};
