
    ,i                     X    d dl mZ d dlmZ  G d d      Z G d d      Z G d d      Zy	)
    )Optionalcommand_builderc                   &    e Zd ZdZdZdZdZeeehZy)UserPromptHandlerTypez3Represents the behavior of the user prompt handler.acceptdismissignoreN)__name__
__module____qualname____doc__ACCEPTDISMISSIGNOREVALID_TYPES     u/var/www/system.tvplus.app.br/jogos/scrap/venv/lib/python3.12/site-packages/selenium/webdriver/common/bidi/session.pyr   r      s     =FGF7F+Kr   r   c                   x    e Zd ZdZ	 	 	 	 	 	 ddee   dee   dee   dee   dee   dee   fd	Zd
eeef   fdZy)UserPromptHandlerz8Represents the configuration of the user prompt handler.Nalertbefore_unloadconfirmdefaultfilepromptc           	          d|fd|fd|fd|fd|fd|ffD ]<  \  }}|	|t         j                  vst        d| d	| d
t         j                          || _        || _        || _        || _        || _        || _        y)a  Initialize UserPromptHandler.

        Parameters:
        -----------
            alert: Handler type for alert prompts
            before_unload: Handler type for beforeUnload prompts
            confirm: Handler type for confirm prompts
            default: Default handler type for all prompts
            file: Handler type for file picker prompts
            prompt: Handler type for prompt dialogs

        Raises:
        ------
            ValueError: If any handler type is not valid
        r   r   r   r   r   r   NzInvalid z handler type: z. Must be one of )	r   r   
ValueErrorr   r   r   r   r   r   )	selfr   r   r   r   r   r   
field_namevalues	            r   __init__zUserPromptHandler.__init__$   s    2 em,  TNv"
 	J  U2G2S2S%S zl/%@QRgRsRsQtu 	 
*	r   returnc                 t    ddddddd}i }|j                         D ]  \  }}t        | |      }||||<    |S )zConvert the UserPromptHandler to a dictionary for BiDi protocol.

        Returns:
        -------
            Dict[str, str]: Dictionary representation suitable for BiDi protocol
        r   beforeUnloadr   r   r   r   )r   r   r   r   r   r   )itemsgetattr)r    field_mappingresult	attr_namedict_keyr"   s         r   to_dictzUserPromptHandler.to_dictP   sd     +  
 #0#6#6#8 	)IxD),E #(x 	) r   )NNNNNN)	r   r   r   r   r   strr#   dictr-   r   r   r   r   r   !   s    B  $'+!%!%" $*}*  }* #	*
 #* sm* *Xc3h r   r   c                   0    e Zd Zd ZdddZdddZd Zy)Sessionc                     || _         y )N)conn)r    r3   s     r   r#   zSession.__init__i   s	    	r   N)browsing_contextsc                8    d|i}|g }|r||d<   t        d|      S )NeventsbrowsingContextszsession.subscriber   r    r4   r6   paramss       r   	subscribezSession.subscribel   s8    f
 $ "):F%&2F;;r   c                8    d|i}|g }|r||d<   t        d|      S )Nr6   r7   zsession.unsubscriber   r8   s       r   unsubscribezSession.unsubscribev   s8    f
 $ "):F%&4f==r   c                 P    t        di       }| j                  j                  |      S )a5  
        The session.status command returns information about the remote end's readiness
        to create new sessions and may include implementation-specific metadata.

        Returns
        -------
        dict
            Dictionary containing the ready state (bool), message (str) and metadata
        zsession.status)r   r3   execute)r    cmds     r   statuszSession.status   s&     .3yy  %%r   )r   r   r   r#   r:   r<   r@   r   r   r   r1   r1   h   s      48 < 6: >&r   r1   N)typingr   %selenium.webdriver.common.bidi.commonr   r   r   r1   r   r   r   <module>rC      s.   $  A, ,D DN#& #&r   