+
    ^eòj3  ã                  ó4  € R t ^ RIHt ^ RIt^ RIHt ^ RIHtHtH	t	 ]'       d   ^ RIH
t
  ! R R]4      t]P                  ! R4      t]P                  ! R	4      tR
t ! R R]	4      t]! 4       tR R ltR R ltR R ltR R ltR R ltR R ltR R ltR# )as  
SGR (Select Graphic Rendition) state tracking for terminal escape sequences.

This module provides functions for tracking and propagating terminal styling (bold, italic, colors,
etc.) via public API propagate_sgr(), and its dependent functions, cut() and wrap(). It only has
attributes necessary to perform its functions, eg 'RED' and 'BLUE' attributes are not defined.
)ÚannotationsN)ÚIntEnum)ÚTYPE_CHECKINGÚIteratorÚ
NamedTuple)ÚSequencec                  ó’   € ] tR t^tRt^ t^t^t^t^t	^t
^t^t^t^	t^t^t^t^t^t^t^t^t^t^%t^&t^'t^(t^/t^0t^1t^Zt^at ^dt!^kt"Rt#R# )Ú_SGRz²
SGR (Select Graphic Rendition) parameter codes.

References:
- https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
- https://github.com/tehmaze/ansi/tree/master/ansi/colour
© N)$Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚRESETÚBOLDÚDIMÚITALICÚ	UNDERLINEÚBLINKÚRAPID_BLINKÚINVERSEÚHIDDENÚSTRIKETHROUGHÚDOUBLE_UNDERLINEÚBOLD_DIM_OFFÚ
ITALIC_OFFÚUNDERLINE_OFFÚ	BLINK_OFFÚINVERSE_OFFÚ
HIDDEN_OFFÚSTRIKETHROUGH_OFFÚFG_BLACKÚFG_WHITEÚFG_EXTENDEDÚ
FG_DEFAULTÚBG_BLACKÚBG_WHITEÚBG_EXTENDEDÚ
BG_DEFAULTÚFG_BRIGHT_BLACKÚFG_BRIGHT_WHITEÚBG_BRIGHT_BLACKÚBG_BRIGHT_WHITEÚ__static_attributes__r
   ó    Úˆ/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/wcwidth/sgr_state.pyr	   r	      s¡   † ñð €EØ€DØ
€CØ€FØ€IØ€EØ€KØ€GØ€FØ€MØÐØ€LØ€JØ€MØ€IØ€KØ€JØÐØ€HØ€HØ€KØ€JØ€HØ€HØ€KØ€JØ€OØ€OØ€OØ„Or/   r	   z\x1b\[([\d;:]*)mz\x1b\[[\d;:]*mz[0mc                  óÄ   € ] tR t^Kt$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   Rt
R]R&   RtR]R	&   RtR]R
&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR# )Ú	_SGRStateaÂ  
Track active SGR terminal attributes by category (immutable).

:param bold: Bold attribute (SGR 1).
:param dim: Dim/faint attribute (SGR 2).
:param italic: Italic attribute (SGR 3).
:param underline: Underline attribute (SGR 4).
:param blink: Slow blink attribute (SGR 5).
:param rapid_blink: Rapid blink attribute (SGR 6).
:param inverse: Inverse/reverse attribute (SGR 7).
:param hidden: Hidden/invisible attribute (SGR 8).
:param strikethrough: Strikethrough attribute (SGR 9).
:param double_underline: Double underline attribute (SGR 21).
:param foreground: Foreground color as tuple of SGR params, or None for default.
:param background: Background color as tuple of SGR params, or None for default.
FÚboolÚboldÚdimÚitalicÚ	underlineÚblinkÚrapid_blinkÚinverseÚhiddenÚstrikethroughÚdouble_underlineNútuple[int, ...] | NoneÚ
foregroundÚ
backgroundr
   )r   r   r   r   r   r4   Ú__annotations__r5   r6   r7   r8   r9   r:   r;   r<   r=   r?   r@   r.   r
   r/   r0   r2   r2   K   s„   ‡ ñð" €Dˆ$ÓØ€CˆÓØ€FˆDÓØ€IˆtÓØ€Eˆ4ÓØ€K�ÓØ€GˆTÓØ€FˆDÓØ€M�4ÓØ"Ð�dÓ"Ø)-€JÐ&Ó-Ø)-€JÐ&×-r/   r2   c               ó    € V ^8„  d   QhRRRR/# )é   Ústater2   Úreturnr3   r
   )Úformats   "r0   Ú__annotate__rG   o   s   € ÷ 
