
    `6i                     \    d dl 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  G d d      Zy)	    N)Any)
Connection)create_remote_object)PipeTransport)
Playwrightc                   <    e Zd ZddZdefdZdefdZdeddfdZy)	PlaywrightContextManagerreturnNc                     |  d| _         y )NF)_exit_was_calledselfs    p/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/playwright/async_api/_context_manager.py__init__z!PlaywrightContextManager.__init__   s     %    c                 P  K   t        j                         }t        d t        t	        |      |      | _        |j                  | j
                  j                                | j
                  j                  }t        j                  | j
                  j                  j                  |ht         j                         d {   \  }}|j                         s|j                          t        t!        t#        |            j%                               }| j&                  |_        |S 7 ew)N)return_when)asyncioget_running_loopr   r   r   _connectioncreate_taskrunplaywright_futurewait
_transporton_error_futureFIRST_COMPLETEDdonecancelAsyncPlaywrightnextiterresult	__aexit__stop)r   loopr   r   _
playwrights         r   
__aenter__z#PlaywrightContextManager.__aenter__   s     '')% $	
 	))--/0 ,,>>((88:KL//
 
a !%%'$$&$T$t*%5%<%<%>?
..

s   B<D&>D$?A&D&c                 >   K   | j                          d {   S 7 w)N)r)   r   s    r   startzPlaywrightContextManager.start2   s     __&&&&s   argsc                 |   K   | j                   ry d| _         | j                  j                          d {    y 7 w)NT)r   r   
stop_async)r   r,   s     r   r$   z"PlaywrightContextManager.__aexit__5   s2        $))+++s   2<:<)r
   N)	__name__
__module____qualname__r   r    r)   r+   r   r$    r   r   r	   r	      s2    &/ *'_ ',S ,T ,r   r	   )r   typingr   playwright._impl._connectionr    playwright._impl._object_factoryr   playwright._impl._transportr   playwright.async_api._generatedr   r    r	   r2   r   r   <module>r8      s#      3 A 5 I!, !,r   