+
     hrH  c                  s   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^RIHt Rt	Rt
Rt]P                  ! R4      tRP                  ]! ^ ^4       U u. uF  q R19  g   K  ]! V 4      NK  	  up 4      tRP                  ]! ^ ^4       U u. uF  q R29  g   K  ]! V 4      NK  	  up 4      tRP                  ]! ^ ^4       U u. uF  p V R39  g   K  ]! V 4      NK  	  up 4      tRP                  ]! ^ ^4       U u. uF  p V R49  g   K  ]! V 4      NK  	  up 4      tRP                  ]! ^ ^4       U u. uF  p V R49  g   K  ]! V 4      NK  	  up 4      tRP                  ]! ^ ^4       U u. uF  p V R59  g   K  ]! V 4      NK  	  up 4      t]P                  ! R	P/                  R
RRRRR7      4      t]P                  ! RP/                  RRRR7      4      tR]P                  ! R
4      R]P                  ! R4      R]P                  ! R4      R]P                  ! R4      R]P                  ! R4      R]P                  ! R4      R]P                  ! R4      R]P                  ! R4      /t]P                  ! R4      t]P                  ! R4      t ! R R ]P:                  4      tR6R! R" lltR# R$ lt R% R& lt!R' R( lt"R) R* lt#R+ R, lt$R- R. lt%R/ R0 lt&R# u up i u up i u up i u up i u up i u up i )7a  
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} 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portr   r   r   r   r   r   z[^@]*r	   z(\[.*\]|[^:]*)r
   z ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$z^\[.*\]$c                  s    ] tR t^t$ R]R&   R]R&   R]R&   R]R&   R]R&   R]R	&   R]R
&   ]R R l4       t]R R l4       tR R ltR R lt	Rt
R# )ParseResultstrr   r   r	   
int | Noner
   r   
str | Noner   r   c                   V ^8  d   QhRR/#    returnr    format   "4/usr/lib/python3.14/site-packages/httpx/_urlparse.py__annotate__ParseResult.__annotate__   s     
 
3 
    c                	s   R P                  V P                  '       d   V P                   R2MR RV P                  9   d   RV P                   R2MV P                  V P                  e   RV P                   2.4      # R .4      # )r   Z@:[])joinr   r	   r
   self   &r   r   ZParseResult.authority   s|    ww'+}}}4==/#"$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
r   c               r   r   r   r   r   r   r   r      s     
 
 
r   c                	s    R P                  RV P                  9   d   RV P                   R2MV P                  V P                  e   RV P                   2.4      # R .4      # )r   r   r   r   )r   r	   r
   r   r!   r   netlocZParseResult.netloc   sd    ww$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
r   c               s     V ^8  d   QhRRRR/# )r   kwargsr   r   r   r   r   r   r   r   r      s     ( (* ( (r   c           
     	s    V'       g   V # R V P                   RV P                  RV P                  RV P                  RV P                  /pVP                  V4       \        R/ VB # )r   r   r   r   r   r   )r   r   r   r   r   Zupdateurlparse)r    r#   Zdefaultss   &, r   	copy_withZParseResult.copy_with   s\    K dkkDIITZZ
 	'h''r   c               r   r   r   r   r   r   r   r      s     

 

 

r   c                	s4   V P                   pR P                  V P                  '       d   V P                   R2MR V'       d   RV 2MR V P                  V P                  e   RV P                   2MR V P
                  e   RV P
                   2.4      # R .4      # )r   r   //?Z#)r   r   r   r   r   r   )r    r      & r   __str__ZParseResult.__str__   s    NN	ww%)[[[4;;-q!b$-"YK 2		$(JJ$:!DJJ< '+}}'@!DMM?#
 	
 GI
 	
r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__annotations__Zpropertyr   r"   r&   r*   Z__static_attributes__r   r   r   r   r      s]    KM
I

I
 
 
 
