Ë
    5]j]c  ã                  ó  — d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	 ddl
mZ ddlmZmZ ddlmZ erdd	lmZmZ dd
lmZ  ej*                  d«      Zd!d„Zd!d„Zd"d„Z G d„ de«      Z G d„ de«      Z G d„ d«      Z	 	 	 	 	 d#	 	 	 	 	 	 	 	 	 	 	 	 	 d$d„Z ej*                  d«      Z d!d„Z!d%d&d„Z"d'd„Z#	 	 	 	 	 	 	 	 d(	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d)d„Z$ddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d*d„Z%	 	 	 	 	 	 d+d „Z&y),zÖ
babel.messages.pofile
~~~~~~~~~~~~~~~~~~~~~

Reading and writing of files in the ``gettext`` PO (portable object)
format.

:copyright: (c) 2013-2026 by the Babel Team.
:license: BSD, see LICENSE for more details.
é    )ÚannotationsN)ÚIterable)ÚTYPE_CHECKINGÚLiteral)ÚLocale)ÚCatalogÚMessage)ÚTextWrapper)ÚIOÚAnyStr)ÚSupportsWritez\\([\\trn"])c                óL   — d„ }d| vr| dd S t         j                  || dd «      S )z¿Reverse `escape` the given string.

    >>> print(unescape('"Say:\\n  \\"hello, world!\\"\\n"'))
    Say:
      "hello, world!"
    <BLANKLINE>

    :param string: the string to unescape
    c                óL   — | j                  d«      }|dk(  ry|dk(  ry|dk(  ry|S )Né   Únú
Útú	Úrú)Úgroup)ÚmatchÚms     úL/var/www/zogu/zoguvenv/lib/python3.12/site-packages/babel/messages/pofile.pyÚreplace_escapesz!unescape.<locals>.replace_escapes+   s2   € Ø�K‰K˜‹NˆØ�Š8ØØ�#ŠXØØ�#ŠXØàˆó    ú\r   éÿÿÿÿ)Ú_unescape_reÚsub)Ústringr   s     r   Úunescaper"       s6   € ò	ð �6ÑØ�a˜ˆ|ÐÜ×Ñ˜O¨V°A°b¨\Ó:Ð:r   c                óª   — d| v rE| j                  «       }| j                  d«      r|dd }dj                  t        t        |«      «      S t	        | «      S )aì  Reverse the normalization done by the `normalize` function.

    >>> print(denormalize(r'''""
    ... "Say:\n"
    ... "  \"hello, world!\"\n"'''))
    Say:
      "hello, world!"
    <BLANKLINE>

    >>> print(denormalize(r'''""
    ... "Say:\n"
    ... "  \"Lorem ipsum dolor sit "
    ... "amet, consectetur adipisicing"
    ... " elit, \"\n"'''))
    Say:
      "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
    <BLANKLINE>

    :param string: the string to denormalize
    r   ú""r   NÚ )Ú
splitlinesÚ
startswithÚjoinÚmapr"   )r!   Úescaped_liness     r   Údenormalizer+   ;   sT   € ð* ˆv�~Ø×)Ñ)Ó+ˆØ×Ñ˜TÔ"Ø)¨!¨"Ð-ˆMØ�w‰w”sœ8 ]Ó3Ó4Ð4ä˜ÓÐr   c                óR  — d| vr"d| vr| j                  «       j                  «       S g }d}d}| D ]U  }|dk(  r|rt        d«      ‚d}Œ|dk(  r|st        d«      ‚d}Œ-|dk(  r|r||z  }Œ:|sŒ=|j                  |«       d}ŒQ||z  }ŒW |r|rt        d«      ‚|j                  |«       |S )	zùExtract locations from location comments.

    Locations are extracted while properly handling First Strong
    Isolate (U+2068) and Pop Directional Isolate (U+2069), used by
    gettext to enclose filenames with spaces and tabs in their names.
    õ   â�¨õ   â�©r%   Fzglocation comment contains more First Strong Isolate characters, than Pop Directional Isolate charactersTzglocation comment contains more Pop Directional Isolate characters, than First Strong Isolate charactersú )ÚlstripÚsplitÚ
