import { ImageResponse } from "next/og"; export const alt = "HiveGrid – Software für SHK-Betriebe"; export const size = { width: 1200, height: 630 }; export const contentType = "image/png"; async function loadGoogleFont(family: string, weight: number, text: string) { const url = `https://fonts.googleapis.com/css2?family=${family.replace(/ /g, "+")}:wght@${weight}&text=${encodeURIComponent(text)}`; const css = await fetch(url, { headers: { "User-Agent": "Mozilla/5.0" }, }).then((r) => r.text()); const match = css.match(/src: url\((.+?)\) format\('(?:opentype|truetype|woff2?)'\)/); if (!match) throw new Error(`Font ${family} ${weight} not found in CSS response`); return fetch(match[1]).then((r) => r.arrayBuffer()); } export default async function Image() { const headlineText = "Ihr Betrieb läuft organisiert, automatisiert und effizient. HiveGrid SHK-SOFTWARE Von Auftragsannahme bis Rechnungsstellung. Alles in einer Plattform. hivegrid.de"; const [interBold, interRegular] = await Promise.all([ loadGoogleFont("Inter", 700, headlineText), loadGoogleFont("Inter", 400, headlineText), ]); return new ImageResponse( (