
    є jjz              	       6   d Z dZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZ d
dlmZ d
dlmZmZmZmZ d
dlm Z! d
dlm"Z# d
dlm$Z% d
dlm&Z&m'Z' d
dlm(Z) d
dl*m+Z+m,Z,m-Z-m.Z. d
dl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 dZ7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@ eAd  eBd          D                       ZCdeDdeDfdZEdeDdeDfdZF G d d          ZG G d  d!          ZH G d" d#          ZI G d$ d%          ZJ G d& d'          ZK G d( d)          ZL G d* d+          ZMe G d, d-                      ZN	 	 	 d=d.eOd/eOd0eOdeNfd1ZPePZQ G d2 d3          ZR ejS        d4          ZT G d5 d6          ZUd7eVd8eVd9eVddfd:ZWd;e5deDfd<ZXdS )>u   
Implementation of stream filters; §7.4 Filters of the PDF 2.0 specification.

§8.9.7 Inline images of the PDF 2.0 specification has abbreviations that can be
used for the names of filters in an inline image object.
zMathieu Fenniakzbiziqe@mathieu.fenniak.net    N)	a85decode)	dataclass)Path)TemporaryDirectory)AnyOptionalUnioncast   )LzwCodec)WHITESPACES_AS_BYTES	deprecatedeprecation_with_replacementlogger_warning)CcittFaxDecodeParameters)FilterTypeAbbreviations)FilterTypes)ImageAttributesStreamAttributes)LzwFilterParameters)DependencyErrorLimitReachedErrorPdfReadErrorPdfStreamError)ArrayObjectDictionaryObjectIndirectObject
NullObjectNumberObjectStreamObjectis_null_or_noneihxi@KL i i 	= c              #   6   K   | ]}t          |f          V  d S N)bytes).0is     aC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\pypdf/filters.py	<genexpr>r(   W   s*      66aeQDkk666666       datareturnc                     t          j                    }|                    | t                    }|j        r%t          dt          |j                   d          |S )N
max_length#Limit reached while decompressing.  bytes remaining.)zlibdecompressobj
decompressZLIB_MAX_OUTPUT_LENGTHunconsumed_tailr   len)r+   decompressorresults      r'   _decompress_with_limitr:   Z   sf    %''L$$T6L$MMF# 
f#l6R2S2Sfff
 
 	
 Mr)   c           
         	 t          |           S # t          j        $ r d}t          dt	          |dz   t          |                               D ]3}	 t          | d|                    c cY S # t          j        $ r Y 0w xY wt          j        t          j        dz            }d}t          }t          |           }t                      }t          |          D ]}t          | |                  }		 |                    |	|          }
||
z  }|t          |
          z  }|dk    rt          d||z
   d	          a# t          j        $ rm}|t          k    rt          d
||z
   d	          t          |          }||v rY d}~t          |t                      |                    |           Y d}~d}~ww xY w|cY S w xY w)a  
    Decompress the given data using zlib.

    Attempts to decompress the input data using zlib.
    If the decompression fails due to a zlib error, it falls back
    to using a decompression object with a larger window size.

    Please note that the output length is limited to avoid memory
    issues. If you need to process larger content streams, consider
    adapting ``pypdf.filters.ZLIB_MAX_OUTPUT_LENGTH``. In case you
    are only dealing with trusted inputs and/or want to disable these
    limits, set the value to `0`.

    Args:
        data: The input data to be decompressed.

    Returns:
        The decompressed data.

       r   N    r)   r.   r   r0   r1   z,Recovery limit reached while decompressing. )r:   r2   errorrangeminr7   r3   	MAX_WBITSr5   set_SINGLE_BYTESr4   r   ZLIB_MAX_RECOVERY_INPUT_LENGTHstrr   __name__add)r+   max_tail_cut_off_bytesr&   r8   