ValueErrorÚappend)ÚlineÚ	locationsÚlocationÚin_filenameÚcs        r   Ú_extract_locationsr9   Y   s÷   € ð �tÑ °Ñ 4Ø�{‰{‹}×"Ñ"Ó$Ð$à€IØ€HØ€KØò  'ˆØ�Š=ÙÜ ðJóð ð ˆKØØ�(Š]ÙÜ ðGóð ð  ˆKØØ�#ŠXÙØ˜A‘‘ÚØ× Ñ  Ô*Ø‘à˜‰M‰Hð1 'ñ4 ÙÜ ðJóð ð ×Ñ˜XÔ&àÐr   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚPoFileErrorzDException thrown by PoParser when an invalid po file is encountered.c                óX   •— t         ‰| �  |› d|› �«       || _        || _        || _        y )Nz on )ÚsuperÚ__init__Úcatalogr4   Úlineno)ÚselfÚmessager?   r4   r@   Ú	__class__s        €r   r>   zPoFileError.__init__Ž   s0   ø€ Ü‰Ñ˜G˜9 D¨¨Ð1Ô2ØˆŒØˆŒ	Øˆ�r   )
rB   Ústrr?   r   r4   rD   r@   ÚintÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r>   Ú__classcell__©rC   s   @r   r;   r;   ‹   s   ø„ ÙN÷ñ r   r;   c                  ó(   ‡ — e Zd Zdˆ fd„Zdd„Zˆ xZS )Ú_NormalizedStringc                óT   •— t         ‰| �  t        t        j                  |«      «       y ©N)r=   r>   r)   rD   Ústrip)rA   ÚargsrC   s     €r   r>   z_NormalizedString.__init__–   s   ø€ Ü‰ÑœœSŸY™Y¨Ó-Õ.r   c                óF   — | sydj                  t        t        | «      «      S )Nr%   )r(   r)   r"   ©rA   s    r   r+   z_NormalizedString.denormalize™   s   € ÙØØ�w‰w”sœ8 TÓ*Ó+Ð+r   )rS   rD   rF   rG   )rF   rD   )rH   rI   rJ   r>   r+   rL   rM   s   @r   rO   rO   •   s   ø„ õ/÷,r   rO   c                  óx   — e Zd ZdZ	 	 d	 	 	 	 	 	 	 dd„Zdd„Zdd„Zdd„Zddd„Zddd„Z	dd„Z
dd	„Zdd
„Zdd„Zy)ÚPoFileParserz–Support class to  read messages from a ``gettext`` PO (portable object) file
    and add them to a `Catalog`

    See `read_po` for simple cases.
    c                ój   — || _         || _        d| _        d| _        || _        | j                  «        y )Nr   )r?   Úignore_obsoleteÚcounterÚoffsetÚabort_invalidÚ_reset_message_state)rA   r?   rY   r\   s       r   r>   zPoFileParser.__init__¦   s5   € ð ˆŒØ.ˆÔØˆŒØˆŒØ*ˆÔØ×!Ñ!Õ#r   c                óž   — g | _         g | _        g | _        g | _        g | _        g | _        d | _        d| _        d| _        d| _	        d| _
        y )NF)ÚmessagesÚtranslationsr5   ÚflagsÚuser_commentsÚauto_commentsÚcontextÚobsoleteÚin_msgidÚ	in_msgstrÚ
