Ë
    EêñiE¹  ã                  ó  — U d dl mZ d dlmZmZ d dlmZmZmZm	Z	m
Z
mZmZmZ d dl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mZmZ d dlmZ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* d dl+m,Z, d dl-m.Z. d dl/m0Z0m1Z1 d dl2m3Z3 er d dlm4Z4 d dl5m6Z6 d dl/m7Z7m8Z8m9Z9 d dl:m;Z;m<Z<m=Z=  ed«      Z> ed«      Z?e	d   Z@deAd<    G d„ dee>   «      ZB G d„ dee>   «      ZC	 	 	 	 	 d"	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#d„ZDd$d„ZE G d „ d!«      ZFy)%é    )Úannotations)ÚCallableÚSequence)ÚTYPE_CHECKINGÚAnyÚGenericÚLiteralÚ	TypeAliasÚTypeVarÚcastÚoverload)Úconvert_anything_to_list)Úcurrent_form_id)ÚWidthÚcreate_layout_config)Ú(convert_to_sequence_and_check_comparableÚget_default_indicesÚmaybe_coerce_enumÚmaybe_coerce_enum_sequenceÚ0validate_and_sync_multiselect_value_with_optionsÚ$validate_and_sync_value_with_options)Úcheck_widget_policiesÚmaybe_raise_label_warnings)ÚKeyÚLabelVisibilityÚcompute_and_register_element_idÚ get_label_visibility_proto_valueÚsave_for_app_testingÚto_key©ÚStreamlitAPIException)ÚButtonGroup)Úgather_metrics)Úget_script_run_ctx)Ú
BindOptionÚregister_widget)Úextract_leading_icon)ÚOptionSequence)ÚDeltaGenerator)Ú
WidgetArgsÚWidgetCallbackÚWidgetKwargs)ÚRegisterWidgetResultÚWidgetDeserializerÚWidgetSerializerÚTÚV)ÚsingleÚmultir
   ÚSelectionModec                  óz   — e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   dedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zy)Ú_SingleSelectButtonGroupSerdezªString-based serde for single-select ButtonGroup widgets.

    Uses string-based values (formatted option strings) for robust handling
    of dynamic option changes.
    úSequence[T]Úoptionsú	list[str]Úformatted_optionsúdict[str, int]Ú formatted_option_to_option_indexú
int | NoneÚdefault_option_indexúCallable[[Any], str]Úformat_funcN)r>   r@   c               óJ   — || _         || _        || _        || _        || _        y ©N)r8   r:   r<   r>   r@   )Úselfr8   r:   r<   r>   r@   s         úi/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/widgets/button_group.pyÚ__init__z&_SingleSelectButtonGroupSerde.__init___   s+   € ð ˆŒØ!2ˆÔØ0PˆÔ-Ø$8ˆÔ!Ø&ˆÕó    c                ó  — |€g S t        | j                  «      dk(  rg S t        | j                  «      D ]  \  }}||k(  sŒ| j                  |   gc S  	 | j	                  |«      }|gS # t
        $ r t        |«      gcY S w xY w)zCSerialize single-select value to a list of strings for wire format.r   )Úlenr8   Ú	enumerater:   r@   Ú	ExceptionÚstr)rC   ÚvÚindexÚoptÚformatted_values        rD   Ú	serializez'_SingleSelectButtonGroupSerde.serializen   s—   € àˆ9ØˆIÜˆt�|‰|Ó Ò!ØˆIô $ D§L¡LÓ1ò 	7‰JˆE�3Ø�a‹xØ×.Ñ.¨uÑ5Ð6Ò6ð	7ð
	Ø"×.Ñ.¨qÓ1ˆOð  Ð Ð øô ò 	Ü˜“F�8ŠOð	ús   ÁA( Á(B Á?B c                ó  — t        | j                  «      dk(  ry|€&| j                  �| j                  | j                     S yt        |«      dk(  ry|d   }| j                  j	                  |«      }|�| j                  |   S |S )z5Deserialize from a list of strings to a single value.r   N)rH   r8   r>   r<   Úget)rC   Úui_valueÚstring_valueÚoption_indexs       rD   Údeserializez)_SingleSelectButtonGroupSerde.deserialize‚   s‘   € äˆt�|‰|Ó Ò!Øð ÐØ×(Ñ(Ð4Ø—|‘| D×$=Ñ$=Ñ>Ð>Øô ˆx‹=˜AÒØà ‘{ˆð ×<Ñ<×@Ñ@ÀÓNˆØÐ#Ø—<‘< Ñ-Ð-ð ÐrF   )r8   r7   r:   r9   r<   r;   r>   r=   r@   r?   ÚreturnÚNone)rL   úT | str | NonerW   r9   )rS   úlist[str] | NonerW   rY   ©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rK   rE   rP   rV   © rF   rD   r6   r6   R   sx   … ñð ÓØ Ó Ø&4Ó4Ø$Ó$Ø%Ó%ð ,0Ø,/ñ'àð'ð %ð	'ð
 +9ð'ð )ð'ð *ð'ð 
