
    $)fm                       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 e G d d	             Ze G d
 d             Ze G d d             Ze G d d             Ze G d d             Z G d dej"                        Ze G d d             Z	 	 d	 	 	 	 	 	 	 ddZ	 	 	 	 ddZd dZd dZ ed      e G d d                    Zy)!    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)pagec                  V    e Zd ZU ded<   ded<   ded<   ded<   ded<   d Zed        Zy	)

CreditCardstrnumbernameexpiry_monthexpiry_yearcvcc                    t               }| j                  |d<   | j                  |d<   | j                  |d<   | j                  |d<   | j
                  |d<   |S )Nr   r   expiryMonth
expiryYearr   )dictr   r   r   r   r   selfjsons     m/var/www/html/flask-app/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v122/autofill.pyto_jsonzCreditCard.to_json!   sU    vXyyV"//]!--\hhU    c           
          | t        |d         t        |d         t        |d         t        |d         t        |d               S )Nr   r   r   r   r   )r   r   r   r   r   r   clsr   s     r   	from_jsonzCreditCard.from_json*   sM    tH~&T&\"T-01D./DK 
 	
r   N__name__
__module____qualname____annotations__r   classmethodr     r   r   r   r      s@     K I   
H 
 
r   r   c                  8    e Zd ZU ded<   ded<   d Zed        Zy)AddressFieldr   r   valuec                V    t               }| j                  |d<   | j                  |d<   |S )Nr   r*   )r   r   r*   r   s     r   r   zAddressField.to_json=   s(    vyyV

Wr   c                F     | t        |d         t        |d               S )Nr   r*   )r   r*   r   r   s     r   r    zAddressField.from_jsonC   s'    T&\"d7m$
 	
r   Nr!   r'   r   r   r)   r)   5   s)     I J 
 
r   r)   c                  2    e Zd ZU dZded<   d Zed        Zy)AddressFieldsz#
    A list of address fields.
    typing.List[AddressField]fieldsc                z    t               }| j                  D cg c]  }|j                          c}|d<   |S c c}w Nr0   r   r0   r   r   r   is      r   r   zAddressFields.to_jsonR   1    v/3{{;!!))+;X <   8c                f     | |d   D cg c]  }t         j                  |       c}      S c c}w Nr0   )r0   r)   r    r   r   r5   s      r   r    zAddressFields.from_jsonW   /    7;H~F!L**1-F
 	
F   .Nr"   r#   r$   __doc__r%   r   r&   r    r'   r   r   r.   r.   K   s(     &%
 
 
r   r.   c                  .    e Zd ZU ded<   d Zed        Zy)Addressr/   r0   c                z    t               }| j                  D cg c]  }|j                          c}|d<   |S c c}w r2   r3   r4   s      r   r   zAddress.to_jsonc   r6   r7   c                f     | |d   D cg c]  }t         j                  |       c}      S c c}w r9   r:   r;   s      r   r    zAddress.from_jsonh   r<   r=   Nr!   r'   r   r   rA   rA   ^   s#     &%
 
 
r   rA   c                  2    e Zd ZU dZded<   d Zed        Zy)	AddressUIa  
    Defines how an address can be displayed like in chrome://settings/addresses.
    Address UI is a two dimensional array, each inner array is an "address information line", and when rendered in a UI surface should be displayed as such.
    The following address UI for instance:
    [[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}], [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]]
    should allow the receiver to render:
    Jon Doe
    Munich 81456
    ztyping.List[AddressFields]address_fieldsc                z    t               }| j                  D cg c]  }|j                          c}|d<   |S c c}w )NaddressFields)r   rF   r   r4   s      r   r   zAddressUI.to_json}   s5    v6:6I6I J J_ !Kr7   c                f     | |d   D cg c]  }t         j                  |       c}      S c c}w )NrH   )rF   )r.   r    r;   s      r   r    zAddressUI.from_json   s0    @D_@UV1M33A6V
 	
