/**
 * Types for the client-side rate limiter.
 *
 * The limiter is responsible for:
 *   - **Micro-batching**: collect calls made inside a short window and
 *     flush them as a single list, so a loop doing `add('A'); add('B')`
 *     becomes one network command.
 *   - **Chunking**: split very large flushes into fixed-size chunks and
 *     dispatch them with an interval, to avoid flooding TradingView in
 *     cases where the caller enqueues hundreds of symbols at once.
 *   - **Deduplication**: `add('X')` called twice inside the window
 *     becomes one add. Calling `add('X'); remove('X')` inside the window
 *     cancels out and produces nothing at all.
 */
interface RateLimitOptions {
    /**
     * Collect operations for this many milliseconds before flushing.
     * A shorter window means less batching but lower latency.
     * Default: 50.
     */
    batchWindowMs?: number;
    /**
     * Maximum symbols per dispatched chunk. Flushes larger than this are
     * split across multiple chunks with `chunkIntervalMs` between them.
     * Default: 50.
     */
    chunkSize?: number;
    /**
     * Delay between consecutive chunks within a single flush.
     * Only applies when a flush exceeds `chunkSize` symbols.
     * Default: 100.
     */
    chunkIntervalMs?: number;
}
declare const DEFAULT_RATE_LIMIT: Required<RateLimitOptions>;
declare function resolveRateLimit(opts?: RateLimitOptions): Required<RateLimitOptions>;
interface SymbolBatcherExecutor {
    /** Called with a chunk of symbols to add. */
    add: (symbols: string[]) => void;
    /** Called with a chunk of symbols to remove. */
    remove: (symbols: string[]) => void;
}

/**
 * Exponential backoff with jitter.
 *
 * delay(attempt) = min(initial * factor^(attempt-1), max) + jitter
 *
 * `jitter` is a fraction in [0, 1] applied symmetrically: a value of 0.3
 * means the final delay is the base delay ± up to 30%.
 *
 * The random source can be overridden for deterministic tests.
 */
interface BackoffOptions {
    /** First attempt delay, in milliseconds. Default: 100. */
    initialDelayMs?: number;
    /** Upper bound for any single delay, in milliseconds. Default: 30_000. */
    maxDelayMs?: number;
    /** Multiplier applied to each subsequent attempt. Default: 2. */
    factor?: number;
    /** Jitter fraction in [0, 1]. Default: 0.3. */
    jitter?: number;
}
declare const DEFAULT_BACKOFF: Required<BackoffOptions>;
declare function calculateBackoff(attempt: number, opts?: BackoffOptions, random?: () => number): number;

/**
 * Types for the Transport layer.
 *
 * Transport is deliberately dumb: it speaks raw strings to and from a
 * WebSocket, manages the connection lifecycle, and handles reconnect.
 * It knows nothing about TradingView's framing — that is the Protocol
 * layer's job.
 */

type TransportState = 'idle' | 'connecting' | 'open' | 'reconnecting' | 'closed';
interface CloseInfo {
    code: number;
    reason: string;
    wasClean: boolean;
}
interface ReconnectOptions extends BackoffOptions {
    /** Enable automatic reconnect. Default: `true`. */
    enabled?: boolean;
    /** Maximum reconnect attempts before giving up. Default: 10. */
    maxAttempts?: number;
}
interface TransportOptions {
    /** WebSocket URL (ws:// or wss://). */
    url: string;
    /** Origin header — required by TradingView in Node. Ignored in browsers. */
    origin?: string;
    /** HTTP/SOCKS agent for proxy support. Node only. */
    agent?: unknown;
    /**
     * Extra HTTP headers to send on the upgrade request. Node only —
     * browsers do not allow custom headers on WebSocket handshakes.
     * Used for authentication (`Cookie: sessionid=...`).
     */
    headers?: Record<string, string>;
    /** Reconnect behaviour. Set `enabled: false` to disable. */
    reconnect?: ReconnectOptions;
    /** Abort the transport and disable reconnect when signalled. */
    signal?: AbortSignal;
    /** Called once per successful open (initial and after each reconnect). */
    onOpen?: () => void;
    /** Called on every close, including transient drops that trigger reconnect. */
    onClose?: (info: CloseInfo) => void;
    /** Called for every raw inbound WebSocket message. */
    onMessage?: (raw: string) => void;
    /** Called for WebSocket errors that don't necessarily trigger a close. */
    onError?: (err: Error) => void;
    /** Called when a reconnect is scheduled, before the delay elapses. */
    onReconnect?: (info: {
        attempt: number;
        delayMs: number;
    }) => void;
}

