import { __exports as r } from "./index-LexicalOnChangePlugin.dev2.js";
import { __require as _ } from "./index-LexicalComposerContext2.js";
import x from "react";
var f;
function O() {
  if (f) return r;
  f = 1;
  var a = _(), n = x, s = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? n.useLayoutEffect : n.useEffect;
  function c({
    ignoreHistoryMergeTagChange: u = !0,
    ignoreSelectionChange: i = !1,
    onChange: e
  }) {
    const [t] = a.useLexicalComposerContext();
    return s(() => {
      if (e)
        return t.registerUpdateListener(({
          editorState: d,
          dirtyElements: l,
          dirtyLeaves: m,
          prevEditorState: p,
          tags: o
        }) => {
          i && l.size === 0 && m.size === 0 || u && o.has("history-merge") || p.isEmpty() || e(d, t, o);
        });
    }, [t, u, i, e]), null;
  }
  return r.OnChangePlugin = c, r;
}
export {
  O as __require
};
