# Path: il2fb/ds/airbridge/typing.py



import io
import logging
import math
import sys
import threading
    import readline
    import pyreadline as readline
from colorama import init as init_colors, Fore, Style
from il2fb.ds.airbridge.typing import StringHandler, StringOrNone


def write_string_to_stderr(s: str) -> None:
    write_string_to_stream(sys.stderr, s)


class Terminal:
    _prompt_empty_value = math.nan

    def __init__(self):
        readline.clear_history()
        init_colors()

        self._prompt_value = self._prompt_empty_value
        self._prompt_mutex = threading.Lock()
        self._prompt_not_empty = threading.Condition(self._prompt_mutex)
        self._prompt_has_waiters = True

        self._stdin_listener_thread = None
        self._stdin_listener_event = threading.Event()
        self._stdin_listener_event.clear()

    @staticmethod
    def handle_stdout(s: str) -> None:
        write_string_to_stdout(s)

    @staticmethod
    def handle_stderr(s: str) -> None:
        write_string_to_stderr(colorize_error(s))


# Path: il2fb/ds/airbridge/typing.py



# Path: il2fb/ds/airbridge/terminal.py
import io
import logging
import math
import sys
import threading
    import readline
    import pyreadline as readline
from colorama import init as init_colors, Fore, Style
from il2fb.ds.airbridge.typing import StringHandler, StringOrNone



def write_string_to_stderr(s: str) -> None:
    write_string_to_stream(sys.stderr, s)


class Terminal:
    _prompt_empty_value = math.nan

    def __init__(self):
        readline.clear_history()
        init_colors()

        self._prompt_value = self._prompt_empty_value
        self._prompt_mutex = threading.Lock()
        self._prompt_not_empty = threading.Condition(self._prompt_mutex)
        self._prompt_has_waiters = True

        self._stdin_listener_thread = None
        self._stdin_listener_event = threading.Event()
        self._stdin_listener_event.clear()

    @staticmethod
    def handle_stdout(s: str) -> None:
        write_string_to_stdout(s)

    @staticmethod
    def handle_stderr(s: str) -> None:
        write_string_to_stderr(colorize_error(s))


    def handle_prompt(self, value: StringOrNone) -> None: