
    'h                     t    S SK JrJr  S SKJr  S SKJr  S SKJr   " S S5      r	 " S S5      r
 " S	 S
5      rg)    )AnyOptional)command_builder)UserPromptHandler)Proxyc                   4    \ rS rSrSrSrSrSrSr\\\\1r	Sr
g)	ClientWindowState   zRepresents a window state.
fullscreen	maximized	minimizednormal N)__name__
__module____qualname____firstlineno____doc__
FULLSCREEN	MAXIMIZED	MINIMIZEDNORMALVALID_STATES__static_attributes__r       o/var/www/home/psychics-availability/venv/lib/python3.13/site-packages/selenium/webdriver/common/bidi/browser.pyr	   r	      s'    $JIIF	9f=Lr   r	   c                       \ rS rSrSrS\S\S\S\S\S\S	\4S
 jrS\4S jr	S\4S jr
S\4S jrS\4S jrS\4S jrS\4S jrS\4S jr\S\SS 4S j5       rSrg)ClientWindowInfo%   z'Represents a client window information.client_windowstatewidthheightxyactivec                 X    Xl         X l        X0l        X@l        XPl        X`l        Xpl        g Nr    r!   r"   r#   r$   r%   r&   )selfr    r!   r"   r#   r$   r%   r&   s           r   __init__ClientWindowInfo.__init__(   s(     +

r   returnc                     U R                   $ )zGets the state of the client window.

Returns:
-------
    str: The state of the client window (one of the ClientWindowState constants).
)r!   r*   s    r   	get_stateClientWindowInfo.get_state:        zzr   c                     U R                   $ )z\Gets the client window identifier.

Returns:
-------
    str: The client window identifier.
)r    r/   s    r   get_client_window"ClientWindowInfo.get_client_windowC   s     !!!r   c                     U R                   $ )z`Gets the width of the client window.

Returns:
-------
    int: The width of the client window.
)r"   r/   s    r   	get_widthClientWindowInfo.get_widthL   r2   r   c                     U R                   $ )zbGets the height of the client window.

Returns:
-------
    int: The height of the client window.
)r#   r/   s    r   
get_heightClientWindowInfo.get_heightU        {{r   c                     U R                   $ )znGets the x coordinate of the client window.

Returns:
-------
    int: The x coordinate of the client window.
)r$   r/   s    r   get_xClientWindowInfo.get_x^        vvr   c                     U R                   $ )znGets the y coordinate of the client window.

Returns:
-------
    int: The y coordinate of the client window.
)r%   r/   s    r   get_yClientWindowInfo.get_yg   r@   r   c                     U R                   $ )zyChecks if the client window is active.

