Ë
    Eêñi¨F  ã                  ó  — 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mZ d dl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  eh d£«      Zded<   dZded<   dd„Z dd„Z! G d„ d«      Z"	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd„Z#y)é    )ÚannotationsN)ÚPath)ÚTYPE_CHECKINGÚFinalÚLiteralÚcast)ÚruntimeÚurl_util)ÚLayoutConfigÚvalidate_heightÚvalidate_width)ÚStreamlitAPIException)ÚIFrame)Úcaching)Úgather_metrics)ÚDeltaGenerator>   ú.htmú.htmlú.xhtmlr   Ú_HTML_EXTENSIONSi   Ú_MAX_PATH_LENGTHc                ó˜   — t        | «      t        kD  sd| v ry	 t        | «      j                  «       S # t        t
        t        f$ r Y yw xY w)z5Check if obj is a file path, without throwing if not.ú<F)Úlenr   r   Úis_fileÚ	TypeErrorÚOSErrorÚ
ValueError)Úobjs    ú[/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/iframe.pyÚ_is_filer!   +   sK   € ô
 ˆ3ƒxÔ"Ò" c¨S¡jØðÜ�C‹y× Ñ Ó"Ð"øÜ”w¤
Ð+ò áðús   ™2 ²A	ÁA	c                ój   — | €yt        | t        «      rt        | t        «      s| dk\  st        d«      ‚y)z3Validate tab_index according to web specifications.Néÿÿÿÿz6tab_index must be None, -1, or a non-negative integer.)Ú
isinstanceÚintÚboolr   ©Ú	tab_indexs    r    Ú_validate_tab_indexr)   :   s;   € àÐØä�9œcÔ"Ü˜9¤dÔ+Ø˜ŠOä#ØDó
ð 	
ð ó    c                  óô   — e Zd Z ed«      	 	 	 dddœ	 	 	 	 	 	 	 	 	 	 	 dd„«       Z ed«      	 	 	 dddœ	 	 	 	 	 	 	 	 	 	 	 dd„«       Z ed«      dd	dd
œ	 	 	 	 	 	 	 	 	 dd„«       Z	 	 	 	 	 	 	 	 dd„Zedd„«       Z	y)ÚIframeMixinÚ_iframeNr'   c               óš   — t        «       }t        ||||¬«       t        |�|nd|�|nd¬«      }| j                  j	                  d||¬«      S )a˜	  Load a remote URL in an iframe.

        To use this function, import it from the ``streamlit.components.v1``
        module.

        .. deprecated::
            ``st.components.v1.iframe`` is deprecated and will be removed in a
            future release. Please use ``st.iframe`` instead, which provides
            the same functionality with additional features like automatic
            content sizing and local file support.

        .. warning::
            Using ``st.components.v1.iframe`` directly (instead of importing
            its module) is deprecated and will be disallowed in a later version.

        Parameters
        ----------
        src : str
            The URL of the page to embed.

        width : int
            The width of the iframe in CSS pixels. By default, this is the
            app's default element width.

        height : int
            The height of the frame in CSS pixels. By default, this is ``150``.

        scrolling : bool
            Whether to allow scrolling in the iframe. If this ``False``
            (default), Streamlit crops any content larger than the iframe and
            does not show a scrollbar. If this is ``True``, Streamlit shows a
            scrollbar when the content is larger than the iframe.

        tab_index : int or None
            Specifies how and if the iframe is sequentially focusable.
            Users typically use the ``Tab`` key for sequential focus
            navigation.

            This can be one of the following values:

            - ``None`` (default): Uses the browser's default behavior.
            - ``-1``: Removes the iframe from sequential navigation, but still
              allows it to be focused programmatically.
            - ``0``: Includes the iframe in sequential navigation in the order
              it appears in the document but after all elements with a positive
              ``tab_index``.
            - Positive integer: Includes the iframe in sequential navigation.
              Elements are navigated in ascending order of their positive
              ``tab_index``.

            For more information, see the `tabindex
            <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex>`_
            documentation on MDN.

        Examples
        --------
        >>> import streamlit.components.v1 as components
        >>>
        >>> components.iframe("https://example.com", height=500)

        )ÚsrcÚ	scrollingr(   Ústretché–   ©ÚwidthÚheightÚiframe©Úlayout_config©ÚIFrameProtoÚmarshallr   ÚdgÚ_enqueue)Úselfr/   r4   r5   r0   r(   Úiframe_protor8   s           r    r-   zIframeMixin._iframeI   s^   € ôN #“}ˆÜØØØØõ		
ô %Ø Ð,‘%°)Ø#Ð/‘6°Sô
ˆð �w‰w×Ñ ¨,ÀmÐÓTÐTr*   Ú_htmlc               óš   — t        «       }t        ||||¬«       t        |�|nd|�|nd¬«      }| j                  j	                  d||¬«      S )aW
  Display an HTML string in an iframe.

        To use this function, import it from the ``streamlit.components.v1``
        module.

        If you want to insert HTML text into your app without an iframe, try
        ``st.html`` instead.

        .. deprecated::
            ``st.components.v1.html`` is deprecated and will be removed in a
            future release. Please use ``st.iframe`` instead, which provides
            the same functionality with additional features like automatic
            content sizing and local file support.

        .. warning::
            Using ``st.components.v1.html`` directly (instead of importing
            its module) is deprecated and will be disallowed in a later version.

        Parameters
        ----------
        html : str
            The HTML string to embed in the iframe.

        width : int
            The width of the iframe in CSS pixels. By default, this is the
            app's default element width.

        height : int
            The height of the frame in CSS pixels. By default, this is ``150``.

        scrolling : bool
            Whether to allow scrolling in the iframe. If this ``False``
            (default), Streamlit crops any content larger than the iframe and
            does not show a scrollbar. If this is ``True``, Streamlit shows a
            scrollbar when the content is larger than the iframe.

        tab_index : int or None
            Specifies how and if the iframe is sequentially focusable.
            Users typically use the ``Tab`` key for sequential focus
            navigation.

            This can be one of the following values:

            - ``None`` (default): Uses the browser's default behavior.
            - ``-1``: Removes the iframe from sequential navigation, but still
              allows it to be focused programmatically.
            - ``0``: Includes the iframe in sequential navigation in the order
              it appears in the document but after all elements with a positive
              ``tab_index``.
            - Positive integer: Includes the iframe in sequential navigation.
              Elements are navigated in ascending order of their positive
              ``tab_index``.

            For more information, see the `tabindex
            <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex>`_
            documentation on MDN.

        Examples
        --------
        >>> import streamlit.components.v1 as components
        >>>
        >>> components.html(
        >>>     "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"
        >>> )

        )Úsrcdocr0   r(   r1   r2   r3   r6   r7   r9   )r>   Úhtmlr4   r5   r0   r(   r?   r8   s           r    r@   zIframeMixin._html�   s^   € ôX #“}ˆÜØØØØõ		
ô %Ø Ð,‘%°)Ø#Ð/‘6°Sô
ˆð �w‰w×Ñ ¨,ÀmÐÓTÐTr*   r6   r1   Úcontent)r4   r5   r(   c               ó¤  — t        |d¬«       t        |d¬«       t        «       }d}t        |t        «      rt        |«      n|}t        |t        «      r,| j                  ||| j                  j                  «       «      }nxt        j                  |d¬«      r||_        nYt        |«      r,| j                  ||| j                  j                  «       «      }n"|j                  d«      r||_        n	||_        d}d|_        t!        |«       |�||_        |}|}	|s|dk(  rd}|dk(  rd	}	t%        ||	¬
«      }
| j                  j'                  d||
¬«      S )aÒ  Embed content in an iframe.

        ``st.iframe`` embeds external URLs, HTML content, or local files in an
        iframe. It auto-detects the input type and handles it appropriately.

        Parameters
        ----------
        src : str or Path
            The content to embed. This can be one of the following:

            - **Absolute URL**: A URL starting with ``http://``, ``https://``,
              or ``data:``. The URL is loaded directly in the iframe.
            - **Relative URL**: A path starting with ``/``, such as
              ``/app/static/report.html``. Useful for referencing files served
              via Streamlit's `static file serving
              <https://docs.streamlit.io/develop/concepts/configuration/serving-static-files>`_.
            - **Local file path**: A path to a local file, either as a string
              or ``Path`` object. HTML files (``.html``, ``.htm``, ``.xhtml``)
              are read and embedded directly. Other files (PDF, images, SVG,
              etc.) are uploaded to Streamlit's media storage and rendered
              using the browser's native viewer.
            - **HTML string**: If ``src`` doesn't match any of the above
              patterns, it's treated as raw HTML and embedded directly in the
              iframe.

        width : int, "stretch", or "content"
            The width of the iframe. This can be one of the following:

            - ``"stretch"`` (default): The iframe fills the width of its
              container.
            - ``"content"``: The iframe matches the width of its content.
            - An ``int``: A fixed width in CSS pixels.

        height : int, "stretch", or "content"
            The height of the iframe. This can be one of the following:

            - ``"content"`` (default): The iframe automatically sizes to match
              its content height. For HTML strings and local HTML files,
              Streamlit measures the content height. For external URLs and
              non-HTML files, this falls back to 400px due to cross-origin
              restrictions.
            - ``"stretch"``: The iframe fills the available vertical space.
              Works best inside containers with defined heights.
            - An ``int``: A fixed height in CSS pixels.

        tab_index : int or None
            Controls keyboard navigation focus. This can be one of the
            following:

            - ``None`` (default): Browser default behavior.
            - ``-1``: Removes from tab order but allows programmatic focus.
            - ``0``: Adds to tab order in document position.
            - Positive ``int``: Adds to tab order at specified priority.

            For more information, see the `tabindex
            <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex>`_
            documentation on MDN.

        Examples
        --------
        Embed an external website:

        >>> import streamlit as st
        >>> st.iframe("https://docs.streamlit.io", height=600)

        Embed HTML content directly:

        >>> import streamlit as st
        >>> st.iframe(
        ...     '''
        ...     <style>body { font-family: sans-serif; padding: 1rem; }</style>
        ...     <p>This is <strong>embedded HTML</strong>.</p>
        ...     ''',
        ...     height=100,
        ... )

        Embed a local HTML file:

        >>> import streamlit as st
        >>> from pathlib import Path
        >>> st.iframe(Path("reports/dashboard.html"), height=800)

        T)Úallow_contentF)ÚhttpÚhttpsÚdata)Úallowed_schemasú/rD   r1   i�  r3   r6   r7   )r   r   r:   r$   r   ÚstrÚ_process_local_filer<   Ú_get_delta_path_strr
   Úis_urlr/   r!   Ú
