+
    ^eòjl�  ã                  ó  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RI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Ht ^RIHtHtHtHtHtHt ^R	IHt ^R
IHtH t  ^RI!H"t"H#t#H$t$ R]%R&   ]PL                  PO                  RR4      '       d   Rt(M	 ^RI)H*t+ ]+t( ! R R]PZ                  4      t. ! R R]4      t/R.R R llt0R R lt1R R lt2R R lt3R R lt4R R  lt5R/R!R"R#^R$^R%R&R'R(R)RR*R+/R, R- lllt*R#   ], d    Rt( Lki ; i)0z*This is a python implementation of clip().)ÚannotationsN)Úislice)ÚLiteralÚCallableÚOptionalÚ
NamedTuple)Úwidth)Úiter_graphemes)Ú	HyperlinkÚHyperlinkParams)Ú_SGR_PATTERNÚ_SGR_STATE_DEFAULTÚ	_SGRStateÚ_sgr_state_updateÚ_sgr_state_is_activeÚ_sgr_state_to_sequence)Ú_clamp_ambiguous_width)Ú
TextSizingÚTextSizingParams)Ú_SEQUENCE_CLASSIFYÚ_HORIZONTAL_CURSOR_MOVEMENTÚINDETERMINATE_EFFECT_SEQUENCEz&Optional[Callable[..., Optional[str]]]Ú_c_clipÚWCWIDTH_PYTHONÚ )Úclipc                  ó¢   € ] tR t^)tRt]P                  ! 4       t]P                  ! 4       t]P                  ! 4       t	]P                  ! 4       t
RtR# )Ú_HyperlinkActionz.Outcome of processing an OSC 8 hyperlink unit.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚenumÚautoÚNO_CLOSEÚEMPTYÚOUTSIDEÚVISIBLEÚ__static_attributes__r   ó    Ú„/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/wcwidth/_clip.pyr   r   )   s1   † Ù8à�yŠy‹{€HØ�IŠI‹K€EØ�iŠi‹k€GØ�iŠi‹k„Gr+   r   c                  óˆ   € ] tR t^2t$ RtR]R&   ^ tR]R&   ^ tR]R&   RtR]R	&   Rt	R]R
&   Rt
R]R&   ^ tR]R&   ^ tR]R&   RtR# )Ú_HyperlinkResultzb
Result of processing an OSC 8 hyperlink.

Only the fields relevant to each action are populated.
r   ÚactionÚintÚ	close_endÚinner_widthr   ÚstrÚopen_seqÚclipped_innerÚ	close_seqÚclipped_widthÚ
hl_col_endr   N)r   r    r!   r"   r#   Ú__annotations__r1   r2   r4   r5   r6   r7   r8   r*   r   r+   r,   r.   r.   2   sU   ‡ ñð ÓØ€IˆsÓØ€K�ÓØ€HˆcÓØ€M�3ÓØ€IˆsÓØ€M�3ÓØ€J�×r+   r.   c               ó(   € V ^8„  d   QhRRRRRRRR/# )é   Úresultr3   Úcaptured_stylezOptional[_SGRState]Ú	end_styleÚreturnr   )Úformats   "r,   Ú__annotate__rA   C   s+   € ÷ ñ ˜Cð Ð1Dð Ø2ðØ>Añr+   c                ó„   € Ve<   \        V4      ;p'       d	   W0,           p \        Vf   TMT4      '       d
   V R,          p V # )a6  
Apply SGR prefix/suffix around *result*.

If an SGR state was captured at the first visible character, prefix the result with the
corresponding SGR sequence, and suffix with a reset if any styles remain active at the end
of the clipped region.

*end_style* is the style in effect after the final SGR sequence emitted within the clip window,
or ``None`` when no such sequence was emitted, the style at the first visible character is still
in effect.  This matches :func:`wcwidth.propagate_sgr`, which decides the trailing reset by SGR
state at the end of each line.
z[0m)r   r   )r<   r=   r>   Úprefixs   &&& r,   Ú_apply_sgr_wraprD   C   sB   € ð Ò!Ü+¨NÓ;Ð;ˆ6Ö;Ø•_ˆFÜ°)Ò2C¡È×SÒSØ�iÕˆFØ€Mr+   c               óH   € V ^8„  d   Qh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;   Útextr3   Ústartr0   ÚendÚfillcharÚtabsizeÚambiguous_widthÚterm_programú
bool | strÚcontrol_codesú$Literal['parse', 'strict', 'ignore']Úparamsr   Ú	match_endÚcolr?   r.   r   )r@   s   "r,   rA   rA   Y   sŽ   € ÷ Cñ CØ
ðCàðCð 
ðCð ð	Cð
 ðCð ðCð ðCð 8ðCð ðCð ðCð 
ðCð ñCr+   c               ó.  € \         P                  ! W	4      w  r¼W¼3R8X  d   \        \        P                  4      # W	V p\        W×WEVR7      pV^ 8X  d   \        \        P                  VR7      # W®,           pWñ8:  g   W¢8¼  d   \        \        P                  VVR7      # \        ^ W,
          4      pW*,
          p\        VVVW4VVRVR7	      p\        VVWEVR7      p\        \        P                  VVVP                  4       VVP                  4       VVR7      # )zÙ
Process an OSC 8 hyperlink unit.

Finds the matching close sequence, measures the inner text width, and determines whether the
hyperlink is empty, outside the clip window, or visible (requiring inner-text clipping).
)rN   rJ   rK   rL   )r1   )r1   r2   F)rI   rJ   rK   rL   Úpropagate_sgrrN   )r1   r2   r4   r5   r6   r7   r8   )éÿÿÿÿrU   )r
   Ú
