o
    ҷh`                     @  sX  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 G d	d
 d
e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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eG d%d& d&ZeG d'd( d(ZG d)d* d*ejZG d+d, d,eZ G d-d. d.eZ!G d/d0 d0eZ"eG d1d2 d2Z#eG d3d4 d4Z$eG d5d6 d6Z%eG d7d8 d8Z&G d9d: d:ejZ'dd?d@Z(ddEdFZ)ddHdIZ*	dddMdNZ+	dddQdRZ,	dddSdTZ-ddVdWZ.	dddZd[Z/dd\d]Z0dd^d_Z1dd`daZ2ddbdcZ3ddddeZ4ddfdgZ5ddhdiZ6ddjdkZ7ddmdnZ8ddqdrZ9ddvdwZ:ddzd{Z;dd}d~Z<dddZ=	ddddZ>dddZ?dddZ@dddZAdddZBdddZCdddZDdddZEdddZFdddZGedeG dd dZHedeG dd dZIedeG dd dZJedeG dd dZKedeG dd dZLedeG dd dZMedeG dd dZNedeG dd dZOedeG dd dZPdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)browser)network)pagec                      4   e Zd Zd
ddZedddZ fdd	Z  ZS )SerializedStorageKeyreturnstrc                 C     | S N selfr   r   b/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v118/storage.pyto_json      zSerializedStorageKey.to_jsonjsonc                 C     | |S r   r   clsr   r   r   r   	from_json      zSerializedStorageKey.from_jsonc                      d t  S )NzSerializedStorageKey({})formatsuper__repr__r   	__class__r   r   r          zSerializedStorageKey.__repr__r   r   )r   r   r   r   __name__
__module____qualname__r   classmethodr   r    __classcell__r   r   r!   r   r      
    
r   c                   @  s\   e Zd ZdZdZdZdZd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 )StorageTypez)
    Enum of possible storage types.
    appcachecookiesfile_systems	indexeddblocal_storageshader_cachewebsqlservice_workerscache_storageinterest_groupsshared_storagestorage_bucketsallotherc                 C     | j S r   valuer   r   r   r   r   0      zStorageType.to_jsonc                 C  r   r   r   r   r   r   r   r   3   r   zStorageType.from_jsonN)r&   r'   r(   __doc__APPCACHECOOKIESFILE_SYSTEMS	INDEXEDDBLOCAL_STORAGESHADER_CACHEWEBSQLSERVICE_WORKERSCACHE_STORAGEINTEREST_GROUPSSHARED_STORAGESTORAGE_BUCKETSALL_OTHERr   r)   r   r   r   r   r   r,      s&    r,   c                   @  6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )UsageForTypez#
    Usage for a storage type.
    r,   storage_typefloatusagec                 C  s"   t  }| j |d< | j|d< |S )NstorageTyperR   )dictrP   r   rR   r   r   r   r   r   r   C   s   
zUsageForType.to_jsonc                 C  s   | t |d t|d dS )NrS   rR   )rP   rR   )r,   r   rQ   r   r   r   r   r   I   s   
zUsageForType.from_jsonNr&   r'   r(   r?   __annotations__r   r)   r   r   r   r   r   rO   8      
 rO   c                   @  rN   )TrustTokenszq
    Pair of issuer origin and number of available (signed, but not used) Trust
    Tokens from that issuer.
    r   issuer_originrQ   countc                 C     t  }| j|d< | j|d< |S )NissuerOriginr[   )rT   rZ   r[   rU   r   r   r   r   [      

zTrustTokens.to_jsonc                 C  s   | t |d t|d dS )Nr]   r[   )rZ   r[   )r   rQ   r   r   r   r   r   a      

zTrustTokens.from_jsonNrV   r   r   r   r   rY   Q   s   
 rY   c                   @  s<   e 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 )InterestGroupAccessTypez.
    Enum of interest group access types.
    joinleaveupdateloadedbidwinc                 C  r;   r   r<   r   r   r   r   r   t   r>   zInterestGroupAccessType.to_jsonc                 C  r   r   r   r   r   r   r   r   w   r   z!InterestGroupAccessType.from_jsonN)r&   r'   r(   r?   JOINLEAVEUPDATELOADEDBIDWINr   r)   r   r   r   r   r   r`   i   s    r`   c                   @  s:   e Zd ZU dZded< dZded< dd Zed	d
 ZdS )InterestGroupAdz:
    Ad advertising element inside an interest group.
    r   
render_urlNtyping.Optional[str]metadatac                 C  s(   t  }| j|d< | jd ur| j|d< |S )N	renderUrlrp   )rT   rn   rp   rU   r   r   r   r      s
   


zInterestGroupAd.to_jsonc                 C  s,   | t |d d|v rt |d dS d dS )Nrq   rp   )rn   rp   r   r   r   r   r   r      s   
zInterestGroupAd.from_json)	r&   r'   r(   r?   rW   rp   r   r)   r   r   r   r   r   rm   |   s   
 rm   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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 )InterestGroupDetailsz0
    The full details of an interest group.
    r   owner_originnamenetwork.TimeSinceEpochexpiration_timejoining_origintyping.List[str]trusted_bidding_signals_keysztyping.List[InterestGroupAd]adsad_componentsNro   bidding_urlbidding_wasm_helper_url
