Ë
    Eêñi¨V  ã                  ó”  — 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
mZ d dlmZ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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/m0Z0m1Z1m2Z2m3Z3 d dl4m5Z5 erd dl6m7Z7m8Z8 d dl9m:Z: d dlm;Z; d dl<m=Z=  e	d«      Z>dd„Z? G d„ dee>   «      Z@ G d„ d«      ZAy)é    )Úannotations)Údedent)ÚTYPE_CHECKINGÚAnyÚGenericÚ	TypeGuardÚTypeVarÚcastÚoverload)ÚOptionSequenceÚconvert_anything_to_list)Úcurrent_form_id)Úcreate_layout_config)Úcreate_mappingsÚindex_Úmaybe_coerce_enumÚmaybe_coerce_enum_sequenceÚ*validate_and_sync_range_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)ÚSlider)Úgather_metrics)ÚScriptRunContextÚget_script_run_ctx)Ú
BindOptionÚ
WidgetArgsÚWidgetCallbackÚWidgetKwargsÚregister_widget)Úcheck_python_comparable)ÚCallableÚSequence)ÚDeltaGenerator)ÚWidthWithoutContent)ÚRegisterWidgetResultÚTc                ó.   — t        | t        t        f«      S ©N)Ú
isinstanceÚlistÚtuple)Úvalues    új/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/widgets/select_slider.pyÚ_is_range_valuer6   J   s   € Ü�eœd¤E˜]Ó+Ð+ó    c                  óH   — e Zd ZdZedœ	 	 	 	 	 	 	 	 	 dd„Zd	d„Zd
d„Zdd„Zy)ÚSelectSliderSerdez�Serializer/deserializer for select_slider widget values.

    Uses formatted option strings for robust handling of dynamic option changes.
    )Úformat_funcc               ó<   — || _         || _        || _        || _        y r0   )ÚoptionsÚformatted_option_to_indexÚdefault_indicesr:   )Úselfr<   r=   r>   r:   s        r5   Ú__init__zSelectSliderSerde.__init__T   s#   € ð ˆŒØ)BˆÔ&Ø.ˆÔØ&ˆÕr7   c                óB  — |st        | j                  «      dk\  rjt        | j                  «      dkD  r| j                  d   nt        | j                  «      dz
  }| j                  | j                  d      | j                  |   fS | j                  | j                  d      S )z2Return the default value based on default_indices.é   é   r   )Úlenr>   r<   )r?   Úis_rangeÚend_idxs      r5   Ú_get_defaultzSelectSliderSerde._get_defaulta   s–   € á”s˜4×/Ñ/Ó0°AÒ5ô �t×+Ñ+Ó,¨qÒ0ð ×$Ñ$ QÒ'ä˜Ÿ™Ó&¨Ñ*ð ð
 —L‘L ×!5Ñ!5°aÑ!8Ñ9¸4¿<¹<ÈÑ;PÐQÐQØ�|‰|˜D×0Ñ0°Ñ3Ñ4Ð4r7   c                ó   — 	 | j                  |«      }|| j                  v r|gS 	 t        |t        t
        f«      r|D �cg c]  }| j                  |«      ‘Œ c}S | j                  |«      gS # t        $ r Y ŒRw xY wc c}w )z1Convert option value(s) to formatted string list.)r:   r=   Ú	Exceptionr1   r3   r2   )r?   ÚvÚ	formattedÚxs       r5   Ú	serializezSelectSliderSerde.serializel   sŠ   € ð	Ø×(Ñ(¨Ó+ˆIØ˜D×:Ñ:Ñ:Ø!�{Ð"ð ;ô �aœ%¤˜Ô'Ø12Ö3¨A�D×$Ñ$ QÕ'Ò3Ð3à× Ñ  Ó#Ð$Ð$øô ò 	Ùð	üò
 4s   ‚!A, ¿A;Á,	A8Á7A8c                ó�  — t        | j                  «      dk\  }|s| j                  |¬«      S |rdnd}t        |«      |k7  r| j                  |¬«      S g }t        |«      D ]ª  \  }}| j                  j                  |«      }|�9|t        | j                  «      k  r!|j                  || j                  |   f«       Œ\| j                  t        |t        | j                  «      dz
  «         }|j                  || j                  |   f«       Œ¬ |r1|d   d   |d   d   kD  r|d   d   |d   d   fS |d   d   |d   d   fS |d   d   S )z6Convert formatted string list back to option value(s).rB   )rE   rC   r   )	rD   r>   rG   Ú	enumerater=   Úgetr<   ÚappendÚmin)	r?   Úui_valuerE   Úexpected_lenÚresultsÚiÚsÚidxÚdefault_idxs	            r5   ÚdeserializezSelectSliderSerde.deserialize|   sh  € ä�t×+Ñ+Ó,°Ñ1ˆáØ×$Ñ$¨hÐ$Ó7Ð7á$‘q¨!ˆÜˆx‹=˜LÒ(ð ×$Ñ$¨hÐ$Ó7Ð7ð (*ˆÜ˜hÓ'ò 		I‰DˆAˆqØ×0Ñ0×4Ñ4°QÓ7ˆCØˆ 3¬¨T¯\©\Ó):Ò#:Ø—‘  T§\¡\°#Ñ%6Ð7Õ8ð #×2Ñ2Ü˜œ3˜t×3Ñ3Ó4°qÑ8Ó9ñ�ð —‘ ¨T¯\©\¸+Ñ-FÐGÕHð		Iñ à�q‰z˜!‰}˜w q™z¨!™}Ò,Ø ™
 1™ w¨q¡z°!¡}Ð5Ð5Ø˜A‘J˜q‘M 7¨1¡:¨a¡=Ð1Ð1à�q‰z˜!‰}Ðr7   N)