find_closer.   r   r&   r   r'   r(   Úmaxr   r)   Ú	make_openÚ
make_close)rF   rG   rH   rI   rJ   rK   rL   rN   rP   rQ   rR   Úclose_startr1   Ú
inner_textr2   r8   Úinner_clip_startÚinner_clip_endr5   r7   s   &&&&&&&&$$$         r,   Ú_process_hyperlinkr^   Y   s+  € ô* '×1Ò1°$ÓBÑ€KØÐ 8Ô+ÜÔ 0× 9Ñ 9Ó:Ð:Ø Ð,€JÜØØØ!ô€Kð �aÔÜÔ 0× 6Ñ 6À)ÔLÐLàÕ"€JàÔ˜cœjÜÔ 0× 8Ñ 8ÀIØ,7ô9ð 	9ô ˜1˜e�kÓ*ÐØ•Y€NäØÐ$ nØØ'Ø!ØØ#ô€Mô Ø ]ØØ!ô€Mô Ü× Ñ ØØØ×!Ñ!Ó#Ø#Ø×#Ñ#Ó%Ø#Øô	ð 	r+   c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R	/# )r;   Úcellszdict[int, tuple[str, int]]Ú	sequenceszlist[tuple[int, int, str]]rG   r0   rH   rI   r3   r?   r   )r@   s   "r,   rA   rA   Ÿ   sD   € ÷ 4ñ 4Ø%ð4à)ð4ð ð4ð 
ð	4ð
 ð4ð 	ñ4r+   c                ó|  € / pV F(  w  rgpVP                  V. 4      P                  Wx34       K*  	  VP                  4        F  p	V	P                  4        K  	  V '       d   \	        V P                  4       4      MRp
V'       d   \	        VP                  4       4      MRp\	        W«4      p. p^ p\        WÃ4      pWï8:  d£   VP                  VR4       F  w  ppVP                  V4       K  	  Wã8¼  d   V^,          pKD  Wà9   d2   W,          w  ppVP                  V4       TT;'       g    ^,          pK{  Y.u;8:  d   V
8:  d   M MVP                  V4       V^,          pK¨  \        VP                  4       4       F0  pVV8”  g   K  VV,           F  w  ppVP                  V4       K  	  K2  	  RP                  V4      # )z«
Reconstruct the output string from painter's algorithm state.

Walks columns left-to-right, interleaving escape sequences and cell content, filling gaps with
*fillchar*.
r   rU   r   )
Ú
setdefaultÚappendÚvaluesÚsortrW   ÚkeysÚminÚgetÚsortedÚjoin)r`   ra   rG   rH   rI   Úseqs_by_colÚcol_posÚorderÚseq_textÚentriesÚmax_cell_colÚmax_seq_colÚmax_colÚpartsÚwalk_colÚ	col_limitÚ_Ú	cell_textÚcell_wÚcs   &&&&&               r,   Ú_reconstruct_painterr{   Ÿ   sz  € ð 57€KÛ$-Ñ ˆ˜Ø×Ñ˜w¨Ó+×2Ñ2°EÐ3DÖEñ %.à×%Ñ%Ö'ˆØ�‰Žñ (÷ ).”3�u—z‘z“|Ô$°2€Lß-8”#�k×&Ñ&Ó(Ô)¸b€KÜ�,Ó,€Gà€EØ€HÜ�GÓ!€IØ
Ô
à&Ÿ?™?¨8°RÖ8‰KˆAˆxØ�L‰L˜Ö"ñ 9ð Œ?Ø˜�MˆHÙàÔØ %¥ÑˆI�vØ�L‰L˜Ô#Ø˜Ÿ˜ !Õ#ŠHàÖ0 L×0Ø—‘˜XÔ&Ø˜�MŠHô �K×$Ñ$Ó&Ö'ˆØˆyŽ=Ø*¨1Ÿ~˜~‘��8Ø—‘˜XÖ&ó  .ñ (ð
 �7‰7�5‹>Ðr+   c               ó@   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRRRR/
# ©r;   rF   r3   rG   r0   rH   rT   ÚboolrK   rL   rM   rI   rJ   rN   rO   r?   z4tuple[str, Optional[_SGRState], Optional[_SGRState]]r   )r@   s   "r,   rA   rA   Ö   sx   € ÷ r6ñ r6Ø
ðr6àðr6ð 
ðr6ð
 ðr6ð ðr6ð ðr6ð ðr6ð ðr6ð 8ðr6ð :ñr6r+   c               ó~  a € VR8H  p	. p
^ p^ pRpRpV'       d   \         MRpV\        V 4      8  Edû   W,          pW²8¼  d4   VR9  d-   Ve   EMßV P                  RV^,           4      pVR8X  d   EM½TpKR  VR8X  Ed%   \        P                  ! W4      pV'       g   V
P                  V4       V^,          pK”  VP                  R4      ee   V'       d]   VeY   \        VVP                  4       4      pVe(   W²8  d"   V
P                  VP                  4       4       TpVP                  4       pEK  \        P                  ! VP                  4       4      ;p'       Ed«   \        WW&WtVVVVP                  4       VR7      pVP                  \        P                  J d2   V
P                  VP                  4       4       VP                  4       pEM7VP                  \        P                  J d   VP                   pEMVP                  \        P"                  J d!   VVP$                  ,          pVP                   pMÍV
P                  VP&                  4       V
P                  VP(                  4       V
P                  VP*                  4       V'       d   Vf   TpV'       dH   VeD   \,        P.                  ! VP(                  4       F  p\        VVP                  4       4      pTpK!  	  VVP$                  ,          pVP                   pEKâ  VP                  R4      ;pEe   VP                  R4      ;'       g    R	pVP                  R
4      pVf   Q h\1        \2        P4                  ! VVR7      VV4      pVP7                  V4      pW±8¼  dF   VV,           V8:  d8   V
P                  VP9                  4       4       V'       d   Vf   TpVV,          pMXW²8  dJ   VV,           V8”  d<   . o R V 3R llp\;        VW±W&VVV4      pV
P=                  S 4       V'       d   Vf   TpM	VV,          pVP                  4       pEK  VP                  4       pV	'       d/   \>        P                  ! V4      '       d   \A        RV RV: 24      hV
P                  V4       VP                  4       pEK~  VR8X  dŽ   V^ 8”  dY   W·W·,          ,
          ,           pVV8  d<   Yu;8:  d   V8  d#   M MV
P                  R4       V'       d   Vf   TpV^,          pKB  M"Yu;8:  d   V8  d   M MV
P                  R4       V^,          pEK  \C        \E        WR7      4      p\G        VVVR7      pV^ 8X  d$   Yu;8:  d   V8  d   M M V
P                  V4       MŽW±8¼  d/   VV,           V8:  d!   V
P                  V4       V'       d   Vf   TpMZW²8  dU   VV,           V8”  dG   V
P                  V\I        W+V,           4      \K        W4      ,
          ,          4       V'       d   Vf   TpVV,          pV\        V4      ,          pEK  R	PM                  V
4      WÞ3# )z—
Clip text without cursor movement (simple append-to-output path).

Returns ``(result, captured_style, end_style)``.  The caller applies SGR wrapping.
ÚstrictNú	ÚÚ
sgr_params©rP   rQ   rR   Úts_metaÚts_textr   Úts_term©rN   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r;   Úsr3   Ú_wr0   Ú_colr?   ÚNoner   )r@   s   "r,   rA   Ú"_clip_simple.<locals>.__annotate__J  s(   € ÷ +ñ + Sð +¨cð +¸ð +Àñ +r+   c                ó*   <€ SP                  V 4       R # ©N)rd   )rŠ   r‹   rŒ   Úts_partss   &&&€r,   Ú	_ts_writeÚ_clip_simple.<locals>._ts_writeJ  s   ø€ Ø Ÿ™¨Ö*r+   ú*Indeterminate cursor sequence at position ú, Ú	Ú ©rG   ©rK   rL   rU   )'r   ÚlenÚfindr   Úmatchrd   Úgroupr   rH   r   Úparser^   r/   r   r&   r'   r1   r(   r2   r4   r5   r6   r   Úfinditerr   r   Úfrom_paramsÚdisplay_widthÚmake_sequenceÚ_text_sizing_clipÚextendr   Ú
ValueErrorÚnextr	   r   rh   rW   rk   )!rF   rG   rH   rT   rK   rL   rI   rJ   rN   r€   ÚoutputrR   Úidxr=   r>   Úcurrent_styleÚcharÚnext_escÚmÚhl_stateÚrÚsgr_mr…   r†   r‡   ÚtsÚts_widthr’   ÚseqÚnext_tabÚgraphemeÚ
grapheme_wr‘   s!   &&&$$$$$$                       @r,   Ú_clip_simpler¶   Ö   s*  ø€ ð* ˜hÑ&€Fà€FØ
€CØ
€CØ*.€NØ%)€Iß*7Õ&¸T€Mà
”�D“	�/Ø�yˆð Œ:˜$ nÔ4ØÒ)Ùð
 —y‘y ¨¨q­Ó1ˆHØ˜2Œ~ÙØˆCÙà�6�>Ü"×(Ò(¨Ó3ˆAßØ—‘˜dÔ#Ø�q•�Ùð �w‰w�|Ó$Ò0·]À}ÒG`Ü 1°-ÀÇÁÃÓ K�Ø!Ò-°#´)Ø—M‘M !§'¡'£)Ô,Ø -�IØ—e‘e“g�Úô +×0Ò0°·±³Ó;Ð;ˆx×;Ü&Ø °Ø Ø!Ø#¨q¯u©u«w¸Cô	�ð —8‘8Ô/×8Ñ8Ó8Ø—M‘M !§'¡'£)Ô,ØŸ%™%›'’CØ—X‘XÔ!1×!7Ñ!7Ó7ØŸ+™+’CØ—X‘XÔ!1×!9Ñ!9Ó9Ø˜1Ÿ=™=Õ(�CØŸ+™+‘Cà—M‘M !§*¡*Ô-Ø—M‘M !§/¡/Ô2Ø—M‘M !§+¡+Ô.ß$¨Ò)?Ø)6˜÷ %¨Ò)BÜ%1×%:Ò%:¸1¿?¹?Ö%K˜EÜ,=¸mÈUÏ[É[Ë]Ó,[˜MØ(5šIñ &Lð ˜1Ÿ=™=Õ(�CØŸ+™+�CÚð Ÿ7™7 9Ó-Ð-�Ó:ØŸ'™' )Ó,×2Ð2°�ØŸ'™' )Ó,�ØÒ*Ð*Ð*ÜÜ$×0Ò0°ÈÔVØ˜Wó&�ð ×+Ñ+¨OÓ<�à”< C¨(¥N°cÔ$9Ø—M‘M "×"2Ñ"2Ó"4Ô5ß$¨Ò)?Ø)6˜Ø˜8•O‘CØ”Y 3¨¥>°EÔ#9Ø*,�H÷+ð +ä+Ø˜C¨°Ø$Ø!ó#�Cð —M‘M (Ô+ß$¨Ò)?Ø)6˜øà˜8•O�CØ—e‘e“g�Úð —'‘'“)ˆCßÔ7×=Ò=¸c×BÒBÜ Ø@ÀÀÀRØ‘gðóð ð �M‰M˜#ÔØ—%‘%“'ˆCÚà�4Œ<à˜Œ{Ø¨S­]Õ";Õ<�Ø˜H”nØÖ) c×)ØŸ™ cÔ*ß(¨^Ò-CØ-:˜NØ˜1•H’Cð %ð Ö# ×#Ø—‘˜dÔ#Ø�1�HˆCÚäœ tÔ7Ó8ˆÜ˜8°_Ø(4ô6ˆ
