%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/rich/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/rich/__pycache__/console.cpython-312.pyc

�

"T�e��
��UddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZddlmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZmZmZdd
lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.ej^dk\rddlm0Z0m1Z1m2Z2n
ddl3m0Z0m1Z1m2Z2ddl4m5Z5m6Z6ddl7m7Z7ddl8m9Z9m:Z:ddl;m<Z<ddl=m>Z>m?Z?ddl@mAZAmBZBddlCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLddlMmNZOddlPmQZQmRZRddlSmTZTmUZUddlVmWZWmXZXdd lYmZZZdd!l[m\Z\dd"l]m^Z^dd#l_m`Z`dd$lambZbdd%lcmdZdmeZedd&lfmgZgdd'lhmiZimjZjmkZkdd(llmmZmmnZndd)lompZpmqZqerdd*lrmsZsdd+ltmuZudd,lvmwZwd-Zxd.Zyej��d/k(Z{e!e+e|d0fgd0fZ}e0d1Z~e0d2ZGd3�d4�Z�e��Z�	e�j�j�Z�	e�j�j�Z�	e�j�j�Z�e�e�e�fZ�e�e�fZ�eD�jeD�jeD�jd6�Z�Gd7�d8e&�Z�e
Gd9�d:��Z�e2Gd;�d<e1��Z�e2Gd=�d>e1��Z�e+e�e�e|fZ�	e#e+e�ebfZ�eK�Z�Gd?�d@e��Z�GdA�dB�Z�GdC�dD�Z�GdE�dF�Z�GdG�dH�Z�GdI�dJ�Z�GdK�dL�Z�GdM�dN�Z�ddPe�dQe!dRe!dRe�fffdS�Z�dQe�fdT�Z�eD�jeD�jeD�jBeDj�dU�Z�e��jG�D��cic]\}}||��
c}}Z�e
GdV�dWe�jJ��Z�GdX�dYe�Z�da�e'dZe�d[<d�d\�Z�dQe�fd]�Z�Gd^�d_�Z�d`e|dQe|fda�Z�e�dbk(rve�dO�c�Z�e��jadddedfdOdgddhdidjdkdl�dmdn��e��jadodpe�e���e��jedgdOdqgdr�dsdt�du�dgdvgdw�dxdt�dygdz�d{dt�d|�d}�d~��yy#e�$rdZ�Y��QwxYw#e�$rdZ�Y��BwxYw#e�$rd5Z�Y��3wxYwcc}}w)��N)�ABC�abstractmethod)�	dataclass�field)�datetime)�wraps)�getpass)�escape)�isclass)�islice)�ceil)�	monotonic)�	FrameType�
ModuleType�
TracebackType)�IO�
TYPE_CHECKING�Any�Callable�Dict�Iterable�List�Mapping�
NamedTuple�Optional�TextIO�Tuple�Type�Union�cast)�	NULL_FILE)��)�Literal�Protocol�runtime_checkable�)�errors�themes)�_emoji_replace)�CONSOLE_HTML_FORMAT�CONSOLE_SVG_FORMAT)�
get_fileno)�FormatTimeCallable�	LogRender)�Align�AlignMethod)�ColorSystem�	blend_rgb)�Control)�EmojiVariant)�NullHighlighter�ReprHighlighter��render)�Measurement�measure_renderables)�Pager�SystemPager)�Pretty�
is_expandable)�	rich_cast)�Region)�render_scope)�Screen)�Segment)�Style�	StyleType)�Styled)�DEFAULT_TERMINAL_THEME�SVG_EXPORT_THEME�
TerminalTheme)�Text�TextType)�Theme�
ThemeStack)�WindowsConsoleFeatures)�Live��Status�s�d�WindowsrK)�default�left�center�right�full)�fold�crop�ellipsis�ignorec��eZdZy)�NoChangeN)�__name__�
__module__�__qualname__���./usr/lib/python3/dist-packages/rich/console.pyr`r`Vs��rer`�)�kitty�256color�16colorc�(�eZdZUdZeed<	eed<y)�ConsoleDimensionszSize of the terminal.�width�heightN)rarbrc�__doc__�int�__annotations__rdrerfrlrlts����J�.��K�-rerlc��eZdZUdZeed<	eed<	eed<	eed<	eed<	eed<	eed<	d	Z	e
eed
<	d	Ze
e
ed<	dZe
eed
<	d	Ze
eed<	d	Ze
eed<	d	Ze
eed<edefd��Zdd�Zeeeeeeeeed�	deeefdeeefdeeefd
ee
eefdee
e
efd
ee
eefdee
eefdee
eefdee
eefddfd�Zdeddfd�Zdeddfd�Zdd�Zdededdfd�Zy	)�ConsoleOptionsz$Options for __rich_console__ method.�size�legacy_windows�	min_width�	max_width�is_terminal�encoding�
max_heightN�justify�overflowF�no_wrap�	highlight�markuprn�returnc�:�|jjd�S)z+Check if renderables should use ascii only.�utf)ry�
startswith��selfs rf�
ascii_onlyzConsoleOptions.ascii_only�s���=�=�+�+�E�2�2�2rec�v�tjt�}|jj�|_|S)zdReturn a copy of the options.

        Returns:
            ConsoleOptions: a copy of self.
        )rs�__new__�__dict__�copy�r��optionss  rfr�zConsoleOptions.copy�s.��#1�"8�"8��"H���=�=�-�-�/����re)	rmrvrwr{r|r}r~rrnrmc	��|j�}
t|t�std|�x|
_|
_t|t�s||
_t|t�s||
_t|t�s||
_t|t�s||
_t|t�s||
_t|t�s||
_	t|t�s||
_
t|	t�s|	�|	|
_|	�dntd|	�|
_|
S)zUpdate values, return a copy.rN)
r��
isinstancer`�maxrvrwr{r|r}r~rrzrn)r�rmrvrwr{r|r}r~rrnr�s           rf�updatezConsoleOptions.update�s����)�)�+���%��*�47��5�M�A�G��� 1��)�X�.� )�G���)�X�.� )�G���'�8�,�%�G�O��(�H�-�'�G���'�8�,�%�G�O��)�X�.� )�G���&�(�+�#�G�N��&�(�+��!�%+��"�%+�^�T��Q���G�N��rec�V�|j�}td|�x|_|_|S)z�Update just the width, return a copy.

        Args:
            width (int): New width (sets both min_width and max_width)

        Returns:
            ~ConsoleOptions: New console options instance.
        r)r�r�rvrw)r�rmr�s   rf�update_widthzConsoleOptions.update_width�s*���)�)�+��03�A�u�
�=���G�-��rec�B�|j�}|x|_|_|S)z�Update the height, and return a copy.

        Args:
            height (int): New height

        Returns:
            ~ConsoleOptions: New Console options instance.
        )r�rzrn)r�rnr�s   rf�
update_heightzConsoleOptions.update_height�s#���)�)�+��.4�4���W�^��rec�4�|j�}d|_|S)z�Return a copy of the options with height set to ``None``.

        Returns:
            ~ConsoleOptions: New console options instance.
        N)r�rnr�s  rf�reset_heightzConsoleOptions.reset_height�s���)�)�+������rec�r�|j�}td|�x|_|_|x|_|_|S)aUpdate the width and height, and return a copy.

        Args:
            width (int): New width (sets both min_width and max_width).
            height (int): New height.

        Returns:
            ~ConsoleOptions: New console options instance.
        r)r�r�rvrwrnrz)r�rmrnr�s    rf�update_dimensionsz ConsoleOptions.update_dimensions�s9���)�)�+��03�A�u�
