{"version":3,"file":"metadata.mjs","names":[],"sources":["../../src/ui/metadata.ts"],"sourcesContent":["export const SOCIAL_IMAGE_WIDTH = 1200;\nexport const SOCIAL_IMAGE_HEIGHT = 630;\n\nexport interface SocialImageMetaOptions {\n  imageUrl: string;\n  title: string;\n  description: string;\n  siteName?: string;\n  siteUrl?: string;\n  type?: string;\n  alt?: string;\n  width?: number;\n  height?: number;\n  mimeType?: string;\n}\n\nexport function getSocialImageMeta(options: SocialImageMetaOptions) {\n  const {\n    imageUrl,\n    title,\n    description,\n    siteName,\n    siteUrl,\n    type = \"website\",\n    alt,\n    width = SOCIAL_IMAGE_WIDTH,\n    height = SOCIAL_IMAGE_HEIGHT,\n    mimeType = \"image/png\",\n  } = options;\n\n  return [\n    { property: \"og:title\", content: title },\n    { property: \"og:description\", content: description },\n    { property: \"og:type\", content: type },\n    { property: \"og:image\", content: imageUrl },\n    { property: \"og:image:type\", content: mimeType },\n    { property: \"og:image:width\", content: String(width) },\n    { property: \"og:image:height\", content: String(height) },\n    ...(alt ? [{ property: \"og:image:alt\", content: alt }] : []),\n    ...(siteName ? [{ property: \"og:site_name\", content: siteName }] : []),\n    ...(siteUrl ? [{ property: \"og:url\", content: siteUrl }] : []),\n    { name: \"twitter:card\", content: \"summary_large_image\" },\n    { name: \"twitter:title\", content: title },\n    { name: \"twitter:description\", content: description },\n    { name: \"twitter:image\", content: imageUrl },\n    ...(alt ? [{ name: \"twitter:image:alt\", content: alt }] : []),\n  ];\n}\n\nexport interface DotIconSvgOptions {\n  size?: number;\n  color?: string;\n  radius?: number;\n  background?: string;\n}\n\nexport function createDotIconSvg(options: DotIconSvgOptions = {}) {\n  const {\n    size = 64,\n    color = \"#111111\",\n    radius = size * 0.34,\n    background = \"transparent\",\n  } = options;\n  const center = size / 2;\n\n  return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"0 0 ${size} ${size}\">\n  <rect width=\"${size}\" height=\"${size}\" fill=\"${background}\" />\n  <circle cx=\"${center}\" cy=\"${center}\" r=\"${radius}\" fill=\"${color}\" />\n</svg>`;\n}\n\nexport function createPngIcoBuffer(png: Uint8Array, width: number, height: number) {\n  const header = new Uint8Array(22);\n  const view = new DataView(header.buffer);\n\n  view.setUint16(0, 0, true);\n  view.setUint16(2, 1, true);\n  view.setUint16(4, 1, true);\n\n  header[6] = width >= 256 ? 0 : width;\n  header[7] = height >= 256 ? 0 : height;\n  header[8] = 0;\n  header[9] = 0;\n\n  view.setUint16(10, 1, true);\n  view.setUint16(12, 32, true);\n  view.setUint32(14, png.byteLength, true);\n  view.setUint32(18, 22, true);\n\n  const ico = new Uint8Array(22 + png.byteLength);\n  ico.set(header, 0);\n  ico.set(png, 22);\n  return ico;\n}\n"],"mappings":";AAAA,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;AAenC,SAAgB,mBAAmB,SAAiC;CAClE,MAAM,EACJ,UACA,OACA,aACA,UACA,SACA,OAAO,WACP,KACA,QAAQ,oBACR,cACA,WAAW,gBACT;AAEJ,QAAO;EACL;GAAE,UAAU;GAAY,SAAS;GAAO;EACxC;GAAE,UAAU;GAAkB,SAAS;GAAa;EACpD;GAAE,UAAU;GAAW,SAAS;GAAM;EACtC;GAAE,UAAU;GAAY,SAAS;GAAU;EAC3C;GAAE,UAAU;GAAiB,SAAS;GAAU;EAChD;GAAE,UAAU;GAAkB,SAAS,OAAO,MAAM;GAAE;EACtD;GAAE,UAAU;GAAmB,SAAS,OAAO,OAAO;GAAE;EACxD,GAAI,MAAM,CAAC;GAAE,UAAU;GAAgB,SAAS;GAAK,CAAC,GAAG,EAAE;EAC3D,GAAI,WAAW,CAAC;GAAE,UAAU;GAAgB,SAAS;GAAU,CAAC,GAAG,EAAE;EACrE,GAAI,UAAU,CAAC;GAAE,UAAU;GAAU,SAAS;GAAS,CAAC,GAAG,EAAE;EAC7D;GAAE,MAAM;GAAgB,SAAS;GAAuB;EACxD;GA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