o
    M,h                     @  sj  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G dd dej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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G d'd( d(ejZeG d)d* d*ZeG d+d, d,ZG d-d. d.e Z!eG d/d0 d0Z"G d1d2 d2ejZ#dd5d6Z$dd8d9Z%dd:d;Z&dd<d=Z'dd@dAZ(	dddCdDZ)ddGdHZ*	dddKdLZ+ddNdOZ,										dddedfZ-ddhdiZ.ddjdkZ/ddndoZ0ddpdqZ1ddsdtZ2ddvdwZ3	dddzd{Z4		ddd~dZ5dddZ6	dd ddZ7							ddddZ8dddZ9	ddddZ:dddZ;	ddddZ<dddZ=	ddddZ>d	ddZ?dddZ@d
ddZAdddZBdddZC	ddddZD			ddddZE	ddddZFdddZGdddÄZHdddǄZI	ddddʄZJddd̈́ZK			ddddӄZLdddՄZMddd؄ZNdddۄZO						ddddZPdddZQedeG dd dZRdS (      )annotations   )event_classT_JSON_DICT)	dataclassN)dom)network)pagec                   @  s   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Z	ded< dZ
ded	< dZded
< dd Zedd ZdS )SafeAreaInsetsNtyping.Optional[int]toptop_maxleftleft_maxbottom
bottom_maxright	right_maxc                 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r?| j|d< | jd urI| j|d< | jd urS| j|d< |S )	Nr   topMaxr   leftMaxr   	bottomMaxr   rightMax)	dictr   r   r   r   r   r   r   r   selfjson r   }/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v141/emulation.pyto_json+   s$   















zSafeAreaInsets.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 |d nd d|v r7t |d nd d|v rBt |d nd d|v rMt |d nd d|v rZt |d d	S d d	S )
Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   intclsr   r   r   r   	from_json?   s   zSafeAreaInsets.from_json)__name__
__module____qualname__r   __annotations__r   r   r   r   r   r   r   r   classmethodr#   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 )ScreenOrientationz
    Screen orientation.
    strtype_r    anglec                 C     t  }| j|d< | j|d< |S )Ntyper,   )r   r+   r,   r   r   r   r   r   X      

zScreenOrientation.to_jsonc                 C  s   | t |d t|d dS )Nr.   r,   )r+   r,   r*   r    r!   r   r   r   r#   ^      

zScreenOrientation.from_jsonNr$   r%   r&   __doc__r'   r   r(   r#   r   r   r   r   r)   M   s   
 r)   c                   @  s:   e Zd ZU ded< ded< ded< dd Zedd	 Zd
S )DisplayFeaturer*   orientationr    offsetmask_lengthc                 C  (   t  }| j|d< | j|d< | j|d< |S )Nr5   r6   
maskLength)r   r5   r6   r7   r   r   r   r   r   t   
   


zDisplayFeature.to_jsonc                 C  s&   | t |d t|d t|d dS )Nr5   r6   r9   )r5   r6   r7   r0   r!   r   r   r   r#   {   
   


zDisplayFeature.from_jsonNr$   r%   r&   r'   r   r(   r#   r   r   r   r   r4   f   s   
 r4   c                   @  *   e Zd ZU ded< dd Zedd ZdS )DevicePosturer*   r+   c                 C     t  }| j|d< |S )Nr.   )r   r+   r   r   r   r   r         
zDevicePosture.to_jsonc                 C     | t |d dS )Nr.   )r+   r*   r!   r   r   r   r#         
zDevicePosture.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 )	MediaFeaturer*   namevaluec                 C  r-   )NrE   rF   )r   rE   rF   r   r   r   r   r      r/   zMediaFeature.to_jsonc                 C     | t |d t |d dS )NrE   rF   )rE   rF   rB   r!   r   r   r   r#      r1   zMediaFeature.from_jsonNr<   r   r   r   r   rD      s   
 rD   c                   @  0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
VirtualTimePolicya?  
    advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
    allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
    pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
    resource fetches.
    advancepausepauseIfNetworkFetchesPendingc                 C     | j S NrF   r   r   r   r   r         zVirtualTimePolicy.to_jsonc                 C     | |S rN   r   r!   r   r   r   r#         zVirtualTimePolicy.from_jsonN)
