ó
    OÎh‡(  ã                  óü   • S r SSKJr  SSKJrJr  SSKJrJr  SSK	J
r
Jr  SSKJrJrJr  SSKJr  SS	KJr  \(       a  SS
KJr  / SQr " S S\S9r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)zQ
Margin implementations for a :class:`~prompt_toolkit.layout.containers.Window`.
é    )Úannotations)ÚABCMetaÚabstractmethod)ÚTYPE_CHECKINGÚCallable)ÚFilterOrBoolÚ	to_filter)ÚStyleAndTextTuplesÚfragment_list_to_textÚto_formatted_text)Ú
get_cwidthé   )Ú	UIContent)ÚWindowRenderInfo)ÚMarginÚNumberedMarginÚScrollbarMarginÚConditionalMarginÚPromptMarginc                  óP   • \ rS rSrSr\SS j5       r\        SS j5       rSrg)	r   é    z
Base interface for a margin.
c                ó   • g)zã
Return the width that this margin is going to consume.

:param get_ui_content: Callable that asks the user control to create
    a :class:`.UIContent` instance. This can be used for instance to
    obtain the number of lines.
r   © ©ÚselfÚget_ui_contents     ÚZ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/prompt_toolkit/layout/margins.pyÚ	get_widthÚMargin.get_width%   s   € ð ó    c                ó   • / $ )aS  
Creates a margin.
This should return a list of (style_str, text) tuples.

:param window_render_info:
    :class:`~prompt_toolkit.layout.containers.WindowRenderInfo`
    instance, generated after rendering and copying the visible part of
    the :class:`~prompt_toolkit.layout.controls.UIControl` into the
    :class:`~prompt_toolkit.layout.containers.Window`.
:param width: The width that's available for this margin. (As reported
    by :meth:`.get_width`.)
:param height: The height that's available for this margin. (The height
    of the :class:`~prompt_toolkit.layout.containers.Window`.)
r   ©r   Úwindow_render_infoÚwidthÚheights       r   Úcreate_marginÚMargin.create_margin0   s	   € ð$ ˆ	r    r   N©r   zCallable[[], UIContent]ÚreturnÚint©r#   r   r$   r*   r%   r*   r)   r
   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r&   Ú__static_attributes__r   r    r   r   r       sO   † ñð óó ðð ðØ"2ðØ;>ðØHKðà	óó ór    r   )Ú	metaclassc                  óV   • \ rS rSrSr S     S	S jjrS
S jr        SS jrSrg)r   éE   zú
Margin that displays the line numbers.

:param relative: Number relative to the cursor position. Similar to the Vi
                 'relativenumber' option.
:param display_tildes: Display tildes after the end of the document, just
    like Vi does.
