
    /_i/h                    t   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
 d dlmZ d dl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 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*m+Z+m,Z,m-Z-m.Z. d dl/m0Z0 d dl1m2Z2 erd dl3m4Z4 d dl1m2Z2 e G d d             Z5e G d d             Z6 G d d      Z7y)    )annotations)	dataclass)dedent)TYPE_CHECKINGLiteralcastoverload)current_form_id)HeightLayoutConfigWidthWithoutContentvalidate_heightvalidate_width)check_widget_policiesmaybe_raise_label_warnings)KeyLabelVisibilitycompute_and_register_element_id get_label_visibility_proto_valueto_key)StreamlitAPIException)TextArea)	TextInput)gather_metrics)ScriptRunContextget_script_run_ctx)
WidgetArgsWidgetCallbackWidgetKwargsget_session_stateregister_widget)validate_icon_or_emoji)SupportsStr)DeltaGeneratorc                  (    e Zd ZU ded<   ddZddZy)TextInputSerde
str | Nonevaluec                "    ||S | j                   S Nr(   selfui_values     f/var/www/html/land_sniper/venv/lib/python3.12/site-packages/streamlit/elements/widgets/text_widgets.pydeserializezTextInputSerde.deserialize@       #/x?TZZ?    c                    |S r*    r-   vs     r/   	serializezTextInputSerde.serializeC       r2   Nr.   r'   returnr'   r6   r'   r:   r'   __name__
__module____qualname____annotations__r0   r7   r4   r2   r/   r&   r&   <       @r2   r&   c                  (    e Zd ZU ded<   ddZddZy)TextAreaSerder'   r(   c                "    ||S | j                   S r*   r+   r,   s     r/   r0   zTextAreaSerde.deserializeK   r1   r2   c                    |S r*   r4   r5   s     r/   r7   zTextAreaSerde.serializeN   r8   r2   Nr9   r;   r<   r4   r2   r/   rC   rC   G   rA   r2   rC   c                     e Zd Ze	 	 	 	 	 	 	 	 	 ddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 	 	 	 ddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z ed      	 	 	 	 	 	 	 	 	 ddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	       Z	 	 	 	 	 	 	 	 	 dddddddd
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZe	 	 	 	 	 	 	 	 dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 	 	 dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z ed      	 	 	 	 	 	 	 	 dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z	 	 	 	 	 	 	 	 ddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZe	d d       Z
y)!TextWidgetsMixinNFvisiblestretch)placeholderdisabledlabel_visibilityiconwidthc                    y r*   r4   r-   labelr(   	max_charskeytypehelpautocomplete	on_changeargskwargsrJ   rK   rL   rM   rN   s                   r/   
text_inputzTextWidgetsMixin.text_inputS       ( 	r2   c                    y r*   r4   rP   s                   r/   rZ   zTextWidgetsMixin.text_inputi   r[   r2   rZ   c               X    t               }| j                  |||||||||	|
||||||      S )u`  Display a single-line text input widget.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this input 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. Display unsupported elements as literal
            characters by backslash-escaping them. E.g.,
            ``"1\. Not an ordered list"``.

            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

        value : object or None
            The text value of this widget when it first renders. This will be
            cast to str internally. If ``None``, will initialize empty and
            return ``None`` until the user provides input. Defaults to empty string.

        max_chars : int or None
            Max number of characters allowed in text input.

        key : str or int
            An optional string or integer to use as the unique key for the widget.
            If this is omitted, a key will be generated for the widget
            based on its content. No two widgets may have the same key.

        type : "default" or "password"
            The type of the text input. This can be either "default" (for
            a regular text input), or "password" (for a text input that
            masks the user's typed value). Defaults to "default".

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

        autocomplete : str
            An optional value that will be passed to the <input> element's
            autocomplete property. If unspecified, this value will be set to
            "new-password" for "password" inputs, and the empty string for
            "default" inputs. For more details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

        on_change : callable
            An optional callback invoked when this text input'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.

        placeholder : str or None
            An optional string displayed when the text input is empty. If None,
            no text is displayed.

        disabled : bool
            An optional boolean that disables the text input 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.

        icon : str, None
            An optional emoji or icon to display within the input field to the
            left of the value. If ``icon`` is ``None`` (default), no icon is
            displayed. If ``icon`` is a string, the following options are
            valid:

            - A single-character emoji. For example, you can set ``icon="🚨"``
              or ``icon="🔥"``. Emoji short codes are not supported.

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

            - ``"spinner"``: Displays a spinner as an icon.

        width : "stretch" or int
            The width of the text input 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.

        Returns
        -------
        str or None
            The current value of the text input widget or ``None`` if no value has been
            provided by the user.

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> title = st.text_input("Movie title", "Life of Brian")
        >>> st.write("The current movie title is", title)

        .. output::
           https://doc-text-input.streamlit.app/
           height: 260px

        )rQ   r(   rR   rS   rT   rU   rV   rW   rX   rY   rJ   rK   rL   rM   rN   ctx)r   _text_input)r-   rQ   r(   rR   rS   rT   rU   rV   rW   rX   rY   rJ   rK   rL   rM   rN   r^   s                    r/   rZ   zTextWidgetsMixin.text_input   sU    l !"%#-!   
 	
r2   )rJ   rK   rL   rM   rN   r^   c               f   t        |      }t        | j                  |||dk(  rd n|       t        ||       |t	        |      nd }t        d|dh| j                  ||||||t	        |      ||      }t               j                  }|||v r||   d }t               }||_	        ||_
        |||_        t        | j                        |_        ||_        t        |      |j                   _        |t%        |      |_        |||_        |t	        |      |_        |t-        |      |_        |dk(  rt        j0                  |_        n*|dk(  rt        j4                  |_        nt7        d| d	      |	|dk(  rd
nd}||_        t;        |      }t=        |j                  ||	|
|j>                  |j@                  |d      }|jB                  r$|j"                  |j"                  |_        d|_"        tG        |       tI        |      }| j                  jK                  d||       |j"                  S )N default_valuerZ   rR   )user_keykey_as_main_identitydgrQ   r(   rR   rT   rU   rV   rJ   rM   rN   defaultpassword'zK' is not a valid text_input type. Valid types are 'default' and 'password'.znew-passwordstring_valueon_change_handlerrX   rY   deserializer
serializerr^   
value_typeT)rN   layout_config)&r   r   rf   r   strr   r    filtered_stateTextInputProtoidrQ   rg   r
   form_idrK   r   rL   r(   r   rU   rR   rJ   r"   rM   DEFAULTrT   PASSWORDr   rV   r&   r!   r0   r7   value_changed	set_valuer   r   _enqueue)r-   rQ   r(   rR   rS   rT   rU   rV   rW   rX   rY   rJ   rK   rL   rM   rN   r^   
element_idsession_statetext_input_protoserdewidget_staterq   s                          r/   r_   zTextWidgetsMixin._text_input)  sg   ( SkGG"'2+$5		
 	#5*:; $/E
T4 #.ww%K(

$ *+::?sm3c8J8RE)+(!&',$#2477#; $,!2R3
))/ $*4L! )2&"+.{+;($:4$@!9$2$:$:!Z$2$;$;!'D6de  -1Z-?>RL(4%u%&'**%	
 %%!!-)5);); &)-&u$51'7}U!!!r2   )rJ   rK   rL   rN   c
                    y r*   r4   r-   rQ   r(   heightrR   rS   rU   rW   rX   rY   rJ   rK   rL   rN   s                 r/   	text_areazTextWidgetsMixin.text_area      $ 	r2   c
                    y r*   r4   r   s                 r/   r   zTextWidgetsMixin.text_area  r   r2   r   c
               T    t               }| j                  |||||||||	|
||||      S )a  Display a multi-line text input widget.

        Parameters
        ----------
        label : str
            A short label explaining to the user what this input 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. Display unsupported elements as literal
            characters by backslash-escaping them. E.g.,
            ``"1\. Not an ordered list"``.

            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

        value : object or None
            The text value of this widget when it first renders. This will be
            cast to str internally. If ``None``, will initialize empty and
            return ``None`` until the user provides input. Defaults to empty string.

        height : "content", "stretch", int, or None
            The height of the text area widget. This can be one of the
            following:

            - ``None`` (default): The height of the widget fits three lines.
            - ``"content"``: The height of the widget matches the
              height of its content.
            - ``"stretch"``: The height of the widget matches the height of
              its content or the height of the parent container, whichever is
              larger. If the widget is not in a parent container, the height
              of the widget matches the height of its content.
            - An integer specifying the height in pixels: The widget has a
              fixed height. If the content is larger than the specified
              height, scrolling is enabled.

            The widget's height can't be smaller than the height of two lines.
            When ``label_visibility="collapsed"``, the minimum height is 68
            pixels. Otherwise, the minimum height is 98 pixels.

        max_chars : int or None
            Maximum number of characters allowed in text area.

        key : str or int
            An optional string or integer to use as the unique key for the widget.
            If this is omitted, a key will be generated for the widget
            based on its content. No two widgets may have the same 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 text_area'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.

        placeholder : str or None
            An optional string displayed when the text area is empty. If None,
            no text is displayed.

        disabled : bool
            An optional boolean that disables the text area 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 text area 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.

        Returns
        -------
        str or None
            The current value of the text area widget or ``None`` if no value has been
            provided by the user.

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> txt = st.text_area(
        ...     "Text to analyze",
        ...     "It was the best of times, it was the worst of times, it was the age of "
        ...     "wisdom, it was the age of foolishness, it was the epoch of belief, it "
        ...     "was the epoch of incredulity, it was the season of Light, it was the "
        ...     "season of Darkness, it was the spring of hope, it was the winter of "
        ...     "despair, (...)",
        ... )
        >>>
        >>> st.write(f"You wrote {len(txt)} characters.")

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

        )rQ   r(   r   rR   rS   rU   rW   rX   rY   rJ   rK   rL   rN   r^   )r   
_text_area)r-   rQ   r(   r   rR   rS   rU   rW   rX   rY   rJ   rK   rL   rN   r^   s                  r/   r   zTextWidgetsMixin.text_area  sM    b !"#-  
 	
r2   )rJ   rK   rL   rN   r^   c
                  t        |      }t        | j                  |||dk(  rd n|       t        ||       |t	        |      nd }t        d|dh| j                  |||||t	        |
      |      }t               j                  }|||v r||   d }t               }||_	        ||_
        |||_        t        | j                        |_        ||_        t        |      |j                   _        |t%        |      |_        |||_        |
t	        |
      |_        t-        |      }t/        |j                  |||	|j0                  |j2                  |d      }|j4                  r$|j"                  |j"                  |_        d|_        t9        |       |t;        |d	       n	|d
k7  rdnd}t=        ||      }| j                  j?                  d||       |j"                  S )Nra   rb   r   rR   )
rd   re   rf   rQ   r(   r   rR   rU   rJ   rN   rj   rk   T)allow_content	collapsedz   ^   )rN   r   rp   ) r   r   rf   r   rr   r   r    rs   TextAreaProtoru   rQ   rg   r
   rv   rK   r   rL   r(   r   rU   rR   rJ   rC   r!   r0   r7   ry   rz   r   r   r   r{   )r-   rQ   r(   r   rR   rS   rU   rW   rX   rY   rJ   rK   rL   rN   r^   r|   r}   text_area_protor   r   rq   s                        r/   r   zTextWidgetsMixin._text_areai  s   $ SkGG"'2+$5		
 	#5*:;#/E
T4 #.wwK(

  *+::?sm3c8J8RE'/' %&+O#"1$''":#+ 1Q2
((. #)$<O  (1O%"*-k*:O'e$&'**%	
 %%!!-(4(:(:%(,O%uF$7 -;SF$5@o]S!!!r2   c                    t        d|       S )zGet our DeltaGenerator.r$   )r   )r-   s    r/   rf   zTextWidgetsMixin.dg  s     $d++r2   )	ra   NNrg   NNNNN) rQ   rr   r(   rr   rR   
int | NonerS   
Key | NonerT   Literal['default', 'password']rU   r'   rV   r'   rW   WidgetCallback | NonerX   WidgetArgs | NonerY   WidgetKwargs | NonerJ   r'   rK   boolrL   r   rM   r'   rN   r   r:   rr   )	NNNrg   NNNNN) rQ   rr   r(   SupportsStr | NonerR   r   rS   r   rT   r   rU   r'   rV   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rM   r'   rN   r   r:   r'   ) rQ   rr   r(   str | SupportsStr | NonerR   r   rS   r   rT   r   rU   r'   rV   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rM   r'   rN   r   r:   r'   )"rQ   rr   r(   r   rR   r   rS   r   rT   rr   rU   r'   rV   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rM   r'   rN   r   r^   ScriptRunContext | Noner:   r'   )ra   NNNNNNN)rQ   rr   r(   rr   r   Height | NonerR   r   rS   r   rU   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rN   r   r:   rr   )NNNNNNNN)rQ   rr   r(   r   r   r   rR   r   rS   r   rU   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rN   r   r:   r'   )rQ   rr   r(   r   r   r   rR   r   rS   r   rU   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rN   r   r:   r'   )rQ   rr   r(   r   r   r   rR   r   rS   r   rU   r'   rW   r   rX   r   rY   r   rJ   r'   rK   r   rL   r   rN   r   r^   r   r:   r'   )r:   r$   )r=   r>   r?   r	   rZ   r   r_   r   r   propertyrf   r4   r2   r/   rG   rG   R   s&     $/8#'+/"&&* #',5%.#  	
  -  ! )   $    *  !" ##$ 
% *  %) $/8#'+/"&&* #',5%.# " 	
  -  ! )   $    *  !" ##$ 
% * L! +- $/8#'+/"&&*g
 #',5%.#g
g
 (g
 	g

 g
 -g
 g
 !g
 )g
  g
 $g
  g
 g
 *g
  !g
" ##g
$ 
%g
 "g
X %' $#'+/"&&*s" #',5%.'+%s"s" "s" 	s"
 s" s" s" !s" )s"  s" $s"  s" s" *s"  !s"" ##s"$ %%s"& 
's"j   $ $+/"&&* #',5%.  	
    )   $    * #  
! &  %) $ $+/"&&* #',5%. " 	
    )   $    * #  
! & K  +- $ $+/"&&*`
 #',5%.`
`
 (`
 	`

 `
 `
 `
 )`
  `
 $`
  `
 `
 *`
 #`
  
!`
 !`
J %' $ $+/"&&*d" #',5%.'+!d"d" "d" 	d"
 d" d" d" )d"  d" $d"  d" d" *d" #d"  %!d"" 
#d"L , ,r2   rG   N)8
__future__r   dataclassesr   textwrapr   typingr   r   r   r	   !streamlit.elements.lib.form_utilsr
   #streamlit.elements.lib.layout_utilsr   r   r   r   r   streamlit.elements.lib.policiesr   r   streamlit.elements.lib.utilsr   r   r   r   r   streamlit.errorsr   streamlit.proto.TextArea_pb2r   r   streamlit.proto.TextInput_pb2r   rt   streamlit.runtime.metrics_utilr   streamlit.runtime.scriptrunnerr   r   streamlit.runtime.stater   r   r   r    r!   streamlit.string_utilr"   streamlit.type_utilr#   streamlit.delta_generatorr$   r&   rC   rG   r4   r2   r/   <module>r      s    # !  9 9 =   3 B E 9 O  9 +8/      @
, @
,r2   