/**
 * Transport — WebSocket lifecycle with reconnect and message buffering.
 *
 * Responsibilities:
 *   - Open / close / destroy the socket
 *   - Buffer outbound messages until connected, then flush
 *   - Reconnect with exponential backoff + jitter on unexpected drops
 *   - Surface raw inbound messages via `onMessage` callback
 *   - Integrate with `AbortSignal` for external cancellation
 *
 * Non-responsibilities:
 *   - TradingView frame encoding/decoding (see `protocol.ts`)
 *   - Session management (see phase 2: `session-manager.ts`)
 *   - Heartbeat handling (composed at the SessionManager layer)
 */

declare class Transport {
    private readonly opts;
    private ws;
    private state;
    private buffer;
    private reconnectAttempt;
    private reconnectTimer;
    private manualClose;
    private readonly onAbort;
    constructor(opts: TransportOptions);
    /** Current transport state. */
    getState(): TransportState;
    /** Number of messages currently held in the outbound buffer. */
    getBufferedCount(): number;
    /**
     * Open the WebSocket connection. Resolves when the socket reaches the
     * `open` state, rejects if the initial handshake fails.
     *
     * Calling `connect()` on an already-open or already-connecting transport
     * is a no-op and resolves immediately.
     */
    connect(): Promise<void>;
    /**
     * Queue a message for sending.
     *
     * If the transport is not currently open, the message is buffered and
     * sent once the connection is established. The buffer has no size limit
     * — the caller is responsible for not flooding it in bad network
     * conditions.
     */
    send(data: string): void;
    /**
     * Gracefully close the current connection. Disables reconnect — use
     * `connect()` again if you want to reopen.
     */
    close(code?: number, reason?: string): Promise<void>;
    /**
     * Forcefully tear down the transport. Cancels any pending reconnect,
     * drops the buffer, and releases event listeners. After `destroy()`
     * the transport cannot be reused.
     */
    destroy(): void;
    /**
     * Pick the right WebSocket implementation for the current runtime.
     *
     *   1. Browser-like (`window` global + `WebSocket` global): use the
     *      native `WebSocket` — `origin`/`headers`/`agent` cannot be set,
     *      they're controlled by the browser.
     *   2. Node-like: dynamically import the `ws` package so that browser
     *      bundlers can tree-shake it away. This gives us `origin`,
     *      `headers`, and `agent` for proxies.
     *   3. Fallback: if `ws` can't be loaded but native `WebSocket` is
     *      present (e.g. Bun, Deno, Cloudflare Workers, Node 22+), use
     *      that — headers simply won't be set.
     */
    private createSocket;
    private flushBuffer;
    private shouldReconnect;
    private scheduleReconnect;
    private clearReconnectTimer;
}

/**
 * OHLCV candle types and timeframe definitions.
 */
/** A single OHLCV bar. All times are UTC epoch seconds. */
interface Candle {
    /** Bar start time, UTC epoch seconds. */
    time: number;
    open: number;
    high: number;
    low: number;
    close: number;
    volume: number;
}
/**
 * TradingView-native timeframe strings — these are the exact values
 * sent on the wire in `create_series`. Minute-based values are the
 * count of minutes ("60" = 1 hour, "240" = 4 hours).
 *
 * Case matters: lower-case `m` is never used raw — see `TimeframeAlias`.
 */
