/** * URL safety utilities for external hyperlinks/media in untrusted PPTX content. */ const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'mailto:']); /** * Returns true only for absolute URLs with an allowed protocol. */ export function isAllowedExternalUrl(url: string): boolean { try { const parsed = new URL(url); return ALLOWED_PROTOCOLS.has(parsed.protocol.toLowerCase()); } catch { return false; } }