r$   r%   r&   r3   ADVANCEPAUSE PAUSE_IF_NETWORK_FETCHES_PENDINGr   r(   r#   r   r   r   r   rI      s    rI   c                   @  s6   e Zd ZU dZded< ded< dd Zedd Zd	S )
UserAgentBrandVersionzh
    Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
    r*   brandversionc                 C  r-   )NrX   rY   )r   rX   rY   r   r   r   r   r      r/   zUserAgentBrandVersion.to_jsonc                 C  rG   )NrX   rY   )rX   rY   rB   r!   r   r   r   r#      r1   zUserAgentBrandVersion.from_jsonNr2   r   r   r   r   rW      s   
 rW   c                   @  s   e Zd ZU 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	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 )UserAgentMetadataz
    Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
    Missing optional values will be filled in by the target with what it would normally use.
    r*   platformplatform_versionarchitecturemodelboolmobileNz3typing.Optional[typing.List[UserAgentBrandVersion]]brandsfull_version_listtyping.Optional[str]full_versionbitnesstyping.Optional[bool]wow64z!typing.Optional[typing.List[str]]form_factorsc                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | jd ur+dd | jD |d< | jd ur:d	d | jD |d
< | jd urD| j|d< | j	d urN| j	|d< | j
d urX| j
|d< | jd urgdd | jD |d< |S )Nr[   platformVersionr]   r^   r`   c                 S     g | ]}|  qS r   r   .0ir   r   r   
<listcomp>       z-UserAgentMetadata.to_json.<locals>.<listcomp>ra   c                 S  rj   r   rk   rl   r   r   r   ro      rp   fullVersionListfullVersionre   rg   c                 S  s   g | ]}|qS r   r   rl   r   r   r   ro     s    formFactors)r   r[   r\   r]   r^   r`   ra   rb   rd   re   rg   rh   r   r   r   r   r      s&   













zUserAgentMetadata.to_jsonc                 C  s   | t |d t |d t |d t |d t|d d|v r'dd |d D nd d	|v r5d
d |d	 D nd d|v r@t |d nd d|v rKt |d nd d|v rVt|d nd d|v rfdd |d D dS d dS )Nr[   ri   r]   r^   r`   ra   c                 S     g | ]}t |qS r   rW   r#   rl   r   r   r   ro         z/UserAgentMetadata.from_json.<locals>.<listcomp>rq   c                 S  rt   r   ru   rl   r   r   r   ro     rv   rr   re   rg   rs   c                 S  s   g | ]}t |qS r   rB   rl   r   r   r   ro     rp   )r[   r\   r]   r^   r`   ra   rb   rd   re   rg   rh   )r*   r_   r!   r   r   r   r#     s   




zUserAgentMetadata.from_json)r$   r%   r&   r3   r'   ra   rb   rd   re   rg   rh   r   r(   r#   r   r   r   r   rZ      s    
 rZ   c                   @  sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
d Zedd ZdS )
SensorTypezz
    Used to specify sensor types to emulate.
    See https://w3c.github.io/sensors/#automation for more information.
    zabsolute-orientationaccelerometerzambient-lightgravity	gyroscopezlinear-accelerationmagnetometerzrelative-orientationc                 C  rM   rN   rO   rP   r   r   r   r   '  rQ   zSensorType.to_jsonc                 C  rR   rN   r   r!   r   r   r   r#   *  rS   zSensorType.from_jsonN)r$   r%   r&   r3   ABSOLUTE_ORIENTATIONACCELEROMETERAMBIENT_LIGHTGRAVITY	GYROSCOPELINEAR_ACCELERATIONMAGNETOMETERRELATIVE_ORIENTATIONr   r(   r#   r   r   r   r   rw     s    rw   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 )SensorMetadataNrf   	availabletyping.Optional[float]minimum_frequencymaximum_frequencyc                 C  sF   t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< |S )Nr   minimumFrequencymaximumFrequency)r   r   r   r   r   r   r   r   r   7  s   





zSensorMetadata.to_jsonc                 C  sN   | d|v rt |d nd d|v rt|d nd d|v r#t|d dS d dS )Nr   r   r   )r   r   r   )r_   floatr!   r   r   r   r#   A  s   zSensorMetadata.from_json)
r$   r%   r&   r   r'   r   r   r   r(   r#   r   r   r   r   r   /     
 
r   c                   @  r=   )SensorReadingSingler   rF   c                 C  r?   )NrF   )r   rF   r   r   r   r   r   N  r@   zSensorReadingSingle.to_jsonc                 C  rA   )NrF   rO   r   r!   r   r   r   r#   S  rC   zSensorReadingSingle.from_jsonNr<   r   r   r   r   r   J  s
   
 r   c                   @  s:   e Zd ZU ded< ded< ded< dd Zedd Zd	S )
SensorReadingXYZr   xyzc                 C  r8   )Nr   r   r   )r   r   r   r   r   r   r   r   r   b  r:   zSensorReadingXYZ.to_jsonc                 C  s&   | t |d t |d t |d dS )Nr   r   r   )r   r   r   r   r!   r   r   r   r#   i  r;   zSensorReadingXYZ.from_jsonNr<   r   r   r   r   r   Z  s   
 r   c                   @  sB   e Zd ZU ded< ded< ded< ded< dd Zedd	 Zd
