+
    '(jg              	      J   ^ RI Ht ^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
 ^ RIHt ^ RIHt ^RIHt ^R	IHt ^R
IHt ^RIHtHtHtHt ^RIHt ^RIHt ^RIHt ^RI H!t! ^RI"H#t#H$t$ ^RI%H&t& ^RI'H(t(H)t)  ! R R4      t* ! R R]*4      t+ ! R R]*4      t, ! R R],4      t-] ! R R4      4       t. ! R R],4      t/ ! R R ],4      t0 ! R! R"],4      t1 ! R# R$]*4      t2 ! R% R&]*4      t3 ! R' R(]*4      t4 ! R) R*]*4      t5 ! R+ R,]*4      t6 ! R- R.]*4      t7 ! R/ R0]*4      t8 ! R1 R2],4      t9 ! R3 R4],4      t: ! R5 R6],4      t; ! R7 R84      t< ! R9 R:]4      t=]>R;8X  Ed1   ^ RI?t?^ RIt]?P                  ! R<R=7      tA]AP                  R>R?R@RA7       ]AP                  RBRCRDRERRFRG7       ]AP                  RHRIRJRKRLRM7       ]AP                  RNRORPRRPRM7       ]AP                  RQRRRSRERTRU7       ]AP                  RVRW]CRXRRYRZ7       ]AP                  R[R\R]RER^RU7       ]AP                  R_R`RaRERbRU7       ]AP                  4       tE^ RcIFHt ]EP                  Rd8X  d   ]P                  P                  4       tJM5]K! ]EP                  ReRf7      ;_uu_ 4       tL]LP                  4       tJRRR4       ]=! ]J]EP                  '       d   RgMRh]EP                  ]EP                  ]EP                  Ri7      tQ]EP                  '       dl   ^ RIStS^ RITtT]SP                  ! 4       tV]! ]V]EP                  ]EP                  Rj7      t]P                  ]Q4       ]TP                  ! ]VP                  4       4       R# ]! ]EP                  ]EP                  RkRl7      t]P                  ]Q4       R# R#   + '       g   i     EL; i)m    )annotationsN)	dataclass)ClassVarIterableget_args)
MarkdownIt)Token)Table)box)
loop_first)Stack)ConsoleConsoleOptionsJustifyMethodRenderResult)Renderables)JupyterMixin)Rule)Segment)Style
StyleStack)Syntax)TextTextTypec                  x    ] tR t^t$ RtR]R&   ]R R l4       tR R ltR R	 lt	R
 R lt
R R ltR R ltRtR# )MarkdownElementTzClassVar[bool]new_linec               $    V ^8  d   QhRRRRRR/#    markdownMarkdowntokenr	   returnr    )formats   "B/home/ubuntu/cf-venv/lib/python3.14/site-packages/rich/markdown.py__annotate__MarkdownElement.__annotate__   s!     
 
h 
u 
 
    c                    V ! 4       # )zFactory to create markdown element,

Args:
    markdown (Markdown): The parent Markdown object.
    token (Token): A node from markdown-it.

Returns:
    MarkdownElement: A new markdown element
r%   clsr!   r#   s   &&&r'   createMarkdownElement.create   s     ur*   c                    V ^8  d   QhRRRR/# r    contextMarkdownContextr$   Noner%   )r&   s   "r'   r(   r)   )          D r*   c                    R# )z]Called when the node is entered.

Args:
    context (MarkdownContext): The markdown context.
Nr%   selfr2   s   &&r'   on_enterMarkdownElement.on_enter)       r*   c               $    V ^8  d   QhRRRRRR/# r    r2   r3   textr   r$   r4   r%   )r&   s   "r'   r(   r)   0   s!       h 4 r*   c                    R# )zXCalled when text is parsed.

Args:
    context (MarkdownContext): The markdown context.
Nr%   r8   r2   r>   s   &&&r'   on_textMarkdownElement.on_text0   r;   r*   c                    V ^8  d   QhRRRR/# r1   r%   )r&   s   "r'   r(   r)   7   r5   r*   c                    R# )z_Called when the parser leaves the element.

Args:
    context (MarkdownContext): [description]
Nr%   r7   s   &&r'   on_leaveMarkdownElement.on_leave7   r;   r*   c               $    V ^8  d   QhRRRRRR/# r    r2   r3   childr   r$   boolr%   )r&   s   "r'   r(   r)   >   s"      o o RV r*   c                    R# )aD  Called when a child element is closed.

This method allows a parent element to take over rendering of its children.

Args:
    context (MarkdownContext): The markdown context.
    child (MarkdownElement): The child markdown element.

Returns:
    bool: Return True to render the element, or False to not render the element.
