HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/__pycache__/markup.cpython-310.pyc
o

��h!�@s�ddlZddlmZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZe�dej�Ze�d�ZGd
d�de
�Ze	eZeegefZeeegefZ e�d�j!fdede defdd�Z"dedeee#eeeeffdd�Z$			d&dede
eefde%deedef
dd�Z&e'dkr�gd�Z(dd l)m*Z*dd!l+m,Z,e,d"d#d$d%�Z-e(D]
Z.e-�/ee.�e.�q�e*e-�dSdS)'�N)�literal_eval)�
attrgetter)�Callable�Iterable�List�Match�
NamedTuple�Optional�Tuple�Union�)�_emoji_replace)�EmojiVariant)�MarkupError)�Style)�Span�Textz((\\*)\[([a-z#/@][^[]*?)])z^([\w.]*?)(\(.*?\))?$c@sJeZdZUdZeed<	eeed<	defdd�Zedefdd��Z	d	S)
�TagzA tag in console markup.�name�
parameters�returncCs"|jdur|jS|j�d|j��S)N� �rr��self�r�B/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/markup.py�__str__s��zTag.__str__cCs.|jdurd|j�d�Sd|j�d|j�d�S)z*Get the string representation of this tag.N�[�]�=rrrrr�markup!s

���z
Tag.markupN)
�__name__�
__module__�__qualname__�__doc__�str�__annotations__r	r�propertyr!rrrrrs
rz(\\*)(\[[a-z#/@][^[]*?])r!�_escapercCs@dttdtfdd�}|||�}|�d�r|�d�s|dS|S)z�Escapes text so that it won't be interpreted as markup.

    Args:
        markup (str): Content to be inserted in to markup.

    Returns:
        str: Markup with square brackets escaped.
    �matchrcSs|��\}}|�|�d|��S)z!Called by re.sub replace matches.�\)�groups)r*�backslashes�textrrr�escape_backslashes=sz"escape.<locals>.escape_backslashesr+z\\)rr&�endswith)r!r)r/rrr�escape0s

r1ccs�d}t}t}t�|�D]`}|��\}}}|��\}}	||kr)||||�dfV|rU|t|�d�\}
}|
rD|d|
dfV||
d7}|rU||t|�d�dfV|	}q|�d�\}}
}|d|||
re|nd�fV|	}q|t|�kr|||d�dfVdSdS)z�Parse markup in to an iterable of tuples of (position, text, tag).

    Args:
        markup (str): A string containing console markup

    rN�r+r )�divmodr�RE_TAGS�finditerr,�span�len�	partition)r!�position�_divmod�_Tagr*�	full_text�escapes�tag_text�start�endr-�escapedr.�equalsrrrr�_parseIs0��rC�T�style�emoji�
emoji_variantcs
t}d|vrt|r|||d�|d�S||d�St|d�}|j}tj}g��j�g}|j}	t}
t}dtdt	t
tff��fdd�}t|�D�]\}
}}|dur_|�d	d�}||r[||�n|�qD|du�rU|j
�d
��rC|j
dd���}|r�||�}z||�\}}Wn,ty�td|j�d
|
�d��d�wz��\}}Wnty�td|
�d��d�w|j
�d��r6|j�r#d}|j��}t�|�}|dur�|��\}}|dur�dn|}zt|�}Wn3ty�}ztd|�d|j�d|j����d}~wt�y}ztd|j�d|���d�d}~ww|�r"|t|t��r|n|ff}nd}|	|
|t|�t|j
|id���qD|	|
|t|�t|���qD|||j
�|j�}��t|�|f�qDt|�}��ru���\}}t|�}|�rr|	|
|||����s]t|ddd�t d�d�|_!|S)a�Render console markup in to a Text instance.

    Args:
        markup (str): A string containing console markup.
        style: (Union[str, Style]): The style to use.
        emoji (bool, optional): Also render emoji code. Defaults to True.
        emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.


    Raises:
        MarkupError: If there is a syntax error in the markup.

    Returns:
        Text: A test instance.
    r)�default_variant)rE�
style_namercs<tt��d�D]\}\}}|j|kr�|�Sqt|��)z"Pop tag matching given style name.r)�	enumerate�reversedr�KeyError)rI�index�_�tag��pop�style_stackrr�	pop_style�s

�zrender.<locals>.pop_styleNz\[�/rz
closing tag 'z' at position z doesn't match any open tagzclosing tag '[/]' at position z has nothing to close�@rDz()zerror parsing z in z; r)�meta���r?)�key)"r
r�appendr�	normalizerQrrr&r
�intrC�replacer�
startswith�striprLrr!�
IndexErrorr�
RE_HANDLERr*r,r�SyntaxError�msg�	Exception�
isinstance�tupler7�sortedr�spans)r!rErFrG�
emoji_replacer.rYrZrg�append_span�_Spanr;rSr9�
plain_textrOrIr?�open_tag�handler_namer�
handler_match�match_parameters�meta_params�error�normalized_tag�text_lengthrrPr�renderjs���
 
���
���

��������������rt�__main__)z[red]Hello World[/red]zagenta]Hello [b]World[/b]z9[bold]Bold[italic] bold and italic [/bold]italic[/italic]zDClick [link=https://www.willmcgugan.com]here[/link] to visit my Blogz+:warning-emoji: [bold red blink] DANGER![/])�print)�Table�Markup�Result)rr)�padding)rDTN)0�re�astr�operatorr�typingrrrrrr	r
rr
rFr�errorsrrErr.rr�compile�VERBOSEr4r`rr&�_ReStringMatch�_ReSubCallable�_EscapeSubMethod�subr1r[rC�boolrtr"�MARKUP�pip._vendor.richrv�pip._vendor.rich.tablerw�gridr!�add_rowrrrr�<module>sf(�

���
�(#��
���
��