
     h
                       U d dl mZ d dlmZ d dlmZ ddlmZ g dZde	d<    e
d	 eD                       Zej        Zd
e	d<    ed          d&d            Zefd'dZ ed          d(d            Zd)dZd*dZedk    rd e ed                      edd           D ]Z ee            ed!dd"          D ]*Z e ede          d#z               ed$ez             )d%S d%S )+    )annotations)	lru_cache)Callable   )CELL_WIDTHS))    ~   )      )   i  )ip  i  )i %  i%  )i (  i(  zlist[tuple[int, int]]_SINGLE_CELL_UNICODE_RANGESc           
     j    g | ]0\  }}t          t          t          ||d z                       D ]}|1S )r   )mapchrrange).0_start_end	characters       U/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pip/_vendor/rich/cells.py
<listcomp>r      s[       FDS%q"9"9::   	       zCallable[[str], bool]_is_single_cell_widthsi   textstrreturnintc                    t          |           rt          |           S t          t          t          |                     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sumr   get_character_cell_size)r   s    r   cached_cell_lenr"   !   s9     d## 4yys*D11222r   	_cell_lenCallable[[str], int]c                    t          |           dk     r ||           S t          |           rt          |           S t          t          t          |                     S )zGet 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   )r   r   r    r   r!   )r   r#   s     r   cell_lenr&   3   sV     4yy3yd## 4yys*D11222r   )maxsizer   c                    t          |           }t          }d}t          |          dz
  }||z   dz  }	 ||         \  }}}||k     r|dz
  }n||k    r|dz   }n
|dk    rdn|S ||k     rn	||z   dz  }>dS )zGet 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.
    r   r      T)ordr   r   )	r   	codepoint_tablelower_boundupper_boundindexstartendwidths	            r   r!   r!   C   s     IIFKf++/K;&1,E
1"5MsEu!)KK__!)KK11.$${*q0
1 1r   totalc                   t          |           r*t          |           }||k     r| d||z
  z  z   S | d|         S |dk    rdS t          |           }||k    r| S ||k     r| d||z
  z  z   S d}t          |           }	 ||z   dz  }| d|dz            }t          |          }||dz   k    r&t          |d                   dk    r|dd         dz   S ||k    r|S ||k    r|}n|}g)	z?Set the length of a string to fit within given number of cells. Nr    Tr)   r   r*   )r   r   r&   )	r   r4   size	cell_sizer1   r2   posbefore
before_lens	            r   set_cell_sizer=   `   s8    d## 4yy%<<#...FUF|zzrIE5cUY.///E
d))Cs{q iaif%%
""xr
';';q'@'@#2#;$$MCCEr   r3   	list[str]c                    t           }g g}|j        }|d         j        }d}| D ]D} ||          }||z   |k    }	|	r ||g           |d         j        }|}4 ||           ||z  }Ed |D             S )ah  Split 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.
    r*   r   c                8    g | ]}d                      |          S )r7   )join)r   lines     r   r   zchop_cells.<locals>.<listcomp>   s"    ,,,dBGGDMM,,,r   )r!   append)
r   r3   _get_character_cell_sizelinesappend_new_lineappend_to_last_linetotal_widthr   
cell_widthchar_doesnt_fits
             r   
chop_cellsrK      s      7 TElO)*K 
& 
&	--i88
%
2U: 	&OYK((("')"2$KK	***:%KK,,e,,,,r   __main__u   😽u]   这是对亚洲语言支持的测试。面对模棱两可的想法，拒绝猜测的诱惑。   P   r*   |xN)r   r   r   r   )r   r   r#   r$   r   r   )r   r   r   r   )r   r   r4   r   r   r   )r   r   r3   r   r   r>   )
__future__r   	functoolsr   typingr   _cell_widthsr   r   __annotations__	frozenset_SINGLE_CELLS
issupersetr   r"   r&   r!   r=   rK   __name__printrB   r   n r   r   <module>r]      s:   " " " " " " "             % % % % % %6 6 6      	 7    1>0H  H H H H 43 3 3 3" ;J 3 3 3 3 3  4   8       F"- "- "- "-J z	E
!
!&
)
)***
~  AB  C  C  dU2q"  mm  BC  D  D  GJ  J  	K  	K  	KcAg  r   