ó'ó!ô(rF   r6   c                  óz   — e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   dedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zy)Ú_MultiSelectButtonGroupSerdez©String-based serde for multi-select ButtonGroup widgets.

    Uses string-based values (formatted option strings) for robust handling
    of dynamic option changes.
    r7   r8   r9   r:   r;   r<   ú	list[int]Údefault_option_indicesr?   r@   N)re   r@   c               óR   — || _         || _        || _        |xs g | _        || _        y rB   )r8   r:   r<   re   r@   )rC   r8   r:   r<   re   r@   s         rD   rE   z%_MultiSelectButtonGroupSerde.__init__©   s0   € ð ˆŒØ!2ˆÔØ0PˆÔ-Ø&<Ò&BÀˆÔ#Ø&ˆÕrF   c                ó`  — |€g S t        |«      }g }|D ]n  }d}t        | j                  «      D ],  \  }}||k(  sŒ|j                  | j                  |   «       d} n |rŒL	 | j                  |«      }|j                  |«       Œp |S # t        $ r |j                  t        |«      «       Y Œ˜w xY w)zASerialize multi-select values to list of strings for wire format.FT)r   rI   r8   Úappendr:   r@   rJ   rK   )	rC   ÚvalueÚconverted_valueÚvaluesrL   ÚfoundrM   rN   rO   s	            rD   rP   z&_MultiSelectButtonGroupSerde.serialize¸   sÇ   € àˆ=ØˆIÜ2°5Ó9ˆØˆØ ò 	+ˆAàˆEÜ'¨¯©Ó5ò ‘
��sØ˜!“8Ø—M‘M $×"8Ñ"8¸Ñ"?Ô@Ø �EÙð	ñ ØðØ"&×"2Ñ"2°1Ó"5�ð
 �M‰M˜/Õ*ð'	+ð( ˆøô ò Ø—‘œc !›fÔ%Ùðús   Á!BÂ#B-Â,B-c                ó  — |€'| j                   D �cg c]  }| j                  |   ‘Œ c}S g }|D ]O  }| j                  j                  |«      }|�|j	                  | j                  |   «       Œ?|j	                  |«       ŒQ |S c c}w )z3Deserialize from list of strings to list of values.)re   r8   r<   rR   rh   )rC   rS   Úirk   rL   rU   s         rD   rV   z(_MultiSelectButtonGroupSerde.deserializeÔ   s‡   € àÐØ-1×-HÑ-HÖI¨�D—L‘L “OÒIÐIà "ˆØò 	!ˆAØ×@Ñ@×DÑDÀQÓGˆLØÐ'Ø—‘˜dŸl™l¨<Ñ8Õ9ð —‘˜aÕ ð	!ð ˆùò Js   ‘B)r8   r7   r:   r9   r<   r;   re   úlist[int] | Noner@   r?   rW   rX   )ri   zlist[T | str] | list[T] | NonerW   r9   )rS   rZ   rW   zlist[T | str] | list[T]r[   ra   rF   rD   rc   rc   œ   sx   … ñð ÓØ Ó Ø&4Ó4Ø%Ó%Ø%Ó%ð 48Ø,/ñ'àð'ð %ð	'ð
 +9ð'ð !1ð'ð *ð'ð 
ó'óô8rF   rc   Nc                ó~  — t        «       }| |_        ||j                  d d  ||_        ||_        ||_        t         j                  j                  |j                  «       «      |_	        |
|_
        |�*||_        t        |«      |j                  _        |	�|	|_        |D ]  }|j                   j#                  |«       Œ |S rB   )ÚButtonGroupProtoÚidÚdefaultÚform_idÚdisabledÚ
