
    !<i #                     |    d Z ddlZddlZddlmZmZ erddlmZmZ ddl	m
Z
mZ deddd	efd
Z G d d          ZdS )z5Plain text help formatter for improved accessibility.    N)TYPE_CHECKINGAny)ConsoleConsoleOptions)	HelpEntry	HelpPanelobjconsoler   returnc                    | dS t          | d          r| j                                        S t          | d          rddlm}  |t          j                    |j        |j        |j	        |j
        |j        ddddd	          }|                                5 }|                    | d
           ddd           n# 1 swxY w Y   |                                                                S t          |                                           S )a  Extract plain text from Rich renderables.

    Parameters
    ----------
    obj : Any
        Object to convert to plain text.
    console : ~rich.console.Console
        Console for rendering Rich objects.

    Returns
    -------
    str
        Plain text representation.
    N plain__rich_console__r   )r   FT)filewidthheighttab_sizelegacy_windowssafe_boxforce_terminalno_color	highlightmarkupemoji)end)hasattrr   rstriprich.consoler   ioStringIOr   r   r   r   r   captureprintgetstr)r	   r
   r   plain_consoler!   s        /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/cyclopts/help/formatters/plain.py_to_plain_textr'      sX    {r sG "y!!! s&'' &((((((->%"1% 
 
 
 ""$$ 	-,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-{{}}##%%% s88??s   B<<C C c                      e Zd ZdZ	 	 ddededz  fdZddd	ed
dfdZ	 	 	 	 	 	 	 	 ddZddddde	d
dfdZ
ddddde	d
dfdZdeedf         deedf         deddddd
dfdZdeedf         deedf         deddd
df
dZdS )PlainFormatterzPlain text formatter for improved accessibility.

    Parameters
    ----------
    indent_width : int
        Number of spaces to indent entries (default: 2).
    max_width : Optional[int]
        Maximum line width for wrapping text.
       Nindent_width	max_widthc                 6    || _         || _        d|z  | _        d S )N )r+   r,   indent)selfr+   r,   s      r&   __init__zPlainFormatter.__init__I   s#    
 )"L(    r
   r   textr   c                 6    |                     |dd           dS )z.Print text without any highlighting or markup.F)r   r   N)r"   )r0   r
   r3   s      r&   _print_plainzPlainFormatter._print_plainR   s     deE:::::r2   optionsr   panelr   c                    |j         sdS |j        r|                     ||j         d           |j         D ]}|j        rd                    |j                  nd}|j        rd                    |j                  nd}t          |j        |          }|s|rQ|j        dk    r$| 	                    |j        |j        |||           | 
                    |j        |j        ||           |                                 dS )a@  Format and render a single help panel as plain text.

        Parameters
        ----------
        console : ~rich.console.Console
            Console to render to.
        options : ~rich.console.ConsoleOptions
            Console rendering options.
        panel : HelpPanel
            Help panel to render.
        N:r.   r   	parameter)entriestitler5   namesjoinshortsr'   descriptionformat_format_parameter_entry_format_command_entryr"   )r0   r
   r6   r7   entry
