o
    ҷh`                     @  s  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G dd dejZeG dd dZG dd dejZdnddZdnddZ				dodpd"d#Zdnd$d%Z		dqdrd+d,Z				dodsd5d6Z		dqdtd;d<Z		dqdudBdCZ	dvdwdFdGZdxdJdKZ	dvdydMdNZdxdOdPZdxdQdRZdzdTdUZ dzdVdWZ!dxdXdYZ"dxdZd[Z#dxd\d]Z$	dvd{d`daZ%edbeG dcdd ddZ&edeeG dfdg dgZ'edheG didj djZ(edkeG dldm dmZ)dS )|    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)page)runtimec                   @  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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typing.Optional[dom.RGBA]grid_border_colorcell_border_colorgrid_border_dashcell_border_dashrow_gap_colorrow_hatch_colorcolumn_gap_colorcolumn_hatch_colorc                 C  s   t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< | jd ur-| j |d< | jd ur9| j |d< | jd urC| j|d< | jd urM| j|d< | j	d urY| j	 |d< | j
d ure| j
 |d	< | jd urq| j |d
< | jd ur}| j |d< |S )NshowGridExtensionLinesshowPositiveLineNumbersshowNegativeLineNumbersgridBorderColorcellBorderColorgridBorderDashcellBorderDashrowGapColorrowHatchColorcolumnGapColorcolumnHatchColor)dictr   r   r   r   to_jsonr   r   r   r   r   r   r   selfjson r(   a/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v85/overlay.pyr$   7   s0   















zGridHighlightConfig.to_jsonc                 C  s  | 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j|d nd d|v r;tj|d nd d|v rFt |d nd d|v rQt |d nd d|v r^tj|d nd d	|v rktj|d	 nd d
|v rxtj|d
 nd d|v rtj|d dS 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   )boolr   RGBA	from_jsonclsr'   r(   r(   r)   r,   Q   s   zGridHighlightConfig.from_json)__name__
__module____qualname____doc__r   __annotations__r   r   r   r   r   r   r   r   r   r   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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_configc                 C  s^  t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< | jd ur+| j|d< | jd ur5| j|d< | jd urA| j |d< | jd urM| j |d< | j	d urY| j	 |d< | j
d ure| j
 |d	< | jd urq| j |d
< | jd ur}| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< |S )NshowInfo
showStyles
showRulersshowAccessibilityInfoshowExtensionLinescontentColorpaddingColorborderColormarginColoreventTargetColor
shapeColorshapeMarginColorcssGridColorcolorFormatgridHighlightConfig)r#   r6   r7   r8   r9   r:   r;   r$   r<   r=   r>   r?   r@   rA   rB   rD   rE   r%   r(   r(   r)   r$      s@   



