type RawTimeframe = '1' | '3' | '5' | '15' | '30' | '45' | '60' | '120' | '180' | '240' | '360' | '480' | '720' | '1D' | '3D' | '1W' | '1M' | '3M' | '6M' | '12M';
/**
 * Human-friendly timeframe aliases. Case-sensitive:
 *   - lowercase `m` = minute
 *   - uppercase `M` = month (use `RawTimeframe`'s `'1M'` / `'3M'` directly)
 */
type TimeframeAlias = '1m' | '3m' | '5m' | '15m' | '30m' | '45m' | '1h' | '2h' | '3h' | '4h' | '6h' | '8h' | '12h' | '1d' | '3d' | '1w';
/** Any value accepted by the public API. Normalized to `RawTimeframe` before going on the wire. */
type Timeframe = RawTimeframe | TimeframeAlias;
/**
 * Convert any accepted `Timeframe` value to the raw TradingView string
 * that must be sent on the wire.
 *
 * Throws `TvError` if called with a string that isn't a known timeframe.
 * This exists as a runtime guard for values coming from untyped
 * sources (JSON config files, user input, etc.).
 */
declare function normalizeTimeframe(tf: Timeframe | string): RawTimeframe;
/** Runtime list of every valid timeframe alias, useful for docs and validation. */
declare const TIMEFRAME_ALIASES: readonly Timeframe[];

/**
 * Shared types for session-level abstractions.
 *
 * A "session" in TradingView's protocol is a server-side container
 * identified by an ID (e.g. `qs_xyz` for a quote session, `cs_abc` for
 * a chart session). All commands and responses for that container
 * carry the session id as the first parameter.
 */

/**
 * Base contract every session class implements so that `SessionManager`
 * can route inbound messages and drive lifecycle events.
 */
interface Session {
    readonly id: string;
    /**
     * Called by `SessionManager` when a protocol message targets this
     * session. The method name (`method`) and the full `params` array
     * (including the session id at `params[0]`) are passed through as-is.
     */
    handleMessage(method: string, params: unknown[]): void;
    /**
     * Called by `SessionManager` when the underlying transport drops.
     * The session should assume its server-side state is gone and reset
     * any "initial load complete" flags so that a reconnect re-delivers
     * the full snapshot.
     */
    handleDisconnect(): void;
    /**
     * Called by `SessionManager` after the transport has successfully
     * reconnected AND the TradingView hello packet has been received.
     * The session must re-issue the commands needed to restore its
     * server-side state (create session, set fields, add symbols, …).
     */
    replay(): void;
}
/** Event payload emitted when a quote delta arrives for a symbol. */
interface QuoteUpdate {
    /** Full pair name, e.g. `'BINANCE:BTCUSDT'`. */
    symbol: string;
    /** The fields that changed in this specific update. */
    delta: Record<string, unknown>;
    /** The full accumulated state for this symbol after applying the delta. */
    snapshot: Record<string, unknown>;
    /** `true` on the first delta for this symbol in the session. */
    isFirstLoad: boolean;
}
/** Event payload emitted when a per-symbol error is reported. */
interface QuoteErrorInfo {
    symbol: string;
    message: string;
}
/** Event payload when a batch of candles is delivered on a series. */
interface CandlesUpdate {
    seriesId: string;
    symbol: string;
    candles: Candle[];
}
/** Event payload when a single bar ticks (live streaming update). */
interface CandleTick {
    seriesId: string;
    symbol: string;
    candle: Candle;
}

/**
 * Types for the SessionManager — the layer that owns a Transport,
 * handles heartbeat auto-response, routes inbound protocol messages to
 * registered sessions, and orchestrates replay after reconnect.
 */

