Ë
    V.jA  ã                  ó  — U d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	 erd dl
mZ d dlmZ ddlmZ g d	¢Z G d
„ d«      Z ed e«       ¬«      Zded<   dd„Zdd„Zdd„Zedd„«       Ze	 d	 	 	 	 	 dd„«       Zedd„«       Zy)é    )Úannotations)Úcontextmanager)Ú
ContextVar)ÚTYPE_CHECKINGÚAnyÚ	Generator)ÚInput)ÚOutputé   )ÚApplication)Ú
AppSessionÚget_app_sessionÚget_appÚget_app_or_noneÚset_appÚcreate_app_sessionÚcreate_app_session_from_ttyc                  óR   — e Zd ZdZ	 d	 	 	 	 	 dd„Zd	d„Zed
d„«       Zedd„«       Zy)r   aY  
    An AppSession is an interactive session, usually connected to one terminal.
    Within one such session, interaction with many applications can happen, one
    after the other.

    The input/output device is not supposed to change during one session.

    Warning: Always use the `create_app_session` function to create an
    instance, so that it gets activated correctly.

    :param input: Use this as a default input for all applications
        running in this session, unless an input is passed to the `Application`
        explicitly.
    :param output: Use this as a default output.
    Nc                ó.   — || _         || _        d | _        y ©N)Ú_inputÚ_outputÚapp)ÚselfÚinputÚoutputs      údC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\prompt_toolkit/application/current.pyÚ__init__zAppSession.__init__)   s   € ð ˆŒØˆŒð -1ˆ�ó    c                ó"   — d| j                   ›d�S )NzAppSession(app=Ú))r   )r   s    r   Ú__repr__zAppSession.__repr__3   s   € Ø  §¡ ¨AÐ.Ð.r   c                óV   — | j                   €ddlm}  |«       | _         | j                   S )Nr   ©Úcreate_input)r   Úprompt_toolkit.input.defaultsr%   )r   r%   s     r   r   zAppSession.input6   s"   € à�;‰;ÐÝBá&›.ˆDŒKØ�{‰{Ðr   c                óV   — | j                   €ddlm}  |«       | _         | j                   S )Nr   ©Úcreate_output)r   Úprompt_toolkit.output.defaultsr)   )r   r)   s     r   r   zAppSession.output>   s"   € à�<‰<ÐÝDá(›?ˆDŒLØ�|‰|Ðr   ©NN)r   úInput | Noner   úOutput | NoneÚreturnÚNone)r.   Ústr)r.   r	   )r.   r
   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r"   Úpropertyr   r   © r   r   r   r      sX   „ ñð" CGð1Ø!ð1Ø2?ð1à	ó1ó/ð òó ðð òó ñr   r   Ú_current_app_session)ÚdefaultzContextVar[AppSession]c                 ó*   — t         j                  «       S r   )r7   Úgetr6   r   r   r   r   L   s   € Ü×#Ñ#Ó%Ð%r   c                 ót   — t         j                  «       } | j                  �| j                  S ddlm}  |«       S )a'  
    Get the current active (running) Application.
    An :class:`.Application` is active during the
    :meth:`.Application.run_async` call.

    We assume that there can only be one :class:`.Application` active at the
    same time. There is only one terminal window, with only one stdin and
    stdout. This makes the code significantly easier than passing around the
    :class:`.Application` everywhere.

    If no :class:`.Application` is running, then return by default a
    :class:`.DummyApplication`. For practical reasons, we prefer to not raise
    an exception. This way, we don't have to check all over the place whether
    an actual `Application` was returned.

    (For applications like pymux where we can have more than one `Application`,
    we'll use a work-around to handle that.)
    r   )ÚDummyApplication)r7   r:   r   Údummyr<   )Úsessionr<   s     r   r   r   P   s2   € ô& #×&Ñ&Ó(€GØ‡{�{ÐØ�{‰{Ðå'áÓÐr   c                 óB   — t         j                  «       } | j                  S )zj
    Get the current active (running) Application, or return `None` if no
    application is running.
    ©r7   r:   r   )r>   s    r   r   r   l   s   € ô
 #×&Ñ&Ó(€GØ�;‰;Ðr   c              #  óŠ   K  — t         j                  «       }|j                  }| |_        	 d–— ||_        y# ||_        w xY w­w)aµ  
    Context manager that sets the given :class:`.Application` active in an
    `AppSession`.

    This should only be called by the `Application` itself.
    The application will automatically be active while its running. If you want
    the application to be active in other threads/coroutines, where that's not
    the case, use `contextvars.copy_context()`, or use `Application.context` to
    run it in the appropriate context.
    Nr@   )r   r>   Úprevious_apps      r   r   r   u   s<   è ø€ ô #×&Ñ&Ó(€Gà—;‘;€LØ€G„Kð#Ûà"ˆ�ø�lˆ�üs   ‚(A«7 ¯A·	A Á ANc              #  ó  K  — | €t        «       j                  } |€t        «       j                  }t        | |¬«      }t        j                  |«      }	 |–— t        j                  |«       y# t        j                  |«       w xY w­w)z§
    Create a separate AppSession.

    This is useful if there can be multiple individual ``AppSession``'s going
    on. Like in the case of a Telnet/SSH server.
    N©r   r   )r   r   r   r   r7   ÚsetÚreset)r   r   r>   Útokens       r   r   r   ‹   ss   è ø€ ð$ €}ÜÓ!×(Ñ(ˆØ€~Ü Ó"×*Ñ*ˆô ˜u¨VÔ4€Gä ×$Ñ$ WÓ-€Eð*ØŠä×"Ñ" 5Õ)øÔ×"Ñ" 5Õ)üs   ‚ABÁA, ÁBÁ,BÂBc               #  ó”   K  — ddl m}  ddlm}  | d¬«      } |d¬«      }t	        ||¬«      5 }|–— ddd«       y# 1 sw Y   yxY w­w)a‘  
    Create `AppSession` that always prefers the TTY input/output.

    Even if `sys.stdin` and `sys.stdout` are connected to input/output pipes,
    this will still use the terminal for interaction (because `sys.stderr` is
    still connected to the terminal).

    Usage::

        from prompt_toolkit.shortcuts import prompt

        with create_app_session_from_tty():
            prompt('>')
    r   r$   r(   T)Úalways_prefer_ttyrD   N)r&   r%   r*   r)   r   )r%   r)   r   r   Úapp_sessions        r   r   r   ¬   s?   è ø€ õ  ;Ý<á¨4Ô0€EÙ¨TÔ2€Fä	 %°Õ	7¸;ØÒ÷ 
8×	7Ñ	7üs   ‚,A®<³	A¼AÁA)r.   r   )r.   úApplication[Any])r.   zApplication[Any] | None)r   rK   r.   zGenerator[None, None, None]r+   )r   r,   r   r-   r.   ú!Generator[AppSession, None, None])r.   rL   )Ú
__future__r   Ú
contextlibr   Úcontextvarsr   Útypingr   r   r   Úprompt_toolkit.input.baser	   Úprompt_toolkit.output.baser
   Úapplicationr   Ú__all__r   r7   Ú__annotations__r   r   r   r   r   r   r6   r   r   Ú<module>rV      sµ   ðÞ "å %Ý "ß 0Ñ 0áÝ/Ý1å(ò€÷,ñ ,ñ^ 0:Ø¡J£Lô0Ð Ð,ó ó
&óó8ð ò#ó ð#ð* à8<ð*Øð*Ø(5ð*à&ò*ó ð*ð@ òó ñr   