o
    $	hn                     @  s  U d dl mZ d dlmZ d dl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 d dlmZ d dlmZ d d	lmZ eeed
 f Zded< eeed f Zded< eeed
 f Zded< eeed f Zded< ed Zded< ed Zded< ed Z ded< eG dd dZ!dJdKdd Z"		!	"dLdMd(d)Z#dNd+d,Z$dOd.d/Z%dPd5d6Z&dQd8d9Z'dRd;d<Z(d=d>d?d=d?d@dAZ)dSdEdFZ*dTdHdIZ+d"S )U    )annotations)	dataclass)LiteralUnioncast)	TypeAlias)StreamlitInvalidColumnGapErrorStreamlitInvalidHeightError(StreamlitInvalidHorizontalAlignmentError&StreamlitInvalidVerticalAlignmentErrorStreamlitInvalidWidthError)Block)GapSize)HeightConfig)WidthConfigstretchr   WidthWithoutContent)r   contentWidthHeightWithoutContentHeightsmallmediumlargeGapleftcenterright
distributeHorizontalAlignmenttopr   bottomr    VerticalAlignmentc                   @  s&   e Zd ZU dZded< dZded< dS )LayoutConfigNzWidth | NonewidthzHeight | Noneheight)__name__
__module____qualname__r'   __annotations__r(    r-   r-   `/var/www/html/mmpi2/mmpi_env/lib/python3.10/site-packages/streamlit/elements/lib/layout_utils.pyr&   *   s   
 r&   Fr'   allow_contentboolreturnNonec                 C  sb   t | ttfst| |t | tr&dg}|r|d | |vr$t| |dS | dkr/t| |dS )a'  Validate the width parameter.

    Parameters
    ----------
    width : Any
        The width value to validate.
    allow_content : bool
        Whether to allow "content" as a valid width value.

    Raises
    ------
    StreamlitInvalidWidthError
        If the width value is invalid.
    r   r   r   N)
isinstanceintstrr   append)r'   r/   valid_stringsr-   r-   r.   validate_width0   s   




r8   TNr(   Height | Literal['auto']allow_stretchadditional_allowedlist[str] | Nonec                 C  s|   t | ttfst| |t | tr3g }|r|d |r!|d |r(|| | |vr1t| |dS | dkr<t| |dS )a  Validate the height parameter.

    Parameters
    ----------
    height : Any
        The height value to validate.
    allow_content : bool
        Whether to allow "content" as a valid height value.
    allow_stretch : bool
        Whether to allow "stretch" as a valid height value.
    additional_allowed : list[str] or None
        Additional string values to allow beyond the base allowed values.

    Raises
    ------
    StreamlitInvalidHeightError
        If the height value is invalid.
    r   r   r   N)r3   r4   r5   r	   r6   extend)r(   r/   r:   r;   r7   r-   r-   r.   validate_heightM   s    






r>   r   c                 C  >   t  }t| ttfrt| |_|S | dkrd|_|S d|_|S Nr   T)r   r3   r4   floatpixel_widthuse_contentuse_stretch)r'   width_configr-   r-   r.   get_width_configx      
rF   r   c                 C  r?   r@   )r   r3   r4   rA   pixel_heightrC   rD   )r(   height_configr-   r-   r.   get_height_config   rG   rJ   gap
str | Noneelement_typer5   GapSize.ValueTypec                 C  sX   t jt jt jd}t| tr|  }| }||v r|| S n| du r&t jS t	| |d)z6Convert a gap string or None to a GapSize proto value.r   N)rK   rM   )
r   SMALLMEDIUMLARGEr3   r5   lowerkeysNONEr   )rK   rM   gap_mappinggap_sizevalid_sizesr-   r-   r.   get_gap_size   s   
rX   horizontal_alignmentc                 C     g d}| |vrt | dd S )Nr   st.container)r
   )rY   valid_horizontal_alignmentsr-   r-   r.   validate_horizontal_alignment   s   r]   vertical_alignmentc                 C  rZ   )Nr"   r[   )r   )r^   valid_vertical_alignmentsr-   r-   r.   validate_vertical_alignment   s   
r`   startr   endspace_between)r   r   r   r#   r$   r    	alignment'HorizontalAlignment | VerticalAlignment%Block.FlexContainer.Justify.ValueTypec                 C  sb   g d}t |  }||vrtjjjS |dv r$tdttjjd|  S tdttjj|  S )N)ra   r   rb   rc   ra   rb   r   rf   JUSTIFY_)map_to_flex_terminologyr   FlexContainerJustifyJUSTIFY_UNDEFINEDr   getattrupper)rd   valid_justifyjustifyr-   r-   r.   get_justify   s   
rq   #Block.FlexContainer.Align.ValueTypec                 C  s@   g d}t |  }||vrtjjjS tdttjjd|  S )Nrg   rr   ALIGN_)ri   r   rj   AlignALIGN_UNDEFINEDr   rm   rn   )rd   valid_alignalignr-   r-   r.   	get_align   s   
rx   )F)r'   r   r/   r0   r1   r2   )FTN)
r(   r9   r/   r0   r:   r0   r;   r<   r1   r2   )r'   r   r1   r   )r(   r   r1   r   )rK   rL   rM   r5   r1   rN   )rY   r!   r1   r2   )r^   r%   r1   r2   )rd   re   r1   rf   )rd   re   r1   rr   ),
__future__r   dataclassesr   typingr   r   r   typing_extensionsr   streamlit.errorsr   r	   r
   r   r   streamlit.proto.Block_pb2r   streamlit.proto.GapSize_pb2r    streamlit.proto.HeightConfig_pb2r   streamlit.proto.WidthConfig_pb2r   r4   r   r,   r   r   r   r   r!   r%   r&   r8   r>   rF   rJ   rX   r]   r`   ri   rq   rx   r-   r-   r-   r.   <module>   sJ   
+





