ó
    X– jy6  ã                  óš   • S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJrJr  SSKJr  SS	KJr  \(       a  SS
KJr   " S S5      rg)z The ActionChains implementation.é    )Úannotations)ÚTYPE_CHECKING)ÚActionBuilder)ÚKeyInput)ÚPointerInput)ÚScrollOriginÚ
WheelInput)Úkeys_to_typing)Ú
WebElement)Ú	WebDriverc                  ó0  • \ rS rSrSr  S       SS jjrSS jrSS jrSS S jjrSS S jjr	SS S	 jjr
SS S
 jjrS!S jrS"S jrSS#S jjrSS#S jjrS$S jrS%S jrS&S jrS'S jrSS S jjrS(S jrS)S jrS*S jrS+S jrS,S jrS-S jrSS jrSrg).ÚActionChainsé"   aÔ  Automate low-level interactions like mouse movements, button actions, key presses, and context menus.

ActionChains are a way to automate low level interactions such as mouse
movements, mouse button actions, key press, and context menu interactions.
This is useful for doing more complex actions like hover over and drag and
drop.

Generate user actions.
   When you call methods for actions on the ActionChains object,
   the actions are stored in a queue in the ActionChains object.
   When you call perform(), the events are fired in the order they
   are queued up.

ActionChains can be used in a chain pattern::

    menu = driver.find_element(By.CSS_SELECTOR, ".nav")
    hidden_submenu = driver.find_element(By.CSS_SELECTOR, ".nav #submenu1")

    ActionChains(driver).move_to_element(menu).click(hidden_submenu).perform()

Or actions can be queued up one by one, then performed.::

    menu = driver.find_element(By.CSS_SELECTOR, ".nav")
    hidden_submenu = driver.find_element(By.CSS_SELECTOR, ".nav #submenu1")

    actions = ActionChains(driver)
    actions.move_to_element(menu)
    actions.click(hidden_submenu)
    actions.perform()

