o
    ,&]i  ã                
   @  sü   U d dl mZ d dlmZ d dlmZ ddddddddddœ	Zd	ed
< dZded< i 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	ed"< d#d$hZ
d%ed&< d/d)d*„Zd0d,d-„Zd.S )1é    )Úannotations)ÚFinal)ÚStreamlitAPIExceptionÚctrlÚcmdÚaltÚshift)	r   Úcontrolr   ÚcommandÚmetar   Úoptionr   ÚmodzFinal[dict[str, str]]Ú_MODIFIER_ALIASES)r   r   r   r   zFinal[tuple[str, ...]]Ú_MODIFIER_ORDERÚenterÚreturnÚspaceÚspacebarÚtabÚescapeÚescÚ	backspaceÚdeleteÚdelÚhomeÚendÚpageupÚpagedownÚleftÚ	arrowleftÚrightÚupÚdown)Ú
arrowrightr!   Úarrowupr"   Ú	arrowdownÚ_KEY_ALIASESÚcÚrzFinal[set[str]]Ú_RESERVED_KEYSÚlower_tokenÚstrc                 C  sN   | t v rt |  S t| ƒdkr|  ¡ r| S |  d¡r#| dd…  ¡ r#| S tdƒ‚)zFNormalize a key token to a format that can be used on the client side.é   ÚfNzgshortcut must include a single character or one of the supported keys (e.g. Enter, Space, Tab, Escape).)r&   ÚlenÚisalnumÚ
startswithÚisdigitr   )r*   © r2   úc/var/www/html/IGF-ODF-V3/venv/lib/python3.10/site-packages/streamlit/elements/lib/shortcut_utils.pyÚ_normalize_key_tokenD   s   ÿr4   Úshortcutc                   sÚ   t | tƒs	tdƒ‚dd„ |  d¡D ƒ}|stdƒ‚g ‰ d}|D ].}| ¡ }|tv r7t| }|ˆ vr6ˆ  |¡ q|dur?tdƒ‚t|ƒ}|tv rKtdƒ‚|}q|du rVtd	ƒ‚‡ fd
d„t	D ƒ}|durh| |¡ d 
|¡S )ac  Normalize a shortcut string to a format that can be used on the client side.

    Parameters
    ----------
    shortcut : str
        The shortcut string to normalize.

    Returns
    -------
    str
        The normalized shortcut string.

    Raises
    ------
    StreamlitAPIException
        If the shortcut is not a string value.
        If the shortcut does not contain at least one key or modifier.
        If the shortcut contains a single non-modifier key.
        If the shortcut uses the keys 'C' or 'R', with or without modifiers.
        If the shortcut does not include a non-modifier key.
    z shortcut must be a string value.c                 S  s   g | ]
}|  ¡ r|  ¡ ‘qS r2   )Ústrip)Ú.0Útokenr2   r2   r3   Ú
<listcomp>o   s    z&normalize_shortcut.<locals>.<listcomp>ú+z9The `shortcut` must contain at least one key or modifier.Nz:The `shortcut` may only specify a single non-modifier key.zIThe `shortcut` cannot use the keys 'C' or 'R', with or without modifiers.zGThe `shortcut` must include a non-modifier key such as 'K' or 'Ctrl+K'.c                   s   g | ]}|ˆ v r|‘qS r2   r2   )r7   Úmodifier©Ú	modifiersr2   r3   r9   ’   s    )Ú
isinstancer+   r   ÚsplitÚlowerr   Úappendr4   r)   r   Újoin)r5   ÚtokensÚkeyÚ	raw_tokenr*   Únormalized_modifierÚnormalized_keyÚnormalized_tokensr2   r<   r3   Únormalize_shortcutV   sH   
ÿ
ÿÿÿ
ÿ

rI   N)r*   r+   r   r+   )r5   r+   r   r+   )Ú
__future__r   Útypingr   Ústreamlit.errorsr   r   Ú__annotations__r   r&   r)   r4   rI   r2   r2   r2   r3   Ú<module>   st   ÷ÿþýüûúùø	÷
öõôóòñðïê