(

 

r   r   c               $    V ^8  d   QhRRRRRR/# )r   urlr   r#   r   r   r   r   r   r   r   r   r      s&     D D# Dj D[ Dr   c           	     sb
   \        V 4      \        8  d   \        R 4      h\        ;QJ d    R V  4       F  '       g   K   RM	  RM! R V  4       4      '       d9   \	        R V  4       4      pV P                  V4      pRV: RV R2p\        V4      hRV9   d0   VR,          p\        V\        4      '       d   \        V4      MTVR&   R	V9   d6   VP                  R	4      ;'       g    R
pVP                  R4      w  VR&   qqR&   RV9   g   RV9   dk   \        VP                  RR
4      ;'       g    R
\        R7      p\        VP                  RR
4      ;'       g    R
\        R7      p	V	'       d   V RV	 2MTVR&   RV9   dC   VP                  R4      ;'       g    R
p
V
P                  R4      w  VR&   qR&   V'       g   RVR&   RV9   dZ   VP                  R4      ;'       g    R
pRV9   d8   VP                  R4      '       d   VP!                  R4      '       g
   RV R2VR&   VP#                  4        F  w  rVf   K  \        V4      \        8  d   \        RV R24      h\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d<   \	        R V 4       4      pVP                  V4      pRV RV: RV R2p\        V4      h\$        V,          P'                  V4      '       d   K  \        RV R24      h	  \(        P+                  V 4      pVf   Q hVP-                  4       pVP                  R VR ,          4      ;'       g    R
pVP                  R!VR!,          4      ;'       g    R
pVP                  RVR,          4      ;'       g    R
pVP                  RVR,          4      pVP                  R"VR",          4      p\.        P+                  V4      pVf   Q hVP-                  4       pVP                  RVR,          4      ;'       g    R
pVP                  RVR,          4      ;'       g    R
pVP                  RVR,          4      pVP1                  4       p\        V\2        R7      p\5        V4      p\7        VV4      pVR
8g  pVR
8g  ;'       g    VR
8g  ;'       g    VRJp\9        VVVR#7       V'       g	   V'       d   \;        V4      p\        V\<        R7      pVf   RM\        V\>        R7      p Vf   RM\        V\@        R7      p!\C        VVVVVV V!4      # )$zURL too longc              3  z   "   T F1  qP                  4       ;'       d    VP                  4       '       * x  K3  	  R # 5iNisasciiZisprintableZ.0charr)   r   	<genexpr>urlparse.<locals>.<genexpr>   s+     
E<<>44$"2"2"444   ;;TFc              3     "   T F6  qP                  4       '       g   K  VP                  4       '       d   K2  Vx  K8  	  R # 5ir.   r/   r1   r)   r   r3   r4      s%     VSTLLND4CSCSCUDDS   A A 
A z.Invalid non-printable ASCII character in URL, z at position .r
   r"   r   r   r	   usernamepasswordsafer   raw_pathr(   r   r   Nr   r   zURL component 'z
' too longc              3  r-   r.   r/   r1   r)   r   r3   r4     s+     O<<><<$*:*:*<&<<r5   c              3  r6   r.   r/   r1   r)   r   r3   r4     s(      %*TllnDTEUEUEWDDUr7   z-Invalid non-printable ASCII character in URL z component, zInvalid URL component 'Z'r   r   r   )
has_schemehas_authority)"lenMAX_URL_LENGTHr   ZanyZnextZfindZ
isinstanceintr   popZ	partitionquoteUSERNAME_SAFEPASSWORD_SAFEget
startswithZendswithZitemsCOMPONENT_REGEXZ	fullmatch	URL_REGEXmatchZ	groupdictAUTHORITY_REGEXlowerUSERINFO_SAFEencode_hostnormalize_portvalidate_pathnormalize_path	PATH_SAFE
QUERY_SAFE	FRAG_SAFEr   )"r,   r#   r2   ZidxZerrorr
   r"   Z_r9   r:   r=   Z	seperatorr	   ZkeyZvalueZ	url_matchZurl_dictr   r   r   r   ZfragZauthority_matchZauthority_dictr   Zparsed_schemeZparsed_userinfoZparsed_hostZparsed_portr>   r?   Zparsed_pathZparsed_queryZparsed_frags"   &,                                r   r%   r%      s   
 3x. (( s
E
Esss
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99rNJ39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 sOOsss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D"I::fhv./552DJJw 12E::j(:"67D &++I6O&&&$..0N zz*nZ&@AGGRH::fnV45;;D::fnV45D
  M >O"4(K,T6:K"$J2MM!2MMk6M  $:]K]d#T	2K',}t%J:WL&*ldd8SK  r   c                    V ^8  d   QhRRRR/# )r   r	   r   r   r   r   r   r   r   r   \  s     ,= ,=c ,=c ,=r   c                s   V '       g   R # \         P                  V 4      '       d    \        P                  ! V 4       V # \        P                  V 4      '       d     \        P                  ! V ^R 4       T ^R # V P                  4       '       d)   Rp\        V P                  4       \        V,           R7      #  \        P                  ! V P                  4       4      P                  R4      #   \        P                   d    \        RT : 24      hi ; i  \        P                   d    \        RT : 24      hi ; i  \        P                   d    \        RT : 24      hi ; i)r   zInvalid IPv4 address: zInvalid IPv6 address: z"`{}%|\r;   ZasciizInvalid IDNA hostname: i)IPv4_STYLE_HOSTNAMErK   	ipaddressZIPv4AddressZAddressValueErrorr   IPv6_STYLE_HOSTNAMEZIPv6Addressr0   rD   rM   