ð ˜Œ?ØÖ!˜c×!Ø—‘˜hÔ'øØŒ\˜c JÕ.°#Ô5Ø�M‰M˜(Ô#ß Ò!7Ø!.�øØŒY˜3 Õ+¨eÔ3Ø�M‰M˜(¤c¨#°ZÕ/?Ó&@Ä3ÀuÃ?Õ&RÕSÔTß Ò!7Ø!.�àˆzÕˆØŒs�8‹}Õ‹à�7‰7�6‹?˜NÐ5Ð5r+   c               ó<   € V ^8„  d   QhRRRRRRRRRRR	RR
RRRRR/	# )r;   r°   r   rR   r0   rG   rH   rI   r3   rK   rL   rM   Úwrite_cellszCallable[[str, int, int], None]r?   r   )r@   s   "r,   rA   rA   ‹  sm   € ÷ Uñ UØðUà	ðUð ðUð 
ð	Uð
 ðUð ðUð ðUð 1ðUð 	ñUr+   c           
     ó  a aaa€ S P                  V4      pW8¼  d-   W,           V8:  d    S! S P                  4       W�4       W,           # W8¼  g   W,           V8:  d	   W,           # \        ^ W!,
          4      p	\        W1V,           4      V,
          p
S P                  P
                  o. pS P                  P                  ^ 8”  d˜   \        \        S P                  4      S P                  P                  4       F  pVP                  VS34       K  	  \        S P                  P                  \        V4      ,
          4       F  pVP                  RS34       K  	  MA\        S P                  4       F(  pVP                  V\        WÅVR7      S,          34       K*  	  . oR VVV V3R llpW,           p^ pV F½  w  ppVV,           pVV	8:  d   TpK  VV
8¼  d    Mž\        VV
4      \        VV	4      ,
          pVV8X  d7   V^ 8”  d0   S'       g   V\        VV	4      ,           pSP                  VV34       M>V! V4       V\        VV	4      ,           p\        V4       F  pS! V^VV,           4       K  	  TpK¿  	  V! V4       W,           # )z²
Emit tokens for a text-sizing (OSC 66) sequence, clipped to (start, end).

Calls *write_cells(text, width, col)* for each emitted cell or sequence. Returns new column
position.
r   r™   c               ó    € V ^8„  d   QhRRRR/# )r;   Ú	flush_colr0   r?   r�   r   )r@   s   "r,   rA   Ú'_text_sizing_clip.<locals>.__annotate__¹  s   € ÷ ñ ˜ð  ñ r+   c                ó  <€ S'       g   R # S Uu. uF  q^ ,          NK  	  pp\        R S 4       4      p\        SSP                  P                  ^ 8”  d   \	        V4      M^ SP                  P
                  SP                  P                  SP                  P                  SP                  P                  4      pS! \        VRP                  V4      SP                  4      P                  4       VV 4       SP                  4        R # u upi )Nc              3  ó2   "  € T F  q^,          x € K  	  R# 5i)é   Nr   )Ú.0Úus   & r,   Ú	<genexpr>Ú3_text_sizing_clip.<locals>.flush.<locals>.<genexpr>½  s   é € Ð2¡M˜q˜—d’d£Mùs   ‚r   )Úsumr   rP   r   rš   Ú	numeratorÚdenominatorÚvertical_alignÚhorizontal_alignr   rk   Ú
terminatorr¢   Úclear)	r»   rÁ   ÚtextsÚtotal_wrP   Úpending_unitsÚscaler°   r¸   s	   &    €€€€r,   ÚflushÚ _text_sizing_clip.<locals>.flush¹  sÍ   ø€ ßÙÙ,Ó-™}˜!�1—�™}ˆÐ-ÜÑ2¡MÓ2Ó2ˆÜ!ØØŸ)™)Ÿ/™/¨AÔ-ŒC�ŒJ°1Ø�I‰I×Ñ §¡×!6Ñ!6Ø�I‰I×$Ñ$ b§i¡i×&@Ñ&@ó	Bˆñ
 	Ü�v˜rŸw™w u›~¨r¯}©}Ó=×KÑKÓMØØô	ð 	×ÑÖùò .s   �D	)r¡   r¢   rW   rh   rP   rÎ   r   r   r	   rF   rd   Úrangerš   )r°   rR   rG   rH   rI   rK   rL   r¸   r±   Ú	rel_startÚrel_endÚunitsÚgrw   rÏ   Úflush_col_posÚunit_posÚ	unit_textÚunit_wÚunit_endÚoverlapÚ	abs_startÚirÍ   rÎ   s   f&&&&&&f               @@r,   r£   r£   ‹  s)  û€ ð" ×Ñ Ó0€Hð „|˜�¨#Ô-Ù�B×$Ñ$Ó&¨Ô6Ø�~Ðà
