o
    Œõ±j:  ã                   @  st   d Z ddlmZ ddlmZ ddlmZ 	ddddd	œddd„Z	ddddd	œddd„Z	ddddd	œddd„Z	dS )zBPython grapheme, emoji, and sequence-aware ljust, rjust, center().é    )Úannotations)ÚLiteralé   )Úwidthú ÚparseF©Úcontrol_codesÚambiguous_widthÚterm_programÚtextÚstrÚ
dest_widthÚintÚfillcharr	   ú$Literal['parse', 'strict', 'ignore']r
   r   ú
bool | strÚreturnc                C  sD   |   ¡ r|  ¡ rt| ƒ}nt| |||d�}td|| ƒ}| ||  S )u¡  
    Return text left-justified in a string of given display width.

    :param text: String to justify, may contain terminal sequences.
    :param dest_width: Total display width of result in terminal cells.
    :param fillchar: Single character for padding (default space). Must have
        display width of 1 (not wide, not zero-width, not combining). Unicode
        characters like ``'Â·'`` are acceptable. The width is not validated.
    :param control_codes: How to handle control sequences when measuring.
        Passed to :func:`width` for measurement.
    :param ambiguous_width: Width to use for East Asian Ambiguous (A)
        characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts.
    :param term_program: Terminal software identifier for table correction.
        ``False`` (default) disables override lookup.  ``True`` reads the
        ``TERM_PROGRAM`` or ``TERM`` environment variable for auto-detection.
        Accepts a canonical terminal name matching :func:`list_term_programs`,
        such as from XTVERSION_, ENQ_, or ``TERM_PROGRAM``.

        .. versionadded:: 0.8.0
    :returns: Text padded on the right to reach ``dest_width``.

    .. versionadded:: 0.3.0

    Example::

        >>> ljust('hi', 5)
        'hi   '
        >>> ljust('\x1b[31mhi\x1b[0m', 5)
        '\x1b[31mhi\x1b[0m   '
        >>> ljust('\U0001F468\u200D\U0001F469\u200D\U0001F467', 6)
        'ðŸ‘¨â€�ðŸ‘©â€�ðŸ‘§    '
    r   r   ©ÚisasciiÚisprintableÚlenr   Úmax©r   r   r   r	   r
   r   Ú
text_widthÚpadding_cells© r   ú€/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/wcwidth/align.pyÚljust
   ó   )
ÿr   c                C  sD   |   ¡ r|  ¡ rt| ƒ}nt| |||d�}td|| ƒ}|| |  S )u¡  
    Return text right-justified in a string of given display width.

    :param text: String to justify, may contain terminal sequences.
    :param dest_width: Total display width of result in terminal cells.
    :param fillchar: Single character for padding (default space). Must have
        display width of 1 (not wide, not zero-width, not combining). Unicode
        characters like ``'Â·'`` are acceptable. The width is not validated.
    :param control_codes: How to handle control sequences when measuring.
        Passed to :func:`width` for measurement.
    :param ambiguous_width: Width to use for East Asian Ambiguous (A)
        characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts.
    :param term_program: Terminal software identifier for table correction.
        ``False`` (default) disables override lookup.  ``True`` reads the
        ``TERM_PROGRAM`` or ``TERM`` environment variable for auto-detection.
        Accepts a canonical terminal name matching :func:`list_term_programs`,
        such as from XTVERSION_, ENQ_, or ``TERM_PROGRAM``.

        .. versionadded:: 0.8.0
    :returns: Text padded on the left to reach ``dest_width``.

    .. versionadded:: 0.3.0

    Example::

        >>> rjust('hi', 5)
        '   hi'
        >>> rjust('\x1b[31mhi\x1b[0m', 5)
        '   \x1b[31mhi\x1b[0m'
        >>> rjust('\U0001F468\u200D\U0001F469\u200D\U0001F467', 6)
        '    ðŸ‘¨â€�ðŸ‘©â€�ðŸ‘§'
    r   r   r   r   r   r   r   Úrjust<   r   r    c          
      C  sh   |   ¡ r|  ¡ rt| ƒ}nt| |||d�}td|| ƒ}|d ||@ d@  }|| }	|| |  ||	  S )uÖ  
    Return text centered in a string of given display width.

    :param text: String to center, may contain terminal sequences.
    :param dest_width: Total display width of result in terminal cells.
    :param fillchar: Single character for padding (default space). Must have
        display width of 1 (not wide, not zero-width, not combining). Unicode
        characters like ``'Â·'`` are acceptable. The width is not validated.
    :param control_codes: How to handle control sequences when measuring.
        Passed to :func:`width` for measurement.
    :param ambiguous_width: Width to use for East Asian Ambiguous (A)
        characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts.
    :param term_program: Terminal software identifier for table correction.
        ``False`` (default) disables override lookup.  ``True`` reads the
        ``TERM_PROGRAM`` or ``TERM`` environment variable for auto-detection.
        Accepts a canonical terminal name matching :func:`list_term_programs`,
        such as from XTVERSION_, ENQ_, or ``TERM_PROGRAM``.

        .. versionadded:: 0.8.0
    :returns: Text padded on both sides to reach ``dest_width``.

    For odd-width padding, the extra cell fills in the same cell position as
    Python's :meth:`str.center` behavior (the left side when ``dest_width`` is
    odd, the right side when ``dest_width`` is even).
    See `the eccentric str.center <https://jazcap53.github.io/pythons-eccentric-strcenter.html>`_.

    .. versionadded:: 0.3.0

    Example::

        >>> center('hi', 6)
        '  hi  '
        >>> center('\x1b[31mhi\x1b[0m', 6)
        '  \x1b[31mhi\x1b[0m  '
        >>> center('\U0001F468\u200D\U0001F469\u200D\U0001F467', 6)
        '  ðŸ‘¨â€�ðŸ‘©â€�ðŸ‘§  '
    r   r   é   r   r   )
r   r   r   r	   r
   r   r   Útotal_paddingÚleft_padÚ	right_padr   r   r   Úcentern   s   .
ÿr%   N)r   )r   r   r   r   r   r   r	   r   r
   r   r   r   r   r   )
Ú__doc__Ú
__future__r   Útypingr   Ú_widthr   r   r    r%   r   r   r   r   Ú<module>   s,    ýù5ýù5ýù