o
    h`                     @  sl   d dl mZ d dlZd dlZd dlmZ d dlZd dlm	Z	 er&d dl
mZ ej	dddddddZdS )    )annotationsN)TYPE_CHECKING)add_script_run_ctx)IteratorIn progress...F)	show_time_cachetextstrr   boolr   returnIterator[None]c                #  s   ddl m  ddlm t d}dt zG fdd}tt	||
  dV  W r_
 d	W d   n1 sFw   Y  d
tjjv rY  dS   dS dS r
 d	W d   n1 srw   Y  d
tjjv r  w   w w )a  Display a loading spinner while executing a block of code.

    Parameters
    ----------
    text : str
        The text to display next to the spinner. This defaults to
        ``"In progress..."``.

        The text can optionally contain GitHub-flavored Markdown. Syntax
        information can be found at: https://github.github.com/gfm.

        See the ``body`` parameter of |st.markdown|_ for additional, supported
        Markdown directives.

        .. |st.markdown| replace:: ``st.markdown``
        .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

    show_time : bool
        Whether to show the elapsed time next to the spinner text. If this is
        ``False`` (default), no time is displayed. If this is ``True``,
        elapsed time is displayed with a precision of 0.1 seconds. The time
        format is not configurable.

    Example
    -------
    >>> import streamlit as st
    >>> import time
    >>>
    >>> with st.spinner("Wait for it...", show_time=True):
    >>>     time.sleep(5)
    >>> st.success("Done!")
    >>> st.button("Rerun")

    .. output ::
        https://doc-spinner.streamlit.app/
        height: 210px

    r   )Spinner)
clean_textg      ?Tc                    sf   ' r!  } | _ | _| _d|  W d    d S W d    d S 1 s,w   Y  d S )Nspinner)r	   cacher   _enqueue)spinner_protoSpinnerProtor   r   display_messagedisplay_message_lockmessager   r	    N/var/www/vscode/kcb/lib/python3.10/site-packages/streamlit/elements/spinner.pyset_messageV   s   
"zspinner.<locals>.set_messageNFchat_message)streamlit.proto.Spinner_pb2r   streamlit.string_utilr   stempty	threadingLockr   Timerstartset
_active_dg_ancestor_block_types	container)r	   r   r   
DELAY_SECSr   r   r   r   r      s4   -	

r   )r   )r	   r
   r   r   r   r   r   r   )
__future__r   
contextlibr!   typingr   	streamlitr   streamlit.runtime.scriptrunnerr   collections.abcr   contextmanagerr   r   r   r   r   <module>   s   