zHighlightConfig.to_jsonc                 C  sz  | 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 r7t |d nd d|v rDtj|d nd d|v rQtj|d nd d|v r^tj|d nd d	|v rktj|d	 nd d
|v rxtj|d
 nd d|v rtj|d nd d|v rtj|d nd d|v rtj|d nd d|v rt|d nd d|v rt|d dS d dS )NrF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   )r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rD   rE   )r*   r   r+   r,   ColorFormatr
   r-   r(   r(   r)   r,      s&   zHighlightConfig.from_json)r/   r0   r1   r2   r6   r3   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rD   rE   r$   r4   r,   r(   r(   r(   r)   r5   b   s(   
 "r5   c                   @  s,   e Zd ZdZdZdZdd Zedd ZdS )	rU   rgbhslhexc                 C     | j S Nvaluer&   r(   r(   r)   r$         zColorFormat.to_jsonc                 C     | |S rZ   r(   r-   r(   r(   r)   r,         zColorFormat.from_jsonN)	r/   r0   r1   RGBHSLHEX_r$   r4   r,   r(   r(   r(   r)   rU      s    rU   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 ur| j |d< | jd ur"| j |d< |S )Nre   rK   outlineColor)r#   re   r$   r;   rf   r%   r(   r(   r)   r$      s   

zHingeConfig.to_jsonc                 C  sN   | t j|d d|v rt j|d nd d|v r#t j|d dS d dS )Nre   rK   rg   )re   r;   rf   )r   Rectr,   r+   r-   r(   r(   r)   r,      s   zHingeConfig.from_json)
r/   r0   r1   r2   r3   r;   rf   r$   r4   r,   r(   r(   r(   r)   rd      s   
 	rd   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 )InspectModesearchForNodesearchForUAShadowDOMcaptureAreaScreenshotshowDistancesnonec                 C  rY   rZ   r[   r]   r(   r(   r)   r$      r^   zInspectMode.to_jsonc                 C  r_   rZ   r(   r-   r(   r(   r)   r,     r`   zInspectMode.from_jsonN)r/   r0   r1   SEARCH_FOR_NODESEARCH_FOR_UA_SHADOW_DOMCAPTURE_AREA_SCREENSHOTSHOW_DISTANCESNONEr$   r4   r,   r(   r(   r(   r)   ri      s    ri   return0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z(
    Disables domain notifications.
    methodzOverlay.disableNr(   cmd_dictr'   r(   r(   r)   disable     
rz   c                  c  rv   )z'
    Enables domain notifications.
    rw   zOverlay.enableNr(   rx   r(   r(   r)   enable  r{   r|   node_id
dom.NodeIdinclude_distancer   include_stylerD   rC   r9   0typing.Generator[T_JSON_DICT, T_JSON_DICT, dict]c                 c  st    t  }|  |d< |dur||d< |dur||d< |dur$| |d< |dur,||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.
    nodeIdNincludeDistanceincludeStylerS   rI   z!Overlay.getHighlightObjectForTestrw   params	highlightr#   r$   )r}   r   r   rD   r9   r   ry   r'   r(   r(   r)   get_highlight_object_for_test  s    r   c                  c  rv   )z
    Hides any highlight.
    rw   zOverlay.hideHighlightNr(   rx   r(   r(   r)   hide_highlight>  r{   r   frame_idpage.FrameIdr;   r   content_outline_colorc                 c  P    t  }|  |d< |dur| |d< |dur| |d< d|d}|V }dS )aM  
    Highlights owner element of the frame with given id.

    :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).
    frameIdNrK   contentOutlineColorzOverlay.highlightFramer   r   )r   r;   r   r   ry   r'   r(   r(   r)   highlight_frameH     
r   highlight_configtyping.Optional[dom.NodeId]backend_node_id"typing.Optional[dom.BackendNodeId]	object_id'typing.Optional[runtime.RemoteObjectId]selectortyping.Optional[str]c                 c  st    t  }|  |d< |dur| |d< |dur| |d< |dur(| |d< |dur0||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   ry   r'   r(   r(   r)   highlight_nodea  s   
r   quaddom.Quadcolorrf   c                 c  r   )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   Nr   rg   zOverlay.highlightQuadr   r   )r   r   rf   r   ry   r'   r(   r(   r)   highlight_quad  r   r   xintywidthheightc           	      c  sd    t  }| |d< ||d< ||d< ||d< |dur| |d< |dur(| |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   Nr   rg   zOverlay.highlightRectr   r   )	r   r   r   r   r   rf   r   ry   r'   r(   r(   r)   highlight_rect  s   
r   mode typing.Optional[HighlightConfig]c                 c  s<    t  }|  |d< |du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   ry   r'   r(   r(   r)   set_inspect_mode  s   
r   showr*   c                 c  $    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   Nr#   r   r   ry   r'   r(   r(   r)   set_show_ad_highlights     
r   messagec                 c  s,    t  }| du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   ry   r'   r(   r(   r)   set_paused_in_debugger_message  s   
r   c                 c  r   )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_borders  r   r   c                 c  r   )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_counter  r   r   resultc                 c  r   )zl
    Requests that backend shows paint rectangles

    :param result: True for showing paint rectangles
    r   zOverlay.setShowPaintRectsr   Nr   r   r   ry   r'   r(   r(   r)   set_show_paint_rects  r   r   c                 c  r   )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(  r   r   c                 c  r   )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_rects9  r   r   c                 c  r   )zt
    Requests that backend shows hit-test borders on layers

    :param show: True for showing hit-test borders
    r   zOverlay.setShowHitTestBordersr   Nr   r   r(   r(   r)   set_show_hit_test_bordersJ  r   r   c                 c  r   )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[  r   r   hinge_configtyping.Optional[HingeConfig]c                 c  s0    t  }| dur|  |d< d|d}|V }dS )zp
    Add a dual screen device hinge

    :param hinge_config: *(Optional)* hinge data, null means hideHinge
    NhingeConfigzOverlay.setShowHinger   r   )r   r   ry   r'   r(   r(   r)   set_show_hingel  s   
r   zOverlay.inspectNodeRequestedc                   @  (   e Zd ZU dZded< e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   rt   c                 C     | t j|d dS )Nr   )r   )r   BackendNodeIdr,   r-   r(   r(   r)   r,        zInspectNodeRequested.from_jsonN)r'   r   rt   r   r/   r0   r1   r2   r3   r4   r,   r(   r(   r(   r)   r   ~  s
   
 r   zOverlay.nodeHighlightRequestedc                   @  r   )NodeHighlightRequestedzc
    Fired when the node should be highlighted. This happens after call to ``setInspectMode``.
    r~   r}   r'   r   rt   c                 C  r   )Nr   )r}   )r   NodeIdr,   r-   r(   r(   r)   r,     r   z NodeHighlightRequested.from_jsonN)r'   r   rt   r   r   r(   r(   r(   r)   r     s
   
 r   zOverlay.screenshotRequestedc                   @  r   )ScreenshotRequestedzN
    Fired when user asks to capture screenshot of some area on the page.
    zpage.Viewportviewportr'   r   rt   c                 C  r   )Nr   )r   )r   Viewportr,   r-   r(   r(   r)   r,     r   zScreenshotRequested.from_jsonN)r'   r   rt   r   r   r(   r(   r(   r)   r     s
   
 r   zOverlay.inspectModeCanceledc                   @  s   e Zd ZdZedddZdS )	InspectModeCanceledz3
    Fired when user cancels the inspect mode.
    r'   r   rt   c                 C  s   |  S rZ   r(   r-   r(   r(   r)   r,     s   zInspectModeCanceled.from_jsonN)r'   r   rt   r   )r/   r0   r1   r2   r4   r,   r(   r(   r(   r)   r     s    r   )rt   ru   )NNNN)r}   r~   r   r   r   r   rD   rC   r9   r   rt   r   )NN)r   r   r;   r   r   r   rt   ru   )r   r5   r}   r   r   r   r   r   r   r   rt   ru   )r   r   r   r   rf   r   rt   ru   )r   r   r   r   r   r   r   r   r   r   rf   r   rt   ru   rZ   )r   ri   r   r   rt   ru   )r   r*   rt   ru   )r   r   rt   ru   )r   r*   rt   ru   )r   r   rt   ru   )*
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r
   r5   EnumrU   rd   ri   rz   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   Ph



#$$







