declare class Tokenizer {
    protected tokens: string;
    /**
     * This is set to the next token to be read.
     */
    index: number;
    size: number;
    get ended(): boolean;
    constructor(tokens: string);
    /**
     * Reads characters until one of the passed characters (not included).
     * @param chars The list of characters to search for.
     * @returns The string between the current index and the found character or the end of tokens.
     */
    untilChar(...chars: string[]): string;
    /**
     * Reads the next token and changes the state.
     * @returns The next token.
     */
    next(): string | undefined;
    /**
     * Reads the next character without changing the state.
     */
    getNext(): string | undefined;
}
declare enum PartType {
    /**
     * Literal string, we do not process these
     */
    literal = 0,
    /**
     * URI template expression
     */
    template = 1,
    /**
     * query parameter
     */
    param = 2
}
declare enum DataType {
    nil = 0,
    string = 1,
    object = 2,
    array = 3
}
/**
 * The operator definition for a template expression
 */
interface IOperator {
    /**
     * The value of the operator for the variable.
     * Can be one of `+`, `#`, `.`, `/`, `;`, `?`, or `&`,
     * THere are additional reserved characters for future use: `=`, `,`, `!`, `@` and `|`.
     *
     * This is not set when the expression has no operator.
     */
    operator?: string;
    prefix?: string;
    separator: string;
    named?: boolean;
    reserved?: boolean;
    emptyNameSeparator?: boolean;
}
/**
 * Variable definition of a template expression
 */
interface IVariable {
    /**
     * The variable name, cleaned of any operators
     */
    name: string;
    /**
     * Whether the variable "explode" values as described in the spec.
     */
    explode: boolean;
    /**
     * The value length to insert. For expressions like `{var:20}`
     */
    maxLength?: number;
}
export interface IUrlPart {
    type: PartType;
    expression: string;
}
/**
 * A part that defines a query parameter.
 */
export interface IUrlParamPart extends IUrlPart {
    /**
     * The name of the query parameter.
     */
    name: string;
    /**
     * The name value of the query parameter.
     */
    value: string;
    /**
     * Whether the parameter should be considered when creating the URL.
     */
    enabled: boolean;
}
/**
 * A part that defines a template expression
 */
export interface IUrlExpressionPart extends IUrlPart {
    operator: IOperator;
    variables: IVariable[];
}
interface IData {
    /**
     * type of data 0: undefined/null, 1: string, 2: object, 3: array
     */
    type: DataType;
    /**
     * The read values, except undefined/null.
     * The value is always set. Name is set when the read value is an object.
     */
    values: {
        value: string;
        name?: string;
    }[];
}
export interface IUrlExpandOptions {
    /**
     * When set it ignores replacing the value in the template when the variable is missing.
     */
    ignoreMissing?: boolean;
    /**
     * When set it throws errors when missing variables.
     */
    strict?: boolean;
}
export type UrlPart = IUrlPart | IUrlParamPart | IUrlExpressionPart;
export declare class UrlSearchParams {
    /**
     * A reference to the URL processor's parts.
     */
    protected parts: UrlPart[];
    constructor(parts: UrlPart[]);
    /**
     * Iterates over each query parameter, in order.
     */
    [Symbol.iterator](): Generator<IUrlParamPart>;
    /**
     * Reads parts, in order, that are query parameters.
     */
    list(): IUrlParamPart[];
    /**
     * Adds a new query parameter to the list.
     *
     * @param name The name of the parameter.
     * @param value The value of the parameter.
     * @param enabled Whether her parameter is enabled.
     */
    append(name: string, value?: string, enabled?: boolean): number;
    /**
     * Replaces the param part in the parts list.
     *
     * @param index The index of the parameter as returned by the `getParameters()` method.
     * @param param The param to set.
     */
    update(index: number, param: IUrlParamPart): void;
    /**
     * Replaces all parameters with the name with the passed value.
     * It insets the param at the first occurrence of the current param in the parts list.
     * If not exists, it adds it as a last.
     *
     * @param name The name of the parameter
     * @param value the value of the parameter
     * @param enabled Whether her parameter is enabled.
     */
    set(name: string, value: string, enabled?: boolean): number;
    /**
     * @param name The name of the parameter to search for.
     * @returns The reference to the parameter.
     */
    get(name: string): IUrlParamPart | undefined;
    /**
     * Removes a query parameter from the parameters list.
     *
     * @param index The index of the parameter as returned by the `getParameters()` method.
     */
    delete(index: number): void;
    /**
     * Toggles the enabled state of the parameter.
     *
     * @param index The index of the parameter as returned by the `getParameters()` method.
     * @param enabled The enabled state of the parameter.
     */
    toggle(index: number, enabled: boolean): void;
    /**
     * Removes all query parameters.
     */
    clear(): void;
    /**
     * Transforms the parameters to a key-value pair separated by a comma,
     * ech in a new line.
     *
     * For example `a=b&c=d` is translated to:
     * ```
     * a: b
     * c: d
     * ```
     * Disabled parameters have `#` sign at the beginning of the line.
     */
    toParamsString(): string;
    /**
     * The opposite of `toParamsString()`. Takes the input string
     * and creates a new list of query parameters from it.
     */
    fromParamsString(value: string): void;
    private processLine;
}
/**
 * A class that parses a string a treats it as a value that may include
 * URI templates and request parameters.
 *
 * It can be used by the UI libraries to manipulate the URL templates and query parameters.
 */
export declare class UrlProcessor {
    /**
     * The source expression.
     * It is immutable for the entire manipulation process of the URI.
     * Any modification is on the parts level and the `expand()` and `toString()`
     * function only rely on the `parts`.
     */
    expression: string;
    /**
     * The tokenizer object
     */
    tokens: Tokenizer;
    /**
     * An ordered list of parts of the expression.
     */
    parts: UrlPart[];
    /**
     * A helper class to manipulate query parameters on the parser.
     */
    search: UrlSearchParams;
    constructor(expression: string);
    /**
     * Creates an URI leaving the template expressions are they are (without expanding them).
     */
    toString(): string;
    /**
     * Creates a URI with expanded template values.
     *
     * @param map The variables to evaluate.
     * @param opts Processing options.
     */
    expand(map: Record<string, unknown>, opts?: IUrlExpandOptions): string;
    protected _expandExpression(part: IUrlExpressionPart, map: Record<string, unknown>, opts: IUrlExpandOptions): string;
    protected _expandNamedExpression(data: IData, operator: IOperator, variable: IVariable): string;
    protected _expandUnNamedExpression(data: IData, operator: IOperator, variable: IVariable): string;
    protected _getData(map: Record<string, unknown>, name: string): IData;
    protected _validExpansionValue(value: unknown): boolean;
    /**
     * Creates an ordered list of parts that describe the passed expression.
     *
     * FIXME: Handle error states like unclosed brackets.
     */
    protected _parse(): void;
    /**
     * Adds a literal part.
     * Literal parts are not processed in any way. They do not contain query parameters
     * or template expressions.
     *
     * @param expression The literal expression.
     */
    protected _addLiteral(expression: string): void;
    /**
     * Adds a part that describes a query parameter
     * @param expression The query param as `name=value` or `name` or `name=`
     */
    protected _addParam(expression: string): void;
    /**
     * Adds a part that is a template expression.
     *
     * @param expression The template expression as defined in RFC 6570
     */
    protected _addTemplate(expression: string): void;
    protected _readVariables(expression: string, operator?: string): IVariable[];
}
export {};
//# sourceMappingURL=UrlProcessor.d.ts.map