o
    e]                    @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
Z
d dlZd dlZd dl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 ed	 G d
d dZeddddddG dd deZdS )    )annotationsN)Path)Iterable)documentset_documentation_group)CommitOperationAdd)colorsfontsget_matching_versionget_theme_assetssizes)README_CONTENTthemesc                   @  s   e Zd Zdd Zdd Zdd Zed(d
dZed)ddZd*ddZ	ed+d,ddZ
ed-ddZed.dd Z						!d/d0d&d'ZdS )1
ThemeClassc                 C  s   g | _ d | _d S N)_stylesheetsname)self r   BD:\Projects\ConvertPro\env\Lib\site-packages\gradio/themes/base.py__init__   s   
zThemeClass.__init__c                   s(  i }i }| j  D ]R\  drq	d u r- dr%d | d d < q	td  dtd} fdd}t|| dd	  d
rW d d  | < q	| < q	| D ]\  |vrl| < q`dd	dd | D  d }dd	dd | D  d }| d| S )N__darkzCannot set 'z1' to None - only dark mode variables can be None.z(\*)([\w_]+)(\b)c                   s   |  d}|dr|drtd  d d dr;|dr; d d |dd  kr;td  d d	|  d
}|dd}d| dS )Nr   *r   zCannot refer 'z' to 'zz' - dark variable references are automatically used for dark mode attributes, so do not use the _dark suffix in the value.r      zN' - if dark and light mode values are the same, set dark mode version to None.   r   -zvar(--))group
startswithendswith
ValueErrorreplace)matchZ
full_matchwordattrvalr   r   	repl_func3   s    

z,ThemeClass._get_theme_css.<locals>.repl_funcr   z-darkz:root {

c                 S  "   g | ]\}}d | d| dqS z  --z: ;r   .0r'   r(   r   r   r   
<listcomp>V      " z-ThemeClass._get_theme_css.<locals>.<listcomp>z
}z.dark {
c                 S  r+   r,   r   r.   r   r   r   r0   [   r1   )
__dict__itemsr    r!   r"   strresubr#   join)r   cssZdark_csspatternr)   Zcss_codeZdark_css_coder   r&   r   _get_theme_css!   sL   





zThemeClass._get_theme_cssc                 C  sd   di i}t | D ]'}|dr|ds|dks|dkr/tt| |ttfr/t| ||d |< q|S )z+Convert the theme into a python dictionary.themer   _fontr   r   )dirr    
isinstancegetattrlistr4   )r   Zschemapropr   r   r   to_dicta   s   zThemeClass.to_dictpathr4   returnc                 C  sB   t |}| tj|tjdW  d   S 1 sw   Y  dS )zdLoad a theme from a json file.

        Parameters:
            path: The filepath to read.
        )object_hookN)open	from_dictjsonloadr	   Zas_font)clsrC   fpr   r   r   rI   n   s   
$zThemeClass.loadr;   dict[str, dict[str, str]]c                 C  sd   |  }|d   D ]
\}}t||| q	t }|jD ]}|ds/t||s/t||t|| q|S )zCreate a theme instance from a dictionary representation.

        Parameters:
            theme: The dictionary representation of the theme.
        r;   r   )r3   setattrBaser2   r    hasattrr?   )rJ   r;   Z	new_themerA   valuebaser'   r   r   r   rG   x   s   
zThemeClass.from_dictfilenamec                 C  s"   t |tj|  tjd dS )zsWrite the theme to a json file.

        Parameters:
            filename: The path to write the theme too
        rJ   N)r   
write_textrH   dumpsrB   r	   FontEncoder)r   rR   r   r   r   dump   s   "zThemeClass.dumpN	repo_namehf_token
str | Nonec              
   C  s   d|vr
|d}}n| d\}}tj|d}z||}W n tjy4 } z	td| d|d}~ww t|}t||}	|	sOtd| ddd	 |D  tj	|d
d|	j
 dd}
| |
}||_|S )a  Load a theme from the hub.

        This DOES NOT require a HuggingFace account for downloading publicly available themes.

        Parameters:
            repo_name: string of the form <author>/<theme-name>@<semantic-version-expression>.  If a semantic version expression is omitted, the latest version will be fetched.
            hf_token: HuggingFace Token. Only needed to download private themes.
        @Ntoken
The space z does not existz.Cannot find a matching version for expression z from files c                 S  s   g | ]}|j qS r   )rR   )r/   fr   r   r   r0      s    z'ThemeClass.from_hub.<locals>.<listcomp>spacethemes/theme_schema@.json)repo_id	repo_typerR   )splithuggingface_hubHfApi
space_inforequests	HTTPErrorr"   r   r
   Zhf_hub_downloadversionrI   r   )rJ   rX   rY   r   rk   apirh   eassetsZmatching_versionZ
theme_filer;   r   r   r   from_hub   s4   


zThemeClass.from_hubrh    huggingface_hub.hf_api.SpaceInfoc                 C  s&   t | }t|dd dj}t| S )Nc                 S  s   | j S r   rk   )Zassetr   r   r   <lambda>   s    z.ThemeClass._get_next_version.<locals>.<lambda>)key)r   maxrk   r4   Z
next_patch)rh   rn   Zlatest_versionr   r   r   _get_next_version   s   zThemeClass._get_next_versionrk   boolc                   s   t | }t fdd|D S )Nc                 3  s     | ]}|j t kV  qd S r   )rk   semverVersion)r/   arq   r   r   	<genexpr>   s    z3ThemeClass._theme_version_exists.<locals>.<genexpr>)r   any)rh   rk   rn   r   rq   r   _theme_version_exists   s   z ThemeClass._theme_version_existsForg_name
theme_namedescriptionprivatec              
   C  s  ddl m} t }	|s&zt d }
W n ty% } ztd|d}~ww tj|dd }
|p1|
 d| }z|	|}W n tj	yJ   d}Y nw |du}|s[|rX| 
|nd}nt|}|rv| ||rvtd	| d
| d| d|py|}tjdddd}|  }||d< tj||tjd W d   n1 sw   Y  tjddd}tj||pd|
|d}|t| W d   n1 sw   Y  tjddd:}ttjd  }tdd| d|}td|p||}td|p|
|}td||}|| W d   n	1 sw   Y  t d| d|j!dt d|j!dt d|j!dg}tj"|d d!|d"|d# |	j#|d$d ||d% d&| }t$d'|  |S )(u  Upload a theme to the HuggingFace hub.

        This requires a HuggingFace account.

        Parameters:
            repo_name: The name of the repository to store the theme assets, e.g. 'my_theme' or 'sunset'.
            org_name: The name of the org to save the space in. If None (the default), the username corresponding to the logged in user, or hƒ_token is used.
            version: A semantic version tag for theme. Bumping the version tag lets you publish updates to a theme without changing the look of applications that already loaded your theme.
            hf_token: API token for your HuggingFace account
            theme_name: Name for the name. If None, defaults to repo_name
            description: A long form description to your theme.
        r   )__version__r   zIn order to push to hub, log in via `huggingface-cli login` or provide a theme_token to push_to_hub. For more information see https://huggingface.co/docs/huggingface_hub/quick-start#loginNr\   /z0.0.1r^   z" already has a theme with version z. See: themes/theme_schema@zE.json. To manually override this version, use the HuggingFace hub UI.wFrb   )modedeletesuffixrk   rS   )r   r   z%Add a description of this theme here!)r~   r   authorZgradio_versionzapp.pyztheme=gr.themes.Default\(\)ztheme=''z{THEME}z{AUTHOR}z{SPACE_NAME}ra   )Zpath_in_repoZpath_or_fileobjz	README.mdr`   gradioT)rd   Z	space_sdkr]   exist_okr   zUpdating theme)rc   Zcommit_messagerd   
