import { jsx } from "react/jsx-runtime";
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
import { unlock } from "../../lock-unlock";
const {
  useGlobalStyle,
  useGlobalSetting,
  useSettingsForBlockElement,
  TypographyPanel: StylesTypographyPanel
} = unlock(blockEditorPrivateApis);
function TypographyPanel({ element, headingLevel }) {
  let prefixParts = [];
  if (element === "heading") {
    prefixParts = prefixParts.concat(["elements", headingLevel]);
  } else if (element && element !== "text") {
    prefixParts = prefixParts.concat(["elements", element]);
  }
  const prefix = prefixParts.join(".");
  const [style] = useGlobalStyle(prefix, void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = useGlobalStyle(
    prefix,
    void 0,
    "all",
    {
      shouldDecodeEncode: false
    }
  );
  const [rawSettings] = useGlobalSetting("");
  const usedElement = element === "heading" ? headingLevel : element;
  const settings = useSettingsForBlockElement(
    rawSettings,
    void 0,
    usedElement
  );
  return /* @__PURE__ */ jsx(
    StylesTypographyPanel,
    {
      inheritedValue: inheritedStyle,
      value: style,
      onChange: setStyle,
      settings
    }
  );
}
export {
  TypographyPanel as default
};
//# sourceMappingURL=typography-panel.js.map