S )SensorReadingQuaternionr   r   r   r   wc                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )Nr   r   r   r   )r   r   r   r   r   r   r   r   r   r   |  s   



zSensorReadingQuaternion.to_jsonc                 C  s0   | t |d t |d t |d t |d dS )Nr   r   r   r   )r   r   r   r   r   r!   r   r   r   r#     s   



z!SensorReadingQuaternion.from_jsonNr<   r   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 )SensorReadingNz$typing.Optional[SensorReadingSingle]singlez!typing.Optional[SensorReadingXYZ]xyzz(typing.Optional[SensorReadingQuaternion]
quaternionc                 C  sR   t  }| jd ur| j |d< | jd ur| j |d< | jd ur'| j |d< |S )Nr   r   r   )r   r   r   r   r   r   r   r   r   r     s   


zSensorReading.to_jsonc                 C  sT   | d|v rt |d nd d|v rt|d nd d|v r&t|d dS d dS )Nr   r   r   )r   r   r   )r   r#   r   r   r!   r   r   r   r#     s   zSensorReading.from_json)
r$   r%   r&   r   r'   r   r   r   r(   r#   r   r   r   r   r     r   r   c                   @  s$   e Zd ZdZdd Zedd ZdS )PressureSourcecpuc                 C  rM   rN   rO   rP   r   r   r   r     rQ   zPressureSource.to_jsonc                 C  rR   rN   r   r!   r   r   r   r#     rS   zPressureSource.from_jsonN)r$   r%   r&   CPUr   r(   r#   r   r   r   r   r     s
    r   c                   @  rH   )
PressureStatenominalfairseriouscriticalc                 C  rM   rN   rO   rP   r   r   r   r     rQ   zPressureState.to_jsonc                 C  rR   rN   r   r!   r   r   r   r#     rS   zPressureState.from_jsonN)
r$   r%   r&   NOMINALFAIRSERIOUSCRITICALr   r(   r#   r   r   r   r   r     s    r   c                   @  s.   e Zd ZU dZded< dd Zedd ZdS )PressureMetadataNrf   r   c                 C  s   t  }| jd ur| j|d< |S )Nr   )r   r   r   r   r   r   r     r/   zPressureMetadata.to_jsonc                 C  s"   | d|v rt |d dS d dS )Nr   )r   r_   r!   r   r   r   r#     s
   zPressureMetadata.from_json)r$   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 )WorkAreaInsetsNr   r   r   r   r   c                 C  sZ   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< |S )Nr   r   r   r   )r   r   r   r   r   r   r   r   r   r     s   







zWorkAreaInsets.to_jsonc                 C  sd   | 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 dS d dS )Nr   r   r   r   )r   r   r   r   r   r!   r   r   r   r#     s   zWorkAreaInsets.from_json)r$   r%   r&   r   r'   r   r   r   r   r(   r#   r   r   r   r   r     s   
 r   c                      s4   e Zd Zd
ddZedddZ fdd	Z  ZS )ScreenIdreturnr*   c                 C  s   | S rN   r   rP   r   r   r   r     s   zScreenId.to_jsonr   c                 C  rR   rN   r   r!   r   r   r   r#     rS   zScreenId.from_jsonc                   s   d t  S )NzScreenId({}))formatsuper__repr__rP   	__class__r   r   r     s   zScreenId.__repr__)r   r*   )r   r*   r   r   )r$   r%   r&   r   r(   r#   r   __classcell__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ed< 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ed< ded< ded< ded< dd Zedd ZdS )
ScreenInfoz
    Screen information similar to the one returned by window.getScreenDetails() method,
    see https://w3c.github.io/window-management/#screendetailed.
    r    r   r   widthheight
avail_left	avail_topavail_widthavail_heightr   device_pixel_ratior)   r5   color_depthr_   is_extendedis_internal
is_primaryr*   labelr   id_c                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j	|d	< | j
 |d
< | j|d< | j|d< | j|d< | j|d< | j|d< | j |d< |S )Nr   r   r   r   	availLeftavailTop
availWidthavailHeightdevicePixelRatior5   
colorDepth
isExtended
isInternal	isPrimaryr   id)r   r   r   r   r   r   r   r   r   r   r5   r   r   r   r   r   r   r   r   r   r   r   r   9  s$   













zScreenInfo.to_jsonc                 C  s   | di dt |d dt |d dt |d dt |d dt |d dt |d d	t |d
 dt |d dt|d dt|d dt |d dt|d dt|d dt|d dt|d dt|d S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r5   r   r   r   r   r   r   r   r   r   r   r   r   )r    r   r)   r#   r_   r*   r   r!   r   r   r   r#   M  sB   	
