Ë
    úmxibÇ  ã                  óR  — U d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZmZ d dlmZ d dlmc 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mZ d d
lmZ d dl m!Z! d dl"m#Z#m$Z$m%Z%m&Z&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z-m.Z. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4m5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ e
r4d dlAmBZB d dlCmDZDmEZE d dlFmGZG d dlHmIZI d dlJmKZK d dlLmMZM d dlNmOZO d dlPmQZQmRZR  eeS«      ZTd eUd!<    G d"„ d#e«      ZVd+d$„ZW G d%„ d&«      ZXd,d'„ZYd-d(„ZZd.d/d)„Z[d0d*„Z\y)1é    )ÚannotationsN)ÚEnum)ÚTYPE_CHECKINGÚAnyÚFinal)Ú	ParseDict)ÚconfigÚenv_utilÚruntime)Ú
get_logger)ÚClientState)ÚFileURLsÚFileURLsRequest)Ú
ForwardMsg)ÚGitInfo)ÚConfigÚCustomThemeConfigÚFontFaceÚ
NewSessionÚUserInfo)Úcaching)ÚForwardMsgQueue)ÚFragmentStorageÚMemoryFragmentStorage)ÚInstallation)ÚPagesManager)Ú	RerunDataÚScriptRunnerÚScriptRunnerEvent)Úsecrets_singleton)Úparse_fonts_with_source)Úto_snake_case)ÚSTREAMLIT_VERSION_STRING)ÚLocalSourcesWatcher)ÚCallable)ÚBackMsgÚDeferredFileRequest)Ú
ScriptData)ÚScriptCache)ÚUserInfoType©ÚSessionState)ÚUploadedFileManager)ÚPageHashÚPageInfor   Ú_LOGGERc                  ó   — e Zd ZdZdZdZy)ÚAppSessionStateÚAPP_NOT_RUNNINGÚAPP_IS_RUNNINGÚSHUTDOWN_REQUESTEDN)Ú__name__Ú
__module__Ú__qualname__r3   r4   r5   © ó    úT/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/runtime/app_session.pyr2   r2   C   s   „ Ø'€OØ%€NØ-Ñr:   r2   c                 ó<   — t        t        j                  «       «      S )z5Randomly generate a unique ID for a script execution.)ÚstrÚuuidÚuuid4r9   r:   r;   Ú_generate_scriptrun_idr@   I   s   € äŒt�z‰z‹|ÓÐr:   c                  óæ  — e Zd ZdZ	 d&	 	 	 	 	 	 	 	 	 	 	 	 	 d'd„Zd(d„Zd(d„Zd(d„Zd(d„Zd)d„Z	d(d	„Z
d*d
„Zd+d„Zd,d„Zd-d„Zd(d„Zd(d„Zd.d„Zed/d„«       Zd0d„Zd&d1d„Zd2d„Zd&d3d„Z	 	 	 	 	 	 d4	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d5d„Z	 	 	 	 	 	 d4	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d5d„Zd6d„Zd6d„Z	 	 d7	 	 	 	 	 	 	 d8d„Z	 	 	 	 d9d„Zd:d„Zd(d„Z	 d&	 	 	 d-d„Z d(d„Z!d(d „Z"d(d!„Z#d;d"„Z$d<d#„Z%d=d$„Z&	 	 	 	 	 	 d>d%„Z'y)?Ú
AppSessiona!  
    Contains session data for a single "user" of an active app
    (that is, a connected browser tab).

    Each AppSession has its own ScriptData, root DeltaGenerator, ScriptRunner,
    and widget state.

    An AppSession is attached to each thread involved in running its script.

    Nc                óÄ  — |xs t        t        j                  «       «      | _        t	        j
                  «       | _        || _        || _        || _	        t        |j                  | j                  «      | _        t        «       | _        || _        t         j"                  | _        t'        «       | _        d| _        d| _        d| _        t1        j2                  d«      dk7  r| j5                  «        t1        j2                  d«      | _        d| _        ddlm}  |«       | _        || _         d| _!        tE        «       | _#        tH        jK                  d| j                  «       y)aþ  Initialize the AppSession.

        Parameters
        ----------
        script_data
            Object storing parameters related to running a script

        uploaded_file_manager
            Used to manage files uploaded by users via the Streamlit web client.

        script_cache
            The app's ScriptCache instance. Stores cached user scripts. ScriptRunner
            uses the ScriptCache to avoid having to reload user scripts from disk
            on each rerun.

        message_enqueued_callback
            After enqueuing a message, this callable notification will be invoked.

        user_info
            A dict that contains information about the current user. For now,
            it only contains the user's email address.

            {
                "email": "example@example.com"
            }

            Information about the current user is optionally provided when a
            websocket connection is initialized via the "X-Streamlit-User" header.

        session_id_override
            The ID to assign to this session. Setting this can be useful when the
            service that a Streamlit Runtime is running in wants to tie the lifecycle of
            a Streamlit session to some other session-like object that it manages.
        Nzserver.fileWatcherTypeÚnonezserver.runOnSaver   r+   zAppSession initialized (id=%s))&r=   r>   r?   ÚidÚasyncioÚget_running_loopÚ_event_loopÚ_script_dataÚ_uploaded_file_mgrÚ_script_cacher   Úmain_script_pathÚ_pages_managerr   Ú_browser_queueÚ_message_enqueued_callbackr2   r3   Ú_stater   Ú_client_stateÚ_local_sources_watcherÚ_stop_config_listenerÚ_stop_pages_listenerr	   Ú
get_optionÚregister_file_watchersÚ_run_on_saveÚ_scriptrunnerÚstreamlit.runtime.stater,   Ú_session_stateÚ
_user_infoÚ_debug_last_backmsg_idr   Ú_fragment_storager0   Údebug)ÚselfÚscript_dataÚuploaded_file_managerÚscript_cacheÚmessage_enqueued_callbackÚ	user_infoÚsession_id_overrider,   s           r;   Ú__init__zAppSession.__init__Z   s!  € ðZ &Ò:¬¬T¯Z©Z«\Ó):ˆŒä"×3Ñ3Ó5ˆÔØ'ˆÔØ"7ˆÔØ)ˆÔÜ*Ø×(Ñ(¨$×*<Ñ*<ó
ˆÔô .Ó/ˆÔØ*CˆÔ'ä%×5Ñ5ˆŒô )›]ˆÔàBFˆÔ#Ø@DˆÔ"Ø?CˆÔ!ä×ÑÐ5Ó6¸&Ò@Ø×'Ñ'Ô)ä"×-Ñ-Ð.@ÓAˆÔà26ˆÔõ 	9á*›nˆÔØ#ˆŒà26ˆÔ#ä2GÓ2IˆÔä�‰Ð6¸¿¹Õ@r:   c                ó$   — | j                  «        y)zGEnsure that we call shutdown() when an AppSession is garbage collected.N)Úshutdown©r_   s    r;   Ú__del__zAppSession.__del__´   s   € à�‰�r:   c                ó8  — | j                   €t        | j                  «      | _         | j                   j                  | j                  «       t        j                  | j                  d¬«      | _        t        j                  j                  | j                  «       y)a4  Register handlers to be called when various files are changed.

        Files that we watch include:
          - source files that already exist (for edits)
          - `.py` files in the main script's `pages/` directory (for file additions
            and deletions)
          - project and user-level config.toml files
          - the project-level secrets.toml files

        This method is called automatically on AppSession construction, but it may be
        called again in the case when a session is disconnected and is being reconnect
        to.
        NT)Úforce_connect)rR   r$   rM   Úregister_file_change_callbackÚ_on_source_file_changedr	   Úon_config_parsedrS   r    Úfile_change_listenerÚconnectÚ_on_secrets_file_changedri   s    r;   rV   z!AppSession.register_file_watchers¸   s|   € ð ×&Ñ&Ð.Ü*=¸d×>QÑ>QÓ*RˆDÔ'à×#Ñ#×AÑAØ×(Ñ(ô	
ô &,×%<Ñ%<Ø×(Ñ(¸ô&
ˆÔ"ô 	×.Ñ.×6Ñ6°t×7TÑ7TÕUr:   c                ó<  — | j                   �| j                   j                  «        | j                  �| j                  «        | j                  �| j                  «        t        j
                  j                  | j                  «       d| _         d| _        d| _        y)zJDisconnect the file watcher handlers registered by register_file_watchers.N)rR   ÚcloserS   rT   r    rp   Ú
disconnectrr   ri   s    r;   Údisconnect_file_watchersz#AppSession.disconnect_file_watchersÑ   s‚   € à×&Ñ&Ð2Ø×'Ñ'×-Ñ-Ô/Ø×%Ñ%Ð1Ø×&Ñ&Ô(Ø×$Ñ$Ð0Ø×%Ñ%Ô'ä×.Ñ.×9Ñ9¸$×:WÑ:WÔXà&*ˆÔ#Ø%)ˆÔ"Ø$(ˆÕ!r:   c                ó€   — t        j                  | j                  «       t        j                  | j                  «       y)z×Clears session-level caches for this session.

        This should be called when a session is disconnected or shut down, since this
        ensures memory is freed up and resource release hooks are called.
        N)r   Úclear_session_data_cacherE   Úclear_session_resource_cacheri   s    r;   Úclear_session_cacheszAppSession.clear_session_cachesà   s(   € ô 	×(Ñ(¨¯©Ô1Ü×,Ñ,¨T¯W©WÕ5r:   c                ó6   — | j                   j                  «       S )ai  Clear the forward message queue and return the messages it contained.

        The Server calls this periodically to deliver new messages
        to the browser connected to this app.

        Returns
        -------
        list[ForwardMsg]
            The messages that were removed from the queue and should
            be delivered to the browser.

        )rN   Úflushri   s    r;   Úflush_browser_queuezAppSession.flush_browser_queueé   s   € ð ×"Ñ"×(Ñ(Ó*Ð*r:   c                ó"  — | j                   t        j                  k7  ròt        j	                  d| j
                  «       | j                  j                  | j
                  «       t        j                  «       rSt        j                  «       }|j                  j                  | j
                  «       |j                  j                  «        | j                  «        t        j                  | _         | j                  «        | j!                  «        yy)ziShut down the AppSession.

        It's an error to use a AppSession after it's been shut down.

        zShutting down (id=%s)N)rP   r2   r5   r0   r^   rE   rJ   Úremove_session_filesr   ÚexistsÚget_instanceÚmedia_file_mgrÚclear_session_refsÚremove_orphaned_filesÚrequest_script_stoprv   rz   )r_   Úrts     r;   rh   zAppSession.shutdownø   sÁ   € ð �;‰;œ/×<Ñ<Ò<Ü�M‰MÐ1°4·7±7Ô;ð ×#Ñ#×8Ñ8¸¿¹ÔAä�~‰~ÔÜ×)Ñ)Ó+�Ø×!Ñ!×4Ñ4°T·W±WÔ=Ø×!Ñ!×7Ñ7Ô9ð
 ×$Ñ$Ô&ä)×<Ñ<ˆDŒKð ×)Ñ)Ô+ð ×%Ñ%Õ'ð/ =r:   c                ó®   — | j                   r| j                   |_        | j                  j                  |«       | j                  r| j	                  «        yy)zöEnqueue a new ForwardMsg to our browser queue.

        This can be called on both the main thread and a ScriptRunner
        run thread.

        Parameters
        ----------
        msg : ForwardMsg
            The message to enqueue

        N)r\   Údebug_last_backmsg_idrN   ÚenqueuerO   ©r_   Úmsgs     r;   Ú_enqueue_forward_msgzAppSession._enqueue_forward_msg  sI   € ð ×&Ò&Ø(,×(CÑ(CˆCÔ%à×Ñ×#Ñ# CÔ(Ø×*Ò*Ø×+Ñ+Õ-ð +r:   c                ó4  — 	 |j                  d«      }|dk(  r9|j                  r|j                  | _        | j                  |j                  «       y|dk(  r| j                  «        y|dk(  r| j                  «        y|dk(  r| j                  «        y|dk(  r| j                  |j                  «       y|dk(  r| j                  «        y|dk(  r| j                  |j                  «       y|d	k(  rWt        j                  | j                  |j                   «      «      }|j#                  d
|j                   j$                  › �«       yt&        j)                  d|«       y# t*        $ r0}t&        j-                  d«       | j/                  |«       Y d}~yd}~ww xY w)zProcess a BackMsg.ÚtypeÚrerun_scriptÚload_git_infoÚclear_cacheÚapp_heartbeatÚset_run_on_saveÚstop_scriptÚfile_urls_requestÚdeferred_file_requestÚdeferred_file_zNo handler for "%s"zError processing back messageN)Ú
WhichOneofrˆ   r\   Ú_handle_rerun_script_requestr�   Ú_handle_git_information_requestÚ_handle_clear_cache_requestÚ_handle_app_heartbeat_requestÚ_handle_set_run_on_save_requestr“   Ú_handle_stop_script_requestÚ_handle_file_urls_requestr•   rF   Úcreate_taskÚ_handle_deferred_file_requestr–   Úset_nameÚfile_idr0   ÚwarningÚ	ExceptionÚ	exceptionÚhandle_backmsg_exception)r_   r‹   Úmsg_typeÚtaskÚexs        r;   Úhandle_backmsgzAppSession.handle_backmsg+  sb  € ð!	.Ø—~‘~ fÓ-ˆHØ˜>Ò)Ø×,Ò,Ø25×2KÑ2K�DÔ/à×1Ñ1°#×2BÑ2BÕCØ˜_Ò,Ø×4Ñ4Õ6Ø˜]Ò*Ø×0Ñ0Õ2Ø˜_Ò,Ø×2Ñ2Õ4ØÐ.Ò.Ø×4Ñ4°S×5HÑ5HÕIØ˜]Ò*Ø×0Ñ0Õ2ØÐ0Ò0Ø×.Ñ.¨s×/DÑ/DÕEØÐ4Ò4ô ×*Ñ*Ø×6Ñ6°s×7PÑ7PÓQó�ð —‘ ¨s×/HÑ/H×/PÑ/PÐ.QÐRÕSä—‘Ð 5°xÕ@øäò 	.Ü×ÑÐ=Ô>Ø×)Ñ)¨"×-Ñ-ûð	.úsI   ‚AE ÁE Á'E Á=E Â E Â4E Ã
 E Ã+AE ÅE Å	FÅ'&FÆFc                óF  ‡ ‡— ‰ j                  ‰ j                  t        j                  «       ‰ j                  ‰ j                  t        j                  d¬«       ‰ j                  ‰ j                  t        j                  «       ‰ j
                  j                  ˆˆ fd„«       y)zGHandle an Exception raised while processing a BackMsg from the browser.Ú )Úpage_script_hashc                 óD   •— ‰j                  ‰j                  ‰ «      «      S ©N)rŒ   Ú_create_exception_message)Úer_   s   €€r;   ú<lambda>z5AppSession.handle_backmsg_exception.<locals>.<lambda>j  s   ø€ �D×-Ñ-¨d×.LÑ.LÈQÓ.OÓP€ r:   N)Ú_on_scriptrunner_eventrX   r   ÚSCRIPT_STOPPED_WITH_SUCCESSÚSCRIPT_STARTEDrH   Úcall_soon_threadsafe)r_   r²   s   ``r;   r§   z#AppSession.handle_backmsg_exceptionP  sŠ   ù€ ð 	×#Ñ#Ø×ÑÔ 1× MÑ Mô	
