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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G d)d* d*ejZd+d,d-d.Zd/d,d0d1Z d/d,d2d3Z!d/d,d4d5Z"d6d/d7d8d9Z#dd:d/d7d;d<Z$d=d/d>d?d@Z%ddAd/dBdCdDZ&ddEdEd=d6dFdGdGdGdGd:dHdIdJdKd/dLdMdNZ'dd/dOdPdQZ(d/d,dRdSZ)d6d/dTdUdVZ*d6d/dWdXdYZ+dd6dZd/d[d\d]Z,ddZd^d/d_d`daZ-dbd/dcdddeZ.ddFdFdFd/dfdgdhZ/ddidcdjdkZ0dd6ddld/dmdndoZ1dd"d/dpdqdrZ2dd6d$dsd/dtdudvZ3d$d&d/dwdxdyZ4d6d6d/dzd{d|Z5d/d,d}d~Z6dbd/dddZ7d=d/dddZ8d6d/dddZ9dd6dGd/dddZ:dddFdGddidddZ;ddZd/dddZ<dbd/dddZ=dEdEd/dddZ>dd/dddZ?dEd/dddZ@ddbdZdZdd/dddZAd6d/d7ddZBedeG dd dZCdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)network)pagec                   @  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_intanglec                 C  s   t  }| j|d< | j|d< |S )Ntyper   )dictr   r   selfjson r   U/tmp/pip-unpacked-wheel-3ysq0mf8/selenium/webdriver/common/devtools/v131/emulation.pyto_json   s    

zScreenOrientation.to_jsonc                 C  s   | t |d t|d dS )Nr   r   )r   r   r   r   clsr   r   r   r   	from_json"   s    

zScreenOrientation.from_jsonN__name__
__module____qualname____doc____annotations__r   classmethodr   r   r   r   r   r
      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  s(   t  }| j|d< | j|d< | j|d< |S )Nr#   r$   
maskLength)r   r#   r$   r%   r   r   r   r   r   8   s
    


zDisplayFeature.to_jsonc                 C  s&   | t |d t|d t|d dS )Nr#   r$   r&   )r#   r$   r%   r   r   r   r   r   r   ?   s
    


zDisplayFeature.from_jsonNr   r   r   r    r   r!   r   r   r   r   r   r"   *   s   
r"   c                   @  s*   e Zd ZU ded< dd Zedd ZdS )DevicePosturer   r   c                 C  s   t  }| j|d< |S )Nr   )r   r   r   r   r   r   r   M   s    
zDevicePosture.to_jsonc                 C  s   | t |d dS )Nr   )r   r   r   r   r   r   r   R   s    
zDevicePosture.from_jsonNr'   r   r   r   r   r(   H   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  s   t  }| j|d< | j|d< |S )Nr+   r,   )r   r+   r,   r   r   r   r   r   _   s    

zMediaFeature.to_jsonc                 C  s   | t |d t |d dS )Nr+   r,   )r+   r,   r)   r   r   r   r   r   e   s    

zMediaFeature.from_jsonNr'   r   r   r   r   r*   Y   s
   
r*   c                   @  s0   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.
    ZadvancepauseZpauseIfNetworkFetchesPendingc                 C  s   | j S Nr,   r   r   r   r   r   x   s    zVirtualTimePolicy.to_jsonc                 C  s   | |S r/   r   r   r   r   r   r   {   s    zVirtualTimePolicy.from_jsonN)
r   r   r   r   ZADVANCEZPAUSEZ PAUSE_IF_NETWORK_FETCHES_PENDINGr   r!   r   r   r   r   r   r-   m   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 )
UserAgentBrandVersionzh
    Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
    r   brandversionc                 C  s   t  }| j|d< | j|d< |S )Nr3   r4   )r   r3   r4   r   r   r   r   r      s    

zUserAgentBrandVersion.to_jsonc                 C  s   | t |d t |d dS )Nr3   r4   )r3   r4   r)   r   r   r   r   r      s    

zUserAgentBrandVersion.from_jsonNr   r   r   r   r   r2      s   
r2   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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]wow64c                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | jd k	rVdd | jD |d< | jd k	rtd	d | jD |d
< | jd k	r| j|d< | j	d k	r| j	|d< | j
d k	r| j
|d< |S )Nr6   platformVersionr8   r9   r;   c                 S  s   g | ]}|  qS r   r   .0ir   r   r   
<listcomp>   s     z-UserAgentMetadata.to_json.<locals>.<listcomp>r<   c                 S  s   g | ]}|  qS r   rD   rE   r   r   r   rH      s     fullVersionListfullVersionr@   rB   )r   r6   r7   r8   r9   r;   r<   r=   r?   r@   rB   r   r   r   r   r      s"    












