
    q*i(                     d   % S SK r S SKrS SKrS SKJr  S SKJrJrJrJ	r	J
r
Jr  \R                  S:  a  S SKJr  OS SKJr  \\\SS4   r  S SKrS	r \R                  S:  a  S SKJr  OS SKJr  S	rSr " S S\	5      r " S S\	5      r " S S\	5      r " S S\
S
S9r " S S5      r\" \5      r \\!S'   S\SS4S jr"  S*S\\#   S\$S\%4S jjr& " S  S!5      r' " S" S#\'5      r( " S$ S%\'5      r) " S& S'5      r* " S( S)5      r+g! \ a    S SKr Nf = f! \ a    S
r Nf = f! \ a    S
r Nf = f)+    N)Executor)AnyFinalOptionalProtocol	TypedDictcast)      )Buffer)Unionzmemoryview[int]zmemoryview[bytes]TF)r
      )ZstdDecompressori   c                   <    \ rS rSrS\S\4S jrS	S\S\4S jjrSr	g)
ZLibCompressObjProtocol&   datareturnc                     g N selfr   s     Y/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/aiohttp/compression_utils.pycompress ZLibCompressObjProtocol.compress'   s    s    modec                    g r   r   r   r   s     r   flushZLibCompressObjProtocol.flush(   s    #r   r   N.)
__name__
__module____qualname____firstlineno__r   bytesr   intr!   __static_attributes__r   r   r   r   r   &   s    2V225#5555r   r   c                   \    \ rS rSrSS\S\S\4S jjrSS\S\4S jjr\	S\
4S j5       rS	rg
)ZLibDecompressObjProtocol+   r   
max_lengthr   c                     g r   r   r   r   r.   s      r   
decompress$ZLibDecompressObjProtocol.decompress,   s    r   lengthc                    g r   r   r   r3   s     r   r!   ZLibDecompressObjProtocol.flush-   s    Cr   c                     g r   r   r   s    r   eofZLibDecompressObjProtocol.eof/   s    r   r   Nr#   )r$   r%   r&   r'   r   r)   r(   r1   r!   propertyboolr9   r*   r   r   r   r,   r,   +   s4    KvK3KK7C7U7T r   r,   c                       \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'         SS\S\S	\S
\S\S\\   S\4S jjr	 SS	\S\S\
4S jjr SS\S	\S\S\4S jjr SS	\S\S\S\4S jjrSrg)ZLibBackendProtocol3   	MAX_WBITSZ_FULL_FLUSHZ_SYNC_FLUSHZ_BEST_SPEEDZ_FINISHlevelmethodwbitsmemLevelstrategyzdictr   c                     g r   r   )r   rE   rF   rG   rH   rI   rJ   s          r   compressobjZLibBackendProtocol.compressobj:   s     #&r   c                     g r   r   )r   rG   rJ   s      r   decompressobj!ZLibBackendProtocol.decompressobjC   s    $'r   r   c                    g r   r   )r   r   rE   rG   s       r   r   ZLibBackendProtocol.compressG       r   bufsizec                    g r   r   )r   r   rG   rT   s       r   r1   ZLibBackendProtocol.decompressJ   rS   r   r   N)......)..)r$   r%   r&   r'   r)   __annotations__r   r   r   rL   r,   rO   r(   r   r1   r*   r   r   r   r>   r>   3   s    NM "%&& & 	&
 & & & 
!& 14(('-(	"(
 ?B&)8;	 AD&):=	 r   r>   c                   4    \ rS rSr% \\S'   \\S'   \\S'   Srg)CompressObjArgsO   rG   rI   rE   r   N)r$   r%   r&   r'   r)   rW   r*   r   r   r   rY   rY   O   s    JMJr   rY   )totalc                   $   \ rS rSrS\4S jr\S\4S j5       r\S\	4S j5       r