Mñ 
M 	ð 
M¨dñ 
Mr/   c                óÚ  € V P                   ;'       gÙ    V P                  ;'       gÅ    V P                  ;'       g±    V P                  ;'       g�    V P                  ;'       g‰    V P
                  ;'       gu    V P                  ;'       ga    V P                  ;'       gM    V P                  ;'       g9    V P                  ;'       g%    V P                  RJ;'       g    V P                  RJ# )z…
Return True if any attributes are set.

:param state: The SGR state to check.
:returns: True if any attribute differs from default.
N)r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r?   r@   )rD   s   &r0   Ú_sgr_state_is_activerI   o   s÷   € ð �J‰J÷ Lð L˜%Ÿ)™)÷ Lð L u§|¡|÷ Lð L°u·±÷ Lð LØ�{‰{÷Lð LØ#×/Ñ/÷Lð LØ38·=±=÷Lð LØDIÇLÁL÷Lð Là×"Ñ"÷Lð Là&+×&<Ñ&<÷Lð Lð ×Ñ tÐ+÷Lð Lð 05×/?Ñ/?ÀtÐ/KðMr/   c               ó    € V ^8„  d   QhRRRR/# )rC   Úcolorztuple[int, ...]rE   Ústrr
   )rF   s   "r0   rG   rG   |   s   € ÷ +ñ + ð +°Cñ +r/   c                óž   € \        V 4      ^8”  d'   V ^,          ^8X  d   RP                  R V  4       4      # RP                  R V  4       4      # )a§  
Join color parameters, preserving the ITU T.416 colon form where it was used.

``38:2:<colour space id>:R:G:B`` carries a colour space element that the legacy
``38;2;R;G;B`` form has no slot for, so joining it with ``;`` would shift R, G and B
one position and leave a trailing parameter.

:param color: Color parameters as parsed by :func:`_parse_sgr_params`.
:returns: Parameter string for embedding in an SGR sequence.
Ú:c              3  ó8   "  € T F  p\        V4      x € K  	  R # 5i©N©rL   ©Ú.0Úps   & r0   Ú	<genexpr>Ú'_color_params_to_str.<locals>.<genexpr>ˆ   s   é € Ð.© 1œ˜AŸ˜«ùó   ‚Ú;c              3  ó8   "  € T F  p\        V4      x € K  	  R # 5irP   rQ   rR   s   & r0   rU   rV   ‰   s   é € Ð*¡E˜q”C˜—F�F£EùrW   )ÚlenÚjoin)rK   s   &r0   Ú_color_params_to_strr\   |   sC   € ô ˆ5ƒz�A„~˜% �( aœ-Ø�x‰xÑ.©Ó.Ó.Ð.Ø�8‰8Ñ*¡EÓ*Ó*Ð*r/   c               ó    € V ^8„  d   QhRRRR/# )rC   rD   r2   rE   rL   r
   )rF   s   "r0   rG   rG   Œ   s   € ÷ 'ñ ' )ð '°ñ 'r/   c                ól  € \        V 4      '       g   R# V P                  R3V P                  R3V P                  R3V P                  R3V P
                  R3V P                  R3V P                  R3V P                  R	3V P                  R
3V P                  R3.
pV UUu. uF  w  r#V'       g   K  VNK  	  pppV P                  e%   VP                  \        V P                  4      4       V P                  e%   VP                  \        V P                  4      4       RRP                  V4       R2# u uppi )z¶
Generate minimal SGR sequence to restore this state from reset.

