§
    XŠtj>'  ã                   óà  — d Z ddlZddlmZ  ej        d¦  «        Z ej        dej        ej        z  ej        z  ¦  «        Z	 ej        dej
        ej        z  ej        z  ¦  «        Z ej        dej        ¦  «        Z G d„ d	e¦  «        Z G d
„ de¦  «        Zd"d„Zd#d„Zd#d„Zd#d„Zd„ Zd„ Zd„ Zd„ Zd„ Zi Zd„ Zd„ Zd$d„Zd%d„Z G d„ d¦  «        Z d„ Z!d„ Z"d„ Z# G d „ d!e¦  «        Z$dS )&z´
    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)ÚTextIOWrapperz[/\\ ]z”
    <!DOCTYPE\s+(
     [a-zA-Z_][a-zA-Z0-9]*
     (?: \s+      # optional in HTML5
     [a-zA-Z_][a-zA-Z0-9]*\s+
     "[^"]*")?
     )
     [^>]*>
z<(.+?)(\s.*?)?>.*?</.+?>z\s*<\?xml[^>]*\?>c                   ó   — e Zd ZdZdS )ÚClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úK/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/pygments/util.pyr   r      s   € € € € € ØMÐMÐMÐMr   r   c                   ó   — e Zd ZdZdS )ÚOptionErrorzƒ
    This exception will be raised by all option processing functions if
    the type or value of the argument is not correct.
    Nr   r   r   r   r   r   "   s   € € € € € ðð ð ð r   r   Fc                 óø   — |                       ||¦  «        }|r|                     ¦   «         }||vrIt          d                     |d                     t          t          |¦  «        ¦  «        ¦  «        ¦  «        ‚|S )z}
    If the key `optname` from the dictionary is not in the sequence
    `allowed`, raise an error, otherwise return it.
    z%Value for option {} must be one of {}z, )ÚgetÚlowerr   ÚformatÚjoinÚmapÚstr)ÚoptionsÚoptnameÚallowedÚdefaultÚnormcaseÚstrings         r   Úget_choice_optr   (   sw   € ð
 �[Š[˜ 'Ñ*Ô*€FØð  Ø—’‘”ˆØ�WÐÐÝÐA×HÒHÈÐRV×R[ÒR[Õ\_Õ`cÐelÑ\mÔ\mÑRnÔRnÑoÔoÑpÔpÐpØ€Mr   c                 ó†  — |                       ||¦  «        }t          |t          ¦  «        r|S t          |t          ¦  «        rt          |¦  «        S t          |t          ¦  «        st          d|›d|› d�¦  «        ‚|                     ¦   «         dv rdS |                     ¦   «         dv rdS t          d|›d|› d�¦  «        ‚)	a@  
    Intuitively, this is `options.get(optname, default)`, but restricted to
    Boolean value. The Booleans can be represented as string, in order to accept
    Boolean value from the command line arguments. If the key `optname` is
    present in the dictionary `options` and is not associated with a Boolean,
    raise an `OptionError`. If it is absent, `default` is returned instead.

    The valid string values for ``True`` are ``1``, ``yes``, ``true`` and
    ``on``, the ones for ``False`` are ``0``, ``no``, ``false`` and ``off``
    (matched case-insensitively).
    úInvalid type ú for option z%; use 1/0, yes/no, true/false, on/off)Ú1ÚyesÚtrueÚonT)Ú0ÚnoÚfalseÚoffFúInvalid value )r   Ú