in_msgctxtrU   s    r   r]   z!PoFileParser._reset_message_state³   sR   € ØˆŒØˆÔØˆŒØˆŒ
ØˆÔØˆÔØˆŒØˆŒØˆŒØˆŒØˆ�r   c           
     ó  — t        | j                  «      dkD  r»t        d„ | j                  D «       «      }t        | j                  j
                  «      D �cg c]  }d‘Œ }}t        | j                  «      D ]O  \  }}|| j                  j
                  k\  r| j                  d| j                  d«       Œ=|j                  «       ||<   ŒQ t        |«      }n=| j                  d   j                  «       }| j                  d   d   j                  «       }| j                  r| j                  j                  «       nd}t        ||| j                  | j                  | j                  | j                   | j                  dz   |¬«      }| j"                  r@| j$                  sC|| j                  j"                  | j                  j'                  ||«      <   n|| j                  |<   | xj(                  dz  c_        | j+                  «        yc c}w )z�
        Add a message to the catalog based on the current parser state and
        clear the state ready to process the next message.
        r   c              3  ó<   K  — | ]  }|j                  «       –— Œ y ­wrQ   )r+   )Ú.0r   s     r   ú	<genexpr>z,PoFileParser._add_message.<locals>.<genexpr>Æ   s   è ø€ ÒA¨a˜!Ÿ-™-Ÿ/ÑAùó   ‚r%   z5msg has more translations than num_plurals of catalogr   N)r@   rd   )Úlenr_   ÚtupleÚranger?   Únum_pluralsÚsortedr`   Ú_invalid_pofiler[   r+   rd   r	   r5   ra   rc   rb   re   rY   Ú_key_forrZ   r]   )rA   ÚmsgidÚ_r!   ÚidxÚtranslationÚmsgctxtrB   s           r   Ú_add_messagezPoFileParser._add_messageÀ   s«  € ô
 ˆt�}‰}Ó Ò!ÜÑA°4·=±=ÔAÓAˆEÜ"'¨¯©×(@Ñ(@Ó"AÖB˜Q’bÐBˆFÐBÜ$*¨4×+<Ñ+<Ó$=ò 8Ñ ��[Ø˜$Ÿ,™,×2Ñ2Ò2Ø×(Ñ(ØØŸ™ØOôð
 Ø)×5Ñ5Ó7��s’ð8ô ˜6“]‰Fà—M‘M !Ñ$×0Ñ0Ó2ˆEØ×&Ñ& qÑ)¨!Ñ,×8Ñ8Ó:ˆFØ04·²�$—,‘,×*Ñ*Ô,À$ˆÜØØØ�N‰NØ�J‰JØ×ÑØ×ÑØ—;‘; ‘?Øô	
ˆð �=Š=Ø×'Ò'ØOV�—‘×%Ñ% d§l¡l×&;Ñ&;¸EÀ7Ó&KÒLà")ˆD�L‰L˜ÑØ�Š˜Ñ�Ø×!Ñ!Õ#ùò? Cs   Á	Hc                ó  — | j                   r~| j                  sa| j                  d| j                  d| j                   d   j	                  «       › d�«       | j                  j                  dt        «       g«       | j                  «        y y )Nr%   zmissing msgstr for msgid 'r   ú')r_   r`   rs   r[   r+   r3   rO   rz   rU   s    r   Ú_finish_current_messagez$PoFileParser._finish_current_messageè   sz   € Ø�=Š=Ø×$Ò$Ø×$Ñ$ØØ—K‘KØ0°·±¸qÑ1A×1MÑ1MÓ1OÐ0PÐPQÐRôð
 ×!Ñ!×(Ñ(¨!Ô->Ó-@Ð)AÔBØ×ÑÕð r   c                óf   — |sy |d   dk(  r| j                  ||«       y | j                  |||«       y )Nr   ú")Ú!_process_string_continuation_lineÚ_process_keyword_line)rA   r@   r4   re   s       r   Ú_process_message_linez"PoFileParser._process_message_lineó   s5   € ÙØØ�‰7�cŠ>Ø×2Ñ2°4¸Õ@à×&Ñ& v¨t°XÕ>r   c                óP  — |j                  d«      \  }}}|dv r| j                  «        || _        |dk(  r|| _        |dv r3d| _        d| _        | j                  j                  t        |«      «       y |dk(  rd| _        t        |«      | _	        y |dk(  s|j                  d	«      rmd| _        d| _        |j                  d
«      \  }}}	|rt        |	d d «      nd}
|dk7  rt        |«      n	t        «       }| j                  j                  |
|g«       y | j                  ||d«       y )Nr/   )ru   ry   ru   )ru   Úmsgid_pluralFTry   Úmsgstrúmsgstr[ú[r   r   r$   zUnknown or misformatted keyword)Ú	partitionr}   re   r[   rh   rf   r_   r3   rO   rd   r'   rg   rE   r`   rs   )rA   r@   r4   re   Úkeywordrv   ÚargÚkwargÚhas_bracketÚidxargrw   Úss               r   r�   z"PoFileParser._process_keyword_lineû   s&  € ØŸ.™.¨Ó-‰ˆ��CàÐ*Ñ*Ø×(Ñ(Ô*à ˆŒð �gÒØ ˆDŒKàÐ/Ñ/Ø#ˆDŒOØ ˆDŒMØ�M‰M× Ñ Ô!2°3Ó!7Ô8Øà�iÒØ"ˆDŒOÜ,¨SÓ1ˆDŒLØà�hÒ '×"4Ñ"4°YÔ"?Ø!ˆDŒMØ!ˆDŒNØ)0×):Ñ):¸3Ó)?Ñ&ˆE�; Ù&1”#�f˜S˜b�kÔ"°qˆCØ*-°ª+Ô! #Ô&Ô;LÓ;NˆAØ×Ñ×$Ñ$ c¨1 XÔ.Øà×Ñ˜T 6Ð+LÕMr   c                ó  — | j                   r| j                  d   }nL| j                  r| j                  d   d   }n-| j                  r| j
                  }n| j                  ||d«       y |j                  |j                  «       «       y )Nr   r   z<Got line starting with " but not in msgid, msgstr or msgctxt)	rf   r_   rg   r`   rh   rd   rs   r3   rR   )rA   r4   r@   rŽ   s       r   r€   z.PoFileParser._process_string_continuation_line  sq   € Ø�=Š=Ø—‘˜bÑ!‰AØ�^Š^Ø×!Ñ! "Ñ% aÑ(‰AØ�_Š_Ø—‘‰Aà× Ñ ØØØOôð
 à	�‰�—‘“Õr   c                óŒ  — | j                  «        |d d }|dk(  rpt        |dd  «      D ]^  }|j                  d«      \  }}}|r(	 | j                  j	                  |t        |«      f«       ŒB| j                  j	                  |d f«       Œ` y |dk(  rC| j                  j                  d„ |dd  j                  «       j                  d«      D «       «       y |dk(  r1|dd  j                  «       }|r| j                  j	                  |«       y | j                  j	                  |dd  j                  «       «       y # t        $ r Y �Œw xY w)	Né   z#:ú:z#,c              3  ó<   K  — | ]  }|j                  «       –— Œ y ­wrQ   )rR   )rk   Úflags     r   rl   z0PoFileParser._process_comment.<locals>.<genexpr>@  s   è ø€ ÒT¨t˜dŸj™jŸlÑTùrm   ú,z#.r   )r}   r9   Ú
rpartitionr5   r3   rE   r2   ra   Úextendr0   r1   rR   rc   rb   )rA   r4   Úprefixr6   ÚaÚcolonÚbÚcomments           r   Ú_process_commentzPoFileParser._process_comment/  s4  € Ø×$Ñ$Ô&à�b�q�ˆØ�TŠ>Ü.¨t°A°B¨xÓ8ò <�Ø&×1Ñ1°#Ó6‘��5˜!Ùð!ØŸ™×-Ñ-¨q´#°a³&¨kÕ:ð —N‘N×)Ñ)¨8°TÐ*:Õ;ð<ð à�TŠ>Ø�J‰J×ÑÑT°t¸A¸B°x·±Ó7H×7NÑ7NÈsÓ7SÔTÔTØà�TŠ>à˜1˜2�h—n‘nÓ&ˆGÙØ×"Ñ"×)Ñ)¨'Ô2Øð 	×Ñ×!Ñ! $ q r (§.¡.Ó"2Õ3øô% &ò !Ú ð!ús   Á&D6Ä6	EÅEc           	     ó  — d}t        |«      D ]­  \  }}|j                  «       }|€t        |t        «       }|sŒ,|r%|j	                  | j
                  j                  «      }|d   dk(  rA|dd dk(  r&| j                  ||dd j                  «       d¬«       Œ‰	 | j                  |«       Œœ| j                  ||«       Œ¯ | j                  «        | j                  s~| j                  s| j                  s| j                   rY| j"                  j%                  t'        «       «       | j(                  j%                  dt'        «       g«       | j+                  «        yyy# t        $ r'}| j                  ||t        |«      «       Y d}~�Œvd}~ww xY w)aV  
        Reads from the file-like object (or iterable of string-likes) `fileobj`
        and adds any po file units found in it to the `Catalog`
        supplied to the constructor.

        All of the items in the iterable must be the same type; either `str`
        or `bytes` (decoded with the catalog charset), but not a mixture.
        Nr   ú#r‘   z#~T)re   )Ú	enumeraterR   Ú
isinstancerD   Údecoder?   Úcharsetr‚   r0   r�   r2   rs   r}   rZ   ra   rb   rc   r_   r3   rO   r`   rz   )rA   ÚfileobjÚneeds_decoder@   r4   Úexcs         r   ÚparsezPoFileParser.parseM  sh  € ð ˆä% gÓ.ò 	9‰LˆF�DØ—:‘:“<ˆDØÐ#ô $.¨d´CÓ#8Ð8�ÙØÙØ—{‘{ 4§<¡<×#7Ñ#7Ó8�Ø�A‰w˜#Š~Ø˜˜�8˜tÒ#Ø×.Ñ.¨v°t¸A¸B°x·±Ó7HÐSWÐ.ÕXðEØ×-Ñ-¨dÕ3ð ×*Ñ*¨6°4Õ8ð'	9ð* 	×$Ñ$Ô&ð �|Š| §¢¨t×/AÒ/AÀT×EWÒEWØ�M‰M× Ñ Ô!2Ó!4Ô5Ø×Ñ×$Ñ$ aÔ):Ó)<Ð%=Ô>Ø×ÑÕð FXˆ|øô &ò EØ×,Ñ,¨T°6¼3¸s»8×DÒDûðEús   ÂEÅ	F	Å"FÆF	c                ó°   — t        |t        «      sJ ‚| j                  rt        || j                  ||«      ‚t        d|«       t        d|dz   › d|›�«       y )NzWARNING:zWARNING: Problem on line r   z: )r¡   rD   r\   r;   r?   Úprint)rA   r4   r@   Úmsgs       r   rs   zPoFileParser._invalid_pofilev  sT   € Ü˜$¤Ô$Ð$Ð$Ø×ÒÜ˜c 4§<¡<°°vÓ>Ð>Üˆj˜#ÔÜÐ)¨&°1©*¨°R¸°xÐ@ÕAr   N)FF)r?   r   rY   Úboolr\   r«   rF   rG   )rF   rG   )F)r¤   úIO[AnyStr] | Iterable[AnyStr]rF   rG   )rH   rI   rJ   rK   r>   r]   rz   r}   r‚   r�   r€   r�   r§   rs   © r   r   rW   rW   Ÿ   sl   „ ñð !&Ø#ð	$àð$ð ð$ð ð	$ð
 
