
    l0jX0                       d dl mZ d dlZd dlmZ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 erd dl	mZ  ed	            e             G d
 de
                      Z e             G d de
                      Z G d de
ee          Z e             G d de
e                      ZeZ e             G d de
                      Z G d de
          Z G d de
          Z e             G d de
                      ZdS )    )annotationsN)TYPE_CHECKINGLiteral)documentset_documentation_group)BlockContext)warn_deprecationwarn_style_method_deprecation)
Changeable
Selectable)Blocklayoutc                  d     e Zd ZdZdddddd fdZ fdZe	 ddd            ZddddZ xZ	S )Rowa3  
    Row is a layout element within Blocks that renders all children horizontally.
    Example:
        with gr.Blocks() as demo:
            with gr.Row():
                gr.Image("lion.jpg", scale=2)
                gr.Image("tiger.jpg", scale=1)
        demo.launch()
    Guides: controlling-layout
    defaultTN)variantvisibleelem_idequal_heightr   &Literal['default', 'panel', 'compact']r   boolr   
str | Noner   c               v    || _         || _        |dk    rd| _         t                      j        d||d| dS )a  
        Parameters:
            variant: row type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
            visible: If False, row will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
            equal_height: If True, makes every child element have equal height
        compactFr   r   N )r   r   allow_expected_parentssuper__init__)selfr   r   r   r   kwargs	__class__s         Q/home/wildlama/miniconda3/envs/lam/lib/python3.11/site-packages/gradio/layouts.pyr   zRow.__init__   sQ      (i*/D'D'DDVDDDDD    c                d    d| j         | j        dt                                                      S )Nrow)typer   r   )r   r   r   
get_configr    r"   s    r#   r(   zRow.get_config5   s:    | -
 
 gg  ""	
 	
r$   bool | Nonec                    | ddS Nupdate)r   __type__r   r   s    r#   r-   z
Row.update=       
  
 
 	
r$   )r   c               4    t                       ||| _        | S )z
        Styles the Row.
        Parameters:
            equal_height: If True, makes every child element have equal height
        )r
   r   )r    r   r!   s      r#   stylez	Row.styleF   s#     	&'''# ,Dr$   )r   r   r   r   r   r   r   r   Nr   r*   )r   r*   
__name__
__module____qualname____doc__r   r(   staticmethodr-   r2   __classcell__r"   s   @r#   r   r      s        	 	 ;D"!E E E E E E E E,
 
 
 
 
 #
 
 
 
 \
 %)         r$   r   c                  Z     e Zd ZdZddddddd fdZ fdZe	 	 ddd            Z xZS )Columna~  
    Column is a layout element within Blocks that renders all children vertically. The widths of columns can be set through the `scale` and `min_width` parameters.
    If a certain scale results in a column narrower than min_width, the min_width parameter will win.
    Example:
        with gr.Blocks() as demo:
            with gr.Row():
                with gr.Column(scale=1):
                    text1 = gr.Textbox()
                    text2 = gr.Textbox()
                with gr.Column(scale=4):
                    btn1 = gr.Button("Button 1")
                    btn2 = gr.Button("Button 2")
    Guides: controlling-layout
       i@  r   TN)scale	min_widthr   r   r   r@   intrA   r   r   r   r   r   r   c                   |t          |          k    rt          d| d           || _        || _        || _        |dk    rd| _         t                      j        d||d| dS )a  
        Parameters:
            scale: relative width compared to adjacent Columns. For example, if Column A has scale=2, and Column B has scale=1, A will be twice as wide as B.
            min_width: minimum pixel width of Column, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in a column narrower than min_width, the min_width parameter will be respected first.
            variant: column type, 'default' (no background), 'panel' (gray background color and rounded corners), or 'compact' (rounded corners and no internal gap).
            visible: If False, column will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        z*'scale' value should be an integer. Using z will cause issues.r   Fr   Nr   )roundr	   r@   rA   r   r   r   r   )r    r@   rA   r   r   r   r!   r"   s          r#   r   zColumn.__init__h   s    $ E%LL  WUWWW   
"i*/D'D'DDVDDDDDr$   c                p    d| j         | j        | j        dt                                                      S )Ncolumn)r'   r   r@   rA   )r   r@   rA   r   r(   r)   s    r#   r(   zColumn.get_config   s>    |Z	
 

 gg  ""
 	
