Ë
    F·j´,  ã                  ó–  — d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ  G d„ d«      Z G d	„ d
e«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ d«      Z G d„ d«      Z G d„ d«      Z G d„ d«      ZeeeeedœZe€ej1                  d«       e	€ej1                  d«       yy) zq
Handlers for Content-Encoding.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
é    )ÚannotationsNé   )ÚbrotliÚzstd)ÚDecodingErrorc                  ó   — e Zd Zdd„Zdd„Zy)ÚContentDecoderc                ó   — t        «       ‚©N©ÚNotImplementedError©ÚselfÚdatas     ú]/var/www/html/ai-video-generator/backend/venv/lib/python3.12/site-packages/httpx/_decoders.pyÚdecodezContentDecoder.decode   ó   € Ü!Ó#Ð#ó    c                ó   — t        «       ‚r   r   ©r   s    r   ÚflushzContentDecoder.flush   r   r   N©r   ÚbytesÚreturnr   ©r   r   )Ú__name__Ú
__module__Ú__qualname__r   r   © r   r   r	   r	      s   „ ó$ô$r   r	   c                  ó    — e Zd ZdZdd„Zdd„Zy)ÚIdentityDecoderz 
    Handle unencoded data.
    c                ó   — |S r   r   r   s     r   r   zIdentityDecoder.decode   s   € Øˆr   c                 ó   — y©Nr   r   r   s    r   r   zIdentityDecoder.flush"   s   € Ør   Nr   r   )r   r   r   Ú__doc__r   r   r   r   r   r!   r!      s   „ ñóôr   r!   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚDeflateDecoderzZ
    Handle 'deflate' decoding.

    See: https://stackoverflow.com/questions/1838699
    c                óD   — d| _         t        j                  «       | _        y )NT)Úfirst_attemptÚzlibÚdecompressobjÚdecompressorr   s    r   Ú__init__zDeflateDecoder.__init__-   s   € Ø!ˆÔÜ ×.Ñ.Ó0ˆÕr   c                óB  — | j                   }d| _         	 | j                  j                  |«      S # t        j                  $ r[}|r?t        j
                  t        j                   «      | _        | j                  |«      cY d }~S t        t        |«      «      |‚d }~ww xY w©NF)
r)   r,   Ú
decompressr*   Úerrorr+   Ú	MAX_WBITSr   r   Ústr)r   r   Úwas_first_attemptÚexcs       r   r   zDeflateDecoder.decode1   s‚   € Ø ×.Ñ.ÐØ"ˆÔð	3Ø×$Ñ$×/Ñ/°Ó5Ð5øÜ�z‰zò 	3Ù Ü$(×$6Ñ$6¼¿¹°Ó$G�Ô!Ø—{‘{ 4Ó(Õ(Ü¤ C£Ó)¨sÐ2ûð		3ús!   •0 °BÁ;BÁ>BÂBÂBc                ó˜   — 	 | j                   j                  «       S # t        j                  $ r}t	        t        |«      «      |‚d }~ww xY wr   ©r,   r   r*   r1   r   r3   ©r   r5   s     r   r   zDeflateDecoder.flush<   óA   € ð	3Ø×$Ñ$×*Ñ*Ó,Ð,øÜ�z‰zò 	3Ü¤ C£Ó)¨sÐ2ûð	3úó   ‚ œA	¯AÁA	N©r   ÚNoner   r   ©r   r   r   r%   r-   r   r   r   r   r   r'   r'   &   s   „ ñó1ó	3ô3r   r'   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚGZipDecoderzW
    Handle 'gzip' decoding.

    See: https://stackoverflow.com/questions/1838699
    c                óZ   — t        j                  t         j                  dz  «      | _        y )Né   )r*   r+   r2   r,   r   s    r   r-   zGZipDecoder.__init__J   s   € Ü ×.Ñ.¬t¯~©~ÀÑ/BÓCˆÕr   c                óš   — 	 | j                   j                  |«      S # t        j                  $ r}t	        t        |«      «      |‚d }~ww xY wr   )r,   r0   r*   r1   r   r3   ©r   r   r5   s      r   r   zGZipDecoder.decodeM   sC   € ð	3Ø×$Ñ$×/Ñ/°Ó5Ð5øÜ�z‰zò 	3Ü¤ C£Ó)¨sÐ2ûð	3ús   ‚ �A
