+
    	i?                        ^ RI Ht R.t0 R.mtR/R ltR0R ltR tR tR tR	 t	R
 t
R0R lt ! R R]4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      t ! R  R!4      t ! R" R#4      t ! R$ R%4      t ! R& R'4      t ! R( R)4      t ! R* R+4      t ! R, R-4      tR# )1    )parse_component_value_listparseNc              #    "   \        V \        4      '       d   \        V 4      p \        V 4      pT;'       g    / p \	        WAV4      x   TP                  4       pTf   R# TR8X  d    \	        YAT4      x  K/  T'       d   K9  \        TRTP                   R24      h  \
         d   pT'       d    Rp?R# ThRp?ii ; i  \
         d   pT'       g   Th Rp?K  Rp?ii ; i5i)z~Yield tinycss2 selectors found in given ``input``.

:param input:
    A string, or an iterable of tinycss2 component values.

N,unexpected  token.)
isinstancestrr   TokenStreamparse_selectorSelectorErrornexttype)input
namespaces	forgivingrelativetokens	exceptionr   s   &&&&   W/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cssselect2/parser.pyr   r      s      %*51F!!rJV::
 {{}<S[$$VBB
 9#DK		{'*JKK!   ! $ #O !$si   5C#C#B 
C#)C  7C#C#B=(B80C#6B88B==C# C 
CC#C  C#c                 z   V P                  4        V'       dG   V P                  4       pVR9   d   VP                  pV P                  4        MRpV P                  4        \	        W4      w  rV V P                  4       pV P                  4       '       d   V P                  4       ;'       g    TpK2  \        WV4      pV'       d   \        XV4      pVe   V# V P                  4       pVe   VR8X  d   V# VR9   d   VP                  p	V P                  4        MV'       d   Rp	MV# \	        W4      w  r\        WYV
4      pK  )> r   )r   +~)
skip_whitespace_and_commentpeekvaluer   parse_compound_selectorskip_whitespaceskip_commentSelectorRelativeSelectorCombinedSelector)r   r   r   r   initial_combinatorresultpseudo_elementhas_whitespaceselector
combinatorcompounds   &&&        r   r   r   1   s   
&&({{}?"!%KKM!$**,4VHF
//1!!###335GGNF3'(:HEH%O{{}<43;O_$JKKMJO#:6#N !&h?    c                     \        W4      pVe   TM. p \        W4      w  rEVf   Vf   MVP                  V4       K*  V'       g	   W%3R8w  d   \        V4      V3# V P	                  4       pV'       d   VP
                  MRp\        VRV 24      h)NEOFz"expected a compound selector, got NN)parse_type_selectorparse_simple_selectorappendCompoundSelectorr   r   r   )r   r   type_selectorssimple_selectorssimple_selectorr'   r   	peek_types   &&      r   r   r   S   s    (<N)7)C~
*?+ '%)@0N;|K 01>AA;;=D!		uI
 B9+N
OOr,   c                     V P                  4        \        W4      pVf   R # . pVw  rEVe   VP                  \        V4      4       Ve   VP                  \	        V4      4       V# N)r    parse_qualified_namer2   LocalNameSelectorNamespaceSelector)r   r   qualified_namer5   	namespace
local_names   &&    r   r0   r0   e   si    
)&=N*I 1* => 1) <=r,   c                 X   V P                  4       pVf   R# VP                  R8X  d:   VP                  '       d(   V P                  4        \	        VP
                  4      R 3# VR8X  d\   V P                  4        V P                  4       pVe   VP                  R8w  d   \        VRV 24      h\        VP
                  4      R 3# VP                  R8X  d4   V P                  4        \        \        VP                  4      V4      pVR 3# VR8X  Ed   V P                  4        V P                  4       pVR8X  d_   V P                  4       pVe   VP                  R8w  d   \        VRV 24      hVP                  pV\        9  d   \        VRV 24      hR V3# Ve6   VP                  R8X  d%   VP                  pVR9   d   R V3# \        V4      R 3# VeJ   VP                  R	8X  d9   VP                  pVR9   d   \        W1V4      R 3# \!        WcP"                  4      R 3# \        VR
