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__/panel.cpython-310.pyc
o

��h�+�@sddlmZmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZmZdd	lmZdd
lmZmZddlmZmZerVddlmZmZmZmZGd
d�de�Ze dkr�ddlmZe�Z!ddlm"Z"mZddlmZeddde"dd�Z#e!�$�e!�$e#�dSdS)�)�
TYPE_CHECKING�Optional�)�AlignMethod)�ROUNDED�Box)�cell_len)�JupyterMixin)�Measurement�measure_renderables)�Padding�PaddingDimensions)�Segment)�Style�	StyleType)�Text�TextType)�Console�ConsoleOptions�RenderableType�RenderResultc @sZeZdZdZefddddddddddddd�d	d
dedeed
edeededee	de	de
de
deedeedede	ddfdd�Z
eefdddddddddddd�d	d
dedeed
edeededee	de
de
deedeedede	ddfdd��Zedeefdd��Zedeefd d!��Z	"	#	$	%		&d,d'd(�Z	"	#	$	%		)d-d*d+�ZdS).�PanelaNA console renderable that draws a border around its contents.

    Example:
        >>> console.print(Panel("Hello, World!"))

    Args:
        renderable (RenderableType): A console renderable object.
        box (Box): A Box instance that defines the look of the border (see :ref:`appendix_box`. Defaults to box.ROUNDED.
        title (Optional[TextType], optional): Optional title displayed in panel header. Defaults to None.
        title_align (AlignMethod, optional): Alignment of title. Defaults to "center".
        subtitle (Optional[TextType], optional): Optional subtitle displayed in panel footer. Defaults to None.
        subtitle_align (AlignMethod, optional): Alignment of subtitle. Defaults to "center".
        safe_box (bool, optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
        expand (bool, optional): If True the panel will stretch to fill the console width, otherwise it will be sized to fit the contents. Defaults to True.
        style (str, optional): The style of the panel (border and contents). Defaults to "none".
        border_style (str, optional): The style of the border. Defaults to "none".
        width (Optional[int], optional): Optional width of panel. Defaults to None to auto-detect.
        height (Optional[int], optional): Optional height of panel. Defaults to None to auto-detect.
        padding (Optional[PaddingDimensions]): Optional padding around renderable. Defaults to 0.
        highlight (bool, optional): Enable automatic highlighting of panel title (if str). Defaults to False.
    N�centerT�none)rrF)�title�title_align�subtitle�subtitle_align�safe_box�expand�style�border_style�width�height�padding�	highlight�
renderabler�boxrrrrrrr r!r"r#r$r%�returncCsX||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_|
|_||_
dS)N)r&r'rrrrrrr r!r"r#r$r%)�selfr&r'rrrrrrr r!r"r#r$r%�r*�A/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/panel.py�__init__(s
zPanel.__init__)rrrrrr r!r"r#r$r%cCs$||||||||||	|
|||
dd�S)z2An alternative constructor that sets expand=False.F)rrrrrr r!r"r#r$r%rr*)�clsr&r'rrrrrr r!r"r#r$r%r*r*r+�fitIs �z	Panel.fitcC�^|jr-t|jt�rt�|j�n|j��}d|_|j�dd�|_d|_	|�
�|�d�|SdS�N��
� Tr)r�
isinstance�strr�from_markup�copy�end�plain�replace�no_wrap�expand_tabs�pad)r)�
title_textr*r*r+�_titlem�
��
zPanel._titlecCr/r0)rr4r5rr6r7r8r9r:r;r<r=)r)�
subtitle_textr*r*r+�	_subtitle}r@zPanel._subtitle�consoler�optionsrrc#s��t�|j�}t|�rt|j|�n|j}��|j�}|��|j�}|jdur*|j	nt
|j	|j�}|jdur9�jn|j}|jj
||d�}	dtdtdtdtdtdtf�fdd	�}
|j}|durc|�|�|jrj|d
n�j||�|d
�d�j}|jp~|jp~d}
|
r�|
d
8}
|dur�t
|j	d
t||jd
��}|d
}|j||
|jd�}�j|||d
�}t|	j|�}t|	j �|�}t�!�}|dus�|dkr�t|	�"|d
g�|�Vn.|
||d|j#|	j$|�}t|	j%|	j$|�V��&||�|d��EdHt|	j$|	j'|�V|V|D]}|V|EdH|V|V�q|j(}|du�r$|�|�|du�s.|dk�r;t|	�)|d
g�|�Vn.|
||d|j*|	j+|�}t|	j,|	j+|�V��&||�|d��EdHt|	j+|	j-|�V|VdS)N)�safe�textr"�align�	characterr r(cs�|��}|�|�|t|j�}|jr|���|j��|rX|dkr/tj||||fddd�S|dkrK|d}tj|||f|||||fddd�Stj|||f|ddd�S|S)acGets new aligned text.

            Args:
                text (Text): Title or subtitle text.
                width (int): Desired width.
                align (str): Alignment.
                character (str): Character for alignment.
                style (Style): Border style

            Returns:
                Text: New text instance
            �leftTr1)r;r8r�)	r7�truncaterr9r �stylize�	get_styler�assemble)rFr"rGrHr �excess_spacerI�rCr*r+�
align_text�s:

�
�
�z*Panel.__rich_console__.<locals>.align_textrJ)rD)r"r#r%)r �).r�unpackr$�anyr&rMr r!r"�	max_width�minrr'�
substituter�intr5rr?�stylize_beforer�measure�update_width�maximumr#�maxr�updater%�render_linesr�mid_left�	mid_right�line�get_topr�top�top_left�render�	top_rightrB�
get_bottomr�bottom�bottom_left�bottom_right)r)rCrD�_paddingr&r r!r"rr'rQr>�child_width�child_height�
child_options�lines�
line_start�line_end�new_linerbrAr*rPr+�__rich_console__�s���
��������/

������



�
�
zPanel.__rich_console__r
c
Csz|j}t�|j�\}}}}||}|r|j|gn|jg}|jdur5t||�|j|d�|�j	|d}	n|j}	t
|	|	�S)NrJ)r?rrSr$r&r"rr[rUr\r
)
r)rCrDr?�_�rightrIr$�renderablesr"r*r*r+�__rich_measure__s$
����

zPanel.__rich_measure__)rCrrDrr(r)rCrrDrr(r
)�__name__�
__module__�__qualname__�__doc__rrrrr�boolrrXr
r,�classmethodr.�propertyrr?rBrtrxr*r*r*r+rs���������	�
���
����
�!��������	�
���
����#��
�	���r�__main__)r)�DOUBLEr)rz
Hello, World!z
rich.Panelz
white on blue)rr r'r$N)%�typingrrrGrr'rr�cellsr�jupyterr	rZr
rr$rr
�segmentrr rrrFrrrCrrrrrry�cr��p�printr*r*r*r+�<module>s<��