+
    ä�i�,  ã                  óœ   € R t ^ RIHt ^ RIHtHt ^ RIt^ RIHtH	t	H
t
Ht ^RIHt  ! R R]	4      t]
! RR	R
7      t ! R R	4      tR R ltR# )zyA tree representation of a linear markdown-it token stream.

This module is not part of upstream JavaScript markdown-it.
)Úannotations)Ú	GeneratorÚSequenceN)ÚAnyÚ
NamedTupleÚTypeVarÚoverload)ÚTokenc                  ó,   € ] tR t^t$ R]R&   R]R&   RtR# )Ú_NesterTokensr	   ÚopeningÚclosing© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Ú__static_attributes__r   ó    Ú2/usr/lib/python3/dist-packages/markdown_it/tree.pyr   r      s   ‡ ØƒNØ‡Nr   r   Ú	_NodeTypeÚSyntaxTreeNode)Úboundc                  óÂ  € ] tR t^tRtRKRR/R R llltR R lt]R R	 l4       t]R
 R l4       tR R ltR R lt	]
R R l4       t]P                  R R l4       t]
R R l4       t]P                  R R l4       t]
R R l4       t]
R R l4       t]
R R l4       t]
R R l4       t]
R  R! l4       t]
R" R# l4       tR$ R% ltR& R' ltR(^R)R*R+^ /R, R- lltR.R/R/ R0 lltR1 R2 lt]
R3 R4 l4       t]
R5 R6 l4       tR7 R8 lt]
R9 R: l4       t]
R; R< l4       t]
R= R> l4       t]
R? R@ l4       t]
RA RB l4       t ]
RC RD l4       t!]
RE RF l4       t"]
RG RH l4       t#RIt$RJ# )Lr   aE  A Markdown syntax tree node.

A class that can be used to construct a tree representation of a linear
`markdown-it-py` token stream.

Each node in the tree represents either:
  - root of the Markdown document
  - a single unnested `Token`
  - a `Token` "_open" and "_close" token pair, and the tokens nested in
      between
Úcreate_rootTc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚtokensúSequence[Token]r   ÚboolÚreturnÚNoner   )Úformats   "r   Ú__annotate__ÚSyntaxTreeNode.__annotate__#   s$   € ÷ (9ñ (9Ø%ð(9Ø<@ð(9à	ñ(9r   c               óÚ  € RV n         RV n        RV n        . V n        V'       d   V P	                  V4       R# V'       g   \        R4      h\        V4      ^8X  d^   V^ ,          pVP                  '       d   \        R4      hW0n         VP                  '       d   V P	                  VP                  4       R# R# \        V^ ,          VR,          4      V n        V P	                  V^R 4       R# )zsInitialize a `SyntaxTreeNode` from a token stream.

