a
    $ñ»j=  ã                   @  s°  d dl mZ d dlZd dlmZ ddlmZmZ ddlm	Z	 ddlm
Z
 eG dd	„ d	ƒƒZeG d
d„ dƒƒZeG dd„ dƒƒZeG dd„ dƒƒZeG dd„ dƒƒZddœdd„Zddœdd„Zdddœdd„Zddœdd„Zddd œd!d"„Zdd#d$œd%d&„Zdd'dd(œd)d*„Zdd+dd,œd-d.„Zd'dd/œd0d1„Zdd'd'dd2œd3d4„Zed5ƒeG d6d7„ d7ƒƒƒZed8ƒeG d9d:„ d:ƒƒƒZed;ƒeG d<d=„ d=ƒƒƒZed>ƒeG d?d@„ d@ƒƒƒZdS )Aé    )ÚannotationsN)Ú	dataclassé   )Úevent_classÚT_JSON_DICT)Údom)Úruntimec                   @  s˜   e Zd ZU dZded< ded< ded< ded< ded	< ded
< ded< ded< dZded< dZded< dZded< ddœdd„Ze	dd dœdd„ƒZ
dS )Ú	AnimationzAnimation instance.ÚstrÚid_ÚnameÚboolÚpaused_stateÚ
play_stateÚfloatÚplayback_rateÚ
start_timeÚcurrent_timeÚtype_Nz typing.Optional[AnimationEffect]Úsourceútyping.Optional[str]Úcss_idz%typing.Optional[ViewOrScrollTimeline]Úview_or_scroll_timeliner   ©Úreturnc                 C  sž   t ƒ }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j	d urn| j	 
¡ |d	< | jd ur‚| j|d
< | jd urš| j 
¡ |d< |S )NÚidr   ÚpausedStateÚ	playStateÚplaybackRateÚ	startTimeÚcurrentTimeÚtyper   ÚcssIdÚviewOrScrollTimeline)Údictr   r   r   r   r   r   r   r   r   Úto_jsonr   r   ©ÚselfÚjson© r)   ú5E:\soccer\ml_env\Lib\site-packages\mycdp/animation.pyr%   /   s"    











ÿzAnimation.to_json©r(   r   c                 C  s¶   | t |d ƒt |d ƒt|d ƒt |d ƒt|d ƒt|d ƒt|d ƒt |d ƒ| d	d ¡d urpt |d	 ¡nd | d
d ¡d urŽt |d
 ƒnd | dd ¡d ur®t |d ¡nd d�S )Nr   r   r   r   r   r   r    r!   r   r"   r#   )r   r   r   r   r   r   r   r   r   r   r   )r
   r   r   ÚgetÚAnimationEffectÚ	from_jsonÚViewOrScrollTimeline©Úclsr(   r)   r)   r*   r.   C   s&    







ÿÿÿêzAnimation.from_json)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r   r%   Úclassmethodr.   r)   r)   r)   r*   r	      s   
r	   c                   @  sl   e Zd ZU 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dœdd„Z	e
dd dœdd„ƒZdS )r/   zTimeline instance.zdom.ScrollOrientationÚaxisNú"typing.Optional[dom.BackendNodeId]Úsource_node_idútyping.Optional[float]Ústart_offsetÚ
end_offsetÚsubject_node_idr   r   c                 C  sp   t ƒ }| j ¡ |d< | jd ur,| j ¡ |d< | jd ur@| j|d< | jd urT| j|d< | jd url| j ¡ |d< |S )Nr8   ÚsourceNodeIdÚstartOffsetÚ	endOffsetÚsubjectNodeId)r$   r8   r%   r:   r<   r=   r>   r&   r)   r)   r*   r%   r   s    





zViewOrScrollTimeline.to_jsonr+   c              	   C  s–   | t j |d ¡| dd ¡d ur0t j |d ¡nd | dd ¡d urNt|d ƒnd | dd ¡d urlt|d ƒnd | dd ¡d urŽt j |d ¡nd d�S )Nr8   r?   r@   rA   rB   )r8   r:   r<   r=   r>   )r   ZScrollOrientationr.   r,   ÚBackendNodeIdr   r0   r)   r)   r*   r.      s    ÿÿÿÿìzViewOrScrollTimeline.from_json)r2   r3   r4   r5   r6   r:   r<   r=   r>   r%   r7   r.   r)   r)   r)   r*   r/   `   s   
r/   c                   @  s�   e Zd ZU dZded< ded< ded< dZded< ded	< d
ed< d
ed< d
ed< dZded< dZded< ddœdd„Ze	dd dœdd„ƒZ
dS )r-   zAnimationEffect instance.r   ÚdelayÚ	end_delayÚiteration_startNr;   Ú
iterationsÚdurationr
   Ú	directionÚfillÚeasingr9   Úbackend_node_idztyping.Optional[KeyframesRule]Úkeyframes_ruler   r   c                 C  s”   t ƒ }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | jd ur`| j|d< | j	d urx| j	 
