
    }c                         d Z ddlZddlZddlmZ dZdZ ej        dd          ZdZ	d	Z
d
edee         fdZd
ededdfdZdS )zPNG image manipulation helpers.    N)Optional      !i
   s
   tEXtDepth s       IENDB`filenamereturnc                 x   t          | d          5 }|                    t          t          z    d           |                    t                    }|                    t          t          z             s	 ddd           dS t          j	        d|dd                   d         cddd           S # 1 swxY w Y   dS )zARead the special tEXt chunk indicating the depth from a PNG file.rb   Nr         r   )
openseekLEN_IEND	LEN_DEPTHread
startswithDEPTH_CHUNK_LENDEPTH_CHUNK_STARTstructunpack)r   f
depthchunks      /lib/python3.11/site-packages/sphinx/util/png.pyread_png_depthr      s   	h		 =	(Y&'+++VVI&&
$$_7H%HII 	== = = = = = = = =z"R%'899!<= = = = = = = = = = = = = = = = = =s   A"B/ "B//B36B3depthc                    t          j        d|          }t          | d          5 }|                    t           d           |                    t          t          z   |z              t          j	        t          |z             dz  }|                    t          j        d|                     |                    t                     ddd           dS # 1 swxY w Y   dS )zWrite the special tEXt chunk indicating the depth to a PNG file.

    The chunk is placed immediately before the special IEND chunk.
    r   zr+br   l    z!IN)r   packr   r   r   writer   r   binasciicrc32
IEND_CHUNK)r   r   datar   crcs        r   write_png_depthr&      s   
 ;tU##D	h		 	!	y!	"33d:;;;n.566C	D#&&'''	
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   B#CCC)__doc__r!   r   typingr   r   r   r   r   r   r#   strintr   r&        r   <module>r-      s    % %        	&+dB''$ 4
	=S 	=Xc] 	= 	= 	= 	=c # $      r,   