import type { Match } from 'linkify-it';
import type MarkdownIt from 'markdown-it';
import type Token from 'markdown-it/lib/token';
import { Mark, type Node, type NodeType, type Schema } from 'prosemirror-model';
import { type Logger2 } from "../../logger.js";
import type { Parser, ParserToken } from "../types/parser.js";
import { type TransformFn } from "./ProseMirrorTransformer/index.js";
export type TokenAttrs = {
    [name: string]: unknown;
};
type MarkdownParserOptions = {
    logger: Logger2.ILogger;
    pmTransformers: TransformFn[];
    dynamicModifier?: MarkdownParserDynamicModifier;
};
export declare class MarkdownParser implements Parser {
    schema: Schema;
    stack: Array<{
        type: NodeType;
        attrs?: TokenAttrs;
        content: Array<Node>;
    }>;
    marks: readonly Mark[];
    tokens: Record<string, ParserToken>;
    tokenizer: MarkdownIt;
    pmTransformers: TransformFn[];
    dynamicModifier: MarkdownParserDynamicModifier | null;
    private logger;
    constructor(schema: Schema, tokenizer: MarkdownIt, tokens: Record<string, ParserToken>, opts: MarkdownParserOptions);
    validateLink(url: string): boolean;
    normalizeLink(url: string): string;
    normalizeLinkText(url: string): string;
    matchLinks(text: string): Readonly<Match>[] | null;
    parse(src: string): Node;
    parse(tokens: Token[]): Node;
    private top;
    private push;
    private getTokenAttrs;
    private getTokenSpec;
    private getTokenType;
    private handlePrimitiveToken;
    private handleMark;
    private getNodeSchema;
    private handleNode;
    private handleBlock;
    private handleToken;
    private addNode;
    private openNode;
    private closeNode;
    private addText;
    private openMark;
    private closeMark;
    private parseTokens;
}
export type ProcessToken = (token: Token, index: number, rawMarkup: string | null, allowedAttrs?: string[]) => Token;
export type ProcessNodeAttrs = (token: Token, attrs: TokenAttrs, allowedAttrs?: string[]) => TokenAttrs;
export type ProcessNode = (node: Node) => Node;
export interface ElementProcessor {
    processToken?: ProcessToken[];
    processNodeAttrs?: ProcessNodeAttrs[];
    processNode?: ProcessNode[];
}
export interface MarkdownParserDynamicModifierConfig {
    [elementType: string]: ElementProcessor;
}
/**
 * Class MarkdownParserDynamicModifier
 *
 * Provides a mechanism for dynamic modification of tokens and node attributes during parsing by a MarkdownParser.
 * It allows sequential processing of element types by applying a series of custom handlers:
 *
 *    - `processToken`: An array of handlers that process tokens sequentially, each passing the result to the next.
 *
 *    - `processNodeAttrs`: An array of handlers that modify and process node attributes.
 *
 *    - `processNode`: An array of handlers that process and modify the resulting ProseMirror nodes.
 *
 * Example:
 * ```ts
 * const dynamicModifier = new MarkdownParserDynamicModifier({
 *     paragraph: {
 *         processToken: [
 *             (token, index, rawMarkup, allowedAttrs) => {
 *                 token.attrSet('data-prefix', 'prefix-value');
 *                 return token;
 *             },
 *             (token) => {
 *                 console.log(`Processing token: ${token.type}`);
 *                 return token;
 *             },
 *         ],
 *         processNodeAttrs: [
 *             (token, attrs) => {
 *                 attrs['data-paragraph'] = token.attrGet('data-prefix');
 *                 return attrs;
 *             },
 *             (token, attrs) => {
 *                 console.log(`Processing attrs for token: ${token.type}`);
 *                 return attrs;
 *             },
 *         ],
 *         processNode: [
 *             (node) => {
 *                 console.log(`Processing node: ${node.type}`);
 *                 return node;
 *             },
 *         ],
 *     },
 * });
 * ```
 *
 * This class extends the functionality of a MarkdownParser for scenarios such as:
 * - Adding default attributes to specific elements.
 * - Modifying token metadata.
 * - Logging or customizing processing steps for debugging.
 */
export declare class MarkdownParserDynamicModifier {
    private elementProcessors;
    constructor(config: MarkdownParserDynamicModifierConfig);
    processTokens(tokens: Token[], rawMarkup: string | null): Token[];
    processAttrs(token: Token, attrs: TokenAttrs): TokenAttrs;
    processNodes(node: Node): Node;
}
export {};
