import type { TypeChange, TypeSelection } from './rg_filetypes.ts';
/**
 * Normalized rg options, mirrored by Python's RgFlags.
 *
 * parseFlags resolves mutually overriding options in command-line order.
 * maxDepth counts children at depth 1. null terminates filenames;
 * nullData selects NUL-delimited records. typeChanges preserves add/clear
 * order; typeSelections pairs each type name with an exclusion bit.
 */
export interface RgFlags {
    ignoreCase: boolean;
    smartCase: boolean;
    invert: boolean;
    wholeWord: boolean;
    lineRegexp: boolean;
    fixedString: boolean;
    lineNumbers: boolean;
    column: boolean;
    vimgrep: boolean;
    byteOffsets: boolean;
    onlyMatching: boolean;
    replace: string | null;
    trim: boolean;
    maxColumns: number | null;
    maxColumnsPreview: boolean;
    null: boolean;
    nullData: boolean;
    crlf?: boolean;
    multiline?: boolean;
    multilineDotall?: boolean;
    stats?: boolean;
    json?: boolean;
    searchZip?: boolean;
    pre?: string | null;
    preGlobs?: readonly string[];
    pathSeparator: string | null;
    quiet: boolean;
    countOnly: boolean;
    countMatches: boolean;
    includeZero: boolean;
    filesOnly: boolean;
    filesWithoutMatch: boolean;
    listFiles: boolean;
    typeList: boolean;
    withFilename: boolean;
    noFilename: boolean;
    heading: boolean;
    passthru: boolean;
    maxCount: number | null;
    stopOnNonmatch: boolean;
    contextAfter: number;
    contextBefore: number;
    contextSeparator: string | null;
    fieldMatchSeparator: string;
    fieldContextSeparator: string;
    globs: readonly string[];
    iglobs: readonly string[];
    globCaseInsensitive: boolean;
    typeChanges: readonly TypeChange[];
    typeSelections: readonly TypeSelection[];
    hidden: boolean;
    maxDepth: number | null;
    maxFilesize: number | null;
    follow: boolean;
    oneFileSystem: boolean;
    binary: boolean;
    sort: string | null;
    sortReverse: boolean;
    noMessages: boolean;
    engine: string;
    unicode: boolean;
    threads: number | null;
    text: boolean;
    encoding?: string;
    regexSizeLimit?: number | null;
    dfaSizeLimit?: number | null;
}
/**
 * Whether the output shows -A/-B/-C context, which also puts the context
 * separator between one file's lines and the next file's. Only printed
 * lines carry it: -c, -l and --files-without-match answer per file. -o
 * keeps it, each line printed as its matches. --passthru prints every line
 * but never separates groups.
 */
export declare function printsContext(f: RgFlags): boolean;
/**
 * Whether -S searches `pattern` without regard to case: it has at least one
 * literal character and none of them is uppercase. `fixedString` is -F,
 * where every character is a literal.
 */
export declare function smartCaseFolds(pattern: string, fixedString: boolean): boolean;
/**
 * What one haystack's search selected, beside what it printed: `binary` when
 * a binary-file notice stood in for the lines, `skipped` when a walked
 * binary file went unsearched, which no listing names but
 * --files-without-match's status counts.
 */
export declare function foldsCase(pattern: string, fixed: boolean, f: RgFlags): boolean;
export interface Tally {
    selected: boolean;
    binary?: boolean;
    skipped?: boolean;
    matches?: number;
    matchedLines?: number;
    searched?: number;
    nul?: number | null;
    error?: string;
}
/** What --stats and the --json summary add up over the haystacks. */
export declare class Totals {
    matches: number;
    matchedLines: number;
    withMatch: number;
    searched: number;
    printed: number;
    bytesSearched: number;
    elapsed: number;
    /** Add another run's totals: a line split over mounts prints one footer for all its runs. */
    merge(other: Totals): void;
    /** Count one haystack: its tally, the bytes printed for it, its seconds. */
    add(tally: Tally, printed: number, elapsed: number): void;
}
/**
 * One run's output with the footer it ends with cut off, and the totals that
 * footer printed, read back the way the wc and du combiners read their total
 * rows; the output whole and null when it ends in none. `summary` reads
 * --json's summary record, not the --stats block. Mirrors Python's
 * `split_footer`.
 */
export declare function splitFooter(data: Uint8Array, summary: boolean): [Uint8Array, Totals | null];
/** What ends a line rg writes itself: NUL under --null-data, CR LF under --crlf. */
export declare function recordEnd(f: RgFlags): string;
//# sourceMappingURL=rg_search.d.ts.map