import { I as IflytekServerConfig } from '../types-C4bbgHHW.js';
export { a as IflytekAudioFrame, b as IflytekStartPayload, c as IflytekStopPayload } from '../types-C4bbgHHW.js';

/**
 * 讯飞语音转文字 — 服务端适配层
 *
 * 运行在 Node.js 上，为每个 Socket.IO 客户端管理一条到讯飞 WebSocket 的上游连接。
 * 纯逻辑，不依赖任何 HTTP 框架。
 *
 * 使用方式：
 * ```ts
 * import { Server } from "socket.io";
 * import { IflytekServerAdapter } from "sa2kit/iflytek/server";
 *
 * const io = new Server(httpServer, { cors: { origin: "*" } });
 * const adapter = new IflytekServerAdapter({
 *   appId: process.env.IFLYTEK_APP_ID!,
 *   apiKey: process.env.IFLYTEK_API_KEY!,
 *   apiSecret: process.env.IFLYTEK_API_SECRET!,
 * });
 *
 * io.on("connection", (socket) => {
 *   adapter.attach(socket);
 * });
 * ```
 */

interface SocketLike {
    id: string;
    emit(event: string, data: unknown): void;
    on(event: string, handler: (...args: any[]) => void): void;
}
declare class IflytekServerAdapter {
    private appId;
    private apiKey;
    private apiSecret;
    private host;
    private path;
    private debug;
    private sessions;
    constructor(config: IflytekServerConfig);
    /**
     * 将适配器绑定到一个 Socket.IO socket 连接上。
     * 自动监听 iflytek:start / iflytek:audio / iflytek:stop / disconnect 事件。
     */
    attach(socket: SocketLike): void;
    private handleStart;
    private handleAudio;
    private handleStop;
    private handleDisconnect;
    private buildWsUrl;
    private extractText;
    private extractResult;
    private mergeResult;
    private closeUpstream;
    private log;
}

export { IflytekServerAdapter, IflytekServerConfig };