°AÁA
c                ó˜   — 	 | j                   j                  «       S # t        j                  $ r}t	        t        |«      «      |‚d }~ww xY wr   r7   r8   s     r   r   zGZipDecoder.flushS   r9   r:   Nr;   r   r   r=   r   r   r   r?   r?   C   s   „ ñóDó3ô3r   r?   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚBrotliDecoderaT  
    Handle 'brotli' decoding.

    Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/
        or   `pip install brotli`. See https://github.com/google/brotli
    Supports both 'brotlipy' and 'Brotli' packages since they share an import
    name. The top branches are for 'brotlipy' and bottom branches for 'Brotli'
    c                ó  — t         €t        d«      d ‚t        j                  «       | _        d| _        |  t        | j                  d«      r| j                  j                  | _        y | j                  j                  | _        y )NzžUsing 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' packages have been installed. Make sure to install httpx using `pip install httpx[brotli]`.Fr0   )	r   ÚImportErrorÚDecompressorr,   Ú	seen_dataÚhasattrr0   Ú_decompressÚprocessr   s    r   r-   zBrotliDecoder.__init__d   sv   € Üˆ>ÜðPóð ð	ô #×/Ñ/Ó1ˆÔØˆŒÙÜ�4×$Ñ$ lÔ3à#×0Ñ0×;Ñ;ˆDÕð  $×0Ñ0×8Ñ8ˆDÕr   c                óš   — |syd| _         	 | j                  |«      S # t        j                  $ r}t	        t        |«      «      |‚d }~ww xY w©Nr   T)rJ   rL   r   r1   r   r3   rC   s      r   r   zBrotliDecoder.decodev   sJ   € ÙØØˆŒð	3Ø×#Ñ# DÓ)Ð)øÜ�|‰|ò 	3Ü¤ C£Ó)¨sÐ2ûð	3ús   Œ �A
°AÁA
c                óà   — | j                   sy	 t        | j                  d«      r| j                  j                  «        y# t        j
                  $ r}t        t        |«      «      |‚d }~ww xY w)Nr   Úfinish)rJ   rK   r,   rQ   r   r1   r   r3   r8   s     r   r   zBrotliDecoder.flush   s]   € Ø�~Š~Øð
	3Ü�t×(Ñ(¨(Ô3ð ×!Ñ!×(Ñ(Ô*ØøÜ�|‰|ò 	3Ü¤ C£Ó)¨sÐ2ûð	3ús   �0A  Á A-ÁA(Á(A-Nr;   r   r   r=   r   r   r   rF   rF   Z   s   „ ñó9ó$3ô3r   rF   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚZStandardDecoderz 
    Handle 'zstd' RFC 8878 decoding.

    Requires `pip install zstandard`.
    Can be installed as a dependency of httpx using `pip install httpx[zstd]`.
    c                óv   — t         €t        d«      d ‚t        j                  «       j                  «       | _        y )NzXUsing 'ZStandardDecoder', ...Make sure to install httpx using `pip install httpx[zstd]`.)r   rH   ÚZstdDecompressorr+   r,   r   s    r   r-   zZStandardDecoder.__init__˜   s;   € Üˆ<ÜðNóð ðô
 !×1Ñ1Ó3×AÑAÓCˆÕr   c                ó�  — t         €J ‚t        j                  «       }	 |j                  | j                  j                  |«      «       | j                  j                  rª| j                  j                  r”| j                  j                  }t        j                  «       j                  «       | _        |j                  | j                  j                  |«      «       | j                  j                  r| j                  j                  rŒ”|j                  «       S # t         j                  $ r}t        t        |«      «      |‚d }~ww xY wr   )r   ÚioÚBytesIOÚwriter,   r0   ÚeofÚunused_datarU   r+   Ú	ZstdErrorr   r3   Úgetvalue)r   r   Úoutputr[   r5   s        r   r   zZStandardDecoder.decode¡   sõ   € ÜÐÐÐÜ—‘“ˆð	3Ø�L‰L˜×*Ñ*×5Ñ5°dÓ;Ô<Ø×#Ñ#×'Ò'¨D×,=Ñ,=×,IÒ,IØ"×/Ñ/×;Ñ;�Ü$(×$9Ñ$9Ó$;×$IÑ$IÓ$K�Ô!Ø—‘˜T×.Ñ.×9Ñ9¸+ÓFÔGð ×#Ñ#×'Ò'¨D×,=Ñ,=×,IÓ,Ið �‰Ó Ð øô �~‰~ò 	3Ü¤ C£Ó)¨sÐ2ûð	3ús   žC)D ÄEÄ+E Å Ec                óŽ   — | j                   j                  «       }| j                   j                  st        d«      ‚t	        |«      S )NzZstandard data is incomplete)r,   r   rZ   r   r   )r   Úrets     r   r   zZStandardDecoder.flush®   s;   € Ø×Ñ×%Ñ%Ó'ˆØ× Ñ ×$Ò$ÜÐ >Ó?Ð?Ü�S‹zÐr   Nr;   r   r   r=   r   r   r   rS   rS   �   s   „ ñóDó!ôr   rS   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚMultiDecoderzE
    Handle the case where multiple encodings have been applied.
    c                ó6   — t        t        |«      «      | _        y)zm
        'children' should be a sequence of decoders in the order in which
        each was applied.
        N)ÚlistÚreversedÚchildren)r   rf   s     r   r-   zMultiDecoder.__init__º   s   € ô œX hÓ/Ó0ˆ�r   c                óJ   — | j                   D ]  }|j                  |«      }Œ |S r   )rf   r   ©r   r   Úchilds      r   r   zMultiDecoder.decodeÂ   s(   € Ø—]‘]ò 	&ˆEØ—<‘< Ó%‰Dð	&àˆr   c                óp   — d}| j                   D ]$  }|j                  |«      |j                  «       z   }Œ& |S r$   )rf   r   r   rh   s      r   r   zMultiDecoder.flushÇ   s8   € ØˆØ—]‘]ò 	6ˆEØ—<‘< Ó%¨¯©«Ñ5‰Dð	6àˆr   N)rf   ztyping.Sequence[ContentDecoder]r   r<   r   r   r=   r   r   r   rb   rb   µ   s   „ ñó1óô
