
    $$}gZ              	         U d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
mZ e	rddlmZ dZdZdUdZ G d d          ZdVdZdWdZdVdZdXdZdXdZdYd Z G d! d"e          Zh d#Zd ej        d$ej                  fd% ej        d&d'                    e           d(          fd) ej        d*          fd+ ej        d,          fd- ej        d.ej                  fgZd/ed0<   dZd3Z 	 d[d\d8Z!d[d]d9Z"d^d<Z#d_d?Z$d`dAZ%dadEZ& G dF dG          Z'dH Z(dI Z)dJ Z* G dK dL          Z+ G dM dNe+          Z, G dO dPe+          Z- G dQ dRe-          Z. G dS dTe+          Z/dS )bz
    babel.numbers
    ~~~~~~~~~~~~~

    CLDR Plural support.  See UTS #35.

    :copyright: (c) 2013-2024 by the Babel Team.
    :license: BSD, see LICENSE for more details.
    )annotationsN)IterableMapping)TYPE_CHECKINGAnyCallable)Literal)zeroonetwofewmanyotherr   sourcefloat | decimal.DecimalreturnMtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]]c                j   t          |           }t          |          }t          |t                    r*||k    r|}n!t	          j        t          |                    }t          |t          j                  r|                                }|j        }|dk     r|j	        |d         nd}d
                    d |D                       }|                    d          }t          |          }t          |          }	t          |pd          }
t          |pd          }ndx}x}	x}
}dx}}||||	|
|||fS )u  Extract operands from a decimal, a float or an int, according to `CLDR rules`_.

    The result is an 8-tuple (n, i, v, w, f, t, c, e), where those symbols are as follows:

    ====== ===============================================================
    Symbol Value
    ------ ---------------------------------------------------------------
    n      absolute value of the source number (integer and decimals).
    i      integer digits of n.
    v      number of visible fraction digits in n, with trailing zeros.
    w      number of visible fraction digits in n, without trailing zeros.
    f      visible fractional digits in n, with trailing zeros.
    t      visible fractional digits in n, without trailing zeros.
    c      compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting.
    e      currently, synonym for ‘c’. however, may be redefined in the future.
    ====== ===============================================================

    .. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-61/tr35-numbers.html#Operands

    :param source: A real number
    :type source: int|float|decimal.Decimal
    :return: A n-i-v-w-f-t-c-e tuple
    :rtype: tuple[decimal.Decimal, int, int, int, int, int, int, int]
    r   N  c              3  4   K   | ]}t          |          V  d S Nstr).0ds     L/var/www/py-google-trends/myenv/lib/python3.11/site-packages/babel/plural.py	<genexpr>z#extract_operands.<locals>.<genexpr>G   s(      ;;a3q66;;;;;;    0)absint
isinstancefloatdecimalDecimalr   as_tupleexponentdigitsjoinrstriplen)r   ni	dec_tupleexpfraction_digitstrailingno_trailingvwftces                 r   extract_operandsr:      s<   2 	FAAA!U (66AA A''A!W_%% JJLL	 47!GG)*3440077;;?;;;;;ooc**MMA q!!AAIAaAq!Q!!r   c                      e Zd ZdZdZddZdd	Zedd            Ze	dd            Z
e	dd            ZddZddZddZdS ) 
PluralRuleaf  Represents a set of language pluralization rules.  The constructor
    accepts a list of (tag, expr) tuples or a dict of `CLDR rules`_. The
    resulting object is callable and accepts one parameter with a positive or
    negative number (both integer and float) for the number that indicates the
    plural form for a string and returns the tag for the format:

    >>> rule = PluralRule({'one': 'n is 1'})
    >>> rule(1)
    'one'
    >>> rule(2)
    'other'

    Currently the CLDR defines these tags: zero, one, two, few, many and
    other where other is an implicit default.  Rules should be mutually
    exclusive; for a given numeric value, only one rule should apply (i.e.
    the condition should only be true for one of the plural rule elements.

    .. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-33/tr35-numbers.html#Language_Plural_Rules
    )abstract_funcrules-Mapping[str, str] | Iterable[tuple[str, str]]r   Nonec                   t          |t                    r|                                }t                      }g | _        t          |          D ]~\  }}|t          vrt          d|          ||v rt          d|d          |                    |           t          |          j
        }|r| j                            ||f           dS )a$  Initialize the rule instance.

        :param rules: a list of ``(tag, expr)``) tuples with the rules
                      conforming to UTS #35 or a dict with the tags as keys
                      and expressions as values.
        :raise RuleError: if the expression is malformed
        zunknown tag ztag z defined twiceN)r#   r   itemssetr=   sorted_plural_tags