ð 	×#Ñ#Ø×ÑÜ×,Ñ,Øð 	$ô 	
ð
 	×#Ñ#Ø×ÑÔ 1× MÑ Mô	
ð 	×Ñ×-Ñ-ÜPõ	
r:   c                ó^  — | j                   t        j                  k(  rt        j	                  d«       y|rç|j
                  }|r2| j                  j                  |«      st        j                  d|«       y|j                  d«      r/| j                  j                  j                  |j                  «       t        |j                  |j                  |j                   |j"                  |r|nd|j$                  t'        |j(                  «      |j                  ¬«      }n
t        «       }| j*                  �jt-        t/        j0                  d«      «      r.|j
                  s"| j*                  j3                  «        d| _        n| j*                  j5                  |«      }|ry| j7                  |«       y)aš  Signal that we're interested in running the script.

        If the script is not already running, it will be started immediately.
        Otherwise, a rerun will be requested.

        Parameters
        ----------
        client_state : streamlit.proto.ClientState_pb2.ClientState | None
            The ClientState protobuf to run the script with, or None
            to use previous client state.

        z'Discarding rerun request after shutdownNznThe fragment with id %s does not exist anymore - it might have been removed during a preceding full-app rerun.Úcontext_info)Úquery_stringÚwidget_statesr®   Ú	page_nameÚfragment_idÚis_auto_rerunÚcached_message_hashesr¹   zrunner.fastReruns)rP   r2   r5   r0   r¤   r½   r]   ÚcontainsÚinfoÚHasFieldrQ   r¹   ÚCopyFromr   rº   r»   r®   r¼   r¾   Úsetr¿   rX   Úboolr	   rU   Úrequest_stopÚrequest_rerunÚ_create_scriptrunner)r_   Úclient_stater½   Ú
