
    i~!                     t    d dl mZmZmZ d dlmZ  G d d          Z G d d          Z G d d          Zd	S )
    )AnyOptionalUnion)command_builderc                      e Zd ZdZ	 	 	 	 	 ddedededee         dee         d	ee         d
ee         fdZed             Zej	        d             Zed             Z
e
j	        d             Z
ed             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             Zed             Zej	        d             Zdeeeedf         f         fdZdS )GeolocationCoordinatesz#Represents geolocation coordinates.      ?Nlatitude	longitudeaccuracyaltitudealtitude_accuracyheadingspeedc                 h    || _         || _        || _        || _        || _        || _        || _        dS )a  Initialize GeolocationCoordinates.

        Parameters:
        -----------
            latitude: Latitude coordinate (-90.0 to 90.0).
            longitude: Longitude coordinate (-180.0 to 180.0).
            accuracy: Accuracy in meters (>= 0.0), defaults to 1.0.
            altitude: Altitude in meters or None, defaults to None.
            altitude_accuracy: Altitude accuracy in meters (>= 0.0) or None, defaults to None.
            heading: Heading in degrees (0.0 to 360.0) or None, defaults to None.
            speed: Speed in meters per second (>= 0.0) or None, defaults to None.

        Raises:
        ------
            ValueError: If coordinates are out of valid range or if altitude_accuracy is provided without altitude.
        Nr
   r   r   r   r   r   r   )selfr
   r   r   r   r   r   r   s           t/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/selenium/webdriver/common/bidi/emulation.py__init__zGeolocationCoordinates.__init__   s:    4 !"  !2


    c                     | j         S N)	_latituder   s    r   r
   zGeolocationCoordinates.latitude<   
    ~r   c                 P    d|cxk    rdk    sn t          d          || _        d S )Ng     Vg     V@z'latitude must be between -90.0 and 90.0)
ValueErrorr   r   values     r   r
   zGeolocationCoordinates.latitude@   s;    &&&&$&&&&FGGGr   c                     | j         S r   )
_longituder   s    r   r   z GeolocationCoordinates.longitudeF   s
    r   c                 P    d|cxk    rdk    sn t          d          || _        d S )Ng     fg     f@z*longitude must be between -180.0 and 180.0)r   r!   r   s     r   r   z GeolocationCoordinates.longitudeJ   s;    %((((5((((IJJJr   c                     | j         S r   )	_accuracyr   s    r   r   zGeolocationCoordinates.accuracyP   r   r   c                 >    |dk     rt          d          || _        d S )N        zaccuracy must be >= 0.0)r   r$   r   s     r   r   zGeolocationCoordinates.accuracyT   s%    3;;6777r   c                     | j         S r   	_altituder   s    r   r   zGeolocationCoordinates.altitudeZ   r   r   c                     || _         d S r   r(   r   s     r   r   zGeolocationCoordinates.altitude^   s    r   c                     | j         S r   )_altitude_accuracyr   s    r   r   z(GeolocationCoordinates.altitude_accuracyb   s    &&r   c                 r    || j         t          d          ||dk     rt          d          || _        d S )Nz0altitude_accuracy cannot be set without altituder&   z altitude_accuracy must be >= 0.0)r   r   r,   r   s     r   r   z(GeolocationCoordinates.altitude_accuracyf   sI    !6OPPP?@@@"'r   c                     | j         S r   )_headingr   s    r   r   zGeolocationCoordinates.headingn   s
    }r   c                 T    |d|cxk    rdk     sn t          d          || _        d S )Nr&   g     v@z%heading must be between 0.0 and 360.0)r   r/   r   s     r   r   zGeolocationCoordinates.headingr   s@    cU&:&:&:&:U&:&:&:&:DEEEr   c                     | j         S r   )_speedr   s    r   r   zGeolocationCoordinates.speedx   s
    {r   c                 B    ||dk     rt          d          || _        d S )Nr&   zspeed must be >= 0.0)r   r2   r   s     r   r   zGeolocationCoordinates.speed|   s*    3444r   returnc                     | j         | j        | j        d}| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )N)r
   r   r   r   altitudeAccuracyr   r   r   )r   results     r   to_dictzGeolocationCoordinates.to_dict   sv    1
 1
 =$!%F:!-)-)?F%&<# $F9:!"jF7Or   )r	   NNNN)__name__
