+
     h7  c                   s  a  R< tR0 t ^ RIt^ RIHtHtHt ^ RIHt ^ RIH	t	H
t
HtHtHtHtHt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H t  ^RI!H"t" ^RI#H$t$  ! R R]4      t% ! R R]]4      t&]'R8X  EdH   ^ RI(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I0H&t& ^RI1H2t2 ^RI3H4t4 ^RI5H6t6 ^RI7H8t8 ]! 4       t]6! RRRR7      t5]8! RR R!4      t7]7Ps                  R"R#R$4       R%]2! R&4      R']7R(R)R*R+R,/R-]5]4! R.4      .	t:]+! ]:4      t;. R=Ot<]&! ]R/7      ;_uu_ 4       t=/ t>] ^ k ]?! ^d4       EF  t@]<]@]A! ]<4      ,          ,          tB]< EF_  tC]C]B8X  d   K  ])P                  ! R04       ](P                  ! ^ ^
4      ^8  d   ]P                  ]G! ];4      4       ^](PP                  ! 4       R1,          ^,           ,          ]>]B]C3&   ]A! ]>4      ]A! ]<4      ^,
          8  d-   ]>P                  ]I! ]>P                  4       4      ^ ,          4       ]8! R2R37      t7]7P                  R44       ]7P                  R54       ]7P                  R64       ]>P                  4        F/  w  w  tMtNtO]7Ps                  ]M]N]$! ]OR7 ]OR88  d   R9MR:R;7      4       K1  	  ]=P                  ]/P                  ! ]74      4       EKb  	  EK  	  RRR4       R# R#   + '       g   i     R# ; i)>    N)EventRLockThread)TracebackType)IOAnyCallableListOptionalTextIOTypecast)get_console)ConsoleConsoleRenderableRenderableType
RenderHook)Control)	FileProxy)JupyterMixin)
LiveRenderVerticalOverflowMethod)Screen)Textc                   sf   a a ] tR t^t oRtV3R lV 3R lltV3R lR ltV3R lR ltRtVt	V ;t
# )	_RefreshThreadz3A thread that calls refresh() at regular intervals.c                s(   < V ^8  d   QhRRRS[ RR/# )   liveLiverefresh_per_secondreturnN)floatformat__classdict__   ":/usr/lib/python3.14/site-packages/pip/_vendor/rich/live.py__annotate___RefreshThread.__annotate__   s"     & &V & &4 &    c                s^   < Wn         W n        \        4       V n        \        SV `  R R7       R# )T)ZdaemonN)r   r   r   doneZsuper__init__)selfr   r   	__class__s   &&&r$   r)   Z_RefreshThread.__init__   s'    	"4G	%r'   c                   < V ^8  d   QhRR/# r   r   N r    r#   r$   r%   r&      s      d r'   c                s:    V P                   P                  4        R # N)r(   Zsetr*      &r$   stopZ_RefreshThread.stop   s    		r'   c                r,   r-   r.   r    r#   r$   r%   r&      s     ( (T (r'   c                sX   V P                   P                  ^V P                  ,          4      '       gd   V P                  P                  ;_uu_ 4        V P                   P                  4       '       g   V P                  P                  4        RRR4       K  R#   + '       g   i     K  ; i)i   N)r(   waitr   r   _lockZis_setrefreshr0   r1   r$   runZ_RefreshThread.run   sd    ))..T%<%<!<==yy''))II%%' ! > s   ;BB)	)r(   r   r   )__name__
__module____qualname____firstlineno____doc__r)   r2   r6   __static_attributes____classdictcell__Z__classcell__)r+   r"   s   @@r$   r   r      s+     =& & ( ( (r'   r   c                   sZ  a  ] tR t^#t o RtR+RRRRRRR^R	RR
RRRRRRR/	V 3R lR lllt]V 3R lR l4       tV 3R lR ltR,V 3R lR llt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR  lt]V 3R! lR" l4       tR#R/V 3R$ lR% lltV 3R& lR' ltV 3R( lR) ltR*tV tR# )-r   a  Renders an auto-updating live display of any given renderable.