rerun_dataÚsuccesss        r;   rÇ   zAppSession.request_rerunm  se  € ð �;‰;œ/×<Ñ<Ò<Ü�O‰OÐEÔFØáØ&×2Ñ2ˆKñ"  4×#9Ñ#9×#BÑ#BÀ;Ô#OÜ—‘ðTàôð
 à×$Ñ$ ^Ô4Ø×"Ñ"×/Ñ/×8Ñ8¸×9RÑ9RÔSä"Ø)×6Ñ6Ø*×8Ñ8Ø!-×!>Ñ!>Ø&×0Ñ0Ù+6™K¸DØ*×8Ñ8Ü&)¨,×*LÑ*LÓ&MØ)×6Ñ6ô	‰Jô #›ˆJà×ÑÐ)ä”V×&Ñ&Ð':Ó;Ô<Ø"×.Ò.ð ×"Ñ"×/Ñ/Ô1Ø%)�Õ"ð
 ×,Ñ,×:Ñ:¸:ÓF�ÙØð
 	×!Ñ! *Õ-r:   c                óR   — | j                   �| j                   j                  «        yy)zgRequest that the scriptrunner stop execution.

        Does nothing if no scriptrunner exists.
        N)rX   rÆ   ri   s    r;   r…   zAppSession.request_script_stopÁ  s'   € ð
 ×ÑÐ)Ø×Ñ×+Ñ+Õ-ð *r:   c                ó8   — | j                   j                  «        y)z%Clear the user info for this session.N)r[   Úclearri   s    r;   Úclear_user_infozAppSession.clear_user_infoÉ  s   € à�‰×ÑÕr:   c                ó|  — t        | j                  | j                  j                  | j                  | j
                  | j                  || j                  | j                  | j                  ¬«	      | _
        | j                  j                  j                  | j                  «       | j                  j                  «        y)z;Create and run a new ScriptRunner with the given RerunData.)	Ú
session_idrL   Úsession_stateÚuploaded_file_mgrrb   Úinitial_rerun_datard   Úfragment_storageÚpages_managerN)r   rE   rI   rL   rZ   rJ   rK   r[   r]   rM   rX   Úon_eventrq   r´   Ústart)r_   rÔ   s     r;   rÈ   zAppSession._create_scriptrunnerÍ  s�   € ä)Ø—w‘wØ!×.Ñ.×?Ñ?Ø×-Ñ-Ø"×5Ñ5Ø×+Ñ+Ø1Ø—o‘oØ!×3Ñ3Ø×-Ñ-ô

ˆÔð 	×Ñ×#Ñ#×+Ñ+¨D×,GÑ,GÔHØ×Ñ× Ñ Õ"r:   c                ó   — | j                   S r°   )rZ   ri   s    r;   rÒ   zAppSession.session_stateÝ  s   € à×"Ñ"Ð"r:   c                óª   ‡‡— | j                   j                  «       Št        t        ˆˆfd„‰«      d «      }|�| j                  j
                  }||k(  S y)Nc                ó   •— ‰|    d   ‰k(  S )NÚscript_pathr9   )ÚkÚfilepathÚpagess    €€r;   r³   z9AppSession._should_rerun_on_file_change.<locals>.<lambda>å  s   ø€ ˜U 1™X mÑ4¸Ñ@€ r:   T)rM   Ú	get_pagesÚnextÚfilterrQ   r®   )r_   rÞ   Úchanged_page_script_hashÚcurrent_page_script_hashrß   s    `  @r;   Ú_should_rerun_on_file_changez'AppSession._should_rerun_on_file_changeá  sY   ù€ Ø×#Ñ#×-Ñ-Ó/ˆä#'ÜÔ@À%ÓHØó$
Ð ð
 $Ð/Ø'+×'9Ñ'9×'JÑ'JÐ$Ø+Ð/GÑGÐGàr:   c                óî   — | j                   j                  «        |�| j                  |«      sy| j                  r| j	                  | j
                  «       y| j                  | j                  «       «       y)zfOne of our source files changed. Clear the cache and schedule a rerun if
        appropriate.
        N)rK   rÎ   rå   rW   rÇ   rQ   rŒ   Ú_create_file_change_message)r_   rÞ   s     r;   rn   z"AppSession._on_source_file_changedï  s`   € ð 	×Ñ× Ñ Ô"àÐ¨×(IÑ(IÈ(Ô(SØà×ÒØ×Ñ˜t×1Ñ1Õ2à×%Ñ% d×&FÑ&FÓ&HÕIr:   c                ó$   — | j                  «        y)z:Called when `secrets.file_change_listener` emits a Signal.N)rn   )r_   Ú_s     r;   rr   z#AppSession._on_secrets_file_changedý  s   € ð 	×$Ñ$Õ&r:   c                ó>   — | j                   j                  d|¬«       y )NT)Úretain_lifecycle_msgsÚfragment_ids_this_run)rN   rÎ   )r_   rì   s     r;   Ú_clear_queuezAppSession._clear_queue	  s!   € Ø×Ñ×!Ñ!Ø"&Ð>Sð 	"õ 	
