"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var typography_example_exports = {};
__export(typography_example_exports, {
  default: () => PreviewTypography
});
module.exports = __toCommonJS(typography_example_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_element = require("@wordpress/element");
var import_components = require("@wordpress/components");
var import_i18n = require("@wordpress/i18n");
var import_block_editor = require("@wordpress/block-editor");
var import_editor = require("@wordpress/editor");
var import_lock_unlock = require("../../lock-unlock");
var import_preview_styles = require("./font-library-modal/utils/preview-styles");
var import_utils = require("./utils");
const { useGlobalStyle, GlobalStylesContext } = (0, import_lock_unlock.unlock)(
  import_block_editor.privateApis
);
const { mergeBaseAndUserConfigs } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
function PreviewTypography({ fontSize, variation }) {
  const { base } = (0, import_element.useContext)(GlobalStylesContext);
  let config = base;
  if (variation) {
    config = mergeBaseAndUserConfigs(base, variation);
  }
  const [textColor] = useGlobalStyle("color.text");
  const [bodyFontFamilies, headingFontFamilies] = (0, import_utils.getFontFamilies)(config);
  const bodyPreviewStyle = bodyFontFamilies ? (0, import_preview_styles.getFamilyPreviewStyle)(bodyFontFamilies) : {};
  const headingPreviewStyle = headingFontFamilies ? (0, import_preview_styles.getFamilyPreviewStyle)(headingFontFamilies) : {};
  if (textColor) {
    bodyPreviewStyle.color = textColor;
    headingPreviewStyle.color = textColor;
  }
  if (fontSize) {
    bodyPreviewStyle.fontSize = fontSize;
    headingPreviewStyle.fontSize = fontSize;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
    import_components.__unstableMotion.div,
    {
      animate: {
        scale: 1,
        opacity: 1
      },
      initial: {
        scale: 0.1,
        opacity: 0
      },
      transition: {
        delay: 0.3,
        type: "tween"
      },
      style: {
        textAlign: "center",
        lineHeight: 1
      },
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: headingPreviewStyle, children: (0, import_i18n._x)("A", "Uppercase letter A") }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: bodyPreviewStyle, children: (0, import_i18n._x)("a", "Lowercase letter A") })
      ]
    }
  );
}
//# sourceMappingURL=typography-example.js.map
