a
    pDf7                     @  s   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
Z
ddlmZmZ ddlmZ erpd dlmZ d dlmZ d d	lmZ G d
d deZdS )    )annotations)TYPE_CHECKINGAnyClassVarDictMappingOptionalTypeN   )ChatAreaInputChatMessageEvent)TextAreaInput)Document)Comm)Modelc                      s   e Zd ZU dZejdddZejdddZejdddZej	dd	dZ
ej	d
ddZejdg dddZeZded< ddiejZded< ddd fddZd&dddddd fdd Zd!d"d#d$d%Z  ZS )'r   a:  
    The `ChatAreaInput` allows entering any multiline string using a text input
    box, with the ability to press enter to submit the message.

    Unlike TextAreaInput, the `ChatAreaInput` defaults to auto_grow=True and
    max_rows=10, and the value is not synced to the server until the enter key
    is pressed so bind on `value_input` if you need to access the existing value.

    Lines are joined with the newline character `\n`.

    Reference: https://panel.holoviz.org/reference/chat/ChatAreaInput.html

    :Example:

    >>> ChatAreaInput(max_rows=10)
    Tzl
        Whether the text area should automatically grow vertically to
        accommodate the current text.)defaultdocFzHIf True, disables sending the message by pressing the `enter_sends` key.zbIf True, pressing the Enter key sends the message, if False it is sent by pressing the Ctrl+Enter.   z0
        Number of rows in the text input field.
   zq
        When combined with auto_grow this determines the maximum number
        of rows the input area can grow.height)Zbothwidthr   Fz
        Whether the layout is interactively resizable,
        and if so in which dimensions: `width`, `height`, or `both`.
        Can only be set during initialization.)r   Zobjectsr   zClassVar[Type[Model]]_widget_typevalueNz"ClassVar[Mapping[str, str | None]]_renamer   zDict[str, Any])r   returnc                   s$   t  |}|| j| jd |S )N)Zvalue_inputr   )super_get_propertiesupdater   )selfr   props	__class__ ]/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/panel/chat/input.pyr   R   s    zChatAreaInput._get_propertieszOptional[Model]zOptional[Comm]r   )r   rootparentcommr   c                   s(   t  ||||}| jd|||d |S )NZchat_message_event)modelr   r&   )r   
_get_modelZ_register_events)r   r   r$   r%   r&   r'   r    r"   r#   r(   W   s    zChatAreaInput._get_modelr   None)eventr   c                 C  s<   |j | _ t|  d| _ W d   n1 s.0    Y  dS )z6
        Clear value on shift enter key down.
         N)r   paramZdiscard_events)r   r*   r"   r"   r#   _process_eventb   s    zChatAreaInput._process_event)NNN)__name__
__module____qualname____doc__r,   BooleanZ	auto_growZdisabled_enterZenter_sendsZIntegerrowsZmax_rowsZObjectSelectorZ	resizable_bkChatAreaInputr   __annotations___PnTextAreaInputr   r   r(   r-   __classcell__r"   r"   r    r#   r      sD   
	   r   )
__future__r   typingr   r   r   r   r   r   r	   r,   Zmodels.chatarea_inputr   r4   r   Zwidgetsr   r6   Zbokeh.documentr   Zpyviz_commsr   Zbokeh.modelr   r"   r"   r"   r#   <module>   s   $