
    ]h?2                        d dl mZmZmZmZ d dlmZ  G d d      Z G d d      Z G d d      Z	 G d	 d
      Z
 G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Zy)    )DictListOptionalUnion)command_builderc                       e Zd ZdZdZdZdZy)SameSitez5Represents the possible same site values for cookies.strictlaxnoneN)__name__
__module____qualname____doc__STRICTLAXNONE     /home/pod-website-builder.sw7ft.com/pod-website-builder/website-analyzer/venv/lib/python3.12/site-packages/selenium/webdriver/common/bidi/storage.pyr	   r	      s    ?F
CDr   r	   c                   4    e Zd ZdZdZdZdedefdZdefdZ	y	)

BytesValuezRepresents a bytes value.base64stringtypevaluec                      || _         || _        y Nr   r   )selfr   r   s      r   __init__zBytesValue.__init__%   s    	
r   returnc                 4    | j                   | j                  dS )zConverts the BytesValue to a dictionary.

        Returns:
        -------
            Dict: A dictionary representation of the BytesValue.
        r   r   r    s    r   to_dictzBytesValue.to_dict)   s     		DJJ77r   N)
r   r   r   r   TYPE_BASE64TYPE_STRINGstrr!   r   r%   r   r   r   r   r      s.    #KKS  8 8r   r   c                       e Zd ZdZ	 	 	 	 	 	 ddedededee   dee   dee   d	ee   d
ee   dee   fdZ	e
dedd fd       Zy)CookiezRepresents a cookie.Nnamer   domainpathsize	http_onlysecure	same_siteexpiryc
                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y r   	r+   r   r,   r-   r.   r/   r0   r1   r2   