click_modeÚStyleÚValueÚupperÚstyleÚrequiredÚlabelr   Úlabel_visibilityri   Úhelpr8   rh   )Ú	widget_idr:   Údefault_valuesru   r   rv   rz   r|   r}   r~   r{   ÚprotoÚformatted_options                rD   Ú_build_protorƒ   ä   s¸   € ô Ó€Eà€E„HØ%€E‡M�M‘!ÐØ#€E„MØ€E„NØ!€EÔÜ"×(Ñ(×.Ñ.¨u¯{©{«}Ó=€E„KØ€E„Nð ÐØˆŒÜ'GØó(
ˆ×ÑÔ$ð ÐØˆEŒJà-ò /ÐØ�‰×ÑÐ-Õ.ð/à€LrF   c                ó*   — | dvrt        d| › d�«      ‚y)zHCheck if the selection_mode value is valid or raise exception otherwise.>   r3   r2   zYThe selection_mode argument must be one of ['single', 'multi']. The argument passed was 'ú'.Nr    )Úselection_modes    rD   Ú#_maybe_raise_selection_mode_warningr‡   	  s/   € àÐ0Ñ0Ü#ð(Ø(6Ð'7°rð;ó
ð 	
ð 1rF   c                  ót  — e Zd Zeddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zedddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„«       Zeddd
dddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zedddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d d„«       Z ed«      ddddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d!d„«       Zeddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d"d„«       Zedddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#d„«       Zeddd
dddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d$d„«       Zedddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d%d„«       Z ed«      ddddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d&d„«       Z ed«      ddddddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d'd„«       Zddddddddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d(d„Ze	d)d„«       Z
y)*ÚButtonGroupMixinr2   NFÚvisibleÚcontent)r†   r@   Úkeyr~   Ú	on_changeÚargsÚkwargsru   r}   ÚwidthÚbindc                ó   — y rB   ra   ©rC   r|   r8   r†   rs   r{   r@   rŒ   r~   r�   rŽ   r�   ru   r}   r�   r‘   s                   rD   ÚpillszButtonGroupMixin.pills  ó   € ð& rF   )r†   rs   r@   rŒ   r~   r�   rŽ   r�   ru   r}   r�   r‘   c                ó   — y rB   ra   r“   s                   rD   r”   zButtonGroupMixin.pills*  ó   € ð& rF   .)r†   rs   r{   r@   rŒ   r~   r�   rŽ   r�   ru   r}   r�   r‘   c                ó   — y rB   ra   r“   s                   rD   r”   zButtonGroupMixin.pills?  r—   rF   )rs   r{   r@   rŒ   r~   r�   rŽ   r�   ru   r}   r�   r‘   c                ó   — y rB   ra   r“   s                   rD   r”   zButtonGroupMixin.pillsT  ó   € ð& rF   r”   c               óD   — | j                  ||||||||d|	|
|||||¬«      S )a#  Display a pills widget.

        A pills widget is similar to a ``st.selectbox`` or ``st.multiselect``
        where the ``options`` are displayed as pill-buttons instead of a
        drop-down list.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this widget is for.
            The label can optionally contain GitHub-flavored Markdown of the
            following types: Bold, Italics, Strikethroughs, Inline Code, Links,
            and Images. Images display like icons, with a max height equal to
            the font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Common block-level Markdown (headings,
            lists, blockquotes) is automatically escaped and displays as
            literal text in labels.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            For accessibility reasons, you should never set an empty label, but
            you can hide it with ``label_visibility`` if needed. In the future,
            we may disallow empty labels by raising an exception.

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

        options : Iterable of V
            Labels for the select options in an ``Iterable``. This can be a
            ``list``, ``set``, or anything supported by ``st.dataframe``. If
            ``options`` is dataframe-like, the first column will be used. Each
            label will be cast to ``str`` internally by default and can
            optionally contain GitHub-flavored Markdown, including the Markdown
            directives described in the ``body`` parameter of ``st.markdown``.

        selection_mode : "single" or "multi"
            The selection mode for the widget. If this is ``"single"``
            (default), only one option can be selected. If this is ``"multi"``,
            multiple options can be selected.

        default : Iterable of V, V, or None
            The value of the widget when it first renders. If the
            ``selection_mode`` is ``multi``, this can be a list of values, a
            single value, or ``None``. If the ``selection_mode`` is
            ``"single"``, this can be a single value or ``None``.

        required : bool
            Whether a selection is required. If this is ``True`` and
            ``selection_mode="single"``, users cannot deselect an option once
            one is selected. Clicking an already-selected option does nothing.
            The default is ``False``.

            If ``required=True`` is used with ``selection_mode="multi"``, an
            exception is raised.

        format_func : function
            Function to modify the display of the options. It receives
            the raw option as an argument and should output the label to be
            shown for that option. This has no impact on the return value of
            the command. The output can optionally contain GitHub-flavored
            Markdown, including the Markdown directives described in the
            ``body`` parameter of ``st.markdown``.

        key : str, int, or None
            An optional string or integer to use as the unique key for
            the widget. If this is ``None`` (default), a key will be
            generated for the widget based on the values of the other
            parameters. No two widgets may have the same key. Assigning
            a key stabilizes the widget's identity and preserves its
            state across reruns even when other parameters change.

            .. note::
               Changing ``selection_mode`` resets the widget even when a
               key is provided.

            A key lets you read or update the widget's value via
            ``st.session_state[key]``. For more details, see `Widget
            behavior <https://docs.streamlit.io/develop/concepts/architecture/widget-behavior>`_.

            Additionally, if ``key`` is provided, it will be used as a
            CSS class name prefixed with ``st-key-``.

        help : str or None
            A tooltip that gets displayed next to the widget label. Streamlit
            only displays the tooltip when ``label_visibility="visible"``. If
            this is ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        on_change : callable
            An optional callback invoked when this widget's value changes.

        args : list or tuple
            An optional list or tuple of args to pass to the callback.

        kwargs : dict
            An optional dict of kwargs to pass to the callback.

        disabled : bool
            An optional boolean that disables the widget if set to ``True``.
            The default is ``False``.

        label_visibility : "visible", "hidden", or "collapsed"
            The visibility of the label. The default is ``"visible"``. If this
            is ``"hidden"``, Streamlit displays an empty spacer instead of the
            label, which can help keep the widget aligned with other widgets.
            If this is ``"collapsed"``, Streamlit displays no label or spacer.

        width : "content", "stretch", or int
            The width of the pills widget. This can be one of the following:

            - ``"content"`` (default): The width of the widget matches the
              width of its content, but doesn't exceed the width of the parent
              container.
            - ``"stretch"``: The width of the widget matches the width of the
              parent container.
            - An integer specifying the width in pixels: The widget has a
              fixed width. If the specified width is greater than the width of
              the parent container, the width of the widget matches the width
              of the parent container.

        bind : "query-params" or None
            Binding mode for syncing the widget's value with a URL query
            parameter. If this is ``None`` (default), the widget's value
            is not synced to the URL. When this is set to
            ``"query-params"``, changes to the widget update the URL, and
            the widget can be initialized or updated through a query
            parameter in the URL. This requires ``key`` to be set. The
            key is used as the query parameter name.

            When the widget's value equals its default, the query
            parameter is removed from the URL to keep it clean. A bound
            query parameter can't be set or deleted through
            ``st.query_params``; it can only be programmatically changed
            through ``st.session_state``.

            An empty query parameter (e.g., ``?tags=``) clears the
            widget. Invalid query parameter values are ignored and removed from
            the URL. For ``selection_mode="multi"``, multiple selections use
            repeated parameters (e.g., ``?tags=Red&tags=Blue``) and duplicates
            are deduplicated.

        Returns
        -------
        list of V, V, or None
            If the ``selection_mode`` is ``multi``, this is a list of selected
            options or an empty list. If the ``selection_mode`` is
            ``"single"``, this is a selected option or ``None``.

            This contains copies of the selected options, not the originals.

        Examples
        --------
        **Example 1: Multi-select pills**

        Display a multi-select pills widget, and show the selection:

        >>> import streamlit as st
        >>>
        >>> options = ["North", "East", "South", "West"]
        >>> selection = st.pills("Directions", options, selection_mode="multi")
        >>> st.markdown(f"Your selected options: {selection}.")

        .. output::
           https://doc-pills-multi.streamlit.app/
           height: 200px

        **Example 2: Single-select pills with icons**

        Display a single-select pills widget with icons:

        >>> import streamlit as st
        >>>
        >>> option_map = {
        ...     0: ":material/add:",
        ...     1: ":material/zoom_in:",
        ...     2: ":material/zoom_out:",
        ...     3: ":material/zoom_out_map:",
        ... }
        >>> selection = st.pills(
        ...     "Tool",
        ...     options=option_map.keys(),
        ...     format_func=lambda option: option_map[option],
        ...     selection_mode="single",
        ... )
        >>> st.write(
        ...     "Your selected option: "
        ...     f"{None if selection is None else option_map[selection]}"
        ... )

        .. output::
           https://doc-pills-single.streamlit.app/
           height: 200px

        r”   ©r|   r†   rs   r{   r@   rŒ   r~   rz   r�   rŽ   r�   ru   r}   r�   r‘   ©Ú_internal_button_groupr“   s                   rD   r”   zButtonGroupMixin.pillsh  sM   € ðx ×*Ñ*ØØØ)ØØØ#ØØØØØØØØ-ØØð! +ó 
