o
    Yh<8                     @  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 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
r{d dlm+Z+ dZ,de-d< dZ.de-d< dZ/de-d< eee0f Z1de-d< ed Z2de-d< ed Z3de-d< ed Z4de-d < ed! Z5de-d"< ed# Z6de-d$< ee4e5e6f Z7de-d%< ee7ee0df f Z8de-d&< e9d'Z:de-d(< dKd,d-Z;dLd0d1Z<e#d2					dMdNd=d2Z=dOd>d?Z>dPdCdDZ?dQdEdFZ@dRdIdJZAdS )S    )annotationsN)Mapping)Path)dedent)TYPE_CHECKINGAnyFinalLiteralUnioncast)	TypeAlias)AtomicImageimage_to_url)LayoutConfig) 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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   _/var/www/html/Persson_Maskin/env/lib/python3.10/site-packages/streamlit/commands/page_config.py
<dictcomp>>   s   " z*_lower_clean_dict_keys.<locals>.<dictcomp>)items)r1   r4   r4   r;   _lower_clean_dict_keys=   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| tdddddd	d
W S  t	yK   t| trJ|  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stretch)widthFRGBr&   favicon)layout_configclampchannelsoutput_formatimage_id)
get_random_emoji
isinstancer5   r   
startswithr   r   r   r   	Exception)r?   r4   r4   r;   _get_favicon_stringA   s0   



rN   set_page_config
page_title
str | NonePageIcon | NonelayoutLayout | Noneinitial_sidebar_stateInitialSideBarState | None
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|du r-tj}nt	|d||j_
|dkr>tj}n|dkrFtj}n|dkrNtj}n|du rVtj}nt|d||j_|durwtd	t|}t| |jj}	t||	 t }
|
du rdS |
| dS )
u   
    Configure the default settings of the page.

    This command can be called multiple times in a script run to dynamically
    change the page configuration. The calls are additive, with each successive
    call overriding only the parameters that are specified.

    Parameters
    ----------
    page_title: str or None
        The page title, shown in the browser tab. If this is ``None``
        (default), the page title is inherited from the previous call of
        ``st.set_page_config``. If this is ``None`` and no previous call
        exists, the page title is inferred from the page source.

        If a page source is a Python file, its inferred title is derived from
        the filename. If a page source is a callable object, its inferred title
        is derived from the callable's name.

    page_icon : Anything supported by st.image (except list), str, or None
        The page favicon. If ``page_icon`` is ``None`` (default), the page icon
        is inherited from the previous call of ``st.set_page_config``. If this
        is ``None`` and no previous call exists, the favicon is 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", "wide", or None
        How the page content should be laid out. If this is ``None`` (default),
        the page layout is inherited from the previous call of
        ``st.set_page_config``. If this is ``None`` and no previous call
        exists, the page layout is ``"centered"``.

        ``"centered"`` constrains the elements into a centered column of fixed
        width. ``"wide"`` uses the entire screen.

    initial_sidebar_state: "auto", "expanded", "collapsed", or None
        How the sidebar should start out. If this is ``None`` (default), the
        sidebar state is inherited from the previous call of
        ``st.set_page_config``. If no previous call exists, the sidebar state
        is ``"auto"``.

        The folowing states are supported:

        - ``"auto"``: The sidebar is hidden on small devices and shown otherwise.
        - ``"expanded"``: The sidebar is shown initially.
        - ``"collapsed"``: The sidebar is hidden initially.

        In most cases, ``"auto"`` provides the best user experience across
        devices of different sizes.

    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 to configure. The following
        keys can have string or ``None`` values:

        - "Get help": The URL this menu item should point to.
        - "Report a Bug": The URL this menu item should point to.
        - "About": A markdown string to show in the About dialog.

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

        If you do not include a key, its menu item will be hidden (unless it
        was set by a previous call to ``st.set_page_config``). To remove an
        item that was specified in a previous call to ``st.set_page_config``,
        set its value to ``None`` in the dictionary.

    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$   )rS   r&   r'   r(   )rU   r/   )ForwardProtopage_config_changedtitlerN   rD   PageConfigProtoCENTEREDWIDELAYOUT_UNSETr   rS   AUTOEXPANDED	COLLAPSEDSIDEBAR_UNSETr   rU   r   r>   validate_menu_itemsrW   set_menu_items_protor   enqueue)rP   r?   rS   rU   rW   msg	pb_layoutpb_sidebar_statelowercase_menu_itemsmenu_items_protoctxr4   r4   r;   rO   p   sD   w

c                   C  s
   t tS N)r@   choicer0   r4   r4   r4   r;   rJ     s   
rJ   rk   rl   PageConfigProto.MenuItemsc                 C  s   t | v r| t  d ur| t  |_nd|_t| v r&| t d ur#| t |_nd|_t| v r@| t d ur;t| t p6d|_d S d|_	d S d S )NT )
r   get_help_urlhide_get_helpr   report_a_bug_urlhide_report_a_bugr!   r   about_section_mdclear_about_md)rk   rl   r4   r4   r;   rf      s   


rf   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   )rW   r9   r:   r4   r4   r;   re   9  s   

re   ry   TypeGuard[MenuKey]c                 C  s   | t tthv S rn   )r   r   r!   rx   r4   r4   r;   r~   C  s   r~   )r1   r/   r2   r3   )r?   r"   r2   r5   )NNNNN)rP   rQ   r?   rR   rS   rT   rU   rV   rW   rX   r2   rY   )r2   r5   )rk   r/   rl   rp   r2   rY   )rW   r/   r2   rY   )ry   r5   r2   r   )B
__future__r   r@   collections.abcr   pathlibr   textwrapr   typingr   r   r   r	   r
   r   typing_extensionsr   "streamlit.elements.lib.image_utilsr   r   #streamlit.elements.lib.layout_utilsr   streamlit.errorsr   r   r   r   streamlit.proto.ForwardMsg_pb2r   rZ   streamlit.proto.PageConfig_pb2r   r]   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/   listr0   r>   rN   rO   rJ   rf   re   r~   r4   r4   r4   r;   <module>   s\    

/ 
+