ó$ó ó&$óP	 ô?ô!NóFó"4ó<' ôRBr   rW   Fc                ó`   — t        |||¬«      }t        |||¬«      }|j                  | «       |S )a©  Read messages from a ``gettext`` PO (portable object) file from the given
    file-like object (or an iterable of lines) and return a `Catalog`.

    >>> from datetime import datetime
    >>> from io import StringIO
    >>> buf = StringIO('''
    ... #: main.py:1
    ... #, fuzzy, python-format
    ... msgid "foo %(name)s"
    ... msgstr "quux %(name)s"
    ...
    ... # A user comment
    ... #. An auto comment
    ... #: main.py:3
    ... msgid "bar"
    ... msgid_plural "baz"
    ... msgstr[0] "bar"
    ... msgstr[1] "baaz"
    ... ''')
    >>> catalog = read_po(buf)
    >>> catalog.revision_date = datetime(2007, 4, 1)

    >>> for message in catalog:
    ...     if message.id:
    ...         print((message.id, message.string))
    ...         print(' ', (message.locations, sorted(list(message.flags))))
    ...         print(' ', (message.user_comments, message.auto_comments))
    ('foo %(name)s', 'quux %(name)s')
      ([('main.py', 1)], ['fuzzy', 'python-format'])
      ([], [])
    (('bar', 'baz'), ('bar', 'baaz'))
      ([('main.py', 3)], [])
      (['A user comment'], ['An auto comment'])

    .. versionadded:: 1.0
       Added support for explicit charset argument.

    :param fileobj: the file-like object (or iterable of lines) to read the PO file from
    :param locale: the locale identifier or `Locale` object, or `None`
                   if the catalog is not bound to a locale (which basically
                   means it's a template)
    :param domain: the message domain
    :param ignore_obsolete: whether to ignore obsolete messages in the input
    :param charset: the character set of the catalog.
    :param abort_invalid: abort read if po file is invalid
    )ÚlocaleÚdomainr£   )r\   )r   rW   r§   )r¤   r¯   r°   rY   r£   r\   r?   Úparsers           r   Úread_por²   ~  s2   € ôl ˜V¨F¸GÔD€GÜ˜' ?À-ÔP€FØ
