U
    g(                  	   @  s8  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ddl	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eG dd dZG dd dejZeG dd dZG dd dej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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 G d/d0 d0ejZ!d1d2d3d4Z"d1d2d5d6Z#dd7d8d8d9d8d:d;d<d=Z$d>d:d?d@dAZ%d7d:dBdCdDZ&d1d2dEdFZ'ddGdHdHd1dIdJdKZ(dddLdMdNdOd1dPdQdRZ)ddSdHdHd1dTdUdVZ*ddWdWdWdWdHdHd1dXdYdZZ+dd
dLdMdNd1d[d\d]Z,dd0d^d1d_d`daZ-dbd1dcdddeZ.ddOd1dfdgdhZ/dbd1dcdidjZ0dbd1dcdkdlZ1dmd1dndodpZ2dqd1drdsdtZ3dud1dvdwdxZ4dyd1dzd{d|Z5dbd1d}d~dZ6dbd1d}ddZ7dbd1dcddZ8dbd1dcddZ9dbd1dcddZ:dbd1dcddZ;ddd1dddZ<dd1dddZ=ddd1dddZ>edeG dd dZ?edeG dd dZ@edeG dd dZAedeG dd dZBdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)page)runtimec                   @  s6   e Zd ZU dZded< ded< dd Zedd Zd	S )
SourceOrderConfigzR
    Configuration data for drawing the source order of an elements children.
    zdom.RGBAparent_outline_colorchild_outline_colorc                 C  s&   t  }| j |d< | j |d< |S )NparentOutlineColorchildOutlineColor)dictr   to_jsonr   selfjson r   S/tmp/pip-unpacked-wheel-3ysq0mf8/selenium/webdriver/common/devtools/v130/overlay.pyr      s    zSourceOrderConfig.to_jsonc                 C  s$   | t j|d t j|d dS )Nr   r   )r   r   r   RGBA	from_jsonclsr   r   r   r   r   "   s    zSourceOrderConfig.from_jsonN__name__
__module____qualname____doc____annotations__r   classmethodr   r   r   r   r   r
      s   
r
   c                   @  s  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< 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< 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d Zedd ZdS )GridHighlightConfigzC
    Configuration data for the highlighting of Grid elements.
    Ntyping.Optional[bool]show_grid_extension_linesshow_positive_line_numbersshow_negative_line_numbersshow_area_namesshow_line_namesshow_track_sizestyping.Optional[dom.RGBA]grid_border_colorcell_border_colorrow_line_colorcolumn_line_colorgrid_border_dashcell_border_dashrow_line_dashcolumn_line_dashrow_gap_colorrow_hatch_colorcolumn_gap_colorcolumn_hatch_colorarea_border_colorgrid_background_colorc                 C  s  t  }| jd k	r| j|d< | jd k	r.| j|d< | jd k	rB| j|d< | jd k	rV| j|d< | jd k	rj| j|d< | jd k	r~| j|d< | jd k	r| j |d< | j	d k	r| j	 |d< | j
d k	r| j
 |d	< | jd k	r| j |d
< | jd k	r| j|d< | jd k	r| j|d< | jd k	r| j|d< | jd k	r4| j|d< | jd k	rN| j |d< | jd k	rh| j |d< | jd k	r| j |d< | jd k	r| j |d< | jd k	r| j |d< | jd k	r| j |d< |S )NshowGridExtensionLinesshowPositiveLineNumbersshowNegativeLineNumbersshowAreaNamesshowLineNamesshowTrackSizesgridBorderColorcellBorderColorrowLineColorcolumnLineColorgridBorderDashcellBorderDashrowLineDashcolumnLineDashrowGapColorrowHatchColorcolumnGapColorcolumnHatchColorareaBorderColorgridBackgroundColor)r   r$   r%   r&   r'   r(   r)   r+   r   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r   r   r   r   r   k   sT    




















zGridHighlightConfig.to_jsonc                 C  s  | d|krt |d nd d|kr,t |d nd d|krBt |d nd d|krXt |d nd d|krnt |d nd d|krt |d nd d|krtj|d nd d|krtj|d nd d	|krtj|d	 nd d
|krtj|d
 nd d|krt |d nd d|krt |d nd d|kr4t |d nd d|krLt |d nd d|krhtj|d nd d|krtj|d nd d|krtj|d nd d|krtj|d nd d|krtj|d nd d|krtj|d nd dS )Nr9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   )r$   r%   r&   r'   r(   r)   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   )boolr   r   r   r   r   r   r   r      s,    zGridHighlightConfig.from_json)r   r   r   r   r$   r    r%   r&   r'   r(   r)   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r   r!   r   r   r   r   r   r"   *   s0   
,r"   c                   @  s   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< dZded< dd Zedd ZdS )FlexContainerHighlightConfigzM
    Configuration data for the highlighting of Flex container elements.
    Ntyping.Optional[LineStyle]container_borderline_separatoritem_separatortyping.Optional[BoxStyle]main_distributed_spacecross_distributed_spacerow_gap_spacecolumn_gap_spacecross_alignmentc                 C  s   t  }| jd k	r| j |d< | jd k	r6| j |d< | jd k	rN| j |d< | jd k	rf| j |d< | jd k	r~| j |d< | jd k	r| j |d< | jd k	r| j |d< | j	d k	r| j	 |d< |S )	NcontainerBorderlineSeparatoritemSeparatormainDistributedSpacecrossDistributedSpacerowGapSpacecolumnGapSpacecrossAlignment)
r   rP   r   rQ   rR   rT   rU   rV   rW   rX   r   r   r   r   r      s$    







z$FlexContainerHighlightConfig.to_jsonc                 C  s   | d|krt |d nd d|kr0t |d nd d|krHt |d nd d|kr`t|d nd d|krxt|d nd d|krt|d nd d|krt|d nd d|krt |d nd d	S )
NrY   rZ   r[   r\   r]   r^   r_   r`   )rP   rQ   rR   rT   rU   rV   rW   rX   )	LineStyler   BoxStyler   r   r   r   r      s    z&FlexContainerHighlightConfig.from_json)r   r   r   r   rP   r    rQ   rR   rT   rU   rV   rW   rX   r   r!   r   r   r   r   r   rN      s   
rN   c                   @  sJ   e Zd ZU dZdZded< dZded< dZded< dd	 Ze	d
d Z
dS )FlexItemHighlightConfigzH
    Configuration data for the highlighting of Flex item elements.
    NrS   base_size_boxrO   base_size_borderflexibility_arrowc                 C  sR   t  }| jd k	r| j |d< | jd k	r6| j |d< | jd k	rN| j |d< |S )NbaseSizeBoxbaseSizeBorderflexibilityArrow)r   rd   r   re   rf   r   r   r   r   r      s    


zFlexItemHighlightConfig.to_jsonc                 C  sP   | d|krt |d nd d|kr0t|d nd d|krHt|d nd dS )Nrg   rh   ri   )rd   re   rf   )rb   r   ra   r   r   r   r   r     s
    z!FlexItemHighlightConfig.from_json)r   r   r   r   rd   r    re   rf   r   r!   r   r   r   r   r   rc      s   

rc   c                   @  s>   e Zd ZU dZdZded< dZded< dd Zed	d
 Z	dS )ra   z/
    Style information for drawing a line.
    Nr*   colortyping.Optional[str]patternc                 C  s6   t  }| jd k	r| j |d< | jd k	r2| j|d< |S )Nrj   rl   )r   rj   r   rl   r   r   r   r   r     s    


zLineStyle.to_jsonc                 C  s8   | d|krt j|d nd d|kr0t|d nd dS )Nrj   rl   )rj   rl   )r   r   r   strr   r   r   r   r   $  s    zLineStyle.from_json)
r   r   r   r   rj   r    rl   r   r!   r   r   r   r   r   ra     s   
ra   c                   @  s>   e Zd ZU dZdZded< dZded< dd Zedd	 Z	dS )
rb   z.
    Style information for drawing a box.
    Nr*   
fill_colorhatch_colorc                 C  s:   t  }| jd k	r| j |d< | jd k	r6| j |d< |S )N	fillColor
hatchColor)r   rn   r   ro   r   r   r   r   r   7  s    

zBoxStyle.to_jsonc                 C  s<   | d|krt j|d nd d|kr4t j|d nd dS )Nrp   rq   )rn   ro   r   r   r   r   r   r   ?  s    zBoxStyle.from_json)
r   r   r   r   rn   r    ro   r   r!   r   r   r   r   r   rb   ,  s   
rb   c                   @  s,   e Zd ZdZdZdZdd Zedd ZdS )	ContrastAlgorithmZaaZaaaZapcac                 C  s   | j S Nvaluer   r   r   r   r   L  s    zContrastAlgorithm.to_jsonc                 C  s   | |S rs   r   r   r   r   r   r   O  s    zContrastAlgorithm.from_jsonN)	r   r   r   ZAAZAAAZAPCAr   r!   r   r   r   r   r   rr   G  s   rr   c                   @  s
  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< 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< 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 Zed d! ZdS )"HighlightConfigzC
    Configuration data for the highlighting of page elements.
    Nr#   	show_infoshow_stylesshow_rulersshow_accessibility_infoshow_extension_linesr*   content_colorpadding_colorborder_colormargin_colorevent_target_colorshape_colorshape_margin_colorcss_grid_colortyping.Optional[ColorFormat]color_formatz$typing.Optional[GridHighlightConfig]grid_highlight_configz-typing.Optional[FlexContainerHighlightConfig]flex_container_highlight_configz(typing.Optional[FlexItemHighlightConfig]flex_item_highlight_configz"typing.Optional[ContrastAlgorithm]contrast_algorithmz7typing.Optional[ContainerQueryContainerHighlightConfig]*container_query_container_highlight_configc                 C  s  t  }| jd k	r| j|d< | jd k	r.| j|d< | jd k	rB| j|d< | jd k	rV| j|d< | jd k	rj| j|d< | jd k	r| j |d< | jd k	r| j |d< | j	d k	r| j	 |d< | j
d k	r| j
 |d	< | jd k	r| j |d
< | jd k	r| j |d< | jd k	r| j |d< | jd k	r.| j |d< | jd k	rH| j |d< | jd k	rb| j |d< | jd k	r|| j |d< | jd k	r| j |d< | jd k	r| j |d< | jd k	r| j |d< |S )NshowInfo
showStyles
showRulersshowAccessibilityInfoshowExtensionLinescontentColorpaddingColorborderColormarginColoreventTargetColor
shapeColorshapeMarginColorcssGridColorcolorFormatgridHighlightConfigflexContainerHighlightConfigflexItemHighlightConfigcontrastAlgorithm&containerQueryContainerHighlightConfig)r   rx   ry   rz   r{   r|   r}   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     sP    















zHighlightConfig.to_jsonc                 C  s  | d|krt |d nd d|kr,t |d nd d|krBt |d nd d|krXt |d nd d|krnt |d nd d|krtj|d nd d|krtj|d nd d|krtj|d nd d	|krtj|d	 nd d
|krtj|d
 nd d|krtj|d nd d|kr(tj|d nd d|krDtj|d nd d|kr^t|d nd d|krxt|d nd d|krt|d nd d|krt|d nd d|krt|d nd d|krt	|d nd dS )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   )
rM   r   r   r   ColorFormatr"   rN   rc   rr   &ContainerQueryContainerHighlightConfigr   r   r   r   r     s*    zHighlightConfig.from_json)r   r   r   r   rx   r    ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   rw   T  s.   
*rw   c                   @  s0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
r   ZrgbZhslZhwbhexc                 C  s   | j S rs   rt   rv   r   r   r   r     s    zColorFormat.to_jsonc                 C  s   | |S rs   r   r   r   r   r   r     s    zColorFormat.from_jsonN)
r   r   r   ZRGBZHSLZHWBZHEX_r   r!   r   r   r   r   r   r     s   r   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )GridNodeHighlightConfigz6
    Configurations for Persistent Grid Highlight
    r"   r   
dom.NodeIdnode_idc                 C  s&   t  }| j |d< | j |d< |S )Nr   nodeId)r   r   r   r   r   r   r   r   r     s    zGridNodeHighlightConfig.to_jsonc                 C  s"   | t |d tj|d dS )Nr   r   )r   r   )r"   r   r   NodeIdr   r   r   r   r     s    z!GridNodeHighlightConfig.from_jsonNr   r   r   r   r   r     s   
r   c                   @  s2   e Zd ZU ded< ded< dd Zedd Zd	S )
FlexNodeHighlightConfigrN   r   r   r   c                 C  s&   t  }| j |d< | j |d< |S )Nr   r   )r   r   r   r   r   r   r   r   r     s    zFlexNodeHighlightConfig.to_jsonc                 C  s"   | t |d tj|d dS )Nr   r   )r   r   )rN   r   r   r   r   r   r   r   r   
  s    z!FlexNodeHighlightConfig.from_jsonNr   r   r   r    r   r!   r   r   r   r   r   r     s
   
r   c                   @  sR   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d	 Ze	d
d Z
dS )"ScrollSnapContainerHighlightConfigNrO   snapport_bordersnap_area_borderr*   scroll_margin_colorscroll_padding_colorc                 C  sj   t  }| jd k	r| j |d< | jd k	r6| j |d< | jd k	rN| j |d< | jd k	rf| j |d< |S )NsnapportBordersnapAreaBorderscrollMarginColorscrollPaddingColor)r   r   r   r   r   r   r   r   r   r   r      s    



z*ScrollSnapContainerHighlightConfig.to_jsonc                 C  sl   | d|krt |d nd d|kr0t |d nd d|krJtj|d nd d|krdtj|d nd dS )Nr   r   r   r   )r   r   r   r   )ra   r   r   r   r   r   r   r   r   ,  s    z,ScrollSnapContainerHighlightConfig.from_json)r   r   r   r   r    r   r   r   r   r!   r   r   r   r   r   r     s   
r   c                   @  s2   e Zd ZU ded< ded< dd Zedd Zd	S )
ScrollSnapHighlightConfigr   &scroll_snap_container_highlight_configr   r   c                 C  s&   t  }| j |d< | j |d< |S )N"scrollSnapContainerHighlightConfigr   )r   r   r   r   r   r   r   r   r   >  s    z!ScrollSnapHighlightConfig.to_jsonc                 C  s"   | t |d tj|d dS )Nr   r   )r   r   )r   r   r   r   r   r   r   r   r   D  s    z#ScrollSnapHighlightConfig.from_jsonNr   r   r   r   r   r   6  s
   
r   c                   @  sF   e Zd ZU dZded< dZded< dZded< dd	 Zed
d Z	dS )HingeConfigz-
    Configuration for dual screen hinge
    zdom.RectrectNr*   r}   outline_colorc                 C  sH   t  }| j |d< | jd k	r,| j |d< | jd k	rD| j |d< |S )Nr   r   outlineColor)r   r   r   r}   r   r   r   r   r   r   Z  s    

zHingeConfig.to_jsonc                 C  sJ   | t j|d d|kr(t j|d nd d|krBt j|d nd dS )Nr   r   r   )r   r}   r   )r   ZRectr   r   r   r   r   r   r   c  s
    zHingeConfig.from_json)
r   r   r   r   r    r}   r   r   r!   r   r   r   r   r   r   L  s   
	r   c                   @  s>   e Zd ZU dZded< ded< ded< dd Zed	d
 ZdS )WindowControlsOverlayConfigz3
    Configuration for Window Controls Overlay
    rM   show_cssrm   selected_platformtheme_colorc                 C  s(   t  }| j|d< | j|d< | j|d< |S )NshowCSSselectedPlatform
themeColor)r   r   r   r   r   r   r   r   r   z  s
    


z#WindowControlsOverlayConfig.to_jsonc                 C  s&   | t |d t|d t|d dS )Nr   r   r   )r   r   r   )rM   rm   r   r   r   r   r     s
    


z%WindowControlsOverlayConfig.from_jsonNr   r   r   r   r   r   l  s   
r   c                   @  s2   e Zd ZU ded< ded< dd Zedd Zd	S )
ContainerQueryHighlightConfigr   r   r   r   c                 C  s&   t  }| j |d< | j |d< |S )Nr   r   )r   r   r   r   r   r   r   r   r     s    z%ContainerQueryHighlightConfig.to_jsonc                 C  s"   | t |d tj|d dS )Nr   r   )r   r   )r   r   r   r   r   r   r   r   r     s    z'ContainerQueryHighlightConfig.from_jsonNr   r   r   r   r   r     s
   
r   c                   @  s:   e Zd ZU dZded< dZded< dd Zedd ZdS )	r   NrO   rP   descendant_borderc                 C  s:   t  }| jd k	r| j |d< | jd k	r6| j |d< |S )NrY   descendantBorder)r   rP   r   r   r   r   r   r   r     s    

z.ContainerQueryContainerHighlightConfig.to_jsonc                 C  s8   | d|krt |d nd d|kr0t |d nd dS )NrY   r   )rP   r   )ra   r   r   r   r   r   r     s    z0ContainerQueryContainerHighlightConfig.from_json)	r   r   r   rP   r    r   r   r!   r   r   r   r   r   r     s
   
r   c                   @  s2   e Zd ZU ded< ded< dd Zedd Zd	S )
IsolatedElementHighlightConfigIsolationModeHighlightConfigisolation_mode_highlight_configr   r   c                 C  s&   t  }| j |d< | j |d< |S )NisolationModeHighlightConfigr   )r   r   r   r   r   r   r   r   r     s    z&IsolatedElementHighlightConfig.to_jsonc                 C  s"   | t |d tj|d dS )Nr   r   )r   r   )r   r   r   r   r   r   r   r   r     s    z(IsolatedElementHighlightConfig.from_jsonNr   r   r   r   r   r     s
   
r   c                   @  sF   e Zd ZU dZded< dZded< dZded< dd Zedd	 Z	dS )
r   Nr*   resizer_colorresizer_handle_color
mask_colorc                 C  sR   t  }| jd k	r| j |d< | jd k	r6| j |d< | jd k	rN| j |d< |S )NresizerColorresizerHandleColor	maskColor)r   r   r   r   r   r   r   r   r   r     s    


z$IsolationModeHighlightConfig.to_jsonc                 C  sV   | d|krt j|d nd d|kr4t j|d nd d|krNt j|d nd dS )Nr   r   r   )r   r   r   r   r   r   r   r   r     s
    z&IsolationModeHighlightConfig.from_json)
r   r   r   r   r    r   r   r   r!   r   r   r   r   r   r     s   

r   c                   @  s4   e Zd ZdZdZdZdZdZdd Ze	dd	 Z
d
S )InspectModeZsearchForNodeZsearchForUAShadowDOMZcaptureAreaScreenshotZshowDistancesnonec                 C  s   | j S rs   rt   rv   r   r   r   r     s    zInspectMode.to_jsonc                 C  s   | |S rs   r   r   r   r   r   r     s    zInspectMode.from_jsonN)r   r   r   ZSEARCH_FOR_NODEZSEARCH_FOR_UA_SHADOW_DOMZCAPTURE_AREA_SCREENSHOTZSHOW_DISTANCESNONEr   r!   r   r   r   r   r   r     s   r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])returnc                  c  s   ddi} | V }dS )z(
    Disables domain notifications.
    methodzOverlay.disableNr   cmd_dictr   r   r   r   disable  s     r   c                  c  s   ddi} | V }dS )z'
    Enables domain notifications.
    r   zOverlay.enableNr   r   r   r   r   enable  s     r   r   r#   r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, dict])r   include_distanceinclude_styler   r{   r   c                 c  sr   t  }|  |d< |dk	r"||d< |dk	r2||d< |dk	rF| |d< |dk	rV||d< d|d}|V }t |d	 S )
a  
    For testing.

    :param node_id: Id of the node to get highlight object for.
    :param include_distance: *(Optional)* Whether to include distance info.
    :param include_style: *(Optional)* Whether to include style info.
    :param color_format: *(Optional)* The color format to get config with (default: hex).
    :param show_accessibility_info: *(Optional)* Whether to show accessibility info (default: true).
    :returns: Highlight data for the node.
    r   NZincludeDistanceZincludeStyler   r   z!Overlay.getHighlightObjectForTestr   params	highlightr   r   )r   r   r   r   r{   r   r   r   r   r   r   get_highlight_object_for_test  s    r   ztyping.List[dom.NodeId])node_idsr   c                 c  s4   t  }dd | D |d< d|d}|V }t |d S )z
    For Persistent Grid testing.

    :param node_ids: Ids of the node to get highlight object for.
    :returns: Grid Highlight data for the node ids provided.
    c                 S  s   g | ]}|  qS r   r   .0ir   r   r   
<listcomp><  s     z7get_grid_highlight_objects_for_test.<locals>.<listcomp>ZnodeIdsz&Overlay.getGridHighlightObjectsForTestr   Z
highlightsr   )r   r   r   r   r   r   r   #get_grid_highlight_objects_for_test2  s    	r   )r   r   c                 c  s.   t  }|  |d< d|d}|V }t |d S )z
    For Source Order Viewer testing.

    :param node_id: Id of the node to highlight.
    :returns: Source order highlight data for the node id provided.
    r   z,Overlay.getSourceOrderHighlightObjectForTestr   r   r   )r   r   r   r   r   r   r   *get_source_order_highlight_object_for_testE  s    	r   c                  c  s   ddi} | V }dS )z
    Hides any highlight.
    r   zOverlay.hideHighlightNr   r   r   r   r   hide_highlightX  s     r   zpage.FrameIdr*   )frame_idr}   content_outline_colorr   c                 c  sN   t  }|  |d< |dk	r&| |d< |dk	r:| |d< d|d}|V }dS )a  
    Highlights owner element of the frame with given id.
    Deprecated: Doesn't work reliably and cannot be fixed due to process
    separation (the owner node might be in a different process). Determine
    the owner node in the client and use highlightNode.

    :param frame_id: Identifier of the frame to highlight.
    :param content_color: *(Optional)* The content box highlight fill color (default: transparent).
    :param content_outline_color: *(Optional)* The content box highlight outline color (default: transparent).
    ZframeIdNr   ZcontentOutlineColorzOverlay.highlightFramer   r   )r   r}   r   r   r   r   r   r   r   highlight_frameb  s    r   ztyping.Optional[dom.NodeId]z"typing.Optional[dom.BackendNodeId]z'typing.Optional[runtime.RemoteObjectId]rk   )highlight_configr   backend_node_id	object_idselectorr   c                 c  sr   t  }|  |d< |dk	r&| |d< |dk	r:| |d< |dk	rN| |d< |dk	r^||d< d|d}|V }dS )	a  
    Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
    objectId must be specified.

    :param highlight_config: A descriptor for the highlight appearance.
    :param node_id: *(Optional)* Identifier of the node to highlight.
    :param backend_node_id: *(Optional)* Identifier of the backend node to highlight.
    :param object_id: *(Optional)* JavaScript object id of the node to be highlighted.
    :param selector: *(Optional)* Selectors to highlight relevant nodes.
    highlightConfigNr   backendNodeIdobjectIdr   zOverlay.highlightNoder   r   )r   r   r   r   r   r   r   r   r   r   r   highlight_node~  s    r   zdom.Quad)quadrj   r   r   c                 c  sN   t  }|  |d< |dk	r&| |d< |dk	r:| |d< d|d}|V }dS )a1  
    Highlights given quad. Coordinates are absolute with respect to the main frame viewport.

    :param quad: Quad to highlight
    :param color: *(Optional)* The highlight fill color (default: transparent).
    :param outline_color: *(Optional)* The highlight outline color (default: transparent).
    r   Nrj   r   zOverlay.highlightQuadr   r   )r   rj   r   r   r   r   r   r   r   highlight_quad  s    r   int)xywidthheightrj   r   r   c           	      c  sb   t  }| |d< ||d< ||d< ||d< |dk	r:| |d< |dk	rN| |d< d|d	}|V }dS )
a  
    Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.

    :param x: X coordinate
    :param y: Y coordinate
    :param width: Rectangle width
    :param height: Rectangle height
    :param color: *(Optional)* The highlight fill color (default: transparent).
    :param outline_color: *(Optional)* The highlight outline color (default: transparent).
    r   r   r   r   Nrj   r   zOverlay.highlightRectr   r   )	r   r   r   r   rj   r   r   r   r   r   r   r   highlight_rect  s    r   )source_order_configr   r   r   r   c                 c  sb   t  }|  |d< |dk	r&| |d< |dk	r:| |d< |dk	rN| |d< d|d}|V }dS )a  
    Highlights the source order of the children of the DOM node with given id or with the given
    JavaScript object wrapper. Either nodeId or objectId must be specified.

    :param source_order_config: A descriptor for the appearance of the overlay drawing.
    :param node_id: *(Optional)* Identifier of the node to highlight.
    :param backend_node_id: *(Optional)* Identifier of the backend node to highlight.
    :param object_id: *(Optional)* JavaScript object id of the node to be highlighted.
    ZsourceOrderConfigNr   r   r   zOverlay.highlightSourceOrderr   r   )r   r   r   r   r   r   r   r   r   r   highlight_source_order  s    r   z typing.Optional[HighlightConfig])moder   r   c                 c  s:   t  }|  |d< |dk	r&| |d< d|d}|V }dS )av  
    Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
    Backend then generates 'inspectNodeRequested' event upon element selection.

    :param mode: Set an inspection mode.
    :param highlight_config: *(Optional)* A descriptor for the highlight appearance of hovered-over nodes. May be omitted if ```enabled == false```.
    r   Nr   zOverlay.setInspectModer   r   )r   r   r   r   r   r   r   r   set_inspect_mode  s    r   rM   )showr   c                 c  s"   t  }| |d< d|d}|V }dS )zu
    Highlights owner element of all frames detected to be ads.

    :param show: True for showing ad highlights
    r   zOverlay.setShowAdHighlightsr   Nr   r   r   r   r   r   r   r   set_show_ad_highlights  s    r   )messager   c                 c  s*   t  }| dk	r| |d< d|d}|V }dS )zk
    :param message: *(Optional)* The message to display, also triggers resume and step over controls.
    Nr  z"Overlay.setPausedInDebuggerMessager   r   )r  r   r   r   r   r   r   set_paused_in_debugger_message   s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zn
    Requests that backend shows debug borders on layers

    :param show: True for showing debug borders
    r   zOverlay.setShowDebugBordersr   Nr   r   r   r   r   set_show_debug_borders0  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zh
    Requests that backend shows the FPS counter

    :param show: True for showing the FPS counter
    r   zOverlay.setShowFPSCounterr   Nr   r   r   r   r   set_show_fps_counterA  s    r  z$typing.List[GridNodeHighlightConfig])grid_node_highlight_configsr   c                 c  s,   t  }dd | D |d< d|d}|V }dS )z
    Highlight multiple elements with the CSS Grid overlay.

    :param grid_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
    c                 S  s   g | ]}|  qS r   r   r   r   r   r   r   [  s     z*set_show_grid_overlays.<locals>.<listcomp>ZgridNodeHighlightConfigszOverlay.setShowGridOverlaysr   Nr   )r  r   r   r   r   r   r   set_show_grid_overlaysR  s    r  z$typing.List[FlexNodeHighlightConfig])flex_node_highlight_configsr   c                 c  s,   t  }dd | D |d< d|d}|V }dS )zx
    :param flex_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
    c                 S  s   g | ]}|  qS r   r   r   r   r   r   r   j  s     z*set_show_flex_overlays.<locals>.<listcomp>ZflexNodeHighlightConfigszOverlay.setShowFlexOverlaysr   Nr   )r  r   r   r   r   r   r   set_show_flex_overlaysc  s    r  z&typing.List[ScrollSnapHighlightConfig])scroll_snap_highlight_configsr   c                 c  s,   t  }dd | D |d< d|d}|V }dS )zz
    :param scroll_snap_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
    c                 S  s   g | ]}|  qS r   r   r   r   r   r   r   y  s     z1set_show_scroll_snap_overlays.<locals>.<listcomp>ZscrollSnapHighlightConfigsz!Overlay.setShowScrollSnapOverlaysr   Nr   )r	  r   r   r   r   r   r   set_show_scroll_snap_overlaysr  s    r
  z*typing.List[ContainerQueryHighlightConfig])!container_query_highlight_configsr   c                 c  s,   t  }dd | D |d< d|d}|V }dS )z~
    :param container_query_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
    c                 S  s   g | ]}|  qS r   r   r   r   r   r   r     s     z5set_show_container_query_overlays.<locals>.<listcomp>ZcontainerQueryHighlightConfigsz%Overlay.setShowContainerQueryOverlaysr   Nr   )r  r   r   r   r   r   r   !set_show_container_query_overlays  s    r  )resultr   c                 c  s"   t  }| |d< d|d}|V }dS )zl
    Requests that backend shows paint rectangles

    :param result: True for showing paint rectangles
    r  zOverlay.setShowPaintRectsr   Nr   r  r   r   r   r   r   r   set_show_paint_rects  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zt
    Requests that backend shows layout shift regions

    :param result: True for showing layout shift regions
    r  z!Overlay.setShowLayoutShiftRegionsr   Nr   r  r   r   r   set_show_layout_shift_regions  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zx
    Requests that backend shows scroll bottleneck rects

    :param show: True for showing scroll bottleneck rects
    r   z$Overlay.setShowScrollBottleneckRectsr   Nr   r   r   r   r    set_show_scroll_bottleneck_rects  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zc
    Deprecated, no longer has any effect.

    :param show: True for showing hit-test borders
    r   zOverlay.setShowHitTestBordersr   Nr   r   r   r   r   set_show_hit_test_borders  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zY
    Request that backend shows an overlay with web vital metrics.

    :param show:
    r   zOverlay.setShowWebVitalsr   Nr   r   r   r   r   set_show_web_vitals  s    r  c                 c  s"   t  }| |d< d|d}|V }dS )zf
    Paints viewport size upon main frame resize.

    :param show: Whether to paint size or not.
    r   z#Overlay.setShowViewportSizeOnResizer   Nr   r   r   r   r    set_show_viewport_size_on_resize  s    r  ztyping.Optional[HingeConfig])hinge_configr   c                 c  s.   t  }| dk	r|  |d< d|d}|V }dS )zp
    Add a dual screen device hinge

    :param hinge_config: *(Optional)* hinge data, null means hideHinge
    NZhingeConfigzOverlay.setShowHinger   r   )r  r   r   r   r   r   r   set_show_hinge  s    r  z+typing.List[IsolatedElementHighlightConfig])"isolated_element_highlight_configsr   c                 c  s,   t  }dd | D |d< d|d}|V }dS )z
    Show elements in isolation mode with overlays.

    :param isolated_element_highlight_configs: An array of node identifiers and descriptors for the highlight appearance.
    c                 S  s   g | ]}|  qS r   r   r   r   r   r   r     s     z.set_show_isolated_elements.<locals>.<listcomp>ZisolatedElementHighlightConfigszOverlay.setShowIsolatedElementsr   Nr   )r  r   r   r   r   r   r   set_show_isolated_elements  s    r  z,typing.Optional[WindowControlsOverlayConfig])window_controls_overlay_configr   c                 c  s.   t  }| dk	r|  |d< d|d}|V }dS )z
    Show Window Controls Overlay for PWA

    :param window_controls_overlay_config: *(Optional)* Window Controls Overlay data, null means hide Window Controls Overlay
    NZwindowControlsOverlayConfigz$Overlay.setShowWindowControlsOverlayr   r   )r  r   r   r   r   r   r    set_show_window_controls_overlay  s    r  zOverlay.inspectNodeRequestedc                   @  s.   e Zd ZU dZded< edd dddZdS )	InspectNodeRequestedz
    Fired when the node should be inspected. This happens after call to ``setInspectMode`` or when
    user manually inspects an element.
    zdom.BackendNodeIdr   r   r   r   c                 C  s   | t j|d dS )Nr   )r   )r   ZBackendNodeIdr   r   r   r   r   r   5  s    zInspectNodeRequested.from_jsonNr   r   r   r   r    r!   r   r   r   r   r   r  +  s   
r  zOverlay.nodeHighlightRequestedc                   @  s.   e Zd ZU dZded< edd dddZdS )	NodeHighlightRequestedzc
    Fired when the node should be highlighted. This happens after call to ``setInspectMode``.
    r   r   r   r  c                 C  s   | t j|d dS )Nr   )r   )r   r   r   r   r   r   r   r   D  s    z NodeHighlightRequested.from_jsonNr  r   r   r   r   r  <  s   
r  zOverlay.screenshotRequestedc                   @  s.   e Zd ZU dZded< edd dddZdS )	ScreenshotRequestedzN
    Fired when user asks to capture screenshot of some area on the page.
    zpage.Viewportviewportr   r  c                 C  s   | t j|d dS )Nr   )r   )r   ZViewportr   r   r   r   r   r   T  s    zScreenshotRequested.from_jsonNr  r   r   r   r   r  K  s   
r  zOverlay.inspectModeCanceledc                   @  s$   e Zd ZdZedd dddZdS )InspectModeCanceledz3
    Fired when user cancels the inspect mode.
    r   r  c                 C  s   |  S rs   r   r   r   r   r   r   c  s    zInspectModeCanceled.from_jsonN)r   r   r   r   r!   r   r   r   r   r   r!  [  s   r!  )NNNN)NN)NNNN)NN)NN)NNN)N)N)N)N)C
__future__r   utilr   r   Zdataclassesr   enumtyping r   r   r	   r
   r"   rN   rc   ra   rb   Enumrr   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r   r   r   r   <module>   s    >  #
    #      $    $        