Tr%   r8   r2   rI   s   &&&r'   on_child_closeMarkdownElement.on_child_close>   s     r*   c               $    V ^8  d   QhRRRRRR/# r    consoler   optionsr   r$   r   r%   )r&   s   "r'   r(   r)   L   s$      )7	r*   c                	    R# )Nr%   r%   r8   rQ   rR   s   &&&r'   __rich_console__ MarkdownElement.__rich_console__L   s	     	r*   r%   N)__name__
__module____qualname____firstlineno__r   __annotations__classmethodr.   r9   rA   rE   rM   rU   __static_attributes__r%   r*   r'   r   r      s<    #Hn#
 
 r*   r   c                      ] tR t^RtRtRtR# )UnknownElementzAn unknown element.

Hopefully there will be no unknown elements, and we will have a MarkdownElement for
everything in the document.

r%   N)rW   rX   rY   rZ   __doc__r]   r%   r*   r'   r_   r_   R   s    r*   r_   c                  B    ] tR t^[tRtRtR R ltR R ltR R ltR	t	R
# )TextElementz)Base class for elements that render text.nonec                    V ^8  d   QhRRRR/# r1   r%   )r&   s   "r'   r(   TextElement.__annotate__`   s     ) ) )D )r*   c                	h    VP                  V P                  4      V n        \        R R7      V n        R# leftjustifyN)enter_style
style_namestyler   r>   r7   s   &&r'   r9   TextElement.on_enter`   s$    ((9
(	r*   c               $    V ^8  d   QhRRRRRR/# r=   r%   )r&   s   "r'   r(   re   d   s&     Y Y Yh Y4 Yr*   c                	    V P                   P                  T\        V\        4      '       d   VP                  4       R # R 4       R # N)r>   append
isinstancestrcurrent_styler@   s   &&&r'   rA   TextElement.on_textd   s.    		
48M8Mw44XSWXr*   c                    V ^8  d   QhRRRR/# r1   r%   )r&   s   "r'   r(   re   g   s       D r*   c                	&    VP                  4        R # rq   )leave_styler7   s   &&r'   rE   TextElement.on_leaveg   s    r*   )rm   r>   N)
rW   rX   rY   rZ   r`   rl   r9   rA   rE   r]   r%   r*   r'   rb   rb   [   s    3J)Y r*   rb   c                  X    ] tR t^kt$ RtRtR]R&   ]R R l4       tR R lt	R	 R
 lt
RtR# )	ParagraphzA Paragraph.zmarkdown.paragraphr   rj   c               $    V ^8  d   QhRRRRRR/# )r    r!   r"   r#   r	   r$   r|   r%   )r&   s   "r'   r(   Paragraph.__annotate__r   s!     7 7h 7u 7 7r*   c                	<    T ! VP                   ;'       g    R R7      # )rh   ri   ri   r,   s   &&&r'   r.   Paragraph.createq   s    8++55v66r*   c                    V ^8  d   QhRRRR/# r    rj   r   r$   r4   r%   )r&   s   "r'   r(   r~   u   s       $ r*   c                	    Wn         R # rq   ri   r8   rj   s   &&r'   __init__Paragraph.__init__u   s    r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r~   x   s$      )7	r*   c              #  	`   "   V P                   V P                  n         V P                  x  R # 5irq   )rj   r>   rT   s   &&&r'   rU   Paragraph.__rich_console__x   s       !LL		iis   ,.ri   N)rW   rX   rY   rZ   r`   rl   r[   r\   r.   r   rU   r]   r%   r*   r'   r|   r|   k   s1    %J7 7 r*   r|   c                  4    ] tR t^t$ RtR]R&   RtR]R&   RtR# )	HeadingFormatrh   r   rj    rt   rm   r%   N)rW   rX   rY   rZ   rj   r[   rm   r]   r%   r*   r'   r   r      s    #G]#E3Or*   r   c                     a  ] tR t^t$ RtRRRRRRRRRRR	R/tR
]R&   ]R R l4       tR R lt	R V 3R llt
R R ltRtV ;t# )Headingz
A heading.h1centerh2rh   h3h4h5h6z"ClassVar[dict[str, JustifyMethod]]LEVEL_ALIGNc               $    V ^8  d   QhRRRRRR/# )r    r!   r"   r#   r	   r$   r   r%   )r&   s   "r'   r(   Heading.__annotate__   s!      h u  r*   c                	&    V ! VP                   4      # rq   )tagr,   s   &&&r'   r.   Heading.create   s    599~r*   c                    V ^8  d   QhRRRR/# r1   r%   )r&   s   "r'   r(   r      s     - - -D -r*   c                	Z    \        4       V n        VP                  V P                  4       R # rq   )r   r>   rk   rl   r7   s   &&r'   r9   Heading.on_enter   s    F	DOO,r*   c                    V ^8  d   QhRRRR/# )r    r   rt   r$   r4   r%   )r&   s   "r'   r(   r      s      C D r*   c                	D   < Wn         R V 2V n        \        SV `  4        R# )	markdown.N)r   rl   superr   )r8   r   	__class__s   &&r'   r   Heading.__init__   s!    %cU+r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r      s$      )7	r*   c              #  	   "   V P                   P                  4       pV P                  P                  V P                  R 4      pWCn        Vx  R# 5i)rh   N)r>   copyr   getr   rj   )r8   rQ   rR   r>   heading_justifys   &&&  r'   rU   Heading.__rich_console__   s=      yy~~**..txx@&
   AA)rl   r   r>   )rW   rX   rY   rZ   r`   r   r[   r\   r.   r9   r   rU   r]   __classcell__r   s   @r'   r   r      sb     	hfffff7K3   - 
 r*   r   c                  L    ] tR t^tRtRt]R R l4       tR R ltR R lt	R	t
R
# )	CodeBlockz&A code block with syntax highlighting.zmarkdown.code_blockc               $    V ^8  d   QhRRRRRR/# )r    r!   r"   r#   r	   r$   r   r%   )r&   s   "r'   r(   CodeBlock.__annotate__   s!     > >h >u > >r*   c                	    VP                   ;'       g    R pVP                  R4      ^ ,          pT ! T;'       g    RVP                  4      # )r    r>   )info	partition
code_theme)r-   r!   r#   	node_info
lexer_names   &&&  r'   r.   CodeBlock.create   sC    JJ$$"	((-a0
:'')<)<==r*   c               $    V ^8  d   QhRRRRRR/# )r    r   rt   themer$   r4   r%   )r&   s   "r'   r(   r      s!      3 s t r*   c                	    Wn         W n        R # rq   r   r   )r8   r   r   s   &&&r'   r   CodeBlock.__init__   s    $
r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r      s$      )7	r*   c              #  	   "   \        V P                  4      P                  4       p\        W0P                  V P
                  R ^R7      pVx  R# 5i)T)r   	word_wrappaddingN)rt   r>   rstripr   r   r   )r8   rQ   rR   codesyntaxs   &&&  r'   rU   CodeBlock.__rich_console__   s?      499~$$&//tQ
 r   r   N)rW   rX   rY   rZ   r`   rl   r\   r.   r   rU   r]   r%   r*   r'   r   r      s+    0&J> >
 r*   r   c                  B    ] tR t^tRtRtR R ltR R ltR R ltR	t	R