„z�S•^ uÔ,Ø�~Ðô �A�u•{Ó#€IÜ�#˜X•~Ó&¨Õ,€GØ�I‰I�O‰O€Eà#%€EØ	‡y�y‡�˜ÔÜœ r§w¡wÓ/°·±·±ÖAˆAØ�L‰L˜!˜U˜Ö$ñ Bä�r—y‘y—‘¬¨U«Õ3Ö4ˆAØ�L‰L˜"˜e˜Ö%ò 5ô   §¡Ö(ˆAØ�L‰LØ”E˜!Ø'3ô5Ø7<õ=ð >ö?ñ )ð
 ,.€M÷ó ð  •O€MØ€HÛ"Ñˆ	�6Ø˜fÕ$ˆØ�yÔ ØˆHÙØ�wÔÙä�h Ó(¬3¨x¸Ó+CÕCˆØ�fÔ ¨!¤ß Ø #¤c¨(°IÓ&>Õ >�Ø× Ñ  )¨VÐ!4Õ5á�-Ô Øœc (¨IÓ6Õ6ˆIÜ˜7–^�Ù˜H a¨°Q­Ö7ñ $àŠñ% #ñ( 
ˆ-ÔØ�>Ðr+   c               ó@   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRRRR/
# r}   r   )r@   s   "r,   rA   rA   ã  sx   € ÷ G'ñ G'Ø
ðG'àðG'ð 
ðG'ð
 ðG'ð ðG'ð ðG'ð ðG'ð ðG'ð 8ðG'ð :ñG'r+   c               ó  aaa(a)a*a+a,a-€ VR8H  p	/ o)\        4       o+. o-^ o,^ p
^ pRo(RpS'       d   \        MRo*RpRR V(V)V*VV+VV,V-3R lllpV\        V 4      8  Ed£   W,          pW¢8¼  d¿   VR9  d¸   Ve   ^ Tu;8:  d   V8  dr   M Mn\        V P	                  R4      V P	                  R4      V P	                  R4      4      V8  d   R pM,\
        P                  ! W4      pVf   R MVP                  4       pV^ 8  d-   S(e   EMüV P                  RV^,           4      pVR 8X  d   EMÚTpKÝ  VR8X  Ed   \        P                  ! W4      pV'       g*   S-P                  V
S,V34       S,^,          o,V^,          pEK,  VP                  R	4      eq   S'       di   S*ee   \        S*VP                  4       4      o*S(e4   W¢8  d.   S-P                  V
S,VP                  4       34       S,^,          o,S*pVP                  4       pEK¯  \        P                  ! VP                  4       4      ;p'       EdÓ   \!        WVSWtVVVVP                  4       V
R
7      pVP"                  \$        P&                  J d>   S-P                  V
S,VP                  4       34       S,^,          o,VP                  4       pEMRVP"                  \$        P(                  J d   VP*                  pEM&VP"                  \$        P,                  J d!   V
VP.                  ,          p
VP*                  pMèS-P                  V
S,VP0                  34       S,^,          o,V! VP2                  VP4                  V
RR7       V
VP4                  ,          p
S-P                  V
S,VP6                  34       S,^,          o,S'       dH   S*eD   \8        P:                  ! VP2                  4       F  p\        S*VP                  4       4      o*S*pK!  	  VP<                  p
VP*                  pEK®  VP                  R4      ;pez   VP                  R4      ;'       g    RpVP                  R4      pVf   Q h\?        \@        PB                  ! VVR7      VV4      p\E        VW¡VSVVV4      p
VP                  4       pEK<  VP                  4       pV	'       d/   \F        P                  ! V4      '       d   \I        RV RV: 24      hVP                  R4      ;pe0   V'       d   \K        V4      ^,
          M^ p
VP                  4       pEKÆ  VP                  R4      ;peq   V'       d   \K        V4      M^pV
V,           pW¢8  d8   VV8”  d1   \M        \        W¡4      \O        VV4      4       F  pV! S^V4       K  	  Tp
VP                  4       pEKK  VP                  R4      ;p e_   V '       d   \K        V 4      M^p!V	'       d   V!V
8”  d   \I        RV RV! RV
 R24      hV
V!,          p
V
^ 8  d   ^ p
VP                  4       pEK¾  S-P                  V
S,VP                  4       34       S,^,          o,VP                  4       pEKü  VR8X  d   ^ p
V^,          pEK  VR8X  d   V
^ 8”  d
   V
^,          p
V^,          pEK4  VR8X  dŠ   V^ 8”  dI   W§W§,          ,
          ,           p"\M        \        W¡4      \O        V"V4      4       F  p#V! R^V#4       K  	  T"p
M.Yu;8:  d   V8  d!   M MS-P                  V
S,R34       S,^,          o,V^,          pEKÄ  \Q        \S        WR7      4      p$\U        V$VVR7      p%V%^ 8X  d0   Yu;8:  d   V8  d!   M M–S-P                  V
S,V$34       S,^,          o,MxW¡8¼  d   V
V%,           V8:  d   V! V$V%V
4       MYW¢8  dT   V
V%,           V8”  dF   \        W4      p&\M        \O        W*V%,           4      V&,
          4       F  p'V! S^V&V',           4       K  	  V
V%,          p
V\        V$4      ,          pEK³  \W        S)S-WS4      S(V3# )!zê
Clip text, painting cells so that cursor movement can overwrite them.

Text with no cursor movement to resolve is clipped by _clip_simple() instead.

Returns ``(result, captured_style, end_style)``.  The caller applies SGR wrapping.
r€   Nc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r;   rŠ   r3   Úwr0   Ú	write_colÚis_hyperlinkr~   r?   r�   r   )r@   s   "r,   rA   Ú#_clip_painter.<locals>.__annotate__  s1   € ÷ +ñ +˜ð + ð +°ð +Ø#'ð+Ø48ñ+r+   c                ó¸  <€ V^ 8X  d6   V '       d,   SP                  VSV 34       S^,          oS'       d   Sf   SoR# \        V4       FÄ  pW$,           pV^ 8”  dL   SP                  V^,
          R4      ^,          ^8X  d'   S	^3SV^,
          &   S
P                  V^,
          4       SP                  VR4      ^,          ^8X  d'   S	^3SV^,           &   S
P                  V^,           4       SP	                  VR4       S
P                  V4       KÆ  	  W3SV&   V'       d*   \        V4       F  pS
P                  W$,           4       K  	  S'       d   Sf   SoR# R# R# )zIWrite *w* cells of text *s* at *write_col*, handling wide-char splitting.N)r   é    )rd   rÑ   ri   ÚdiscardÚpopÚadd)rŠ   rá   râ   rã   ÚoffsetÚsrc_colr=   r`   r©   rI   Úhyperlink_cellsrT   Ú	seq_orderra   s   &&&&  €€€€€€€€r,   Ú_write_cellsÚ#_clip_painter.<locals>._write_cells  s5  ø€ ð �Œ6çØ× Ñ  )¨Y¸Ð!:Ô;Ø˜Q•�	ß  ^Ò%;Ø%2�NÙÜ˜A–hˆFØÕ(ˆGØ˜Œ{˜uŸy™y¨°1­°gÓ>¸qÕAÀQÔFØ&.° ]��g •kÑ"Ø×'Ñ'¨°!­Ô4Ø�y‰y˜ 'Ó*¨1Õ-°Ô2Ø&.° ]��g •kÑ"Ø×'Ñ'¨°!­Ô4Ø�I‰I�g˜tÔ$Ø×#Ñ# GÖ,ñ ð ˜6ˆˆiÑßÜ ž(�Ø×#Ñ# IÕ$6Ö7ñ #ç˜^Ò3Ø*ŠNñ 4‰=r+   r�   ÚÚr‚   rƒ   r„   T)rã   r…   r†   r   r‡   rˆ   r”   r•   Úhpa_nÚ
cforward_nÚcbackward_nz!Cursor left movement at position z would move z cells left from column z, exceeding string startr–   r—   r˜   r™   )FrU   ),Úsetr   rš   rW   Úrfindr   ÚsearchrH   r›   r   rœ   rd   r�   r   r   rž   r^   r/   r   r&   r'   r1   r(   r2   r4   r5   r7   r6   r   rŸ   r8   r   r   r    r£   r   r¥   r0   rÑ   rh   r¦   r	   r   r{   ).rF   rG   rH   rT   rK   rL   rI   rJ   rN   r€   rR   r¨   r>   Únext_movementrî   rª   Úfoundr«   r¬   r­   r®   r¯   r…   r†   r‡   r°   r²   rò   ró   Ú	n_forwardÚmove_endrÝ   rô   Ú
n_backwardr³   Úfill_colr´   rµ   Ú
clip_startrê   r=   r`   r©   rì   rí   ra   s.   &&&d$$d$$                               @@@@@@r,   Ú_clip_painterrÿ   ã  s8  ÿ€ ð. ˜hÑ&€FØ(*€EÜ #£€OØ,.€IØ€Ià
€CØ
€Cð +/€Nð &*€Iß*7Õ&¸T€Mà#'€M÷+÷ +ñ +ð: ”�D“	�/Ø�yˆð Œ:˜$ nÔ4àÒ$¨¨]Ö(@¸S×(@ä�t—z‘z &Ó)¨4¯:©:°dÓ+;¸T¿Z¹ZÈÓ=OÓPÐSVÔVØ$&‘Mä7×>Ò>¸tÓI�EØ*/ª-¡B¸U¿Y¹Y»[�MØ˜qÔ Ø!Ò-ÙØŸ9™9 V¨S°1­WÓ5�Ø˜r”>ÙØ�Ùà�6�>Ü"×(Ò(¨Ó3ˆAßà× Ñ  # y°$Ð!7Ô8Ø˜Q•�	Ø�q•�Úð �w‰w�|Ó$Ò0·]À}ÒG`Ü 1°-ÀÇÁÃÓ K�Ø!Ò-°#´)Ø×$Ñ$ c¨9°a·g±g³iÐ%@ÔAØ •N�IØ -�IØ—e‘e“g�Úô +×0Ò0°·±³Ó;Ð;ˆx×;Ü&Ø  h°Ø Ø!Ø#¨q¯u©u«w¸Cô	�ð —8‘8Ô/×8Ñ8Ó8Ø×$Ñ$ c¨9°a·g±g³iÐ%@ÔAØ •N�IØŸ%™%›'’CØ—X‘XÔ!1×!7Ñ!7Ó7ØŸ+™+’CØ—X‘XÔ!1×!9Ñ!9Ó9Ø˜1Ÿ=™=Õ(�CØŸ+™+‘Cà×$Ñ$ c¨9°a·j±jÐ%AÔBØ •N�IÙ  §¡°!·/±/À3Ø.2õ4à˜1Ÿ?™?Õ*�CØ×$Ñ$ c¨9°a·k±kÐ%BÔCØ •N�I÷ %¨Ò)BÜ%1×%:Ò%:¸1¿?¹?Ö%K˜EÜ,=¸mÈUÏ[É[Ë]Ó,[˜MØ(5šIñ &Lð Ÿ,™,�CØŸ+™+�CÚð Ÿ7™7 9Ó-Ð-�Ò:ØŸ'™' )Ó,×2Ð2°�ØŸ'™' )Ó,�ØÒ*Ð*Ð*ÜÜ$×0Ò0°ÈÔVØ˜Wó&�ô (Ø˜ C¨°?Ø Ø ó"�ð —e‘e“g�Úð —'‘'“)ˆCßÔ7×=Ò=¸c×BÒBÜ Ø@ÀÀÀRØ‘gðóð ð Ÿ™ Ó)Ð)�Ò6ß(-”c˜%“j 1–n°1�Ø—e‘e“g�Úð  Ÿg™g lÓ3Ð3�
Ò@ß/9œC 
œO¸q�	Ø �?�Ø”9 ¨EÔ!1Ü"¤3 s£?´C¸À#Ó4FÖG˜Ù$ X¨q°!Ö4ñ Hà�Ø—e‘e“g�Úð  !Ÿw™w }Ó5Ð5�ÒBß1<œS Ô-À!�
ß˜j¨3Ô.Ü$Ø;¸C¸5ÀØ%˜,Ð&>¸s¸eð D1ð2óð ð
 �zÕ!�Ø˜”7Ø�CØ—e‘e“g�Úð ×Ñ˜c 9¨a¯g©g«iÐ8Ô9Ø˜�NˆIØ—%‘%“'ˆCÚð �4Œ<ØˆCØ�1�HˆCÚð �6Œ>Ø�QŒwØ�q•�Ø�1�HˆCÚð �4Œ<Ø˜Œ{Ø¨S­]Õ";Õ<�Ü %¤c¨#£o´s¸8ÀSÓ7IÖ J�HÙ   a¨Ö2ñ !Kà‘ØÖ# ×#Ø× Ñ  # y°$Ð!7Ô8Ø˜Q•�	Ø�1�HˆCÚô œ tÔ7Ó8ˆÜ˜8°_Ø(4ô6ˆ
