§
    ¡”j   ã                   ó@   — d dl mZmZmZ ddlmZ 	 	 dd„Z	 	 	 d	d„ZdS )
é    )ÚUTF8ÚdecodeÚlookupé   )Úparse_stylesheetNc                 óÚ  — |r!t          |¦  «        }|rt          | |¦  «        S |                      d¦  «        r�|                      ddd¦  «        }|dk    rp|                      d|¦  «        rZt          | d|…                              d¦  «        ¦  «        }|r.|j        dv rt          | t
          ¦  «        S t          | |¦  «        S |rt          | |¦  «        S t          | t
          ¦  «        S )	aB  Determine the character encoding of a CSS stylesheet and decode it.

    This is based on the presence of a :abbr:`BOM (Byte Order Mark)`,
    a ``@charset`` rule, and encoding meta-information.

    :type css_bytes: :obj:`bytes`
    :param css_bytes: A CSS byte string.
    :type protocol_encoding: :obj:`str`
    :param protocol_encoding:
        The encoding label, if any, defined by HTTP or equivalent protocol.
        (e.g. via the ``charset`` parameter of the ``Content-Type`` header.)
    :type environment_encoding: :class:`webencodings.Encoding`
    :param environment_encoding:
        The `environment encoding
        <https://www.w3.org/TR/css-syntax/#environment-encoding>`_, if any.
    :returns:
        A 2-tuple of a decoded Unicode string and the
        :class:`webencodings.Encoding` object that was used.

    s
   @charset "ó   "é
   éd   éÿÿÿÿs   ";Úlatin1)zutf-16bezutf-16le)r   r   Ú
startswithÚfindÚnamer   )Ú	css_bytesÚprotocol_encodingÚenvironment_encodingÚfallbackÚ	end_quotes        ú]/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/tinycss2/bytes.pyÚdecode_stylesheet_bytesr      sÿ   € ð. ð /ÝÐ+Ñ,Ô,ˆØð 	/Ý˜) XÑ.Ô.Ð.Ø×Ò˜MÑ*Ô*ð 	3ð —N’N 4¨¨SÑ1Ô1ˆ	Ø˜Š?ˆ?˜y×3Ò3°E¸9ÑEÔEˆ?Ý˜i¨¨9¨Ô5×<Ò<¸XÑFÔFÑGÔGˆHØð 3Ø”=Ð$<Ð<Ð<Ý! )­TÑ2Ô2Ð2Ý˜i¨Ñ2Ô2Ð2Øð 7Ý�iÐ!5Ñ6Ô6Ð6Ý�)�TÑ"Ô"Ð"ó    Fc                 óT   — t          | ||¦  «        \  }}t          |||¦  «        }||fS )a}	  Parse :diagram:`stylesheet` from bytes,
    determining the character encoding as web browsers do.

    This is used when reading a file or fetching a URL.
    The character encoding is determined from the initial bytes
    (a :abbr:`BOM (Byte Order Mark)` or a ``@charset`` rule)
    as well as the parameters. The ultimate fallback is UTF-8.

    :type css_bytes: :obj:`bytes`
    :param css_bytes: A CSS byte string.
    :type protocol_encoding: :obj:`str`
    :param protocol_encoding:
        The encoding label, if any, defined by HTTP or equivalent protocol.
        (e.g. via the ``charset`` parameter of the ``Content-Type`` header.)
    :type environment_encoding: :class:`webencodings.Encoding`
    :param environment_encoding:
        The `environment encoding`_, if any.
    :type skip_comments: :obj:`bool`
    :param skip_comments:
        Ignore CSS comments at the top-level of the stylesheet.
        If the input is a string, ignore all comments.
    :type skip_whitespace: :obj:`bool`
    :param skip_whitespace:
        Ignore whitespace at the top-level of the stylesheet.
        Whitespace is still preserved
        in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
        and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
    :returns:
        A ``(rules, encoding)`` tuple.

        * ``rules`` is a list of
          :class:`~tinycss2.ast.QualifiedRule`,
          :class:`~tinycss2.ast.AtRule`,
          :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
          :class:`~tinycss2.ast.WhitespaceToken`
          (if ``skip_whitespace`` is false),
          and :class:`~tinycss2.ast.ParseError` objects.
        * ``encoding`` is the :class:`webencodings.Encoding` object
          that was used.
          If ``rules`` contains an ``@import`` rule, this is
          the `environment encoding`_ for the imported stylesheet.

    .. _environment encoding:
            https://www.w3.org/TR/css-syntax/#environment-encoding

    .. code-block:: python

        response = urlopen('http://example.net/foo.css')
        rules, encoding = parse_stylesheet_bytes(
            css_bytes=response.read(),
            # Python 3.x
            protocol_encoding=response.info().get_content_type().get_param('charset'),
            # Python 2.x
            protocol_encoding=response.info().gettype().getparam('charset'),
        )
        for rule in rules:
            ...

    )r   r   )r   r   r   Úskip_commentsÚskip_whitespaceÚcss_unicodeÚencodingÚ
stylesheets           r   Úparse_stylesheet_bytesr   0   s>   € õ| 4ØÐ$Ð&:ñ<ô <Ñ€K�å! +¨}¸oÑNÔN€JØ�xÐÐr   )NN)NNFF)Úwebencodingsr   r   r   Úparserr   r   r   © r   r   ú<module>r#      s�   ðØ -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -à $Ð $Ð $Ð $Ð $Ð $ð :>Ø15ð'#ð '#ð '#ð '#ðT 9=Ø04Ø@EðA ð A ð A ð A ð A ð A r   