§
    ¯õió  ã                   óˆ   — d dl mZmZ d dlmZ d dlmZ d dlmZ  G d„ d¦  «        Z	 G d„ d¦  «        Z
 G d	„ d
¦  «        ZdS )é    )ÚAnyÚOptional)Úcommand_builder)ÚUserPromptHandler)ÚProxyc                   ó.   — e Zd ZdZdZdZdZdZeeeehZdS )ÚClientWindowStatezRepresents a window state.Ú
fullscreenÚ	maximizedÚ	minimizedÚnormalN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
FULLSCREENÚ	MAXIMIZEDÚ	MINIMIZEDÚNORMALÚVALID_STATES© ó    úr/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/selenium/webdriver/common/bidi/browser.pyr	   r	      s6   € € € € € Ø$Ð$à€JØ€IØ€IØ€Fà 	¨9°fÐ=€L€L€Lr   r	   c                   óª   — e Zd ZdZdededededededefd	„Zd
efd„Zd
efd„Z	d
efd„Z
d
efd„Zd
efd„Zd
efd„Zd
efd„Zeded
d fd„¦   «         ZdS )ÚClientWindowInfoz'Represents a client window information.Úclient_windowÚstateÚwidthÚheightÚxÚyÚactivec                 óh   — || _         || _        || _        || _        || _        || _        || _        d S ©N©r   r   r   r   r    r!   r"   )Úselfr   r   r   r   r    r!   r"   s           r   Ú__init__zClientWindowInfo.__init__(   s:   € ð +ˆÔØˆŒ
ØˆŒ
ØˆŒØˆŒØˆŒØˆŒˆˆr   Úreturnc                 ó   — | j         S )z©Gets the state of the client window.

        Returns:
        -------
            str: The state of the client window (one of the ClientWindowState constants).
        )r   ©r&   s    r   Ú	get_statezClientWindowInfo.get_state:   ó   € ð ŒzÐr   c                 ó   — | j         S )z|Gets the client window identifier.

        Returns:
        -------
            str: The client window identifier.
        )r   r*   s    r   Úget_client_windowz"ClientWindowInfo.get_client_windowC   s   € ð Ô!Ð!r   c                 ó   — | j         S )z€Gets the width of the client window.

        Returns:
        -------
            int: The width of the client window.
        )r   r*   s    r   Ú	get_widthzClientWindowInfo.get_widthL   r,   r   c                 ó   — | j         S )z‚Gets the height of the client window.

        Returns:
        -------
            int: The height of the client window.
        )r   r*   s    r   Ú
get_heightzClientWindowInfo.get_heightU   ó   € ð Œ{Ðr   c                 ó   — | j         S )zŽGets the x coordinate of the client window.

        Returns:
        -------
            int: The x coordinate of the client window.
        )r    r*   s    r   Úget_xzClientWindowInfo.get_x^   ó   € ð Œvˆr   c                 ó   — | j         S )zŽGets the y coordinate of the client window.

        Returns:
        -------
            int: The y coordinate of the client window.
        )r!   r*   s    r   Úget_yzClientWindowInfo.get_yg   r6   r   c                 ó   — | j         S )z™Checks if the client window is active.

        Returns:
        -------
            bool: True if the client window is active, False otherwise.
        )r"   r*   s    r   Ú	is_activezClientWindowInfo.is_activep   r3   r   Údatac           	      ó¸  — 	 |d         }t          |t          ¦  «        st          d¦  «        ‚|d         }t          |t          ¦  «        st          d¦  «        ‚|t          j        vrt          d|› dt          j        › �¦  «        ‚|d         }t          |t
          ¦  «        r|dk     rt          d	|› �¦  «        ‚|d
         }t          |t
          ¦  «        r|dk     rt          d|› �¦  «        ‚|d         }t          |t
          ¦  «        s$t          dt          |¦  «        j        › �¦  «        ‚|d         }t          |t
          ¦  «        s$t          dt          |¦  «        j        › �¦  «        ‚|d         }t          |t          ¦  «        st          d¦  «        ‚ | |||||||¬¦  «        S # t          t          f$ r}	t          d|	› �¦  «        ‚d}	~	ww xY w)aƒ  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)
Úclsr;   r   r   r   r   r    r!   r"   Úes
             r   Ú	from_dictzClientWindowInfo.from_dicty   s  € ð )	OØ  Ô0ˆMÝ˜m­SÑ1Ô1ð BÝ Ð!@ÑAÔAÐAà˜”MˆEÝ˜e¥SÑ)Ô)ð ;Ý Ð!9Ñ:Ô:Ð:ØÕ-Ô:Ð:Ð:Ý Ð!k°5Ð!kÐ!kÕK\ÔKiÐ!kÐ!kÑlÔlÐlà˜”MˆEÝ˜e¥SÑ)Ô)ð W¨U°QªY¨YÝ Ð!UÈeÐ!UÐ!UÑVÔVÐVà˜(”^ˆFÝ˜f¥cÑ*Ô*ð Y¨f°qªj¨jÝ Ð!WÈvÐ!WÐ!WÑXÔXÐXà�S”	ˆAÝ˜a¥Ñ%Ô%ð RÝ Ð!P½dÀ1¹g¼gÔ>NÐ!PÐ!PÑQÔQÐQà�S”	ˆAÝ˜a¥Ñ%Ô%ð RÝ Ð!P½dÀ1¹g¼gÔ>NÐ!PÐ!PÑQÔQÐQà˜(”^ˆFÝ˜f¥dÑ+Ô+ð =Ý Ð!;Ñ<Ô<Ð<à�3Ø+ØØØØØØðñ ô ð øõ �)Ð$ð 	Oð 	Oð 	OÝÐMÈ!ÐMÐMÑNÔNÐNøøøøð	Oøøøs   ‚F.F1 Æ1GÇGÇGN)r   r   r   r   r?   rA   rC   r'   r+   r.   r0   r2   r5   r8   r:   ÚclassmethodÚdictrH   r   r   r   r   r   %   sf  € € € € € Ø1Ð1ðàðð ðð ð	ð
 ðð ðð ðð ðð ð ð ð$˜3ð ð ð ð ð" 3ð "ð "ð "ð "ð˜3ð ð ð ð ð˜Cð ð ð ð ð�sð ð ð ð ð�sð ð ð ð ð˜4ð ð ð ð ð ð8O˜Tð 8OÐ&8ð 8Oð 8Oð 8Oñ „[ð8Oð 8Oð 8Or   r   c            	       óœ   — e Zd ZdZd„ Z	 	 	 ddee         dee         dee         de	fd„Z
