import { tempstream } from "tempstream"; import type { Readable } from "stream"; import type { Context } from "koa"; import type { HTMLOptions } from "@sealcode/sealgen"; import { htmlEscape } from "escape-goat"; export const start_timestamp = Date.now(); export function defaultHead({ ctx, title, htmlOptions, metaImage, canonicalPath, css_clumps = [], description = "", }: { ctx: Context; title: string | Promise; htmlOptions: Partial; metaImage?: string; canonicalPath?: string; css_clumps: string[]; description: string; }): JSX.Element | Readable { const origin = ctx.URL.origin; return tempstream /* HTML */ `${title} ${ctx.$app.getFeedHTMLMetatags(ctx)} ${metaImage ? `` : ""} ${[ "default", "page", ...(ctx.url.includes("/dowodzenie/") ? ["admin"] : []), ...css_clumps, ].map( (clump_name) => /* HTML */ `` )} ${canonicalPath ? `` : ""} ${htmlOptions.morphing ? `` : ""} ${htmlOptions.preserveScroll ? `` : ""} `; }