import { d as BlockAttributeHandler, T as Transformer } from '../ast-types-U4BC1m-E.js'; export { B as BlockMergerConfig, b as blockMerger } from '../block-merger-D5SME1EO.js'; /** * Default block attribute handlers for standard Quill delta attributes. * * Each handler maps a Quill attribute name to an AST block type * and any attributes to carry over to the node. */ declare const DEFAULT_BLOCK_ATTRIBUTES: Record; /** * Default mark nesting priorities. * Higher value = wraps outer (applied first in nesting order). * * The element mark order matches quill-delta-to-html: * bold(outer) > italic > strike > underline > code(inner) * * Example with priorities: link(100) > color(40) > bold(30) * Result: `text` */ declare const DEFAULT_MARK_PRIORITIES: Record; /** * Wraps adjacent `code-block` nodes into a `code-block-container` parent. * * Quill stores each code line as a separate block with a `code-block` attribute. * This transformer groups consecutive code-block nodes into a single * `code-block-container` node, mirroring Quill's editor DOM structure: * * ```html *
*
line 1
*
line 2
*
* ``` * * @example * ```ts * const ast = new DeltaParser(delta).use(codeBlockGrouper).toAST(); * ``` */ declare const codeBlockGrouper: Transformer; /** * Groups adjacent `list-item` nodes into a flat `list` container, * matching Quill's editor DOM structure. * * Unlike `listGrouper`, this transformer does NOT nest sub-lists. * All consecutive list items (regardless of type or indent) are placed * as flat siblings inside a single `
    `. Visual nesting is handled * by `ql-indent-*` CSS classes. * * This matches Quill's actual `root.innerHTML` structure: * ```html *
      *
    1. Parent
    2. *
    3. Child
    4. *
    * ``` * * @example * ```ts * const ast = new DeltaParser(delta).use(flatListGrouper).toAST(); * ``` */ declare const flatListGrouper: Transformer; /** * Groups adjacent `list-item` nodes into `list` container nodes * and nests them correctly based on indentation levels. * * Ported from quill-delta-to-html's ListNester. * * Quill stores list items as flat blocks with `list` and optional `indent` attributes. * This transformer: * 1. Groups consecutive same-type, same-indent list items into flat list containers * 2. Merges consecutive list groups into sections * 3. Nests higher-indent groups under their parent items * 4. Merges consecutive root-level lists of the same type * * @example * ```ts * const ast = new DeltaParser(delta).use(listGrouper).toAST(); * ``` */ declare const listGrouper: Transformer; /** * Wraps adjacent table-cell nodes into proper table > row > cell structure. * * Ported from quill-delta-to-html's TableGrouper. * * Quill stores table cells as flat blocks with a `table` attribute * whose value is the row identifier (e.g. `'row-1'`). * This transformer: * 1. Detects consecutive `table-cell` nodes in root.children * 2. Groups cells sharing the same row id into `table-row` containers * 3. Wraps all rows in a `table` container node * * @example * ```ts * const ast = new DeltaParser(delta).use(tableGrouper).toAST(); * ``` */ declare const tableGrouper: Transformer; /** * Validates a CSS color value. * * Accepts hex colors (`#fff`, `#ffffff`), named colors (`red`, `transparent`), * and CSS color functions (`rgb(...)`, `rgba(...)`, `hsl(...)`, `hsla(...)`). */ declare function isValidColor(value: unknown): boolean; /** * Validates a CSS color literal (named color only, no hex or functions). * Used specifically for `allowBackgroundClasses` — only named colors * should be used as CSS class names. */ declare function isValidColorLiteral(value: unknown): boolean; /** * Validates a CSS font-family value. * Allows letters, spaces, hyphens, and commas. */ declare function isValidFontFamily(value: unknown): boolean; /** * Validates a CSS size value. * Accepts common size keywords (small, large, huge, etc.) * and numeric values with units (px, em, rem, %, pt). */ declare function isValidSize(value: unknown): boolean; /** * Validates a CSS width value. * Accepts numeric values with units (px, em, rem, %, auto). */ declare function isValidWidth(value: unknown): boolean; /** * Groups consecutive elements in an array that satisfy a predicate. * * Returns a new array where consecutive elements matching the predicate * are collected into sub-arrays, and non-matching elements are left as-is. * * Ported from quill-delta-to-html's `groupConsecutiveElementsWhile`. * * @example * ```ts * groupConsecutiveElementsWhile( * [1, 'a', 'b', 2, 'c'], * (curr, prev) => typeof curr === typeof prev * ); * // => [1, ['a', 'b'], 2, 'c'] * ``` */ declare function groupConsecutiveElementsWhile(arr: T[], predicate: (curr: T, prev: T) => boolean): Array; /** * Sanitized mention data structure. */ interface SanitizedMention { name: string; target?: string; slug?: string; class?: string; 'end-point'?: string; } /** * Sanitizes mention data from a Quill delta. * * Ensures all fields are strings and strips unexpected properties. * This is opt-in — call it before passing mention data to the renderer * if you want strict validation. * * @example * ```ts * const safe = sanitizeMention(rawMentionData); * if (safe) { * // use safe.name, safe.slug, etc. * } * ``` */ declare function sanitizeMention(data: unknown): SanitizedMention | null; /** * URL sanitizer config. */ interface UrlSanitizerConfig { /** Additional protocols to allow beyond the defaults. */ extraProtocols?: string[]; /** Replace the default protocol whitelist entirely. */ protocols?: string[]; } /** * Creates a URL sanitizer function. * * The sanitizer checks the URL against a protocol whitelist. * Relative URLs (starting with `/`, `#`, or no protocol) are always allowed. * Returns `undefined` for unsafe URLs, or the original URL if safe. * * This is opt-in — not required by any renderer, but can be passed * as the `urlSanitizer` config option to `SemanticHtmlRenderer`. * * @example * ```ts * const sanitize = createUrlSanitizer(); * sanitize('https://example.com'); // 'https://example.com' * sanitize('javascript:alert(1)'); // undefined * ``` * * @example * ```ts * const renderer = new SemanticHtmlRenderer({ * urlSanitizer: createUrlSanitizer(), * }); * ``` */ declare function createUrlSanitizer(config?: UrlSanitizerConfig): (url: string) => string | undefined; export { DEFAULT_BLOCK_ATTRIBUTES, DEFAULT_MARK_PRIORITIES, type SanitizedMention, type UrlSanitizerConfig, codeBlockGrouper, createUrlSanitizer, flatListGrouper, groupConsecutiveElementsWhile, isValidColor, isValidColorLiteral, isValidFontFamily, isValidSize, isValidWidth, listGrouper, sanitizeMention, tableGrouper };