§
    JŠtjM:  ã                  óÀ  — d dl m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 g d	¢Z d
j        ej        Ž Zej                             dde› de› �¦  «        Zej                             dde› de› �¦  «        Z eej                             dd¦  «        ¦  «        Z eej                             dd¦  «        ¦  «        Z eej                             dd¦  «        ¦  «        Zd-d„Z ej        d¦  «        Z ej        d¦  «        Z ej!         G d„ d¦  «        ¦   «         Z"ej!         G d„ d¦  «        ¦   «         Z#d.d#„Z$d/d%„Z%d0d,„Z&dS )1é    )ÚannotationsN)Ú	Generator)ÚCallableé   )ÚHeaders)ÚSecurityError)Úversion)ÚSERVERÚ
USER_AGENTÚRequestÚResponsez{}.{}ÚWEBSOCKETS_USER_AGENTzPython/z websockets/ÚWEBSOCKETS_SERVERÚWEBSOCKETS_MAX_NUM_HEADERSÚ128ÚWEBSOCKETS_MAX_LINE_LENGTHÚ8192ÚWEBSOCKETS_MAX_BODY_SIZEÚ	1_048_576ÚvalueÚbytesÚreturnÚstrc                ó.   — |                       d¬¦  «        S )zG
    Decode a bytestring for interpolating into an error message.

    Úbackslashreplace©Úerrors)Údecode)r   s    úO/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/websockets/http11.pyÚdr    2   s   € ð
 �<Š<Ð1ˆ<Ñ2Ô2Ð2ó    s   [-!#$%&\'*+.^_`|~0-9a-zA-Z]+s   [\x09\x20-\x7e\x80-\xff]*c                  ón   — e Zd ZU dZded<   ded<   dZded<   edd
„¦   «         Zedd„¦   «         Z	dd„Z
dS )r   z�
    WebSocket handshake request.

    Attributes:
        path: Request path, including optional query.
        headers: Request headers.
    r   Úpathr   ÚheadersNúException | NoneÚ
_exceptionr   c                óD   — t          j        dt          ¦  «         | j        S )NzIRequest.exception is deprecated; use ServerProtocol.handshake_exc instead©ÚwarningsÚwarnÚDeprecationWarningr&   ©Úselfs    r   Ú	exceptionzRequest.exception^   s&   € åŒØWÝñ	
ô 	
ð 	
ð ŒÐr!   Ú	read_lineú-Callable[[int], Generator[None, None, bytes]]úGenerator[None, None, Request]c              #  óZ  K  — 	 t          |¦  «        E d{V —†}n"# t          $ r}t          d¦  «        |‚d}~ww xY w	 |                     dd¦  «        \  }}}n.# t          $ r! t          dt	          |¦  «        › �¦  «        d‚w xY w|dk    rt          dt	          |¦  «        › �¦  «        ‚|dk    rt          d	t	          |¦  «        › �¦  «        ‚|                     d
d¦  «        }t          |¦  «        E d{V —†}d|v rt          d¦  «        ‚d|v rt          d¦  «        ‚ | ||¦  «        S )a©  
        Parse a WebSocket handshake request.

        This is a generator-based coroutine.

        The request path isn't URL-decoded or validated in any way.

        The request path and headers are expected to contain only ASCII
        characters. Other characters are represented with surrogate escapes.

        :meth:`parse` doesn't attempt to read the request body because
        WebSocket handshake requests don't have one. If the request contains a
        body, it may be read from the data stream after :meth:`parse` returns.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data

        Raises:
            EOFError: If the connection is closed without a full HTTP request.
            SecurityError: If the request exceeds a security limit.
            ValueError: If the request isn't well formatted.

        Nz1connection closed while reading HTTP request lineó    é   zinvalid HTTP request line: ó   HTTP/1.1ú)unsupported protocol; expected HTTP/1.1: s   GETz+unsupported HTTP method; expected GET; got ÚasciiÚsurrogateescapeúTransfer-Encodingz!transfer codings aren't supportedúContent-Lengthzunsupported request body)Ú
