§
    TøÁi`  ã                  óú   — d dl mZ d dlZd dlZd dlZd dlmZm	Z	m
Z
mZ ddlmZmZ ddlmZmZmZ g d¢Z	 d d	lmZ d d
lmZmZ ddddœd d„Z	 d!d"d„Zn# e$ r ddddœd d„Z	 d!d"d„ZY nw xY w G d„ d¦  «        ZdS )#é    )ÚannotationsN)ÚAnyÚ	AwaitableÚCallableÚLiteralé   )ÚRequestÚResponseé   )ÚServerÚServerConnectionÚserve)ÚrouteÚ
unix_routeÚRouter)ÚNotFound)ÚMapÚRequestRedirect)Úserver_nameÚsslÚcreate_routerÚurl_mapr   Úargsr   r   ú
str | Noner   ú,ssl_module.SSLContext | Literal[True] | Noner   útype[Router] | NoneÚkwargsÚreturnúAwaitable[Server]c               óÐ   ‡‡	— |€dnd}|dur|�||d<   |€t           } || ||¦  «        Š	|                     dd¦  «        Š‰€‰	j        }ndˆˆ	fd„}t          ‰	j        g|¢R d|i|¤ŽS )aÐ	  
        Create a WebSocket server dispatching connections to different handlers.

        This feature requires the third-party library `werkzeug`_:

        .. code-block:: console

            $ pip install werkzeug

        .. _werkzeug: https://werkzeug.palletsprojects.com/

        :func:`route` accepts the same arguments as
        :func:`~websockets.sync.server.serve`, except as described below.

        The first argument is a :class:`werkzeug.routing.Map` that maps URL patterns
        to connection handlers. In addition to the connection, handlers receive
        parameters captured in the URL as keyword arguments.

        Here's an example::


            from websockets.asyncio.router import route
            from werkzeug.routing import Map, Rule

            async def channel_handler(websocket, channel_id):
                ...

            url_map = Map([
                Rule("/channel/<uuid:channel_id>", endpoint=channel_handler),
                ...
            ])

            # set this future to exit the server
            stop = asyncio.get_running_loop().create_future()

            async with route(url_map, ...) as server:
                await stop


        Refer to the documentation of :mod:`werkzeug.routing` for details.

        If you define redirects with ``Rule(..., redirect_to=...)`` in the URL map,
        when the server runs behind a reverse proxy that modifies the ``Host``
        header or terminates TLS, you need additional configuration:

        * Set ``server_name`` to the name of the server as seen by clients. When
          not provided, websockets uses the value of the ``Host`` header.

        * Set ``ssl=True`` to generate ``wss://`` URIs without enabling TLS.
          Under the hood, this bind the URL map with a ``url_scheme`` of
          ``wss://`` instead of ``ws://``.

        There is no need to specify ``websocket=True`` in each rule. It is added
        automatically.

        Args:
            url_map: Mapping of URL patterns to connection handlers.
            server_name: Name of the server as seen by clients. If :obj:`None`,
                websockets uses the value of the ``Host`` header.
            ssl: Configuration for enabling TLS on the connection. Set it to
                :obj:`True` if a reverse proxy terminates TLS connections.
            create_router: Factory for the :class:`Router` dispatching requests to
                handlers. Set it to a wrapper or a subclass to customize routing.

        NÚwsÚwssTr   Úprocess_requestÚ
connectionr   Úrequestr	   r   úResponse | Nonec              “  óŽ   •K  —  ‰| |¦  «        }t          |t          ¦  «        r|ƒ d {V —†}|�|S ‰                     | |¦  «        S ©N)Ú
isinstancer   Úroute_request)r$   r%   ÚresponseÚ_process_requestÚrouters      €€úc/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/websockets/asyncio/router.pyr#   zroute.<locals>.process_requestˆ   s_   øè è € ð ,Ð+¨J¸Ñ@Ô@�Ý˜h­	Ñ2Ô2ð .Ø%-˜~˜~˜~˜~˜~˜~�HØÐ'Ø#�OØ×+Ò+¨J¸Ñ@Ô@Ð@ó    ©r$   r   r%   r	   r   r&   )r   Úpopr*   r   Úhandler)
r   r   r   r   r   r   Ú
url_schemer#   r,   r-   s
           @@r.   r   r   (   sÉ   øø€ ðR !˜[�T�T¨eˆ
Ø�dˆ?ˆ?˜s˜ØˆF�5‰MàÐ Ý"ˆMà�˜w¨°ZÑ@Ô@ˆð �JŠJÐ(¨$Ñ/Ô/ð 	ð Ð#ð Ô$ð ˆOðAð Að Að Að Að Að Aõ �V”^ÐV dÐVÐVÐV¸OÐVÈvÐVÐVÐVr/   Úpathc                ó"   — t          | fd|dœ|¤ŽS )aj  
        Create a WebSocket Unix server dispatching connections to different handlers.

        :func:`unix_route` combines the behaviors of :func:`route` and
        :func:`~websockets.asyncio.server.unix_serve`.

        Args:
            url_map: Mapping of URL patterns to connection handlers.
            path: File system path to the Unix socket.

        T)Úunixr4   )r   ©r   r4   r   s      r.   r   r   ”   s!   € õ  �WÐ= 4¨dÐ=Ð=°fÐ=Ð=Ð=r/   c               ó    — t          d¦  «        ‚)Nzroute() requires werkzeug©ÚImportError)r   r   r   r   r   r   s         r.   r   r      s   € õ Ð5Ñ6Ô6Ð6r/   c                ó    — t          d¦  «        ‚)Nzunix_route() requires werkzeugr9   r7   s      r.   r   r      s   € õ
 Ð:Ñ;Ô;Ð;r/   c                  óH   — e Zd ZdZ	 	 ddd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dS ) r   z*WebSocket router supporting :func:`route`.Nr!   r   r   r   r   r3   Ústrr   ÚNonec                óv   — || _         || _        || _        | j                              ¦   «         D ]	}d|_        Œ
d S )NT)r   r   r3   Ú
iter_rulesÚ	websocket)Úselfr   r   r3   Úrules        r.   Ú__init__zRouter.__init__ª   sJ   € ð ˆŒØ&ˆÔØ$ˆŒØ”L×+Ò+Ñ-Ô-ð 	"ð 	"ˆDØ!ˆDŒNˆNð	"ð 	"r/   r$   r   r%   r	   c                ó8   — | j         €|j        d         S | j         S )NÚHost)r   Úheaders)rB   r$   r%   s      r.   Úget_server_namezRouter.get_server_name¶   s!   € ØÔÐ#Ø”? 6Ô*Ð*àÔ#Ð#r/   Úurlr
   c                ój   — |                      t          j        j        d|› �¦  «        }||j        d<   |S )Nz	Found at ÚLocation)ÚrespondÚhttpÚ
HTTPStatusÚFOUNDrG   )rB   r$   rI   r+   s       r.   ÚredirectzRouter.redirect¼   s7   € Ø×%Ò%¥d¤oÔ&;Ð=NÈÐ=NÐ=NÑOÔOˆØ'*ˆÔ˜Ñ$Øˆr/   c                óL   — |                      t          j        j        d¦  «        S )Nz	Not Found)rL   rM   rN   Ú	NOT_FOUND©rB   r$   s     r.   Ú	not_foundzRouter.not_foundÁ   s   € Ø×!Ò!¥$¤/Ô";¸[ÑIÔIÐIr/   r&   c                óÆ  — | j                              |                      ||¦  «        | j        ¬¦  «        }	 t          j                             |j        ¦  «        }|                     |j        |j	        ¬¦  «        \  }}nR# t          $ r%}|                      ||j        ¦  «        cY d}~S d}~wt          $ r |                      |¦  «        cY S w xY w||c|_        |_        dS )zRoute incoming request.)r   r3   )Ú	path_infoÚ
query_argsN)r   ÚbindrH   r3   ÚurllibÚparseÚurlparser4   ÚmatchÚqueryr   rP   Únew_urlr   rT   r2   Úhandler_kwargs)rB   r$   r%   Úurl_map_adapterÚparsedr2   r   rP   s           r.   r*   zRouter.route_requestÄ   s  € ð œ,×+Ò+Ø×,Ò,¨Z¸ÑAÔAØ”ð ,ñ 
ô 
ˆð		.Ý”\×*Ò*¨7¬<Ñ8Ô8ˆFØ-×3Ò3Ø œ+Ø!œ<ð 4ñ ô ‰OˆG�V�Vøõ ð 	?ð 	?ð 	?Ø—=’= ¨XÔ-=Ñ>Ô>Ð>Ð>Ð>Ð>Ð>Ð>øøøøÝð 	.ð 	.ð 	.Ø—>’> *Ñ-Ô-Ð-Ð-Ð-ð	.øøøà8?ÀÐ5ˆ
Ô˜JÔ5Øˆts$   ·AB  Â 
CÂ
B*Â$CÂ*"CÃCc              ƒ  ó8   K  —  |j         |fi |j        ¤Žƒ d{V —†S )zHandle a connection.N)r2   r_   rS   s     r.   r2   zRouter.handlerÙ   s6   è è € à'�ZÔ'¨
ÐPÐP°jÔ6OÐPÐPÐPÐPÐPÐPÐPÐPÐPr/   )Nr!   )r   r   r   r   r3   r=   r   r>   )r$   r   r%   r	   r   r=   )r$   r   rI   r=   r   r
   )r$   r   r   r
   r0   )r$   r   r   r>   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__rD   rH   rP   rT   r*   r2   © r/   r.   r   r   §   s©   € € € € € Ø4Ð4ð
 #'Øð	
"ð 
"ð 
"ð 
"ð 
"ð$ð $ð $ð $ðð ð ð ð
Jð Jð Jð Jðð ð ð ð*Qð Qð Qð Qð Qð Qr/   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   )r   r   r4   r   r   r   r   r   )Ú
__future__r   rM   r   Ú
ssl_moduleÚurllib.parserY   Útypingr   r   r   r   Úhttp11r	   r
   Úserverr   r   r   Ú__all__Úwerkzeug.exceptionsr   Úwerkzeug.routingr   r   r   r   r:   r   rg   r/   r.   ú<module>rq      sÔ  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à &Ð &Ð &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3ð ,Ð
+Ð
+€ðU>Ø,Ð,Ð,Ð,Ð,Ð,Ø5Ð5Ð5Ð5Ð5Ð5Ð5Ð5ð4 #'Ø<@Ø-1ðjWð jWð jWð jWð jWð jWð\  ð>ð >ð >ð >ð >ð >øðC ð <ð <ð <ð
 #'Ø<@Ø-1ð7ð 7ð 7ð 7ð 7ð 7ð  ð<ð <ð <ð <ð <ð <ð <ð<øøøðh4Qð 4Qð 4Qð 4Qð 4Qñ 4Qô 4Qð 4Qð 4Qð 4Qs   ¶A ÁA+Á*A+