//#region src/ansi/tokenize.d.ts /** An ANSI code paired with the code that ends its effect. */ type AnsiCode = { readonly code: string; readonly endCode: string; }; type AnsiToken = AnsiCode & { readonly type: "ansi"; }; type ControlToken = { readonly type: "control"; readonly code: string; }; type CharToken = { readonly type: "char"; readonly value: string; readonly fullWidth: boolean; }; type Token = AnsiToken | ControlToken | CharToken; type StyledChar = CharToken & { readonly styles: AnsiCode[]; }; declare const endCodesSet: Set; declare function getLinkStartCode(url: string, params?: Record): string; declare function getEndCode(code: string): string; declare function ansiCodesToString(codes: readonly AnsiCode[]): string; /** Check if a code is an intensity code (bold or dim) — these share the end code `22m` but can coexist. */ declare function isIntensityCode(code: AnsiCode): boolean; declare function tokenize(string: string, endChar?: number): Token[]; /** Reduces the given array of ANSI codes to the minimum necessary to render with the same style. */ declare function reduceAnsiCodes(codes: readonly AnsiCode[]): AnsiCode[]; /** Like {@link reduceAnsiCodes}, but assumes that `codes` is already reduced. Further reductions are only done for the items in `newCodes`. */ declare function reduceAnsiCodesIncremental(codes: readonly AnsiCode[], newCodes: readonly AnsiCode[]): AnsiCode[]; /** Returns the combination of ANSI codes needed to undo the given ANSI codes. */ declare function undoAnsiCodes(codes: readonly AnsiCode[]): AnsiCode[]; /** Returns the minimum amount of ANSI codes necessary to get from the compound style `from` to `to`. Both are expected to be reduced. */ declare function diffAnsiCodes(from: readonly AnsiCode[], to: readonly AnsiCode[]): AnsiCode[]; declare function styledCharsFromTokens(tokens: readonly Token[]): StyledChar[]; declare function styledCharsToString(chars: readonly StyledChar[]): string; //#endregion export { tokenize as _, StyledChar as a, diffAnsiCodes as c, getLinkStartCode as d, isIntensityCode as f, styledCharsToString as g, styledCharsFromTokens as h, ControlToken as i, endCodesSet as l, reduceAnsiCodesIncremental as m, AnsiToken as n, Token as o, reduceAnsiCodes as p, CharToken as r, ansiCodesToString as s, AnsiCode as t, getEndCode as u, undoAnsiCodes as v };