
     f                         d dl mZmZmZmZmZmZ erd dlmZ ddl	m
Z
 ddlmZ ddlmZ erd dlmZ dZ G d d	          Z G d
 d          Zdee         defdZdee         deddfdZdededdfdZdS )    )TYPE_CHECKINGAnyDictIterableListSequence)ConsoleRenderable   )get_console)Segment)DEFAULT_TERMINAL_THEMEz<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">{code}</pre>
c            
       f    e Zd ZdZdededdfdZdee         dee         d	edeeef         fd
Z	dS )JupyterRenderablez)A shim to write html to Jupyter notebook.htmltextreturnNc                 "    || _         || _        d S )N)r   r   )selfr   r   s      [/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/pip/_vendor/rich/jupyter.py__init__zJupyterRenderable.__init__   s    				    includeexcludekwargsc                     | j         | j        d}r fd|                                D             }r fd|                                D             }|S )Nz
text/plainz	text/htmlc                 $    i | ]\  }}|v 	||S  r   .0kvr   s      r   
<dictcomp>z7JupyterRenderable._repr_mimebundle_.<locals>.<dictcomp>   $    DDDVaqG||Aq|||r   c                 $    i | ]\  }}|v	||S r   r   r    r!   r"   r   s      r   r#   z7JupyterRenderable._repr_mimebundle_.<locals>.<dictcomp>    )    HHHVaq7G7GAq7G7G7Gr   )r   r   items)r   r   r   r   datas    ``  r   _repr_mimebundle_z#JupyterRenderable._repr_mimebundle_   sp     #idi@@ 	EDDDDtzz||DDDD 	IHHHHtzz||HHHDr   )
__name__
__module____qualname____doc__strr   r   r   r   r*   r   r   r   r   r      s        33S      }/7}HK	c3h     r   r   c                   Z    e Zd ZdZdZdddee         dee         dedeeef         f
d	Z	d
S )JupyterMixinz@Add to an Rich renderable to make it render in Jupyter notebook.r   r   r	   r   r   r   r   c                 P   t                      }t          |                    | |j                            }t	          |          }|                    |          }||d}r fd|                                D             }r fd|                                D             }|S )Nr   c                 $    i | ]\  }}|v 	||S r   r   r   s      r   r#   z2JupyterMixin._repr_mimebundle_.<locals>.<dictcomp>5   r$   r   c                 $    i | ]\  }}|v	||S r   r   r&   s      r   r#   z2JupyterMixin._repr_mimebundle_.<locals>.<dictcomp>7   r'   r   )r   listrenderoptions_render_segments_render_bufferr(   )	r   r   r   r   consolesegmentsr   r   r)   s	    ``      r   r*   zJupyterMixin._repr_mimebundle_)   s     --tW_==>>))%%h//"66 	EDDDDtzz||DDDD 	IHHHHtzz||HHHDr   N)
r+   r,   r-   r.   	__slots__r   r/   r   r   r*   r   r   r   r1   r1   $   sq        JJI!# # 	
 
c3h     r   r1   r;   r   c                    dt           dt           fd}g }|j        }t          }t          j        |           D ]X\  }}}|r	 ||          }|r7|                    |          }|r	d| d| dn|}|j        rd|j         d| d	} ||           Yd
                    |          }	t          	                    |	          }
|
S )Nr   r   c                 ~    |                      dd                               dd                               dd          S )zEscape html.&z&amp;<z&lt;>z&gt;)replace)r   s    r   escapez _render_segments.<locals>.escape<   s6    ||C))11#v>>FFsFSSSr   z<span style="z">z</span>z	<a href="z" target="_blank">z</a> )code)
r/   appendr   r   simplifyget_html_stylelinkjoinJUPYTER_HTML_FORMATformat)r;   rC   	fragmentsappend_fragmentthemer   stylecontrolrulerE   r   s              r   r8   r8   ;   s   TS TS T T T T I&O"E ' 0 : : 	 	eW 	vd|| 	L''..D<@J848848888dDz LK5:KKKKK779D%%4%00DKr   r   Nc                     t          |           }t          ||          }	 ddlm}  ||           dS # t          $ r Y dS w xY w)zRender segments to Jupyter.r   )displayN)r8   r   IPython.displayrT   ModuleNotFoundError)r;   r   r   jupyter_renderableipython_displays        r   rT   rT   T   sq    H%%D*466>>>>>>*+++++    	s   4 
AAargsr   c                  8    t                      } |j        | i |S )zProxy for Console print.)r   print)rY   r   r:   s      r   r[   r[   b   s"    mmG7=$)&)))r   )typingr   r   r   r   r   r   pip._vendor.rich.consoler	   rD   r   segmentr   terminal_themer   rK   r   r1   r/   r8   rT   r[   r   r   r   <module>r`      s   E E E E E E E E E E E E E E E E ;::::::             2 2 2 2 2 2 ;:::::: 
       $       .x0 S    2hw' s t    * * * * * * * * *r   