+
    irH                       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                      ] 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    )formats   "b/Users/igloo/.openclaw/workspace/scratch/fb_ad_env/lib/python3.14/site-packages/httpx/_urlparse.py__annotate__ParseResult.__annotate__   s     
 
3 
    c                	   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   @:[])joinr
   r   r   selfs   &r   r   ParseResult.authority   s|    ww'+}}}4==/#"$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     
 
 
r   c                	    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"   s   &r   netlocParseResult.netloc   sd    ww$'499$4!DII;a $))#'99#8!DII;
 	
 ?A
 	
r   c                    V ^8  d   QhRRRR/# )r   kwargsr   r   r   r   )r   s   "r   r   r      s     ( (* ( (r   c           
     	    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	   updateurlparse)r#   r*   defaultss   &, r   	copy_withParseResult.copy_with   s\    K dkkDIITZZ
 	'h''r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     

 

 

r   c                	4   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   //?#)r   r!   r   r   r   r	   )r#   r   s   & r   __str__ParseResult.__str__   s    NN	ww%)[[[4;;-q!b$-"YK 2		$(JJ$:!DJJ< '+}}'@!DMM?#
 	
 GI
 	
r   r   N)__name__
__module____qualname____firstlineno____annotations__propertyr   r'   r0   r7   __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   s   "r   r   r      s&     D D# Dj D[ Dr   c           	     b
   \        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isasciiisprintable.0chars   & 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rD   rE   rH   s   & r   rK   rL      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_pathr5   r   r   Nr   r    zURL component 'z
' too longc              3  z   "   T F1  qP                  4       ;'       d    VP                  4       '       * x  K3  	  R # 5irD   rE   rH   s   & r   rK   rL     s+     O<<><<$*:*:*<&<<rM   c              3     "   T F6  qP                  4       '       g   K  VP                  4       '       d   K2  Vx  K8  	  R # 5irD   rE   rH   s   & r   rK   rL     s(      %*TllnDTEUEUEWDDUrO   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   )"rA   r*   rJ   idxerrorr   r'   _rQ   rR   rU   	seperatorr   keyvalue	url_matchurl_dictr   r   r   r   fragauthority_matchauthority_dictr
   parsed_schemeparsed_userinfoparsed_hostparsed_portrY   rZ   parsed_pathparsed_query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   s   "r   r   r   \  s     ,= ,=c ,=c ,=r   c                   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"`{}%|\rS   asciizInvalid IDNA hostname: )IPv4_STYLE_HOSTNAMErn   	ipaddressIPv4AddressAddressValueErrorr   IPv6_STYLE_HOSTNAMEIPv6AddressrF   rd   rq   
SUB_DELIMSidnaencodedecode	IDNAError)r   WHATWG_SAFEs   & r   rs   rs   \  s:   		"	"4	(	(	@!!$' 		"	"4	(	(	@!!$q*- Abz	 !TZZ\
[(@AA={{4::<(//88= ** 	@5dX>??	@ ** 	@5dX>??	@  >> =24(;<<=s#   C+ D 82D; +%D%D8;%E c               $    V ^8  d   QhRRRRRR/# )r   r   zstr | int | Noner   r   r   r   r   )r   s   "r   r   r     s"      ) 3 : r   c           
         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: ftphttphttpsi  wswss)ra   
ValueErrorr   rg   )r   r   port_as_intdefault_ports   &&  r   rt   rt     s~     |trz4$i
 2vr7Cr5#NRRL "  4>$2334s	   ? Ac               (    V ^8  d   QhRRRRRRRR/# )r   r   r   rY   boolrZ   r   Noner   )r   s   "r   r   r     s.     S S S Sd St Sr   c                   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 '/'r4   z3Relative URLs cannot have a path starting with '//'r   z2Relative URLs cannot have a path starting with ':'N)rh   r   )r   rY   rZ   s   &&&r   ru   ru     sq      ,,VWWm ??4  RSS ??3QRR   ,:r   c                    V ^8  d   QhRRRR/# )r   r   r   r   r   )r   s   "r   r   r     s        r   c                   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"
rP   r   z..r   )splitrb   appendr!   )r   
componentsoutput	components   &   r   rv   rv     s     $CJ *Z!7 F	$&RD.

 )v MM)$   88Fr   c                    V ^8  d   QhRRRR/# )r   stringr   r   r   )r   s   "r   r   r     s     H HC HC Hr   c                t    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-8%02X)r!   r   )r   bytes   & r   PERCENTr     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   rT   r   r   )r   s   "r   r   r     s!      C s s r   c                    \         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_CHARACTERSrstripr!   r   )r   rT   NON_ESCAPED_CHARSrJ   s   &&  r   percent_encodedr     s[     .4 ==*++77JPQ&$**	=&Q Qs   Ac               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s!      # S S r   c                   . 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
rS   Nr   )
refinditerPERCENT_ENCODED_REGEXstartendgroupr   r   r[   r!   )
r   rT   partscurrent_positionrn   start_positionend_positionmatched_textleading_texttrailing_texts
   &&        r   rd   rd     s     E2F;',{{}eiik{{1~-!>BLLLAB 	\"' < 3v;&01_]>?775>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   r,   )'__doc__
__future__r   r   r   typingr   _exceptionsr   r\   r   r   compiler   r!   rangechrry   rx   rw   re   rf   rr   r   rm   rp   rk   r   r   
NamedTupler   r.   rs   rt   ru   rv   r   r   rd   )is   0r   <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 	  	  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!