
     fL                    ~   d dl mZ ddlmZmZ d dlmZ d dlZd dlZe G d d                      Z	 G d d	ej
                  Z G d
 dej
                  Z G d de          Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 dMdNd%ZdOd&Z	 	 	 	 	 	 	 	 dPdQd2Z	 	 dRdSd5Z	 	 	 	 	 dTdUd7ZdVd:Z	 	 dRdWd?Z	 	 	 	 	 	 	 	 	 	 dXdYdIZ	 	 	 dZd[dLZdS )\    )annotations   )event_classT_JSON_DICT)	dataclassNc                      e Zd ZU ded<   ded<   dZded<   dZded<   dZded<   dZded	<   dZded
<   d Z	e
d             ZdS )
TouchPointfloatxyNtyping.Optional[float]radius_xradius_yrotation_angleforceid_c                    t                      }| j        |d<   | j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )Nr   r   radiusXradiusYrotationAngler   id)dictr   r   r   r   r   r   r   )selfjsons     p/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/common/devtools/v85/input_.pyto_jsonzTouchPoint.to_json%   s    vvFS	FS	=$"mDO=$"mDO*$($7D!:! JDM8DJ    c                l    | t          |d                   t          |d                   d|v rt          |d                   nd d|v rt          |d                   nd d|v rt          |d                   nd d|v rt          |d                   nd d|v rt          |d                   nd           S )	Nr   r   r   r   r   r   r   )r   r   r   r   r   r   r   )r
   clsr   s     r   	from_jsonzTouchPoint.from_json5   s    sDIDI/8D/@/@U4	?+++d/8D/@/@U4	?+++d;Jd;R;R5o!6777X\*1T//%W&&&t%)T\\d4j!!!t
 
 
 	
r   )__name__
__module____qualname____annotations__r   r   r   r   r   r   classmethodr!    r   r   r	   r	      s          HHH HHH (,H++++ (,H++++ .2N1111 %)E(((( #'C&&&&    	
 	
 [	
 	
 	
r   r	   c                  6    e Zd ZdZdZdZd Zed             ZdS )GestureSourceTypedefaulttouchmousec                    | j         S Nvaluer   s    r   r   zGestureSourceType.to_jsonG   
    zr   c                     | |          S r.   r'   r   s     r   r!   zGestureSourceType.from_jsonJ       s4yyr   N)	r"   r#   r$   DEFAULTTOUCHMOUSEr   r&   r!   r'   r   r   r)   r)   B   sM        GEE     [  r   r)   c                  B    e Zd ZdZdZdZdZdZdZd Z	e
d             Zd	S )
MouseButtonnoneleftmiddlerightbackforwardc                    | j         S r.   r/   r1   s    r   r   zMouseButton.to_jsonW   r2   r   c                     | |          S r.   r'   r   s     r   r!   zMouseButton.from_jsonZ   r4   r   N)r"   r#   r$   NONELEFTMIDDLERIGHTBACKFORWARDr   r&   r!   r'   r   r   r9   r9   O   s\        DDFEDG     [  r   r9   c                  B     e Zd ZdZddZed	d            Z fdZ xZS )
TimeSinceEpochz<
    UTC time in seconds, counted from January 1, 1970.
    returnr
   c                    | S r.   r'   r1   s    r   r   zTimeSinceEpoch.to_jsonc   s    r   r   c                     | |          S r.   r'   r   s     r   r!   zTimeSinceEpoch.from_jsonf   r4   r   c                j    d                     t                                                                S )NzTimeSinceEpoch({}))formatsuper__repr__)r   	__class__s    r   rP   zTimeSinceEpoch.__repr__j   s'    #**577+;+;+=+=>>>r   )rJ   r
   )r   r
   rJ   rI   )	r"   r#   r$   __doc__r   r&   r!   rP   __classcell__)rQ   s   @r   rI   rI   _   sv                [? ? ? ? ? ? ? ? ?r   rI   type_str	modifierstyping.Optional[int]	timestamptyping.Optional[TimeSinceEpoch]texttyping.Optional[str]unmodified_textkey_identifiercodekeywindows_virtual_key_codenative_virtual_key_codeauto_repeattyping.Optional[bool]	is_keypadis_system_keylocationcommands!typing.Optional[typing.List[str]]rJ   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c              #  >  K   t                      }| |d<   |||d<   ||                                |d<   |||d<   |||d<   |||d<   |||d<   |||d	<   |||d