r:   c	                ób   ‡ ‡‡‡‡‡‡‡‡— ‰ j                   j                  ˆˆˆˆˆˆˆˆ ˆf	d„«       y)a  Called when our ScriptRunner emits an event.

        This is generally called from the sender ScriptRunner's script thread.
        We forward the event on to _handle_scriptrunner_event_on_event_loop,
        which will be called on the main thread.
        c            
     ó4   •	— ‰j                  ‰‰‰‰‰ ‰‰‰«      S r°   )Ú(_handle_scriptrunner_event_on_event_loop)	rÉ   Úeventr¦   Úforward_msgrì   r®   rß   r_   Úsenders	   €€€€€€€€€r;   r³   z3AppSession._on_scriptrunner_event.<locals>.<lambda>   s*   ø€ �D×AÑAØØØØØØ Ø%Øó	€ r:   N)rH   r·   )	r_   ró   rñ   rò   r¦   rÉ   r®   rì   rß   s	   `````````r;   r´   z!AppSession._on_scriptrunner_event  s$   ÿø€ ð" 	×Ñ×-Ñ-÷	ó 	õ	
r:   c	                óˆ  — | j                   t        j                  «       k7  rt        d«      ‚|| j                  urt
        j                  d|«       y| j                  }	|t        j                  k(  r | j                  t        j                  k7  rt        j                  | _        |€t        d«      ‚|| j                  j                  k7  r|| j                  _        | j                  |«       | j!                  |||«      }
| j#                  |
«       �nÝ|t        j$                  t        j&                  t        j(                  hv �rj| j                  t        j                  k7  rt        j*                  | _        |t        j$                  k(  rt,        j.                  }n4|t        j(                  k(  rt,        j0                  }nt,        j2                  }| j#                  | j5                  |«      «       d| _        |t        j$                  t        j(                  hv rC| j8                  �rË| j8                  j;                  «        | j8                  j=                  «        �n•|€t        d«      ‚t-        «       }
t?        j@                  |
jB                  jD                  |«       | j#                  |
«       �nA|t        jF                  k(  rjt        j*                  | _        | j#                  | j5                  t,        jH                  «      «       | j8                  rß| j8                  j;                  «        nÄ|t        jJ                  k(  r€|€t        d«      ‚| j                  t        j                  k(  rGtM        jN                  «       jP                  jS                  | jT                  «       | jW                  «        || _        d| _        n1|t        jX                  k(  r|€t        d«      ‚| j#                  |«       |	t        j                  k(  }| j                  t        j                  k(  }||k7  r | j#                  | j[                  «       «       yy)a#  Handle a ScriptRunner event.

        This function must only be called on our eventloop thread.

        Parameters
        ----------
        sender : ScriptRunner | None
            The ScriptRunner that emitted the event. (This may be set to
            None when called from `handle_backmsg_exception`, if no
            ScriptRunner was active when the backmsg exception was raised.)

        event : ScriptRunnerEvent
            The event type.

        forward_msg : ForwardMsg | None
            The ForwardMsg to send to the frontend. Set only for the
            ENQUEUE_FORWARD_MSG event.

        exception : BaseException | None
            An exception thrown during compilation. Set only for the
            SCRIPT_STOPPED_WITH_COMPILE_ERROR event.

        client_state : streamlit.proto.ClientState_pb2.ClientState | None
            The ScriptRunner's final ClientState. Set only for the
            SHUTDOWN event.

        page_script_hash : str | None
            A hash of the script path corresponding to the page currently being
            run. Set only for the SCRIPT_STARTED event.

        fragment_ids_this_run : list[str] | None
            The fragment IDs of the fragments being executed in this script run. Only
            set for the SCRIPT_STARTED event. If this value is falsy, this script run
            must be for the full script.

        clear_forward_msg_queue : bool
            If set (the default), clears the queue of forward messages to be sent to the
            browser. Set only for the SCRIPT_STARTED event.
        zrThis function must only be called on the eventloop thread the AppSession was created on. This should never happen.z0Ignoring event from non-current ScriptRunner: %sNzTpage_script_hash must be set for the SCRIPT_STARTED event. This should never happen.z`exception must be set for the SCRIPT_STOPPED_WITH_COMPILE_ERROR event. This should never happen.zJclient_state must be set for the SHUTDOWN event. This should never happen.zHnull forward_msg in ENQUEUE_FORWARD_MSG event. This should never happen.).rH   rF   rG   ÚRuntimeErrorrX   r0   r^   rP   r   r¶   r2   r5   r4   rQ   r®   rí   Ú_create_new_session_messagerŒ   rµ   Ú!SCRIPT_STOPPED_WITH_COMPILE_ERRORÚFRAGMENT_STOPPED_WITH_SUCCESSr3   r   ÚFINISHED_SUCCESSFULLYÚ"FINISHED_FRAGMENT_RUN_SUCCESSFULLYÚFINISHED_WITH_COMPILE_ERRORÚ_create_script_finished_messager\   rR   Úupdate_watched_modulesÚupdate_watched_pagesÚexception_utilsÚmarshallÚsession_eventÚscript_compilation_exceptionÚSCRIPT_STOPPED_FOR_RERUNÚFINISHED_EARLY_FOR_RERUNÚSHUTDOWNr   r�   r‚   rƒ   rE   rz   ÚENQUEUE_FORWARD_MSGÚ&_create_session_status_changed_message)r_   ró   rñ   rò   r¦   rÉ   r®   rì   rß   Ú
