
    ^h                         S SK JrJrJr  S SKJr  S SKrS SKJr  SSK	J
r
  SSKJr  \R                  " S	5      rS
 r\" \5      rg)    )absolute_importdivisionunicode_literals)OrderedDictN)string_types   )base   )moduleFactoryFactoryz{([^}]*)}(.*)c                    ^ U nUR                  S5      R                  m " U4S jS[        R                  5      n[	        5       $ )Nasdc                   8   > \ rS rSrSrU 4S jrS rS rS rSr	g)	#getETreeBuilder.<locals>.TreeWalker   a  Given the particular ElementTree representation, this implementation,
to avoid using recursion, returns "nodes" as tuples with the following
content:

1. The current element

2. The index of the element relative to its parent

3. A stack of ancestor elements

4. A flag "text", "tail" or None to indicate if the current node is a
   text node; either the text or tail of the current element (1)
c                 P  > [        U[        5      (       a)  Uu  n  p4US;   a  [        R                  [	        X$5      4$ Un[        US5      (       d  UR                  5       nUR                  S;   a  [        R                  4$ UR                  S:X  a<  [        R                  UR                  UR                  S5      UR                  S5      4$ UR                  T:X  a  [        R                  UR                  4$ [        UR                  [        5      (       d   [        UR                  5      5       e[        R!                  UR                  5      nU(       a  UR#                  5       u  pgOS nUR                  n[%        5       n['        UR(                  R+                  5       5       HM  u  p[        R!                  U	5      nU(       a&  XUR-                  S5      UR-                  S5      4'   MG  XS U	4'   MO     [        R.                  XgU[1        U5      =(       d    UR                  4$ )	Ntexttailtag)DOCUMENT_ROOTDOCUMENT_FRAGMENTz
<!DOCTYPE>publicIdsystemIdr   r
   )
isinstancetupler	   TEXTgetattrhasattrgetrootr   DOCUMENTDOCTYPEr   getCOMMENTr   type
tag_regexpmatchgroupsr   listattribitemsgroupELEMENTlen)selfnodeelt_flagr&   	namespacer   attrsnamevalueElementTreeCommentTypes              c/home/james-whalen/.local/lib/python3.13/site-packages/bleach/_vendor/html5lib/treewalkers/etree.pygetNodeDetails2getETreeBuilder.<locals>.TreeWalker.getNodeDetails    s   $&&"&Q++99gc&888D4''||~xxAA''\)dii,dhhz.BD D 33||TYY.. "$((L99I4>I9"((2%*\\^NIs $I((C##'(9(9(;#<KD&,,T2EBGu{{1~u{{1~>?.3tTl+ $= is4y5DII7 7    c                     [        U[        5      (       a  Uu  p#pEO	US / S 4u  p#pEUS;   a  g UR                  (       a  X#US4$ [        U5      (       a  UR	                  U5        US   SUS 4$ g )Nr   r   r   )r   r   r   r-   appendr.   r/   elementkeyparentsr2   s         r8   getFirstChild1getETreeBuilder.<locals>.TreeWalker.getFirstChildH   sy    $&&.2+gt.2D"d.B+g''<<"&88\\NN7+"1:q'477r;   c                 $   [        U[        5      (       a  Uu  p#pEOg US:X  a+  [        U5      (       a  UR                  U5        US   SUS 4$ g UR                  (       a  US:w  a  X#US4$ U[        US   5      S-
  :  a  US   US-      US-   US 4$ g )Nr   r   r   r   )r   r   r-   r=   r   r>   s         r8   getNextSibling2getETreeBuilder.<locals>.TreeWalker.getNextSiblingY   s    $&&.2+gtv~w<<NN7+"1:q'477<<DFN"&883wr{+a//"2;sQw/q'4GGr;   c                    [        U[        5      (       a  Uu  p#pEOg US:X  a  U(       d  U$ X#US 4$ UR                  5       nU(       d  U$ [        US   5      R	                  U5      S:X  d   eU[        US   5      R                  U5      US 4$ )Nr   rE   r   )r   r   popr(   countindex)r.   r/   r?   r@   rA   r2   parents          r8   getParentNode1getETreeBuilder.<locals>.TreeWalker.getParentNodem   s    $&&.2+gtv~"N"$66 !M,226:a???!4#4#:#:6#BGTQQr;    N)
__name__
__module____qualname____firstlineno____doc__r9   rB   rF   rM   __static_attributes__)r7   s   r8   
TreeWalkerr      s    	&	7P	 "	 (	Rr;   rV   )Commentr   r	   NonRecursiveTreeWalkerlocals)ElementTreeImplementationElementTreerV   r7   s      @r8   getETreeBuilderr\      s?    +K(007;;lRT00 lR\ 8Or;   )
__future__r   r   r   collectionsr   rebleach.six_shimr    r	   _utilsr   compiler%   r\   getETreeModulerO   r;   r8   <module>re      s;    B B # 	 (  )ZZ(
rj &o6r;   