# )
BlockQuotezA block quote.zmarkdown.block_quotec                   V ^8  d   QhRR/# r    r$   r4   r%   )r&   s   "r'   r(   BlockQuote.__annotate__        3 3$ 3r*   c                	$    \        4       V n        R # rq   r   elementsr8   s   &r'   r   BlockQuote.__init__       %0]r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   r      "      o o RV r*   c                	<    V P                   P                  V4       R # Fr   rr   rL   s   &&&r'   rM   BlockQuote.on_child_close       U#r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r      s$      )7	r*   c              #  	"  "   VP                  VP                  ^,
          R7      pVP                  V P                  W0P                  R7      pV P                  p\        R4      p\        RV4      pV F  pVx  T Rj  xL
  Vx  K  	  R#  L5i)   widthrm   
u   ▌ N)update	max_widthrender_linesr   rm   r   )	r8   rQ   rR   render_optionslinesrm   r   r   lines	   &&&      r'   rU   BlockQuote.__rich_console__   s{      !g.?.?!.CD$$T]]N**$U

4=&%(DMOON s   A<B>B?Br   N)
rW   rX   rY   rZ   r`   rl   r   rM   rU   r]   r%   r*   r'   r   r      s    'J3 r*   r   c                  *    ] tR t^tRtRtR R ltRtR# )HorizontalRulez%A horizontal rule to divide sections.Fc               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   HorizontalRule.__annotate__   s$      )7	r*   c              #  	j   "   VP                  R RR7      p\        VRR7      x  \        4       x  R# 5i)zmarkdown.hrrc   default-)rm   
charactersN)	get_styler   r   )r8   rQ   rR   rm   s   &&& r'   rU   HorizontalRule.__rich_console__   s0      !!-!@3//fs   13r%   N)rW   rX   rY   rZ   r`   r   rU   r]   r%   r*   r'   r   r      s    /H r*   r   c                  >    ] tR t^tRtR R ltR R ltR R ltRtR	# )
TableElementz.MarkdownElement corresponding to `table_open`.c                   V ^8  d   QhRR/# r   r%   )r&   s   "r'   r(   TableElement.__annotate__   s     2 2$ 2r*   c                	"    R V n         R V n        R # rq   )headerbodyr   s   &r'   r   TableElement.__init__   s    15-1	r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   r      s"      o o RV r*   c                	    \        V\        4      '       d	   W n        R# \        V\        4      '       d	   W n        R# \        R 4      h)z Couldn't process markdown table.F)rs   TableHeaderElementr   TableBodyElementr   RuntimeErrorrL   s   &&&r'   rM   TableElement.on_child_close   sB    e/00K
 	 /00I  ABBr*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r      s$      )7	r*   c              #  	,  "   \        \        P                  R RRRR7      pV P                  e|   V P                  P                  ed   V P                  P                  P
                   F?  pVP                  P                  4       pVP                  R4       VP                  V4       KA  	  V P                  eR   V P                  P                   F7  pVP
                   Uu. uF  qwP                  NK  	  ppVP                  ! V!   K9  	  Vx  R# u upi 5i)Fzmarkdown.table.borderT)r   pad_edgerm   	show_edgecollapse_paddingNzmarkdown.table.header)r
   r   SIMPLEr   rowcellscontentr   stylize
