ó
    Eñi¹  ã                   ó    • S SK Jr  S SKJrJrJrJrJr  SSKJ	r	  SSK
JrJr  \(       a
  SSKJrJrJr   " S S\5      rS	S
SSS\S   SS4S jrg)é    )Ú
itemgetter)ÚTYPE_CHECKINGÚCallableÚ
NamedTupleÚOptionalÚSequenceé   )Úerrors)Úis_renderableÚ	rich_cast)ÚConsoleÚConsoleOptionsÚRenderableTypec                   óÄ   • \ rS rSr% Sr\\S'    \\S'    \S\4S j5       rSS jr	S\SS 4S	 jr
S\SS 4S
 jr SS\\   S\\   SS 4S jjr\        SS j5       rSrg)ÚMeasurementé   zSStores the minimum and maximum widths (in characters) required to render an object.ÚminimumÚmaximumÚreturnc                 ó4   • U R                   U R                  -
  $ )z+Get difference between maximum and minimum.)r   r   )Úselfs    ÚI/home/mande/repo/quber/.venv/lib/python3.13/site-packages/rich/measure.pyÚspanÚMeasurement.span   s   € ð �|‰|˜dŸl™lÑ*Ð*ó    c           
      óˆ   • U u  p[        [        SU5      U5      n[        [        SU5      [        S[        X5      5      5      $ )z{Get measurement that ensures that minimum <= maximum and minimum >= 0

Returns:
    Measurement: A normalized measurement.
r   )ÚminÚmaxr   )r   r   r   s      r   Ú	normalizeÚMeasurement.normalize   s=   € ð  ÑˆÜ”c˜!˜W“o wÓ/ˆÜœ3˜q '›?¬C°´3°wÓ3HÓ,IÓJÐJr   Úwidthc                 óF   • U u  p#[        [        X!5      [        X15      5      $ )z–Get a RenderableWith where the widths are <= width.

Args:
    width (int): Maximum desired width.

Returns:
    Measurement: New Measurement object.
)r   r   ©r   r!   r   r   s       r   Úwith_maximumÚMeasurement.with_maximum"   s#   € ð  ÑˆÜœ3˜wÓ.´°GÓ0CÓDÐDr   c                 ó^   • U u  p#[        SU5      n[        [        X!5      [        X15      5      $ )z–Get a RenderableWith where the widths are >= width.

Args:
    width (int): Minimum desired width.

Returns:
    Measurement: New Measurement object.
r   )r   r   r#   s       r   Úwith_minimumÚMeasurement.with_minimum.   s.   € ð  ÑˆÜ�A�u“ˆÜœ3˜wÓ.´°GÓ0CÓDÐDr   NÚ	min_widthÚ	max_widthc                 óZ   • U nUb  UR                  U5      nUb  UR                  U5      nU$ )a  Clamp a measurement within the specified range.

Args:
    min_width (int): Minimum desired width, or ``None`` for no minimum. Defaults to None.
    max_width (int): Maximum desired width, or ``None`` for no maximum. Defaults to None.

Returns:
    Measurement: New Measurement object.
)r'   r$   )r   r)   r*   Úmeasurements       r   ÚclampÚMeasurement.clamp;   s;   € ð ˆØÑ Ø%×2Ñ2°9Ó=ˆKØÑ Ø%×2Ñ2°9Ó=ˆKØÐr   c                 óâ  • UR                   nUS:  a  [        SS5      $ [        U[        5      (       a  UR	                  X2R
                  SS9n[        U5      n[        U5      (       am  [        USS5      nUbQ  U" X5      R                  5       R                  U5      nUR                  S:  a  [        SS5      $ UR                  5       $ [        SU5      $ [        R                  " SU< S35      e)	a¥  Get a measurement for a renderable.

Args:
    console (~rich.console.Console): Console instance.
    options (~rich.console.ConsoleOptions): Console options.
    renderable (RenderableType): An object that may be rendered with Rich.

Raises:
    errors.NotRenderableError: If the object is not renderable.

Returns:
    Measurement: Measurement object containing range of character widths required to render the object.
r	   r   F)ÚmarkupÚ	highlightÚ__rich_measure__NzUnable to get render width for zD; a str, Segment, or object with __rich_console__ method is required)r*   r   Ú
isinstanceÚstrÚ
render_strr0   r   r   Úgetattrr   r$   r   r
   ÚNotRenderableError)ÚclsÚconsoleÚoptionsÚ
renderableÚ
_max_widthÚget_console_widthÚrender_widths          r   ÚgetÚMeasurement.getN   sÿ   € ð" ×&Ñ&ˆ
Ø˜‹>Ü˜q !Ó$Ð$Ü�j¤#×&Ñ&Ø ×+Ñ+Ø§>¡>¸Uð ,ð ˆJô ˜zÓ*ˆ
Ü˜×$Ñ$ô ˜
Ð$6¸Ó=ð ð !Ñ,á% gÓ7ß‘Y“[ß!‘\ *Ó-ð ð
  ×'Ñ'¨!Ó+Ü& q¨!Ó,Ð,Ø#×-Ñ-Ó/Ð/ä" 1 jÓ1Ð1ä×+Ò+Ø1°*±ð @Uð Uóð r   © )r   r   )NN)r9   r   r:   r   r;   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚintÚ__annotations__Úpropertyr   r   r$   r'   r   r-   Úclassmethodr?   Ú__static_attributes__rA   r   r   r   r      sÀ   ‡ Ù]àƒLØ5ØƒLØ5àð+�có +ó ð+ôKð
E #ð 
E¨-ô 
EðE #ð E¨-ô Eð KOñØ! #™ðØ:BÀ3¹-ðà	õð& ð+Øð+Ø*:ð+ØHXð+à	ó+ó ó+r   r   r9   r   r:   r   Úrenderablesr   r   c           	      ó
  • U(       d  [        SS5      $ [         R                  nU Vs/ s H  oC" XU5      PM     nn[        [        U[        S5      S9R                  [        U[        S5      S9R
                  5      nU$ s  snf )a‡  Get a measurement that would fit a number of renderables.

Args:
    console (~rich.console.Console): Console instance.
    options (~rich.console.ConsoleOptions): Console options.
    renderables (Iterable[RenderableType]): One or more renderable objects.

Returns:
    Measurement: Measurement object containing range of character widths required to
        contain all given renderables.
r   )Úkeyr	   )r   r?   r   r   r   r   )r9   r:   rL   Úget_measurementr;   ÚmeasurementsÚmeasured_widths          r   Úmeasure_renderablesrR   }   s�   € ö  Ü˜1˜aÓ Ð Ü!—o‘o€OáHSóÚHS¸*ˆ˜¨*Ö5Éð ð ô !ÜˆLœj¨›mÑ,×4Ñ4ÜˆLœj¨›mÑ,×4Ñ4ó€Nð Ðùòs   ¨B N)Úoperatorr   Útypingr   r   r   r   r   Ú r
   Úprotocolr   r   r9   r   r   r   r   rR   rA   r   r   Ú<module>rW      s[   ðÝ ß JÕ Jå ß .æß@Ñ@ôo�*ô oðdØðàðð Ð*Ñ+ðð õ	r   