<   |	|	|d<   |
|
|d<   |||d<   |||d<   |||d<   |d |D             |d<   d|d}|V }dS )a-  
    Dispatches a key event to the page.

    :param type_: Type of the key event.
    :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
    :param timestamp: *(Optional)* Time at which the event occurred.
    :param text: *(Optional)* Text as generated by processing a virtual key code with a keyboard layout. Not needed for for ```keyUp```` and ````rawKeyDown```` events (default: "")
    :param unmodified_text: *(Optional)* Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
    :param key_identifier: *(Optional)* Unique key identifier (e.g., 'U+0041') (default: "").
    :param code: *(Optional)* Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
    :param key: *(Optional)* Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
    :param windows_virtual_key_code: *(Optional)* Windows virtual key code (default: 0).
    :param native_virtual_key_code: *(Optional)* Native virtual key code (default: 0).
    :param auto_repeat: *(Optional)* Whether the event was generated from auto repeat (default: false).
    :param is_keypad: *(Optional)* Whether the event was generated from the keypad (default: false).
    :param is_system_key: *(Optional)* Whether the event was a system key event (default: false).
    :param location: *(Optional)* Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
    :param commands: **(EXPERIMENTAL)** *(Optional)* Editing commands to send with the key event (e.g., 'selectAll') (default: []). These are related to but not equal the command names used in ````document.execCommand``` and NSStandardKeyBindingResponding. See https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
    typeNrV   rX   rZ   unmodifiedTextkeyIdentifierr^   r_   windowsVirtualKeyCodenativeVirtualKeyCode
