U
    d                     @  s8  U d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
mZmZmZmZ ddddd	d
dgZG dd deZedddddddddd	Zddddddddddddddddd gZddddddddddd!
Zd"ed< ee eestee ee@ rtG d#d	 d	ed$ZG d%d
 d
eZG d&d deZd'S )(z#
The base classes for the styling.
    )annotations)ABCMetaabstractmethodabstractproperty)CallableDictHashableList
NamedTupleOptionalTupleAttrsDEFAULT_ATTRSANSI_COLOR_NAMESANSI_COLOR_NAMES_ALIASES	BaseStyle
DummyStyleDynamicStylec                   @  sV   e Zd ZU ded< ded< ded< ded< ded< ded< ded	< ded
< ded< dS )r   z
str | Nonecolorbgcolorzbool | Nonebold	underlinestrikeitalicblinkreversehiddenN)__name__
__module____qualname____annotations__ r!   r!   >/tmp/pip-unpacked-wheel-4x_7prb2/prompt_toolkit/styles/base.pyr      s   
 F)	r   r   r   r   r   r   r   r   r   ZansidefaultZ	ansiblackZansiredZ	ansigreenZ
ansiyellowZansiblueZansimagentaZansicyanZansigrayZansibrightblackZansibrightredZansibrightgreenZansibrightyellowZansibrightblueZansibrightmagentaZansibrightcyanZ	ansiwhite)
ZansidarkgrayZansitealZansiturquoiseZ	ansibrownZ
ansipurpleZansifuchsiaZansilightgrayZansidarkredZansidarkgreenZansidarkbluezdict[str, str]c                   @  sN   e Zd ZdZeefddddddZeddd	d
ZeddddZ	dS )r   z8
    Abstract base class for prompt_toolkit styles.
    strr   	style_strdefaultreturnc                 C  s   dS )a  
        Return :class:`.Attrs` for the given style string.

        :param style_str: The style string. This can contain inline styling as
            well as classnames (e.g. "class:title").
        :param default: `Attrs` to be used if no styling was defined.
        Nr!   selfr&   r'   r!   r!   r"   get_attrs_for_style_strq   s    z!BaseStyle.get_attrs_for_style_strlist[tuple[str, str]]r(   c                 C  s   g S )z
        The list of style rules, used to create this style.
        (Required for `DynamicStyle` and `_MergedStyle` to work.)
        r!   r*   r!   r!   r"   style_rules}   s    zBaseStyle.style_rulesr   c                 C  s   dS )z
        Invalidation hash for the style. When this changes over time, the
        renderer knows that something in the style changed, and that everything
        has to be redrawn.
        Nr!   r.   r!   r!   r"   invalidation_hash   s    zBaseStyle.invalidation_hashN)
r   r   r   __doc__r   r   r+   r   r/   r0   r!   r!   r!   r"   r   l   s   )	metaclassc                   @  sF   e Zd ZdZefddddddZddd	d
ZeddddZdS )r   z.
    A style that doesn't style anything.
    r$   r   r%   c                 C  s   |S Nr!   r)   r!   r!   r"   r+      s    z"DummyStyle.get_attrs_for_style_strr   r-   c                 C  s   dS )N   r!   r.   r!   r!   r"   r0      s    zDummyStyle.invalidation_hashr,   c                 C  s   g S r3   r!   r.   r!   r!   r"   r/      s    zDummyStyle.style_rulesN)	r   r   r   r1   r   r+   r0   propertyr/   r!   r!   r!   r"   r      s   c                   @  sT   e Zd ZdZddddZefddddd	d
ZddddZeddddZ	dS )r   z
    Style class that can dynamically returns an other Style.

    :param get_style: Callable that returns a :class:`.Style` instance.
    zCallable[[], BaseStyle | None])	get_stylec                 C  s   || _ t | _d S r3   )r6   r   _dummy)r*   r6   r!   r!   r"   __init__   s    zDynamicStyle.__init__r$   r   r%   c                 C  s   |   p| j}|||S r3   )r6   r7   r+   )r*   r&   r'   styler!   r!   r"   r+      s    z$DynamicStyle.get_attrs_for_style_strr   r-   c                 C  s   |   p| j S r3   )r6   r7   r0   r.   r!   r!   r"   r0      s    zDynamicStyle.invalidation_hashr,   c                 C  s   |   p| jjS r3   )r6   r7   r/   r.   r!   r!   r"   r/      s    zDynamicStyle.style_rulesN)
r   r   r   r1   r8   r   r+   r0   r5   r/   r!   r!   r!   r"   r      s   N)r1   
__future__r   abcr   r   r   typingr   r   r   r	   r
   r   r   __all__r   r   r   r   r    setvaluesissubsetAssertionErrorkeysr   r   r   r!   r!   r!   r"   <module>   sr   $"