/**
 * Class MarkdownSerializerDynamicModifier
 *
 * Provides a mechanism for dynamic modification of node serialization during conversion of ProseMirror nodes
 * to a markdown-like format. It allows sequential processing of nodes by applying a series of custom handlers:
 *
 *    - `processNode`: An array of handlers that process nodes sequentially, each modifying the output.
 *
 * Example:
 * ```ts
 * const serializerModifier = new MarkdownSerializerDynamicModifier({
 *     paragraph: {
 *         processNode: [
 *             (state, node, parent, index, callback) => {
 *                 // Custom modifications can be performed here.
 *                 callback(state, node, parent, index);
 *             },
 *         ],
 *     },
 * });
 * ```
 *
 * This class extends the functionality of a MarkdownSerializer for scenarios such as:
 * - Customizing the serialization output.
 * - Logging or modifying node content during serialization.
 */
/** @internal */
export class MarkdownSerializerDynamicModifier {
    nodeProcessors;
    constructor(config) {
        this.nodeProcessors = new Map(Object.entries(config));
    }
    processNode(state, node, parent, index, callback) {
        const nodeType = this.nodeProcessors.get(node.type.name);
        if (!nodeType || !nodeType.processNode || nodeType.processNode.length === 0) {
            callback(state, node, parent, index);
        }
        else {
            nodeType.processNode.forEach((process) => {
                process(state, node, parent, index, callback);
            });
        }
    }
}
//# sourceMappingURL=MarkdownSerializerDynamicModifier.js.map
