"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var preview_styles_exports = {};
__export(preview_styles_exports, {
  default: () => preview_styles_default
});
module.exports = __toCommonJS(preview_styles_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_block_editor = require("@wordpress/block-editor");
var import_components = require("@wordpress/components");
var import_lock_unlock = require("../../lock-unlock");
var import_hooks = require("./hooks");
var import_typography_example = __toESM(require("./typography-example"));
var import_highlighted_colors = __toESM(require("./highlighted-colors"));
var import_preview_wrapper = __toESM(require("./preview-wrapper"));
const { useGlobalStyle } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
const firstFrameVariants = {
  start: {
    scale: 1,
    opacity: 1
  },
  hover: {
    scale: 0,
    opacity: 0
  }
};
const midFrameVariants = {
  hover: {
    opacity: 1
  },
  start: {
    opacity: 0.5
  }
};
const secondFrameVariants = {
  hover: {
    scale: 1,
    opacity: 1
  },
  start: {
    scale: 0,
    opacity: 0
  }
};
const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => {
  const [fontWeight] = useGlobalStyle("typography.fontWeight");
  const [fontFamily = "serif"] = useGlobalStyle("typography.fontFamily");
  const [headingFontFamily = fontFamily] = useGlobalStyle(
    "elements.h1.typography.fontFamily"
  );
  const [headingFontWeight = fontWeight] = useGlobalStyle(
    "elements.h1.typography.fontWeight"
  );
  const [textColor = "black"] = useGlobalStyle("color.text");
  const [headingColor = textColor] = useGlobalStyle(
    "elements.h1.color.text"
  );
  const { paletteColors } = (0, import_hooks.useStylesPreviewColors)();
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
    import_preview_wrapper.default,
    {
      label,
      isFocused,
      withHoverView,
      children: [
        ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__unstableMotion.div,
          {
            variants: firstFrameVariants,
            style: {
              height: "100%",
              overflow: "hidden"
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
              import_components.__experimentalHStack,
              {
                spacing: 10 * ratio,
                justify: "center",
                style: {
                  height: "100%",
                  overflow: "hidden"
                },
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                    import_typography_example.default,
                    {
                      fontSize: 65 * ratio,
                      variation
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                    import_highlighted_colors.default,
                    {
                      normalizedColorSwatchSize: 32,
                      ratio
                    }
                  ) })
                ]
              }
            )
          },
          key
        ),
        ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__unstableMotion.div,
          {
            variants: withHoverView && midFrameVariants,
            style: {
              height: "100%",
              width: "100%",
              position: "absolute",
              top: 0,
              overflow: "hidden",
              filter: "blur(60px)",
              opacity: 0.1
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_components.__experimentalHStack,
              {
                spacing: 0,
                justify: "flex-start",
                style: {
                  height: "100%",
                  overflow: "hidden"
                },
                children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                  "div",
                  {
                    style: {
                      height: "100%",
                      background: color,
                      flexGrow: 1
                    }
                  },
                  index
                ))
              }
            )
          },
          key
        ),
        ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__unstableMotion.div,
          {
            variants: secondFrameVariants,
            style: {
              height: "100%",
              width: "100%",
              overflow: "hidden",
              position: "absolute",
              top: 0
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_components.__experimentalVStack,
              {
                spacing: 3 * ratio,
                justify: "center",
                style: {
                  height: "100%",
                  overflow: "hidden",
                  padding: 10 * ratio,
                  boxSizing: "border-box"
                },
                children: label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                  "div",
                  {
                    style: {
                      fontSize: 40 * ratio,
                      fontFamily: headingFontFamily,
                      color: headingColor,
                      fontWeight: headingFontWeight,
                      lineHeight: "1em",
                      textAlign: "center"
                    },
                    children: label
                  }
                )
              }
            )
          },
          key
        )
      ]
    }
  );
};
var preview_styles_default = PreviewStyles;
//# sourceMappingURL=preview-styles.js.map