parse_lineÚEOFErrorÚsplitÚ
ValueErrorr    r   Úparse_headersÚNotImplementedError)	Úclsr/   Úrequest_lineÚexcÚmethodÚraw_pathÚprotocolr#   r$   s	            r   ÚparsezRequest.parsef   s™  è è € ðF	YÝ&0°Ñ&;Ô&;Ð;Ð;Ð;Ð;Ð;Ð;ˆLˆLøÝð 	Yð 	Yð 	YÝÐNÑOÔOÐUXÐXøøøøð	Yøøøð	XØ)5×);Ò);¸DÀ!Ñ)DÔ)DÑ&ˆF�H˜h˜høÝð 	Xð 	Xð 	XÝÐL½1¸\¹?¼?ÐLÐLÑMÔMÐSWÐWð	Xøøøà�{Ò"Ð"ÝØM½A¸l¹O¼OÐMÐMñô ð ð �VÒÐÝÐVÍ1ÈVÉ9Ì9ÐVÐVÑWÔWÐWØ�Š˜wÐ(9Ñ:Ô:ˆå*¨9Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5ˆð  'Ð)Ð)Ý%Ð&IÑJÔJÐJà˜wÐ&Ð&ÝÐ7Ñ8Ô8Ð8àˆs�4˜Ñ!Ô!Ð!s   „ š
9¤4´9½A Á+Br   c                óx   — d| j         › d�                     ¦   «         }|| j                             ¦   «         z  }|S )z;
        Serialize a WebSocket handshake request.

        zGET z HTTP/1.1
)r#   Úencoder$   Ú	serialize)r-   Úrequests     r   rJ   zRequest.serialize¦   s?   € ð 2˜œÐ1Ð1Ð1×8Ò8Ñ:Ô:ˆØ�4”<×)Ò)Ñ+Ô+Ñ+ˆØˆr!   ©r   r%   )r/   r0   r   r1   ©r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r&   Úpropertyr.   ÚclassmethodrG   rJ   © r!   r   r   r   N   s�   € € € € € € ðð ð €I€I�IØÐÐÑð $(€JÐ'Ð'Ð'Ñ'àðð ð ñ „Xðð ð="ð ="ð ="ñ „[ð="ð~	ð 	ð 	ð 	ð 	ð 	r!   r   c                  óŠ   — e Zd ZU dZded<   ded<   ded<   dZd	ed
<   dZded<   edd„¦   «         Ze		 ddd„¦   «         Z
dd„ZdS )r   zÅ
    WebSocket handshake response.

    Attributes:
        status_code: Response code.
        reason_phrase: Response reason.
        headers: Response headers.
        body: Response body.

    ÚintÚstatus_coder   Úreason_phraser   r$   r!   r   ÚbodyNr%   r&   r   c                óD   — t          j        dt          ¦  «         | j        S )NzJResponse.exception is deprecated; use ClientProtocol.handshake_exc insteadr(   r,   s    r   r.   zResponse.exceptionÆ   s(   € åŒð7åñ	
ô 	
ð 	
ð
 ŒÐr!   Tr/   r0   Ú
read_exactÚread_to_eofÚinclude_bodyÚboolúGenerator[None, None, Response]c              #  óP  K  — 	 t          |¦  «        E d{V —†}n"# t          $ r}t          d¦  «        |‚d}~ww xY w	 |                     dd¦  «        \  }}}	n.# t          $ r! t          dt	          |¦  «        › �¦  «        d‚w xY w|dk    rt          dt	          |¦  «        › �¦  «        ‚	 t          |¦  «        }
n.# t          $ r! t          dt	          |¦  «        › �¦  «        d‚w xY wd	|
cxk    rd
k     s!n t          dt	          |¦  «        › �¦  «        ‚t                               |	¦  «        st          dt	          |	¦  «        › �¦  «        ‚|	                     dd¦  «        }t          |¦  «        E d{V —†}|rt          |
||||¦  «        E d{V —†}nd} | |
|||¦  «        S )aÂ  
        Parse a WebSocket handshake response.

        This is a generator-based coroutine.

        The reason phrase and headers are expected to contain only ASCII
        characters. Other characters are represented with surrogate escapes.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data.
            read_exact: Generator-based coroutine that reads the requested
                bytes or raises an exception if there isn't enough data.
            read_to_eof: Generator-based coroutine that reads until the end
                of the stream.

        Raises:
            EOFError: If the connection is closed without a full HTTP response.
            SecurityError: If the response exceeds a security limit.
            LookupError: If the response isn't well formatted.
            ValueError: If the response isn't well formatted.

        Nz0connection closed while reading HTTP status liner3   r4   zinvalid HTTP status line: r5   r6   z+invalid status code; expected integer; got éd   iX  u-   invalid status code; expected 100â€“599; got zinvalid HTTP reason phrase: r7   r8   r!   )r;   r<   r=   r>   r    rW   Ú	_value_reÚ	fullmatchr   r?   Ú	read_body)rA   r/   r\   r]   r^   Ústatus_linerC   rF   Úraw_status_codeÚ
