Ë
    o]jÎF  ã                   ó8  — d Z ddlZddlZddlZddlZddlZddlZddlZddl	m
Z
 ddlmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZmZmZ d	d
lmZ d	dlmZ  ej:                  d«      Z ej:                  d«      Z ej@                  «       Z!de› �dddœZ" G d„ de«      Z#d„ Z$d„ Z%d„ Z&d'd„Z'd„ Z(d„ Z)d„ Z*d„ Z+	 	 d(d„Z,ejZ                  	 	 d)d„«       Z. G d„ de/«      Z0 G d „ d!e1«      Z2 G d"„ d#ejf                  «      Z4 G d$„ d%«      Z5ejZ                  d&„ «       Z6y)*z9Various utility functions and classes for URL management.é    N)ÚEmailMessage)ÚGzipFile)ÚBytesIOÚStringIO)ÚPath)Úrequest)ÚquoteÚunquoteÚurljoinÚurlsplité   )Ú__version__)ÚLOGGERz^([a-zA-Z][a-zA-Z0-9.+-]+):s   ^([a-zA-Z][a-zA-Z0-9.+-]+):zWeasyPrint z*/*zgzip, deflate)z
User-AgentÚAcceptzAccept-Encodingc                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ÚStreamingGzipFilec                 ó@   — t        j                  | |¬«       || _        y )N©Úfileobj)r   Ú__init__Úfileobj_to_close)Úselfr   s     úF/var/www/zogu/zoguvenv/lib/python3.12/site-packages/weasyprint/urls.pyr   zStreamingGzipFile.__init__$   s   € Ü×Ñ˜$¨Õ0Ø 'ˆÕó    c                 ób   — t        j                  | «       | j                  j                  «        y ©N)r   Úcloser   ©r   s    r   r   zStreamingGzipFile.close(   s    € Ü�‰�tÔØ×Ñ×#Ñ#Õ%r   c                  ó   — y)NF© r   s    r   ÚseekablezStreamingGzipFile.seekable,   s   € Ør   N)Ú__name__Ú
__module__Ú__qualname__r   r   r!   r    r   r   r   r   #   s   „ ò(ò&ór   r   c                 ó’   — | j                  d«      r| S | j                  | j                  d«      rt        nd«      } t        | d¬«      S )zDTurn a Unicode IRI into an ASCII-only URI that conforms to RFC 3986.zdata:úfile:úutf-8s   /:?#[]@!$&'()*+,;=~%)Úsafe)Ú
startswithÚencodeÚFILESYSTEM_ENCODINGr	   ©Úurls    r   Ú
iri_to_urir.   0   s?   € à
‡~�~�gÔàˆ
à
�*‰*¨C¯N©N¸7Ô,CÕ(ÈÓ
Q€Cô �Ð2Ô3Ð3r   c                 ó(  — t        | t        «      rt        | «      } n%t        | t        «      r| j	                  t
        «      } | j                  t        j                  j                  df«      }t        j                  j                  | «      } |st        j                  j                  | «      r| t        j                  j                  z  } d}t        j                  | «      } |r| j                  d«      s| dz  } | j                  d«      rd| › �S d| › �S )zVReturn file URL of `path`.

    Accepts 'str', 'bytes' or 'Path', returns 'str'.

    ú/Tz///r&   zfile://)Ú
