o
    ßñh3  ã                   @  s"  U d dl mZ d dlZd dl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mZ d dlmZ d dlmZmZ d d	lmZ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%m&Z& d dl'm(Z( e
rud dlm)Z) dZ*de+d< dZ,de+d< dZ-de+d< eee.f Z/de+d< ed Z0de+d< ed Z1de+d< ed Z2de+d< ed  Z3de+d!< ed" Z4de+d#< ee2e3e4f Z5de+d$< ee5ee.df f Z6de+d%< e7d&ƒZ8de+d'< g d(¢Z9de+d)< dId-d.„Z:dJd1d2„Z;e!d3ƒ			4	5	dKdLd>d3„ƒZ<dMd?d@„Z=dNdAdB„Z>dOdCdD„Z?dPdGdH„Z@dS )Qé    )ÚannotationsN)ÚMapping)ÚPath)Údedent)ÚTYPE_CHECKINGÚAnyÚFinalÚLiteralÚUnionÚcast)Ú	TypeAlias)ÚAtomicImageÚimage_to_url)Ú StreamlitInvalidMenuItemKeyErrorÚStreamlitInvalidPageLayoutErrorÚ!StreamlitInvalidSidebarStateErrorÚStreamlitInvalidURLError)Ú
ForwardMsg)Ú
PageConfig)Úgather_metrics)Úget_script_run_ctx)Úis_emojiÚvalidate_material_icon)Úis_url)Ú	TypeGuardúget helpr   ÚGET_HELP_KEYúreport a bugÚREPORT_A_BUG_KEYÚaboutÚ	ABOUT_KEYr   ÚPageIcon)ÚcenteredÚwideÚLayout)ÚautoÚexpandedÚ	collapsedÚInitialSideBarState)zGet helpzGet Helpr   Ú_GetHelp)zReport a bugr   Ú_ReportABug)ÚAboutr   Ú_AboutÚMenuKeyÚ	MenuItemsuÛ  ðŸ”¥â„¢ðŸŽ‰ðŸš€ðŸŒŒðŸ’£âœ¨ðŸŒ™ðŸŽ†ðŸŽ‡ðŸ’¥ðŸ¤©ðŸ¤™ðŸŒ›ðŸ¤˜â¬†ðŸ’¡ðŸ¤ªðŸ¥‚âš¡ðŸ’¨ðŸŒ ðŸŽŠðŸ¿ðŸ˜›ðŸ”®ðŸ¤ŸðŸŒƒðŸƒðŸ¾ðŸ’«â–ªðŸŒ´ðŸŽˆðŸŽ¬ðŸŒ€ðŸŽ„ðŸ˜â˜”â›½ðŸ‚ðŸ’ƒðŸ˜ŽðŸ¸ðŸŽ¨ðŸ¥³â˜€ðŸ˜ðŸ…±ðŸŒžðŸ˜»ðŸŒŸðŸ˜œðŸ’¦ðŸ’…ðŸ¦„ðŸ˜‹ðŸ˜‰ðŸ‘»ðŸðŸ¤¤ðŸ‘¯ðŸŒ»â€¼ðŸŒˆðŸ‘ŒðŸŽƒðŸ’›ðŸ˜šðŸ”«ðŸ™ŒðŸ‘½ðŸ¬ðŸŒ…â˜ðŸ·ðŸ‘­â˜•ðŸŒšðŸ’ðŸ‘…ðŸ¥°ðŸœðŸ˜ŒðŸŽ¥ðŸ•ºâ•ðŸ§¡â˜„ðŸ’•ðŸ»âœ…ðŸŒ¸ðŸš¬ðŸ¤“ðŸ¹Â®â˜ºðŸ’ªðŸ˜™â˜˜ðŸ¤ âœŠðŸ¤—ðŸµðŸ¤žðŸ˜‚ðŸ’¯ðŸ˜ðŸ“»ðŸŽ‚ðŸ’—ðŸ’œðŸŒŠâ£ðŸŒðŸ˜˜ðŸ’†ðŸ¤‘ðŸŒ¿ðŸ¦‹ðŸ˜ˆâ›„ðŸš¿ðŸ˜ŠðŸŒ¹ðŸ¥´ðŸ˜½ðŸ’‹ðŸ˜­ðŸ–¤ðŸ™†ðŸ‘âšªðŸ’Ÿâ˜ƒðŸ™ˆðŸ­ðŸ’»ðŸ¥€ðŸš—ðŸ¤§ðŸðŸ’ŽðŸ’“ðŸ¤ðŸ’„ðŸ’–ðŸ”žâ‰â°ðŸ•ŠðŸŽ§â˜ â™¥ðŸŒ³ðŸ¾ðŸ™‰â­ðŸ’ŠðŸ³ðŸŒŽðŸ™ŠðŸ’¸â¤ðŸ”ªðŸ˜†ðŸŒ¾âœˆðŸ“šðŸ’€ðŸ âœŒðŸƒðŸŒµðŸš¨ðŸ’‚ðŸ¤«ðŸ¤­ðŸ˜—ðŸ˜„ðŸ’ðŸ‘ðŸ™ƒðŸ––ðŸ’žðŸ˜…ðŸŽ…ðŸ„ðŸ†“ðŸ‘‰ðŸ’©ðŸ”ŠðŸ¤·âŒšðŸ‘¸ðŸ˜‡ðŸš®ðŸ’ðŸ‘³ðŸ½ðŸ’˜ðŸ’¿ðŸ’‰ðŸ‘ ðŸŽ¼ðŸŽ¶ðŸŽ¤ðŸ‘—â„ðŸ”ðŸŽµðŸ¤’ðŸ°ðŸ‘“ðŸ„ðŸŒ²ðŸŽ®ðŸ™‚ðŸ“ˆðŸš™ðŸ“ðŸ˜µðŸ—£â—ðŸŒºðŸ™„ðŸ‘„ðŸš˜ðŸ¥ºðŸŒðŸ¡â™¦ðŸ’ðŸŒ±ðŸ‘‘ðŸ‘™â˜‘ðŸ‘¾ðŸ©ðŸ¥¶ðŸ“£ðŸ¼ðŸ¤£â˜¯ðŸ‘µðŸ«âž¡ðŸŽ€ðŸ˜ƒâœ‹ðŸžðŸ™‡ðŸ˜¹ðŸ™ðŸ‘¼ðŸâš«ðŸŽðŸªðŸ”¨ðŸŒ¼ðŸ‘†ðŸ‘€ðŸ˜³ðŸŒðŸ“–ðŸ‘ƒðŸŽ¸ðŸ‘§ðŸ’‡ðŸ”’ðŸ’™ðŸ˜žâ›…ðŸ»ðŸ´ðŸ˜¼ðŸ—¿ðŸ—â™ ðŸ¦âœ”ðŸ¤–â˜®ðŸ¢ðŸŽðŸ’¤ðŸ˜€ðŸºðŸ˜ðŸ˜´ðŸ“ºâ˜¹ðŸ˜²ðŸ‘ðŸŽ­ðŸ’šðŸ†ðŸ‹ðŸ”µðŸðŸ”´ðŸ””ðŸ§ðŸ‘°â˜ŽðŸ†ðŸ¤¡ðŸ ðŸ“²ðŸ™‹ðŸ“ŒðŸ¬âœðŸ”‘ðŸ“±ðŸ’°ðŸ±ðŸ’§ðŸŽ“ðŸ•ðŸ‘ŸðŸ£ðŸ‘«ðŸ‘ðŸ˜¸ðŸ¦ðŸ‘ðŸ†—ðŸŽ¯ðŸ“¢ðŸš¶ðŸ¦…ðŸ§ðŸ’¢ðŸ€ðŸš«ðŸ’‘ðŸŸðŸŒ½ðŸŠðŸŸðŸ’ðŸ’²ðŸðŸ¥ðŸ¸â˜â™£ðŸ‘Šâš“âŒðŸ¯ðŸˆðŸ“°ðŸŒ§ðŸ‘¿ðŸ³ðŸ’·ðŸºðŸ“žðŸ†’ðŸ€ðŸ¤ðŸš²ðŸ”ðŸ‘¹ðŸ™ðŸŒ·ðŸ™ŽðŸ¥ðŸ’µðŸ”ðŸ“¸âš â“ðŸŽ©âœ‚ðŸ¼ðŸ˜‘â¬‡âš¾ðŸŽðŸ’”ðŸ”âš½ðŸ’­ðŸŒðŸ·ðŸâœ–ðŸ‡ðŸ“ðŸŠðŸ™ðŸ‘‹ðŸ¤”ðŸ¥ŠðŸ—½ðŸ‘ðŸ˜ðŸ°ðŸ’ðŸ´â™€ðŸ¦ðŸ“âœðŸ‘‚ðŸ´ðŸ‘‡ðŸ†˜ðŸ˜¡ðŸ‰ðŸ‘©ðŸ’ŒðŸ˜ºâœðŸ¼ðŸ’ðŸ¶ðŸ‘ºðŸ–•ðŸ‘¬ðŸ‰ðŸ»ðŸ¾â¬…â¬â–¶ðŸ‘®ðŸŒâ™‚ðŸ”¸ðŸ‘¶ðŸ®ðŸ‘ªâ›³ðŸðŸŽ¾ðŸ•ðŸ‘´ðŸ¨ðŸŠðŸ”¹Â©ðŸŽ£ðŸ‘¦ðŸ‘£ðŸ‘¨ðŸ‘ˆðŸ’¬â­•ðŸ“¹ðŸ“·ÚRANDOM_EMOJIS)u   ðŸŽˆu   ðŸ¤“u   ðŸˆu   ðŸš²u   ðŸ§u   ðŸ¦’u   ðŸ³u   ðŸ•¹ï¸u   ðŸ‡¦ðŸ‡²u   ðŸŽ¸u   ðŸ¦ˆu   ðŸ’Žu   ðŸ‘©â€ðŸŽ¤u   ðŸ§™â€â™‚ï¸u   ðŸ»u   ðŸŽŽÚ
ENG_EMOJISÚdictÚreturnúdict[str, Any]c                 C  s   dd„ |   ¡ D ƒS )Nc                 S  s"   i | ]\}}t |ƒ ¡  ¡ |“qS © )ÚstrÚlowerÚstrip)Ú.0ÚkÚvr4   r4   úR/var/www/vscode/kcb/lib/python3.10/site-packages/streamlit/commands/page_config.pyÚ
<dictcomp>U   s   " z*_lower_clean_dict_keys.<locals>.<dictcomp>)Úitems)r1   r4   r4   r;   Ú_lower_clean_dict_keysT   s   r>   Ú	page_iconr5   c                 C  s’   | dkrt ƒ S t| tƒrt| ƒrd| › S t| tƒr#|  d¡r#t| ƒS t| tƒr,t| ƒ} zt| dddddd	W S  tyH   t| tƒrG|  Y S ‚ w )
a  Return the string to pass to the frontend to have it show
    the given PageIcon.

    If page_icon is a string that looks like an emoji (or an emoji shortcode),
    we return it as-is. Otherwise we use `image_to_url` to return a URL.

    (If `image_to_url` raises an error and page_icon is a string, return
    the unmodified page_icon string instead of re-raising the error.)
    Úrandomzemoji:z	:materialéÿÿÿÿFÚRGBr%   Úfavicon)ÚwidthÚclampÚchannelsÚoutput_formatÚimage_id)	Úget_random_emojiÚ
