import { j as i } from "../../node_modules/react/jsx-runtime.mjs";
import { useRef as c, useEffect as n } from "react";
import u from "./config.mjs";
const p = ({ id: e, value: s, height: f = 500, onBlur: r }) => {
  const o = c(null);
  return n(() => {
    if (!e)
      return;
    const t = UE == null ? void 0 : UE.getEditor(e, u);
    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]), /* @__PURE__ */ i.jsx("div", { id: e, style: { width: "100%", height: f } });
};
export {
  p as default
};