prev_stater‹   ÚstatusÚapp_was_runningÚapp_is_runnings                 r;   rð   z3AppSession._handle_scriptrunner_event_on_event_loop,  s˜  € ðf ×Ñœw×7Ñ7Ó9Ò9Üð,óð ð
 ˜×+Ñ+Ñ+ô �M‰MÐLÈeÔTØà—[‘[ˆ
àÔ%×4Ñ4Ò4Ø�{‰{œo×@Ñ@Ò@Ü-×<Ñ<�”ØÐ'Ü"Øjóð ð   4×#5Ñ#5×#FÑ#FÒFØ6F�×"Ñ"Ô3à×ÑÐ3Ô4à×2Ñ2Ø Ð"7¸óˆCð ×%Ñ% cÖ*àÜ×9Ñ9Ü×?Ñ?Ü×;Ñ;ð
ò 
ð
 �{‰{œo×@Ñ@Ò@Ü-×=Ñ=�”àÔ)×EÑEÒEÜ#×9Ñ9‘ØÔ+×IÑIÒIÜ#×FÑF‘ä#×?Ñ?�à×%Ñ% d×&JÑ&JÈ6Ó&RÔSØ*.ˆDÔ'àÜ!×=Ñ=Ü!×?Ñ?ðñ ð ×.Ó.Ø×/Ñ/×FÑFÔHØ×/Ñ/×DÑDÖFð Ð$Ü&ð4óð ô !“l�Ü×(Ñ(Ø×%Ñ%×BÑBÀIôð ×)Ñ)¨#Ö.àÔ'×@Ñ@Ò@Ü)×9Ñ9ˆDŒKØ×%Ñ%Ø×4Ñ4Ü×7Ñ7óôð
 ×*Ò*Ø×+Ñ+×BÑBÕDàÔ'×0Ñ0Ò0ØÐ#Ü"Ø`óð ð �{‰{œo×@Ñ@Ò@ô ×$Ñ$Ó&×5Ñ5×HÑHÈÏÉÔQØ×)Ñ)Ô+à!-ˆDÔØ!%ˆDÕàÔ'×;Ñ;Ò;ØÐ"Ü"Ø^óð ð ×%Ñ% kÔ2ð %¬×(FÑ(FÑFˆØŸ™¬×(FÑ(FÑFˆØ˜_Ò,Ø×%Ñ% d×&QÑ&QÓ&SÕTð -r:   c                ó¨   — t        «       }| j                  |j                  _        | j                  t
        j                  k(  |j                  _        |S )z6Create and return a session_status_changed ForwardMsg.)r   rW   Úsession_status_changedÚrun_on_saverP   r2   r4   Úscript_is_runningrŠ   s     r;   r  z1AppSession._create_session_status_changed_message×  sD   € ä‹lˆØ15×1BÑ1Bˆ×"Ñ"Ô.à�K‰Kœ?×9Ñ9Ñ9ð 	×"Ñ"Ô4ð ˆ
r:   c                ó<   — t        «       }d|j                  _        |S )z8Create and return a 'script_changed_on_disk' ForwardMsg.T)r   r  Úscript_changed_on_diskrŠ   s     r;   rç   z&AppSession._create_file_change_messageà  s   € ä‹lˆØ37ˆ×ÑÔ0Øˆ
r:   c                óJ  — t        «       }t        «       |j                  _        | j                  j
                  |j                  _        | j                  j                  |j                  _        | j                  j                  |j                  _        ||j                  _	        |r%|j                  j                  j                  |«       | j                  |j                  |xs | j                  j                  «       «       t        |j                  j                  «       t!        |j                  j"                  «       t!        |j                  j"                  j$                  dt        j&                  j(                  j*                  › �«       t!        |j                  j"                  j,                  dt        j&                  j.                  j*                  › �«       t!        |j                  j"                  j0                  dt        j&                  j2                  j*                  › �«       t!        |j                  j"                  j$                  j0                  dt        j&                  j4                  j*                  › �«       t!        |j                  j"                  j,                  j0                  dt        j&                  j6                  j*                  › �«       |j                  j8                  }t;        |j<                  «       t>        |j@                  _!        djE                  tG        tH        tJ        jL                  «      «      |j@                  _'        tP        jR                  |j@                  _*        dtV        jX                  v xs dtV        jX                  v |j@                  _-        | j\                  |j^                  _0        | jb                  td        jf                  k(  |j^                  _4        | j                  jj                  |_5        | jl                  |_7        |S )z+Create and return a new_session ForwardMsg.ztheme.ú.ÚDISPLAYÚWAYLAND_DISPLAY)8r   r@   Únew_sessionÚscript_run_idrI   ÚnamerM   rL   Úmain_script_hashr®   rì   ÚextendÚ_populate_app_pagesrà   Ú_populate_config_msgr	   Ú_populate_theme_msgÚcustom_themeÚlightÚCustomThemeCategoriesÚLIGHTÚvalueÚdarkÚDARKÚsidebarÚSIDEBARÚLIGHT_SIDEBARÚDARK_SIDEBARÚ
initializeÚ_populate_user_info_msgrd   r#   Úenvironment_infoÚstreamlit_versionÚjoinÚmapr=   ÚsysÚversion_infoÚpython_versionr
   ÚSYSTEMÚ	server_osÚosÚenvironÚhas_displayrW   Úsession_statusr  rP   r2   r4   r  Úis_hellorE   rÑ   )r_   r®   rì   rß   r‹   Úimsgs         r;   rö   z&AppSession._create_new_session_messageæ  sî  € ô ‹lˆä(>Ó(@ˆ�‰Ô%Ø#×0Ñ0×5Ñ5ˆ�‰ÔØ+/×+>Ñ+>×+OÑ+Oˆ�‰Ô(Ø+/×+>Ñ+>×+OÑ+Oˆ�‰Ô(Ø+;ˆ�‰Ô(á Ø�O‰O×1Ñ1×8Ñ8Ð9NÔOà× Ñ Ø�O‰O˜UÒE d×&9Ñ&9×&CÑ&CÓ&Eô	
ô 	˜SŸ_™_×3Ñ3Ô4ô 	˜CŸO™O×8Ñ8Ô9äØ�O‰O×(Ñ(×.Ñ.Ø”V×1Ñ1×7Ñ7×=Ñ=Ð>Ð?ô	
ô
 	Ø�O‰O×(Ñ(×-Ñ-Ø”V×1Ñ1×6Ñ6×<Ñ<Ð=Ð>ô	
ô
 	Ø�O‰O×(Ñ(×0Ñ0Ø”V×1Ñ1×9Ñ9×?Ñ?Ð@ÐAô	
ô
 	Ø�O‰O×(Ñ(×.Ñ.×6Ñ6Ø”V×1Ñ1×?Ñ?×EÑEÐFÐGô	
ô
 	Ø�O‰O×(Ñ(×-Ñ-×5Ñ5Ø”V×1Ñ1×>Ñ>×DÑDÐEÐFô	
ð �‰×)Ñ)ˆä §¡Ô/ä2Jˆ×ÑÔ/Ø/2¯x©x¼¼CÄ×AQÑAQÓ8RÓ/Sˆ×ÑÔ,Ü*2¯/©/ˆ×ÑÔ'àœŸ™Ð#ÒFÐ'8¼B¿J¹JÐ'Fð 	×ÑÔ)ð +/×*;Ñ*;ˆ×ÑÔ'à�K‰Kœ?×9Ñ9Ñ9ð 	×ÑÔ-ð ×)Ñ)×2Ñ2ˆŒØŸ'™'ˆŒàˆ
r:   c                ó(   — t        «       }||_        |S )z/Create and return a script_finished ForwardMsg.)r   Úscript_finished)r_   r	  r‹   s      r;   rü   z*AppSession._create_script_finished_message3  s   € ô ‹lˆØ$ˆÔØˆ
r:   c                ó‚   — t        «       }t        j                  |j                  j                  j
                  |«       |S )z*Create and return an Exception ForwardMsg.)r   rÿ   r   ÚdeltaÚnew_elementr¦   )r_   r²   r‹   s      r;   r±   z$AppSession._create_exception_message;  s.   € ä‹lˆÜ× Ñ  §¡×!6Ñ!6×!@Ñ!@À!ÔDØˆ
r:   c                óº  — t        «       }	 ddlm}  || j                  j                  «      }|j                  «       }|€y |\  }}}|j                  d«      }||j                  _        ||j                  _	        ||j                  _
        |j                  xs g |j                  j                  d d  |j                  xs g |j                  j                  d d  |j                  r*t        j                  j                   |j                  _        nw|j$                  rBt'        |j$                  «      dkD  r*t        j                  j(                  |j                  _        n)t        j                  j*                  |j                  _        t,        j/                  d|||«       | j1                  |«       y # t2        $ r!}t,        j/                  d|¬«       Y d }~y d }~ww xY w)Nr   )ÚGitRepoz.gitz7Git information found. Name: %s, Branch: %s, Module: %sz+Obtaining Git information produced an error©Úexc_info)r   Ústreamlit.git_utilr@  rI   rL   Úget_repo_infoÚremovesuffixÚgit_info_changedÚ