ValueErroradd_Parserastappend)selfr?   foundkeyexprrJ   s         r   __init__zPluralRule.__init__j   s     eW%% 	"KKMME/1 	1 	1IC,&& !7!7!7888 !=!=!=!=>>>IIcNNN$--#C 1$$c3Z000	1 	1r   r   c                    | j         d                    fdt          D                       }dt          |           j         d|dS )N, c                2    g | ]}|v | d |          S )z: r   )r   tagr?   s     r   
<listcomp>z'PluralRule.__repr__.<locals>.<listcomp>   s1    YYYSCSXLLS00E#J00LLLr   < >)r?   r*   rF   type__name__)rL   argsr?   s     @r   __repr__zPluralRule.__repr__   sR    
yyYYYYLYYYZZ24::&222222r   :Mapping[str, str] | Iterable[tuple[str, str]] | PluralRulec                F    t          |t                    r|S  | |          S )a
  Create a `PluralRule` instance for the given rules.  If the rules
        are a `PluralRule` object, that object is returned.

        :param rules: the rules as list or dict, or a `PluralRule` object
        :raise RuleError: if the expression is malformed
        )r#   r<   )clsr?   s     r   parsezPluralRule.parse   s)     eZ(( 	Ls5zzr   Mapping[str, str]c                P    t                      j        fd| j        D             S )zThe `PluralRule` as a dict of unicode plural rules.

        >>> rule = PluralRule({'one': 'n is 1'})
        >>> rule.rules
        {'one': 'n is 1'}
        c                .    i | ]\  }}| |          S r   r   )r   rT   rJ   _compiles      r   
<dictcomp>z$PluralRule.rules.<locals>.<dictcomp>   s'    AAAxsCXXc]]AAAr   )_UnicodeCompilercompiler=   )rL   rd   s    @r   r?   zPluralRule.rules   s/     $%%-AAAA4=AAAAr   frozenset[str]c                >    t          d | j        D                       S )zA set of explicitly defined tags in this rule.  The implicit default
        ``'other'`` rules is not part of this set unless there is an explicit
        rule for it.
        c              3  &   K   | ]}|d          V  dS )r   Nr   )r   r.   s     r   r   z"PluralRule.tags.<locals>.<genexpr>   s&      55!1555555r   )	frozensetr=   rL   s    r   tagszPluralRule.tags   s#     55t}555555r   list[tuple[str, Any]]c                    | j         S r   r=   rl   s    r   __getstate__zPluralRule.__getstate__   s
    }r   r=   c                    || _         d S r   rp   )rL   r=   s     r   __setstate__zPluralRule.__setstate__   s     r   r-   r   c                t    t          | d          st          |           | _        |                     |          S )Nr>   )hasattr	to_pythonr>   )rL   r-   s     r   __call__zPluralRule.__call__   s1    tW%% 	)"4DJzz!}}r   N)r?   r@   r   rA   )r   r   )r?   r]   r   r<   )r   ra   )r   rh   )r   rn   )r=   rn   r   rA   )r-   r   r   r   )rZ   