add_columnr   rowsadd_row)	r8   rQ   rR   tablecolumnheadingr  elementrow_contents	   &&&      r'   rU   TableElement.__rich_console__   s      

)!
 ;;"t{{'B++//// ..--/ 78  ) 0
 99 yy~~>AiiHi7iH{+ &  Is   CDD3!D)r   r   N)	rW   rX   rY   rZ   r`   r   rM   rU   r]   r%   r*   r'   r   r      s    82 r*   r   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r   i  z@MarkdownElement corresponding to `thead_open` and `thead_close`.c                   V ^8  d   QhRR/# r   r%   )r&   s   "r'   r(   TableHeaderElement.__annotate__       0 0$ 0r*   c                	    R V n         R # rq   r  r   s   &r'   r   TableHeaderElement.__init__  s	    +/r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   r    "      o o RV r*   c                	B    \        V\        4      '       g   Q hW n        R # r   )rs   TableRowElementr  rL   s   &&&r'   rM   !TableHeaderElement.on_child_close  s    %1111r*   r  NrW   rX   rY   rZ   r`   r   rM   r]   r%   r*   r'   r   r     s    J0 r*   r   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r   i  z@MarkdownElement corresponding to `tbody_open` and `tbody_close`.c                   V ^8  d   QhRR/# r   r%   )r&   s   "r'   r(   TableBodyElement.__annotate__  s     . .$ .r*   c                	    . V n         R # rq   r  r   s   &r'   r   TableBodyElement.__init__  s	    +-	r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   r$  "  r  r*   c                	l    \        V\        4      '       g   Q hV P                  P                  V4       R # r   )rs   r  r  rr   rL   s   &&&r'   rM   TableBodyElement.on_child_close"  s*    %1111		r*   r&  Nr!  r%   r*   r'   r   r     s    J. r*   r   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r  i(  z:MarkdownElement corresponding to `tr_open` and `tr_close`.c                   V ^8  d   QhRR/# r   r%   )r&   s   "r'   r(   TableRowElement.__annotate__+  r  r*   c                	    . V n         R # rq   r	  r   s   &r'   r   TableRowElement.__init__+  s	    -/
r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   r-  .  r  r*   c                	l    \        V\        4      '       g   Q hV P                  P                  V4       R # r   )rs   TableDataElementr	  rr   rL   s   &&&r'   rM   TableRowElement.on_child_close.  s+    %!12222

% r*   r/  Nr!  r%   r*   r'   r  r  (  s    D0 r*   r  c                  H    ] tR tRtRt]R R l4       tR R ltR R ltR	t	R
# )r3  i4  zWMarkdownElement corresponding to `td_open` and `td_close`
and `th_open` and `th_close`.c               $    V ^8  d   QhRRRRRR/# r   r%   )r&   s   "r'   r(   TableDataElement.__annotate__9  s!     $ $h $u $ $r*   c                	    \        VP                  P                  R 4      4      ;'       g    RpRV9   d   RpMRV9   d   RpMRV9   d   RpMRpV\        \        4      9   g   Q hV ! VR	7      # )
rm   r   ztext-align:rightrightztext-align:centerr   ztext-align:leftrh   r   ri   )rt   attrsr   r   r   )r-   r!   r#   rm   rj   s   &&&  r'   r.   TableDataElement.create8  sm    EKKOOG,-33 &G E)G%'GG(=11117##r*   c                    V ^8  d   QhRRRR/# r   r%   )r&   s   "r'   r(   r7  I  s       $ r*   c                	6    \        R VR7      V n        Wn        R# )r   ri   N)r   r
  rj   r   s   &&r'   r   TableDataElement.__init__I  s    !"g6r*   c               $    V ^8  d   QhRRRRRR/# r=   r%   )r&   s   "r'   r(   r7  M  s!     + + +h +4 +r*   c                	    \        V\        4      '       d(   V P                  P                  W!P                  4       R # V P                  P                  V4       R # rq   )rs   rt   r
  rr   ru   append_textr@   s   &&&r'   rA   TableDataElement.on_textM  s9    dC  LL&;&;<LL$$T*r*   )r
  rj   N)