ð 	
rF   c                ó   — y rB   ra   r“   s                   rD   Úsegmented_controlz"ButtonGroupMixin.segmented_controlY  r•   rF   c                ó   — y rB   ra   r“   s                   rD   r    z"ButtonGroupMixin.segmented_controln  r—   rF   c                ó   — y rB   ra   r“   s                   rD   r    z"ButtonGroupMixin.segmented_controlƒ  r—   rF   c                ó   — y rB   ra   r“   s                   rD   r    z"ButtonGroupMixin.segmented_control˜  rš   rF   r    c               óD   — | j                  ||||||||d|	|
|||||¬«      S )a¢#  Display a segmented control widget.

        A segmented control widget is a linear set of segments where each of
        the passed ``options`` functions like a toggle button.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this widget is for.
            The label can optionally contain GitHub-flavored Markdown of the
            following types: Bold, Italics, Strikethroughs, Inline Code, Links,
            and Images. Images display like icons, with a max height equal to
            the font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Common block-level Markdown (headings,
            lists, blockquotes) is automatically escaped and displays as
            literal text in labels.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            For accessibility reasons, you should never set an empty label, but
            you can hide it with ``label_visibility`` if needed. In the future,
            we may disallow empty labels by raising an exception.

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

        options : Iterable of V
            Labels for the select options in an ``Iterable``. This can be a
            ``list``, ``set``, or anything supported by ``st.dataframe``. If
            ``options`` is dataframe-like, the first column will be used. Each
            label will be cast to ``str`` internally by default and can
            optionally contain GitHub-flavored Markdown, including the Markdown
            directives described in the ``body`` parameter of ``st.markdown``.

        selection_mode : "single" or "multi"
            The selection mode for the widget. If this is ``"single"``
            (default), only one option can be selected. If this is ``"multi"``,
            multiple options can be selected.

        default : Iterable of V, V, or None
            The value of the widget when it first renders. If the
            ``selection_mode`` is ``multi``, this can be a list of values, a
            single value, or ``None``. If the ``selection_mode`` is
            ``"single"``, this can be a single value or ``None``.

        required : bool
            Whether a selection is required. If this is ``True`` and
            ``selection_mode="single"``, users cannot deselect an option once
            one is selected. Clicking an already-selected option does nothing.
            The default is ``False``.

            If ``required=True`` is used with ``selection_mode="multi"``, an
            exception is raised.

        format_func : function
            Function to modify the display of the options. It receives
            the raw option as an argument and should output the label to be
            shown for that option. This has no impact on the return value of
            the command. The output can optionally contain GitHub-flavored
            Markdown, including the Markdown directives described in the
            ``body`` parameter of ``st.markdown``.

        key : str, int, or None
            An optional string or integer to use as the unique key for
            the widget. If this is ``None`` (default), a key will be
            generated for the widget based on the values of the other
            parameters. No two widgets may have the same key. Assigning
            a key stabilizes the widget's identity and preserves its
            state across reruns even when other parameters change.

            .. note::
               Changing ``selection_mode`` resets the widget even when a
               key is provided.

            A key lets you read or update the widget's value via
            ``st.session_state[key]``. For more details, see `Widget
            behavior <https://docs.streamlit.io/develop/concepts/architecture/widget-behavior>`_.

            Additionally, if ``key`` is provided, it will be used as a
            CSS class name prefixed with ``st-key-``.

        help : str or None
            A tooltip that gets displayed next to the widget label. Streamlit
            only displays the tooltip when ``label_visibility="visible"``. If
            this is ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        on_change : callable
            An optional callback invoked when this widget's value changes.

        args : list or tuple
            An optional list or tuple of args to pass to the callback.

        kwargs : dict
            An optional dict of kwargs to pass to the callback.

        disabled : bool
            An optional boolean that disables the widget if set to ``True``.
            The default is ``False``.

        label_visibility : "visible", "hidden", or "collapsed"
            The visibility of the label. The default is ``"visible"``. If this
            is ``"hidden"``, Streamlit displays an empty spacer instead of the
            label, which can help keep the widget aligned with other widgets.
            If this is ``"collapsed"``, Streamlit displays no label or spacer.

        width : "content", "stretch", or int
            The width of the segmented control widget. This can be one of the
            following:

            - ``"content"`` (default): The width of the widget matches the
              width of its content, but doesn't exceed the width of the parent
              container.
            - ``"stretch"``: The width of the widget matches the width of the
              parent container.
            - An integer specifying the width in pixels: The widget has a
              fixed width. If the specified width is greater than the width of
              the parent container, the width of the widget matches the width
              of the parent container.

        bind : "query-params" or None
            Binding mode for syncing the widget's value with a URL query
            parameter. If this is ``None`` (default), the widget's value
            is not synced to the URL. When this is set to
            ``"query-params"``, changes to the widget update the URL, and
            the widget can be initialized or updated through a query
            parameter in the URL. This requires ``key`` to be set. The
            key is used as the query parameter name.

            When the widget's value equals its default, the query
            parameter is removed from the URL to keep it clean. A bound
            query parameter can't be set or deleted through
            ``st.query_params``; it can only be programmatically changed
            through ``st.session_state``.

            An empty query parameter (e.g., ``?tags=``) clears the
            widget. Invalid query parameter values are ignored and removed from
            the URL. For ``selection_mode="multi"``, multiple selections use
            repeated parameters (e.g., ``?tags=Red&tags=Blue``) and duplicates
            are deduplicated.

        Returns
        -------
        list of V, V, or None
            If the ``selection_mode`` is ``multi``, this is a list of selected
            options or an empty list. If the ``selection_mode`` is
            ``"single"``, this is a selected option or ``None``.

            This contains copies of the selected options, not the originals.

        Examples
        --------
        **Example 1: Multi-select segmented control**

        Display a multi-select segmented control widget, and show the
        selection:

        >>> import streamlit as st
        >>>
        >>> options = ["North", "East", "South", "West"]
        >>> selection = st.segmented_control(
        ...     "Directions", options, selection_mode="multi"
        ... )
        >>> st.markdown(f"Your selected options: {selection}.")

        .. output::
           https://doc-segmented-control-multi.streamlit.app/
           height: 200px

        **Example 2: Single-select segmented control with icons**

        Display a single-select segmented control widget with icons:

        >>> import streamlit as st
        >>>
        >>> option_map = {
        ...     0: ":material/add:",
        ...     1: ":material/zoom_in:",
        ...     2: ":material/zoom_out:",
        ...     3: ":material/zoom_out_map:",
        ... }
        >>> selection = st.segmented_control(
        ...     "Tool",
        ...     options=option_map.keys(),
        ...     format_func=lambda option: option_map[option],
        ...     selection_mode="single",
        ... )
        >>> st.write(
        ...     "Your selected option: "
        ...     f"{None if selection is None else option_map[selection]}"
        ... )

        .. output::
           https://doc-segmented-control-single.streamlit.app/
           height: 200px

        r    rœ   r�   r“   s                   rD   r    z"ButtonGroupMixin.segmented_control­  sM   € ð~ ×*Ñ*ØØØ)ØØØ#ØØØ%ØØØØØ-ØØð! +ó 