isinstancer5   r   Ú
startswithr   r   r   Ú	Exception)r?   r4   r4   r;   Ú_get_favicon_stringX   s,   

ú
úrM   Úset_page_configr"   r%   Ú
page_titleú
str | NoneúPageIcon | NoneÚlayoutÚinitial_sidebar_stateÚ
menu_itemsúMenuItems | NoneÚNonec                 C  sî   t ƒ }| dur| |j_|durt|ƒ|j_|dkrtj}n|dkr%tj}nt|d‚||j_	|dkr6tj
}n|dkr>tj}n|dkrFtj}nt|d‚||j_|durgtd	t|ƒƒ}t|ƒ |jj}	t||	ƒ tƒ }
|
du rpdS |
 |¡ dS )
uy  
    Configures the default settings of the page.

    .. note::
        This must be the first Streamlit command used on an app page, and must only
        be set once per page.

    Parameters
    ----------
    page_title: str or None
        The page title, shown in the browser tab. If None, defaults to the
        filename of the script ("app.py" would show "app â€¢ Streamlit").

    page_icon : Anything supported by st.image (except list), str, or None
        The page favicon. If ``page_icon`` is ``None`` (default), the favicon
        will be a monochrome Streamlit logo.

        In addition to the types supported by |st.image|_ (except list), the
        following strings are valid:

        - A single-character emoji. For example, you can set ``page_icon="ðŸ¦ˆ"``.

        - An emoji short code. For example, you can set ``page_icon=":shark:"``.
          For a list of all supported codes, see
          https://share.streamlit.io/streamlit/emoji-shortcodes.

        - The string literal, ``"random"``. You can set ``page_icon="random"``
          to set a random emoji from the supported list above.

        - 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, ``page_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.

        .. note::
            Colors are not supported for Material icons. When you use a
            Material icon for favicon, it will be black, regardless of browser
            theme.

        .. |st.image| replace:: ``st.image``
        .. _st.image: https://docs.streamlit.io/develop/api-reference/media/st.image

    layout: "centered" or "wide"
        How the page content should be laid out. Defaults to "centered",
        which constrains the elements into a centered column of fixed width;
        "wide" uses the entire screen.

    initial_sidebar_state: "auto", "expanded", or "collapsed"
        How the sidebar should start out. Defaults to "auto",
        which hides the sidebar on small devices and shows it otherwise.
        "expanded" shows the sidebar initially; "collapsed" hides it.
        In most cases, you should just use "auto", otherwise the app will
        look bad when embedded and viewed on mobile.

    menu_items: dict
        Configure the menu that appears on the top-right side of this app.
        The keys in this dict denote the menu item you'd like to configure:

        - "Get help": str or None
            The URL this menu item should point to.
            If None, hides this menu item.
        - "Report a Bug": str or None
            The URL this menu item should point to.
            If None, hides this menu item.
        - "About": str or None
            A markdown string to show in the About dialog.
            If None, only shows Streamlit's default About text.

        The URL may also refer to an email address e.g. ``mailto:john@example.com``.

    Example
    -------
    >>> import streamlit as st
    >>>
    >>> st.set_page_config(
    ...     page_title="Ex-stream-ly Cool App",
    ...     page_icon="ðŸ§Š",
    ...     layout="wide",
    ...     initial_sidebar_state="expanded",
    ...     menu_items={
    ...         'Get Help': 'https://www.extremelycoolapp.com/help',
    ...         'Report a bug': "https://www.extremelycoolapp.com/bug",
    ...         'About': "# This is a header. This is an *extremely* cool app!"
    ...     }
    ... )
    Nr"   r#   )rR   r%   r&   r'   )rS   r.   )ÚForwardProtoÚpage_config_changedÚtitlerM   rC   ÚPageConfigProtoÚCENTEREDÚWIDEr   rR   ÚAUTOÚEXPANDEDÚ	COLLAPSEDr   rS   r   r>   Úvalidate_menu_itemsrT   Úset_menu_items_protor   Úenqueue)rO   r?   rR   rS   rT   ÚmsgÚ	pb_layoutÚpb_sidebar_stateÚlowercase_menu_itemsÚmenu_items_protoÚctxr4   r4   r;   rN   …   s<   c