‡L�L�ÔØ€Nr   zL(\s+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))c                ó¬   — d| j                  dd«      j                  dd«      j                  dd«      j                  dd	«      j                  d
d«      z  S )zõEscape the given string so that it can be included in double-quoted
    strings in ``PO`` files.

    >>> escape('''Say:
    ...   "hello, world!"
    ... ''')
    '"Say:\\n  \\"hello, world!\\"\\n"'

    :param string: the string to escape
    z"%s"r   z\\r   z\tr   z\rr   z\nr   z\")Úreplace)r!   s    r   Úescaperµ   Ã  sU   € ð �F—N‘N 4¨Ó0×8Ñ8¸¸uÓE×MÑMØØó÷ �gˆd�EÓŸ7™7 3¨Ó.ñ/ð /r   éL   c           
     ó  — |�r|dkD  �rt        |«      }g }| j                  d«      D ]î  }t        t        |«      «      |z   |kD  rÁt        j	                  |«      }|j                  «        |sŒEg }d}|rot        t        |d   «      «      dz
  |z   }	||	z   |k  r%|j                  |j                  «       «       ||	z  }n"|s|j                  |j                  «       «       n|rŒo|j                  dj                  |«      «       |rŒ˜ŒÞ|j                  |«       Œð n| j                  d«      }t        |«      dk  rt        | «      S |r|d   s|d= |dxx   dz  cc<   ddj                  |D �cg c]  }|t        |«      z   ‘Œ c}«      z   S c c}w )	a©  Convert a string into a format that is appropriate for .po files.

    >>> print(normalize('''Say:
    ...   "hello, world!"
    ... ''', width=None))
    ""
    "Say:\n"
    "  \"hello, world!\"\n"

    >>> print(normalize('''Say:
    ...   "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
    ... ''', width=32))
    ""
    "Say:\n"
    "  \"Lorem ipsum dolor sit "
    "amet, consectetur adipisicing"
    " elit, \"\n"

    :param string: the string to normalize
    :param prefix: a string that should be prepended to every line
    :param width: the maximum line width; use `None`, 0, or a negative number
                  to completely disable line wrapping
    r   Tr‘   r   r%   r   r   z""
)	rn   r&   rµ   ÚWORD_SEPr1   Úreverser3   Úpopr(   )
r!   r˜   ÚwidthÚ	prefixlenÚlinesr4   ÚchunksÚbufÚsizeÚlengths
             r   Ú	normalizerÂ   Ô  sq  € ò0 �˜“Ü˜“Kˆ	ØˆØ×%Ñ% dÓ+ò 	#ˆDÜ”6˜$“<Ó  9Ñ,¨uÒ4Ü!Ÿ™¨Ó-�Ø—‘Ô ÚØ�CØ�DÙ Ü!$¤V¨F°2©JÓ%7Ó!8¸1Ñ!<¸yÑ!H˜Ø &™=¨5Ò0ØŸJ™J v§z¡z£|Ô4Ø  F™N™Dá#&ð !$§