r   rb   c                  ó*   — e Zd ZdZddd„Zdd„Zd	d„Zy)
ÚByteChunkerz>
    Handles returning byte content in fixed-size chunks.
    Nc                óD   — t        j                  «       | _        || _        y r   )rW   rX   Ú_bufferÚ_chunk_size©r   Ú
chunk_sizes     r   r-   zByteChunker.__init__Ó   s   € Ü—z‘z“|ˆŒØ%ˆÕr   c                ó¾  — | j                   €|r|gS g S | j                  j                  |«       | j                  j                  «       | j                   k\  �r| j                  j	                  «       }t        dt        |«      | j                   «      D �cg c]  }|||| j                   z    ‘Œ }}t        |d   «      | j                   k(  r7| j                  j                  d«       | j                  j                  «        |S | j                  j                  d«       | j                  j                  |d   «       | j                  j                  «        |d d S g S c c}w ©Nr   éÿÿÿÿ©	ro   rn   rY   Útellr]   ÚrangeÚlenÚseekÚtruncate©r   ÚcontentÚvalueÚiÚchunkss        r   r   zByteChunker.decode×   ó-  € Ø×ÑÐ#Ù '�G�9Ð/¨RÐ/à�‰×Ñ˜7Ô#Ø�<‰<×ÑÓ $×"2Ñ"2Ó2Ø—L‘L×)Ñ)Ó+ˆEô ˜q¤# e£*¨d×.>Ñ.>Ó?öàð �a˜!˜d×.Ñ.Ñ.Ò/ðˆFð ô �6˜"‘:‹ $×"2Ñ"2Ò2Ø—‘×!Ñ! !Ô$Ø—‘×%Ñ%Ô'Ø�à—‘×!Ñ! !Ô$Ø—‘×"Ñ" 6¨"¡:Ô.Ø—‘×%Ñ%Ô'Ø˜c˜r�{Ð"àˆIùòó   ÂEc                ó®   — | j                   j                  «       }| j                   j                  d«       | j                   j                  «        |r|gS g S ©Nr   ©rn   r]   ry   rz   ©r   r}   s     r   r   zByteChunker.flushî   óE   € Ø—‘×%Ñ%Ó'ˆØ�‰×Ñ˜!ÔØ�‰×ÑÔÙ�ˆwÐ' RÐ'r   r   ©rq   z
int | Noner   r<   )r|   r   r   úlist[bytes])r   rˆ   r=   r   r   r   rl   rl   Î   ó   „ ñô&óô.(r   rl   c                  ó*   — e Zd ZdZddd„Zdd„Zd	d„Zy)
ÚTextChunkerz>
    Handles returning text content in fixed-size chunks.
    Nc                óD   — t        j                  «       | _        || _        y r   )rW   ÚStringIOrn   ro   rp   s     r   r-   zTextChunker.__init__ú   s   € Ü—{‘{“}ˆŒØ%ˆÕr   c                ó¾  — | j                   €|r|gS g S | j                  j                  |«       | j                  j                  «       | j                   k\  �r| j                  j	                  «       }t        dt        |«      | j                   «      D �cg c]  }|||| j                   z    ‘Œ }}t        |d   «      | j                   k(  r7| j                  j                  d«       | j                  j                  «        |S | j                  j                  d«       | j                  j                  |d   «       | j                  j                  «        |d d S g S c c}w rs   ru   r{   s        r   r   zTextChunker.decodeþ   r€   r�   c                ó®   — | j                   j                  «       }| j                   j                  d«       | j                   j                  «        |r|gS g S rƒ   r„   r…   s     r   r   zTextChunker.flush  r†   r   r   r‡   )r|   r3   r   ú	list[str]©r   r�   r=   r   r   r   r‹   r‹   õ   r‰   r   r‹   c                  ó*   — e Zd ZdZddd„Zdd„Zd	d„Zy)
