Ë
    ùeœik(  ã                  ó  — d dl mZ d dlZd dlmZmZmZmZ d dlm	Z	m
Z
mZ d dlmZmZ d dlmZm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 d dlmZmZ d dlm Z m!Z!m"Z"m#Z#m$Z$m%Z% d dl&m'Z'  edd¬«      Z( e
d«      Z) G d„ d«      Z*y)é    )ÚannotationsN)Ú	AwaitableÚCallableÚMappingÚSequence)ÚAnyÚ	ParamSpecÚTypeVar)ÚStateÚURLPath)Ú
MiddlewareÚ_MiddlewareFactory)ÚBaseHTTPMiddleware)ÚServerErrorMiddleware)ÚExceptionMiddleware)ÚRequest)ÚResponse)Ú	BaseRouteÚRouter)ÚASGIAppÚExceptionHandlerÚLifespanÚReceiveÚScopeÚSend)Ú	WebSocketÚAppTypeÚ	Starlette)ÚboundÚPc                  óL  — e Zd ZdZ	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zedd„«       Zdd„Zdd„Z	dd„Z
ddd	„Zddd
„Z	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 dd„Z	 	 	 	 	 	 d d„Z	 	 	 d!	 	 	 	 	 	 	 	 	 	 	 d"d„Z	 d	 	 	 	 	 	 	 d#d„Zd$d„Z	 	 	 d!	 	 	 	 	 	 	 	 	 d%d„Zdd&d„Zd'd„Zy)(r   z!Creates an Starlette application.Nc                óÐ   — |�|€|�J d«       ‚|| _         t        «       | _        t        ||||¬«      | _        |€i n
t        |«      | _        |€g n
t        |«      | _        d| _	        y)aø  Initializes the application.

        Parameters:
            debug: Boolean indicating if debug tracebacks should be returned on errors.
            routes: A list of routes to serve incoming HTTP and WebSocket requests.
            middleware: A list of middleware to run for every request. A starlette
                application will always automatically include two middleware classes.
                `ServerErrorMiddleware` is added as the very outermost middleware, to handle
                any uncaught errors occurring anywhere in the entire stack.
                `ExceptionMiddleware` is added as the very innermost middleware, to deal
                with handled exception cases occurring in the routing or endpoints.
            exception_handlers: A mapping of either integer status codes,
                or exception class types onto callables which handle the exceptions.
                Exception handler callables should be of the form
                `handler(request, exc) -> response` and may be either standard functions, or
                async functions.
            on_startup: A list of callables to run on application startup.
                Startup handler callables do not take any arguments, and may be either
                standard functions, or async functions.
            on_shutdown: A list of callables to run on application shutdown.
                Shutdown handler callables do not take any arguments, and may be either
                standard functions, or async functions.
            lifespan: A lifespan context function, which can be used to perform
                startup and shutdown tasks. This is a newer style that replaces the
                `on_startup` and `on_shutdown` handlers. Use one or the other, not both.
        Nz>Use either 'lifespan' or 'on_startup'/'on_shutdown', not both.)Ú
on_startupÚon_shutdownÚlifespan)
Údebugr   Ústater   ÚrouterÚdictÚexception_handlersÚlistÚuser_middlewareÚmiddleware_stack)Úselfr&   ÚroutesÚ
middlewarer*   r#   r$   r%   s           úk/var/www/html/Whatsapp_Customer_Support_Chatbot/venv/lib/python3.12/site-packages/starlette/applications.pyÚ__init__zStarlette.__init__   s{   € ðL Ð JÐ$6¸;Ð;Nð 	
ØLó	
ÐOð ˆŒ
Ü“WˆŒ
Ü˜V°
ÈÐ^fÔgˆŒØ(:Ð(B¡"ÌÐM_ÓH`ˆÔØ%/Ð%7™r¼TÀ*Ó=MˆÔØ04ˆÕó    c                óN  — | j                   }d }i }| j                  j                  «       D ]  \  }}|dt        fv r|}Œ|||<   Œ t	        t
        ||¬«      g| j                  z   t	        t        ||¬«      gz   }| j                  }t        |«      D ]  \  }}	}
 ||g|	¢­i |