:param state: The SGR state to convert.
:returns: SGR escape sequence string, or empty string if no attributes set.
Ú Ú1Ú2Ú3Ú4Ú5Ú6Ú7Ú8Ú9Ú21z[rX   Úm)rI   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r?   Úappendr\   r@   r[   )rD   Ú
bool_attrsÚactiveÚcodeÚparamss   &    r0   Ú_sgr_state_to_sequencerp   Œ   s  € ô   ×&Ò&Ùð 
�‰�SÐ˜EŸI™I sÐ+¨e¯l©l¸CÐ-@Ø	�‰˜#Ð §¡¨cÐ 2°U×5FÑ5FÈÐ4LØ	�‰˜Ð˜uŸ|™|¨SÐ1°E×4GÑ4GÈÐ3MØ	×	Ñ	 Ð&ð	€Jñ (2Ô<¡z‘|�v´V�dˆd¡z€FÑ<ð ×ÑÒ#Ø�‰Ô*¨5×+;Ñ+;Ó<Ô=Ø×ÑÒ#Ø�‰Ô*¨5×+;Ñ+;Ó<Ô=à�3—8‘8˜FÓ#Ð$ AÐ&Ð&ùó =s   ÂD0Â.D0c               ó    € V ^8„  d   QhRRRR/# )rC   ÚsequencerL   rE   zlist[int | tuple[int, ...]]r
   )rF   s   "r0   rG   rG   ¨   s   € ÷ ñ  ð Ð(Cñ r/   c                ó¬  € \         P                  V 4      pV'       g   . # VP                  ^4      pV'       g   ^ .# . pVP                  R4       F|  pRV9   dO   VP                  R4       Uu. uF  qU'       d   \	        V4      M^ NK  	  ppVP                  \        V4      4       KX  TP                  V'       d   \	        V4      M^ 4       K~  	  V# u upi )aš  
Parse SGR sequence and return list of parameter values.

Handles compound sequences like ``\x1b[1;31;4m`` -> [1, 31, 4].
Empty params (e.g., ``\x1b[m``) are treated as [0] (reset).
Colon-separated extended colors like ``\x1b[38:2::255:0:0m`` are returned
as tuples: [(38, 2, 255, 0, 0)].

:param sequence: SGR escape sequence string.
:returns: List of integer parameters or tuples for colon-separated colors.
rX   rN   )Ú_SGR_PATTERNÚmatchÚgroupÚsplitÚintrk   Útuple)rr   ru   Ú
params_strÚresultÚparamrT   Úpartss   &      r0   Ú_parse_sgr_paramsr~   ¨   s±   € ô ×Ñ˜xÓ(€EßØˆ	Ø—‘˜Q“€JßØˆsˆ
Ø*,€FØ×!Ñ! #Ö&ˆØ�%Œ<ð 27·±¸SÔ1AÓBÑ1A¨Ažq”S˜”V aÒ'Ñ1AˆEÐBØ�M‰Mœ% ›,Ö'à�M‰M¯œ#˜eœ*°1Ö5ñ 'ð €Mùò	 Cs   Á,Cc               ó$   € V ^8„  d   QhRRRRRR/# )rC   ro   zIterator[int | tuple[int, ...]]Úbaserx   rE   r>   r
   )rF   s   "r0   rG   rG   Æ   s$   € ÷ ñ Ø+ðØ36ðàñr/   c                óØ  €  \        V 4      p\        V\        4      '       d   R# V^8X  d2   \        V 4      p\        V\        4      '       d   R# \        V4      ^V3# V^8X  dt   \        V 4      \        V 4      \        V 4      rep\        V\        4      '       g-   \        V\        4      '       g   \        V\        4      '       d   R# \        V4      ^WEV3#  R#   \         d     R# i ; i)a%  
Parse extended color (256-color or RGB) from parameter iterator.

:param params: Iterator of remaining SGR parameters (semicolon-separated format).
:param base: Base code (38 for foreground, 48 for background).
:returns: Color tuple like (38, 5, N) or (38, 2, R, G, B), or None if malformed.
N)ÚnextÚ
isinstancery   rx   ÚStopIteration)ro   r€   ÚmodeÚnÚrÚgÚbs   &&     r0   Ú_parse_extended_colorrŠ   Æ   sË   € ðÜ�F‹|ˆÜ�dœE×"Ò"ÙØ�1Œ9Ü�V“ˆAÜ˜!œU×#Ò#ÙÜ˜“I˜q !Ð$Ð$Ø�1Œ9Ü˜6“l¤D¨£L´$°v³,�!ˆAÜ˜!œU×#Ò#¤z°!´U×';Ò';¼zÈ!ÌU×?SÒ?SÙÜ˜“I˜q !¨Ð*Ð*ð	 ñ øô ô ØÙðús)   ‚!C ¥(C ÁC ÁA)C ÃC ÃC)Ã(C)c               ó$   € V ^8„  d   QhRRRRRR/# )rC   rD   r2   rr   rL   rE   r
   )rF   s   "r0   rG   rG   ã   s&   € ÷ Nñ N˜Yð N°#ð N¸)ñ Nr/   c                óì
  € \        V4      p\        V4      pV EFV  p\        V\        4      '       d€   \	        V4      ^8¼  d0   V^ ,          \
        P                  8X  d   V P                  VR7      p M>\	        V4      ^8¼  d/   V^ ,          \
        P                  8X  d   V P                  VR7      p K™  V\
        P                  8X  d	   \        p K¶  V\
        P                  8X  d   V P                  RR7      p Kß  V\
        P                  8X  d   V P                  RR7      p EK	  V\
        P                  8X  d   V P                  RR7      p EK3  V\
        P                  8X  d   V P                  RR7      p EK]  V\
        P                  8X  d   V P                  RR7      p EK‡  V\
        P                   8X  d   V P                  RR	7      p EK±  V\
        P"                  8X  d   V P                  RR