raw_reasonrX   Úreasonr$   rZ   s                 r   rG   zResponse.parseÏ   s[  è è € ðB	XÝ%/°	Ñ%:Ô%:Ð:Ð:Ð:Ð:Ð:Ð:ˆKˆKøÝð 	Xð 	Xð 	XÝÐMÑNÔNÐTWÐWøøøøð	Xøøøð	VØ4?×4EÒ4EÀdÈAÑ4NÔ4NÑ1ˆH�o z zøÝð 	Vð 	Vð 	VÝÐJ½!¸K¹.¼.ÐJÐJÑKÔKÐQUÐUð	Vøøøà�{Ò"Ð"ÝØL½A¸k¹N¼NÐLÐLñô ð ð	Ý˜oÑ.Ô.ˆKˆKøÝð 	ð 	ð 	ÝØR½aÀÑ>PÔ>PÐRÐRñô àðð	øøøð �kÐ'Ð'Ò'Ð' CÒ'Ð'Ð'Ð'ÝØTÅÀ/Ñ@RÔ@RÐTÐTñô ð õ ×"Ò" :Ñ.Ô.ð 	MÝÐK½A¸j¹M¼MÐKÐKÑLÔLÐLØ×"Ò" 7Ð,=Ñ>Ô>ˆå*¨9Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5ˆàð 	Ý'Ø˜W i°¸[ñô ð ð ð ð ð ð ˆDˆDð ˆDàˆs�; ¨°Ñ6Ô6Ð6s'   „ š
9¤4´9½A Á+BÂ,B< Â<+C'c                óœ   — d| j         › d| j        › d�                     ¦   «         }|| j                             ¦   «         z  }|| j        z  }|S )z<
        Serialize a WebSocket handshake response.

        z	HTTP/1.1 ú z
)rX   rY   rI   r$   rJ   rZ   )r-   Úresponses     r   rJ   zResponse.serialize  sX   € ð K˜tÔ/ÐJÐJ°$Ô2DÐJÐJÐJ×QÒQÑSÔSˆØ�D”L×*Ò*Ñ,Ô,Ñ,ˆØ�D”IÑˆØˆr!   rL   )T)
r/   r0   r\   r0   r]   r0   r^   r_   r   r`   rM   )rN   rO   rP   rQ   rR   rZ   r&   rS   r.   rT   rG   rJ   rU   r!   r   r   r   ²   sÊ   € € € € € € ð	ð 	ð ÐÐÑØÐÐÑØÐÐÑØ€DÐÐÐÑà#'€JÐ'Ð'Ð'Ñ'àðð ð ñ „Xðð ð "ðD7ð D7ð D7ð D7ñ „[ðD7ðL
ð 
ð 
ð 
ð 
ð 
r!   r   r/   r0   úGenerator[None, None, bytes]c              #  óÌ   K  — 	  | t           ¦  «        E d{V —†}n# t          $ r t          d¦  «        ‚w xY w|                     d¦  «        st	          d¦  «        ‚|dd…         S )ao  
    Parse a single line.

    CRLF is stripped from the return value.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.

    Raises:
        EOFError: If the connection is closed without a CRLF.
        SecurityError: If the response exceeds a security limit.

    Nzline too longó   
zline without CRLFéþÿÿÿ)ÚMAX_LINE_LENGTHÚRuntimeErrorr   Úendswithr<   )r/   Úlines     r   r;   r;   #  sŠ   è è € ð"-Ø#˜)¥OÑ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4ˆˆøÝð -ð -ð -Ý˜OÑ,Ô,Ð,ð-øøøð �=Š=˜Ñ!Ô!ð ,ÝÐ*Ñ+Ô+Ð+Ø���Œ9Ðs   „ ›5úGenerator[None, None, Headers]c              #  ó   K  — t          ¦   «         }t          t          dz   ¦  «        D �]E}	 t          | ¦  «        E d{V —†}n"# t          $ r}t	          d¦  «        |‚d}~ww xY w|dk    r �n	 |                     dd¦  «        \  }}n.# t          $ r! t          dt          |¦  «        › �¦  «        d‚w xY wt           	                    |¦  «        st          dt          |¦  «        › �¦  «        ‚| 
                    d¦  «        }t           	                    |¦  «        st          d	t          |¦  «        › �¦  «        ‚|                     d
¦  «        }|                     d
d¦  «        }|||<   �ŒGt          d¦  «        ‚|S )aÅ  
    Parse HTTP headers.

    Non-ASCII characters are represented with surrogate escapes.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.

    Raises:
        EOFError: If the connection is closed without complete headers.
        SecurityError: If the request exceeds a security limit.
        ValueError: If the request isn't well formatted.

    r   Nz,connection closed while reading HTTP headersr!   ó   :zinvalid HTTP header line: zinvalid HTTP header name: s    	zinvalid HTTP header value: r7   r8   ztoo many HTTP headers)r   ÚrangeÚMAX_NUM_HEADERSr;   r<   r=   r>   r    Ú	_token_rerd   Ústriprc   r   r   )	r/   r$   Ú_rt   rC   Úraw_nameÚ	raw_valueÚnamer   s	            r   r?   r?   >  s¶  è è € õ, ‰iŒi€GÝ•? QÑ&Ñ'Ô'ð 5ñ 5ˆð	TÝ(¨Ñ3Ô3Ð3Ð3Ð3Ð3Ð3Ð3ˆDˆDøÝð 	Tð 	Tð 	TÝÐIÑJÔJÐPSÐSøøøøð	Tøøøà�3Š;ˆ;Ø‰Eð	OØ"&§*¢*¨T°1Ñ"5Ô"5ÑˆH�i�iøÝð 	Oð 	Oð 	OÝÐC½!¸D¹'¼'ÐCÐCÑDÔDÈ$ÐNð	Oøøøå×"Ò" 8Ñ,Ô,ð 	IÝÐG½!¸H¹+¼+ÐGÐGÑHÔHÐHØ—O’O FÑ+Ô+ˆ	Ý×"Ò" 9Ñ-Ô-ð 	KÝÐI½1¸Y¹<¼<ÐIÐIÑJÔJÐJà�Š˜wÑ'Ô'ˆØ× Ò  Ð*;Ñ<Ô<ˆØˆ�‰‰õ Ð3Ñ4Ô4Ð4à€Ns#   ¬AÁ
A!ÁAÁA!Á.BÂ+B3rX   rW   r$   r   r\   r]   c              #  ó<  K  — d| cxk    rdk     sn | dk    s| dk    rdS |                      d¦  «        x}��.|dk    rt          d|› d	�¦  «        ‚d}	 t          |¦  «        E d {V —†}|                     dd¦  «        d         }t	          |¦  «        dk    r)|                     d¬¦  «        }	t          d|	› d�¦  «        ‚t          |d¦  «        }
|
dk    rnwt	          |¦  «        |
z   t          k    r#t          d|
› dt	          |¦  «        › d�¦  «        ‚| ||
¦  «        E d {V —†z  } |d¦  «        E d {V —†dk    rt          d¦  «        ‚Œût          |¦  «        E d {V —† |S |                      d¦  «        x}�dt	          |¦  «        dk    rt          d|› d�¦  «        ‚t          |¦  «        }|t          k    rt          d|› d�¦  «        ‚ ||¦  «        E d {V —†S 	  |t          ¦  «        E d {V —†S # t          $ r t          dt          › d�¦  «        ‚w xY w)Nrb   éÈ   éÌ   i0  r!   r9   Úchunkedztransfer coding z isn't supportedTó   ;r   r   é   r   r   zchunk too large: 0xz bytesé   zchunk too large: z bytes after r4   ro   zchunk without CRLFr:   é   zbody too large: zbody too large: over )Úgetr@   r;   r=   Úlenr   r   rW   ÚMAX_BODY_SIZEr>   r?   rr   )rX   r$   r/   r\   r]   ÚcodingrZ   Úchunk_size_lineÚraw_chunk_sizeÚstr_chunk_sizeÚ
chunk_sizeÚraw_content_lengthÚcontent_lengths                r   re   re   q  së  è è € ð ˆkÐÐÒÐ˜CÒÐÐÐ ;°#Ò#5Ð#5¸ÈÒ9KÐ9KØˆsð —K’KÐ 3Ñ4Ô4Ð
4ˆ&Ñ	AØ�YÒÐÝ%Ð&Q¸Ð&QÐ&QÐ&QÑRÔRÐRàˆð	7Ý)3°IÑ)>Ô)>Ð>Ð>Ð>Ð>Ð>Ð>ˆOØ,×2Ò2°4¸Ñ;Ô;¸AÔ>ˆNå�>Ñ"Ô" RÒ'Ð'Ø!/×!6Ò!6Ð>PÐ!6Ñ!QÔ!Q�Ý#Ð$P¸.Ð$PÐ$PÐ$PÑQÔQÐQÝ˜^¨RÑ0Ô0ˆJØ˜QŠˆØÝ�4‰yŒy˜:Ñ%­Ò5Ð5Ý#ØR¨
ÐRÐRÅÀTÁÄÐRÐRÐRñô ð ð ˜z˜z¨*Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5Ñ5ˆDØ%˜: a™=œ=Ð(Ð(Ð(Ð(Ð(Ð(¨WÒ4Ð4Ý Ð!5Ñ6Ô6Ð6ð!	7õ$ ! Ñ+Ô+Ð+Ð+Ð+Ð+Ð+Ð+Ð+Øˆà '§¢Ð,<Ñ =Ô =Ð
=Ð
Ð	JåÐ!Ñ"Ô" RÒ'Ð'ÝÐ MÐ3EÐ MÐ MÐ MÑNÔNÐNÝÐ/Ñ0Ô0ˆØ�MÒ)Ð)ÝÐ I°>Ð IÐ IÐ IÑJÔJÐJØ%˜: nÑ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5Ð6ð	OØ*˜{­=Ñ9Ô9Ð9Ð9Ð9Ð9Ð9Ð9Ð:øÝð 	Oð 	Oð 	OÝÐ M½Ð MÐ MÐ MÑNÔNÐNð	Oøøøs   Ç"G8 Ç8#H)r   r   r   r   )r/   r0   r   rm   )r/   r0   r   ru   )rX   rW   r$   r   r/   r0   r\   r0   r]   r0   r   rm   )'Ú
__future__r   ÚdataclassesÚosÚreÚsysr)   Úcollections.abcr   Útypingr   Údatastructuresr   Ú
exceptionsr   r	   Úwebsockets_versionÚ__all__ÚformatÚversion_infoÚPYTHON_VERSIONÚenvironrˆ   r   r
   rW   ry   rq   rŠ   r    Úcompilerz   rc   Ú	dataclassr   r   r;   r?   re   rU   r!   r   ú<module>r£      s’  ðØ "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð à #Ð #Ð #Ð #Ð #Ð #Ø %Ð %Ð %Ð %Ð %Ð %Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2ðð ð €ð  �” Ô!1Ð2€ð ŒZ�^Š^ØØ>ˆnÐ>Ð>Ð*<Ð>Ð>ñô €
ð 
Œ�ŠØØ>ˆnÐ>Ð>Ð*<Ð>Ð>ñ
ô 
€ð �#�b”j—n’nÐ%AÀ5ÑIÔIÑJÔJ€ð �#�b”j—n’nÐ%AÀ6ÑJÔJÑKÔK€ð ��B”J—N’NÐ#=¸{ÑKÔKÑLÔL€ð3ð 3ð 3ð 3ð ˆBŒJÐ7Ñ8Ô8€	ð ˆBŒJÐ4Ñ5Ô5€	ð Ôð`ð `ð `ð `ð `ñ `ô `ñ Ôð`ðF Ôðmð mð mð mð mñ mô mñ Ôðmð`ð ð ð ð60ð 0ð 0ð 0ðf:Oð :Oð :Oð :Oð :Oð :Or!   