repositoryÚbranchÚmoduleÚuntracked_filesÚuncommitted_filesÚis_head_detachedr   Ú	GitStatesÚHEAD_DETACHEDÚstateÚahead_commitsÚlenÚAHEAD_OF_REMOTEÚDEFAULTr0   r^   rŒ   r¥   )	r_   r‹   r@  ÚrepoÚ	repo_infoÚrepository_namerH  rI  rª   s	            r;   rš   z*AppSession._handle_git_information_requestA  s‹  € Ü‹lˆð%	VÝ2á˜4×,Ñ,×=Ñ=Ó>ˆDà×*Ñ*Ó,ˆIØÐ Øà.7Ñ+ˆO˜V Và-×:Ñ:¸6ÓBˆOà.=ˆC× Ñ Ô+Ø*0ˆC× Ñ Ô'Ø*0ˆC× Ñ Ô'à6:×6JÑ6JÒ6PÈbˆC× Ñ ×0Ñ0±Ð3Ø8<×8NÑ8NÒ8TÐRTˆC× Ñ ×2Ñ2±1Ð5à×$Ò$Ü-4×->Ñ->×-LÑ-L�×$Ñ$Õ*Ø×#Ò#¬¨D×,>Ñ,>Ó(?À!Ò(CÜ-4×->Ñ->×-NÑ-N�×$Ñ$Õ*ä-4×->Ñ->×-FÑ-F�×$Ñ$Ô*ä�M‰MØIØØØô	ð ×%Ñ% cÕ*øÜò 	Vô �M‰MÐGÐRTˆM×UÑUûð	Vús   Œ4F0 ÁE.F0 Æ0	GÆ9GÇGc                ó&   — | j                  |«       y)a  Tell the ScriptRunner to re-run its script.

        Parameters
        ----------
        client_state : streamlit.proto.ClientState_pb2.ClientState | None
            The ClientState protobuf to run the script with, or None
            to use previous client state.

        N)rÇ   )r_   rÉ   s     r;   r™   z'AppSession._handle_rerun_script_requestk  s   € ð 	×Ñ˜<Õ(r:   c                ó$   — | j                  «        y)z1Tell the ScriptRunner to stop running its script.N)r…   ri   s    r;   rž   z&AppSession._handle_stop_script_requesty  s   € à× Ñ Õ"r:   c                ó°   — t         j                  j                  «        t         j                  j                  «        | j                  j                  «        y)zjClear this app's cache.

        Because this cache is global, it will be cleared for all users.

        N)r   Ú
cache_datarÎ   Úcache_resourcerZ   ri   s    r;   r›   z&AppSession._handle_clear_cache_request}  s:   € ô 	×Ñ× Ñ Ô"Ü×Ñ×$Ñ$Ô&Ø×Ñ×!Ñ!Õ#r:   c                 ó   — y)zÑHandle an incoming app heartbeat.

        The heartbeat indicates the frontend is active and keeps the
        websocket from going idle and disconnecting.

        The actual handler here is a noop

        Nr9   ri   s    r;   rœ   z(AppSession._handle_app_heartbeat_request‡  s   € ð 	r:   c                óP   — || _         | j                  | j                  «       «       y)zÐChange our run_on_save flag to the given value.

        The browser will be notified of the change.

        Parameters
        ----------
        new_value : bool
            New run_on_save value

        N)rW   rŒ   r  )r_   Ú	new_values     r;   r�   z*AppSession._handle_set_run_on_save_request’  s#   € ð &ˆÔØ×!Ñ! $×"MÑ"MÓ"OÕPr:   c                ó|  — t        «       }|j                  |j                  _        | j                  j                  | j                  |j                  «      }|D ]Q  }|j                  j                  j                  t        |j                  |j                  |j                  ¬«      «       ŒS | j                  |«       y)z6Handle a file_urls_request BackMsg sent by the client.)r£   Ú
upload_urlÚ
delete_urlN)r   Ú
request_idÚfile_urls_responseÚresponse_idrJ   Úget_upload_urlsrE   Ú
file_namesÚ	file_urlsÚappendr   r£   r`  ra  rŒ   )r_   r•   r‹   Úupload_url_infosÚupload_url_infos        r;   rŸ   z$AppSession._handle_file_urls_request   s¢   € ä‹lˆØ->×-IÑ-Iˆ×ÑÔ*à×2Ñ2×BÑBØ�G‰GÐ&×1Ñ1ó
Ðð  0ò 	ˆOØ×"Ñ"×,Ñ,×3Ñ3ÜØ+×3Ñ3Ø.×9Ñ9Ø.×9Ñ9ôõð	ð 	×!Ñ! #Õ&r:   c              ƒ  óÜ  K  — t        «       }|j                  |j                  _        	 t        j                  t        j                  «       j                  j                  |j                  «      ƒ d{  –—† }||j                  _	        | j                  |«       y7 Œ'# t        $ rD}t        j                  d|j                  «       t        |«      |j                  _        Y d}~Œ\d}~ww xY w­w)zúHandle a deferred_file_request BackMsg sent by the client.

        Execute the deferred callable in a separate thread and send the URL back
        to the frontend. This prevents blocking the main event loop if the callable
        is slow.
        Nz0Error executing deferred callable for file_id %s)r   r£   Údeferred_file_responserF   Ú	to_threadr   r�   r‚   Úexecute_deferredÚurlr¥   r0   r¦   r=   Ú	error_msgrŒ   )r_   ÚrequestÚresponsero  r²   s        r;   r¡   z(AppSession._handle_deferred_file_request´  sÀ   è ø€ ô “<ˆØ29·/±/ˆ×'Ñ'Ô/ð	?ô  ×)Ñ)Ü×$Ñ$Ó&×5Ñ5×FÑFØ—‘ó÷ ˆCð 36ˆH×+Ñ+Ô/ð 	×!Ñ! (Õ+ðùô
 ò 	?ä×ÑØBÀGÇOÁOôô 9<¸A»ˆH×+Ñ+×5Ñ5ûð	?üsA   ‚&C,©A	B Á2BÁ3B ÂC,ÂB Â	C)Â%:C$ÃC,Ã$C)Ã)C,c                óÒ   — |j                  «       D ]T  \  }}|j                  j                  «       }||_        |d   j	                  dd«      |_        |d   |_        |d   |_        ŒV y )Nr¼   ré   ú Úicon)ÚitemsÚ	app_pagesÚaddr®   Úreplacer¼   Úurl_pathnameru  )r_   r‹   rß   r®   Ú	page_infoÚ
page_protos         r;   r  zAppSession._populate_app_pagesÐ  sl   € ð ,1¯;©;«=ò 	0Ñ'Ð˜iØŸ™×*Ñ*Ó,ˆJà*:ˆJÔ'Ø#,¨[Ñ#9×#AÑ#AÀ#ÀsÓ#KˆJÔ Ø&/°Ñ&<ˆJÔ#Ø'¨Ñ/ˆJ�Oñ	0r:   r°   )r`   r(   ra   r-   rb   r)   rc   zCallable[[], None] | Nonerd   r*   re   ú
str | NoneÚreturnÚNone)r~  r  )r~  zlist[ForwardMsg])r‹   r   r~  r  )r‹   r&   r~  r  )r²   ÚBaseExceptionr~  r  )rÉ   úClientState | Noner~  r  )rÔ   r   r~  r  )r~  r,   )rÞ   r=   r~  rÅ   )rÞ   r}  r~  r  )ré   r   r~  r  )rì   úlist[str] | Noner~  r  )NNNNNN)ró   zScriptRunner | Nonerñ   r   rò   zForwardMsg | Noner¦   zBaseException | NonerÉ   r�  r®   r}  rì   r‚  rß   údict[PageHash, PageInfo] | Noner~  r  )r~  r   )NN)r®   r=   rì   r‚  rß   rƒ  r~  r   )r	  z)ForwardMsg.ScriptFinishedStatus.ValueTyper~  r   )r²   r€  r~  r   )r^  rÅ   r~  r  )r•   r   r~  r  )rq  r'   r~  r  )r‹   r   rß   zdict[PageHash, PageInfo]r~  r  )(r6   r7   r8   Ú__doc__rf   rj   rV   rv   rz   r}   rh   rŒ   r«   r§   rÇ   r…   rÏ   rÈ   ÚpropertyrÒ   rå   rn   rr   rí   r´   rð   r  rç   rö   rü   r±   rš   r™   rž   r›   rœ   r�   rŸ   r¡   r  r9   r:   r;   rB   rB   N   s†  „ ñ	ð$ +/ðXAàðXAð  3ðXAð "ð	XAð
 $=ðXAð  ðXAð (ðXAð 
óXAótóVó2)ó6ó+ó(ó>.ó(#.óJ
ó:R.óh.ó ó#ð  ò#ó ð#óôJó
'ô
ð *.Ø*.Ø+/Ø'+Ø26Ø15ð
à#ð
ð !ð
ð 'ð	
ð
 (ð
ð )ð
ð %ð
ð  0ð
ð /ð
ð 
ó
ðD *.Ø*.Ø+/Ø'+Ø26Ø15ðiUà#ðiUð !ðiUð 'ð	iUð
 (ðiUð )ðiUð %ðiUð  0ðiUð /ðiUð 
óiUóVóð 37Ø15ð	KàðKð  0ðKð /ð	Kð
 
óKðZØ?ðà	óóó(VðV 26ð)Ø.ð)à	ó)ó#ó$ó	óQó'ó(,ð8	0Øð	0Ø&>ð	0à	ô	0r:   rB   c                 ó  — d} t        j                  | «      }t        t        j                  |j                  «       «      }|€Hdj                  d„ t        j                  j                  «       D «       «      }t        d| ›d|› d|› �«      ‚|S )Nzclient.toolbarModez, c              3  ó<   K  — | ]  }|j                  «       –— Œ y ­wr°   )Úlower)Ú.0rÝ   s     r;   ú	<genexpr>z$_get_toolbar_mode.<locals>.<genexpr>è  s   è ø€ Ò"P° 1§7¡7§9Ñ"Pùs   ‚zConfig z. expects to have one of the following values: z. Current value: )	r	   rU   Úgetattrr   ÚToolbarModeÚupperr-  ÚkeysÚ
ValueError)Ú
config_keyÚconfig_valueÚ
enum_valueÚallowed_valuess       r;   Ú_get_toolbar_moder”  á  s–   € Ø%€JÜ×$Ñ$ ZÓ0€LÜ6=Ü×Ñ˜L×.Ñ.Ó0ó7€Jð ÐØŸ™Ñ"P´f×6HÑ6H×6MÑ6MÓ6OÔ"PÓPˆÜØ�j�^ð $%Ø%3Ð$4ð 5Ø*˜^ð-ó
ð 	
ð
 Ðr:   c                ó.  — t        j                  d«      | _        t        j                  d«      | _        t        j                  d«      | _        t        j                  d«      | _        t        j                  d«      du rd| _        t        «       | _        y )Nzbrowser.gatherUsageStatszglobal.maxCachedMessageAgezserver.allowRunOnSavezui.hideTopBarzclient.showSidebarNavigationFT)	r	   rU   Úgather_usage_statsÚmax_cached_message_ageÚallow_run_on_saveÚhide_top_barÚhide_sidebar_navr”  Útoolbar_mode)r‹   s    r;   r  r  ñ  sx   € Ü#×.Ñ.Ð/IÓJ€CÔÜ!'×!2Ñ!2Ð3OÓ!P€CÔÜ"×-Ñ-Ð.EÓF€CÔÜ×(Ñ(¨Ó9€CÔÜ×ÑÐ7Ó8¸EÑAØ#ˆÔÜ(Ó*€CÕr:   c           	     ó^  — t        j                  |«      }t        d„ |j                  «       D «       «      ry |j	                  «       D ]#  \  }}|dvsŒ|€Œt        | t        |«      |«       Œ% | j                  j                  | j                  j                  dœ}|j                  dd «      }|�=||vr/t        j                  d|t        |j                  «       «      «       n