r    r+   r   r,   r-   r.   r/   r0   r1   r2   s
             r   r!   zCookie.__init__6   C     	
		""r   datar"   c                    t        |j                  di       j                  d      |j                  di       j                  d            } | |j                  d      ||j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d	      |j                  d
      	      S )zCreates a Cookie instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the cookie information.

        Returns:
        -------
            Cookie: A new instance of Cookie.
        r   r   r+   r,   r-   r.   httpOnlyr0   sameSiter2   r4   )r   get)clsr7   r   s      r   	from_dictzCookie.from_dictL   s     488GR044V<dhhwPR>S>W>WX_>`a&!88H%&!&!hhz*88H%hhz*88H%

 
	
r   )NNNNNN)r   r   r   r   r(   r   r   intboolr!   classmethodr   r=   r   r   r   r*   r*   3   s     #"$(!%#' $  	
 sm sm D>  C= , 
T 
h 
 
r   r*   c                       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   d	ee   d
ee   dee   fdZ	de
fdZy)CookieFilterz Represents a filter for cookies.Nr+   r   r,   r-   r.   r/   r0   r1   r2   c
                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y r   r4   r5   s
             r   r!   zCookieFilter.__init__j   r6   r   r"   c                    i }| j                   | j                   |d<   | j                  | j                  j                         |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j
                  | j
                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d	<   |S )
zConverts the CookieFilter to a dictionary.

        Returns:
        -------
            Dict: A dictionary representation of the CookieFilter.
        r+   r   r,   r-   r.   r9   r0   r:   r2   )
r+   r   r%   r,   r-   r.   r/   r0   r1   r2   r    results     r   r%   zCookieFilter.to_dict   s     99 !YYF6N::!"jj002F7O;;"#{{F899 !YYF6N99 !YYF6N>>%!%F:;;"#{{F8>>%!%F:;;"#{{F8r   )	NNNNNNNNN)r   r   r   r   r   r(   r   r>   r?   r!   r   r%   r   r   r   rB   rB   g   s    * #&* $""$(!%#' $sm 
# 	
 sm sm D>  C= , r   rB   c                   H    e Zd ZdZd	dee   dee   fdZededd fd       Z	y)
PartitionKeyz#Represents a storage partition key.Nuser_contextsource_originc                      || _         || _        y r   rI   rJ   r    rI   rJ   s      r   r!   zPartitionKey.__init__   s    (*r   r7   r"   c                 R     | |j                  d      |j                  d            S )a	  Creates a PartitionKey instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the partition key information.

        Returns:
        -------
            PartitionKey: A new instance of PartitionKey.
        userContextsourceOriginrL   )r;   )r<   r7   s     r   r=   zPartitionKey.from_dict   s)     -0((>2
 	
r   NN)
r   r   r   r   r   r(   r!   r@   r   r=   r   r   r   rH   rH      sC    -+Xc] +(SV- + 
T 
n 
 
r   rH   c                   (    e Zd ZdZdefdZdefdZy)"BrowsingContextPartitionDescriptorz3Represents a browsing context partition descriptor.contextc                      d| _         || _        y )NrT   r   rT   )r    rT   s     r   r!   z+BrowsingContextPartitionDescriptor.__init__   s    	r   r"   c                 4    | j                   | j                  dS )zConverts the BrowsingContextPartitionDescriptor to a dictionary.

        Returns:
        -------
            Dict: A dictionary representation of the BrowsingContextPartitionDescriptor.
        rV   rV   r$   s    r   r%   z*BrowsingContextPartitionDescriptor.to_dict   s     		dll;;r   N)r   r   r   r   r(   r!   r   r%   r   r   r   rS   rS      s    = < <r   rS   c                   :    e Zd ZdZddee   dee   fdZdefdZy)	StorageKeyPartitionDescriptorz.Represents a storage key partition descriptor.NrI   rJ   c                 .    d| _         || _        || _        y )N
storageKeyr   rI   rJ   rM   s      r   r!   z&StorageKeyPartitionDescriptor.__init__   s     	(*r   r"   c                     d| j                   i}| j                  | j                  |d<   | j                  | j                  |d<   |S )zConverts the StorageKeyPartitionDescriptor to a dictionary.

        Returns:
        -------
            Dict: A dictionary representation of the StorageKeyPartitionDescriptor.
        r   rO   rP   r\   rE   s     r   r%   z%StorageKeyPartitionDescriptor.to_dict   sO     $))$($($5$5F=!)%)%7%7F>"r   rQ   )	r   r   r   r   r   r(   r!   r   r%   r   r   r   rY   rY      s-    8+Xc] +(SV- +
 r   rY   c                   n    e Zd ZdZ	 	 	 	 	 ddedededee   dee   dee   d	ee   d
ee   fdZ	de
fdZy)PartialCookiez(Represents a partial cookie for setting.Nr+   r   r,   r-   r/   r0   r1   r2   c	                 t    || _         || _        || _        || _        || _        || _        || _        || _        y r   )r+   r   r,   r-   r/   r0   r1   r2   )	r    r+   r   r,   r-   r/   r0   r1   r2   s	            r   r!   zPartialCookie.__init__   s<     	
	""r   r"   c                 x   | j                   | j                  j                         | j                  d}| j                  | j                  |d<   | j
                  | j
                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   |S )zConverts the PartialCookie to a dictionary.

        Returns:
        -------
            Dict: A dictionary representation of the PartialCookie.
        )r+   r   r,   r-   r9   r0   r:   r2   )	r+   r   r%   r,   r-   r/   r0   r1   r2   rE   s     r   r%   zPartialCookie.to_dict   s     IIZZ'')kk

 99 !YYF6N>>%!%F:;;"#{{F8>>%!%F:;;"#{{F8r   )NNNNN)r   r   r   r   r(   r   r   r?   r>   r!   r   r%   r   r   r   r_   r_      s    2 #$(!%#' $  	
 sm D>  C= ( r   r_   c                   @    e Zd ZdZdee   defdZede	dd fd       Z
y)	GetCookiesResultz.Represents the result of a getCookies command.cookiespartition_keyc                      || _         || _        y r   rd   re   )r    rd   re   s      r   r!   zGetCookiesResult.__init__  s    *r   r7   r"   c                     |j                  dg       D cg c]  }t        j                  |       }}t        j                  |j                  di             } | ||      S c c}w )a  Creates a GetCookiesResult instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the get cookies result information.

        Returns:
        -------
            GetCookiesResult: A new instance of GetCookiesResult.
        rd   partitionKeyrg   )r;   r*   r=   rH   )r<   r7   cookierd   re   s        r   r=   zGetCookiesResult.from_dict  s[     ;?((9b:QR6##F+RR$..txx/KL7-@@ Ss   A"N)r   r   r   r   r   r*   rH   r!   r@   r   r=   r   r   r   rc   rc     sC    8+V +\ + AT A&8 A Ar   rc   c                   6    e Zd ZdZdefdZededd fd       Zy)SetCookieResultz-Represents the result of a setCookie command.re   c                     || _         y r   re   r    re   s     r   r!   zSetCookieResult.__init__)  
    *r   r7   r"   c                 ^    t         j                  |j                  di             } | |      S )a  Creates a SetCookieResult instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the set cookie result information.

        Returns:
        -------
            SetCookieResult: A new instance of SetCookieResult.
        ri   rn   rH   r=   r;   r<   r7   re   s      r   r=   zSetCookieResult.from_dict,  *     %..txx/KL//r   N	r   r   r   r   rH   r!   r@   r   r=   r   r   r   rl   rl   &  s4    7+l + 0T 0&7 0 0r   rl   c                   6    e Zd ZdZdefdZededd fd       Zy)DeleteCookiesResultz1Represents the result of a deleteCookies command.re   c                     || _         y r   rn   ro   s     r   r!   zDeleteCookiesResult.__init__?  rp   r   r7   r"   c                 ^    t         j                  |j                  di             } | |      S )a&  Creates a DeleteCookiesResult instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the delete cookies result information.

        Returns:
        -------
            DeleteCookiesResult: A new instance of DeleteCookiesResult.
        ri   rn   rr   rs   s      r   r=   zDeleteCookiesResult.from_dictB  rt   r   Nru   r   r   r   rw   rw   <  s4    ;+l + 0T 0&; 0 0r   rw   c                       e Zd ZdZd Z	 	 ddee   deeee	f      de
fdZ	 ddedeeee	f      defd	Z	 	 ddee   deeee	f      defd
Zy)Storagez*BiDi implementation of the storage module.c                     || _         y r   )conn)r    r}   s     r   r!   zStorage.__init__U  s	    	r   Nfilter	partitionr"   c                     i }||j                         |d<   ||j                         |d<   | j                  j                  t        d|            }t        j                  |      S )a7  Retrieves cookies that match the given parameters.

        Parameters:
        -----------
            filter: Optional filter to match cookies.
            partition: Optional partition descriptor.

        Returns:
        -------
            GetCookiesResult: The result of the get cookies command.
        r~   r   zstorage.getCookies)r%   r}   executer   rc   r=   r    r~   r   paramsrF   s        r   get_cookieszStorage.get_cookiesX  sf      %~~/F8 "+"3"3"5F;""?3G#PQ))&11r   rj   c                     d|j                         i}||j                         |d<   | j                  j                  t        d|            }t        j                  |      S )a  Sets a cookie in the browser.

        Parameters:
        -----------
            cookie: The cookie to set.
            partition: Optional partition descriptor.

        Returns:
        -------
            SetCookieResult: The result of the set cookie command.
        rj   r   zstorage.setCookie)r%   r}   r   r   rl   r=   )r    rj   r   r   rF   s        r   
set_cookiezStorage.set_cookieq  s[      FNN,- "+"3"3"5F;""?3F#OP((00r   c                     i }||j                         |d<   ||j                         |d<   | j                  j                  t        d|            }t        j                  |      S )aE  Deletes cookies that match the given parameters.

        Parameters:
        -----------
            filter: Optional filter to match cookies to delete.
            partition: Optional partition descriptor.

        Returns:
        -------
            DeleteCookiesResult: The result of the delete cookies command.
        r~   r   zstorage.deleteCookies)r%   r}   r   r   rw   r=   r   s        r   delete_cookieszStorage.delete_cookies  sf      %~~/F8 "+"3"3"5F;""?3JF#ST",,V44r   rQ   r   )r   r   r   r   r!   r   rB   r   rS   rY   rc   r   r_   rl   r   rw   r   r   r   r   r{   r{   R  s    4
 *.hl2&2 E"DFc"cde2 
	28 im11 E"DFc"cde1 
	12 *.hl5&5 E"DFc"cde5 
	5r   r{   N)typingr   r   r   r   %selenium.webdriver.common.bidi.commonr   r	   r   r*   rB   rH   rS   rY   r_   rc   rl   rw   r{   r   r   r   <module>r      s   $ / . A 8 8(1
 1
h3 3l
 
2< <" .- -`A A00 0,0 0,M5 M5r   