r<   zSequence[T]r=   zdict[str, int]r>   ú	list[int]r:   zCallable[[Any], str]ÚreturnÚNone)rE   Úboolr\   úT | tuple[T, T])rJ   zT | tuple[T, T] | list[T]r\   z	list[str])rS   zlist[str] | Noner\   r_   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr@   rG   rM   rZ   © r7   r5   r9   r9   N   sP   „ ñð -0ñ'àð'ð $2ð	'ð
 #ð'ð *ð'ð 
ó'ó	5ó%ô  r7   r9   c                  ó¶  — e Zd Zeedddddf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„«       Z ed	«      ddedddddfdddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„«       Zddeddddddddddf	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zedd„«       Z	y)ÚSelectSliderMixinNFÚvisibleÚstretch)ÚdisabledÚlabel_visibilityÚwidthÚbindc
                ó   — y r0   re   ©r?   Úlabelr<   r4   r:   ÚkeyÚhelpÚ	on_changeÚargsÚkwargsrj   rk   rl   rm   s                 r5   Úselect_sliderzSelectSliderMixin.select_slider    s   € ð" r7   re   c
                ó   — y r0   re   ro   s                 r5   rv   zSelectSliderMixin.select_slider³   s   € ð" r7   rv   c
               óT   — t        «       }| j                  |||||||||	|
||||¬«      S )a‡  
        Display a slider widget to select items from a list.

        This also allows you to render a range slider by passing a two-element
        tuple or list as the ``value``.

        The difference between ``st.select_slider`` and ``st.slider`` is that
        ``select_slider`` accepts any datatype and takes an iterable set of
        options, while ``st.slider`` only accepts numerical or date/time data and
        takes a range as input.

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

            Each item in the iterable can optionally contain GitHub-flavored
            Markdown, subject to the same limitations described in the
            ``label`` parameter.

        value : a supported type or a tuple/list of supported types or None
            The value of the slider when it first renders. If a tuple/list
            of two values is passed here, then a range slider with those lower
            and upper bounds is rendered. For example, if set to `(1, 10)` the
            slider will have a selectable range between 1 and 10.
            Defaults to first option.

        format_func : function
            Function to modify the display of the labels from the options.
            argument. It receives the option as an argument and its output
            will be cast to str.

        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 select_slider'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 select slider 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 : "stretch" or int
            The width of the slider widget. This can be one of the
            following:

            - ``"stretch"`` (default): 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. Range select sliders use repeated parameters
            (e.g., ``?color=red&color=blue``).

        Returns
        -------
        any value or tuple of any value
            The current value of the slider widget. The return type will match
            the data type of the value parameter.

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

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> color = st.select_slider(
        ...     "Select a color of the rainbow",
        ...     options=[
        ...         "red",
        ...         "orange",
        ...         "yellow",
        ...         "green",
        ...         "blue",
        ...         "indigo",
        ...         "violet",
        ...     ],
        ... )
        >>> st.write("My favorite color is", color)

        And here's an example of a range select slider:

        >>> import streamlit as st
        >>>
        >>> start_color, end_color = st.select_slider(
        ...     "Select a range of color wavelength",
        ...     options=[
        ...         "red",
        ...         "orange",
        ...         "yellow",
        ...         "green",
        ...         "blue",
        ...         "indigo",
        ...         "violet",
        ...     ],
        ...     value=("red", "blue"),
        ... )
        >>> st.write("You selected wavelengths between", start_color, "and", end_color)

        .. output::
           https://doc-select-slider.streamlit.app/
           height: 450px

        )rp   r<   r4   r:   rq   rr   rs   rt   ru   rj   rk   Úctxrl   rm   )r"   Ú_select_slider)r?   rp   r<   r4   r:   rq   rr   rs   rt   ru   rj   rk   rl   rm   ry   s                  r5   rv   zSelectSliderMixin.select_sliderÆ   sO   € ôL !Ó"ˆØ×"Ñ"ØØØØ#ØØØØØØØ-ØØØð #ó 