interface SessionManagerOptions {
    /** WebSocket URL. Defaults to TradingView widget endpoint. */
    url?: string;
    /** Origin header (Node only). Defaults to TradingView origin. */
    origin?: string;
    /** HTTP/SOCKS agent for proxy support (Node only). */
    agent?: unknown;
    /**
     * Extra HTTP headers for the WebSocket handshake (Node only). Pass a
     * `Cookie` header here to carry TradingView session cookies.
     */
    headers?: Record<string, string>;
    /**
     * Auth token to send via `set_auth_token` after the server hello.
     * Defaults to `"unauthorized_user_token"` for public access.
     */
    authToken?: string;
    /**
     * Locale to advertise to TradingView via `set_locale`. Defaults to
     * `['en', 'US']`. Most users can ignore this.
     */
    locale?: [language: string, country: string];
    /** Transport reconnect configuration. */
    reconnect?: ReconnectOptions;
    /** Rate limit configuration applied to quote sessions created via this manager. */
    rateLimit?: RateLimitOptions;
    /** Abort signal — destroys the manager and its transport when fired. */
    signal?: AbortSignal;
}
type SessionManagerState = 'idle' | 'connecting' | 'ready' | 'reconnecting' | 'closed';

/**
 * SessionManager — glues Transport, Protocol, and per-session logic.
 *
 * Responsibilities:
 *   - Own a single `Transport` and connect/disconnect it
 *   - Auto-respond to heartbeat frames
 *   - Buffer command sends until the TradingView hello packet arrives
 *   - Route inbound command frames to the session named in `params[0]`
 *   - Replay all registered sessions after a reconnect
 *   - Provide a `sendCommand()` helper used by session classes
 */

declare class SessionManager {
    readonly transport: Transport;
    readonly rateLimit: Required<RateLimitOptions>;
    private readonly sessions;
    private readonly authToken;
    private readonly locale;
    private helloData;
    private state;
    private readyWaiters;
    private hasEverConnected;
    private disposed;
    constructor(opts?: SessionManagerOptions);
    /** Current manager state. */
    getState(): SessionManagerState;
    /** The TradingView hello packet from the most recent connection, if any. */
    getHelloData(): unknown;
    /** Number of currently registered sessions. */
    getSessionCount(): number;
    /**
     * Open the transport and wait until the TradingView hello packet is
     * received — only after that are session commands safe to send.
     */
    connect(): Promise<void>;
    /**
     * Gracefully close the transport and release all sessions. After
     * `disconnect()` the manager cannot be reused.
     */
    disconnect(): Promise<void>;
    /**
     * Register a session so `SessionManager` can route inbound messages
     * to it and include it in replay after reconnect.
     */
    registerSession(session: Session): void;
    /** Remove a session from the routing table. */
    unregisterSession(sessionId: string): void;
    /** Send a `{ m: method, p: params }` command over the transport. */
    sendCommand(method: string, params: unknown[]): void;
    private handleTransportOpen;
    private handleTransportClose;
    private handleRawMessage;
    private handleHello;
    private routeCommand;
    private waitForReady;
    private resolveReadyWaiters;
    private rejectReadyWaiters;
}

/**
 * QuoteSession — manages a TradingView `quote_create_session` container.
 *
 * Responsibilities:
 *   - Send `quote_create_session` / `quote_set_fields` / `quote_add_symbols`
 *     / `quote_remove_symbols` / `quote_delete_session`
 *   - Accumulate per-symbol state across deltas
 *   - Emit typed events via callbacks
 *   - Re-register on reconnect via `replay()`
 *   - Apply rate limiting to add/remove calls through `SymbolBatcher`
 */