rW   rX   rY   rZ   r`   r\   r.   r   rA   r]   r%   r*   r'   r3  r3  4  s*    % $ $ + +r*   r3  c                  T    ] tR tRtRt]R R l4       tR R ltR R ltR	 R
 lt	Rt
R# )ListElementiT  zA list element.c               $    V ^8  d   QhRRRRRR/# )r    r!   r"   r#   r	   r$   rD  r%   )r&   s   "r'   r(   ListElement.__annotate__X  s&     A Ah Au A Ar*   c           	     	n    V ! VP                   \        VP                  P                  R ^4      4      4      # )start)typeintr:  r   r,   s   &&&r'   r.   ListElement.createW  s'    5::s5;;??7A#>?@@r*   c               $    V ^8  d   QhRRRRRR/# )r    	list_typert   
list_startz
int | Noner$   r4   r%   )r&   s   "r'   r(   rF  [  s!     % %# %: %$ %r*   c                	,    . V n         Wn        W n        R # rq   )itemsrM  rN  )r8   rM  rN  s   &&&r'   r   ListElement.__init__[  s    %'
"$r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   rF  `  r  r*   c                	l    \        V\        4      '       g   Q hV P                  P                  V4       R # r   )rs   ListItemrP  rr   rL   s   &&&r'   rM   ListElement.on_child_close`  s*    %****

% r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   rF  e  s$      )7	r*   c              #  	  "   V P                   R 8X  d/   V P                   F  pVP                  W4       Rj  xL
  K  	  R# V P                  f   ^MV P                  pV\	        V P                  4      ,           p\        V P                  4       F&  w  rcVP                  WWF,           V4       Rj  xL
  K(  	  R#  L L5i)bullet_list_openN)rM  rP  render_bulletrN  len	enumeraterender_number)r8   rQ   rR   itemnumberlast_numberindexs   &&&    r'   rU   ListElement.__rich_console__e  s      >>//

--g??? # //1QtF 3tzz?2K(4--fnk    5	 @
s"   5B?B;A8B?0B=1B?=B?)rP  rN  rM  N)rW   rX   rY   rZ   r`   r\   r.   r   rM   rU   r]   r%   r*   r'   rD  rD  T  s-    A A%

 r*   rD  c                  N    ] tR tRtRtRtR R ltR R ltR R	 ltR
 R lt	Rt
R# )rT  it  zAn item in a list.zmarkdown.itemc                   V ^8  d   QhRR/# r   r%   )r&   s   "r'   r(   ListItem.__annotate__y  r   r*   c                	$    \        4       V n        R # rq   r   r   s   &r'   r   ListItem.__init__y  r   r*   c               $    V ^8  d   QhRRRRRR/# rH   r%   )r&   s   "r'   r(   rd  |  r   r*   c                	<    V P                   P                  V4       R # r   r   rL   s   &&&r'   rM   ListItem.on_child_close|  r   r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   rd    s!      W ~ , r*   c              #  	r  "   VP                  VP                  ^,
          R7      pVP                  V P                  W0P                  R7      pVP                  RRR7      p\        RV4      p\        R	V4      p\        R4      p\        V4       F!  w  rV	'       d   TMTx  T
 Rj  xL
  Vx  K#  	  R#  L5i)
   r   r   zmarkdown.item.bulletrc   r   u    • r   Nz   )r   r   r   r   rm   r   r   r   )r8   rQ   rR   r   r   bullet_stylebulletr   r   firstr   s   &&&        r'   rY  ListItem.render_bullet  s      g.?.?!.CD$$T]]N**$U(()?(P,/'<04=%e,KE!&w.OON -s   B$B7&B5'B7c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r    rQ   r   rR   r   r^  rJ  r_  r$   r   r%   )r&   s   "r'   r(   rd    s4      )7ADSV	r*   c              #  	  "   \        \        V4      4      ^,           pVP                  VP                  V,
          R7      pVP	                  V P
                  W`P                  R7      pVP                  RRR7      p\        R4      p	\        RV,          V4      p
\        V P                  V^,
          4      R,           V4      p\        V4       F!  w  rV'       d   TMT
x  T Rj  xL
  V	x  K#  	  R#  L5i)	r    r   r   zmarkdown.item.numberrc   r   r   r   N)rZ  rt   r   r   r   r   rm   r   r   rjustr   )r8   rQ   rR   r^  r_  number_widthr   r   number_styler   r   numeralro  r   s   &&&&&         r'   r\  ListItem.render_number  s      3{+,q0 g.?.?,.NO$$T]]N**$U(()?(P4=#,l;VH++L1,<=C\R%e,KE"'/OON -s   C$C7&C5'C7r   N)rW   rX   rY   rZ   r`   rl   r   rM   rY  r\  r]   r%   r*   r'   rT  rT  t  s#     J3 r*   rT  c                  8    ] tR tRt]R R l4       tR R ltRtR# )Linki  c               $    V ^8  d   QhRRRRRR/# r   r%   )r&   s   "r'   r(   Link.__annotate__  s!     , ,h ,u , ,r*   c                	r    VP                   P                  R R4      pV ! VP                  \        V4      4      # )href#)r:  r   r
  rt   )r-   r!   r#   urls   &&& r'   r.   Link.create  s+    kkoofc*5==#c(++r*   c                    V ^8  d   QhRRRR/# )r    r>   rt   r}  r%   )r&   s   "r'   r(   r{    s      S  r*   c                	2    \        V4      V n        W n        R # rq   )r   r>   r}  )r8   r>   r}  s   &&&r'   r   Link.__init__  s    J		r*   )r}  r>   N)rW   rX   rY   rZ   r\   r.   r   r]   r%   r*   r'   ry  ry    s    , , r*   ry  c                  j   a  ] tR tRtRtRt]R R l4       tR V 3R lltR V 3R	 llt	R
 R lt