If `create_root` is True, create a root node for the document.
NzGCan only create root from empty token sequence. Set `create_root=True`.z;Unequal nesting level at the start and end of token stream.éÿÿÿÿ)
ÚtokenÚnester_tokensÚ_parentÚ	_childrenÚ_set_children_from_tokensÚ
ValueErrorÚlenÚnestingÚchildrenr   )Úselfr   r   Úinline_tokens   &&$ r   Ú__init__ÚSyntaxTreeNode.__init__#   sÜ   € ð $(ˆŒ
ð 48ˆÔð !ˆŒð %'ˆŒçØ×*Ñ*¨6Ô2ÙçÜð+óð ô �‹[˜AÔØ! !�9ˆLØ×#×#Ð#Ü ØQóð ð &ŒJØ×$×$Ð$Ø×.Ñ.¨|×/DÑ/DÖEñ %ô "/¨v°a­y¸&À½*Ó!EˆDÔØ×*Ñ*¨6°!°B¨<Ö8r   c               ó   € V ^8„  d   QhRR/# ©r   r!   Ústrr   )r#   s   "r   r$   r%   M   s   € ÷ 5ñ 5˜#ñ 5r   c                	óL   € \        V 4      P                   R V P                    R2# )Ú(Ú))Útyper   ©r1   s   &r   Ú__repr__ÚSyntaxTreeNode.__repr__M   s$   € Ü�t“*×%Ñ%Ð& a¨¯	©	 {°!Ð4Ð4r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   ÚitemÚintr!   r   )r#   s   "r   r$   r%   Q   s!   € ÷ ñ ˜)ð ¨3ð °9ñ r   c                	ó   € R # ©Nr   ©r1   r@   s   &&r   Ú__getitem__ÚSyntaxTreeNode.__getitem__P   ó   € ár   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r@   Úslicer!   úlist[_NodeType]r   )r#   s   "r   r$   r%   U   s!   € ÷ ñ ˜)ð ¨5ð °_ñ r   c                	ó   € R # rC   r   rD   s   &&r   rE   rF   T   rG   r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r@   zint | slicer!   z_NodeType | list[_NodeType]r   )r#   s   "r   r$   r%   X   s"   € ÷ #ñ #˜)ð #¨;ð #Ð;Vñ #r   c                	ó(   € V P                   V,          # rC   )r0   rD   s   &&r   rE   rF   X   s   € Ø�}‰}˜TÕ"Ð"r   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   úlist[Token]r   )r#   s   "r   r$   r%   [   s   € ÷ ñ ˜	ð  kñ r   c                ó.   a€ R V3R llo. pS! W4       V# )z Recover the linear token stream.c               ó$   € V ^8„  d   QhRRRRRR/# )r   Únoder   Ú
token_listrO   r!   r"   r   )r#   s   "r   r$   Ú.SyntaxTreeNode.to_tokens.<locals>.__annotate__^   s"   € ÷ 	>ñ 	>¨9ð 	>À+ð 	>ÐRVñ 	>r   c                ó´  <€ V P                   R 8X  d   V P                   F  pS! W!4       K  	  R# V P                  '       d   VP                  V P                  4       R# V P                  '       g   Q hVP                  V P                  P
                  4       V P                   F  pS! W!4       K  	  VP                  V P                  P                  4       R# )ÚrootN)r;   r0   r(   Úappendr)   r   r   )rR   rS   ÚchildÚrecursive_collect_tokenss   && €r   rY   Ú:SyntaxTreeNode.to_tokens.<locals>.recursive_collect_tokens^   sœ   ø€ Ø�y‰y˜FÔ"Ø!Ÿ]œ]�EÙ,¨UÖ?ó +à——�Ø×!Ñ! $§*¡*Ö-à×)×)Ð)Ð)Ð)Ø×!Ñ! $×"4Ñ"4×"<Ñ"<Ô=Ø!Ÿ]œ]�EÙ,¨UÖ?ñ +à×!Ñ! $×"4Ñ"4×"<Ñ"<Ö=r   r   )r1   r   rY   s   & @r   Ú	to_tokensÚSyntaxTreeNode.to_tokens[   s!   ø€ ÷	>ð 	>ð !ˆÙ  Ô.Øˆr   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   rJ   r   )r#   s   "r   r$   r%   p   s   € ÷ ñ �yð  _ñ r   c                	ó   € V P                   # rC   ©r+   r<   s   &r   r0   ÚSyntaxTreeNode.childreno   s   € à�~‰~Ðr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   ÚvaluerJ   r!   r"   r   )r#   s   "r   r$   r%   t   s!   € ÷ ñ �yð ¨ð ¸Tñ r   c                	ó   € Wn         R # rC   r_   ©r1   rb   s   &&r   r0   r`   s   s   € àŽr   c               ó    € V ^8„  d   QhRRRR/# ©r   r1   r   r!   ú_NodeType | Noner   )r#   s   "r   r$   r%   x   s   € ÷ ñ �Yð Ð#3ñ r   c                	ó   € V P                   # rC   ©r*   r<   s   &r   ÚparentÚSyntaxTreeNode.parentw   s   € à�|‰|Ðr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   rb   rg   r!   r"   r   )r#   s   "r   r$   r%   |   s"   € ÷ ñ �Yð Ð'7ð ¸Dñ r   c                	ó   € Wn         R # rC   ri   rd   s   &&r   rj   rk   {   s   € àŽr   c               ó   € V ^8„  d   QhRR/# ©r   r!   r    r   )r#   s   "r   r$   r%   €   s   € ÷ 6ñ 6˜ñ 6r   c                óL   € V P                   ;'       g    V P                  '       * # )z Is the node a special root node?)r(   r)   r<   s   &r   Úis_rootÚSyntaxTreeNode.is_root   s   € ð —J‘J×4Ð4 $×"4Ñ"4Ô5Ð5r   c               ó   € V ^8„  d   QhRR/# ro   r   )r#   s   "r   r$   r%   …   s   € ÷ (ñ (˜4ñ (r   c                ó,   € \        V P                  4      # )zÙIs this node nested?.