interface QuoteSessionOptions {
    manager: SessionManager;
    /** Override the manager-level rate limit for this session. */
    rateLimit?: RateLimitOptions;
    /** Called for every quote delta received on this session. */
    onUpdate?: (update: QuoteUpdate) => void;
    /** Called when TradingView returns a per-symbol error. */
    onError?: (err: QuoteErrorInfo) => void;
    /** Called when the initial snapshot for a symbol has fully loaded. */
    onComplete?: (symbol: string) => void;
}
declare class QuoteSession implements Session {
    readonly id: string;
    private readonly manager;
    private readonly batcher;
    private readonly state;
    private readonly fields;
    private readonly subscribedSymbols;
    private readonly loadedSymbols;
    private disposed;
    private created;
    private readonly onUpdateCb?;
    private readonly onErrorCb?;
    private readonly onCompleteCb?;
    constructor(opts: QuoteSessionOptions);
    /** Replace the active field set and push the update to TradingView. */
    setFields(fields: readonly string[]): void;
    /** Queue one symbol for addition. */
    addSymbol(symbol: string): void;
    /** Queue multiple symbols for addition. */
    addSymbols(symbols: Iterable<string>): void;
    /** Queue one symbol for removal. */
    removeSymbol(symbol: string): void;
    /** Queue multiple symbols for removal. */
    removeSymbols(symbols: Iterable<string>): void;
    /** All symbols currently subscribed on this session (local view). */
    getSubscribedSymbols(): readonly string[];
    /** Accumulated quote state for a symbol, if any. */
    getSnapshot(symbol: string): Readonly<Record<string, unknown>> | undefined;
    /** Force-flush any pending add/remove operations. */
    flushPending(): Promise<void>;
    /**
     * Delete the server-side session and release local resources.
     * Safe to call more than once.
     */
    delete(): Promise<void>;
    handleMessage(method: string, params: unknown[]): void;
    handleDisconnect(): void;
    replay(): void;
    private sendCreate;
    private handleQsd;
    private handleQuoteCompleted;
}

/**
 * Typed TradingView quote fields.
 *
 * `QuoteFieldTypeMap` is the single source of truth mapping every
 * known quote field to its runtime TypeScript type. `QuoteField` is
 * the union of all valid field names, and `QuoteSnapshot<F>` builds a
 * Pick over the map for a given subset of fields.
 *
 * Fields come directly from TradingView's `qsd` protocol frames. The
 * naming follows TradingView's own conventions — we do NOT camelCase
 * them here, because they are used as array values passed directly to
 * `quote_set_fields`. The public API (Phase 4 `Symbol.snapshot()`)
 * returns these keys exactly as-is.
 *
 * All numeric fields are typed `number | null` because TradingView can
 * and does send `null` for values it does not have (closed markets,
 * pre-market quotes, delisted symbols, and certain instrument types).
 * Always assume `undefined` as well until `quote_completed` has fired
 * for the symbol — that is why `QuoteSnapshot<F>` wraps everything in
 * `Partial`.
 */
/** A single tick delivered in the `trade` field. */
interface TradeTick {
    /** Server timestamp when TradingView pushed the update (stringified seconds + ms). */
    'data-update-time': string;
    /** Trade price as a stringified number. */
    price: string;
    /** Trade size as a stringified number. */
    size: string;
    /** Exchange timestamp (stringified epoch seconds). */
    time: string;
}
/** A single bar delivered in the `minute-bar` / `daily-bar` / `prev-daily-bar` fields. */
interface BarTick {
    open: string;
    high: string;
    low: string;
    close: string;
    volume: string;
    /** Bar start time (stringified epoch seconds). */
    time: string;
    /** Most recent update time for this bar (stringified). */
    'update-time': string;
    /** Server-side push timestamp (stringified). */
    'data-update-time': string;
}
/**
 * Complete map from quote field name to its value type.
 *
 * Adding a new field: add an entry here and it automatically becomes
 * available via `QuoteField` and `QuoteSnapshot<F>`.
 */