Returns:
-------
    bool: True if the client window is active, False otherwise.
)r&   r/   s    r   	is_activeClientWindowInfo.is_activep   r<   r   datac           
      P    US   n[        U[        5      (       d  [        S5      eUS   n[        U[        5      (       d  [        S5      eU[        R                  ;  a  [        SU S[        R                   35      eUS   n[        U[
        5      (       a  US:  a  [        S	U 35      eUS
   n[        U[
        5      (       a  US:  a  [        SU 35      eUS   n[        U[
        5      (       d!  [        S[        U5      R                   35      eUS   n[        U[
        5      (       d!  [        S[        U5      R                   35      eUS   n[        U[        5      (       d  [        S5      eU " UUUUUUUS9$ ! [        [        4 a  n	[        SU	 35      eSn	A	ff = f)a3  Creates a ClientWindowInfo instance from a dictionary.

Parameters:
-----------
    data: A dictionary containing the client window information.

Returns:
-------
    ClientWindowInfo: A new instance of ClientWindowInfo.

Raises:
------
    ValueError: If required fields are missing or have invalid types.
clientWindowzclientWindow must be a stringr!   zstate must be a stringzInvalid state: z. Must be one of r"   r   z*width must be a non-negative integer, got r#   z+height must be a non-negative integer, got r$   zx must be an integer, got r%   zy must be an integer, got r&   zactive must be a booleanr)   z*Invalid data format for ClientWindowInfo: N)
isinstancestr
ValueErrorr	   r   inttyper   boolKeyError	TypeError)
clsrG   r    r!   r"   r#   r$   r%   r&   es
             r   	from_dictClientWindowInfo.from_dicty   s    )	O 0MmS11 !@AAMEeS)) !9::-::: ?5'9JK\KiKiJj!kllMEeS))UQY #MeW!UVV(^Ffc**fqj #Nvh!WXXS	Aa%% #=d1g>N>N=O!PQQS	Aa%% #=d1g>N>N=O!PQQ(^Ffd++ !;<<+  )$ 	OI!MNN	Os   E?F F%F  F%)r&   r    r#   r!   r"   r$   r%   N)r   r   r   r   r   rK   rM   rO   r+   r0   r4   r7   r:   r>   rB   rE   classmethoddictrT   r   r   r   r   r   r   %   s    1  	
    $3 "3 "3 C s s 4  8OT 8O&8 8O 8Or   r   c            	           \ rS rSrSrS r   SS\\   S\\   S\\	   S\
4S	 jjrS\\
   4S
 jrS\
SS4S jrS\\   4S jrSrg)Browser   z,
BiDi implementation of the browser module.
c                     Xl         g r(   conn)r*   r]   s     r   r+   Browser.__init__   s    	r   Naccept_insecure_certsproxyunhandled_prompt_behaviorr-   c                     0 nUb  XS'   Ub  UR                  5       US'   Ub  UR                  5       US'   U R                  R                  [	        SU5      5      nUS   $ )aN  Creates a new user context.

Parameters:
-----------
    accept_insecure_certs: Optional flag to accept insecure TLS certificates
    proxy: Optional proxy configuration for the user context
    unhandled_prompt_behavior: Optional configuration for handling user prompts

Returns:
-------
    str: The ID of the created user context.
acceptInsecureCertsr`   unhandledPromptBehaviorzbrowser.createUserContextuserContext)to_bidi_dictto_dictr]   executer   )r*   r_   r`   ra   paramsresults         r   create_user_contextBrowser.create_user_context   sr    $ "$ ,,A()#002F7O$00I0Q0Q0SF,-""?3NPV#WXm$$r   c                     U R                   R                  [        S0 5      5      nUS    Vs/ s H  o"S   PM	     sn$ s  snf )zUGets all user contexts.

Returns:
-------
    List[str]: A list of user context IDs.
zbrowser.getUserContextsuserContextsre   )r]   rh   r   )r*   rj   context_infos      r   get_user_contextsBrowser.get_user_contexts   sB     ""?3Lb#QR@F~@VW@V]+@VWWWs   >user_context_idc                 x    US:X  a  [        S5      eSU0nU R                  R                  [        SU5      5        g)zRemoves a user context.

Parameters:
-----------
    user_context_id: The ID of the user context to remove.

Raises:
------
    Exception: If the user context ID is "default" or does not exist.
defaultz&Cannot remove the default user contextre   zbrowser.removeUserContextN)	Exceptionr]   rh   r   )r*   rr   ri   s      r   remove_user_contextBrowser.remove_user_context   s<     i'DEE1		/*EvNOr   c                     U R                   R                  [        S0 5      5      nUS    Vs/ s H  n[        R	                  U5      PM     sn$ s  snf )zlGets all client windows.

Returns:
-------
    List[ClientWindowInfo]: A list of client window information.
zbrowser.getClientWindowsclientWindows)r]   rh   r   r   rT   )r*   rj   windows      r   get_client_windowsBrowser.get_client_windows   sK     ""?3Mr#RSAGAXYAXv **62AXYYYs   Ar\   )NNN)r   r   r   r   r   r+   r   rO   r   r   rK   rk   listrp   rv   r   r{   r   r   r   r   rY   rY      s    
 15!%AE	%'~% % $,,=#>	%
 
%@X49 XP3 P4 P"ZD)9$: Zr   rY   N)typingr   r   %selenium.webdriver.common.bidi.commonr   &selenium.webdriver.common.bidi.sessionr   selenium.webdriver.common.proxyr   r	   r   rY   r   r   r   <module>r      s:   & ! A D 1> >MO MO`KZ KZr   