
    "Zj\                        d dl Z d dlZd dlZd dlZd dlmZmZmZmZ  e	ej
        d          rej
        j        ndZepdZe                                dvZdZ G d de          Zej        d	ej        d
ej        dej        ddd
dd	ddddddddddddddiZej        esdndej        esdndej        esdnd ej        esd!nd"iZd#Zd$Z	 	 	 	 dEd&ed'eeeef                  d(eeeef                  d)ed*ed+efd,ZdFd&ed.ed/ed+efd0ZdGd3ed4ed5ed+efd6Z 	 	 	 dHd8ed9ed'eeef         d(eeeef         eeef         f         d:ed+efd;Z!	 dId<ed=eeeef                  d/ed+efd>Z"dJd@edAed+efdBZ#d@ed+efdCZ$d+efdDZ%dS )K    N)AnyOptionalTupleUnionencodingascii)utf8zutf-8ANSI_COLORS_DISABLEDc                       e Zd ZdZdZdZdZdS )MESSAGESgoodfailwarninfoN)__name__
__module____qualname__GOODFAILWARNINFO     W/Users/jameslopez/projects/MentorCore/.venv/lib/python3.11/site-packages/wasabi/util.pyr   r      s"        DDDDDDr   r               redgreenyellowbluepink   cyan   white   grey   black   u   ✔z[+]u   ✘z[x]u   ⚠z[!]u   ℹz[i]+-Ftextfgbgbold	underlinereturnc                    t                               ||          }t                               ||          }t          |||g          s| S g }|r|                    d           |r|                    d           |r(|                    d                    |                     |r(|                    d                    |                     d                    d                    |          |           S )a  Color text by applying ANSI escape sequence.

    text (str): The text to be formatted.
    fg (Optional[Union[str, int]]): Optional foreground color. String name or 0 - 256 (see COLORS).
    bg (Optional[Union[str, int]]): Optional background color. String name or 0 - 256 (see COLORS).
    bold (bool): Format text in bold.
    underline (bool): Underline text.
    RETURNS (str): The formatted text.
    14z38;5;{}z48;5;{}z[{}m{}[0m;)COLORSgetanyappendformatjoin)r/   r0   r1   r2   r3   styless         r   colorr@   3   s      
B		B	B		BB~ F c c	 ,i&&r**+++	 ,i&&r**+++%%chhv&6&6===r   P   wrap_maxindentc                     |dz  }|t          |          z
  }t          |           } t          j        | |||dd          S )a$  Wrap text at given width using textwrap module.

    text (Any): The text to wrap.
    wrap_max (int): Maximum line width, including indentation. Defaults to 80.
    indent (int): Number of spaces used for indentation. Defaults to 4.
    RETURNS (str): The wrapped text with line breaks.
     F)widthinitial_indentsubsequent_indentbreak_long_wordsbreak_on_hyphens)lenstrtextwrapfill)r/   rB   rC   