zScreenInfo.from_jsonNr2   r   r   r   r   r     s*   
 r   c                   @  s,   e Zd ZdZdZdZdd Zedd ZdS )	DisabledImageTypez3
    Enum of image types that can be disabled.
    avifwebpc                 C  rM   rN   rO   rP   r   r   r   r   j  rQ   zDisabledImageType.to_jsonc                 C  rR   rN   r   r!   r   r   r   r#   m  rS   zDisabledImageType.from_jsonN)	r$   r%   r&   r3   AVIFWEBPr   r(   r#   r   r   r   r   r   c  s    r   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c                  c  s    ddi} | V }t |d S )z^
    Tells whether emulation is supported.

    :returns: True if emulation is supported.
    methodzEmulation.canEmulateresultr   cmd_dictr   r   r   r   can_emulater  s
   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z/
    Clears the overridden device metrics.
    r   z$Emulation.clearDeviceMetricsOverrideNr   r   r   r   r   clear_device_metrics_override     
r   c                  c  r   )z?
    Clears the overridden Geolocation Position and Error.
    r   z"Emulation.clearGeolocationOverrideNr   r   r   r   r   clear_geolocation_override  r   r   c                  c  r   )z[
    Requests that page scale factor is reset to initial values.

    **EXPERIMENTAL**
    r   zEmulation.resetPageScaleFactorNr   r   r   r   r   reset_page_scale_factor  s   
r   enabledr_   c                 c  $    t  }| |d< d|d}|V }dS )z
    Enables or disables simulating a focused and active page.

    **EXPERIMENTAL**

    :param enabled: Whether to enable to disable focus emulation.
    r   z"Emulation.setFocusEmulationEnabledr   paramsNr   r   r   r   r   r   r   r   set_focus_emulation_enabled     

r   rf   c                 c  ,    t  }| dur| |d< d|d}|V }dS )z
    Automatically render all web contents using a dark theme.

    **EXPERIMENTAL**

    :param enabled: *(Optional)* Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
    Nr   z!Emulation.setAutoDarkModeOverrider   r   r   r   r   r   set_auto_dark_mode_override     

r   rater   c                 c  r   )z
    Enables CPU throttling to emulate slow CPUs.

    :param rate: Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
    r   zEmulation.setCPUThrottlingRater   Nr   )r   r   r   r   r   r   r   set_cpu_throttling_rate     
r   colortyping.Optional[dom.RGBA]c                 c  s0    t  }| dur|  |d< d|d}|V }dS )a  
    Sets or clears an override of the default background color of the frame. This override is used
    if the content does not specify one.

    :param color: *(Optional)* RGBA of the default background color. If not specified, any existing override will be cleared.
    Nr   z+Emulation.setDefaultBackgroundColorOverrider   r   r   )r   r   r   r   r   r   r   %set_default_background_color_override  s   	
r   insetsc                 c  (    t  }|  |d< d|d}|V }dS )z
    Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
    respective variables to be undefined, even if previously overridden.

    **EXPERIMENTAL**

    :param insets:
    r   z#Emulation.setSafeAreaInsetsOverrider   Nr   )r   r   r   r   r   r   r   set_safe_area_insets_override     
r   r   r    r   device_scale_factorr`   scaler   screen_widthr   screen_height
position_x
position_ydont_set_visible_sizescreen_orientation"typing.Optional[ScreenOrientation]viewporttyping.Optional[page.Viewport]display_featuretyping.Optional[DisplayFeature]device_posturetyping.Optional[DevicePosture]c                 c  s    t  }| |d< ||d< ||d< ||d< |dur||d< |dur$||d< |dur,||d< |dur4||d	< |dur<||d
< |	durD|	|d< |
durN|
 |d< |durX| |d< |durb| |d< |durl| |d< d|d}|V }dS )aW  
    Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
    window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
    query results).

    :param width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param device_scale_factor: Overriding device scale factor value. 0 disables the override.
    :param mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
    :param scale: **(EXPERIMENTAL)** *(Optional)* Scale to apply to resulting view image.
    :param screen_width: **(EXPERIMENTAL)** *(Optional)* Overriding screen width value in pixels (minimum 0, maximum 10000000).
    :param screen_height: **(EXPERIMENTAL)** *(Optional)* Overriding screen height value in pixels (minimum 0, maximum 10000000).
    :param position_x: **(EXPERIMENTAL)** *(Optional)* Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
    :param position_y: **(EXPERIMENTAL)** *(Optional)* Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
    :param dont_set_visible_size: **(EXPERIMENTAL)** *(Optional)* Do not set visible view size, rely upon explicit setVisibleSize call.
    :param screen_orientation: *(Optional)* Screen orientation override.
    :param viewport: **(EXPERIMENTAL)** *(Optional)* If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
    :param display_feature: **(EXPERIMENTAL)** *(Optional)* If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. Deprecated, use Emulation.setDisplayFeaturesOverride.
    :param device_posture: **(EXPERIMENTAL)** *(Optional)* If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.
    r   r   deviceScaleFactorr`   Nr   screenWidthscreenHeight	positionX	positionYdontSetVisibleSizescreenOrientationr   displayFeaturedevicePosturez"Emulation.setDeviceMetricsOverrider   r   )r   r   r   r`   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   set_device_metrics_override  s<   $
