Ë
    úmxiû  ã                  óÚ   — U d dl mZ d dl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 d dlmZ d dlmZ erd d	lmZ d d
lmZ eez  ez  ej.                  z  Zded<   dd„Z G d„ d«      Zy)é    )ÚannotationsN)ÚPath)ÚTYPE_CHECKINGÚAnyÚ	TypeAliasÚcast)Úurl_util)Úvalidate_height©ÚStreamlitAPIException)Úgather_metrics)ÚDeltaGenerator)ÚHeightWithoutContentr   ÚPdfDatac                 óB   — 	 ddl } | j                  S # t        $ r Y yw xY w)z¼Get the PDF custom component if available.

    Returns
    -------
    Any | None
        The pdf_viewer function if the streamlit-pdf component is available,
        None otherwise.
    r   N)Ústreamlit_pdfÚ
pdf_viewerÚImportError)r   s    úM/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/elements/pdf.pyÚ_get_pdf_componentr   !   s(   € ðÛà×'Ñ'Ð'øÜò Ùðús   ‚ ’	�c                  óv   — e Zd Z ed«      dddœ	 	 	 	 	 	 	 d	d„«       Z	 	 	 	 	 	 	 	 	 	 d
d„Zdd„Zedd„«       Zy)ÚPdfMixinÚpdfiô  N)ÚheightÚkeyc               ó|   — |€t        d«      ‚t        «       }|€| j                  «       S | j                  ||||«      S )a¸  Display a PDF viewer.

        .. Important::

            You must install |streamlit-pdf|_ to use this command. You can
            install it as an extra with Streamlit:

            .. code-block:: shell

                pip install streamlit[pdf]

        .. |streamlit-pdf| replace:: ``streamlit-pdf``
        .. _streamlit-pdf: https://github.com/streamlit/streamlit-pdf

        Parameters
        ----------
        data : str, Path, BytesIO, or bytes
            The PDF file to show. This can be one of the following:

            - A URL (string) for a hosted PDF file.
            - A path to a local PDF file. If you use a relative path, it must
              be relative to the current working directory.
            - A file-like object. For example, this can be an ``UploadedFile``
              from ``st.file_uploader``, or this can be a local file opened
              with ``open()``.
            - Raw bytes data.

        height : int or "stretch"
            The height of the PDF viewer. This can be one of the following:

            - An integer specifying the height in pixels: The viewer has a
              fixed height. If the content is larger than the specified
              height, scrolling is enabled. This is ``500`` by default.
            - ``"stretch"``: The height of the viewer matches the height of
              its content or the height of the parent container, whichever is
              larger. If the viewer is not in a parent container, the height
              of the viewer matches the height of its content.

        Example
        -------
        >>> st.pdf("https://example.com/sample.pdf")
        >>> st.pdf("https://example.com/sample.pdf", height=600)
        zhThe PDF data cannot be None. Please provide a valid PDF file path, URL, bytes data, or file-like object.)r   r   Ú_show_pdf_warningÚ_call_pdf_component)ÚselfÚdatar   r   Úpdf_components        r   r   zPdfMixin.pdf3   sR   € ðh ˆ<Ü'ð3óð ô +Ó,ˆØÐ Ø×)Ñ)Ó+Ð+à×'Ñ'¨°t¸VÀSÓIÐIó    c                ó®  — t        |d¬«       t        |t        t        f«      rZt        |«      j	                  «       }t        j                  |d¬«      r|}n¢	 t        |d«      5 }|j                  «       }ddd«       n{t        |t        «      r|}nht        |d	«      rt        |d
«      r|j                  «       }n?t        |d	«      r|j                  «       }n"t        dt        |«      j                   › d�«      ‚|dk(  rd}	nt        |«      }	 ||	|¬«      }
t#        d|
«      S # 1 sw Y   Œ¯xY w# t        t        f$ r}t        d|› d|› �«      ‚d}~ww xY w)z5Call the custom PDF component with the provided data.F)Úallow_content)ÚhttpÚhttps)Úallowed_schemasÚrbNzUnable to read file 'z': ÚreadÚgetvaluezUnsupported data type for PDF: zy. Please provide a file path (str or Path), URL (str), bytes data, or file-like object (such as BytesIO or UploadedFile).Ústretch)Úfiler   r   r   )r
   Ú
isinstanceÚstrr   Ústripr	   Úis_urlÚopenr)   ÚFileNotFoundErrorÚPermissionErrorr   ÚbytesÚhasattrr*   ÚtypeÚ__name__r   )r   r!   r    r   r   Údata_strÚ
file_paramr,   ÚeÚcomponent_heightÚresults              r   r   zPdfMixin._call_pdf_componentt   sW  € ô 	˜¨eÕ4ô
 �dœS¤$˜KÔ(Ü˜4“y—‘Ó(ˆHÜ�‰˜xÐ9JÕKà%‘
ðÜ˜h¨Ó-ð 1°Ø%)§Y¡Y£[˜
÷1øô ˜œeÔ$à‰JÜ�T˜6Ô"¤w¨t°ZÔ'@àŸ™›‰JÜ�T˜6Ô"àŸ™›‰Jô (Ø1´$°t³*×2EÑ2EÐ1Fð GIð Jóð ð �YÒð  )Ñä" 6›{ÐáØØ#Øô
ˆô
 Ð$ fÓ-Ð-÷K1ð 1ûä)¬?Ð;ò Ü/Ø/°¨z¸¸Q¸CÐ@óð ûðús0   ÁD/ Á$D#Á5D/ Ä#D,Ä(D/ Ä/EÄ>EÅEc                ó   — t        d«      ‚)z;Raise an exception that the PDF component is not available.zúThe PDF viewer requires the `streamlit-pdf` component to be installed.

Please run `pip install streamlit[pdf]` to install it.

For more information, see the Streamlit PDF documentation at https://docs.streamlit.io/develop/api-reference/media/st.pdf.r   ©r   s    r   r   zPdfMixin._show_pdf_warning±   s   € ä#ðLó
ð 	
r"   c                ó   — t        d| «      S )zGet our DeltaGenerator.r   )r   r>   s    r   ÚdgzPdfMixin.dg»   s   € ô Ð$ dÓ+Ð+r"   )r    r   r   r   r   ú
str | NoneÚreturnr   )
r!   r   r    r   r   r   r   rA   rB   r   )rB   r   )	r7   Ú
__module__Ú__qualname__r   r   r   r   Úpropertyr@   © r"   r   r   r   2   s�   „ Ù�EÓð
 (+Øñ>Jàð>Jð %ð	>Jð
 ð>Jð 
ò>Jó ð>Jð@;.àð;.ð ð;.ð %ð	;.ð
 ð;.ð 
ó;.óz
ð ò,ó ñ,r"   r   )rB   z
Any | None)Ú
__future__r   ÚioÚpathlibr   Útypingr   r   r   r   Ú	streamlitr	   Ú#streamlit.elements.lib.layout_utilsr
   Ústreamlit.errorsr   Ústreamlit.runtime.metrics_utilr   Ústreamlit.delta_generatorr   r   r.   r4   ÚBytesIOr   Ú__annotations__r   r   rF   r"   r   ú<module>rR      sX   ðö #ã 	Ý ß 6Ó 6å Ý ?Ý 2Ý 9áÝ8ÝHà˜4‘Z %Ñ'¨"¯*©*Ñ4€ˆÓ 4ó÷"L,ò L,r"   