import { __exports as r } from "./index-useBlockFormat2.js";
import { __require as N } from "./index-LexicalCode2.js";
import { __require as S } from "./index-LexicalList2.js";
import { __require as T } from "./index-LexicalRichText2.js";
import { __require as k } from "./index-LexicalSelection.js";
import { __require as R } from "./index-Lexical.js";
var h;
function H() {
  if (h) return r;
  h = 1, Object.defineProperty(r, "__esModule", { value: !0 }), r.useBlockFormat = void 0;
  const d = N(), c = S(), l = T(), n = k(), i = R(), u = {
    bullet: "Bulleted List",
    check: "Check List",
    code: "Code Block",
    h1: "Heading 1",
    h2: "Heading 2",
    h3: "Heading 3",
    h4: "Heading 4",
    h5: "Heading 5",
    h6: "Heading 6",
    number: "Numbered List",
    paragraph: "Normal",
    quote: "Quote"
  }, m = (p) => {
    const { blockType: t, editor: o } = p, _ = () => {
      o.update(() => {
        const e = (0, i.$getSelection)();
        ((0, i.$isRangeSelection)(e) || (0, i.DEPRECATED_$isGridSelection)(e)) && (0, n.$setBlocksType)(e, () => (0, i.$createParagraphNode)());
      });
    }, a = (e) => {
      t !== e && o.update(() => {
        const s = (0, i.$getSelection)();
        ((0, i.$isRangeSelection)(s) || (0, i.DEPRECATED_$isGridSelection)(s)) && (0, n.$setBlocksType)(s, () => (0, l.$createHeadingNode)(e));
      });
    }, f = () => {
      t !== "bullet" ? o.dispatchCommand(c.INSERT_UNORDERED_LIST_COMMAND, void 0) : o.dispatchCommand(c.REMOVE_LIST_COMMAND, void 0);
    }, C = () => {
      t !== "check" ? o.dispatchCommand(c.INSERT_CHECK_LIST_COMMAND, void 0) : o.dispatchCommand(c.REMOVE_LIST_COMMAND, void 0);
    }, g = () => {
      t !== "number" ? o.dispatchCommand(c.INSERT_ORDERED_LIST_COMMAND, void 0) : o.dispatchCommand(c.REMOVE_LIST_COMMAND, void 0);
    }, E = () => {
      t !== "quote" && o.update(() => {
        const e = (0, i.$getSelection)();
        ((0, i.$isRangeSelection)(e) || (0, i.DEPRECATED_$isGridSelection)(e)) && (0, n.$setBlocksType)(e, () => (0, l.$createQuoteNode)());
      });
    }, L = () => {
      t !== "code" && o.update(() => {
        let e = (0, i.$getSelection)();
        if ((0, i.$isRangeSelection)(e) || (0, i.DEPRECATED_$isGridSelection)(e))
          if (e.isCollapsed())
            (0, n.$setBlocksType)(e, () => (0, d.$createCodeNode)());
          else {
            const s = e.getTextContent(), $ = (0, d.$createCodeNode)();
            e.insertNodes([$]), e = (0, i.$getSelection)(), (0, i.$isRangeSelection)(e) && e.insertRawText(s);
          }
      });
    };
    return {
      label: u[t],
      paragraph: {
        title: "Normal",
        active: t === "paragraph",
        dispatch: () => _()
      },
      h1: {
        title: "Heading 1",
        active: t === "h1",
        dispatch: () => a("h1")
      },
      h2: {
        title: "Heading 2",
        active: t === "h2",
        dispatch: () => a("h2")
      },
      h3: {
        title: "Heading 3",
        active: t === "h3",
        dispatch: () => a("h3")
      },
      h4: {
        title: "Heading 4",
        active: t === "h4",
        dispatch: () => a("h4")
      },
      h5: {
        title: "Heading 5",
        active: t === "h5",
        dispatch: () => a("h5")
      },
      h6: {
        title: "Heading 6",
        active: t === "h6",
        dispatch: () => a("h6")
      },
      bulletList: {
        title: "Bullet List",
        active: t === "bullet",
        dispatch: () => f()
      },
      checkList: {
        title: "Check List",
        active: t === "check",
        dispatch: () => C()
      },
      numberList: {
        title: "Numbered List",
        active: t === "number",
        dispatch: () => g()
      },
      quote: {
        title: "Quote",
        active: t === "quote",
        dispatch: () => E()
      },
      code: {
        title: "Code Block",
        active: t === "code",
        dispatch: () => L()
      }
    };
  };
  return r.useBlockFormat = m, r;
}
export {
  H as __require
};