Returns `True` if the node represents a `Token` pair and tokens in the
sequence between them, where `Token.nesting` of the first `Token` in
the pair is 1 and nesting of the other `Token` is -1.
)r    r)   r<   s   &r   Ú	is_nestedÚSyntaxTreeNode.is_nested„   s   € ô �D×&Ñ&Ó'Ð'r   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   zSequence[_NodeType]r   )r#   s   "r   r$   r%   �   s   € ÷ $ñ $�yð $Ð%8ñ $r   c                óX   € V P                   '       g   V .# V P                   P                  # )zMGet siblings of the node.

Gets the whole group of siblings, including self.
)rj   r0   r<   s   &r   ÚsiblingsÚSyntaxTreeNode.siblingsŽ   s$   € ð �{�{ˆ{Ø�6ˆMØ�{‰{×#Ñ#Ð#r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   ™   s   € ÷ Gñ G�cñ Gr   c                óö   € V P                   '       d   R# V P                  '       d   V P                  P                  # V P                  '       g   Q h\	        V P                  P
                  P                  R4      # )zðGet a string type of the represented syntax.

- "root" for root nodes
- `Token.type` if the node represents an unnested token
- `Token.type` of the opening token, with "_open" suffix stripped, if
    the node represents a nester token pair
rV   Ú_open)rq   r(   r;   r)   Ú_removesuffixr   r<   s   &r   r;   ÚSyntaxTreeNode.type˜   sX   € ð �<�<ˆ<ÙØ�:�:ˆ:Ø—:‘:—?‘?Ð"Ø×!×!Ð!Ð!Ð!Ü˜T×/Ñ/×7Ñ7×<Ñ<¸gÓFÐFr   c               ó    € V ^8„  d   QhRRRR/# rf   r   )r#   s   "r   r$   r%   ©   s   € ÷ ñ ˜9ð Ð)9ñ r   c                ó²   € V P                   P                  V 4      pV^,           \        V P                   4      8  d   V P                   V^,           ,          # R# )z\Get the next node in the sequence of siblings.

Returns `None` if this is the last sibling.
N)ry   Úindexr.   ©r1   Ú
self_indexs   & r   Únext_siblingÚSyntaxTreeNode.next_sibling¨   sC   € ð —]‘]×(Ñ(¨Ó.ˆ
Ø˜�>œC §¡Ó.Ô.Ø—=‘= ¨a¥Õ0Ð0Ùr   c               ó    € V ^8„  d   QhRRRR/# rf   r   )r#   s   "r   r$   r%   ´   s   € ÷ ñ ˜yð Ð-=ñ r   c                óŒ   € V P                   P                  V 4      pV^,
          ^ 8¼  d   V P                   V^,
          ,          # R# )zaGet the previous node in the sequence of siblings.

Returns `None` if this is the first sibling.
N)ry   r‚   rƒ   s   & r   Úprevious_siblingÚSyntaxTreeNode.previous_sibling³   s:   € ð —]‘]×(Ñ(¨Ó.ˆ
Ø˜�>˜QÔØ—=‘= ¨a¥Õ0Ð0Ùr   c               ó    € V ^8„  d   QhRRRR/# ©r   r   r   r!   r"   r   )r#   s   "r   r$   r%   ¾   s   € ÷ $ñ $àð$ð 
ñ$r   c                ón   € \        V 4      ! VRR7      pWn        V P                  P                  V4       R# )zMake a child node for `self`.F)r   N)r;   rj   r0   rW   )r1   r   rX   s   && r   Ú
_add_childÚSyntaxTreeNode._add_child¾   s+   € ô
 �T”
˜6¨uÔ5ˆØŒØ�‰×Ñ˜UÖ#r   c               ó    € V ^8„  d   QhRRRR/# rŒ   r   )r#   s   "r   r$   r%   Ç   s   € ÷ +ñ +°ð +ÀDñ +r   c                óÖ  € \        \        V4      4      pV'       dÍ   VP                  4       pVP                  '       g   V P	                  V.4       K>  VP                  ^8w  d   \        R4      hV.p^pV'       d>   V'       d6   VP                  4       pVP                  V4       WSP                  ,          pKE  V'       d   \        RV^ ,           24      hV P	                  V4       KÔ  R# )z_Convert the token stream to a tree structure and set the resulting
nodes as children of `self`.zInvalid token nestingzunclosed tokens starting N)ÚlistÚreversedÚpopr/   rŽ   r-   rW   )r1   r   Úreversed_tokensr(   Únested_tokensr/   s   &&    r   r,   Ú(SyntaxTreeNode._set_children_from_tokensÇ   s¼   € ô œx¨Ó/Ó0ˆßØ#×'Ñ'Ó)ˆEà—=—=�=Ø—‘  Ô(ÙØ�}‰} Ô!Ü Ð!8Ó9Ð9à"˜GˆMØˆGß!§gØ'×+Ñ+Ó-�Ø×$Ñ$ UÔ+ØŸ=™=Õ(’ßÜ Ð#<¸]È1Õ=MÐ<NÐ!OÓPÐPà�O‰O˜MÖ*ñ% r   ÚindentÚ	show_textFÚ_currentc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r˜   rA   r™   r    rš   r!   r7   r   )r#   s   "r   r$   r%   ß   s,   € ÷ ñ ØðØ-1ðØEHðà	ñr   c          	     ó‚  € RV,          pVRV P                    2,           pV P                  '       gQ   V P                  '       d?   VRRP                  R V P                  P	                  4        4       4      ,           ,          pVR,          pV'       ds   V P                  '       ga   V P                   R9   dP   V P
                  '       d>   VR\        P                  ! V P
                  VRV,          ,           4      ,           ,          pV P                   F*  pVRVP                  WW1,           R7      ,           ,          pK,  	  V# )z'Create an XML style string of the tree.Ú Ú<c              3  ó6   "  € T F  w  rV R V: 2x € K  	  R# 5i)Ú=Nr   )Ú.0ÚkÚvs   &  r   Ú	<genexpr>Ú(SyntaxTreeNode.pretty.<locals>.<genexpr>æ   s   é € Ð"OÑ<N±D°A a S¨¨!©¥<Ó<Nùs   ‚Ú>Ú
)r˜   r™   rš   )ÚtextÚtext_special)
r;   rq   ÚattrsÚjoinÚitemsÚcontentÚtextwrapr˜   r0   Úpretty)r1   r˜   r™   rš   Úprefixr¨   rX   s   &$$$   r   r¯   ÚSyntaxTreeNode.prettyß   sí   € ð �x•ˆØ˜!˜DŸI™I˜;˜Õ'ˆØ�|�|ˆ| §
§
 