ð 	
rF   rž   )rŒ   rs   r†   r{   ru   r@   rz   r�   rŽ   r�   r|   r}   r~   r�   r‘   c               óÞ  ‡ — t        ||«       |r|dk(  rt        d«      ‚|xs t        Š dˆ fd„}t        |«      }t	        ||«      }g }i }t        |«      D ]#  \  }} ‰ |«      }|j                  |«       |||<   Œ% |dk(  r0t        t           ||||‰ ¬«      }|j                  }|j                  }n6t        t           ||||r|d   nd ‰ ¬«      }|j                  }|j                  }| j                  ||||||||||||	|
||||‰ ||¬«      }|dk(  r/t        d|«      }t        |||«      }t        d	|j                  «      S t        d
|«      }t!        |||«      }t        d|j                  «      S )Nr3   zˆThe `required` argument cannot be used with `selection_mode='multi'`. The `required` parameter is only supported for single-select mode.c                óè   •—  ‰| «      }|j                  dd«      }|d   j                  «       }t        |«      \  }}|r|st        |«      dkD  r|d   nd}nd}t	        j
                  ||xs d¬«      S )zøIf option starts with a material icon or an emoji, we extract it to send
            it parsed to the frontend.

            Note: The icon is only extracted if it's followed by a space or is the
            entire content (icon-only).
            ú é   r   Ú N)r‹   Úcontent_icon)ÚsplitÚstripr'   rH   rq   ÚOption)ÚoptionÚtransformedÚpartsÚ
