a
    d=
                     @  sh   d Z ddlmZ ddlZddlmZ ddlmZmZ ddl	m
Z
mZ ed edG d	d
 d
e
ZdS )z[ Predefined buttons with bound events that can be included in a gr.Blocks for convenience.     )annotationsN)Literal)documentset_documentation_group)Button	Component	componentaddc                      sl   e Zd ZdZdZdddddddddddddddd	d
ddddddddd fddZdd dddZ  ZS )ClearButtonaH  
    Button that clears the value of a component or a list of components when clicked. It is instantiated with the list of components to clear.
    Preprocessing: passes the button value as a {str} into the function
    Postprocessing: expects a {str} to be returned from a function, which is set as the label of the button
    TNZClearZ	secondary)valuevariantsizeiconlinkvisibleinteractiveelem_idelem_classesscale	min_widthz"None | list[Component] | Componentstrz'Literal['primary', 'secondary', 'stop']zLiteral['sm', 'lg'] | Nonez
str | Noneboolzlist[str] | str | Nonez
int | None)
componentsr   r   r   r   r   r   r   r   r   r   r   c                  s8   t  j|f|||||||	|
||d
| | | d S )N)
r   r   r   r   r   r   r   r   r   r   )super__init__r	   )selfr   r   r   r   r   r   r   r   r   r   r   r   kwargs	__class__ g/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/components/clear_button.pyr      s"    zClearButton.__init__z"None | Component | list[Component])r   returnc                 C  sH   |s| S t |tr|g}tdd |D }| jdg |d| d | S )z
        Adds a component or list of components to the list of components that will be cleared when the button is clicked.
        c                 S  s   g | ]}| d qS )N)postprocess).0r   r   r   r    
<listcomp>G       z#ClearButton.add.<locals>.<listcomp>Nz() => )Z_js)
isinstancer   jsondumpsZclick)r   r   Zclear_valuesr   r   r    r	   :   s    
zClearButton.add)N)__name__
__module____qualname____doc__Zis_templater   r	   __classcell__r   r   r   r    r
      s"    ,!r
   )r,   
__future__r   r'   typingr   Zgradio_client.documentationr   r   Zgradio.componentsr   r   r
   r   r   r   r    <module>   s   