
    Cje>                       S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	  SSK
JrJr  SSKJrJrJrJr  SSKrSS	KJr  SS
KJr  SSKJr  SSKJr  \(       a  SSKJr  \	" SSSSSSSSSSSSS5      r\	" SSSSSSSSSSSS5      r \	" SSSSSSSSSS5
      r!\	" SSSSSSSSSSSSS5      r"\RF                  RI                  5       \" SS9 " S S5      5       5       r\" 5       r%g) a  
The Style class contains all the information needed to generate styled terminal output.

You won't often need to create Style objects directly, if you are using [Content][textual.content.Content] for output.
But you might want to use styles for more customized widgets.
    )annotations)	dataclass)cached_property	lru_cache)
attrgetter)dumpsloads)TYPE_CHECKINGAnyIterableMappingN)Style)TerminalTheme)
active_app)Color)
StylesBase
background
foregroundbolddimitalic	underline
underline2reversestrikeblinklink
auto_color_metametaT)frozenc                     \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   Sr	S\S	'   Sr
S\S
'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   S1S jr\S2S j5       r\S3S j5       rS3S jrS4S jrS2S jrS5S jr\S5S j5       r\S5S j5       r\" S S!9S6S" j5       r\r\ S7S# j5       r!\ S8S9S$ jj5       r"\ S:S% j5       r#\  S8     S;S& jj5       r$\ S<S' j5       r%\ S=S( j5       r&\S>S) j5       r'S?S* jr(\S7S+ j5       r)\S7S, j5       r*\+S2S- j5       r,\ S@S. j5       r-\SAS/ j5       r.S0r/g)Br   Z   zRepresents a style in the Visual interface (color and other attributes).

Styles may be added together, which combines their style attributes.

NzColor | Noner   r   zbool | Noner   r   r   r   r   r   r   r   z
str | Noner   zbytes | Noner   Fboolr   c              #    #    SU R                   S 4v   SU R                  S 4v   SU R                  S 4v   SU R                  S 4v   SU R                  S 4v   SU R
                  S 4v   SU R                  S 4v   SU R                  S 4v   S	U R                  S 4v   S
U R                  S 4v   SU R                  S 4v   U R                  b  SU R                  4v   g g 7f)Nr   r   r   r   r   r   r   r   r   r   r   r    )r   r   r   r   r   r   r   r   r   r   r   r   r    selfs    _/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/style.py__rich_repr__Style.__rich_repr__q   s     DOOT11DOOT11dii%%TXXt##T))4>>4//DOOT11t++T))tzz4''dii%%::!$))## "s   CCc                    [        U 5      S:H  $ )N)NNNNNNNNNNNN)_get_simple_attributesr&   s    r(   _is_nullStyle._is_null   s    %d+ 0
 
 	
    c                *    [        [        U 5      5      $ )z!A hash of the style's attributes.)hash_get_hash_attributesr&   s    r(   r1   
Style.hash   s     (.//r/   c                    U R                   $ N)r1   r&   s    r(   __hash__Style.__hash__   s    yyr/   c                j    [        U[        5      (       d  [        $ U R                  UR                  :H  $ r5   )
isinstancer   NotImplementedr1   )r'   others     r(   __eq__Style.__eq__   s(    %''!!yyEJJ&&r/   c                $    U R                   (       + $ r5   )r-   r&   s    r(   __bool__Style.__bool__   s    ==  r/   c                    U R                   $ r5   )style_definitionr&   s    r(   __str__Style.__str__   s    $$$r/   c                   / nUR                   nU R                  b  U" U R                  R                  5        U R                  b  U" SU R                  R                   35        U R                  b  U" U R                  (       a  SOS5        U R
                  b  U" U R
                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS	5        U R                  b  U" U R                  (       a  S
OS5        U R                  b  U" U R                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS5        U R                  bM  SU R                  ;  a  U" SU R                   S35        O&SU R                  ;  a  U" SU R                   S35        U R                  b  U R                  R                  5        Hd  u  p4[        U[         5      (       a<  SU;  a  U" U SU S35        M0  SU;  a  U" U SU S35        MF  U" U SU< 35        MV  U" U SU< 35        Mf     SR#                  U5      $ )z=Style encoded in a string (may be parsed from `Style.parse`).on r   not boldr   not dimr   
not italicr   not underliner   not underline2r   
not striker   	not blink'zlink='"zlink="z='z="= appendr   cssr   r   r   r   r   r   r   r   r   r   r    itemsr9   strjoinr'   outputoutput_appendkeyvalues        r(   rB   Style.style_definition   s    ??&$//--.??&C 3 345699 DII&:>88488%;;;"dkk(|D>>%+_M??&$//,?OP;;"dkk(|D::!TZZ'[A99 $))#tyyk34DII%tyyk34::!"iioo/
eS))#~%Rwa&89C%Rwa&89%Qui&89!SE5)"45 0 xxr/   c                   / nUR                   nU R                  b  U" U R                  R                  5        U R                  b  U" SU R                  R                   35        U R                  b  U" U R                  (       a  SOS5        U R
                  b  U" U R
                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS	5        U R                  b  U" U R                  (       a  S
