
    AHjK                         d dl mZ d dl mZ d dl mZ d dl mZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ ddeddddfdededededee   dedee   dee   dedefdZy)    )Any)List)Optional)Tuple)Document)Lexer)SimpleLexer)PromptSession)Style)DEFAULT_QUESTION_PREFIX)INSTRUCTION_MULTILINE)build_validator)Question)merge_styles_default NFmessagedefaultvalidateqmarkstyle	multilineinstructionlexerkwargsreturnc                 @    t        |g      }	|xs t        d      }t        |      }
|rt        dt        t
        t        t        f      f fd}t        |f|	|
||d|}|j                  j                  t        |             t        |j                        S )a  Prompt the user to enter a free text message.

    This question type can be used to prompt the user for some text input.

    Example:
        >>> import questionary
        >>> questionary.text("What's your first name?").ask()
        ? What's your first name? Tom
        'Tom'

    .. image:: ../images/text.gif

    This is just a really basic example, the prompt can be customised using the
    parameters.

    Args:
        message: Question text.

        default: Default value will be returned if the user just hits
                 enter.

        validate: Require the entered value to pass a validation. The
                  value can not be submitted until the validator accepts
                  it (e.g. to check minimum password length).

                  This can either be a function accepting the input and
                  returning a boolean, or an class reference to a
                  subclass of the prompt toolkit Validator class.

        qmark: Question prefix displayed in front of the question.
               By default this is a ``?``.

        style: A custom color and style for the question parts. You can
               configure colors as well as font types for different elements.

        multiline: If ``True``, multiline input will be enabled.

        instruction: Write instructions for the user if needed. If ``None``
                     and ``multiline=True``, some instructions will appear.

        lexer: Supply a valid lexer to style the answer. Leave empty to
               use a simple one by default.

        kwargs: Additional arguments, they will be passed to prompt toolkit.

    Returns:
        :class:`Question`: Question instance, ready to be prompted (using ``.ask()``).
    zclass:answerr   c                  ~    dfddj                        fg} r"| j                  ddj                        f       | S )Nzclass:qmarkzclass:questionz {} zclass:instruction)formatappend)resultr   r   r   s    P/root/tools/cai/cai_env/lib/python3.12/site-packages/questionary/prompts/text.pyget_prompt_tokensztext.<locals>.get_prompt_tokensU   sD     %(+;V]]7=S*TUMM.k0JKL    )r   	validatorr   r   )r   r	   r   r   r   r   strr
   default_bufferresetr   r   app)r   r   r   r   r   r   r   r   r   merged_styler$   r"   ps   `  `  `      r!   textr+      s    v (0L0[0E)Iy+tE#s(O4  % A 8G,-AEE?r#   )typingr   r   r   r   prompt_toolkit.documentr   prompt_toolkit.lexersr   r	   prompt_toolkit.shortcuts.promptr
   prompt_toolkit.stylesr   questionary.constantsr   r   questionary.prompts.commonr   questionary.questionr   questionary.stylesr   r%   boolr+    r#   r!   <module>r7      s        , ' - 9 ' 9 7 6 ) 3
 (!!%!RRR R 	R
 E?R R #R E?R R Rr#   