+
    .pÐj  ã                  óv   € R t ^ RIHt ^ RIt^ RIHtHt ]P                  ! R4      tR R lt	R R lt
R	 R
 ltR# )z¿Helpers for Telegram Bot API chat identifiers: a ``chat_id`` is a numeric ID (int) or an ``@username``
string for public channels/groups; a bare ``int(chat_id)`` crashes on the username form.)ÚannotationsN)ÚAnyÚUnionz@[A-Za-z0-9_]{4,32}c               ó    € V ^8„  d   QhRRRR/# )é   Úchat_idr   Úreturnz	int | str© )Úformats   "Ú6/opt/hermes/plugins/platforms/telegram/telegram_ids.pyÚ__annotate__r      s   € ÷ ñ ¨ð °	ñ ó    c                ó~   € \        V 4      P                  4       p \        V4      #   \        \        3 d    Tu # i ; i)zšBot API-compatible chat_id: numeric values (incl. negative channel IDs) as ``int``, anything
else (e.g. ``@username``) as a stripped string; never raises.)ÚstrÚstripÚintÚ	TypeErrorÚ
ValueError)r   Úchat_id_strs   & r   Únormalize_telegram_chat_idr      s@   € ô �g“,×$Ñ$Ó&€KðÜ�;ÓÐøÜ”zÐ"ô ØÒðús   ›
& ¦<»<c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   Úboolr	   )r
   s   "r   r   r      s   € ÷ Gñ G¨#ð G°$ñ Gr   c                ól   € \        \        P                  \        V 4      P	                  4       4      4      # )zHTrue when the value is an ``@username``-format Telegram chat identifier.)r   Ú_TELEGRAM_USERNAME_REÚ	fullmatchr   r   )r   s   &r   Úlooks_like_telegram_usernamer      s&   € äÔ%×/Ñ/´°G³×0BÑ0BÓ0DÓEÓFÐFr   c               ó    € V ^8„  d   QhRRRR/# )r   Ú
target_refr   r   z
str | Noner	   )r
   s   "r   r   r      s   € ÷ Bñ B¨sð B°zñ Br   c                ó^   € \        V 4      P                  4       p\        V4      '       d   V# R# )zCReturn the value when it is an ``@username`` target, else ``None``.N)r   r   r   )r   Úvalues   & r   Úparse_telegram_username_targetr       s)   € ä�
‹O×!Ñ!Ó#€EÜ0°×7Ò7ˆ5ÐA¸TÐAr   )Ú__doc__Ú
__future__r   ÚreÚtypingr   r   Úcompiler   r   r   r    r	   r   r   Ú<module>r&      s9   ðñ\õ #ã 	ß ð Ÿ
š
Ð#9Ó:Ð õõG÷
Br   