isinstancer   ÚstrÚbytesÚdecoder+   ÚendswithÚosÚpathÚsepÚabspathÚisdirr   Úpathname2urlr)   )r7   Úwants_trailing_slashs     r   Úpath2urlr=   @   sØ   € ô �$œÔÜ�4‹y‰Ü	�Dœ%Ô	 Ø�{‰{Ô.Ó/ˆàŸ=™=¬"¯'©'¯+©+°sÐ);Ó<ÐÜ�7‰7�?‰?˜4Ó €DÙœrŸw™wŸ}™}¨TÔ2ð 	”—‘—‘ÑˆØ#ÐÜ×Ñ Ó%€Dá D§M¡M°#Ô$6Ø�‰ˆØ‡��uÔð �t�fˆ~Ðà˜˜ÐÐr   c                 ón   — t        | t        «      rt        nt        }t	        |j                  | «      «      S )z4Return whether an URL (bytes or string) is absolute.)r1   r2   ÚUNICODE_SCHEME_REÚBYTES_SCHEME_REÚboolÚmatch)r-   Úschemes     r   Úurl_is_absoluterD   _   s'   € ä",¨S´#Ô"6Õ¼O€FÜ�—‘˜SÓ!Ó"Ð"r   c           	      óˆ   — | j                  |d«      j                  «       }|r t        |xs d||d| j                  ||f«      S y)a'  Get the URI corresponding to the ``attr_name`` attribute.

    Return ``None`` if:

    * the attribute is empty or missing or,
    * the value is a relative URI but the document has no base URI and
      ``allow_relative`` is ``False``.

    Otherwise return an URI, absolute if possible.

    Ú z<%s %s="%s">N)ÚgetÚstripÚurl_joinÚtag)ÚelementÚ	attr_nameÚbase_urlÚallow_relativeÚvalues        r   Úget_url_attributerP   e   sM   € ð �K‰K˜	 2Ó&×,Ñ,Ó.€EÙÜØŠN˜˜E >°>Ø�[‰[˜) UÐ+ó-ð 	-ð r   c                 ó¨   — | j                  d«      rdt        | dd «      fS t        | «      rdt        | «      fS |rdt        t	        || «      «      fS y)z.Get tuple describing internal or external URI.ú#Úinternalr   NÚexternal)r)   r
   rD   r.   r   )r-   rM   s     r   Úget_url_tuplerU   x   sZ   € à
‡~�~�cÔØœG C¨¨ GÓ,Ð-Ð-Ü	˜Ô	ØœJ s›OÐ,Ð,Ù	ØœJ¤w¨x¸Ó'=Ó>Ð?Ð?ð 
r   c                 óª   — t        |«      rt        |«      S | rt        t        | |«      «      S |rt        |«      S t        j                  d|› �g|¢­Ž  y)zBLike urllib.urljoin, but warn if base_url is required but missing.z+Relative URI reference without a base URI: N)rD   r.   r   r   Úerror)rM   r-   rN   ÚcontextÚcontext_argss        r   rI   rI   ‚   sY   € ä�sÔÜ˜#‹ÐÙ	Üœ' (¨CÓ0Ó1Ð1Ù	Ü˜#‹Ðä�‰Ø9¸'¸ÐCð	àó	ð r   c                 óü  — | j                  |d«      j                  «       }|j                  d«      r t        |«      dkD  rddt	        |dd «      ffS t        | ||d¬«      }|rP|rH	 t        |«      }	 t        |«      }|j                  r$|dd	 |dd	 k(  rddt	        |j                  «      ffS dd|ffS y# t        $ r t        j                  d
|«       Y Œ(w xY w# t        $ r t        j                  d|«       Y ŒMw xY w)z˜Get the URL value of an element attribute.

    Return ``('external', absolute_uri)``, or ``('internal',
    unquoted_fragment_id)``, or ``None``.

    rF   rR   r   r-   rS   NT)rN   éÿÿÿÿzMalformed base URL: %szMalformed URL: %srT   )rG   rH   r)   Úlenr
   rP   r   ÚfragmentÚ
ValueErrorr   Úwarning)rK   rL   rM   Ú
attr_valueÚuriÚparsedÚparsed_bases          r   Úget_link_attributerd   ‘   s  € ð —‘˜Y¨Ó+×1Ñ1Ó3€JØ×Ñ˜SÔ!¤c¨*£o¸Ò&9à˜
¤G¨J°q°r¨NÓ$;Ð<Ð=Ð=Ü
˜G Y°ÈÔ
N€CÙ
ÙðOÜ! #›�ðOÜ"*¨8Ó"4�Kð
 —’¨6°#°2¨;¸+ÀcÀrÐ:JÒ+JØ %¨