update_urltrusted_bidding_signals_urluser_bidding_signalsc                 C  s   t  }| j|d< | j|d< | j |d< | j|d< dd | jD |d< dd | jD |d	< d
d | jD |d< | j	d urA| j	|d< | j
d urK| j
|d< | jd urU| j|d< | jd ur_| j|d< | jd uri| j|d< |S )NownerOriginru   expirationTimejoiningOriginc                 S     g | ]}|qS r   r   .0ir   r   r   
<listcomp>       z0InterestGroupDetails.to_json.<locals>.<listcomp>trustedBiddingSignalsKeysc                 S     g | ]}|  qS r   r   r   r   r   r   r          r{   c                 S  r   r   r   r   r   r   r   r      r   adComponents
biddingUrlbiddingWasmHelperUrl	updateUrltrustedBiddingSignalsUrluserBiddingSignals)rT   rt   ru   rw   r   rx   rz   r{   r|   r}   r~   r   r   r   rU   r   r   r   r      s&   












zInterestGroupDetails.to_jsonc                 C  s   | t |d t |d tj|d t |d dd |d D dd |d	 D d
d |d D d|v r9t |d nd d|v rDt |d nd d|v rOt |d nd d|v rZt |d nd d|v rgt |d dS d dS )Nr   ru   r   r   c                 S     g | ]}t |qS r   rr   r   r   r   r   r      r   z2InterestGroupDetails.from_json.<locals>.<listcomp>r   c                 S     g | ]}t |qS r   rm   r   r   r   r   r   r          r{   c                 S  r   r   r   r   r   r   r   r      r   r   r   r   r   r   r   )rt   ru   rw   rx   rz   r{   r|   r}   r~   r   r   r   )r   r   TimeSinceEpochr   r   r   r   r   r      s    


zInterestGroupDetails.from_json)r&   r'   r(   r?   rW   r}   r~   r   r   r   r   r)   r   r   r   r   r   rs      s"   
 rs   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
ZdZdZdZdZdZdZdZdd Zedd ZdS )SharedStorageAccessTypez.
    Enum of shared storage access types.
    documentAddModuledocumentSelectURLdocumentRundocumentSetdocumentAppenddocumentDeletedocumentClear
workletSetworkletAppendworkletDeleteworkletClear
workletGetworkletKeysworkletEntriesworkletLengthworkletRemainingBudgetc                 C  r;   r   r<   r   r   r   r   r      r>   zSharedStorageAccessType.to_jsonc                 C  r   r   r   r   r   r   r   r      r   z!SharedStorageAccessType.from_jsonN)r&   r'   r(   r?   DOCUMENT_ADD_MODULEDOCUMENT_SELECT_URLDOCUMENT_RUNDOCUMENT_SETDOCUMENT_APPENDDOCUMENT_DELETEDOCUMENT_CLEARWORKLET_SETWORKLET_APPENDWORKLET_DELETEWORKLET_CLEARWORKLET_GETWORKLET_KEYSWORKLET_ENTRIESWORKLET_LENGTHWORKLET_REMAINING_BUDGETr   r)   r   r   r   r   r   r      s*    r   c                   @  6   e Zd ZU dZded< ded< dd Zedd Zd	S )
SharedStorageEntryzK
    Struct for a single key-value pair in an origin's shared storage.
    r   keyr=   c                 C  r\   Nr   r=   )rT   r   r=   rU   r   r   r   r      r^   zSharedStorageEntry.to_jsonc                 C     | t |d t |d dS Nr   r=   )r   r=   rr   r   r   r   r   r     r_   zSharedStorageEntry.from_jsonNrV   r   r   r   r   r         
 r   c                   @  s>   e Zd ZU dZded< ded< ded< dd	 Zed
d ZdS )SharedStorageMetadataz1
    Details for an origin's shared storage.
    rv   creation_timeintlengthrQ   remaining_budgetc                 C  s,   t  }| j |d< | j|d< | j|d< |S )NcreationTimer   remainingBudget)rT   r   r   r   r   rU   r   r   r   r     
   

zSharedStorageMetadata.to_jsonc                 C  s*   | t j|d t|d t|d dS )Nr   r   r   )r   r   r   )r   r   r   r   rQ   r   r   r   r   r     s
   

zSharedStorageMetadata.from_jsonNrV   r   r   r   r   r     s   
 r   c                   @  r   )
SharedStorageReportingMetadatazU
    Pair of reporting metadata details for a candidate URL for ``selectURL()``.
    r   
