
    Mh                     b   d dl Z d dlmZ d dlmZ d dlmZ  e j        de j                  Z	dde
d	ed
e
fdZdde
de
d
e
fdZd de
ded
e
fdZde
d
e
fdZde
d
e
fdZde
d
e
fdZ e j        d          Zde
d
e
fdZ e j        d          Zde
d
e
fdZ e j        d          Zde
d
e
fdZdS )!    N)_replace_charref)Match)quotez^( {0,3})\t)flags   textwidthreturnc                 x    dt           t                   dt          ffd}t                              ||           S )Nmr
   c                 ^    |                      d          }|dt          |          z
  z  z   S )N    )grouplen)r   sr	   s     L/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mistune/util.pyreplz expand_leading_tab.<locals>.repl
   s,    GGAJJ3%#a&&.)))    )r   str_expand_tab_resub)r   r	   r   s    ` r   expand_leading_tabr   	   sK    *c
 *s * * * * * * dD)))r       spacec                 B    d|z   }t                               ||           S )Nz\1)r   r   )r   r   r   s      r   
expand_tabr      s!    5=DdD)))r   Tr   r   c                     |                      dd          } |                      dd          } |                      dd          } |r|                      dd          } | S )	zXEscape characters of ``&<>``. If quote=True, ``"`` will be
    converted to ``&quote;``.&z&amp;<z&lt;>z&gt;"z&quot;)replace)r   r   s     r   escaper$      s]     	
		#wA			#vA			#vA %IIc8$$Hr   linkc                 B    d}t          t          |           |          S )zEscape URL for safety.z:/?#@!$&()*+,;=%)safe)r   unescape)r%   r'   s     r   
escape_urlr)   !   s'    	 	
 $d++++r   c                 :    t          t          |                     S )zEscape characters for safety.)r$   r(   r   s    r   safe_entityr,   +   s    (1++r   c                     d                     |                                                                           }|                                                                S )z.Generate a unique key for links and footnotes.r   )joinsplitstriplowerupper)r   keys     r   unikeyr4   0   sA    
((17799


#
#
%
%C99;;r   z8&(#[0-9]{1,7};|#[xX][0-9a-fA-F]+;|[^\t\n\f <&#;]{1,32};)c                 N    d| vr| S t                               t          |           S )z
    Copy from `html.unescape`, but `_charref` is different. CommonMark
    does not accept entity references without a trailing semicolon
    r   )_charref_rer   r   r+   s    r   r(   r(   =   s'    
 !||??+Q///r   z(<!--.*?-->|<[^>]*>)c                 8    t                               d|           S )N )_striptags_rer   r+   s    r   	striptagsr:   J   s    R###r   z\n\s+$srcc                 8    t                               d|           S )N
)_strip_end_rer   )r;   s    r   	strip_endr?   Q   s    T3'''r   )r   )r   )T)rehtmlr   typingr   urllib.parser   compileMr   r   intr   r   boolr$   r)   r,   r4   r6   r(   r9   r:   r>   r?    r   r   <module>rI      s   				 ! ! ! ! ! !            N"$777* *S * *S * * * ** *S * *# * * * *
 c $ #    ,S ,S , , , ,3 3    
c c     bj 0 0 0 0 0 0 
233$ $ $ $ $ $ 
9%%(3 (3 ( ( ( ( ( (r   