
    aDgC                       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
             Z G d dej                        Zd+dZd+dZ	 	 d,	 	 	 	 	 	 	 d-dZd+dZ	 	 d,	 	 	 	 	 	 	 d.dZ	 	 	 	 d/	 	 	 	 	 	 	 	 	 	 	 d0dZ	 	 d,	 	 	 	 	 	 	 d1dZ	 	 d,	 	 	 	 	 	 	 	 	 	 	 	 	 d2dZ	 d3	 	 	 	 	 d4dZ	 	 	 	 d5dZ	 d3	 	 	 d6dZ	 	 	 	 d5dZ	 	 	 	 d5dZ	 	 	 	 d7dZ	 	 	 	 d7dZ	 	 	 	 d5dZ	 	 	 	 d5dZ 	 	 	 	 d5dZ! ed      e G d  d!                    Z" ed"      e G d# d$                    Z# ed%      e G d& d'                    Z$ ed(      e G d) d*                    Z%y)8    )annotations)event_classT_JSON_DICT)	dataclassN   )dom)page)runtimec                      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dZedd       Zy)HighlightConfigzC
    Configuration data for the highlighting of page elements.
    Ntyping.Optional[bool]	show_infoshow_stylesshow_rulersshow_extension_linestyping.Optional[dom.RGBA]content_colorpadding_colorborder_colormargin_colorevent_target_colorshape_colorshape_margin_colorcss_grid_colorc                   t               }| j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j
                  | j
                  j                         |d<   | j                  | j                  j                         |d<   | j                  | j                  j                         |d<   | j                  | j                  j                         |d<   | j                  | j                  j                         |d	<   | j                  | j                  j                         |d
<   | j                  | j                  j                         |d<   | j                  | j                  j                         |d<   |S )NshowInfo
showStyles
showRulersshowExtensionLinescontentColorpaddingColorborderColormarginColoreventTargetColor
shapeColorshapeMarginColorcssGridColor)dictr   r   r   r   r   to_jsonr   r   r   r   r   r   r   )selfjsons     K/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/cdp/overlay.pyr)   zHighlightConfig.to_json<   s    F>>%#~~D'!%!1!1D'!%!1!1D$$0)-)B)BD%&)#'#5#5#=#=#?D )#'#5#5#=#=#?D ("&"3"3";";"=D("&"3"3";";"=D"".'+'>'>'F'F'HD#$'!%!1!1!9!9!;D"".'+'>'>'F'F'HD#$*#'#6#6#>#>#@D     c                $    | 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 r"t        j                  j                  |d         nd d|v r"t        j                  j                  |d         nd d|v r"t        j                  j                  |d         nd d|v r"t        j                  j                  |d         nd d	|v r"t        j                  j                  |d	         nd d
|v r"t        j                  j                  |d
         nd d|v r"t        j                  j                  |d         nd d|v r't        j                  j                  |d               S 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   )boolr   RGBA	from_jsonclsr+   s     r,   r1   zHighlightConfig.from_jsonX   s   0:d0Bd4
+,4@D4HT,/0d4@D4HT,/0dEY]aEad+?&@!AgkFTX\F\#((,,T.-ABbfFTX\F\#((,,T.-ABbfDQUYDY++D,?@_cDQUYDY++D,?@_cOaeiOisxx11$7I2JKosBNRVBV**4+=>\`OaeiOisxx11$7I2JKosGUY]G]388--d>.BC
 	
 dh
 	
r-   )returnr   )r+   r   r4   r   )__name__
__module____qualname____doc__r   __annotations__r   r   r   r   r   r   r   r   r   r   r   r)   classmethodr1    r-   r,   r   r      s     (,I$+ *.K&- *.K&- 37/6 04M,3 04M,3 /3L+2 /3L+2 5918 .2K*1 5918 15N-48 
 
r-   r   c                  :    e Zd ZdZdZdZdZdZd	dZe	d
d       Z
y)InspectModesearchForNodesearchForUAShadowDOMcaptureAreaScreenshotshowDistancesnonec                    | j                   S N)value)r*   s    r,   r)   zInspectMode.to_jsonq   s    zzr-   c                     | |      S rD   r;   r2   s     r,   r1   zInspectMode.from_jsont   s    4yr-   N)r4   str)r+   rG   r4   r=   )r5   r6   r7   SEARCH_FOR_NODESEARCH_FOR_UA_SHADOW_DOMCAPTURE_AREA_SCREENSHOTSHOW_DISTANCESNONEr)   r:   r1   r;   r-   r,   r=   r=   j   s6    %O55$ND  r-   r=   c               #     K   ddi} | }yw)z(
    Disables domain notifications.
    methodzOverlay.disableNr;   cmd_dictr+   s     r,   disablerQ   y   s     
 	#H >D   