event_typereporting_urlc                 C  r\   )N	eventTypereportingUrl)rT   r   r   rU   r   r   r   r   0  r^   z&SharedStorageReportingMetadata.to_jsonc                 C  r   )Nr   r   )r   r   rr   r   r   r   r   r   6  r_   z(SharedStorageReportingMetadata.from_jsonNrV   r   r   r   r   r   '  r   r   c                   @  rN   )SharedStorageUrlWithMetadataz>
    Bundles a candidate URL with its reporting metadata.
    r   urlz+typing.List[SharedStorageReportingMetadata]reporting_metadatac                 C  (   t  }| j|d< dd | jD |d< |S )Nr   c                 S  r   r   r   r   r   r   r   r   L  r   z8SharedStorageUrlWithMetadata.to_json.<locals>.<listcomp>reportingMetadata)rT   r   r   rU   r   r   r   r   I     
z$SharedStorageUrlWithMetadata.to_jsonc                 C  "   | t |d dd |d D dS )Nr   c                 S  r   r   )r   r   r   r   r   r   r   S  r   z:SharedStorageUrlWithMetadata.from_json.<locals>.<listcomp>r   )r   r   rr   r   r   r   r   r   O     
z&SharedStorageUrlWithMetadata.from_jsonNrV   r   r   r   r   r   >  rX   r   c                   @  sz   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d Zedd ZdS )SharedStorageAccessParamsz
    Bundles the parameters for shared storage access events whose
    presence/absence can vary according to SharedStorageAccessType.
    Nro   script_source_urloperation_nameserialized_dataz:typing.Optional[typing.List[SharedStorageUrlWithMetadata]]urls_with_metadatar   r=   typing.Optional[bool]ignore_if_presentc                 C  s   t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< | jd ur0dd | jD |d< | jd ur:| j|d< | jd urD| j|d< | jd urN| j|d	< |S )
NscriptSourceUrloperationNameserializedDatac                 S  r   r   r   r   r   r   r   r     r   z5SharedStorageAccessParams.to_json.<locals>.<listcomp>urlsWithMetadatar   r=   ignoreIfPresent)rT   r   r   r   r   r   r=   r   rU   r   r   r   r     s    












z!SharedStorageAccessParams.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/dd |d D nd d|v r:t |d nd d|v rEt |d nd d	|v rRt|d	 d
S d d
S )Nr   r   r   r   c                 S  r   r   )r   r   r   r   r   r   r     r   z7SharedStorageAccessParams.from_json.<locals>.<listcomp>r   r=   r   )r   r   r   r   r   r=   r   )r   boolr   r   r   r   r     s   z#SharedStorageAccessParams.from_json)r&   r'   r(   r?   r   rW   r   r   r   r   r=   r   r   r)   r   r   r   r   r   r   W  s   
 
r   c                   @  (   e Zd ZdZdZdd Zedd ZdS )StorageBucketsDurabilityrelaxedstrictc                 C  r;   r   r<   r   r   r   r   r     r>   z StorageBucketsDurability.to_jsonc                 C  r   r   r   r   r   r   r   r     r   z"StorageBucketsDurability.from_jsonN)r&   r'   r(   RELAXEDSTRICTr   r)   r   r   r   r   r   r         r   c                   @  s6   e Zd ZU ded< dZded< dd Zedd	 ZdS )
StorageBucketr   storage_keyNro   ru   c                 C  s,   t  }| j |d< | jd ur| j|d< |S )N
storageKeyru   )rT   r   r   ru   rU   r   r   r   r     r   zStorageBucket.to_jsonc                 C  s.   | t |d d|v rt|d dS d dS )Nr   ru   )r   ru   )r   r   r   r   r   r   r   r     s   zStorageBucket.from_json)r&   r'   r(   rW   ru   r   r)   r   r   r   r   r   r     s   
 r   c                   @  sR   e Zd ZU 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 )StorageBucketInfor   bucketr   id_rv   
expirationrQ   quotar   
persistentr   
durabilityc                 C  sR   t  }| j |d< | j|d< | j |d< | j|d< | j|d< | j |d< |S )Nr   idr   r   r   r   )rT   r   r   r   r   r   r   r   rU   r   r   r   r     s   


zStorageBucketInfo.to_jsonc              
   C  sL   | t |d t|d tj|d t|d t|d t|d dS )Nr   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   r   rQ   r   r   r   r   r   r   r     s   


zStorageBucketInfo.from_jsonNr&   r'   r(   rW   r   r)   r   r   r   r   r   r     s   
 
