
    ]jA"              	      \   d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZmZ  G d d      Z G d	 d
      Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d             Ze G d d              Ze G d! d"             Ze G d# d$             Ze G d% d&             Ze G d' d(             Ze G d) d*             Z e G d+ d,             Z!e G d- d.             Z"d/d0iZ# G d1 d2      Z$ e%       jM                  d*e'      Z( e%       Z)d/ ed/d0e)jM                  d3      re)jM                  d3e'      ne'      ie$_*        y4)5    )annotations)Callable)	dataclassfield)Any)command_builder)EventConfig_EventWrapper_EventManagerc                      e Zd ZdZdZdZdZy)PointerTypezPointerType.mousepentouchN)__name__
__module____qualname____doc__MOUSEPENTOUCH     X/home/ubuntu/.local/lib/python3.12/site-packages/selenium/webdriver/common/bidi/input.pyr   r      s    E
CEr   r   c                      e Zd ZdZdZdZy)OriginzOrigin.viewportpointerN)r   r   r   r   VIEWPORTPOINTERr   r   r   r   r      s    HGr   r   c                  >    e Zd ZU dZ edd      Zded<   dZded<   y)	ElementOriginzElementOrigin.elementFdefaultinitstrtypeN
Any | None)r   r   r   r   r   r(   __annotations__r#   r   r   r   r"   r"      s     ie4D#4GZr   r"   c                  <    e Zd ZU dZdZded<    ee      Zded<   y)PerformActionsParameterszPerformActionsParameters.Nr)   contextdefault_factory	list[Any]actions)	r   r   r   r   r-   r*   r   listr1   r   r   r   r,   r,   '   s    #GZt4GY4r   r,   c                  Z    e Zd ZU dZ edd      Zded<   dZded	<    ee
      Z	ded<   y)NoneSourceActionszNoneSourceActions.noneFr$   r'   r(   N
str | Noneidr.   r0   r1   
r   r   r   r   r   r(   r*   r7   r2   r1   r   r   r   r4   r4   /   s/    f51D#1B
t4GY4r   r4   c                  Z    e Zd ZU dZ edd      Zded<   dZded	<    ee
      Z	ded<   y)KeySourceActionszKeySourceActions.keyFr$   r'   r(   Nr6   r7   r.   r0   r1   r8   r   r   r   r:   r:   8   s/    e%0D#0B
t4GY4r   r:   c                  h    e Zd ZU dZ edd      Zded<   dZded	<   dZd
ed<    ee	      Z
ded<   y)PointerSourceActionszPointerSourceActions.r   Fr$   r'   r(   Nr6   r7   r)   
parametersr.   r0   r1   )r   r   r   r   r   r(   r*   r7   r>   r2   r1   r   r   r   r=   r=   A   s9    ie4D#4B
!J
!t4GY4r   r=   c                       e Zd ZU dZdZded<   y)PointerParameterszPointerParameters.Nr)   pointer_type)r   r   r   r   rA   r*   r   r   r   r@   r@   K   s    #L*#r   r@   c                  Z    e Zd ZU dZ edd      Zded<   dZded	<    ee
      Z	ded<   y)WheelSourceActionszWheelSourceActions.wheelFr$   r'   r(   Nr6   r7   r.   r0   r1   r8   r   r   r   rC   rC   R   s/    gE2D#2B