SUB_DELIMSidnaencodeZdecodeZ	IDNAError)r	   ZWHATWG_SAFEr)   r   rO   rO   \  s:   		"	"4	(	(	@!!$' 		"	"4	(	(	@!!$q*- Abz	 !TZZ\
[(@AA={{4::<(//88= ** 	@5dX>??	@ ** 	@5dX>??	@  >> =24(;<<=s#   C+ D 82D; +%D%D8;%E c               r+   )r   r
   zstr | int | Noner   r   r   r   r   r   r   r   r   r     s"      ) 3 : r   c           
     s    V e   V R8X  d   R #  \        V 4      pR^R^PRRR^PRR/P                  T4      pY#8X  d   R # T#   \         d    \        RT : 24      hi ; i)	Nr   zInvalid port: ZftpZhttpZhttpsi  ZwsZwss)rB   Z
ValueErrorr   rG   )r
   r   Zport_as_intZdefault_port   &&  r   rP   rP     s~     |trz4$i
 2vr7Cr5#NRRL "  4>$2334s	   ? Ac               s(    V ^8  d   QhRRRRRRRR/# )r   r   r   r>   Zboolr?   r   ZNoner   r   r   r   r   r     s.     S S S Sd St Sr   c                s   V'       d+   V '       d#   V P                  R4      '       g   \        R4      hV'       gQ   V'       gG   V P                  R4      '       d   \        R4      hV P                  R4      '       d   \        R4      hR# R# R# )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 '/'r'   z3Relative URLs cannot have a path starting with '//'r   z2Relative URLs cannot have a path starting with ':'N)rH   r   )r   r>   r?   s   &&&r   rQ   rQ     sq      ,,VWWm ??4  RSS ??3QRR   ,:r   c               rV   )r   r   r   r   r   r   r   r   r   r     s        r   c                s   RV 9  d   V # V P                  R4      pRV9  d
   RV9  d   V # . pV FJ  pVR8X  d   K  VR8X  d'   V'       d   VR.8w  d   VP                  4        K5  K7  K9  VP                  V4       KL  	  RP                  V4      # )zx
Drop "." and ".." segments from a URL path.

For example:

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

 )v MM)$   88Fr   c               rV   )r   stringr   r   r   r   r   r   r   r     s     H HC HC Hr   c                st    R P                  V P                  R4       Uu. uF	  pRVR 2NK  	  up4      # u upi )r   zutf-8Z%Z02X)r   r\   )r`   Zbyter)   r   PERCENTra     s6    77v}}W/EF/EtaSzN/EFGGFs   5c               $    V ^8  d   QhRRRRRR/# r   r`   r   r<   r   r   r   r   r   r   r     s!      C s s r   c                s    \         V,           pV P                  V4      '       g   V # RP                  V  Uu. uF  q3V9   d   TM
\        V4      NK  	  up4      # u upi )z)
Use percent-encoding to quote a string.
r   )UNRESERVED_CHARACTERSZrstripr   ra   )r`   r<   ZNON_ESCAPED_CHARSr2   r]   r   percent_encodedre     s[     .4 ==*++77JPQ&$**	=&Q Qs   Ac               rb   rc   r   r   r   r   r   r     s!      # S S r   c                s   . p^ p\         P                  ! \        V 4       Fk  pVP                  4       VP	                  4       reVP                  ^ 4      pWS8w  d    WV pVP                  \        WR7      4       VP                  V4       TpKm  	  V\        V 4      8w  d    WR p	VP                  \        WR7      4       RP                  V4      # )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;   Nr   )
reZfinditerPERCENT_ENCODED_REGEXZstartZendZgroupr_   re   r@   r   )
r`   r<   ZpartsZcurrent_positionrK   Zstart_positionZend_positionZmatched_textZleading_textZtrailing_texts
   &&        r   rD   rD     s     E2F;',{{}eiik{{1~-!>BLLLAB 	\"' < 3v;&01_]>?775>r   )    "   <   >   `   )rh   ri   #   rj   rk   )	rh   ri   rm   rj   rk   ?   rl   {   }   )rh   ri   rm   rj   rk   rn   rl   ro   rp   /   i:   ;   =   @   [   \   ]   ^   |   )rh   ri   rm   rj   rk   rn   rl   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   r$   )'Z__doc__Z
__future__r    rX   rf   Ztypingr[   Z_exceptionsr   rA   rd   rZ   Zcompilerg   r   ZrangeZchrrU   rT   rS   rE   rF   rN   r   rJ   rL   rI   rW   rY   Z
NamedTupler   r%   rO   rP   rQ   rR   ra   re   rD   )Zis   0r   <module>rz      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 	  	  bjj56I&
BJJx RZZ 

4 

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