result_strremaining_limitdata_lengthknown_errorsindexchunkdecompressedr>   	error_strs                r'   r4   r4   d   s>   */%d+++: - - - '(q#4q8#d))DDEE 	 	A-d3QB3i8888888:    )$.2*=>>
0$iiuu;'' 	, 	,E!$u+.E,+66u6YYl*
3|#4#44"a' +dkE>Qddd   : 	, 	, 	,99 +m{UZGZmmm    JJ	, HHHHy(333  ++++++++	, [-sl    AG A0+G 0B?G BA.G 1A
D<;G <F84F3?G *F3.G 3F88G ?G c            
           e Zd Ze	 ddedee         dedefd            Zedede	e
e
e
f         fd            Zeded	e
d
e
defd            Zeddede
defd            ZdS )FlateDecodeNr+   decode_parmskwargsr,   c                    t          |           }t          |t                    r|}nt                      }|                    dd          }|dk    rt                              |          \  }}}t          j        ||z  |z  dz            dz   }	|	t          k    rt          d|	 dt           d          |dk    rk|	dz  }	|	|z  }
t          |          }t          t          |                    D ]%}||	z  |
k    r||         |||
z
           z   dz  ||<   &t          |          }n?d	|cxk    rd
k    r n nt                              |||	          }nt          d|          |S )a&  
        Decode data which is flate-encoded.

        Args:
          data: Flate-encoded data.
          decode_parms: Additional decoding parameters.

        Returns:
          The flate-decoded data.

        Raises:
          PdfReadError: Unsupported parameters have been found.

        z
/Predictorr   r<   zRow length of  exceeds defined limit of .   r*   
      z"Unsupported flatedecode predictor )r4   
isinstancer   getrR   _get_parametersmathceilFLATE_MAX_ROW_LENGTHr   	bytearrayr?   r7   r$   _decode_png_predictionr   )r+   rS   rT   str_data
parameters	predictorcolumnscolorsbits_per_component
row_lengthbppstr_data_mutr&   s                r'   decodezFlateDecode.decode   s   ( d##l$455 	,%JJ)++JNN<33	 > 	W2=2M2Mj2Y2Y/GV/ 	'F*-??!CDDqH  00 'bZbbK_bbb  
 A~ Wa
 G+(22s<0011 Z ZA:~, Z+7?\!c'=R+RVY*YQ ..y W W W WB W W W W W&==gz  ##U	#U#UVVVr)   rd   c                 |    dt           dt          dt          f fd} |t          j        d          }|t          k    rt          d| dt           d	           |t          j        d          }|d
k    rt          d| d           |t          j        d          }|d
k    rt          d|           |||fS )Nkeydefaultr,   c                                          | t          |                                                    }t          |t                    r|dk     rt          d|  d| d          |S )Nr   zExpected positive number for z, got !)r\   r   
get_objectr[   intr   )rn   ro   _valuerd   s      r'   r\   z(FlateDecode._get_parameters.<locals>.get   sp    ^^Cg)>)>??JJLLFfc** Yfqj Y"#W3#W#Wf#W#W#WXXXMr)   r   )rn   ro   zNumber of columns rV   rW      zColor value zJ exceeds limit of 16. Please open an issue if this limits valid use cases.r<   z1More than 16 bits per component are not allowed: )	rE   rs   LZWCOLUMNSFLATE_MAX_COLUMNSr   COLORSBITS_PER_COMPONENTr   )rd   r\   rf   rg   rh   s   `    r'   r]   zFlateDecode._get_parameters   s   	S 	3 	3 	 	 	 	 	 	 ##+q111&& 	r#$p$p$p\m$p$p$pqqqQ///B; 	#Hv H H H  
 !SS%;QGGG" 	igSegghhh 222r)   rf   ri   c                 \   t          |           |z  x}dk    r8t          dt                     | d||z
  z  z  } t          |           |z  dk    sJ g }d|z  }|dz
  |z  }t          dt          |           |          D ]}t	          | |||z                      }|d         }	|	dk    rn|	dk    r2t          |dz   |          D ]}
||
         ||
|z
           z   dz  ||
<   n|	dk    r,t          d|          D ]}
||
         ||
         z   dz  ||
<   n\|	dk    rst          d|dz             D ]}
||
         dz  }||
         |z   dz  ||
<   t          |dz   |          D ],}
||
|z
           }|||
         z   dz  }||
         |z   dz  ||
<   -n|	d	k    rt          d|dz             D ]}
||
         ||
         z   dz  ||
<   t          |dz   |          D ]}
||
|z
           }||
         }||
|z
           }||z   |z
  }t          ||z
            }t          ||z
            }t          ||z
            }||k    r	||k    r|}n||k    r|}n|}||
         |z   dz  ||
