Current File : /home/inlingua/miniconda3/lib/python3.1/site-packages/rich/__pycache__/cells.cpython-312.pyc
�

~�Eg
����UddlmZddlmZddlmZddlmZgd�Zde	d<e
eD���cgc]\}}eee
||dz��D]}|���!c}}}�ZejZd	e	d
<ed�dd��Zefdd
�Zed��dd��Zdd�Z						dd�Zedk(rQeed��edd�D]
Zee��e
ddd�D]Zeede�dz�edez��!yycc}}}w) �)�annotations)�	lru_cache)�Callable�)�CELL_WIDTHS))� �~)��)�i�)ipi�)i%i�%)i(i�(zlist[tuple[int, int]]�_SINGLE_CELL_UNICODE_RANGESzCallable[[str], bool]�_is_single_cell_widthsic�`�t|�rt|�Sttt|��S)a/Get the number of cells required to display text.

    This method always caches, which may use up a lot of memory. It is recommended to use
    `cell_len` over this method.

    Args:
        text (str): Text to display.

    Returns:
        int: Get the number of cells required to display text.
    )r�len�sum�map�get_character_cell_size)�texts �*lib/python3.12/site-packages/rich/cells.py�cached_cell_lenr!s)���d�#��4�y���s�*�D�1�2�2�c��t|�dkr||�St|�rt|�Sttt|��S)z�Get the number of cells required to display text.

    Args:
        text (str): Text to display.

    Returns:
        int: Get the number of cells required to display text.
    i)rrrrr)r�	_cell_lens  r�cell_lenr3s>���4�y�3�������d�#��4�y���s�*�D�1�2�2r)�maxsizec���t|�}t}d}t|�dz
}||zdz}	||\}}}||kr|dz
}n||kDr|dz}n	|dk(rdS|S||kr	y||zdz}�8)z�Get the cell size of a character.

    Args:
        character (str): A single character.

    Returns:
        int: Number of cells (0, 1 or 2) occupied by that character.
    rr����)�ordrr)	�	character�	codepoint�_table�lower_bound�upper_bound�index�start�end�widths	         rrrCs����I��I�
�F��K��f�+��/�K�
�;�
&�1�,�E�
�"�5�M���s�E��u���!�)�K�
��_��!�)�K����1�.��.���$����{�*�q�0��rc�`�t|�r t|�}||kr|d||z
zzS|d|S|dkryt|�}||k(r|S||kr|d||z
zzSd}t|�}	||zdz}|d|dz}t|�}||dzk(rt|d�dk(r|dddzS||k(r|S||kDr|}n|}�N)z?Set the length of a string to fit within given number of cells.� Nr�rrr)rrr)	r�total�size�	cell_sizer&r'�pos�before�
before_lens	         r�
set_cell_sizer2`s���d�#��4�y���%�<��#����.�.�.��F�U�|����z�����I��E�����5���c�U�Y�.�/�/�/�
�E�

�d�)�C���s�{�q� ���i��a�����f�%�
�����"�x��r�
�';�q�'@��#�2�;��$�$�����M�����C��E�rc��t}gg}|j}|dj}d}|D]<}||�}||z|kD}	|	r||g�|dj}|}�0||�||z
}�>|D�
cgc]}
dj|
���c}
Scc}
w)ahSplit text into lines such that each line fits within the available (cell) width.

    Args:
        text: The text to fold such that it fits in the given width.
        width: The width available (number of cells).

    Returns:
        A list of strings such that each string in the list has cell width
        less than or equal to the available width.
    rrr+)r�append�join)rr(�_get_character_cell_size�lines�append_new_line�append_to_last_line�total_widthr �
cell_width�char_doesnt_fit�lines           r�
chop_cellsr>�s��� 7�� �T�E��l�l�O���)�*�*���K��	�-�i�8�
�%�
�2�U�:����Y�K�(�"'��)�"2�"2��$�K��	�*��:�%�K��',�,�e�d�B�G�G�D�M�e�,�,��,s�,B�__main__u😽u]这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。��Pr�|�xN)r�str�return�int)rrDrzCallable[[str], int]rErF)r rDrErF)rrDr,rFrErD)rrDr(rFrEz	list[str])�
__future__r�	functoolsr�typingr�_cell_widthsrr
�__annotations__�	frozensetr�chr�range�
_SINGLE_CELLS�
issupersetrrrrr2r>�__name__�printr=�n)�_start�_endr s000r�<module>rVsn��"���%�6��2���8��7�L�F�D��S�%���q��"9�:�I�	�:�	�7���
�1>�0H�0H��-�H��4��3��3�";J�
3� �4��
��
�8 �F"-�

�"-��"-��"-�J�z��	�
!�&�
)�*��~�AB�C��
�d��C�
�2�q�"�
��
�m��BC�D�GJ�J�	K�
�c�A�g���	��gs�$C3