o
    ҷh                     @  s   d dl mZ ddlmZmZ d dlmZ d dlZd dlZG dd dej	Z
G dd	 d	ej	ZeG d
d dZ	d"d#ddZd$ddZd%ddZ	d"d&ddZd$ddZedeG d d! d!ZdS )'    )annotations   )event_classT_JSON_DICT)	dataclassNc                   @  ,   e Zd ZdZdZdZdd Zedd ZdS )	
LoginStatez
    Whether this is a sign-up or sign-in action for this account, i.e.
    whether this account has ever been used to sign in to this RP before.
    SignInSignUpc                 C     | j S Nvalueself r   a/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v117/fed_cm.pyto_json      zLoginState.to_jsonc                 C     | |S r   r   clsjsonr   r   r   	from_json      zLoginState.from_jsonN)	__name__
__module____qualname____doc__SIGN_INSIGN_UPr   classmethodr   r   r   r   r   r      s    r   c                   @  r   )	
DialogTypez]
    Whether the dialog shown is an account chooser or an auto re-authentication dialog.
    AccountChooserAutoReauthnc                 C  r   r   r   r   r   r   r   r   $   r   zDialogType.to_jsonc                 C  r   r   r   r   r   r   r   r   '   r   zDialogType.from_jsonN)	r   r   r   r   ACCOUNT_CHOOSERAUTO_REAUTHNr   r!   r   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Zded< dZded< dd Zedd Z	dS )Accountz/
    Corresponds to IdentityRequestAccount
    str
account_idemailname
given_namepicture_urlidp_config_urlidp_signin_urlr   login_stateNtyping.Optional[str]terms_of_service_urlprivacy_policy_urlc                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j	 |d< | j
d ur7| j
|d	< | jd urA| j|d
< |S )N	accountIdr*   r+   	givenName
pictureUrlidpConfigUrlidpSigninUrl
loginStatetermsOfServiceUrlprivacyPolicyUrl)dictr)   r*   r+   r,   r-   r.   r/   r0   r   r2   r3   )r   r   r   r   r   r   F   s   










zAccount.to_jsonc                 C  s   | t |d t |d t |d t |d t |d t |d t |d t|d d	|v r4t |d	 nd d
|v rAt |d
 d
S d d
S )Nr4   r*   r+   r5   r6   r7   r8   r9   r:   r;   )
r)   r*   r+   r,   r-   r.   r/   r0   r2   r3   )r(   r   r   r   r   r   r   r   V   s   







zAccount.from_json)
r   r   r   r   __annotations__r2   r3   r   r!   r   r   r   r   r   r'   ,   s   
 r'   disable_rejection_delaytyping.Optional[bool]return0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                 c  s,    t  }| dur| |d< d|d}|V }dS )z
    :param disable_rejection_delay: *(Optional)* Allows callers to disable the promise rejection delay that would normally happen, if this is unimportant to what's being tested. (step 4 of https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in)
    NdisableRejectionDelayzFedCm.enablemethodparamsr<   )r>   rE   cmd_dictr   r   r   r   enablef   s   
rH   c                  c  s    ddi} | V }d S )NrD   zFedCm.disabler   rG   r   r   r   r   disablev   s   
rJ   	dialog_idr(   account_indexintc                 c  s,    t  }| |d< ||d< d|d}|V }dS )z5
    :param dialog_id:
    :param account_index:
    dialogIdaccountIndexzFedCm.selectAccountrC   NrF   )rK   rL   rE   rG   r   r   r   r   select_account~   s   
rP   trigger_cooldownc                 c  s4    t  }| |d< |dur||d< d|d}|V }dS )zE
    :param dialog_id:
    :param trigger_cooldown: *(Optional)*
    rN   NtriggerCooldownzFedCm.dismissDialogrC   rF   )rK   rQ   rE   rG   r   r   r   r   dismiss_dialog   s   
rS   c                  c  s    ddi} | V }dS )z
    Resets the cooldown time, if any, to allow the next FedCM call to show
    a dialog even if one was recently dismissed by the user.
    rD   zFedCm.resetCooldownNr   rI   r   r   r   reset_cooldown   s   
rT   zFedCm.dialogShownc                   @  sD   e Zd ZU ded< ded< ded< ded< ded	< edddZdS )DialogShownr(   rK   r"   dialog_typeztyping.List[Account]accountstitler1   subtitler   r   r@   c                 C  sR   | t |d t|d dd |d D t |d d|v r%t |d dS d dS )	NrN   
dialogTypec                 S  s   g | ]}t |qS r   )r'   r   ).0ir   r   r   
<listcomp>   s    z)DialogShown.from_json.<locals>.<listcomp>rW   rX   rY   )rK   rV   rW   rX   rY   )r(   r"   r   r   r   r   r   r      s   

zDialogShown.from_jsonN)r   r   r@   rU   )r   r   r   r=   r!   r   r   r   r   r   rU      s   
 rU   r   )r>   r?   r@   rA   )r@   rA   )rK   r(   rL   rM   r@   rA   )rK   r(   rQ   r?   r@   rA   )
__future__r   utilr   r   dataclassesr   enumtypingEnumr   r"   r'   rH   rJ   rP   rS   rT   rU   r   r   r   r   <module>   s&   :


