/**
 * Terminal Enhancements
 * OSC-8 hyperlinks, theming palette, and verbose mode.
 */
import { logger } from '../utils/logger.js';
export class OSC8Hyperlink {
    static create(url, text) {
        return `\x1b]8;;${url}\x1b\\${text}\x1b]8;;\x1b\\`;
    }
    static isSupported() {
        const term = process.env.TERM_PROGRAM || '';
        const supported = ['kitty', 'iTerm.app', 'iTerm2', 'WezTerm', 'vscode', 'Hyper'];
        return supported.some(t => term.toLowerCase().includes(t.toLowerCase()));
    }
    static stripLinks(text) {
        // Remove OSC-8 escape sequences
        return text.replace(/\x1b\]8;;[^\x1b]*\x1b\\/g, '');
    }
}
export class LobsterPalette {
    static instance = null;
    accent = '#FF5A2D';
    success = '#2FBF71';
    warning = '#FFB020';
    error = '#E23D2D';
    info = '#3B82F6';
    dim = '#6B7280';
    static getInstance() {
        if (!LobsterPalette.instance) {
            LobsterPalette.instance = new LobsterPalette();
        }
        return LobsterPalette.instance;
    }
    static resetInstance() {
        LobsterPalette.instance = null;
    }
    getColor(name) {
        const colors = this.getAllColors();
        return colors[name];
    }
    applyAnsi(text, colorName) {
        const ansiMap = {
            accent: '\x1b[38;2;255;90;45m',
            success: '\x1b[38;2;47;191;113m',
            warning: '\x1b[38;2;255;176;32m',
            error: '\x1b[38;2;226;61;45m',
            info: '\x1b[38;2;59;130;246m',
            dim: '\x1b[38;2;107;114;128m',
        };
        const code = ansiMap[colorName];
        if (!code)
            return text;
        return `${code}${text}\x1b[0m`;
    }
    getAllColors() {
        return {
            accent: this.accent,
            success: this.success,
            warning: this.warning,
            error: this.error,
            info: this.info,
            dim: this.dim,
        };
    }
}
export class VerboseMode {
    static instance = null;
    enabled = false;
    static getInstance() {
        if (!VerboseMode.instance) {
            VerboseMode.instance = new VerboseMode();
        }
        return VerboseMode.instance;
    }
    static resetInstance() {
        VerboseMode.instance = null;
    }
    isEnabled() {
        return this.enabled;
    }
    enable() {
        this.enabled = true;
    }
    disable() {
        this.enabled = false;
    }
    toggle() {
        this.enabled = !this.enabled;
        return this.enabled;
    }
    log(message) {
        if (this.enabled) {
            logger.debug(`[VERBOSE] ${message}`);
        }
    }
}
//# sourceMappingURL=terminal-enhancements.js.map