
    ch                        S SK Jr  S SKJr  S SKJr  S SKJr          SS jr    SS jr	 " S S5      r
 " S	 S
\
5      r " S S\
5      rg)    )annotations)Any)util)get_script_run_ctxc                P    U /nUR                  U5        UR                  U5        U$ N)extendappend)root_containerparent_pathindex
delta_paths       cC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\streamlit/cursor.pymake_delta_pathr      s.     !!Jk"e    c                    U c  g[        5       nUc  gXR                  ;   a  UR                  U    $ [        U S9nX!R                  U '   U$ )zReturn the top-level RunningCursor for the given container.
This is the cursor that is used when user code calls something like
`st.foo` (which uses the main container) or `st.sidebar.foo` (which uses
the sidebar container).
N)r   )r   cursorsRunningCursor)r   ctxcursors      r   get_container_cursorr       sQ     

C
{${{>**.9F"(KKMr   c                      \ rS rSrSrSS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS j5       rSS	 jr\SS
 j5       rSrg)Cursor8   zA pointer to a delta location in the app.

When adding an element to the app, you should always call
get_locked_cursor() on that element's respective Cursor.
c                .    [         R                  " U 5      $ r   )r   repr_selfs    r   __repr__Cursor.__repr__?   s    zz$r   c                    [        5       e)zgThe top-level container this cursor lives within - either
RootContainer.MAIN or RootContainer.SIDEBAR.
NotImplementedErrorr   s    r   r   Cursor.root_containerB   s    
 "##r   c                    [        5       e)z0The cursor's parent's path within its container.r"   r   s    r   r   Cursor.parent_pathI        "##r   c                    [        5       e)z/The index of the Delta within its parent block.r"   r   s    r   r   Cursor.indexN   r'   r   c                X    [        U R                  U R                  U R                  5      $ )zbThe complete path of the delta pointed to by this cursor - its
container, parent path, and index.
)r   r   r   r   r   s    r   r   Cursor.delta_pathS   s#    
 t22D4D4DdjjQQr   c                    [        5       er   r"   r   s    r   	is_lockedCursor.is_lockedZ   s    !##r   c                    [        5       er   r"   r   propss     r   get_locked_cursorCursor.get_locked_cursor^   s    !##r   c                    [        5       e)zOther data in this cursor. This is a temporary measure that will go
away when we implement improved return values for elements.

This is only implemented in LockedCursor.
r"   r   s    r   r1   Cursor.propsa   s     "##r    N)returnstrr7   intr7   tuple[int, ...])r7   	list[int]r7   boolr1   r   r7   LockedCursorr7   r   )__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   r   r-   r2   r1   __static_attributes__r6   r   r   r   r   8   s      $ $ $ $ $ $ R R $ $$ $ $r   r   c                  |    \ rS rSrS
SS jjr\SS j5       r\SS j5       r\SS j5       r\SS j5       r	SS jr
Srg	)r   k   c                *    Xl         X l        SU l        g)a~  A moving pointer to a delta location in the app.

RunningCursors auto-increment to the next available location when you
call get_locked_cursor() on them.

Parameters
----------
root_container: int
    The root container this cursor lives in.
parent_path: tuple of ints
  The full path of this cursor, consisting of the IDs of all ancestors.
  The 0th item is the topmost ancestor.

r   N)_root_container_parent_path_index)r   r   r   s      r   __init__RunningCursor.__init__l   s      .'r   c                    U R                   $ r   rM   r   s    r   r   RunningCursor.root_container       ###r   c                    U R                   $ r   rN   r   s    r   r   RunningCursor.parent_path          r   c                    U R                   $ r   rO   r   s    r   r   RunningCursor.index       {{r   c                    g)NFr6   r   s    r   r-   RunningCursor.is_locked   s    r   c                    [        SU R                  U R                  U R                  S.UD6nU =R                  S-  sl        U$ )N)r   r   r      r6   )rA   rM   rN   rO   )r   r1   locked_cursors      r   r2   RunningCursor.get_locked_cursor   sJ    $ 
//))++
 	
 	qr   )rO   rN   rM   N)r6   )r   r:   r   r<   r7   Noner9   r;   r>   r@   )rC   rD   rE   rF   rP   rH   r   r   r   r-   r2   rI   r6   r   r   r   r   k   s\    & $ $ ! !    
r   r   c                      \ rS rSr  S         SS jjr\SS j5       r\SS j5       r\SS j5       r\SS j5       r	SS jr
\SS j5       rS	rg
)rA      c                4    Xl         X0l        X l        X@l        g)a$  A locked pointer to a location in the app.

LockedCursors always point to the same location, even when you call
get_locked_cursor() on them.

Parameters
----------
root_container: int
    The root container this cursor lives in.
parent_path: tuple of ints
  The full path of this cursor, consisting of the IDs of all ancestors. The
  0th item is the topmost ancestor.
index: int
**props: any
  Anything else you want to store in this cursor. This is a temporary
  measure that will go away when we implement improved return values
  for elements.

N)rM   rO   rN   _props)r   r   r   r   r1   s        r   rP   LockedCursor.__init__   s    4  .'r   c                    U R                   $ r   rS   r   s    r   r   LockedCursor.root_container   rU   r   c                    U R                   $ r   rW   r   s    r   r   LockedCursor.parent_path   rY   r   c                    U R                   $ r   r[   r   s    r   r   LockedCursor.index   r]   r   c                    g)NTr6   r   s    r   r-   LockedCursor.is_locked   s    r   c                    Xl         U $ r   rh   r0   s     r   r2   LockedCursor.get_locked_cursor   s    r   c                    U R                   $ r   rs   r   s    r   r1   LockedCursor.props   r]   r   )rO   rN   rh   rM   N)r6   r   )
r   r:   r   r<   r   r:   r1   r   r7   rd   r9   r;   r>   r@   rB   )rC   rD   rE   rF   rP   rH   r   r   r   r-   r2   r1   rI   r6   r   r   rA   rA      s     (*	 % 	
  
> $ $ ! !      r   rA   N)r   r:   r   r<   r   r:   r7   r=   )r   z
int | Noner7   zRunningCursor | None)
__future__r   typingr   	streamlitr   7streamlit.runtime.scriptrunner_utils.script_run_contextr   r   r   r   r   rA   r6   r   r   <module>r{      sq    #   V&5>A00$ 0$f.F .b66 6r   