
    ȯeiX                       U d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZ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$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ddlAmBZBmCZC ddlDmEZEmFZFmGZGmHZH ddlImJZJ ddlKmLZL ddlMmNZN dd lOmPZP dd!lQmRZR dd"lSmTZT dd#lUmVZV dd$lWmXZX dd%lYmZZZ dd&l[m\Z\ dd'l]m^Z^ dd(l_m`Z` dd)lambZb dd*lcmdZd dd+lemfZf dd,lgmhZh dd-limjZj dd.lkmlZl dd/lmmnZn dd0lompZp dd1lqmrZr dd2lsmtZt dd3lumvZv dd4lwmxZx dd5lymzZz dd6l{m|Z| dd7l}m~Z~ dd8lmZ dd9lmZ dd:lmZ dd;lmZ dd<lmZ dd=lmZmZ dd>lmZ dd?lmZ dd@lmZ ddAlmZ e
rddBlmZ ddClmZ ddDlmZ ddElmZ ddFlDmZ dGZdHedI<    edJ      ZeZdKedL<   ee   ZdKedM<   dNadOedP<   dVdQZdVdRZ G dS dTge ede$e&efehejelene(epe.e0ete2e4e6e,e8e:e<e@eLeJeNePevexeReTeVe*eXeze~e|eeZe\e>e^eee`ee"ebere ZdWdUZy)Xz@Allows us to create and absorb changes (aka Deltas) to elements.    )annotationsN)CallableIterable)deepcopy)TYPE_CHECKINGAnyFinalLiteralNoReturn	TypeAliasTypeVarcast)cli_utilconfigcursorenv_utilloggerruntimeutil)BidiComponentMixin)context_dg_stack"get_last_dg_added_to_context_stack)
AlertMixin)
ArrowMixin)BalloonsMixin)
BokehMixin)	CodeMixin)PydeckMixin)	HelpMixin)
EmptyMixin)ExceptionMixin)	FormMixin)GraphvizMixin)HeadingMixin)	HtmlMixin)IframeMixin)
ImageMixin)	JsonMixin)LayoutsMixin)FormDatacurrent_form_id)get_height_configget_text_alignment_configget_width_configvalidate_text_alignment)MapMixin)MarkdownMixin)
MediaMixin)MetricMixin)PdfMixin)PlotlyMixin)ProgressMixin)PyplotMixin)	SnowMixin)
SpaceMixin)	TextMixin)
ToastMixin)VegaChartsMixin)AudioInputMixin)ButtonMixin)ButtonGroupMixin)CameraInputMixin)	ChatMixin)CheckboxMixin)ColorPickerMixin)DataEditorMixin)FileUploaderMixin)MultiSelectMixin)NumberInputMixin)
RadioMixin)SelectSliderMixin)SelectboxMixin)SliderMixin)TextWidgetsMixin)TimeWidgetsMixin)
WriteMixin)StreamlitAPIException)	Block_pb2ForwardMsg_pb2)RootContainer)caching)enqueue_message)get_script_run_ctx)TracebackType)Message)Cursor)AddRowsMetadata)LayoutConfigi   z
Final[int]MAX_DELTA_BYTESValuer   	BlockTypeAncestorBlockTypesFbool_use_warning_has_been_displayedc                    t         sda t        j                  ddd      } t        j                         r)t        j                  d      j                  d|  d       yt        j                         sUt        j                  d      r?t        j                  d	   }t        j                  d      j                  d|  d
| d       yyyy)zPrint a warning if Streamlit is imported but not being run with `streamlit run`.
    The warning is printed only once, and is printed using the root logger.
    TWarning:yellowboldfgroot
  z to view a Streamlit app on a browser, use Streamlit in a file and
  run it with the following command:

    streamlit run [FILE_NAME] [ARGUMENTS]z#global.showWarningOnDirectExecutionr   zb to view this Streamlit app on a browser, run it with the following
  command:

    streamlit run z [ARGUMENTS]N)r`   r   style_for_clir   is_replr   
get_loggerwarningr   existsr   
get_optionsysargv)rl   script_names     [/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/streamlit/delta_generator.py_maybe_print_use_warningrs      s     +*.'(($8Lf%--wi  * * !f&7&71'
 ((1+Kf%--wi  BBM O'
! +    c                     t               } | rOt        | dd      rAt        j                  ddd      }t	        j
                  d      j                  d| d	       y
y
y
)zJPrint a warning if elements are being modified during a fragment callback.in_fragment_callbackFrb   Trc   rd   rg   rh   a   A fragment rerun was triggered with a callback that displays one or more elements. During a fragment rerun, within a callback, displaying elements is not officially supported because those elements will replace the existing elements at the top of your app.N)rU   getattrr   ri   r   rk   rl   )ctxrl   s     rr   &_maybe_print_fragment_callback_warningry      s`    

C
ws2E:(($8L&!))7) X X	
 ;srt   c                  N   e Zd ZdZej
                  dddf	 	 	 	 	 	 	 	 	 ddZddZddZ	 	 	 	 	 	 	 	 ddZ	e
dd       Ze
dd       Zdd	Zdd
Ze
dd       Ze
dd       Z	 	 	 	 ddZe
dd       Ze
dd       Ze
dd       ZddZ	 	 d 	 	 	 	 	 	 	 	 	 d!dZ	 	 d 	 	 	 	 	 d"dZy)#DeltaGeneratoraG  Creator of Delta protobuf messages.

    Parameters
    ----------
    root_container: BlockPath_pb2.BlockPath.ContainerValue or None
      The root container for this DeltaGenerator. If None, this is a null
      DeltaGenerator which doesn't print to the app at all (useful for
      testing).

    cursor: cursor.Cursor or None
      This is either:
      - None: if this is the running DeltaGenerator for a top-level
        container (MAIN or SIDEBAR)
      - RunningCursor: if this is the running DeltaGenerator for a
        non-top-level container (created with dg.container())
      - LockedCursor: if this is a locked DeltaGenerator returned by some
        other DeltaGenerator method. E.g. the dg returned in dg =
        st.text("foo").

    parent: DeltaGenerator
      To support the `with dg` notation, DGs are arranged as a tree. Each DG
      remembers its own parent, and the root of the tree is the main DG.

    block_type: None or "vertical" or "horizontal" or "column" or "expandable"
      If this is a block DG, we track its type to prevent nested columns/expanders

    Nc                4   ||||j                   k7  rt        d      || _        || _        || _        || _        d| _        | j                  j                  D ]>  }|j                  j                         D ]  }t        |      s| j                  |_        ! @ y)am  Inserts or updates elements in Streamlit apps.

        As a user, you should never initialize this object by hand. Instead,
        DeltaGenerator objects are initialized for you in two places:

        1) When you call `dg = st.foo()` for some method "foo", sometimes `dg`
        is a DeltaGenerator object. You can call methods on the `dg` object to
        update the element `foo` that appears in the Streamlit app.

        2) This is an internal detail, but `st.sidebar` itself is a
        DeltaGenerator. That's why you can call `st.sidebar.foo()` to place
        an element `foo` inside the sidebar.

        NzHDeltaGenerator root_container and cursor.root_container must be the same)root_containerRuntimeError_root_container_provided_cursor_parent_block_type
_form_data	__class__	__bases____dict__valuescallable
__module__)selfr}   r   parent
block_typemixinfuncs          rr   __init__zDeltaGenerator.__init__   s    0 &"&"7"77Z   . !'% ,0 ^^-- 	6E--/ 6D>&*ooDO6	6rt   c                ,    t        j                  |       S N)r   repr_r   s    rr   __repr__zDeltaGenerator.__repr__4  s    zz$rt   c                \    t        j                  g t        j                         |        y r   r   setgetr   s    rr   	__enter__zDeltaGenerator.__enter__7  s%    </335<t<=rt   c                X    t        j                  t        j                         d d        y)NFr   )r   typexctbs       rr   __exit__zDeltaGenerator.__exit__;  s(     	-113CR89 rt   c                @    | | j                   k(  rt               }||S | S )zReturn the DeltaGenerator that's currently 'active'.
        If we are the main DeltaGenerator, and are inside a `with` block that
        creates a container, our active_dg is that container. Otherwise,
        our active_dg is self.
        )_main_dgr   )r   last_context_stack_dgs     rr   
_active_dgzDeltaGenerator._active_dgH  s/     4==  %G$H!$0,, rt   c                J    | j                   r| j                   j                  S | S )zReturn this DeltaGenerator's root - that is, the top-level ancestor
        DeltaGenerator that we belong to (this generally means the st._main
        DeltaGenerator).
        )r   r   r   s    rr   r   zDeltaGenerator._main_dgZ  s     )-t||$$>$>rt   c           	          dd l }t        |      D cg c]  }t        t        ||            s| c}d fd}|S c c}w )Nr   c                     v rEj                   t        j                  k(  rd d d}t        |      d d d}t        |      d d}t        |      )NzMethod `z6()` does not exist for `st.sidebar`. Did you mean `st.z()`?zB()` does not exist for `DeltaGenerator` objects. Did you mean `st.`z%()` is not a valid Streamlit command.)r   rR   SIDEBARrO   )argskwargsmessagenamer   streamlit_methodss      rr   wrapperz+DeltaGenerator.__getattr__.<locals>.wrapperi  s    ((''=+@+@@"4& )::>tE  (00 #4& )#fD*  (00 dV#HI'00rt   )r   r   r   r   returnr   )	streamlitdirr   rw   )r   r   stmethod_namer   r   s   ``   @rr   __getattr__zDeltaGenerator.__getattr__b  sA     ,/r7
'hwr;?W6XK
	1$ -
s
   AAc                    t        | j                  t        | j                        t        | j                        | j
                        }t        | j                        |_        |S )Nr}   r   r   r   )r{   r   r   _cursorr   r   r   )r   _memodgs      rr   __deepcopy__zDeltaGenerator.__deepcopy__}  sM    //DLL)DLL)''	
 !1	rt   c              #  <   K   | }|| |j                   }|y y wr   )r   )r   
current_dgs     rr   
_ancestorszDeltaGenerator._ancestors  s*     ,0
$#++J $s   c              #  d   K   | j                   D ]  }|j                  |j                    yw)znIterate all the block types used by this DeltaGenerator and all
        its ancestor DeltaGenerators.
        N)r   r   )r   as     rr   _ancestor_block_typesz$DeltaGenerator._ancestor_block_types  s/     
  	$A}}(mm#	$s   00c                &    t        d |D              S )Nc              3  ,   K   | ]  }|d k(  s	d  yw)column   N ).0ancestor_blocks     rr   	<genexpr>z>DeltaGenerator._count_num_of_parent_columns.<locals>.<genexpr>  s      
 Nh<VA
s   
)sum)r   ancestor_block_typess     rr   _count_num_of_parent_columnsz+DeltaGenerator._count_num_of_parent_columns  s      
$8
 
 	
rt   c                p    | j                   t        j                  | j                        S | j                   S )zReturn our Cursor. This will be None if we're not running in a
        ScriptThread - e.g., if we're running a "bare" script outside of
        Streamlit.
        )r   r   get_container_cursorr   r   s    rr   r   zDeltaGenerator._cursor  s3       (..t/C/CDD$$$rt   c                    | j                   d u S r   )r   r   s    rr   _is_top_levelzDeltaGenerator._is_top_level  s    $$,,rt   c                *    t        t        |             S r   )stridr   s    rr   r   zDeltaGenerator.id  s    2d8}rt   c                t    | j                   }|j                  t        |j                  j                        S dS )a  Returns the element's delta path as a string like "[0, 2, 3, 1]".

        This uniquely identifies the element's position in the front-end,
        which allows (among other potential uses) the MediaFileManager to maintain
        session-specific maps of MediaFile objects placed with their "coordinates".

        This way, users can (say) use st.image with a stream of different images,
        and Streamlit will expire the older images and replace them in place.
        z[])r   r   r   
delta_path)r   r   s     rr   _get_delta_path_strz"DeltaGenerator._get_delta_path_str  s0     __-/ZZ-Cs2::(()MMrt   c                
   | j                   }t               }|r"|j                  rt        |      rt	        d      t                t                t        j                         }t        |j                  j                  |      }|j                  |       |r|j                  B|j                  j                  j                  j                  t        |j                               |j                   B|j                  j                  j"                  j                  t%        |j                                |j&                  Wt)        |j&                         |j                  j                  j*                  j                  t-        |j&                               d}	|j.                  F|j0                  :|j0                  j2                  |j4                  j2                  dd t7        |       d}	|	r]|j0                  |j0                  j9                  ||      nd}
t;        |j.                  |
|      }t=        t?        |            |_         n|}tC        jD                  ||| jF                  |jF                  |jF                  |       |S )a  Create NewElement delta, fill it, and enqueue it.

        Parameters
        ----------
        delta_type : str
            The name of the streamlit method being called
        element_proto : proto
            The actual proto in the NewElement type e.g. Alert/Button/Slider
        add_rows_metadata : AddRowsMetadata or None
            Metadata for the add_rows method

        Returns
        -------
        DeltaGenerator
            Return a DeltaGenerator that can be used to modify the newly-created
            element.
        zCalling `st.sidebar` in a function wrapped with `st.fragment` is not supported. To write elements to the sidebar with a fragment, call your fragment function inside a `with st.sidebar` context manager.NFT)
delta_typeadd_rows_metadata)r}   r   r   )invoked_dg_id
used_dg_idreturned_dg_idlayout_config)$r   rU   current_fragment_id_writes_directly_to_sidebarrO   rs   ry   rQ   
ForwardMsgrw   deltanew_elementCopyFromheightheight_configr,   widthwidth_configr.   text_alignmentr/   text_alignment_configr-   r   r   r   metadata_enqueue_messageget_locked_cursorr{   r*   r+   r   rS   save_element_messager   )r   r   element_protor   r   r   rx   msgmsg_el_protomsg_was_enqueued
new_cursor	output_dgs               rr   _enqueuezDeltaGenerator._enqueue  s'   2 __ "3**/J2/N'P  	!".0 '')syy44jAm,##/		%%33<<%m&:&:; "".		%%22;;$]%8%89 ++7'(D(DE		%%;;DD-m.J.JK
 !)bjj.D)+)>)>CLL##A&S!# ::) 

,,)=N -    '!11!I $,OB,?#@I  I 	$$''uu$<<'	
 rt   c           	     F   |t        j                         }| j                  }|j                  d      }|j                  |j
                  |S t        j                         }|j
                  j                  |j                  j                  d d  |j                  j                  j                  |       t        j                  |j                  g |j
                  j                  |j
                  j                         }|t"        }t%        d ||j                  |||            }t'        t)        |            |_        |j
                  j-                  d        t/        |       t1        j2                  || j4                  |j4                  |j4                         |S )Ntype)r}   parent_pathr{   r   )r   )r   r   r   )rP   Blockr   
WhichOneofr   r   rQ   r   r   r   r   	add_blockr   r   RunningCursorr   indexr{   r   r*   r+   r   r   r   rS   save_block_messager   )r   block_protodg_typer   r   r   block_cursorblock_dgs           rr   _blockzDeltaGenerator._block'  s`   
 #//+K __ !++F3