<   nt          d
|	          t          |          }|                    |dd                     !t          |          S )Nr   z.Image data is not rectangular. Adding padding.    )r   r   r*   rX         zUnsupported PNG filter )
r7   r   rF   r?   listabsr   tupleextendr$   )r+   rf   ri   	remainderoutputprevious_row_datarj   rowrow_datafilter_byter&   floorleftupup_leftp	dist_leftdist_updist_up_leftpaeths                       r'   rb   z"FlateDecode._decode_png_prediction  s    TZ//IA5 	/KXVVVGzI566Dt99z)Q.... :-A~')CIIz22 3	( 3	(C"&tC#
2B,B'C"D"DH"1+Ka -! *sQw
33 J JA#+A;!c'1B#Bc"IHQKKJ! &q*-- M MA#+A;1B11E#E"LHQKKM! "q#'** > >A-a0A5E#+A;#6#"=HQKKsQw
33 > >A#AG,D!$5a$88Q>E#+A;#6#"=HQKK> ! q#'** M MA#+A;1B11E#E"LHQKKsQw
33 > >A#AG,D*1-B/C8Gr	G+A #AHI!!b&kkG#&q7{#3#3L G+ (	\0I ( $ L0 ( " '#+A;#6#"=HQKK#>& #=k==   !&hMM(122,''''V}}r)   levelc                 ,    t          j        | |          S )z
        Compress the input data using zlib.

        Args:
            data: The data to be compressed.
            level: See https://docs.python.org/3/library/zlib.html#zlib.compress

        Returns:
            The compressed data.

        )r2   compress)r+   r   s     r'   encodezFlateDecode.encodeB  s     }T5)))r)   r#   )r   )rF   
__module____qualname__staticmethodr$   r   r   r   rl   r   rs   r]   rb   r    r)   r'   rR   rR      s        489 99/09 9 
	9 9 9 \9v 3$4 3sC}9M 3 3 3 \32 =U =S =c =e = = = \=~ * *U *3 * * * * \* * *r)   rR   c            
       Z    e Zd ZdZe	 ddeeef         dee	         de
defd            ZdS )	ASCIIHexDecodez
    The ASCIIHexDecode filter decodes data that has been encoded in ASCII
    hexadecimal form into a base-7 ASCII format.
    Nr+   rS   rT   r,   c                 z   t          | t                    r|                                 } |                     d          }|dk    rt	          dt
                     | }n
| d|         }d                    |                                          }t          |          dz  dk    r|dz  }t          j
        |          S )	a  
        Decode an ASCII-Hex encoded data stream.

        Args:
          data: a str sequence of hexadecimal-encoded values to be
            converted into a base-7 ASCII string
          decode_parms: this filter does not use parameters.

        Returns:
          A string conversion in base-7 ASCII, where each of its values
          v is such that 0 <= ord(v) <= 127.

        Raises:
          PdfStreamError:

           >r   z4missing EOD in ASCIIHexDecode, check if output is OKNr)   rX   r      0)r[   rE   r   findr   rF   joinsplitr7   binascii	unhexlify)r+   rS   rT   eodhex_datas        r'   rl   zASCIIHexDecode.decodeX  s    , dC   	!;;==D iioo"9 	"F   HHDSDzH 88HNN,,-- x==1! 	H!(+++r)   r#   rF   r   r   __doc__r   r	   rE   r$   r   r   r   rl   r   r)   r'   r   r   R  s{         
  48*, *,CJ*,/0*, *, 
	*, *, *, \*, *, *,r)   r   c            
       J    e Zd ZdZe	 ddedee         dedefd            Z	dS )	RunLengthDecodeuA  
    The RunLengthDecode filter decodes data that has been encoded in a
    simple byte-oriented format based on run length.
    The encoded data is a sequence of runs, where each run consists of
    a length byte followed by 1 to 128 bytes of data. If the length byte is
    in the range 0 to 127,
    the following length + 1 (1 to 128) bytes are copied literally during
    decompression.
    If length is in the range 129 to 255, the following single byte is to be
    copied 257 − length (2 to 128) times during decompression. A length value
    of 128 denotes EOD.
    Nr+   rS   rT   r,   c                 ^   g }d}t          |           }d}	 ||k    rt          dt                     n| |         }|dz  }|dk    rL||k     rE||dz
  k    r'| ||dz            dk    rt          dt                     nt          dt                     n|dk     r+|dz  }|                    | |||z                       ||z  }n6d	|z
  }|                    t	          | |         f          |z             |dz  }||z  }|t
          k    rt          d
          d                    |          S )a  
        Decode a run length encoded data stream.

        Args:
          data: a bytes sequence of length/data
          decode_parms: this filter does not use parameters.

        Returns:
          A bytes decompressed sequence.

        Raises:
          PdfStreamError:

        r   Tz5missing EOD in RunLengthDecode, check if output is OKr         
