§
    Ìtºf(  ã                   óð   — d dl mZ d dlmZ 	 d dlmZ n$# e$ r 	 d dlmZ n# e$ r	 d dl	mZ Y nw xY wY nw xY wd dlm
Z
mZ d dlmZ dZ G d„ d	e¦  «        Z ee
¦  «         G d
„ de¦  «        ¦   «         ZdS )é    )Úimplementer)ÚProtocolWrapper©ÚnotFound)Ú
NoResource)Ú	IResourceÚResource)ÚNOT_DONE_YET)ÚWebSocketResourceÚWSGIRootResourcec                   ó   — e Zd ZdZd„ Zd„ ZdS )r   a«  
    Root resource when you want a WSGI resource be the default serving
    resource for a Twisted Web site, but have subpaths served by
    different resources.

    This is a hack needed since
    `twisted.web.wsgi.WSGIResource <http://twistedmatrix.com/documents/current/api/twisted.web.wsgi.WSGIResource.html>`_.
    does not provide a ``putChild()`` method.

    .. seealso::

       * `Autobahn Twisted Web WSGI example <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_wsgi>`_
       * `Original hack <http://blog.vrplumber.com/index.php?/archives/2426-Making-your-Twisted-resources-a-url-sub-tree-of-your-WSGI-resource....html>`_
    c                 óJ   — t          j        | ¦  «         || _        || _        dS )a}  

        :param wsgiResource: The WSGI to serve as root resource.
        :type wsgiResource: Instance of `twisted.web.wsgi.WSGIResource <http://twistedmatrix.com/documents/current/api/twisted.web.wsgi.WSGIResource.html>`_.
        :param children: A dictionary with string keys constituting URL subpaths, and Twisted Web resources as values.
        :type children: dict
        N)r	   Ú__init__Ú_wsgiResourceÚchildren)ÚselfÚwsgiResourcer   s      úX/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/autobahn/twisted/resource.pyr   zWSGIRootResource.__init__F   s(   € õ 	Ô˜$ÑÔÐØ)ˆÔØ ˆŒˆˆó    c                 óx   — |j                              ¦   «          |j                             d|¦  «         | j        S )Nr   )ÚprepathÚpopÚpostpathÚinsertr   )r   ÚpathÚrequests      r   ÚgetChildzWSGIRootResource.getChildR   s8   € ØŒ×ÒÑÔÐØÔ×Ò  4Ñ(Ô(Ð(ØÔ!Ð!r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r   6   s<   € € € € € ðð ð
!ð 
!ð 
!ð"ð "ð "ð "ð "r   r   c                   ó.   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ ZdS )r   z/
    A Twisted Web resource for WebSocket.
    Tc                 ó   — || _         dS )zˆ

        :param factory: An instance of :class:`autobahn.twisted.websocket.WebSocketServerFactory`.
        :type factory: obj
        N)Ú_factory)r   Úfactorys     r   r   zWebSocketResource.__init___   s   € ð  ˆŒˆˆr   c                 ó"   — t          d¬¦  «        S )zR
        This resource cannot have children, hence this will always fail.
        zNo such child resource.)Úmessager   )r   Únamer   s      r   ÚgetChildWithDefaultz%WebSocketResource.getChildWithDefaulth   s   € õ Ð 9Ð:Ñ:Ô:Ð:r   c                 ó   — dS )zS
        This resource cannot have children, hence this is always ignored.
        Nr"   )r   r   Úchilds      r   ÚputChildzWebSocketResource.putChildn   s   € € € r   c                 ó"  — |j         j        €Xddlm} |                     dd¦  «         |                     dd¦  «         |j        d|j        fz  }|                     d	¦  «        S | j	         
                    |j                             ¦   «         ¦  «        }|s|                     d
