{"version":3,"sources":["open-graph.ts"],"sourcesContent":["import { convertToWebPath } from \"../app/convert-to-web-path.ts\";\n\nexport const OPEN_GRAPH = Symbol(\"OPEN_GRAPH\");\n\nexport interface OpenGraphData {\n\ttitle: string,\n\tdescription?: string\n}\n\n/**\n * Can be implemented to generate a custom preview image\n */\nexport interface OpenGraphPreviewImageGenerator {\n\tgetImageURL(data: OpenGraphData): Promise<string|URL>|string|URL\n}\n\n/**\n * Constructed with OpenGraphData and an preview image generator\n * Has a getMetaTags() function that returns a string of HTML meta tags (title, description, image)\n */\nexport class OpenGraphInformation {\n\n\tconstructor(public data: OpenGraphData, private image_generator?:OpenGraphPreviewImageGenerator) {}\n\n\t#meta_tags?:string\n\n\tasync getMetaTags() {\n\t\tif (!this.#meta_tags) {\n\t\t\tconst image_url = this.image_generator ? convertToWebPath(await this.image_generator.getImageURL(this.data)) : null;\n\t\t\tthis.#meta_tags = `\n<title>${this.data.title}</title>\n${this.data.description?`<meta name=\"description\" content=\"${this.data.description}\">`:''}\n<meta property=\"og:title\" content=\"${this.data.title}\">\n${this.data.description?`<meta property=\"og:description\" content=\"${this.data.description}\">`:''}\n${image_url?`<meta property=\"og:image\" content=\"${image_url}\">`:''}\n\n<meta name=\"twitter:card\" content=\"summary_large_image\">\n<meta name=\"twitter:title\" content=\"${this.data.title}\">\n${this.data.description?`<meta name=\"twitter:description\" content=\"${this.data.description}\">`:''}\n${image_url?`<meta name=\"twitter:image\" content=\"${image_url}\">`:''}`\n\t\t}\n\t\t\n\t\treturn this.#meta_tags;\n\t}\n}"],"names":["convertToWebPath","OPEN_GRAPH","Symbol","OpenGraphInformation","constructor","data","image_generator","getMetaTags","image_url","getImageURL","title","description"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gCAAgC;AAEjE,OAAO,MAAMC,aAAaC,OAAO,cAAc;AAkB/C,OAAO,MAAMC;;;IAEZC,YAAY,AAAOC,IAAmB,EAAE,AAAQC,eAA+C,CAAE;aAA9ED,OAAAA,WAA6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