





'''simple docstring'''
import os
import string
import sys


a__							:							Dict =1 << 8

a__							:							Union[str, Any] ={
    '''tab''': ord('''\t'''),
    '''newline''': ord('''\r'''),
    '''esc''': 27,
    '''up''': 65 + ARROW_KEY_FLAG,
    '''down''': 66 + ARROW_KEY_FLAG,
    '''right''': 67 + ARROW_KEY_FLAG,
    '''left''': 68 + ARROW_KEY_FLAG,
    '''mod_int''': 91,
    '''undefined''': sys.maxsize,
    '''interrupt''': 3,
    '''insert''': 50,
    '''delete''': 51,
    '''pg_up''': 53,
    '''pg_down''': 54,
}

a__							:							Tuple =KEYMAP['''up''']
a__							:							Any =KEYMAP['''left''']

if sys.platform == "win32":
    a__							:							Union[str, Any] =[]
    a__							:							Union[str, Any] ={
        B'''\xe0H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
        B'''\x00H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
        B'''\xe0P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
        B'''\x00P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
        B'''\xe0M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
        B'''\x00M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
        B'''\xe0K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
        B'''\x00K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
    }

for i in range(10):
    a__							:							Union[str, Any] =ord(str(i))
def 				lowercase__   (   ) ->      List[Any]:



       """simple docstring"""






       if os.name == "nt":
              import msvcrt

              __UpperCamelCase       =  'mbcs'
              # Flush the keyboard buffer
              while msvcrt.kbhit():
                     msvcrt.getch()
              if len(__lowercase     ) == 0:
                     # Read the keystroke
                     __UpperCamelCase       =  msvcrt.getch()

                     # If it is a prefix char, get second part
                     if ch in (b"\x00", b"\xe0"):
                            __UpperCamelCase       =  ch + msvcrt.getch()
                            # Translate actual Win chars to bullet char types
                            try:
                                   __UpperCamelCase       =  chr(WIN_KEYMAP[cha]     )
                                   WIN_CH_BUFFER.append(chr(KEYMAP['mod_int']     )     )
                                   WIN_CH_BUFFER.append(__lowercase     )
                                   if ord(__lowercase     ) in (
                                       KEYMAP["insert"] - 1 << 9,
                                       KEYMAP["delete"] - 1 << 9,
                                       KEYMAP["pg_up"] - 1 << 9,
                                       KEYMAP["pg_down"] - 1 << 9,
                                   ):
                                          WIN_CH_BUFFER.append(chr(126     )     )
                                   __UpperCamelCase       =  chr(KEYMAP['esc']     )
                            except KeyError:
                                   __UpperCamelCase       =  cha[1]
                     else:
                            __UpperCamelCase       =  ch.decode(__lowercase     )
              else:
                     __UpperCamelCase       =  WIN_CH_BUFFER.pop(0     )
       elif os.name == "posix":
              import termios
              import tty

              __UpperCamelCase       =  sys.stdin.fileno()
              __UpperCamelCase       =  termios.tcgetattr(__lowercase     )
              try:
                     tty.setraw(__lowercase     )
                     __UpperCamelCase       =  sys.stdin.read(1     )
              finally:
                     termios.tcsetattr(__lowercase				,  termios.TCSADRAIN				,  __lowercase     )
       return ch


def 				lowercase__   (   ) ->      Union[str, Any]:



       """simple docstring"""






       __UpperCamelCase       =  get_raw_chars()
       if ord(__lowercase     ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
              return char

       elif ord(__lowercase     ) == KEYMAP["esc"]:
              __UpperCamelCase       =  get_raw_chars()
              if ord(__lowercase     ) == KEYMAP["mod_int"]:
                     __UpperCamelCase       =  get_raw_chars()
                     if ord(__lowercase     ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(__lowercase     ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
                            return chr(ord(__lowercase     ) + ARROW_KEY_FLAG     )
                     else:
                            return KEYMAP["undefined"]
              else:
                     return get_raw_chars()

       else:
              if char in string.printable:
                     return char
              else:
                     return KEYMAP["undefined"]







'''simple docstring'''
from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
    if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from ...utils.dummy_torch_and_transformers_objects import (
        VersatileDiffusionDualGuidedPipeline,
        VersatileDiffusionImageVariationPipeline,
        VersatileDiffusionPipeline,
        VersatileDiffusionTextToImagePipeline,
    )
else:
    from .modeling_text_unet import UNetFlatConditionModel
    from .pipeline_versatile_diffusion import VersatileDiffusionPipeline
    from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline
    from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline
    from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline
