Ë
    EêñiuJ  ã                  óŠ  — U d dl mZ d dlmZmZmZ d dl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 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$m%Z% e&Z'de(d<   e&ez  eg df   z  ez  Z)de(d<   	 	 	 	 dd„Z*	 	 	 	 dd„Z+d d„Z,d!d„Z- ed«      dddœ	 	 	 	 	 	 	 d"d„«       Z.	 	 	 	 	 	 	 	 d"d„Z/y)#é    )Úannotations)ÚCallableÚMappingÚSequence)ÚPath)ÚTYPE_CHECKINGÚLiteralÚ	TypeAlias)Úconfig)ÚStreamlitAPIException)ÚStreamlitPage)Ú
ForwardMsg)Ú
Navigation)Úgather_metrics)ÚPagesManager)ÚScriptRunContextÚget_script_run_ctx)Úis_emoji)ÚAppPage)ÚPageHashÚPageInfor
   ÚSectionHeaderNÚPageTypec                óî   — t        | t        «      r| S t        | t        «      rt        | «      S t        | t        «      rt        | «      S t	        | «      rt        | «      S t        dt        | «      › d�«      ‚)z5Convert various input types to StreamlitPage objects.zInvalid page type: zY. Must be either a string path, a pathlib.Path, a callable function, or a st.Page object.)Ú
isinstancer   Ústrr   Úcallabler   Útype)Ú
page_inputs    ú_/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/commands/navigation.pyÚconvert_to_streamlit_pager!   *   sw   € ô �*œmÔ,ØÐä�*œcÔ"Ü˜ZÓ(Ð(ä�*œdÔ#Ü˜ZÓ(Ð(ä�
Ôä˜ZÓ(Ð(ä
Ø
œd :Ó.Ð/ð 0Dð 	Dóð ó    c                ór   — g }| j                  «       D ]!  }|j                  |j                  «       «       Œ# |S )N)ÚvaluesÚextendÚcopy)Únav_sectionsÚ	page_listÚpagess      r    Úpages_from_nav_sectionsr*   A   s=   € ð €IØ×$Ñ$Ó&ò 'ˆØ×Ñ˜Ÿ™›Õ&ð'ð Ðr"   c                ó\   — t        «       }d|j                  _        | j                  |«       y )NÚ )r   Úpage_not_foundÚ	page_nameÚenqueue)ÚctxÚmsgs     r    Úsend_page_not_foundr2   K   s#   € Ü
‹,€CØ#%€C×ÑÔ Ø‡K�K�Õr"   c                ó0   — |j                   }|�|| _         yy)zLSet external_url on the AppPage proto when the page targets an external URL.N)Úexternal_url)Ú
page_protoÚpager4   s      r    Ú_set_external_urlr7   Q   s    € à×$Ñ$€LØÐØ".ˆ
Õð  r"   Ú
navigationÚsidebarF©ÚpositionÚexpandedc               óz   — t        |t        «      r|dvrt        d|› d�«      ‚dt        _        t        | ||¬«      S )u•"  
    Configure the available pages in a multipage app.

    Call ``st.navigation`` in your entrypoint file to define the available
    pages for your app. ``st.navigation`` returns the current page, which can
    be executed using ``.run()`` method.

    When using ``st.navigation``, your entrypoint file (the file passed to
    ``streamlit run``) acts like a router or frame of common elements around
    each of your pages. Streamlit executes the entrypoint file with every app
    rerun. To execute the current page, you must call the ``.run()`` method on
    the ``StreamlitPage`` object returned by ``st.navigation``.

    The set of available pages can be updated with each rerun for dynamic
    navigation. By default, ``st.navigation`` displays the available pages in
    the sidebar if there is more than one page. This behavior can be changed
    using the ``position`` keyword argument.

    As soon as any session of your app executes the ``st.navigation`` command,
    your app will ignore the ``pages/`` directory (across all sessions).

    Parameters
    ----------
    pages : Sequence[page-like], Mapping[str, Sequence[page-like]]
        The available pages for the app.

        To create a navigation menu with no sections or page groupings,
        ``pages`` must be a list of page-like objects. Page-like objects are
        anything that can be passed to ``st.Page`` or a ``StreamlitPage``
        object returned by ``st.Page``.

        To create labeled sections or page groupings within the navigation
        menu, ``pages`` must be a dictionary. Each key is the label of a
        section and each value is the list of page-like objects for
        that section. If you use ``position="top"``, each grouping will be a
        collapsible item in the navigation menu. For top navigation, if you use
        an empty string as a section header, the pages in that section will be
        displayed at the beginning of the menu before the collapsible sections.
        Section labels support GitHub-flavored Markdown as described in the
        ``title`` parameter of ``st.Page``.

        When you use a string or path as a page-like object, they are
        internally passed to ``st.Page`` and converted to ``StreamlitPage``
        objects. In this case, the page will have the default title, icon, and
        path inferred from its path or filename. To customize these attributes
        for your page, initialize your page with ``st.Page``.

    position : "sidebar", "top", or "hidden"
        The position of the navigation menu. If this is ``"sidebar"``
        (default), the navigation widget appears at the top of the sidebar. If
        this is ``"top"``, the navigation appears in the top header of the app.
        If this is ``"hidden"``, the navigation widget is not displayed.

        If there is only one page in ``pages``, the navigation will be hidden
        for any value of ``position``.

    expanded : bool or int
        Controls whether the navigation menu is expanded and how many items
        are visible when it's collapsed.

        This parameter is only used when ``position="sidebar"`` and the sidebar
        has other elements below the navigation menu. If the sidebar only
        contains the navigation menu, it will always be fully expanded. The
        following values are valid:

        - ``False`` (default): The navigation menu shows a maximum
          of ten pages when there are more than twelve pages. The menu is fully
          expanded when there are twelve or fewer pages. A collapsed menu has a
          "View X more" button at the bottom. An expanded menu that can be
          collapsed has a "View less" button at the bottom.

        - ``True``: The navigation menu will always be fully expanded, and no
          "View less" button will be displayed.

        - Positive integer: A positive integer specifies the maximum number of
          pages to display when the menu is collapsed. When there are at least
          three more pages than this integer, the menu will be collapsed.
          Otherwise, the menu will be fully expanded. ``expanded=10`` is
          equivalent to the default, ``expanded=False``.

        If the value of ``expanded`` changes between reruns, an expanded menu
        will stay expanded. If the change in value makes the menu newly
        collapsible, Streamlit will only add a "View less" button at the bottom.

    Returns
    -------
    StreamlitPage
        The current page selected by the user. To run the page, you must use
        the ``.run()`` method on it.

    Examples
    --------
    The following examples show different possible entrypoint files, each named
    ``streamlit_app.py``. An entrypoint file is passed to ``streamlit run``. It
    manages your app's navigation and serves as a router between pages.

    **Example 1: Use a callable or Python file as a page**

    You can declare pages from callables or file paths. If you pass callables
    or paths to ``st.navigation`` as a page-like objects, they are internally
    converted to ``StreamlitPage`` objects using ``st.Page``. In this case, the
    page titles, icons, and paths are inferred from the file or callable names.

    ``page_1.py`` (in the same directory as your entrypoint file):

    >>> import streamlit as st
    >>>
    >>> st.title("Page 1")

    ``streamlit_app.py``:

    >>> import streamlit as st
    >>>
    >>> def page_2():
    ...     st.title("Page 2")
    >>>
    >>> pg = st.navigation(["page_1.py", page_2])
    >>> pg.run()

    .. output::
        https://doc-navigation-example-1.streamlit.app/
        height: 200px

    **Example 2: Group pages into sections and customize them with ``st.Page``**

    You can use a dictionary to create sections within your navigation menu. In
    the following example, each page is similar to Page 1 in Example 1, and all
    pages are in the same directory. However, you can use Python files from
    anywhere in your repository. ``st.Page`` is used to give each page a custom
    title. For more information, see |st.Page|_.

    Directory structure:

    >>> your_repository/
    >>> â”œâ”€â”€ create_account.py
    >>> â”œâ”€â”€ learn.py
    >>> â”œâ”€â”€ manage_account.py
    >>> â”œâ”€â”€ streamlit_app.py
    >>> â””â”€â”€ trial.py

    ``streamlit_app.py``:

    >>> import streamlit as st
    >>>
    >>> pages = {
    ...     "Your account": [
    ...         st.Page("create_account.py", title="Create your account"),
    ...         st.Page("manage_account.py", title="Manage your account"),
    ...     ],
    ...     "Resources": [
    ...         st.Page("learn.py", title="Learn about us"),
    ...         st.Page("trial.py", title="Try it out"),
    ...     ],
    ... }
    >>>
    >>> pg = st.navigation(pages)
    >>> pg.run()

    .. output::
        https://doc-navigation-example-2.streamlit.app/
        height: 300px


    **Example 3: Use top navigation**

    You can use the ``position`` parameter to place the navigation at the top
    of the app. This is useful for apps with a lot of pages because it allows
    you to create collapsible sections for each group of pages. The following
    example uses the same directory structure as Example 2 and shows how to
    create a top navigation menu.

    ``streamlit_app.py``:

    >>> import streamlit as st
    >>>
    >>> pages = {
    ...     "Your account": [
    ...         st.Page("create_account.py", title="Create your account"),
    ...         st.Page("manage_account.py", title="Manage your account"),
    ...     ],
    ...     "Resources": [
    ...         st.Page("learn.py", title="Learn about us"),
    ...         st.Page("trial.py", title="Try it out"),
    ...     ],
    ... }
    >>>
    >>> pg = st.navigation(pages, position="top")
    >>> pg.run()

    .. output::
        https://doc-navigation-top.streamlit.app/
        height: 300px

    **Example 4: Stateful widgets across multiple pages**

    Call widget functions in your entrypoint file when you want a widget to be
    stateful across pages. Assign keys to your common widgets and access their
    values through Session State within your pages.

    ``streamlit_app.py``:

    >>> import streamlit as st
    >>>
    >>> def page1():
    >>>     st.write(st.session_state.foo)
    >>>
    >>> def page2():
    >>>     st.write(st.session_state.bar)
    >>>
    >>> # Widgets shared by all the pages
    >>> st.sidebar.selectbox("Foo", ["A", "B", "C"], key="foo")
    >>> st.sidebar.checkbox("Bar", key="bar")
    >>>
    >>> pg = st.navigation([page1, page2])
    >>> pg.run()

    .. output::
        https://doc-navigation-multipage-widgets.streamlit.app/
        height: 350px

    .. |st.Page| replace:: ``st.Page``
    .. _st.Page: https://docs.streamlit.io/develop/api-reference/navigation/st.page

    >   ÚtopÚhiddenr9   zInvalid position "zG". The position parameter must be one of "sidebar", "hidden", or "top".Fr:   )r   r   r   r   Úuses_pages_directoryÚ_navigation)r)   r;   r<   s      r    r8   r8   X   sP   € ôP �h¤Ô$¨Ð8TÑ(TÜ#Ø   
ð +Sð Só
ð 	
ð ).„LÔ%ä�u x¸(ÔCÐCr"   c               óD
  — t        | t        «      r| D �cg c]  }t        |«      ‘Œ }}d|i}n<| j                  «       D ���ci c]  \  }}||D �cg c]  }t        |«      ‘Œ c}“Œ! }}}}t	        |«      }|st        d«      ‚d }	i }
|D ](  }||   D ]  }|j                  sŒ|	�t        d«      ‚|}	Œ  Œ* |	€5|D �cg c]  }|j                  rŒ|‘Œ }}|st        d«      ‚|d   }	d|	_        t        «       }|s	d|	_	        |	S |D ]�  }||   D ]…  }t        |j                  t        «      rt        |j                  «      nd}|j                  }||
v rt        d|j                  › d�«      ‚||j                  |j                   ||j                  d	œ|
|<   Œ‡ Œ‘ t#        «       }|d
k(  r*t$        j&                  j(                  |j*                  _        nž|dk(  r*t$        j&                  j.                  |j*                  _        no|dk(  rjt1        j2                  d«      du r*t$        j&                  j(                  |j*                  _        n)t$        j&                  j4                  |j*                  _        t        |t6        «      r&|rd|j*                  _        n’d|j*                  _        n€t        |t:        «      rN|dk  rt        d|›d�«      ‚|dk(  rd|j*                  _        nEd|j*                  _        ||j*                  _        n"t        dt?        |«      j@                  ›d�«      ‚|jC                  «       |j*                  jD                  d d  |D ]Ð  }||   D ]Æ  }|j*                  jF                  jI                  «       }|j                  |_%        |j                  |_&        tO        |j                   «      rd|j                   › �n|j                   |_        |j                  |_(        ||_)        |j                  |_*        |jV                  d
k(  |_,        t[        ||«       ŒÈ ŒÒ |j\                  j_                  |
«       |j\                  ja                  |	j                  ¬«      }d }|r7|d   }|D �cg c]  }|j                  |k(  sŒ|‘Œ }}tc        |«      dkD  r|d   }|r|j                  rd }|ste        |«       |	}d|_	        |j                  |j*                  _%        |jg                  |j                  «       |ji                  |«       |S c c}w c c}w c c}}}w c c}w c c}w )Nr,   z;`st.navigation` must be called with at least one `st.Page`.zUMultiple Pages specified with `default=True`. At most one Page can be set to default.zZAt least one non-external page is required. External URL pages cannot be the default page.r   Tz+Multiple Pages specified with URL pathname zl. URL pathnames must be unique. The url pathname may be inferred from the filename, callable name, or title.)Úpage_script_hashr.   ÚiconÚscript_pathÚurl_pathnamer?   r>   r9   zclient.showSidebarNavigationFzInvalid value for expanded: z=. When using an int, expanded must be a non-negative integer.zInvalid type for expanded: z4. expanded must be a bool or a non-negative integer.zemoji:)Úfallback_page_hashrC   )5r   r   r!   Úitemsr*   r   Ú_defaultÚis_externalr   Ú_can_be_calledÚ_pager   r   Ú_script_hashÚurl_pathÚtitlerD   r   ÚNavigationProtoÚPositionÚHIDDENr8   r;   ÚTOPr   Ú
get_optionÚSIDEBARÚboolr<   ÚintÚvisible_itemsr   Ú__name__ÚkeysÚsectionsÚ	app_pagesÚaddrC   r.   r   Ú
is_defaultÚsection_headerrF   Ú_visibilityÚ	is_hiddenr7   Úpages_managerÚ	set_pagesÚget_page_scriptÚlenr2   Úset_mpa_v2_pager/   )r)   r;   r<   ÚpÚconverted_pagesr'   ÚsectionÚsection_pagesr(   Údefault_pageÚpagehash_to_pageinfor_   r6   Únon_external_pagesr0   rE   Úscript_hashr1   Ú
found_pageÚpage_to_returnÚfound_page_script_hashÚmatching_pagess                         r    rA   rA   L  s(  € ô �%œÔ"ØAFÖG¸AÔ4°QÕ7ÐGˆÐGØ˜OÐ,‰ð +0¯+©+«-÷
ð 
á&�˜ð ¸MÖJ°qÔ/°Õ2ÒJÑJð
ˆò 
ô (¨Ó5€IáÜ#ØIó
ð 	
ð €LØ57Ðð 'ò $ˆØ  Ñ0ò 	$ˆDØ�}‹}ØÐ+Ü/ðBóð ð  $‘ñ	$ð$ð ÐØ)2ÖH A¸!¿-»-šaÐHÐÐHÙ!Ü'ðAóð ð *¨!Ñ,ˆØ $ˆÔä
Ó
€CÙð '+ˆÔ#ØÐð 'ò ˆØ  Ñ0ò 	ˆDÜ-7¸¿
¹
ÄDÔ-Iœ#˜dŸj™jœ/ÈrˆKà×+Ñ+ˆKØÐ2Ñ2ô ,ØAÀ$Ç-Á-Àð QKð Kóð ð %0Ø!ŸZ™ZØŸ	™	Ø*Ø $§¡ñ1Ð  Ò-ñ	ðô, ‹,€Cà�8ÒÜ"1×":Ñ":×"AÑ"Aˆ�‰ÕØ	�UÒ	Ü"1×":Ñ":×">Ñ">ˆ�‰ÕØ	�YÒ	ä×ÑÐ;Ó<ÀÑEÜ&5×&>Ñ&>×&EÑ&EˆC�N‰NÕ#ä&5×&>Ñ&>×&FÑ&FˆC�N‰NÔ#ô �(œDÔ!ÙØ&*ˆC�N‰NÕ#ð ',ˆC�N‰NÕ#ä	�HœcÔ	"Ø�aŠ<Ü'Ø.¨x¨lð ;Nð Nóð ð �qŠ=à&+ˆC�N‰NÕ#ð ',ˆC�N‰NÔ#Ø+3ˆC�N‰NÕ(ä#Ø)¬$¨x«.×*AÑ*AÐ)Dð EAð Aó
ð 	
ð
 ".×!2Ñ!2Ó!4€C‡N�N×Ñ™AÐØ&ò 
'ˆØ  Ñ0ò 		'ˆDØ—‘×(Ñ(×,Ñ,Ó.ˆAØ!%×!2Ñ!2ˆAÔØŸ*™*ˆAŒKÜ-5°d·i±iÔ-@�v˜dŸi™i˜[Ñ)ÀdÇiÁiˆAŒFØŸ=™=ˆAŒLØ-ˆAÔØ!Ÿ]™]ˆAŒNØ×*Ñ*¨hÑ6ˆAŒKÜ˜a Õ&ñ		'ð
'ð ×Ñ×ÑÐ 4Ô5Ø×"Ñ"×2Ñ2Ø'×4Ñ4ð 3ó €Jð €NÙØ!+Ð,>Ñ!?Ðà ö
Ø A§N¡NÐ6LÓ$LŠAð
ˆð 
ô ˆ~Ó Ò"Ø+¨AÑ.ˆNñ ˜.×4Ò4ØˆáÜ˜CÔ Ø%ˆð %)€NÔ!Ø&4×&AÑ&A€C‡N�NÔ#à×Ñ˜×3Ñ3Ô4ð ‡K�K�ÔàÐùòw Hùò Kùô
ùò4 IùòN
s5   •TÁTÁTÁ!TÂ9TÃTÑ*TÑ?TÔT)r   r   Úreturnr   )r'   z(dict[SectionHeader, list[StreamlitPage]]rs   zlist[StreamlitPage])r0   r   rs   ÚNone)r5   ÚAppPageProtor6   r   rs   rt   )r)   z?Sequence[PageType] | Mapping[SectionHeader, Sequence[PageType]]r;   z#Literal['sidebar', 'hidden', 'top']r<   z
bool | intrs   r   )0Ú
__future__r   Úcollections.abcr   r   r   Úpathlibr   Útypingr   r	   r
   Ú	streamlitr   Ústreamlit.errorsr   Ústreamlit.navigation.pager   Ústreamlit.proto.ForwardMsg_pb2r   Ústreamlit.proto.Navigation_pb2r   rP   Ústreamlit.runtime.metrics_utilr   Ústreamlit.runtime.pages_managerr   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr   r   Ústreamlit.string_utilr   Ústreamlit.proto.AppPage_pb2r   ru   Ústreamlit.source_utilr   r   r   r   Ú__annotations__r   r!   r*   r2   r7   r8   rA   © r"   r    ú<module>r‡      s$  ðö #ç 7Ñ 7Ý ß 4Ñ 4å Ý 2Ý 3Ý 5Ý HÝ 9Ý 8÷õ +áÝCß8à€ˆyÓ Ø˜D‘j 8¨B°¨HÑ#5Ñ5¸ÑE€ˆ)Ó EðØðàóð.Ø:ðàóóó/ñ �Óð 5>Ø ñ	pDØJðpDð 2ðpDð ð	pDð
 òpDó ðpDðfbØJðbð 2ðbð ð	bð
 ôbr"   