r  posturec                 c  r   )z
    Start reporting the given posture value to the Device Posture API.
    This override can also be set in setDeviceMetricsOverride().

    **EXPERIMENTAL**

    :param posture:
    r  z"Emulation.setDevicePostureOverrider   Nr   )r  r   r   r   r   r   r   set_device_posture_overrideB  r   r	  c                  c  r   )z
    Clears a device posture override set with either setDeviceMetricsOverride()
    or setDevicePostureOverride() and starts using posture information from the
    platform again.
    Does nothing if no override is set.

    **EXPERIMENTAL**
    r   z$Emulation.clearDevicePostureOverrideNr   r   r   r   r   clear_device_posture_overrideV     

r
  featurestyping.List[DisplayFeature]c                 c  .    t  }dd | D |d< d|d}|V }dS )z
    Start using the given display features to pupulate the Viewport Segments API.
    This override can also be set in setDeviceMetricsOverride().

    **EXPERIMENTAL**

    :param features:
    c                 S  rj   r   rk   rl   r   r   r   ro   q  rp   z1set_display_features_override.<locals>.<listcomp>r  z$Emulation.setDisplayFeaturesOverrider   Nr   )r  r   r   r   r   r   r   set_display_features_overridee  s   
r  c                  c  r   )z
    Clears the display features override set with either setDeviceMetricsOverride()
    or setDisplayFeaturesOverride() and starts using display features from the
    platform again.
    Does nothing if no override is set.

    **EXPERIMENTAL**
    r   z&Emulation.clearDisplayFeaturesOverrideNr   r   r   r   r   clear_display_features_overridey  r  r  hiddenc                 c  r   )z\


    **EXPERIMENTAL**

    :param hidden: Whether scrollbars should be always hidden.
    r  zEmulation.setScrollbarsHiddenr   Nr   )r  r   r   r   r   r   r   set_scrollbars_hidden  r   r  disabledc                 c  r   )zc


    **EXPERIMENTAL**

    :param disabled: Whether document.coookie API should be disabled.
    r  z#Emulation.setDocumentCookieDisabledr   Nr   )r  r   r   r   r   r   r   set_document_cookie_disabled  r   r  configurationrc   c                 c  4    t  }| |d< |dur||d< d|d}|V }dS )z


    **EXPERIMENTAL**

    :param enabled: Whether touch emulation based on mouse input should be enabled.
    :param configuration: *(Optional)* Touch/gesture events configuration. Default: current platform.
    r   Nr  z$Emulation.setEmitTouchEventsForMouser   r   )r   r  r   r   r   r   r   r   set_emit_touch_events_for_mouse  s   
r  media*typing.Optional[typing.List[MediaFeature]]c                 c  sF    t  }| dur| |d< |durdd |D |d< d|d}|V }dS )z
    Emulates the given media type or media feature for CSS media queries.

    :param media: *(Optional)* Media type to emulate. Empty string disables the override.
    :param features: *(Optional)* Media features to emulate.
    Nr  c                 S  rj   r   rk   rl   r   r   r   ro     rp   z&set_emulated_media.<locals>.<listcomp>r  zEmulation.setEmulatedMediar   r   )r  r  r   r   r   r   r   r   set_emulated_media  s   

r  r+   r*   c                 c  r   )z
    Emulates the given vision deficiency.

    :param type_: Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
    r.   z%Emulation.setEmulatedVisionDeficiencyr   Nr   r+   r   r   r   r   r   r   set_emulated_vision_deficiency  r   r  c                 c  r   )zK
    Emulates the given OS text scale.

    :param scale: *(Optional)*
    Nr   z Emulation.setEmulatedOSTextScaler   r   )r   r   r   r   r   r   r   set_emulated_os_text_scale  s   
r  latitude	longitudeaccuracyaltitudealtitude_accuracyheadingspeedc           
      c  s    t  }| dur| |d< |dur||d< |dur||d< |dur$||d< |dur,||d< |dur4||d< |dur<||d< d	|d
}|V }	dS )a  
    Overrides the Geolocation Position or Error. Omitting latitude, longitude or
    accuracy emulates position unavailable.

    :param latitude: *(Optional)* Mock latitude
    :param longitude: *(Optional)* Mock longitude
    :param accuracy: *(Optional)* Mock accuracy
    :param altitude: *(Optional)* Mock altitude
    :param altitude_accuracy: *(Optional)* Mock altitudeAccuracy
    :param heading: *(Optional)* Mock heading
    :param speed: *(Optional)* Mock speed
    Nr  r  r   r!  altitudeAccuracyr#  r$  z Emulation.setGeolocationOverrider   r   )