RtV ;t# )	ImageItemi  z#Renders a placeholder for an image.Fc               $    V ^8  d   QhRRRRRR/# r   r%   )r&   s   "r'   r(   ImageItem.__annotate__  s&     
I 
Ih 
Iu 
I 
Ir*   c                n    V ! \        VP                  P                  RR4      4      VP                  4      # )zFactory to create markdown element,

Args:
    markdown (Markdown): The parent Markdown object.
    token (Any): A token from markdown-it.

Returns:
    MarkdownElement: A new markdown element
srcr   )rt   r:  r   
hyperlinksr,   s   &&&r'   r.   ImageItem.create  s+     3u{{ub12H4G4GHHr*   c               $    V ^8  d   QhRRRRRR/# )r    destinationrt   r  rJ   r$   r4   r%   )r&   s   "r'   r(   r    s!      C T d r*   c                	J   < Wn         W n        R V n        \        SV `  4        R # rq   )r  r  linkr   r   )r8   r  r  r   s   &&&r'   r   ImageItem.__init__  s     &$ $	r*   c                    V ^8  d   QhRRRR/# r1   r%   )r&   s   "r'   r(   r    s     " " "D "r*   c                	~   < VP                   P                  V n        \        R R7      V n        \        SV `  V4       R# rg   )ru   r  r   r>   r   r9   )r8   r2   r   s   &&r'   r9   ImageItem.on_enter  s/    ))..	(	!r*   c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r    s$      )7	r*   c              #  	  "   \        V P                  ;'       g    V P                  ;'       g    R R7      pV P                  ;'       g<    \	        V P                  P                  R4      P                  R^4      R,          4      pV P                  '       d   VP                  V4       \        P                  ! RVRRR7      pVx  R # 5i)Nr  /u   🌆 r   r   )end)
r   r  r  r>   r   striprsplitr  r  assemble)r8   rQ   rR   
link_styletitler>   s   &&&   r'   rU   ImageItem.__rich_console__  s      		 E ET-=-= E EF
		QQT$"2"2"8"8"="D"DS!"LR"PQ???MM*%}}WeSb9
s   ,C	C	
AC	1C	)r  r  r  r>   )rW   rX   rY   rZ   r`   r   r\   r.   r   r9   rU   r]   r   r   s   @r'   r  r    s=    -H
I 
I " "
 r*   r  c                  d    ] tR tRtRtRR R llt]R R l4       tR R	 ltR
 R lt	R R lt
RtR# )r3   i  z!Manages the console render state.Nc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r    rQ   r   rR   r   rm   r   inline_code_lexer
str | Noneinline_code_themert   r$   r4   r%   )r&   s   "r'   r(   MarkdownContext.__annotate__  sN     R RR  R 	R
 &R R 
Rr*   c                	    Wn         W n        \        V4      V n        \	        4       V n        R V n        Ve   \        RWER7      V n        R # R # )Nr   )r   )rQ   rR   r   style_stackr   stack_syntaxr   )r8   rQ   rR   rm   r  r  s   &&&&&&r'   r   MarkdownContext.__init__  sE     '1%'8-2W
&*(!"&7QDL )r*   c                   V ^8  d   QhRR/# r    r$   r   r%   )r&   s   "r'   r(   r    s     ( (u (r*   c                .    V P                   P                  # )z>Current style which is the product of all styles on the stack.)r  currentr   s   &r'   ru   MarkdownContext.current_style  s     '''r*   c               $    V ^8  d   QhRRRRRR/# )r    r>   rt   	node_typer$   r4   r%   )r&   s   "r'   r(   r    s!     	/ 	/C 	/C 	/D 	/r*   c                r   VR9   d   V P                   e}   V P                   P                  V4      pVP                  4        V P                  P                  P                  V \        P                  ! W0P                  P                  R7      4       R# V P                  P                  P                  W4       R# )z#Called when the parser visits text.Nr   >   fencecode_inline)
r  	highlightr   r  toprA   r   r  r  r  )r8   r>   r  highlight_texts   &&& r'   rA   MarkdownContext.on_text  s|    00T\\5M!\\33D9N!!#JJNN""dmmN:J:J:R:RS JJNN""4.r*   c                    V ^8  d   QhRRRR/# )r    rl   str | Styler$   r   r%   )r&   s   "r'   r(   r    s     " "k "e "r*   c                    V P                   P                  VRR7      pV P                  P                  V4       V P                  # )zEnter a style context.rc   r   )rQ   r   r  pushru   )r8   rl   rm   s   && r'   rk   MarkdownContext.enter_style  s;    &&z6&Be$!!!r*   c                   V ^8  d   QhRR/# r  r%   )r&   s   "r'   r(   r    s      U r*   c                :    V P                   P                  4       pV# )zLeave a style context.)r  pop)r8   rm   s   & r'   ry   MarkdownContext.leave_style  s      $$&r*   )r  rQ   rR   r  r  )Nmonokai)rW   rX   rY   rZ   r`   r   propertyru   rA   rk   ry   r]   r%   r*   r'   r3   r3     s3    +R" ( (	/" r*   r3   c                      ] tR tRt$ Rt/ R]bR]bR]bR]bR]bR]	bR	]
bR
]
bR]bR]bR]bR]bR]bR]bR]bR]btR]R&   0 RmtRR R lltR R ltR R ltRtR# )r"   i  a  A Markdown renderable.

