/**
* Placeholder utilities for AI rewrite flows.
*
* Both the RTE (Tiptap/HTML) and Feed (Slate/markdown) paths need to protect
* certain tokens — links, images, user mentions — before sending text to the
* AI, and restore them afterwards. This file provides both sets of helpers.
*
* ## RTE (HTML) — `extractLinkAndImg` / `restorePlaceholders`
* Replaces `` and `` elements with `[PEGA-IMG-XXXX]` / `[PEGA-LINK-XXXX]`
* placeholders using DOMParser. Reduces payload size and prevents the AI from
* stripping or mangling anchor/image tags. Images wrapped in an anchor are
* captured as a single LINK placeholder so the full `
` structure
* is stored intact.
*
* ## Feed (markdown) — `extractMentions` / `restoreMentionPlaceholders`
* Replaces `
` elements in the HTML with unique
* placeholders. Uses DOMParser to reliably locate elements rather than regex.
* Anchors are processed first so that linked images (`
`) are
* captured as a single LINK placeholder.
*/
export declare function extractLinkAndImg(html: string): ExtractResult;
/**
* Restores placeholders in the rewritten HTML with the original HTML elements.
* Placeholders that were dropped by the AI are appended at the end, each
* wrapped in a `
` tag (TipTap's default block element).
* Any hallucinated placeholder strings (not in the map) are stripped.
*/
export declare function restorePlaceholders(html: string, placeholderMap: PlaceholderMap, userPlaceholders?: string[]): string;
interface ExtractMentionsResult {
cleanText: string;
mentionMap: PlaceholderMap;
userPlaceholders: string[];
}
/**
* Extracts all `