\S\	4S j5       r\S\	4S j5       r\S\	4S	 j5       r\S\	4S
 j5       rS\S\S\4S jrS\S\S\4S jrS\S\S\S\4S jrS\S\S\S\4S jrS\S\4S jrSrg)ZLibBackendWrapperU   _zlib_backendc                     Xl         g r   r_   )r   r_   s     r   __init__ZLibBackendWrapper.__init__V   s    2?r   r   c                 0    [        U R                  SS5      $ )Nr$   	undefinedgetattrr_   r8   s    r   nameZLibBackendWrapper.nameY   s    t)):{CCr   c                 .    U R                   R                  $ r   )r_   r@   r8   s    r   r@   ZLibBackendWrapper.MAX_WBITS]   s    !!+++r   c                 .    U R                   R                  $ r   )r_   rA   r8   s    r   rA   ZLibBackendWrapper.Z_FULL_FLUSHa       !!...r   c                 .    U R                   R                  $ r   )r_   rB   r8   s    r   rB   ZLibBackendWrapper.Z_SYNC_FLUSHe   rn   r   c                 .    U R                   R                  $ r   )r_   rC   r8   s    r   rC   ZLibBackendWrapper.Z_BEST_SPEEDi   rn   r   c                 .    U R                   R                  $ r   )r_   rD   r8   s    r   rD   ZLibBackendWrapper.Z_FINISHm   s    !!***r   argskwargsc                 :    U R                   R                  " U0 UD6$ r   )r_   rL   r   ru   rv   s      r   rL   ZLibBackendWrapper.compressobjq   s    !!--t>v>>r   c                 :    U R                   R                  " U0 UD6$ r   )r_   rO   rx   s      r   rO    ZLibBackendWrapper.decompressobjt   s    !!//@@@r   r   c                 B    U R                   R                  " U/UQ70 UD6$ r   )r_   r   r   r   ru   rv   s       r   r   ZLibBackendWrapper.compressw   s#    !!**4A$A&AAr   c                 B    U R                   R                  " U/UQ70 UD6$ r   )r_   r1   r}   s       r   r1   ZLibBackendWrapper.decompressz   s#    !!,,TCDCFCCr   attrnamec                 .    [        U R                  U5      $ r   rf   )r   r   s     r   __getattr__ZLibBackendWrapper.__getattr__~   s    t))844r   ra   N)r$   r%   r&   r'   r>   rb   r;   strrh   r)   r@   rA   rB   rC   rD   r   r   rL   r,   rO   r   r(   r   r1   r   r*   r   r   r   r]   r]   U   sO   @&9 @ Dc D D ,3 , , /c / / /c / / /c / / +# + +? ? ?8O ?A3 A# A:S ABV BC B3 B5 BDv Dc DS DU D5C 5C 5r   r]   ZLibBackendnew_zlib_backendr   c                     U [         l        g r   )r   r_   )r   s    r   set_zlib_backendr      s
     0Kr   encodingsuppress_deflate_headerc                     U S:X  a  S[         R                  -   $ U(       a  [         R                  * $ [         R                  $ )Ngzip   )r   r@   )r   r   s     r   encoding_to_moder      s9     6K))))%<K!!!W+BWBWWr   c                   >    \ rS rSrS\4S\S\\   S\\   4S jjrSr	g)ZlibBaseHandler   Nr   executormax_sync_chunk_sizec                 (    Xl         X l        X0l        g r   )_mode	_executor_max_sync_chunk_size)r   r   r   r   s       r   rb   ZlibBaseHandler.__init__   s     
!$7!r   )r   r   r   )
r$   r%   r&   r'   MAX_SYNC_CHUNK_SIZEr)   r   r   rb   r*   r   r   r   r   r      s9     (,-@	88 8$8 &c]	8 8r   r   c                      ^  \ rS rSrSSSSSS\4S\\   S\S\\   S\\   S\\   S	\\	   S
\\   4U 4S jjjr
S\S\4S jrS\S\4S jrSS\\   S\4S jjrSrU =r$ )ZLibCompressor   NFr   r   rE   rG   rI   r   r   c                    > [         T	U ]  Uc  [        X5      OUUUS9  [        [        R
                  5      U l        0 nU R                  US'   Ub  XXS'   Ub  X8S'   U R
                  R                  " S0 UD6U l        g )Nr   r   r   rG   rI   rE   r   )	superrb   r   r]   r   r_   r   rL   _compressor)
r   r   r   rE   rG   rI   r   r   rv   	__class__s
            r   rb   ZLibCompressor.__init__   s     	 = !C 3 	 	
 %7{7P7P$Q"$**w!):#7O--99CFCr   r   r   c                 8    U R                   R                  U5      $ r   )r   r   r   s     r   compress_syncZLibCompressor.compress_sync   s    ((..r   c                 0  #    U R                   SL=(       a    [        U5      U R                   :  nU(       aL  [        R                  " 5       R	                  U R
                  U R                  R                  U5      I Sh  vN $ U R                  U5      $  N7f)a  Compress the data and returned the compressed bytes.

Note that flush() must be called after the last call to compress()

If the data size is large than the max_sync_chunk_size, the compression
will be done in the executor. Otherwise, the compression will be done
in the event loop.

**WARNING: This method is NOT cancellation-safe when used with flush().**
If this operation is cancelled, the compressor state may be corrupted.
The connection MUST be closed after cancellation to avoid data corruption
in subsequent compress operations.

For cancellation-safe compression (e.g., WebSocket), the caller MUST wrap
compress() + flush() + send operations in a shield and lock to ensure atomicity.
N)	r   lenasyncioget_running_looprun_in_executorr   r   r   r   )r   r   should_use_executors      r   r   ZLibCompressor.compress   s     & %%T1 6D	D555 	  113CC 0 0 9 94   !!$''s   A<B>B?Br   c                 r    U R                   R                  Ub  U5      $ U R                  R                  5      $ )a  Flush the compressor synchronously.

**WARNING: This method is NOT cancellation-safe when called after compress().**
The flush() operation accesses shared compressor state. If compress() was
cancelled, calling flush() may result in corrupted data. The connection MUST
be closed after compress() cancellation.

For cancellation-safe compression (e.g., WebSocket), the caller MUST wrap
compress() + flush() + send operations in a shield and lock to ensure atomicity.
)r   r!   r_   rD   r    s     r   r!   ZLibCompressor.flush   s>     %%$D
 	