z<Found trailing newline in stream data, check if output is OKz3Early EOD in RunLengthDecode, check if output is OK  z"Limit reached while decompressing.r)   )r7   r   rF   appendr$   RUN_LENGTH_MAX_OUTPUT_LENGTHr   r   )r+   rS   rT   lstrM   rK   total_lengthlengths           r'   rl   zRunLengthDecode.decode  s   ( $ii#	N# KX   %[FQJE} ;&  q0 tEEAI<M7NRW7W &Z\d    #Mx   | !

4 89:::v

5$u+0069:::
F"L:: N'(LMMMG#	NH xx}}r)   r#   )
rF   r   r   r   r   r$   r   r   r   rl   r   r)   r'   r   r     sr           48; ;;/0; ; 
	; ; ; \; ; ;r)   r   c            
       `    e Zd Z G d d          Ze	 d	dedee         dedefd            Z	dS )
	LZWDecodec                   2    e Zd ZdZdZdeddfdZdefdZdS )LZWDecode.Decoderr   r*   r+   r,   Nc                     || _         d S r#   )r+   )selfr+   s     r'   __init__zLZWDecode.Decoder.__init__  s    DIIIr)   c                 \    t          t                                        | j                  S )N)max_output_length)	_LzwCodecLZW_MAX_OUTPUT_LENGTHrl   r+   )r   s    r'   rl   zLZWDecode.Decoder.decode  s$    /DEEELLTYWWWr)   )rF   r   r   STOP	CLEARDICTr$   r   rl   r   r)   r'   Decoderr     sb        		 	4 	 	 	 		XE 	X 	X 	X 	X 	X 	Xr)   r   Nr+   rS   rT   r,   c                 Z    t                               |                                           S )z
        Decode an LZW encoded data stream.

        Args:
          data: ``bytes`` or ``str`` text to decode.
          decode_parms: a dictionary of parameter values.

        Returns:
          decoded data.

        )r   r   rl   r+   rS   rT   s      r'   rl   zLZWDecode.decode  s$    $   &&--///r)   r#   )
rF   r   r   r   r   r$   r   r   r   rl   r   r)   r'   r   r     s        X X X X X X X X  480 00/00 0 
	0 0 0 \0 0 0r)   r   c            
       Z    e Zd ZdZe	 ddeeef         dee	         de
defd            ZdS )	ASCII85Decodez7Decodes string ASCII85-encoded data into a byte format.Nr+   rS   rT   r,   c                    t          | t                    r|                                 } |                     t                    } t          |           dk    rB|                     d          r-| dd                             t                    | dd         z   } 	 t          | dt                    S # t          $ rH}|j
        d         dk    r1t          d	t                     t          | d
t                    cY d}~S  d}~ww xY w)z
        Decode an Ascii85 encoded data stream.

        Args:
          data: ``bytes`` or ``str`` text to decode.
          decode_parms: this filter does not use parameters.

        Returns:
          decoded data.

        rX   r   Nr   T)adobeignorecharsr   z2Ascii85 encoded byte sequences must end with b'~>'z$Ignoring missing Ascii85 end marker.F)r[   rE   r   stripr   r7   endswithrstripr   
ValueErrorargsr   rF   )r+   rS   rT   r>   s       r'   rl   zASCII85Decode.decode  s   " dC   	!;;==Dzz.//t99q= 	FT]]400 	F9##$899DIED	T;OPPPP 	 	 	z!} TT VExPPP U@TUUUUUUUUU		s$   B1 1
D;<C>7D=C>>Dr#   r   r   r)   r'   r   r     su        AA 48 CJ/0  
	   \  r)   r   c            
       F    e Zd Ze	 ddedee         dedefd            ZdS )	DCTDecodeNr+   rS   rT   r,   c                     | S )as  
        Decompresses data encoded using a DCT (discrete cosine transform)
        technique based on the JPEG standard (IS0/IEC 10918),
        reproducing image sample data that approximates the original data.

        Args:
          data: text to decode.
          decode_parms: this filter does not use parameters.

        Returns:
          decoded data.

        r   r   s      r'   rl   zDCTDecode.decode  s	    & r)   r#   	rF   r   r   r   r$   r   r   r   rl   r   r)   r'   r   r     sf         48 /0  
	   \  r)   r   c            
       F    e Zd Ze	 ddedee         dedefd            ZdS )	JPXDecodeNr+   rS   rT   r,   c                     | S )a  
        Decompresses data encoded using the wavelet-based JPEG 2000 standard,
        reproducing the original image data.

        Args:
          data: text to decode.
          decode_parms: this filter does not use parameters.

        Returns:
          decoded data.

        r   r   s      r'   rl   zJPXDecode.decode-  s	    $ r)   r#   r   r   r)   r'   r   r   ,  sf         48 /0  
	   \  r)   r   c                       e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	e
edf         ed	<   dZe
edf         ed
<   dZe
edf         ed<   dZeed<   dZe
edf         ed<   edefd            ZdS )CCITTParametersu;   §7.4.6, optional parameters for the CCITTFaxDecode filter.r   Ki  rf   rowsFN	EndOfLineEncodedByteAlignT
EndOfBlockBlackIs1DamagedRowsBeforeErrorr,   c                 &    | j         dk     rd}nd}|S )Nr   r~   r}   )r   )r   
CCITTgroups     r'   groupzCCITTParameters.groupO  s$    6A: 	JJ Jr)   )rF   r   r   r   r   rs   __annotations__rf   r   r   r	   boolr   r   r   r   propertyr   r   r)   r'   r   r   B  s         EEAsJJJGSD#MMM#(IuT4Z (((*/eD$J'///$(JdDj!(((Hd/0E#t),000s    X  r)   r   r   rf   r   c                 F    t          ddd           t          | ||          S )NCCITParametersr   z6.0.0)r   r   )r   rf   r   s      r'   __create_old_class_instancer   [  s*    
 !!13DgNNN1gt,,,r)   c                       e Zd ZdZededeeef         dee	ef         de
fd            Ze	 	 dded	ee         d
e	dedef
d            ZdS )CCITTFaxDecodeu   
    §7.4.6, CCITTFaxDecode filter (ISO 32000).

    Either Group 3 or Group 4 CCITT facsimile (fax) encoding.
    CCITT encoding is bit-oriented, not byte-oriented.

    §7.4.6, optional parameters for the CCITTFaxDecode filter.
    rd   Nr   r,   c                    t          t          |                    }| rt          t          t          t
          f         |                                           }t          |t                    r|D ]}t          j	        |v r)|t          j	                                                 |_	        t          j
        |v r)|t          j
                                                 |_        t          j        |v r.|t          j                                                 j        |_        nt          j	        |v r)|t          j	                                                 |_	        t          j
        |v r)|t          j
                                                 |_        t          j        |v r.|t          j                                                 j        |_        |S )N)r   )r   rs   r
   r	   r   r   rr   r[   CCITTr   rw   rf   
BLACK_IS_1valuer   )rd   r   ccitt_parametersparameters_unwrappeddecode_parms        r'   r]   zCCITTFaxDecode._get_parametersr  s   
 +D		::: 	j#'k#334j6K6K6M6M$ $  .<< j#7 e eKw+- O-8-A-L-L-N-N(*}3 [3>u}3M3X3X3Z3Z(0';6 e4?@P4Q4\4\4^4^4d(1e 722 T)=eg)F)Q)Q)S)S$&=$88 `/CEM/R/]/]/_/_$,#';; j0DUEU0V0a0a0c0c0i$-r)   r   r+   rS   heightrT   c                    t                               ||          }t          |           }d}t          j        g |ddddddd|j        ddd|j        d	d