ð 	
r7   c                óê  ‡‡— t        |«      }t        | j                  ||‰¬«       t        ||«       t	        |«      Št        ‰«       t        ‰«      dk(  rt        d«      ‚dˆˆfd„} |‰«      }t        ‰|«      \  }}t        d|d| j                  |||||¬«	      }t        «       }||_        t        j                  j                  |_        ||_        d|_        ||j"                  d d  d|_        t        ‰«      d	z
  |_        d	|_        t        j*                  |_        ||j.                  d d  t1        | j                  «      |_        |
|_        t7        |«      |j8                  _        |�t=        |«      |_        |r|rtA        |«      |_!        tE        |¬
«      }tG        ‰|||¬«      }tI        |j                  |||	|jJ                  |jL                  |d|dd¬«      }tO        |j:                  tP        «      rtS        tU        d|«      |‰«      }ntW        ||‰«      }tO        |j:                  tP        «      }|r+tU        d|j:                  «      }tY        |‰|||«      \  }}|}n+t[        |j:                  ‰|d   ||«      \  }}tU        d|«      }|s|j\                  r'|jM                  |«      }||j^                  d d  d|_0        |rtc        |||«       | j                  je                  d||¬«       |S )N)Údefault_valuer   z,The `options` argument needs to be non-emptyc                ó¼   •— t        | «      r)| D �cg c]  }t        ‰|«      ‘Œ }}|\  }}||kD  r||g}|S 	 t        ‰| «      gS c c}w # t        $ r	 ‰�‚ dgcY S w xY w)Nr   )r6   r   Ú
ValueError)rJ   ÚvalÚslider_valueÚstartÚendÚoptr4   s        €€r5   Úas_index_listz7SelectSliderMixin._select_slider.<locals>.as_index_list¿  s~   ø€ Ü˜qÔ!Ø<=Ö>°S¤ s¨CÕ 0Ð>�Ð>Ø)‘
��sØ˜3’;Ø$'¨ <�LØ#Ð#ðÜ˜s A›Ð'Ð'ùò  ?øô ò ØÐ$Øà�s’
ð	ús   ‘A·A	 Á	AÁArv   T)Úuser_keyÚkey_as_main_identityÚdgrp   r<   r4   rr   rl   z%srC   )rl   )r=   r>   r:   Ústring_array_valueF)
Úon_change_handlerrt   ru   ÚdeserializerÚ
serializerry   Ú
value_typerm   Ú	clearableÚallow_url_duplicatesz!RegisterWidgetResult[tuple[T, T]]útuple[T, T]r.   Úslider)Úlayout_config)rJ   r   r\   r[   )3r   r   r‡   r   r   r(   rD   r   r   r   ÚSliderProtoÚidÚTypeÚSELECT_SLIDERÚtyperp   ÚformatÚdefaultrR   ÚmaxÚstepÚINTÚ	data_typer<   r   Úform_idrj   r   rk   r4   r   rr   rd   Úquery_param_keyr   r9   r'   rZ   rM   r1   r3   r   r
   r   r   r   Úvalue_changedÚ	raw_valueÚ	set_valuer   Ú_enqueue) r?   rp   r<   r4   r:   rq   rr   rs   rt   ru   rj   rk   ry   rl   rm   r„   r€   Úformatted_optionsÚ formatted_option_to_option_indexÚ