Args:
    renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
    console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.
    screen (bool, optional): Enable alternate screen mode. Defaults to False.
    auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()` or `update()` with refresh flag. Defaults to True
    refresh_per_second (float, optional): Number of times per second to refresh the live display. Defaults to 4.
    transient (bool, optional): Clear the renderable on exit (has no effect when screen=True). Defaults to False.
    redirect_stdout (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
    redirect_stderr (bool, optional): Enable redirection of stderr. Defaults to True.
    vertical_overflow (VerticalOverflowMethod, optional): How to handle renderable when it is too tall for the console. Defaults to "ellipsis".
    get_renderable (Callable[[], RenderableType], optional): Optional callable to get renderable. Defaults to None.
NconsolescreenFauto_refreshTr   	transientredirect_stdoutredirect_stderrvertical_overflowZellipsisget_renderablec                s   < V ^8  d   QhRS[ S[,          RS[ S[,          RS[RS[RS[RS[RS[RS[R	S[R
S[ S[. S[3,          ,          RR/# )r   
renderabler>   r?   r@   r   rA   rB   rC   rD   rE   r   N)r	   r   r   boolr   r   r   r    r#   r$   r%   Live.__annotate__3   s     &
 &
^,&
 '"	&

 &
 &
 "&
 &
 &
 &
 2&
 !"n*<!=>&
 
&
r'   c       	        s   V^ 8  g   Q R4       hWn         Ve   TM	\        4       V n        W0n        RV n        Wpn        Wn        RV n        RV n        \        4       V n
        RV n        W@n        RV n        V'       d   RMTV n        RV n        WPn        Wn        Wn        \'        V P)                  4       V	R7      V n        R# )r    zrefresh_per_second must be > 0NFT)rD   )_renderabler   r>   _screen_alt_screen_redirect_stdout_redirect_stderr_restore_stdout_restore_stderrr   r4   
ipy_widgetr@   _startedrA   _refresh_threadr   rD   _get_renderabler   rE   _live_render)r*   rF   r>   r?   r@   r   rA   rB   rC   rD   rE   s   &&$$$$$$$$$r$   r)   ZLive.__init__3   s     "A%G'GG%%")"5w;=  / /2626W
)-(#!'Y9="4!2-&!5F
r'   c                    < V ^8  d   QhRS[ /# r   r   rG   r    r#   r$   r%   rH   \   s      D r'   c                s    V P                   # )z'Check if live display has been started.)rQ   r0   r1   r$   
is_startedZLive.is_started[   s     }}r'   c                rU   rV   r   r    r#   r$   r%   rH   `   s          r'   c                sn    V P                   e   V P                  4       MV P                  pT;'       g    R# )N )rS   rI   r*   rF      & r$   rE   ZLive.get_renderable`   s<     ##/   "!! 	
 Rr'   c                s$   < V ^8  d   QhRS[ RR/# )r   r5   r   NrW   r    r#   r$   r%   rH   h   s     - -T -d -r'   c                s   V P                   ;_uu_ 4        V P                  '       d    RRR4       R# V P                  P                  V 4       RV n        V P                  '       d!   V P                  P                  R4      V n        V P                  P                  R4       V P                  4        V P                  P                  V 4       V'       d    V P                  4        V P                  '       d5   \        W P                  4      V n        V P                   P#                  4        RRR4       R#   \         d    T P                  4        h i ; i  + '       g   i     R# ; i)zdStart live rendering display.

Args:
    refresh (bool, optional): Also refresh. Defaults to False.
