
    ch-                        S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  S S	KJr  S S
KJr  \
" S5      SSSSS.           SS jj5       r " S S5      rg)    )annotationsN)Path)Callable)StreamlitAPIException)gather_metrics)get_script_run_ctx)page_icon_and_name)validate_icon_or_emoji)calc_md5PageFtitleiconurl_pathdefaultStreamlitPagec                   [        XX#US9$ )u  Configure a page for ``st.navigation`` in a multipage app.

Call ``st.Page`` to initialize a ``StreamlitPage`` object, and pass it to
``st.navigation`` to declare a page in your app.

When a user navigates to a page, ``st.navigation`` returns the selected
``StreamlitPage`` object. Call ``.run()`` on the returned ``StreamlitPage``
object to execute the page. You can only run the page returned by
``st.navigation``, and you can only run it once per app rerun.

A page can be defined by a Python file or ``Callable``.

Parameters
----------
page : str, Path, or callable
    The page source as a ``Callable`` or path to a Python file. If the page
    source is defined by a Python file, the path can be a string or
    ``pathlib.Path`` object. Paths can be absolute or relative to the
    entrypoint file. If the page source is defined by a ``Callable``, the
    ``Callable`` can't accept arguments.

title : str or None
    The title of the page. If this is ``None`` (default), the page title
    (in the browser tab) and label (in the navigation menu) will be
    inferred from the filename or callable name in ``page``. For more
    information, see `Overview of multipage apps
    <https://docs.streamlit.io/st.page.automatic-page-labels>`_.

icon : str or None
    An optional emoji or icon to display next to the page title and label.
    If ``icon`` is ``None`` (default), no icon is displayed next to the
    page label in the navigation menu, and a Streamlit icon is displayed
    next to the title (in the browser tab). If ``icon`` is a string, the
    following options are valid:

    - A single-character emoji. For example, you can set ``icon="🚨"``
        or ``icon="🔥"``. Emoji short codes are not supported.

    - An icon from the Material Symbols library (rounded style) in the
        format ``":material/icon_name:"`` where "icon_name" is the name
        of the icon in snake case.

        For example, ``icon=":material/thumb_up:"`` will display the
        Thumb Up icon. Find additional icons in the `Material Symbols             <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
        font library.

url_path : str or None
    The page's URL pathname, which is the path relative to the app's root
    URL. If this is ``None`` (default), the URL pathname will be inferred
    from the filename or callable name in ``page``. For more information,
    see `Overview of multipage apps
    <https://docs.streamlit.io/st.page.automatic-page-urls>`_.

    The default page will have a pathname of ``""``, indicating the root
    URL of the app. If you set ``default=True``, ``url_path`` is ignored.
    ``url_path`` can't include forward slashes; paths can't include
    subdirectories.

default : bool
    Whether this page is the default page to be shown when the app is
    loaded. If ``default`` is ``False`` (default), the page will have a
    nonempty URL pathname. However, if no default page is passed to
    ``st.navigation`` and this is the first page, this page will become the
    default page. If ``default`` is ``True``, then the page will have
    an empty pathname and ``url_path`` will be ignored.

Returns
-------
StreamlitPage
    The page object associated to the given script.

Example
-------
>>> import streamlit as st
>>>
>>> def page2():
>>>     st.title("Second page")
>>>
>>> pg = st.navigation([
>>>     st.Page("page1.py", title="First page", icon="🔥"),
>>>     st.Page(page2, title="Second page", icon=":material/favorite:"),
>>> ])
>>> pg.run()
r   )r   )pager   r   r   r   s        lC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\streamlit/navigation/page.pyr   r      s    |      c                      \ rS rSrSrSSSSS.           SS jj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)r      a  A page within a multipage Streamlit app.

Use ``st.Page`` to initialize a ``StreamlitPage`` object.

Attributes
----------
icon : str
    The icon of the page.

    If no icon was declared in ``st.Page``, this property returns ``""``.

title : str
    The title of the page.

    Unless declared otherwise in ``st.Page``, the page title is inferred
    from the filename or callable name. For more information, see
    `Overview of multipage apps
    <https://docs.streamlit.io/st.page.automatic-page-labels>`_.

url_path : str
    The page's URL pathname, which is the path relative to the app's root
    URL.

    Unless declared otherwise in ``st.Page``, the URL pathname is inferred
    from the filename or callable name. For more information, see
    `Overview of multipage apps
    <https://docs.streamlit.io/st.page.automatic-page-urls>`_.

    The default page will always have a ``url_path`` of ``""`` to indicate
    the root URL (e.g. homepage).

