/** * Escape HTML special characters * * Converts special characters to their HTML entity equivalents * to prevent XSS attacks and ensure proper HTML rendering. * * @param text - The text to escape * @returns Escaped HTML string * * @example * ```ts * htmlspecialchars('') * // Returns: '<script>alert("xss")</script>' * ``` */ export declare function htmlspecialchars(text: string): string; /** * Inverte entidades HTML de volta para caracteres normais * * Converte entidades HTML de volta para seus caracteres originais, * fazendo o processo inverso de htmlspecialchars. * * @param text - O texto com entidades HTML a ser convertido * @returns String com caracteres normais * * @example * ```ts * inverter('<script>alert("xss")</script>') * // Returns: '' * ``` */ export declare function inverter(text: string): string; /** * Escape a value for use in HTML attributes * * Handles strings, numbers, and objects (which are JSON stringified). * * @param subject - The value to escape * @returns Escaped string safe for HTML attributes * * @example * ```ts * escapeStringForHtml('Hello "World"') * // Returns: 'Hello "World"' * * escapeStringForHtml({ name: 'John' }) * // Returns: '{"name":"John"}' * ``` */ export declare function escapeStringForHtml(subject: any): string; /** * Convert an object of attributes to an HTML attributes string * * Takes an object of key-value pairs and converts them to a string * suitable for insertion into an HTML tag. * * @param attributes - Object with attribute names as keys and values * @returns Formatted HTML attributes string * * @example * ```ts * stringifyHtmlAttributes({ class: 'btn', id: 'submit' }) * // Returns: 'class="btn" id="submit"' * ``` */ export declare function stringifyHtmlAttributes(attributes: { [key: string]: any; }): string; /** * Insert attributes into the root HTML element * * Finds the first HTML tag in a string and inserts the provided attributes * into that tag. Useful for adding data attributes or other properties * to component root elements. * * @param html - The HTML string to modify * @param attributes - Attributes to insert into the root tag * @returns Modified HTML string with attributes inserted * @throws Error if no HTML tag is found * * @example * ```ts * insertAttributesIntoHtmlRoot('
Content
', { 'data-id': '123' }) * // Returns: '
Content
' * ``` */ export declare function insertAttributesIntoHtmlRoot(html: string, attributes: { [key: string]: string; }): string;