autoRepeatisKeypadisSystemKeyrf   c                    g | ]}|S r'   r'   .0is     r   
<listcomp>z&dispatch_key_event.<locals>.<listcomp>   s    222Aa222r   rg   zInput.dispatchKeyEventmethodparamsr   r   )rT   rV   rX   rZ   r\   r]   r^   r_   r`   ra   rb   rd   re   rf   rg   rz   cmd_dictr   s                     r   dispatch_key_eventr}   n   s5     H &&FF6N'{'//11{v"#2 !"0v
u+*B&'*)@%&*|&z  -}%z22222z* H >>DDDr   c              #  B   K   t                      }| |d<   d|d}|V }dS )z
    This method emulates inserting text that doesn't come from a key press,
    for example an emoji keyboard or an IME.

    **EXPERIMENTAL**

    :param text: The text to insert.
    rZ   zInput.insertTextrx   Nr   )rZ   rz   r|   r   s       r   insert_textr      s;       &&FF6N$ H >>DDDr   r   r
   r   buttontyping.Optional[MouseButton]buttonsclick_countdelta_xr   delta_ypointer_typec              #    K   t                      }| |d<   ||d<   ||d<   |||d<   ||                                |d<   ||                                |d<   |||d<   |||d	<   |||d
<   |	|	|d<   |
|
|d<   d|d}|V }dS )a  
    Dispatches a mouse event to the page.

    :param type_: Type of the mouse event.
    :param x: X coordinate of the event relative to the main frame's viewport in CSS pixels.
    :param y: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
    :param timestamp: *(Optional)* Time at which the event occurred.
    :param button: *(Optional)* Mouse button (default: "none").
    :param buttons: *(Optional)* A number indicating which buttons are pressed on the mouse when a mouse event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
    :param click_count: *(Optional)* Number of times the mouse button was clicked (default: 0).
    :param delta_x: *(Optional)* X delta in CSS pixels for mouse wheel event (default: 0).
    :param delta_y: *(Optional)* Y delta in CSS pixels for mouse wheel event (default: 0).
    :param pointer_type: *(Optional)* Pointer type (default: "mouse").
    rk   r   r   NrV   rX   r   r   
clickCountdeltaXdeltaYpointerTypezInput.dispatchMouseEventrx   r{   )rT   r   r   rV   rX   r   r   r   r   r   r   rz   r|   r   s                 r   dispatch_mouse_eventr      s      8 &&FF6NF3KF3K'{'//11{!>>++x#y*|"x"x ,}, H >>DDDr   touch_pointstyping.List[TouchPoint]c              #     K   t                      }| |d<   d |D             |d<   |||d<   ||                                |d<   d|d}|V }dS )	au  
    Dispatches a touch event to the page.

    :param type_: Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
    :param touch_points: Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
    :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
    :param timestamp: *(Optional)* Time at which the event occurred.
    rk   c                6    g | ]}|                                 S r'   )r   rt   s     r   rw   z(dispatch_touch_event.<locals>.<listcomp>  s     ???QQYY[[???r   touchPointsNrV   rX   zInput.dispatchTouchEventrx   r{   )rT   r   rV   rX   rz   r|   r   s          r   dispatch_touch_eventr     s       &&FF6N??,???F='{'//11{, H >>DDDr   intc	              #     K   t                      }	| |	d<   ||	d<   ||	d<   |                                |	d<   ||                                |	d<   |||	d<   |||	d<   |||	d	<   |||	d
<   d|	d}
|
V }dS )a)  
    Emulates touch event from the mouse event parameters.

    **EXPERIMENTAL**

    :param type_: Type of the mouse event.
    :param x: X coordinate of the mouse pointer in DIP.
    :param y: Y coordinate of the mouse pointer in DIP.
    :param button: Mouse button. Only "none", "left", "right" are supported.
    :param timestamp: *(Optional)* Time at which the event occurred (default: current time).
    :param delta_x: *(Optional)* X delta in DIP for mouse wheel event (default: 0).
    :param delta_y: *(Optional)* Y delta in DIP for mouse wheel event (default: 0).
    :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
    :param click_count: *(Optional)* Number of times the mouse button was clicked (default: 0).
    rk   r   r   r   NrX   r   r   rV   r   z Input.emulateTouchFromMouseEventrx   r{   )rT   r   r   r   rX   r   r   rV   r   rz   r|   r   s               r   emulate_touch_from_mouse_eventr     s      4 &&FF6NF3KF3K~~''F8'//11{"x"x'{*|4 H >>DDDr   ignoreboolc              #  B   K   t                      }| |d<   d|d}|V }dS )z
    Ignores input events (useful while auditing page).

    :param ignore: Ignores input events processing when set to true.
    r   zInput.setIgnoreInputEventsrx   Nr   )r   rz   r|   r   s       r   set_ignore_input_eventsr   N  s<       &&FF8. H >>DDDr   scale_factorrelative_speedgesture_source_type"typing.Optional[GestureSourceType]c              #     K   t                      }| |d<   ||d<   ||d<   |||d<   ||                                |d<   d|d}|V }dS )	ai  
    Synthesizes a pinch gesture over a time period by issuing appropriate touch events.

    **EXPERIMENTAL**

    :param x: X coordinate of the start of the gesture in CSS pixels.
    :param y: Y coordinate of the start of the gesture in CSS pixels.
    :param scale_factor: Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
    :param relative_speed: *(Optional)* Relative pointer speed in pixels per second (default: 800).
    :param gesture_source_type: *(Optional)* Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
    r   r   scaleFactorNrelativeSpeedgestureSourceTypezInput.synthesizePinchGesturerx   r{   )r   r   r   r   r   rz   r|   r   s           r   synthesize_pinch_gesturer   _  s{      $ &&FF3KF3K(F=!"0&&9&A&A&C&C"#0 H >>DDDr   
x_distance
y_distancex_overscrolly_overscrollprevent_flingspeedrepeat_countrepeat_delay_msinteraction_marker_namec              #     K   t                      }| |d<   ||d<   |||d<   |||d<   |||d<   |||d<   |||d<   |||d	<   ||                                |d
<   |	|	|d<   |
|
|d<   |||d<   d|d}|V }dS )ai  
    Synthesizes a scroll gesture over a time period by issuing appropriate touch events.

    **EXPERIMENTAL**

    :param x: X coordinate of the start of the gesture in CSS pixels.
    :param y: Y coordinate of the start of the gesture in CSS pixels.
    :param x_distance: *(Optional)* The distance to scroll along the X axis (positive to scroll left).
    :param y_distance: *(Optional)* The distance to scroll along the Y axis (positive to scroll up).
    :param x_overscroll: *(Optional)* The number of additional pixels to scroll back along the X axis, in addition to the given distance.
    :param y_overscroll: *(Optional)* The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
    :param prevent_fling: *(Optional)* Prevent fling (default: true).
    :param speed: *(Optional)* Swipe speed in pixels per second (default: 800).
    :param gesture_source_type: *(Optional)* Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
    :param repeat_count: *(Optional)* The number of times to repeat the gesture (default: 0).
    :param repeat_delay_ms: *(Optional)* The number of milliseconds delay between each repeat. (default: 250).
    :param interaction_marker_name: *(Optional)* The name of the interaction markers to generate, if not empty (default: "").
    r   r   N	xDistance	yDistancexOverscrollyOverscrollpreventFlingr   r   repeatCountrepeatDelayMsinteractionMarkerNamezInput.synthesizeScrollGesturerx   r{   )r   r   r   r   r   r   r   r   r   r   r   r   rz   r|   r   s                  r   synthesize_scroll_gesturer     s      @ &&FF3KF3K({({ ,} ,} !.~w&&9&A&A&C&C"# ,}""1**A&'1 H >>DDDr   duration	tap_countc              #     K   t                      }| |d<   ||d<   |||d<   |||d<   ||                                |d<   d|d}|V }dS )	au  
    Synthesizes a tap gesture over a time period by issuing appropriate touch events.

    **EXPERIMENTAL**

    :param x: X coordinate of the start of the gesture in CSS pixels.
    :param y: Y coordinate of the start of the gesture in CSS pixels.
    :param duration: *(Optional)* Duration between touchdown and touchup events in ms (default: 50).
    :param tap_count: *(Optional)* Number of times to perform the tap (e.g. 2 for double tap, default: 1).
    :param gesture_source_type: *(Optional)* Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
    r   r   Nr   tapCountr   zInput.synthesizeTapGesturerx   r{   )r   r   r   r   r   rz   r|   r   s           r   synthesize_tap_gesturer     s      $ &&FF3KF3K%z&z&&9&A&A&C&C"#. H >>DDDr   )NNNNNNNNNNNNNN) rT   rU   rV   rW   rX   rY   rZ   r[   r\   r[   r]   r[   r^   r[   r_   r[   r`   rW   ra   rW   rb   rc   rd   rc   re   rc   rf   rW   rg   rh   rJ   ri   )rZ   rU   rJ   ri   )NNNNNNNN)rT   rU   r   r
   r   r
   rV   rW   rX   rY   r   r   r   rW   r   rW   r   r   r   r   r   r[   rJ   ri   )NN)