¡ |d	< | jd ur�| j 
¡ |d
< |S )NrD   ÚendDelayÚiterationStartrH   rI   rJ   rK   rG   ÚbackendNodeIdÚkeyframesRule)r$   rD   rE   rF   rH   rI   rJ   rK   rG   rL   r%   rM   r&   r)   r)   r*   r%   µ   s    










zAnimationEffect.to_jsonr+   c                 C  s®   | t |d ƒt |d ƒt |d ƒt |d ƒt|d ƒt|d ƒt|d ƒ| dd ¡d urdt |d ƒnd | d	d ¡d ur†tj |d	 ¡nd | d
d ¡d ur¦t |d
 ¡nd d�
S )NrD   rN   rO   rH   rI   rJ   rK   rG   rP   rQ   )
rD   rE   rF   rH   rI   rJ   rK   rG   rL   rM   )r   r
   r,   r   rC   r.   ÚKeyframesRuler0   r)   r)   r*   r.   Æ   s$    






ÿÿÿízAnimationEffect.from_json)r2   r3   r4   r5   r6   rG   rL   rM   r%   r7   r.   r)   r)   r)   r*   r-   š   s   
r-   c                   @  sH   e Zd ZU dZded< dZded< ddœd	d
„Zedd dœdd„ƒZdS )rR   zKeyframes Rule.ztyping.List[KeyframeStyle]Ú	keyframesNr   r   r   r   c                 C  s2   t ƒ }dd„ | jD ƒ|d< | jd ur.| j|d< |S )Nc                 S  s   g | ]}|  ¡ ‘qS r)   )r%   ©Ú.0Úir)   r)   r*   Ú
<listcomp>ê   ó    z)KeyframesRule.to_json.<locals>.<listcomp>rS   r   )r$   rS   r   r&   r)   r)   r*   r%   è   s
    

zKeyframesRule.to_jsonr+   c                 C  s6   | dd„ |d D ƒ|  dd ¡d ur.t|d ƒnd d�S )Nc                 S  s   g | ]}t  |¡‘qS r)   )ÚKeyframeStyler.   rT   r)   r)   r*   rW   ò   rX   z+KeyframesRule.from_json.<locals>.<listcomp>rS   r   )rS   r   )r,   r
   r0   r)   r)   r*   r.   ï   s    ÿûzKeyframesRule.from_json)	r2   r3   r4   r5   r6   r   r%   r7   r.   r)   r)   r)   r*   rR   à   s   
rR   c                   @  sD   e Zd ZU dZded< ded< ddœdd„Zedd d	œd
d„ƒZdS )rY   zKeyframe Style.r
   ÚoffsetrK   r   r   c                 C  s   t ƒ }| j|d< | j|d< |S )NrZ   rK   )r$   rZ   rK   r&   r)   r)   r*   r%     s    

zKeyframeStyle.to_jsonr+   c                 C  s   | t |d ƒt |d ƒd�S )NrZ   rK   )rZ   rK   ©r
   r0   r)   r)   r*   r.   	  s    

þzKeyframeStyle.from_jsonN)r2   r3   r4   r5   r6   r%   r7   r.   r)   r)   r)   r*   rY   û   s   
rY   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]r   c                  c  s   ddi} | V }dS )z(Disables animation domain notifications.ÚmethodzAnimation.disableNr)   ©Úcmd_dictr(   r)   r)   r*   Údisable  s    ÿr_   c                  c  s   ddi} | V }dS )z'Enables animation domain notifications.r\   zAnimation.enableNr)   r]   r)   r)   r*   Úenable  s    ÿr`   r
   z1typing.Generator[T_JSON_DICT, T_JSON_DICT, float])r   r   c                 c  s*   t ƒ }| |d< d|dœ}|V }t|d ƒS )z€
    Returns the current time of the an animation.
    :param id_: Id of animation.
    :returns: Current time of the page.
    r   zAnimation.getCurrentTime©r\   Úparamsr    )r$   r   )r   rb   r^   r(   r)   r)   r*   Úget_current_time!  s    þrc   c                  c  s   ddi} | V }t |d ƒS )zn
    Gets the playback rate of the document timeline.
    :returns: Playback rate for animations on page.
    r\   zAnimation.getPlaybackRater   )r   r]   r)   r)   r*   Úget_playback_rate3  s    ÿrd   ztyping.List[str])Ú