__module____qualname____doc__floatr   r   propertyr
   setterr   r   r   r   r   r   dictstrr   r8    r   r   r   r      sS       -- $(-1#'!%       	 
 5/  $E?  %         D   X _  _
   X      
   X _  _
   X _  _ ' ' X' ( ( (   X ^  ^
   X \  \
c5#556      r   r   c                   B    e Zd ZdZdZefdefdZdeeef         fdZdS )GeolocationPositionErrorz(Represents a geolocation position error.positionUnavailabletypec                 Z    || j         k    rt          d| j          d          || _        d S )Nztype must be "")TYPE_POSITION_UNAVAILABLEr   rF   )r   rF   s     r   r   z!GeolocationPositionError.__init__   s8    4111Od.LOOOPPP			r   r4   c                     d| j         iS )NrF   )rF   r   s    r   r8   z GeolocationPositionError.to_dict   s    	""r   N)	r9   r:   r;   r<   rI   rA   r   r@   r8   rB   r   r   rD   rD      sf        22 5#<  S    
#c3h # # # # # #r   rD   c                       e Zd ZdZd Z	 	 	 	 ddee         dee         deee	                  deee	                  ddf
d	Z
	 	 	 dd
ee	         deee	                  deee	                  ddfdZdS )	Emulationz6
    BiDi implementation of the emulation module.
    c                     || _         d S r   )conn)r   rN   s     r   r   zEmulation.__init__   s    			r   Ncoordinateserrorcontextsuser_contextsr4   c                 P   ||t          d          ||t          d          ||t          d          i }||                                |d<   n||                                |d<   |||d<   n|||d<   | j                            t	          d	|                     dS )
a  Set geolocation override for the given contexts or user contexts.

        Parameters:
        -----------
            coordinates: Geolocation coordinates to emulate, or None.
            error: Geolocation error to emulate, or None.
            contexts: List of browsing context IDs to apply the override to.
            user_contexts: List of user context IDs to apply the override to.

        Raises:
        ------
            ValueError: If both coordinates and error are provided, or if both contexts
                       and user_contexts are provided, or if neither contexts nor
                       user_contexts are provided.
        Nz)Cannot specify both coordinates and errorz-Cannot specify both contexts and userContextsz,Must specify either contexts or userContextsrO   rP   rQ   userContextsz emulation.setGeolocationOverride)r   r8   rN   executer   )r   rO   rP   rQ   rR   paramss         r   set_geolocation_overridez"Emulation.set_geolocation_override   s    , "u'8HIIIM$=LMMM 5KLLL!#"$/$7$7$9$9F=!!#mmooF7O!)F:&%2F>"	/*LfUUVVVVVr   timezonec                     ||t          d          ||t          d          d|i}|||d<   n|||d<   | j                            t          d|                     dS )aU  Set timezone override for the given contexts or user contexts.

        Parameters:
        -----------
            timezone: Timezone identifier (IANA timezone name or offset string like '+01:00'),
                     or None to clear the override.
            contexts: List of browsing context IDs to apply the override to.
            user_contexts: List of user context IDs to apply the override to.

        Raises:
        ------
            ValueError: If both contexts and user_contexts are provided, or if neither
                       contexts nor user_contexts are provided.
        Nz.Cannot specify both contexts and user_contextsz-Must specify either contexts or user_contextsrX   rQ   rT   zemulation.setTimezoneOverride)r   rN   rU   r   )r   rX   rQ   rR   rV   s        r   set_timezone_overridezEmulation.set_timezone_override   s    ( M$=MNNN 5LMMM",h!7!)F:&%2F>"	/*I6RRSSSSSr   )NNNN)NNN)r9   r:   r;   r<   r   r   r   rD   listrA   rW   rZ   rB   r   r   rL   rL      s          
 9=48(,-1+W +W45+W 01+W 49%	+W
  S	*+W 
+W +W +W +W^ #'(,-1	!T !T3-!T 49%!T  S	*	!T
 
!T !T !T !T !T !Tr   rL   N)	typingr   r   r   %selenium.webdriver.common.bidi.commonr   r   rD   rL   rB   r   r   <module>r^      s   $ ( ' ' ' ' ' ' ' ' ' A A A A A A~ ~ ~ ~ ~ ~ ~ ~B# # # # # # # #VT VT VT VT VT VT VT VT VT VTr   