first_partÚiconÚ	remainingÚactual_format_funcs         €rD   Ú_transformed_format_funczIButtonGroupMixin._internal_button_group.<locals>._transformed_format_funcÀ  s   ø€ ñ -¨VÓ4ˆKð  ×%Ñ% c¨1Ó-ˆEØ˜q™Ÿ™Ó)ˆJä2°:Ó>‰OˆD�)Ù™Iô +.¨e«*°qª.˜e Ašh¸b‘à�ä#×*Ñ*Ø#Ø!š\ Tôð rF   )r:   r<   re   r@   r   )r:   r<   r>   r@   )rs   r†   r{   ru   r@   rŒ   r~   rz   Ú
serializerÚdeserializerr�   rŽ   r�   r|   r}   r�   Úoptions_format_funcr‘   Ústring_formatted_optionsz-RegisterWidgetResult[list[V] | list[V | str]]úlist[V]z$RegisterWidgetResult[V | str | None]úV | None)r®   r1   rW   zButtonGroupProto.Option)r   r!   rK   r   r   rI   rh   rc   r1   rP   rV   r6   Ú_button_groupr   r   ri   r   )!rC   r8   rŒ   rs   r†   r{   ru   r@   rz   r�   rŽ   r�   r|   r}   r~   r�   r‘   rµ   Úindexable_optionsr€   r:   r<   rM   r®   Ú	formattedÚmulti_serder¶   r·   Úsingle_serdeÚresultÚ	multi_resÚ
single_resr´   s!                                   @rD   rž   z'ButtonGroupMixin._internal_button_groupŸ  sè  ø€ ô* 	# 5Ð*:Ô;ñ ˜¨'Ò1Ü'ðUóð ð 4?Ò3EÄ#Ðõ	ô4 EÀWÓMÐÜ,Ð->ÀÓHˆð (*ÐØ;=Ð(Ü&Ð'8Ó9ò 	@‰MˆE�6Ù*¨6Ó2ˆIØ×$Ñ$ YÔ/ð ;@Ð,¨YÒ7ð	@ð ˜WÒ$Ü6´qÑ9Ø!Ø"3Ø1QØ'5Ø.ôˆKð %×.Ñ.ˆJØ&×2Ñ2‰Lä8¼Ñ;Ø!Ø"3Ø1QÙ:H ^°AÒ%6ÈdØ.ôˆLð &×/Ñ/ˆJØ'×3Ñ3ˆLð -1×,>Ñ,>ØØ"Ø)ØØØ0ØØØØ!Ø%ØØØØØ-ØØ 2ØØ%6ð) -?ó -
ˆð0 ˜WÒ$ÜÐLÈfÓUˆIÜ2Ø˜7Ð$5óˆIô ˜	 9§?¡?Ó3Ð3äÐ@À&ÓIˆ
Ü& z°7Ð<MÓNˆ
Ü�J 
× 0Ñ 0Ó1Ð1rF   )rŒ   rs   r†   r{   ru   rz   r@   r�   rŽ   r�   r|   r}   r~   r�   r¸   r‘   r¹   c               ó>  — t        |«       |dk(  rt        j                  nt        j                  }|t        j                  k(  r+|�)t	        |t
        «      rt        |«      dkD  rt        d«      ‚|dvrt        d|› d�«      ‚t        |«      }|}|�t        |«      dk(  rd }t        |d¬	«      }t        | j                  |||¬