||   | _        t!        | |j                  dd «      |j                  dd «      |j                  dd «      |«      } |j                  d	d «      }t#        |t$        «      r	 t'        j(                  |«      }|�M|D ]H  }		 d|	v rt%        |	d   «      |	d<   |	d= | j,                  j/                  t1        |	t3        «       «      «       ŒJ |j                  dd «      }
t#        |
t$        «      rL|
j5                  «       j7                  «       }
|
j9                  d«      r|
gdz  }
n	 t'        j(                  |
«      }
|
�J|
rt;        |
«      dkD  rt=        dt;        |
«      › �«      ‚|
D ]  }	 | j>                  j/                  |«       Œ  |j                  dd «      }t#        |t$        «      r	 t'        j(                  |«      }t#        |t@        «      r-tC        dd«      D ]  }| jD                  j/                  |«       Œ nrt#        |t        «      rb|rt;        |«      dkD  rt=        dt;        |«      › �«      ‚|d d dgdt;        |«      z
  z  z   }|D ]  }	 | jD                  j/                  |«       Œ  |j                  dd «      }t#        |t$        «      r	 t'        j(                  |«      }|�#|D ]  }	 | jH                  j/                  |«       Œ  |j                  dd «      }t#        |t$        «      r	 t'        j(                  |«      }|�Qt;        |«      d k7  rt        jK                  d!t;        |«      «       |D ]  }	 | jL                  j/                  |«       Œ  y y # t*        $ r%}t        j                  d
||¬«       d }Y d }~�Œd }~ww xY w# t*        $ r#}t        j                  d|	|¬«       Y d }~�Œ-d }~ww xY w# t*        $ r%}t        j                  d|
|¬«       d }
Y d }~�Œ¥d }~ww xY w# t*        $ r#}t        j                  d||¬«       Y d }~�Œ©d }~ww xY w# t*        $ r%}t        j                  d||¬«       d }Y d }~�Œ�d }~ww xY w# t*        $ r#}t        j                  d||¬«       Y d }~�Œ"d }~ww xY w# t&        jF                  $ r%}t        j                  d||¬«       d }Y d }~�Œd }~ww xY w# t*        $ r#}t        j                  d||¬«       Y d }~�Œ/d }~ww xY w# t&        jF                  $ r%}t        j                  d||¬«       d }Y d }~�Œd }~ww xY w# t*        $ r#}t        j                  d||¬«       Y d }~�Œd }~ww xY w)"Nc              3  ó$   K  — | ]  }|d u –— Œ
 y ­wr°   r9   )r‰  Úvals     r;   rŠ  z&_populate_theme_msg.<locals>.<genexpr>ý  s   è ø€ Ò
6˜3ˆ3�$Œ;Ñ
6ùs   ‚>	   ÚbaseÚfontÚcodeFontÚ	fontFacesÚheadingFontÚheadingFontSizesÚheadingFontWeightsÚchartSequentialColorsÚchartCategoricalColors)r  r#  rŸ  zb"%s" is an invalid value for theme.base. Allowed values include %s. Setting theme.base to "light".r   r¡  r£  r¢  zFFailed to parse the theme.fontFaces config option with json.loads: %s.rA  ÚweightÚweight_rangez6Failed to parse the theme.fontFaces config option: %s.r¤  )ÚpxÚremé   zMFailed to parse the theme.headingFontSizes config option with json.loads: %s.zUConfig theme.headingFontSizes should have 1-6 values corresponding to h1-h6, but got z=Failed to parse the theme.headingFontSizes config option: %s.r¥  zOFailed to parse the theme.headingFontWeights config option with json.loads: %s.é   é   zWConfig theme.headingFontWeights should have 1-6 values corresponding to h1-h6, but got iX  z?Failed to parse the theme.headingFontWeights config option: %s.r§  zCFailed to parse the theme.chartCategoricalColors config option: %s.r¦  zBFailed to parse the theme.chartSequentialColors config option: %s.é
   zuConfig theme.chartSequentialColors should have 10 color values, but got %s. Defaulting to Streamlit's default colors.)'r	   Úget_options_for_sectionÚallÚvaluesrv  Úsetattrr"   Ú	BaseThemer!  r$  Úgetr0   r¤   ÚlistrŽ  rŸ  r!   Ú
