
    )i6*                       S SK Jr  S SKrS SKrS SKJr  S SKrS SKJ	r	J
r
  S SKJrJrJrJrJrJr  S SKJr  S SKJrJrJr  S SKJrJrJrJr   S S	KJr  \R@                  (       a  S S
K!J"r"  1 Skr#SS jr$ " S S\%5      r& " S S\RN                  \(\RR                  4   5      r*SS jr+SS jr, " S S\*5      r-g! \ a    Sr Nof = f)    )annotationsN)cookies)AwaitableOrContextManager AwaitableOrContextManagerWrapper)URLAddressFormDataHeadersQueryParamsState)HTTPException)
FormParserMultiPartExceptionMultiPartParser)MessageReceiveScopeSend)parse_options_header)Router>   accept
user-agentcache-controlaccept-encodingaccept-languagec                   0 nU R                  S5       Hh  nSU;   a  UR                  SS5      u  p4OSUpCUR                  5       UR                  5       pCU(       d	  U(       d  MP  [        R                  " U5      X'   Mj     U$ )a  
This function parses a ``Cookie`` HTTP header into a dict of key/value pairs.

It attempts to mimic browser cookie parsing behavior: browsers and web servers
frequently disregard the spec (RFC 6265) when setting and reading cookies,
so we attempt to suit the common scenarios here.

This function has been adapted from Django 3.1.0.
Note: we are explicitly _NOT_ using `SimpleCookie.load` because it is based
on an outdated spec and will fail on lots of input we want to support
;=    )splitstriphttp_cookies_unquote)cookie_stringcookie_dictchunkkeyvals        R/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/starlette/requests.pycookie_parserr+   "   sw     #%K$$S)%<{{3*HC 599;		S##+44S9K *     c                      \ rS rSrSrg)ClientDisconnect=    N)__name__
__module____qualname____firstlineno____static_attributes__r0   r,   r*   r.   r.   =   s    r,   r.   c                  n   \ rS rSrSrSSS jjrSS jrSS jrSS jr\	R                  r
\	R                  r\SS j5       r\SS	 j5       r\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\S S j5       r\S!S j5       r\SS j5       r\SS j5       r\SS j5       r\S"S j5       rS#S jrSrg)$HTTPConnectionA   z
A base class for incoming HTTP connections, that is used to provide
any functionality that is common to both `Request` and `WebSocket`.
Nc                &    US   S;   d   eXl         g )Ntype)http	websocketscope)selfr>   receives      r*   __init__HTTPConnection.__init__G   s    V} 5555
r,   c                     U R                   U   $ Nr=   )r?   r(   s     r*   __getitem__HTTPConnection.__getitem__K   s    zz#r,   c                ,    [        U R                  5      $ rD   )iterr>   r?   s    r*   __iter__HTTPConnection.__iter__N   s    DJJr,   c                ,    [        U R                  5      $ rD   )lenr>   rI   s    r*   __len__HTTPConnection.__len__Q   s    4::r,   c                     U R                   S   $ )Nappr=   rI   s    r*   rQ   HTTPConnection.appZ   s    zz%  r,   c                l    [        U S5      (       d  [        U R                  S9U l        U R                  $ )N_urlr=   )hasattrr   r>   rT   rI   s    r*   urlHTTPConnection.url^   s)    tV$$$**-DIyyr,   c                   [        U S5      (       do  [        U R                  5      nUR                  SUR                  SS5      5      nUnUR	                  S5      (       d  US-  nX1S'   SUS'   X!S'   [        US	9U l        U R                  $ )
N	_base_urlapp_root_path	root_pathr    /pathr,   query_stringr=   )rU   dictr>   getendswithr   rY   )r?   base_url_scoperZ   r]   s       r*   base_urlHTTPConnection.base_urld   s    t[))!$**-N +..@R@RS^`b@cdM D==%%%)6"-0N>**7;' ~6DN~~r,   c                l    [        U S5      (       d  [        U R                  S9U l        U R                  $ )N_headersr=   )rU   r
   r>   rf   rI   s    r*   headersHTTPConnection.headersu   s)    tZ((#$**5DM}}r,   c                v    [        U S5      (       d  [        U R                  S   5      U l        U R                  $ )N_query_paramsr^   )rU   r   r>   rj   rI   s    r*   query_paramsHTTPConnection.query_params{   s1    t_--!,TZZ-G!HD!!!r,   c                :    U R                   R                  S0 5      $ )Npath_params)r>   r`   rI   s    r*   rn   HTTPConnection.path_params   s    zz~~mR00r,   c                    [        U S5      (       d5  0 nU R                  R                  S5      nU(       a  [        U5      nXl        U R                  $ )N_cookiescookie)rU   rg   r`   r+   rq   )r?   r   cookie_headers      r*   r   HTTPConnection.cookies   sD    tZ((&(G LL,,X6M'6#M}}r,   c                P    U R                   R                  S5      nUb  [        U6 $ g )Nclient)r>   r`   r   )r?   	host_ports     r*   rv   HTTPConnection.client   s*     JJNN8,	 I&&r,   c                N    SU R                   ;   d   S5       eU R                   S   $ )Nsessionz=SessionMiddleware must be installed to access request.sessionr=   rI   s    r*   rz   HTTPConnection.session   s)    DJJ&g(gg&zz)$$r,   c                N    SU R                   ;   d   S5       eU R                   S   $ )NauthzAAuthenticationMiddleware must be installed to access request.authr=   rI   s    r*   r}   HTTPConnection.auth   )    #h%hh#zz&!!r,   c                N    SU R                   ;   d   S5       eU R                   S   $ )NuserzAAuthenticationMiddleware must be installed to access request.userr=   rI   s    r*   r   HTTPConnection.user   r   r,   c                    [        U S5      (       d9  U R                  R                  S0 5        [        U R                  S   5      U l        U R                  $ )N_statestate)rU   r>   