t4GY4r   rC   c                  >    e Zd ZU dZ edd      Zded<   dZded	<   y)
PauseActionzPauseAction.pauseFr$   r'   r(   Nr)   duration)r   r   r   r   r   r(   r*   rH   r   r   r   rF   rF   [   s     gE2D#2Hjr   rF   c                  >    e Zd ZU dZ edd      Zded<   dZded	<   y)
KeyDownActionzKeyDownAction.keyDownFr$   r'   r(   Nr6   valuer   r   r   r   r   r(   r*   rL   r   r   r   rJ   rJ   c   s     ie4D#4E:r   rJ   c                  >    e Zd ZU dZ edd      Zded<   dZded	<   y)
KeyUpActionzKeyUpAction.keyUpFr$   r'   r(   Nr6   rL   rM   r   r   r   rO   rO   k   s     gE2D#2E:r   rO   c                  >    e Zd ZU dZ edd      Zded<   dZded	<   y)
PointerUpActionzPointerUpAction.	pointerUpFr$   r'   r(   Nr)   button)r   r   r   r   r   r(   r*   rT   r   r   r   rR   rR   s   s     k6D#6FJr   rR   c                      e Zd ZU dZ 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ded<   dZded<   y)WheelScrollActionzWheelScrollAction.scrollFr$   r'   r(   Nr)   xydelta_xdelta_yrH   origin)r   r   r   r   r   r(   r*   rX   rY   rZ   r[   rH   r\   r   r   r   rV   rV   {   sR    hU3D#3AzAzGZGZHjFJr   rV   c                  t    e Zd ZU dZ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
ded	<   dZded
<   y)PointerCommonPropertieszPointerCommonProperties.Nr)   widthheightpressuretangential_pressuretwistaltitude_angleazimuth_angle)r   r   r   r   r_   r*   r`   ra   rb   rc   rd   re   r   r   r   r^   r^      sL    "E:FJHj&**E:!%NJ% $M:$r   r^   c                       e Zd ZU dZdZded<   y)ReleaseActionsParameterszReleaseActionsParameters.Nr)   r-   )r   r   r   r   r-   r*   r   r   r   rg   rg      s    #GZr   rg   c                  J    e Zd ZU dZdZded<   dZded<    ee      Z	ded<   y)	SetFilesParameterszSetFilesParameters.Nr)   r-   r#   r.   r0   files)
r   r   r   r   r-   r*   r#   r   r2   rj   r   r   r   ri   ri      s(    GZGZT2E92r   ri   c                  N    e Zd ZU dZdZded<   dZded<   dZded<   ed	d       Z	y)
FileDialogInfozAFileDialogInfo - parameters for the input.fileDialogOpened event.Nr)   r-   r#   zbool | Nonemultiplec                r     | |j                  d      |j                  d      |j                  d            S )z-Deserialize event params into FileDialogInfo.r-   r#   rm   )r-   r#   rm   )get)clsparamss     r   	from_jsonzFileDialogInfo.from_json   s5     JJy)JJy)ZZ
+
 	
r   )rq   dictreturnrl   )
r   r   r   r   r-   r*   r#   rm   classmethodrr   r   r   r   rl   rl      s5    KGZGZ Hk 
 
r   rl   c                  v    e Zd ZU dZ 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ded<   y)PointerMoveActionzPointerMoveAction.pointerMoveFr$   r'   r(   Nr)   rX   rY   rH   r\   
properties)r   r   r   r   r   r(   r*   rX   rY   rH   r\   ry   r   r   r   rw   rw      sH    m%8D#8AzAzHjFJ!J
!r   rw   c                  L    e Zd ZU dZ edd      Zded<   dZded	<   dZded
<   y)PointerDownActionzPointerDownAction.pointerDownFr$   r'   r(   Nr)   rT   ry   )	r   r   r   r   r   r(   r*   rT   ry   r   r   r   r{   r{      s*    m%8D#8FJ!J
!r   r{   file_dialog_openedzinput.fileDialogOpenedc                  p    e Zd ZU dZi Zded<   ddZdddZdddZdddZ	dd	Z
dd
ZdddZddZddZy)InputzWebDriver BiDi input module.zdict[str, EventConfig]EVENT_CONFIGSc                H    || _         t        || j                        | _        y N)_connr   r   _event_manager)selfconns     r   __init__zInput.__init__   s    
+D$2D2DEr   Nc                    |t        d      |t        d      ||d}|j                         D ci c]  \  }}|	|| }}}t        d|      }| j                  j	                  |      }|S c c}}w )zExecute input.performActionsz6perform_actions() missing required argument: 'context'z6perform_actions() missing required argument: 'actions')r-   r1   zinput.performActions	TypeErroritemsr   r   execute)r   r-   r1   rq   kvcmdresults           r   perform_actionszInput.perform_actions   s    ?TUU?TUU 
 $*<<>C41aQ]!Q$CC4f=##C( Ds
   
A/A/c                    |t        d      d|i}|j                         D ci c]  \  }}|	|| }}}t        d|      }| j                  j	                  |      }|S c c}}w )zExecute input.releaseActionsz6release_actions() missing required argument: 'context'r-   zinput.releaseActionsr   )r   r-   rq   r   r   r   r   s          r   release_actionszInput.release_actions   st    ?TUU w
 $*<<>C41aQ]!Q$CC4f=##C( Ds
   
A!A!c                   |t        d      |t        d      |t        d      |||d}|j                         D ci c]  \  }}|	|| }}}t        d|      }| j                  j	                  |      }|S c c}}w )zExecute input.setFilesz0set_files() missing required argument: 'context'z0set_files() missing required argument: 'element'z.set_files() missing required argument: 'files')r-   r#   rj   zinput.setFilesr   )	r   r-   r#   rj   rq   r   r   r   r   s	            r   	set_fileszInput.set_files   s    ?NOO?NOO=LMM 

 $*<<>C41aQ]!Q$CC.7##C( Ds   
A=A=c                :    | j                   j                  d|      S )zSubscribe to the input.fileDialogOpened event.

        Args:
            callback: Callable invoked with a FileDialogInfo when a file dialog opens.

        Returns:
            A handler ID that can be passed to remove_file_dialog_handler.
        r}   r   add_event_handler)r   callbacks     r   add_file_dialog_handlerzInput.add_file_dialog_handler  s     ""445I8TTr   c                :    | j                   j                  d|      S )zUnsubscribe a previously registered file dialog event handler.

        Args:
            handler_id: The handler ID returned by add_file_dialog_handler.
        r}   r   remove_event_handler)r   
handler_ids     r   remove_file_dialog_handlerz Input.remove_file_dialog_handler  s     ""778LjYYr   c                <    | j                   j                  |||      S )a  Add an event handler.

        Args:
            event: The event to subscribe to.
            callback: The callback function to execute on event.
            contexts: The context IDs to subscribe to (optional).

        Returns:
            The callback ID.
        r   )r   eventr   contextss       r   r   zInput.add_event_handler  s     ""44UHhOOr   c                :    | j                   j                  ||      S )zRemove an event handler.

        Args:
            event: The event to unsubscribe from.
            callback_id: The callback ID.
        r   )r   r   callback_ids      r   r   zInput.remove_event_handler&  s     ""77{KKr   c                6    | j                   j                         S )zClear all event handlers.)r   clear_event_handlers)r   s    r   r   zInput.clear_event_handlers/  s    ""7799r   )rt   None)NN)r-   r)   r1   list[Any] | Noner   )r-   r)   )NNN)r-   r)   r#   r)   rj   r   )rt   int)r   r   rt   r   )r   r'   r   r   r   zlist[str] | Nonert   r   )r   r'   r   r   rt   r   )r   r   r   r   r   r*   r   r   r   r   r   r   r   r   r   r   r   r   r   r      sB    &,.M).F &	UZPL:r   r   FileDialogOpenedN)+
__future__r   collections.abcr   dataclassesr   r   typingr   %selenium.webdriver.common.bidi.commonr   -selenium.webdriver.common.bidi._event_managerr	   r
   r   r   r   r"   r,   r4   r:   r=   r@   rC   rF   rJ   rO   rR   rV   r^   rg   ri   rl   rw   r{   EVENT_NAME_MAPPINGr   globalsro   rs   r   _globalsr   r   r   r   <module>r      sf   # $ (  A c c      5 5 5 5 5 5 5 5 5 5 5 5 $ $ $ 5 5 5                	 	 	 	% 	% 	%    3 3 3 
 
 
  " " " " " " 2 c: c:N 9==!148  9+ 2:,,?Q2R'.X\ r   