rT   rU   r   r   rV   rW   rX   rY   rJ   ri   )NNNNN)rT   rU   r   r   r   r   r   r9   rX   rY   r   r   r   r   rV   rW   r   rW   rJ   ri   )r   r   rJ   ri   )r   r
   r   r
   r   r
   r   rW   r   r   rJ   ri   )
NNNNNNNNNN)r   r
   r   r
   r   r   r   r   r   r   r   r   r   rc   r   rW   r   r   r   rW   r   rW   r   r[   rJ   ri   )NNN)r   r
   r   r
   r   rW   r   rW   r   r   rJ   ri   )
__future__r   utilr   r   dataclassesr   enumtypingr	   Enumr)   r9   r
   rI   r}   r   r   r   r   r   r   r   r   r'   r   r   <module>r      s   # " " " " " * * * * * * * * ! ! ! ! ! !  
1
 1
 1
 1
 1
 1
 1
 1
h
 
 
 
 
	 
 
 
    $)    ? ? ? ? ?U ? ? ?" +/59%)04/3%)$(9=8<-1+//3)-6:F F F F FR   0 +/59/3(,,0*.*.-14 4 4 4 4t +/59	    B 6:*.*.*.,0- - - - -`   * 04BF    H .2-1/3/3/3&*BF-1048<; ; ; ; ;B *.*.BF      r   