/**
 * @license
 * Copyright 2022-2026 Greg Lauckhart <greg@lauckhart.com>
 * SPDX-License-Identifier: Apache-2.0
 */
import { Producer } from "./producer.js";
import { SgrCategory } from "./sgr.js";
import { Token } from "./token.js";
/**
 * An immutable representation of an ANSI CSI SGR sequence, also known as the "American National Standards Institute
 * Control Sequence Introducer Select Graphic Rendition".
 *
 * Implemented largely from https://en.wikipedia.org/wiki/ANSI_escape_code
 *
 * Provides high level logic for parsing and manipulating styling.
 */
export interface Style extends Producer {
    /**
     * The current definition, either {@link codes} or {@link text}.
     */
    get styleDefinition(): Style.Definition;
    set styleDefinition(definition: Style.InputDefinition | Style | undefined);
    /**
     * The list of codes in this style.
     */
    styleCodes: (string | number)[];
    /**
     * The style as a style token.
     */
    styleToken: Token;
    /**
     * A style that disables this style.
     */
    undoStyle: Style;
    /**
     * Create the ANSI escape sequence for this style.
     */
    toString(): string;
    /**
     * Create a new style by adding additional style information.
     */
    addStyle<T extends Style>(this: T, style: Style.InputDefinition | Style): T;
    /**
     * Create a style that transitions from this style to another.
     */
    diffStyle<T extends Style>(this: T, other: Style): T;
    /**
     * Execute a function against each code in this style's sequence.
     */
    evaluateStyle(processor: (category: SgrCategory, code: number | string) => void): void;
    /**
     * The factory used to create this style.
     */
    factory: Style.Factory;
}
export declare function Style(definition?: Style.InputDefinition): Style;
export declare namespace Style {
    type Factory = (definition?: Definition | Style, derivesFrom?: Style) => Style;
    type Definition = undefined | string | (string | number)[];
    type InputDefinition = Definition | {
        styleDefinition: Definition;
    };
    function opcodeOf(code: number | string): number | undefined;
    function codesOf(definition?: string): (number | string)[];
    function textOf(definition?: string): string | undefined;
    function definitionOf(definition: InputDefinition): Definition;
}
export declare namespace Style {
    var prototype: {
        get styleDefinition(): Style.Definition;
        set styleDefinition(definition: Style.InputDefinition);
        readonly styleCodes: (string | number)[];
        readonly styleToken: Token;
        readonly undoStyle: Style;
        toString(): string;
        addStyle<T extends Style>(this: T, codes: Style.InputDefinition): T;
        diffStyle<T extends Style>(this: T, other: Style): T;
        evaluateStyle(processor: (category: SgrCategory, code: number | string) => void): void;
        readonly factory: typeof Style;
        [Symbol.iterator](): ArrayIterator<{
            kind: "style";
            style: Style;
        }>;
    };
}
export declare namespace Style {
    var Inherit: Style;
}
export declare namespace Style {
    var None: Style;
}
//# sourceMappingURL=style.d.ts.map