
    hrH              
         S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  Sr	Sr
Sr\R                  " S	5      rS
R                  \" SS5       V s/ s H  o S;  d  M
  \" U 5      PM     sn 5      rS
R                  \" SS5       V s/ s H  o S;  d  M
  \" U 5      PM     sn 5      rS
R                  \" SS5       V s/ s H  n U S;  d  M  \" U 5      PM     sn 5      rS
R                  \" SS5       V s/ s H  n U S;  d  M  \" U 5      PM     sn 5      rS
R                  \" SS5       V s/ s H  n U S;  d  M  \" U 5      PM     sn 5      rS
R                  \" SS5       V s/ s H  n U S;  d  M  \" U 5      PM     sn 5      r\R                  " SR/                  SSSSSS95      r\R                  " SR/                  SSSS95      r\R                  " S5      \R                  " S5      \R                  " S5      \R                  " S5      \R                  " S5      \R                  " S5      \R                  " S5      \R                  " S5      S.r\R                  " S5      r\R                  " S 5      r " S! S"\R:                  5      rS+S,S# jjrS-S$ jr S.S% jr!S/S& jr"S0S' jr#S1S( jr$S2S) jr%S2S* jr&gs  sn f s  sn f s  sn f s  sn f s  sn f s  sn f )3a  
An implementation of `urlparse` that provides URL validation and normalization
as described by RFC3986.

We rely on this implementation rather than the one in Python's stdlib, because:

* It provides more complete URL validation.
* It properly differentiates between an empty querystring and an absent querystring,
  to distinguish URLs with a trailing '?'.
* It handles scheme, hostname, port, and path normalization.
* It supports IDNA hostnames, normalizing them to their encoded form.
* The API supports passing individual components, as well as the complete URL string.

Previously we relied on the excellent `rfc3986` package to handle URL parsing and
validation, but this module provides a simpler alternative, with less indirection
required.
    )annotationsN   )
InvalidURLi   zBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~z!$&'()*+,;=z%[A-Fa-f0-9]{2}        )r   "   <   >   `   )r   r	   #   r
   r   )	r   r	   r   r
   r   ?   r   {   }   )r   r	   r   r
   r   r   r   r   r   /   :   ;   =   @   [   \   ]   ^   |   )r   r	   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   z(?:(?P<scheme>{scheme}):)?(?://(?P<authority>{authority}))?(?P<path>{path})(?:\?(?P<query>{query}))?(?:#(?P<fragment>{fragment}))?z([a-zA-Z][a-zA-Z0-9+.-]*)?z[^/?#]*z[^?#]*z[^#]*z.*scheme	authoritypathqueryfragmentzA(?:(?P<userinfo>{userinfo})@)?(?P<host>{host}):?(?P<port>{port})?z(\[.*\]|[^:@]*))userinfohostportz[^@]*z(\[.*\]|[^:]*))r   r   r   r   r    r!   r"   r#   z ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$z^\[.*\]$c                      \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S'   S	\S
'   S	\S'   \SS j5       r\SS j5       rSS jrSS jr	Sr
g)ParseResult   strr   r!   r"   
int | Noner#   r   
str | Noner   r    c                    SR                  U R                  (       a  U R                   S3OSSU R                  ;   a  SU R                   S3OU R                  U R                  b  SU R                   3/5      $ S/5      $ )Nr   @:[])joinr!   r"   r#   selfs    A/var/www/html/env/lib/python3.13/site-packages/httpx/_urlparse.pyr   ParseResult.authority   sz    ww'+}}4==/#"$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
    c                    SR                  SU R                  ;   a  SU R                   S3OU R                  U R                  b  SU R                   3/5      $ S/5      $ )Nr   r,   r-   r.   )r/   r"   r#   r0   s    r2   netlocParseResult.netloc   sd    ww$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
