Ë
    EêñiîR  ã                  óx  — 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 d dl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+m,Z, d dl-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 d dl4m5Z5 erd dl6m7Z7m8Z8 d dl9m:Z:  ed«      Z; G d„ dee;   «      Z< G d„ d«      Z=y)é    )Úannotations)Údedent)ÚTYPE_CHECKINGÚAnyÚGenericÚTypeVarÚcastÚoverload)ÚNever)ÚOptionSequenceÚconvert_anything_to_list)Úcurrent_form_id)ÚWidthÚcreate_layout_config)Úcreate_mappingsÚmaybe_coerce_enumÚ$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)ÚRadio)Úgather_metrics)ÚScriptRunContextÚget_script_run_ctx)Ú
BindOptionÚ
WidgetArgsÚWidgetCallbackÚWidgetKwargsÚget_session_stateÚregister_widget)Úcheck_python_comparable)ÚCallableÚSequence)ÚDeltaGeneratorÚTc                  ó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)Ú
RadioSerdez¼Serializer/deserializer for Radio widget values.

    Uses string-based values (formatted option strings) for robust handling
    of dynamic option changes, similar to SelectboxSerde.
    ú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)r5   r7   c               óJ   — || _         || _        || _        || _        || _        y ©N)r/   r1   r3   r5   r7   )Úselfr/   r1   r3   r5   r7   s         úb/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/widgets/radio.pyÚ__init__zRadioSerde.__init__R   s+   € ð ˆŒØ!2ˆÔØ0PˆÔ-Ø$8ˆÔ!Ø&ˆÕó    c                ó¶   — |€y t        | j                  «      dk(  ry 	 | j                  |«      }|| j
                  v r|S |S # t        $ r t	        |«      cY S w xY w©Nr   )Úlenr/   r7   Ú	ExceptionÚstrr3   )r:   ÚvÚformatted_values      r;   Ú	serializezRadioSerde.serializea   sm   € Øˆ9ØÜˆt�|‰|Ó Ò!Øð	Ø"×.Ñ.¨qÓ1ˆOð ˜d×CÑCÑCØ"Ð"ð Ðøô ò 	ô �q“6ŠMð	ús   žA ÁAÁAc                óâ   — t        | j                  «      dk(  ry |€'| j                  �| j                  | j                     S d S | j                  j	                  |«      }|�| j                  |   S |S r?   )r@   r/   r5   r3   Úget)r:   Úui_valueÚoption_indexs      r;   ÚdeserializezRadioSerde.deserialize{   s~   € äˆt�|‰|Ó Ò!ØàÐð ×,Ñ,Ð8ð —‘˜T×6Ñ6Ñ7ðð ðð ×<Ñ<×@Ñ@ÀÓJˆØ-9Ð-Eˆt�|‰|˜LÑ)ÐSÈ8ÐSr=   )r/   r.   r1   r0   r3   r2   r5   r4   r7   r6   ÚreturnÚNone)rC   úT | str | NonerK   ú
str | None)rH   rN   rK   rM   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rB   r<   rE   rJ   © r=   r;   r-   r-   E   sy   … ñð ÓØ Ó Ø&4Ó4Ø$Ó$Ø%Ó%ð ,0Ø,/ñ'àð'ð %ð	'ð
 +9ð'ð )ð'ð *ð'ð 
ó'óô4Tr=   r-   c            	      óT  — e Zd Zededddddfdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zededddddfdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zeedddddfdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„«       Z ed
«      dedddddfdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zdedddddfddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zedd„«       Z	y)Ú
RadioMixinr   NFÚvisibleÚcontent)ÚdisabledÚ
horizontalÚcaptionsÚlabel_visibilityÚwidthÚbindc
                ó   — y r9   rT   ©r:   Úlabelr/   Úindexr7   ÚkeyÚhelpÚ	on_changeÚargsÚkwargsrY   rZ   r[   r\   r]   r^   s                   r;   ÚradiozRadioMixin.radioŒ   s   € ð& r=   c
                ó   — y r9   rT   r`   s                   r;   rh   zRadioMixin.radio¡   s   € ð& r=   c
                ó   — y r9   rT   r`   s                   r;   rh   zRadioMixin.radio¶   s   € ð& r=   rh   c
               óX   — t        «       }| j                  |||||||||	|