zUserAgentMetadata.to_jsonc                 C  s   | t |d t |d t |d t |d t|d d|krNdd |d D nd d	|krjd
d |d	 D nd d|krt |d nd d|krt |d nd d|krt|d nd d
S )Nr6   rC   r8   r9   r;   r<   c                 S  s   g | ]}t |qS r   r2   r   rE   r   r   r   rH      s     z/UserAgentMetadata.from_json.<locals>.<listcomp>rI   c                 S  s   g | ]}t |qS r   rK   rE   r   r   r   rH      s     rJ   r@   rB   )
r6   r7   r8   r9   r;   r<   r=   r?   r@   rB   )r   r:   r   r   r   r   r      s    




zUserAgentMetadata.from_json)r   r   r   r   r    r<   r=   r?   r@   rB   r   r!   r   r   r   r   r   r5      s   
r5   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-orientationZaccelerometerzambient-lightZgravityZ	gyroscopezlinear-accelerationZmagnetometerzrelative-orientationc                 C  s   | j S r/   r0   r1   r   r   r   r      s    zSensorType.to_jsonc                 C  s   | |S r/   r   r   r   r   r   r      s    zSensorType.from_jsonN)r   r   r   r   ZABSOLUTE_ORIENTATIONZACCELEROMETERZAMBIENT_LIGHTZGRAVITYZ	GYROSCOPEZLINEAR_ACCELERATIONZMAGNETOMETERZRELATIVE_ORIENTATIONr   r!   r   r   r   r   r   rL      s   rL   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 )SensorMetadataNrA   	availabletyping.Optional[float]minimum_frequencymaximum_frequencyc                 C  sF   t  }| jd k	r| j|d< | jd k	r.| j|d< | jd k	rB| j|d< |S )NrN   minimumFrequencymaximumFrequency)r   rN   rP   rQ   r   r   r   r   r      s    





zSensorMetadata.to_jsonc                 C  sJ   | d|krt |d nd d|kr,t|d nd d|krBt|d nd dS )NrN   rR   rS   )rN   rP   rQ   )r:   floatr   r   r   r   r      s
    zSensorMetadata.from_json)
r   r   r   rN   r    rP   rQ   r   r!   r   r   r   r   r   rM      s   

rM   c                   @  s*   e Zd ZU ded< dd Zedd ZdS )SensorReadingSinglerT   r,   c                 C  s   t  }| j|d< |S )Nr,   )r   r,   r   r   r   r   r     s    
zSensorReadingSingle.to_jsonc                 C  s   | t |d dS )Nr,   r0   rT   r   r   r   r   r     s    
zSensorReadingSingle.from_jsonNr'   r   r   r   r   rU     s   
rU   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 )
SensorReadingXYZrT   xyzc                 C  s(   t  }| j|d< | j|d< | j|d< |S )NrX   rY   rZ   )r   rX   rY   rZ   r   r   r   r   r     s
    


zSensorReadingXYZ.to_jsonc                 C  s&   | t |d t |d t |d dS )NrX   rY   rZ   )rX   rY   rZ   rV   r   r   r   r   r   &  s
    


zSensorReadingXYZ.from_jsonNr'   r   r   r   r   rW     s   
rW   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 )SensorReadingQuaternionrT   rX   rY   rZ   wc                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )NrX   rY   rZ   r\   )r   rX   rY   rZ   r\   r   r   r   r   r   9  s    



zSensorReadingQuaternion.to_jsonc                 C  s0   | t |d t |d t |d t |d dS )NrX   rY   rZ   r\   )rX   rY   rZ   r\   rV   r   r   r   r   r   A  s    



z!SensorReadingQuaternion.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 )SensorReadingNz$typing.Optional[SensorReadingSingle]singlez!typing.Optional[SensorReadingXYZ]xyzz(typing.Optional[SensorReadingQuaternion]
quaternionc                 C  sR   t  }| jd k	r| j |d< | jd k	r6| j |d< | jd k	rN| j |d< |S )Nr^   r_   r`   )r   r^   r   r_   r`   r   r   r   r   r   S  s    


zSensorReading.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 )Nr^   r_   r`   )r^   r_   r`   )rU   r   rW   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]   K  s   