�=���G�-�.4�4����+��re)r�rs)rarbrcrorlrq�boolrp�strr{r�
JustifyMethodr|�OverflowMethodr}r~rrn�propertyr�r��	NO_CHANGErr`r�r�r�r�r�rdrerfrsrs}s��.�
�����2��N�&��N�&���<��M���O�2�'+�G�X�m�
$�+�0�)-�H�h�~�&�-�1�#�G�X�d�^�#�$� $�I�x��~�$�,�!�F�H�T�N�!�/� �F�H�S�M� �
�3�D�3��3��'0�*3�*3�<E�>G�3<�5>�2;�1:�#��S�(�]�#�#���h��'�	#�
��h��'�#��x�
�.��8�9�
#����0�(�:�;�#��x��~�x�/�0�#���$���1�2�#��h�t�n�h�.�/�#��h�s�m�X�-�.�#�
�#�J�#��*:���C��,<���
�s�
�C�
�<L�
rersc�(�eZdZdZdeddeffd�Zy)�RichCastz5An object that may be 'cast' to a console renderable.r��ConsoleRenderablec��y�Nrdr�s rf�__rich__zRichCast.__rich__���	reN)rarbrcrorr�r�rdrerfr�r�s��?��	�"�J��3�	4�rer�c�$�eZdZdZ						dd�Zy)r�z-An object that supports the console protocol.c��yr�rd�r��consoler�s   rf�__rich_console__z"ConsoleRenderable.__rich_console__r�reN)r��Consoler�rsr��RenderResult)rarbrcror�rdrerfr�r�
s"��7�� ��+;��	�rer�c��eZdZdZy)�CaptureErrorz(An error in the Capture context manager.N)rarbrcrordrerfr�r�!s��2rer�c�<�eZdZdZddeddfd�Zdddd	deefd
�Zy)�NewLinez$A renderable to generate new line(s)�countr�Nc��||_yr�)r��r�r�s  rf�__init__zNewLine.__init__(s	����
rer�r�r�rsc#�@K�td|jz���y�w)N�
)rDr�r�s   rfr�zNewLine.__rich_console__+s�����d�T�Z�Z�'�(�(�s��r')	rarbrcrorpr�rrDr�rdrerfr�r�%s:��.��c��$��)� �)�+;�)�	�'�	�)rer�c�H�eZdZdZdeeedededdfd�Zdd	d
ede	fd�Z
y)�ScreenUpdatez)Render a list of lines at a given offset.�lines�x�yr�Nc�.�||_||_||_yr�)�_linesr�r�)r�r�r�r�s    rfr�zScreenUpdate.__init__4s����������rer�r�r�c#��K�|j}tj}t|j|j
�D]\}}|||���|Ed{����y7��wr�)r�r4�move_to�	enumerater�r�)r�r�r�r�r��offset�lines       rfr�zScreenUpdate.__rich_console__9sS����
�F�F���/�/��%�d�k�k�4�6�6�:�	�L�F�D��!�V�$�$��O�O�	��s�AA�A�A)rarbrcrorrDrpr�rsr�r�rdrerfr�r�1sL��3��d�4��=�1��c��c��d��
� ��+9��	�rer�c�\�eZdZdZdd�Zdd�Zdeeedeedee	ddfd	�Z
defd
�Zy)
�Capturez�Context manager to capture the result of printing to the console.
    See :meth:`~rich.console.Console.capture` for how to use.

    Args:
        console (Console): A console instance to capture output.
    r�Nc� �||_d|_yr�)�_console�_result)r�r�s  rfr�zCapture.__init__Ks����
�&*��rec�:�|jj�|Sr�)r��
begin_capturer�s rf�	__enter__zCapture.__enter__O����
�
�#�#�%��re�exc_type�exc_val�exc_tbc�B�|jj�|_yr�)r��end_capturer��r�r�r�r�s    rf�__exit__zCapture.__exit__Ss���}�}�0�0�2��rec�H�|j�td��|jS)zGet the result of the capture.z<Capture result is not available until context manager exits.)r�r�r�s rf�getzCapture.get[s(���<�<���N��
��|�|�re)r�r�r�N)r�r�)
rarbrcror�r�rr�
BaseExceptionrr�r�r�rdrerfr�r�Cs\���+��3��4�
�.�/�3��-�(�3���'�	3�

�3��S�rer�c	�b�eZdZdZddddededdfd�Zdd	�Zd
ee	e
dee
deeddfd
�Zy)�ThemeContextzbA context manager to use a temporary theme. See :meth:`~rich.console.Console.use_theme` for usage.r�r��theme�inheritr�Nc�.�||_||_||_yr�)r�r�r�)r�r�r�r�s    rfr�zThemeContext.__init__gs�������
���rec�P�|jj|j�|Sr�)r��
push_themer�r�s rfr�zThemeContext.__enter__ls��������
�
�+��rer�r�r�c�8�|jj�yr�)r��	pop_themer�s    rfr�zThemeContext.__exit__ps��	
����� re�T)r�r�)
rarbrcrorMr�r�r�rrr�rr�rdrerfr�r�dsk��l��	��%��$��RV��
�!��4�
�.�/�!��-�(�!���'�	!�

�!rer�c�r�eZdZdZ			ddddeedededdf
d	�Zdd
�Zdee	e
dee
d
eeddfd�Zy)�PagerContextzZA context manager that 'pages' content. See :meth:`~rich.console.Console.pager` for usage.Nr�r��pager�styles�linksr�c�T�||_|�
t�n||_||_||_yr�)r�r=r�r�r�)r�r�r�r�r�s     rfr�zPagerContext.__init__|s(�� ��
�&+�m�[�]���
������
rec�:�|jj�|Sr�)r��
_enter_bufferr�s rfr�zPagerContext.__enter__�r�rer�r�r�c���|��|jj5|jjdd}|jjdd�=|}|jst	j
|�}n!|jst	j|�}|jj|�}ddd�|jj�|jj�y#1swY�?xYwr�)r��_lock�_bufferr�rD�strip_stylesr��strip_links�_render_bufferr��show�_exit_buffer)r�r�r�r��buffer�segments�contents       rfr�zPagerContext.__exit__�s��������$�$�
A�(,�
�
�(=�(=�a�(@���M�M�)�)�!�,�.4���{�{�&�3�3�H�=�H����&�2�2�8�<�H��-�-�6�6�x�@��
A�
�J�J�O�O�G�$��
�
�"�"�$�
A�
A�s�BC*�*C3�NFF)r�r�)
rarbrcrorr<r�r�r�rr�rr�rdrerfr�r�ys���d�
"&���
��
����
��	
�
�
�
�
��%��4�
�.�/�%��-�(�%���'�	%�

�%rer�c	��eZdZdZ	ddddededdfd�Zdd	�d
edeeddfd�Z	dd�Z
d
eeedeedee
ddfd�Zy)�
ScreenContextziA context manager that enables an alternative screen. See :meth:`~rich.console.Console.screen` for usage.r�r��hide_cursor�styler�Nc�P�||_||_t|��|_d|_y)N�r�F)r�r�rC�screen�_changed)r�r�r�r�s    rfr�zScreenContext.__init__�s&�����&����5�)�����
rer��renderablesc���|r*t|�dkDrt|�n|d|j_|�||j_|j
j
|jd��y)a+Update the screen.

        Args:
            renderable (RenderableType, optional): Optional renderable to replace current renderable,
                or None for no change. Defaults to None.
            style: (Style, optional): Replacement style, or None for no change. Defaults to None.
        r'rN�)�end)�len�Groupr��
renderabler�r��print)r�r�r�s   rfr�zScreenContext.update�s\���'*�;�'7�!�';��{�#��Q��
�K�K�"��� %�D�K�K�������4�;�;�B��/rec��|jjd�|_|jr'|jr|jj	d�|S)NTF)r��set_alt_screenr�r��show_cursorr�s rfr�zScreenContext.__enter__�s>�����3�3�D�9��
��=�=�T�-�-��L�L�$�$�U�+��rer�r�r�c��|jrD|jjd�|jr|jj	d�yyy)NFT)r�r�rr�rr�s    rfr�zScreenContext.__exit__�sB���=�=��L�L�'�'��.�������(�(��.� �re�r�)r�r�)rarbrcror�rFr��RenderableTyperr�r�rr�rr�rdrerfr�r��s���s�IK�� ��/3��<E��	
��JN�0�*�0�3;�I�3F�0�	
�0�$�	/��4�
�.�/�	/��-�(�	/���'�		/�

�	/rer�c�n�eZdZdZdd�dddeddfd	�Zededfd
��Z						dd�Z	ddd
dde
fd�Zy)ra$Takes a group of renderables and returns a renderable object that renders the group.

    Args:
        renderables (Iterable[RenderableType]): An iterable of renderable objects.
        fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.
    T)�fitr�r
rr�Nc�.�||_||_d|_yr�)�_renderablesr�_render)r�rr�s   rfr�zGroup.__init__�s��'������7;��rec�f�|j�t|j�|_|jSr�)r�listrr�s rfr�zGroup.renderables�s(���<�<���� 1� 1�2�D�L��|�|�rer�r�r�rsc��|jrt|||j�St|j|j�Sr�)rr;r�r:rwr�s   rf�__rich_measure__zGroup.__rich_measure__�s9���8�8�&�w���9I�9I�J�J��w�0�0�'�2C�2C�D�Drec#�8K�|jEd{���y7��wr�)r�r�s   rfr�zGroup.__rich_console__�s�����#�#�#�#�s���)r�r�r�rsr�r:)rarbrcror�r�r�rr�rr�r�rdrerfrr�s����DH�<�%5�<�D�<�D�<�
��T�"2�3����
E� �E�+;�E�	�E�$� �$�+;�$�	�$rerTrr�.c�^��dtdttfdtdtff�fd�}|S)z�A decorator that turns an iterable of renderables in to a group.

    Args:
        fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.
    �method.r�c�X���t��dtdtdtf��fd��}|S)zGConvert a method that returns an iterable of renderables in to a Group.�args�kwargsr�c�*���|i|��}t|d�i�S)Nr)r)rrr�rrs   ��rf�_replacez*group.<locals>.decorator.<locals>._replace�s"��� �$�1�&�1�K��+�/�3�/�/re)rrr)rrrs` �rf�	decoratorzgroup.<locals>.decorator�s7���

