VULN_CHECK_I913V6 j$Y UdZddlZddlZddlmZdZeed<ejdk(rejejZn e e dddl Z ddlm Z mZmZddlmZmZmZmZdd lmZdd lmZd Zd Zej4ZGd deZGddeZGdde ZGddejZ ejBjDZ#ejHge#_%ejLe#_'efde(dejLfdZ"ejBjRZ*ejLejVge*_%ejXe*_'dejLde(fdZ)ejBjZZ.ejLej^ejHeeeeej`ejHge._%ejXe._'dejLde1de(dede(f dZ2ejBjfZ4ejLejjejHeeeeej`ejHge4_%ejXe4_'dejLde(de(dede(f dZ3ejBjlZ7ejLejjge7_%ejXe7_'dejLdejjde8fd Z6ejBjrZ:ejLej`ege:_%ejXe:_'dejLdefd!Z9ejBjvZejLej`e ge>_%ejXe>_'dejLd$e de8fd%Z=ejBj~Z@ejLej`e ge@_%ejXe@_'dejLd$e de8fd&Z?ejBjZBejgeB_%ejXeB_'d'e1de8fd(ZDGd)d*ZEe d+k(re"ZFdd,lGmHZHeHZIeEejZKeKjd-ed.d/0ZMejd1ZOeIjd2eIjd3eIjd4eIjd5eIjd6eIjd7eIjd8eIjd9eIjd:eIjd;eIjd<eIjd=eIjd>eIjd?eIjd@eIjdAeIjdBeIjeKjeKjeKjdCe jdDeKjeKjdEe jdDeKjeKjdFe jdDeKjeKjeKjeKjdGe jdDeKjeKjeKjeKjdHe jdDeKjeIjeIjdIeIjdJeKjdKe jdDeKjdLeKjdMejdNeKje jdDeKje jdDeIjdOeKjdKe jdDeKjdLeKjdPejdNe jdDeKje jdDeIjdQeKjdRejdSTe jdDeKjeKjeQdUyy)VzLight wrapper around the Win32 Console API - this module should only be imported on Windows The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions N)Anywindllwin32z can only be imported on Windows) Structurebyrefwintypes)IO NamedTupleTypecast) ColorSystem)Styleic eZdZy)LegacyWindowsErrorN)__name__ __module__ __qualname__D/usr/lib/python3.12/site-packages/pip/_vendor/rich/_win32_console.pyrrsrrc@eZdZUdZeed<eed<edddefdZy)WindowsCoordinateszCoordinates in the Windows Console API are (y, x), not (x, y). This class is intended to prevent that confusion. Rows and columns are indexed from 0. This class can be used in place of wintypes._COORD in arguments and argtypes. rowcolvaluereturncBt|j|jS)aEConverts a WindowsCoordinates into a wintypes _COORD structure. This classmethod is internally called by ctypes to perform the conversion. Args: value (WindowsCoordinates): The input coordinates to convert. Returns: wintypes._COORD: The converted coordinates struct. )COORDrr)clsrs r from_paramzWindowsCoordinates.from_param*sUYY **rN) rrr__doc__int__annotations__ classmethodrr!rrrrr s4 H H +3 + + +rrcVeZdZdefdefdej fdej fdefgZy)CONSOLE_SCREEN_BUFFER_INFOdwSizedwCursorPosition wAttributessrWindowdwMaximumWindowSizeN)rrrrrWORD SMALL_RECT_fields_rrrr'r'8s; 5 U#  & X(() & Hrr'cDeZdZdejfdej fgZy)CONSOLE_CURSOR_INFOr(bVisibleN)rrrrDWORDBOOLr/rrrr1r1Bs8>>*Z,GHHrr1handlercHttjt|S)zRetrieves a handle to the specified standard device (standard input, standard output, or standard error). Args: handle (int): Integer identifier for the handle. Defaults to -11 (stdout). Returns: wintypes.HANDLE: The handle )r rHANDLE _GetStdHandle)r5s r GetStdHandler9Ms v!6 77r std_handlectj}tt||}|s t d|j S)aRetrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. Raises: LegacyWindowsError: If any error occurs while calling the Windows console API. Returns: int: Value representing the current console mode as documented at https://docs.microsoft.com/en-us/windows/console/getconsolemode#parameters z)Unable to get legacy Windows Console Mode)rr3bool_GetConsoleModerr)r: console_modesuccesss rGetConsoleModer@^s<>>#L?:|<=G  !LMM   rcharlengthstartc tj|j}tj|}tjd}t ||||t ||jS)aWrites a character to the console screen buffer a specified number of times, beginning at the specified coordinates. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. char (str): The character to write. Must be a string of length 1. length (int): The number of times to write the character. start (WindowsCoordinates): The coordinates to start writing at. Returns: int: The number of characters written. r)ctypesc_charencoderr3_FillConsoleOutputCharacterWrr)r:rArBrC characternum_characters num_writtens rFillConsoleOutputCharacterrLs^" dkkm,I^^F+N..#K   k    r attributesc tj|}tj|}tjd}t||||t ||j S)alSets the character attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. attributes (int): Integer value representing the foreground and background colours of the cells. length (int): The number of cells to set the output attribute of. start (WindowsCoordinates): The coordinates of the first cell whose attributes are to be set. Returns: int: The number of cells whose attributes were actually set. r)rr3r-_FillConsoleOutputAttributerr)r:rMrBrC num_cells style_attrsrKs rFillConsoleOutputAttributerRsT$v&I-- +K..#KKE53E   rc,tt||S)a|Set the colour attributes for all text written after this function is called. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. attributes (int): Integer value representing the foreground and background colours. Returns: bool: True if the attribute was set successfully, otherwise False. )r<_SetConsoleTextAttribute)r:rMs rSetConsoleTextAttributerUs (Z@ AArcDt}t|t||S)aqRetrieves information about the specified console screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. Returns: CONSOLE_SCREEN_BUFFER_INFO: A CONSOLE_SCREEN_BUFFER_INFO ctype struct contain information about screen size, cursor position, colour attributes, and more.)r'_GetConsoleScreenBufferInfor)r:console_screen_buffer_infos rGetConsoleScreenBufferInforYs#">r cursor_infoc>tt|t|S)aGet the cursor info - used to get cursor visibility and width Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct that receives information about the console's cursor. Returns: bool: True if the function succeeds, otherwise False. )r<_GetConsoleCursorInforr:r^s rGetConsoleCursorInforbs %j% 2DE FFrc>tt|t|S)awSet the cursor info - used for adjusting cursor visibility and width Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct containing the new cursor info. Returns: bool: True if the function succeeds, otherwise False. )r<_SetConsoleCursorInforras rSetConsoleCursorInfore*s %j% 2DE FFrtitlec*tt|S)zSets the title of the current console window Args: title (str): The new title of the console window. Returns: bool: True if the function succeeds, otherwise False. )r<_SetConsoleTitle)rfs rSetConsoleTitleri>s  ' ((rceZdZdZdZgdZddZedefdZ edefdZ d e ddfd Z d e d e ddfd Zd eddfdZddZddZddZddZddZddZdeddfdZddZddZddZde ddfdZdefdZy)LegacyWindowsTermaThis class allows interaction with the legacy Windows Console API. It should only be used in the context of environments where virtual terminal processing is not available. However, if it is used in a Windows environment, the entire API should work. Args: file (IO[str]): The file which the Windows Console API HANDLE is retrieved from, defaults to sys.stdout. )rrrl  rNc*tt}||_t|j}||_|dz|_|dz dz|_|j |jdzz|_||_ |j|_ |j|_ y)Nrrr) r9STDOUT_handlerYr* _default_text _default_fore _default_back_default_attrs_filewriteflush)selffiler5 default_texts r__init__zLegacyWindowsTerm.__init__isf% 1&9EE ))A-*a/14"00D4F4F!4KL ZZ ZZ rct|jj}tt t |j t t |jS)zReturns the current position of the cursor (0-based) Returns: WindowsCoordinates: The current cursor position. rr)rYr|r)rr r#YX)rcoords rcursor_positionz!LegacyWindowsTerm.cursor_positionws;2$,,?PP!d3&8d3>PQQrct|jj}tt t |j t t |jS)zReturns the current size of the console screen buffer, in character columns and rows Returns: WindowsCoordinates: The width and height of the screen as WindowsCoordinates. r)rYr|r(rr r#rr)r screen_sizes rrzLegacyWindowsTerm.screen_sizes@8 ELL !S+--(d3 .F  rtextcF|j||jy)zWrite text directly to the terminal without any modification of styles Args: text (str): The text to write to the console N)rr)rrs r write_textzLegacyWindowsTerm.write_texts 4 rstylec|j}|j}|jr||}}|rv|jtj j }||nd}|jr||jz}|jr||jz}|j|}n |j}|r?|jtj j }||nd}|j|}n |j}|J|Jt|jtj ||dzz|j#|t|j|j$y)zWrite styled text to the terminal. Args: text (str): The text to write style (Style): The style of the text Nrrrr)rM)colorbgcolorreverse downgrader WINDOWSnumberbold BRIGHT_BITdimANSI_TO_WINDOWSr~rrUr|rEc_ushortrr})rrrrrforebacks r write_styledzLegacyWindowsTerm.write_styleds: -- ==$e7E ??;#6#67>>D+4Dzzdoo-yyt..''-D%%D $$[%8%89@@D+4D''-D%%D LLV__TTQY5G%H   9K9KLr new_positioncp|jdks|jdkryt|j|y)zSet the position of the cursor Args: new_position (WindowsCoordinates): The WindowsCoordinates representing the new position of the cursor. rNrZ)rrr]r|)rrs rmove_cursor_toz LegacyWindowsTerm.move_cursor_tos0   a <#3#3a#7  lCrc|j}|j}|j}t|jd}t |j d||t|j |j||y)z@Erase all content on the line the cursor is currently located atrr rBrCN) rrrrrrLr|rRr)rrrcells_to_erasestart_coordinatess r erase_linezLegacyWindowsTerm.erase_linesj&& ..$.?3F3FAN" LL#nz) ...Now the whole line will be erased...zI'm going to disappear!z black on cyan)r )^r"rEsystypingrrr$platform LibraryLoaderWinDLL ImportErrorrtimerrrr r r r pip._vendor.rich.colorr pip._vendor.rich.stylerr{"ENABLE_VIRTUAL_TERMINAL_PROCESSING_COORDr Exceptionrrr'r1kernel32r9r8r3argtypesr7restyper#r@r=LPDWORDr4FillConsoleOutputCharacterWrHrFPOINTERrrLrRrOr-rUrTr<rYrWr]r\rbr`rerdSetConsoleTitleWrhLPCWSTRrirkr5pip._vendor.rich.consolerconsolestdouttermrrparseheadingruleprintrrsleeprrrrrrrrrrrrrsj <<7 !V ! !&-- 0F  "BC DD ----.( %&"  ++0I&**I,,  NN !  & 8 8(// 8//00$OOX-=-=>"--x3, &JJ OO MM NNe()FNN8>>" )%(0}}$      <%ooHH OO MM NNe()FNN8>>" ($'/mm#     6"??BB OO MM%!$,==  B B-5]] B  B %ooHH OOFNN-.($'/mm# & & & #OODD OOe()&"%-MM! ? ?); ?  ?<< OOFNN&'"!)  G G.A G  G << OOFNN&'"!)  G G.A G  G??33%--.#== )3 )4 )s's'l z ^F0iG SZZ (DNN+,  /Eekk*+G LL)* MM#$ MM-  MM#$ MM-. MM12 MM9: MM-. MM;< MMKL MM;< MM34 MM12 MM34 MM34 MM;< LL+, MMOOO89DJJqMOOJDJJqMOOJDJJqMOO+,DJJqMOO-.DJJqM  MMO LL() MM=>OOUVDJJqMr"c;5;;~67DJJqMDJJqM MM89OOUVDJJqMr"c;5;;~67DJJqMDJJqM MM?@/{u{{?7STDJJqMOO $Kmr