
    ,h
                        d dl mZ d dlmZ d dlmZ d dlZd dlmZm	Z	m
Z
mZ d dlZddlmZ dZdd	Zdd
Z ej$                  d      Z ej$                  d      ZdddZy)    )annotations)Callable)suppressN)quoteunquoteurlparse
urlunparse   )	_punycode)zhttp:zhttps:zmailto:c                z   t        j                  | d      }|j                  re|j                  r|j                  t        v rGt        t              5  |j                  t        j                  |j                              }ddd       t        j                  t        j                  |            S # 1 sw Y   1xY w)zvNormalize destination URLs in links

    ::

        [label]:   destination   'title'
                ^^^^^^^^^^^
    Tslashes_denote_hosthostnameN)mdurlparser   protocolRECODE_HOSTNAME_FORr   	Exception_replacer   to_asciiencodeformaturlparseds     b/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/markdown_it/common/normalize_url.pynormalizeLinkr      s     [[$7F OOv2EEi  	S__i.@.@.Q_RF	S <<V,--	S 	Ss   0B11B:c                   t        j                  | d      }|j                  re|j                  r|j                  t        v rGt        t              5  |j                  t        j                  |j                              }ddd       t        j                  t        j                  |      t         j                  dz         S # 1 sw Y   CxY w)zSNormalize autolink content

    ::

        <destination>
         ~~~~~~~~~~~
    Tr   r   N%)r   r   r   r   r   r   r   r   r   
to_unicodedecoder   DECODE_DEFAULT_CHARSr   s     r   normalizeLinkTextr$   (   s     [[$7F OOv2EEi  	U__i.B.B6??.S_TF	U <<V,e.H.H3.NOO		U 	Us   0CCz!^(vbscript|javascript|file|data):z!^data:image\/(gif|png|jpeg|webp);c                    | ||       S | j                         j                         } t        j                  |       rt	        t
        j                  |             S dS )a  Validate URL link is allowed in output.

    This validator can prohibit more than really needed to prevent XSS.
    It's a tradeoff to keep code simple and to be secure by default.

    Note: url should be normalized at this point, and existing entities decoded.
    T)striplowerBAD_PROTO_REsearchboolGOOD_DATA_RE)r   	validators     r   validateLinkr-   F   sP     ~
))+


C-9-@-@-E4##C()O4O    )r   strreturnr/   )N)r   r/   r,   zCallable[[str], bool] | Noner0   r*   )
__future__r   collections.abcr   
contextlibr   reurllib.parser   r   r   r	   r    r   r   r   r$   compiler(   r+   r-    r.   r   <module>r9      sX    " $  	 = =  4 .2P4 rzz>?rzz>?Pr.   