c                óD   • [        U5      U l        [        U5      U l        g ©N)r	   ÚrelativeÚdisplay_tildes)r   r7   r8   s      r   Ú__init__ÚNumberedMargin.__init__O   s   € ô " (Ó+ˆŒÜ'¨Ó7ˆÕr    c                óV   • U" 5       R                   n[        S[        U 5      S-   5      $ )Né   r   )Ú
line_countÚmaxÚlen)r   r   r=   s      r   r   ÚNumberedMargin.get_widthU   s)   € Ù#Ó%×0Ñ0ˆ
Ü�1”c˜Z˜LÓ*¨QÑ.Ó/Ð/r    c                óž  • U R                  5       nSnSnUR                  R                  R                  n/ nS n	[	        UR
                  5       H¯  u  p«X¹:w  a’  Uc  OŽX·:X  aJ  U(       a  UR                  USUS-   -  45        OhUR                  USUS-   -  R                  U5      45        O?U(       a  [        X·-
  5      S-
  nUR                  USUS-   -  R                  U5      45        Un	UR                  S5        M±     U R                  5       (       a7  W
UR                  :  a'  UR                  S5        U
S-  n
X¡R                  :  a  M'  U$ )Nzclass:line-numberzclass:line-number.currentz%ir   z%i ©Ú Ú
)zclass:tildez~
)r7   Ú
ui_contentÚcursor_positionÚyÚ	enumerateÚdisplayed_linesÚappendÚrjustÚabsr8   Úwindow_height)r   r#   r$   r%   r7   ÚstyleÚstyle_currentÚcurrent_linenoÚresultÚlast_linenorG   Úlinenos               r   r&   ÚNumberedMargin.create_marginY   sH  € ð —=‘=“?ˆà#ˆØ3ˆð ,×6Ñ6×FÑF×HÑHˆð &(ˆØˆä"Ð#5×#EÑ#EÖF‰IˆAàÓ$Ø‘>ØØÓ-æàŸ™ }°d¸fÀq¹jÑ6IÐ&JÕKàŸ™Ø*¨U°f¸q±jÑ-A×,HÑ,HÈÓ,OÐPõö
  Ü!$ VÑ%<Ó!=ÀÑ!A˜à—M‘M 5¨5°F¸Q±JÑ+?×*FÑ*FÀuÓ*MÐ"NÔOà ˆKØ�M‰M˜*Ö%ñ- Gð2 ×Ñ× Ñ ØÐ(×6Ñ6Ó6Ø—‘Ð4Ô5Ø�Q‘�ð ×6Ñ6Õ6ð ˆr    )r8   r7   N)FF)r7   r   r8   r   r)   ÚNoner(   r+   ©	r,   r-   r.   r/   r0   r9   r   r&   r1   r   r    r   r   r   E   sU   † ñð NSð8Ø$ð8Ø>Jð8à	õ8ô0ð-Ø"2ð-Ø;>ð-ØHKð-à	÷-r    r   c                  óF   • \ rS rSrSrSS jrS	S jr        S
S jrSrg)r   é‰   zB
Wrapper around other :class:`.Margin` classes to show/hide them.
c                ó0   • Xl         [        U5      U l        g r6   )Úmarginr	   Úfilter)r   rZ   r[   s      r   r9   ÚConditionalMargin.__init__Ž   s   € ØŒÜ Ó'ˆ�r    c                ód   • U R                  5       (       a  U R                  R                  U5      $ g)Nr   )r[   rZ   r   r   s     r   r   ÚConditionalMargin.get_width’   s%   € Ø�;‰;�=‰=Ø—;‘;×(Ñ(¨Ó8Ð8àr    c                óv   • U(       a1  U R                  5       (       a  U R                  R                  XU5      $ / $ r6   )r[   rZ   r&   r"   s       r   r&   ÚConditionalMargin.create_margin˜   s.   € ö �T—[‘[—]‘]Ø—;‘;×,Ñ,Ð-?ÈÓOÐOàˆIr    )r[   rZ   N)rZ   r   r[   r   r)   rU   r(   r+   rV   r   r    r   r   r   ‰   s6   † ñô(ôðØ"2ðØ;>ðØHKðà	÷r    r   c                  ó^   • \ rS rSrSr   S       S	S jjrS
S jr        SS jrSrg)r   é¡   zW
Margin displaying a scrollbar.