||||||¬«      S )a´  Display a radio button widget.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this radio group 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
            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.

            Labels can include markdown as described in the ``label`` parameter.

        index : int or None
            The index of the preselected option on first render. If ``None``,
            will initialize empty and return ``None`` until the user selects an option.
            Defaults to 0 (the first option).

        format_func : function
            Function to modify the display of radio 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 radio.

        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.

            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 radio'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 radio button if set to
            ``True``. The default is ``False``.

        horizontal : bool
            An optional boolean, which orients the radio group horizontally.
            The default is false (vertical buttons).

        captions : iterable of str or None
            A list of captions to show below each radio button. If None (default),
            no captions are shown.

        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 radio button 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``.

            Invalid query parameter values are ignored and removed
            from the URL. If ``index`` is ``None``, an empty query
            parameter (e.g., ``?my_key=``) clears the widget.

        Returns
        -------
        any
            The selected option or ``None`` if no option is selected.

            This is a copy of the selected option, not the original.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> genre = st.radio(
        ...     "What's your favorite movie genre",
        ...     [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],
        ...     captions=[
        ...         "Laugh out loud.",
        ...         "Get the popcorn.",
        ...         "Never stop learning.",
        ...     ],
        ... )
        >>>
        >>> if genre == ":rainbow[Comedy]":
        ...     st.write("You selected comedy.")
        ... else:
        ...     st.write("You didn't select comedy.")

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

        To initialize an empty radio widget, use ``None`` as the index value:

        >>> import streamlit as st
        >>>
        >>> genre = st.radio(
        ...     "What's your favorite movie genre",
        ...     [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],
        ...     index=None,
        ... )
        >>>
        >>> st.write("You selected:", genre)

        .. output::
           https://doc-radio-empty.streamlit.app/
           height: 300px

        )ra   r/   rb   r7   rc   rd   re   rf   rg   rY   rZ   r[   r\   r^   Úctxr]   )r    Ú_radio)r:   ra   r/   rb   r7   rc   rd   re   rf   rg   rY   rZ   r[   r\   r]   r^   rl   s                    r;   rh   zRadioMixin.radioË   sS   € ôH !Ó"ˆØ�{‰{ØØØØ#ØØØØØØØ!ØØ-ØØØð! ó 
ð 	
r=   )rY   rZ   r\   r[   r^   rl   r]   c
               óT  — t        |«      }t        | j                  |||dk(  rd n|¬«       t        ||«       t	        |d¬«      }t        |«      }t        |«       t        ||«      \  }}t        d|d| j                  |||||||¬«      }t        |t        «      s#|�!t        dt        |«      j                  › �«      ‚|�9t        |«      dkD  r+d|cxk  rt        |«      k  st        d«      ‚ t        d«      ‚dd	„}t        «       j                   }|�||v r||   €d }t#        «       }||_        ||_        |�||_        ||j*                  d d  t-        | j                  «      |_        ||_        |
