/**
 * This module has one goal (and is to be rewritten soon to achieve that goal,
 * as the file itself is way too long). See {@link reconstructToCode}.
 * @module
 */
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
import { type AutoSelectPredicate } from './auto-select/auto-select-defaults';
import type { InlineWarning } from './inline/source-inline-map';
/**
 * Whether to inline every file into a single self-contained text: `true` inlines them, `'banner'` additionally
 * precedes each with a banner comment naming it.
 * @see {@link Selection#inlineFull}
 */
export type InlineFull = boolean | 'banner';
interface Selection {
    /**
     * The set of node ids to be reconstructed.
     */
    nodes: ReadonlySet<NodeId>;
    /**
     * @see {@link ReconstructRequiredInput#reconstructFiles}
     */
    reconstructFiles?: 'all' | number[];
    /**
     * If set, selected `source()` calls are replaced by the (spliced) reconstruction of the sourced file,
     * producing a single self-contained reconstruction (`code` will be a `string` for the main file, index 0).
     * Requires {@link Selection#sourceMap} to be provided. Overrides {@link Selection#reconstructFiles}.
     * @see {@link SourceInlineMap.build}
     */
    inlineSources?: boolean;
    /**
     * If set, every file is reconstructed into a single self-contained text, in the loading order flowR
     * determined (which respects implicit sources), independent of whether it is sourced explicitly. Files that
     * _are_ sourced explicitly are spliced into their `source()` call instead of being repeated at the top level.
     * Pass `'banner'` to precede every inlined file with a banner comment naming it.
     * Requires {@link Selection#sourceMap} to be provided. Overrides {@link Selection#inlineSources} and
     * {@link Selection#reconstructFiles}.
     */
    inlineFull?: InlineFull;
    /**
     * Maps a `source()` call node id to the index of the sourced file in `ast.ast.files`.
     * Only used together with {@link Selection#inlineSources} or {@link Selection#inlineFull}. Build it via {@link SourceInlineMap.build}.
     */
    sourceMap?: ReadonlyMap<NodeId, number>;
}
export declare const reconstructLogger: import("tslog").Logger<import("tslog").ILogObj>;
export interface ReconstructionResult {
    /** Returns the reconstructed code as string or array of code reconstructions (corresponding to the desired file indices in the {@link Selection}) */
    code: string | string[];
    /** number of lines that contain nodes that triggered the `autoSelectIf` predicate {@link reconstructToCode} */
    linesWithAutoSelected: number;
    /** warnings raised while inlining `source()` calls (only set when {@link Selection#inlineSources} is active) */
    inlineWarnings?: InlineWarning[];
    /**
     * The reconstructed files, in loading order, each with the path it came from (absent for inline code).
     * `code` holds the same parts, joined into one string when only a single file was reconstructed.
     * Not set by the inlinings, whose whole purpose is to produce one self-contained text.
     */
    files?: readonly {
        path: string | undefined;
        code: string;
    }[];
}
export declare function reconstructToCode(ast: NormalizedAst, selection: Selection & ({
    inlineSources: true;
} | {
    inlineFull: true;
} | {
    reconstructFiles?: [number] | undefined;
}), autoSelectIf?: AutoSelectPredicate): ReconstructionResult & {
    code: string;
};
export declare function reconstructToCode(ast: NormalizedAst, selection: Selection, autoSelectIf?: AutoSelectPredicate): ReconstructionResult;
export {};