ð ˜Œ?ØÖ!˜c×!Ø× Ñ  # y°(Ð!;Ô<Ø˜Q•�	øØŒ\˜c JÕ.°#Ô5Ù˜ :¨sÕ3ØŒY˜3 Õ+¨eÔ3Ü˜U›ˆJÜ¤ C¨zÕ)9Ó :¸ZÕ GÖH�Ù˜X q¨*°vÕ*=Ö>ñ Ið 	ˆzÕˆØŒs�8‹}Õ‹ä  ¨	°5¸xÓHØ˜Ið'ð 'r+   rI   r—   rJ   rK   rT   TrN   rž   Ú
overtypingrL   Fc               óD   € V ^8„  d   QhRRRRRRRRRRRRR	R
RRRRRRRR/# )r;   rF   r3   rG   r0   rH   rI   rJ   rK   rT   r~   rN   rO   r   zOptional[bool]rL   rM   r?   r   )r@   s   "r,   rA   rA   í  sƒ   € ÷ Cñ CØ
ðCàðCð 
ðCð
 ðCð ðCð ðCð ðCð 8ðCð ðCð ðCð 	ñCr+   c               ó  € \        V^ 4      pV^ 8  d&   VR8w  d   \        RV 24      h\        P                  pW!8:  d   R# V P	                  4       '       d   V P                  4       '       d   WV # \        eQ   VR8X  dJ   VRJdD   V^ 8”  d=   \        V4      ^8X  d-   VP	                  4       '       d   \        WW#VWVWyR7	      p
