o
    »Ùøi   ã                   @   sF   d dl Z ddlmZmZ dd„ Zdd„ Zdd	„ Zd
d„ Ze  d¡Z	dS )é    Né   )Ú_next_significantÚ_to_token_iteratorc                 C   s
  t | dd�}t|ƒ}|du rdS |j}|dkr!|jr!t|d|jƒS |dkrU|jrU|j}|dkr5t||jƒS |dkr@t||jd	ƒS t	 
|¡}|rSt||jt| d
¡ƒƒS dS |dkrÈ|j}|dkrft|ddƒS |dkrpt|dd
ƒS |dkryt|d
ƒS |dkr‚t|d	ƒS |dkrŒt|d
d	ƒS |dkr–t|d	d	ƒS |d dkr´t	 
|d
d… ¡}|r²t|d	t| d
¡ƒƒS dS t	 
|¡}|rÆt|d
t| d
¡ƒƒS dS |dkrÿt|ƒ}|jdk�r|j}|dkrât|d
ƒS |dkrìt|d
d	ƒS t	 
|¡}|�rt|d
t| d
¡ƒƒS dS dS dS )aF  Parse `<An+B> <https://drafts.csswg.org/css-syntax-3/#anb>`_,
    as found in `:nth-child()
    <https://drafts.csswg.org/selectors/#nth-child-pseudo>`_
    and related Selector pseudo-classes.

    Although tinycss2 does not include a full Selector parser,
    this bit of syntax is included as it is particularly tricky to define
    on top of a CSS tokenizer.

    :type input: :obj:`str` or :term:`iterable`
    :param input: A string or an iterable of :term:`component values`.
    :returns:
        A ``(a, b)`` tuple of integers, or :obj:`None` if the input is invalid.

    T)Úskip_commentsNÚnumberr   Ú	dimensionÚnzn-éÿÿÿÿr   ÚidentÚevené   Úoddz-nz-n-ú-ú+)r   r   ÚtypeÚ
is_integerÚ	parse_endÚ	int_valueÚ
lower_unitÚparse_bÚparse_signless_bÚN_DASH_DIGITS_REÚmatchÚintÚgroupÚlower_valueÚnext)ÚinputÚtokensÚtokenÚ
token_typeÚunitr   r
   © r"   úY/home/develop/edictos_py/central_edictos/env/lib/python3.10/site-packages/tinycss2/nth.pyÚ	parse_nth   sl   
ÿ

ÿ
ÿ

õr$   c                 C   sx   t | ƒ}|d u r|dfS |dkrt| |dƒS |dkr t| |dƒS |jdkr6|jr8|jd dv r:t| ||jƒS d S d S d S )Nr   r   r   r   r	   r   ú-+)r   r   r   r   Úrepresentationr   r   )r   Úar   r"   r"   r#   r   K   s   þr   c                 C   sD   t | ƒ}|jdkr|jr|jd dvr t| |||j ƒS d S d S d S )Nr   r   r%   )r   r   r   r&   r   r   )r   r'   Úb_signr   r"   r"   r#   r   X   s   þr   c                 C   s   t | ƒd u r
||fS d S )N)r   )r   r'   Úbr"   r"   r#   r   _   s   ÿr   z^n(-[0-9]+)$)
ÚreÚparserr   r   r$   r   r   r   Úcompiler   r"   r"   r"   r#   Ú<module>   s    E