r4   c                    U(       d  U $ U R                   U R                  U R                  U R                  U R                  S.nUR                  U5        [        S0 UD6$ )Nr   r   )r   r   r   r   r    updateurlparse)r1   kwargsdefaultss      r2   	copy_withParseResult.copy_with   sR    K kkIIZZ
 	'h''r4   c                ,   U R                   nSR                  U R                  (       a  U R                   S3OSU(       a  SU 3OSU R                  U R                  b  SU R                   3OSU R
                  b  SU R
                   3/5      $ S/5      $ )Nr   r,   //?#)r   r/   r   r   r   r    )r1   r   s     r2   __str__ParseResult.__str__   s    NN	ww%)[[4;;-q!b$-"YK 2		$(JJ$:!DJJ< '+}}'@!DMM?#
 	
 GI
 	
r4    N)returnr'   )r<   r)   rG   r%   )__name__
__module____qualname____firstlineno____annotations__propertyr   r6   r>   rD   __static_attributes__rF   r4   r2   r%   r%      sX    KM
I

I
 
 
 
(

r4   r%   c           	     	   [        U 5      [        :  a  [        S5      e[        S U  5       5      (       a8  [	        S U  5       5      nU R                  U5      nSU< SU S3n[        U5      eSU;   a*  US   n[        U[        5      (       a  [        U5      OUUS'   SU;   a4  UR                  S5      =(       d    S	nUR                  S
5      u  US'   oqS'   SU;   d  SU;   aa  [        UR                  SS	5      =(       d    S	[        S9n[        UR                  SS	5      =(       d    S	[        S9n	U	(       a  U S
U	 3OUUS'   SU;   a@  UR                  S5      =(       d    S	n
U
R                  S5      u  US'   oS'   U(       d  S US'   SU;   aU  UR                  S5      =(       d    S	nS
U;   a5  UR                  S5      (       a  UR!                  S5      (       d	  SU S3US'   UR#                  5        H  u  pUc  M
  [        U5      [        :  a  [        SU S35      e[        S U 5       5      (       a;  [	        S U 5       5      nUR                  U5      nSU SU< SU S3n[        U5      e[$        U   R'                  U5      (       a  M  [        SU S35      e   [(        R+                  U 5      nUc   eUR-                  5       nUR                  SUS   5      =(       d    S	nUR                  SUS   5      =(       d    S	nUR                  SUS   5      =(       d    S	nUR                  SUS   5      nUR                  S US    5      n[.        R+                  U5      nUc   eUR-                  5       nUR                  SUS   5      =(       d    S	nUR                  SUS   5      =(       d    S	nUR                  SUS   5      nUR1                  5       n[        U[2        S9n[5        U5      n[7        UU5      nUS	:g  nUS	:g  =(       d    US	:g  =(       d    US Ln[9        UUUS!9  U(       d  U(       a  [;        U5      n[        U[<        S9nUc  S O[        U[>        S9n Uc  S O[        U[@        S9n![C        UUUUUU U!5      $ )"NzURL too longc              3  x   #    U  H0  oR                  5       =(       a    UR                  5       (       + v   M2     g 7fNisasciiisprintable.0chars     r2   	<genexpr>urlparse.<locals>.<genexpr>   s(     
E<<>4$"2"2"444   8:c              3     #    U  H4  oR                  5       (       d  M  UR                  5       (       a  M0  Uv   M6     g 7frQ   rR   rU   s     r2   rX   rY      s%     VSTLLND4CSCSCUDDS   >>	>z.Invalid non-printable ASCII character in URL, z at position .r#   r6   r   r,   r"   usernamepasswordsafer!   raw_pathrB   r   r   r-   r.   zURL component 'z
' too longc              3  x   #    U  H0  oR                  5       =(       a    UR                  5       (       + v   M2     g 7frQ   rR   rU   s     r2   rX   rY     s(     O<<><$*:*:*<&<<rZ   c              3     #    U  H4  oR                  5       (       d  M  UR                  5       (       a  M0  Uv   M6     g 7frQ   rR   rU   s     r2   rX   rY     s(      %*TllnDTEUEUEWDDUr\   z-Invalid non-printable ASCII character in URL z component, zInvalid URL component ''r   r   r    )
has_schemehas_authority)"lenMAX_URL_LENGTHr   anynextfind
isinstanceintr'   pop	partitionquoteUSERNAME_SAFEPASSWORD_SAFEget
startswithendswithitemsCOMPONENT_REGEX	fullmatch	URL_REGEXmatch	groupdictAUTHORITY_REGEXlowerUSERINFO_SAFEencode_hostnormalize_portvalidate_pathnormalize_path	PATH_SAFE
QUERY_SAFE	FRAG_SAFEr%   )"urlr<   rW   idxerrorr#   r6   _r^   r_   rb   	seperatorr"   keyvalue	url_matchurl_dictr   r   r   r   fragauthority_matchauthority_dictr!   parsed_schemeparsed_userinfoparsed_hostparsed_portrf   rg   parsed_pathparsed_queryparsed_frags"                                     r2   r;   r;      s   
 3x. (( 
E
EEEVSVVhhtn<THMRUQVVWX 	  f~&0s&;&;Tv 6H%+,2,<,<S,A)v&> VzV3J39rNJ39rN9Az8*5xz V::j)/R5=5G5G5L2v	'?"F7O zz&!'R$; 4 4s9K9K a[F6N
 lln
5zN* ?3%z!BCC OOOO %*  jj&CC5hmC53  !'' #3'11%88 #:3%q!ABB) %. $I   ""$H ZZ(8"45;F

;(=>D"I::fhv./52DJJw 12E::j(:"67D &++I6O&&&$..0N zz*nZ&@AGRH::fnV45;D::fnV45D
  M >O"4(K,T6:K"$J2M!2Mk6M  $:]K]d#T	2K',}t%J:WL&*ldd8SK  r4   c                   U (       d  g[         R                  U 5      (       a   [        R                  " U 5        U $ [        R                  U 5      (       a   [        R                  " U SS 5        U SS $ U R                  5       (       a!  Sn[        U R                  5       [        U-   S9$  [        R                  " U R                  5       5      R                  S5      $ ! [        R                   a    [        SU < 35      ef = f! [        R                   a    [        SU < 35      ef = f! [        R                   a    [        S	U < 35      ef = f)
Nr   zInvalid IPv4 address: r   zInvalid IPv6 address: z"`{}%|\r`   asciizInvalid IDNA hostname: )IPv4_STYLE_HOSTNAMEr{   	ipaddressIPv4AddressAddressValueErrorr   IPv6_STYLE_HOSTNAMEIPv6AddressrS   rq   r~   
SUB_DELIMSidnaencodedecode	IDNAError)r"   WHATWG_SAFEs     r2   r   r   \  s:   		"	"4	(	(	@!!$' 		"	"4	(	(	@!!$q*- Abz	 !TZZ\
[(@AA={{4::<(//88= ** 	@5dX>??	@ ** 	@5dX>??	@  >> =24(;<<=s#   C D ,2D- $D$D*-$Ec                    U b  U S:X  a  g  [        U 5      nSSSSSS.R                  U5      nX#:X  a  g U$ ! [         a    [        SU < 35      ef = f)Nr   zInvalid port:    P   i  )ftphttphttpswswss)rn   
ValueErrorr   rt   )r#   r   port_as_intdefault_ports       r2   r   r     st     |trz4$i
 rCr#NRRL "  4>$2334s	   6 Ac                   U(       a(  U (       a!  U R                  S5      (       d  [        S5      eU(       dK  U(       dC  U R                  S5      (       a  [        S5      eU R                  S5      (       a  [        S5      eggg)z
Path validation rules that depend on if the URL contains
a scheme or authority component.

See https://datatracker.ietf.org/doc/html/rfc3986.html#section-3.3
/z7For absolute URLs, path must be empty or begin with '/'rA   z3Relative URLs cannot have a path starting with '//'r,   z2Relative URLs cannot have a path starting with ':'N)ru   r   )r   rf   rg   s      r2   r   r     sq      ,,VWWm ??4  RSS ??3QRR   ,:r4   c                   SU ;  a  U $ U R                  S5      nSU;  a  SU;  a  U $ / nU HF  nUS:X  a  M  US:X  a$  U(       a  US/:w  a  UR                  5         M1  M3  M5  UR                  U5        MH     SR                  U5      $ )zx
Drop "." and ".." segments from a URL path.

For example:

    normalize_path("/path/./to/somewhere/..") == "/path/to"
r]   r   z..r   )splitro   appendr/   )r   
componentsoutput	components       r2   r   r     s     $CJ *Z!7 F	$&RD.

 )v MM)$   88Fr4   c                v    SR                  U R                  S5       Vs/ s H	  nSUS 3PM     sn5      $ s  snf )Nr   zutf-8%02X)r/   r   )stringbytes     r2   PERCENTr     s6    77v}}W/EF/EtaSzN/EFGGFs   6c                    [         U-   nU R                  U5      (       d  U $ SR                  U  Vs/ s H  o3U;   a  UO
[        U5      PM     sn5      $ s  snf )z)
Use percent-encoding to quote a string.
r   )UNRESERVED_CHARACTERSrstripr/   r   )r   ra   NON_ESCAPED_CHARSrW   s       r2   percent_encodedr     s[     .4 ==*++77JPQ&$**	=&Q Qs   Ac                   / nSn[         R                  " [        U 5       Hg  nUR                  5       UR	                  5       peUR                  S5      nXS:w  a  XU nUR                  [        XS95        UR                  U5        UnMi     U[        U 5      :w  a  XS n	UR                  [        XS95        SR                  U5      $ )a  
Use percent-encoding to quote a string, omitting existing '%xx' escape sequences.

See: https://www.rfc-editor.org/rfc/rfc3986#section-2.1

* `string`: The string to be percent-escaped.
* `safe`: A string containing characters that may be treated as safe, and do not
    need to be escaped. Unreserved characters are always treated as safe.
    See: https://www.rfc-editor.org/rfc/rfc3986#section-2.3
r   r`   Nr   )
refinditerPERCENT_ENCODED_REGEXstartendgroupr   r   rh   r/   )
r   ra   partscurrent_positionr{   start_positionend_positionmatched_textleading_texttrailing_texts
             r2   rq   rq     s     E2F;',{{}eiik{{1~-!>BLLLAB 	\"' < 3v;&01_]>?775>r4   r9   )r   r'   r<   r)   rG   r%   )r"   r'   rG   r'   )r#   zstr | int | Noner   r'   rG   r(   )r   r'   rf   boolrg   r   rG   None)r   r'   rG   r'   )r   r'   rG   r'   )r   r'   ra   r'   rG   r'   )'__doc__
__future__r   r   r   typingr   _exceptionsr   ri   r   r   compiler   r/   rangechrr   r   r   rr   rs   r   formatrz   r}   rx   r   r   
NamedTupler%   r;   r   r   r   r   r   r   rq   )is   0r2   <module>r      s  $ #  	   # I  


#45  GG4&R&3Q*QVSV&R	 WW4&R&3Q*QVSV&R
 GG tT""AMM 	A"	  tT""AGG 	A"	  tT""AGG 	A"	  tT""AAA 	A"	" JJ	*
 f+  	& **Tf 	  	  jj56I&JJx ZZ 

4 

7#JJ)*JJt	 jj!DE jj- 4
&## 4
nDN,=^6S2>HK S SsH   	J2J2	J7J79
J<J<0
K>K'
K5K
K,K