Ë
    û—hÖ  ã                   óV   — d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	  G d„ de	«      Z
y)é    N)ÚBinaryIOÚOptionalÚUnion)ÚDesiredCapabilities)Ú
ArgOptionsc            	       ó’  ‡ — e Zd ZdZdˆ fd„Zedefd„«       Zej                  deddfd„«       Zede	e   fd„«       Z
e
j                  deddfd	„«       Z
edee   fd
„«       Zdeddfd„Zdeddfd„Zedefd„«       Zdedeeeeee   f   ddfd„Zedefd„«       Zej                  deddfd„«       Zdefd„Zedefd„«       Zˆ xZS )ÚChromiumOptionszgoog:chromeOptionsÚreturnNc                 óv   •— t         ‰| �  «        d| _        g | _        g | _        i | _        d | _        d| _        y )NÚ F)ÚsuperÚ__init__Ú_binary_locationÚ_extension_filesÚ_extensionsÚ_experimental_optionsÚ_debugger_addressÚ_enable_webextensions)ÚselfÚ	__class__s    €úf/home/bbl/html/w1hd.aprs.trek/venv/lib/python3.12/site-packages/selenium/webdriver/chromium/options.pyr   zChromiumOptions.__init__   s>   ø€ Ü‰ÑÔØ%'ˆÔØ+-ˆÔØ&(ˆÔØRTˆÔ"Ø04ˆÔØ+0ˆÕ"ó    c                 ó   — | j                   S )z@:Returns: The location of the binary, otherwise an empty string.)r   ©r   s    r   Úbinary_locationzChromiumOptions.binary_location&   s   € ð ×$Ñ$Ð$r   Úvaluec                 ó\   — t        |t        «      st        | j                  «      ‚|| _        y)z’Allows you to set where the chromium binary lives.

        Parameters:
        ----------
            value: path to the Chromium binary
        N)Ú
isinstanceÚstrÚ	TypeErrorÚBINARY_LOCATION_ERRORr   ©r   r   s     r   r   zChromiumOptions.binary_location+   s'   € ô ˜%¤Ô%Ü˜D×6Ñ6Ó7Ð7Ø %ˆÕr   c                 ó   — | j                   S )z6:Returns: The address of the remote devtools instance.)r   r   s    r   Údebugger_addressz ChromiumOptions.debugger_address7   s   € ð ×%Ñ%Ð%r   c                 óH   — t        |t        «      st        d«      ‚|| _        y)a  Allows you to set the address of the remote devtools instance that
        the ChromeDriver instance will try to connect to during an active wait.

        Parameters:
        ----------
            value: address of remote devtools instance if any (hostname[:port])
        z!Debugger Address must be a stringN)r   r   r    r   r"   s     r   r$   z ChromiumOptions.debugger_address<   s"   € ô ˜%¤Ô%ÜÐ?Ó@Ð@Ø!&ˆÕr   c                 óÖ   — dt         dt        fd„}g }| j                  D ].  }t        |d«      5 }|j	                   ||«      «       ddd«       Œ0 || j
                  z   S # 1 sw Y   ŒIxY w)z;:Returns: A list of encoded extensions that will be loaded.Ú	file_datar
   c                 óf   — t        j                  | j                  «       «      j                  d«      S )Nzutf-8)Úbase64Ú	b64encodeÚreadÚdecode)r'   s    r   Ú_decodez+ChromiumOptions.extensions.<locals>._decodeM   s'   € ô ×#Ñ# I§N¡NÓ$4Ó5×<Ñ<¸WÓEÐEr   ÚrbN)r   r   r   ÚopenÚappendr   )r   r-   Úencoded_extensionsÚ	extensionÚfs        r   Ú
extensionszChromiumOptions.extensionsI   s€   € ð	Fœxð 	F¬Có 	Fð  ÐØ×.Ñ.ò 	6ˆIÜ�i Ó&ð 6¨!Ø"×)Ñ)©'°!«*Ô5÷6ð 6ð	6ð " D×$4Ñ$4Ñ4Ð4÷6ð 6ús   ®AÁA(	r2   c                 ó   — |r‚t         j                  j                  t         j                  j                  |«      «      }t         j                  j	                  |«      r| j
                  j                  |«       yt        d«      ‚t        d«      ‚)zÅAdds the path to the extension to a list that will be used to
        extract it to the ChromeDriver.

        Parameters:
        ----------
            extension: path to the \*.crx file
        z#Path to the extension doesn't existúargument can not be nullN)	ÚosÚpathÚabspathÚ