r  r  r   r!  r"  r#  r$  r   r   r   r   r   r   set_geolocation_override  s(   
r&  1typing.Generator[T_JSON_DICT, T_JSON_DICT, float]c                 c  s0    t  }|  |d< d|d}|V }t|d S )z>


    **EXPERIMENTAL**

    :param type_:
    :returns: 
    r.   z(Emulation.getOverriddenSensorInformationr   requestedSamplingFrequencyr   r   r   r  r   r   r   !get_overridden_sensor_information)  s   r*  metadatatyping.Optional[SensorMetadata]c                 c  D    t  }| |d< | |d< |dur| |d< d|d}|V }dS )a  
    Overrides a platform sensor of a given type. If ``enabled`` is true, calls to
    Sensor.start() will use a virtual sensor as backend rather than fetching
    data from a real hardware sensor. Otherwise, existing virtual
    sensor-backend Sensor objects will fire an error event and new calls to
    Sensor.start() will attempt to use a real sensor instead.

    **EXPERIMENTAL**

    :param enabled:
    :param type_:
    :param metadata: *(Optional)*
    r   r.   Nr+  z"Emulation.setSensorOverrideEnabledr   r   )r   r+   r+  r   r   r   r   r   r   set_sensor_override_enabled>  s   
r.  readingc                 c  4    t  }|  |d< | |d< d|d}|V }dS )z
    Updates the sensor readings reported by a sensor type previously overridden
    by setSensorOverrideEnabled.

    **EXPERIMENTAL**

    :param type_:
    :param reading:
    r.   r/  z#Emulation.setSensorOverrideReadingsr   Nr   )r+   r/  r   r   r   r   r   r   set_sensor_override_readings\  s   
r1  source!typing.Optional[PressureMetadata]c                 c  r-  )aa  
    Overrides a pressure source of a given type, as used by the Compute
    Pressure API, so that updates to PressureObserver.observe() are provided
    via setPressureStateOverride instead of being retrieved from
    platform-provided telemetry data.

    **EXPERIMENTAL**

    :param enabled:
    :param source:
    :param metadata: *(Optional)*
    r   r2  Nr+  z*Emulation.setPressureSourceOverrideEnabledr   r   )r   r2  r+  r   r   r   r   r   r   $set_pressure_source_override_enableds  s   
r4  statec                 c  r0  )aV  
    TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
    Provides a given pressure state that will be processed and eventually be
    delivered to PressureObserver users. ``source`` must have been previously
    overridden by setPressureSourceOverrideEnabled.

    **EXPERIMENTAL**

    :param source:
    :param state:
    r2  r5  z"Emulation.setPressureStateOverrider   Nr   )r2  r5  r   r   r   r   r   r   set_pressure_state_override  s   
r6  own_contribution_estimatec                 c  sD    t  }|  |d< | |d< |dur||d< d|d}|V }dS )aF  
    Provides a given pressure data set that will be processed and eventually be
    delivered to PressureObserver users. ``source`` must have been previously
    overridden by setPressureSourceOverrideEnabled.

    **EXPERIMENTAL**

    :param source:
    :param state:
    :param own_contribution_estimate: *(Optional)*
    r2  r5  NownContributionEstimatez!Emulation.setPressureDataOverrider   r   )r2  r5  r7  r   r   r   r   r   r   set_pressure_data_override  s   
r9  is_user_activeis_screen_unlockedc                 c  ,    t  }| |d< ||d< d|d}|V }dS )z
    Overrides the Idle state.

    :param is_user_active: Mock isUserActive
    :param is_screen_unlocked: Mock isScreenUnlocked
    isUserActiveisScreenUnlockedzEmulation.setIdleOverrider   Nr   )r:  r;  r   r   r   r   r   r   set_idle_override  r   r?  c                  c  r   )z&
    Clears Idle state overrides.
    r   zEmulation.clearIdleOverrideNr   r   r   r   r   clear_idle_override  r   r@  r[   c                 c  r   )z
    Overrides value returned by the javascript navigator object.

    **EXPERIMENTAL**

    :param platform: The platform navigator.platform should return.
    r[   zEmulation.setNavigatorOverridesr   Nr   )r[   r   r   r   r   r   r   set_navigator_overrides  r   rA  page_scale_factorc                 c  r   )zu
    Sets a specified page scale factor.

    **EXPERIMENTAL**

    :param page_scale_factor: Page scale factor.
    pageScaleFactorzEmulation.setPageScaleFactorr   Nr   )rB  r   r   r   r   r   r   set_page_scale_factor  r   rD  rF   c                 c  r   )z|
    Switches script execution in the page.

    :param value: Whether script execution should be disabled in the page.
    rF   z$Emulation.setScriptExecutionDisabledr   Nr   )rF   r   r   r   r   r   r   set_script_execution_disabled	  r   rE  max_touch_pointsc                 c  r  )z
    Enables touch on platforms which do not support them.

    :param enabled: Whether the touch event emulation should be enabled.
    :param max_touch_points: *(Optional)* Maximum touch points supported. Defaults to one.
    r   NmaxTouchPointsz"Emulation.setTouchEmulationEnabledr   r   )r   rF  r   r   r   r   r   r   set_touch_emulation_enabled  s   