names_textshorts_textdescs           r&   __call__zPlainFormatter.__call__V   s!   " } 	F ; 	:g%+'8'8'8999 ] 	Y 	YE 38+E%+...2J49LH#((5<000bK!%"3W==D  Y[ Y<;..00elDRY[`aaaa ..u{EL$PWXXX 	r2   usagec                     |r>t          ||          }|r.|                     ||           |                                 dS dS dS )a$  Render the usage line.

        Parameters
        ----------
        console : ~rich.console.Console
            Console to render to.
        options : ~rich.console.ConsoleOptions
            Console rendering options.
        usage : Any
            The usage line (Text or str).
        Nr'   r5   r"   )r0   r
   r6   rI   
usage_texts        r&   render_usagezPlainFormatter.render_usage   s^    "  	 'w77J  !!':666		  	    r2   r@   c                     |r>t          ||          }|r.|                     ||           |                                 dS dS dS )a@  Render the description.

        Parameters
        ----------
        console : ~rich.console.Console
            Console to render to.
        options : ~rich.console.ConsoleOptions
            Console rendering options.
        description : Any
            The description (can be various Rich renderables).
        NrK   )r0   r
   r6   r@   	desc_texts        r&   render_descriptionz!PlainFormatter.render_description   s^    "  	 &{G<<I  !!'9555		  	    r2   r=   .r?   rG   rD   r   c                 f   t          |          t          |          z   }|sdS g }|r|                    |           |j        r3d                    |j                  }|                    d| d           |j        r3d                    |j                  }	|                    d|	 d           |j        |                    d|j         d           |j        r|                    d           d                    |          }
t          |          d	k    rQd                    |          }|
r| d
|
 }n|}|                     |t          j
        || j
                             dS |
r|d          d
|
 }n|d         }|                     |t          j
        || j
                             dS )a  Format and print a parameter entry.

        Parameters
        ----------
        names : tuple[str, ...]
            Parameter long names.
        shorts : tuple[str, ...]
            Short forms of the parameter.
        desc : str
            Parameter description.
        console : ~rich.console.Console
            Console to print to.
        entry : HelpEntry
            The full help entry with metadata fields.
        N, z
[choices: ]z
[env var: z
[default: z
[required]r.      : r   )listappendchoicesr>   env_vardefaultrequiredlenr5   textwrapr/   )r0   r=   r?   rG   r
   rD   all_options
desc_partschoices_strenv_vars_str	full_descoptions_strr3   s                r&   rB   z&PlainFormatter._format_parameter_entry   s   0 5kkDLL0 	F 
 	$d### = 	;))EM22K9;999:::= 	<99U]33L:<:::;;;=$;5=;;;<<<> 	,l+++HHZ((	 {a))K00K #%4444"gxtT['I'IJJJJJ  &%a.77I77"1~gxtT['I'IJJJJJr2   c                 F   |rt          |          D ]\  }}|dk    r|g}|r+|                    dd                    |          z              d                    |          }|r| d| }	n|}	|                     |t	          j        |	| j                             |                     |t	          j        || j                             dS |rQd                    |          }
|r|
 d| }	n|
}	|                     |t	          j        |	| j                             dS dS )aW  Format and print a command entry.

        Parameters
        ----------
        names : tuple[str, ...]
            Command long names.
        shorts : tuple[str, ...]
            Short forms of the command.
        desc : str
            Command description.
        console : ~rich.console.Console
            Console to print to.
        r   rR   r.   r   rU   N)	enumeraterW   r>   r5   r]   r/   )r0   r=   r?   rG   r
   inameparts
entry_namer3   
shorts_strs              r&   rC   z$PlainFormatter._format_command_entry   sf   ,  	K$U++ S S466!FE >TCHHV,<,<%<===!#J *",6666)%%gxtT[/Q/QRRRR %%gxtT[/Q/QRRRRS S  	K&))J "$....!gxtT['I'IJJJJJ	K 	Kr2   )r*   N)r
   r   r6   r   r7   r   r   N)__name__
__module____qualname____doc__intr1   r$   r5   rH   r   rM   rP   tuplerB   rC    r2   r&   r)   r)   >   s          $) )) :) ) ) );I ;S ;T ; ; ; ;** "* 	*
 
* * * *X   "  	 
 
       .   "  	 
 
       .BKS#XBK c3hBK 	BK
 BK BK 
BK BK BK BKH-KS#X-K c3h-K 	-K
 -K 
-K -K -K -K -K -Kr2   r)   )rn   r   r]   typingr   r   r   r   r   cyclopts.helpr   r   r$   r'   r)   rq   r2   r&   <module>rt      s    ; ; 				  % % % % % % % % 34444444422222222. .i .C . . . .bcK cK cK cK cK cK cK cK cK cKr2   