interface QuoteFieldTypeMap {
    /** Last price. */
    lp: number | null;
    bid: number | null;
    ask: number | null;
    /** Absolute change since previous close. */
    ch: number | null;
    /** Percent change since previous close. */
    chp: number | null;
    volume: number | null;
    open_price: number | null;
    high_price: number | null;
    low_price: number | null;
    prev_close_price: number | null;
    open_time: number | null;
    minmov: number;
    minmove2: number;
    pricescale: number;
    pointvalue: number;
    format: string;
    fractional: boolean;
    popularity: number | null;
    average_volume: number | null;
    circulating_supply: number | null;
    total_supply: number | null;
    total_shares_outstanding: number | null;
    total_shares_diluted: number | null;
    total_value_traded: number | null;
    all_time_high: number | null;
    all_time_open: number | null;
    all_time_low: number | null;
    price_52_week_low: number | null;
    price_52_week_high: number | null;
    price_percent_change_52_week: number | null;
    price_percent_change_1_week: number | null;
    first_bar_time_1s: number | null;
    first_bar_time_1m: number | null;
    first_bar_time_1d: number | null;
    /** Last price time (epoch seconds). */
    lp_time: number | null;
    /** Regular-trading-hours change. */
    rch: number | null;
    /** Regular-trading-hours change percent. */
    rchp: number | null;
    /** Regular-trading-hours close. */
    rtc: number | null;
    /** Regular-trading-hours close time. */
    rtc_time: number | null;
    basic_eps_net_income: number | null;
    beta_1_year: number | null;
    market_cap_basic: number | null;
    earnings_per_share_basic_ttm: number | null;
    price_earnings_ttm: number | null;
    dividends_yield: number | null;
    description: string;
    short_name: string;
    pro_name: string;
    original_name: string;
    exchange: string;
    /** Instrument type: `'stock'`, `'crypto'`, `'forex'`, `'spot'`, `'futures'`, etc. */
    type: string;
    currency_code: string;
    country_code: string;
    language: string;
    local_description: string;
    logoid: string;
    sector: string;
    industry: string;
    timezone: string;
    update_mode: string;
    current_session: string;
    status: string;
    provider_id: string;
    is_tradable: boolean;
    trade: TradeTick;
    'minute-bar': BarTick;
    'daily-bar': BarTick;
    'prev-daily-bar': BarTick;
    /** Free-form bundle of fundamental data attached by TradingView. */
    fundamentals: Record<string, unknown>;
}
/** Union of every valid quote field name. */
type QuoteField = keyof QuoteFieldTypeMap;
/**
 * Partial snapshot of a symbol's quote, typed to the fields you asked
 * for.
 *
 * Example:
 *   const snap: QuoteSnapshot<['lp', 'bid', 'ask']> = await ...
 *   snap.lp   // number | null | undefined
 *   snap.bid  // number | null | undefined
 *
 * All fields are `?:` (optional) because TradingView delivers updates
 * as deltas — any given field may not yet have arrived for a freshly
 * subscribed symbol.
 */
type QuoteSnapshot<F extends readonly QuoteField[] = readonly QuoteField[]> = {
    [K in F[number]]?: QuoteFieldTypeMap[K];
};
/** Full untyped snapshot with every known field as optional. */
type FullQuoteSnapshot = Partial<QuoteFieldTypeMap>;

/**
 * Typed SymbolInfo — the camelCase view of TradingView's raw
 * `symbol_resolved` payload.
 *
 * All fields are optional because TradingView emits different subsets
 * for different instrument types (crypto vs stock vs forex etc.).
 * Consumers should defensively check presence before use.
 *
 * The raw → typed conversion is a single pass through `transformKeys`
 * (see `utils/kebab-to-camel.ts`). Any field TradingView adds in the
 * future will automatically surface on the returned object (with type
 * `unknown`) even if it isn't declared here.
 */