Ø�C˜#Ÿ(™(Ñ"O¸D¿J¹J×<LÑ<LÔ<NÓ"OÓOÕOÕOˆDØ��ˆçØ—L—L�LØ—	‘	Ð5Ô5Ø——�à�Dœ8Ÿ?š?¨4¯<©<¸À#ÈÅ,Õ9NÓOÕOÕOˆDØ—]”]ˆEØ�D˜5Ÿ<™<Ø¸XÕ=Nð (ó õ õ ŠDñ #ð ˆr   Úinclude_selfc               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r²   r    r!   z Generator[_NodeType, None, None]r   )r#   s   "r   r$   r%   õ   s$   € ÷ 5ñ 5Øð5Ø*.ð5à	)ñ5r   c             #  ó„   "  € V'       d   V x € V P                    F  pVP                  RR7       Rj  x€L
  K  	  R#  L
5i)z›Recursively yield all descendant nodes in the tree starting at self.

The order mimics the order of the underlying linear token
stream (i.e. depth first).
T)r²   N)r0   Úwalk)r1   r²   rX   s   &$ r   rµ   ÚSyntaxTreeNode.walkõ   s4   é € ÷ ØŠJØ—]”]ˆEØ—z‘z¨t�zÓ4×4Ò4ó #Ù4ùs   ‚1A ³>´A c               ó   € V ^8„  d   QhRR/# )r   r!   r	   r   )r#   s   "r   r$   r%     s   € ÷ Oñ O %ñ Or   c                ó¤   € V P                   '       d   V P                   # V P                  '       d   V P                  P                  # \        R4      h)zTReturn the `Token` that is used as the data source for the
properties defined below.z.Root node does not have the accessed attribute)r(   r)   r   ÚAttributeErrorr<   s   &r   Ú_attribute_tokenÚSyntaxTreeNode._attribute_token  sA   € ð �:�:ˆ:Ø—:‘:ÐØ××ÐØ×%Ñ%×-Ñ-Ð-ÜÐMÓNÐNr   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%     s   € ÷ +ñ +�Sñ +r   c                ó6   € V P                  4       P                  # )zhtml tag name, e.g. "p" )rº   Útagr<   s   &r   r¾   ÚSyntaxTreeNode.tag  s   € ð ×$Ñ$Ó&×*Ñ*Ð*r   c               ó   € V ^8„  d   QhRR/# )r   r!   zdict[str, str | int | float]r   )r#   s   "r   r$   r%     s   € ÷ -ñ -Ð3ñ -r   c                ó6   € V P                  4       P                  # )zHtml attributes.)rº   rª   r<   s   &r   rª   ÚSyntaxTreeNode.attrs  ó   € ð ×$Ñ$Ó&×,Ñ,Ð,r   c               ó    € V ^8„  d   QhRRRR/# )r   Únamer7   r!   zNone | str | int | floatr   )r#   s   "r   r$   r%     s   € ÷ 5ñ 5˜Cð 5Ð$<ñ 5r   c                ó@   € V P                  4       P                  V4      # )z@Get the value of attribute `name`, or null if it does not exist.)rº   ÚattrGet)r1   rÅ   s   &&r   rÇ   ÚSyntaxTreeNode.attrGet  s   € à×$Ñ$Ó&×.Ñ.¨tÓ4Ð4r   c               ó   € V ^8„  d   QhRR/# )r   r!   ztuple[int, int] | Noner   )r#   s   "r   r$   r%   #  s   € ÷ ñ Ð+ñ r   c                ó`   € V P                  4       P                  pV'       d   \        V4      # R# )z8Source map info. Format: `tuple[ line_begin, line_end ]`N)rº   ÚmapÚtuple)r1   Úmap_s   & r   rË   ÚSyntaxTreeNode.map"  s(   € ð ×$Ñ$Ó&×*Ñ*ˆßä˜“;ÐÙr   c               ó   € V ^8„  d   QhRR/# )r   r!   rA   r   )r#   s   "r   r$   r%   ,  s   € ÷ -ñ -�sñ -r   c                ó6   € V P                  4       P                  # )z(nesting level, the same as `state.level`)rº   Úlevelr<   s   &r   rÑ   ÚSyntaxTreeNode.level+  rÃ   r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   1  s   € ÷ /ñ /˜ñ /r   c                ó6   € V P                  4       P                  # )zUIn a case of self-closing tag (code, html, fence, etc.), it
has contents of this tag.)rº   r­   r<   s   &r   r­   ÚSyntaxTreeNode.content0  s   € ð ×$Ñ$Ó&×.Ñ.Ð.r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   7  s   € ÷ .ñ .˜ñ .r   c                ó6   € V P                  4       P                  # )z5'*' or '_' for emphasis, fence string for fence, etc.)rº   Úmarkupr<   s   &r   rØ   ÚSyntaxTreeNode.markup6  s   € ð ×$Ñ$Ó&×-Ñ-Ð-r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   <  s   € ÷ ,ñ ,�cñ ,r   c                ó6   € V P                  4       P                  # )zfence infostring)rº   Úinfor<   s   &r   rÜ   ÚSyntaxTreeNode.info;  ó   € ð ×$Ñ$Ó&×+Ñ+Ð+r   c               ó   € V ^8„  d   QhRR/# )r   r!   zdict[Any, Any]r   )r#   s   "r   r$   r%   A  s   € ÷ ,ñ ,�nñ ,r   c                ó6   € V P                  4       P                  # )z/A place for plugins to store an arbitrary data.)rº   Úmetar<   s   &r   rá   ÚSyntaxTreeNode.meta@  rÞ   r   c               ó   € V ^8„  d   QhRR/# ro   r   )r#   s   "r   r$   r%   F  s   € ÷ -ñ -�tñ -r   c                ó6   € V P                  4       P                  # )z5True for block-level tokens, false for inline tokens.)rº   Úblockr<   s   &r   rå   ÚSyntaxTreeNode.blockE  rÃ   r   c               ó   € V ^8„  d   QhRR/# ro   r   )r#   s   "r   r$   r%   K  s   € ÷ .ñ .˜ñ .r   c                ó6   € V P                  4       P                  # )zZIf it's true, ignore this element when rendering.
Used for tight lists to hide paragraphs.)rº   Úhiddenr<   s   &r   ré   ÚSyntaxTreeNode.hiddenJ  s   € ð ×$Ñ$Ó&×-Ñ-Ð-r   )r+   r*   r)   r(   N)r   )%r   r   r   r   Ú__doc__r3   r=   r   rE   r[   Úpropertyr0   Úsetterrj   rq   ru   ry   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      s*  † ñ
ñ(9ØCG÷(9ð (9õT5ð ôó ðð ôó ðõ#õð( ôó ðð ‡_�_ôó ðð ôó ðð ‡]�]ôó ðð ô6ó ð6ð ô(ó ð(ð ô$ó ð$ð ôGó ðGð ôó ðð ôó ðõ$õ+ð0Ø ðØ49ðØKL÷ð,5Ø15÷5õ,Oð ô+ó ð+ð ô-ó ð-õ5ð ôó ðð ô-ó ð-ð ô/ó ð/ð
 ô.ó ð.ð ô,ó ð,ð ô,ó ð,ð ô-ó ð-ð ô.ó ô.r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ústringr7   Úsuffixr!   r   )r#   s   "r   r$   r$   Q  s!   € ÷ ñ ˜#ð  sð ¨sñ r   c                ób   € V'       d'   V P                  V4      '       d   V R\        V4      )  # V # )zuRemove a suffix from a string.

Replace this with str.removesuffix() from stdlib when minimum Python
version is 3.9.
N)Úendswithr.   )rï   rð   s   &&r   r~   r~   Q  s-   € ÷ �&—/‘/ &×)Ò)Ø�nœ˜V›˜Ð%Ð%Ø€Mr   )rë   Ú
__future__r   Úcollections.abcr   r   r®   Útypingr   r   r   r   r(   r	   r   r   r   r~   r   r   r   Ú<module>rö      sK   ðñõ #ç /Û ß 5Ó 5å ô�Jô ñ
 �KÐ'7Ô8€	÷x.ñ x.÷v	r   