*.*<*<*E*E
 	
r   )r   r_   r   )r$   r%   r&   r'   r   r   r   r<   r)   r   rb   r(   r   r   r!   r*   __classcell__r   s   @r   r   r      s     #'(-##"&'+-@D3-D "&D }	D
 }D 3-D 8$D &c]D D:/% /E /(5 (U (8
(3- 
5 
 
r   r   c            
          ^  \ rS rSrSSS\4S\\   S\S\\   S\\	   4U 4S jjjr
SS	\S
\	S\4S jjrSS	\S
\	S\4S jjrSS\	S\4S jjr\S\4S j5       rSrU =r$ )ZLibDecompressor   NFr   r   r   r   c                    > [         TU ]  [        X5      UUS9  [        [        R
                  5      U l        U R
                  R                  U R                  S9U l        g )Nr   )rG   )	r   rb   r   r]   r   r_   rO   r   _decompressor)r   r   r   r   r   r   s        r   rb   ZLibDecompressor.__init__   sZ     	!(D 3 	 	

 %7{7P7P$Q!//==DJJ=Or   r   r.   r   c                 8    U R                   R                  X5      $ r   )r   r1   r0   s      r   decompress_sync ZLibDecompressor.decompress_sync   s    !!,,T>>r   c                   #    U R                   be  [        U5      U R                   :  aL  [        R                  " 5       R	                  U R
                  U R                  R                  X5      I Sh  vN $ U R                  X5      $  N7f)zDecompress the data and return the decompressed bytes.

If the data size is large than the max_sync_chunk_size, the decompression
will be done in the executor. Otherwise, the decompression will be done
in the event loop.
N)	r   r   r   r   r   r   r   r1   r   r0   s      r   r1   ZLibDecompressor.decompress   su      %%1D	D555 113CC 2 2 = =t   ##D55s   A.B0B1Br3   c                 x    US:  a  U R                   R                  U5      $ U R                   R                  5       $ )Nr   )r   r!   r5   s     r   r!   ZLibDecompressor.flush  s?     z $$V,	
 ##))+	
r   c                 .    U R                   R                  $ r   )r   r9   r8   s    r   r9   ZLibDecompressor.eof  s    !!%%%r   )r   r_   )r   )r$   r%   r&   r'   r   r   r   r<   r   r)   rb   r(   r   r1   r!   r;   r9   r*   r   r   s   @r   r   r      s     #'(-'+-@P3-P "&P 8$	P
 &c]P P?E ?s ?5 ?6U 6 6E 6 
C 
 
 &T & &r   r   c                   >    \ rS rSrS	S jrS\S\4S jrS\4S jrSrg)
BrotliDecompressori  r   Nc                 d    [         (       d  [        S5      e[        R                  " 5       U l        g )NzIThe brotli decompression is not available. Please install `Brotli` module)
HAS_BROTLIRuntimeErrorbrotliDecompressor_objr8   s    r   rb   BrotliDecompressor.__init__  s+    z1  '')	r   r   c                     [        U R                  S5      (       a)  [        [        U R                  R	                  U5      5      $ [        [        U R                  R                  U5      5      $ )Nr1   )hasattrr   r	   r(   r1   processr   s     r   r   "BrotliDecompressor.decompress_sync'  sK    499l++tyy33D9::E499,,T233r   c                     [        U R                  S5      (       a(  [        [        U R                  R	                  5       5      $ g)Nr!   r   )r   r   r	   r(   r!   r8   s    r   r!   BrotliDecompressor.flush,  s.    499g&&tyy011r   r   r   N	r$   r%   r&   r'   rb   r(   r   r!   r*   r   r   r   r   r     s&    *4E 4e 4
u r   r   c                   >    \ rS rSrS	S jrS\S\4S jrS\4S jrSrg)
ZSTDDecompressori2  r   Nc                 N    [         (       d  [        S5      e[        5       U l        g )NzOThe zstd decompression is not available. Please install `backports.zstd` module)HAS_ZSTDr   r   r   r8   s    r   rb   ZSTDDecompressor.__init__3  s%    x9  %&	r   r   c                 8    U R                   R                  U5      $ r   )r   r1   r   s     r   r    ZSTDDecompressor.decompress_sync;  s    yy##D))r   c                     g)Nr   r   r8   s    r   r!   ZSTDDecompressor.flush>  s    r   r   r   r   r   r   r   r   r   2  s&    '*E *e *u r   r   )NF),r   syszlibconcurrent.futuresr   typingr   r   r   r   r   r	   version_infocollections.abcr   r   r(   	bytearray
brotlicffir   ImportErrorr   compression.zstdr   backports.zstdr   r   r   r,   r>   rY   r]   r   rW   r   r   r<   r)   r   r   r   r   r   r   r   r   r   <module>r      s    
  ' B Bw&5)%68KKLF# J
7"53H
  6h 6
 ( 8iu *5 *5Z #5T": :1': 1t 1
 #$)XsmX!X 	X	8 	8J
_ J
Z,& ,&^ . C	    J  HsB   D D D$ 
DD DD D! D!$D/.D/