¡
¨6¯:©:«<Ô 8Ø!ò !ð —L‘L §¡¨£Ô.ó ð  —‘˜TÕ"ñ)	#ð, ×!Ñ! $Ó'ˆä
ˆ5ƒz�Q‚Ü�f‹~Ðñ �U˜2’YØ�"ˆIØˆb‹	�TÑ‹	Ø�D—I‘IÀ5ÖI¸4 ¬°«Ó 5ÒIÓJÑJÐJùÒIs   Å+F	
c                ór   — d| vrd| vr| S | j                  d«      sd| z   } | j                  d«      s| dz  } | S )zàEnclose filenames which include white spaces or tabs.

    Do the same as gettext and enclose filenames which contain white
    spaces or tabs with First Strong Isolate (U+2068) and Pop
    Directional Isolate (U+2069).
    r/   r   r-   r.   )r'   Úendswith)Úfilenames    r   Ú_enclose_filename_if_necessaryrÆ     sM   € ð �(Ñ˜t¨8Ñ3Øˆà×Ñ˜xÔ(Ø˜hÑ&ˆØ×Ñ˜XÔ&Ø�HÑˆØ€Or   Tc
           
     óÄ   — d}
|rd}
n|rd}
t        |||	||||
|¬«      D ]?  }t        |t        «      r|j                  |j                  d«      }| j                  |«       ŒA y)aÊ  Write a ``gettext`` PO (portable object) template file for a given
    message catalog to the provided file-like object.

    >>> catalog = Catalog()
    >>> catalog.add('foo %(name)s', locations=[('main.py', 1)],
    ...             flags=('fuzzy',))
    <Message...>
    >>> catalog.add(('bar', 'baz'), locations=[('main.py', 3)])
    <Message...>
    >>> from io import BytesIO
    >>> buf = BytesIO()
    >>> write_po(buf, catalog, omit_header=True)
    >>> print(buf.getvalue().decode("utf8"))
    #: main.py:1
    #, fuzzy, python-format
    msgid "foo %(name)s"
    msgstr ""
    <BLANKLINE>
    #: main.py:3
    msgid "bar"
    msgid_plural "baz"
    msgstr[0] ""
    msgstr[1] ""
    <BLANKLINE>
    <BLANKLINE>

    :param fileobj: the file-like object to write to
    :param catalog: the `Catalog` instance
    :param width: the maximum line width for the generated output; use `None`,
                  0, or a negative number to completely disable line wrapping
    :param no_location: do not emit a location comment for every message
    :param omit_header: do not include the ``msgid ""`` entry at the top of the
                        output
    :param sort_output: whether to sort the messages in the output by msgid
    :param sort_by_file: whether to sort the messages in the output by their
                         locations
    :param ignore_obsolete: whether to ignore obsolete messages and not include
                            them in the output; by default they are included as
                            comments
    :param include_previous: include the old msgid as a comment when
                             updating the catalog
    :param include_lineno: include line number in the location comment
    NrB   r6   ©rY   Úinclude_linenoÚinclude_previousÚno_locationÚomit_headerÚsort_byr»   Úbackslashreplace)Úgenerate_por¡   rD   Úencoder£   Úwrite)r¤   r?   r»   rË   rÌ   Úsort_outputÚsort_by_filerY   rÊ   rÉ   rÍ   r4   s               r   Úwrite_porÔ   "  ss   € ðp €GÙØ‰Ù	ØˆäØØ'Ø%Ø)ØØØØô	ò ˆô �dœCÔ Ø—;‘;˜wŸ™Ð0BÓCˆDØ�‰�dÕñr   rÈ   c             #  óà  ‡ ‡‡K  — ‰r‰dkD  r‰nd}t        |d¬«      Št        ‰dd¬«      }	dˆfd„	}