operationsr]   zhttps://huggingface.co/spaces/zSee your theme here! )%r   r   rf   rg   ZwhoamiOSErrorr"   rh   ri   rj   ru   rw   rx   r|   tempfileNamedTemporaryFilerB   rH   rW   r	   rV   r   formatwritetextwrapdedentr   __file__parent	read_textr5   r6   r   r   Zcreate_repoZcreate_commitprint)r   rX   r}   rk   rY   r~   r   r   r   rl   r   rm   Zspace_idrh   Zspace_existsr   Zcss_filecontentsZreadme_fileZreadme_contentZapp_filer   urlr   r   r   push_to_hub   s   


	
zThemeClass.push_to_hub)rC   r4   rD   r   )r;   rL   rD   r   )rR   r4   r   )rX   r4   rY   rZ   )rh   rp   rD   r4   )rh   rp   rk   r4   rD   rv   )NNNNNF)rX   r4   r}   rZ   rk   rZ   rY   rZ   r~   rZ   r   rZ   r   rv   )__name__
__module____qualname__r   r:   rB   classmethodrI   rG   rW   ro   staticmethodru   r|   r   r   r   r   r   r      s,    @	
'	r   r   ro   rI   rW   rG   rB   c                   @  s4  e Zd Zejejejejejej	e
ddddfe
ddddfd	dd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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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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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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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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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ddddZdS )rN   zSource Sans Prozui-sans-serifz	system-uiz
sans-serifzIBM Plex Monozui-monospaceZConsolasZ	monospace)primary_huesecondary_hueneutral_hue	text_sizespacing_sizeradius_sizefont	font_monor   colors.Color | strr   r   r   sizes.Size | strr   r   r   -fonts.Font | str | Iterable[fonts.Font | str]r   c                C  s  d| _ ddd}	|	|dd}|	|dd}|	|dd}|	|ddd	}|	|dd
d	}|	|ddd	}|j| _|j| _|j| _|j| _|j	| _
|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j	| _|j| _|j| _|j| _|j| _|j| _ |j| _!|j| _"|j| _#|j| _$|j| _%|j	| _&|j| _'|j| _(|j| _)|j| _*|j| _+|j| _,|j-| _.|j/| _0|j1| _2|j3| _4|j5| _6|j7| _8|j9| _:|j-| _;|j/| _<|j1| _=|j3| _>|j5| _?|j7| _@|j9| _A|j-| _B|j/| _C|j1| _D|j3| _E|j5| _F|j7| _G|j9| _HtI|tJs|g}dd |D | _KtI|tJs!|g}dd |D | _LdMdd | jKD | _NdMdd | jLD | _Og | _P| jK| jL D ]}|Q }
|
rY| jPR|
 qJ| S  dS )a
  
        Parameters:
            primary_hue: The primary hue of the theme. Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            secondary_hue: The secondary hue of the theme. Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            neutral_hue: The neutral hue of the theme, used . Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            text_size: The size of the text. Load a preset, like gradio.themes.sizes.text_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            spacing_size: The size of the spacing. Load a preset, like gradio.themes.sizes.spacing_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            radius_size: The radius size of corners. Load a preset, like gradio.themes.sizes.radius_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            font: The primary font to use for the theme. Pass a string for a system font, or a gradio.themes.font.GoogleFont object to load a font from Google Fonts. Pass a list of fonts for fallbacks.
            font_mono: The monospace font to use for the theme, applies to code. Pass a string for a system font, or a gradio.themes.font.GoogleFont object to load a font from Google Fonts. Pass a list of fonts for fallbacks.
        rQ   colorNc                 S  s   t | ts| S |dkr#tjjD ]}|j| kr|  S qtd|  d|dkrDtjjD ]}|j| d|  kr;|  S q+td|  dd S )Nr   zColor shortcut z not found.sizer   zSize shortcut )	r>   r4   r   Colorallr   r"   r   Size)Zshortcutr   prefixr   r   r   r   r   expand_shortcutk  s   