«       t        «       }t        | j                  «      }|€|n&t        |«      D ��cg c]  \  }} |||   «      ‘Œ c}}}t        ||dh| j                  |||||||¬«      }t!        |||xs g ||||||||¬«      }|dk(  r|�t#        |«      |_        t'        |j(                  ||||	|
|d|d||dk(  rdnd ¬«      }d} |j*                  }!|�Z|dk(  r0|r|d   nd }"t-        t/        d|j*                  «      ||"||«      \  }!} n%t1        t/        d|j*                  «      |||«      \  }!} | s|j2                  r6| r|!n|j*                  }# |
t/        d|#«      «      |j4                  d d  d|_        |rt9        |||xs t"        «       | j                  j;                  d||¬«       | r'ddlm}$  |$t/        d|!«      |j2                  xs | «      S |S c c}}w )Nr2   r¨   zYThe default argument to `st.pills` must be a single value when `selection_mode='single'`.>   r”   r    z[The style argument must be one of ['pills', 'segmented_control']. The argument passed was 'r…   r   T)r�   Úallow_content_width)Údefault_valuerv   )
Úuser_keyÚkey_as_main_identityÚdgr8   rs   rv   rz   r�   r|   r~   )rv   rz   r|   r}   r~   r{   zquery-paramsÚstring_array_value)Úon_change_handlerrŽ   r�   r·   r¶   ÚctxÚ
value_typer‘   Ú	clearabler:   Úmax_array_lengthFzT | Nonezlist[T] | list[T | str]r0   Úbutton_group)Úlayout_config)r-   ) r‡   rq   ÚSINGLE_SELECTÚMULTI_SELECTÚ
isinstancer   rH   r!   r   r   r   rÉ   r$   r   rI   r   rƒ   rK   Úquery_param_keyr&   rr   ri   r   r   r   Úvalue_changedÚ
raw_valuesÚ	set_valuer   Ú_enqueueÚstreamlit.runtime.state.commonr-   )%rC   r½   rŒ   rs   r†   r{   ru   rz   r@   r·   r¶   r�   rŽ   r�   r|   r}   r~   r�   r¸   r‘   r¹   Úparsed_selection_modeÚ_defaultrÑ   rÌ   rt   rM   Ú_r:   Ú
element_idr�   Úwidget_stateÚvalue_needs_resetÚcurrent_valueÚdefault_indexÚvalue_for_serializationr-   s%                                        rD   r¼   zButtonGroupMixin._button_group#  s%  € ô0 	,¨NÔ;ð  Ò)ô ×*Ò*ä!×.Ñ.ð 	ð "Ô%5×%CÑ%CÒCØÐ#Ü˜7¤HÔ-Ü�G“˜qÒ ô (ð-óð ð
 Ð6Ñ6Ü'ð,Ø,1¨7°"ð6óð ô
 �S‹kˆàˆØÐ¤3 w£<°1Ò#4ØˆHä,°5ÈdÔSˆä˜dŸg™g s¨IÀXÕNä Ó"ˆÜ! $§'¡'Ó*ˆð Ð"ñ ô !*Ð*;Ó <÷á�E˜1ñ Ð-¨eÑ4Õ5óð 	ô 5ØØØ". Ø�w‰wØ%ØØ,ØØØØô
ˆ
ô ØØØŠM�rØØØ,ØØØ-ØØô
ˆð �>Ò! c oÜ$'¨£HˆEÔ!ä&Ø�H‰HØ'ØØØ%Ø!ØØ+ØØØ6Ø"0°HÒ"<™QÀ$ô
ˆð  "ÐØ)×/Ñ/ˆØÐ*Ø Ò)á.5 ¨¢
¸4�Ü3WÜ˜ \×%7Ñ%7Ó8Ø%Ø!ØØ'ó4Ñ0�Ñ0ô EÜÐ6¸×8JÑ8JÓKØ)ØØ+ó	ñ 1�Ð0ñ  × :Ò :ñ "3‘¸×8JÑ8Jð $ñ #-¬T°#Ð7NÓ-OÓ"PˆE×Ñ™QÐØ"ˆEŒOáä   jÐ2EÒ2LÌÔMà�‰×Ñ˜¨¸mÐÔLñ ÝKá'Ü�S˜-Ó(Ø×*Ñ*Ò?Ð.?óð ð
 ÐùóIs   Ã8Jc                ó   — t        d| «      S )zGet our DeltaGenerator.r)   )r   )rC   s    rD   rÉ   zButtonGroupMixin.dgÌ  s   € ô Ð$ dÓ+Ð+rF   ) r|   rK   r8   úOptionSequence[V]r†   úLiteral['single']rs   r1   r{   úLiteral[True]r@   úCallable[[Any], str] | NonerŒ   ú
Key | Noner~   ú
str | Noner�   úWidgetCallback | NonerŽ   úWidgetArgs | Noner�   úWidgetKwargs | Noneru   Úboolr}   r   r�   r   r‘   r%   rW   r1   ) r|   rK   r8   rå   r†   ræ   rs   rX   r{   rç   r@   rè   rŒ   ré   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   r»   ) r|   rK   r8   rå   r†   ræ   rs   r»   r{   úLiteral[False]r@   rè   rŒ   ré   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   r»   ) r|   rK   r8   rå   r†   úLiteral['multi']rs   úSequence[V] | V | Noner{   rî   r@   rè   rŒ   ré   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   rº   ) r|   rK   r8   rå   r†   úLiteral['single', 'multi']rs   rñ   r{   rî   r@   rè   rŒ   ré   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   úlist[V] | V | None) r|   rK   r8   rå   r†   ræ   rs   r1   r{   rç   r@   rè   rŒ   ústr | int | Noner~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   r1   ) r|   rK   r8   rå   r†   ræ   rs   rX   r{   rç   r@   rè   rŒ   rô   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   r»   ) r|   rK   r8   rå   r†   ræ   rs   r»   r{   rï   r@   rè   rŒ   rô   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   r»   ) r|   rK   r8   rå   r†   rð   rs   rñ   r{   rî   r@   rè   rŒ   rô   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   rº   ) r|   rK   r8   rå   r†   rò   rs   rñ   r{   rî   r@   rè   rŒ   rô   r~   rê   r�   rë   rŽ   rì   r�   rí   ru   rî   r}   r   r�   r   r‘   r%   rW   ró   )"r8   rå   rŒ   ré   rs   rñ   r†   rò   r{   rî   ru   rî   r@   rè   rz   ú%Literal['pills', 'segmented_control']r�   rë   rŽ   rì   r�   rí   r|   rê   r}   r   r~   rê   r�   r   r‘   r%   rW   ró   )*r½   zSequence[Any]rŒ   ré   rs   ro   r†   r4   r{   rî   ru   rî   rz   rõ   r@   z-Callable[[V], ButtonGroupProto.Option] | Noner·   zWidgetDeserializer[T]r¶   zWidgetSerializer[T]r�   rë   rŽ   rì   r�   rí   r|   rê   r}   r   r~   rê   r�   r   r¸   rè   r‘   r%   r¹   rZ   rW   zRegisterWidgetResult[T])rW   r)   )r\   r]   r^   r   r”   r#   r    rž   r¼   ÚpropertyrÉ   ra   rF   rD   r‰   r‰     sê
  „ ð ð -5ð 48ØØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð  ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð -5Øà37ØØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð  ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð -5Ø Ø#&Ø37ØØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð !ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð +/ØØ37ØØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 )ðð (ðð ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðñ& �GÓð 6>Ø*.ØØ37ØØØ+/Ø"&Ø&*ØØ,5Ø Øñ#l