indent_str
wrap_widths        r   wraprQ   S   sS     #JC
OO+Jt99D=!$   r   2   ...objmax_lenellipsisc                     t          |           }t          |          |k    r:t          |dz            }d                    |d|         ||| d                   S |S )av  Wrapper around `repr()` to print shortened and formatted string version.

    obj: The object to represent.
    max_len (int): Maximum string length. Longer strings will be cut in the
        middle so only the beginning and end is displayed, separated by ellipsis.
    ellipsis (str): Ellipsis character(s), e.g. "...".
    RETURNS (str): The formatted representation.
    r   z{} {} {}N)reprrK   intr=   )rT   rU   rV   stringhalfs        r   format_reprr\   h   s`     #YYF
6{{g7Q;  &$.IIIr   r    r   abadd_symbolsc           
         |                      d          }|                     d          }g }t          j        d||          }|                                D ]\  }	}
}}}|	dk    r"||
|         D ]}|                    |           |	dk    s|	dk    rW|||         D ]L}|rd                    t          |          n|}|                    t          |||d                              M|	d	k    s|	dk    rW||
|         D ]L}|rd                    t          |          n|}|                    t          |||d
                              Md	                    |          S )aO  Compare two strings and return a colored diff with red/green background
    for deletion and insertions.

    a (str): The first string to diff.
    b (str): The second string to diff.
    fg (Union[str, int]): Foreground color. String name or 0 - 256 (see COLORS).
    bg (Union[Tuple[str, str], Tuple[int, int]]): Background colors as
        (insert, delete) tuple of string name or 0 - 256 (see COLORS).
    add_symbols (bool): Whether to add symbols before the diff lines. Uses '+'
        for inserts and '-' for deletions. Default is False.
    RETURNS (str): The formatted diff.
    
Nequalinsertreplacez{} {}r   )r0   r1   deleter   )
splitdifflibSequenceMatcherget_opcodesr<   r=   INSERT_SYMBOLr@   DELETE_SYMBOLr>   )r^   r_   r0   r1   r`   a_listb_listoutputmatcheropcodea0a1b0b1items                  r   diff_stringsrw   y   s   & WWT]]FWWT]]FF%dFF;;G")"5"5"7"7 < <BBWr"u $ $d####X9!4!4r"u < <>ISw~~mT:::teDRBqE:::;;;;X9!4!4r"u < <>ISw~~mT:::teDRBqE:::;;;;99Vr   descriptiondefaultc                     |rd                     |          nd}t          d                     | |          |          }t          |          }|S )a  Get user input from the command line via raw_input / input.

    description (str): Text to display before prompt.
    default (Optional[Union[str, bool]]): Optional default value to display with prompt.
    indent (int): Indentation in spaces.
    RETURNS (str): User input.
    z (default: {}) z{}{}: )rC   )r=   rQ   input)rx   ry   rC   
additionalprompt
user_inputs         r   get_raw_inputr      sS     6=D!((111"J(//+z::6JJJFvJr   re   rZ   errorsc                     t          |           } |                     t          |                              d          } | S )zMangle non-supported characters, for savages with ASCII terminals.

    string (Any): The string to escape.
    errors (str): The str.encode errors setting. Defaults to `"replace"`.
    RETURNS (str): The escaped string.
    r	   )rL   encodeENCODINGdecode)rZ   r   s     r   locale_escaper      s5     [[F]]8V,,33F;;FMr   c                 ^    	 |                      t                     dS # t          $ r Y dS w xY w)zCheck if terminal can render unicode characters, e.g. special loading
    icons. Can be used to display fallbacks for ASCII terminals.

    string (str): The string to render.
    RETURNS (bool): Whether the terminal can render the text.
    TF)r   r   UnicodeEncodeError)rZ   s    r   
can_renderr      s@    ht   uus    
,,c                      t          j        t                    rdS 	 ddlm}   |              n1# t
          $ r$ t          j        dk    rdt           j        vrY dS Y nw xY wdS )zReturns True if the running system's terminal supports ANSI escape
    sequences for color, formatting etc. and False otherwise.

    RETURNS (bool): Whether the terminal supports ANSI colors.
    Fr   just_fix_windows_consolewin32ANSICONT)	osgetenvENV_ANSI_DISABLEDcoloramar   ImportErrorsysplatformenvironr   s    r   supports_ansir      s     
y"## u#555555
 	! """"	    <7""y
'B'B55
 4s   . (AA)NNFF)rA   r   )rR   rS   )r+   r]   F)Fr   )re   )&rh   r   r   rM   typingr   r   r   r   hasattrstdoutr   STDOUT_ENCODINGr   lowerNO_UTF8r   objectr   r   r   r   r   r9   ICONSrk   rl   rL   rY   boolr@   rQ   r\   rw   r   r   r   r   r   r   r   <module>r      s    				 



  . . . . . . . . . . . .)0Z)H)HR#*%%d%g
..

"3
3 +     v    M1M1M1M1	1Qa
A
A
AQ
AR
$ M7588M7588M7588M7588		 
 %)$(> >
>sCx!> 	sCx!> 	>
 > 	> > > >@ s c  C    * S 3 s s    ( "2B# #
#
# 	c3h# 	eCHouS#X./	#
 # 	# # # #N RS 'c4i(89KN    	 	# 	s 	3 	 	 	 	s t    t      r   