startswithrB   r0   r)   r(   r   r=   )r>   r/   r4   r5   r(   r?   Úuses_srcdocÚsrc_strÚeffective_widthÚeffective_heightr8   s              r    r6   zIframeMixin.iframeö   sG  € ôz 	�u¨DÕ1Ü˜¨dÕ3ä"“}ˆð ˆô )¨¬dÔ3”#�c”(¸ˆä�cœ4Ô Ø×2Ñ2Ø˜g t§w¡w×'BÑ'BÓ'Dó‰Kô �_‰_˜WÐ6OÕPØ&ˆLÕÜ�gÔà×2Ñ2Ø˜g t§w¡w×'BÑ'BÓ'Dó‰Kð ×Ñ Ô$à&ˆLÕà")ˆLÔØˆKà!%ˆÔä˜IÔ&ØÐ Ø%.ˆLÔ"ð  ˆØ!ÐÙØ˜	Ò!Ø"+�Ø˜Ò"Ø#&Ð ä$¨?ÐCSÔTˆà�w‰w×Ñ ¨,ÀmÐÓTÐTr*   c                ó  — t        |«      }|j                  j                  «       }|t        v r-	 t	        |d¬«      5 }|j                  «       |_        ddd«       y	 t	        |d«      5 }|j                  «       }ddd«       t        j                  |«      \  }	}
t        j                  «       rVt        j                   «       j"                  j%                  |	xs d|«      }t'        j(                  ||	xs d|«       ||_        y
d	|_        y
# 1 sw Y   yxY w# t        t        t        t        f$ r}t        d|› d|› �«      |‚d}~ww xY w# 1 sw Y   ŒÒxY w# t        t        t        f$ r}t        d|› d|› �«      |‚d}~ww xY w)a.  Process a local file for embedding in the iframe.

        Parameters
        ----------
        proto : IFrameProto
            The proto to populate with src or srcdoc.
        file_path : str
            Path to the local file.
        coordinates : str
            The element coordinates for media file tracking.

        Returns
        -------
        bool
            True if the file was embedded via srcdoc (HTML), False if via src (URL).

        Raises
        ------
        StreamlitAPIException
            If the file cannot be read.
        zutf-8)ÚencodingNzUnable to read file 'z': TÚrbzapplication/octet-streamÚ F)r   ÚsuffixÚlowerr   ÚopenÚreadrB   ÚFileNotFoundErrorÚPermissionErrorr   ÚUnicodeDecodeErrorr   Ú	mimetypesÚ
