
    [i                        U d dl mZ d dlZd dlZd dlmZ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mZ d d	lmZ erd d
lmZ d dlmZ dZded<    G d d      Zy)    )annotationsN)TYPE_CHECKINGFinalcast)LayoutConfigWidthvalidate_width)NoSessionContext)Element)Spinner)add_script_run_ctxenqueue_message)
clean_text)Iterator)DeltaGeneratorg      ?r   
DELAY_SECSc                  d    e Zd Zej                  	 ddddd	 	 	 	 	 	 	 	 	 dd       Zed	d       Zy)
SpinnerMixinFcontent)	show_time_cachewidthc             #    K   t        |d       t        |      }t               }t        |      |_        ||_        ||_        t               }|j                  j                  |       	 | j                  j                  ||      \  }dt        j                         d}		 dfd}
t        j                  t         |
      }	t#        |	       |	j%                          d |	r|	j'                          5  dt)         |              ddd       y# t        $ r d Y yw xY w# 1 sw Y   yxY w# |	r|	j'                          5  dt)         |              ddd       w # 1 sw Y   w xY wxY 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.

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

            - ``"content"`` (default): The width of the element matches the
              width of its content, but doesn't exceed the width of the parent
              container.
            - ``"stretch"``: The width of the element matches the width of the
              parent container.
            - An integer specifying the width in pixels: The element has a
              fixed width. If the specified width is greater than the width of
              the parent container, the width of the element matches the width
              of the parent container.

        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

        T)allow_content)r   )layout_configNc                 X    5  rt                        d d d        y # 1 sw Y   y xY w)N)r   )create_transientdisplay_messagedisplay_message_locks   k/var/www/html/userprofiledev.eatanceapp.com/venv/lib/python3.12/site-packages/streamlit/elements/spinner.pyset_messagez)SpinnerMixin.spinner.<locals>.set_message   s!    )&'(8(:; *))s    )F)returnNone)r	   r   SpinnerProtor   textcacher   ElementProtospinnerCopyFromdg
_transientr
   	threadingLockTimerr   r   startcancelr   )selfr%   r   r   r   r   spinner_protoelement_protoclear_transienttimerr!   r   r   r   s              @@@r    r(   zSpinnerMixin.spinner+   sD    x 	uD1$51$'-$"+$&&}5	040B0B+ 1C 1-o (~~/(,	3< OOJ<Eu%KKM%"' 12 &%1   		0 &% %"' 12 &%%ss   A'E6- D E6&AD6 'E6;D*	E6D'$E6&D''E6*D3/E66E3E'	E3'E0,E33E6c                    t        d|       S )zGet our DeltaGenerator.r   )r   )r1   s    r    r*   zSpinnerMixin.dg   s     $d++    N)zIn progress...)
r%   strr   boolr   r9   r   r   r"   zIterator[None])r"   r   )__name__
__module____qualname__
contextlibcontextmanagerr(   propertyr*    r7   r    r   r   *   s|     %g3   g3g3 	g3
 g3 g3 
g3 g3R , ,r7   r   ) 
__future__r   r=   r,   typingr   r   r   #streamlit.elements.lib.layout_utilsr   r   r	   streamlit.errorsr
   streamlit.proto.Element_pb2r   r'   streamlit.proto.Spinner_pb2r   r$   streamlit.runtime.scriptrunnerr   r   streamlit.string_utilr   collections.abcr   streamlit.delta_generatorr   r   __annotations__r   r@   r7   r    <module>rL      sR    #   - - 
 . ? ? N ,(8 
E n, n,r7   