%);I'')%'ZZ%:%:"		$$[1
 ++--C"**00C"**2B2BC
 ?$G!11#%	
 'r':; 	

$$t$<""''uu#;;		
 rt   )
r}   z
int | Noner   Cursor | Noner   zDeltaGenerator | Noner   z
str | Noner   None)r   r   r   r  )r   ztype[BaseException] | Noner   zBaseException | Noner   zTracebackType | Noner   zLiteral[False])r   r{   )r   r   r   zCallable[..., NoReturn])r   r   r   r{   )r   zIterable[DeltaGenerator])r   r^   )r   r^   r   int)r   r  )r   r_   )NN)
r   r   r   rW   r   zAddRowsMetadata | Noner   zLayoutConfig | Noner   r{   )r   zBlock_pb2.Block | Noner   ztype | Noner   r{   )__name__r   __qualname____doc__rR   MAINr   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r  r   rt   rr   r{   r{      s   fB &3%7%7 $(,!%36"36 36 &	36
 36 
36j >' " !	
 
  " ? ?6 , , $ $
$6
	
 % % - -  N$ 59-1gg g 2	g
 +g 
gV /3#:+: : 
	:rt   r{   c                    t        d | j                  D              }t        t        | j                              }|xr | S )Nc              3  V   K   | ]!  }|j                   t        j                  k(   # y wr   )r   rR   r   )r   r   s     rr   r   z._writes_directly_to_sidebar.<locals>.<genexpr>e  s!     WAQ&&-*?*??Ws   '))anyr   r_   listr   )r   
in_sidebarhas_containers      rr   r   r   d  s9    WWWJb6678M+m++rt   r  )r   r{   r   r_   )r  
__future__r   ro   collections.abcr   r   copyr   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   &streamlit.components.v2.bidi_componentr   $streamlit.delta_generator_singletonsr   r   streamlit.elements.alertr   streamlit.elements.arrowr   streamlit.elements.balloonsr   streamlit.elements.bokeh_chartr   streamlit.elements.coder   %streamlit.elements.deck_gl_json_chartr   streamlit.elements.doc_stringr   streamlit.elements.emptyr    streamlit.elements.exceptionr!   streamlit.elements.formr"   !streamlit.elements.graphviz_chartr#   streamlit.elements.headingr$   streamlit.elements.htmlr%   streamlit.elements.iframer&   streamlit.elements.imager'   streamlit.elements.jsonr(   streamlit.elements.layoutsr)   !streamlit.elements.lib.form_utilsr*   r+   #streamlit.elements.lib.layout_utilsr,   r-   r.   r/   streamlit.elements.mapr0   streamlit.elements.markdownr1   streamlit.elements.mediar2   streamlit.elements.metricr3   streamlit.elements.pdfr4   streamlit.elements.plotly_chartr5   streamlit.elements.progressr6   streamlit.elements.pyplotr7   streamlit.elements.snowr8   streamlit.elements.spacer9   streamlit.elements.textr:   streamlit.elements.toastr;   streamlit.elements.vega_chartsr<   &streamlit.elements.widgets.audio_inputr=   !streamlit.elements.widgets.buttonr>   'streamlit.elements.widgets.button_groupr?   'streamlit.elements.widgets.camera_inputr@   streamlit.elements.widgets.chatrA   #streamlit.elements.widgets.checkboxrB   'streamlit.elements.widgets.color_pickerrC   &streamlit.elements.widgets.data_editorrD   (streamlit.elements.widgets.file_uploaderrE   &streamlit.elements.widgets.multiselectrF   'streamlit.elements.widgets.number_inputrG    streamlit.elements.widgets.radiorH   (streamlit.elements.widgets.select_sliderrI   $streamlit.elements.widgets.selectboxrJ   !streamlit.elements.widgets.sliderrK   'streamlit.elements.widgets.text_widgetsrL   'streamlit.elements.widgets.time_widgetsrM   streamlit.elements.writerN   streamlit.errorsrO   streamlit.protorP   rQ   !streamlit.proto.RootContainer_pb2rR   streamlit.runtimerS   streamlit.runtime.scriptrunnerrT   r   rU   typesrV   google.protobuf.messagerW   streamlit.cursorrX   +streamlit.elements.lib.built_in_chart_utilsrY   rZ   r[   __annotations__r\   r   r]   r^   r`   rs   ry   r{   r   r   rt   rr   <module>rS     s   G " 
 . 	 	 	   F 0 / 5 5 - = 3 / 7 - ; 3 - 1 / - 3 G  , 5 / 1 + 7 5 1 - / - / : B 9 D D 5 = D B F C D 7 F ? 9 D D / 2 5 ; % N =#/'K@. . 	9  ( 3 I 3 ).  -<

ttt t 	t
 t t t t t t t t t t t  !t" #t$ %t& 't( )t* +t, -t. /t0 1t2 3t4 5t6 7t8 9t: ;t< =t> ?t@ AtB CtD EtF GtH ItJ KtL MtN OtP QtR StT UtV WtX YtZ [t\ ]t^ _t` atb ctn,rt   