+
    Tib*                      a 0 t $ ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	H
t
Ht ^ RIHt ]]]]3,          t]! ^4      t. R!OtR]R&   ]! ] U UUu. uF$  w  r]! ]]! W^,           4      4       F  pVNK  	  K&  	  uppp 4      t]P2                  tR]R	&    ! R
 R]	4      t]! RR7      R"R R ll4       t]! R4      R"R R ll4       tR"R R lltR R ltR"R R llt R"R R llt!R"R R llt"R"R R llt#R"R R llt$R # u uppp i )#    )annotations)	lru_cache)
itemgetter)Callable
NamedTupleSequenceTuple)loadzlist[tuple[int, int]]_SINGLE_CELL_UNICODE_RANGESzCallable[[str], bool]_is_single_cell_widthsc                  :    ] tR t^&t$ RtR]R&   R]R&   R]R&   RtR	# )
	CellTablezDContains unicode data required to measure the cell widths of glyphs.strunicode_versionzSequence[tuple[int, int, int]]widthszfrozenset[str]narrow_to_wide N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r       U/home/kuhnn/.local/share/uv/tools/nano-pdf/lib/python3.14/site-packages/rich/cells.pyr   r   &   s    N**""r   r   i   )maxsizec               $    V ^8  d   QhRRRRRR/# )   	characterr   r   returnintr   )formats   "r   __annotate__r$   /   s!      s S c r   c                p   \        V 4      pV'       d   V^ 8  g   ^Tu;8:  d
   ^8  d    ^ #  M^ # \        V4      P                  pVR,          pW$^,          8  d   ^# ^ p\        V4      ^,
          pWV8:  d?   WV,           ^,	          pW7,          w  rp
W(8  d   V^,
          pK1  W)8  d   V^,           pKB  V
# ^# )a  Get the cell size of a character.

Args:
    character (str): A single character.
    unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.

Returns:
    int: Number of cells (0, 1 or 2) occupied by that character.
)ordload_cell_tabler   len)r    r   	codepointtable
last_entrylower_boundupper_boundindexstartendwidths   &&         r   get_character_cell_sizer3   .   s     IIY^u	'AE'A (BO,33ErJa= Ke*q.K

$*q0!LE!)K_!)KLr   c               $    V ^8  d   QhRRRRRR/# r   textr   r   r!   r"   r   )r#   s   "r   r$   r$   R   s!     , ,# , , ,r   c                    \        W4      # )a}  Get the number of cells required to display text.

This method always caches, which may use up a lot of memory. It is recommended to use
`cell_len` over this method.

Args:
    text (str): Text to display.
    unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.

Returns:
    int: Get the number of cells required to display text.
)	_cell_lenr6   r   s   &&r   cached_cell_lenr:   Q   s     T++r   c               $    V ^8  d   QhRRRRRR/# r5   r   )r#   s   "r   r$   r$   b   s!     , ,3 , ,# ,r   c                N    \        V 4      R8  d   \        W4      # \        W4      # )  Get the cell length of a string (length as it appears in the terminal).

Args:
    text: String to measure.
    unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.

Returns:
    Length of string in terminal cells.
i   )r)   r:   r8   r9   s   &&r   cell_lenr>   b   s%     4y3t55T++r   c               $    V ^8  d   QhRRRRRR/# r5   r   )r#   s   "r   r$   r$   q   s!     - -C -# -# -r   c                  a \        V 4      '       d   \        V 4      # RV 9  d   RV 9  d   \        V3R lV  4       4      # \        S4      p^ pRpRR0p^ p\        V 4      pWg8  di   W,          pW9   d2   VR8X  d   V^,          pM>V'       d   W4VP                  9   ,          pRpM\        VS4      ;p	'       d   TpW9,          pV^,          pKn  V# )r=      ‍   ️c              3  <   <"   T F  p\        VS4      x  K  	  R # 5i)N)r3   ).0r    r   s   & r   	<genexpr>_cell_len.<locals>.<genexpr>   s       
QUI#I??QUs   N)r   r)   sumr(   r   r3   )
r6   r   
cell_tabletotal_widthlast_measured_characterSPECIALr/   character_countr    character_widths
   &f        r   r8   r8   q   s     d##4y t 4 
QU
 
 	
 !1JK*."GE$iO