r]   c                   @  s$   e Zd ZdZdd Zedd ZdS )PressureSourcecpuc                 C  s   | j S r/   r0   r1   r   r   r   r   i  s    zPressureSource.to_jsonc                 C  s   | |S r/   r   r   r   r   r   r   l  s    zPressureSource.from_jsonN)r   r   r   ZCPUr   r!   r   r   r   r   r   ra   f  s   ra   c                   @  s0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
PressureStateZnominalZfairZseriouscriticalc                 C  s   | j S r/   r0   r1   r   r   r   r   w  s    zPressureState.to_jsonc                 C  s   | |S r/   r   r   r   r   r   r   z  s    zPressureState.from_jsonN)
r   r   r   ZNOMINALZFAIRZSERIOUSCRITICALr   r!   r   r   r   r   r   rc   q  s   rc   c                   @  s.   e Zd ZU dZded< dd Zedd ZdS )PressureMetadataNrA   rN   c                 C  s   t  }| jd k	r| j|d< |S )NrN   )r   rN   r   r   r   r   r     s    

zPressureMetadata.to_jsonc                 C  s   | d|krt |d nd dS )NrN   )rN   r:   r   r   r   r   r     s    zPressureMetadata.from_json)r   r   r   rN   r    r   r!   r   r   r   r   r   rf     s   
rf   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.
    ZavifZwebpc                 C  s   | j S r/   r0   r1   r   r   r   r     s    zDisabledImageType.to_jsonc                 C  s   | |S r/   r   r   r   r   r   r     s    zDisabledImageType.from_jsonN)	r   r   r   r   ZAVIFZWEBPr   r!   r   r   r   r   r   rh     s   rh   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool])returnc                  c  s   ddi} | V }t |d S )z^
    Tells whether emulation is supported.

    :returns: True if emulation is supported.
    methodzEmulation.canEmulateresultrg   cmd_dictr   r   r   r   can_emulate  s
     rn   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c  s   ddi} | V }dS )z/
    Clears the overridden device metrics.
    rj   z$Emulation.clearDeviceMetricsOverrideNr   rl   r   r   r   clear_device_metrics_override  s     ro   c                  c  s   ddi} | V }dS )z?
    Clears the overridden Geolocation Position and Error.
    rj   z"Emulation.clearGeolocationOverrideNr   rl   r   r   r   clear_geolocation_override  s     rp   c                  c  s   ddi} | V }dS )z[
    Requests that page scale factor is reset to initial values.

    **EXPERIMENTAL**
    rj   zEmulation.resetPageScaleFactorNr   rl   r   r   r   reset_page_scale_factor  s     rq   r:   )enabledri   c                 c  s"   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.
    rr   z"Emulation.setFocusEmulationEnabledrj   paramsNr   rr   rt   rm   r   r   r   r   set_focus_emulation_enabled  s    
rw   rA   c                 c  s*   t  }| dk	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.
    Nrr   z!Emulation.setAutoDarkModeOverriders   ru   rv   r   r   r   set_auto_dark_mode_override  s    
rx   rT   )rateri   c                 c  s"   t  }| |d< d|d}|V }dS )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).
    ry   zEmulation.setCPUThrottlingRaters   Nru   )ry   rt   rm   r   r   r   r   set_cpu_throttling_rate  s    rz   ztyping.Optional[dom.RGBA])colorri   c                 c  s.   t  }| dk	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.setDefaultBackgroundColorOverriders   r   r   )r{   rt   rm   r   r   r   r   %set_default_background_color_override  s    	r}   r   rO   ztyping.Optional[int]z"typing.Optional[ScreenOrientation]ztyping.Optional[page.Viewport]ztyping.Optional[DisplayFeature]ztyping.Optional[DevicePosture])widthheightdevice_scale_factorr;   scalescreen_widthscreen_height
position_x
position_ydont_set_visible_sizescreen_orientationviewportdisplay_featuredevice_postureri   c                 c  s   t  }| |d< ||d< ||d< ||d< |dk	r6||d< |dk	rF||d< |dk	rV||d< |dk	rf||d	< |dk	rv||d
< |	dk	r|	|d< |
dk	r|
 |d< |dk	r| |d< |dk	r| |d< |dk	r| |d< d|d}|V }dS )a!  
    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.
    :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   ZdeviceScaleFactorr;   Nr   ZscreenWidthZscreenHeightZ	positionXZ	positionYZdontSetVisibleSizeZscreenOrientationr   ZdisplayFeatureZdevicePosturez"Emulation.setDeviceMetricsOverriders   r|   )r~   r   r   r;   r   r   r   r   r   r   r   r   r   r   rt   rm   r   r   r   r   set_device_metrics_override  s:    $r   )postureri   c                 c  s&   t  }|  |d< d|d}|V }dS )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.setDevicePostureOverriders   Nr|   )r   rt   rm   r   r   r   r   set_device_posture_override[  s    r   c                  c  s   ddi} | V }dS )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**
    rj   z$Emulation.clearDevicePostureOverrideNr   rl   r   r   r   clear_device_posture_overrideo  s    
 r   )hiddenri   c                 c  s"   t  }| |d< d|d}|V }dS )z\


    **EXPERIMENTAL**

    :param hidden: Whether scrollbars should be always hidden.
    r   zEmulation.setScrollbarsHiddenrs   Nru   )r   rt   rm   r   r   r   r   set_scrollbars_hidden~  s    
