/**
 * @license
 * Copyright 2026 HopCode
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * React hook and context for writing raw escape sequences to the terminal,
 * bypassing Ink's stdout interception.
 *
 * Provides per-protocol notification helpers (iTerm2 / Kitty / Ghostty / Bell)
 * and terminal progress reporting.
 */
import { BEL, wrapForMultiplexer, oscITerm2Notify, oscKittyNotify, oscGhosttyNotify, } from '../../utils/osc.js';
// ── Factory (no React context needed) ──────────────────────────────
/**
 * Build a TerminalNotification object from a raw write function.
 * Useful when the caller already has stdout.write and does not need
 * (or cannot use) TerminalWriteContext (e.g. in AppContainer's body
 * before the provider is mounted in the JSX tree).
 */
export function buildTerminalNotification(writeRaw) {
    return {
        notifyITerm2({ message, title }) {
            writeRaw(wrapForMultiplexer(oscITerm2Notify(title ?? '', message)));
        },
        notifyKitty({ message, title, id }) {
            for (const seq of oscKittyNotify(title, message, id)) {
                writeRaw(wrapForMultiplexer(seq));
            }
        },
        notifyGhostty({ message, title }) {
            writeRaw(wrapForMultiplexer(oscGhosttyNotify(title, message)));
        },
        notifyBell() {
            // Raw BEL — inside tmux this triggers tmux's bell-action (window flag).
            // Wrapping would make it opaque DCS payload and lose that fallback.
            writeRaw(BEL);
        },
    };
}
//# sourceMappingURL=useTerminalNotification.js.map