dˆ ˆfd	„	}t        ‰ |¬
«      D �]  }|j                  sY|rŒ‰ j                  }‰rA‰dkD  r<g }|j	                  «       D ]  }||	j                  |«      z  }Œ dj                  |«      }|› d�–— |j                  D ]  } |
|«      E d{  –—†  Œ |j                  D ]  } |
|d¬«      E d{  –—†  Œ |s“g }	 t        |j                  d„ ¬«      }|D ]R  \  }}|j                  t        j                  d«      }t        |«      }|r
|r|› d|d›�}||vsŒB|j!                  |«       ŒT  |
dj                  |«      d¬«      E d{  –—†  |j"                  r-ddj                  dgt        |j"                  «      ¢«      › d�–— |j$                  rv|rt |
dt'        |j$                  d   ‰¬«      › �d¬«      E d{  –—†  t)        |j$                  «      dkD  r/t'        |j$                  d   ‰¬«      } |
d|› �d¬«      E d{  –—†   ||«      E d{  –—†  d–— �Œ |sbt        ‰ j*                  j-                  «       |¬
«      D ]9  }|j                  D ]  } |
|«      E d{  –—†  Œ  ||d¬«      E d{  –—†  d–— Œ; yy7 �Œö7 �ŒÖ# t        $ r |j                  }Y �ŒÍw xY w7 �Œ^7 Œì7 Œ§7 Œ™7 ŒK7 Œ9­w)z„Yield text strings representing a ``gettext`` PO (portable object) file.

    See `write_po()` for a more detailed description.
    r   r¶   F)r»   Úbreak_long_wordsz# )r»   Úsubsequent_indentrÖ   r%   c              3  ól   •K  — ‰j                  | «      D ]  }d|› d|j                  «       › d�–— Œ y ­w)NrŸ   r/   r   )ÚwraprR   )rœ   r˜   r4   Úcomment_wrappers      €r   Ú_format_commentz$generate_po.<locals>._format_comment…  s<   øè ø€ Ø#×(Ñ(¨Ó1ò 	0ˆDØ�f�X˜Q˜tŸz™z›|˜n¨BÐ/Ó/ñ	0ùs   ƒ14c           
   3  ó¾  •K  — t        | j                  t        t        f«      r·| j                  r |› dt        | j                  |‰¬«      › d�–— |› dt        | j                  d   |‰¬«      › d�–— |› dt        | j                  d   |‰¬«      › d�–— t        ‰j                  «      D ],  }	 | j                  |   }|› d	|d
›dt        ||‰¬«      › d�–— Œ. y | j                  r |› dt        | j                  |‰¬«      › d�–— |› dt        | j                  |‰¬«      › d�–— |› dt        | j                  xs d|‰¬«      › d�–— y # t        $ r d}Y Œ›w xY w­w)Nzmsgctxt )r˜   r»   r   úmsgid r   úmsgid_plural r   r%   r†   Údz] zmsgstr )
r¡   ÚidÚlistro   rd   rÂ   rp   rq   r!   Ú
IndexError)rB   r˜   rw   r!   r?   r»   s       €€r   Ú_format_messagez$generate_po.<locals>._format_message‰  st  øè ø€ Ü�g—j‘j¤4¬ -Ô0Ø�ŠØ˜ ¬°7·?±?È6ÐY^Ô)_Ð(`Ð`bÐcÒcØ�H˜F¤9¨W¯Z©Z¸©]À6ÐQVÔ#WÐ"XÐXZÐ[Ò[Ø�H˜M¬)°G·J±J¸q±MÈ&ÐX]Ô*^Ð)_Ð_aÐbÒbä˜W×0Ñ0Ó1ò c�ð Ø$Ÿ^™^¨CÑ0�Fð  ˜ ¨¨A w¨b´¸6È&ÐX]Ô1^Ð0_Ð_aÐbÓbñcð �ŠØ˜ ¬°7·?±?È6ÐY^Ô)_Ð(`Ð`bÐcÒcØ�H˜F¤9¨W¯Z©ZÀÈeÔ#TÐ"UÐUWÐXÒXØ�H˜G¤I¨g¯n©nÒ.BÀÈ6ÐY^Ô$_Ð#`Ð`bÐcÓcøô "ò  Ø’Fð üs+   ƒB+EÂ/EÂ>BEÅEÅEÅEÅE)rÍ   r   Nú.)r˜   c                óH   — | d   t        | d   t        «      xr | d   xs dfS )Nr   r   r   )r¡   rE   )Úxs    r   ú<lambda>zgenerate_po.<locals>.<lambda>·  s(   €  1 Q¡4¬°A°a±D¼#Ó)>Ò)GÀ1ÀQÁ4Ò)MÈ2Ð"N€ r   ©Úkeyú/r’   rß   r/   rŸ   z, rÝ   )r»   ú|r   rÞ   z#~ )r%   )r
   Ú_sort_messagesrà   Úheader_commentr&   rÙ   r(   rb   rc   rr   r5   Ú	TypeErrorr´   ÚosÚseprÆ   r3   ra   Úprevious_idrÂ   rn   re   Úvalues)r?   rY   rÉ   rÊ   rË   rÌ   rÍ   r»   Úcomment_widthÚheader_wrapperrÛ   rã   rB   Úcomment_headerr½   r4   rœ   Úlocsr5   rÅ   r@   r6   Únorm_previous_idrÚ   s   `      `               @r   rÏ   rÏ   o  s,  úè ø€ ñ" # u¨q¢y‘E°b€Mä!¨ÈÔN€OÜ  uÀÐW\Ô]€Nõ0ödô& " '°7Ô;ó 5ˆØ�zŠzÙØØ$×3Ñ3ˆNÙ˜ šØ�Ø*×5Ñ5Ó7ò 7�DØ˜^×0Ñ0°Ó6Ñ6‘Eð7à!%§¡¨5Ó!1�Ø#Ð$ BÐ'Ò'à×,Ñ,ò 	0ˆGÙ& wÓ/×/Ñ/ð	0à×,Ñ,ò 	<ˆGÙ& w°sÔ;×;Ñ;ð	<ñ ØˆDð.Ü"Ø×%Ñ%ÙNô�	ð %.ò *Ñ �˜&Ø#×+Ñ+¬B¯F©F°CÓ8�Ü9¸(ÓC�Ù™nØ"* ¨1¨V°A¨JÐ7�HØ 4Ò'Ø—K‘K Õ)ð*ñ ' s§x¡x°£~¸cÔB×BÐBØ�=Š=Ø�d—i‘i Ð <¤f¨W¯]©]Ó&;Ð <Ó=Ð>¸bÐAÒAà×ÒÑ#3Ù&Øœ 7×#6Ñ#6°qÑ#9ÀÔGÐHÐIØô÷ ð ô �7×&Ñ&Ó'¨!Ò+Ü#,¨W×-@Ñ-@ÀÑ-CÈ5Ô#QÐ Ù*¨]Ð;KÐ:LÐ+MÐVYÔZ×ZÐZá" 7Ó+×+Ð+ØŒ