!K	H$
(*:S:SSS*.'"9)_"UUU*3'.
r   c               $    V ^8  d   QhRRRRRR/# )r   r6   r   r   r!   z'tuple[list[CellSpan], int]'r   )r#   s   "r   r$   r$      s$     2  2 
2  #2 !2 r   c                2   \        V4      p\        V 4      p^ pRp^ p. pRR0pWC8  d   W,          ;q9   d   V	R8X  d&   V^,          pV'       d   VR,          w  rpWV3VR&   MPV'       dI   V^,          pV'       d8   VR,          w  rpWRP                  9   d   RpV^,          pV^,          pWV3VR&   K  \        W4      ;p'       d(   T	pVP	                  YD^,           ;qM34       Wm,          pK  V'       g   K  VR,          w  rpW^,           ;qL3VR&   K  Wv3# )zDivide text into spans that define a single grapheme.

Args:
    text: String to split.
    unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.

Returns:
    List of spans.
NrA   rB   r&   )r(   r)   r   r3   append)r6   r   rH   codepoint_countr/   rJ   rI   spansrK   r    r0   _endcell_lengthrM   s   &&            r   split_graphemesrU      s5    !1J$iOE*.K(*E"G

!$I0H$
/4Ry,E!&{ ;E"I(
/4Ry,E.2K2KK26/#q(#q(!&{ ;E"I5iQQ?Q&/#LL%!)!3EF*KU',Ry$E 2@E"Ir   c               (    V ^8  d   QhRRRRRRRR/# r   r6   r   cell_positionr"   r   r!   ztuple[str, str]r   )r#   s   "r   r$   r$      s,     )# )#
)#!)#47)#)#r   c                4   V^ 8:  d   RV 3# \        W4      w  r4\        W,          \        V4      ,          4      p\        \	        \
        VRV 4      4      p Wa8X  d-   V\        V4      8  d   V R3# W5,          ^ ,          pV RV WR 3# Wa8  dC   W5,          w  rp
Wj,           V8  d   V RV R,           RW	R ,           3# V^,          pWj,          pK{  W5^,
          ,          w  rp
Wj,
          V8  d   V RV R,           RW	R ,           3# V^,          pWj,          pK  )P  Split text by cell position.

If the cell position falls within a double width character, it is converted to two spaces.

Args:
    text: Text to split.
    cell_position Offset in cells.
    unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.

Returns:
    Tuple to two split strings.
 N )rU   r"   r)   rG   map_span_get_cell_len)r6   rX   r   rR   rT   offset	left_sizesplit_indexr0   r1   	cell_sizes   &&&        r   _split_textrc      s,    4x(?E --U;<FC*E'6N;<I
%U#Rx-*K%tL'999$$)M!E	$}4FU|c)3d+;;;aKF"I$)1*$5!E	$}4FU|c)3d+;;;aKF"Ir   c               (    V ^8  d   QhRRRRRRRR/# rW   r   )r#   s   "r   r$   r$     s,     = =
=!=47==r   c                N    \        V 4      '       d
   V RV WR 3# \        WV4      # )rZ   N)r   rc   )r6   rX   r   s   &&&r   
split_textrf     s3     d##N]#T.%999tO<<r   c               (    V ^8  d   QhRRRRRRRR/# )r   r6   r   totalr"   r   r!   r   )r#   s   "r   r$   r$     s(       C # 3 r   c                   \        V 4      '       d-   \        V 4      pW18  d   V RW,
          ,          ,           # V RV # V^ 8:  d   R# \        V 4      pWA8X  d   V # WA8  d   V RW,
          ,          ,           # \        WV4      w  rV # )a  Adjust a string by cropping or padding with spaces such that it fits within the given number of cells.

Args:
    text: String to adjust.
    total: Desired size in cells.
    unicode_version: Unicode version.

Returns:
    A string with cell size equal to total.
r\   Nr[   )r   r)   r>   rc   )r6   rh   r   sizerb   _s   &&&   r   set_cell_sizerl     s     d##4y<#...FU|zIcU.///$7GDKr   c               (    V ^8  d   QhRRRRRRRR/# )r   r6   r   r2   r"   r   r!   z	list[str]r   )r#   s   "r   r$   r$   1  s(      S  s 	 r   c                Z   \        V 4      '       d/   \        ^ \        V 4      V4       Uu. uF  q0W3V,            NK  	  up# \        W4      w  rE^ p. p^ pV F2  w  rpWk,           V8  d   VP	                  WV	 4       T	p^ pWk,          pK4  	  V'       d   VP	                  WR 4       V# u upi )aL  Split text into lines such that each line fits within the available (cell) width.

Args:
    text: The text to fold such that it fits in the given width.
    width: The width available (number of cells).

Returns:
    A list of strings such that each string in the list has cell width
    less than or equal to the available width.
N)r   ranger)   rU   rP   )r6   r2   r   r/   rR   rk   	line_sizelinesline_offsetr0   r1   rb   s   &&&         r   
chop_cellsrs   1  s     d##9>q#d)U9ST9SUU]+9STTt5HEIEK!&I 5(LL%01KI	 "' T,'(L Us   B(N))    ~   )      )   i  )ip  i  )i %  i%  )i (  i(  )auto)%__conditional_annotations__
__future__r   	functoolsr   operatorr   typingr   r   r   r	   rich._unicode_datar
   r(   r"   CellSpanr^   r   r   	frozensetr]   chrro   _SINGLE_CELLS
issupersetr   r   r3   r:   r>   r8   rU   rc   rf   rl   rs   )_startrS   r    rz   s   000@r   <module>r      s   " "   8 8 6c3] 6 2   87LFS%q"9:I 	: 	7 1>0H0H - H#
 # 4 D 4, , ,-`2 j)#X=(6 os   *C<