Ë
    cQbju  ã            	       ó
  — d Z ddlZddlZddl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z  dz  dedz  dedz  fd	„Zdededefd
„Zddededz  defd„Z	 	 ddeez  dededefd„Zdeeez  ez     dee   fd„Zy)zUtility functions.é    N)ÚIterable)ÚKeysÚreturnc                  óf  — d} 	 t        j                   t         j                  t         j                  «      } | j                  d«       	 | j                  «       d   }	 | j                  «        |S # t        $ r„ | r| j                  «        	 t        j                   t         j                  t         j                  «      } | j                  d«       n*# t        $ r | r| j                  «        t        d«      ‚w xY wY Œ³w xY w# t        $ r}t        d|› d�«      ‚d}~ww xY w# | j                  «        w xY w)zqDetermines a free port using sockets.

    First try IPv4, but use IPv6 if it can't bind (IPv6-only system).
    N)z	127.0.0.1r   )z::1r   z5Can't find free port (Unable to bind to IPv4 or IPv6)é   zCan't find free port: (ú))
ÚsocketÚAF_INETÚSOCK_STREAMÚbindÚOSErrorÚcloseÚAF_INET6ÚRuntimeErrorÚgetsocknameÚ	Exception)Úfree_socketÚportÚes      úR/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/common/utils.pyÚ	free_portr      s  € ð
 €KðXä—m‘m¤F§N¡N´F×4FÑ4FÓGˆØ×ÑÐ)Ô*ðØ×+Ñ+Ó-¨aÑ0‰ð 	×ÑÔØ€Køô# ò 
XÙØ×ÑÔð	XÜ Ÿ-™-¬¯©¼×9KÑ9KÓLˆKØ×Ñ˜ZÕ(øÜò 	XÙØ×!Ñ!Ô#ÜÐVÓWÐWð	Xúñ )ð
Xûô ò ;ÜÐ4°Q°C°qÐ9Ó:Ð:ûð;ûð 	×ÑÕúsO   „AA. ÁC> Á.C;Â
ACÃC;Ã'C5Ã5C;Ã:C;Ã>	DÄDÄDÄD ÄD0Ú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)ak  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: hostname
        port: 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
   r   )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: hostname or IP
        port: port number
    ú:ú[z]:)Ú
startswith)r   r   s     r   Újoin_host_portr)   a   s:   € ð ˆd�{˜4Ÿ?™?¨3Ô/Ø�4�&˜˜4˜&Ð!Ð!ØˆV�1�T�FÐÐó    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)z†Tries to connect to the server at port to see if it is running.

    Args:
        port: port number
        host: hostname or IP
    Nr   TF)r	   Úcreate_connectionÚ_is_connectable_exceptionsÚshutdownÚ	SHUT_RDWRr   r   )r   r   Úsocket_Úresults       r   r   r   p   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Úschemec                 óR  — 	 t         j                  j                  i «      }t         j                  j                  |«      }t         j                  j	                  |› d|› d| › d�«      }|j                  |d¬«      5 }|j                  «       dk7  r
	 ddd«       y|j                  «       j                  d	«      }t        j                  |«      }|j                  d
«      }	|	€!|j                  di «      j                  d
«      }	|	du cddd«       S # 1 sw Y   yxY w# t        $ r Y yw xY w)a  Send a request to the HTTP server at the /status endpoint to verify connectivity.

    Args:
        port: port number
        host: hostname or IP
        scheme: URL scheme

    Returns:
        True if the service is ready to accept new sessions, False otherwise.
    z://r&   z/statusr   )ÚtimeoutéÈ   NFzutf-8ÚreadyÚvalueT)ÚurllibÚrequestÚProxyHandlerÚbuild_openerÚRequestÚopenÚgetcodeÚreadÚdecodeÚjsonÚloadsÚgetr   )
r   r   r2   Úproxy_handlerÚopenerr9   ÚresÚbodyÚdatar6   s
             r   Úis_url_connectablerI   ‡   s  € ðäŸ™×3Ñ3°BÓ7ˆÜ—‘×,Ñ,¨]Ó;ˆä—.‘.×(Ñ(¨F¨8°3°t°f¸A¸d¸VÀ7Ð)KÓLˆØ�[‰[˜¨!ˆ[Ó,ð 	!°Ø�{‰{‹} Ò#Ø÷	!ð 	!ð —8‘8“:×$Ñ$ WÓ-ˆDÜ—:‘:˜dÓ#ˆDð —H‘H˜WÓ%ˆEØˆ}ØŸ™ ¨"Ó-×1Ñ1°'Ó:�Ø˜D�=÷	!÷ 	!ò 	!ûô ò Ùðús=   ‚A9D Á;DÂD ÂA+DÄ	D ÄDÄD ÄD Ä	D&Ä%D&r7   c                 óò   — 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)r7   Ú
charactersÚvals      r   Úkeys_to_typingrR   ¬   sh   € à€JØò #ˆÜ�cœ4Ô à×Ñœc #›hÕ'Ü˜œc¤5˜\Ô*Ø×Ñœc #›hÕ'à×Ñ˜cÕ"ð#ð Ðr*   )N)Ú	localhost)rS   Úhttp)Ú__doc__rA   r	   Úurllib.requestr8   Úcollections.abcr   Úselenium.webdriver.common.keysr   ÚerrorÚConnectionResetErrorr-   rM   r   r   Úbytesr$   r)   Úboolr   rI   rN   ÚlistrR   © r*   r   ú<module>r_      sõ   ðñ$ ã Û Û Ý $å /à$Ÿl™lÐ,@ÐAÐ ð�3ó ñ<"˜c E™k¨DÑ0ð "¸¸d¹
ð "ÈcÐTXÉjó "ðJ˜ð  Cð ¨Có ñ˜ð  C¨$¡Jð Àó ð2 Øñ"Ø
�‰)ð"à
ð"ð ð"ð 
ó	"ðJ˜( 3¨¡9¨uÑ#4Ñ5ð ¸$¸s¹)ô r*   