OS5        U R                  b  U" U R                  (       a  SOS5        U R                  b  U" U R                  (       a  SOS5        U R                  b  U" S5        U R                  bE  U R                  R                  5        H'  u  p4[        U[         5      (       d  M  U" U S35        M)     SR#                  U5      $ )z(Identifier used to close tags in markup.rF   r   rG   r   rH   r   rI   r   rJ   r   rK   r   rL   r   rM   r   rP   rQ   rR   rX   s        r(   
markup_tagStyle.markup_tag   sh    ??&$//--.??&C 3 345699 DII&:>88488%;;;"dkk(|D>>%+_M??&$//,?OP;;"dkk(|D::!TZZ'[A99 &!::!"iioo/
eS))!SE), 0 xxr/   i   )maxsizec                    [        U[        5      (       a  U R                  (       a  U$ UR                  (       a  U $ [        U 5      u  nnnnnnnn	n
nnnn[        U5      u  nnnnnnnnnnnnn[        Ub  UR                  S:X  a  UOX/-   Ub  UR                  S:X  a  UOUUc  UOUUc  UOUUc  UOUUc  UOUUc  UOUUc  U	OUUc  U
OUUc  UOUUc  UOUUb  Ub  [        0 UEUE5      5      nU$ Uc  U5      nU$ U5      nU$ Uc  U $ [        $ )Nr   )r9   r   r-   _get_attributesar   r:   )r'   r;   r   r   r   r   r   r   r   r   r   r   r   r    r   other_backgroundother_foreground
other_bold	other_dimother_italicother_underlineother_underline2other_reverseother_strikeother_blink
other_link
other_metaother__meta	new_styles                                r(   __add__Style.__add__   s   eU##}}~~  %"  &     #*jlla.? %#6 )04D4F4F!4K )"*
 (i&.L,4	/.6
<L(0m&.L$,+"*
 ([-D 0T0Z01+I4  $/#6%/I4  =H/I4 ]K!!r/   c                    [         $ )z%Get a null (no color or style) style.)
NULL_STYLE)clss    r(   null
Style.null8  s
     r/   c                    SSK Jn   [        R                  " 5       nUR
                  R                  U5      $ ! [         a    U" X5      s $ f = f)zParse a style from text.

Args:
    text_style: A style encoded in a string.
    variables: Optional mapping of CSS variables. `None` to get variables from the app.

Returns:
    New style.
r   )parse_style)textual.markupr{   r   getLookupError
stylesheet)rw   
text_style	variablesr{   apps        r(   parseStyle.parse=  sK     	/	6.."C ~~))*55  	6z55	6s   8 AAc                ~     U R                  U5      nUR                  $ ! [         a    UR                  5       s $ f = f)zProduces a normalized from of a style, used to match closing tags with opening tags.

Args:
    text_style: Style to normalize.

Returns:
    Normalized markup tag.
)r   	Exceptionstripr_   )rw   r   styles      r(   _normalize_markup_tagStyle._normalize_markup_tagP  sC    	&IIj)E   	&##%%	&s    <<c                   [        UR                  c  SO[        R                  " UR                  USS9UR                  c  SO [        R                  " UR                  U5      UR
                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  S9$ )zBuild a Style from a (Rich) Style.

Args:
    rich_style: A Rich Style object.
    theme: Optional Rich [terminal theme][rich.terminal_theme.TerminalTheme].

Returns:
    New Style.
NF)r   )
r   r   r   r   r   r   r   r   r   r   )r   bgcolorr   from_rich_colorcolorr   r   r   r   r   r   r   r   r   r   )rw   
rich_stylethemes      r(   from_rich_styleStyle.from_rich_style`  s      %%- **:+=+=uQVW ##+ **:+;+;UC$$ **!,,&&$$"""")
 	
r/   c                   UR                   n[        UR                  UR                  (       a!  [	        SSSUR
                  R                  SS9OUR
                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  S9$ )zuCreate a Visual Style from a Textual styles object.

Args:
    styles: A Styles object, such as `my_widget.styles`.

r   T)auto)	r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   rd   r   r   r   r   r   r   r   r   )rw   stylesr   s      r(   from_stylesStyle.from_styles  s     &&
 $$ aAv||~~D9\\$$ **!,,&&$$""((
 	
r/   c                *    [        [        0 UE5      S9$ )zCreate a Visual Style containing meta information.

Args:
    meta: A dictionary of meta information.

Returns:
    A new Style.
r   )r   r   )rw   r    s     r(   	from_metaStyle.from_meta  s     5D?++r/   c                    [        U 5      u  nnnnnnnnn	n
nnUc  SOX-   n[        Uc  SOUR                  Uc  SOUR                  UUUUUUU	U
UUc  SS9$ U R                  S9$ )zJConvert this Styles into a Rich style.

Returns:
    A Rich style object.
Nr   r   r   r   r   r   r   r   r   r   r   r    r,   	RichStyle
rich_colorr    )r'   r   r   r   r   r   r   r   r   r   r   r   r   r   s                 r(   r   Style.rich_style  s    * #4(	
 #*
0G-$U-=-=&.DJ4I4I!
 	
 -1II
 	
r/   c                    [        U 5      u  nnnnnnn	n
nnnnUc  SOX4-   n[        Uc  SOUR                  Uc  SOUR                  UUUUU	U
UUU0 U R                  ESX40ES9$ )zGet a Rich style with the given offset included in meta.

This is used in text selection.

Args:
    x: X coordinate.
    y: Y coordinate.

Returns:
    A Rich Style object.
Noffsetr   r   )r'   xyr   r   r   r   r   r   r   r   r   r   r   r   r   s                   r(   rich_style_with_offsetStyle.rich_style_with_offset  s    2 #4(	
"*
0G-$U-=-=&.DJ4I4I!0DII0x!0
 	
r/   c                .    [        SS/[        U 5      Q76 $ )zThe style without any colors.N)r   !_get_simple_attributes_sans_colorr&   s    r(   without_colorStyle.without_color  s     T4J"CD"IJJr/   c                >    [        U R                  U R                  S9$ )z4Just the background color, with no other attributes.r   )r   r   r   r&   s    r(   background_styleStyle.background_style  s     T__DJJ77r/   c                ^    U R                   SL =(       d    U R                   R                  S:H  $ )z+Is the foreground transparent (or not set)?Nr   )r   rd   r&   s    r(   has_transparent_foreground Style.has_transparent_foreground  s'     $&@$//*;*;q*@@r/   c                B    [        U5      n[        U[        U5      5      $ )z*Add a number of styles and get the result.)itersumnext)rw   r   iter_styless      r(   combineStyle.combine  s     6l;[ 122r/   c                J    U R                   c  0 $ [        U R                   5      $ )z=Get meta information (can not be changed after construction).)r   r	   r&   s    r(   r    
Style.meta  s!     ZZ'r>U4::->>r/    )returnzrich.repr.Result)r   r$   )r   int)r;   r   r   r$   )r   rV   )r;   zobject | Noner   r   )r   r   r5   )r   rV   r   zdict[str, str] | Noner   r   )r   rV   r   rV   )r   r   r   zTerminalTheme | Noner   r   )r   r   r   r   )r    Mapping[str, Any]r   r   )r   r   )r   r   r   r   r   r   )r   zIterable[Style]r   r   )r   r   )0__name__
__module____qualname____firstlineno____doc__r   __annotations__r   r   r   r   r   r   r   r   r   r   r   r   r)   r   r-   r1   r6   r<   r?   rC   rB   r_   r   rs   __radd__classmethodrx   r   r   r   r   r   r   r   r   r   propertyr   r   r    __static_attributes__r   r/   r(   r   r   Z   s-     $J##J#D+CFK!I{!"J"G[FKE;D*E<J$  
 
  0 0'
!% '  ' R    > x D" !D"L H  6 6$     BF"
""
+?"
	"
 "
H 
 
4 	, 	, %
 %
N(
T K K 8 8 A A 3 3
 ? ?r/   r   )&r   
__future__r   dataclassesr   	functoolsr   r   operatorr   pickler   r	   typingr
   r   r   r   	rich.reprrich
rich.styler   r   rich.terminal_themer   textual._contextr   textual.colorr   textual.css.stylesr   r2   r,   r   rc   reprr   rv   r   r/   r(   <module>r      s7   # ! 0   8 8  ) - ' - "
	
 " $
	
  %/
	
% ! 
	

" 
$z? z?  z?z W
r/   