´G¸F¿O¹OÓ4LÐ'MÐNÐNØ˜
 CÐ(Ð)Ð)ð øô "ò GÜ—N‘NÐ#;¸XÖFðGûô ò 9Ü—‘Ð2°CÖ8ð9ús$   Á&C Á2B4 Â4CÃCÃC;Ã:C;c                 ó2   — t        | «      r| S t        | «      S )z²Get a ``scheme://path`` URL from ``string``.

    If ``string`` looks like an URL, return it unchanged. Otherwise assume a
    filename and convert it to a ``file://`` URL.

    )rD   r=   )Ústrings    r   Ú
ensure_urlrg   ¯   s   € ô % VÔ,ˆ6ÐB´(¸6Ó2BÐBr   c                 óz   — t        j                  dt        ¬«       t        ||||d¬«      }|j	                  | «      S )z~Fetch an external resource such as an image or stylesheet.

    This function is deprecated, use ``URLFetcher`` instead.

    a-  default_url_fetcher is deprecated and will be removed in WeasyPrint 69.0, please use URLFetcher instead. For security reasons, HTTP redirects are not supported anymore with default_url_fetcher, but are with URLFetcher.

See https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#url-fetchers©ÚcategoryF)Úallow_redirects)ÚwarningsÚwarnÚDeprecationWarningÚ
URLFetcherÚfetch)r-   ÚtimeoutÚssl_contextÚhttp_headersÚallowed_protocolsÚfetchers         r   Údefault_url_fetcherrv   ¹   sC   € ô ‡M�Mð	Xô $õ%ô Ø�˜lÐ,=ÈuôV€Gà�=‰=˜ÓÐr   c              #   ó8  K  — |�t        |«      }|€
t        «       }| ||||fD �cg c]  }|�|‘Œ }	}t        |	«      dk7  r#dj                  |	«      xs d}
t	        d|
› �«      ‚| �_|||dœ}t        | d«      r| |d<   n,t        | t        «      r| |d	<   nt        | «      r| |d
<   n| |d	<   t        di |¤Ž}|5 }|–— ddd«       y|�+|€t        |«      }t        |d«      5 }||ddf–— ddd«       y|�’t        ||«      5 }|rP|j                  dk7  rAt        j                  d|j                  › d|j                   › �«       t#        d«      |ddf–— n*|€|j                   }|||j$                  |j                  f–— ddd«       y|�6|€+t'        |dd«      }|r|j)                  d«      st        |«      }||ddf–— yt        |t*        «      rt#        |«      |ddf–— yt-        |«      |ddf–— yc c}w # 1 sw Y   yxY w# 1 sw Y   yxY w# 1 sw Y   yxY w­w)z†If only one input is given, return it.

    Yield a file object, the base url, the protocol encoding and the protocol mime-type.

    Nr   z, Únothingz!Expected exactly one source, got )rM   Úurl_fetcherÚcheck_css_mime_typeÚreadÚfile_objÚfilenamer-   Úrbztext/csszUnsupported stylesheet type z for rF   Únameú<r    )rg   ro   r\   ÚjoinÚ	TypeErrorÚhasattrr1   r   rD   Úselect_sourcer=   Úopenrp   Úcontent_typer   rW   r-   r   ÚcharsetÚgetattrr)   r2   r   )Úguessr}   r-   r|   rf   rM   ry   rz   ÚparamÚselected_paramsÚsourceÚkwargsÚresultÚresponser   s                  r   r„   r„   Ë   s‡  è ø€ ð ÐÜ˜hÓ'ˆØÐÜ “lˆð " 8¨S°(¸FÐCöØØÐò 	ð€Oð ô ˆ?Ó˜qÒ Ø—‘˜?Ó+Ò8¨yˆÜÐ;¸F¸8ÐDÓEÐEØ	Ð	à Ø&Ø#6ñ
ˆô
 �5˜&Ô!Ø!&ˆF�:ÒÜ˜œtÔ$Ø!&ˆF�:ÒÜ˜UÔ#Ø!ˆF�5ŠMà!&ˆF�:ÑÜÑ( Ñ(ˆØð 	�vØŠL÷	ð 	à	Ð	ØÐÜ Ó)ˆHÜ�(˜DÓ!ð 	1 XØ˜H d¨DÐ0Ò0÷	1ð 	1à	ˆÜ�; Ó$ð 		R¨Ù" x×'<Ñ'<À
