"use client";
import { jsx as i } from "react/jsx-runtime";
import { $isTableSelection as m } from "../../../../node_modules/@lexical/table/LexicalTable.prod.js";
import { FORMAT_TEXT_COMMAND as l, $isRangeSelection as n } from "../../../../node_modules/lexical/Lexical.prod.js";
import { useState as d } from "react";
import { useToolbarContext as c } from "../../context/toolbar-context.js";
import { useUpdateToolbarHandler as p } from "../../editor-hooks/use-update-toolbar.js";
import { Toggle as f } from "../../../ui/toggle.js";
import u from "../../../../node_modules/lucide-react/dist/esm/icons/code.js";
import T from "../../../../node_modules/lucide-react/dist/esm/icons/strikethrough.js";
import h from "../../../../node_modules/lucide-react/dist/esm/icons/underline.js";
import b from "../../../../node_modules/lucide-react/dist/esm/icons/italic.js";
import g from "../../../../node_modules/lucide-react/dist/esm/icons/bold.js";
const C = {
  bold: g,
  italic: b,
  underline: h,
  strikethrough: T,
  code: u
};
function R({
  format: r
}) {
  const { activeEditor: a } = c(), [e, t] = d(!1);
  p((o) => {
    (n(o) || m(o)) && "hasFormat" in o && t(o.hasFormat(r));
  });
  const s = C[r];
  return /* @__PURE__ */ i(
    f,
    {
      "aria-label": "Toggle bold",
      variant: "outline",
      size: "sm",
      defaultPressed: e,
      pressed: e,
      onPressedChange: t,
      onClick: () => {
        a.dispatchCommand(
          l,
          r
        );
      },
      children: /* @__PURE__ */ i(s, { className: "h-4 w-4" })
    }
  );
}
export {
  R as FontFormatToolbarPlugin
};