¤Ž}Œ |S )Niô  )Úhandlerr&   )Úhandlersr&   )
r&   r*   ÚitemsÚ	Exceptionr   r   r,   r   r(   Úreversed)r.   r&   Úerror_handlerr*   ÚkeyÚvaluer0   ÚappÚclsÚargsÚkwargss              r1   Úbuild_middleware_stackz Starlette.build_middleware_stackJ   sÑ   € Ø—
‘
ˆØˆØ:<Ðà×1Ñ1×7Ñ7Ó9ò 	0‰JˆC�Ø�sœIÐ&Ñ&Ø %‘à*/Ð" 3Ò'ð		0ô Ô-°}ÈEÔRÐSØ×"Ñ"ñ#äÔ-Ð8JÐRWÔXÐYñZð 	ð �k‰kˆÜ!)¨*Ó!5ò 	,ÑˆC��vÙ�cÐ+˜DÒ+ FÑ+‰Cð	,àˆ
r3   c                ó.   — | j                   j                  S ©N)r(   r/   )r.   s    r1   r/   zStarlette.routes`   s   € à�{‰{×!Ñ!Ð!r3   c               ó<   —  | j                   j                  |fi |¤ŽS rC   )r(   Úurl_path_for)r.   ÚnameÚpath_paramss      r1   rE   zStarlette.url_path_ford   s   € Ø'ˆt�{‰{×'Ñ'¨Ñ<°Ñ<Ð<r3   c              ƒ  ó’   K  — | |d<   | j                   €| j                  «       | _         | j                  |||«      ƒ d {  –—†  y 7 Œ­w)Nr=   )r-   rA   )r.   ÚscopeÚreceiveÚsends       r1   Ú__call__zStarlette.__call__g   sD   è ø€ Øˆˆe‰Ø× Ñ Ð(Ø$(×$?Ñ$?Ó$AˆDÔ!Ø×#Ñ# E¨7°DÓ9×9Ò9ús   ‚=A¿AÁ Ac                ó8   — | j                   j                  |«      S rC   )r(   Úon_event)r.   Ú
event_types     r1   rN   zStarlette.on_eventm   s   € Ø�{‰{×#Ñ# JÓ/Ð/r3   c                ó@   — | j                   j                  |||¬«       y ©N)r=   rF   )r(   Úmount)r.   Úpathr=   rF   s       r1   rR   zStarlette.mountp   s   € Ø�‰×Ñ˜$ C¨dÐÕ3r3   c                ó@   — | j                   j                  |||¬«       y rQ   )r(   Úhost)r.   rU   r=   rF   s       r1   rU   zStarlette.hosts   s   € Ø�‰×Ñ˜ 3¨TÐÕ2r3   c                ó„   — | j                   �t        d«      ‚| j                  j                  dt	        |g|¢­i |¤Ž«       y )Nz6Cannot add middleware after an application has startedr   )r-   ÚRuntimeErrorr,   Úinsertr   )r.   Úmiddleware_classr?   r@   s       r1   Úadd_middlewarezStarlette.add_middlewarev   sB   € ð × Ñ Ð,ÜÐWÓXÐXØ×Ñ×#Ñ# A¤zÐ2BÐ'TÀTÒ'TÈVÑ'TÕUr3   c                ó"   — || j                   |<   y rC   )r*   )r.   Úexc_class_or_status_coder5   s      r1   Úadd_exception_handlerzStarlette.add_exception_handler€   s   € ð
 =Dˆ×ÑÐ 8Ò9r3   c                ó<   — | j                   j                  ||«       y rC   )r(   Úadd_event_handler)r.   rO   Úfuncs      r1   r_   zStarlette.add_event_handler‡   s   € ð
 	�‰×%Ñ% j°$Õ7r3   c                óD   — | j                   j                  |||||¬«       y ©N)ÚmethodsrF   Úinclude_in_schema©r(   Ú	add_route)r.   rS   Úrouterc   rF   rd   s         r1   rf   zStarlette.add_routeŽ   s"   € ð 	�‰×Ñ˜d E°7ÀÐYjÐÕkr3   c                ó@   — | j                   j                  |||¬«       y ©N)rF   ©r(   Úadd_websocket_route)r.   rS   rg   rF   s       r1   rk   zStarlette.add_websocket_route˜   s   € ð 	�‰×'Ñ'¨¨e¸$Ð'Õ?r3   c                óL   ‡ ‡— t        j                  dt        «       dˆˆ fd„}|S )NzŸThe `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/exceptions/ for the recommended approach.c                ó,   •— ‰j                  ‰| «       | S rC   )r]   )r`   r\   r.   s    €€r1   Ú	decoratorz.Starlette.exception_handler.<locals>.decorator§   s   ø€ Ø×&Ñ&Ð'?ÀÔFØˆKr3   ©r`   r   Úreturnr   ©ÚwarningsÚwarnÚDeprecationWarning)r.   r\   rn   s   `` r1   Úexception_handlerzStarlette.exception_handler    s%   ù€ Ü�‰ðWäô	
ö	ð Ðr3   c                óX   ‡ ‡‡‡‡— t        j                  dt        «       dˆˆˆˆˆ fd„}|S )zø
        We no longer document this decorator style API, and its usage is discouraged.
        Instead you should use the following approach:

        >>> routes = [Route(path, endpoint=...), ...]
        >>> app = Starlette(routes=routes)
        z�The `route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/routing/ for the recommended approach.c                óH   •— ‰j                   j                  ‰| ‰‰‰¬«       | S rb   re   )r`   rd   rc   rF   rS   r.   s    €€€€€r1   rn   z"Starlette.route.<locals>.decoratorÁ   s0   ø€ Ø�K‰K×!Ñ!ØØØØØ"3ð "ô ð ˆKr3   ro   rq   )r.   rS   rc   rF   rd   rn   s   ````` r1   rg   zStarlette.route­   s,   ü€ ô 	�‰ðTäô	