r   c                   @  r   )AttributionReportingSourceType
navigationeventc                 C  r;   r   r<   r   r   r   r   r     r>   z&AttributionReportingSourceType.to_jsonc                 C  r   r   r   r   r   r   r   r     r   z(AttributionReportingSourceType.from_jsonN)r&   r'   r(   
NAVIGATIONEVENTr   r)   r   r   r   r   r   r     r   r   c                      r
   )UnsignedInt64AsBase10r   r   c                 C  r   r   r   r   r   r   r   r     r   zUnsignedInt64AsBase10.to_jsonr   c                 C  r   r   r   r   r   r   r   r     r   zUnsignedInt64AsBase10.from_jsonc                   r   )NzUnsignedInt64AsBase10({})r   r   r!   r   r   r      r#   zUnsignedInt64AsBase10.__repr__r$   )r   r   r   r   r%   r   r   r!   r   r     r+   r   c                      r
   )UnsignedInt128AsBase16r   r   c                 C  r   r   r   r   r   r   r   r     r   zUnsignedInt128AsBase16.to_jsonr   c                 C  r   r   r   r   r   r   r   r     r   z UnsignedInt128AsBase16.from_jsonc                   r   )NzUnsignedInt128AsBase16({})r   r   r!   r   r   r      r#   zUnsignedInt128AsBase16.__repr__r$   )r   r   r   r   r%   r   r   r!   r   r     r+   r   c                      r
   )SignedInt64AsBase10r   r   c                 C  r   r   r   r   r   r   r   r     r   zSignedInt64AsBase10.to_jsonr   c                 C  r   r   r   r   r   r   r   r     r   zSignedInt64AsBase10.from_jsonc                   r   )NzSignedInt64AsBase10({})r   r   r!   r   r   r      r#   zSignedInt64AsBase10.__repr__r$   )r   r   r   r   r%   r   r   r!   r   r     r+   r   c                   @  2   e Zd ZU ded< ded< dd Zedd Zd	S )
#AttributionReportingFilterDataEntryr   r   ry   valuesc                 C  r   )Nr   c                 S  r   r   r   r   r   r   r   r   $  r   z?AttributionReportingFilterDataEntry.to_json.<locals>.<listcomp>r  )rT   r   r  rU   r   r   r   r   !  r   z+AttributionReportingFilterDataEntry.to_jsonc                 C  r   )Nr   c                 S  r   r   rr   r   r   r   r   r   +  r   zAAttributionReportingFilterDataEntry.from_json.<locals>.<listcomp>r  )r   r  rr   r   r   r   r   r   '  r   z-AttributionReportingFilterDataEntry.from_jsonNr   r   r   r   r   r        
 r   c                   @  r   )
(AttributionReportingAggregationKeysEntryr   r   r   r=   c                 C  s"   t  }| j|d< | j |d< |S r   )rT   r   r=   r   rU   r   r   r   r   5  s   
z0AttributionReportingAggregationKeysEntry.to_jsonc                 C  s   | t |d t|d dS r   )r   r   r   r   r   r   r   r   ;  s   
z2AttributionReportingAggregationKeysEntry.from_jsonNr   r   r   r   r   r  /  r  r  c                   @  r   )
&AttributionReportingEventReportWindowsr   startztyping.List[int]endsc                 C  r   )Nr  c                 S  r   r   r   r   r   r   r   r   N  r   zBAttributionReportingEventReportWindows.to_json.<locals>.<listcomp>r  )rT   r  r  rU   r   r   r   r   K  r   z.AttributionReportingEventReportWindows.to_jsonc                 C  r   )Nr  c                 S  r   r   r   r   r   r   r   r   U  r   zDAttributionReportingEventReportWindows.from_json.<locals>.<listcomp>r  )r  r  r  r   r   r   r   r   Q  r   z0AttributionReportingEventReportWindows.from_jsonNr   r   r   r   r   r  C  s   
 r  c                   @  s   e Zd ZU 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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 )&AttributionReportingSourceRegistrationrv   timer   type_r   source_originreporting_originry   destination_sitesr   event_idr   priorityz0typing.List[AttributionReportingFilterDataEntry]filter_dataz5typing.List[AttributionReportingAggregationKeysEntry]aggregation_keysNztyping.Optional[int]expiryevent_report_windowz7typing.Optional[AttributionReportingEventReportWindows]event_report_windowsaggregatable_report_windowz&typing.Optional[UnsignedInt64AsBase10]	debug_keyc                 C  s   t  }| j |d< | j |d< | j|d< | j|d< dd | jD |d< | j |d< | j |d	< d
d | j	D |d< dd | j
D |d< | jd urQ| j|d< | jd ur[| j|d< | jd urg| j |d< | jd urq| j|d< | jd ur}| j |d< |S )Nr	  typesourceOriginreportingOriginc                 S  r   r   r   r   r   r   r   r     r   zBAttributionReportingSourceRegistration.to_json.<locals>.<listcomp>destinationSiteseventIdr  c                 S  r   r   r   r   r   r   r   r     r   
filterDatac                 S  r   r   r   r   r   r   r   r     r   aggregationKeysr  eventReportWindoweventReportWindowsaggregatableReportWindowdebugKey)rT   r	  r   r
  r  r  r  r  r  r  r  r  r  r  r  r  rU   r   r   r   r   {  s*   









z.AttributionReportingSourceRegistration.to_jsonc                 C  s   | t j|d t|d t|d t|d dd |d D t|d t|d	 d
d |d D dd |d D d|v rFt|d nd d|v rQt|d nd d|v r]t|d nd d|v rht|d nd d|v rvt|d dS d dS )Nr	  r  r  r  c                 S  r   r   rr   r   r   r   r   r     r   zDAttributionReportingSourceRegistration.from_json.<locals>.<listcomp>r  r  r  c                 S  r   r   )r   r   r   r   r   r   r     r   r  c                 S  r   r   )r  r   r   r   r   r   r     r   r  r  r  r  r   r!  )r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  )	r   r   r   r   r   r   r   r   r  r   r   r   r   r     s$   

