import { __exports as i } from "./index-LexicalHorizontalRuleNode.prod2.js";
import { __require as L } from "./index-LexicalComposerContext2.js";
import { __require as x } from "./index-useLexicalNodeSelection.js";
import { __require as E } from "./index-LexicalUtils.js";
import { __require as y } from "./index-Lexical.js";
import D from "react";
var d;
function h() {
  if (d) return i;
  d = 1;
  var N = L(), p = x(), f = E(), e = y(), l = D;
  let O = e.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");
  function C({ nodeKey: t }) {
    let [o] = N.useLexicalComposerContext(), [n, m, _] = p.useLexicalNodeSelection(t), s = l.useCallback((r) => (n && e.$isNodeSelection(e.$getSelection()) && (r.preventDefault(), r = e.$getNodeByKey(t), c(r) && r.remove()), !1), [n, t]);
    return l.useEffect(() => f.mergeRegister(o.registerCommand(e.CLICK_COMMAND, (r) => {
      let M = o.getElementByKey(t);
      return r.target === M ? (r.shiftKey || _(), m(!n), !0) : !1;
    }, e.COMMAND_PRIORITY_LOW), o.registerCommand(e.KEY_DELETE_COMMAND, s, e.COMMAND_PRIORITY_LOW), o.registerCommand(
      e.KEY_BACKSPACE_COMMAND,
      s,
      e.COMMAND_PRIORITY_LOW
    )), [_, o, n, t, s, m]), l.useEffect(() => {
      let r = o.getElementByKey(t);
      r !== null && (r.className = n ? "selected" : "");
    }, [o, n, t]), null;
  }
  class a extends e.DecoratorNode {
    static getType() {
      return "horizontalrule";
    }
    static clone(o) {
      return new a(o.__key);
    }
    static importJSON() {
      return u();
    }
    static importDOM() {
      return { hr: () => ({ conversion: R, priority: 0 }) };
    }
    exportJSON() {
      return { type: "horizontalrule", version: 1 };
    }
    exportDOM() {
      return { element: document.createElement("hr") };
    }
    createDOM() {
      return document.createElement("hr");
    }
    getTextContent() {
      return `
`;
    }
    isInline() {
      return !1;
    }
    updateDOM() {
      return !1;
    }
    decorate() {
      return l.createElement(C, { nodeKey: this.__key });
    }
  }
  function R() {
    return { node: u() };
  }
  function u() {
    return e.$applyNodeReplacement(new a());
  }
  function c(t) {
    return t instanceof a;
  }
  return i.$createHorizontalRuleNode = u, i.$isHorizontalRuleNode = c, i.HorizontalRuleNode = a, i.INSERT_HORIZONTAL_RULE_COMMAND = O, i;
}
export {
  h as __require
};
