import type { IYTLiveChat } from "../interfaces/i-yt-live-chat.js"; import type { ChatItem, RawActionReceivedEventArgs, SendDummyOptions, StartOptions, YTLiveChatEvents, YTLiveChatOptions } from "../types/index.js"; import { TypedEventEmitter } from "../utils/typed-event-emitter.js"; import { YTHttpClient } from "./yt-http-client.js"; /** * Main live chat service for YouTube InnerTube chat polling. * * Supports typed events, async iterators, local dummy injection, and auto reconnect. */ export declare class YTLiveChat extends TypedEventEmitter implements IYTLiveChat { private readonly options; private readonly httpClient; private activeRun?; private abortController?; private activeLiveId?; /** * Create a `YTLiveChat` service instance. * * No constructor options are required. * * @param options Optional runtime configuration. * @param httpClient Optional custom HTTP client. * * @example * ```ts * const livechat = new YTLiveChat(); * * livechat.on("chatReceived", ({ chatItem }) => { * console.log(chatItem.author.name); * }); * * await livechat.start({ handle: "@YouTubeChannelHandle" }); * ``` */ constructor(options?: YTLiveChatOptions, httpClient?: YTHttpClient); /** * Start monitoring chat for a specific target. * At least one of `handle`, `channelId`, or `liveId` is required. * * @example * ```ts * const livechat = new YTLiveChat(); * await livechat.start({ handle: "@YouTubeChannelHandle" }); * ``` */ start(options?: StartOptions): Promise; /** * Stop monitoring and emit `chatStopped`. */ stop(reason?: string): void; /** * Dispose service resources and remove all listeners. */ dispose(): void; /** * Inject a local fake event through the same pipeline as real events. * * @example * ```ts * chat.sendDummy({ mode: "text", text: "hello from UI test" }); * ``` */ sendDummy(options?: SendDummyOptions): ChatItem; /** * Stream parsed chat items as an async iterable. * * @example * ```ts * for await (const item of chat.streamChatItems({ liveId: "VIDEO_ID" })) { * console.log(item.author.name); * } * ``` */ streamChatItems(options?: StartOptions, signal?: AbortSignal): AsyncIterable; /** * Stream raw action payloads as an async iterable. * * @example * ```ts * for await (const action of chat.streamRawActions({ liveId: "VIDEO_ID" })) { * console.log(action.rawAction); * } * ``` */ streamRawActions(options?: StartOptions, signal?: AbortSignal): AsyncIterable; private runLoop; private logDebugItem; private createDummyChatItem; private toDummyRawAction; } //# sourceMappingURL=yt-live-chat.d.ts.map