element_idÚslider_protor‘   ÚserdeÚwidget_stateÚactual_is_rangeÚrange_valueÚvalidated_rangeÚvalue_needs_resetÚcurrent_valueÚvalidated_singleÚserialized_valuerƒ   s       `                           @r5   rz   z SelectSliderMixin._select_sliderž  s  ù€ ô" �S‹kˆäØ�G‰GØØØõ		
ô 	# 5Ð*:Ô;ä& wÓ/ˆÜ Ô$äˆs‹8�qŠ=Ü'Ð(VÓWÐWö	ñ" % UÓ+ˆô ?NØ�ó?
Ñ;ÐÐ;ô 5ØØØ!%Ø�w‰wØØ%ØØØô

ˆ
ô #“}ˆØ$ˆŒÜ'×,Ñ,×:Ñ:ˆÔØ"ˆÔØ"ˆÔØ".ˆ×Ñ™QÐØˆÔÜ˜s›8 a™<ˆÔØˆÔÜ!,§¡ˆÔØ"3ˆ×Ñ™QÐÜ.¨t¯w©wÓ7ˆÔØ (ˆÔÜ.NØó/
ˆ×%Ñ%Ô+ð ÐÜ & t£ˆLÔá‘CÜ+.¨s«8ˆLÔ(ä,°5Ô9ˆä!ØØ&FØ(Ø#ô	
ˆô 'Ø�O‰OØ'ØØØ×*Ñ*Ø—‘ØØ+Øð ð "&ô
ˆô" �l×(Ñ(¬%Ô0Ü5ÜÐ8¸,ÓGÈÐRUó‰Lô -¨\¸7ÀCÓHˆLô % \×%7Ñ%7¼Ó?ˆÙä˜}¨l×.@Ñ.@ÓAˆKä:ØØØ ØØóñ /ˆOÐ.ð .=‰Mô 3WØ×"Ñ"ØØ˜Q‘ØØó3Ñ/ÐÐ/ô ! Ð&6Ó7ˆMá × :Ò :Ø$Ÿ™¨}Ó=ÐØ(8ˆL×"Ñ"¡1Ð%Ø%)ˆLÔ"áÜ   j°+Ô>à�‰×Ñ˜ <¸}ÐÔMØÐr7   c                ó   — t        d| «      S )zGet our DeltaGenerator.r+   )r
   )r?   s    r5   r‡   zSelectSliderMixin.dgG  s   € ô Ð$ dÓ+Ð+r7   )rp   rd   r<   úOptionSequence[T]r4   ztuple[T, T] | list[T]r:   úCallable[[Any], Any]rq   ú
Key | Nonerr   ú
str | Noners   úWidgetCallback | Nonert   úWidgetArgs | Noneru   úWidgetKwargs | Nonerj   r^   rk   r   rl   r,   rm   r#   r\   r�   )rp   rd   r<   r±   r4   zT | Noner:   r²   rq   r³   rr   r´   rs   rµ   rt   r¶   ru   r·   rj   r^   rk   r   rl   r,   rm   r#   r\   r.   )rp   rd   r<   r±   r4   úT | Sequence[T] | Noner:   r²   rq   r³   rr   r´   rs   rµ   rt   r¶   ru   r·   rj   r^   rk   r   rl   r,   rm   r#   r\   r_   )rp   rd   r<   r±   r4   r¸   r:   r²   rq   r³   rr   r´   rs   rµ   rt   r¶   ru   r·   rj   r^   rk   r   ry   zScriptRunContext | Nonerl   r,   rm   r#   r\   r_   )r\   r+   )
r`   ra   rb   r   rd   rv   r    rz   Úpropertyr‡   re   r7   r5   rg   rg   Ÿ   sY  „ Øð -0ØØØ+/Ø"&Ø&*ðð Ø,5Ø%.Øñàðð #ðð %ð	ð
 *ðð ðð ðð )ðð  ðð $ðð ðð *ðð #ðð ðð  
ò!ó ðð$ ð &(ØØ,/ØØØ+/Ø"&Ø&*ðð Ø,5Ø%.Øñàðð #ðð ð	ð
 *ðð ðð ðð )ðð  ðð $ðð ðð *ðð #ðð ðð  
ò!ó ðñ$ �OÓ$ð &(Ø(,Ø,/ØØØ+/Ø"&Ø&*ðU
ð Ø,5Ø%.ØñU
àðU
ð #ðU
ð &ð	U
ð
 *ðU
ð ðU
ð ðU
ð )ðU
ð  ðU
ð $ðU
ð ðU
ð *ðU
ð #ðU
ð ðU
ð  
ò!U
ó %ðU
ðt &(Ø(,Ø,/ØØØ+/Ø"&Ø&*ØØ,5Ø'+Ø%.Øðgàðgð #ðgð &ð	gð
 *ðgð ðgð ðgð )ðgð  ðgð $ðgð ðgð *ðgð %ðgð #ðgð ðgð  
ó!gðR ò,ó ñ,r7   rg   N)r4   zT | Sequence[T]r\   zTypeGuard[Sequence[T]])BÚ
__future__r   Útextwrapr   Útypingr   r   r   r   r	   r
   r   Ústreamlit.dataframe_utilr   r   Ú!streamlit.elements.lib.form_utilsr   Ú#streamlit.elements.lib.layout_utilsr   Ú-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.Slider_pb2r   r’   Ústreamlit.runtime.metrics_utilr    Ústreamlit.runtime.scriptrunnerr!   r"   Ústreamlit.runtime.stater#   r$   r%   r&   r'   Ústreamlit.type_utilr(   Úcollections.abcr)   r*   Ústreamlit.delta_generatorr+   r,   Ústreamlit.runtime.state.commonr-   r.   r6   r9   rg   re   r7   r5   ú<module>rÌ      sš   ðõ #å ÷÷ ñ ÷ NÝ =Ý D÷÷ ÷÷÷ õ 3Ý <Ý 9ß O÷õ õ 8áß2å8ÝGÝCáˆCƒL€ó,ôN˜ ™
ô N÷bk,ò k,r7   