�v��	0�C�	0�3�	0�5�	0�
�	0��re)rrr
r)rrs` rf�groupr�s8���
���h�~�6�6�7�
�	�#�u�*�	�
��rec���	tt�}|jj}dt	|j�vstjd�s|dk(ry|dk(ryy#t$rYywxYw)z-Check if we're running in a Jupyter notebook.Fzgoogle.colab�DATABRICKS_RUNTIME_VERSION�ZMQInteractiveShellT�TerminalInteractiveShell)�get_ipython�	NameError�	__class__rar��os�getenv)�ipython�shells  rf�_is_jupyterr)ss�����m�G����&�&�E��#�g�/�/�0�0�
�9�9�1�2��)�)��	�,�	,��������s�A!�!	A-�,A-)�standard�256�	truecolor�windowsc�L�eZdZUdZeed<ee��Ze	e
ed<dZeed<y)�ConsoleThreadLocalsz(Thread local values for Console context.�theme_stack)�default_factoryr�r�buffer_indexN)
rarbrcrorNrqrrr�rrDr2rprdrerfr/r/$s(��2���!�$�7�F�D��M�7��L�#�rer/c�6�eZdZdZedeedeefd��Zy)�
RenderHookz(Provides hooks in to the render process.r�r�c��y)aLCalled with a list of objects to render.

        This method can return a new list of renderables, or modify and return the same list.

        Args:
            renderables (List[ConsoleRenderable]): A number of renderable objects.

        Returns:
            List[ConsoleRenderable]: A replacement list of renderables.
        Nrd)r�r�s  rf�process_renderableszRenderHook.process_renderables0s�reN)rarbrcrorrr�r6rdrerfr4r4-s3��2���� 1�2��	
��	 ���rer4rO�_windows_console_featuresc�@�t�tSddlm}|�atS)Nr'��get_windows_console_features)r7�_windowsr:r9s rfr:r:Cs �� �,�(�(�6� <� >��$�$rec�<�txrt�jS)zDetect legacy Windows.)�WINDOWSr:�vtrdrerf�detect_legacy_windowsr?Ms���<�7�9�<�<�<�<rec<�n�eZdZUdZej
Zeeefe	d<dddddddddddddddddddddde
�dddddd	�d
eeddee
d
ee
dee
de
deede
deeede
deedeedeedee
dede
de
de
deede
de
de
d eeefd!ed"d#ee
d$e
d%eegefd&eegefdeeeeff8d'�Zd(efd)�Zed(eefd*��Zej8d+eed(dfd,��Zed(eefd-��Zed(efd.��Z e j8d/ed(dfd0��Z ed(e!fd1��Z"d(ee#fd2�Z$d�d3�Z%d�d4�Z&d�d5�Z'd�d6�Z(d7e)d(dfd8�Z*d�d9�Z+d�d:�Z,d;e-d<e-d=e-d(dfd>�Z.d�d?�Z/d(efd@�Z0ddA�dedBe
d(dfdC�Z1d�dD�Z2ddA�dedBe
d(e3fdE�Z4ed(eefdF��Z5ed(efdG��Z6ed(e
fdH��Z7ed(e
fdI��Z8ed(e9fdJ��Z:ed(e;fdK��Z<e<j8dLe=eefd(dfdM��Z<ed(efdN��Z>e>j8ded(dfdO��Z>ed(efdP��Z?e?j8ded(dfdQ��Z?d�dR�Z@d(eAfdS�ZB	d�dTeeCdUe
dVe
d(eDfdW�ZEd�dYed(dfdZ�ZFd�d[e
d(dfd\�ZGd]d^d_d`da�dbeHdceddedeedfed(dgfdh�ZId�die
d(e
fdj�ZJd�dke
d(e
fdl�ZKed(e
fdm��ZLdned(e
fdo�ZM	d�dpe
deed(dqfdr�ZNdds�dteHduee9d(eOfdv�ZP	d�dteHduee9d(eQefdw�ZR	d�ddddx�dteHduee9deeSdye
dze
d(eeefd{�ZTd|ddddddd}�d~edeeeSfdeeUd�eeVdee
dee
dee
d!eeWd(d�fd��ZXdd��d�eeeSfd�eeeSefd(eSfd��ZYddddd��d�eQe-d�ed�edeeUdee
dee
dee
d(eeZfd��Z[	d�d�d�d�d��dne\d�edeeeSfd�e]d(df
d��Z^d�e_d(dfd��Z`d�d�ddd��d�e-d�ed�edeeeeSfdee
d(dfd��Zad�d�ddddddddddddd��d�e-d�ed�edeeeeSfdeeUd�eeVd�ee
dee
dee
dee
deedeed�e
dee
d�e
d(df d��Zb	d�dd�dddddddd��	d�eed�e-d�edeefde
d�e
d�e
d�e
d�e
d�eee-ge-fd�e
d(dfd��Zcddd��dteHd�eedduee9d(dfd��Ze	d�d�eeed�ed�ed(dfd��Zfd�d�dddd�d�d��deed�edeed�e
d�e
d�eQeeegfd�ed(dfd��Zheiejj�fd�ed�egeelfd(e=eeemee-fffd���Znd�d�dddddddXd��	d�e-d�ed�edeeeeSfdeeUdee
dee
dee
d�e
d�ed(dfd��Zod�d��Zpd�eQed(efdÄZq	d�dddddĜd�e\de
de
d�e
d�eerd(efdȄZsdddɜd�e
dUe
d(efd˄Ztdddɜd�ed�e
dUe
d(dfd̈́ZudddddΜdeevd�e
d�eed�e
d(ef
dфZwddexddΜd�edeevd�e
d�ed�e
d(dfd҄Zyd�ddezd�dd՜dnedeevd�e
d�ed�ed�eed(efd؄Z{d�ddezd�dd՜d�ednedeevd�e
d�ed�ed�eed(dfdلZ|y)�r�arA high level console interface.

    Args:
        color_system (str, optional): The color system supported by your terminal,
            either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect.
        force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None.
        force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None.
        force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None.
        soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False.
        theme (Theme, optional): An optional style theme object, or ``None`` for default theme.
        stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False.
        file (IO, optional): A file object where the console should write to. Defaults to stdout.
        quiet (bool, Optional): Boolean to suppress all output. Defaults to False.
        width (int, optional): The width of the terminal. Leave as default to auto-detect width.
        height (int, optional): The height of the terminal. Leave as default to auto-detect height.
        style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None.
        no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None.
        tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8.
        record (bool, optional): Boolean to enable recording of terminal output,
            required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False.
        markup (bool, optional): Boolean to enable :ref:`console_markup`. Defaults to True.
        emoji (bool, optional): Enable emoji code. Defaults to True.
        emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
        highlight (bool, optional): Enable automatic highlighting. Defaults to True.
        log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True.
        log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True.
        log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ".
        highlighter (HighlighterType, optional): Default highlighter.
        legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``.
        safe_box (bool, optional): Restrict box options that don't render on legacy Windows.
        get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log),
            or None for datetime.now.
        get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic.
    �_environ�autoNFr#Tz[%X])�color_system�force_terminal�
force_jupyter�force_interactive�	soft_wrapr��stderr�file�quietrmrnr��no_color�tab_size�recordr�emoji�
emoji_variantr~�log_time�log_path�log_time_format�highlighterru�safe_box�get_datetime�get_timerArC)rBr*r+r,r-rDrErFrGr�rHrIrJrmrnr�rKrLrMrrNrOr~rPrQrRrS�HighlighterTyperurTrUrVc���|�||_|�
t�n||_|jr�|
�?|jjd�}|�|j	�rt|�}
nt}
|�?|jjd�}|�|j	�rt|�}nt}||_||_	||_
||_||_||_
|�t�xr|jn||_|
�E|jjd�}|�(|j	�rt|�|jz
}
|�8|jjd�} | �| j	�rt| �}||_|
|_||_|d|_|�||_||_|	|_||_|�d|_n)|dk(r|j1�|_nt2||_t5j6�|_t;|||��|_|xst>|_ ||_!|xstDjF|_$|xstJ|_&||_'|
�|
n
d|jv|_(|�|jRxr|jTn||_+t5j6�|_,t[t]|�t^j`n|���|_1g|_2g|_3d|_4d	|_5y)
N�JUPYTER_COLUMNS�
JUPYTER_LINES�COLUMNS�LINESrB)�	show_time�	show_path�time_format�NO_COLOR)r0F)6rAr)�
is_jupyterr��isdigitrp�JUPYTER_DEFAULT_COLUMNS�JUPYTER_DEFAULT_LINESrLrM�_markup�_emoji�_emoji_variant�
_highlightr?rurG�_width�_height�_force_terminal�_filerJrH�
_color_system�_detect_color_system�
COLOR_SYSTEMS�	threading�RLockr�r/�_log_render�_null_highlighterrSrTr�nowrUrrVr�rKrx�is_dumb_terminal�is_interactive�_record_buffer_lockr/rNr)�DEFAULT�_thread_locals�_record_buffer�
_render_hooks�_live�_is_alt_screen)!r�rCrDrErFrGr�rHrIrJrmrnr�rKrLrMrrNrOr~rPrQrRrSrurTrUrVrA�jupyter_columns�
jupyter_lines�columnsr�s!                                 rfr�zConsole.__init__xs���F��$�D�M�+8�+@�+�-�m����?�?��}�"&�-�-�"3�"3�4E�"F��"�.�?�3J�3J�3L���0�E�3�E��~� $�
�
� 1� 1�/� B�
� �,��1F�1F�1H� ��/�F�2�F� ��
����������6C���#����%�#�
$�
<�T�_�_�)<��	
���=��m�m�'�'�	�2�G��"�w���'8��G��t�':�':�:���>��M�M�%�%�g�.�E�� �U�]�]�_��U���"����������#����%�#1�D� ���
���
������!%�D��
�V�
#�!%�!:�!:�!<�D��!.�|�!<�D���_�_�&��
�$���'�
���
-8�,L�;L��� ��
�(�8�H�L�L��� �-�I��
���
� �,�H�*��
�
�2M�	
�
�
!�(��
�
�
;�d�&;�&;�";�"�	
��$-�?�?�#4�� �1�"�U�]�6�>�>��N�
���.0���/1���'+��
�#��rer�c�<�d|j�d|j�d�S)Nz<console width=� �>)rmrmr�s rf�__repr__zConsole.__repr__�s"�� �����A�d�.@�.@�-C�1�E�Erec��|jxs,|jrtjntj}t	|d|�}|�t
}|S)z Get the file object to write to.�rich_proxied_file)rlrH�sys�stdout�getattrr!)r�rIs  rfrIzConsole.file�s@���z�z�H�D�K�K�c�j�j�S�Z�Z���t�0�$�7���<��D��re�new_filec��||_y)zSet a new file object.N)rl)r�r�s  rfrIzConsole.files����
rec�.�|jjS�zGet a thread local buffer.)ryr�r�s rfr�zConsole._buffers���"�"�)�)�)rec�.�|jjSr��ryr2r�s rf�
_buffer_indexzConsole._buffer_index
s���"�"�/�/�/re�valuec�&�||j_yr�r�)r�r�s  rfr�zConsole._buffer_indexs��+0����(rec�.�|jjS)z!Get the thread local theme stack.)ryr0r�s rf�_theme_stackzConsole._theme_stacks���"�"�.�.�.rec��|jrtjS|jr|jryt
rR|jrtj
St�}|jrtjStjS|jjdd�j�j�}|dvrtjS|jjdd�j�j�}|jd�\}}}tj|tj �}|S)z"Detect color system from env vars.N�	COLORTERMr�)r,�24bit�TERM�-)rar2�	TRUECOLORrxrur=rur:r,�	EIGHT_BITrAr��strip�lower�
rpartition�_TERM_COLORS�STANDARD)r��windows_console_features�
color_term�term�
_term_name�_hyphen�colorsrCs        rfrnzConsole._detect_color_systems���?�?��(�(�(����4�#8�#8����"�"�"�*�*�*�'C�'E�$�,�5�5��%�%�
�!�*�*�
����*�*�;��;�A�A�C�I�I�K�J��3�3�"�,�,�,��=�=�$�$�V�R�0�6�6�8�>�>�@�D�*.�/�/�#�*>�'�J���'�+�+�F�K�4H�4H�I�L��rec�.�|xjdz
c_y)z4Enter in to a buffer context, and buffer all output.r'N)r�r�s rfr�zConsole._enter_buffer0s�����a��rec�N�|xjdzc_|j�y)z5Leave buffer context, and render content if required.r'N)r��
_check_bufferr�s rfr�zConsole._exit_buffer4s�����a������rec��|j5|j�tjd��||_ddd�y#1swYyxYw)z�Set Live instance. Used by Live context manager.

        Args:
            live (Live): Live instance using this Console.

        Raises:
            errors.LiveError: If this Console has a Live context currently active.
        Nz+Only one live display may be active at once)r�r|r(�	LiveError)r��lives  rf�set_livezConsole.set_live9sC���Z�Z�	��z�z�%��&�&�'T�U�U��D�J�	�	�	�s	�)?�Ac�T�|j5d|_ddd�y#1swYyxYw)zClear the Live instance.N)r�r|r�s rf�
clear_livezConsole.clear_liveGs%��
�Z�Z�	��D�J�	�	�	�s��'�hookc�|�|j5|jj|�ddd�y#1swYyxYw)zpAdd a new render hook to the stack.

        Args:
            hook (RenderHook): Render hook instance.
        N)r�r{�append)r�r�s  rf�push_render_hookzConsole.push_render_hookLs4���Z�Z�	,����%�%�d�+�	,�	,�	,�s�2�;c�z�|j5|jj�ddd�y#1swYyxYw)z'Pop the last renderhook from the stack.N)r�r{�popr�s rf�pop_render_hookzConsole.pop_render_hookUs0��
�Z�Z�	%����"�"�$�	%�	%�	%�s�1�:c�&�|j�|S)z,Own context manager to enter buffer context.�r�r�s rfr�zConsole.__enter__Zs�������rer��	exc_value�	tracebackc�$�|j�y)zExit buffer context.N)r�)r�r�r�r�s    rfr�zConsole.__exit___s�����rec�$�|j�y)z`Begin capturing console output. Call :meth:`end_capture` to exit capture mode and return output.Nr�r�s rfr�zConsole.begin_capturecs�����rec�z�|j|j�}|jdd�=|j�|S)zhEnd capture mode and return captured string.

        Returns:
            str: Console output.
        N)r�r�r�)r��
render_results  rfr�zConsole.end_capturegs5���+�+�D�L�L�9�
��L�L��O������re�r�r�c�>�|jj||��y)a�Push a new theme on to the top of the stack, replacing the styles from the previous theme.
        Generally speaking, you should call :meth:`~rich.console.Console.use_theme` to get a context manager, rather
        than calling this method directly.

        Args:
            theme (Theme): A theme instance.
            inherit (bool, optional): Inherit existing styles. Defaults to True.
        r�N)r�r��r�r�r�s   rfr�zConsole.push_themers��	
���$�$�U�G�$�<rec�8�|jj�y)z9Remove theme from top of stack, restoring previous theme.N)r�r�r�s rfr�zConsole.pop_theme}s�����#�#�%rec��t|||�S)aUse a different theme for the duration of the context manager.

        Args:
            theme (Theme): Theme instance to user.
            inherit (bool, optional): Inherit existing console styles. Defaults to True.

        Returns:
            ThemeContext: [description]
        )r�r�s   rf�	use_themezConsole.use_theme�s���D�%��1�1rec�B�|j�t|jSy)zpGet color system string.

        Returns:
            Optional[str]: "standard", "256" or "truecolor".
        N)rm�_COLOR_SYSTEMS_NAMESr�s rfrCzConsole.color_system�s$�����)�'��(:�(:�;�;�rec�T�t|jdd�xsdj�S)zGet the encoding of the console file, e.g. ``"utf-8"``.

        Returns:
            str: A standard encoding string.
        ry�utf-8)r�rIr�r�s rfryzConsole.encoding�s%����	�	�:�w�7�B�7�I�I�K�Krec��|j�|jSttjd�r*tjjjd�ry|jry|jjd�}|�d|_yt|jdd�}	|�dS|�S#t$rYywxYw)z�Check if the console is writing to a terminal.

        Returns:
            bool: True if the console writing to a device capable of
            understanding terminal codes, otherwise False.
        Nrb�idlelibF�FORCE_COLORT�isatty)rk�hasattrr��stdinrbr�rarAr�r�rI�
ValueError)r��force_colorr�s   rfrxzConsole.is_terminal�s������+��'�'�'��3�9�9�l�+��	�	�0D�0D�0O�0O��1
���?�?���m�m�'�'�
�6���"�#'�D� ��/6�t�y�y�(�D�/Q��	�"�N�5�8���8���	��		�s�'B2�+B2�2	B>�=B>c�~�|jjdd�}|j�dv}|jxr|S)zxDetect dumb terminal.

        Returns:
            bool: True if writing to a dumb terminal, otherwise False.

        r�r�)�dumb�unknown)rAr�r�rx)r��_term�is_dumbs   rfruzConsole.is_dumb_terminal�s<���
�
�!�!�&�"�-���+�+�-�#6�6�����+�G�+rec	��t|jj|j|jd|j|j
|j��S)zGet default console options.r')rzrtrurvrwryrx)rsrtrnrurmryrxr�s rfr�zConsole.options�sH����y�y�'�'�����.�.���j�j��]�]��(�(�
�	
rec�H�|j�9|j�-t|j|jz
|j�S|jrtdd�Sd}d}t
r	t
j�\}}n%tD]}	t
j|�\}}n|jjd�}|�|j�rt|�}|jjd�}|�|j�rt|�}|xsd}|xsd}t|j�||jz
n|j|j�|�S|j�S#tttf$rY��wxYw#tttf$rY��wxYw)zGet the size of the console.

        Returns:
            ConsoleDimensions: A named tuple containing the dimensions.
        N�P�r[r\)rirjrlrurur=r%�get_terminal_size�AttributeErrorr��OSError�_STD_STREAMSrAr�rbrp)r�rmrn�file_descriptorr�r�s      rfrtzConsole.size�s����;�;�"�t�|�|�'?�$�T�[�[�4�3F�3F�%F����U�U�� � �$�R��,�,�#�� $���
� "� 4� 4� 6�
��v�$0�
���$&�$8�$8��$I�M�E�6��

��-�-�#�#�I�.����7�?�?�#4���L�E��
�
�!�!�'�*����������Z�F�������2�� �+/�;�;�+>�E�D�'�'�'�D�K�K��l�l�*�F�
�	
�04���
�	
��+#�J��8�
��
��'�
�G�<����s$�)E/�F	�/F�F�	F!� F!�new_sizec�*�|\}}||_||_y)zvSet a new size for the terminal.

        Args:
            new_size (Tuple[int, int]): New width and height.
        N)rirj)r�r�rmrns    rfrtzConsole.sizes��!�
��v������rec�.�|jjS)zsGet the width of the console.

        Returns:
            int: The width (in characters) of the console.
        )rtrmr�s rfrmz
Console.widths���y�y���rec��||_y)zFSet width.

        Args:
            width (int): New width.
        N)ri)r�rms  rfrmz
Console.width"s����rec�.�|jjS)zpGet the height of the console.

        Returns:
            int: The height (in lines) of the console.
        )rtrnr�s rfrnzConsole.height+s���y�y���rec��||_y)zISet height.

        Args:
            height (int): new height.
        N)rj)r�rns  rfrnzConsole.height4s����rec�J�|jtj��y)z3Play a 'bell' sound (if supported by the terminal).N)�controlr4�bellr�s rfr�zConsole.bell=s�����W�\�\�^�$rec��t|�}|S)a�A context manager to *capture* the result of print() or log() in a string,
        rather than writing it to the console.

        Example:
            >>> from rich.console import Console
            >>> console = Console()
            >>> with console.capture() as capture:
            ...     console.print("[bold magenta]Hello World[/]")
            >>> print(capture.get())

        Returns:
            Capture: Context manager with disables writing to the terminal.
        )r�)r��captures  rfr�zConsole.captureAs���$�-���rer�r�r�c� �t||||��S)aA context manager to display anything printed within a "pager". The pager application
        is defined by the system and will typically support at least pressing a key to scroll.

        Args:
            pager (Pager, optional): A pager object, or None to use :class:`~rich.pager.SystemPager`. Defaults to None.
            styles (bool, optional): Show styles in pager. Defaults to False.
            links (bool, optional): Show links in pager. Defaults to False.

        Example:
            >>> from rich.console import Console
            >>> from rich.__main__ import make_test_card
            >>> console = Console()
            >>> with console.pager():
                    console.print(make_test_card())

        Returns:
            PagerContext: A context manager.
        )r�r�r�)r�)r�r�r�r�s    rfr�z
Console.pagerRs��*�D��f�E�J�Jrer'r�c�P�|dk\sJd��|jt|��y)zqWrite new line(s).

        Args:
            count (int, optional): Number of new lines. Defaults to 1.
        rzcount must be >= 0N)rr�r�s  rfr�zConsole.lineis&����z�/�/�/�z��
�
�7�5�>�"re�homec��|r7|jtj�tj��y|jtj��y)z�Clear the screen.

        Args:
            home (bool, optional): Also move the cursor to 'home' position. Defaults to True.
        N)r�r4�clearr�)r�r�s  rfr�z
Console.clearss3����L�L�����'�,�,�.�9��L�L�����)re�dotszstatus.spinnerg�?g)@)�spinner�
spinner_style�speed�refresh_per_second�statusr�r�r�r�rRc�.�ddlm}|||||||��}|S)atDisplay a status and spinner.

        Args:
            status (RenderableType): A status renderable (str or Text typically).
            spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots".
            spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner".
            speed (float, optional): Speed factor for spinner animation. Defaults to 1.0.
            refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5.

        Returns:
            Status: A Status object that may be used as a context manager.
        r'rQ)r�r�r�r�r�)r�rR)r�r�r�r�r�r�rR�status_renderables        rfr�zConsole.status~s,��*	#�"����'��1�

��!� rer�c�f�|jr%|jtj|��yy)zqShow or hide the cursor.

        Args:
            show (bool, optional): Set visibility of the cursor.
        TF)rxr�r4r)r�r�s  rfrzConsole.show_cursor�s*������L�L��,�,�T�2�3��re�enablec��d}|jr9|js-|jtj|��d}||_|S)a�Enables alternative screen mode.

        Note, if you enable this mode, you should ensure that is disabled before
        the application exits. See :meth:`~rich.Console.screen` for a context manager
        that handles this for you.

        Args:
            enable (bool, optional): Enable (True) or disable (False) alternate screen. Defaults to True.

        Returns:
            bool: True if the control codes were written.

        FT)rxrur�r4�
alt_screenr})r�r��changeds   rfrzConsole.set_alt_screen�sC�������D�$7�$7��L�L��+�+�F�3�4��G�"(�D���rec��|jS)z�Check if the alt screen was enabled.

        Returns:
            bool: True if the alt screen was enabled, otherwise False.
        )r}r�s rf�
is_alt_screenzConsole.is_alt_screen�s���"�"�"re�titlec�f�|jr%|jtj|��yy)aSet the title of the console terminal window.

        Warning: There is no means within Rich of "resetting" the window title to its
        previous value, meaning the title you set will persist even after your application
        exits.

        ``fish`` shell resets the window title before and after each command by default,
        negating this issue. Windows Terminal and command prompt will also reset the title for you.
        Most other shells and terminals, however, do not do this.

        Some terminals may require configuration changes before you can set the title.
        Some terminals may not support setting the title at all.

        Other software (including the terminal itself, the shell, custom prompts, plugins, etc.)
        may also set the terminal window title. This could result in whatever value you write
        using this method being overwritten.

        Args:
            title (str): The new title of the terminal window.

        Returns:
            bool: True if the control code to change the terminal title was
                written, otherwise False. Note that a return value of True
                does not guarantee that the window title has actually changed,
                since the feature may be unsupported/disabled in some terminals.
        TF)rxr�r4r�)r�r�s  rf�set_window_titlezConsole.set_window_title�s(��6����L�L����u�-�.��rer�r�c�&�t|||xsd��S)auContext manager to enable and disable 'alternative screen' mode.

        Args:
            hide_cursor (bool, optional): Also hide the cursor. Defaults to False.
            style (Style, optional): Optional style for screen. Defaults to None.

        Returns:
            ~ScreenContext: Context which enables alternate screen on enter, and disables it on exit.
        r�)r�r�)r�)r�r�r�s   rfr�zConsole.screen�s���T�{�%�+�2�N�Nre�r�rr�c�P�tj||xs|j|�}|S)a�Measure a renderable. Returns a :class:`~rich.measure.Measurement` object which contains
        information regarding the number of characters required to print the renderable.

        Args:
            renderable (RenderableType): Any renderable or string.
            options (Optional[ConsoleOptions], optional): Options to use when measuring, or None
                to use default options. Defaults to None.

        Returns:
            Measurement: A measurement of the renderable.
        )r:r�r�)r�rr��measurements    rf�measurezConsole.measure�s%��"�o�o�d�G�,C�t�|�|�Z�P���rec#�vK�|xs|j}|jdkryt|�}t|d�rt	|�s|j||�}ndt
|t�r;|j||j|j��}|j||�}ntjd|�d���	t|�}t}|j!�}|D]-}t
||�r|���|j#||�Ed{����/y#t$rtjd|�d���wxYw7�-�w)	akRender an object in to an iterable of `Segment` instances.

        This method contains the logic for rendering objects with the console protocol.
        You are unlikely to need to use it directly, unless you are extending the library.

        Args:
            renderable (RenderableType): An object supporting the console protocol, or
                an object that may be converted to a string.
            options (ConsoleOptions, optional): An options object, or None to use self.options. Defaults to None.

        Returns:
            Iterable[Segment]: An iterable of segments that may be rendered.
        r'Nr�)r~rzUnable to render zC; A str, Segment or object with __rich_console__ method is requiredzobject z is not renderable)r�rwr@r�rr�r�r��
render_strr~rr(�NotRenderableError�iter�	TypeErrorrDr�r9)	r�rr��_options�render_iterable�text_renderable�iter_render�_Segment�
render_outputs	         rfr9zConsole.rendersP����"�*�d�l�l������!���z�*�
��:�1�2�7�:�;N�(�9�9�$��I�O�
�
�C�
(�"�o�o��h�&8�&8����.��O�.�>�>�t�X�N�O��+�+�#�J�>�2T�T��
�
	���/�K�
���(�(�*��(�	@�M��-��2�#�#��;�;�}�h�?�?�?�		@��
�	��+�+��/�,�,>�?��
�	��@�s+�B:D9�=D�AD9�	D7�
D9�#D4�4D9)r��pad�	new_linesrrc�^�|j5|xs|j}|j||�}|rtj||�}|j
}|�t
d|�}tttj||j|||��d|��}	|j
�r|j
t|	�z
}
|
dkDrU|r$td|jz|�td�gntd|jz|�gg}|	j||
z�|	cddd�S#1swYyxYw)aGRender objects in to a list of lines.

        The output of render_lines is useful when further formatting of rendered console text
        is required, such as the Panel class which draws a border around any renderable object.

        Args:
            renderable (RenderableType): Any object renderable in the console.
            options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``.
            style (Style, optional): Optional style to apply to renderables. Defaults to ``None``.
            pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``.
            new_lines (bool, optional): Include "
" characters at end of lines.

        Returns:
            List[List[Segment]]: A list of lines, where a line is a list of Segment objects.
        Nr)�include_new_linesrr�r�r�)
r�r�r9rD�apply_stylernr�rr�split_and_crop_linesrwr�extend)r�rr�r�rr�render_options�	_rendered�
render_heightr��extra_lines�pad_lines            rf�render_lineszConsole.render_lines:s2��0�Z�Z�!	�$�4����N����J��?�I��#�/�/�	�5�A�	�*�1�1�M��(� #�A�}� 5�
����0�0�!�&�0�0�*3��#���!�
��E��$�$�0�,�3�3�c�%�j�@����?�%�!��~�'?�'?�!?��G��QU��W�%�c�N�,D�,D�&D�e�L�M� �H�
�L�L��K�!7�8��C!	�!	�!	�s�DD#�#D,r�)r�r{r|rNrr~rS�textr{r|rKc��|xs|duxr|j}	|xs|duxr|j}
|xs|duxr|j}|
r(t|||	|j��}||_||_n(t|	rt||j��n||||��}|r|xs|jnd}
|
�$|
t|��}|j|�|S|S)a�Convert a string to a Text instance. This is called automatically if
        you print or log a string.

        Args:
            text (str): Text to render.
            style (Union[str, Style], optional): Style to apply to rendered text.
            justify (str, optional): Justify method: "default", "left", "center", "full", or "right". Defaults to ``None``.
            overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji, or ``None`` to use Console default.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use Console default.
            highlight (Optional[bool], optional): Enable highlighting, or ``None`` to use Console default.
            highlighter (HighlighterType, optional): Optional highlighter to apply.
        Returns:
            ConsoleRenderable: Renderable object.

        N)r�rNrO)�default_variant)r{r|r�)rfrerh�
render_markuprgr{r|rKr*rSr��copy_styles)r�rr�r{r|rNrr~rS�
emoji_enabled�markup_enabled�highlight_enabled�	rich_text�_highlighter�highlight_texts               rfrzConsole.render_strus���8�@�%�4�-�"?�D�K�K�
��D�F�d�N�$C�t�|�|��%�P�)�t�*;�*O������%���#�"�1�1�	�I�!(�I��!)�I��� ��t�T�5H�5H�I���!��
�I�=N��7�t�'7�'7�SW���#�)�#�i�.�9�N��&�&�y�1�!�!��re)rV�namerVc�f�t|t�r|S	|jj|�}|�tj|�}|j
r|j
�S|S#tj$r9}|�|j|�cYd}~Stjd|�d|���d�d}~wwxYw)a Get a Style instance by its theme name or parse a definition.

        Args:
            name (str): The name of a style or a style definition.

        Returns:
            Style: A Style object.

        Raises:
            MissingStyle: If no style could be parsed from name.

        NzFailed to get style z; )r�rEr�r��parse�linkr�r(�StyleSyntaxError�	get_style�MissingStyle)r�r)rVr��errors     rfr.zConsole.get_style�s����d�E�"��K�
	��%�%�)�)�$�/�E��}����D�)��#(�:�:�5�:�:�<�8�5�8���&�&�	��"��~�~�g�.�.��%�%�&�t�h�b���8���
��	�s*�A
A$�"A$�$B0�7B+�	B0�B+�+B0�r{rNrr~�objects�seprc	���������g}|j�g��j}	���dvrdtddf��fd�}
|
�t}|s|�|jr|j}d	�����fd�}|D]�}
t|
�}
t
|
t�r|	|j|
|||����:t
|
t�r	|	|
��St
|
t�r|��|
��st|
�r|��t|
|�����|	|t|
�����|�|j�4|j|j�}|D�
cgc]}
t|
|���}}
|Scc}
w)
aCombine a number of renderables and text into one renderable.

        Args:
            objects (Iterable[Any]): Anything that Rich can render.
            sep (str): String to write between print data.
            end (str): String to write at end of print data.
            justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default.

        Returns:
            List[ConsoleRenderable]: A list of things to render.
        )rWrXrYrr�Nc	�F���t|tt����yr�)r0r r1)r�_appendr{s ��rf�align_appendz2Console._collect_renderables.<locals>.align_append�s�����j�$�{�G�*D�E�Frec�v���r6t�����}�|j����j�yy)N)r{r)rK�joinr�)�sep_textr�rr{r3rs �����rf�
check_textz0Console._collect_renderables.<locals>.check_text�s3������W�#�>���x�}�}�T�*�+��
�
��re)rNrrS)rS�r�N)r�r
rsrhrSr@r�r�rrKr�r?r>r�r.rG)r�r2r3rr{rNrr~r��append_textr7r'r;rr�r6r�rs  ```          @@@rf�_collect_renderableszConsole._collect_renderables�s_���202���$�$�����k�k�����1�1�
G��
G�D�
G�"�F�(9����*�t����+�+�L�	�	�"�	;�J�"�:�.�J��*�c�*���O�O�"�%��L�$���
�J��-��J�'��J�(9�:����z�"��z�*����v�j�l�C�D��L��Z��9�:�#	;�&	���:�:�!��N�N�4�:�:�.�E�GR�S��6�*�e�4�S�K�S����Ts�E#u─z	rule.linerX)�
charactersr��alignr?r@c�J�ddlm}|||||��}|j|�y)u�Draw a line with optional centered title.

        Args:
            title (str, optional): Text to render over the rule. Defaults to "".
            characters (str, optional): Character(s) to form the line. Defaults to "─".
            style (str, optional): Style of line. Defaults to "rule.line".
            align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center".
        r')�Rule)r�r?r�r@N)�rulerBr)r�r�r?r�r@rBrCs       rfrCzConsole.rules#�� 	��%�J�e�5�Q���
�
�4�rer�c��|js.|5|jjd�|D��ddd�yy#1swYyxYw)z�Insert non-printing control codes.

        Args:
            control_codes (str): Control codes, such as those that may move the cursor.
        c3�4K�|]}|j���y�wr�)�segment)�.0�_controls  rf�	<genexpr>z"Console.control.<locals>.<genexpr>6s����#M��H�$4�$4�#M���N)rur�r)r�r�s  rfr�zConsole.control.sL���$�$��
N����#�#�#M�W�#M�M�
N�
N�%�
N�
N�s	�#<�Ar�r�)r3rr�r~c�h�|jd�|D��}|j|||ddddd|��	y)a�Output to the terminal. This is a low-level way of writing to the terminal which unlike
        :meth:`~rich.console.Console.print` won't pretty print, wrap text, or apply markup, but will
        optionally apply highlighting and a basic style.

        Args:
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use
                console default. Defaults to ``None``.
        c3�2K�|]}t|����y�wr�)r�)rG�_objects  rfrIzConsole.out.<locals>.<genexpr>Ks����"G�G�3�w�<�"G���FTr^)r�r~rNrr}r|r\rN)r9r)r�r3rr�r~r2�
raw_outputs       rf�outzConsole.out8sD��&�(�(�"G�w�"G�G�
��
�
����������	�
	
re)r3rr�r{r|r}rNrr~rmrnr\rG�new_line_startr}r\rQc
���|st�f}|
�|j}
|
r
|�d}|�d}d}|jdd}|5|j|||||||	��}|D]}|j	|�}�|j
j
|||
�t|
|j�nt||||	��}g}|j}|j}|�|D]}||||���n9|D]4}|tj|||�|j|����6|rVtdj!d�|D��j#��d	kDr$|j%d
tj&��|rF|j(j}tj*||jd��D]
}||��n|j(j|�ddd�y#1swYyxYw)a[Print to the console.

        Args:
            objects (positional args): Objects to log to the terminal.
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
            overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
            no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
            width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
            crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
            soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
                Console default. Defaults to ``None``.
            new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
        NTr^Fr1)r{r|rmrnr}rr~r�c3�4K�|]}|j���y�wr��r�rGrFs  rfrIz Console.print.<locals>.<genexpr>�s����I�����I�rJr'r�r)r�rGr{r>r6r�r��minrmr�rr9rDrr.rr9�
splitlines�insertr�r�r)r�r3rr�r{r|r}rNrr~rmrnr\rGrQr2�render_hooksr�r�r�new_segmentsrr9r�
buffer_extendr�s                          rfrz
Console.printXs��J��y�l�G������I��������#���D��)�)�!�,��
�0	2��3�3�������#�4��K�%�
D��"�6�6�{�C��
D�!�\�\�0�0��!�05�0A�c�%����,�y����#�1��N�+-�L�!�(�(�F��[�[�F��}�"-�?�J��6�*�n�=�>�?�#.��J���+�+�"�:�~�>����u�@U���������I�L�I�I�T�T�V�W���!�'�'��7�<�<�>�:�� $��� 3� 3�
�#�8�8� �$�*�*�%��(�D�"�$�'�(�
���#�#�L�1�a0	2�0	2�0	2�s�FG�G!rg)	�data�indentr~�	skip_keys�ensure_ascii�check_circular�	allow_nanrV�	sort_keys�jsonr]r^r_r`rarbrcc	���ddlm}|�|j||||||||	|
��	}n0t|t�std|�d���|||||||||	|
��	}|j
|d��y)	a�Pretty prints JSON. Output will be valid JSON.

        Args:
            json (Optional[str]): A string containing JSON.
            data (Any): If json is not supplied, then encode this data.
            indent (Union[None, int, str], optional): Number of spaces to indent. Defaults to 2.
            highlight (bool, optional): Enable highlighting of output: Defaults to True.
            skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
            ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
            check_circular (bool, optional): Check for circular references. Defaults to True.
            allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
            default (Callable, optional): A callable that converts values that can not be encoded
                in to something that can be JSON encoded. Defaults to None.
            sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
        r)�JSONN)r^r~r_r`rarbrVrcz/json must be str. Did you mean print_json(data=z) ?T)rG)�	rich.jsonrf�	from_datar�r�r
r)
r�rdr]r^r~r_r`rarbrVrcrf�json_renderables
             rf�
print_jsonzConsole.print_json�s���:	#��<�"�n�n���#�#�)�-�#��#�-�
�O��d�C�(��E�d�X�S�Q���#���#�#�)�-�#��#�
�O�	
�
�
�?�d�
�3re)�regionr�rkc�Z�|jstjd��|xs|j}|�9dx}}|j	|j
|jxs|j�}n|\}}}}|j	||�}|j||��}	|j|	||�y)a�Update the screen at a given offset.

        Args:
            renderable (RenderableType): A Rich renderable.
            region (Region, optional): Region of screen to update, or None for entire screen. Defaults to None.
            x (int, optional): x offset. Defaults to 0.
            y (int, optional): y offset. Defaults to 0.

        Raises:
            errors.NoAltScreen: If the Console isn't in alt screen mode.

        �0Alt screen must be enabled to call update_screenNrr)	r�r(�NoAltScreenr�r�rwrnr�update_screen_lines)
r�rrkr�rr�r�rmrnr�s
          rf�
update_screenzConsole.update_screen�s���&�!�!��$�$�%W�X�X� �0�D�L�L���>��I�A��+�=�=��(�(�.�*?�*?�*N�4�;�;��N�#)��A�q�%��+�=�=�e�V�L�N��!�!�*�n�!�E��� � ���1�-rer�r�r�c���|jstjd��t|||�}|j	|�}|j
j
|�|j�y)a�Update lines of the screen at a given offset.

        Args:
            lines (List[List[Segment]]): Rendered lines (as produced by :meth:`~rich.Console.render_lines`).
            x (int, optional): x offset (column no). Defaults to 0.
            y (int, optional): y offset (column no). Defaults to 0.

        Raises:
            errors.NoAltScreen: If the Console isn't in alt screen mode.
        rmN)r�r(rnr�r9r�rr�)r�r�r�r��
screen_updater�s      rfrozConsole.update_screen_linessY���!�!��$�$�%W�X�X�$�U�A�q�1�
��;�;�}�-�������H�%����rerTr"rd�rmrr��	word_wrap�show_locals�suppress�
max_framesrrtrurvrwc	�P�ddlm}||||||||��}	|j|	�y)a
Prints a rich render of the last exception and traceback.

        Args:
            width (Optional[int], optional): Number of characters used to render code. Defaults to 100.
            extra_lines (int, optional): Additional lines of code to render. Defaults to 3.
            theme (str, optional): Override pygments theme used in traceback
            word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
            show_locals (bool, optional): Enable display of local variables. Defaults to False.
            suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
            max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.
        r')�	TracebackrsN)r�ryr)
r�rmrr�rtrurvrwryr�s
          rf�print_exceptionzConsole.print_exception.s4��,	)���#���#��!�
�	�	
�
�
�9�rer��currentframec�<�|dz
}|�}|�K|r|�|j}|dz}|r|��|�J�|jj|j|jfStj�|}|j|j|jjfS)aEGet caller frame information.

        Args:
            offset (int): the caller offset within the current frame stack.
            currentframe (Callable[[], Optional[FrameType]], optional): the callable to use to
                retrieve the current frame. Defaults to ``inspect.currentframe``.

        Returns:
            Tuple[str, int, Dict[str, Any]]: A tuple containing the filename, the line number and
                the dictionary of local variables associated with the caller frame.

        Raises:
            RuntimeError: If the stack offset is invalid.
        r')
�f_back�f_code�co_filename�f_lineno�f_locals�inspect�stack�filename�lineno�frame)r�r{r��
frame_infos    rf�_caller_frame_infozConsole._caller_frame_infoQs���(	�!���������U�.������!����U�.��$�$�$��<�<�+�+�U�^�^�U�^�^�K�K�!�����0�J��&�&�
�(9�(9�:�;K�;K�;T�;T�T�Tre)	r3rr�r{rNrr~�
log_locals�
_stack_offsetr�r�c	
���|
st�f}
|jdd}|5|j|
||||||��}|�|D�
cgc]}
t|
|���}}
|j	|	�\}}}|jd�rdntjj|�}|jtj�d}|rP|j�D��cic]\}}|jd�s||��}}}|jt|d���|j|||j�|||��g}|D]}|j!|�}�g}|j"}|j$}|j&}|D]}
|||
|���|j(j"}t+j,||j.d	�
�D]
}||��	ddd�ycc}
wcc}}w#1swYyxYw)aXLog rich content to the terminal.

        Args:
            objects (positional args): Objects to log to the terminal.
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to None.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to None.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to None.
            log_locals (bool, optional): Boolean to enable logging of locals where ``log()``
                was called. Defaults to False.
            _stack_offset (int, optional): Offset of caller from end of call stack. Defaults to 1.
        Nr1�<����__z	[i]locals)r�)rP�path�line_no�	link_pathFrV)r�r{r>rGr�r�r%r��abspathr�r3�itemsr�rBrrrUr6rr9r�r�rDrrm)r�r3rr�r{rNrr~r�r�r2rZr�rr�r��localsr�r��keyr��
locals_mapr�r[rr9rr\r�s                             rf�logzConsole.logts��8��y�l�G��)�)�!�,��
�.	$��3�3�������#�4��K�� �KV�W�Z�v�j�%�8�W��W�(,�(?�(?�
�(N�%�H�g�v� (� 3� 3�C� 8��b�g�g�o�o�h�>W�I��&�&�r�v�v�.�r�2�D��'-�l�l�n��"��U��>�>�$�/���J��
��
�"�"�<�
�+�#N�O�� � ���!�.�.�0��#�'�
!��	�K�%�
D��"�6�6�{�C��
D�*,�L�!�(�(�F��[�[�F�!�\�\�N�)�
;�
��v�j�.�9�:�
;� �L�L�/�/�M��4�4��d�j�j�e��
$���d�#�
$�W.	$�.	$��X���#.	$�.	$�s*�G"�G�BG"�G�/CG"�G"�"G+c	�p�|jr|jdd�=y|j5|jr=|j5|j
j
|jdd�ddd�|jdk(�rG|jrFddl	m
}||j|j|jdd��|jdd�=�n�t�r�d}|jrt|j�}|�|t v}|rlddlm}ddlm}|jdd}|j*r*|j,rt/t1j2|��}||||j���n*|j|jdd�}|jj4}d}		t7|�|	kr	||�n�g}
|
j8}d}|j;d	�D]T}
|t7|
�z|	kDr+|
r)|d
j=|
��|
j?�d}||
�|t7|
�z
}�V|
r'|d
j=|
��|
j?�n:|j|jdd�}	|jj5|�|jjE�|jdd�=ddd�y#1swY��jxYw#t@$r}|jB�d�|_!�d}~wwxYw#t@$r}|jB�d�|_!�d}~wwxYw#1swYyxYw)aQCheck if the buffer may be rendered. Render it if it can (e.g. Console.quiet is False)
        Rendering is supported on Windows, Unix and Jupyter environments. For
        legacy Windows consoles, the win32 API is called directly.
        This method will also record what it renders if recording is enabled via Console.record.
        Nrr')�displayF)�LegacyWindowsTerm)�legacy_windows_renderi Tr�zG
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***)#rJr�r�rMrwrzrr�ra�jupyterr�r�r=rur-rI�_STD_STREAMS_OUTPUT�rich._win32_consoler��rich._windows_rendererr�rKrmrrD�remove_color�writerr�rXr9r��UnicodeEncodeError�reason�flush)r�r��use_legacy_windows_render�filenor�r�r�rr��	MAX_WRITE�batch�batch_appendrtr�r0s               rfr�zConsole._check_buffer�s����:�:����Q���
�Z�Z�D	(��{�{��-�-�@��'�'�.�.�t�|�|�A��?�@��!�!�Q�&��?�?�0��D�L�L�$�*=�*=�d�l�l�1�o�*N�O����Q���49�1��.�.�%/��	�	�%:�F�%�1�$*�.A�$A�!:�5�M�T�%)�\�\�!�_�F�#�}�}��1C�1C�)-�g�.B�.B�6�.J�)K��1�&�:K�D�I�I�:V�W�$(�#6�#6�t�|�|�A��#G�D�%)�I�I�O�O�E�(6�I�&�#&�t�9�	�#9�$)�$�K�79�E�38�<�<�L�+,�D�04����0E�%:��+/�#�d�)�+;�i�+G�E�,1�"�'�'�%�.�,A�,1�K�K�M�34�D�(4�T�(:�(,��D�	�(9��
%:�(-�(-�b�g�g�e�n�(=�(-���
��
 $�2�2�4�<�<��?�C��"� �I�I�O�O�D�1�
�I�I�O�O�%����Q��ID	(�D	(�@�@��l$6�&�27�,�,��@H�0I��� %��&�� 2�"�.3�l�l�^�<D�,E�E�L�!��"��D	(�D	(�sm�L,�)K�+EL,�.B8K �&L,�L�!)L,�K	�L,� 	L�)K>�>L�L,�	L)�L$�$L)�)L,�,L5r�c�>�g}|j}|j}|j}|j}|jr|rtj|�}|D]0\}}}	|r||j|||����$|r|	r�)||��2dj|�}
|
S)z)Render buffered output, and clear buffer.)rCrur�)	r�rmrurxrKrDr�r9r9)r�r��outputr�rCru�not_terminalrr�r��rendereds           rfr�zConsole._render_buffers����������)�)���,�,���+�+�+���=�=�\��)�)�&�1�F�$*�
	� �D�%�����L�L��%1�'5�!���#�w��t��
	��7�7�6�?���re)rrN�password�stream�promptr�r�c��|r|j|||d��|rtd|��}|S|r|j�}|St�}|S)a5Displays a prompt and waits for input from the user. The prompt may contain color / style.

        It works in the same way as Python's builtin :func:`input` function and provides elaborate line editing and history features if Python's builtin :mod:`readline` module is previously loaded.

        Args:
            prompt (Union[str, Text]): Text to render in the prompt.
            markup (bool, optional): Enable console markup (requires a str prompt). Defaults to True.
            emoji (bool, optional): Enable emoji (requires a str prompt). Defaults to True.
            password: (bool, optional): Hide typed text. Defaults to False.
            stream: (TextIO, optional): Optional file to read input from (rather than stdin). Defaults to None.

        Returns:
            str: Text read from stdin.
        r�)rrNr)r�)rr	�readline�input)r�r�rrNr�r��results       rfr�z