setdefaultr   r   rI   s    r*   r   HTTPConnection.state   sD    tX&&JJ!!'2.  

7 34DK{{r,   c               x    U R                   S   nUR                  " U40 UD6nUR                  U R                  S9$ )Nrouter)rc   )r>   url_path_formake_absolute_urlrc   )r?   namern   r   url_paths        r*   url_forHTTPConnection.url_for   s=    H-&&t;{;))4==)AAr,   )rY   rq   rf   rj   r   rT   r>   rD   )r>   r   r@   zReceive | NonereturnNone)r(   strr   
typing.Any)r   ztyping.Iterator[str])r   intr   r   )r   r   )r   r
   )r   r   )r   zdict[str, typing.Any])r   dict[str, str])r   zAddress | None)r   r   )r   r   rn   r   r   r   )r1   r2   r3   r4   __doc__rA   rE   rJ   rN   object__eq____hash__propertyrQ   rV   rc   rg   rk   rn   r   rv   rz   r}   r   r   r   r5   r0   r,   r*   r7   r7   A   s#   
  ]]FH! !  
     
 " "
 1 1     % % " " " "  Br,   r7   c                     #    [        S5      e7f)Nz+Receive channel has not been made availableRuntimeErrorr0   r,   r*   empty_receiver      s     
D
EE   c                    #    [        S5      e7f)Nz(Send channel has not been made availabler   )messages    r*   
empty_sendr      s     
A
BBr   c                     ^  \ rS rSr% S\S'   \\4SU 4S jjjr\SS j5       r	\SS j5       r
SS jrSS jrSS	 jrS
S
S.SS jjrS
S
S.     SS jjrSS jrSS jrSS jrSrU =r$ )Request   zFormData | None_formc                |   > [         TU ]  U5        US   S:X  d   eX l        X0l        SU l        SU l        S U l        g )Nr:   r;   F)superrA   _receive_send_stream_consumed_is_disconnectedr   )r?   r>   r@   send	__class__s       r*   rA   Request.__init__   sC    V}&&&
 % %
