/**
 * Outbound-send queue — buffers message stanzas that can't reach the wire
 * because there is no live XMPP stream at send time, and replays them once
 * a stream comes (back) online.
 *
 * Lives at MODULE scope on purpose, NOT on the XmppClient instance: the
 * exact windows we need to cover are the ones where the instance itself is
 * gone or being swapped —
 *   1. start race — a send fires before the provider's bootstrap has run
 *      `setClient(created)`, so `useSendMessage` sees `client === null` and
 *      used to throw "No XMPP client".
 *   2. full-reinit race — after 3 failed reconnects the provider does
 *      `setClient(null)` then re-`initializeClient`s; sends in that gap
 *      also saw `client === null`.
 *   3. reconnect window — the instance survives but its underlying stream
 *      is `connecting`/`offline`; a fire-and-forget stanza is silently lost
 *      and only the 30s watchdog notices.
 *
 * Each queued item carries a `send(client)` closure that captures the
 * original args (text or media), so flush is type-agnostic.
 *
 * TTL is deliberately aligned with the 30s pending-send watchdog in
 * useSendMessage (PENDING_WATCHDOG_MS): a queued item older than that has
 * already been — or is about to be — flipped to "Failed → tap to retry" by
 * the watchdog, so replaying it on a late reconnect would duplicate the
 * bubble. We drop those on flush and let the watchdog own the failure.
 */
export interface OutboundQueueClient {
    sendMessage: (...args: any[]) => any;
    sendMediaMessageStanza: (...args: any[]) => any;
}
export interface QueuedSend {
    /** Optimistic/stanza id — used to dedupe re-enqueues (e.g. media retry). */
    optimisticId: string;
    roomJID: string;
    /** Wall-clock ms when first queued; drives the TTL drop on flush. */
    enqueuedAt: number;
    /** Replays the original send against a live, online client. */
    send: (client: OutboundQueueClient) => void;
}
export declare const OUTBOUND_QUEUE_TTL_MS = 30000;
/**
 * Append (or, if the id is already queued, replace in place) a pending
 * send. Order is preserved for FIFO flush.
 */
export declare function enqueueOutboundSend(item: QueuedSend): void;
/**
 * Replay every queued send (in order) against a now-online client. Items
 * older than the TTL are dropped — the send watchdog has already failed
 * them, so re-sending would duplicate. The queue is emptied either way.
 */
export declare function flushOutboundSends(client: OutboundQueueClient, now: number): void;
/** Drop everything — called on permanent teardown (logout / close). */
export declare function clearOutboundSends(): void;
/** Current depth — for tests and diagnostics. */
export declare function outboundQueueLength(): number;
//# sourceMappingURL=outboundQueue.d.ts.map