guess_typer	   ÚexistsÚget_instanceÚmedia_file_mgrÚaddr   Úsave_media_datar/   )r>   ÚprotoÚ	file_pathÚcoordinatesÚpathrY   ÚfÚeÚ	file_dataÚmimetypeÚ_Úfile_urls               r    rM   zIframeMixin._process_local_file„  sŒ  € ô2 �I‹ˆØ—‘×"Ñ"Ó$ˆàÔ%Ñ%ðÜ˜)¨gÔ6ð ,¸!Ø#$§6¡6£8�E”L÷,ð ð	Ü�i Ó&ð %¨!ØŸF™F›H�	÷%ô  ×*Ñ*¨9Ó5‰ˆ�!ä�>‰>ÔÜ×+Ñ+Ó-×<Ñ<×@Ñ@Ø˜8ÒAÐ'AÀ;óˆHô ×#Ñ#Ø˜8ÒAÐ'AÀ;ôð !ˆEŒIð ð ˆEŒIØ÷E,ð ûô "ÜÜÜ"ð	ò ô ,Ø+¨I¨;°c¸!¸Ð=óàðûðú÷%ð %ûä!¤?´GÐ<ò 	Ü'Ø'¨	 {°#°a°SÐ9óàðûð	úsd   ¯D ¼DÁD ÁE Á(E
Á9E ÄDÄD ÄD ÄEÄ0EÅEÅ
EÅE ÅFÅ*E<Å<Fc                ó   — t        d| «      S )zGet our DeltaGenerator.r   )r   )r>   s    r    r<   zIframeMixin.dgÇ  s   € ô Ð$ dÓ+Ð+r*   )NNF)r/   rL   r4   ú
int | Noner5   rr   r0   r&   r(   rr   Úreturnr   )rC   rL   r4   rr   r5   rr   r0   r&   r(   rr   rs   r   )
r/   z
str | Pathr4   ú#int | Literal['stretch', 'content']r5   rt   r(   rr   rs   r   )rg   r:   rh   rL   ri   rL   rs   r&   )rs   r   )
Ú__name__Ú
__module__Ú__qualname__r   r-   r@   r6   rM   Úpropertyr<   © r*   r    r,   r,   H   s˜  „ Ù�IÓð !Ø!ØðQUð !%ñQUàðQUð ðQUð ð	QUð
 ðQUð ðQUð 
