


import builtins
import sys

from ...utils.imports import _is_package_available
from . import cursor, input
from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor
from .keymap import KEYMAP


snake_case_						:			Union[str, Any]													=							False
try:
							snake_case_						:			str													=							_is_package_available('''google.colab''')
except ModuleNotFoundError:
							pass

@input.register
class 						A__							:




						def __init__(       self					:      Optional[int]				,    _a					:      str = None				,    _a					:      list = []  )							->     Dict:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =0
										_SCREAMING_SNAKE_CASE			  =choices
										_SCREAMING_SNAKE_CASE			  =prompt
										if sys.platform == "win32":
														_SCREAMING_SNAKE_CASE			  ="*"
										else:
														_SCREAMING_SNAKE_CASE			  ="➔ "




						def 							__UpperCamelCase				(       self					:      int				,    _a					:      int				,    _a					:      str = ""  )							->     Any:


										"""simple docstring"""





										if sys.platform != "win32":
														writeColor(self.choices[index]				,    32				,    __lowerCamelCase  )
										else:
														forceWrite(self.choices[index]				,    __lowerCamelCase  )




						def 							__UpperCamelCase				(       self					:      Dict				,    _a					:      int  )							->     List[str]:


										"""simple docstring"""





										if index == self.position:
														forceWrite(f" {self.arrow_char} "  )
														self.write_choice(__lowerCamelCase  )
										else:
														forceWrite(f"    {self.choices[index]}"  )
										reset_cursor()




						def 							__UpperCamelCase				(       self					:      Any				,    _a					:      Direction				,    _a					:      int = 1  )							->     Union[str, Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =self.position
										if direction == Direction.DOWN:
														if self.position + 1 >= len(self.choices  ):
																		return
														self.position += num_spaces
										else:
														if self.position - 1 < 0:
																		return
														self.position -= num_spaces
										clear_line()
										self.print_choice(__lowerCamelCase  )
										move_cursor(__lowerCamelCase				,    direction.name  )
										self.print_choice(self.position  )




						@input.mark(KEYMAP['''up''']  )
						def 							__UpperCamelCase				(       self					:      Optional[int]  )							->     Any:


										"""simple docstring"""





										self.move_direction(Direction.UP  )




						@input.mark(KEYMAP['''down''']  )
						def 							__UpperCamelCase				(       self					:      Optional[Any]  )							->     List[str]:


										"""simple docstring"""





										self.move_direction(Direction.DOWN  )




						@input.mark(KEYMAP['''newline''']  )
						def 							__UpperCamelCase				(       self					:      str  )							->     List[str]:


										"""simple docstring"""





										move_cursor(len(self.choices  ) - self.position				,    '''DOWN'''  )
										return self.position




						@input.mark(KEYMAP['''interrupt''']  )
						def 							__UpperCamelCase				(       self					:      Tuple  )							->     Any:


										"""simple docstring"""





										move_cursor(len(self.choices  ) - self.position				,    '''DOWN'''  )
										raise KeyboardInterrupt




						@input.mark_multiple(*[KEYMAP[str(__lowerCamelCase  )] for number in range(10  )]  )
						def 							__UpperCamelCase				(       self					:      str  )							->     List[Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =int(chr(self.current_selection  )  )
										_SCREAMING_SNAKE_CASE			  =index - self.position
										if index == self.position:
														return
										if index < len(self.choices  ):
														if self.position > index:
																		self.move_direction(Direction.UP				,    -movement  )
														elif self.position < index:
																		self.move_direction(Direction.DOWN				,    __lowerCamelCase  )
														else:
																		return
										else:
														return




						def 							__UpperCamelCase				(       self					:      List[str]				,    _a					:      int = 0  )							->     int:


										"""simple docstring"""





										if self.prompt:
														linebreak()
														forceWrite(self.prompt				,    '''\n'''  )
														if in_colab:
																		forceWrite('''Please input a choice index (starting from 0), and press enter'''				,    '''\n'''  )
														else:
																		forceWrite('''Please select a choice using the arrow or number keys, and selecting with enter'''				,    '''\n'''  )
										_SCREAMING_SNAKE_CASE			  =default_choice
										for i in range(len(self.choices  )  ):
														self.print_choice(__lowerCamelCase  )
														forceWrite('''\n'''  )
										move_cursor(len(self.choices  ) - self.position				,    '''UP'''  )
										with cursor.hide():
														while True:
																		if in_colab:
																						try:
																										_SCREAMING_SNAKE_CASE			  =int(builtins.input()  )
																						except ValueError:
																										_SCREAMING_SNAKE_CASE			  =default_choice
																		else:
																						_SCREAMING_SNAKE_CASE			  =self.handle_input()
																		if choice is not None:
																						reset_cursor()
																						for _ in range(len(self.choices  ) + 1  ):
																										move_cursor(1				,    '''UP'''  )
																										clear_line()
																						self.write_choice(__lowerCamelCase				,    '''\n'''  )
																						return choice







from ...utils import logging
from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel
from .configuration_mta import MTaConfig


snake_case_						:			List[Any]													=							logging.get_logger(__name__)

snake_case_						:			Optional[Any]													=							'''T5Config'''

class 						A__							(		UpperCamelCase__  ):
						UpperCAmelCase             =						"mt5"
						UpperCAmelCase             =						MTaConfig

class 						A__							(		UpperCamelCase__  ):
						UpperCAmelCase             =						"mt5"
						UpperCAmelCase             =						MTaConfig

class 						A__							(		UpperCamelCase__  ):
						UpperCAmelCase             =						"mt5"
						UpperCAmelCase             =						MTaConfig