Console.input,sW��.��J�J�v�f�E�r�J�B���R��/�F��
�	����*���
�����
re�r�r�r�c� �|jsJd��|j5|r#djd�|jD��}n"djd�|jD��}|r|jdd�=ddd�|S#1swYSxYw)a�Generate text from console contents (requires record=True argument in constructor).

        Args:
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            styles (bool, optional): If ``True``, ansi escape codes will be included. ``False`` for plain text.
                Defaults to ``False``.

        Returns:
            str: String containing console contents.

        �ITo export console contents set record=True in the constructor or instancer�c3�NK�|]\}}}|r|j|�n|���y�wr�r8)rGrr��_s    rfrIz&Console.export_text.<locals>.<genexpr>`s.�����&��e�Q�,1�U�\�\�$�'�d�:��s�#%c3�LK�|]}|js|j���y�wr�)r�rrUs  rfrIz&Console.export_text.<locals>.<genexpr>es#������"�?�?��L�L��s�"$N)rMrwr9rz)r�r�r�rs    rf�export_textzConsole.export_textNs���
�K�K�	W�V�	W���
%�
%�
	+���w�w��*.�*=�*=����
�w�w��#'�#6�#6����
��'�'��*�
	+���
	+���s�AB�B
r�c��|j||��}t|dd��5}|j|�ddd�y#1swYyxYw)a�Generate text from console and save to a given location (requires record=True argument in constructor).

        Args:
            path (str): Path to write text files.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            styles (bool, optional): If ``True``, ansi style codes will be included. ``False`` for plain text.
                Defaults to ``False``.

        r��wtr��ryN)r��openr�)r�r�r�r�r�
write_files      rf�	save_textzConsole.save_textnsJ�����e�F��;��
�$��w�
/�	#�:����T�"�	#�	#�	#�s	�=�A�r�r��code_format�
inline_stylesr�r�c	�~�|jsJd��g}|j}|xst}d}|�tn|}	|j5|r�tjtj|j��D]X\}
}}t|
�}
|r=|j|�}
|jrd|j�d|
�d�}
|
r	d|
�d|
�d�n|
}
||
��Zn�i}tjtj|j��D]v\}
}}t|
�}
|r[|j|�}
|j|
t|�d	z�}|jrd
|�d|j�d|
�d�}
n	d|�d|
�d�}
||
��xg}|j}|j�D]\}}|s�	|d
|�d|�d���dj|�}|	j!dj|�||j"j$|j&j$��}|r|jdd�=ddd�|S#1swYSxYw)aIGenerate HTML from console contents (requires record=True argument in constructor).

        Args:
            theme (TerminalTheme, optional): TerminalTheme object containing console colors.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            code_format (str, optional): Format string to render HTML. In addition to '{foreground}',
                '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``.
            inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
                larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
                Defaults to False.

        Returns:
            str: String containing console contents as HTML.
        r�r�Nz	<a href="z">z</a>z
<span style="z</span>r'z<a class="rz" href="z<span class="rz.rz {�}r�)�code�
stylesheet�
foreground�
background)rMr�rHr+rwrD�filter_control�simplifyrzr
�get_html_styler,�
setdefaultrr�r9�format�foreground_color�hex�background_color)r�r�r�r�r��	fragmentsr��_themer��render_code_formatrr�r�rCr��style_number�stylesheet_rules�stylesheet_append�
style_rule�
rendered_codes                    rf�export_htmlzConsole.export_html|ss��.
�K�K�	W�V�	W��!�	��!�!���0�0���
�4?�4G�0�[��
�
%�
%�(	+��&-�&<�&<��$�$�T�%8�%8�9�'�	!�N�D�%��"�$�<�D��$�3�3�F�;�� �:�:�%.�u�z�z�l�"�T�F�$�#G�D�HL��t�f�B�t�f�G�D�RV���4�L�	!�*,��&-�&<�&<��$�$�T�%8�%8�9�'�!�N�D�%��"�$�<�D��$�3�3�F�;��'-�'8�'8��s�6�{�Q��'O�� �:�:�%0���h�u�z�z�l�RT�UY�TZ�Z^�#_�D�%3�L�>��D�6��#Q�D��4�L�!�/1� �$4�$;�$;�!�06����P�,�J��!�)�B�|�n�C�
�|�2�*N�O�P�"�Y�Y�'7�8�
�.�5�5��W�W�Y�'�%�!�2�2�6�6�!�2�2�6�6�	6��M���'�'��*�Q(	+�R��S(	+�R��s�E$H2�)A?H2�2H<c��|j||||��}t|dd��5}|j|�ddd�y#1swYyxYw)a@Generate HTML from console contents and write to a file (requires record=True argument in constructor).

        Args:
            path (str): Path to write html file.
            theme (TerminalTheme, optional): TerminalTheme object containing console colors.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            code_format (str, optional): Format string to render HTML. In addition to '{foreground}',
                '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``.
            inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
                larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
                Defaults to False.

        r�r�r�r�N)r�r�r�)r�r�r�r�r�r��htmlr�s        rf�	save_htmlzConsole.save_html�sX��,�����#�'�	 �
���$��w�
/�	#�:����T�"�	#�	#�	#�s	�?�A�Richg��Q���?�r�r�r�r��font_aspect_ratio�	unique_idr�r�c����3�4�5�6�7�8�ddlm}i�7dtdtf�3�7fd�}|xst�3|j
�8d}	|	|z�4|	dz�5d}
d}d}d}
d	}d
}d
}d
}||z}||z}|
|z}|
|z}g}g}i}d}dtdtfd�}	d2dtdttdtdtfd��6|j5ttj|j��}|r|jj�d
d
d
���Zdttjdj!d�D��j#dd�|j#dd�z��z�d}t%tj&�8���D�]�\}}d}|D�]�\}} }!| xs
t�} || �}"|"|vr
|||"<|dz
}d||"��}#| j(rJd}$| j*��3j,j.n$| j*j1�3�j.}%nf| j2}&|&d
uxr
|&j4}$| j2��3j6j.n$| j2j1�3�j.}%||�}'|$r-|j9�6d|%|�4z|�5zdz�4|'z�5dzd���|dt;|�zk7rE|j9�6d||���d |#��|�4z|�5z|	z�4t;|�zd!��d"|�d#��$��|||�z
}������t=|�D�(cgc]
}(|(�5zdz��})}(d%j!�4�5�6��8fd&�t%|)�D��}*d%j!�fd'�|j?�D��}+dj!|�},dj!|�}-tA�8�4z|z�}.|dz�5z|z}/�6d�3j6j.d(d)|
|
|.|/d
�*�	}0�3j,j.}1|r$|0�6d||���d+�|1d,|.d-z|
|	zd.z�/�z
}0|0d0z
}0|jC��4|	�5�4�8zdz
|dz�5zdz
|.|z|/|z|
|z|
|z|+|0|,|-|*�1�}2|2S#1swY��oxYwcc}(w)3a
        Generate an SVG from the console contents (requires record=True in Console constructor).

        Args:
            title (str, optional): The title of the tab in the output image
            theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``
            code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables
                into the string in order to form the final SVG output. The default template used and the variables
                injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable.
            font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format``
                string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font).
                If you aren't specifying a different font inside ``code_format``, you probably don't need this.
            unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node
                ids). If not set, this defaults to a computed value based on the recorded content.
        r)�cell_lenr�r�c����|�vr�|Sg}|j�|jjr�jn|jj��}|j�|jjr�j
n|jj��}|jr||}}|jr
t||d�}|jd|j���|jr|jd�|jr|jd�|jr|jd�|jr|jd�dj|�}|�|<|S)z%Convert a Style to CSS rules for SVG.g�������?zfill: zfont-weight: boldzfont-style: italic;ztext-decoration: underline;ztext-decoration: line-through;�;)�color�
is_defaultr��
get_truecolor�bgcolorr��reverse�dimr3r�r��bold�italic�	underline�striker9)r��	css_rulesr�r��cssr��style_caches     ��rf�
get_svg_stylez)Console.export_svg.<locals>.get_svg_style	sD�����#�"�5�)�)��I��K�K�'�5�;�;�+A�+A��'�'��[�[�.�.�v�6�
��M�M�)�U�]�]�-E�-E��'�'��]�]�0�0��8�
�
�}�}�!(�%�w���y�y�!�%��#�6�����v�e�i�i�[�1�2��z�z�� � �!4�5��|�|�� � �!6�7����� � �!>�?��|�|�� � �!A�B��(�(�9�%�C�!$�K����Jre�g��Q���?r'�(r#rc�8�t|�jdd�S)z.HTML escape text and replace spaces with nbsp.r�z&#160;)r
�replacerTs rf�escape_textz'Console.export_svg.<locals>.escape_textA	s���$�<�'�'��X�6�6reNr)r��attribsc	���dtdtfd��dj�fd�|j�D��}|rd|�d|�d|�d|�d�	Sd|�d|�d	�S)
z.Make a tag from name, content, and attributes.r�r�c�P�t|t�rt|d�St|�S)N�g)r��floatr�r�)r�s rf�	stringifyz7Console.export_svg.<locals>.make_tag.<locals>.stringifyJ	s#���e�e�-�!�%��-�-��5�z�!rer�c3�~�K�|]4\}}|jd�jdd��d�|��d����6y�w)r�r�z="�"N)�lstripr�)rG�k�vr�s   �rfrIz7Console.export_svg.<locals>.make_tag.<locals>.<genexpr>O	sD�����#��A�q��8�8�C�=�(�(��c�2�3�2�i��l�^�1�E�#�s�:=r�r�z</z/>)�objectr�r9r�)r)r�r��tag_attribsr�s    @rf�make_tagz$Console.export_svg.<locals>.make_tagE	s|���

"��
"�C�
"�
�(�(�#�#�M�M�O�#��K���D�6��;�-�q��	��D�6��;�
����a��}�B�/�
rez	terminal-r�c3�2K�|]}t|����y�wr�)�reprrUs  rfrIz%Console.export_svg.<locals>.<genexpr>a	s����C�w�T�'�]�C�rNr�r^)�length�rT�rectg�?��?�
crispEdges)�fillr�r�rmrn�shape_renderingr�r�zurl(#�-line-�))�_classr�r��
textLength�	clip_pathr�c3�^�K�|]$\}}d��d|�d�dd|��z�dz���d����&y�w)	z<clipPath id="rz">
    rrr
)r�r�rmrnz
            </clipPath>Nrd)rGr�r��
char_width�line_heightrr�rms   �����rfrIz%Console.export_svg.<locals>.<genexpr>�	sW�����
� ����y�k���y�9�
�f��V�:��+=�k�TX�FX�Y�Z�[�
�
�s�*-c3�<�K�|]\}}d��d|�d|�d����y�w)�.z-rz { z }Nrd)rGr��rule_nor�s   �rfrIz%Console.export_svg.<locals>.<genexpr>�	s/�����
�7C�s�G�a�	�{�"�W�I�T�#��c�2�
�s�zrgba(255,255,255,0.35)�1)r�stroke�stroke_widthr�r�rmrn�rxz-title�middlerg�)rr�text_anchorr�r�z�
            <g transform="translate(26,22)">
            <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
            <circle cx="22" cy="0" r="7" fill="#febc2e"/>
            <circle cx="44" cy="0" r="7" fill="#28c840"/>
            </g>
        )r�r�char_heightr�terminal_width�terminal_heightrmrn�
terminal_x�
terminal_yr��chrome�backgrounds�matrixr�r�)"�
rich.cellsr�rEr�rIrmrrrwrrDr�rzr��zlib�adler32r9�encoder�rr�r�r�r�r�r�r�r�r�r�ranger�r
r�)9r�r�r�r�r�r�r�r�r�r#�
margin_top�margin_right�
margin_bottom�margin_left�padding_top�
padding_right�padding_bottom�padding_left�
padding_width�padding_height�margin_width�
margin_height�text_backgrounds�
text_group�classes�style_nor�r�r�r�r�rr�rH�rules�
class_name�has_backgroundr�r��text_lengthr��line_offsetsr�r�r)r*r$r%r(�title_color�svgr�rrrr�rms9      `                                            @@@@@@rf�
export_svgzConsole.export_svg�sj���6	(�(*��	��	�3�	�B�*�*���
�
���� �#4�4�
�!�D�(���
����
������
�����$�}�4�
�$�~�5��"�\�1��"�]�2�
�&(�� "�
�"$����	7�c�	7�c�	7�
15�	��	� (��
�	�AG�	�
�	�(�
%�
%�	,��G�2�2�4�3F�3F�G�H�H���#�#�)�)�+�	,�
��#�c�����W�W�C�(�C�C�K�K�� ���l�l�7�H�5�	6��'��I�
�� ��!=�!=�h�u�!U�V�4	$�G�A�t��A�)-�2
$�%��e�X��(����%�e�,����'�%-�G�E�N���M�H� ���� 0�1�
��=�=�%)�N�!�;�;�.��/�/�3�3�"�[�[�6�6�v�>�B�B��$�m�m�G�%,�D�%8�%S��AS�AS�=S�N�!�=�=�0��/�/�3�3�"�]�]�8�8��@�D�D��'�t�n��!�$�+�+� �"�!+��*�n��+�o��3�",�{�":�#.��#5�,8��
��3��T��?�*��%�%� �"�'��-�&/�[��*��#>��*�n��+�o��;�'1�C��I�'=�(-�i�[��q�c��&C��
��X�d�^�#��e2
$�4	$�lDI��8�L���+�-��3�L��L��	�	�
�$-�\�#:�	
�
�����
�GN�}�}��
�
���g�g�.�/������$���e�j�0�=�@�A���q�5�K�/�.�@�����(�(�,�,�+���� �"��

���-�-�1�1����h���E�"�#��F�+� �$� �A�%��{�*�Q�.��
�F�	�	�	��� � ��!�#�#�%��-��1���U�k�1�A�5� �<�/�"�]�2�"�\�1�!�K�/���#���!�
��"�
�M	,�	,��LMs�2AQ$�#Q1�$Q.c��|j||||||��}t|dd��5}	|	j|�ddd�y#1swYyxYw)a7Generate an SVG file from the console contents (requires record=True in Console constructor).

        Args:
            path (str): The path to write the SVG to.
            title (str, optional): The title of the tab in the output image
            theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``
            code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables
                into the string in order to form the final SVG output. The default template used and the variables
                injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable.
            font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format``
                string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font).
                If you aren't specifying a different font inside ``code_format``, you probably don't need this.
            unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node
                ids). If not set, this defaults to a computed value based on the recorded content.
        r�r�r�r�N)rGr�r�)