NTF)r4   rQ   r>   Zset_liverJ   set_alt_screenrK   show_cursor_enable_redirect_ioZpush_render_hookr5   Z	Exceptionr2   r@   r   r   rR   start)r*   r5   s   &&r$   r`   Z
Live.starth   s     ZZZ}}} Z LL!!$' DM|||#'<<#>#>t#D LL$$U+$$&LL))$/LLN    '5d<S<S'T$$$**,- Z ! 
 IIK ZZs5   E3E'A-ED6&E84E6EEE'	c                r,   r-   r.   r    r#   r$   r%   rH      s     0 0d 0r'   c           
     s   V P                   ;_uu_ 4        V P                  '       g    RRR4       R# V P                  P                  4        RV n        V P                  '       d0   V P
                  e"   V P
                  P                  4        RV n        RV n        V P                  ;_uu_ 4         V P                  '       g-   V P                  P                  '       g   V P                  4        V P                  4        V P                  P                  4        V P                  '       g7   V P                  P                  '       d   V P                  P                  4        V P                  P                  R4       V P                  '       d   V P                  P!                  R4       V P"                  '       dF   V P                  '       g4   V P                  P%                  V P&                  P)                  4       4       V P*                  e-   V P"                  '       d   V P*                  P-                  4        RRR4       RRR4       R#   T P                  4        T P                  P                  4        T P                  '       g7   T P                  P                  '       d   T P                  P                  4        T P                  P                  R4       T P                  '       d   T P                  P!                  R4       T P"                  '       dF   T P                  '       g4   T P                  P%                  T P&                  P)                  4       4       T P*                  e/   T P"                  '       d   T P*                  P-                  4        i i i ; i  + '       g   i     ELm; i  + '       g   i     R# ; i)zStop live rendering display.NFZvisibleT)r4   rQ   r>   Z
clear_liver@   rR   r2   rD   rK   
is_jupyterr5   _disable_redirect_ioZpop_render_hookis_terminalZliner^   r]   rA   controlrT   Zrestore_cursorrP   Zcloser0   r1   r$   r2   Z	Live.stop   sk   ZZZ=== Z LL##%!DM   T%9%9%E$$))+'+$%.D"0+++DLL4K4K4K--/LL002+++0H0H0H))+LL,,T2'''33E:~~~d.>.>.>,,T->->-M-M-OP2t~~~--/!  Z  --/LL002+++0H0H0H))+LL,,T2'''33E:~~~d.>.>.>,,T->->-M-M-OP2t~~~--/ 8F2  ZZs   N32N3&A
N30N	2-I I0AN	AN	,N	<N	AN	!N	;N3AN&AN-,NN,AN?NN	N0*	N33O	c                r,   )r   r   r   r.   r    r#   r$   r%   rH      s      6 r'   c                sB    V P                  V P                  R JR7       V # )N)r5   )r`   rI   r0   r1   r$   	__enter__ZLive.__enter__   s     

4++47
8r'   c                sp   < V ^8  d   QhRS[ S[S[,          ,          RS[ S[,          RS[ S[,          RR/# )r   exc_typeexc_valexc_tbr   N)r	   r   ZBaseExceptionr   r    r#   r$   r%   rH      sG      4./ -( '	
 
r'   c                s&    V P                  4        R # r/   )r2   )r*   rf   rg   rh   s   &&&&r$   __exit__ZLive.__exit__   s     			r'   c                r,   r-   r.   r    r#   r$   r%   rH      s     Q QT Qr'   c                s   V P                   P                  '       g   V P                   P                  '       Ed   V P                  '       dq   \	        \
        P                  \        4      '       gM   \
        P                  V n        \        R\        V P                   \
        P                  4      4      \
        n        V P                  '       du   \	        \
        P                  \        4      '       gO   \
        P                  V n        \        R\        V P                   \
        P                  4      4      \
        n        R# R# R# R# )z&Enable redirecting of stdout / stderr.r
   N)r>   rc   ra   rL   
isinstancesysstdoutr   rN   r   rM   stderrrO   r0   r1   r$   r_   ZLive._enable_redirect_io   s    <<###t||'>'>'>$$$Z