dddd
d|j        dd
dt          |j	                  dddt          j
        |          ddd|j        ddd|dR  }|| z   S )Nz'<2shlhhhllhhllhhllhhllhhllhhllhhllhhllhs   II*   r<   r*   r~   r   r   i  r}   i  i  i  i  i  r   )r   r]   r7   structpackrf   r   r   rs   r   calcsize)r+   rS   r   rT   paramsimg_sizetiff_header_structtiff_headers           r'   rl   zCCITTFaxDecode.decode  s     //fEEt998k )
)
)
 )
 	)

 )
 )
 )
 )
 N)
 )
 )
 )
 K)
 )
 )
  !)
" #)
$ %)
& ')
( ))
* L+)
, -)
. /)
0 1)
2   3)
4 5)
6 7)
8 9)
: o" ;)
@ A)
B C)
D E)
F KG)
H I)
J K)
L M)
N O)
P Q)
 )
 )
V T!!r)   )Nr   )rF   r   r   r   r   r	   r   r   r   rs   r   r]   r$   r   r   rl   r   r)   r'   r   r   h  s           $-=~MN C'(  
      \ 4  485" 5"5"/05" 5" 	5"
 
5" 5" 5" \5" 5" 5"r)   r   jbig2decc            
       b    e Zd Ze	 ddedee         dedefd            Zede	fd            Z