Ò'JÜ—‘Ø2°8×3HÑ3HÐ2Ið JØ#Ÿ<™<˜.ð*ô+ô ˜r“l H¨d°DÐ8Ó8àÐ#Ø'Ÿ|™|�HØ ¨(×*:Ñ*:¸H×<QÑ<QÐQÒQ÷		Rð 		Rð 
Ð	ØÐä˜8 V¨TÓ2ˆDá˜DŸO™O¨CÔ0Ü% dÓ+�Ø˜ $¨Ð,Ó,ä�fœcÔ"Ü˜6Ó" H¨d°DÐ8Ó8ä˜&“/ 8¨T°4Ð7Ó7ùòg÷*	ð 	ú÷
	1ð 	1ú÷		Rð 		RüsZ   ‚#H¥G1°BHÂ6G6Â;$HÃ	HÃ(HÃ?A=HÅ<A:HÇ6G?Ç;HÈHÈHÈHÈHc                   ó   — e Zd ZdZy)ÚURLFetchingErrorz)Some error happened when fetching an URL.N©r"   r#   r$   Ú__doc__r    r   r   r‘   r‘     s   „ Ú3r   r‘   c                   ó   — e Zd ZdZy)ÚFatalURLFetchingErrorzESome error happened when fetching an URL and must stop the rendering.Nr’   r    r   r   r•   r•     s   „ ÚOr   r•   c                   óB   ‡ — e Zd ZdZ	 	 dˆ fd„	Zdˆ fd„	Zdd„Zd„ Zˆ xZS )	ro   a`  Fetcher of external resources such as images or stylesheets.

    :param int timeout: The number of seconds before HTTP requests are dropped.
    :param ssl.SSLContext ssl_context: An SSL context used for HTTPS requests.
    :param dict http_headers: Additional HTTP headers used for HTTP requests.
    :type allowed_protocols: :term:`sequence`
    :param allowed_protocols: A set of authorized protocols, :obj:`None` means all.
    :param bool allow_redirects: Whether HTTP redirects must be followed.
    :param bool fail_on_errors: Whether HTTP errors should stop the rendering.

    Another class inheriting from this class, with a ``fetch`` method that has a
    compatible signature, can be given as the ``url_fetcher`` argument to
    :class:`weasyprint.HTML` or :class:`weasyprint.CSS`.

    See :ref:`URL Fetchers` for more information and examples.

    c                 óX  •— t         ‰
| �  «        t        j                  «       t        j                  «       t        j
                  «       t        j                  «       t        j                  «       t        j                  «       t        j                  «       t        j                  «       t        j                  |¬«      g	}|r#|j                  t        j                  «       «       |D ]  }	| j                  |	«       Œ || _        i t         ¥|xs i ¥| _        || _        || _        d | _        y )N)rX   )Úsuperr   r   ÚProxyHandlerÚUnknownHandlerÚHTTPHandlerÚHTTPDefaultErrorHandlerÚ
FTPHandlerÚFileHandlerÚHTTPErrorProcessorÚDataHandlerÚHTTPSHandlerÚappendÚHTTPRedirectHandlerÚadd_handlerÚ_timeoutÚHTTP_HEADERSÚ_http_headersÚ_allowed_protocolsÚ_fail_on_errorsÚ_request)r   rq   rr   rs   rt   rk   Úfail_on_errorsr�   ÚhandlersÚhandlerÚ	__class__s             €r   r   zURLFetcher.__init__)  sî   ø€ ô 	‰ÑÔä× Ñ Ó"¤G×$:Ñ$:Ó$<¼g×>QÑ>QÓ>SÜ×+Ñ+Ó-¬w×/AÑ/AÓ/CÜ×ÑÓ!¤7×#=Ñ#=Ó#?Ä×ATÑATÓAVÜ× Ñ ¨Ô5ð	7ˆñ
 Ø�O‰OœG×7Ñ7Ó9Ô:Øò 	&ˆGØ×Ñ˜WÕ%ð	&ð  ˆŒØE¤ÐE°Ò1CÀÐEˆÔØ"3ˆÔØ-ˆÔØˆ�r   c                 óJ  •— t         j                  |«      x}st        d|› �«      ‚|d   j                  «       }| j                  �|| j                  vrt        d|› �«      ‚|dk(  r|j                  d«      d   }t        |«      }i | j                  ¥|xs i ¥}| j                  xs t        j                  ||¬«      }d| _        t        ‰