Either way, the actions are performed in the order they are called, one after
another.
Nc                ó  • Xl         SnSnSnUbe  [        U[        5      (       aP  U HJ  n[        U[        5      (       a  Un[        U[        5      (       a  Un[        U[
        5      (       d  MH  UnML     [        XXVUS9U l        g)aL  Creates a new ActionChains.

Args:
    driver: The WebDriver instance which performs user actions.
    duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in PointerInput
    devices: Optional list of input devices (PointerInput, KeyInput, WheelInput) to use.
        If not provided, default devices will be created.
N)ÚmouseÚkeyboardÚwheelÚduration)Ú_driverÚ
isinstanceÚlistr   r   r	   r   Úw3c_actions)ÚselfÚdriverr   Údevicesr   r   r   Údevices           Úx/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/selenium/webdriver/common/action_chains.pyÚ__init__ÚActionChains.__init__E   s~   € ð ŒØˆØˆØˆØÑ¤:¨g´t×#<Ñ#<Û!Ü˜f¤l×3Ñ3Ø"EÜ˜f¤h×/Ñ/Ø%HÜ˜f¤j×1Ó1Ø"’Eñ "ô )¨ÀxÐgoÑpˆÕó    c                ó8   • U R                   R                  5         g)zPerforms all stored actions.N)r   Úperform©r   s    r   r"   ÚActionChains.performa   s   € à×Ñ× Ñ Õ"r    c                ó’   • U R                   R                  5         U R                   R                   H  nUR                  5         M     g)z3Clear actions stored locally and on the remote end.N)r   Úclear_actionsr   )r   r   s     r   Úreset_actionsÚActionChains.reset_actionse   s6   € à×Ñ×&Ñ&Ô(Ø×&Ñ&×.Ô.ˆFØ× Ñ Ö"ò /r    c                ó  • U(       a  U R                  U5        U R                  R                  R                  5         U R                  R                  R                  5         U R                  R                  R                  5         U $ )zsClicks an element.

Args:
    on_element: The element to click.
        If None, clicks on current mouse position.
)Úmove_to_elementr   Úpointer_actionÚclickÚ
key_actionÚpause©r   Ú
on_elements     r   r,   ÚActionChains.clickk   sb   € ö Ø× Ñ  Ô,à×Ñ×'Ñ'×-Ñ-Ô/Ø×Ñ×#Ñ#×)Ñ)Ô+Ø×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                óÆ   • U(       a  U R                  U5        U R                  R                  R                  5         U R                  R                  R                  5         U $ )z•Holds down the left mouse button on an element.

Args:
    on_element: The element to mouse down.
        If None, clicks on current mouse position.
)r*   r   r+   Úclick_and_holdr-   r.   r/   s     r   r3   ÚActionChains.click_and_hold{   sJ   € ö Ø× Ñ  Ô,à×Ñ×'Ñ'×6Ñ6Ô8Ø×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                ó  • U(       a  U R                  U5        U R                  R                  R                  5         U R                  R                  R                  5         U R                  R                  R                  5         U $ )zžPerforms a context-click (right click) on an element.

Args:
    on_element: The element to context-click.
        If None, clicks on current mouse position.
)r*   r   r+   Úcontext_clickr-   r.   r/   s     r   r6   ÚActionChains.context_clickŠ   sb   € ö Ø× Ñ  Ô,à×Ñ×'Ñ'×5Ñ5Ô7Ø×Ñ×#Ñ#×)Ñ)Ô+Ø×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                óê   • U(       a  U R                  U5        U R                  R                  R                  5         [	        S5       H'  nU R                  R
                  R                  5         M)     U $ )zDouble-clicks an element.

Args:
    on_element: The element to double-click.
        If None, clicks on current mouse position.
é   )r*   r   r+   Údouble_clickÚranger-   r.   )r   r0   Ú_s      r   r:   ÚActionChains.double_clickš   sZ   € ö Ø× Ñ  Ô,à×Ñ×'Ñ'×4Ñ4Ô6Üq–ˆAØ×Ñ×'Ñ'×-Ñ-Ö/ñ ð ˆr    c                óJ   • U R                  U5        U R                  U5        U $ )z£Hold down the left mouse button on an element, then move to target and release.

Args:
    source: The element to mouse down.
    target: The element to mouse up.
)r3   Úrelease)r   ÚsourceÚtargets      r   Údrag_and_dropÚActionChains.drag_and_dropª   s#   € ð 	×Ñ˜FÔ#Ø‰VÔØˆr    c                ój   • U R                  U5        U R                  X#5        U R                  5         U $ )zÂHold down the left mouse button on an element, then move by offset and release.

Args:
    source: The element to mouse down.
    xoffset: X offset to move to.
    yoffset: Y offset to move to.
)r3   Úmove_by_offsetr?   )r   r@   ÚxoffsetÚyoffsets       r   Údrag_and_drop_by_offsetÚ$ActionChains.drag_and_drop_by_offsetµ   s.   € ð 	×Ñ˜FÔ#Ø×Ñ˜GÔ-Ø‰ŒØˆr    c                óÈ   • U(       a  U R                  U5        U R                  R                  R                  U5        U R                  R                  R                  5         U $ )al  Send a key press only without releasing it (modifier keys only).

Args:
    value: The modifier key to send. Values are defined in `Keys` class.
    element: The element to send keys.
        If None, sends a key to current focused element.

Example, pressing ctrl+c::

    ActionChains(driver).key_down(Keys.CONTROL).send_keys("c").key_up(Keys.CONTROL).perform()
)r,   r   r-   Úkey_downr+   r.   ©r   ÚvalueÚelements      r   rK   ÚActionChains.key_downÂ   sJ   € ö ØJ‰JwÔà×Ñ×#Ñ#×,Ñ,¨UÔ3Ø×Ñ×'Ñ'×-Ñ-Ô/àˆr    c                óÈ   • U(       a  U R                  U5        U R                  R                  R                  U5        U R                  R                  R                  5         U $ )aB  Releases a modifier key.

Args:
    value: The modifier key to send. Values are defined in Keys class.
    element: The element to send keys.
        If None, sends a key to current focused element.

