"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.sanitizeFaqHtml = sanitizeFaqHtml; const sanitize_html_1 = __importDefault(require("sanitize-html")); const FAQ_ALLOWED_TAGS = [ 'p', 'br', 'strong', 'b', 'em', 'i', 'u', 'ul', 'ol', 'li', 'a', 'img', 'video', 'iframe', 'h2', 'h3', 'blockquote', ]; const FAQ_ALLOWED_ATTRIBUTES = { a: ['href', 'title', 'target', 'rel'], img: ['src', 'alt', 'title'], video: ['src', 'controls'], iframe: ['src', 'allowfullscreen', 'title'], }; /** Sanitizes staff-authored FAQ HTML before persistence or display. */ function sanitizeFaqHtml(html) { return (0, sanitize_html_1.default)(html, { allowedTags: FAQ_ALLOWED_TAGS, allowedAttributes: FAQ_ALLOWED_ATTRIBUTES, allowedSchemes: ['http', 'https', 'mailto'], allowedSchemesByTag: { iframe: ['http', 'https'], img: ['http', 'https'], video: ['http', 'https'], }, transformTags: { a: sanitize_html_1.default.simpleTransform('a', { rel: 'noopener noreferrer', target: '_blank' }), }, }); } //# sourceMappingURL=sanitizeHtml.js.map