z&Base.__init__.<locals>.expand_shortcut)r   r   text)r   r   spacingZradiusc                 S  &   g | ]}t |tjr|nt|qS r   r>   r	   ZFontr/   Zfontfamr   r   r   r0         z!Base.__init__.<locals>.<listcomp>c                 S  r   r   r   r   r   r   r   r0     r   z, c                 s      | ]}t |V  qd S r   r4   r/   r   r   r   r   rz         z Base.__init__.<locals>.<genexpr>c                 s  r   r   r   r   r   r   r   rz     r   )r   N)Tr   c50Z
primary_50Zc100Zprimary_100Zc200Zprimary_200Zc300Zprimary_300Zc400Zprimary_400c500Zprimary_500Zc600Zprimary_600c700Zprimary_700Zc800Zprimary_800Zc900Zprimary_900Zc950Zprimary_950Zsecondary_50Zsecondary_100Zsecondary_200Zsecondary_300Zsecondary_400Zsecondary_500Zsecondary_600Zsecondary_700Zsecondary_800Zsecondary_900Zsecondary_950Z
neutral_50Zneutral_100Zneutral_200Zneutral_300Zneutral_400Zneutral_500Zneutral_600Zneutral_700Zneutral_800Zneutral_900Zneutral_950ZxxsZspacing_xxsZxsZ
spacing_xssmZ
spacing_smmd
spacing_mdZlgZ
spacing_lgZxlZ
spacing_xlZxxlZspacing_xxlZ
radius_xxsZ	radius_xsZ	radius_sm	radius_mdZ	radius_lgZ	radius_xlZ
radius_xxlZtext_xxsZtext_xsZtext_smtext_mdZtext_lgZtext_xlZtext_xxlr>   r   r<   Z
_font_monor7   r   r   r   
stylesheetappendset)r   r   r   r   r   r   r   r   r   r   Zfont_stylesheetr   r   r   r   C  s   &
zBase.__init__N)body_background_fillbody_background_fill_darkbody_text_colorbody_text_color_darkbody_text_sizebody_text_color_subduedbody_text_color_subdued_darkbody_text_weightembed_radiusbackground_fill_primarybackground_fill_primary_darkbackground_fill_secondarybackground_fill_secondary_darkborder_color_accentborder_color_accent_darkborder_color_accent_subdued border_color_accent_subdued_darkborder_color_primaryborder_color_primary_darkcolor_accentcolor_accent_softcolor_accent_soft_darklink_text_colorlink_text_color_darklink_text_color_activelink_text_color_active_darklink_text_color_hoverlink_text_color_hover_darklink_text_color_visitedlink_text_color_visited_darkprose_text_sizeprose_text_weightprose_header_text_weightshadow_dropshadow_drop_lgshadow_insetshadow_spreadshadow_spread_darkblock_background_fillblock_background_fill_darkblock_border_colorblock_border_color_darkblock_border_widthblock_border_width_darkblock_info_text_colorblock_info_text_color_darkblock_info_text_sizeblock_info_text_weightblock_label_background_fill block_label_background_fill_darkblock_label_border_colorblock_label_border_color_darkblock_label_border_widthblock_label_border_width_darkblock_label_shadowblock_label_text_colorblock_label_text_color_darkblock_label_marginblock_label_paddingblock_label_radiusblock_label_right_radiusblock_label_text_sizeblock_label_text_weightblock_paddingblock_radiusblock_shadowblock_shadow_darkblock_title_background_fill block_title_background_fill_darkblock_title_border_colorblock_title_border_color_darkblock_title_border_widthblock_title_border_width_darkblock_title_text_colorblock_title_text_color_darkblock_title_paddingblock_title_radiusblock_title_text_sizeblock_title_text_weightcontainer_radiusform_gap_width
layout_gappanel_background_fillpanel_background_fill_darkpanel_border_colorpanel_border_color_darkpanel_border_widthpanel_border_width_darksection_header_text_sizesection_header_text_weightchatbot_code_background_color"chatbot_code_background_color_darkcheckbox_background_colorcheckbox_background_color_darkcheckbox_background_color_focus$checkbox_background_color_focus_darkcheckbox_background_color_hover$checkbox_background_color_hover_dark"checkbox_background_color_selected'checkbox_background_color_selected_darkcheckbox_border_colorcheckbox_border_color_darkcheckbox_border_color_focus checkbox_border_color_focus_darkcheckbox_border_color_hover checkbox_border_color_hover_darkcheckbox_border_color_selected#checkbox_border_color_selected_darkcheckbox_border_radiuscheckbox_border_widthcheckbox_border_width_darkcheckbox_checkradio_circlecheckbox_shadowcheckbox_label_background_fill#checkbox_label_background_fill_dark$checkbox_label_background_fill_hover)checkbox_label_background_fill_hover_dark'checkbox_label_background_fill_selected,checkbox_label_background_fill_selected_darkcheckbox_label_border_color checkbox_label_border_color_dark!checkbox_label_border_color_hover&checkbox_label_border_color_hover_darkcheckbox_label_border_width checkbox_label_border_width_darkcheckbox_label_gapcheckbox_label_paddingcheckbox_label_shadowcheckbox_label_text_sizecheckbox_label_text_weightcheckbox_label_text_colorcheckbox_label_text_color_dark"checkbox_label_text_color_selected'checkbox_label_text_color_selected_darkerror_background_fillerror_background_fill_darkerror_border_colorerror_border_color_darkerror_border_widtherror_border_width_darkerror_text_colorerror_text_color_darkerror_icon_colorerror_icon_color_darkinput_background_fillinput_background_fill_darkinput_background_fill_focus input_background_fill_focus_darkinput_background_fill_hover input_background_fill_hover_darkinput_border_colorinput_border_color_darkinput_border_color_focusinput_border_color_focus_darkinput_border_color_hoverinput_border_color_hover_darkinput_border_widthinput_border_width_darkinput_paddinginput_placeholder_colorinput_placeholder_color_darkinput_radiusinput_shadowinput_shadow_darkinput_shadow_focusinput_shadow_focus_darkinput_text_sizeinput_text_weightloader_colorloader_color_darkslider_colorslider_color_darkstat_background_fillstat_background_fill_darktable_border_colortable_border_color_darktable_even_background_filltable_even_background_fill_darktable_odd_background_filltable_odd_background_fill_darktable_radiustable_row_focustable_row_focus_darkbutton_border_widthbutton_border_width_darkbutton_shadowbutton_shadow_activebutton_shadow_hoverbutton_transitionbutton_large_paddingbutton_large_radiusbutton_large_text_sizebutton_large_text_weightbutton_small_paddingbutton_small_radiusbutton_small_text_sizebutton_small_text_weightbutton_primary_background_fill#button_primary_background_fill_dark$button_primary_background_fill_hover)button_primary_background_fill_hover_darkbutton_primary_border_color button_primary_border_color_dark!button_primary_border_color_hover&button_primary_border_color_hover_darkbutton_primary_text_colorbutton_primary_text_color_darkbutton_primary_text_color_hover$button_primary_text_color_hover_dark button_secondary_background_fill%button_secondary_background_fill_dark&button_secondary_background_fill_hover+button_secondary_background_fill_hover_darkbutton_secondary_border_color"button_secondary_border_color_dark#button_secondary_border_color_hover(button_secondary_border_color_hover_darkbutton_secondary_text_color button_secondary_text_color_dark!button_secondary_text_color_hover&button_secondary_text_color_hover_darkbutton_cancel_background_fill"button_cancel_background_fill_dark#button_cancel_background_fill_hover(button_cancel_background_fill_hover_darkbutton_cancel_border_colorbutton_cancel_border_color_dark button_cancel_border_color_hover%button_cancel_border_color_hover_darkbutton_cancel_text_colorbutton_cancel_text_color_darkbutton_cancel_text_color_hover#button_cancel_text_color_hover_darkrD   c                C  s  |pt | dd| _|pt | dd| _|pt | dd| _|p"t | dd| _|p+t | dd	| _|p4t | d
d| _|	p=t | dd| _|pFt | dd| _|pOt | dd| _	|pXt | dd| _
|
pat | dd| _|pjt | dd| _|pst | dd| _|p|t | dd| _|pt | dd| _|pt | dd| _|pt | d d!| _|pt | d"d| _|pt | d#d$| _|pt | d%d$| _|pt | d&d'| _|pt | d(d'| _|pt | d)d*| _|pt | d+d,| _|pt | d-d'| _|pt | d.d$| _|pt | d/d0| _|pt | d1d0| _|"pt | d2d3| _|#pt | d4d5| _|$pt | d6d7| _|%p"t | d8d9| _ |&p,t | d:d;| _!|'p6t | d<d| _"|(p@t | d=d| _#|)pJt | d>d?| _$|*pTt | d@d?| _%|+p^t | dAd;| _&|,pht | dBdC| _'|-prt | dDdE| _(|.p|t | dFdE| _)|/pt | dGdH| _*|0pt | dId| _+|1pt | dJd| _,|2pt | dKdL| _-|3pt | dMd?| _.|4pt | dNd?| _/|5pt | dOd;| _0|6pt | dPdC| _1|7pt | dQdR| _2|8pt | dSdT| _3|9pt | dUd!| _4|:pt | dVdW| _5|;pt | dXdY| _6|<pt | dZd[| _7|=pt | d\d]| _8|>pt | d^dH| _9|?p&t | d_d| _:|@p0t | d`da| _;|Ap:t | dbd| _<|BpDt | dcdd| _=|CpNt | dedC| _>|DpXt | dfdd| _?|Epbt | dgdC| _@|Fplt | dhdd| _A|Gpvt | didC| _B|Hpt | djdk| _C|Ipt | dldC| _D|Jpt | dmdT| _E|Kpt | dnd!| _F|Lpt | dodW| _G|Mpt | dpdd| _H|Npt | dqd	| _I|Opt | drd| _J|Ppt | dsd| _K|Qpt | dtdk| _L|Rpt | dudv| _M|Spt | dwdL| _N|Tpt | dxdL| _O|Upt | dyd?| _P|Vpt | dzd?| _Q|Wpt | d{dW| _R|Xp t | d|dC| _S|Yp*t | d}d	| _T|Zp4t | d~d| _U|p>t | dd| _V|pHt | dd| _W|[pRt | dd| _X|\p\t | dd| _Y|]pft | dd| _Z|^ppt | dd| _[|_pzt | dd| _\|`pt | dd| _]|apt | dd| _^|bpt | dd| __|cpt | dd$| _`|dpt | dd$| _a|ept | dd| _b|fpt | dd| _c|gpt | dd'| _d|hpt | dd'| _e|ipt | dd| _f|jpt | dd| _g|kpt | dd$| _h|lpt | dd$| _i|mpt | dd| _j|npt | dd| _k|opt | dd| _l|sp$t | dd| _m|tp.t | dd| _n|up8t | dd| _o|vpBt | dd| _p|wpLt | dd| _q|xpVt | dd| _r|yp`t | dd?| _s|zpjt | dd?| _t|{ptt | dd| _u||p~t | dd| _v|}pt | dd| _w|~pt | dd| _x|pt | dd| _y|pt | dd| _z|pt | ddd| _{|pt | dd	| _||pt | dd| _}|ppt | dd| _~|qpt | dd| _|rpt | dd| _|pt | dd| _|pt | dd| _|p t | dd| _|p
t | dd| _|pt | dtjj| _|p t | dd| _|p,t | dtjj| _|p8t | dtjj| _|pBt | dd;| _|pLt | ddC| _|pXt | dtjj| _|pdt | dtjj| _|ppt | dtjj| _|p|t | dtjj| _|pt | dd| _|pt | dd| _|pt | dd'| _|pt | dd$| _|pt | dd̓| _|pt | dd̓| _|pt | dd?| _|pt | dd?| _|pt | dd҃| _|pt | dd| _|pt | ddՃ| _|pt | ddՃ| _|pt | ddk| _|pt | ddC| _|pt | ddڃ| _|pt | dd0| _|p&t | ddT| _|p0t | dd| _|p:t | ddd| _|pDt | ddC| _|pNt | dd| _|pXt | ddC| _|pbt | dd	| _|plt | dd| _|pvt | dd| _|pt | ddC| _|pt | dd	| _| pt | dd| _|!pt | dd| _|pt | dd| _|pt | ddC| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|p t | dd| _|p*t | dd| _|p4t | dd| _|ߐp>t | dd| _|pHt | dd| _|pRt | dd| _|p]t | d d| _|pit | dd| _|put | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | d	d| _|pt | d
d| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|ǐpt | dd| _|Ȑpt | dd| _|ɐpt | dd| _|ʐpt | dd| _|ːp't | dd| _|̐p3t | dd| _|͐p?t | dd| _|ΐpKt | dd| _|ϐpWt | d d| _|Аpbt | d!d| _|ѐpnt | d"d#| _|Ґpzt | d$d#| _|Ӑpt | d%d!| _|Ԑpt | d&d| _|Րpt | d'd| _|֐pt | d(d| _|אpt | d)d!| _|ؐpt | d*d| _|ِpt | d+d| _|ڐpt | d,d| _|ېpt | d-d| _|ܐpt | d.d| _|ݐpt | d/d| _|ސ	pt | d0d| _|	pt | d1dd| _|	pt | d2dd| _|	p#t | d3dd| _|Ð	p/t | d4d5| _|Đ	p:t | d6d| _|Ő	pEt | d7d	| _|Ɛ	pPt | d8d| _|	p\t | d9d:| _| S (;  a(X  
        Parameters:
            body_background_fill: The background of the entire app.
            body_background_fill_dark: The background of the entire app in dark mode.
            body_text_color: The default text color.
            body_text_color_dark: The default text color in dark mode.
            body_text_size: The default text size.
            body_text_color_subdued: The text color used for softer, less important text.
            body_text_color_subdued_dark: The text color used for softer, less important text in dark mode.
            body_text_weight: The default text weight.
            embed_radius: The corner radius used for embedding when the app is embedded within a page.
            background_fill_primary: The background primarily used for items placed directly on the page.
            background_fill_primary_dark: The background primarily used for items placed directly on the page in dark mode.
            background_fill_secondary: The background primarily used for items placed on top of another item.
            background_fill_secondary_dark: The background primarily used for items placed on top of another item in dark mode.
            border_color_accent: The border color used for accented items.
            border_color_accent_dark: The border color used for accented items in dark mode.
            border_color_accent_subdued: The subdued border color for accented items.
            border_color_accent_subdued_dark: The subdued border color for accented items in dark mode.
            border_color_primary: The border color primarily used for items placed directly on the page.
            border_color_primary_dark: The border color primarily used for items placed directly on the page in dark mode.
            color_accent: The color used for accented items.
            color_accent_soft: The softer color used for accented items.
            color_accent_soft_dark: The softer color used for accented items in dark mode.
            link_text_color: The text color used for links.
            link_text_color_dark: The text color used for links in dark mode.
            link_text_color_active: The text color used for links when they are active.
            link_text_color_active_dark: The text color used for links when they are active in dark mode.
            link_text_color_hover: The text color used for links when they are hovered over.
            link_text_color_hover_dark: The text color used for links when they are hovered over in dark mode.
            link_text_color_visited: The text color used for links when they have been visited.
            link_text_color_visited_dark: The text color used for links when they have been visited in dark mode.
            prose_text_size: The text size used for markdown and other prose.
            prose_text_weight: The text weight used for markdown and other prose.
            prose_header_text_weight: The text weight of a header used for markdown and other prose.
            shadow_drop: Drop shadow used by other shadowed items.
            shadow_drop_lg: Larger drop shadow used by other shadowed items.
            shadow_inset: Inset shadow used by other shadowed items.
            shadow_spread: Size of shadow spread used by shadowed items.
            shadow_spread_dark: Size of shadow spread used by shadowed items in dark mode.
            block_background_fill: The background around an item.
            block_background_fill_dark: The background around an item in dark mode.
            block_border_color: The border color around an item.
            block_border_color_dark: The border color around an item in dark mode.
            block_border_width: The border width around an item.
            block_border_width_dark: The border width around an item in dark mode.
            block_info_text_color: The color of the info text.
            block_info_text_color_dark: The color of the info text in dark mode.
            block_info_text_size: The size of the info text.
            block_info_text_weight: The weight of the info text.
            block_label_background_fill: The background of the title label of a media element (e.g. image).
            block_label_background_fill_dark: The background of the title label of a media element (e.g. image) in dark mode.
            block_label_border_color: The border color of the title label of a media element (e.g. image).
            block_label_border_color_dark: The border color of the title label of a media element (e.g. image) in dark mode.
            block_label_border_width: The border width of the title label of a media element (e.g. image).
            block_label_border_width_dark: The border width of the title label of a media element (e.g. image) in dark mode.
            block_label_shadow: The shadow of the title label of a media element (e.g. image).
            block_label_text_color: The text color of the title label of a media element (e.g. image).
            block_label_text_color_dark: The text color of the title label of a media element (e.g. image) in dark mode.
            block_label_margin: The margin of the title label of a media element (e.g. image) from its surrounding container.
            block_label_padding: The padding of the title label of a media element (e.g. image).
            block_label_radius: The corner radius of the title label of a media element (e.g. image).
            block_label_right_radius: The corner radius of a right-aligned helper label.
            block_label_text_size: The text size of the title label of a media element (e.g. image).
            block_label_text_weight: The text weight of the title label of a media element (e.g. image).
            block_padding: The padding around an item.
            block_radius: The corner radius around an item.
            block_shadow: The shadow under an item.
            block_shadow_dark: The shadow under an item in dark mode.
            block_title_background_fill: The background of the title of a form element (e.g. textbox).
            block_title_background_fill_dark: The background of the title of a form element (e.g. textbox) in dark mode.
            block_title_border_color: The border color of the title of a form element (e.g. textbox).
            block_title_border_color_dark: The border color of the title of a form element (e.g. textbox) in dark mode.
            block_title_border_width: The border width of the title of a form element (e.g. textbox).
            block_title_border_width_dark: The border width of the title of a form element (e.g. textbox) in dark mode.
            block_title_text_color: The text color of the title of a form element (e.g. textbox).
            block_title_text_color_dark: The text color of the title of a form element (e.g. textbox) in dark mode.
            block_title_padding: The padding of the title of a form element (e.g. textbox).
            block_title_radius: The corner radius of the title of a form element (e.g. textbox).
            block_title_text_size: The text size of the title of a form element (e.g. textbox).
            block_title_text_weight: The text weight of the title of a form element (e.g. textbox).
            container_radius: The corner radius of a layout component that holds other content.
            form_gap_width: The border gap between form elements, (e.g. consecutive textboxes).
            layout_gap: The gap between items within a row or column.
            panel_background_fill: The background of a panel.
            panel_background_fill_dark: The background of a panel in dark mode.
            panel_border_color: The border color of a panel.
            panel_border_color_dark: The border color of a panel in dark mode.
            panel_border_width: The border width of a panel.
            panel_border_width_dark: The border width of a panel in dark mode.
            section_header_text_size: The text size of a section header (e.g. tab name).
            section_header_text_weight: The text weight of a section header (e.g. tab name).
            chatbot_code_background_color: The background color of code blocks in the chatbot.
            chatbot_code_background_color_dark: The background color of code blocks in the chatbot in dark mode.
            checkbox_background_color: The background of a checkbox square or radio circle.
            checkbox_background_color_dark: The background of a checkbox square or radio circle in dark mode.
            checkbox_background_color_focus: The background of a checkbox square or radio circle when focused.
            checkbox_background_color_focus_dark: The background of a checkbox square or radio circle when focused in dark mode.
            checkbox_background_color_hover: The background of a checkbox square or radio circle when hovered over.
            checkbox_background_color_hover_dark: The background of a checkbox square or radio circle when hovered over in dark mode.
            checkbox_background_color_selected: The background of a checkbox square or radio circle when selected.
            checkbox_background_color_selected_dark: The background of a checkbox square or radio circle when selected in dark mode.
            checkbox_border_color: The border color of a checkbox square or radio circle.
            checkbox_border_color_dark: The border color of a checkbox square or radio circle in dark mode.
            checkbox_border_color_focus: The border color of a checkbox square or radio circle when focused.
            checkbox_border_color_focus_dark: The border color of a checkbox square or radio circle when focused in dark mode.
            checkbox_border_color_hover: The border color of a checkbox square or radio circle when hovered over.
            checkbox_border_color_hover_dark: The border color of a checkbox square or radio circle when hovered over in dark mode.
            checkbox_border_color_selected: The border color of a checkbox square or radio circle when selected.
            checkbox_border_color_selected_dark: The border color of a checkbox square or radio circle when selected in dark mode.
            checkbox_border_radius: The corner radius of a checkbox square.
            checkbox_border_width: The border width of a checkbox square or radio circle.
            checkbox_border_width_dark: The border width of a checkbox square or radio circle in dark mode.
            checkbox_check: The checkmark visual of a checkbox square.
            radio_circle: The circle visual of a radio circle.
            checkbox_shadow: The shadow of a checkbox square or radio circle.
            checkbox_label_background_fill: The background of the surrounding button of a checkbox or radio element.
            checkbox_label_background_fill_dark: The background of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_background_fill_hover: The background of the surrounding button of a checkbox or radio element when hovered over.
            checkbox_label_background_fill_hover_dark: The background of the surrounding button of a checkbox or radio element when hovered over in dark mode.
            checkbox_label_background_fill_selected: The background of the surrounding button of a checkbox or radio element when selected.
            checkbox_label_background_fill_selected_dark: The background of the surrounding button of a checkbox or radio element when selected in dark mode.
            checkbox_label_border_color: The border color of the surrounding button of a checkbox or radio element.
            checkbox_label_border_color_dark: The border color of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_border_color_hover: The border color of the surrounding button of a checkbox or radio element when hovered over.
            checkbox_label_border_color_hover_dark: The border color of the surrounding button of a checkbox or radio element when hovered over in dark mode.
            checkbox_label_border_width: The border width of the surrounding button of a checkbox or radio element.
            checkbox_label_border_width_dark: The border width of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_gap: The gap consecutive checkbox or radio elements.
            checkbox_label_padding: The padding of the surrounding button of a checkbox or radio element.
            checkbox_label_shadow: The shadow of the surrounding button of a checkbox or radio element.
            checkbox_label_text_size: The text size of the label accompanying a checkbox or radio element.
            checkbox_label_text_weight: The text weight of the label accompanying a checkbox or radio element.
            checkbox_label_text_color: The text color of the label accompanying a checkbox or radio element.
            checkbox_label_text_color_dark: The text color of the label accompanying a checkbox or radio element in dark mode.
            checkbox_label_text_color_selected: The text color of the label accompanying a checkbox or radio element when selected.
            checkbox_label_text_color_selected_dark: The text color of the label accompanying a checkbox or radio element when selected in dark mode.
            error_background_fill: The background of an error message.
            error_background_fill_dark: The background of an error message in dark mode.
            error_border_color: The border color of an error message.
            error_border_color_dark: The border color of an error message in dark mode.
            error_border_width: The border width of an error message.
            error_border_width_dark: The border width of an error message in dark mode.
            error_text_color: The text color of an error message.
            error_text_color_dark: The text color of an error message in dark mode.
            input_background_fill: The background of an input field.
            input_background_fill_dark: The background of an input field in dark mode.
            input_background_fill_focus: The background of an input field when focused.
            input_background_fill_focus_dark: The background of an input field when focused in dark mode.
            input_background_fill_hover: The background of an input field when hovered over.
            input_background_fill_hover_dark: The background of an input field when hovered over in dark mode.
            input_border_color: The border color of an input field.
            input_border_color_dark: The border color of an input field in dark mode.
            input_border_color_focus: The border color of an input field when focused.
            input_border_color_focus_dark: The border color of an input field when focused in dark mode.
            input_border_color_hover: The border color of an input field when hovered over.
            input_border_color_hover_dark: The border color of an input field when hovered over in dark mode.
            input_border_width: The border width of an input field.
            input_border_width_dark: The border width of an input field in dark mode.
            input_padding: The padding of an input field.
            input_placeholder_color: The placeholder text color of an input field.
            input_placeholder_color_dark: The placeholder text color of an input field in dark mode.
            input_radius: The corner radius of an input field.
            input_shadow: The shadow of an input field.
            input_shadow_dark: The shadow of an input field in dark mode.
            input_shadow_focus: The shadow of an input field when focused.
            input_shadow_focus_dark: The shadow of an input field when focused in dark mode.
            input_text_size: The text size of an input field.
            input_text_weight: The text weight of an input field.
            loader_color: The color of the loading animation while a request is pending.
            loader_color_dark: The color of the loading animation while a request is pending in dark mode.
            slider_color: The color of the slider in a range element.
            slider_color_dark: The color of the slider in a range element in dark mode.
            stat_background_fill: The background used for stats visuals (e.g. confidence bars in label).
            stat_background_fill_dark: The background used for stats visuals (e.g. confidence bars in label) in dark mode.
            table_border_color: The border color of a table.
            table_border_color_dark: The border color of a table in dark mode.
            table_even_background_fill: The background of even rows in a table.
            table_even_background_fill_dark: The background of even rows in a table in dark mode.
            table_odd_background_fill: The background of odd rows in a table.
            table_odd_background_fill_dark: The background of odd rows in a table in dark mode.
            table_radius: The corner radius of a table.
            table_row_focus: The background of a focused row in a table.
            table_row_focus_dark: The background of a focused row in a table in dark mode.
            button_border_width: The border width of a button.
            button_border_width_dark: The border width of a button in dark mode.
            button_cancel_background_fill: The background of a button of "cancel" variant.
            button_cancel_background_fill_dark: The background of a button of "cancel" variant in dark mode.
            button_cancel_background_fill_hover: The background of a button of "cancel" variant when hovered over.
            button_cancel_background_fill_hover_dark: The background of a button of "cancel" variant when hovered over in dark mode.
            button_cancel_border_color: The border color of a button of "cancel" variant.
            button_cancel_border_color_dark: The border color of a button of "cancel" variant in dark mode.
            button_cancel_border_color_hover: The border color of a button of "cancel" variant when hovered over.
            button_cancel_border_color_hover_dark: The border color of a button of "cancel" variant when hovered over in dark mode.
            button_cancel_text_color: The text color of a button of "cancel" variant.
            button_cancel_text_color_dark: The text color of a button of "cancel" variant in dark mode.
            button_cancel_text_color_hover: The text color of a button of "cancel" variant when hovered over.
            button_cancel_text_color_hover_dark: The text color of a button of "cancel" variant when hovered over in dark mode.
            button_large_padding: The padding of a button with the default "large" size.
            button_large_radius: The corner radius of a button with the default "large" size.
            button_large_text_size: The text size of a button with the default "large" size.
            button_large_text_weight: The text weight of a button with the default "large" size.
            button_primary_background_fill: The background of a button of "primary" variant.
            button_primary_background_fill_dark: The background of a button of "primary" variant in dark mode.
            button_primary_background_fill_hover: The background of a button of "primary" variant when hovered over.
            button_primary_background_fill_hover_dark: The background of a button of "primary" variant when hovered over in dark mode.
            button_primary_border_color: The border color of a button of "primary" variant.
            button_primary_border_color_dark: The border color of a button of "primary" variant in dark mode.
            button_primary_border_color_hover: The border color of a button of "primary" variant when hovered over.
            button_primary_border_color_hover_dark: The border color of a button of "primary" variant when hovered over in dark mode.
            button_primary_text_color: The text color of a button of "primary" variant.
            button_primary_text_color_dark: The text color of a button of "primary" variant in dark mode.
            button_primary_text_color_hover: The text color of a button of "primary" variant when hovered over.
            button_primary_text_color_hover_dark: The text color of a button of "primary" variant when hovered over in dark mode.
            button_secondary_background_fill: The background of a button of default "secondary" variant.
            button_secondary_background_fill_dark: The background of a button of default "secondary" variant in dark mode.
            button_secondary_background_fill_hover: The background of a button of default "secondary" variant when hovered over.
            button_secondary_background_fill_hover_dark: The background of a button of default "secondary" variant when hovered over in dark mode.
            button_secondary_border_color: The border color of a button of default "secondary" variant.
            button_secondary_border_color_dark: The border color of a button of default "secondary" variant in dark mode.
            button_secondary_border_color_hover: The border color of a button of default "secondary" variant when hovered over.
            button_secondary_border_color_hover_dark: The border color of a button of default "secondary" variant when hovered over in dark mode.
            button_secondary_text_color: The text color of a button of default "secondary" variant.
            button_secondary_text_color_dark: The text color of a button of default "secondary" variant in dark mode.
            button_secondary_text_color_hover: The text color of a button of default "secondary" variant when hovered over.
            button_secondary_text_color_hover_dark: The text color of a button of default "secondary" variant when hovered over in dark mode.
            button_shadow: The shadow under a button.
            button_shadow_active: The shadow under a button when pressed.
            button_shadow_hover: The shadow under a button when hovered over.
            button_small_padding: The padding of a button set to "small" size.
            button_small_radius: The corner radius of a button set to "small" size.
            button_small_text_size: The text size of a button set to "small" size.
            button_small_text_weight: The text weight of a button set to "small" size.
            button_transition: The transition animation duration of a button between regular, hover, and focused states.
        r   z*background_fill_primaryr   r   z*neutral_800r   z*neutral_100r   z*text_mdr   Z400r   z