r,   c                R    [         R                  " [        U R                  S   5      $ )Nmethod)typingcastr   r>   rI   s    r*   r   Request.method   s    {{3

8 455r,   c                    U R                   $ rD   )r   rI   s    r*   r@   Request.receive   s    }}r,   c                 #    [        U S5      (       a  U R                  7v   S7v   g U R                  (       a  [        S5      eU R                  (       d  U R	                  5       I S h  vN nUS   S:X  a=  UR                  SS5      nUR                  SS5      (       d  S	U l        U(       a  U7v   OUS   S
:X  a  S	U l        [        5       eU R                  (       d  M  S7v   g  N}7f)N_bodyr,   zStream consumedr:   zhttp.requestbody	more_bodyFThttp.disconnect)rU   r   r   r   r   r`   r   r.   )r?   r   r   s      r*   streamRequest.stream   s     4!!**I  011'' MMO+Gv.0{{63/{{;66,0D)J$55(,%&(( ''' 	 ,s   A'C))C'*A5C)!C)c                   #    [        U S5      (       d.  / nU R                  5         S h  vN nUR                  U5        M  U R                  $  N#
 SR                  U5      U l        N&7f)Nr   r,   )rU   r   appendjoinr   )r?   chunksr'   s      r*   r   Request.body   sT     tW%%"$F#{{} %ee$zz%}&)DJs%   $A(AAA A(AA(c                   #    [        U S5      (       d3  U R                  5       I S h  vN n[        R                  " U5      U l        U R                  $  N+7f)N_json)rU   r   jsonloadsr   )r?   r   s     r*   r   Request.json   s?     tW%%$DD)DJzz %s   %AA,Ai  	max_files
max_fieldsc                 #    U R                   c  [        c   S5       eU R                  R                  S5      n[        U5      u  pEUS:X  aN   [	        U R                  U R                  5       UUS9nUR                  5       I S h  vN U l         U R                   $ US:X  aM  [        U R                  U R                  5       5      nUR                  5       I S h  vN U l         U R                   $ [        5       U l         U R                   $  N! [         a+  nSU R                  ;   a  [        SUR                  S9eUeS nAff = f Nj7f)	NzEThe `python-multipart` library must be installed to use form parsing.zContent-Types   multipart/form-datar   rQ   i  )status_codedetails!   application/x-www-form-urlencoded)r   r   rg   r`   r   r   parser   r>   r   r   r   r	   )	r?   r   r   content_type_headercontent_type_multipart_parserexcform_parsers	            r*   	_get_formRequest._get_form   s+    ::$0WVW0"&,,"2"2>"B23FGOL55'6"+#-	($ (8'='='?!?DJ zz !EE(t{{}E#.#4#4#66
 zz &Z
zz "@) 

*+CKKPPI 7sI   A
E7D
 D	D
 A	EE0ED
 

D?&D::D??Ec               2    [        U R                  XS95      $ )Nr   )r   r   )r?   r   r   s      r*   formRequest.form  s     00jkkr,   c                p   #    U R                   b#  U R                   R                  5       I S h  vN   g g  N7frD   )r   closerI   s    r*   r   Request.close  s-     ::!**""$$$ "$s   +646c                2  #    U R                   (       dd  0 n[        R                  " 5        nUR                  5         U R	                  5       I S h  vN nS S S 5        UR                  S5      S:X  a  SU l         U R                   $  N4! , (       d  f       N8= f7f)Nr:   r   T)r   anyioCancelScopecancelr   r`   )r?   r   css      r*   is_disconnectedRequest.is_disconnected  st     $$!G ""$		 $/ % {{6"&77(,%$$$ 0 %$s.   )B$BBB0BB
BBc                N  #    SU R                   R                  S0 5      ;   a  / n[         HV  nU R                  R	                  U5       H4  nUR                  UR                  S5      UR                  S5      45        M6     MX     U R                  SXS.5      I S h  vN   g g  N7f)Nzhttp.response.push
extensionszlatin-1)r:   r]   rg   )r>   r`   SERVER_PUSH_HEADERS_TO_COPYrg   getlistr   encoder   )r?   r]   raw_headersr   values        r*   send_push_promiseRequest.send_push_promise(  s     4::>>,#CC57K3!\\11$7E&&I(>Y@W'XY 8 4 **&:Dabbb D
 cs   BB%B#B%)r   r   r   r   r   r   r   )r>   r   r@   r   r   r   )r   r   )r   r   )r   z"typing.AsyncGenerator[bytes, None])r   bytesr   )r   int | floatr   r   r   r	   )r   r   r   r   r   z#AwaitableOrContextManager[FormData])r   r   )r   bool)r]   r   r   r   )r1   r2   r3   r4   __annotations__r   r   rA   r   r   r@   r   r   r   r   r   r   r   r   r5   __classcell__)r   s   @r*   r   r      s    8ET^   6 6  ( ;?Z^ : +/$l'l<Gl	,l
%%c cr,   r   )r%   r   r   r   )r   typing.NoReturn)r   r   r   r   ).
__future__r   r   r   r;   r   r#   r   starlette._utilsr   r   starlette.datastructuresr   r   r	   r
   r   r   starlette.exceptionsr   starlette.formparsersr   r   r   starlette.typesr   r   r   r   multipart.multipartr   ModuleNotFoundErrorTYPE_CHECKINGstarlette.routingr   r   r+   	Exceptionr.   Mappingr   Anyr7   r   r   r   r0   r,   r*   <module>r     s    "   (  X X X . Q Q 9 9 8
 
( 6	y 	sBV^^CO4 sBlFCocn oc]    s   B9 9CC