|_        t5        |«      |j6                  _        |�t;        ||«      |j<                  d d  |�t?        |«      |_         |d
k(  r|�tC        |«      |_"        tG        |||||¬«      }tI        |j$                  |||	|jJ                  |jL                  |d||d u |¬«      }tO        |||«      }tQ        tS        d|j8                  «      ||||«      \  }}|s|jT                  r!|jM                  |«      }|�||_+        d|_,        |rt[        |||«       | j                  j]                  d||¬«       |S )Nr   )Údefault_valueT)r]   Úallow_content_widthrh   )
Úuser_keyÚkey_as_main_identityÚdgra   r/   rb   rd   rZ   r[   r]   zRadio Value has invalid type: z3Radio index must be between 0 and length of optionsc                ón   — | €yt        | t        «      r| S t        dt        | «      j                  › �«      ‚)NÚ z-Radio captions must be strings. Passed type: )Ú
isinstancerB   r   ÚtyperO   )Úcaptions    r;   Úhandle_captionsz*RadioMixin._radio.<locals>.handle_captionsâ  s;   € ØˆØÜ˜'¤3Ô'Ø�Ü'Ø?ÄÀWÃ×@VÑ@VÐ?WÐXóð r=   zquery-params)r1   r3   r5   r7   Ústring_value)
Úon_change_handlerrf   rg   ÚdeserializerÚ
serializerrl   Ú
value_typer^   Ú	clearabler1   úT | None)Úlayout_config)rx   rN   rK   rB   )/r   r   rs   r   r   r   r'   r   r   rv   Úintr   rw   rO   r@   r%   Úfiltered_stateÚ
RadioProtoÚidra   Údefaultr/   r   Úform_idrZ   rY   r   r\   ÚvalueÚmapr[   r   rd   rB   Úquery_param_keyr-   r&   rJ   rE   r   r   r	   Úvalue_changedÚ	raw_valueÚ	set_valuer   Ú_enqueue)r:   ra   r/   rb   r7   rc   rd   re   rf   rg   rY   rZ   r\   r[   r^   rl   r]   r�   Úoptr1   r3   Ú
element_idry   Úsession_stateÚradio_protoÚserdeÚwidget_stateÚcurrent_valueÚvalue_needs_resetÚserialized_values                                 r;   rm   zRadioMixin._radio£  s÷  € ô( �S‹kˆäØ�G‰GØØØ"'¨1¢*™$°%õ		
ô 	# 5Ð*:Ô;ä,°5ÈdÔSˆä& wÓ/ˆÜ Ô$ä>MØ�ó?
Ñ;ÐÐ;ô 5ØØØ!%Ø�w‰wØØ%ØØØ!ØØô
ˆ
ô ˜%¤Ô%¨%Ð*;Ü'Ø0´°e³×1EÑ1EÐ0FÐGóð ð Ð¤ S£¨A¢°a¸5Ô6KÄ3ÀsÃ8Ò6KÜ'ØEóð ð 7LÜ'ØEóð ó	ô *Ó+×:Ñ:ˆØˆ?˜s mÑ3¸ÀcÑ8JÐ8RØˆEä “lˆØ#ˆŒØ!ˆÔØÐØ"'ˆKÔØ!2ˆ×Ñ™AÐÜ-¨d¯g©gÓ6ˆÔØ!+ˆÔØ'ˆÔÜ-MØó.
ˆ×$Ñ$Ô*ð ÐÜ&)¨/¸8Ó&DˆK× Ñ ¡Ð#àÐÜ% d›|ˆKÔð �>Ò! c oÜ*-¨c«(ˆKÔ'äØØ/Ø-MØ!&Ø#ô
ˆô 'Ø�N‰NØ'ØØØ×*Ñ*Ø—‘ØØ%Øð  �}ð 0ô
ˆô" )¨°wÀÓDˆô ,PÜ�˜\×/Ñ/Ó0°#°u¸cÀ;ó,
Ñ(ˆÐ(ñ  × :Ò :Ø$Ÿ™¨}Ó=ÐØÐ+Ø(8�Ô%Ø$(ˆKÔ!áÜ   j°+Ô>Ø�‰×Ñ˜ +¸]ÐÔKØÐr=   c                ó   — t        d| «      S )zGet our DeltaGenerator.r*   )r	   )r:   s    r;   rs   zRadioMixin.dg6  s   € ô Ð$ dÓ+Ð+r=   ) ra   rB   r/   zSequence[Never]rb   r‚   r7   úCallable[[Any], Any]rc   ú
Key | Nonerd   rN   re   úWidgetCallback | Nonerf   úWidgetArgs | Nonerg   úWidgetKwargs | NonerY   ÚboolrZ   rž   r[   úSequence[str] | Noner\   r   r]   r   r^   r!   rK   rL   ) ra   rB   r/   úOptionSequence[T]rb   r‚   r7   r™   rc   rš   rd   rN   re   r›   rf   rœ   rg   r�   rY   rž   rZ   rž   r[   rŸ   r\   r   r]   r   r^   r!   rK   r+   ) ra   rB   r/   r    rb   rL   r7   r™   rc   rš   rd   rN   re   r›   rf   rœ   rg   r�   rY   rž   rZ   rž   r[   rŸ   r\   r   r]   r   r^   r!   rK   r€   ) ra   rB   r/   r    rb   r4   r7   r™   rc   rš   rd   rN   re   r›   rf   rœ   rg   r�   rY   rž   rZ   rž   r[   rŸ   r\   r   r]   r   r^   r!   rK   r€   )"ra   rB   r/   r    rb   r4   r7   r™   rc   rš   rd   rN   re   r›   rf   rœ   rg   r�   rY   rž   rZ   rž   r\   r   r[   rŸ   r^   r!   rl   zScriptRunContext | Noner]   r   rK   r€   )rK   r*   )
rO   rP   rQ   r
   rB   rh   r   rm   Úpropertyrs   rT   r=   r;   rV   rV   ‹   s¦  „ Øð
 Ø,/ØØØ+/Ø"&Ø&*ðð Ø Ø)-Ø,5Ø Øñ#àðð !ðð ð	ð
 *ðð ðð ðð )ðð  ðð $ðð ðð ðð 'ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð
 Ø,/ØØØ+/Ø"&Ø&*ðð Ø Ø)-Ø,5Ø Øñ#àðð #ðð ð	ð
 *ðð ðð ðð )ðð  ðð $ðð ðð ðð 'ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðð( ð -0ØØØ+/Ø"&Ø&*ðð Ø Ø)-Ø,5Ø Øñ#àðð #ðð ð	ð
 *ðð ðð ðð )ðð  ðð $ðð ðð ðð 'ðð *ðð  ð!ð" ð#ð$ 