expanduserÚexistsr   r0   ÚOSErrorÚ
ValueError)r   r2   Úextension_to_adds      r   Úadd_extensionzChromiumOptions.add_extensionZ   sg   € ñ Ü!Ÿw™wŸ™¬r¯w©w×/AÑ/AÀ)Ó/LÓMÐÜ�w‰w�~‰~Ð.Ô/Ø×%Ñ%×,Ñ,Ð-=Õ>äÐCÓDÐDäÐ7Ó8Ð8r   c                 óT   — |r| j                   j                  |«       yt        d«      ‚)zçAdds Base64 encoded string with extension data to a list that will
        be used to extract it to the ChromeDriver.

        Parameters:
        ----------
            extension: Base64 encoded string with extension data
        r6   N)r   r0   r=   )r   r2   s     r   Úadd_encoded_extensionz%ChromiumOptions.add_encoded_extensionk   s'   € ñ Ø×Ñ×#Ñ# IÕ.äÐ7Ó8Ð8r   c                 ó   — | j                   S )z<:Returns: A dictionary of experimental options for chromium.©r   r   s    r   Úexperimental_optionsz$ChromiumOptions.experimental_optionsx   s   € ð ×)Ñ)Ð)r   Únamec                 ó"   — || j                   |<   y)zºAdds an experimental option which is passed to chromium.

        Parameters:
        ----------
          name: The experimental option name.
          value: The option value.
        NrC   )r   rE   r   s      r   Úadd_experimental_optionz'ChromiumOptions.add_experimental_option}   s   € ð ,1ˆ×"Ñ" 4Ò(r   c                 ó   — | j                   S )z™:Returns: Whether webextension support is enabled for Chromium-based browsers.
        True if webextension support is enabled, False otherwise.
        )r   r   s    r   Úenable_webextensionsz$ChromiumOptions.enable_webextensions‡   s   € ð
 ×)Ñ)Ð)r   c                 óØ   — || _         |r,ddg}|D ]"  }|| j                  vsŒ| j                  |«       Œ$ yddg}|D ],  }|| j                  v sŒ| j                  j                  |«       Œ. y)aù  Enables or disables webextension support for Chromium-based browsers.

        Parameters:
        ----------
            value : bool
                True to enable webextension support, False to disable.

        Notes:
        -----
        - When enabled, this automatically adds the required Chromium flags:
            - --enable-unsafe-extension-debugging
            - --remote-debugging-pipe
        - When disabled, this removes BOTH flags listed above, even if they were manually added via add_argument()
          before enabling webextensions.
        - Enabling --remote-debugging-pipe makes the connection b/w chromedriver
          and the browser use a pipe instead of a port, disabling many CDP functionalities
          like devtools
        z#--enable-unsafe-extension-debuggingz--remote-debugging-pipeN)r   Ú
_argumentsÚadd_argumentÚremove)r   r   Úrequired_flagsÚflagÚflags_to_removes        r   rI   z$ChromiumOptions.enable_webextensionsŽ   s~   € ð( &+ˆÔ"ÙàCÐE^Ð_ˆNØ&ò ,�Ø˜tŸ™Ò.Ø×%Ñ% dÕ+ñ,ð
  EÐF_Ð`ˆOØ'ò 1�Ø˜4Ÿ?™?Ò*Ø—O‘O×*Ñ*¨4Õ0ñ1r   c                 óf  — | j                   }| j                  j                  «       }| j                  r|j	                  | j                  «       | j
                  |d<   | j                  r| j                  |d<   | j                  |d<   | j                  r| j                  |d<   ||| j                  <   |S )zžCreates a capabilities with all the options that have been set

        Returns:
        -------
            dict : a dictionary with all set options
        r4   ÚbinaryÚargsÚdebuggerAddress)
Ú_capsrD   ÚcopyÚmobile_optionsÚupdater4   r   rK   r$   ÚKEY)r   ÚcapsÚchrome_optionss      r   Úto_capabilitieszChromiumOptions.to_capabilities°   sŸ   € ð �z‰zˆØ×2Ñ2×7Ñ7Ó9ˆØ×ÒØ×!Ñ! $×"5Ñ"5Ô6Ø'+§¡ˆ�|Ñ$Ø×ÒØ'+×';Ñ';ˆN˜8Ñ$Ø!%§¡ˆ�vÑØ× Ò Ø04×0EÑ0EˆNÐ,Ñ-à'ˆˆT�X‰X‰àˆr   c                 ó>   — t         j                  j                  «       S )N)r   ÚCHROMErV   r   s    r   Údefault_capabilitiesz$ChromiumOptions.default_capabilitiesÆ   s   € ä"×)Ñ)×.Ñ.Ó0Ð0r   )r
   N)Ú__name__Ú
__module__Ú__qualname__rY   r   Úpropertyr   r   Úsetterr   r$   Úlistr4   r?   rA   ÚdictrD   r   ÚintrG   ÚboolrI   r\   r_   Ú__classcell__)r   s   @r   r	   r	      s�  ø„ Ø
€Cõ1ð ð% ò %ó ð%ð ×Ñð	& Sð 	&¨Tò 	&ó ð	&ð ð& (¨3¡-ò &ó ð&ð ×Ñð
' cð 
'¨dò 
'ó ð
'ð ð5˜D ™Iò 5ó ð5ð 9 sð 9¨tó 9ð"9¨sð 9°tó 9ð ð* dò *ó ð*ð1¨Cð 1¸¸cÀ3ÈÈdÐSVÉiÐ>WÑ8Xð 1Ð]aó 1ð ð* dò *ó ð*ð × Ñ ð1¨$ð 1°4ò 1ó !ð1ðB ó ð, ð1 dò 1ó ô1r   r	   )r)   r7   Útypingr   r   r   Ú.selenium.webdriver.common.desired_capabilitiesr   Ú!selenium.webdriver.common.optionsr   r	   © r   r   ú<module>rn      s'   ðó$ Û 	ß ,Ñ ,å NÝ 8ôn1�jõ n1r   