òQUó ðQUñf �GÓð !Ø!ØðVUð !%ñVUàðVUð ðVUð ð	VUð
 ðVUð ðVUð 
òVUó ðVUñp �HÓð
 6?Ø6?Ø $ñKUàðKUð 3ð	KUð
 4ðKUð ðKUð 
òKUó ðKUðZAØ ðAØ-0ðAØ?BðAà	óAðF ò,ó ñ,r*   r,   c                ó`   — |�|| _         |�|| _        || _        t        |«       |�|| _        yy)a—  Marshalls data into an IFrame proto.

    These parameters correspond directly to <iframe> attributes, which are
    described in more detail at
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe.

    Parameters
    ----------
    proto : IFrame protobuf
        The protobuf object to marshall data into.
    src : str
        The URL of the page to embed.
    srcdoc : str
        Inline HTML to embed. Overrides src.
    scrolling : bool
        If true, show a scrollbar when the content is larger than the iframe.
        Otherwise, never show a scrollbar.
    tab_index : int, optional
        Specifies the tab order of the iframe.

    N)r/   rB   r0   r)   r(   )rg   r/   rB   r0   r(   s        r    r;   r;   Í  s>   € ð8 €ØˆŒ	àÐØˆŒà€E„Oä˜	Ô"ØÐØ#ˆ�ð r*   )r   rL   rs   r&   )r(   rr   rs   ÚNone)NNFN)rg   r:   r/   ú
str | NonerB   r|   r0   r&   r(   rr   rs   r{   )$Ú
__future__r   r`   Úpathlibr   Útypingr   r   r   r   Ú	streamlitr	   r
   Ú#streamlit.elements.lib.layout_utilsr   r   r   Ústreamlit.errorsr   Ústreamlit.proto.IFrame_pb2r   r:   Ústreamlit.runtimer   Ústreamlit.runtime.metrics_utilr   Ústreamlit.delta_generatorr   Ú	frozensetr   Ú__annotations__r   r!   r)   r,   r;   ry   r*   r    ú<module>r‰      s¹   ðö #ã Ý ß 6Ó 6ç '÷ñ õ
 3Ý <Ý %Ý 9áÝ8ñ $Ò$?Ó@Ð �%Ó @ð Ð �%Ó óó
÷B,ñ B,ðN ØØØ ð&$Øð&$à	ð&$ð ð&$ð ð	&$ð
 ð&$ð 
ô&$r*   