V R24      hR# )Nhash.identzExpected a class name, got z[] block:z$Expected a pseudo-element name, got z)Expected a supported pseudo-element, got functionr   r   r/   )beforeafter
first-linefirst-letter)iswherenothas)r   r   is_identifierr   
IDSelectorr   r   ClassSelectorparse_attribute_selectorr   contentlower_valueSUPPORTED_PSEUDO_ELEMENTSPseudoClassSelector
lower_nameparse_logical_combinationFunctionalPseudoClassSelector	arguments)r   r   r   r   attrr   names   &&     r   r1   r1   t   s   ;;=D|yyFt111$**%t++	{{}<499/(CD6&JKKTZZ($..	j	 'DLL(A:NTz	{{}3;;;=D|tyyG3#D,PQUPV*WXX$$E55#EeWMO O;$))w"6##DHHTz!*40$66$))z"9??D4404H$NN5dNNKTRRD6&ABBr,   c                    R pRpVR8X  d   \         pM-VR8X  d   \        pMVR8X  d
   Rp\        pMVR8X  d	   R p\        p\	        V P
                  WV4       Uu. uF  pVP                  e   K  VNK  	  ppX! V4      # u upi )TFrJ   rK   rL   rM   )MatchesAnySelectorSpecificityAdjustmentSelectorNegationSelectorRelationalSelectorr   rY   r'   )matches_any_tokenr   r[   r   r   selector_classr)   	selectorss   &&&     r   rW   rW      s    IHt|+	6		)	+ 	)):(K,K "" 	K  , )$$	,s   A>.A>c                 j   V P                  4        \        WR R7      pVf    V P                  4       p\        VRV 24      hVw  rEV P                  4        V P	                  4       pVf   RpRpMVR9   d   VP
                  pV P                  4        V P                  4        V P                  4       pVe   VP                  R9  d"   Vf   RMVP                  p	\        VRV	 24      hVP
                  pM\        VRV 24      hV P                  4        V P                  4       pRp
Ve   VP                  R8X  d#   VP
                  P                  4       R8X  d   R	p
MLVP                  R8X  d#   VP
                  P                  4       R
8X  d   R p
M\        VRVP                   24      h\        WEWxV
4      # )T)is_attributeNzexpected attribute name, got rC   Nonezexpected attribute value, got z*expected attribute selector operator, got iFszexpected ], got )=z~=z|=z^=z$=z*=)rC   string)	r    r:   r   r   r   r   r   lowerAttributeSelector)r   r   r=   r   r>   r?   r   operatorr   	next_typecase_sensitives   &&         r   rQ   rQ      s   
)&4PN{{}D$A$"HII*I
;;=D|	4	4:: {{}<499,??"&,DIII(Fyk&RSS

D$Ntf"UVV
;;=DN99DJJ$4$4$6#$="NYY'!djj&6&6&8C&?!N(8&DEEYH^TTr,   c                   V P                  4       pVf   R# VP                  R8X  d   V P                  4       pV P                  4       pVR8w  d6   V'       d   RMVP                  RR4      pWTP                  VP
                  33# V P                  4        VP                  VP                  4      pVf   \        VRVP                   24      hMVR8X  dp   V P                  4       pV P                  4       pVR8w  d6   V'       d   \        VRVP                   24      hVP                  RR4      R3# V P                  4        RpMVR8X  d   V P                  4        RpMR# V P                  4       pVP                  R8X  d   WVP                  VP
                  33# VR8X  d   V'       g   VR3# \        VRVP                   24      h)zReturn ``(namespace, local)`` for given tokens.

Can also return ``None`` for a wildcard.

The empty string for ``namespace`` means "no namespace".

NrC   | zundefined namespace prefix: *zexpected local name, got )r   r   r   getr   rS   r   )r   r   re   r   first_identr>   r   s   &&&    r   r:   r:      s    ;;=D|yyGkkm{{}3;*
tT0JI00+2I2IJJJNN;#4#45	;K<M<M;NOQ Q  
{{}{{}3;#D,Edii[*QRR>>$-t33			 ;;=DyyG::t'7'7888	\$D$=dii["IJJr,   c                       ] tR tRtRtRtR# )r   i  z3A specialized ``ValueError`` for invalid selectors. N)__name__
__module____qualname____firstlineno____doc____static_attributes__rw   r,   r   r   r     s    =r,   r   c                   J   a  ] tR tRt o R tR tR tR tR tR t	R t
R	tV tR
# )r   i  c                4    \        V4      V n        . V n        R # r9   )iterr   peeked)selfr   s   &&r   __init__TokenStream.__init__  s    6lr,   c                    V P                   '       d   V P                   P                  4       # \        V P                  R 4      # r9   )r   popr   r   r   s   &r   r   TokenStream.next  s-    ;;;;;??$$T**r,   c                    V P                   '       g0   V P                   P                  \        V P                  R 4      4       V P                   R,          # )N)r   r2   r   r   r   s   &r   r   TokenStream.peek  s6    {{{KKtDKK67{{2r,   c                    R p V P                  4       pVe   VP                  V9  d    V# V P                  4        RpK=  )FT)r   r   r   )r   
skip_typesfoundr   s   &&  r   skipTokenStream.skip!  s?    99;D|tyy
:  IIKEr,   c                &    V P                  R .4      # )
whitespacer   r   s   &r   r    TokenStream.skip_whitespace+  s    yy,((r,   c                &    V P                  R .4      # )commentr   r   s   &r   r!   TokenStream.skip_comment.  s    yy)%%r,   c                (    V P                  R R.4      # )r   r   r   r   s   &r   r   'TokenStream.skip_whitespace_and_comment1  s    yy)\233r,   )r   r   N)rx   ry   rz   r{   r   r   r   r   r    r!   r   r}   __classdictcell____classdict__s   @r   r   r     s-     +
)&4 4r,   r   c                   0   a  ] tR tRt o RR ltR tRtV tR# )r"   i5  Nc                    Wn         W n        Vf   VP                  V n        R # VP                  w  r4pW4V^,           3V n        R # r9   parsed_treer'   specificity)r   treer'   abcs   &&&   r   r   Selector.__init__6  sA    ,!#//D&&GA! QU{Dr,   c                j    V P                   '       d   R V P                    2MRpV P                  : V 2# )z::rr   )r'   r   )r   pseudos   & r   __repr__Selector.__repr__@  s8    /3/B/B/B2d))*+""%fX..r,   r   r9   )rx   ry   rz   r{   r   r   r}   r   r   s   @r   r"   r"   5  s     +/ /r,   r"   c                   L   a  ] tR tRt o R t]R 4       t]R 4       tR tRt	V t
R# )r#   iE  c                    Wn         W n        R # r9   r*   r)   )r   r*   r)   s   &&&r   r   RelativeSelector.__init__F  s    $ r,   c                .    V P                   P                  # r9   )r)   r   r   s   &r   r   RelativeSelector.specificityJ  s    }}(((r,   c                .    V P                   P                  # r9   )r)   r'   r   s   &r   r'   RelativeSelector.pseudo_elementN  s    }}+++r,   c                x    V P                   R 8X  d   V P                  : # V P                    R V P                  : 2# )r   r   r   s   &r   r   RelativeSelector.__repr__R  s9    $(OOs$:t}}	9OO$Admm%67	9r,   r   N)rx   ry   rz   r{   r   propertyr   r'   r   r}   r   r   s   @r   r#   r#   E  s<     ! ) ) , ,9 9r,   r#   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r$   iX  c                *    Wn         W n        W0n        R # r9   leftr*   right)r   r   r*   r   s   &&&&r   r   CombinedSelector.__init__Y  s    	$
r,   c                    V P                   P                  w  rpV P                  P                  w  rEpW,           W%,           W6,           3# r9   )r   r   r   )r   a1b1c1a2b2c2s   &      r   r   CombinedSelector.specificitya  s;    YY**
ZZ++
w((r,   c                R    V P                   : V P                   V P                  : 2# r9   r   r   s   &r   r   CombinedSelector.__repr__g  s"    ))t/

~>>r,   )r*   r   r   N
rx   ry   rz   r{   r   r   r   r   r}   r   r   s   @r   r$   r$   X  s(      ) )
? ?r,   r$   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r3   ik  c                    Wn         R # r9   r5   )r   r5   s   &&r   r   CompoundSelector.__init__l  s     0r,   c           	         V P                   '       d2   \        \        \        \	        R  V P                    4       !  4      4      # R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir9   r   .0sels   & r   	<genexpr>/CompoundSelector.specificity.<locals>.<genexpr>u  s     C-Bc//-B   r   r   r   )r5   tuplemapsumzipr   s   &r   r   CompoundSelector.specificityo  sF        S#CT-B-BC#E F G G Nr,   c                T    R P                  \        \        V P                  4      4      # )rr   )joinr   reprr5   r   s   &r   r   CompoundSelector.__repr__y  s    wws4!6!6788r,   r   Nr   r   s   @r   r3   r3   k  s(     1  9 9r,   r3   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r;   i}  c                $    Vw  V n         V n        R # r9   r?   lower_local_name)r   r?   s   &&r   r   LocalNameSelector.__init__  s    1;..r,   c                    V P                   # r9   )r?   r   s   &r   r   LocalNameSelector.__repr__  s    r,   r   N)r   r      	rx   ry   rz   r{   r   r   r   r}   r   r   s   @r   r;   r;   }  s     K< r,   r;   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r<   i  c                    Wn         R # r9   r>   )r   r>   s   &&r   r   NamespaceSelector.__init__  s	     #r,   c                H    V P                   R 8X  d   R# RV P                    R2# )rr   rq   {z}|r   r   s   &r   r   NamespaceSelector.__repr__  s&    nn*sH"T^^4DC0HHr,   r   Nr   r   r   s   @r   r<   r<     s     K#
I Ir,   r<   c                   0   a  ] tR tRt o RtR tR tRtV tR# )rO   i  c                    Wn         R # r9   rC   )r   rC   s   &&r   r   IDSelector.__init__  s    
r,   c                     R V P                    2# )#r   r   s   &r   r   IDSelector.__repr__  s    4::,r,   r   N)r   r   r   r   r   s   @r   rO   rO     s     K   r,   rO   c                   0   a  ] tR tRt o RtR tR tRtV tR# )rP   i  c                    Wn         R # r9   
class_name)r   r   s   &&r   r   ClassSelector.__init__  s    $r,   c                     R V P                    2# )rB   r   r   s   &r   r   ClassSelector.__repr__  s    4??#$$r,   r   Nr   r   r   r   r   s   @r   rP   rP     s     K%% %r,   rP   c                   0   a  ] tR tRt o RtR tR tRtV tR# )rl   i  c                T    Wn         Vw  V n        V n        W0n        W@n        WPn        R # r9   )r>   r[   rV   rm   r   ro   )r   r>   r[   rm   r   ro   s   &&&&&&r   r   AttributeSelector.__init__  s'    "%)"	4? 
 -r,   c                    V P                   f   RMRV P                    R2pV P                  f   RMRV P                  '       d   RMR 2pRV V P                   V P                   V P                  : V R	2# )
Nz*|r   }rr   r   rh   rg   [])r>   ro   r[   rm   r   )r   r>   ro   s   &  r   r   AttributeSelector.__repr__  s~     NN2D"T^^<LB8O	%%-Bt***45 	 	{499+dmm_TZZNa!	"r,   )ro   rV   r[   r>   rm   r   Nr   r   r   s   @r   rl   rl     s     K	-" "r,   rl   c                   0   a  ] tR tRt o RtR tR tRtV tR# )rU   i  c                    Wn         R # r9   r[   )r   r[   s   &&r   r   PseudoClassSelector.__init__  s    	r,   c                (    R V P                   ,           # rD   r  r   s   &r   r   PseudoClassSelector.__repr__  s    TYYr,   r  Nr   r   r   s   @r   rU   rU     s     K r,   rU   c                   0   a  ] tR tRt o RtR tR tRtV tR# )rX   i  c                    Wn         W n        R # r9   )r[   rY   )r   r[   rY   s   &&&r   r   &FunctionalPseudoClassSelector.__init__  s    	"r,   c                L    R V P                    \        V P                  4      : 2# r
  )r[   r   rY   r   s   &r   r   &FunctionalPseudoClassSelector.__repr__  s!    499+eDNN3677r,   )rY   r[   Nr   r   r   s   @r   rX   rX     s     K#8 8r,   rX   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r_   i  c                    Wn         R # r9   selector_listr   r  s   &&r   r   NegationSelector.__init__      *r,   c                b    V P                   '       d   \        R  V P                    4       4      # R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir9   r   r   r)   s   & r   r   /NegationSelector.specificity.<locals>.<genexpr>       O<N++<Nr   r   r  maxr   s   &r   r   NegationSelector.specificity  +    OD<N<NOOOr,   c                N    R RP                  R V P                   4       4       R2# )z:not(, c              3   8   "   T F  p\        V4      x  K  	  R # 5ir9   r   r   s   & r   r   ,NegationSelector.__repr__.<locals>.<genexpr>        I6Hsc6Hr   )r   r  r   s   &r   r   NegationSelector.__repr__  '    tyy Id6H6H IIJ!LLr,   r  Nr   r   s   @r   r_   r_     *     +  M Mr,   r_   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r`   i  c                    Wn         R # r9   r  r  s   &&r   r   RelationalSelector.__init__  r  r,   c                b    V P                   '       d   \        R  V P                    4       4      # R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir9   r   r  s   & r   r   1RelationalSelector.specificity.<locals>.<genexpr>  r  r   r   r  r   s   &r   r   RelationalSelector.specificity  r   r,   c                N    R RP                  R V P                   4       4       R2# )z:has(r"  c              3   8   "   T F  p\        V4      x  K  	  R # 5ir9   r$  r   s   & r   r   .RelationalSelector.__repr__.<locals>.<genexpr>  r&  r   r'  r(  r   s   &r   r   RelationalSelector.__repr__  r*  r,   r  Nr   r   s   @r   r`   r`     r+  r,   r`   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r]   i  c                    Wn         R # r9   r  r  s   &&r   r   MatchesAnySelector.__init__  r  r,   c                b    V P                   '       d   \        R  V P                    4       4      # R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir9   r   r  s   & r   r   1MatchesAnySelector.specificity.<locals>.<genexpr>  r  r   r   r  r   s   &r   r   MatchesAnySelector.specificity  r   r,   c                N    R RP                  R V P                   4       4       R2# )z:is(r"  c              3   8   "   T F  p\        V4      x  K  	  R # 5ir9   r$  r   s   & r   r   .MatchesAnySelector.__repr__.<locals>.<genexpr>  s     H5GcS		5Gr   r'  r(  r   s   &r   r   MatchesAnySelector.__repr__  s'    diiHT5G5GHHIKKr,   r  Nr   r   s   @r   r]   r]     s*     +  L Lr,   r]   c                   <   a  ] tR tRt o R t]R 4       tR tRtV t	R# )r^   i  c                    Wn         R # r9   r  r  s   &&r   r   &SpecificityAdjustmentSelector.__init__  r  r,   c                    R# )r   r   rw   r   s   &r   r   )SpecificityAdjustmentSelector.specificity  s    r,   c                N    R RP                  R V P                   4       4       R2# )z:where(r"  c              3   8   "   T F  p\        V4      x  K  	  R # 5ir9   r$  r   s   & r   r   9SpecificityAdjustmentSelector.__repr__.<locals>.<genexpr>
  s     "K8J4998Jr   r'  r(  r   s   &r   r   &SpecificityAdjustmentSelector.__repr__	  s'    "K8J8J"KKLANNr,   r  Nr   r   s   @r   r^   r^     s*     +  O Or,   r^   >   rG   rF   markerprefixshadowrR   postfix	selectionplaceholderrH   target-textrI   footnote-callgrammar-errorspelling-errorfootnote-markerfile-selector-button)NFF)F)tinycss2r   __all__rT   r   r   r   r0   r1   rW   rQ   r:   
ValueErrorr   r   r"   r#   r$   r3   r;   r<   rO   rP   rl   rU   rX   r_   r`   r]   r^   rw   r,   r   <module>rZ     s    /)	 L@@DP$,^%*#UL,K^>J >!4 !4H/ / 9 9&? ?&9 9$ 	I 	I   % %" "0 8 8M MM ML L	O 	Or,   