const deckBase = (import.meta as ImportMeta & { env: { BASE_URL: string } }).env.BASE_URL export function resolveImageSource(source: string | undefined, base = deckBase) { if (!source || isAbsoluteSource(source)) return source const normalizedBase = base.endsWith('/') ? base : `${base}/` return `${normalizedBase}${source.replace(/^\.\//, '')}` } function isAbsoluteSource(source: string) { return source.startsWith('/') || source.startsWith('#') || /^[a-z][a-z\d+.-]*:/i.test(source) }