z0AttributionReportingSourceRegistration.from_json)r&   r'   r(   rW   r  r  r  r  r  r   r)   r   r   r   r   r   r  Y  s$   
 r  c                   @  sP   e Zd ZdZd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 ),AttributionReportingSourceRegistrationResultsuccessinternalErrorinsufficientSourceCapacity%insufficientUniqueDestinationCapacityexcessiveReportingOriginsprohibitedByBrowserPolicysuccessNoised destinationReportingLimitReacheddestinationGlobalLimitReacheddestinationBothLimitsReached#reportingOriginsPerSiteLimitReachedexceedsMaxChannelCapacityc                 C  r;   r   r<   r   r   r   r   r     r>   z4AttributionReportingSourceRegistrationResult.to_jsonc                 C  r   r   r   r   r   r   r   r     r   z6AttributionReportingSourceRegistrationResult.from_jsonN)r&   r'   r(   SUCCESSINTERNAL_ERRORINSUFFICIENT_SOURCE_CAPACITY(INSUFFICIENT_UNIQUE_DESTINATION_CAPACITYEXCESSIVE_REPORTING_ORIGINSPROHIBITED_BY_BROWSER_POLICYSUCCESS_NOISED#DESTINATION_REPORTING_LIMIT_REACHED DESTINATION_GLOBAL_LIMIT_REACHEDDESTINATION_BOTH_LIMITS_REACHED(REPORTING_ORIGINS_PER_SITE_LIMIT_REACHEDEXCEEDS_MAX_CHANNEL_CAPACITYr   r)   r   r   r   r   r   r"    s     r"  frame_idpage.FrameIdr   @typing.Generator[T_JSON_DICT, T_JSON_DICT, SerializedStorageKey]c                 c  s2    t  }|  |d< d|d}|V }t|d S )zV
    Returns a storage key given a frame id.

    :param frame_id:
    :returns: 
    frameIdzStorage.getStorageKeyForFramemethodparamsr   )rT   r   r   r   )r;  rA  cmd_dictr   r   r   r   get_storage_key_for_frame  s   	rC  originr   storage_types0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                 c  ,    t  }| |d< ||d< d|d}|V }dS )z
    Clears storage for origin.

    :param origin: Security origin.
    :param storage_types: Comma separated list of StorageType to clear.
    rD  storageTypeszStorage.clearDataForOriginr?  NrT   )rD  rE  rA  rB  r   r   r   r   clear_data_for_origin     

rJ  r   c                 c  rG  )z
    Clears storage for storage key.

    :param storage_key: Storage key.
    :param storage_types: Comma separated list of StorageType to clear.
    r   rH  zStorage.clearDataForStorageKeyr?  NrI  )r   rE  rA  rB  r   r   r   r   clear_data_for_storage_key  rK  rL  browser_context_id)typing.Optional[browser.BrowserContextID]Gtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[network.Cookie]]c                 c  s>    t  }| dur|  |d< d|d}|V }dd |d D S )z
    Returns all browser cookies.

    :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
    :returns: Array of cookie objects.
    NbrowserContextIdzStorage.getCookiesr?  c                 S  s   g | ]}t j|qS r   )r   Cookier   r   r   r   r   r     s    zget_cookies.<locals>.<listcomp>r.   rT   r   rM  rA  rB  r   r   r   r   get_cookies  s   	rT  r.    typing.List[network.CookieParam]c                 c  sB    t  }dd | D |d< |dur| |d< d|d}|V }dS )z
    Sets given cookies.

    :param cookies: Cookies to be set.
    :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
    c                 S  r   r   r   r   r   r   r   r     r   zset_cookies.<locals>.<listcomp>r.   NrP  zStorage.setCookiesr?  rR  )r.   rM  rA  rB  r   r   r   r   set_cookies  s   

rV  c                 c  s0    t  }| dur|  |d< d|d}|V }dS )z
    Clears cookies.

    :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
    NrP  zStorage.clearCookiesr?  rR  rS  r   r   r   clear_cookies   s   
rW  gtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[float, float, bool, typing.List[UsageForType]]]c                 c  sR    t  }| |d< d|d}|V }t|d t|d t|d dd |d	 D fS )
a|  
    Returns usage and quota in bytes.

    :param origin: Security origin.
    :returns: A tuple with the following items:

        0. **usage** - Storage usage (bytes).
        1. **quota** - Storage quota (bytes).
        2. **overrideActive** - Whether or not the origin has an active storage quota override
        3. **usageBreakdown** - Storage usage per type (bytes).
    rD  zStorage.getUsageAndQuotar?  rR   r   overrideActivec                 S  r   r   )rO   r   r   r   r   r   r   K  r   z'get_usage_and_quota.<locals>.<listcomp>usageBreakdown)rT   rQ   r   rD  rA  rB  r   r   r   r   get_usage_and_quota2  s   