dS )	JBIG2DecodeNr+   rS   rT   r,   c                    t           t          d          t                      5 }t          |          }g }|rd|v r|d         }t	          |          st	          |                                x}          sr|
J d            t          |t                    rQ|                    d          }|	                    |
                                           |                    |           |                    d          }|	                    |            |                    |           t          j                                        }	d|	d<   t          j        t           dd	d
dddt#          t$                    g|d|	          }
d|
j        v s	d|
j        v rt          d          d|
j        v r*t)          d|
j                            d                     |
j        rD|
j                            d                                          D ]}t/          |t0                     |
j        dk    rt5          d|
j                   	 d d d            n# 1 swxY w Y   |
j        S )Nz!jbig2dec binary is not available.z/JBIG2Globalsmypyzglobals.jbig2zimage.jbig2CLC_ALLz
--embeddedz--formatpngz--output-z-MT)capture_outputenvs    unrecognized option '--embedded's   unrecognized option '-M'zjbig2dec>=0.19 is required.s0   FATAL ERROR failed to allocate image data bufferz/Memory limit reached while reading JBIG2 data:
zutf-8r   z(Unable to decode JBIG2 data. Exit code: )JBIG2DEC_BINARYr   r   r   r!   rr   r[   r    joinpathwrite_bytesget_datar   osenvironcopy
subprocessrunrE   JBIG2_MAX_OUTPUT_LENGTHstderrr   rl   
splitlinesr   rF   
returncoder   stdout)r+   rS   rT   tempdir	directorypathsjbig2_globalspointerpathenvironmentr9   lines               r'   rl   zJBIG2Decode.decode  s     	G!"EFFF!! )	eWWI "E +< ? + ,_ =&}55 +oYfYqYqYsYsNsg>t>t +"66666!'<88 +(11/BB(()9)9););<<<T***%%m44DT"""LL*//++K$'K!^# #566   $  F 3fmC EGbflfsGs E%&CDDDBfmS 'fv}G[G[\cGdGdff   } 3"M0099DDFF 3 3D"42222 A% e$%cPVPa%c%cdddeQ)	e )	e )	e )	e )	e )	e )	e )	e )	e )	e )	e )	e )	e )	e )	eT }s   HIIIc                      t           sdS t          j        t           dgdd          } | j                            dd          d         }ddlm}  ||           |d	          k    S )
NFz	--versionT)r  text r   )maxsplit)Versionz0.19)r  r  r  r  r   _utilsr  )r9   versionr  s      r'   _is_binary_compatiblez!JBIG2Decode._is_binary_compatible  s     	5k*
 
 

 -%%cA%66q9######ww776??22r)   r#   )rF   r   r   r   r$   r   r   r   rl   r   r"  r   r)   r'   r   r     s         482 22/02 2 
	2 2 2 \2h 34 3 3 3 \3 3 3r)   r   filter_nameold_namenew_namec                 D    | |k    rd S t          d| d| dd           d S )NzThe filter name z7 is deprecated and will be removed in pypdf 7.0.0. Use z	 instead.r~   )r   r#  r$  r%  s      r'   _deprecate_inline_image_filtersr(    sJ    h o8oo\dooo	    r)   streamc                 ^   |                      t          j        d          }t          |t                    r't          t          |                                          }t          |t                    s|f}|                      t          j        i ft          |          z            }t          |t          t          f          s|f}| j        }|s|S t          ||          D ]K\  }}t          |t                    ri }|t          j        t"          j        fv rAt'          |t"          j        t          j                   t(                              |          }x|t          j        t"          j        fv rAt'          |t"          j        t          j                   t0                              |          }|t          j        t"          j        fv rCt'          |t"          j        t          j                   t6                              ||          }0|t          j        t"          j        fv rCt'          |t"          j        t          j                   t<                              ||          }|t          j        t"          j         fv rBt'          |t"          j         t          j                   tB                              |          }|t          j"        t"          j#        fv rdt'          |t"          j#        t          j"                   |                      tH          j%        d          }tL                              |||          }g|t          j'        t"          j(        fv rBt'          |t"          j(        t          j'                   tR                              |          }|t          j*        k    rtV                              |          }|t          j,        k    rtZ                              ||          }|dk    rd|v sd|v rt]          d          ;t]          d|           |S )au  
    Decode the stream data based on the specified filters.

    This function decodes the stream data using the filters provided in the
    stream.

    Args:
        stream: The input stream object containing the data and filters.

    Returns:
        The decoded stream data.

    Raises:
        NotImplementedError: If an unsupported filter type is encountered.

    r   r'  z/Cryptz/Namez/Typez3/Crypt filter with /Name or /Type not supported yetzUnsupported filter )/r\   r   FILTERr[   r   r
   r   rr   DECODE_PARMSr7   r   r   _datazipr   FTASCII_HEX_DECODEFTAAHxr(  r   rl   ASCII_85_DECODEA85r   
LZW_DECODErv   r   FLATE_DECODEFLrR   RUN_LENGTH_DECODERLr   CCITT_FAX_DECODECCFr   HEIGHTr   
DCT_DECODEDCTr   
JPX_DECODEr   JBIG2_DECODEr   NotImplementedError)r)  filtersrS   r+   r#  r   r   s          r'   decode_stream_datarC    s   " jj)0"55G'>** :{G$6$6$8$899g{++ *::.;bUS\\=QRRLlT5M22 '$,D "7L99 #K #KVfj)) 	F2.88  	K+cg`b`stttt!((..DDR/99 	K+cg`b`rssss ''--DDR]CG44 	K+cg`b`mnnnn##D&11DDR_cf55 	K+cf_a_noooo%%dF33DDR136:: 	K+cf_a_stttt"))$//DDR0#':: 	K+cg`b`sttttZZ 6;;F!((vv>>DDR]CG44 	K+cg`b`mnnnn##D))DDBM) 
	K##D))DDBO+ 	K%%dF33DDH$ 	K&  Gv$5 )I  
 &&IK&I&IJJJKr)   )r   r   r   )Yr   
__author____author_email__r   r^   r	  shutilr   r  r2   base64r   dataclassesr   pathlibr   tempfiler   typingr   r   r	   r
   _codecs._codecsr   r   r   r   r   r   r   	constantsr   r   r   r1  r   r/  r   r   r   rv   errorsr   r   r   r   genericr   r   r   r   r   r    r!   MAX_DECLARED_STREAM_LENGTH$MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTHr  r   r   r5   rD   rx   r`   FLATE_MAX_BUFFER_SIZEr   r?   rC   r$   r:   r4   rR   r   r   r   r   r   r   r   rs   r   r   r   whichr  r   rE   r(  rC  r   r)   r'   <module>rT     s3  :  
/    				              ! ! ! ! ! !       ' ' ' ' ' ' - - - - - - - - - - - - 2 2 2 2 2 2            9 8 8 8 8 8 5 5 5 5 5 5 ( ( ( ( ( ( 8 8 8 8 8 8 8 8 1 1 1 1 1 1 T T T T T T T T T T T T                  ( '1 $$ " ) # !*    "  6655::66666 5    DU Du D D D DNd* d* d* d* d* d* d* d*N1, 1, 1, 1, 1, 1, 1, 1,hJ J J J J J J JZ0 0 0 0 0 0 0 0@       D       .       ,        2 - -
-- - 	- - - - -[" [" [" [" [" [" [" ["| &,z**B3 B3 B3 B3 B3 B3 B3 B3J  s W[    B| B B B B B B Br)   