Args:
    markup (str): A string containing markdown.
    code_theme (str, optional): Pygments theme for code blocks. Defaults to "monokai". See https://pygments.org/styles/ for code themes.
    justify (JustifyMethod, optional): Justify value for paragraphs. Defaults to None.
    style (Union[str, Style], optional): Optional style to apply to markdown.
    hyperlinks (bool, optional): Enable hyperlinks. Defaults to ``True``.
    inline_code_lexer: (str, optional): Lexer to use if inline code highlighting is
        enabled. Defaults to None.
    inline_code_theme: (Optional[str], optional): Pygments theme for inline code
        highlighting, or None for no highlighting. Defaults to None.
paragraph_openheading_openr  
code_blockblockquote_openhrrX  ordered_list_openlist_item_openimage
table_open
tbody_open
thead_opentr_opentd_openth_openz*ClassVar[dict[str, type[MarkdownElement]]]r   Nc               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# )r    markuprt   r   rj   zJustifyMethod | Nonerm   r  r  rJ   r  r  r  r$   r4   r%   )r&   s   "r'   r(   Markdown.__annotate__%  sd     A AA A &	A
 A A &A &A 
Ar*   c                	    \        4       P                  R 4      P                  R4      pWn        VP                  V4      V n        W n        W0n        W@n        WPn        W`n	        T;'       g    TV n
        R# )strikethroughr  N)r   enabler  parseparsedr   rj   rm   r  r  r  )	r8   r  r   rj   rm   r  r  r  parsers	   &&&&&&&& r'   r   Markdown.__init__%  s`     $$_5<<WEll6*$-4
$!2!2!@!@jr*   c                    V ^8  d   QhRRRR/# )r    tokenszIterable[Token]r$   r%   )r&   s   "r'   r(   r  9  s      o / r*   c              #     "   V Fl  pVP                   R8H  pVP                  R8H  pVP                  '       d6   V'       g.   V'       g&   V P                  VP                  4       Rj  xL
  Kh  Vx  Kn  	  R#  L5i)zFlattens the token stream.r  imgN)rI  r   children_flatten_tokens)r8   r  r#   is_fenceis_images   &&   r'   r  Markdown._flatten_tokens9  s[     EzzW,HyyE)H~~~x8//???  @s   =A9 A9A9&A7'A9c               $    V ^8  d   QhRRRRRR/# rP   r%   )r&   s   "r'   r(   r  C  s)     }0 }0}0)7}0	}0r*   c              #    "   VP                  V P                  RR7      pVP                  RR7      p\        VVVV P                  V P
                  R7      pV P                  pV P                  pRp\        P                  ! 4       pV P                  V4       EF  p	V	P                  p
