� ]�g����v�UddlZddlmZmZddlmZddlmZddlm Z m Z m Z m Z m Z mZmZmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-e r ddl.m/Z/m0Z0m1Z1m2Z2dZ3de4d<dZ5de4d<ej6d��Z7ee8dfZ9 e e8gee-fZ:Gd�de��Z;Gd�de&��Z<e=dk�rNdd l>m/Z/e<d!��Z?e?�@d"gd#��e?�@d$gd%��e/��Z.e.�Ad&��e.�Be?d'�(��e.�B��e.�Ad)��e.�Be?d*d+�,��e.�B��e.�Ad-��e.�Be?d.d/�,��e.�B��e.�Ad0��e.�Be?d1d2�,��e.�B��dSdS)3�N)�partial�reduce)�gcd)� itemgetter) � TYPE_CHECKING�Any�Callable�Dict�Iterable�List� NamedTuple�Optional�Pattern�Tuple�Union�)� loop_last)� pick_bool)� divide_line)� AlignMethod)�cell_len� set_cell_size)�Lines)�strip_control_codes)� EmojiVariant)� JupyterMixin)� Measurement)�Segment)�Style� StyleType)�Console�ConsoleOptions� JustifyMethod�OverflowMethod�defaultr#�DEFAULT_JUSTIFY�foldr$�DEFAULT_OVERFLOWz\s+$�Textc��eZdZUdZeed< eed< eeefed< defd�Z de fd�Z dede de dffd �Zdeddfd �Zdeddfd �Zd eddfd �ZdS)�Spanz A marked up region in some text.�start�end�style�returnc�8�d|j�d|j�d|j�d�S)NzSpan(z, �))r,r-r.��selfs �Y/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/rich/text.py�__repr__z Span.__repr__9s)��@�t�z�@�@�T�X�@�@���@�@�@�@�c�"�|j|jkS�N)r-r,r2s r4�__bool__z Span.__bool__<s���x�$�*�$�$r6�offsetc��||jkr|dfS||jkr|dfS|\}}}t|t||��|��}t|j||��}||fS)z)Split a span in to 2 from a given offset.N)r,r-r+�min)r3r:r,r-r.�span1�span2s r4�splitz Span.split?sv�� �D�J� � ���:� � �T�X� � ���:� � ���s�E��U�C��V�,�,�e�4�4���U�Y��U�+�+���e�|�r6c�<�|\}}}t||z||z|��S)z�Move start and end by a given offset. Args: offset (int): Number of characters to add to start and end. Returns: TextSpan: A new TextSpan with adjusted position. �r+�r3r:r,r-r.s r4�movez Span.moveLs*��!���s�E��E�F�N�C�&�L�%�8�8�8r6c�\�|\}}}||kr|St|t||��|��S)z�Crop the span at the given offset. Args: offset (int): A value between start and end. Returns: Span: A new (possibly smaller) span. )r+r<rBs r4� right_cropzSpan.right_cropXs:��!���s�E� �S�=�=��K��E�3�v�s�+�+�U�3�3�3r6�cellsc�>�|r|\}}}t|||z|��S|S)z�Extend the span by the given number of cells. Args: cells (int): Additional space to add to end of span. Returns: Span: A span. rA)r3rFr,r-r.s r4�extendz Span.extendfs3�� � � $� �E�3����s�U�{�E�2�2� 2��Kr6N)�__name__� __module__� __qualname__�__doc__�int�__annotations__r�strrr5�boolr9rrr?rCrErH�r6r4r+r+/s�������*�*� �J�J�J�� �H�H�H�� ��e�� ����)�A�#�A�A�A�A�%�$�%�%�%�%� �C� �E�&�(�6�2B�*B�$C� � � � � 9�3� 9�6� 9� 9� 9� 9� 4�� 4�� 4� 4� 4� 4� �C� �F� � � � � � r6r+c��eZdZdZgd�Z d�ddddddd�dedeeefd ed d ed d ee dedee dee e ddfd�Z de fd�Zde fd�Zdefd�Zdefd�Zdeddfd�Zdede fd�Zdede fd�Zdee efddfd�Zede fd���Zedefd���Zeddddddd �dedeeefd!e d"eed ed d ed deddfd#���Zedddddd$d%�dedeeefd ed d ed d ee dedee ddfd&���Ze d�ddd'�dede d ed d ed ddf d(���Z!edddddd$dd)�d*eede"ee ffdeeefd ed d ed d ee dede d+ee#eefddfd,���Z$edefd-���Z%e%j&d.eddfd/���Z%ede e fd0���Z'e'j&de e ddfd1���Z'd�d2eddfd3�Z(d�d4�Z) d�deeefd6e dee ddfd7�Z* d�deeefd6e dee ddfd8�Z+ d�d+e#eefd6e dee ddfd9�Z,d�d+ee#eefd:eddfd;�Z-d<eddfd=�Z.d>d?d@e defdA�Z/dBe ddfdC�Z0 d�ddD�dEee1eefdeee2e fdFede fdG�Z3ddH�dIe4edeeefdJe de fdK�Z5d�dL�Z6dMe ddfdN�Z7dOe ddfdP�Z8d>d?dQdRde4e9fdS�Z:d>d?dQdRde;fdT�Z<d�d>d?dede4dUfdV�Z=dWe4dddfdX�Z>d�dee ddfdY�Z?ddZd[�d\e d ed d]e ddfd^�Z@d�d_�ZAd�dae dbeddfdc�ZBd�dae dbeddfdd�ZCd�dae dbeddfde�ZDd�dfeEdge dbeddfdh�ZF d�dedefdeeedifddfdj�ZGd�dk�ZHdle4e"eee fddfdm�ZId�dn�ZJ d�dZdZdo�dpedqe dre deKfds�ZLdte4e deKfdu�ZMd�dwe ddfdx�ZNddd$ddy�d>d?dge d ed d ed de d ee deKfdz�ZOdge deKfd{�ZPde fd|�ZQ d�d}d~d�d�ee dbede ddfd��ZRdS)�r)a�Text with color / style. Args: text (str, optional): Default unstyled text. Defaults to "". style (Union[str, Style], optional): Base style for text. Defaults to "". justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None. end (str, optional): Character to end text with. Defaults to "\\n". tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. spans (List[Span], optional). A list of predefined style spans. Defaults to None. ) �_textr.�justify�overflow�no_wrapr-�tab_size�_spans�_length�N� )rTrUrVr-rW�spans�textr.rTr#rUr$rVr-rWr\r/c���t|��} | g|_||_||_||_||_||_||_|pg|_t| ��|_ dSr8) rrSr.rTrUrVr-rWrX�lenrY) r3r]r.rTrUrVr-rWr\�sanitized_texts r4�__init__z Text.__init__�sc��-�T�2�2��$�%�� ��� �29�� �4<�� ��� ���� �� �"'�+�2�� ���/�/�� � � r6c��|jSr8)rYr2s r4�__len__z Text.__len__�s ���|�r6c�*�t|j��Sr8)rPrYr2s r4r9z Text.__bool__�s���D�L�!�!�!r6c��|jSr8��plainr2s r4�__str__z Text.__str__�s ���z�r6c�8�d|j�d|j�d|j�d�S)Nz<text � �>)rgrXr.r2s r4r5z Text.__repr__�s)��F�� �F�F�t�{�F�F�t�z�F�F�F�Fr6�otherc��t|ttf��r+|���}|�|��|St Sr8)� isinstancerOr)�copy�append�NotImplemented)r3rl�results r4�__add__z Text.__add__�sB�� �e�c�4�[� )� )� ��Y�Y�[�[�F� �M�M�%� � � ��M��r6c�z�t|t��stS|j|jko|j|jkSr8)rnr)rqrgrX�r3rls r4�__eq__z Text.__eq__�s7���%��&�&� "�!� !��z�U�[�(�H�T�[�E�L�-H�Hr6c��t|t��r ||jvSt|t��r|j|jvSdS)NF)rnrOrgr)rus r4� __contains__zText.__contains__�sG�� �e�S� !� !� -��D�J�&� &� ��t� $� $� -��;�$�*�,� ,��ur6�slicec� ��dtddf�fd� }t|t��r ||��S|�t�j����\}}}|dkr��||g��}|dSt d���)Nr:r/r)c�x����t�t�j���fd��jD��d���}|S)Nc�R��g|]#\}}}|�cxkr|k�nn �dd|����$S)rrrQ��.0r,r-r.�_Spanr:s ��r4� <listcomp>z9Text.__getitem__.<locals>.get_text_at.<locals>.<listcomp>�sY������)��s�E��V�,�,�,�,�u�,�,�,�,�,��E�!�Q��&�&�,�,�,r6rZ)r\r-)r+r)rgrX)r:r]rr3s` @�r4� get_text_atz%Text.__getitem__.<locals>.get_text_at�sa������E��� �6�"������-1�[���� ����D��Kr6rz%slices with step!=1 are not supported)rMrn�indicesr_rg�divide� TypeError)r3ryr�r,�stop�step�liness` r4� __getitem__zText.__getitem__�s���� �� �� � � � � � � �e�S� !� !� I��;�u�%�%� %� %� � �c�$�*�o�o� >� >� �E�4���q�y�y�� � �U�D�M�2�2���Q�x�� � G�H�H�Hr6c�*�t|j��S)z5Get the number of cells required to render this text.)rrgr2s r4rz Text.cell_len�s���� �#�#�#r6c��ddlm}g}|j}dd|jfgd�|jD���d�|jD���t |��d|jf�}|�tdd�����d}|j}|D]C\}}} ||kr|||||�����|}| r||rd | �d �nd | �d ����Dd � |��} | S) z~Get console markup to render this Text. Returns: str: A string potentially creating markup tags. r)�escaperFc3�4K�|]}|jd|jfV��dS�FN)r,r.�r~�spans r4� <genexpr>zText.markup.<locals>.<genexpr>�s-���� F� F�$�t�z�5�$�*�-� F� F� F� F� F� Fr6c3�4K�|]}|jd|jfV��dS�TN)r-r.r�s r4r�zText.markup.<locals>.<genexpr>�s-���� C� C�t�t�x��t�z�*� C� C� C� C� C� Cr6T��keyz[/�]�[rZ) �markupr�rgr.rXr_�sortrrp�join) r3r��outputrg� markup_spans�positionrpr:�closingr.r�s r4r�z Text.markup�sB�� #�"�"�"�"�"���� �� ��t�z� "� � F� F�$�+� F� F� F� �D� C�t�{� C� C� C� ���Z�Z��t�z� *�  � � ���j��A�.�.��/�/�/������&2� C� C� "�F�G�U��� � ���v�v�e�H�V�O�4�5�5�6�6�6�!��� C����A�}�E�}�}�}�}�\��\�\�\�B�B�B���������� r6T)r.�emoji� emoji_variantrTrUr-r�r�c�Z�ddlm}|||||���} || _|| _|| _| S)a�Create Text instance from markup. Args: text (str): A string containing console markup. style (Union[str, Style], optional): Base style for text. Defaults to "". emoji (bool, optional): Also render emoji code. Defaults to True. emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None. justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. end (str, optional): Character to end text with. Defaults to "\\n". Returns: Text: A Text instance with markup rendered. r)�render)r�r�)r�r�rTrUr-) �clsr]r.r�r�rTrUr-r�� rendered_texts r4� from_markupzText.from_markupsL��4 #�"�"�"�"�"���t�U�%�}�U�U�U� � '� ��!)� ��� ���r6��r.rTrUrVr-rWc ��ddlm}td||||||���} |��} | �d�| �|��D����} | S)a�Create a Text object from a string containing ANSI escape codes. Args: text (str): A string containing escape codes. style (Union[str, Style], optional): Base style for text. Defaults to "". justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None. end (str, optional): Character to end text with. Defaults to "\\n". tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. r)� AnsiDecoderr[)rTrUrVr-rWr.c3�K�|]}|V��dSr8rQ�r~�lines r4r�z!Text.from_ansi.<locals>.<genexpr>Hs"����C�C�d�T�C�C�C�C�C�Cr6)�ansir�r)r��decode) r�r]r.rTrUrVr-rWr��joiner�decoderrrs r4� from_ansizText.from_ansi%s}��. &�%�%�%�%�%�� ������� � � ���+�-�-�����C�C�g�n�n�T�.B�.B�C�C�C�C�C��� r6�rTrUc�L�||||���}|�|��|S)aaConstruct a Text instance with a pre-applied styled. A style applied in this way won't be used to pad the text when it is justified. Args: text (str): A string containing console markup. style (Union[str, Style]): Style to apply to the text. Defaults to "". justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. Returns: Text: A text instance with a style applied to the entire string. r�)�stylize)r�r]r.rTrU� styled_texts r4�styledz Text.styledKs4��*�c�$��(�C�C�C� ����E�"�"�"��r6)r.rTrUrVr-rW�meta�partsr�c���|||||||���} | j} t} |D]*} t| | tf��r | | ���%| | ��+|r| �|��| S)a�Construct a text instance by combining a sequence of strings with optional styles. The positional arguments should be either strings, or a tuple of string + style. Args: style (Union[str, Style], optional): Base style for text. Defaults to "". justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None. end (str, optional): Character to end text with. Defaults to "\\n". tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. meta (Dict[str, Any], optional). Meta data to apply to text, or None for no meta data. Default to None Returns: Text: A new text instance. r�)rpr)rnrO� apply_meta) r�r.rTrUrVr-rWr�r�r]rp�_Text�parts r4�assemblez Text.assembleds���6�s�������  � � �������� � �D��$��� �-�-� ���t� � � � ���� � � � � "� �O�O�D� !� !� !�� r6c��t|j��dkr%d�|j��g|jdd�<|jdS)z Get the text as a single string.rrZNr)r_rSr�r2s r4rgz Text.plain�sC�� �t�z�?�?�a� � ��W�W�T�Z�0�0�1�D�J�q�q�q�M��z�!�}�r6�new_textc���||jkrXt|��}|g|jdd�<|j}t |��|_||jkr|���dSdSdS)zSet the text to a new value.N)rgrrSrYr_� _trim_spans)r3r�r`� old_lengths r4rgz Text.plain�s{�� �t�z� !� !�0��:�:�N�+�,�D�J�q�q�q�M���J��~�.�.�D�L��D�L�(�(�� � �"�"�"�"�"� "� !� )�(r6c��|jS)z.Get a reference to the internal list of spans.�rXr2s r4r\z Text.spans�s ���{�r6c�$�|dd�|_dS)z Set spans.Nr�)r3r\s r4r\z Text.spans�s���A�A�A�h�� � � r6rgc �n�t||j|j|j|j|j|j���}|S)zNReturn a new Text instance with copied metadata (but not the string or spans).r�)r)r.rTrUrVr-rW)r3rg� copy_selfs r4� blank_copyzText.blank_copy�s?��� ��*��L��]��L����]� � � � ��r6c ��t|j|j|j|j|j|j|j���}|j|jdd�<|S)zReturn a copy of this instance.r�N) r)rgr.rTrUrVr-rWrX)r3r�s r4roz Text.copy�sT��� �J��*��L��]��L����]� � � � �#�k� �������r6rr,c ���|rpt|��}|dkr||z}|�|}|dkr||z}||ks||krdS|j�t|t ||��|����dSdS)azApply a style to the text, or a portion of the text. Args: style (Union[str, Style]): Style instance or style definition to apply. start (int): Start offset (negative indexing is supported). Defaults to 0. end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None. rN)r_rXrpr+r<�r3r.r,r-�lengths r4r�z Text.stylize�s��� � E���Y�Y�F��q�y�y������{����Q�w�w��s�l������#��,�,��� �K� � �t�E�3�v�s�+;�+;�U�C�C� D� D� D� D� D� E� Er6c ���|rqt|��}|dkr||z}|�|}|dkr||z}||ks||krdS|j�dt|t ||��|����dSdS)a�Apply a style to the text, or a portion of the text. Styles will be applied before other styles already present. Args: style (Union[str, Style]): Style instance or style definition to apply. start (int): Start offset (negative indexing is supported). Defaults to 0. end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None. rN)r_rX�insertr+r<r�s r4�stylize_beforezText.stylize_before�s��� � H���Y�Y�F��q�y�y������{����Q�w�w��s�l������#��,�,��� �K� � �q�$�u�c�&�#�.>�.>��"F�"F� G� G� G� G� G� H� Hr6c�^�tj|��}|�|||���dS)agApply metadata to the text, or a portion of the text. Args: meta (Dict[str, Any]): A dict of meta information. start (int): Start offset (negative indexing is supported). Defaults to 0. end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None. )r,r-N)r� from_metar�)r3r�r,r-r.s r4r�zText.apply_meta�s1�����%�%�� � � �U�%�S� �1�1�1�1�1r6�handlersc ���|�in|}|�d�|���D����|�tj|����|S)a�Apply event handlers (used by Textual project). Example: >>> from rich.text import Text >>> text = Text("hello world") >>> text.on(click="view.toggle('world')") Args: meta (Dict[str, Any]): Mapping of meta information. **handlers: Keyword args are prefixed with "@" to defined handlers. Returns: Text: Self is returned to method may be chained. Nc� �i|] \}}d|��|�� S)�@rQ)r~r��values r4� <dictcomp>zText.on.<locals>.<dictcomp>s$��I�I�I�*�#�u�Y��Y�Y��I�I�Ir6)�update�itemsr�rr�)r3r�r�s r4�onzText.on s]���\�r�r�t�� � � �I�I����8H�8H�I�I�I�J�J�J� � � �U�_�T�*�*�+�+�+�� r6�suffixc��|j�|��r$|�t|����dSdS)zaRemove a suffix if it exists. Args: suffix (str): Suffix to remove. N)rg�endswithrEr_)r3r�s r4� remove_suffixzText.remove_suffixsD�� �:� � �v� &� &� )� �O�O�C��K�K� (� (� (� (� (� )� )r6�consoler!r:c���|dkrt|��|z}|j}||j�����}|jD]&\}}}||cxkr|krn�|||d���z }�'|S)a Get the style of a character at give offset. Args: console (~Console): Console where text will be rendered. offset (int): Offset in to text (negative indexing supported) Returns: Style: A Style instance. rrZ�r%)r_� get_styler.rorX)r3r�r:r�r.r,r-� span_styles r4�get_style_at_offsetzText.get_style_at_offset(s��� �A�:�:���Y�Y��'�F��%� �� �$�*�%�%�*�*�,�,��&*�k� ;� ;� "�E�3� ��V�$�$�$�$�u�$�$�$�$�$����:�r�:�:�:�:���� r6�spacesc������dkrdS|j}d�z}|rTt|�����fd�|D��|jdd�<|j�|��|xj�z c_dS|xj|z c_dS)z�Extend the Text given number of spaces where the spaces have the same style as the last character. Args: spaces (int): Number of spaces to add to the Text. rNrjc�T��g|]$}|j�kr|����n|��%SrQ)r-rH)r~r�� end_offsetr�s ��r4r�z%Text.extend_style.<locals>.<listcomp>HsF�������(,�x�:�'=�'=�� � �F�#�#�#�4���r6)r\r_rXrSrprYrg)r3r�r\� new_spacesr�s ` @r4� extend_stylezText.extend_style<s����� �Q�;�;� �F�� ���6�\� � � %��T���J������!����D�K����N� �J� � �j� )� )� )� �L�L�F� "�L�L�L�L� �J�J�*� $�J�J�J�Jr6)� style_prefix� re_highlightr�c �4�d}|jj}t}|j}t |t ��rt j|��}|�|��D]�}|j } |rO| ��\} } t|��r||| | ���n|} | �| | kr||| | | ����|dz }|� ��� ��D]6} | | ��\} } | dkr | | kr||| | |�| �������7��|S)a%Highlight text with a regular expression, where group names are translated to styles. Args: re_highlight (Union[re.Pattern, str]): A regular expression object or string. style (Union[GetStyleCallable, StyleType]): Optional style to apply to whole match, or a callable which accepts the matched text and returns a style. Defaults to None. style_prefix (str, optional): Optional prefix to add to style group names. Returns: int: Number of regex matches rNr�����) rXrpr+rgrnrO�re�compile�finditerr��callable� groupdict�keys)r3r�r.r��count� append_spanrrg�match�get_spanr,r-� match_style�names r4�highlight_regexzText.highlight_regexQs[��&���k�(� ���� �� �l�C� (� (� 4��:�l�3�3�L�!�*�*�5�1�1� L� L�E��z�H�� @�%�X�Z�Z� ��s�9A�%���S�e�e�E�%��)�$4�5�5�5�e� ��*�s�U�{�{��K���e�S�+� >� >�?�?�?� �Q�J�E����)�)�.�.�0�0� L� L��%�X�d�^�^� ��s��B�;�;�3��;�;��K���e�S�\�2I�4�2I�2I� J� J�K�K�K�� L�� r6)�case_sensitive�wordsr�c�.�d�d�|D����}|jj}d}t}t j||j|rdn tj���D]5}|�d��\} } ||| | |����|dz }�6|S)aBHighlight words with a style. Args: words (Iterable[str]): Words to highlight. style (Union[str, Style]): Style to apply. case_sensitive (bool, optional): Enable case sensitive matching. Defaults to True. Returns: int: Number of words highlighted. �|c3�>K�|]}tj|��V��dSr8)r�r��r~�words r4r�z'Text.highlight_words.<locals>.<genexpr>�s*����>�>��B�I�d�O�O�>�>�>�>�>�>r6r��flagsr) r�rXrpr+r�r�rg� IGNORECASEr�) r3r�r.r��re_words�add_spanr�rr�r,r-s r4�highlight_wordszText.highlight_wordsys���"�8�8�>�>��>�>�>�>�>���;�%�������[� �d�j�^�(N����� � � � � �E����A���J�E�3� �H�U�U�5�#�u�-�-� .� .� .� �Q�J�E�E�� r6c�B�|j���|_dS)z"Strip whitespace from end of text.N)rg�rstripr2s r4r z Text.rstrip�s���Z�&�&�(�(�� � � r6�sizec��t|��}||krm||z }t�|j��}|�It|�d����}|�t ||����dSdSdS)z�Remove whitespace beyond a certain width at the end of the text. Args: size (int): The desired size of the text. Nr)r_�_re_whitespace�searchrg�grouprEr<)r3r � text_length�excess�whitespace_match�whitespace_counts r4� rstrip_endzText.rstrip_end�s��� �$�i�i� � �� � � �4�'�F�-�4�4�T�Z�@�@� ��+�#&�'7�'=�'=�a�'@�'@�#A�#A� �����$4�f� =� =�>�>�>�>�>� � �,�+r6� new_lengthc��t|��}||kr:||kr|�||z ��dS|�||z ��dSdS)z<Set new length of the text, clipping or padding is required.N)r_� pad_rightrE)r3rr�s r4� set_lengthzText.set_length�se���T���� �Z� � �� �"�"����z�F�2�3�3�3�3�3������ 3�4�4�4�4�4� � r6�optionsr"c #�K�|j�|jn|j}|jp |jpt}|jp |jpt}|�||j|||pdt|j|jd�����}td��� |��}|� ||j ���Ed{V��dS)Nr�F�rTrUrWrVr[�r-) rWrTr&rUr(�wrap� max_widthrrVr)r�r�r-)r3r�rrWrTrUr�� all_liness r4�__rich_console__zText.__rich_console__�s�����-1�M�,A��(�(�t�}���,�D�'�/�D�_���=�H�G�$4�H�8H��� � � � � ����]���d�l�G�O�U�C�C� � � ����J�J�O�O�E�*�*� ��#�#�G���#�:�:�:�:�:�:�:�:�:�:�:r6c���|j}|���}|rtd�|D����nd}|���}|rtd�|D����n|}t ||��S)Nc3�4K�|]}t|��V��dSr8�rr�s r4r�z(Text.__rich_measure__.<locals>.<genexpr>�s(����>�>��X�d�^�^�>�>�>�>�>�>r6rc3�4K�|]}t|��V��dSr8r"rs r4r�z(Text.__rich_measure__.<locals>.<genexpr>�s(����1�1�4�����1�1�1�1�1�1r6)rg� splitlines�maxr?r)r3r�rr]r��max_text_widthr��min_text_widths r4�__rich_measure__zText.__rich_measure__�s����z�����!�!��BG�N��>�>��>�>�>�>�>�>�Q��� � � � ��5:� N�C�1�1�5�1�1�1� 1� 1� 1�� ��>�>�:�:�:r6rc#�N������K�t}|j}|js"t|��V�|r ||��V�dSt|jt j������tt|jd����}�fd�|D����|j ���d<dgd�|D���d�|D���t|��d df�}|� tdd��� ��g��j }�j}i��j�t j�d t f�����fd � } t#||dd���D]J\\} } } \} }}| r || ��n || ��| | kr||| | �| ����V��K|r||��V�dSdS) aRender the text as Segments. Args: console (Console): Console instance. end (Optional[str], optional): Optional end character. Returns: Iterable[Segment]: Result of render that may be written to the console. Nr�rc�8��i|]\}}|�|j����SrQ�r.)r~�indexr�r�s �r4r�zText.render.<locals>.<dictcomp>�s+���V�V�V�k�e�T�U�I�I�d�j�1�1�V�V�Vr6r)rFrc3�0K�|]\}}|jd|fV��dSr�)r,�r~r,r�s r4r�zText.render.<locals>.<genexpr>�s/���� M� M�[�U�D�t�z�5�%�(� M� M� M� M� M� Mr6c3�0K�|]\}}|jd|fV��dSr�rr.s r4r�zText.render.<locals>.<genexpr>�s/���� J� J�+�%��t�x��u�%� J� J� J� J� J� Jr6Tr�r/c���t�fd�t���D����}�|��}|�|S�|��}|�|<|S)z#Construct current style from stack.c3�(�K�|] }�|V�� dSr8rQ)r~� _style_id� style_maps �r4r�z9Text.render.<locals>.get_current_style.<locals>.<genexpr>�s(�����O�O�I�9�Y�/�O�O�O�O�O�Or6)�tuple�sorted)�styles� cached_style� current_style�combine�stack� style_cache�style_cache_getr3s �����r4�get_current_stylez&Text.render.<locals>.get_current_style�sc����O�O�O�O�����O�O�O�O�O�F�*�?�6�2�2�L��'�#�#�#�G�F�O�O�M�"/�K�� � � r6)rrgrXrr�r�null�list� enumerater.r_r�rrp�remove�getr9�zip)r3r�r-�_Segmentr]�enumerated_spansr\� stack_append� stack_popr=r:�leaving�style_id� next_offset�_r9r�r:r;r<r3s @@@@@@r4r�z Text.render�sZ�������������z���{� ��$�-�-� � � �� $��h�s�m�m�#�#�#� �F��G�-�u�z�|�|�D�D�D� �� �$�+�q� 9� 9�:�:��V�V�V�V�EU�V�V�V� � �y���,�,� �!� � � � M� M�<L� M� M� M� �K� J�9I� J� J� J� ���Y�Y��a� �  �� � � �z�!�Q�'�'� �(�(�(����|� ��L� �68� �%�/���-�� !�5� !� !� !� !� !� !� !� !� !� !�AD�E�5�QR�QS�QS�9�@U�@U� N� N� <� '�V�W�h�)<�+�q�!�� '�� �(�#�#�#�#�� �X�&�&�&��V�#�#��h�t�F�;�$6�7�9J�9J�9L�9L�M�M�M�M�M�� � ��(�3�-�-� � � � � � � r6r�c ������ �����}dtdf��fd� }|jj}|jj}|jj}d� t �|��D]s}||j��|jr+|�� � t|��z|j����|�� fd�|jD����� t|��z � �t� |_ |S)z�Join text together with this instance as the separator. Args: lines (Iterable[Text]): An iterable of Text instances to join. Returns: Text: A new text instance containing join text. r/r)c3�l�K��jr!t���D]\}}|V�|s�V��dS�Ed{V��dSr8)rgr)�lastr�r�r3s ��r4� iter_textzText.join.<locals>.iter_textsq������z� !�"+�E�"2�"2�#�#�J�D�$��J�J�J��#�"� � � ��#�#� !� � � � � � � � � r6rc3�F�K�|]\}}}��|z�|z|��V��dSr8rQr}s ��r4r�zText.join.<locals>.<genexpr>*sS�������%�E�3����f�u�n�f�s�l�E�:�:������r6) r�r rSrHrXrpr+r.r_rY) r3r�r�rO� extend_textr�� extend_spansr]rr:s `` @@r4r�z Text.join s/�������?�?�$�$�� !�8�F�+� !� !� !� !� !� !� !��n�+� ��o�,� ���-� ������I�K�K� � �D� �K�� � #� #� #��z� K�� �E�E�&�&�3�t�9�9�*<�d�j�I�I�J�J�J� �L������)-����� � � � �c�$�i�i� �F�F�!����r6c��d|jvrdS|�|j}|�d}g}|j}|�dd���D]�}d|jvr ||���d}|�dd���}|D]�}|j�d��rQ|jddd�d z|jd<||jz }||z}|r||z } |�| ��|| z }n ||jz }||������td ��� |��} | jg|_t|j��|_ | j |j dd�<dS) ztConverts tabs to spaces. Args: tab_size (int, optional): Size of tabs. Defaults to 8. � Nr�r[T)�include_separatorrr�rjrZ) rgrWrpr?r�rSrr�r)r�r_rYrX) r3rWr�rpr�� cell_positionr�r�� tab_remainderr�rrs r4� expand_tabszText.expand_tabs2s��� �t�z� !� !� �F� � ��}�H� � ��H�!������J�J�t�t�J�<�<� !� !�D��4�:�%�%���t� � � � � !� �� � �4�4� �@�@��!� !� !�D��z�*�*�4�0�0� 7�)-��B�����)<�s�)B�� �2��%���6� �(5��(@� �(�4�%-� �%=�F� �-�-�f�5�5�5�)�V�3�M��%���6� ��F�4�L�L�L�L� !��b�����x�(�(���l�^�� ��4�:���� ���� �A�A�A���r6F)rU�padrrYc�h�|p |jpt}|dkr�t|j��}||krA|dkr!t |j|dz ��dz|_nt |j|��|_|r<||kr8||z }|j�d|z��g|_t |j��|_dSdSdSdS)auTruncate text if it is longer that a given width. Args: max_width (int): Maximum number of characters in text. overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None, to use self.overflow. pad (bool, optional): Pad with spaces if the length is less than max_width. Defaults to False. �ignore�ellipsisru…rjN)rUr(rrgrrSr_rY)r3rrUrY� _overflowr�r�s r4�truncatez Text.truncate\s����A�� �A�1A� � �� � ��d�j�)�)�F�� �!�!�� �*�*�!.�t�z�9�q�=�!I�!I�E�!Q�D�J�J�!.�t�z�9�!E�!E�D�J�� /�v� �)�)�"�V�+��!%��;�S�6�\�;�;�<�� �"�4�:���� � � � !� � /� /�)�)r6c�|���t|j���t���fd�|jD��|jdd�<dS)z=Remove or modify any spans that are over the end of the text.c ���g|]D}|j�k� |j�kr|n)�|jt�|j��|j����ESrQ�r,r-r<r.�r~r�r� max_offsets ��r4r�z$Text._trim_spans.<locals>.<listcomp>{�f��� � � � ��z�J�&�&� �8�j�(�(����U�4�:�s�:�t�x�'@�'@�$�*�M�M�'�&�&r6N�r_rgr+rX)r3rrcs @@r4r�zText._trim_spanswsU�������_�_� ��� � � � � � � �  � � �� �A�A�A���r6rjr�� characterc�����t|��dks Jd����r>|�z}|�|j�|��|_t���fd�|jD��|jdd�<dSdS)z�Pad left and right with a given number of characters. Args: count (int): Width of padding. character (str): The character to pad with. Must be a string of length 1. r�&Character must be a string of length 1c�>��g|]\}}}�|�z|�z|����SrQrQ�r~r,r-r.rr�s ��r4r�zText.pad.<locals>.<listcomp>��E������%�E�3����e�e�m�S�5�[�%�8�8���r6Nre)r3r�rf�pad_charactersrs ` @r4rYzText.pad�s������9�~�~��"�"�"�$L�"�"�"� � �&��.�N�*�H�D�J�H��H�H�D�J��E������)-�����D�K����N�N�N�  � r6c����t|��dks Jd����r:|�z�|j��|_t���fd�|jD��|jdd�<dSdS)z�Pad the left with a given character. Args: count (int): Number of characters to pad. character (str, optional): Character to pad with. Defaults to " ". rrhc�>��g|]\}}}�|�z|�z|����SrQrQrjs ��r4r�z!Text.pad_left.<locals>.<listcomp>�rkr6Nre)r3r�rfrs ` @r4�pad_leftz Text.pad_left�s������9�~�~��"�"�"�$L�"�"�"� � �%��-�;�t�z�;�;�D�J��E������)-�����D�K����N�N�N� � r6c�n�t|��dks Jd���|r|j�||z��|_dSdS)z�Pad the right with a given character. Args: count (int): Number of characters to pad. character (str, optional): Character to pad with. Defaults to " ". rrhN)r_rg)r3r�rfs r4rzText.pad_right�sS���9�~�~��"�"�"�$L�"�"�"� � <� �J�;� �E�(9�;�;�D�J�J�J� <� <r6�align�widthc�F�|�|��|t|j��z }|rr|dkr|�||��dS|dkr6|dz}|�||��|�||z |��dS|�||��dSdS)z�Align text to a given width. Args: align (AlignMethod): One of "left", "center", or "right". width (int): Desired width. character (str, optional): Character to pad with. Defaults to " ". �left�center�N)r^rrgrro)r3rqrrrf� excess_spacerts r4rqz Text.align�s��� � � �e�����x�� �3�3�3� � � 7��������|�Y�7�7�7�7�7��(�"�"�#�q�(��� � �d�I�.�.�.����|�d�2�I�>�>�>�>�>�� � �l�I�6�6�6�6�6� 7� 7r6rc ����t|ttf��std���t |���r�t|t��r�t |��}|j�|��t |��}t |���|r,|j�t||�z|����|xj �z c_ n�t|t��r�t�|�td���|j �|j r:|j����t |��z|j ����|j�|j ��|j���fd�|j���D����|xj t |��z c_ |S)z�Add text with an optional style. Args: text (Union[Text, str]): A str or Text to append. style (str, optional): A style name. Defaults to None. Returns: Text: Returns self for chaining. z(Only str or Text can be appended to TextNz2style must not be set when appending Text instancec3�F�K�|]\}}}�|�z|�z|��V��dSr8rQ�r~r,r-r.rrs ��r4r�zText.append.<locals>.<genexpr>�sU�����#�#�)��s�E��E�%�+�-�s�[�/@�%�H�H�#�#�#�#�#�#r6)rnrOr)r�r_rrSrprXr+rY� ValueErrorr.rgrHro)r3r]r.r`r:rrs @@r4rpz Text.append�s������$��d� �,�,� H��F�G�G� G� �t�9�9� *��$��$�$� *�!4�T�!:�!:��� �!�!�.�1�1�1��T����!�.�1�1� ��R��K�&�&�t�F�F�[�4H�%�'P�'P�Q�Q�Q�� � � �+� � � ��D�$�'�'� *����$�$�L����#�l� ��:���K�&�&���k�;��T���+B�D�J�O�O����� �!�!�$�*�-�-�-�� �"�"�#�#�#�#�#�-1�[�-=�-=�-?�-?�#�#�#����� � ��D� � �)� � �� r6c ����t�|j�|jr:|j����t |��z|j����|j�|j��|j���fd�|j� ��D����|xjt |��z c_|S)a Append another Text instance. This method is more performant that Text.append, but only works for Text. Args: text (Text): The Text instance to append to this instance. Returns: Text: Returns self for chaining. c3�F�K�|]\}}}�|�z|�z|��V��dSr8rQrzs ��r4r�z#Text.append_text.<locals>.<genexpr>sU����� � �!��s�E� �E�%�+�%�s�[�'8�%� @� @� � � � � � r6) r+rYr.rXrpr_rSrgrHro)r3r]rrs @@r4� append_textzText.append_text�s��������l� � �:� X� �K� � �u�u�[�+��D� � �2I�4�:�V�V� W� W� W� � ���$�*�%�%�%� � ��� � � � � �%)�[�%5�%5�%7�%7� � � � � � � � � ��D� � �!� � �� r6�tokensc �(�|jj}|jj}t}t |��}|D]Y\}}t |��}||��|r&||||t |��z|����|t |��z }�Z||_|S)a)Append iterable of str and style. Style may be a Style instance or a str style definition. Args: tokens (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style. Returns: Text: Returns self for chaining. )rSrprXr+r_rrY)r3rr~r�rr:�contentr.s r4� append_tokenszText.append_tokenss����j�'� ��k�(� ����T����$� #� #�N�G�U�)�'�2�2�G� �K�� � � �� I�� �E�E�&�&�3�w�<�<�*?��G�G�H�H�H� �c�'�l�l� "�F�F��� �� r6c�D�|j�|j��dS)z�Copy styles from another Text instance. Args: text (Text): A Text instance to copy styles from, must be the same length. N)rXrH)r3r]s r4� copy_styleszText.copy_styless"�� � ���4�;�'�'�'�'�'r6)rU� allow_blank� separatorrUr�c������s Jd���|j���vr"t|���g��S|rE|�d�t jt j������D����}nOdttf��fd� }t�fd�|�|����D����}|s)�� ���r|� ��|S)a�Split rich text in to lines, preserving styles. Args: separator (str, optional): String to split on. Defaults to "\\n". include_separator (bool, optional): Include the separator in the lines. Defaults to False. allow_blank (bool, optional): Return a blank line if the text ends with a separator. Defaults to False. Returns: List[RichText]: A list of rich text, one per line of the original. zseparator must not be emptyc3�>K�|]}|���V��dSr8r�r~r�s r4r�zText.split.<locals>.<genexpr>?s;���� � � %�� � � � � � � � � � r6r/c3��K�tjtj������D]!}|���\}}|V�|V��"dSr8)r�r�r�r�)r�r,r-r�r]s ��r4� flatten_spansz!Text.split.<locals>.flatten_spansDs[������[���9�)=�)=�t�D�D���E�!&�����J�E�3��K�K�K��I�I�I�I��r6c3�2�K�|]}|j�k� |V��dSr8rf)r~r�r�s �r4r�zText.split.<locals>.<genexpr>Js8����������y�AX�AX��AX�AX�AX�AX��r6) rgrror�r�r�r�r rMr��pop)r3r�rUr�r�r�r]s ` @r4r?z Text.split's9����"�7�7�7�7�7�y��z�� �D� � ��$�)�)�+�+��'�'� '� � ��K�K� � �)+��R�Y�y�5I�5I�4�)P�)P� � � ���E�E�  �8�C�=� � � � � � � � �����!%���]�]�_�_�!=�!=������E�� �t�}�}�Y�7�7� � �I�I�K�K�K�� r6�offsetsc �������t|��}|s"t|���g��S|j�t ���}dg|�|�}tt ||dd�����}|j�|j�|j�t�t�����fd�|D����}|j s|Sd�|j D��}t |��}t} |j D]�\} } �d} |} | | zdz} ||\}}| |kr|dz } n | |kr|dz} nn | | zdz}�-| |kr|}n4|x}} |} ||\}}| |kr|dz } n | |kr|dz} nn | | zdz}�-t||dz��D]X}||\}}td| |z ��}t| |z ||z ��}||kr||| ||������Y��|S)z�Divide text in to a number of lines at given offsets. Args: offsets (Iterable[int]): Offsets used to divide text. Returns: Lines: New RichText instances between offsets. rrNc3�L�K�|]\}}��||�������V��dS))r.rTrUNrQ)r~r,r-r�rTrUr.r]s �����r4r�zText.divide.<locals>.<genexpr>jsb����� � ���s� �E��U�3�Y����!�  � � � � � � � � r6c�&�g|]}|jj��SrQ)rXrpr�s r4r�zText.divide.<locals>.<listcomp>vs��I�I�I����+�I�I�Ir6rv)r?rrorgr_rCr.rTrUr)rX�_linesr+�ranger%r<)r3r��_offsetsr�divide_offsets� line_ranges� new_lines� _line_appends� line_countr� span_start�span_end� lower_bound� upper_bound� start_line_no� line_start�line_end� end_line_no�line_no� new_start�new_endr�rTrUr.r]s @@@@@r4r�z Text.divideSs����������=�=��� (��$�)�)�+�+��'�'� '��z���$�i�i� ��4�h�4� �4���3�~�~�a�b�b�/A�B�B�C�C� �� ���,���=����� � � � � � � � �*� � � � � � ��{� �� �I�I� �8H�I�I�I� ���%�%� ���+/�;�$ M�$ M� '�J��%��K�$�K�(�;�6�1�<�M� A�'2�=�'A�$� �H�� �*�*�"/�!�"3�K�K��(�*�*�"/�!�"3�K�K��!,�{�!:�q� @� � A��(�"�"�+� � �,9�9� �k�(� �C�+6�{�+C�(�J���*�,�,�&1�A�o� � �!�H�,�,�&1�A�o� � ��#.��#<��"B�K�C�!�� �a��@�@� M� M��'2�7�';�$� �H���:� �#:�;�;� ��h��3�X� �5J�K�K���Y�&�&�*�M�'�*�5�5��G�U�+K�+K�L�L�L��  M��r6r�amountc�����t|j��|z �t���fd�|jD��|jdd�<|jd| �g|_|xj|zc_dS)z7Remove a number of characters from the end of the text.c ���g|]D}|j�k� |j�kr|n)�|jt�|j��|j����ESrQrarbs ��r4r�z#Text.right_crop.<locals>.<listcomp>�rdr6N)r_rgr+rXrSrY)r3r�rrcs @@r4rEzText.right_crop�s��������_�_�v�-� ��� � � � � � � �  � � �� �A�A�A���j��6�'��*�+�� � � � ��� � � � r6rc�`�|p |jpt}|p |jpt}t ||jd��p|dk}t ��} |�d���D]�} d| vr| �|��|rt | g��} n8tt| ��||dk���} | � | ��} | D]} | � |���|r| �||||���| D]} | � ||� ���| �| ����| S) aCWord wrap the text. Args: console (Console): Console instance. width (int): Number of cells available per line. justify (str, optional): Justify method: "default", "left", "center", "full", "right". Defaults to "default". overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None. tab_size (int, optional): Default tab size. Defaults to 8. no_wrap (bool, optional): Disable wrapping, Defaults to False. Returns: Lines: Number of lines. Fr[T�r�rTr')r'r�)rU)rTr&rUr(rrVrr?rXrrOr�rr^rH) r3r�rrrTrUrWrV� wrap_justify� wrap_overflowr�r�r�r�s r4rz Text.wrap�sd��.�A�$�,�A�/� � �E�D�M�E�5E� ��G�T�\�5�9�9�Q�X��=Q�������J�J�4�J�0�0� $� $�D��t�|�|�� � ��*�*�*�� 1�!�4�&�M�M� � �%�c�$�i�i��]�f�=T�U�U�U�� �K�K��0�0� �!� '� '������&�&�&�&�� ��!�!��U�L�=�"����"� =� =��� � �e�m� �<�<�<�<� �L�L�� #� #� #� #�� r6c��t��}|j}|���D]"}|�|��||���#|S)z�Fit the text in to given width by chopping in to lines. Args: width (int): Maximum characters in a line. Returns: Lines: Lines container. )rrpr?r)r3rrr�rpr�s r4�fitzText.fit�sQ���w�w������J�J�L�L� � �D� �O�O�E� "� "� "� �F�4�L�L�L�L�� r6c���d�tjd|jtj���D��} t t d�|D����pd}n#t $rd}YnwxYw|S)zrAuto-detect indentation of code. Returns: int: Number of spaces used to indent code. c�R�h|]$}t|�d������%S�r)r_rr�s r4� <setcomp>z*Text.detect_indentation.<locals>.<setcomp>�s:�� � � �� �� � �A��� � � � � r6� ^( *)(.*)$rc��g|] }|dz�|�� S)rvrQ)r~�indents r4r�z+Text.detect_indentation.<locals>.<listcomp>s"��R�R�R��v�PQ�z�R�V�R�R�Rr6r)r�r�rg� MULTILINErrr�)r3� _indentations� indentations r4�detect_indentationzText.detect_indentation�s��� � ���]�D�J�b�l�S�S�S� � � � �  ��s�R�R�-�R�R�R�S�S�X�WX� �K��� � � ��K�K�K� �����s�!A� A#�"A#u│z dim green)rfr.� indent_sizec��|�|���n|}|���}|���|�d|dz z��}tjd��}g}|j} d} |�d���D]�} |�| j��} | r| � d��s| dz } �9| � d��} tt| ��|��\}}||z�d|z��}|| jt|��d�z| _| � |dt|����| r*|� t||� ��g| z��d} | | ����| r(|� td |� ��g| z��|�d ���|��}|S) u�Adds indent guide lines to text. Args: indent_size (Optional[int]): Size of indentation, or None to auto detect. Defaults to None. character (str, optional): Character to use for indentation. Defaults to "│". style (Union[Style, str], optional): Style of indent guides. Returns: Text: New text with indentation guides. Nrjrr�rTr�rvr+rZr[)r�rorXr�r�rpr?r�rgr�divmodr_r�rHr)r�r�)r3r�rfr.� _indent_sizer]� indent_line� re_indentr��add_line� blank_linesr�r�r�� full_indents�remaining_space� new_indentr�s r4�with_indent_guideszText.with_indent_guidess���$5@�4G�t�.�.�0�0�0�[� ��y�y�{�{�� ������"�>�C�<�!�+;�$<�>�>� ��J�}�-�-� � "� ��#��� ��J�J�4�J�0�0� � �D��O�O�D�J�/�/�E�� �� � �A��� ��q� � ���[�[��^�^�F�,2�3�v�;�;� �,M�,M� )�L�/�'�,�6�O��o�8M�O�O�J�#�d�j��Z���1B�1B�&C�C�D�J� �L�L���3�z�?�?� 3� 3� 3�� �� � �$�z��"?�"?�"?�!@�;�!N�O�O�O�� � �H�T�N�N�N�N� � D� � � �d�2�U�3�3�3�4�{�B� C� C� C��?�?�4�(�(�-�-�i�8�8���r6)rZrZ)rZ)r/r))rNr8)r/N)rj)r]r)r/r))r]r)r/N)r[r�)SrIrJrKrL� __slots__rOrrrrPrMr r+rarcr9rhr5rrs�objectrvrxryr��propertyrr�� classmethodrr�r�r r�rr r�rg�setterr\r�ror�r�r�r�r�r�r�r�GetStyleCallabler�r rr rrrrrr(r�r�rXr^r�rYrorrrqrpr~r�r�rr?r�rErr�r�r�rQr6r4r)r)vs ������ � � � � �I��#%�0� .2�/3�"&��"&�&*�0�0�0��0��S�%�Z� �0� �/�*� 0� �+�,� 0��$��0��0��3�-�0���T� �#�0� �0�0�0�0�.������"�$�"�"�"�"�������G�#�G�G�G�G��S��V�����I�F�I�t�I�I�I�I� �&��T�����I��s�E�z�!2�I�v�I�I�I�I�4�$�#�$�$�$��X�$��������X��:� $&��04�-1�/3��������S�%�Z� � � � �  � �-� ��/�*���+�,���� �����[��B� $&�-1�/3�"&��"#�#�#�#��#��S�%�Z� � #� �/�*� #� �+�,� #��$��#��#��3�-�#� �#�#�#��[�#�J��� .2�/3� ������� �/�*� � �+�,� � �����[��0�$&�-1�/3�"&���)-�+�+�+��c�6�5��i��#8�8�9�+��S�%�Z� �+��/�*� +� �+�,� +� �$�� +��+��+��t�C��H�~�&�+� �+�+�+��[�+�Z��s�����X��  �\�#�c�#�d�#�#�#��\�#���t�D�z�����X�� �\��4��:��$�����\�� � �� �V� � � � � � � � �"�!� E�E��S�%�Z� �E��E��c�]� E� � E�E�E�E�:�!� H�H��S�%�Z� �H��H��c�]� H� � H�H�H�H�6JN� 2� 2���c��N� 2�+.� 2�9A�#�� 2� � 2� 2� 2� 2���x��S�#�X��/��C��F�����()�C�)�D�)�)�)�)��9��c��e�����(%�3�%�4�%�%�%�%�0?C�&� � &�&�&��G�C�L�#�-�.�&���.� �9�:�;�&� � &� � &�&�&�&�Z $� �����}���S�%�Z� �� � � � ����:)�)�)�)� ?�s� ?�t� ?� ?� ?� ?�5�S�5�T�5�5�5�5�;� �;�+;�;� �'� �;�;�;�;�& ;� � ;�+;� ;� � ;� ;� ;� ;�9 �9 �i�9 �c�9 �8�I�;N�9 �9 �9 �9 �v%�(�6�*�%�v�%�%�%�%�N('�('�H�S�M�('�T�('�('�('�('�\04�� /�/�/��/��+�,� /� � /� � /�/�/�/�6  �  �  �  �������t�����"��c��c��D����� <� <�s� <�s� <�T� <� <� <� <�7�7�;�7�s�7�s�7�T�7�7�7�7�*PT�*�*��&�#�+�&�*�/7��c�7�l�8K�/L�*� �*�*�*�*�X����,��u�S�(�9�*=�%=�>�?�� �����0(�(�(�(��*�#(�!� *�*�*��*� � *� � *� � *�*�*�*�XM�h�s�m�M��M�M�M�M�^����T�����*.2�/3��"&�.�.�.��.��.� �/�*� .� �+�,� .��.��$��.� �.�.�.�.�`�������� �C�����.&*�.��&� .�.�.��c�]�.�� .� � .� � .�.�.�.�.�.r6�__main__)r!a� Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. �Lorem�bold�ipsum�italiczjustify='left'�redr+zjustify='center'�greenru)r.rTzjustify='right'�blue�rightzjustify='full'�magenta�full)Cr�� functoolsrr�mathr�operatorr�typingrrr r r r r rrrr�_loopr�_pickr�_wraprrqrrFrr� containersr�controlrr�r�jupyterr�measurer�segmentrr.rr r�r!r"r#r$r&rNr(r�r rO�TextTyper�r+r)rI� rich.consoler]r�rule�printrQr6r4�<module>r�s�� � � � � �%�%�%�%�%�%�%�%������������� � � � � � � � � � � � � � � � � � � � � � � � � � �������������������������*�*�*�*�*�*�*�*�������(�(�(�(�(�(�������!�!�!�!�!�!� � � � � � �������#�#�#�#�#�#�#�#��P�O�O�O�O�O�O�O�O�O�O�O�O�#,���,�,�,�%+��"�+�+�+����G�$�$�� ��f�� ��1��S�E�8�I�#6�6�7��D�D�D�D�D�:�D�D�D�N�����<����D& �z���$�$�$�$�$�$� �4� P� � �D� ���'��F�+�+�+����'��H�-�-�-��g�i�i�G� �L�L�!�"�"�"� �M�M�$�e�M�$�$�$� �M�M�O�O�O� �L�L�#�$�$�$� �M�M�$�g�x�M�8�8�8� �M�M�O�O�O� �L�L�"�#�#�#� �M�M�$�f�g�M�6�6�6� �M�M�O�O�O� �L�L�!�"�"�"� �M�M�$�i��M�8�8�8� �M�M�O�O�O�O�O�3�r6
Memory