7      p EKÛ  V\
        P$                  8X  d   V P                  RR7      p EK  V\
        P&                  8X  d   V P                  RR7      p EK/  V\
        P(                  8X  d   V P                  RR7      p EKY  V\
        P*                  8X  d   V P                  RRR7      p EK„  V\
        P,                  8X  d   V P                  RR7      p EK®  V\
        P.                  8X  d   V P                  RRR7      p EKÙ  V\
        P0                  8X  d   V P                  RRR7      p EK  V\
        P2                  8X  d   V P                  RR
7      p EK.  V\
        P4                  8X  d   V P                  RR7      p EKX  V\
        P6                  8X  d   V P                  RR7      p EK‚  \
        P8                  Tu;8:  d   \
        P:                  8:  g1   M \
        P<                  Tu;8:  d   \
        P>                  8:  d   M MV P                  V3R7      p EKó  \
        P@                  Tu;8:  d   \
        PB                  8:  g1   M \
        PD                  Tu;8:  d   \
        PF                  8:  d   M MV P                  V3R7      p EKd  V\
        PH                  8X  d   V P                  RR7      p EKŽ  V\
        PJ                  8X  d   V P                  RR7      p EK¸  V\
        P                  8X  d;   \M        V\
        P                  4      ;p'       d   V P                  VR7      p EK  EK  V\
        P                  8X  g   EK  \M        V\
        P                  4      ;p'       g   EKD  V P                  VR7      p EKY  	  V # )z»
Parse SGR sequence and return new state with updates applied.

:param state: Current SGR state.
:param sequence: SGR escape sequence string.
:returns: New SGRState with updates applied.
)r?   )r@   T)r4   )r5   )r6   )r7   )r8   )r9   )r:   )r;   )r<   )r=   F)r4   r5   )r7   r=   )r8   r9   N)'r~   Úiterrƒ   ry   rZ   r	   r$   Ú_replacer(   r   Ú_SGR_STATE_DEFAULTr   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%   r)   rŠ   )rD   rr   Úparams_listro   rT   rK   s   &&    r0   Ú_sgr_state_updater‘   ã   s½  € ô $ HÓ-€KÜ�+Ó€FÜˆä�aœ×ÒÜ�1‹v˜Œ{˜q �t¤t×'7Ñ'7Ô7àŸ™°!˜Ó4‘Ü�Q“˜1”  1¥¬×)9Ñ)9Ô!9àŸ™°!˜Ó4�ÙØ”—
‘
Œ?Ü&ŠEà”$—)‘)Œ^Ø—N‘N¨�NÓ-ŠEØ”$—(‘(Œ]Ø—N‘N t�NÓ,‹EØ”$—+‘+ÔØ—N‘N¨$�NÓ/‹EØ”$—.‘.Ô Ø—N‘N¨T�NÓ2‹EØ”$—*‘*Œ_Ø—N‘N¨�NÓ.‹EØ”$×"Ñ"Ô"Ø—N‘N¨t�NÓ4‹EØ”$—,‘,ÔØ—N‘N¨4�NÓ0‹EØ”$—+‘+ÔØ—N‘N¨$�NÓ/‹EØ”$×$Ñ$Ô$Ø—N‘N°�NÓ6‹EØ”$×'Ñ'Ô'Ø—N‘N°D�NÓ9‹Eà”$×#Ñ#Ô#Ø—N‘N¨°5�NÓ9‹EØ”$—/‘/Ô!Ø—N‘N¨%�NÓ0‹EØ”$×$Ñ$Ô$Ø—N‘N¨UÀU�NÓK‹EØ”$—.‘.Ô Ø—N‘N¨¸E�NÓB‹EØ”$×"Ñ"Ô"Ø—N‘N¨5�NÓ1‹EØ”$—/‘/Ô!Ø—N‘N¨%�NÓ0‹EØ”$×(Ñ(Ô(Ø—N‘N°�NÓ7‹Eä�m‰m˜qÖ1¤D§M¡MÖ1Ü×%Ñ%¨ÖB¬d×.BÑ.B×BØ—N‘N¨q¨d�NÓ3‹EÜ�m‰m˜qÖ1¤D§M¡MÖ1Ü×%Ñ%¨ÖB¬d×.BÑ.B×BØ—N‘N¨q¨d�NÓ3‹EØ”$—/‘/Ô!Ø—N‘N¨d�NÓ3‹EØ”$—/‘/Ô!Ø—N‘N¨d�NÓ3‹Eà”$×"Ñ"Ô"Ü-¨f´d×6FÑ6FÓGÐGˆuÖGØŸ™°%˜Ó8“ò Hà”$×"Ñ"×"Ü-¨f´d×6FÑ6FÓGÐGˆu×GÑGØŸ™°%˜Ó8“ñC ðD €Lr/   c               ó    € V ^8„  d   QhRRRR/# )rC   ÚlineszSequence[str]rE   z	list[str]r
   )rF   s   "r0   rG   rG   4  s   € ÷ /ñ /˜ð /¨9ñ /r/   c                óÄ  € \         ;QJ d    R V  4       F  '       g   K   RM	  RM! R V  4       4      '       d	   V '       g   \        V 4      # . p\        pV  F„  p\        V4      p\        P                  V4       F  p\        W%P                  4       4      pK  	  V'       d	   WC,           MTp\        V4      '       d   V\        ,           pVP                  V4       K†  	  V# )aç  
Propagate SGR codes across wrapped lines.

When text with SGR styling is wrapped across multiple lines, each line
needs to be self-contained for proper display. This function:

- Ends each line with ``\x1b[0m`` if styles are active (prevents bleeding)
- Starts each subsequent line with the active style restored

:param lines: List of text lines, possibly containing SGR sequences.
:returns: List of lines with SGR codes propagated.

Example::

    >>> propagate_sgr(['\x1b[31mhello', 'world\x1b[0m'])
    ['\x1b[31mhello\x1b[0m', '\x1b[31mworld\x1b[0m']

This is useful in cases of making special editors and viewers, and is used for the
default modes (propagate_sgr=True) of :func:`wcwidth.wrap` and :func:`wcwidth.clip`.

When wrapping and clipping text containing SGR sequences, maybe a previous line enabled the BLUE
color--if we are viewing *only* the line following, we would want the carry over the BLUE color,
and all lines with sequences should end with terminating reset (``\x1b[0m``).
c              3  óL   "  € T F  p\         P                  V4      x € K  	  R # 5irP   )Ú_SGR_QUICK_CHECKÚsearch)rS   Úlines   & r0   rU   Ú propagate_sgr.<locals>.<genexpr>N  s   é € Ð?¹°Ô×&Ñ& t×,Ð,»ùs   ‚"$TF)ÚanyÚlistr�   rp   rt   Úfinditerr‘   rv   rI   Ú
_SGR_RESETrk   )r“   r{   rD   r˜   Úprefixru   Úoutput_lines   &      r0   Úpropagate_sgrr    4  s«   € ÷4 ‹3Ñ?¹Ó?�3�3Š3Ñ?¹Ó?×?Ò?ÇuÜ�E‹{Ðà€FÜ€Eãˆä'¨Ó.ˆô "×*Ñ*¨4Ö0ˆEÜ% e¯[©[«]Ó;ŠEñ 1÷ (.�f–m°4ˆÜ ×&Ò&Ø%¬
Õ2ˆKà�‰�kÖ"ñ ð €Mr/   )r   Ú
__future__r   ÚreÚenumr   Útypingr   r   r   r   r	   Úcompilert   r–   r�   r2   r�   rI   r\   rp   r~   rŠ   r‘   r    r
   r/   r0   Ú<module>r¦      s—   ðñõ #ó 
Ý ç 6Ñ 6çÝô&ˆ7ô &ðZ �zŠzÐ-Ó.€ð —:’:Ð/Ó0Ð ð €
ô.�
ô .ñB “[Ð õ
Mõ+õ 'õ8õ<õ:N÷b/r/   