*radius_lgr   z*primary_500r   z*primary_50r   z*neutral_700Zbackground_primarywhiteZbackground_primary_darkz*neutral_950Zbackground_secondaryz*neutral_50Zbackground_secondary_darkz*neutral_900r   z*primary_300r   z*neutral_600r   z*neutral_200r   r   z*secondary_600r   r   z*secondary_500r   r   z*secondary_700r   z*secondary_400r   r   r   z*neutral_400r   r   z rgba(0,0,0,0.05) 0px 1px 2px 0pxr   z=0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)r   z&rgba(0,0,0,0.05) 0px 2px 4px 0px insetr   Z3pxr   Z1pxr   r   r   z*border_color_primaryr   r   r   Nr   z*body_text_color_subduedr   r   z*text_smr   r   r   z*background_fill_secondaryr   r   r   r   r   z*block_shadowr   z*neutral_500r   r   0r   z*spacing_sm *spacing_lgr  z1calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0r  z10 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)r  r  r  z#*spacing_xl calc(*spacing_xl + 2px)r  r  noner  r	  r
  r  r  r  Z0pxr  r  r  r  r  r  r  r  r  r  z*spacing_xxlr  r  r  r  r  r  r  r  r   z*border_color_accentr   r   r!  r"  r#  r$  z*checkbox_background_colorr%  r&  r'  r(  r)  r*  z*neutral_300r+  r,  r-  r.  r/  r0  r1  r2  z