| �1  || j                  ¬	«      }|}d
|j                  v rY|j                  d
   }|j                  d
= |dk(  rt        |¬«      }n+|dk(  r&|j!                  «       }		 t#        j$                  |	«      }t)        |j*                  ||j                  |j,                  «      S # t"        j&                  $ r t#        j$                  |	d«      }Y ŒWw xY w)aE  Fetch a given URL.

        :returns: A :obj:`URLFetcherResponse` instance.
        :raises: An exception indicating failure, e.g. :obj:`ValueError` on
            syntactically invalid URL. All exceptions are catched internally by
            WeasyPrint, except when they inherit from :obj:`FatalURLFetchingError`.

        zNot an absolute URI: r   NzURI uses disallowed protocol: Úfileú?r   ©Úheaders)rq   zContent-EncodingÚgzipr   Údeflateiñÿÿÿ)r?   rB   r^   Úlowerr¨   Úsplitr.   r§   rª   r   ÚRequestr˜   r…   r¥   r³   r   r{   ÚzlibÚ
decompressrW   ÚURLFetcherResponser-   Ústatus)r   r-   r³   rB   rC   Úhttp_requestr�   ÚbodyÚcontent_encodingÚdatar®   s             €r   rp   zURLFetcher.fetch=  s™  ø€ ô +×0Ñ0°Ó5Ð5�Ð5ÜÐ4°S°EÐ:Ó;Ð;Ø�q‘—‘Ó!ˆð ×"Ñ"Ð.Ø˜T×4Ñ4Ñ4Ü Ð#AÀ#ÀÐ!GÓHÐHð �VÒØ—)‘)˜C“. Ñ#ˆCô ˜‹oˆð <�T×'Ñ'Ð;¨GªM°rÐ;ˆØ—}‘}ÒM¬¯©¸ÀWÔ(MˆØˆŒÜ‘7‘< °d·m±m�<ÓDˆð ˆØ ×!1Ñ!1Ñ1Ø'×/Ñ/Ð0BÑCÐØ× Ñ Ð!3Ð4Ø 6Ò)Ü(°Ô:‘Ø! YÒ.Ø—}‘}“�ð6ÜŸ?™?¨4Ó0�Dô
 " (§,¡,°°h×6FÑ6FÈÏÉÓXÐXøô	 —z‘zò 6äŸ?™?¨4°Ó5’Dð6ús   Ä5E6 Å6)F"Æ!F"c                 ó²   — t        |t        j                  «      r-|| _        | j	                  |j
                  |j                  «      S | j	                  |«      S r   )r1   r   r¸   rª   rp   Úfull_urlr³   )r   r-   rÀ   rq   s       r   r…   zURLFetcher.openo  s>   € Ü�cœ7Ÿ?™?Ô+ØˆDŒMØ—:‘:˜cŸl™l¨C¯K©KÓ8Ð8Ø�z‰z˜#‹Ðr   c                 ó$   — | j                  |«      S r   )rp   )r   r-   s     r   Ú__call__zURLFetcher.__call__u  s   € Ø�z‰z˜#‹Ðr   )é
   NNNTFr   )NN)	r"   r#   r$   r“   r   rp   r…   rÄ   Ú__classcell__)r®   s   @r   ro   ro     s(   ø„ ñð$ CGØNSõõ(0Yódör   ro   c                   óv   — e Zd ZdZdd„Zd„ Zd„ Zed„ «       Zed„ «       Z	ed„ «       Z