isinstanceÚboolÚintr   r   r   ©r   r   r   r   s       r   Úget_bool_optr.   5   sø   € ð �[Š[˜ 'Ñ*Ô*€FÝ�&�$ÑÔð =ØˆÝ	�F�CÑ	 Ô	 ð =Ý�F‰|Œ|ÐÝ˜¥Ñ$Ô$ð 	=Ýð <¨&ð <ð <Àð <ð <ð <ñ =ô =ð 	=à	�Š‰ŒÐ5Ð	5Ð	5ØˆtØ	�Š‰ŒÐ6Ð	6Ð	6Øˆuåð <¨6ð <ð <Àð <ð <ð <ñ =ô =ð 	=r   c                 óÔ   — |                       ||¦  «        }	 t          |¦  «        S # t          $ r t          d|›d|› d�¦  «        ‚t          $ r t          d|›d|› d�¦  «        ‚w xY w)z?As :func:`get_bool_opt`, but interpret the value as an integer.r   r    z ; you must give an integer valuer)   )r   r,   Ú	TypeErrorr   Ú
ValueErrorr-   s       r   Úget_int_optr2   R   s»   € à�[Š[˜ 'Ñ*Ô*€Fð8Ý�6‰{Œ{ÐøÝð 8ð 8ð 8Ýð 7¨&ð 7ð 7Àð 7ð 7ð 7ñ 8ô 8ð 	8åð 8ð 8ð 8Ýð 7¨6ð 7ð 7Àð 7ð 7ð 7ñ 8ô 8ð 	8ð8øøøs
   ˜' §A A'c                 ó  — |                       ||¦  «        }t          |t          ¦  «        r|                     ¦   «         S t          |t          t
          f¦  «        rt	          |¦  «        S t          d|›d|› d�¦  «        ‚)zµ
    If the key `optname` from the dictionary `options` is a string,
    split it at whitespace and return it. If it is already a list
    or a tuple, it is returned as a list.
    r   r    z; you must give a list value)r   r*   r   ÚsplitÚlistÚtupler   )r   r   r   Úvals       r   Úget_list_optr8   ^   s�   € ð �+Š+�g˜wÑ
'Ô
'€CÝ�#•sÑÔð 4Ø�yŠy‰{Œ{ÐÝ	�C�$¥˜Ñ	'Ô	'ð 4Ý�C‰yŒyÐåð 3¨#ð 3ð 3¸Wð 3ð 3ð 3ñ 4ô 4ð 	4r   c                 ó@  — | j         sdS g }| j                              ¦   «                              ¦   «         D ]A}|                     ¦   «         r+|                     d|                     ¦   «         z   ¦  «         ŒA d                     |¦  «                             ¦   «         S )NÚ ú )r
   ÚstripÚ
splitlinesÚappendr   Úlstrip)ÚobjÚresÚlines      r   Údocstring_headlinerC   n   s�   € ØŒ;ð ØˆrØ
€CØ”×!Ò!Ñ#Ô#×.Ò.Ñ0Ô0ð ð ˆØ�:Š:‰<Œ<ð 	Ø�JŠJ�s˜TŸZšZ™\œ\Ñ)Ñ*Ô*Ð*Ð*àØ�7Š7�3‰<Œ<×ÒÑ Ô Ð r   c                 óD   ‡ — ˆ fd„}‰ j         |_         t          |¦  «        S )zAReturn a static text analyser function that returns float values.c           	      óÐ   •— 	  ‰| ¦  «        }n# t           $ r Y dS w xY w|sdS 	 t          dt          dt          |¦  «        ¦  «        ¦  «        S # t          t
          f$ r Y dS w xY w)Ng        g      ð?)Ú	ExceptionÚminÚmaxÚfloatr1   r0   )ÚtextÚrvÚfs     €r   Útext_analysez%make_analysator.<locals>.text_analyse|   s’   ø€ ð	Ø��4‘”ˆBˆBøÝð 	ð 	ð 	Ø�3�3ð	øøøàð 	Ø�3ð	Ý�s�C ¥U¨2¡Y¤YÑ/Ô/Ñ0Ô0Ð0øÝ�IÐ&ð 	ð 	ð 	Ø�3�3ð	øøøs   ƒ �
œ¥*A ÁA%Á$A%)r
   Ústaticmethod)rL   rM   s   ` r   Úmake_analysatorrO   z   s6   ø€ ð
ð 
ð 
ð 
ð 
ð œ9€LÔÝ˜Ñ%Ô%Ð%r   c                 óê  — |                       d¦  «        }|dk    r| d|…                              ¦   «         }n|                      ¦   «         }|                     d¦  «        r‘	 d„ t                               |dd…                              ¦   «         ¦  «        D ¦   «         d         }n# t          $ r Y dS w xY wt          j        d	|› d
�t          j	        ¦  «        }| 
                    |¦  «        �dS dS )aò  Check if the given regular expression matches the last part of the
    shebang if one exists.

        >>> from pygments.util import shebang_matches
        >>> shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?')
        True
        >>> shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?')
        True
        >>> shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?')
        False
        >>> shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?')
        False
        >>> shebang_matches('#!/usr/bin/startsomethingwith python',
        ...                 r'python(2\.\d)?')
        True

    It also checks for common windows executable file extensions::

        >>> shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?')
        True

    Parameters (``'-f'`` or ``'--foo'`` are ignored so ``'perl'`` does
    the same as ``'perl -e'``)

    Note that this method automatically searches the whole string (eg:
    the regular expression is wrapped in ``'^$'``)
    ú
r   Nz#!c                 ó@   — g | ]}|¯|                      d ¦  «        °|‘ŒS )ú-)Ú
startswith)Ú.0Úxs     r   ú
<listcomp>z#shebang_matches.<locals>.<listcomp>®   s@   € ð 5ð 5ð 5˜1Øð5Ø"#§,¢,¨sÑ"3Ô"3ð5�Qð 5ð 5ð 5r   é   éÿÿÿÿFú^z(\.(exe|cmd|bat|bin))?$T)Úfindr   rT   Úsplit_path_rer4   r<   Ú
IndexErrorÚreÚcompileÚ
IGNORECASEÚsearch)rJ   ÚregexÚindexÚ
first_lineÚfounds        r   Úshebang_matchesrf   ‹   s  € ð8 �IŠI�d‰OŒO€EØ�‚z€zØ˜&˜5˜&”\×'Ò'Ñ)Ô)ˆ
ˆ
à—Z’Z‘\”\ˆ
Ø×Ò˜TÑ"Ô"ð ð	ð5ð 5¥× 3Ò 3°J¸q¸r¸r´N×4HÒ4HÑ4JÔ4JÑ KÔ Kð 5ñ 5ô 5Ø57ô9ˆEˆEøåð 	ð 	ð 	Ø�5�5ð	øøøå”
Ð> Ð>Ð>Ð>ÅÄÑNÔNˆØ�<Š<˜ÑÔÐ*Ø�4Øˆ5s   Á#AB( Â(
B6Â5B6c                 óô   — t                                | ¦  «        }|€dS |                     d¦  «        }t          j        |t          j        ¦  «                             |                     ¦   «         ¦  «        duS )zÁCheck if the doctype matches a regular expression (if present).

    Note that this method only checks the first part of a DOCTYPE.
    eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
    NFé   )Údoctype_lookup_rera   Úgroupr^   r_   ÚIÚmatchr<   )rJ   rb   ÚmÚdoctypes       r   Údoctype_matchesro   ¸   s_   € õ 	× Ò  Ñ&Ô&€AØ€yØˆuØ�gŠg�a‰jŒj€GÝŒ:�e�RœTÑ"Ô"×(Ò(¨¯ª©¬Ñ9Ô9ÀÐEÐEr   c                 ó"   — t          | d¦  «        S )z3Check if the file looks like it has a html doctype.Úhtml)ro   )rJ   s    r   Úhtml_doctype_matchesrr   Å   s   € å˜4 Ñ)Ô)Ð)r   c                 ó2  — t                                | ¦  «        rdS t          | ¦  «        }	 t          |         S # t          $ rR t
                               | ¦  «        }|�Y dS t                               | dd…         ¦  «        du}|t          |<   |cY S w xY w)z2Check if a doctype exists or if we have some tags.TNiè  )Úxml_decl_rerl   ÚhashÚ_looks_like_xml_cacheÚKeyErrorri   ra   Útag_re)rJ   Úkeyrm   rK   s       r   Úlooks_like_xmlrz   Í   s¤   € å×Ò˜ÑÔð ØˆtÝ
ˆt‰*Œ*€CðÝ$ SÔ)Ð)øÝð ð ð Ý×$Ò$ TÑ*Ô*ˆØˆ=Ø�4�4Ý�]Š]˜4   œ;Ñ'Ô'¨tÐ3ˆØ%'Õ˜cÑ"Øˆ	ˆ	ˆ	ðøøøs   ­: º&BÁ#0BÂBc                 ó"   — d| dz	  z   d| dz  z   fS )zoGiven a unicode character code with length greater than 16 bits,
    return the two 16 bit surrogate pair.
    iÀ×  é
   i Ü  iÿ  r   )Úcs    r   Úsurrogatepairr~   Ý   s!   € ð �a˜2‘gÑ ¨1¨u©9Ñ!5Ð7Ð7r   c                 óˆ  — g }d|z  dz  }d|dz   z  dz  }|                      || z   dz   ¦  «         |r!|D ]}|                      ||z   dz   ¦  «         ŒnC|D ]@}t          |dz   ¦  «        }|                      ||dd…         z   |d	         z   dz   ¦  «         ŒA|                      |d
z   ¦  «         d                     |¦  «        S )z)Formats a sequence of strings for output.r;   é   rh   z = (ú,ú"NéþÿÿÿrY   ú)rQ   )r>   Úreprr   )	Úvar_nameÚseqÚrawÚindent_levelÚlinesÚbase_indentÚinner_indentÚiÚrs	            r   Úformat_linesr�   æ   sú   € à€EØ˜Ñ$ qÑ(€KØ˜,¨Ñ*Ñ+¨aÑ/€LØ	‡L‚L�˜xÑ'¨&Ñ0Ñ1Ô1Ð1Ø
ð >àð 	1ð 	1ˆAØ�LŠL˜¨Ñ)¨CÑ/Ñ0Ô0Ð0Ð0ð	1ð ð 	>ð 	>ˆAå�Q˜‘W‘”ˆAØ�LŠL˜¨¨#¨2¨#¬Ñ.°°2´Ñ6¸Ñ<Ñ=Ô=Ð=Ð=Ø	‡L‚L�˜sÑ"Ñ#Ô#Ð#Ø�9Š9�UÑÔÐr   r   c                 ó–   — g }t          ¦   «         }| D ]5}||v s||v rŒ|                     |¦  «         |                     |¦  «         Œ6|S )za
    Returns a list with duplicates removed from the iterable `it`.

    Order is preserved.
    )Úsetr>   Úadd)ÚitÚalready_seenÚlstÚseenr�   s        r   Úduplicates_removedr—   ù   s\   € ð €CÝ‰5Œ5€DØð ð ˆØ�ˆ9ˆ9˜˜\Ð)Ð)ØØ�
Š
�1‰ŒˆØ�Š�‰ŒˆˆØ€Jr   c                   ó   — e Zd ZdZd„ ZdS )ÚFuturez‡Generic class to defer some work.

    Handled specially in RegexLexerMeta, to support regex string construction at
    first use.
    c                 ó   — t           ‚©N)ÚNotImplementedError©Úselfs    r   r   z
Future.get  s   € Ý!Ð!r   N)r   r   r	   r
   r   r   r   r   r™   r™   	  s-   € € € € € ðð ð
"ð "ð "ð "ð "r   r™   c                 ó  — 	 |                       d¦  «        } | dfS # t          $ rg 	 ddl}|                     ¦   «         }|                       |¦  «        } | |fcY S # t          t          f$ r |                       d¦  «        } | dfcY cY S w xY ww xY w)zÃDecode *text* with guessed encoding.

    First try UTF-8; this should fail for non-UTF-8 encodings.
    Then try the preferred locale encoding.
    Fall back to latin-1, which always works.
    zutf-8r   NÚlatin1)ÚdecodeÚUnicodeDecodeErrorÚlocaleÚgetpreferredencodingÚLookupError)rJ   r£   Úprefencodings      r   Úguess_decoder§     sÅ   € ð"Ø�{Š{˜7Ñ#Ô#ˆØ�Wˆ}ÐøÝð "ð "ð "ð	"ØˆMˆMˆMØ!×6Ò6Ñ8Ô8ˆLØ—;’;˜|Ñ,Ô,ˆDØ˜Ð%Ð%Ð%Ð%øÝ"¥KÐ0ð 	"ð 	"ð 	"Ø—;’;˜xÑ(Ô(ˆDØ˜�>Ð!Ð!Ð!Ð!Ð!ð	"øøøð"øøøs,   ‚ ›
B¦0AÁBÁ*BÂBÂBÂBc                 óª   — t          |dd¦  «        r4	 |                      |j        ¦  «        } | |j        fS # t          $ r Y nw xY wt	          | ¦  «        S )zÊDecode *text* coming from terminal *term*.

    First try the terminal encoding, if given.
    Then try UTF-8.  Then try the preferred locale encoding.
    Fall back to latin-1, which always works.
    ÚencodingN)Úgetattrr¡   r©   r¢   r§   )rJ   Úterms     r   Úguess_decode_from_terminalr¬   (  sq   € õ ˆt�Z Ñ&Ô&ð 'ð	'Ø—;’;˜tœ}Ñ-Ô-ˆDð ˜œÐ&Ð&øõ "ð 	ð 	ð 	ØˆDð	øøøõ ˜ÑÔÐs   “6 ¶
AÁAc                 ób   — t          | dd¦  «        r| j        S ddl}|                     ¦   «         S )z7Return our best guess of encoding for the given *term*.r©   Nr   )rª   r©   r£   r¤   )r«   r£   s     r   Úterminal_encodingr®   9  s9   € åˆt�Z Ñ&Ô&ð ØŒ}ÐØ€M€M€MØ×&Ò&Ñ(Ô(Ð(r   c                   ó   — e Zd Zd„ ZdS )ÚUnclosingTextIOWrapperc                 ó.   — |                       ¦   «          d S r›   )Úflushr�   s    r   ÚclosezUnclosingTextIOWrapper.closeC  s   € Ø�
Š
‰Œˆˆˆr   N)r   r   r	   r³   r   r   r   r°   r°   A  s#   € € € € € ðð ð ð ð r   r°   )NFr›   )Fr   )r   )%r
   r^   Úior   r_   r\   ÚDOTALLÚ	MULTILINEÚVERBOSEri   r`   rx   rk   rt   r1   r   rF   r   r   r.   r2   r8   rC   rO   rf   ro   rr   rv   rz   r~   r�   r—   r™   r§   r¬   r®   r°   r   r   r   ú<module>r¸      s€  ððð ð 
€	€	€	Ø Ð Ð Ð Ð Ð ð �”
˜9Ñ%Ô%€Ø�B”Jð  ð „Y�”Ñ ¤
Ñ*ñ,ô ,Ð ð 
ˆŒÐ/Ø”M B¤IÑ-°´Ñ<ñ
>ô 
>€àˆbŒjÐ-¨r¬tÑ4Ô4€ðNð Nð Nð Nð N�Jñ Nô Nð Nðð ð ð ð �)ñ ô ð ð
ð 
ð 
ð 
ð=ð =ð =ð =ð:
8ð 
8ð 
8ð 
8ð4ð 4ð 4ð 4ð 	!ð 	!ð 	!ð&ð &ð &ð"*ð *ð *ðZ
Fð 
Fð 
Fð*ð *ð *ð
 Ð ðð ð ð 8ð 8ð 8ðð ð ð ð&ð ð ð ð "ð "ð "ð "ð "ñ "ô "ð "ð"ð "ð "ð*ð ð ð")ð )ð )ðð ð ð ð ˜]ñ ô ð ð ð r   