r\  
quota_sizetyping.Optional[float]c                 c  s4    t  }| |d< |dur||d< d|d}|V }dS )aV  
    Override quota for the specified origin

    **EXPERIMENTAL**

    :param origin: Security origin.
    :param quota_size: *(Optional)* The quota size (in bytes) to override the original quota with. If this is called multiple times, the overridden quota will be equal to the quotaSize provided in the final call. If this is called without specifying a quotaSize, the quota will be reset to the default value for the specified origin. If this is called multiple times with different origins, the override will be maintained for each origin until it is disabled (called without a quotaSize).
    rD  N	quotaSizezStorage.overrideQuotaForOriginr?  rI  )rD  r]  rA  rB  r   r   r   r   override_quota_for_originO  s   
r`  c                 c  $    t  }| |d< d|d}|V }dS )z
    Registers origin to be notified when an update occurs to its cache storage list.

    :param origin: Security origin.
    rD  z"Storage.trackCacheStorageForOriginr?  NrI  r[  r   r   r   track_cache_storage_for_originf     
rb  c                 c  ra  )z
    Registers storage key to be notified when an update occurs to its cache storage list.

    :param storage_key: Storage key.
    r   z&Storage.trackCacheStorageForStorageKeyr?  NrI  r   rA  rB  r   r   r   r   #track_cache_storage_for_storage_keyw  rc  re  c                 c  ra  )zv
    Registers origin to be notified when an update occurs to its IndexedDB.

    :param origin: Security origin.
    rD  zStorage.trackIndexedDBForOriginr?  NrI  r[  r   r   r   track_indexed_db_for_origin  rc  rf  c                 c  ra  )z|
    Registers storage key to be notified when an update occurs to its IndexedDB.

    :param storage_key: Storage key.
    r   z#Storage.trackIndexedDBForStorageKeyr?  NrI  rd  r   r   r    track_indexed_db_for_storage_key  rc  rg  c                 c  ra  )zq
    Unregisters origin from receiving notifications for cache storage.

    :param origin: Security origin.
    rD  z$Storage.untrackCacheStorageForOriginr?  NrI  r[  r   r   r    untrack_cache_storage_for_origin  rc  rh  c                 c  ra  )zw
    Unregisters storage key from receiving notifications for cache storage.

    :param storage_key: Storage key.
    r   z(Storage.untrackCacheStorageForStorageKeyr?  NrI  rd  r   r   r   %untrack_cache_storage_for_storage_key  rc  ri  c                 c  ra  )zm
    Unregisters origin from receiving notifications for IndexedDB.

    :param origin: Security origin.
    rD  z!Storage.untrackIndexedDBForOriginr?  NrI  r[  r   r   r   untrack_indexed_db_for_origin  rc  rj  c                 c  ra  )zs
    Unregisters storage key from receiving notifications for IndexedDB.

    :param storage_key: Storage key.
    r   z%Storage.untrackIndexedDBForStorageKeyr?  NrI  rd  r   r   r   "untrack_indexed_db_for_storage_key  rc  rk  Dtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[TrustTokens]]c                  c  "    ddi} | V }dd |d D S )z
    Returns the number of stored Trust Tokens per issuer for the
    current browsing context.

    **EXPERIMENTAL**

    :returns: 
    r@  zStorage.getTrustTokensc                 S  r   r   )rY   r   r   r   r   r   r     r   z$get_trust_tokens.<locals>.<listcomp>tokensr   rB  r   r   r   r   get_trust_tokens  s
   
rp  rZ   0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c                 c  s,    t  }| |d< d|d}|V }t|d S )a	  
    Removes all Trust Tokens issued by the provided issuerOrigin.
    Leaves other stored data, including the issuer's Redemption Records, intact.

    **EXPERIMENTAL**

    :param issuer_origin:
    :returns: True if any tokens were deleted, false otherwise.
    r]   zStorage.clearTrustTokensr?  didDeleteTokens)rT   r   )rZ   rA  rB  r   r   r   r   clear_trust_tokens  s   rs  rt   ru   @typing.Generator[T_JSON_DICT, T_JSON_DICT, InterestGroupDetails]c                 c  s6    t  }| |d< ||d< d|d}|V }t|d S )z
    Gets details for a named interest group.

    **EXPERIMENTAL**

    :param owner_origin:
    :param name:
    :returns: 
    r   ru   zStorage.getInterestGroupDetailsr?  details)rT   rs   r   )rt   ru   rA  rB  r   r   r   r   get_interest_group_details  s   rv  enabler   c                 c  ra  )zm
    Enables/Disables issuing of interestGroupAccessed events.

    **EXPERIMENTAL**

    :param enable:
    rw  z Storage.setInterestGroupTrackingr?  NrI  rw  rA  rB  r   r   r   r   set_interest_group_tracking,     

ry  Atyping.Generator[T_JSON_DICT, T_JSON_DICT, SharedStorageMetadata]c                 c  s.    t  }| |d< d|d}|V }t|d S )zv
    Gets metadata for an origin's shared storage.

    **EXPERIMENTAL**

    :param owner_origin:
    :returns: 
    r   z Storage.getSharedStorageMetadatar?  rp   )rT   r   r   rt   rA  rB  r   r   r   r   get_shared_storage_metadata?  s   r}  Ktyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[SharedStorageEntry]]c                 c  s2    t  }| |d< d|d}|V }dd |d D S )z~
    Gets the entries in an given origin's shared storage.

    **EXPERIMENTAL**

    :param owner_origin:
    :returns: 
    r   zStorage.getSharedStorageEntriesr?  c                 S  r   r   )r   r   r   r   r   r   r   f  r   z.get_shared_storage_entries.<locals>.<listcomp>entriesrI  r|  r   r   r   get_shared_storage_entriesT  s   r  r   r=   r   r   c                 c  sD    t  }| |d< ||d< ||d< |dur||d< d|d}|V }dS )a?  
    Sets entry with ``key`` and ``value`` for a given origin's shared storage.

    **EXPERIMENTAL**

    :param owner_origin:
    :param key:
    :param value:
    :param ignore_if_present: *(Optional)* If ```ignoreIfPresent```` is included and true, then only sets the entry if ````key``` doesn't already exist.
    r   r   r=   Nr   zStorage.setSharedStorageEntryr?  rI  )rt   r   r=   r   rA  rB  r   r   r   r   set_shared_storage_entryi  s   
r  c                 c  rG  )z
    Deletes entry for ``key`` (if it exists) for a given origin's shared storage.

    **EXPERIMENTAL**

    :param owner_origin:
    :param key:
    r   r   z Storage.deleteSharedStorageEntryr?  NrI  )rt   r   rA  rB  r   r   r   r   delete_shared_storage_entry     
r  c                 c  ra  )zq
    Clears all entries for a given origin's shared storage.

    **EXPERIMENTAL**

    :param owner_origin:
    r   z!Storage.clearSharedStorageEntriesr?  NrI  r|  r   r   r   clear_shared_storage_entries  rz  r  c                 c  ra  )z
    Resets the budget for ``ownerOrigin`` by clearing all budget withdrawals.

    **EXPERIMENTAL**

    :param owner_origin:
    r   z Storage.resetSharedStorageBudgetr?  NrI  r|  r   r   r   reset_shared_storage_budget  rz  r  c                 c  ra  )zm
    Enables/disables issuing of sharedStorageAccessed events.

    **EXPERIMENTAL**

    :param enable:
    rw  z Storage.setSharedStorageTrackingr?  NrI  rx  r   r   r   set_shared_storage_tracking  rz  r  c                 c  rG  )zu
    Set tracking for a storage key's buckets.

    **EXPERIMENTAL**

    :param storage_key:
    :param enable:
    r   rw  z Storage.setStorageBucketTrackingr?  NrI  )r   rw  rA  rB  r   r   r   r   set_storage_bucket_tracking  r  r  r   c                 c  s(    t  }|  |d< d|d}|V }dS )zz
    Deletes the Storage Bucket with the given storage key and bucket name.

    **EXPERIMENTAL**

    :param bucket:
    r   zStorage.deleteStorageBucketr?  NrR  )r   rA  rB  r   r   r   r   delete_storage_bucket  s   

r  <typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[str]]c                  c  rm  )z}
    Deletes state for sites identified as potential bounce trackers, immediately.

    **EXPERIMENTAL**

    :returns: 
    r@  z$Storage.runBounceTrackingMitigationsc                 S  r   r   rr   r   r   r   r   r   
  r   z3run_bounce_tracking_mitigations.<locals>.<listcomp>deletedSitesr   ro  r   r   r   run_bounce_tracking_mitigations  s
   	r  enabledc                 c  ra  )z
    https://wicg.github.io/attribution-reporting-api/

    **EXPERIMENTAL**

    :param enabled: If enabled, noise is suppressed and reports are sent immediately.
    r  z/Storage.setAttributionReportingLocalTestingModer?  NrI  )r  rA  rB  r   r   r   r   ,set_attribution_reporting_local_testing_mode  rz  r  c                 c  ra  )zm
    Enables/disables issuing of Attribution Reporting events.

    **EXPERIMENTAL**

    :param enable:
    rw  z'Storage.setAttributionReportingTrackingr?  NrI  rx  r   r   r   "set_attribution_reporting_tracking   rz  r  z"Storage.cacheStorageContentUpdatedc                   @  s@   e Zd ZU dZded< ded< ded< ded< edd
dZdS )CacheStorageContentUpdatedz0
    A cache's contents have been modified.
    r   rD  r   	bucket_id
cache_namer   r   r   c                 C  s0   | t |d t |d t |d t |d dS )NrD  r   bucketId	cacheName)rD  r   r  r  rr   r   r   r   r   r   B  s   



z$CacheStorageContentUpdated.from_jsonN)r   r   r   r  r&   r'   r(   r?   rW   r)   r   r   r   r   r   r  3  s   
 r  zStorage.cacheStorageListUpdatedc                   @  8   e Zd ZU dZded< ded< ded< edd	d
ZdS )CacheStorageListUpdatedz)
    A cache has been added/deleted.
    r   rD  r   r  r   r   r   c                 C  &   | t |d t |d t |d dS NrD  r   r  )rD  r   r  rr   r   r   r   r   r   Y  
   


z!CacheStorageListUpdated.from_jsonN)r   r   r   r  r  r   r   r   r   r  L     
 r  zStorage.indexedDBContentUpdatedc                   @  sH   e Zd ZU dZded< ded< ded< ded< ded< edddZdS )IndexedDBContentUpdatedz@
    The origin's IndexedDB object store has been modified.
    r   rD  r   r  database_nameobject_store_namer   r   r   c                 C  s:   | t |d t |d t |d t |d t |d dS )NrD  r   r  databaseNameobjectStoreName)rD  r   r  r  r  rr   r   r   r   r   r   s  s   




z!IndexedDBContentUpdated.from_jsonN)r   r   r   r  r  r   r   r   r   r  b  s   
 r  zStorage.indexedDBListUpdatedc                   @  r  )IndexedDBListUpdatedzA
    The origin's IndexedDB database list has been modified.
    r   rD  r   r  r   r   r   c                 C  r  r  rr   r   r   r   r   r     r  zIndexedDBListUpdated.from_jsonN)r   r   r   r  r  r   r   r   r   r  ~  r  r  zStorage.interestGroupAccessedc                   @  s@   e Zd ZU dZded< ded< ded< ded< edddZdS )InterestGroupAccessedzI
    One of the interest groups was accessed by the associated page.
    rv   access_timer`   r
  r   rt   ru   r   r   r   c                 C  s6   | t j|d t|d t|d t|d dS )N