V
e   V
# \        V4      pRV 9   pV'       d   V'       g   RpVfR   VR8g  ;'       dD    R	V 9   ;'       g7    R
V 9   ;'       g*    T;'       d     \        \        P                  ! V 4      4      pMV'       d
   VR8X  d   RpV'       d   \        \        V VVVVV	VVVR7	      !  # \        \        V VVVVV	VVVR7	      !  # )u�  
Clip text to display columns (start, end) while preserving all terminal sequences.

This function extracts a substring using visible column positions. Terminal escape sequences
are preserved in output. If a wide character (width of 2) is
split at a boundary, it is replaced with ``fillchar``.

TAB characters (``\t``) are expanded to spaces up to the next tab stop, controlled by the
``tabsize`` parameter.  When cursor movement is detected, a "painter's algorithm" is used unless
``overtyping=False`` is set.  Cursor movement control codes are parsed for their effects instead
of ignored.  For these operations, it is assumed that ``text`` begins at column 0.

For text containing **OSC 8 hyperlinks**, the visible text inside a hyperlink is clipped to the
requested column range and the hyperlink sequence is rebuilt::

    >>> clip('\x1b]8;;http://example.com\x07Click This link\x1b]8;;\x07', 6, 10)
    '\x1b]8;;http://example.com\x07This\x1b]8;;\x07'

