import * as React from 'react';
import React__default from 'react';
import { M as MikuFireworks3DProps, F as FireworkKind, g as FireworksRealtimeConfig, h as FireworksRealtimeState, f as FireworksRealtimeUser, a as FireworkLaunchPayload, c as FireworkEngineOptions, D as DanmakuMessage, e as DanmakuControllerOptions, d as DanmakuSendResult } from '../types-DBVDr8Mu.js';
export { b as FireworkPosition } from '../types-DBVDr8Mu.js';

declare function MikuFireworks3D({ width, height, className, defaultKind, autoLaunchOnDanmaku, maxParticles, maxActiveFireworks, defaultAvatarUrl, onLaunch, onDanmakuSend, onError, onFpsReport, onRealtimeStateChange, realtime, }: MikuFireworks3DProps): React__default.JSX.Element;

interface FireworksCanvasProps {
    canvasRef: React__default.RefObject<HTMLCanvasElement>;
}
declare function FireworksCanvas({ canvasRef }: FireworksCanvasProps): React__default.JSX.Element;

interface FireworksControlPanelProps {
    selectedKind: FireworkKind;
    onKindChange: (kind: FireworkKind) => void;
    autoLaunchOnDanmaku: boolean;
    onAutoLaunchChange: (value: boolean) => void;
    avatarUrl: string;
    onAvatarUrlChange: (value: string) => void;
    onLaunch: () => void;
    fps: number;
    realtimeConnected?: boolean;
    onlineCount?: number;
}
declare function FireworksControlPanel({ selectedKind, onKindChange, autoLaunchOnDanmaku, onAutoLaunchChange, avatarUrl, onAvatarUrlChange, onLaunch, fps, realtimeConnected, onlineCount, }: FireworksControlPanelProps): React__default.JSX.Element;

interface DanmakuPanelProps {
    onSend: (text: string) => void;
}
declare function DanmakuPanel({ onSend }: DanmakuPanelProps): React__default.JSX.Element;

interface RealtimeDanmakuEvent {
    id: string;
    roomId: string;
    text: string;
    color?: string;
    kind?: FireworkKind;
    user: FireworksRealtimeUser;
    timestamp: number;
}
interface RealtimeFireworkEvent {
    id: string;
    roomId: string;
    payload: FireworkLaunchPayload;
    user: FireworksRealtimeUser;
    timestamp: number;
}
type ServerMessage = {
    type: 'joined';
    roomId: string;
    onlineCount: number;
    self: FireworksRealtimeUser;
} | {
    type: 'room.snapshot';
    roomId: string;
    users: FireworksRealtimeUser[];
    danmakuHistory: RealtimeDanmakuEvent[];
    fireworkHistory: RealtimeFireworkEvent[];
} | {
    type: 'room.user_joined';
    roomId: string;
    user: FireworksRealtimeUser;
    onlineCount: number;
} | {
    type: 'room.user_left';
    roomId: string;
    userId: string;
    onlineCount: number;
} | {
    type: 'danmaku.broadcast';
    roomId: string;
    event: RealtimeDanmakuEvent;
} | {
    type: 'firework.broadcast';
    roomId: string;
    event: RealtimeFireworkEvent;
} | {
    type: 'error';
    code: string;
    message: string;
} | {
    type: 'pong';
    ts: number;
};
interface WebSocketTransportCallbacks {
    onStateChange?: (state: FireworksRealtimeState) => void;
    onDanmakuBroadcast?: (event: RealtimeDanmakuEvent) => void;
    onFireworkBroadcast?: (event: RealtimeFireworkEvent) => void;
    onSnapshot?: (snapshot: Extract<ServerMessage, {
        type: 'room.snapshot';
    }>) => void;
    onError?: (error: Error) => void;
}
declare class WebSocketTransport {
    private socket;
    private reconnectTimer;
    private isManualClose;
    private readonly pendingQueue;
    private readonly config;
    private readonly callbacks;
    private state;
    constructor(config: FireworksRealtimeConfig, callbacks?: WebSocketTransportCallbacks);
    connect(): void;
    disconnect(): void;
    sendDanmaku(payload: {
        text: string;
        color?: string;
        kind?: FireworkKind;
    }): void;
    sendFirework(payload: FireworkLaunchPayload): void;
    getState(): FireworksRealtimeState;
    private send;
    private updateState;
    private handleServerMessage;
    private scheduleReconnect;
    private flushPendingQueue;
}

