export class DevTUI {
    options;
    app = null;
    updateStatusFn = null;
    updateAppPortFn = null;
    constructor(options) {
        this.options = options;
    }
    async start() {
        try {
            // Temporarily suppress React hook warnings during TUI startup
            const originalError = console.error;
            const suppressReactHookWarnings = (...args) => {
                const message = args[0];
                if (typeof message === "string" && message.includes("Invalid hook call")) {
                    // Suppress React hook warnings during TUI startup - these are known compatibility issues with React 19 canary + Ink
                    return;
                }
                originalError(...args);
            };
            console.error = suppressReactHookWarnings;
            // Use dynamic import to load the TSX implementation at runtime
            const { runTUI } = await import("./tui-interface-impl.js");
            const { app, updateStatus, updateAppPort } = await runTUI(this.options);
            this.app = app;
            this.updateStatusFn = updateStatus;
            this.updateAppPortFn = updateAppPort;
            // Restore original error logging after startup
            setTimeout(() => {
                console.error = originalError;
            }, 1000);
        }
        catch (error) {
            console.error("Failed to start TUI:", error);
            throw error;
        }
    }
    updateStatus(status) {
        if (this.updateStatusFn) {
            this.updateStatusFn(status);
        }
    }
    updateAppPort(port) {
        if (this.updateAppPortFn) {
            this.updateAppPortFn(port);
        }
    }
    async shutdown() {
        if (this.app) {
            this.app.unmount();
        }
    }
}
//# sourceMappingURL=tui-interface.js.map