Ë
    €»—hr  ã                   ó  — d Z ddlZddlmZ ddlmZmZ ddlmZ ddl	m
Z
 ej                  efZdefd„Zdd	eeeedf   d
ee   dee   fd„Zd	ed
edefd„Zdd
ed	ee   defd„Zd
eeef   defd„Zdee   dee   fd„Zy)zThe Utils methods.é    N)ÚIterable)ÚOptionalÚUnion)ÚAnyKey)ÚKeysÚreturnc                  óô   — t        j                   t         j                  t         j                  «      } | j                  d«       | j	                  d«       | j                  «       d   }| j                  «        |S )z%Determines a free port using sockets.)z	127.0.0.1r   é   é   )ÚsocketÚAF_INETÚSOCK_STREAMÚbindÚlistenÚgetsocknameÚclose)Úfree_socketÚports     úa/var/www/html/w1hd.aprs.trek/venv/lib/python3.12/site-packages/selenium/webdriver/common/utils.pyÚ	free_portr      s]   € ä—-‘-¤§¡´×0BÑ0BÓC€KØ×ÑÐ%Ô&Ø×Ñ�qÔØ×'Ñ'Ó)¨!Ñ,€DØ×ÑÔØ€Kó    Úhostr   c                 óV  — 	 t        j                  | d«      }d}|D ]q  \  }}}}}d}|rt        |t	        |d   «      «      }|r#|t         j
                  k(  rt	        |d   «      c S |sŒM|rŒP|t         j                  k(  sŒdt	        |d   «      }Œs |S # t         j                  $ r Y yw xY w)a€  Resolve a hostname to an IP, preferring IPv4 addresses.

    We prefer IPv4 so that we don't change behavior from previous IPv4-only
    implementations, and because some drivers (e.g., FirefoxDriver) do not
    support IPv6 connections.

    If the optional port number is provided, only IPs that listen on the given
    port are considered.

    :Args:
        - host - A hostname.
        - port - Optional port number.

    :Returns:
        A single IP address, as a string. If any IPv4 address is found, one is
        returned. Otherwise, if any IPv6 address is found, one is returned. If
        neither, then None is returned.
    NTr   )r   ÚgetaddrinfoÚgaierrorÚis_connectableÚstrr   ÚAF_INET6)r   r   Ú	addrinfosÚipÚfamilyÚ_ÚsockaddrÚconnectables           r   Úfind_connectable_ipr%   '   s±   € ð&Ü×&Ñ& t¨TÓ2ˆ	ð 
€BØ%.ò "Ñ!ˆ��1�a˜ØˆÙÜ(¨¬s°8¸A±;Ó/?Ó@ˆKá˜6¤V§^¡^Ò3Ü�x ‘{Ó#Ò#Úšr f´·±Ó&?Ü�X˜a‘[Ó!‰Bð"ð €Iøô �?‰?ò Ùðús   ‚B ÂB(Â'B(c                 óJ   — d| v r| j                  d«      sd| › d|› �S | › d|› �S )zùJoins a hostname and port together.

    This is a minimal implementation intended to cope with IPv6 literals. For
    example, _join_host_port('::1', 80) == '[::1]:80'.

    :Args:
        - host - A hostname.
        - port - An integer port.
    ú:ú[z]:)Ú
startswith)r   r   s     r   Újoin_host_portr*   L   s:   € ð ˆd�{˜4Ÿ?™?¨3Ô/Ø�4�&˜˜4˜&Ð!Ð!ØˆV�1�T�FÐÐr   c                 ót  — d}	 t        j                  || fd«      }d}|r0	 |j                  t         j                  «       |j                  «        |S # t        $ r d}Y ŒAw xY w# t
        $ r Y Œ.w xY w# |rA	 |j                  t         j                  «       n# t
        $ r Y nw xY w|j                  «        w w xY w)zsTries to connect to the server at port to see if it is running.

    :Args:
     - port - The port to connect.
    Nr   TF)r   Úcreate_connectionÚ_is_connectable_exceptionsÚshutdownÚ	SHUT_RDWRÚ	Exceptionr   )r   r   Úsocket_Úresults       r   r   r   [   s¿   € ð €GðÜ×*Ñ*¨D°$¨<¸Ó;ˆØˆñ ðØ× Ñ ¤×!1Ñ!1Ô2ð �M‰MŒOØ€Møô &ò ØŠðûô ò Ùðûñ ðØ× Ñ ¤×!1Ñ!1Õ2øÜò Ùðúà�M‰M�Oð úsX   „A ¡A# ÁA ÁA2 ÁA Á A2 Á#	A/Á.A/Á2B7Á6BÂB7Â	B"ÂB7Â!B"Â"B7c                 ó~   — ddl m} 	 |j                  d| › d�«      }|j                  «       dk(  S # t        $ r Y yw xY w)z¢Tries to connect to the HTTP server at /status path and specified port
    to see if it responds successfully.

    :Args:
     - port - The port to connect.
    r   )Úrequestzhttp://127.0.0.1:z/statuséÈ   F)Úurllibr4   ÚurlopenÚgetcoder0   )r   Úurl_requestÚress      r   Úis_url_connectabler;   q   sI   € õ .ðØ×!Ñ!Ð$5°d°V¸7Ð"CÓDˆØ�{‰{‹} Ñ#Ð#øÜò Ùðús   ˆ'0 °	<»<Úvaluec                 óò   — g }| D ]o  }t        |t        «      r|j                  t        |«      «       Œ.t        |t        t
        f«      r|j                  t        |«      «       Œ_|j                  |«       Œq |S )z7Processes the values that will be typed in the element.)Ú
isinstancer   Úappendr   ÚintÚfloatÚextend)r<   Ú
charactersÚvals      r   Úkeys_to_typingrE   �   sh   € à€JØò #ˆÜ�cœ4Ô à×Ñœc #›hÕ'Ü˜œc¤5˜\Ô*Ø×Ñœc #›hÕ'à×Ñ˜cÕ"ð#ð Ðr   )N)Ú	localhost)Ú__doc__r   Úcollections.abcr   Útypingr   r   Úselenium.typesr   Úselenium.webdriver.common.keysr   ÚerrorÚConnectionResetErrorr-   r@   r   r   ÚbytesÚ	bytearrayr%   r*   Úboolr   r;   ÚlistrE   © r   r   ú<module>rS      sÙ   ðñ" ã Ý $ß "å !Ý /à$Ÿl™lÐ,@ÐAÐ ð�3ó ñ"˜e C¨°	¸4Ð$?Ñ@ð "ÈÐQTÉð "ÐaiÐjmÑanó "ðJ˜ð  Cð ¨Có ñ˜ð  H¨S¡Mð ÀDó ð,˜U 3¨ 8™_ð °ó ð ˜( 6Ñ*ð ¨t°C©yô r   