__module____qualname____doc__	__slots__rP   r\   classmethodr`   propertyr?   rm   rq   rs   rw   r   r   r   r<   r<   S   s         ( &I1 1 1 1,3 3 3 3
 	 	 	 [	 B B B XB 6 6 6 X6   ! ! ! !     r   r<   ruler]   r   c                $   t                      j        }dg}t                              |           j        D ])\  }}|                     ||           d|d           *|                    dt          z             d                    |          S )a  Convert a list/dict of rules or a `PluralRule` object into a JavaScript
    function.  This function depends on no external library:

    >>> to_javascript({'one': 'n is 1'})
    "(function(n) { return (n == 1) ? 'one' : 'other'; })"

    Implementation detail: The function generated will probably evaluate
    expressions involved into range operations multiple times.  This has the
    advantage that external helper functions are not required and is not a
    big performance hit for these simple calculations.

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    z(function(n) { return  ?  : z%r; })r   )_JavaScriptCompilerrg   r<   r`   r=   rK   _fallback_tagr*   )r~   to_jsresultrT   rJ   s        r   to_javascriptr      s      !!)E&'F$$T**3 4 4Ss222223333
MM(]*+++776??r   (Callable[[float | decimal.Decimal], str]c           	        t           t          t          t          d}t	                      j        }ddg}t                              |           j        D ]6\  }}|	                    d ||           dt          |                     7|	                    dt                     t          d                    |          dd	          }t          ||           |d
         S )a<  Convert a list/dict of rules or a `PluralRule` object into a regular
    Python function.  This is useful in situations where you need a real
    function and don't are about the actual rule object:

    >>> func = to_python({'one': 'n is 1', 'few': 'n in 2..4'})
    >>> func(1)
    'one'
    >>> func(3)
    'few'
    >>> func = to_python({'one': 'n in 1,11', 'few': 'n in 3..10,13..19'})
    >>> func(11)
    'one'
    >>> func(15)
    'few'

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    )INWITHINMODr:   zdef evaluate(n):z- n, i, v, w, f, t, c, e = extract_operands(n)z if (z
): return z return 
z<rule>execevaluate)in_range_listwithin_range_listcldr_modulor:   _PythonCompilerrg   r<   r`   r=   rK   r   r   r*   eval)r~   	namespaceto_python_funcr   rT   rJ   codes          r   rv   rv      s    ( #,	 I %&&.N7F $$T**3 K KS 	InnS11IISXXIIJJJJ
MM.]..///499V$$h77DyZ  r   c                   t                               |           } | j        t          hz  t	                      j        }fdt          D             j        }dt                     dg}| j	        D ]2\  }}|
                     ||           d ||           d           3|
                     |t                     d           d                    |          S )a  The plural rule as gettext expression.  The gettext expression is
    technically limited to integers and returns indices rather than tags.

    >>> to_gettext({'one': 'n is 1', 'two': 'n is 2'})
    'nplurals=3; plural=((n == 1) ? 0 : (n == 2) ? 1 : 2);'

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    c                    g | ]}|v |	S r   r   )r   rT   	used_tagss     r   rU   zto_gettext.<locals>.<listcomp>   s#    BBB#	1A1A#1A1A1Ar   z	nplurals=z
; plural=(r   r   z);r   )r<   r`   rm   r   _GettextCompilerrg   rF   indexr,   r=   rK   r*   )r~   rd   
_get_indexr   rT   rJ   r   s         @r   
to_gettextr      s     D!!D	]O+I!!)HBBBBBBBHJ4#i..4445FM A AS#??::c?????@@@@
MMZZ..222333776??r   num
range_list+Iterable[Iterable[float | decimal.Decimal]]boolc                H    | t          |           k    ot          | |          S )a  Integer range list test.  This is the callback for the "in" operator
    of the UTS #35 pluralization rule language:

    >>> in_range_list(1, [(1, 3)])
    True
    >>> in_range_list(3, [(1, 3)])
    True
    >>> in_range_list(3, [(1, 3), (5, 8)])
    True
    >>> in_range_list(1.2, [(1, 4)])
    False
    >>> in_range_list(10, [(1, 4)])
    False
    >>> in_range_list(10, [(1, 4), (6, 8)])
    False
    )r"   r   r   r   s     r   r   r     s$    " #c((?A0jAAAr   c                :     t           fd|D                       S )a  Float range test.  This is the callback for the "within" operator
    of the UTS #35 pluralization rule language:

    >>> within_range_list(1, [(1, 3)])
    True
    >>> within_range_list(1.0, [(1, 3)])
    True
    >>> within_range_list(1.2, [(1, 4)])
    True
    >>> within_range_list(8.8, [(1, 4), (7, 15)])
    True
    >>> within_range_list(10, [(1, 4)])
    False
    >>> within_range_list(10.5, [(1, 4), (20, 30)])
    False
    c              3  6   K   | ]\  }}|k    o|k    V  d S r   r   )r   min_max_r   s      r   r   z$within_range_list.<locals>.<genexpr>+  s4      HHztTsd{*sd{HHHHHHr   )anyr   s   ` r   r   r     s(    " HHHHZHHHHHHr   ar$   bc                R    d}| dk     r| dz  } d}|dk     r|dz  }| |z  }|r|dz  }|S )zJavaish modulo.  This modulo operator returns the value with the sign
    of the dividend rather than the divisor like Python does:

    >>> cldr_modulo(-3, 5)
    -3
    >>> cldr_modulo(-3, -5)
    -3
    >>> cldr_modulo(3, 5)
    3
    r      r   )r   r   reverservs       r   r   r   .  sQ     G1uu	R1uu	R	
QB 
bIr   c                      e Zd ZdZdS )	RuleErrorzRaised if a rule is malformed.N)rZ   rx   ry   rz   r   r   r   r   r   E  s        ((((r   r   >   r8   r9   r6   r.   r-   r7   r4   r5   z\s+wordz"\b(and|or|is|(?:with)?in|not|mod|[r   z])\bvaluez\d+symbolz%|,|!=|=ellipsisz\.{2,3}|\u2026z(list[tuple[str | None, re.Pattern[str]]]_RULESslist[tuple[str, str]]c                   |                      d          d         } g }d}t          |           }||k     rt          D ]^\  }}|                    | |          }|A|                                }|r)|                    ||                                f            n_t          d| |                   ||k     |d d d         S )N@r   z3malformed CLDR pluralization rule.  Got unexpected r   )splitr,   r   matchendrK   groupr   )r   r   posr   tokr~   r   s          r   tokenize_ruler   ]  s    	QA$&F
C
a&&C
)) 	^ 	^ICJJq#&&E iikk 8MM3"6777	 ! \RSTWRX\\]]] )) $$B$<r   tokenstype_
str | Nonelist[tuple[str, str]] | boolc                V    | o'| d         d         |k    o|d u p| d         d         |k    S )Nr   r   r   r   r   r   r   s      r   test_next_tokenr   o  s>    
  2fRjmu, 2	$	0&*Q-502r   c                P    t          | ||          r|                                 S d S r   )r   popr   s      r   
skip_tokenr   x  s.    vue,, zz|| r   r"   #tuple[Literal['value'], tuple[int]]c                    d| ffS )Nr   r   )r   s    r   
value_noder   }  s    UIr   nametuple[str, tuple[()]]c                
    | dfS )Nr   r   )r   s    r   
ident_noder     s    8Or   Ituple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]]c                
    d| fS )Nr   r   )r   s    r   range_list_noder     s     ##r   r   tuple[Any, ...]-tuple[Literal['not'], tuple[tuple[Any, ...]]]c                    d| ffS )Nnotr   )r   s    r   negater     s    2%<r   c                  P    e Zd ZdZd ZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd ZdS )rI   u  Internal parser.  This class can translate a single rule into an abstract
    tree of tuples. It implements the following grammar::

        condition     = and_condition ('or' and_condition)*
                        ('@integer' samples)?
                        ('@decimal' samples)?
        and_condition = relation ('and' relation)*
        relation      = is_relation | in_relation | within_relation
        is_relation   = expr 'is' ('not')? value
        in_relation   = expr (('not')? 'in' | '=' | '!=') range_list
        within_relation = expr ('not')? 'within' range_list
        expr          = operand (('mod' | '%') value)?
        operand       = 'n' | 'i' | 'f' | 't' | 'v' | 'w'
        range_list    = (range | value) (',' range_list)*
        value         = digit+
        digit         = 0|1|2|3|4|5|6|7|8|9
        range         = value'..'value
        samples       = sampleRange (',' sampleRange)* (',' ('…'|'...'))?
        sampleRange   = decimalValue '~' decimalValue
        decimalValue  = value ('.' value)?

    - Whitespace can occur between or around any of the above tokens.
    - Rules should be mutually exclusive; for a given numeric value, only one
      rule should apply (i.e. the condition should only be true for one of
      the plural rule elements).
    - The in and within relations can take comma-separated lists, such as:
      'n in 3,5,7..15'.
    - Samples are ignored.

    The translator parses the expression on instantiation into an attribute
    called `ast`.
    c                    t          |          | _        | j        s	d | _        d S |                                 | _        | j        r#t	          d| j        d         d                   d S )NzExpected end of rule, got r   r   )r   r   rJ   	conditionr   )rL   strings     r   rP   z_Parser.__init__  ss    #F++{ 	 DHF>>##; 	QOR9KOOPPP	Q 	Qr   Nc                    t          | j        ||          }||S |t          |d u r|p|          }| j        st          d| d          t          d| d| j        d         d                   )Nz	expected z but end of rule reachedz	 but got r   r   )r   r   reprr   )rL   r   r   termtokens        r   expectz_Parser.expect  s    4;u55L</%8599D{ 	HFFFFGGGIDII4;r?13EIIJJJr   c                    |                                  }t          | j        dd          r.d||                                  ff}t          | j        dd          .|S )Nr   or)and_conditionr   r   rL   ops     r   r   z_Parser.condition  sa    !!fd33 	2D..0011B fd33 	2	r   c                    |                                  }t          | j        dd          r.d||                                  ff}t          | j        dd          .|S )Nr   and)relationr   r   r   s     r   r   z_Parser.and_condition  sY    ]]__fe44 	.T]]__--B fe44 	.	r   c                   |                                  }t          | j        dd          r0t          | j        dd          rdpd||                                 ffS t          | j        dd          }d}t          | j        dd          rd}n<t          | j        dd          s&|rt	          d          |                     |          S d|||                                 ff}|rt          |          n|S )	Nr   isr   isnotinwithinz#Cannot negate operator based rules.r   )rO   r   r   r   r   newfangled_relationr   r   )rL   leftnegatedmethodr   s        r   r   z_Parser.relation  s   yy{{dk6400 	%dk6599EgMtzz||$% %T[&%88dk6844 	6FFdk6488 6 K#$IJJJ//555&$(9(9::$,vbzzz",r   c                    t          | j        dd          rd}n(t          | j        dd          rd}nt          d          dd||                                 ff}|rt	          |          n|S )	Nr   =Fz!=Tz'Expected "=" or "!=" or legacy relationr   r   )r   r   r   r   r   )rL   r   r   r   s       r   r   z_Parser.newfangled_relation  s}    dk8S11 	GGGXt44 	GGGEFFF$doo&7&788$,vbzzz",r   c                    |                                  }t          | j        d          r||                                  fS ||fS )Nr   )r   r   r   )rL   r   s     r   range_or_valuez_Parser.range_or_value  s@    zz||dk:.. 	%%:r   c                    |                                  g}t          | j        dd          r=|                    |                                             t          | j        dd          =t	          |          S )Nr   ,)r   r   r   rK   r   )rL   r   s     r   r   z_Parser.range_list  sr    ))++,
h44 	5d1133444 h44 	5z***r   c                Z   t          | j        d          }||d         t          vrt          d          |d         }t          | j        dd          rd|df|                                 ffS t          | j        dd          rd|df|                                 ffS t          |          S )Nr   r   zExpected identifier variablemodr   r   %)r   r   _VARSr   r   r   )rL   r   r   s      r   rO   z_Parser.expr  s    $+v..<47%//:;;;Awdk6511 	5D":tzz||444Xs33 	5D":tzz||444$r   c                l    t          t          |                     d          d                             S )Nr   r   )r   r"   r   rl   s    r   r   z_Parser.value  s)    #dkk'221566777r   )NN)rZ   rx   ry   rz   rP   r   r   r   r   r   r   r   rO   r   r   r   r   rI   rI     s         B	Q 	Q 	QK K K K    - - -"- - -  + + +	  	  	 8 8 8 8 8r   rI   c                      fdS )%Compiler factory for the `_Compiler`.c                ^    |                      |          |                      |          fz  S r   rg   )rL   r   righttmpls      r   <lambda>z"_binary_compiler.<locals>.<lambda>  s)    TT\\$-?-?eATAT,U%U r   r   r  s   `r   _binary_compilerr  	  s    UUUUUr   c                      fdS )r  c                4    |                      |          z  S r   r  )rL   xr  s     r   r  z!_unary_compiler.<locals>.<lambda>  s    4$,,q//1 r   r   r  s   `r   _unary_compilerr    s    11111r   c                    dS )Nr    r   r  s    r   r  r    s     r   c                      e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Zd ZdS )	_CompilerzZThe compilers are able to transform the expressions into multiple
    output formats.
    c                8    |\  }} t          | d|           | S )Ncompile_)getattr)rL   argr   r[   s       r   rg   z_Compiler.compile  s(    D-wt___--t44r   c                    dS )Nr-   r   r  s    r   r  z_Compiler.<lambda>      # r   c                    dS )Nr.   r   r  s    r   r  z_Compiler.<lambda>   r  r   c                    dS )Nr4   r   r  s    r   r  z_Compiler.<lambda>!  r  r   c                    dS )Nr5   r   r  s    r   r  z_Compiler.<lambda>"  r  r   c                    dS )Nr6   r   r  s    r   r  z_Compiler.<lambda>#  r  r   c                    dS )Nr7   r   r  s    r   r  z_Compiler.<lambda>$  r  r   c                    dS )Nr8   r   r  s    r   r  z_Compiler.<lambda>%  r  r   c                    dS )Nr9   r   r  s    r   r  z_Compiler.<lambda>&  r  r   c                     t          |          S r   r   )r  r4   s     r   r  z_Compiler.<lambda>'  s    Q r   z
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c                    t                      r   )NotImplementedError)rL   r   rO   r   s       r   compile_relationz_Compiler.compile_relation/  s    !###r   N)rZ   rx   ry   rz   rg   	compile_n	compile_i	compile_v	compile_w	compile_f	compile_t	compile_c	compile_ecompile_valuer  compile_and
compile_orr  compile_notcompile_mod
compile_iscompile_isnotr!  r   r   r   r  r    s         5 5 5 IIIIIIII''M""<00K!!,//J!/'**K""<00K!!,//J$$\22M$ $ $ $ $r   r  c                  p    e Zd ZdZ ed          Z ed          Z ed          Z ed          Z	d Z
dS )r   z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c                     d                      fd|d         D                       }|                                 d                     |           d| dS )Nr   c                t    g | ]4\  }}d                      |           d                     |           d5S )(rR   )r  )r   r   r   rL   s      r   rU   z4_PythonCompiler.compile_relation.<locals>.<listcomp><  sE    aaa!QDt||ADD$,,q//DDDaaar   r   r4  z, [z]))r*   upperrg   )rL   r   rO   r   rangess   `    r   r!  z _PythonCompiler.compile_relation;  sc    aaaaS]^_S`aaabb,,..DD4<<#5#5DD&DDDDr   N)rZ   rx   ry   rz   r  r+  r,  r  r-  r.  r!  r   r   r   r   r   3  sm        ++""=11K!!,//J!/*--K""=11KE E E E Er   r   c                  6    e Zd ZdZej        ZeZeZ	eZ
eZd ZdS )r   z)Compile into a gettext plural expression.c                |   g }|                      |          }|d         D ]}|d         |d         k    r6|                    d| d|                      |d                    d           Jt          | j         |          \  }}|                    d| d| d| d| d	           dd	                    |           dS )
Nr   r   r4  z == r5  z >=  && z <= z || )rg   rK   mapr*   )rL   r   rO   r   r   itemminmaxs           r   r!  z!_GettextCompiler.compile_relationI  s    ||D!!qM 	C 	CDAw$q'!!		@d@@T!W(=(=@@@AAAAt|T22S		AdAAAAAA3AAABBBB%6;;r??%%%%r   N)rZ   rx   ry   rz   r  r"  r#  compile_zeror$  r%  r&  r'  r!  r   r   r   r   r   @  sE        33#IIIII	& 	& 	& 	& 	&r   r   c                  .    e Zd ZdZd ZeZeZeZeZ	d Z
dS )r   z/Compiles the expression to plain of JavaScript.c                    dS )NzparseInt(n, 10)r   r  s    r   r  z_JavaScriptCompiler.<lambda>Z  s    + r   c                    t                               | |||          }|dk    r!|                     |          }d| d| d| d}|S )Nr   z
(parseInt(z	, 10) == r:  r5  )r   r!  rg   )rL   r   rO   r   r   s        r   r!  z$_JavaScriptCompiler.compile_relation`  s_    00&$
, ,T>><<%%D@@@t@@@@@Dr   N)rZ   rx   ry   rz   r#  r?  r$  r%  r&  r'  r!  r   r   r   r   r   U  sG        99 ,+IIIII    r   r   c                      e Zd ZdZ ed          Z ed          Z ed          Z ed          Z ed          Z	d Z
dd	Zd
S )rf   z+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc                (     | j         |d         ddiS )Nr   r   T)r!  )rL   r   s     r   r-  z_UnicodeCompiler.compile_notv  s    $t$hqk@4@@@r   Fc           	        g }|d         D ]}|d         |d         k    r/|                     |                     |d                              C|                     |                     |d                    d|                     |d                               |                     |           |rdnd d| dd                    |           S )Nr   r   z..z notr   rW   r   )rK   rg   r*   )rL   r   rO   r   r   r7  r<  s          r   r!  z!_UnicodeCompiler.compile_relationy  s    qM 	S 	SDAw$q'!!dll47334444d1g!6!6QQ$,,tAw:O:OQQRRRR,,t$$]&?ffR]]&]]388TZK[K[]]]r   N)F)rZ   rx   ry   rz   r  r/  r0  r+  r,  r.  r-  r!  r   r   r   rf   rf   i  s        55 "!*--J$$^44M"";//K!!*--J"";//KA A A^ ^ ^ ^ ^ ^r   rf   )r   r   r   r   )r~   r]   r   r   )r~   r]   r   r   )r   r   r   r   r   r   )r   r$   r   r$   r   r$   )r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   )r   r"   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   )0rz   
__future__r   r%   recollections.abcr   r   typingr   r   r   typing_extensionsr	   rF   r   r:   r<   r   rv   r   r   r   r   	Exceptionr   r   rg   UNICODEr*   r   __annotations__r   r   r   r   r   r   r   rI   r  r  r?  r  r   r   r   rf   r   r   r   <module>rN     s     # " " " " "  				 - - - - - - - - / / / / / / / / / / *))))))=8" 8" 8" 8"vZ Z Z Z Z Z Z Zz   .%! %! %! %!P   .B B B B(I I I I(   .) ) ) ) )	 ) ) )		 		 		 
:2:fbj))*ZRZRbggennRRRSSTjbj  !zrz+&&'-rz::;4       * 2 2 2 2 2    
      $ $ $ $   w8 w8 w8 w8 w8 w8 w8 w8tV V V
2 2 2
 }$ $ $ $ $ $ $ $:
E 
E 
E 
E 
Ei 
E 
E 
E& & & & &y & & &*    *   (^ ^ ^ ^ ^y ^ ^ ^ ^ ^r   