d	„ Zd
„ Zed„ «       Zd„ Zy)r»   u  The HTTP response of an URL fetcher.

    :param str url: The URL of the HTTP response.
    :type body: :class:`str`, :class:`bytes` or :term:`file object`
    :param body: The body of the HTTP response.
    :type headers: dict or email.message.EmailMessage
    :param headers: The headers of the HTTP response.
    :param int status: The status of the HTTP response.

    Has the same interface as :class:`urllib.response.addinfourl`.

    If a :term:`file object` is given for the body, it is the callerâ€™s responsibility to
    call ``close()`` on it. The default function used internally to fetch data in
    WeasyPrint tries to close the file object after retreiving; but if this URL fetcher
    is used elsewhere, the file object has to be closed manually.

    Nc                 óÄ  — || _         || _        t        |t        «      r|| _        n;t        «       | _        |xs i j                  «       D ]  \  }}	 || j                  |<   Œ t        |d«      r|| _        y t        |t        «      r<| j                  j                  dd«       t        |j                  d«      «      | _        y t        |«      | _        y # t        $ r Y Œ”w xY w)Nr{   r‡   r'   )r-   r¼   r1   r   r³   Úitemsr^   rƒ   Ú	_file_objr2   Ú	set_paramr   r*   )r   r-   r¾   r³   r¼   r�   ÚkeyrO   s           r   r   zURLFetcherResponse.__init__‹  sÂ   € ØˆŒØˆŒä�gœ|Ô,Ø"ˆD�Lä'›>ˆDŒLØ&š}¨"×3Ñ3Ó5ò ‘
��UðØ(-�D—L‘L Ò%ðô �4˜Ô Ø!ˆD�NÜ˜œcÔ"Ø�L‰L×"Ñ" 9¨gÔ6Ü$ T§[¡[°Ó%9Ó:ˆD�Nä$ T›]ˆD�Nøô "ò Ùðús   ÁCÃ	CÃCc                 ó:   —  | j                   j                  |i |¤ŽS r   )rÊ   r{   )r   Úargsr�   s      r   r{   zURLFetcherResponse.read¡  s   € Ø"ˆt�~‰~×"Ñ" DÐ3¨FÑ3Ð3r   c                 ó¾   — 	 | j                   j                  «        y # t        $ r6 t        j                  d| j
                  t        j                  «       «       Y y w xY w)Nz$Error when closing stream for %s:
%s)rÊ   r   Ú	Exceptionr   r_   r-   Ú	tracebackÚ
format_excr   s    r   r   zURLFetcherResponse.close¤  sI   € ð	2Ø�N‰N× Ñ Õ"øÜò 	2ô �N‰NØ7Ø—‘œ)×.Ñ.Ó0ö2ð	2ús   ‚ �<AÁAc                 óº   — | j                   j                  d«      r@t        j                  | j                   j	                  d«      d   j                  d«      «      S y )Nr&   r±   r   )r-   r)   r   Úurl2pathnamer·   Úremoveprefixr   s    r   r7   zURLFetcherResponse.path®  sG   € à�8‰8×Ñ˜wÔ'Ü×'Ñ'¨¯©¯©°sÓ(;¸AÑ(>×(KÑ(KÈGÓ(TÓUÐUð (r   c                 ó6   — | j                   j                  «       S r   )r³   Úget_content_typer   s    r   r†   zURLFetcherResponse.content_type³  s   € à�|‰|×,Ñ,Ó.Ð.r   c                 ó8   — | j                   j                  d«      S )Nr‡   )r³   Ú	get_paramr   s    r   r‡   zURLFetcherResponse.charset·  s   € à�|‰|×%Ñ% iÓ0Ð0r   c                 ó   — | j                   S r   r,   r   s    r   ÚgeturlzURLFetcherResponse.geturl»  s   € Ø�x‰xˆr   c                 ó   — | j                   S r   r²   r   s    r   ÚinfozURLFetcherResponse.info¾  s   € Ø�|‰|Ðr   c                 ó   — | j                   S r   ©r¼   r   s    r   ÚcodezURLFetcherResponse.codeÁ  s   € à�{‰{Ðr   c                 ó   — | j                   S r   rß   r   s    r   ÚgetcodezURLFetcherResponse.getcodeÅ  s   € Ø�{‰{Ðr   )NNéÈ   )r"   r#   r$   r“   r   r{   r   Úpropertyr7   r†   r‡   rÛ   rÝ   rà   râ   r    r   r   r»   r»   y  sw   „ ñó"+ò,4ò2ð ñVó ðVð ñ/ó ð/ð ñ1ó ð1òòð ñó ðór   r»   c              #   ó�  K  — 	  | |«      }t        |t        «      r—t        j                  dt        ¬«       d	|vr|j                  d
|«      |d	<   |j                  d|j                  d«      «      |d<   |j                  dd«      }|j                  d«      x}r|d|› �z  }d|i|d<   t        di |¤Ž}t        |t        «      sJ d«       ‚	 |–— |j                  «        y# t         $ rE}t        | dd«      rt        d|› d�«      |‚t        t	        |«      j
                  › d|› �«      ‚d}~ww xY w# |j                  «        w xY w­w)aD  Fetch an ``url`` with ```url_fetcher``, fill in optional data, and clean up.

    Fatal errors must raise a ``FatalURLFetchingError`` that stops the rendering. All
    other exceptions are catched and raise an ``URLFetchingError``, that is usually
    catched by the code that fetches the resource and emits a warning.

    r©   FzError fetching "ú"z: NzReturning dicts in URL fetchers is deprecated and will be removed in WeasyPrint 69.0, please return URLFetcherResponse instead.ri   r-   Úredirected_urlr|   rf   r¾   Ú	mime_typezapplication/octet-streamÚencodingz
