o
    “^©iŠ  ã                   @   sÆ   d dl Z d dlZd dlmZmZ er,ddlmZ ddlmZm	Z	 ddl
mZ ddlmZ e  d¡Zd	e  ej¡ d
 ZdgZdddee dddefdd„Zdddee dddefdd„Zddd„ZdS )é    N)ÚTYPE_CHECKINGÚMatché   )ÚBlockParser)Ú
BlockStateÚInlineState)ÚInlineParser)ÚMarkdownz *\n\s*z
(?:^[^\s\dz][^\n]*\n)+ÚspeedupÚinliner   ÚmÚstater   Úreturnc                 C   s*   |  d¡}t d|¡}|  ||¡ | ¡ S )Nr   Ú
)ÚgroupÚHARD_LINEBREAK_REÚsubÚprocess_textÚend)r   r   r   Útext© r   úR/home/ubuntu/hpml_nyu/venv/lib/python3.10/site-packages/mistune/plugins/speedup.pyÚ
parse_text   s   
r   Úblockr   r   c                 C   s   |  d¡}| |¡ | ¡ S )Nr   )r   Úadd_paragraphr   )r   r   r   r   r   r   r   Úparse_paragraph   s   

r   Úmdr	   c                 C   sj   | j  dtt¡ d}d| d }d| jjv r|d7 }| jjr#|d7 }n|d7 }|d	7 }| j d
|t¡ dS )z8Increase the speed of parsing paragraph and inline text.Ú	paragraphz\\><!\[_*`~\^\$=z[\s\S]+?(?=[z]|Úurl_linkzhttps?:|z *\n|z {2,}\n|z$)r   N)r   ÚregisterÚ	PARAGRAPHr   r   ÚrulesÚ	hard_wrapr   )r   ÚpuncÚtext_patternr   r   r   r
   #   s   
)r   r	   r   N)ÚreÚstringÚtypingr   r   Úblock_parserr   Úcorer   r   Úinline_parserr   Úmarkdownr	   Úcompiler   ÚescapeÚpunctuationr    Ú__all__ÚstrÚintr   r   r
   r   r   r   r   Ú<module>   s    
þ