ó
    ¡“,j’Z  ã            	      ó  • % S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	J
r
Jr  SrSr    S7S jr " S	 S
5      rS8S jr    S9S jrS8S jr      S:S jr      S:S jrS;S jr " S S\5      r1 SkrS\R2                  " S\R4                  5      4S\R2                  " SSR7                  \5       S35      4S\R2                  " S5      4S\R2                  " S5      4S\R2                  " S\R4                  5      4/rS\S '   S<S! jr S=       S>S" jjrS=S?S# jjr S@S$ jr!SAS% jr"    SBS& jr#SCS' jr$ " S( S)5      r%S* r&S+ r'S, r( " S- S.5      r) " S/ S0\)5      r* " S1 S2\)5      r+ " S3 S4\+5      r, " S5 S6\)5      r-g)Dzœ
babel.numbers
~~~~~~~~~~~~~

CLDR Plural support.  See UTS #35.

:copyright: (c) 2013-2026 by the Babel Team.
:license: BSD, see LICENSE for more details.
é    )ÚannotationsN)ÚIterableÚMapping)ÚAnyÚCallableÚLiteral)ÚzeroÚoneÚtwoÚfewÚmanyÚotherr   c                ó:  • [        U 5      n[        U5      n[        U[        5      (       a'  X!:X  a  UnO[        R
                  " [        U5      5      n[        U[        R
                  5      (       a›  UR                  5       nUR                  nUS:  a  UR                  US OSnSR                  S U 5       5      nUR                  S5      n[        U5      n[        U5      n	[        U=(       d    S5      n
[        U=(       d    S5      nOS=n=n	=p«S=pÍXX‰X«XÍ4$ )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  ó8   #   • U  H  n[        U5      v •  M     g 7f©N©Ústr)Ú.0Úds     ÚšC:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\babel/plural.pyÚ	<genexpr>Ú#extract_operands.<locals>.<genexpr>G   s   é € Ð;ª? aœ3˜qŸ6˜6ª?ùs   ‚Ú0)ÚabsÚintÚ
isinstanceÚfloatÚdecimalÚDecimalr   Úas_tupleÚexponentÚdigitsÚjoinÚrstripÚlen)ÚsourceÚnÚiÚ	dec_tupleÚexpÚfraction_digitsÚtrailingÚno_trailingÚvÚwÚfÚtÚcÚes                 r   Úextract_operandsr6      sü   € ô6 	ˆF‹€AÜˆA‹€AÜ�!”U×ÑØ‹6Ø‰Aô —’¤ A£Ó'ˆAä�!”W—_‘_×%Ñ%Ø—J‘J“Lˆ	Ø× Ñ ˆØ47¸!³G˜)×*Ñ*¨3¨4Ñ0ÀˆØ—7‘7Ñ;©?Ó;Ó;ˆØ—o‘o cÓ*ˆÜ�‹MˆÜ�ÓˆÜ�—˜AÓˆÜ�× ˜qÓ!‰àÐˆÐˆAÐ�Ø€I€AØ��q˜QÐ!Ð!ó    c                  ó’   • \ rS rSrSrSrSS jrSS jr\    SS j5       r	\
SS j5       r\
SS j5       rSS	 jrSS
 jrSS jrSrg)Ú
PluralRuleéS   a*  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Ú_funcc                óŠ  • [        U[        5      (       a  UR                  5       n[        5       n/ U l        [        U5       H~  u  p4U[        ;  a  [        SU< 35      eX2;   a  [        SU< S35      eUR                  U5        [        U5      R                  nU(       d  Mb  U R                  R                  X545        M€     g)zü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)ÚselfÚrulesÚfoundÚkeyÚexprrE   s         r   Ú__init__ÚPluralRule.__init__j   s    € ô �eœW×%Ñ%Ø—K‘K“MˆEÜ“ˆØ/1ˆŒÜ ž‰IˆCØœ,Ó&Ü  <°©wÐ!7Ó8Ð8Ø“Ü  4¨¡w¨nÐ!=Ó>Ð>Ø�I‰I�cŒNÜ˜$“-×#Ñ#ˆCßˆsØ—‘×$Ñ$ c ZÖ0ò 'r7   c                ó”   ^• U R                   mSR                  U4S j[         5       5      nS[        U 5      R                   SU< S3$ )Nú, c              3  óF   >#   • U  H  oT;   d  M
  U S TU    3v •  M     g7f)z: Nr   )r   ÚtagrH   s     €r   r   Ú&PluralRule.__repr__.<locals>.<genexpr>‚   s(   øé € ÐXº<°CÐRWÉ<Ó/˜C˜5  5¨¡: ,Õ/º<ùs   ƒ	!�!Ú<Ú Ú>)rH   r%   rA   ÚtypeÚ__name__)rG   ÚargsrH   s     @r   Ú__repr__ÚPluralRule.__repr__€   s@   ø€ Ø—
‘
ˆØ�y‰yÔX½<ÓXÓXˆØ”4˜“:×&Ñ&Ð' q¨©°Ð2Ð2r7   c                ó@   • [        U[        5      (       a  U$ U " U5      $ )zê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   r9   )ÚclsrH   s     r   ÚparseÚPluralRule.parse…   s    € ô �eœZ×(Ñ(ØˆLÙ�5‹zÐr7   c                ó„   • [        5       R                  nU R                   VVs0 s H  u  p#X!" U5      _M     snn$ s  snnf )zThe `PluralRule` as a dict of unicode plural rules.

>>> rule = PluralRule({'one': 'n is 1'})
>>> rule.rules
{'one': 'n is 1'}
)Ú_UnicodeCompilerÚcompiler;   )rG   Ú_compilerQ   rE   s       r   rH   ÚPluralRule.rules”   s9   € ô $Ó%×-Ñ-ˆØ37·=²=ÔA²=¡x s��X˜c“]Ò"±=ÒAÐAùÓAs   ¤<c                ó:   • [        S U R                   5       5      $ )z˜A 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  ó*   #   • U  H	  oS    v •  M     g7f)r   Nr   )r   r*   s     r   r   Ú"PluralRule.tags.<locals>.<genexpr>¥   s   é € Ð5¢} !˜1ž¢}ùs   ‚)Ú	frozensetr;   ©rG   s    r   ÚtagsÚPluralRule.tagsŸ   s   € ô Ñ5 t§}¢}Ó5Ó5Ð5r7   c                ó   • U R                   $ r   ©r;   rh   s    r   Ú__getstate__ÚPluralRule.__getstate__§   s   € Ø�}‰}Ðr7   c                ó   • Xl         g r   rl   )rG   r;   s     r   Ú__setstate__ÚPluralRule.__setstate__ª   s   € Ø �r7   c                óf   • [        U S5      (       d  [        U 5      U l        U R                  U5      $ )Nr<   )ÚhasattrÚ	to_pythonr<   )rG   r)   s     r   Ú__call__ÚPluralRule.__call__­   s(   € Ü�t˜W×%Ñ%Ü" 4›ˆDŒJØ�z‰z˜!‹}Ðr7   )r<   r;   N)rH   z-Mapping[str, str] | Iterable[tuple[str, str]]ÚreturnÚNone)rw   r   )rH   ú:Mapping[str, str] | Iterable[tuple[str, str]] | PluralRulerw   r9   )rw   zMapping[str, str])rw   zfrozenset[str])rw   úlist[tuple[str, Any]])r;   rz   rw   rx   )r)   úfloat | decimal.Decimalrw   r   )rW   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__rL   rY   Úclassmethodr]   ÚpropertyrH   ri   rm   rp   ru   Ú__static_attributes__r   r7   r   r9   r9   S   sw   † ñð( &€Iô1ô,3ð
 ðàIðð 
óó ðð óBó ðBð ó6ó ð6ôô!÷r7   r9   c                ó  • [        5       R                  nS/n[        R                  U 5      R                   H#  u  p4UR                  U" U5       SU< S35        M%     UR                  S[        -  5        SR                  U5      $ )aZ  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   )Ú_JavaScriptCompilerra   r9   r]   r;   rF   Ú_fallback_tagr%   )ÚruleÚto_jsÚresultrQ   rE   s        r   Úto_javascriptrŒ   ³   ss   € ô  Ó!×)Ñ)€EØ&Ð'€FÜ×$Ñ$ TÓ*×3Ô3‰ˆØ�‰™˜s›˜ C¨¡w¨cÐ2Ö3ñ 4à
‡M�M�(œ]Ñ*Ô+Ø�7‰7�6‹?Ðr7   c           	     óˆ  • [         [        [        [        S.n[	        5       R
                  nSS/n[        R                  U 5      R                   H,  u  pEUR                  SU" U5       S[        U5      < 35        M.     UR                  S[        < 35        [        SR                  U5      SS	5      n[        Xa5        U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ÚMODr6   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_modulor6   Ú_PythonCompilerra   r9   r]   r;   rF   r   rˆ   r%   Úeval)r‰   Ú	namespaceÚto_python_funcr‹   rQ   rE   Úcodes          r   rt   rt   Ê   s¸   € ô, Ü#ÜÜ,ñ	€Iô %Ó&×.Ñ.€NàØ7ð€Fô ×$Ñ$ TÓ*×3Ô3‰ˆð 	�‰˜™n¨SÓ1Ð2°*¼SÀ»X¹LÐIÖJñ 4ð ‡M�M�Hœ]Ñ-Ð.Ô/Ü�4—9‘9˜VÓ$ h°Ó7€DÜˆÔØ�ZÑ Ð r7   c                óÄ  • [         R                  U 5      n U R                  [        1-  n[	        5       R
                  n[         Vs/ s H  o3U;   d  M
  UPM     snR                  nS[        U5       S3/nU R                   H(  u  p6UR                  U" U5       SU" U5       S35        M*     UR                  U" [        5       S35        SR                  U5      $ s  snf )ag  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
z	nplurals=z
; plural=(r…   r†   z);r   )r9   r]   ri   rˆ   Ú_GettextCompilerra   rA   Úindexr'   r;   rF   r%   )r‰   Ú	used_tagsrb   rQ   Ú
_get_indexr‹   rE   s          r   Ú
to_gettextr¡   ô   sÆ   € ô ×Ñ˜DÓ!€Dà—	‘	œ]˜OÑ+€IÜÓ!×)Ñ)€HÝ!-ÓB¢˜#¸	Ñ1A—#¡ÑB×HÑH€Jàœ#˜i›.Ð)¨Ð4Ð5€FØ—M”M‰ˆØ�‰™ #›˜ s©:°c«?Ð*;¸3Ð?Ö@ñ "à
‡M�M‘Z¤Ó.Ð/¨rÐ2Ô3Ø�7‰7�6‹?Ðùò Cs   Á	CÁCc                óB   • U [        U 5      :H  =(       a    [        X5      $ )aa  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•   ©ÚnumÚ
range_lists     r   r”   r”     s   € ð( ”#�c“(‰?×AÔ0°ÓAÐAr7   c                ó.   ^ • [        U 4S jU 5       5      $ )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  óR   >#   • U  H  u  pUTs=:*  =(       a    U:*  Os  v •  M     g 7fr   r   )r   Úmin_Úmax_r¤   s      €r   r   Ú$within_range_list.<locals>.<genexpr>6  s#   øé € Ð@²Z¡z tˆt�s×"Ó"˜d×"Ñ"²Zùs   ƒ$')Úanyr£   s   ` r   r•   r•   "  s   ø€ ô( Ô@±ZÓ@Ó@Ð@r7   c                óZ   • SnU S:  a  U S-  n SnUS:  a  US-  nX-  nU(       a  US-  nU$ )zÎJavaish 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   )ÚaÚbÚreverseÚrvs       r   r–   r–   9  sF   € ð €GØˆ1ƒuØ	ˆR‰ˆØˆØˆ1ƒuØ	ˆR‰ˆØ	
‰€BÞØ
ˆb‰ˆØ€Ir7   c                  ó   • \ rS rSrSrSrg)Ú	RuleErroriP  zRaised if a rule is malformed.r   N)rW   r|   r}   r~   r   rƒ   r   r7   r   r´   r´   P  s   † Ü(r7   r´   >   r4   r5   r2   r*   r)   r3   r0   r1   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]]]Ú_RULESc                óJ  • U R                  S5      S   n / nSn[        U 5      nX#:  at  [         HR  u  pEUR                  X5      nUc  M  UR	                  5       nU(       a   UR                  XFR                  5       45          O   [        SX   < 35      eX#:  a  Mt  US S S2   $ )NÚ@r   z3malformed CLDR pluralization rule.  Got unexpected r­   )Úsplitr'   r¹   ÚmatchÚendrF   Úgroupr´   )Úsr‹   Úposr¾   Útokr‰   r½   s          r   Útokenize_rulerÃ   h  s¢   € Ø	�‰�‹�Q‰€AØ$&€FØ
€CÜ
ˆa‹&€CØ
‹)ß‰IˆCØ—J‘J˜qÓ&ˆEØÓ Ø—i‘i“k�ÞØ—M‘M 3¯©«Ð"6Ô7Ùñ  ô ÐQÐRSÑRXÑQ[Ð\Ó]Ð]ð �)ð ‘$�B�$‰<Ðr7   c                ód   • U =(       a(    U S   S   U:H  =(       a    US L =(       d    U S   S   U:H  $ )Nr­   r   r®   r   ©ÚtokensÚtype_r¶   s      r   Útest_next_tokenrÈ   z  s8   € ð
 ×Z�f˜R‘j ‘m uÑ,×Z°%¸4°-×2YÀ6È"Á:ÈaÁ=ÐTYÑCYÐZr7   c                óF   • [        XU5      (       a  U R                  5       $ g r   )rÈ   ÚpoprÅ   s      r   Ú
skip_tokenrË   ‚  s    € Ü�v e×,Ñ,Ø�z‰z‹|Ðð -r7   c                ó   • SU 44$ )Nr¶   r   )r¶   s    r   Ú
value_noderÍ   ‡  s   € Ø�U�HÐÐr7   c                ó
   • U S4$ )Nr   r   )Únames    r   Ú
ident_noderÐ   ‹  s   € Ø�ˆ8€Or7   c                ó
   • SU 4$ )Nr¥   r   )r¥   s    r   Úrange_list_noderÒ   �  s   € ð ˜Ð#Ð#r7   c                ó   • SU 44$ )NÚnotr   )r²   s    r   ÚnegaterÕ   •  s   € Ø�2�%ˆ<Ðr7   c                  óX   • \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rS rS rSrg)rD   i™  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                óà   • [        U5      U l        U R                  (       d  S U l        g U R                  5       U l        U R                  (       a  [	        SU R                  S   S   < 35      eg )NzExpected end of rule, got r­   r®   )rÃ   rÆ   rE   Ú	conditionr´   )rG   Ústrings     r   rL   Ú_Parser.__init__»  s\   € Ü# FÓ+ˆŒØ�{�{ð ˆDŒHØØ—>‘>Ó#ˆŒØ�;�;ÜÐ8¸¿¹ÀR¹ÈÑ9KÑ8NÐOÓPÐPð r7   Nc                ó   • [        U R                  X5      nUb  U$ Uc  [        US L =(       a    U=(       d    U5      nU R                  (       d  [        SU S35      e[        SU SU R                  S   S   < 35      e)Nz	expected z but end of rule reachedz	 but got r­   r®   )rË   rÆ   Úreprr´   )rG   rÇ   r¶   ÚtermÚtokens        r   ÚexpectÚ_Parser.expectÆ  s|   € Ü˜4Ÿ;™;¨Ó5ˆØÑØˆLØ‰<Ü˜ ˜×/¨%×8°5Ó9ˆDØ�{�{Ü˜i¨ vÐ-EÐFÓGÐGÜ˜) D 6¨°4·;±;¸r±?À1Ñ3EÑ2HÐIÓJÐJr7   c                óÀ   • U R                  5       n[        U R                  SS5      (       a1  SXR                  5       44n[        U R                  SS5      (       a  M1  U$ )Nrµ   Úor)Úand_conditionrË   rÆ   ©rG   Úops     r   rØ   Ú_Parser.conditionÐ  sS   € Ø×ÑÓ!ˆÜ˜Ÿ™ f¨d×3Ñ3Ø˜×.Ñ.Ó0Ð1Ð1ˆBô ˜Ÿ™ f¨d×3Ó3àˆ	r7   c                óÀ   • U R                  5       n[        U R                  SS5      (       a1  SXR                  5       44n[        U R                  SS5      (       a  M1  U$ )Nrµ   Úand)ÚrelationrË   rÆ   rä   s     r   rã   Ú_Parser.and_conditionÖ  sM   € Ø�]‰]‹_ˆÜ˜Ÿ™ f¨e×4Ñ4Ø˜Ÿ]™]›_Ð-Ð-ˆBô ˜Ÿ™ f¨e×4Ó4àˆ	r7   c                óþ  • U R                  5       n[        U R                  SS5      (       a3  [        U R                  SS5      (       a  SOSnX!U R                  5       44$ [        U R                  SS5      nSn[        U R                  SS5      (       a  SnO?[        U R                  SS5      (       d#  U(       a  [	        S5      eU R                  U5      $ SXAU R                  5       44nU(       a  [        U5      $ U$ )	Nrµ   ÚisrÔ   ÚisnotÚinÚwithinz#Cannot negate operator based rules.ré   )rK   rË   rÆ   r¶   r´   Únewfangled_relationr¥   rÕ   )rG   Úleftrå   ÚnegatedÚmethodr²   s         r   ré   Ú_Parser.relationÜ  sÖ   € Ø�y‰y‹{ˆÜ�d—k‘k 6¨4×0Ñ0Ü& t§{¡{°F¸E×BÑB‘ÈˆBØ˜dŸj™j›lÐ+Ð+Ð+Ü˜TŸ[™[¨&°%Ó8ˆØˆÜ�d—k‘k 6¨8×4Ñ4Ø‰Fä˜dŸk™k¨6°4×8Ñ8ÞÜ#Ð$IÓJÐJØ×/Ñ/°Ó5Ð5Ø˜&¨¯©Ó(9Ð:Ð:ˆÞ$Œv�b‹zÐ,¨"Ð,r7   c                óä   • [        U R                  SS5      (       a  SnO*[        U R                  SS5      (       a  SnO[        S5      eSSXR                  5       44nU(       a  [	        U5      $ U$ )	Nr·   Ú=Fz!=Tz'Expected "=" or "!=" or legacy relationré   rî   )rË   rÆ   r´   r¥   rÕ   )rG   rñ   rò   r²   s       r   rð   Ú_Parser.newfangled_relationí  se   € Ü�d—k‘k 8¨S×1Ñ1Ø‰GÜ˜Ÿ™ X¨t×4Ñ4Ø‰GäÐEÓFÐFØ˜$ §o¡oÓ&7Ð8Ð8ˆÞ$Œv�b‹zÐ,¨"Ð,r7   c                ó€   • U R                  5       n[        U R                  S5      (       a  XR                  5       4$ X4$ )Nr¸   )r¶   rË   rÆ   )rG   rñ   s     r   Úrange_or_valueÚ_Parser.range_or_value÷  s5   € Ø�z‰z‹|ˆÜ�d—k‘k :×.Ñ.ØŸ™›Ð%Ð%à�:Ðr7   c                óì   • U R                  5       /n[        U R                  SS5      (       a=  UR                  U R                  5       5        [        U R                  SS5      (       a  M=  [	        U5      $ )Nr·   Ú,)rù   rË   rÆ   rF   rÒ   )rG   r¥   s     r   r¥   Ú_Parser.range_listþ  s]   € Ø×)Ñ)Ó+Ð,ˆ