r$   r*   c                    | |ddS )Nr-   )r   r   r.   r   )r   r   s     r#   r-   zColumn.update   s      
 
 	
r$   )
r@   rB   rA   rB   r   r   r   r   r   r   )NN)r   r   r   r*   	r6   r7   r8   r9   r   r(   r:   r-   r;   r<   s   @r#   r>   r>   W   s         $ :C"E E E E E E E E<
 
 
 
 
 "#
 
 
 
 \
 
 
 
 
r$   r>   c                  P     e Zd ZdZddddddZ fdZe	 ddd            Z xZS )Tabsz\
    Tabs is a layout element within Blocks that can contain multiple "Tab" Components.
    NT)selectedr   r   rK   int | str | Noner   r   r   r   c                   t          j        | f||d| t          j        |            t          j        |            || _        dS )ap  
        Parameters:
            selected: The currently selected tab. Must correspond to an id passed to the one of the child TabItems. Defaults to the first TabItem.
            visible: If False, Tabs will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        r   N)r   r   r   r   rK   )r    rK   r   r   r!   s        r#   r   zTabs.__init__   sQ     	dOGWOOOOOD!!!D!!! r$   c                d    d| j         it          t          |                                           S )NrK   )rK   r   r   r(   r)   s    r#   r(   zTabs.get_config   s+    DMTU<-F-F-Q-Q-S-STTr$   c                    | ddS )Nr-   )rK   r.   r   )rK   s    r#   r-   zTabs.update   s    
 ! 
 
 	
r$   )rK   rL   r   r   r   r   r3   )rK   rL   rH   r<   s   @r#   rJ   rJ      s          &*"! ! ! ! ! !&U U U U U %)
 
 
 
 \
 
 
 
 
r$   rJ   c                  @     e Zd ZdZddddd
Z fdZddZd Z xZS )Taba  
    Tab (or its alias TabItem) is a layout element. Components defined within the Tab will be visible when this tab is selected tab.
    Example:
        with gr.Blocks() as demo:
            with gr.Tab("Lion"):
                gr.Image("lion.jpg")
                gr.Button("New Lion")
            with gr.Tab("Tiger"):
                gr.Image("tiger.jpg")
                gr.Button("New Tiger")
    Guides: controlling-layout
    N)idr   labelstrrR   rL   r   r   c               r    t          j        | fd|i| t          j        |            || _        || _        dS )aW  
        Parameters:
            label: The visual label for the tab
            id: An optional identifier for the tab, required if you wish to control the selected tab from a predict function.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        r   N)r   r   r   rS   rR   )r    rS   rR   r   r!   s        r#   r   zTab.__init__   sE     	d>>G>v>>>D!!!
r$   c                p    | j         | j        dt          t          |                                           S )N)rS   rR   )rS   rR   r   r   r(   r)   s    r#   r(   zTab.get_config   s<    Z'
 
 L$''2244
 	
r$   return
type[Tabs]c                    t           S r3   )rJ   r    s    r#   get_expected_parentzTab.get_expected_parent   s    r$   c                    dS )Ntabitemr   rZ   s    r#   get_block_namezTab.get_block_name   s    yr$   )rS   rT   rR   rL   r   r   )rW   rX   )	r6   r7   r8   r9   r   r(   r[   r^   r;   r<   s   @r#   rQ   rQ      s         "  $"     &
 
 
 
 
         r$   rQ   c                  R     e Zd ZdZdddd fd	Z fd
Ze	 ddd            Z xZS )Groupa  
    Group is a layout element within Blocks which groups together children so that
    they do not have any padding or margin between them.
    Example:
        with gr.Group():
            gr.Textbox(label="First")
            gr.Textbox(label="Last")
    TNr   r   r   r   r   c               @     t                      j        d||d| dS )z
        Parameters:
            visible: If False, group will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        r   Nr   )r   r   r    r   r   r!   r"   s       r#   r   zGroup.__init__   s/     	D'DDVDDDDDr$   c                L    ddit                                                      S )Nr'   groupr   r(   r)   s    r#   r(   zGroup.get_config  s#    8577#5#5#7#788r$   r*   c                    | ddS r,   r   r/   s    r#   r-   zGroup.update  r0   r$   r   r   r   r   r3   r4   rH   r<   s   @r#   r`   r`      s          "	E E E E E E E E9 9 9 9 9 #
 
 
 
 \
 
 
 
 
