import { useMemo } from "react";
import { a as v } from "../../../../sdk/dist/shared/chunk-A3K4NUVP.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import googleFonts from "../utils/fonts.json.js";
import { useTheme } from "../../../../../use-page-data.js";
function getFontLabel(font) {
  if (font.type === "stack") {
    return v.find((f) => f.value === font.family)?.label ?? font.family;
  }
  return font.family;
}
function useFonts(fontType) {
  const ggFonts = useMemo(
    () => googleFonts.map((font) => ({ value: { type: "google", family: font }, label: font })),
    []
  );
  const theme = useTheme();
  const genericFonts = v.map((font) => ({
    value: { type: "stack", family: font.value },
    label: font.label
  }));
  const suggestedFonts = theme.typography.alternatives?.map((font) => ({
    label: getFontLabel(font[fontType]),
    value: font[fontType]
  })) ?? [];
  const allFonts = useMemo(
    () => [
      ...suggestedFonts.length ? [{ group: "Suggested Fonts", options: suggestedFonts }] : [],
      {
        group: "Generic Fonts",
        options: genericFonts
      },
      {
        group: "Google Fonts",
        options: ggFonts
      }
    ],
    [suggestedFonts, genericFonts, ggFonts]
  );
  return allFonts;
}
export {
  getFontLabel,
  useFonts
};
//# sourceMappingURL=use-fonts.js.map