¦  «         dS |j         j        dc}|j         _        t          |t          ¦  «        r||_        n.t          |j        t          ¦  «        r||j        _        n||_        |                     |¦  «         t!          |d¦  «        r|j                             ¦   «          n$t!          |d¦  «        r|                     ¦   «          |j        dz   |j        z   dz   }|j                             ¦   «         D ]/}||d         dz   d                     |d         ¦  «        z   dz   z  }Œ0|dz  }||j                             ¦   «         z  }|                     |¦  «         t6          S )zâ
        Render the resource. This will takeover the transport underlying
        the request, create a :class:`autobahn.twisted.websocket.WebSocketServerProtocol`
        and let that do any subsequent communication.
        Nr   )Úprotocoliª  s   Upgrade requireds   Upgrades	   WebSocketÚ Úutf8iô  r   Ú_networkProducerÚresumeProducingó    s    HTTP/1.1
s   : ó   ,é   s   
)ÚchannelÚ	transportÚautobahn.websocketr/   ÚsetResponseCodeÚ	setHeaderÚ_SERVER_STATUS_TEMPLATEÚ__version__Úencoder%   ÚbuildProtocolÚgetPeerÚ
isinstancer   ÚwrappedProtocolÚmakeConnectionÚhasattrr2   r3   ÚmethodÚuriÚrequestHeadersÚgetAllRawHeadersÚjoinÚcontentÚreadÚdataReceivedr
   )r   r   r/   Úhtmlr8   ÚdataÚhs          r   ÚrenderzWebSocketResource.renders   s)  € ð Œ?Ô$Ð,à3Ð3Ð3Ð3Ð3Ð3Ø×#Ò# CÐ)<Ñ=Ô=Ð=ð ×Ò˜j¨,Ñ7Ô7Ð7ØÔ3°r¸8Ô;OÐ6PÑPˆDØ—;’;˜vÑ&Ô&Ð&ð ”=×.Ò.¨wÔ/@×/HÒ/HÑ/JÔ/JÑKÔKˆØð 	à×#Ò# CÑ(Ô(Ð(Ø�3ð 07¬Ô/HÈ$Ð,ˆ	�7”?Ô,õ �i¥Ñ1Ô1ð 	*à(0ˆIÔ%Ð%Ý˜	Ô*­OÑ<Ô<ð 	*à19ˆIÔÔ.Ð.à!)ˆIÔØ×Ò 	Ñ*Ô*Ð*õ �9Ð0Ñ1Ô1ð 	(ØÔ&×6Ò6Ñ8Ô8Ð8Ð8å�YÐ 1Ñ2Ô2ð 	(Ø×%Ò%Ñ'Ô'Ð'ð Œ~ Ñ$ w¤{Ñ2Ð5IÑIˆØÔ'×8Ò8Ñ:Ô:ð 	Að 	AˆAØ�A�a”D˜5‘L 4§9¢9¨Q¨q¬T¡?¤?Ñ2°[Ñ@Ñ@ˆDˆDØ�ÑˆØ�”×$Ò$Ñ&Ô&Ñ&ˆØ×Ò˜dÑ#Ô#Ð#åÐr   N)	r   r   r    r!   ÚisLeafr   r*   r-   rP   r"   r   r   r   r   X   sf   € € € € € ðð ð €Fð ð  ð  ð;ð ;ð ;ðð ð ð
Cð Cð Cð Cð Cr   r   N)Úzope.interfacer   Útwisted.protocols.policiesr   Útwisted.web.pagesr   ÚImportErrorÚtwisted.web.resourcer   Útwisted.web.errorr   r	   Útwisted.web.serverr
   Ú__all__r   Úobjectr   r"   r   r   ú<module>r[      sd  ðð8 'Ð &Ð &Ð &Ð &Ð &à 6Ð 6Ð 6Ð 6Ð 6Ð 6ð	=à*Ð*Ð*Ð*Ð*Ð*Ð*øØð =ð =ð =ð=à?Ð?Ð?Ð?Ð?Ð?Ð?øØð =ð =ð =à<Ð<Ð<Ð<Ð<Ð<Ð<Ð<ð=øøøøøð	=øøøð 5Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4ð ,Ð +Ð +Ð +Ð +Ð +ð€ð"ð "ð "ð "ð "�xñ "ô "ð "ðD €ˆYÑÔð]ð ]ð ]ð ]ð ]˜ñ ]ô ]ñ Ôð]ð ]ð ]s$   Ž •6›"¡6¢0­6¯0°6µ6