ò%ó ðñ( �GÓð
 Ø,/ØØØ+/Ø"&Ø&*ðU
ð Ø Ø)-Ø,5Ø Øñ#U
àðU
ð #ðU
ð ð	U
ð
 *ðU
ð ðU
ð ðU
ð )ðU
ð  ðU
ð $ðU
ð ðU
ð ðU
ð 'ðU
ð *ðU
ð  ð!U
ð" ð#U
ð$ 
ò%U
ó ðU
ðv Ø,/ØØØ+/Ø"&Ø&*ðQð Ø Ø,5Ø)-ØØ'+Ø ñ%QàðQð #ðQð ð	Qð
 *ðQð ðQð ðQð )ðQð  ðQð $ðQð ðQð ðQð *ðQð 'ðQð  ð!Qð" %ð#Qð$ ð%Qð& 
ó'Qðf ò,ó ñ,r=   rV   N)>Ú
__future__r   Útextwrapr   Útypingr   r   r   r   r	   r
   Útyping_extensionsr   Ústreamlit.dataframe_utilr   r   Ú!streamlit.elements.lib.form_utilsr   Ú#streamlit.elements.lib.layout_utilsr   r   Ú-streamlit.elements.lib.options_selector_utilsr   r   r   Ústreamlit.elements.lib.policiesr   r   Ústreamlit.elements.lib.utilsr   r   r   r   r   r   Ústreamlit.errorsr   Ústreamlit.proto.Radio_pb2r   r„   Ústreamlit.runtime.metrics_utilr   Ústreamlit.runtime.scriptrunnerr   r    Ústreamlit.runtime.stater!   r"   r#   r$   r%   r&   Ústreamlit.type_utilr'   Úcollections.abcr(   r)   Ústreamlit.delta_generatorr*   r+   r-   rV   rT   r=   r;   ú<module>r´      sŒ   ðõ #å ß G× Gå #ç MÝ =÷÷ñ ÷
÷÷ õ 3Ý 9Ý 9ß O÷÷ õñ ß2å8áˆCƒL€ôCT�˜‘ô CT÷Ln,ò n,r=   