interface SymbolInfo {
    seriesKey?: string;
    baseName?: string[];
    symbol?: string;
    symbolFullname?: string;
    feedTicker?: string;
    exchangeListedSymbol?: string;
    shortName?: string;
    proName?: string;
    originalName?: string;
    symbolPrimaryName?: string;
    symbolProname?: string;
    sessionId?: string;
    sessionRegular?: string;
    sessionExtended?: string;
    sessionDisplay?: string;
    sessionRegularDisplay?: string;
    sessionExtendedDisplay?: string;
    subsessions?: unknown[];
    subsessionId?: string;
    currentSession?: string;
    marketStatus?: {
        phase?: string;
        tradingday?: string;
    };
    exchange?: string;
    exchangeTraded?: string;
    listedExchange?: string;
    providerId?: string;
    group?: string;
    description?: string;
    shortDescription?: string;
    type?: string;
    currencyCode?: string;
    currencyId?: string;
    baseCurrency?: string;
    baseCurrencyId?: string;
    currencyLogoid?: string;
    baseCurrencyLogoid?: string;
    maxPrecision?: number;
    variableTickSize?: string;
    isTradable?: boolean;
    hasDepth?: boolean;
    fundamentalData?: boolean;
    fractional?: boolean;
    feedHasIntraday?: boolean;
    hasIntraday?: boolean;
    isReplayable?: boolean;
    hasPriceSnapshot?: boolean;
    feedHasDwm?: boolean;
    hasNoBbo?: boolean;
    hasNoVolume?: boolean;
    hasDwm?: boolean;
    popularityRank?: number;
    localPopularity?: Record<string, number>;
    localPopularityRank?: Record<string, number>;
    perms?: Record<string, unknown>;
    proPerm?: string;
    historyTag?: string;
    internalStudyId?: string;
    internalStudyInputs?: Record<string, unknown>;
    rtLag?: string;
    rtUpdateTime?: string;
    timezone?: string;
    feed?: string;
    visiblePlotsSet?: string;
    prefixes?: string[];
    brokerNames?: Record<string, unknown>;
    volumeType?: string;
    typespecs?: string[];
    [key: string]: unknown;
}
/**
 * Convert a raw `symbol_resolved` payload into a `SymbolInfo`.
 *
 * This is a shallow conversion — it only camelCases the top-level
 * keys. Nested objects (like `marketStatus`, `localPopularity`) keep
 * their original key casing because their keys are data, not schema
 * (country codes, phase names, etc.).
 */
declare function symbolInfoFromRaw(raw: Record<string, unknown>): SymbolInfo;

/**
 * Error hierarchy for tradingview-api-adapter.
 *
 * All errors thrown by the library extend `TvError`, so consumers can
 * catch them all with a single `instanceof TvError` check. Specific
 * error classes are provided for the common failure modes.
 */
interface TvErrorOptions {
    cause?: unknown;
}
declare class TvError extends Error {
    readonly cause?: unknown;
    constructor(message: string, options?: TvErrorOptions);
}
/** Raised when the WebSocket transport fails to connect or is lost. */
declare class TvConnectionError extends TvError {
}
/** Raised when incoming bytes cannot be parsed as a valid TradingView frame. */
declare class TvProtocolError extends TvError {
}
/** Raised when a session-level operation fails (quote/chart session). */
declare class TvSessionError extends TvError {
}
/** Raised when a specific symbol cannot be resolved or subscribed. */
declare class TvSymbolError extends TvError {
    readonly symbol: string;
    constructor(symbol: string, message: string, options?: TvErrorOptions);
}
/** Raised when an operation exceeds its configured timeout. */
declare class TvTimeoutError extends TvError {
    readonly timeoutMs: number;
    constructor(message: string, timeoutMs: number, options?: TvErrorOptions);
}

export { DEFAULT_RATE_LIMIT as A, type BarTick as B, type Candle as C, DEFAULT_BACKOFF as D, type QuoteSessionOptions as E, type FullQuoteSnapshot as F, type SessionManagerOptions as G, type SessionManagerState as H, Transport as I, type TransportOptions as J, type TransportState as K, calculateBackoff as L, resolveRateLimit as M, type QuoteField as Q, type ReconnectOptions as R, type SymbolInfo as S, type TradeTick as T, type QuoteUpdate as a, type Timeframe as b, type QuoteSnapshot as c, type QuoteErrorInfo as d, SessionManager as e, type RateLimitOptions as f, QuoteSession as g, type QuoteFieldTypeMap as h, type RawTimeframe as i, TIMEFRAME_ALIASES as j, type TimeframeAlias as k, TvConnectionError as l, TvError as m, type TvErrorOptions as n, TvProtocolError as o, TvSessionError as p, TvSymbolError as q, TvTimeoutError as r, normalizeTimeframe as s, symbolInfoFromRaw as t, type SymbolBatcherExecutor as u, type Session as v, type CandlesUpdate as w, type CandleTick as x, type BackoffOptions as y, type CloseInfo as z };