accessTimer  r   ru   )r  r
  rt   ru   )r   r   r   r`   r   r   r   r   r   r     s   

zInterestGroupAccessed.from_jsonN)r   r   r   r  r  r   r   r   r   r    s   
 r  zStorage.sharedStorageAccessedc                   @  sH   e Zd ZU dZded< ded< ded< ded	< d
ed< edddZdS )SharedStorageAccessedzv
    Shared storage was accessed by the associated page.
    The following parameters are included in all events.
    rv   r  r   r
  r<  main_frame_idr   rt   r   rA  r   r   r   c              	   C  sF   | t j|d t|d tj|d t|d t|d dS )Nr  r  mainFrameIdr   rA  )r  r
  r  rt   rA  )r   r   r   r   r	   FrameIdr   r   r   r   r   r   r     s   
zSharedStorageAccessed.from_jsonN)r   r   r   r  r  r   r   r   r   r    s   
 r  z%Storage.storageBucketCreatedOrUpdatedc                   @  $   e Zd ZU ded< ed	ddZdS )
StorageBucketCreatedOrUpdatedr   bucket_infor   r   r   c                 C  s   | t |d dS )N
bucketInfo)r  )r   r   r   r   r   r   r     s   z'StorageBucketCreatedOrUpdated.from_jsonN)r   r   r   r  r&   r'   r(   rW   r)   r   r   r   r   r   r       
 r  zStorage.storageBucketDeletedc                   @  r  )
StorageBucketDeletedr   r  r   r   r   c                 C  s   | t |d dS )Nr  )r  rr   r   r   r   r   r     s   
zStorageBucketDeleted.from_jsonN)r   r   r   r  r  r   r   r   r   r    r  r  z,Storage.attributionReportingSourceRegisteredc                   @  s0   e Zd ZU dZded< ded< edd	d
ZdS )$AttributionReportingSourceRegisteredz
    **EXPERIMENTAL**

    TODO(crbug.com/1458532): Add other Attribution Reporting events, e.g.
    trigger registration.
    r  registrationr"  resultr   r   r   c                 C  s    | t |d t|d dS )Nr  r  )r  r  )r  r   r"  r   r   r   r   r     s   z.AttributionReportingSourceRegistered.from_jsonN)r   r   r   r  r  r   r   r   r   r    s   
 r  )r;  r<  r   r=  )rD  r   rE  r   r   rF  )r   r   rE  r   r   rF  r   )rM  rN  r   rO  )r.   rU  rM  rN  r   rF  )rM  rN  r   rF  )rD  r   r   rX  )rD  r   r]  r^  r   rF  )rD  r   r   rF  )r   r   r   rF  )r   rl  )rZ   r   r   rq  )rt   r   ru   r   r   rt  )rw  r   r   rF  )rt   r   r   r{  )rt   r   r   r~  )
rt   r   r   r   r=   r   r   r   r   rF  )rt   r   r   r   r   rF  )rt   r   r   rF  )r   r   rw  r   r   rF  )r   r   r   rF  )r   r  )r  r   r   rF  )Q
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r   r   Enumr,   rO   rY   r`   rm   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r"  rC  rJ  rL  rT  rV  rW  r\  r`  rb  re  rf  rg  rh  ri  rj  rk  rp  rs  rv  ry  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   CL$L




