; charset=zContent-Typer³   zFURL fetcher must return either a dict or a URLFetcherResponse instancer    )rÐ   rˆ   r•   r‘   Útyper"   r1   Údictrl   rm   rn   rG   r»   r   )ry   r-   ÚresourceÚ	exceptionr†   r‡   s         r   rp   rp   É  s\  è ø€ ðKÙ˜sÓ#ˆô �(œDÔ!Ü�‰ðLä'õ	)ð ˜Ñ Ø&Ÿl™lÐ+;¸SÓAˆH�U‰OØ#Ÿ<™<¨
°H·L±LÀÓ4JÓKˆ�ÑØ—|‘| KÐ1KÓLˆØ—l‘l :Ó.Ð.ˆ7Ð.Ø˜j¨¨	Ð2Ñ2ˆLØ-¨|Ð<ˆ�ÑÜ%Ñ1¨Ñ1ˆä�hÔ 2Ô3ð RØPóRÐ3ðØŠà�‰Õøô3 ò KÜ�;Ð 1°5Ô9Ü'Ð*:¸3¸%¸qÐ(AÓBÈ	ÐQÜ¤$ y£/×":Ñ":Ð!;¸2¸i¸[ÐIÓJÐJûðKûð2 	�‰ÕüsA   ‚E„C  ŒB>EÃD1 ÃEÃ 	D.Ã)A D)Ä)D.Ä.EÄ1EÅE)F)rÅ   NNN)NNNNNNNF)7r“   Ú
contextlibÚos.pathr6   ÚreÚsysrÑ   rl   r¹   Úemail.messager   r´   r   Úior   r   Úpathlibr   Úurllibr   Úurllib.parser	   r
   r   r   rF   r   Úloggerr   Úcompiler?   r@   Úgetfilesystemencodingr+   r¦   r   r.   r=   rD   rP   rU   rI   rd   rg   rv   Úcontextmanagerr„   ÚIOErrorr‘   ÚBaseExceptionr•   ÚOpenerDirectorro   r»   rp   r    r   r   ú<module>rþ      sC  ðÙ ?ã Û Û 	Û 
Û Û Û Ý &Ý ß  Ý Ý ß :Ó :å Ý ð
 �B—J‘JÐ<Ó=Ð Ø�"—*‘*Ð;Ó<€à/�c×/Ñ/Ó1Ð ð   ˜}Ð-ØØ&ñ€ô
˜ô 
ò4ò  ò>#ó-ò&@òò*ò<Cð IMØ*.óð$ ×ÑØMQØGLò?8ó ð?8ôD4�wô 4ôP˜Mô Pô`�×'Ñ'ô `÷FMñ Mð` ×Ññ#ó ñ#r   