àðl
ð #ðl
ð
 3ðl
ð (ðl
ð ðl
ð 1ðl
ð ðl
ð ðl
ð )ðl
ð  ðl
ð $ðl
ð ðl
ð *ðl
ð  ð!l
ð" ð#l
ð$ 
ò%l
ó ðl
ð` ð -5ð 48Ø $ØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð  ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð -5Øà37Ø $ØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð  ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð -5Ø Ø#&Ø37Ø $ØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 *ðð ðð !ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð +/ØØ37Ø $ØØ+/Ø"&Ø&*ØØ,5Ø Øñ#àðð #ðð
 )ðð (ðð ðð 1ðð ðð ðð )ðð  ðð $ðð ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðñ( Ð'Ó(ð 6>Ø*.ØØ37Ø $ØØ+/Ø"&Ø&*ØØ,5Ø Øñ#o
àðo
ð #ðo
ð
 3ðo
ð (ðo
ð ðo
ð 1ðo
ð ðo
ð ðo
ð )ðo
ð  ðo
ð $ðo
ð ðo
ð *ðo
ð  ð!o
ð" ð#o
ð$ 
ò%o
ó )ðo
ñb Ð,Ó-ð
 Ø*.Ø5=ØØØ37Ø7JØ+/Ø"&Ø&*Ø Ø,5ØØ Øñ%A2à"ðA2ð ð	A2ð
 (ðA2ð 3ðA2ð ðA2ð ðA2ð 1ðA2ð 5ðA2ð )ðA2ð  ðA2ð $ðA2ð ðA2ð *ðA2ð  ð!A2ð" ð#A2ð$ ð%A2ð& 
ò'A2ó .ðA2ðN Ø$(Ø(0ØØØ7JØEIð ,0Ø"&Ø&*Ø Ø,5ØØ Ø;?ØØ59ñ-gà(ðgð ð	gð
 "ðgð &ðgð ðgð ðgð 5ðgð Cðgð ,ðgð (ðgð )ðgð  ðgð $ðgð  ð!gð" *ð#gð$ ð%gð& ð'gð( 9ð)gð* ð+gð, #3ð-gð. 
!ó/gðR ò,ó ñ,rF   r‰   )r”   NrŠ   NF)r   rK   r:   z!Sequence[ButtonGroupProto.Option]r€   rd   ru   rî   r   rK   rv   z$ButtonGroupProto.ClickMode.ValueTyperz   rõ   r|   rê   r}   r   r~   rê   r{   rî   rW   rq   )r†   r4   rW   rX   )GÚ
__future__r   Úcollections.abcr   r   Útypingr   r   r   r	   r
   r   r   r   Ústreamlit.dataframe_utilr   Ú!streamlit.elements.lib.form_utilsr   Ú#streamlit.elements.lib.layout_utilsr   r   Ú-streamlit.elements.lib.options_selector_utilsr   r   r   r   r   r   Ústreamlit.elements.lib.policiesr   r   Ústreamlit.elements.lib.utilsr   r   r   r   r   r   Ústreamlit.errorsr!   Ústreamlit.proto.ButtonGroup_pb2r"   rq   Ústreamlit.runtime.metrics_utilr#   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr$   Ústreamlit.runtime.stater%   r&   Ústreamlit.string_utilr'   r(   Ústreamlit.delta_generatorr)   r*   r+   r,   rÚ   r-   r.   r/   r0   r1   r4   r`   r6   rc   rƒ   r‡   r‰   ra   rF   rD   ú<module>r     sY  ðö #ç .÷	÷ 	ó 	õ >Ý =÷÷÷ ÷÷÷ õ 3Ý KÝ 9Ý Vß ?Ý 6áÝ7Ý8÷ñ ÷
ñ ñ ˆCƒL€ÙˆCƒL€à"Ð#4Ñ5€ˆyÓ 5ôG G¨A¡Jô GôTE 7¨1¡:ô Eð^ 4;ØØ(1ØØð"Øð"à8ð"ð ð"ð ð	"ð
 ð"ð 5ð"ð 1ð"ð ð"ð &ð"ð ð"ð ð"ð ó"óJ
÷},ò },rF   