r   )disabledri   c                 c  s"   t  }| |d< d|d}|V }dS )zc


    **EXPERIMENTAL**

    :param disabled: Whether document.coookie API should be disabled.
    r   z#Emulation.setDocumentCookieDisabledrs   Nru   )r   rt   rm   r   r   r   r   set_document_cookie_disabled  s    
r   r>   )rr   configurationri   c                 c  s2   t  }| |d< |dk	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.
    rr   Nr   z$Emulation.setEmitTouchEventsForMousers   ru   )rr   r   rt   rm   r   r   r   r   set_emit_touch_events_for_mouse  s    r   z*typing.Optional[typing.List[MediaFeature]])mediafeaturesri   c                 c  sD   t  }| dk	r| |d< |dk	r0d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  s   g | ]}|  qS r   rD   rE   r   r   r   rH     s     z&set_emulated_media.<locals>.<listcomp>r   zEmulation.setEmulatedMediars   ru   )r   r   rt   rm   r   r   r   r   set_emulated_media  s    
r   r   )r   ri   c                 c  s"   t  }| |d< d|d}|V }dS )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.setEmulatedVisionDeficiencyrs   Nru   r   rt   rm   r   r   r   r   set_emulated_vision_deficiency  s    r   )latitude	longitudeaccuracyri   c                 c  sJ   t  }| dk	r| |d< |dk	r&||d< |dk	r6||d< d|d}|V }dS )a  
    Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
    unavailable.

    :param latitude: *(Optional)* Mock latitude
    :param longitude: *(Optional)* Mock longitude
    :param accuracy: *(Optional)* Mock accuracy
    Nr   r   r   z Emulation.setGeolocationOverriders   ru   )r   r   r   rt   rm   r   r   r   r   set_geolocation_override  s    r   z1typing.Generator[T_JSON_DICT, T_JSON_DICT, float]c                 c  s.   t  }|  |d< d|d}|V }t|d S )z>


    **EXPERIMENTAL**

    :param type_:
    :returns: 
    r   z(Emulation.getOverriddenSensorInformationrs   ZrequestedSamplingFrequencyr   r   rT   r   r   r   r   !get_overridden_sensor_information  s    r   ztyping.Optional[SensorMetadata])rr   r   metadatari   c                 c  sB   t  }| |d< | |d< |dk	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)*
    rr   r   Nr   z"Emulation.setSensorOverrideEnabledrs   r|   )rr   r   r   rt   rm   r   r   r   r   set_sensor_override_enabled  s    r   )r   readingri   c                 c  s2   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.setSensorOverrideReadingsrs   Nr|   )r   r   rt   rm   r   r   r   r   set_sensor_override_readings0  s    r   z!typing.Optional[PressureMetadata])rr   sourcer   ri   c                 c  sB   t  }| |d< | |d< |dk	r.| |d< d|d}|V }dS )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)*
    rr   r   Nr   z*Emulation.setPressureSourceOverrideEnabledrs   r|   )rr   r   r   rt   rm   r   r   r   r   $set_pressure_source_override_enabledG  s    r   )r   stateri   c                 c  s2   t  }|  |d< | |d< d|d}|V }dS )a  
    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:
    r   r   z"Emulation.setPressureStateOverriders   Nr|   )r   r   rt   rm   r   r   r   r   set_pressure_state_overrided  s    r   )is_user_activeis_screen_unlockedri   c                 c  s*   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
    ZisUserActiveZisScreenUnlockedzEmulation.setIdleOverriders   Nru   )r   r   rt   rm   r   r   r   r   set_idle_override|  s    
r   c                  c  s   ddi} | V }dS )z&
    Clears Idle state overrides.
    rj   zEmulation.clearIdleOverrideNr   rl   r   r   r   clear_idle_override  s     r   )r6   ri   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Overrides value returned by the javascript navigator object.

    **EXPERIMENTAL**

    :param platform: The platform navigator.platform should return.
    r6   zEmulation.setNavigatorOverridesrs   Nru   )r6   rt   rm   r   r   r   r   set_navigator_overrides  s    