I-N-N'*zz$!(IdllCJJ,OP
$$$Z

I-N-N'*zz$!(IdllCJJ,OP
 .O$	 (?r'   c                r,   r-   r.   r    r#   r$   r%   rH      s     ( (d (r'   c                s    V P                   '       d'   \        RV P                   4      \        n        RV n         V P                  '       d)   \        RV P                  4      \        n        RV n        R# R# )z'Disable redirecting of stdout / stderr.r
   N)rN   r   rk   rl   rO   rm   r0   r1   r$   rb   ZLive._disable_redirect_io   sW    h(<(<=CJ#'D h(<(<=CJ#'D   r'   c                rU   rV   rY   r    r#   r$   r%   rH      s     F FN Fr'   c                s`    V P                  4       pV P                  '       d   \        V4      # T# )z_Get the renderable that is being displayed

Returns:
    RenderableType: Displayed renderable.
)rE   rK   r   r[   r\   r$   rF   ZLive.renderable   s-     ((*
%)%5%5%5vj!E:Er'   r5   c                s*   < V ^8  d   QhRS[ RS[RR/# )r   rF   r5   r   N)r   rG   r    r#   r$   r%   rH      s"       T d r'   c               s   \        V\        4      '       d   V P                  P                  V4      pV P                  ;_uu_ 4        Wn        V'       d   V P                  4        RRR4       R#   + '       g   i     R# ; i)zUpdate the renderable that is being displayed

Args:
    renderable (RenderableType): New renderable to use.
    refresh (bool, optional): Refresh the display. Defaults to False.
N)rj   strr>   Z
render_strr4   rI   r5   )r*   rF   r5   s   &&$r$   updateZLive.update   sL     j#&&00<JZZZ) ZZZs   A//B 	c                r,   r-   r.   r    r#   r$   r%   rH      s     2 2 2r'   c           	     s   V P                   ;_uu_ 4        V P                  P                  V P                  4       V P                  P
                  '       d    ^ RIHp ^ RIH	p V P                  f   V! 4       V n
        V! V P                  4       V P                  ;_uu_ 4        V P                  P                  RR7       V P                  P                  V P                  P                  4       RRR4       MV P                  P                   '       d^   V P                  P"                  '       gB   V P                  ;_uu_ 4        V P                  P                  \%        4       4       RRR4       MdV P&                  '       gS   V P(                  '       gA   V P                  ;_uu_ 4        V P                  P                  \%        4       4       RRR4       RRR4       R#   + '       g   i     L; i  \         d    ^ RIpTP                  R4        L?i ; i  + '       g   i     LS; i  + '       g   i     Lf; i  + '       g   i     R# ; i)z&Update the display of the Live Render.)display)OutputNT)r3   z(install "ipywidgets" for Jupyter support)r4   rT   Zset_renderablerF   r>   ra   ZIPython.displayrp   Z
ipywidgetsrq   rP   Zclear_outputZprintZImportErrorwarningsZwarnrc   Zis_dumb_terminalr   rQ   rA   )r*   rp   rq   rr   s   &   r$   r5   ZLive.refresh   sh   ZZZ,,T__=||&&&I71 .*0(044$4?**4+<+<+G+GH ) )))$,,2O2O2O\\\LL&&wy1 "\ MMM$...\\\LL&&wy1 "1 Z ) # N#MM"LMN "\
 "\1 ZZs   AH?G3$A H?$AG 	0$H?H?1H?$H	)H?H?H?*$H,	H? G0+H?3 HH?HH?H)$H?,H<7H??I	c                sF   < V ^8  d   QhRS[ S[,          RS[ S[,          /# )r   renderablesr   )r   r   r    r#   r$   r%   rH      s)       12		 r'   c                s   V P                   V P                  n         V P                  P                  '       dr   V P                  ;_uu_ 4        V P
                  '       d   \        P                  ! 4       MV P                  P                  4       pV.VOV P                  NpRRR4       V# V P                  '       g#   V P                  '       g   . VOV P                  NpV#   + '       g   i     T# ; i)z;Process renderables to restore cursor and display progress.N)rD   rT   r>   Zis_interactiver4   rK   r   ZhomeZposition_cursorrQ   rA   )r*   rs   Zresets   && r$   process_renderablesZLive.process_renderables   s     /3.D.D+<<&&& ''' LLN**::< 
  %F{FD4E4EF  	 dnnn;K;):):;K  s   ACC0	)rK   rS   rT   r4   rM   rL   rR   rI   rO   rN   rJ   rQ   r@   r>   rP   r   rA   rD   r/   )F)r7   r8   r9   r:   r;   r)   ZpropertyrX   rE   r`   r2   re   ri   r_   rb   rF   ro   r5   rt   r<   r=   )r"      @r$   r   r   #   s    &
 &*	&

 &
 "&
 %&&
  &
 !%&
 !%&
 5?&
 BF&
 &
P     - -<0 0>  Q Q( ( F FE  2 2: r'   r   Z__main__)cycle)Dictr   Tuple)Align)r   )r   )Panel)Rule)Syntax)Tablea~  def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
    """Iterate and generate a tuple with a flag for last value."""
    iter_values = iter(values)
    try:
        previous_value = next(iter_values)
    except StopIteration:
        return
    for value in iter_values:
        yield False, previous_value
        previous_value = value
    yield True, previous_valueZpythonT)Zline_numbersZfooZbarZbazZ1Z2Z3zYou can make the terminal shorter and taller to see the live table hideText may be printed while the progress bars are rendering.z(In fact, [i]any[/i] renderable will workzSuch as [magenta]tables[/]...zPretty printed structures...ZtypeZexampletextzPretty printedz	Syntax...zGive it a try!)r>   g?i@  zExchange Rates)ZtitlezSource CurrencyzDestination CurrencyzExchange Ratez.4fg      ?ZredZgreen)Zstylec                s    V ^8  d   Qh/ ^ \         9   d,   \        \        \        \        3,          \        3,          ;R&   # )r   exchange_rate_dict)__conditional_annotations__rw   rx   rn   r   )r!   s   "r$   r%   r%      s,    

l
 	>=DsCx%!78=m
 r'   )ZSGDZMYRZEURZUSDZAUDZJPYZCNHZHKDZCADZINRZDKKZGBPZRUBZNZDZMXNZIDRZTWDZTHBZVND)Sr   rk   Z	threadingr   r   r   Ztypesr   Ztypingr   r   r   r   r	   r
   r   r   rZ   r   r>   r   r   r   r   rd   r   Z
file_proxyr   Zjupyterr   Zlive_renderr   r   r?   r   r~   r   r   r   r7   ZrandomZtimeZ	itertoolsrv   rw   rx   Zalignry   r   Zpanelrz   Zruler{   Zsyntaxr|   Ztabler}   Zadd_rowZprogress_renderablesZexamplesZ	exchangesZ
live_tabler   ZrangeZindexZlenZselect_exchangeZexchangeZsleepZrandintZlogZnextZpopZlistZkeysZ
add_columnZitemsZsourceZdestZexchange_ratero   Zcenterr%   )r   ru   r$   <module>r      s   

 * *  H H H  K K  ! ! ;  (V (&i< iX z(( "iG
	" 	F  %&E	MM#sC 	E89'&	F$45 )*HI* 
g		*;==3ZE'I(>?O%.

3>>!R(1,KKX/BE]]_s*a/C"OX#>? )*S^a-??&**40B0G0G0I+J1+MN$45  !23  !78  15G5M5M5O1NVTMMM,S1+83+>%G 6P !!%,,u"567 &   
	O N 
		s   /FKK 	