r�r�r�r�r�r�r�r�rFr�s
          rf�save_svgzConsole.save_svg�	s\��6�o�o����#�/��
�
���$��w�
/�	"�:����S�!�	"�	"�	"�s�A�A
r<)r�rPr�N)r�r�r�r�r�)TNr�r	)rr)}rarbrcror%�environrArr�rqr7rr$r�rMrrprFr5rr.rrr�r�r�r�rI�setterrrDr�r�rNr�r2rnr�r�r�r�r4r�r�r�rr�r�r�r�r�r�r�rCryrxrursr�rlrtrrmrnr�r�r�r<r�r�r�r�r
r�rrr�rr�r:rrr9rErr�r�rWrr.r�r>rLr1rCr4r�rPrrjrArprorrz�staticmethodr�r{rrr�r�r�r�rr�r�r�rJr�r+r�r,rGrIrdrerfr�r�Rsn��!�F#%�*�*�H�g�c�3�h��,�
�)-�(,�,0��!%��"&��#� $�%)�#'�����04����:@�3B�3D�)-��9=�26�04�Az$���E�F�
�z$�!���
z$� ��~�z$�$�D�>�z$��z$����z$��z$��r�#�w��z$��z$���}�z$���
�z$� �	�"�!z$�"�4�.�#z$�$�%z$�&�'z$�(�)z$�*�+z$�, ��-�-z$�.�/z$�0�1z$�2�3z$�4�s�$6�6�7�5z$�6�/�0�7z$�8!���9z$�:�;z$�<�x��H��5�6�=z$�>�8�B��I�.�/�?z$�@�7�3��8�,�-�Az$�xF�#�F���b��g����
�[�[��R��W�������*��g��*��*��0�s�0��0����1�3�1�4�1��1��/�j�/��/� �h�{�&;� �0 ��
��
,�Z�,�D�,�%�
�
����������	�S�	�;?�	=��	=�4�	=�4�	=�&�:>�
2�u�
2�$�
2�,�
2��
�h�s�m�
��
��L�#�L��L��!�T�!��!�F�	,�$�	,��	,��

��

��

��+
�'�+
��+
�Z
�[�[��U�3��8�_��������s�����\�\��3��4����� �� �� ��]�]��S��T����%����$RW�K��e�_�K�59�K�JN�K�	�K�.#�#�#�d�#�	*�$�	*�$�	*��#3��$(�!��!��	!�
!�!��
!�"�!�
�!�B	��	��	��T��T��*�#�t�#��#��c��d��BFJ�O��O�/7�	�/B�O�	�O�RV��(��6>�~�6N��	��$OS�1@�(�1@�3;�N�3K�1@�	�'�	�1@�l-1�9�
"&���9�"�9��.�)�9�
���9��
9��9�
�d�7�m�	�9�~$&�+/�-1� $�!%�$(�15�9��9��S�%�Z� �	9�
�-�(�9��>�*�
9���~�9����9��D�>�9��o�.�9�
�9�xRV���#�u�*�%��3;�E�%��*�<M�3N��	��H,0� $�!%�$(�I��#��I��I��	I��-�(�
I���~�I����I��D�>�I�
��	 �I�Z�� �#.�%�
����	�
�S�%�Z� ���
�
��*N��N�D�N���-1�$(�

��
��
��	
�
��c�5�j�)�*�
��D�>�

�
�
�F��-1�+/�-1�"&� $�!%�$(�#� $��$(�$�!a2��a2��a2��	a2�
��c�5�j�)�*�a2��-�(�
a2��>�*�a2��$��a2���~�a2����a2��D�>�a2���}�a2���
�a2��a2��D�>�a2� �!a2�"
�#a2�J#�;4��()���"�#��26��;4��s�m�;4��	;4�
�d�C��n�%�;4��
;4��;4��;4��;4��;4��(�C�5�#�:�.�/�;4��;4�
�;4�B$(�,0� .�"� .��� �	 .�
�.�)� .�
�
 .�F@A���$�w�-�(��-0��9<��	
��. #��#��!�57��!���}�!��	!�
��}�!��
!��!��5��j��1�2�!��!�
�!�F�;B�:N�:N� U�� U��r�8�I�#6�6�7� U�
�s�C��c�3�h��'�	(� U�� U�J��-1�+/� $�!%�$(� ��O$��O$��O$��	O$�
��c�5�j�)�*�O$��-�(�
O$���~�O$����O$��D�>�O$��O$��O$�
�O$�bM(�^�X�g�%6��3��4� ����#'� �� ��	 �
� ��
 ��� � �

� �D,0���D����#��@59��#�c�#�T�#�$�#�SW�#�"*.��%)�#�
I��
�&�I��	I�
�c�]�I��
I�

�I�^*.��.�#�#��#��
�&�	#�
�#��
#��#�
�#�D�)-��-�#'�#'�y��y��
�&�	y�
�y��
y�!�y��C�=�y�

�y�~�)-��-�#'�#'�$"��$"��	$"�
�
�&�$"��
$"��$"�!�$"��C�=�$"�
�$"rer��
svg_main_codec�Z�ttj|j���S)z�Returns a unique hash for the given SVG main code.

    Args:
        svg_main_code (str): The content we're going to inject in the SVG envelope.

    Returns:
        str: a hash of the given content
    )r�r,r-r.)rMs rf�	_svg_hashrO
s!���t�|�|�M�0�0�2�3�4�4re�__main__)rMzJSONRPC [i]request[/i]�g�������?Fz2.0�subtract�*�)�minuend�
subtrahendr")�jsonrpcr�params�idz
Hello, World!z{'a': 1}z&Which one is correct team name in NBA?)zNew York BullszLos Angeles KingszGolden State Warriors�
Huston RocketrZ)�questionr��answer)�answered�q1z	5 + 7 = ?)�
���
raz
12 - 8 = ?)r'rgr"�rc)r]r^�q2)�sport�maths)r)�empty�quizr�)r�rO)�r�r%�platformr�rpr,�abcrr�dataclassesrrr�	functoolsrr	r�r
r�	itertoolsr�mathr
�timer�typesrrr�typingrrrrrrrrrrrrrrr �rich._null_filer!�version_infor$r%r&�typing_extensionsr�r(r)r*�_export_formatr+r,�_filenor-rrr.r/r@r0r1r�r2r3r�r4rNr5rSr6r7rr9r!rr:r;r�r<r=�prettyr>r?�protocolr@rkrA�scoperBr�rCrFrDr�rErF�styledrG�terminal_themerHrIrJrrKrLr�rMrNr;rOr�rPr�rRrcrd�systemr=r�rWr�r�r`r��	__stdin__r��
_STDIN_FILENO�	Exception�
__stdout__�_STDOUT_FILENO�
__stderr__�_STDERR_FILENOr�r�r�r�r�rlrsr�r�r
r�rsr�r�r�r�r�r�r�rr�rr)r�ror�r��localr/r4r7rqr:r?r�rOrar�r�r	r)r)r|s00rf�<module>r�s����	��
���#�(���������6�6������$&����v��;�;����*�C��6�%�)���9�+�5�%�)������#��S�S� �$��0�������
�(�/�/�
�y�
(���E�#�v�+�.�/��7�8���D�E�
��=�>��	�	�
�J�	���M�M�(�(�*�M���^�^�*�*�,�N���^�^�*�*�,�N��~�~�>��%�~�6���
"�
"��%�%��#�#���.�
�.��B�B��B�J��x�����������(�(�C�7�8��:���n�g�5�6�7��#�%��3�9�3�	)�	)���$��B!�!�*$%�$%�N,/�,/�^$�$�B�t��x��X�c�5�j�-A�(A�B��,�T��*�$�$�� � ��&�&��"�"�	�
�:G�9L�9L�9N�O���v����O����)�/�/�������&AE��8�$<�=�D�%�=�t�=�
s"�s"�l=	5�S�	5�S�	5��z���T�"�G��K�K� �	���
��� �"$�B�7��		
�
��K�K���T�'�]�;��M�M���!%�$L�$�#2�	��!&�$/�#3�"$��%1�#/�"#����	
�!�)��mM���M������N������N���v
Ps<�1P�P"�+P0�;
P>�P�P�"P-�,P-�0P;�:P;

Zerion Mini Shell 1.0