ðk5ñn Ü%Ø×Ñ×#Ñ#Ó%Øô
ò 	ˆGð #×0Ñ0ò 4�Ù*¨7Ó3×3Ñ3ð4á& w°uÔ=×=Ð=Ø‹Jñ	ð ðU 0ùà;úô ò .Ø#×-Ñ-“	ð.úð Cùð
øð [øà+øð 4øØ=ús¸   …CK.Ã	J?Ã
"K.Ã,KÃ-
K.Ã8KÄAK.Å/K.ÆK!ÆA3K.Ç7K$Ç8AK.È>K&È?K.ÉK(ÉAK.ÊK*ÊK.Ê2K,Ê3K.ËK.ËKËK.ËKËK.Ë$K.Ë&K.Ë(K.Ë*K.Ë,K.c                óz   — t        | «      } |dk(  r| j                  «        | S |dk(  r| j                  d„ ¬«       | S )zø
    Sort the given message iterable by the given criteria.

    Always returns a list.

    :param messages: An iterable of Messages.
    :param sort_by: Sort by which criteria? Options are `message` and `location`.
    :return: list[Message]
    rB   r6   c                ó   — | j                   S rQ   )r5   )r   s    r   rç   z _sort_messages.<locals>.<lambda>ï  s
   €  A§K¡K€ r   rè   )rá   Úsort)r_   rÍ   s     r   rì   rì   Þ  sC   € ô �H‹~€HØ�)ÒØ�‰Œð €Oð 
�JÒ	Ø�‰Ñ/ˆÔ0Ø€Or   )r!   rD   rF   rD   )r4   rD   rF   z	list[str])NNFNF)r¤   r¬   r¯   zLocale | str | Noner°   ú
str | NonerY   r«   r£   rû   r\   r«   rF   r   )r%   r¶   )r!   rD   r˜   rD   r»   rE   rF   rD   )rÅ   rD   rF   rD   )r¶   FFFFFFT)r¤   zSupportsWrite[bytes]r?   r   r»   rE   rË   r«   rÌ   r«   rÒ   r«   rÓ   r«   rY   r«   rÊ   r«   rÉ   r«   rF   rG   )r?   r   rY   r«   rÉ   r«   rÊ   r«   rË   r«   rÌ   r«   rÍ   ú%Literal['message', 'location'] | Noner»   rE   rF   zIterable[str])r_   zIterable[Message]rÍ   rü   rF   zlist[Message])'rK   Ú
__future__r   rï   ÚreÚcollections.abcr   Útypingr   r   Ú
babel.corer   Úbabel.messages.catalogr   r	   Ú
babel.utilr
   r   r   Ú	_typeshedr   Úcompiler   r"   r+   r9   Ú	Exceptionr;   rá   rO   rW   r²   r¸   rµ   rÂ   rÆ   rÔ   rÏ   rì   r­   r   r   ú<module>r     s+  ðñ	õ #ã 	Û 	Ý $ß )å ß 3Ý "áß!å'ð ˆr�z‰z˜/Ó*€ó;ó6 ó</ôd�)ô ô,˜ô ,÷\Bñ \BðB #'ØØ!ØØð9Ø*ð9àð9ð ð9ð ð	9ð
 ð9ð ð9ð ó9ðx ˆ2�:‰:ðó€ó/ô":Kózð( ØØØØØ!Ø"ØðJØ!ðJàðJð ðJð ð	Jð
 ðJð ðJð ðJð ðJð ðJð ðJð 
óJð` "ØØ"ØØØ59ØñlØðlð ðlð ð	lð
 ðlð ðlð ðlð 3ðlð ðlð ólð^Øðà2ðð ôr   