:param display_arrows: Display scroll up/down arrows.
c                ó<   • [        U5      U l        X l        X0l        g r6   )r	   Údisplay_arrowsÚup_arrow_symbolÚdown_arrow_symbol)r   rd   re   rf   s       r   r9   ÚScrollbarMargin.__init__¨   s   € ô (¨Ó7ˆÔØ.ÔØ!2Õr    c                ó   • g)Nr   r   r   s     r   r   ÚScrollbarMargin.get_width²   s   € Ør    c           
     ó^  ^^• UR                   nUR                  nU R                  5       nU(       a  US-  n [        UR                  5      [        U5      -  nUR                  [        U5      -  n[        [        U[        SXW-  5      5      5      m[        XX-  5      mSUU4S jjn	/ n
U(       a  U
R                  SU R                  4S/5        SnSnSnS	n[        U5       H�  nU	" U5      (       a8  U	" US-   5      (       d  U
R                  US
45        OKU
R                  US
45        O7U	" US-   5      (       a  U
R                  US
45        OU
R                  US
45        U
R                  S5        M’     U(       a  U
R                  SU R                  45        U
$ ! [         a    / s $ f = f)Né   r   c                ó4   >• TU s=:*  =(       a    TT-   :*  $ s  $ )z/True if we should display a button on this row.r   )ÚrowÚscrollbar_heightÚscrollbar_tops    €€r   Úis_scroll_buttonÚ7ScrollbarMargin.create_margin.<locals>.is_scroll_buttonÍ   s"   ø€ à$¨×OÓO¨}Ð?OÑ/OÑOÐOÑOÐOr    zclass:scrollbar.arrow)zclass:scrollbarrD   zclass:scrollbar.backgroundz*class:scrollbar.background,scrollbar.startzclass:scrollbar.buttonz$class:scrollbar.button,scrollbar.endÚ rB   )rm   r*   r)   Úbool)Úcontent_heightrM   rd   r?   rI   ÚfloatÚvertical_scrollr*   Úminr>   Úextendre   ÚrangerJ   rf   ÚZeroDivisionError)r   r#   r$   r%   rt   rM   rd   Úfraction_visibleÚfraction_aboverp   rQ   Úscrollbar_backgroundÚscrollbar_background_startÚscrollbar_buttonÚscrollbar_button_endÚirn   ro   s                   @@r   r&   ÚScrollbarMargin.create_marginµ   s¼  ù€ ð ,×:Ñ:ˆØ*×8Ñ8ˆØ×,Ñ,Ó.ˆæØ˜QÑˆMð5	Ü"Ð#5×#EÑ#EÓFÌØóJñ  Ðð 0×?Ñ?Ä%ÈÓBWÑWˆNä"Ü�M¤3 q¨-Ñ*JÓ#KÓLó Ðô   Ñ >Ó?ˆM÷
Pð Pð
 *,ˆFÞØ—‘à0°$×2FÑ2FÐGØ1ðôð $@Ð Ø)UÐ&Ø7ÐØ#IÐ ä˜=Ö)�Ù# A×&Ñ&Ù+¨A°©E×2Ñ2ð Ÿ™Ð';¸SÐ&AÕBàŸ™Ð'7¸Ð&=Õ>á'¨¨A©×.Ñ.ØŸ™Ð'AÀ3Ð&GÕHàŸ™Ð';¸SÐ&AÔBØ—‘˜jÖ)ñ *ö  Ø—‘Ð6¸×8NÑ8NÐOÔPàˆMøôW !ó 	ØŠIð	ús   ¸A'F ÆF,Æ+F,)rd   rf   re   N)FÚ^Úv)rd   r   re   Ústrrf   r…   r)   rU   r(   r+   rV   r   r    r   r   r   ¡   sg   † ñð (-Ø"Ø!$ð	3à$ð3ð ð3ð ð	3ð
 
õ3ôð?Ø"2ð?Ø;>ð?ØHKð?à	÷?r    r   c                  óV   • \ rS rSrSr S     S	S jjrS
S jr        SS jrSrg)r   é÷   ab  
[Deprecated]

Create margin that displays a prompt.
This can display one prompt at the first line, and a continuation prompt
(e.g, just dots) on all the following lines.

This `PromptMargin` implementation has been largely superseded in favor of
the `get_line_prefix` attribute of `Window`. The reason is that a margin is
always a fixed width, while `get_line_prefix` can return a variable width
prefix in front of every line, making it more powerful, especially for line
continuations.

:param get_prompt: Callable returns formatted text or a list of
    `(style_str, type)` tuples to be shown as the prompt at the first line.
:param get_continuation: Callable that takes three inputs. The width (int),
    line_number (int), and is_soft_wrap (bool). It should return formatted
    text or a list of `(style_str, type)` tuples for the next lines of the
    input.
Nc                ó   • Xl         X l        g r6   )Ú
get_promptÚget_continuation)r   r‰   rŠ   s      r   r9   ÚPromptMargin.__init__  s   € ð %ŒØ 0Õr    c                óJ   • [        U R                  5       5      n[        U5      $ )z Width to report to the `Window`.)r   r‰   r   )r   r   Útexts      r   r   ÚPromptMargin.get_width  s    € ô % T§_¡_Ó%6Ó7ˆÜ˜$ÓÐr    c                ó  • U R                   n/ nUR                  [        U R                  5       5      5        U(       aN  S nUR                  SS   H9  nUR                  S5        UR                  [        U" X'Xv:H  5      5      5        UnM;     U$ )Nr   rB   )rŠ   rx   r   r‰   rI   rJ   )r   r#   r$   r%   rŠ   rQ   Úlast_yrG   s           r   r&   ÚPromptMargin.create_margin  s‰   € ð  ×0Ñ0ÐØ%'ˆð 	�‰Ô'¨¯©Ó(9Ó:Ô;ö ØˆFà'×7Ñ7¸¸Ó;�Ø—‘˜jÔ)Ø—‘Ü%Ñ&6°uÀÁÓ&MÓNôð ’ñ <ð ˆr    )rŠ   r‰   r6   )r‰   z Callable[[], StyleAndTextTuples]rŠ   z5None | Callable[[int, int, bool], StyleAndTextTuples]r)   rU   r(   r+   rV   r   r    r   r   r   ÷   sX   † ñð2 >Bð	1à4ð1ð;ð1ð
 
õ1ô ðØ"2ðØ;>ðØHKðà	÷r    r   N)r0   Ú
__future__r   Úabcr   r   Útypingr   r   Úprompt_toolkit.filtersr   r	   Úprompt_toolkit.formatted_textr
   r   r   Úprompt_toolkit.utilsr   Úcontrolsr   Ú
containersr   Ú__all__r   r   r   r   r   r   r    r   Ú<module>r›      sz   ðñõ #ç 'ß *ç :÷ñ õ
 ,å æÝ,ò€ô"�wò "ôJA�Vô AôH˜ô ô0S�fô Sôl9�6õ 9r    