Ë
    ?—Öj�  ã                   ó¾   — d dl Z d dlmZ d dlmZ ddlmZ ddlmZ  ee	«      Z
g d¢e
d<   d	ed
eddfd„Zdeeef   ded
edefd„Zde	e   d
edefd„Zdededefd„Zy)é    N)Údefaultdict)ÚAnyé   )ÚAccessDeniedException)ÚKey)zkms:*zkms:Describe*úkms:DescribeKeyr   ÚkeyÚactionÚreturnc                 ó6  — 	 t        j                  | j                  «      }|j                  dg «      D ]O  }t        || j                  |«      }|sŒ|j                  dd«      j                  «       dk(  sŒAt        d|› d�¬«      ‚ y# t        t        f$ r Y yw xY w)	a6  
    Relevant docs:
     - https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html
     - https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html

    This method currently denies action based on whether:
     - There is a applicable DENY-statement in the policy
    NÚ	StatementÚEffectÚ ÚdenyzAction z' is now allowed by the given key policy)Úmessage)
ÚjsonÚloadsÚpolicyÚ
ValueErrorÚAttributeErrorÚgetÚcheck_statementÚarnÚlowerr   )r	   r
   r   Ú	statementÚstatement_appliess        úV/var/www/photos/backend/venv/lib/python3.12/site-packages/moto/kms/policy_validator.pyÚvalidate_policyr      s™   € ðÜ—‘˜CŸJ™JÓ'ˆð —Z‘Z ¨RÓ0ò ˆ	Ü+¨I°s·w±wÀÓGÐÚ §¡¨x¸Ó!<×!BÑ!BÓ!DÈÓ!NÜ'Ø! & Ð)PÐQôð ñøô œÐ'ò Ùðús   ‚B ÂBÂBr   Úresourcec                 óv   — t        | j                  dg «      |«      xr t        | j                  dd«      |«      S )NÚActionÚResourcer   )Úaction_matchesr   Úresource_matches)r   r   r
   s      r   r   r   !   s:   € Ü˜)Ÿ-™-¨°"Ó5°vÓ>ò ÔCSØ�‰�j "Ó% xóDð ó    Úapplicable_actionsc                 óB   ‡ — t         |   }t        ˆ fd„|D «       «      ryy)Nc              3   ó&   •K  — | ]  }|‰v –— Œ
 y ­w)N© )Ú.0Úaltr&   s     €r   ú	<genexpr>z!action_matches.<locals>.<genexpr>)   s   øè ø€ Ò
=¨ˆ3Ð$Ô$Ñ
=ùs   ƒTF)ÚALTERNATIVE_ACTIONSÚany)r&   r
   Úalternativess   `  r   r#   r#   '   s!   ø€ Ü& vÑ.€LÜ
Ó
=°Ô
=Ô=ØØr%   Úapplicable_resourcesc                 ó   — | dk(  ryy)NÚ*TFr)   )r0   r   s     r   r$   r$   .   s   € ð ˜sÒ"ØØr%   )r   Úcollectionsr   Útypingr   Ú
exceptionsr   Úmodelsr   Úlistr-   Ústrr   ÚdictÚboolr   r#   r$   r)   r%   r   ú<module>r;      s«   ðÛ Ý #Ý å -Ý á! $Ó'Ð Ú)VÐ Ð%Ñ &ð˜ð  cð ¨dó ð*˜t C¨ H™~ð ¸ð Àcð Èdó ð t¨C¡yð ¸#ð À$ó ðØðàðð 
ôr%   