:param text: String to clip, may contain terminal escape sequences.
:param start: Absolute starting column (inclusive, 0-indexed), default ``0``.
:param end: Absolute ending column (exclusive).  The default value, ``-1``,
    signifies "to the end of the line", clipping only from *start* without
    requiring the caller to measure the display width of *text*.
:param fillchar: Character to use when a wide character must be split at
    a boundary (default space). Must have display width of 1.
:param tabsize: Tab stop width (default 8). Set to 0 to pass tabs through
    as zero-width (preserved in output but don't advance column position).
:param ambiguous_width: Width to use for East Asian Ambiguous (A)
    characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts.
:param propagate_sgr: If True (default), SGR (terminal styling) sequences
    are propagated, matching :func:`propagate_sgr`.  The result begins with
    any style active at the start position, retains any style changes
    occurring within the clipped region at their original position, and
    ends with a reset sequence if styles are active at the end position.
:param control_codes: How to handle control characters and sequences:

    - ``'parse'`` (default): Track horizontal cursor movement and clip
      hyperlink text.  Cursor overwrite is always allowed, with best effort
      results; indeterminate sequences (home, clear, reset, etc.) are
      preserved as zero-width.
    - ``'strict'``: Like ``parse``, but raises :exc:`ValueError` on
      sequences with indeterminate effects (cursor home, clear screen,
      reset, vertical movement, etc.) matching :func:`width` behavior.
      Also raises on out-of-bounds horizontal cursor movement.
    - ``'ignore'``: All control characters are treated as zero-width.
      Cursor movement is not tracked (fastest path).

:param overtyping: Whether to use the painter's algorithm for cursor
    movement (``\b`` backspace, ``\r`` carriage return, and CSI cursor
    left/right/position sequences).  When ``None`` (default), auto-detects
    by scanning for these characters in *text*.  Set to ``False`` for improved
    performance when the caller knows *text* contains no cursor movement
    characters.  Set to ``True`` to force the painter's algorithm (useful
    for testing).  Has no effect when ``control_codes='ignore'``.
