+
     h'  c                   s   R t . ROt^ RIt^ RIHtHt  ^ RIHtHtH	t	H
t
HtHtHt ]]3tRR ltRR ltRR ltR t]P(                  ! R	]P*                  4      P,                  t ! R
 R4      tR tR t ^ RIHt ]P(                  ! R4      P<                  t ]  R t#R#   ] d    ^ RIHtHtH	t	H
t
HtHt ]t Li ; i  ] d
    ^ RIHt  LRi ; i  ]! d    ]"t  LBi ; i)z5External interface to the BeautifulSoup HTML parser.
N)etreehtml)BeautifulSoupTagCommentProcessingInstructionNavigableStringDeclarationDoctype)r   r   r   r   r   r   c                s    \        WV3/ VB # )a  Parse a string of HTML data into an Element tree using the
BeautifulSoup parser.

Returns the root ``<html>`` Element of the tree.

You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword.  By default, the standard
``BeautifulSoup`` class and the default factory of `lxml.html` are
used.
)_parse)Zdatabeautifulsoupmakeelementbsargss   &&&,;/usr/lib64/python3.14/site-packages/lxml/html/soupparser.py
fromstringr      s     ${=f==    c                s    \        V R4      '       g   \        V 4      p \        WV3/ VB p\        P                  ! V4      # )aA  Parse a file into an ElemenTree using the BeautifulSoup parser.

You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword.  By default, the standard
``BeautifulSoup`` class and the default factory of `lxml.html` are
used.
Zread)hasattrZopenr	   r    ZElementTree)Zfiler
   r   r   roots   &&&, r   parser   $   s<     4  Dz${=f=DT""r   c                sp    \        W4      pVP                  4       pV F  pVP                  V4       K  	  V# )zConvert a BeautifulSoup tree to a list of Element trees.

Returns a list instead of a single root Element to support
HTML-like soup with more than one root element.

You can pass a different Element factory through the `makeelement`
keyword.
)_convert_treeZgetchildrenZremove)beautiful_soup_treer   r   Zchildrenchilds   &&   r   convert_treer   3   s8     ,:D!HE Or   c                 s*   Vf   \         p\        VR4      '       d   RV9  d   RVR&   \        VR4      '       d   RV9  d   RVR&   V! V 3/ VB p\        WB4      p\        V4      ^8X  d"   V^ ,          P                  R8X  d
   V^ ,          # RVn        V# )NZHTML_ENTITIESZconvertEntitiesr   ZDEFAULT_BUILDER_FEATURESZfeatureszhtml.parser)r   r   r   lenZtag)Zsourcer
   r   r   Ztreer   s   &&&,  r   r	   r	   E   s    %}o..F*(.F$%}899V#!.F:*6*D+D
4yA~$q'++/AwDHKr   z`(?:\s|[<!])*DOCTYPE\s*HTML(?:\s+PUBLIC)?(?:\s+(\'[^\']*\'|"[^"]*"))?(?:\s+(\'[^\']*\'|"[^"]*"))?c                   s,   a  ] tR t^^t o R tR tRtV tR# )
_PseudoTagc                s.    R V n         . V n        Wn        R# )r   N)nameattrscontents)selfr      &&r   __init__Z_PseudoTag.__init__`   s    	
 r   c                s6    V P                   P                  4       # N)r   __iter__)r      &r   r    Z_PseudoTag.__iter__e   s    }}%%''r   )r   r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__r   r    Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   ^   s     !