NFr   c                  XPl         [        5       nU(       d  g UR                  R                  n[	        U[
        5      (       a  [        U5      n[	        U[        5      (       a@  Xq-  R                  5       nUR                  5       (       d  [        SUR                   S35      eSnSn	[	        U[        5      (       a  [        U5      u  pO5[        US5      (       a  [        UR                  5      nOUc  [        S5      eXl        U=(       d    UR                  SS5      U l        Ub  [#        U5        U=(       d    U	U l        U R                   R'                  5       S:X  a  [        S5      eXl        UbW  UR'                  5       S:X  a  U(       d  [        S	5      eUR'                  S
5      U l        S
U R(                  ;   a  [        S5      eU R$                  (       a  [#        U R$                  5        SU l        g )Nz!Unable to create Page. The file `z` could not be found. __name__zHCannot infer page title for Callable. Set the `title=` keyword argument._ zKThe title of the page cannot be empty or consist of underscores/spaces onlyzKThe URL path cannot be an empty string unless the page is the default page./z9The URL path cannot contain a nested path (e.g. foo/bar).F)_defaultr   pages_managermain_script_parent
isinstancestrr   resolveis_filer   namer	   hasattrr   _pagereplace_titler
   _iconstrip	_url_path_can_be_called)
selfr   r   r   r   r   ctx	main_pathinferred_nameinferred_icons
             r   __init__StreamlitPage.__init__   s    & "%%88	dC  :DdD!!$--/D<<>>+7		{BWX  dD!!+=d+C(M=T:&&.M] (Z  15
 CM$9$9#s$C"4(/-
;;"$']  ,~~2%g+a  &^^C0DNdnn$+O  ::"4::. %*r   c                    U R                   $ )zThe title of the page.

Unless declared otherwise in ``st.Page``, the page title is inferred
from the filename or callable name. For more information, see
`Overview of multipage apps
<https://docs.streamlit.io/st.page.automatic-page-labels>`_.
)r*   r/   s    r   r   StreamlitPage.title   s     {{r   c                    U R                   $ )z]The icon of the page.

If no icon was declared in ``st.Page``, this property returns ``""``.
)r+   r7   s    r   r   StreamlitPage.icon   s     zzr   c                @    U R                   (       a  S$ U R                  $ )a  The page's URL pathname, which is the path relative to the app's         root URL.

Unless declared otherwise in ``st.Page``, the URL pathname is inferred
from the filename or callable name. For more information, see
`Overview of multipage apps
<https://docs.streamlit.io/st.page.automatic-page-urls>`_.

The default page will always have a ``url_path`` of ``""`` to indicate
the root URL (e.g. homepage).
r   )r   r-   r7   s    r   r   StreamlitPage.url_path  s     ]]r66r   c                6   U R                   (       d  [        S5      eSU l         [        5       nU(       d  gUR                  U R                  5         [        U R                  5      (       a  U R                  5          SSS5        gUR                  R                  [        U R                  5      5      n[        R                  " S5      n[        U R                  5      UR                  S'   [        X#R                  5        SSS5        g! , (       d  f       g= f)a  Execute the page.

When a page is returned by ``st.navigation``, use the ``.run()`` method
within your entrypoint file to render the page. You can only call this
method on the page returned by ``st.navigation``. You can only call
this method once per run of your entrypoint file.

zbThis page cannot be called directly. Only the page returned from st.navigation can be called once.FN__main____file__)r.   r   r   run_with_active_hash_script_hashcallabler(   r    get_page_script_byte_coder#   types
ModuleType__dict__exec)r/   r0   codemodules       r   runStreamlitPage.run  s     ""'t  $ "%%d&7&78

##

 98 $$>>s4::OD%%j1F*-djj/FOOJ'' 988s   ,D
A;D


Dc                ,    [        U R                  5      $ )N)r   r-   r7   s    r   rA   StreamlitPage._script_hash.  s    ''r   )r.   r   r+   r(   r*   r-   )r   str | Path | Callable[[], None]r   
str | Noner   rO   r   rO   r   boolreturnNone)rQ   r#   )rQ   rR   )r   
__module____qualname____firstlineno____doc__r4   propertyr   r   r   rJ   rA   __static_attributes__ r   r   r   r      s    J !#J*-J* 	J*
 J* J* J* 
J*X     7 7(< ( (r   )r   rN   r   rO   r   rO   r   rO   r   rP   rQ   r   )
__future__r   rD   pathlibr   typingr   streamlit.errorsr   streamlit.runtime.metrics_utilr   7streamlit.runtime.scriptrunner_utils.script_run_contextr   streamlit.source_utilr	   streamlit.string_utilr
   streamlit.utilr   r   r   rY   r   r   <module>rc      s    #    2 9 V 4 8 #  _
)_ _ 	_
 _ _ _ _Dp( p(r   