V	P                  pV	P                  ^8H  pV	P                  R8H  pV	P                  ^ 8H  pV
R8X  d   VP                  V	P                  V
4       Kn  V
R8X  d   VP                  R	V
4       K  V
R
8X  d   VP                  RV
4       K  V
R8X  d   \!        V	P"                  P%                  RR4      4      pV P&                  '       d;   VP                  RRR7      pV\)        VR7      ,          pVP+                  V4       EK  VP,                  P/                  \0        P3                  W	4      4       EKM  V
R8X  d`   V	P                  R8X  d(   VP                  RRR7      pVP+                  V4       EK  V	P                  R8X  d   VP5                  4        EK  EK  V
R8X  Ed)   V P&                  '       d   VP5                  4        EK  VP,                  P7                  4       p\9        V\0        4      '       g   Q hVP                  RRR7      pVP+                  V4       VP                  VP:                  P<                  V
4       VP5                  4        VP                  RV
4       VP                  RRR7      pVP+                  V4       VP                  VP>                  V
4       VP5                  4        VP                  RV
4       EK  W9   d   V
R8w  d   V
R8w  d   V'       d   VP+                  RV 24       EK  V'       d   VP5                  4        EK1  VP+                  RV 24       V	P                  '       d   VP                  V	P                  V
4       VP5                  4        EK  V P@                  P%                  V	P                  4      ;'       g    \B        pVP3                  W	4      pV'       g	   V'       d-   VP,                  P/                  V4       VPE                  V4       V'       d   VP,                  P7                  4       pVP,                  '       * ;'       g;    VP,                  ;'       d'    VP,                  PF                  PI                  VV4      pV'       d1   V'       d   Vx  VPK                  VVPL                  4       Rj  xL
  MV'       d   VP,                  P7                  4        V	P                  pVe   VP                  VV4       VP,                  '       * ;'       g;    VP,                  ;'       d'    VP,                  PF                  PI                  VV4      pV'       d8   V'       d   V
R8w  d   Vx  VPK                  VVPL                  4       Rj  xL
  V'       g   V'       g   EK  VPO                  V4       VPP                  pEK  	  R#  EL L>5i)zRender markdown to the console.rc   r   N)height)r  r  Fr>   	hardbreakr   	softbreakr   	link_openr}  r   zmarkdown.link_urlr  html_inlinez<kbd>zmarkdown.kbdboldz</kbd>
link_closezmarkdown.linkz ()r  r  r   inliner  ))r   rm   r   r3   r  r  r  inlinesr   r   r  rI  r   nestingrA   r
  rt   r:  r   r  r   rk   r  r  ry  r.   ry   r  rs   r>   plainr}  r   r_   r9   r  rM   renderrR   rE   r   )r8   rQ   rR   rm   r2   r  inline_style_tagsr   _new_line_segmentr#   r  r   enteringexitingself_closingr}  r  	kbd_styler  link_url_styleelement_classshould_renderr>   s   &&&                    r'   rU   Markdown.__rich_console__C  s     !!$**f!=...-!"44"44
  LL#LLN))&1E

I))C}})Hmmr)G ==A-LF"y9k)i0k)Y/k)5;;??6267???!(!2!23FPV!2!WJ%T"22J''
3MM&&t{{4'?@m+==G+ ' 1 1.& 1 QI''	2]]h.'')l*???'')%mm//1G%gt4444!(!2!2?F!2!SJ''
3OOGLL$6$6	B'')OOD)4%,%6%6+V &7 &N ''7OOGLL)<'')OOC3((- '')C5(9: '') '')C5(9:}}}yA'') !% 1 1%** = O O'..t;|MM&&w/$$W-%mm//1G(/$5 % % O O#MM--<<WgN "
 %#"33#*>>'7??#KKK!MM%%' ==D'6 $MM) O O"== O O#MM--<<WgN "
 %#	X(="33#*>>'7??#KKKll$$W-&//HW 2p L Ls   I Y#D1YY48Y-AY'Y03Y$1YY*.YY!#YYYAY&Y:.Y)Y1*YYY(Y3%YY)r   r  r  r  rj   r  r  rm   >   semr   strong)r  Nrc   TNN)rW   rX   rY   rZ   r`   r|   r   r   r   r   rD  rT  r  r   r   r   r  r3  r   r[   r  r   r  rU   r]   r%   r*   r'   r"   r"     s    <)<< 	< 	i	<
 	:< 	n< 	K< 	[< 	(< 	< 	l< 	&< 	(< 	?< 	#<  	#!<H8 & ,GA(}0 }0r*   r"   __main__z(Render Markdown to the console with Rich)descriptionpathPATHz%path to markdown file, or - for stdin)metavarhelpz-cz--force-colorforce_color
store_truezforce color for non-terminals)destactionr   r  z-tz--code-themer   r  zpygments code theme)r
  r   r  z-iz--inline-code-lexerr  z-yz--hyperlinksr  zenable hyperlinks)r
  r  r  z-wz--widthr   z*width of output (default will auto-detect))rI  r
  r   r  z-jz	--justifyrj   zenable full text justifyz-pz--pagepagezuse pager to scroll output)r   r   zutf-8)encodingfullrh   )rj   r   r  r  )fileforce_terminalr   T)r  r   record)\
__future__r   sysdataclassesr   typingr   r   r   markdown_itr   markdown_it.tokenr	   
rich.tabler
   r   r   _loopr   _stackr   rQ   r   r   r   r   
containersr   jupyterr   ruler   segmentr   rm   r   r   r   r   r>   r   r   r   r_   rb   r|   r   r   r   r   r   r   r   r   r  r3  rD  rT  ry  r  r3   r"   rW   argparseArgumentParserr  add_argumentrJ  
parse_argsargsrich.consoler  stdinreadmarkdown_bodyopenmarkdown_filerj   r   r  r  r!   r  iopydocStringIOfileior  r   printpagergetvaluer%   r*   r'   <module>r1     s   " 
 ! / / " #     I I # !   $   6 6r_ /   (   
k D 2 4
_ 
&? &R	 		 		o 	+ +@/ @'{ 'T; % %P- -`0| 0D z$$>F 4  
 ,   "            9   '   )   D$yyC		($))g..-)..0M / ,,,F????00H yyy(8(8


 	hFOO%& ++4::d
 	h L /..s   NN"	