( (r   r   c                 s   Vf   \         P                  P                  pR ;r#R ;rE\        V 4       F  w  rg\	        V\
        4      '       dH   Vf   TpTpVf:   VP                  '       d&   VP                  P                  4       R8X  d   TpK\  K^  K`  Kb  Ve   Kh  \	        V\        4      '       g   K  TpK  	  Vf   . ;rV P                  p
M:V P                  R V pV P                  W#^,            p
V P                  V^,           R  p	Ve>   V
P                  V4      pV
R V VP                  ,           W^,           R  ,           Vn	        M\        V
4      p\        V4      pV! V4      pTp\        V4       F$  pV! V4      pVf   K  VP                  V4       TpK&  	  TpV	 F$  pV! V4      pVf   K  VP                  V4       TpK&  	  Ve}    VP!                  4       p\'        V4      pV'       g    V# VP)                  4       w  ppVP+                  4       P,                  pT;'       d    V^R Vn        T;'       d    V^R Vn        V#   \"         d    TP$                  p Li ; i)Nr   )r   Zhtml_parserr   Z	enumerate
isinstancer   r   Zlower_DECLARATION_OR_DOCTYPEr   Zindexr   _init_node_convertersZreversedZaddpreviousZaddnextZoutput_readyZAttributeErrorstring_parse_doctype_declarationZgroupsZgetroottreedocinfoZ	public_idZ
system_url)r   r   Zfirst_element_idxZlast_element_idxZ	html_rootZdeclarationZiZeZpre_rootZ	post_rootZrootsconvert_nodeZres_rootZprevZ	convertedZdoctype_stringmatchZexternal_idZsys_urir(   s   &&                  r   r   r   i   sr   &&22 ,0/""I-.a ($%!  QVVV&0H	 1IV  Z3J%K%KK /  !!#,,&//0B1BC#,,->PQ?QR'001A!1C1DE	 KK	""2AY););;eaCDkI	 u%	(5L I&HDh O	 Y'D	   D O	 LL#D	  	0(557N +>:  O $)<<> K**,44G + A AAb0AG!(!:!:WQr]GO  	0(//N	0s   	I I I c                 s  a aaaa	a
a / o. oVV3R  lpVV3R lo	R	VV	3R lloR o
R oV! \         \        4      VVV V
3R l4       pV! \        4      R 4       pV! \        4      R 4       pV! \        4      V3R l4       pS# )
c                  s   <a  VVV 3R  lpV# )c                 sF   < S F  pV SV&   SP                  V4       K  	  V # r   )append)handlert
convertersordered_node_typestypess   & r   addZ5_init_node_converters.<locals>.converter.<locals>.add   s+     '
1"))!,  Nr    )r0   r1   r.   r/   s   j r   	converterZ(_init_node_converters.<locals>.converter   s    	
 
r   c                 sR   < S F  p\        W4      '       g   K  SV,          u # 	  R # r   )r#   )Znoder-   r.   r/   s   & r   find_best_converterZ2_init_node_converters.<locals>.find_best_converter   s'    #A$""!!}$ $ r   c                 s   <  S\        V 4      ,          pVf   R # V! W4      #   \         d    S! T 4      ;pS\        T 4      &    L1i ; ir   )typeKeyError)bs_nodeparentr,   r.   r4   s   && r   r)   Z+_init_node_converters.<locals>.convert_node   sW    	O g/G ?w''	  	O2Eg2NNGjg/	Os   # !AAc                 s   \        V \        4      '       dR   / pV P                  4        F9  w  r#\        V\        4      '       d   R P	                  V4      p\        V4      W&   K;  	  V# V  UUu/ uF  w  r#V\        V4      bK  	  pppV# u uppi ) )r#   ZdictZitemsZlistZjoinunescape)Zbs_attrsattribsZkZvs   &   r   	map_attrsZ(_init_node_converters.<locals>.map_attrs   s}    h%%G (a&&A%a[
 )  3;;($!q(1+~(G; <s   -B	c                 s    \        V 4      ^ 8X  d%   V P                  ;'       g    RV,           V n        R# V R,          P                  ;'       g    RV,           V R,          n        R# )i     Nr"   )r   textZtail)r8   r>   r   r   append_textZ*_init_node_converters.<locals>.append_text   sF    v;!!;;,,"4FK%bz44"<F2JOr   c                 sd  < V P                   pVe6   V'       d	   S
! V4      MR p\        P                  ! WP                  VR7      pM&V'       d	   S
! V4      M/ pS	! V P                  VR7      pV  F"  p S\	        V4      ,          pVe	   V! WT4       K$  	  V#   \
         d     Mi ; iS! YT4       KC  )N)Zattrib)r   r    Z
SubElementr   r5   r6   )r7   r8   r   r;   resr   r,   r)   r.   r   r<   s   &&     r   convert_tagZ*_init_node_converters.<locals>.convert_tag   s    */i&TG""6<<HC*/i&RGgll7;CE$T%[1 &E'  
   $s   3BB%$B%c                 s\    \         P                  ! V 4      pVe   VP                  V4       V# r   )r   ZHtmlCommentr+   r7   r8   r@      && r   convert_commentZ._init_node_converters.<locals>.convert_comment  s)    w'MM#
r   c                 s    V P                  R 4      '       d   V RR p \        P                  ! V P                  R^4      !  pVe   VP	                  V4       V# )Z?Nr9   r"   )Zendswithr    r   Zsplitr+   rB   rC   r   
convert_piZ)_init_node_converters.<locals>.convert_pi  sR    C   crlG))7==a+@AMM#
r   c                 s4   < Ve   S! V\        V 4      4       R # r   )r:   )r7   r8   r?   s   &&r   convert_textZ+_init_node_converters.<locals>.convert_text  s     12r   r   )r   r   r   r   r   )r   r3   rA   rD   rE   rF   r?   r)   r.   r4   r<   r/   s   f     @@@@@@r   r%   r%      s    J( (	= sJ  , w  $% &   
 r   )name2codepointz&(\w+);c                 s2    V '       g   R # R p\        W4      # )r=   c                 s     \        \        V P                  ^4      ,          4      #   \         d    T P                  ^ 4      u # i ; i)i   )unichrrG   Zgroupr6   )Zmr!   r   unescape_entityZ!unescape.<locals>.unescape_entity5  s<    	.455 	771:	s   $' AA)handle_entities)r&   rI   s   & r   r:   r:   1  s    
 ?33r   )r   r   r   )NNr   )$Z__doc__Z__all__ZreZlxmlr    r   Zbs4r   r   r   r   r   r   r   r$   ZImportErrorr   r   r   r	   ZcompileZ
IGNORECASEr*   r'   r   r   r%   Zhtml.entitiesrG   ZhtmlentitydefsZsubrJ   rH   Z	NameErrorZchrr:   r2   r   r   <module>rK      s   2 	 	*    +G4>#$$  ZZ$ MM	 5	 ( (Rj^F.,
 **Z(,,
	4G	  *  *	*j  .-.  Fs5   B 4B= C B:9B:=CC	CC