
    @OOf                     r    d dl Z d dl mZ  ee dd      dk  r ede j                  z         G d de      Zy)    N)KaitaiStructAPI_VERSION)r   	   zPIncompatible Kaitai Struct Python API: 0.9 or later is required, but you have %sc                   4    e Zd ZdZddZd Z G d de      Zy)IcoaT  Microsoft Windows uses specific file format to store applications
    icons - ICO. This is a container that contains one or more image
    files (effectively, DIB parts of BMP files or full PNG files are
    contained inside).
    
    .. seealso::
       Source - https://docs.microsoft.com/en-us/previous-versions/ms997538(v=msdn.10)
    Nc                 V    || _         || _        |r|n| | _        | j                          y N_io_parent_root_readselfr   r   r   s       c/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/mitmproxy/contrib/kaitaistruct/ico.py__init__zIco.__init__   s$    #U


    c                    | j                   j                  d      | _        | j                  dk(  s,t        j                  d| j                  | j                   d      | j                   j                         | _        g | _        t        | j                        D ]F  }| j                  j                  t        j                  | j                   | | j                               H y )N   s      z/seq/0)r   
read_bytesmagickaitaistructValidationNotEqualError	read_u2le
num_imagesimagesrangeappendr   IconDirEntryr   )r   is     r   r   z	Ico._read   s    XX((+
zz00667JDJJX\X`X`bkll((,,.t' 	MAKKs//$

KL	Mr   c                   J    e Zd ZddZd Zed        Zed        Zed        Zy)Ico.IconDirEntryNc                 V    || _         || _        |r|n| | _        | j                          y r	   r
   r   s       r   r   zIco.IconDirEntry.__init__$   s$    DH"DL"'TDJJJLr   c                 l   | j                   j                         | _        | j                   j                         | _        | j                   j                         | _        | j                   j                  d      | _        | j                  dk(  s,t        j                  d| j                  | j                   d      | j                   j                         | _
        | j                   j                         | _        | j                   j                         | _        | j                   j                         | _        y )N       z/types/icon_dir_entry/seq/3)r   read_u1widthheight
num_colorsr   reservedr   r   r   
num_planesbpp	read_u4lelen_imgofs_imgr   s    r   r   zIco.IconDirEntry._read*   s    ))+DJ((**,DK"hh..0DO HH//2DM==G+"::7DMMSWS[S[]{||"hh002DOxx))+DH88--/DL88--/DLr   c                 T   t        | d      r| j                  S | j                  j                         }| j                  j	                  | j
                         | j                  j                  | j                        | _        | j                  j	                  |       t        | dd      S )zRaw image data. Use `is_png` to determine whether this is an
            embedded PNG file (true) or a DIB bitmap (false) and call a
            relevant parser, if needed to parse image data further.
            _m_imgN)	hasattrr3   r   posseekr0   r   r/   getattrr   _poss     r   imgzIco.IconDirEntry.img6   st     tX&{{"88<<>DHHMM$,,'((--dll;DKHHMM$4400r   c                 @   t        | d      r| j                  S | j                  j                         }| j                  j	                  | j
                         | j                  j                  d      | _        | j                  j	                  |       t        | dd      S )zhPre-reads first 8 bytes of the image to determine if it's an
            embedded PNG file.
            _m_png_header   N)r4   r<   r   r5   r6   r0   r   r7   r8   s     r   
png_headerzIco.IconDirEntry.png_headerE   ss    
 t_-)))88<<>DHHMM$,,'!%!4!4Q!7DHHMM$4$77r   c                 t    t        | d      r| j                  S | j                  dk(  | _        t        | dd      S )z$True if this image is in PNG format.	_m_is_pngs   PNG

N)r4   r@   r>   r7   r1   s    r   is_pngzIco.IconDirEntry.is_pngS   s8     t[)~~%!__0SSDN4d33r   NN)	__name__
__module____qualname__r   r   propertyr:   r>   rA    r   r   r   r"   #   sH    	
	0 
	1 
	1 
	8 
	8 
	4 
	4r   r   rB   )rC   rD   rE   __doc__r   r   r   r   rG   r   r   r   r   
   s    M74| 74r   r   )r   r   r7   	Exception__version__r   rG   r   r   <module>rK      sW     % </&8
fjv  kC  kC  D  E  EP4, P4r   