:param term_program: Terminal software identifier for table correction.
    ``False`` (default) disables override lookup.  ``True`` reads the
    ``TERM_PROGRAM`` or ``TERM`` environment variable for auto-detection.
    Accepts a canonical terminal name matching :func:`list_term_programs`,
    such as from XTVERSION_, ENQ_, or ``TERM_PROGRAM``.

    .. versionadded:: 0.8.0

:returns: Substring of ``text`` spanning display columns (start, end),
    with all terminal sequences preserved and wide characters at boundaries
    replaced with ``fillchar``.

:raises ValueError: If ``end`` is negative and not ``-1``, or if
    ``control_codes='strict'`` and an indeterminate-effect sequence or
    out-of-bounds cursor movement is encountered.

SGR (terminal styling) sequences are propagated by default. The result
begins with any active style and ends with a reset::

    >>> clip('\x1b[1;34mHello world\x1b[0m', 6, 11)
    '\x1b[1;34mworld\x1b[0m'
    >>> clip('\x1b[1mbold\x1b[m normal', 1, 9)
    '\x1b[1mold\x1b[m norm'

Set ``propagate_sgr=False`` to disable this behavior.

.. note::

   Segmentation follows UAX #29 grapheme clusters. Tamil, Kannada and Sinhala may be clipped
   short of ``end`` and leave a bare virama at the boundary. Correct rendering of these
   languages is not specified by unicode.org standards, and no terminal emulator or editor
   handles them legibly, so this library function makes no attempt at accommodating them.

.. versionadded:: 0.3.0

.. versionchanged:: 0.5.0
   Added ``propagate_sgr`` parameter (default True).

.. versionchanged:: 0.7.0
   Added ``control_codes`` parameter (default 'parse').
   OSC 8 hyperlink-aware clipping.  OSC 66 text sizing protocol support.
   Added ``overtyping`` parameter (default None, auto-detect).

.. versionchanged:: 0.8.4
   ``start`` now defaults to ``0`` and ``end`` to ``-1``, meaning "to the
   end of the line"::

       >>> clip('\x1b[1;34mHello world\x1b[0m', 6)
       '\x1b[1;34mworld\x1b[0m'

Example::

    >>> clip('hello world', 0, 5)
    'hello'
    >>> clip('ä¸­æ–‡å­—', 0, 3)  # Wide char split at column 3
    'ä¸­ '
    >>> clip('a\tb', 0, 10)  # Tab expanded to spaces
    'a       b'
z5end must be -1 (to end of line) or non-negative, got r   rž   T)rI   rJ   rK   rT   rN   rL   r‚   FÚignorerð   rñ   )	rF   rG   rH   rT   rK   rL   rI   rJ   rN   rU   )rW   r¥   ÚsysÚmaxsizeÚisasciiÚisprintabler   rš   r   r~   r   r÷   rD   rÿ   r¶   )rF   rG   rH   rI   rJ   rK   rT   rN   r   rL   r<   Úhas_escs   &&&$$$$$$$  r,   r   r   í  sÄ  € ô| ��q‹M€EØ
ˆQ„wØ�"Œ9ÜØGÈÀuÐMóOð Oô �k‰kˆØ
„|Ùð ‡|�|‡~‚~˜$×*Ñ*×,Ò,Ø˜#ˆÐô 	ÒØ Ô(Ø $Ó&Ø˜!”Ü�H“ Ô" x×'7Ñ'7×'9Ò'9ÜØ˜¸Ø+Ø'ôDˆð ÒØˆMä,¨_Ó=€Oð ˜‰n€GßŸWØˆð Òð ˜XÑ%÷ Kð KØ�t‰^÷ Jð J˜t t™|÷ Jð JØ×HÐHœ$Ô:×AÒAÀ$ÓGÓHñ 	÷
 
˜¨Ô1Øˆ
çÜ¤ØØØØ'Ø+Ø%ØØØ'ô
!
ñ 
ð 
	ô œLØØØØ#Ø'Ø!ØØØ#ô
ñ 
ð 
r+   r�   )ræ   rU   )6Ú__conditional_annotations__r#   Ú
__future__r   Úosr  r$   Ú	itertoolsr   Útypingr   r   r   r   Ú_widthr   r´   r	   Ú	hyperlinkr
   r   Ú	sgr_stater   r   r   r   r   r   Ú
_constantsr   Útext_sizingr   r   Úescape_sequencesr   r   r   r9   Úenvironri   r   Ú
_wcwidth_cr   Ú_c_clip_implÚImportErrorÚEnumr   r.   rD   r^   r{   r¶   r£   rÿ   )r	  s   @r,   Ú<module>r     s-  øðÜ 0Ý "ó 
Û 
Û Ý ç :Ó :õ Ý $ß 1÷0÷ 0õ /ß 5÷>ñ >ð 
0Ó /Ø‡:�:‡>�>Ð" B×'Ò'Ø�Gðå4ð ˆô�t—y‘yô ô�zô ÷"õ,CõL4õnr6õjUõpG'ñTCð
 ðCð ðCð ðCð ðCð ;BðCð "&ðCð  %÷Cò CøðU ô ØŠðús   ÂC: Ã:	DÄD