Vr=   Nr>   r'   r   r   rE   rE   o   s(     /.
 
 
r   rE   c                  .    e Zd ZdZdZdZd Zed        Zy)FillingStrategyzw
    Specified whether a filled field was done so by using the html autocomplete attribute or autofill heuristics.
    autocompleteAttributeautofillInferredc                    | j                   S N)r*   )r   s    r   r   zFillingStrategy.to_json   s    zzr   c                     | |      S rO   r'   r   s     r   r    zFillingStrategy.from_json   s    4yr   N)	r"   r#   r$   r?   AUTOCOMPLETE_ATTRIBUTEAUTOFILL_INFERREDr   r&   r    r'   r   r   rK   rK      s.     5*  r   rK   c                  j    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 Zed        Zy)FilledFieldr   	html_typeid_r   r*   autofill_typerK   filling_strategydom.BackendNodeIdfield_idc                $   t               }| j                  |d<   | j                  |d<   | j                  |d<   | j                  |d<   | j
                  |d<   | j                  j                         |d<   | j                  j                         |d<   |S )NhtmlTypeidr   r*   autofillTypefillingStrategyfieldId)	r   rU   rV   r   r*   rW   rX   r   rZ   r   s     r   r   zFilledField.to_json   s    v>>ZXXT
yyV

W#11^"&"7"7"?"?"A--//1Yr   c                    | t        |d         t        |d         t        |d         t        |d         t        |d         t        j                  |d         t        j                  j                  |d               S )	Nr\   r]   r   r*   r^   r_   r`   )rU   rV   r   r*   rW   rX   rZ   )r   rK   r    r   BackendNodeIdr   s     r   r    zFilledField.from_json   sx    $z*+DJT&\"d7m$d>23,66t<M7NO&&00iA
 	
r   Nr!   r'   r   r   rT   rT      sO     N 
H I J  &%  	 	
 	
r   rT   c              #     K   t               }| j                         |d<   ||j                         |d<   |j                         |d<   d|d}|}yw)a  
    Trigger autofill on a form identified by the fieldId.
    If the field and related form cannot be autofilled, returns an error.

    :param field_id: Identifies a field that serves as an anchor for autofill.
    :param frame_id: *(Optional)* Identifies the frame that field belongs to.
    :param card: Credit card information to fill out the form. Credit card data is not saved.
    r`   NframeIdcardzAutofill.triggermethodparamsr   r   )rZ   frame_idre   rh   cmd_dictr   s         r   triggerrl      s`      &F ((*F9$,,.y\\^F6N$H >Ds   AAc              #  ~   K   t               }| D cg c]  }|j                          c}|d<   d|d}|}yc c}w w)zh
    Set addresses so that developers can verify their forms implementation.

    :param addresses:
    	addresseszAutofill.setAddressesrf   Nri   )rn   rh   r5   rk   r   s        r   set_addressesro      sE      &F09:1199;:F;)H >D ;s   =8=c               #     K   ddi} | }yw)z1
    Disables autofill domain notifications.
    rg   zAutofill.disableNr'   rk   r   s     r   disablerr      s     
 	$H >D   
c               #     K   ddi} | }yw)z0
    Enables autofill domain notifications.
    rg   zAutofill.enableNr'   rq   s     r   enableru      s     
 	#H >Drs   zAutofill.addressFormFilledc                  8    e Zd ZU dZded<   ded<   edd       Zy)	AddressFormFilledz1
    Emitted when an address form is filled.
    ztyping.List[FilledField]filled_fieldsrE   
address_uic                     | |d   D cg c]  }t         j                  |       c}t        j                  |d               S c c}w )NfilledFields	addressUi)rx   ry   )rT   r    rE   r;   s      r   r    zAddressFormFilled.from_json  sC    =A.=QR;003R **4+<=
 	
Rs   AN)r   r   returnrw   )r"   r#   r$   r?   r%   r&   r    r'   r   r   rw   rw     s)     ,+ 
 
r   rw   )NN)rZ   rY   rj   ztyping.Optional[page.FrameId]re   r   r}   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])rn   ztyping.List[Address]r}   r~   )r}   r~   )
__future__r   utilr   r   dataclassesr   enumtyping r   r	   r   r)   r.   rA   rE   EnumrK   rT   rl   ro   rr   ru   rw   r'   r   r   <module>r      s;   # * !     !
 !
 !
H 
 
 
* 
 
 
$ 
 
 
  
 
 
2dii  +
 +
 +
` 37#/  
8	2'	7" )*

 
  +
r   