Ü˜Ÿ™ h°×4Ñ4Ø×Ñ˜d×1Ñ1Ó3Ô4ô ˜Ÿ™ h°×4Ó4ä˜zÓ*Ð*r7   c                óL  • [        U R                  S5      nUb  US   [        ;  a  [        S5      eUS   n[        U R                  SS5      (       a  SUS4U R	                  5       44$ [        U R                  SS5      (       a  SUS4U R	                  5       44$ [        U5      $ )Nrµ   r®   zExpected identifier variableÚmodr   r·   Ú%)rË   rÆ   Ú_VARSr´   r¶   rÐ   )rG   rµ   rÏ   s      r   rK   Ú_Parser.expr  sœ   € Ü˜$Ÿ+™+ vÓ.ˆØ‰<˜4 ™7¬%Ó/ÜÐ:Ó;Ð;Ø�A‰wˆÜ�d—k‘k 6¨5×1Ñ1Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜Ÿ™ X¨s×3Ñ3Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜$ÓÐr7   c                óN   • [        [        U R                  S5      S   5      5      $ )Nr¶   r®   )rÍ   r   rß   rh   s    r   r¶   Ú_Parser.value  s    € Üœ#˜dŸk™k¨'Ó2°1Ñ5Ó6Ó7Ð7r7   )rE   rÆ   )NN)rW   r|   r}   r~   r   rL   rß   rØ   rã   ré   rð   rù   r¥   rK   r¶   rƒ   r   r7   r   rD   rD   ™  s<   † ñòB	QôKòòò-ò"-òò+ò	 õ8r7   rD   c                ó   ^ • U 4S j$ )ú%Compiler factory for the `_Compiler`.c                óN   >• TU R                  U5      U R                  U5      4-  $ r   ©ra   )rG   rñ   ÚrightÚtmpls      €r   Ú<lambda>Ú"_binary_compiler.<locals>.<lambda>  s!   ø€  T¨T¯\©\¸$Ó-?ÀÇÁÈeÓATÐ,UÒ%Ur7   r   ©r
  s   `r   Ú_binary_compilerr    s	   ø€ äUÐUr7   c                ó   ^ • U 4S j$ )r  c                ó,   >• TU R                  U5      -  $ r   r  )rG   Úxr
  s     €r   r  Ú!_unary_compiler.<locals>.<lambda>  s   ø€ ˜4 $§,¡,¨q£/Ò1r7   r   r  s   `r   Ú_unary_compilerr    s	   ø€ ä1Ð1r7   c                ó   • g)Nr   r   ©r  s    r   r  r    s   € ˜r7   c                  óº   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS r\" S5      r\" S5      r\" S5      r\" S5      r\" S5      r\" S5      rS rSrg)Ú	_Compileri   zRThe compilers are able to transform the expressions into multiple
output formats.
c                ó.   • Uu  p#[        U SU 35      " U6 $ )NÚcompile_)Úgetattr)rG   Úargrå   rX   s       r   ra   Ú_Compiler.compile%  s!   € Ø‰ˆÜ�t˜x¨ t˜_Ô-¨tÐ4Ð4r7   c                ó   • g)Nr)   r   r  s    r   r  Ú_Compiler.<lambda>)  ó   € ˜#r7   c                ó   • g)Nr*   r   r  s    r   r  r  *  r  r7   c                ó   • g)Nr0   r   r  s    r   r  r  +  r  r7   c                ó   • g)Nr1   r   r  s    r   r  r  ,  r  r7   c                ó   • g)Nr2   r   r  s    r   r  r  -  r  r7   c                ó   • g)Nr3   r   r  s    r   r  r  .  r  r7   c                ó   • g)Nr4   r   r  s    r   r  r  /  r  r7   c                ó   • g)Nr5   r   r  s    r   r  r  0  r  r7   c                ó   • [        U5      $ r   r   )r  r0   s     r   r  r  1  s   € ¤ Q¤r7   z
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c                ó   • [        5       er   )ÚNotImplementedError)rG   ró   rK   r¥   s       r   Úcompile_relationÚ_Compiler.compile_relation9  s   € Ü!Ó#Ð#r7   r   N)rW   r|   r}   r~   r   ra   Ú	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   r7   r   r  r     s|   † ñò5ñ €IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ'€MÙ" <Ó0€KÙ! ,Ó/€JÙ! 'Ó*€KÙ" <Ó0€KÙ! ,Ó/€JÙ$ \Ó2€Mõ$r7   r  c                  ó^   • \ rS rSrSr\" S5      r\" S5      r\" S5      r	\" S5      r
S rSrg	)
r—   i=  z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c                ó�   ^ • SR                  U 4S jUS    5       5      nUR                  5        ST R                  U5       SU S3$ )Nrü   c              3  óv   >#   • U  H.  u  pS TR                  U5       STR                  U5       S3v •  M0     g7f)Ú(rO   Ú)Nr  )r   r¯   r°   rG   s      €r   r   Ú3_PythonCompiler.compile_relation.<locals>.<genexpr>F  s7   øé € ð 
ÚDQ¹&¸1ˆa�—‘˜Q“Ð   4§<¡<°£?Ð"3°1Õ5ÂMùs   ƒ69r®   r>  z, [z]))r%   Úupperra   )rG   ró   rK   r¥   Úrangess   `    r   r*  Ú _PythonCompiler.compile_relationE  sN   ø€ Ø—‘ô 
ØDNÈqÂMó
ó 
ˆð —,‘,“.Ð!  4§<¡<°Ó#5Ð"6°c¸&¸ÀÐDÐDr7   r   N)rW   r|   r}   r~   r   r  r5  r6  r  r7  r8  r*  rƒ   r   r7   r   r—   r—   =  s3   † Ù+á" =Ó1€KÙ! ,Ó/€JÙ! *Ó-€KÙ" =Ó1€KõEr7   r—   c                  óF   • \ rS rSrSr\R                  r\r	\r
\r\rS rSrg)r�   iL  z)Compile into a gettext plural expression.c                óf  • / nU R                  U5      nUS    H�  nUS   US   :X  a,  UR                  SU SU R                  US   5       S35        M;  U R                  US   5      nU R                  US   5      nUR                  SU SU SU SU S3	5        Mƒ     SS	R                  U5       S3$ )
Nr®   r   r>  z == r?  z >= ú && z <= z || )ra   rF   r%   )rG   ró   rK   r¥   r²   ÚitemÚminÚmaxs           r   r*  Ú!_GettextCompiler.compile_relationU  sÁ   € ØˆØ�|‰|˜DÓ!ˆØ˜q”MˆDØ�A‰w˜$˜q™'Ó!Ø—	‘	˜A˜d˜V 4¨¯©°T¸!±WÓ(=Ð'>¸aÐ@ÖAà—l‘l 4¨¡7Ó+�Ø—l‘l 4¨¡7Ó+�Ø—	‘	˜A˜d˜V 4¨ u¨D°°°d¸3¸%¸qÐAÖBñ "ð �6—;‘;˜r“?Ð# 1Ð%Ð%r7   r   N)rW   r|   r}   r~   r   r  r,  r-  Úcompile_zeror.  r/  r0  r1  r*  rƒ   r   r7   r   r�   r�   L  s)   † Ù3à×#Ñ#€IØ€IØ€IØ€IØ€Iõ
&r7   r�   c                  ó4   • \ rS rSrSrS r\r\r\r	\r
S rSrg)r‡   ib  z/Compiles the expression to plain of JavaScript.c                ó   • g)NzparseInt(n, 10)r   r  s    r   r  Ú_JavaScriptCompiler.<lambda>g  s   € Ð+r7   c                óx   • [         R                  XX#5      nUS:X  a  U R                  U5      nSU SU SU S3nU$ )Nrî   z
(parseInt(z	, 10) == rF  r?  )r�   r*  ra   )rG   ró   rK   r¥   r›   s        r   r*  Ú$_JavaScriptCompiler.compile_relationm  sH   € Ü×0Ñ0°¸tÓPˆØ�T‹>Ø—<‘< Ó%ˆDØ ˜v Y¨t¨f°D¸¸¸aÐ@ˆDØˆr7   r   N)rW   r|   r}   r~   r   r-  rK  r.  r/  r0  r1  r*  rƒ   r   r7   r   r‡   r‡   b  s%   † Ù9ñ ,€IØ€IØ€IØ€IØ€Iõr7   r‡   c                  óx   • \ rS rSrSr\" S5      r\" S5      r\" S5      r\" S5      r	\" S5      r
S rSS	 jrS
rg)r`   iu  z+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc                ó,   • U R                   " US   SS06$ )Nr®   rò   T)r*  )rG   ré   s     r   r7  Ú_UnicodeCompiler.compile_not‚  s   € Ø×$Ò$ h¨q¡kÐ@¸4Ñ@Ð@r7   c           	     óZ  • / nUS    Hn  nUS   US   :X  a%  UR                  U R                  US   5      5        M4  UR                  U R                  US   5       SU R                  US   5       35        Mp     U R                  U5       U(       a  SOS SU SSR                  U5       3$ )Nr®   r   z..z notr   rT   rü   )rF   ra   r%   )rG   ró   rK   r¥   rò   rB  rG  s          r   r*  Ú!_UnicodeCompiler.compile_relation…  s¨   € ØˆØ˜q”MˆDØ�A‰w˜$˜q™'Ó!Ø—‘˜dŸl™l¨4°©7Ó3Ö4à—‘ §¡¨d°1©gÓ!6Ð 7°r¸$¿,¹,ÀtÈAÁwÓ:OÐ9PÐQÖRñ	 "ð
 —,‘,˜tÓ$Ð%¶¡f¸RÐ%@ÀÀ&ÀÈÈ3Ï8É8ÐTZÓK[ÐJ\Ð]Ð]r7   r   N)F)rW   r|   r}   r~   r   r  r9  r:  r5  r6  r8  r7  r*  rƒ   r   r7   r   r`   r`   u  sE   † Ù5ñ " *Ó-€JÙ$ ^Ó4€MÙ" ;Ó/€KÙ! *Ó-€JÙ" ;Ó/€KòA÷^r7   r`   )r(   r{   rw   zMtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]])r‰   ry   rw   r   )r‰   ry   rw   z(Callable[[float | decimal.Decimal], str])r¤   r{   r¥   ú+Iterable[Iterable[float | decimal.Decimal]]rw   Úbool)r¯   r   r°   r   rw   r   )rÀ   r   rw   úlist[tuple[str, str]]r   )rÆ   rX  rÇ   r   r¶   ú