ÿ
c                   C  s   t  tdt  ¡S )Né
   )r@   Úchoicer/   r0   r4   r4   r4   r;   rI     s   rI   c                 C  sz   t | v r| t  d ur| t  |_nd|_t| v r&| t d ur#| t |_nd|_t| v r9| t d ur;t| t ƒ|_d S d S d S )NT)	r   Úget_help_urlÚhide_get_helpr   Úreport_a_bug_urlÚhide_report_a_bugr    r   Úabout_section_md)rf   rg   r4   r4   r;   ra     s   þra   c                 C  sL   |   ¡ D ]\}}t|ƒst|d‚|d ur#t|dƒs#|tkr#t|d‚qd S )N©Úkey)ÚhttpÚhttpsÚmailto)Úurl)r=   Úvalid_menu_item_keyr   r   r    r   )rT   r9   r:   r4   r4   r;   r`   ,  s   
ÿ
€úr`   rq   úTypeGuard[MenuKey]c                 C  s   | t tthv S )N)r   r   r    rp   r4   r4   r;   rv   6  s   rv   )r1   r.   r2   r3   )r?   r!   r2   r5   )NNr"   r%   N)rO   rP   r?   rQ   rR   r$   rS   r(   rT   rU   r2   rV   )r2   r5   )r2   rV   )rT   r.   r2   rV   )rq   r5   r2   rw   )AÚ
__future__r   r@   Úcollections.abcr   Úpathlibr   Útextwrapr   Útypingr   r   r   r	   r
   r   Útyping_extensionsr   Ú"streamlit.elements.lib.image_utilsr   r   Ústreamlit.errorsr   r   r   r   Ústreamlit.proto.ForwardMsg_pb2r   rW   Ústreamlit.proto.PageConfig_pb2r   rZ   Ústreamlit.runtime.metrics_utilr   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr   Ústreamlit.string_utilr   r   Ústreamlit.url_utilr   r   r   Ú__annotations__r   r    r5   r!   r$   r(   r)   r*   r,   r-   r.   Úlistr/   r0   r>   rM   rN   rI   ra   r`   rv   r4   r4   r4   r;   Ú<module>   s\    ÿ

-û 



