
    hE                        S SK r S SKJrJrJrJr  SSKJrJr  SSK	J
r
Jr  SSKJr  SSKJr  SSKJr  S	r\(       a  SS
KJr  \" S5      rS\S\S\\\4   4S jrS\S\4S jrSSS\S.S\S\S\S\\
   S\4
S jjrSSS\4S jrg)    N)TYPE_CHECKINGTupleTypeTypeVar   )Handler
Middleware)HTTPMoveHTTPPermanentRedirect)Request)StreamResponse)SystemRoute)
middlewarenormalize_path_middleware)Application_Funcrequestpathreturnc                    #    U R                  US9nU R                  R                  R                  U5      I S h  vN nX2l        UR
                  c  SU4$ SU 4$  N7f)N)rel_urlTF)cloneapprouterresolve_match_infohttp_exception)r   r   alt_request
match_infos       I/var/www/html/env/lib/python3.13/site-packages/aiohttp/web_middlewares.py_check_request_resolvesr!      s^     ----K{{))11+>>J(  ([  '> ?s   8AA Afc                     SU l         U $ )Nr   )__middleware_version__)r"   s    r    r   r   !   s     AH    TF)append_slashremove_slashmerge_slashesredirect_classr&   r'   r(   r)   c                    ^ ^^^ T =(       a    T(       + nU(       d   S5       e[         S[        S[        S[        4U UUU4S jj5       nU$ )a,  Factory for producing a middleware that normalizes the path of a request.

Normalizing means:
    - Add or remove a trailing slash to the path.
    - Double slashes are replaced by one.

The middleware returns as soon as it finds a path that resolves
correctly. The order if both merge and append/remove are enabled is
    1) merge slashes
    2) append/remove slash
    3) both merge slashes and append/remove slash.
If the path resolves with at least one of those conditions, it will
redirect to the new path.

Only one of `append_slash` and `remove_slash` can be enabled. If both
are `True` the factory will raise an assertion error

If `append_slash` is `True` the middleware will append a slash when
needed. If a resource is defined with trailing slash and the request
comes without it, it will append it automatically.

If `remove_slash` is `True`, `append_slash` must be `False`. When enabled
the middleware will remove trailing slashes and redirect if the resource
is defined

If merge_slashes is True, merge multiple consecutive slashes in the
path into one.
z#Cannot both remove and append slashr   handlerr   c                   >#    [        U R                  R                  [        5      (       Ga  / nSU R                  ;   a$  U R                  R                  SS5      u  p4SU-   nOSnU R                  nT(       a'  UR                  [        R                  " SSU5      5        T(       a4  U R                  R                  S5      (       d  UR                  US-   5        T
(       a4  U R                  R                  S5      (       a  UR                  US S 5        T(       a1  T(       a*  UR                  [        R                  " SSUS-   5      5        T(       a3  T
(       a,  [        R                  " SSU5      nUR                  US S 5        U HL  n[        R                  " SSU5      n[        X5      I S h  vN u  p`U(       d  M9  T	" U R                  U-   5      e   U" U 5      I S h  vN $  N6 N7f)N?r    z//+/z^//+)
isinstancer   router   raw_pathsplitappendresubr   endswithr!   )r   r+   paths_to_checkr   querymerged_slashesresolvesr&   r(   r)   r'   s          r    impl'normalize_path_middleware.<locals>.implL   s    g((..<<Ng&&&%..44S!<e''%%bffUC&>?GLL$9$9#$>$>%%dSj1 5 5c : :%%d3Bi0%%bffUC&DE!#sD!9%%nSb&9:&vvfc40*A'*P$P!8()9)9E)ABB	 ' W%%%	 %Q &s*   F0G.3G*4G."G.%G,&G.,G.r   r   r   r   )r&   r'   r(   r)   correct_configurationr=   s   ````  r    r   r   &   sV    F ".!>,? G"GG &G &g &. & & &< Kr%   r   r   c                 N   ^  [         S[        S[        S[        4U 4S jj5       nU$ )Nr   r+   r   c                    >#    U R                   nUR                  nTUl         U" U 5      I S h  vN X2l        $  N
! X2l        f = f7f)N)r   current_app)r   r+   r   prevr   s       r    r=   &_fix_request_current_app.<locals>.implo   sF     ''
%%!$
	* ))%)" *%)"s%    A< :< A< AAr?   )r   r=   s   ` r    _fix_request_current_apprF   n   s1    *G *g *. * * Kr%   )r6   typingr   r   r   r   typedefsr   r	   web_exceptionsr
   r   web_requestr   web_responser   web_urldispatcherr   __all__web_appr   r   strboolr!   r   r   rF    r%   r    <module>rR      s    	 6 6 ) ;   ( *
 $	7 	# 	%gBV 	% E  %:EE E 	E
 NE EP- J r%   