str | Nonerw   zlist[tuple[str, str]] | bool)rÆ   rX  rÇ   r   r¶   rY  )r¶   r   rw   z#tuple[Literal['value'], tuple[int]])rÏ   r   rw   ztuple[str, tuple[()]])r¥   rV  rw   zItuple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]])r²   ztuple[Any, ...]rw   z-tuple[Literal['not'], tuple[tuple[Any, ...]]]).r   Ú
__future__r   r    ÚreÚcollections.abcr   r   Útypingr   r   r   rA   rˆ   r6   r9   rŒ   rt   r¡   r”   r•   r–   Ú	Exceptionr´   r  ra   ÚUNICODEr%   r¹   Ú__annotations__rÃ   rÈ   rË   rÍ   rÐ   rÒ   rÕ   rD   r  r  rK  r  r—   r�   r‡   r`   r   r7   r   Ú<module>ra     s  ðòõ #ã Û 	ß -ß )Ñ )à=€Ø€ð:"Ø#ð:"àRô:"÷z]ñ ]ô@ð.'!Ø
Dð'!à-ô'!ôTð.BØ	 ðBà;ðBð 
ôBð.AØ	 ðAà;ðAð 
ôAô.ô.)�	ô )ò		€ð 
ˆ2�:Š:�f˜bŸj™jÓ)Ð*ØˆR�ZŠZÐ=¸b¿g¹gÀe»nÐ=MÈTÐRÓSÐTØˆb�jŠj˜Ó Ð!Øˆr�zŠz˜+Ó&Ð'Ø�—’Ð-¨r¯z©zÓ:Ð;ð4€Ð0ó ôð* ð[Ø!ð[àð[ð ð[ð "õ	[öô
ôð$Ø;ð$àNô$ô÷w8ñ w8òtVò
2ñ
 €÷$ñ $ô:E�iô Eô&�yô &ô,Ð*ô ô&^�yõ ^r7   