r$   r`   c                  X     e Zd ZdZdddd fd	Z fd
Ze	 ddd            Zd Z xZ	S )Boxz
    DEPRECATED.
    Box is a a layout element which places children in a box with rounded corners and
    some padding around them.
    Example:
        with gr.Box():
            gr.Textbox(label="First")
            gr.Textbox(label="Last")
    TNr   r   r   r   r   c               t    t          j        dt                      t                      j        d||d| dS )z
        Parameters:
            visible: If False, box will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        z+gr.Box is deprecated. Use gr.Group instead.r   Nr   )warningswarnDeprecationWarningr   r   rb   s       r#   r   zBox.__init__$  sC     	CEWXXXD'DDVDDDDDr$   c                L    ddit                                                      S )Nr'   boxre   r)   s    r#   r(   zBox.get_config3  s#    6!3!3!5!566r$   r*   c                    | ddS r,   r   r/   s    r#   r-   z
Box.update6  r0   r$   c                "    t                       | S r3   )r
   )r    r!   s     r#   r2   z	Box.style?  s    %'''r$   rg   r3   r4   r5   r<   s   @r#   ri   ri     s          "	E E E E E E E E7 7 7 7 7 #
 
 
 
 \
      r$   ri   c                  >     e Zd Zdddd fdZd fd	Z fd
Z xZS )Formr   )r@   rA   r@   rB   rA   c               V    || _         || _         t                      j        di | dS )a  
        Parameters:
            scale: relative width compared to adjacent Columns. For example, if Column A has scale=2, and Column B has scale=1, A will be twice as wide as B.
            min_width: minimum pixel width of Column, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in a column narrower than min_width, the min_width parameter will be respected first.
        Nr   )r@   rA   r   r   )r    r@   rA   r!   r"   s       r#   r   zForm.__init__E  s6     
"""6"""""r$   childr   c                
   t          | j        t                    rFt          |dd           }| xj        |dn|z  c_        | xj        t          |dd          pdz  c_        t                                          |           d S )Nr@   r?   rA   r   )
isinstanceparentr   getattrr@   rA   r   	add_child)r    ru   r@   r"   s      r#   rz   zForm.add_childO  s    dk3'' 	BE7D11EJJu}!!%7JJNNge[!<<AANN%     r$   c                d    d| j         | j        dt                                                      S )Nform)r'   r@   rA   )r@   rA   r   r(   r)   s    r#   r(   zForm.get_configV  s9    Z
 
 gg  ""	
 	
r$   )r@   rB   rA   rB   )ru   r   )r6   r7   r8   r   rz   r(   r;   r<   s   @r#   rs   rs   D  s        '(1 # # # # # # # #! ! ! ! ! !
 
 
 
 
 
 
 
 
r$   rs   c                  X     e Zd ZdZddddd fd
Z fdZe	 	 	 ddd            Z xZS )	Accordionz
    Accordion is a layout element which can be toggled to show/hide the contained content.
    Example:
        with gr.Accordion("See Details"):
            gr.Markdown("lorem ipsum")
    TN)openr   r   r   r   r   r   r   c               \    || _         || _         t                      j        d||d| dS )a  
        Parameters:
            label: name of accordion section.
            open: if True, accordion is open by default.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
        r   Nr   )rS   r   r   r   )r    rS   r   r   r   r!   r"   s         r#   r   zAccordion.__init__h  s=     
	D'DDVDDDDDr$   c                d    d| j         | j        dt                                                      S )N	accordion)r'   r   rS   )r   rS   r   r(   r)   s    r#   r(   zAccordion.get_config{  s9    IZ
 
 gg  ""	
 	
r$   r*   rS   c                    ||| ddS )Nr-   )r   rS   r   r.   r   )r   rS   r   s      r#   r-   zAccordion.update  s      	
 
 	
r$   )r   r   r   r   r   r   )NNN)r   r*   rS   r   r   r*   rH   r<   s   @r#   r~   r~   _  s          "E E E E E E E E&
 
 
 
 
   #

 

 

 

 \

 

 

 

 

r$   r~   )
__future__r   rk   typingr   r   gradio_client.documentationr   r   gradio.blocksr   gradio.deprecationr	   r
   gradio.eventsr   r   r   r   r>   rJ   rQ   TabItemr`   ri   rs   r~   r   r$   r#   <module>r      s   " " " " " "  ) ) ) ) ) ) ) ) I I I I I I I I & & & & & & N N N N N N N N 0 0 0 0 0 0 0 0 $######   ! ! ! 
A A A A A, A A AH 
@
 @
 @
 @
 @
\ @
 @
 @
F"
 "
 "
 "
 "
<Z "
 "
 "
J 
, , , , ,,
 , , ,^  
"
 "
 "
 "
 "
L "
 "
 "
J( ( ( ( (, ( ( (V
 
 
 
 
< 
 
 
6 
.
 .
 .
 .
 .
 .
 .
 .
 .
 .
r$   