r   )page_scale_factorri   c                 c  s"   t  }| |d< d|d}|V }dS )zu
    Sets a specified page scale factor.

    **EXPERIMENTAL**

    :param page_scale_factor: Page scale factor.
    ZpageScaleFactorzEmulation.setPageScaleFactorrs   Nru   )r   rt   rm   r   r   r   r   set_page_scale_factor  s    
r   )r,   ri   c                 c  s"   t  }| |d< d|d}|V }dS )z|
    Switches script execution in the page.

    :param value: Whether script execution should be disabled in the page.
    r,   z$Emulation.setScriptExecutionDisabledrs   Nru   )r,   rt   rm   r   r   r   r   set_script_execution_disabled  s    r   )rr   max_touch_pointsri   c                 c  s2   t  }| |d< |dk	r||d< d|d}|V }dS )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.
    rr   NZmaxTouchPointsz"Emulation.setTouchEmulationEnabledrs   ru   )rr   r   rt   rm   r   r   r   r   set_touch_emulation_enabled  s    
r   z'typing.Optional[network.TimeSinceEpoch])policybudget&max_virtual_time_task_starvation_countinitial_virtual_timeri   c                 c  sb   t  }|  |d< |dk	r"||d< |dk	r2||d< |dk	rF| |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).
    r   Nr   Z!maxVirtualTimeTaskStarvationCountZinitialVirtualTimezEmulation.setVirtualTimePolicyrs   ZvirtualTimeTicksBaser   )r   r   r   r   rt   rm   r   r   r   r   set_virtual_time_policy  s    r   )localeri   c                 c  s*   t  }| dk	r| |d< d|d}|V }dS )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.
    Nr   zEmulation.setLocaleOverriders   ru   )r   rt   rm   r   r   r   r   set_locale_override  s    
r   )timezone_idri   c                 c  s"   t  }| |d< d|d}|V }dS )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.
    Z
timezoneIdzEmulation.setTimezoneOverriders   Nru   )r   rt   rm   r   r   r   r   set_timezone_override  s    r   )r~   r   ri   c                 c  s*   t  }| |d< ||d< d|d}|V }dS )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.setVisibleSizers   Nru   )r~   r   rt   rm   r   r   r   r   set_visible_size-  s    r   ztyping.List[DisabledImageType])image_typesri   c                 c  s,   t  }dd | D |d< d|d}|V }dS )zM


    **EXPERIMENTAL**

    :param image_types: Image types to disable.
    c                 S  s   g | ]}|  qS r   rD   rE   r   r   r   rH   P  s     z,set_disabled_image_types.<locals>.<listcomp>Z
imageTypeszEmulation.setDisabledImageTypesrs   Nru   )r   rt   rm   r   r   r   r   set_disabled_image_typesE  s    
r   )hardware_concurrencyri   c                 c  s"   t  }| |d< d|d}|V }dS )z]


    **EXPERIMENTAL**

    :param hardware_concurrency: Hardware concurrency to report
    ZhardwareConcurrencyz(Emulation.setHardwareConcurrencyOverriders   Nru   )r   rt   rm   r   r   r   r   !set_hardware_concurrency_overrideX  s    
r   z"typing.Optional[UserAgentMetadata])
user_agentaccept_languager6   user_agent_metadatari   c                 c  sV   t  }| |d< |dk	r||d< |dk	r.||d< |dk	rB| |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
    Z	userAgentNZacceptLanguager6   ZuserAgentMetadatazEmulation.setUserAgentOverriders   r|   )r   r   r6   r   rt   rm   r   r   r   r   set_user_agent_overridek  s    r   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Allows overriding the automation flag.

    **EXPERIMENTAL**

    :param enabled: Whether the override should be enabled.
    rr   zEmulation.setAutomationOverriders   Nru   rv   r   r   r   set_automation_override  s    
r   z"Emulation.virtualTimeBudgetExpiredc                   @  s$   e Zd ZdZedd dddZdS )VirtualTimeBudgetExpiredz~
    **EXPERIMENTAL**

    Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
    r   )r   ri   c                 C  s   |  S r/   r   r   r   r   r   r     s    z"VirtualTimeBudgetExpired.from_jsonN)r   r   r   r   r!   r   r   r   r   r   r     s   r   )N)N)
NNNNNNNNNN)N)NN)NNN)N)N)N)NNN)N)NNN)D
__future__r   utilr   r   Zdataclassesr   enumtyping r   r   r	   r
   r"   r(   r*   Enumr-   r2   r5   rL   rM   rU   rW   r[   r]   ra   rc   rf   rh   rn   ro   rp   rq   rw   rx   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   r   r   r   r   r   r   r   r   <module>   s   >

            ,D        
    #    