ÚTextDecoderz8
    Handles incrementally decoding bytes into text
    c                óF   —  t        j                  |«      d¬«      | _        y )NÚreplace)Úerrors)ÚcodecsÚgetincrementaldecoderÚdecoder)r   Úencodings     r   r-   zTextDecoder.__init__!  s   € Ø=”v×3Ñ3°HÓ=ÀYÔOˆ�r   c                ó8   — | j                   j                  |«      S r   ©r™   r   r   s     r   r   zTextDecoder.decode$  s   € Ø�|‰|×"Ñ" 4Ó(Ð(r   c                ó:   — | j                   j                  dd«      S rO   rœ   r   s    r   r   zTextDecoder.flush'  s   € Ø�|‰|×"Ñ" 3¨Ó-Ð-r   N)zutf-8)rš   r3   r   r<   )r   r   r   r3   )r   r3   r=   r   r   r   r“   r“     s   „ ñôPó)ô.r   r“   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚLineDecoderz—
    Handles incrementally reading lines from text.

    Has the same behaviour as the stdllib splitlines,
    but handling the input iteratively.
    c                ó    — g | _         d| _        y r/   )ÚbufferÚtrailing_crr   s    r   r-   zLineDecoder.__init__3  s   € Ø!#ˆŒØ!&ˆÕr   c                ó°  — d}| j                   rd|z   }d| _         |j                  d«      rd| _         |d d }|sg S |d   |v }|j                  «       }t        |«      dk(  r"|s | j                  j                  |d   «       g S | j                  r/dj                  | j                  «      |d   z   g|dd  z   }g | _        |s|j                  «       g| _        |S )	Nu   
Â…â€¨â€©úFTrt   r   r   Ú )r¢   ÚendswithÚ
splitlinesrx   r¡   ÚappendÚjoinÚpop)r   ÚtextÚNEWLINE_CHARSÚtrailing_newlineÚliness        r   r   zLineDecoder.decode7  sâ   € àBˆð ×ÒØ˜$‘;ˆDØ$ˆDÔØ�=‰=˜ÔØ#ˆDÔØ˜˜�9ˆDáð ˆIà ™8 }Ð4ÐØ—‘Ó!ˆäˆu‹:˜Š?Ñ#3à�K‰K×Ñ˜u Q™xÔ(ØˆIà�;Š;ð —W‘W˜TŸ[™[Ó)¨E°!©HÑ4Ð5¸¸a¸b¸	ÑAˆEØˆDŒKáð !Ÿ9™9›;˜-ˆDŒKàˆr   c                óŽ   — | j                   s| j                  sg S dj                  | j                   «      g}g | _         d| _        |S )Nr¥   F)r¡   r¢   r©   )r   r®   s     r   r   zLineDecoder.flush]  s?   € Ø�{Š{ 4×#3Ò#3ØˆIà—‘˜Ÿ™Ó%Ð&ˆØˆŒØ ˆÔØˆr   Nr;   )r«   r3   r   r�   r‘   r=   r   r   r   rŸ   rŸ   +  s   „ ñó'ó$ôLr   rŸ   )ÚidentityÚgzipÚdeflateÚbrr   r³   r   )r%   Ú
__future__r   r—   rW   Útypingr*   Ú_compatr   r   Ú_exceptionsr   r	   r!   r'   r?   rF   rS   rb   rl   r‹   r“   rŸ   ÚSUPPORTED_DECODERSrª   r   r   r   ú<module>r¹      sæ   ðñõ #ã Û 	Û Û ç !Ý &÷$ñ $ô	�nô 	ô3�^ô 3ô:3�.ô 3ô.23�Nô 23ôj#�~ô #ôL�>ô ÷2$(ñ $(÷N$(ñ $(÷N.ñ .÷9ñ 9ðz  ØØØ
ØñÐ ð 
€>Ø×Ñ˜4Ô Ø€<Ø×Ñ˜6Õ"ð r   