+
    .pÐjÒ  ã                  ój   € R t ^ RIHt ^ RIHtHtHtHt  ^ RIt ! R R4      t
R#   ]	 d    Rt Li ; i)zdSlash-command authorization verdict for the Discord adapter: the on_message gates, side-effect free.)Úannotations)ÚAnyÚCallableÚOptionalÚTupleNc                  ób   € ] tR t^t$ R]R&   R]R&   R]R&   R]R&   R]R	&   R
 R ltR R ltRtR# )ÚDiscordSlashAuthMixinzCallable[[Any], Optional[str]]Ú_get_parent_channel_idzCallable[..., set]Ú"_discord_channel_keys_from_channelzCallable[[], set]Ú_get_allowed_channelsÚ_get_ignored_channelszCallable[..., bool]Ú_is_allowed_userc               ó    € V ^8„  d   QhRRRR/# )é   Úinteractionúdiscord.InteractionÚreturnztuple[bool, Optional[str]]© )Úformats   "Ú;/opt/hermes/plugins/platforms/discord/adapter_slash_auth.pyÚ__annotate__Ú"DiscordSlashAuthMixin.__annotate__   s   € ÷ =ñ =Ø.ð=à	#ñ=ó    c                óº  € \        VRR4      pVe   \        V\        P                  4      MRp\	        4       p\	        4       pV'       EgG   \        VRR4      ;'       g    \        VRR4      pVen   VP                  \        V4      4       \        V\        P                  4      '       d4   V P                  V4      pV'       d   VP                  \        V4      4       T P                  T\        V\        P                  4      '       d   V P                  V4      MR4      pV P                  4       pV'       d"   RV9  d   V'       g   R# WX,          '       g   R# V P                  4       p	V	'       d    V'       d   RV	9   g   WY,          '       d   R# \        VRR4      p
\        V R\	        4       4      ;'       g    \	        4       p\        V R	\	        4       4      ;'       g    \	        4       pV
e   \        V
RR4      f   V'       g	   V'       d   R# R# \        V
P                  4      p\        VR
R4      pT P                  YÚYãV'       g   TMRR7      '       g   R# R# )a  Evaluate slash authorization without responding; returns ``(allowed, reason)``.
Shared with side-effect-free callers (``/skill`` autocomplete returns [] per keystroke).
Fail closed on malformed payloads: with an allowlist, a missing channel id/user REJECTS.
ÚchannelNFÚ
channel_idÚidÚ*ÚuserÚ_allowed_user_idsÚ_allowed_role_idsÚguild)Úauthorr!   Úis_dmÚchannel_ids)Fz;channel id missing with DISCORD_ALLOWED_CHANNELS configured)Fz'channel not in DISCORD_ALLOWED_CHANNELS)Fz#channel in DISCORD_IGNORED_CHANNELS)Fz2missing interaction.user with allowlist configured)Fzmissing interaction.user)Fz9user not in DISCORD_ALLOWED_USERS / DISCORD_ALLOWED_ROLES)TN)ÚgetattrÚ
isinstanceÚdiscordÚ	DMChannelÚsetÚaddÚstrÚThreadr	   r
   r   r   r   r   )Úselfr   Úchan_objÚin_dmr$   Úchannel_keysÚchan_id_rawÚ	parent_idÚallowedÚignoredr   Úallowed_usersÚallowed_rolesÚuser_idÚinteraction_guilds   &&             r   Ú_evaluate_slash_authorizationÚ3DiscordSlashAuthMixin._evaluate_slash_authorization   sý  € ô ˜;¨	°4Ó8ˆØ;CÒ;O”
˜8¤W×%6Ñ%6Ô7ÐUZˆÜ›5ˆÜ›EˆçˆuÜ! +¨|¸TÓB×cÐcÄgÈhÐX\Ð^bÓFcˆKØÒ&Ø—‘¤ KÓ 0Ô1ä˜h¬¯©×7Ò7Ø $× ;Ñ ;¸HÓ E�Iß Ø#Ÿ™¬¨I«Ô7à×BÑBØä˜h¬¯©×7Ò7ð ×+Ñ+¨HÔ5àó	ˆLð ×0Ñ0Ó2ˆGßØ˜gÔ%ß&ð ð ð )×2Ô2ØQÐQà×0Ñ0Ó2ˆGßŸ;Ø˜'”> l×&<Ô&<ØIÐIä�{ F¨DÓ1ˆÜ Ð&9¼3»5ÓA×JÐJÄSÃUˆÜ Ð&9¼3»5ÓA×JÐJÄSÃUˆØŠ<œ7 4¨¨tÓ4Ò<ç§ØTÐTØ6Ð6Ü�d—g‘g“,ˆô $ K°¸$Ó?ÐØ×$Ñ$ØÐ(9ß,1™°tð %÷ 
ò 
ð XÐWØÐr   c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   Úboolr   )r   s   "r   r   r   V   s   € ÷ ñ Ð-@ð ÀTñ r   c                ó~   € \        \        V R\        4       4      4      ;'       d    V P                  V4      ^ ,          # )aG  ``role_authorized`` for an event built from ``interaction``, with the message path's
meaning (_discord_message_admission): a role allowlist exists and THIS actor passes the gate.
Re-evaluated for the interaction instead of trusted from call order, so a builder can never
stamp the grant on an actor the slash gate would refuse.r    )r<   r%   r)   r9   )r-   r   s   &&r   Ú_slash_role_grantÚ'DiscordSlashAuthMixin._slash_role_grantV   sA   € ô
 ”G˜DÐ"5´s³uÓ=Ó>÷ ð À4×CeÑCeØóDØõDð 	r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r9   r>   Ú__static_attributes__r   r   r   r   r      s0   ‡ Ø:Ó:Ø(:Ó:Ø,Ó,Ø,Ó,Ø)Ó)õ=÷~ñ r   r   )Ú__doc__Ú
__future__r   Útypingr   r   r   r   r'   ÚImportErrorr   r   r   r   Ú<module>rJ      s;   ðÙ jÝ "ç 1Ó 1ðÛ÷
Pó Pøð	 ô Ø‚Gðús   –& ¦	2±2