
    e1                         U d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z
 er ededef         Zeegef   ed<   n	 d dlmZ eegee
   f   Zeeegee
   f   Zd
ee   defdZy# e$ r d	 ZY -w xY w)    )TYPE_CHECKINGAny	AwaitableCallableIterableTypeVar)Request)StreamResponseF.)bound
middleware)r   c                     | S )N )xs    4/usr/lib/python3/dist-packages/blackd/middlewares.py<lambda>r      s    q     allow_headersreturnc                 J     t         dt        dt        dt        f fd       }|S )Nrequesthandlerr   c                   K   | j                   dk(  }|xr d| j                  v }|rt               }n ||        d {   }| j                  j                  d      }|s|S d|j                  d<   d|j                  d<   |r<dj	                        |j                  d<   dj	                  d	      |j                  d
<   |S 7 w)NOPTIONSzAccess-Control-Request-MethodOrigin*zAccess-Control-Allow-OriginzAccess-Control-Expose-Headersz, zAccess-Control-Allow-Headers)r   POSTzAccess-Control-Allow-Methods)methodheadersr
   getjoin)r   r   
is_optionsis_preflightresporiginr   s         r   implzcors.<locals>.impl   s     ^^y0
!X&E&X!#D ))D$$X.K69238;45;?99];SDLL78;?99#<DLL78  *s   :CB?BC)r   r	   Handlerr
   )r   r&   s   ` r   corsr(      s1    G g .  , Kr   N)typingr   r   r   r   r   r   aiohttp.web_requestr	   aiohttp.web_responser
   r   __annotations__aiohttp.web_middlewaresr   ImportErrorr'   
Middlewarestrr(   r   r   r   <module>r1      s    M M M ' /8CH-.A!a  !6 G9i77
8w()N*CCD
 *   ! !
!s   A% %A0/A0