rH  policybudget&max_virtual_time_task_starvation_countinitial_virtual_time'typing.Optional[network.TimeSinceEpoch]c                 c  sd    t  }|  |d< |dur||d< |dur||d< |dur$| |d< d|d}|V }t|d S )	a#  
    Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
    the current virtual time policy.  Note this supersedes any previous time budget.

    **EXPERIMENTAL**

    :param policy:
    :param budget: *(Optional)* If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
    :param max_virtual_time_task_starvation_count: *(Optional)* If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
    :param initial_virtual_time: *(Optional)* If set, base::Time::Now will be overridden to initially return this value.
    :returns: Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
    rI  NrJ  !maxVirtualTimeTaskStarvationCountinitialVirtualTimezEmulation.setVirtualTimePolicyr   virtualTimeTicksBaser)  )rI  rJ  rK  rL  r   r   r   r   r   r   set_virtual_time_policy/  s   rQ  localec                 c  r   )z
    Overrides default host system locale with the specified one.

    **EXPERIMENTAL**

    :param locale: *(Optional)* ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
    NrR  zEmulation.setLocaleOverrider   r   )rR  r   r   r   r   r   r   set_locale_overrideQ  r   rS  timezone_idc                 c  r   )ag  
    Overrides default host system timezone with the specified one.

    :param timezone_id: The timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
    
timezoneIdzEmulation.setTimezoneOverrider   Nr   )rT  r   r   r   r   r   r   set_timezone_overridee  r   rV  c                 c  r<  )a<  
    Resizes the frame/viewport of the page. Note that this does not affect the frame's container
    (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
    on Android.

    **EXPERIMENTAL**

    :param width: Frame width (DIP).
    :param height: Frame height (DIP).
    r   r   zEmulation.setVisibleSizer   Nr   )r   r   r   r   r   r   r   r   set_visible_sizev  s   
rW  image_typestyping.List[DisabledImageType]c                 c  r  )zM


    **EXPERIMENTAL**

    :param image_types: Image types to disable.
    c                 S  rj   r   rk   rl   r   r   r   ro     rp   z,set_disabled_image_types.<locals>.<listcomp>
imageTypeszEmulation.setDisabledImageTypesr   Nr   )rX  r   r   r   r   r   r   set_disabled_image_types  s   

r[  data_saver_enabledc                 c  r   )z
    Override the value of navigator.connection.saveData

    **EXPERIMENTAL**

    :param data_saver_enabled: *(Optional)* Override value. Omitting the parameter disables the override.
    NdataSaverEnabledzEmulation.setDataSaverOverrider   r   )r\  r   r   r   r   r   r   set_data_saver_override  r   r^  hardware_concurrencyc                 c  r   )z]


    **EXPERIMENTAL**

    :param hardware_concurrency: Hardware concurrency to report
    hardwareConcurrencyz(Emulation.setHardwareConcurrencyOverrider   Nr   )r_  r   r   r   r   r   r   !set_hardware_concurrency_override  r   ra  
user_agentaccept_languageuser_agent_metadata"typing.Optional[UserAgentMetadata]c                 c  sX    t  }| |d< |dur||d< |dur||d< |dur"| |d< d|d}|V }dS )a  
    Allows overriding user agent with the given string.
    ``userAgentMetadata`` must be set for Client Hint headers to be sent.

    :param user_agent: User agent to use.
    :param accept_language: *(Optional)* Browser language to emulate.
    :param platform: *(Optional)* The platform navigator.platform should return.
    :param user_agent_metadata: **(EXPERIMENTAL)** *(Optional)* To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
    	userAgentNacceptLanguager[   userAgentMetadatazEmulation.setUserAgentOverrider   r   )rb  rc  r[   rd  r   r   r   r   r   r   set_user_agent_override  s   
ri  c                 c  r   )z
    Allows overriding the automation flag.

    **EXPERIMENTAL**

    :param enabled: Whether the override should be enabled.
    r   zEmulation.setAutomationOverrider   Nr   r   r   r   r   set_automation_override  r   rj  