*radius_smr3  z*input_border_widthr4  r8  z!*button_secondary_background_fillr9  r:  z'*button_secondary_background_fill_hoverr;  r<  z*checkbox_label_background_fillr=  r>  r?  r@  z*checkbox_label_border_colorrA  rB  rC  rD  z*spacing_lgrE  z!*spacing_md calc(2 * *spacing_md)rF  rG  rH  r5  zurl("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")r6  zurl("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")r7  z*input_shadowrI  z*body_text_colorrJ  rK  z*checkbox_label_text_colorrL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  z*input_background_fillr\  r]  r^  r_  z*secondary_300r`  ra  z*input_border_colorrb  rc  rd  re  z*spacing_xlrf  rg  rh  ri  rj  rk  rl  rm  rn  ro  z*color_accentrp  r   r   r   Z600rq  autorr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  z*color_accent_softr}  r~  r  r  r  r  z*button_cancel_background_fillr  r  z*button_secondary_border_colorr  r  z*button_cancel_border_colorr  r  z*button_secondary_text_colorr  r  z*button_cancel_text_colorr  r  z!*spacing_lg calc(2 * *spacing_lg)r  r  z*text_lgr  r  z*primary_200r  z*primary_700r  z*button_primary_background_fillr  r  r  z*primary_600r  z*button_primary_border_colorr  r  r  r  z*button_primary_text_colorr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  z!*spacing_sm calc(2 * *spacing_sm)r  r  r  r  zbackground-color 0.2s ease)r?   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r8  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  r5  r6  r7  rI  rJ  rK  rL  r   redr   rM  rN  r   rO  r   rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  r   r   r   rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r     sh     e


		



					









		
		






	
	

				

zBase.set)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rD   rN   )r   r   r   r   bluegrayr   r   r   r   r	   Z
GoogleFontr   r   r   r   r   r   rN   A  s   	  rN   )
__future__r   rH   r5   r   r   pathlibr   typingr   rf   ri   Zsemantic_versionrw   Zgradio_client.documentationr   r   r   Zgradio.themes.utilsr   r	   r
   r   r   Z"gradio.themes.utils.readme_contentr   r   rN   r   r   r   r   <module>   s(      '