interface UseFireworksEngineOptions extends FireworkEngineOptions {
    onLaunch?: (payload: FireworkLaunchPayload) => void;
}
declare function useFireworksEngine(options?: UseFireworksEngineOptions): {
    containerRef: React.RefObject<HTMLDivElement>;
    canvasRef: React.RefObject<HTMLCanvasElement>;
    launch: (payload: FireworkLaunchPayload) => void;
    fps: number;
};

interface DanmakuOverlayItem extends DanmakuMessage {
    track: number;
    durationMs: number;
}
interface SendDanmakuOptions {
    optimistic?: boolean;
}
declare function useDanmakuController(options?: DanmakuControllerOptions): {
    items: DanmakuOverlayItem[];
    send: (text: string, color?: string, sendOptions?: SendDanmakuOptions) => DanmakuSendResult | null;
    addIncoming: (message: DanmakuMessage) => void;
    removeItem: (id: string) => void;
};

interface UseFireworksRealtimeOptions {
    config?: FireworksRealtimeConfig;
    enabled?: boolean;
    onDanmakuBroadcast?: (event: {
        text: string;
        color?: string;
        kind?: FireworkKind;
        userId: string;
        timestamp: number;
        id: string;
    }) => void;
    onFireworkBroadcast?: (event: {
        id: string;
        payload: FireworkLaunchPayload;
        userId: string;
        timestamp: number;
    }) => void;
    onSnapshot?: (snapshot: {
        roomId: string;
        danmakuHistory: Array<{
            id: string;
            text: string;
            color?: string;
            kind?: FireworkKind;
            userId: string;
            timestamp: number;
        }>;
        fireworkHistory: Array<{
            id: string;
            payload: FireworkLaunchPayload;
            userId: string;
            timestamp: number;
        }>;
    }) => void;
    onError?: (error: Error) => void;
    onStateChange?: (state: FireworksRealtimeState) => void;
}
declare function useFireworksRealtime(options: UseFireworksRealtimeOptions): {
    state: FireworksRealtimeState;
    sendDanmaku: (payload: {
        text: string;
        color?: string;
        kind?: FireworkKind;
    }) => void;
    sendFirework: (payload: FireworkLaunchPayload) => void;
};

declare const DEFAULT_MAX_PARTICLES = 5000;
declare const DEFAULT_MAX_ACTIVE_FIREWORKS = 12;
declare const FIREWORK_KIND_LABELS: Record<FireworkKind, string>;
declare const MIKU_PALETTE: string[];
declare const NORMAL_PALETTE: string[];
declare const DANMAKU_MAX_LENGTH = 32;
declare const DANMAKU_TRACK_COUNT = 8;

export { DANMAKU_MAX_LENGTH, DANMAKU_TRACK_COUNT, DEFAULT_MAX_ACTIVE_FIREWORKS, DEFAULT_MAX_PARTICLES, DanmakuControllerOptions, DanmakuMessage, type DanmakuOverlayItem, DanmakuPanel, DanmakuSendResult, FIREWORK_KIND_LABELS, FireworkEngineOptions, FireworkKind, FireworkLaunchPayload, FireworksCanvas, FireworksControlPanel, FireworksRealtimeConfig, FireworksRealtimeState, FireworksRealtimeUser, MIKU_PALETTE, MikuFireworks3D, MikuFireworks3DProps, NORMAL_PALETTE, type UseFireworksEngineOptions, WebSocketTransport, type WebSocketTransportCallbacks, useDanmakuController, useFireworksEngine, useFireworksRealtime };