differencec                 c  r   )af  
    Allows overriding the difference between the small and large viewport sizes, which determine the
    value of the ``svh`` and ``lvh`` unit, respectively. Only supported for top-level frames.

    **EXPERIMENTAL**

    :param difference: This will cause an element of size 100svh to be ```difference``` pixels smaller than an element of size 100lvh.
    rk  z2Emulation.setSmallViewportHeightDifferenceOverrider   Nr   )rk  r   r   r   r   r   r   -set_small_viewport_height_difference_override  s   
rl  Ctyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[ScreenInfo]]c                  c  s"    ddi} | V }dd |d D S )zV
    Returns device's screen configuration.

    **EXPERIMENTAL**

    :returns: 
    r   zEmulation.getScreenInfosc                 S  rt   r   )r   r#   rl   r   r   r   ro     rv   z$get_screen_infos.<locals>.<listcomp>screenInfosr   r   r   r   r   get_screen_infos  s
   	ro  r   r   work_area_insetstyping.Optional[WorkAreaInsets]r   rotationr   r   r   6typing.Generator[T_JSON_DICT, T_JSON_DICT, ScreenInfo]c
                 c  s    t  }
| |
d< ||
d< ||
d< ||
d< |dur| |
d< |dur&||
d< |dur.||
d< |dur6||
d	< |dur>||
d
< |	durF|	|
d< d|
d}|V }t|d S )a  
    Add a new screen to the device. Only supported in headless mode.

    **EXPERIMENTAL**

    :param left: Offset of the left edge of the screen in pixels.
    :param top: Offset of the top edge of the screen in pixels.
    :param width: The width of the screen in pixels.
    :param height: The height of the screen in pixels.
    :param work_area_insets: *(Optional)* Specifies the screen's work area. Default is entire screen.
    :param device_pixel_ratio: *(Optional)* Specifies the screen's device pixel ratio. Default is 1.
    :param rotation: *(Optional)* Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
    :param color_depth: *(Optional)* Specifies the screen's color depth in bits. Default is 24.
    :param label: *(Optional)* Specifies the descriptive label for the screen. Default is none.
    :param is_internal: *(Optional)* Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
    :returns: 
    r   r   r   r   NworkAreaInsetsr   rr  r   r   r   zEmulation.addScreenr   
screenInfo)r   r   r   r#   )r   r   r   r   rp  r   rr  r   r   r   r   r   r   r   r   r   
add_screen  s.   rv  	screen_idc                 c  r   )zv
    Remove screen from the device. Only supported in headless mode.

    **EXPERIMENTAL**

    :param screen_id:
    screenIdzEmulation.removeScreenr   Nr   )rw  r   r   r   r   r   r   remove_screenR  s   

ry  z"Emulation.virtualTimeBudgetExpiredc                   @  s   e Zd ZdZedddZdS )	VirtualTimeBudgetExpiredz~
    **EXPERIMENTAL**

    Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
    r   r   r   c                 C  s   |  S rN   r   r!   r   r   r   r#   o  s   z"VirtualTimeBudgetExpired.from_jsonN)r   r   r   rz  )r$   r%   r&   r3   r(   r#   r   r   r   r   rz  e  s    rz  )r   r   )r   r   )r   r_   r   r   rN   )r   rf   r   r   )r   r   r   r   )r   r   r   r   )r   r
   r   r   )
NNNNNNNNNN)r   r    r   r    r   r   r`   r_   r   r   r   r   r   r   r   r   r   r   r   rf   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  rc   r   r   )NN)r  rc   r  r  r   r   )r+   r*   r   r   )r   r   r   r   )NNNNNNN)r  r   r  r   r   r   r!  r   r"  r   r#  r   r$  r   r   r   )r+   rw   r   r'  )r   r_   r+   rw   r+  r,  r   r   )r+   rw   r/  r   r   r   )r   r_   r2  r   r+  r3  r   r   )r2  r   r5  r   r   r   )r2  r   r5  r   r7  r   r   r   )r:  r_   r;  r_   r   r   )r[   r*   r   r   )rB  r   r   r   )rF   r_   r   r   )r   r_   rF  r   r   r   )NNN)
rI  rI   rJ  r   rK  r   rL  rM  r   r'  )rR  rc   r   r   )rT  r*   r   r   )r   r    r   r    r   r   )rX  rY  r   r   )r\  rf   r   r   )r_  r    r   r   )
rb  r*   rc  rc   r[   rc   rd  re  r   r   )rk  r    r   r   )r   rm  )NNNNNN)r   r    r   r    r   r    r   r    rp  rq  r   r   rr  r   r   r   r   rc   r   rf   r   rs  )rw  r   r   r   )S
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r
   r)   r4   r>   rD   EnumrI   rW   rZ   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.  r1  r4  r6  r9  r?  r@  rA  rD  rE  rH  rQ  rS  rV  rW  r[  r^  ra  ri  rj  rl  ro  rv  ry  rz  r   r   r   r   <module>   s  ;E#_









D





+

#
6