animationsr   c                 c  s,   t ƒ }dd„ | D ƒ|d< d|dœ}|V }dS )zy
    Releases a set of animations to no longer be manipulated.
    :param animations: List of animation ids to seek.
    c                 S  s   g | ]}|‘qS r)   r)   rT   r)   r)   r*   rW   G  rX   z&release_animations.<locals>.<listcomp>re   zAnimation.releaseAnimationsra   N©r$   )re   rb   r^   r(   r)   r)   r*   Úrelease_animations?  s    þrg   z@typing.Generator[T_JSON_DICT, T_JSON_DICT, runtime.RemoteObject])Úanimation_idr   c                 c  s.   t ƒ }| |d< d|dœ}|V }tj |d ¡S )z„
    Gets the remote object of the Animation.
    :param animation_id: Animation id.
    :returns: Corresponding remote object.
    ÚanimationIdzAnimation.resolveAnimationra   ZremoteObject)r$   r   ZRemoteObjectr.   )rh   rb   r^   r(   r)   r)   r*   Úresolve_animationO  s    þrj   r   )re   r   r   c                 c  s4   t ƒ }dd„ | D ƒ|d< ||d< d|dœ}|V }dS )zÅ
    Seek a set of animations to a particular time within each animation.
    :param animations: List of animation ids to seek.
    :param current_time: Set the current time of each animation.
    c                 S  s   g | ]}|‘qS r)   r)   rT   r)   r)   r*   rW   j  rX   z#seek_animations.<locals>.<listcomp>re   r    zAnimation.seekAnimationsra   Nrf   )re   r   rb   r^   r(   r)   r)   r*   Úseek_animationsa  s    þrk   r   )re   Úpausedr   c                 c  s4   t ƒ }dd„ | D ƒ|d< ||d< d|dœ}|V }dS )zŸ
    Sets the paused state of a set of animations.
    :param animations: Animations to set the pause state of.
    :param paused: Paused state to set to.
    c                 S  s   g | ]}|‘qS r)   r)   rT   r)   r)   r*   rW   |  rX   zset_paused.<locals>.<listcomp>re   rl   zAnimation.setPausedra   Nrf   )re   rl   rb   r^   r(   r)   r)   r*   Ú
set_pauseds  s    þrm   )r   r   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )zy
    Sets the playback rate of the document timeline.
    :param playback_rate: Playback rate for animations on page
    r   zAnimation.setPlaybackRatera   Nrf   )r   rb   r^   r(   r)   r)   r*   Úset_playback_rate…  s    þrn   )rh   rH   rD   r   c                 c  s2   t ƒ }| |d< ||d< ||d< d|dœ}|V }dS )z°
    Sets the timing of an animation node.
    :param animation_id: Animation id.
    :param duration: Duration of the animation.
    :param delay: Delay of the animation.
    ri   rH   rD   zAnimation.setTimingra   Nrf   )rh   rH   rD   rb   r^   r(   r)   r)   r*   Ú
set_timing•  s    	þro   zAnimation.animationCanceledc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚAnimationCanceledz/Event for when an animation has been cancelled.r
   r   r   r+   c                 C  s   | t |d ƒd�S ©Nr   )r   r[   r0   r)   r)   r*   r.   °  s    zAnimationCanceled.from_jsonN©r2   r3   r4   r5   r6   r7   r.   r)   r)   r)   r*   rp   ©  s   
rp   zAnimation.animationCreatedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚAnimationCreatedz/Event for each animation that has been created.r
   r   r   r+   c                 C  s   | t |d ƒd�S rq   r[   r0   r)   r)   r*   r.   ¼  s    zAnimationCreated.from_jsonNrr   r)   r)   r)   r*   rs   µ  s   
rs   zAnimation.animationStartedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚAnimationStartedz*Event for animation that has been started.r	   Ú	animationr   r+   c                 C  s   | t  |d ¡d�S ©Nru   )ru   ©r	   r.   r0   r)   r)   r*   r.   È  s    zAnimationStarted.from_jsonNrr   r)   r)   r)   r*   rt   Á  s   
rt   zAnimation.animationUpdatedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚAnimationUpdatedz*Event for animation that has been updated.r	   ru   r   r+   c                 C  s   | t  |d ¡d�S rv   rw   r0   r)   r)   r*   r.   Ô  s    zAnimationUpdated.from_jsonNrr   r)   r)   r)   r*   rx   Í  s   
rx   )Ú
__future__r   ÚtypingÚdataclassesr   Úutilr   r   Ú r   r   r	   r/   r-   rR   rY   r_   r`   rc   rd   rg   rj   rk   rm   rn   ro   rp   rs   rt   rx   r)   r)   r)   r*   Ú<module>   sJ   O9E