÷	ñ 	ð Ðr3   c                óP   ‡ ‡‡— t        j                  dt        «       dˆˆˆ fd„}|S )a  
        We no longer document this decorator style API, and its usage is discouraged.
        Instead you should use the following approach:

        >>> routes = [WebSocketRoute(path, endpoint=...), ...]
        >>> app = Starlette(routes=routes)
        z¬The `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/routing/#websocket-routing for the recommended approach.c                óD   •— ‰j                   j                  ‰| ‰¬«       | S ri   rj   )r`   rF   rS   r.   s    €€€r1   rn   z,Starlette.websocket_route.<locals>.decoratorÛ   s!   ø€ Ø�K‰K×+Ñ+¨D°$¸TÐ+ÔBØˆKr3   ro   rq   )r.   rS   rF   rn   s   ``` r1   Úwebsocket_routezStarlette.websocket_routeÍ   s'   ú€ ô 	�‰ðfäô	
÷	ð Ðr3   c                ó`   ‡ — t        j                  dt        «       |dk(  sJ d«       ‚dˆ fd„}|S )zú
        We no longer document this decorator style API, and its usage is discouraged.
        Instead you should use the following approach:

        >>> middleware = [Middleware(...), ...]
        >>> app = Starlette(middleware=middleware)
        z¥The `middleware` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/middleware/#using-middleware for recommended approach.Úhttpz/Currently only middleware("http") is supported.c                ó6   •— ‰j                  t        | ¬«       | S )N)Údispatch)rZ   r   )r`   r.   s    €r1   rn   z'Starlette.middleware.<locals>.decoratorð   s   ø€ Ø×ÑÔ 2¸TÐÔBØˆKr3   ro   rq   )r.   Úmiddleware_typern   s   `  r1   r0   zStarlette.middlewareá   s=   ø€ ô 	�‰ðdäô	
ð
  &Ò(Ð[Ð*[Ó[Ð(õ	ð Ðr3   )FNNNNNN)r.   r   r&   Úboolr/   zSequence[BaseRoute] | Noner0   zSequence[Middleware] | Noner*   z%Mapping[Any, ExceptionHandler] | Noner#   ú"Sequence[Callable[[], Any]] | Noner$   r�   r%   zLifespan[AppType] | Nonerp   ÚNone)rp   r   )rp   zlist[BaseRoute])rF   ÚstrrG   r   rp   r   )rI   r   rJ   r   rK   r   rp   r‚   )rO   rƒ   rp   r   rC   )rS   rƒ   r=   r   rF   ú
str | Nonerp   r‚   )rU   rƒ   r=   r   rF   r„   rp   r‚   )rY   z_MiddlewareFactory[P]r?   zP.argsr@   zP.kwargsrp   r‚   )r\   úint | type[Exception]r5   r   rp   r‚   )rO   rƒ   r`   r   rp   r‚   )NNT)rS   rƒ   rg   z3Callable[[Request], Awaitable[Response] | Response]rc   úlist[str] | NonerF   r„   rd   r€   rp   r‚   )rS   rƒ   rg   z&Callable[[WebSocket], Awaitable[None]]rF   r„   rp   r‚   )r\   r…   rp   r   )
rS   rƒ   rc   r†   rF   r„   rd   r€   rp   r   )rS   rƒ   rF   r„   rp   r   )r   rƒ   rp   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   rA   Úpropertyr/   rE   rL   rN   rR   rU   rZ   r]   r_   rf   rk   ru   rg   rz   r0   © r3   r1   r   r      sø  „ Ù+ð Ø-1Ø26ØDHØ9=Ø:>Ø-1ð/5Øð/5àð/5ð +ð/5ð 0ð	/5ð
 Bð/5ð 7ð/5ð 8ð/5ð +ð/5ð 
ó/5óbð, ò"ó ð"ó=ó:ó0ô4ô3ðVà/ðVð ðVð ð	Vð
 
óVðDà"7ðDð "ðDð 
ó	Dð8àð8ð ð8ð 
ó	8ð %)ØØ"&ðlàðlð Cðlð "ð	lð
 ðlð  ðlð 
ólð  ð	@àð@ð 6ð@ð ð	@ð
 
ó@óð  %)ØØ"&ðàðð "ðð ð	ð
  ðð 
óô@ô(r3   )+Ú
__future__r   rr   Úcollections.abcr   r   r   r   Útypingr   r	   r
   Ústarlette.datastructuresr   r   Ústarlette.middlewarer   r   Ústarlette.middleware.baser   Ústarlette.middleware.errorsr   Ústarlette.middleware.exceptionsr   Ústarlette.requestsr   Ústarlette.responsesr   Ústarlette.routingr   r   Ústarlette.typesr   r   r   r   r   r   Ústarlette.websocketsr   r   r    r   rŒ   r3   r1   ú<module>rš      sY   ðÝ "ã ß BÓ Bß *Ñ *ç 3ß ?Ý 8Ý =Ý ?Ý &Ý (ß /ß U× UÝ *á
�) ;Ô
/€ÙˆcƒN€÷^ò ^r3   