isinstancer=   ÚjsonÚloadsr¥   Ú
font_facesrh  r   r   Ústriprˆ  ÚendswithrQ  r�  Úheading_font_sizesÚintÚrangeÚheading_font_weightsÚJSONDecodeErrorÚchart_categorical_colorsÚerrorÚchart_sequential_colors)r‹   ÚsectionÚ
theme_optsÚoption_nameÚ
option_valÚbase_maprŸ  rº  r²   Ú	font_facer½  ÚsizerÀ  ré   Úheading_weightsr¨  rÂ  ÚcolorrÄ  s                      r;   r  r  û  su  € Ü×/Ñ/°Ó8€JÜ
Ñ
6 *×"3Ñ"3Ó"5Ô
6Ô6Øà#-×#3Ñ#3Ó#5ò AÑˆ�Zð ð
òð Ñ&ä�Cœ {Ó3°ZÕ@ð%Að2 —‘×$Ñ$Ø—‘×"Ñ"ñ€Hð �>‰>˜& $Ó'€DØÐØ�xÑÜ�O‰Oð1àÜ�X—]‘]“_Ó%õ	ð   ‘~ˆCŒHô "ØØ�‰�v˜tÓ$Ø�‰�z 4Ó(Ø�‰�} dÓ+Øó€Cð —‘ ¨TÓ2€Jô �*œcÔ"ð	ÜŸ™ JÓ/ˆJð ÐØ#ò 	ˆIð
Ø˜yÑ(Ü03°I¸hÑ4GÓ0H�I˜nÑ-Ø! (Ð+Ø—‘×%Ñ%¤i°	¼8»:Ó&FÕGð	ð $Ÿ™Ð(:¸DÓAÐô
 Ð$¤cÔ*Ø/×5Ñ5Ó7×=Ñ=Ó?ÐØ×&Ñ& }Ô5à"4Ð!5¸Ñ!9Ñð*Ü%)§Z¡ZÐ0BÓ%CÐ"ð Ð%á!¤SÐ);Ó%<¸qÒ%@ÜðÜÐ1Ó2Ð3ð5óð ð 'ò 	ˆDðØ×&Ñ&×-Ñ-¨dÕ3ð	ð &Ÿ>™>Ð*>ÀÓEÐô Ð&¬Ô,ð	(Ü#'§:¡:Ð.BÓ#CÐ ô Ð&¬Ô,ä�q˜!“ò 	BˆAØ×$Ñ$×+Ñ+Ð,@ÕAñ	Bä	Ð(¬$Ô	/á#¤sÐ+?Ó'@À1Ò'DÜðÜÐ3Ó4Ð5ð7óð ð
 /¨r°Ð2°c°UØ”Ð(Ó)Ñ)ñ6
ñ 
ˆð &ò 	ˆFðØ×(Ñ(×/Ñ/°Õ7ð	ð  *Ÿ~™~Ð.FÈÓMÐô Ð*¬CÔ0ð	,Ü'+§z¡zÐ2JÓ'KÐ$ð  Ð+Ø-ò 	ˆEðØ×,Ñ,×3Ñ3°EÕ:ð	ð )Ÿn™nÐ-DÀdÓKÐô Ð)¬3Ô/ð	+Ü&*§j¡jÐ1HÓ&IÐ#ð Ð*äÐ&Ó'¨2Ò-Ü�M‰MðHäÐ+Ó,ôð
 -ò 	ˆEðØ×+Ñ+×2Ñ2°5Õ9ñ	ð +øô_ ò 	Ü�O‰OØXØØð ô ð
 ŽJûð	ûô ò Ü—‘ØLØØð  ÷ ò ûðûô* ò *Ü—‘ØcØ&Øð  ô ð
 &*Ö"ûð*ûô$ ò Ü—‘ØSØØð  ÷ ò ûðûô ò 	(Ü�O‰OØaØ$Øð ô ð
 $(Ö ûð	(ûô6 ò Ü—‘ØUØØð  ÷ ò ûðûô ×#Ñ#ò 	,Ü�O‰OØUØ(Øð ô ð
 (,Ö$ûð	,ûô ò Ü—‘ØYØØð  ÷ ò ûðûô ×#Ñ#ò 	+Ü�O‰OØTØ'Øð ô ð
 '+Ö#ûð	+ûô& ò Ü—‘ØXØØð  ÷ ò ûðúsñ   ÅP; Å*AQ,È
R ÉSÊS; Ì5T,Í5U ÎVÏW ÐX Ð;	Q)ÑQ$Ñ$Q)Ñ,	RÑ5RÒRÒ	S	Ò$SÓS	Ó	S8ÓS3Ó3S8Ó;	T)ÔT$Ô$T)Ô,	UÔ5UÕUÕVÕ.VÖVÖ	WÖV=Ö=W×W=×W8×8W=Ø 	X,Ø	X'Ø'X,c                ó’   — t        j                  «       }|j                  | _        |j                  | _        |j                  | _        y r°   )r   ÚinstanceÚinstallation_idÚinstallation_id_v3Úinstallation_id_v4)r‹   Úinsts     r;   r*  r*  Û  s:   € Ü× Ñ Ó"€DØ×.Ñ.€CÔØ!×4Ñ4€CÔØ!×4Ñ4€CÕr:   )r~  r=   )r~  zConfig.ToolbarMode.ValueType)r‹   r   r~  r  )Útheme)r‹   r   rÅ  r=   r~  r  )r‹   r   r~  r  )]Ú
__future__r   rF   r¸  r4  r/  r>   Úenumr   Útypingr   r   r   Úgoogle.protobuf.json_formatr   Ústreamlit.elements.exceptionÚelementsr¦   rÿ   Ú	streamlitr	   r
   r   Ústreamlit.loggerr   Ústreamlit.proto.ClientState_pb2r   Ústreamlit.proto.Common_pb2r   r   Ústreamlit.proto.ForwardMsg_pb2r   Ústreamlit.proto.GitInfo_pb2r   Ústreamlit.proto.NewSession_pb2r   r   r   r   r   Ústreamlit.runtimer   Ú#streamlit.runtime.forward_msg_queuer   Ústreamlit.runtime.fragmentr   r   Ústreamlit.runtime.metrics_utilr   Ústreamlit.runtime.pages_managerr   Ústreamlit.runtime.scriptrunnerr   r   r   Ústreamlit.runtime.secretsr    Ústreamlit.runtime.theme_utilr!   Ústreamlit.string_utilr"   Ústreamlit.versionr#   Ústreamlit.watcherr$   Úcollections.abcr%   Ústreamlit.proto.BackMsg_pb2r&   r'   Ústreamlit.runtime.script_datar(   Ú+streamlit.runtime.scriptrunner.script_cacher)   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr*   rY   r,   Ú'streamlit.runtime.uploaded_file_managerr-   Ústreamlit.source_utilr.   r/   r6   r0   Ú__annotations__r2   r@   rB   r”  r  r  r*  r9   r:   r;   ú<module>rõ     sÎ   ðö #ã Û Û 	Û 
Û Ý ß ,Ñ ,å 1ç 6Ð 6ß /Ñ /Ý 'Ý 7ß @Ý 5Ý /÷õ õ &Ý ?ß MÝ 7Ý 8ß UÑ UÝ 7Ý @Ý /Ý 6Ý 1áÝ(çHÝ8ÝGÝTÝ4ÝKß8á˜HÓ%€ˆÓ %ô.�dô .ó÷
K0ñ K0ófó +ô]ô@5r:   