c               #     K   ddi} | }yw)z'
    Enables domain notifications.
    rN   zOverlay.enableNr;   rO   s     r,   enablerT      s     
 	"H >DrR   c              #     K   t               }| j                         |d<   |||d<   |||d<   d|d}|}t        |d         S w)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.
    :returns: Highlight data for the node.
    nodeIdincludeDistanceincludeStylez!Overlay.getHighlightObjectForTestrN   params	highlightr(   r)   )node_idinclude_distanceinclude_stylerZ   rP   r+   s         r,   get_highlight_object_for_testr`      sg      &F(F8#$4 ! !.~5H >D[!""s   AAc               #     K   ddi} | }yw)z
    Hides any highlight.
    rN   zOverlay.hideHighlightNr;   rO   s     r,   hide_highlightrb      s     
 	)H >DrR   c              #     K   t               }| j                         |d<   ||j                         |d<   ||j                         |d<   d|d}|}yw)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).
    frameIdNr    contentOutlineColorzOverlay.highlightFramerY   r\   )frame_idr   content_outline_colorrZ   rP   r+   s         r,   highlight_framerh      sk      &F ((*F9 !.!6!6!8~((=(E(E(G$%*H >D   AAc              #     K   t               }| j                         |d<   ||j                         |d<   ||j                         |d<   ||j                         |d<   |||d<   d|d}|}yw)	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.
    highlightConfigNrV   backendNodeIdobjectIdselectorzOverlay.highlightNoderY   r\   )highlight_configr]   backend_node_id	object_idrn   rZ   rP   r+   s           r,   highlight_noderr      s     " &F 0 8 8 :F"??,x""1"9"9";&..0z%z)H >Ds   A.A0c              #     K   t               }| j                         |d<   ||j                         |d<   ||j                         |d<   d|d}|}yw)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).
    quadNcoloroutlineColorzOverlay.highlightQuadrY   r\   )rt   ru   outline_colorrZ   rP   r+   s         r,   highlight_quadrx      sb      &F\\^F6N--/w !.!6!6!8~)H >Dri   c              #     K   t               }| |d<   ||d<   ||d<   ||d<   ||j                         |d<   ||j                         |d<   d|d	}|}yw)
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).
    xywidthheightNru   rv   zOverlay.highlightRectrY   r\   )	rz   r{   r|   r}   ru   rw   rZ   rP   r+   s	            r,   highlight_rectr~     sx     $ &FF3KF3KF7OF8--/w !.!6!6!8~)H >Ds   AAc              #     K   t               }| j                         |d<   ||j                         |d<   d|d}|}yw)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```.
    modeNrk   zOverlay.setInspectModerY   r\   )r   ro   rZ   rP   r+   s        r,   set_inspect_moder   (  sN      &F\\^F6N#$4$<$<$> !*H >Ds   =?c              #  <   K   t               }| |d<   d|d}|}yw)zu
    Highlights owner element of all frames detected to be ads.

    :param show: True for showing ad highlights
    showzOverlay.setShowAdHighlightsrY   Nr(   r   rZ   rP   r+   s       r,   set_show_ad_highlightsr   >  .      &FF6N/H >D   c              #  @   K   t               }| | |d<   d|d}|}yw)zk
    :param message: *(Optional)* The message to display, also triggers resume and step over controls.
    Nmessagez"Overlay.setPausedInDebuggerMessagerY   r   )r   rZ   rP   r+   s       r,   set_paused_in_debugger_messager   O  s5      &F#y6H >Ds   c              #  <   K   t               }| |d<   d|d}|}yw)zn
    Requests that backend shows debug borders on layers

    :param show: True for showing debug borders
    r   zOverlay.setShowDebugBordersrY   Nr   r   s       r,   set_show_debug_bordersr   _  r   r   c              #  <   K   t               }| |d<   d|d}|}yw)zh
    Requests that backend shows the FPS counter

    :param show: True for showing the FPS counter
    r   zOverlay.setShowFPSCounterrY   Nr   r   s       r,   set_show_fps_counterr   p  s.      &FF6N-H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zl
    Requests that backend shows paint rectangles

    :param result: True for showing paint rectangles
    resultzOverlay.setShowPaintRectsrY   Nr   r   rZ   rP   r+   s       r,   set_show_paint_rectsr     s/      &FF8-H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zt
    Requests that backend shows layout shift regions

    :param result: True for showing layout shift regions
    r   z!Overlay.setShowLayoutShiftRegionsrY   Nr   r   s       r,   set_show_layout_shift_regionsr     s/      &FF85H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zx
    Requests that backend shows scroll bottleneck rects

    :param show: True for showing scroll bottleneck rects
    r   z$Overlay.setShowScrollBottleneckRectsrY   Nr   r   s       r,    set_show_scroll_bottleneck_rectsr     s.      &FF6N8H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zt
    Requests that backend shows hit-test borders on layers

    :param show: True for showing hit-test borders
    r   zOverlay.setShowHitTestBordersrY   Nr   r   s       r,   set_show_hit_test_bordersr     s.      &FF6N1H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zf
    Paints viewport size upon main frame resize.

    :param show: Whether to paint size or not.
    r   z#Overlay.setShowViewportSizeOnResizerY   Nr   r   s       r,    set_show_viewport_size_on_resizer     s.      &FF6N7H >Dr   zOverlay.inspectNodeRequestedc                  .    e Zd ZU dZded<   edd       Zy)InspectNodeRequestedz
    Fired when the node should be inspected. This happens after call to ``setInspectMode`` or when
    user manually inspects an element.
    zdom.BackendNodeIdrp   c                T     | t         j                  j                  |d               S )Nrl   )rp   )r   BackendNodeIdr1   r2   s     r,   r1   zInspectNodeRequested.from_json  s(    --77_8MN
 	
r-   N)r+   r   r4   r   r5   r6   r7   r8   r9   r:   r1   r;   r-   r,   r   r     s!    
 '&
 