dee	         fd	„Zd
e	ddfd„Zdee         fd„ZdS )ÚBrowserz4
    BiDi implementation of the browser module.
    c                 ó   — || _         d S r$   )Úconn)r&   rN   s     r   r'   zBrowser.__init__º   s   € ØˆŒ	ˆ	ˆ	r   NÚaccept_insecure_certsÚproxyÚunhandled_prompt_behaviorr(   c                 óØ   — i }|�||d<   |�|                      ¦   «         |d<   |�|                     ¦   «         |d<   | j                             t	          d|¦  «        ¦  «        }|d         S )a–  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.
        NÚacceptInsecureCertsrP   ÚunhandledPromptBehaviorzbrowser.createUserContextÚuserContext)Úto_bidi_dictÚto_dictrN   Úexecuter   )r&   rO   rP   rQ   ÚparamsÚresults         r   Úcreate_user_contextzBrowser.create_user_context½   s~   € ð$ "$ˆà Ð,Ø,AˆFÐ(Ñ)àÐØ#×0Ò0Ñ2Ô2ˆF�7‰Oà$Ð0Ø0I×0QÒ0QÑ0SÔ0SˆFÐ,Ñ-à”×"Ò"¥?Ð3NÐPVÑ#WÔ#WÑXÔXˆØ�mÔ$Ð$r   c                 óv   — | j                              t          di ¦  «        ¦  «        }d„ |d         D ¦   «         S )zuGets all user contexts.

        Returns:
        -------
            List[str]: A list of user context IDs.
        zbrowser.getUserContextsc                 ó   — g | ]
}|d          ‘ŒS )rU   r   )Ú.0Úcontext_infos     r   ú
<listcomp>z-Browser.get_user_contexts.<locals>.<listcomp>å   s   € ÐWÐWÐW°�˜]Ô+ÐWÐWÐWr   ÚuserContexts©rN   rX   r   ©r&   rZ   s     r   Úget_user_contextszBrowser.get_user_contextsÝ   s=   € ð ”×"Ò"¥?Ð3LÈbÑ#QÔ#QÑRÔRˆØWÐWÀÀ~Ô@VÐWÑWÔWÐWr   Úuser_context_idc                 óˆ   — |dk    rt          d¦  «        ‚d|i}| j                             t          d|¦  «        ¦  «         dS )zúRemoves 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 contextrU   zbrowser.removeUserContextN)Ú	ExceptionrN   rX   r   )r&   re   rY   s      r   Úremove_user_contextzBrowser.remove_user_contextç   sO   € ð ˜iÒ'Ð'ÝÐDÑEÔEÐEà Ð1ˆØŒ	×Ò�/Ð*EÀvÑNÔNÑOÔOÐOÐOÐOr   c                 óv   — | j                              t          di ¦  «        ¦  «        }d„ |d         D ¦   «         S )zŒGets all client windows.

        Returns:
        -------
            List[ClientWindowInfo]: A list of client window information.
        zbrowser.getClientWindowsc                 óB   — g | ]}t                                |¦  «        ‘ŒS r   )r   rH   )r^   Úwindows     r   r`   z.Browser.get_client_windows.<locals>.<listcomp>   s'   € ÐYÐYÐY°vÕ ×*Ò*¨6Ñ2Ô2ÐYÐYÐYr   ÚclientWindowsrb   rc   s     r   Úget_client_windowszBrowser.get_client_windowsø   s=   € ð ”×"Ò"¥?Ð3MÈrÑ#RÔ#RÑSÔSˆØYÐYÀÈÔAXÐYÑYÔYÐYr   )NNN)r   r   r   r   r'   r   rC   r   r   r?   r[   Úlistrd   ri   r   rn   r   r   r   rL   rL   µ   sú   € € € € € ðð ðð ð ð
 15Ø!%ØAEð	%ð %à'¨œ~ð%ð ˜Œð%ð $,Ð,=Ô#>ð	%ð
 
ð%ð %ð %ð %ð@X 4¨¤9ð Xð Xð Xð XðP°3ð P¸4ð Pð Pð Pð Pð"Z DÐ)9Ô$:ð Zð Zð Zð Zð Zð Zr   rL   N)Útypingr   r   Ú%selenium.webdriver.common.bidi.commonr   Ú&selenium.webdriver.common.bidi.sessionr   Úselenium.webdriver.common.proxyr   r	   r   rL   r   r   r   ú<module>rt      sü   ðð& !Ð  Ð  Ð  Ð  Ð  Ð  Ð  à AÐ AÐ AÐ AÐ AÐ AØ DÐ DÐ DÐ DÐ DÐ DØ 1Ð 1Ð 1Ð 1Ð 1Ð 1ð>ð >ð >ð >ð >ñ >ô >ð >ðMOð MOð MOð MOð MOñ MOô MOð MOð`KZð KZð KZð KZð KZñ KZô KZð KZð KZð KZr   