Example, pressing ctrl+c::

    ActionChains(driver).key_down(Keys.CONTROL).send_keys("c").key_up(Keys.CONTROL).perform()
)r,   r   r-   Úkey_upr+   r.   rL   s      r   rQ   ÚActionChains.key_upÖ   sJ   € ö ØJ‰JwÔà×Ñ×#Ñ#×*Ñ*¨5Ô1Ø×Ñ×'Ñ'×-Ñ-Ô/àˆr    c                ó˜   • U R                   R                  R                  X5        U R                   R                  R	                  5         U $ )zÌMoving the mouse to an offset from current mouse position.

Args:
    xoffset: X offset to move to, as a positive or negative integer.
    yoffset: Y offset to move to, as a positive or negative integer.
)r   r+   Úmove_byr-   r.   )r   rF   rG   s      r   rE   ÚActionChains.move_by_offsetê   s;   € ð 	×Ñ×'Ñ'×/Ñ/°ÔAØ×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                ó˜   • U R                   R                  R                  U5        U R                   R                  R	                  5         U $ )z`Moving the mouse to the middle of an element.

Args:
    to_element: The WebElement to move to.
)r   r+   Úmove_tor-   r.   )r   Ú
to_elements     r   r*   ÚActionChains.move_to_elementö   s;   € ð 	×Ñ×'Ñ'×/Ñ/°
Ô;Ø×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                óÀ   • U R                   R                  R                  U[        U5      [        U5      5        U R                   R                  R                  5         U $ )a7  Move the mouse to an element with the specified offsets.

Offsets are relative to the in-view center point of the element.

Args:
    to_element: The WebElement to move to.
    xoffset: X offset to move to, as a positive or negative integer.
    yoffset: Y offset to move to, as a positive or negative integer.
)r   r+   rW   Úintr-   r.   )r   rX   rF   rG   s       r   Úmove_to_element_with_offsetÚ(ActionChains.move_to_element_with_offset  sG   € ð 	×Ñ×'Ñ'×/Ñ/°
¼CÀ»LÌ#ÈgË,ÔWØ×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                ó¬   • U R                   R                  R                  U5        U R                   R                  R                  [	        U5      5        U $ )z7Pause all inputs for the specified duration in seconds.)r   r+   r.   r-   r[   )r   Úsecondss     r   r.   ÚActionChains.pause  s?   € à×Ñ×'Ñ'×-Ñ-¨gÔ6Ø×Ñ×#Ñ#×)Ñ)¬#¨g«,Ô7àˆr    c                óÆ   • U(       a  U R                  U5        U R                  R                  R                  5         U R                  R                  R                  5         U $ )z’Releasing a held mouse button on an element.

Args:
    on_element: The element to mouse up.
        If None, releases on current mouse position.
)r*   r   r+   r?   r-   r.   r/   s     r   r?   ÚActionChains.release  sJ   € ö Ø× Ñ  Ô,à×Ñ×'Ñ'×/Ñ/Ô1Ø×Ñ×#Ñ#×)Ñ)Ô+àˆr    c                ór   • [        U5      nU H%  nU R                  U5        U R                  U5        M'     U $ )z”Sends keys to current focused element.

Args:
    keys_to_send: The keys to send. Modifier keys constants can be found in the
        'Keys' class.
)r
   rK   rQ   )r   Úkeys_to_sendÚtypingÚkeys       r   Ú	send_keysÚActionChains.send_keys&  s7   € ô   Ó-ˆãˆCØM‰M˜#ÔØK‰K˜Öñ ð ˆr    c                óF   • U R                  U5        U R                  " U6   U $ )z®Sends keys to an element.

Args:
    element: The element to send keys.
    keys_to_send: The keys to send. Modifier keys constants can be found in the
        'Keys' class.
)r,   rg   )r   rN   rd   s      r   Úsend_keys_to_elementÚ!ActionChains.send_keys_to_element5  s!   € ð 	
‰
7ÔØŠ˜Ñ%Øˆr    c                óL   • U R                   R                  R                  US9  U $ )zºScroll the element into the viewport if it's outside it.

Scrolls the bottom of the element to the bottom of the viewport.

Args:
    element: Which element to scroll into the viewport.
)Úorigin©r   Úwheel_actionÚscroll)r   rN   s     r   Úscroll_to_elementÚActionChains.scroll_to_elementA  s&   € ð 	×Ñ×%Ñ%×,Ñ,°GÐ,Ñ<Øˆr    c                óL   • U R                   R                  R                  XS9  U $ )aX  Scroll by a provided amount with the origin in the top left corner.

Scrolls by provided amounts with the origin in the top left corner
of the viewport.

Args:
    delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
    delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
)Údelta_xÚdelta_yrn   )r   rt   ru   s      r   Úscroll_by_amountÚActionChains.scroll_by_amountL  s&   € ð 	×Ñ×%Ñ%×,Ñ,°WÐ,ÑNØˆr    c                óè   • [        U[        5      (       d  [        S[        U5       35      eU R                  R
                  R                  UR                  UR                  UR                  UUS9  U $ )aÉ  Scroll by a provided amount based on a scroll origin (element or viewport).

The scroll origin is either the center of an element or the upper left of the
viewport plus any offsets. If the origin is an element, and the element
is not in the viewport, the bottom of the element will first be
scrolled to the bottom of the viewport.

Args:
    scroll_origin: Where scroll originates (viewport or element center) plus provided offsets.
    delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
    delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.

Raises:
    MoveTargetOutOfBoundsException: If the origin with offset is outside the viewport.
z+Expected object of type ScrollOrigin, got: )rm   ÚxÚyrt   ru   )
r   r   Ú	TypeErrorÚtyper   ro   rp   rm   Úx_offsetÚy_offset)r   Úscroll_originrt   ru   s       r   Úscroll_from_originÚActionChains.scroll_from_originY  sq   € ô  ˜-¬×6Ñ6ÜÐIÌ$È}ÓJ]ÐI^Ð_Ó`Ð`à×Ñ×%Ñ%×,Ñ,Ø ×'Ñ'Ø×$Ñ$Ø×$Ñ$ØØð 	-ñ 	
ð ˆr    c                ó   • U $ ©N© r#   s    r   Ú	__enter__ÚActionChains.__enter__w  s   € Øˆr    c                ó   • g rƒ   r„   )r   Ú_typeÚ_valueÚ
_tracebacks       r   Ú__exit__ÚActionChains.__exit__z  s   € Ør    )r   r   )éú   N)r   r   r   r[   r   z1list[PointerInput | KeyInput | WheelInput] | NoneÚreturnÚNone)rŽ   r   rƒ   )r0   úWebElement | NonerŽ   r   )r@   r   rA   r   rŽ   r   )r@   r   rF   r[   rG   r[   rŽ   r   )rM   ÚstrrN   r   rŽ   r   )rF   r[   rG   r[   rŽ   r   )rX   r   rŽ   r   )rX   r   rF   r[   rG   r[   rŽ   r   )r_   zfloat | intrŽ   r   )rd   r‘   rŽ   r   )rN   r   rd   r‘   rŽ   r   )rN   r   rŽ   r   )rt   r[   ru   r[   rŽ   r   )r   r   rt   r[   ru   r[   rŽ   r   )rŽ   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r"   r'   r,   r3   r6   r:   rB   rH   rK   rQ   rE   r*   r\   r.   r?   rg   rj   rq   rv   r€   r…   r‹   Ú__static_attributes__r„   r    r   r   r   "   s¯   † ñ ðJ ØEIð	qàðqð ðqð Cð	qð
 
õqô8#ô#öö öö ô 	ôöö(ô(
ô	ôôöôô
ô	ôôô<÷r    r   N)r–   Ú
__future__r   re   r   Ú0selenium.webdriver.common.actions.action_builderr   Ú+selenium.webdriver.common.actions.key_inputr   Ú/selenium.webdriver.common.actions.pointer_inputr   Ú-selenium.webdriver.common.actions.wheel_inputr   r	   Úselenium.webdriver.common.utilsr
   Ú$selenium.webdriver.remote.webelementr   Ú#selenium.webdriver.remote.webdriverr   r   r„   r    r   Ú<module>r       s4   ðñ" 'å "å  å JÝ @Ý Hß RÝ :Ý ;æÝ=÷Yò Yr    