r-   r   zOverlay.nodeHighlightRequestedc                  .    e Zd ZU dZded<   edd       Zy)NodeHighlightRequestedzc
    Fired when the node should be highlighted. This happens after call to ``setInspectMode``.
    
dom.NodeIdr]   c                T     | t         j                  j                  |d               S )NrV   )r]   )r   NodeIdr1   r2   s     r,   r1   z NodeHighlightRequested.from_json  s%    JJ((h8
 	
r-   N)r+   r   r4   r   r   r;   r-   r,   r   r     s!     
 
r-   r   zOverlay.screenshotRequestedc                  .    e Zd ZU dZded<   edd       Zy)ScreenshotRequestedzN
    Fired when user asks to capture screenshot of some area on the page.
    zpage.Viewportviewportc                T     | t         j                  j                  |d               S )Nr   )r   )r	   Viewportr1   r2   s     r,   r1   zScreenshotRequested.from_json  s&    ]],,T*-=>
 	
r-   N)r+   r   r4   r   r   r;   r-   r,   r   r     s!     
 
r-   r   zOverlay.inspectModeCanceledc                  "    e Zd ZdZedd       Zy)InspectModeCanceledz3
    Fired when user cancels the inspect mode.
    c                     |        S rD   r;   r2   s     r,   r1   zInspectModeCanceled.from_json  s     
 	
r-   N)r+   r   r4   r   )r5   r6   r7   r8   r:   r1   r;   r-   r,   r   r     s    
 
 
r-   r   )r4   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])NN)r]   r   r^   r   r_   r   r4   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, dict])rf   zpage.FrameIdr   r   rg   r   r4   r   )NNNN)ro   r   r]   ztyping.Optional[dom.NodeId]rp   z"typing.Optional[dom.BackendNodeId]rq   z'typing.Optional[runtime.RemoteObjectId]rn   typing.Optional[str]r4   r   )rt   zdom.Quadru   r   rw   r   r4   r   )rz   intr{   r   r|   r   r}   r   ru   r   rw   r   r4   r   rD   )r   r=   ro   z typing.Optional[HighlightConfig]r4   r   )r   r/   r4   r   )r   r   r4   r   )r   r/   r4   r   )&
__future__r   cdp.utilr   r   dataclassesr   enumtyping r   r	   r
   r   Enumr=   rQ   rT   r`   rb   rh   rr   rx   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r;   r-   r,   <module>r      s   # - !      S
 S
 S
l$))  37/3##/# -# 
8	#6 48;?0  9 
8	6 04>B=A)-), < ;	
 ' 
8H ,037( 1 
8	< ,037  	
 ) 1 
8H >B: 
8,	7$ )-%	7 	7"	7"	7"	7"	7"	7"	7" +,

 
  -
 -.


 

  /

 *+

 
  ,
 *+


 

  ,

r-   