+
    Q(i@                         R t ^ RIHt ^ RIHt ^ RIHtHtHtH	t	H
t
HtHtHtHtHt ]'       d   ^ RIHt R R ltR R ltRR	 R
 lltR R ltR R ltRR R lltR# )z9RST documentation generation functions for cyclopts apps.)TYPE_CHECKING)extract_text)
adjust_filters_for_subcommandextract_descriptionextract_usagegenerate_anchorget_app_infois_all_builtin_flagsiterate_commandsnormalize_command_filtersshould_include_commandshould_show_usage)Appc                F    V ^8  d   QhR\         R\        \         ,          /# )   titlereturn)strlist)formats   "W/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cyclopts/docs/rst.py__annotate__r      s      S T#Y     c                    RRRV  2.# )zCreate an RST code block containing the title.

Parameters
----------
title : str
    Title text to display in code block.

Returns
-------
list[str]
    RST formatted code block lines.
z.. code-block:: text z    r   s   &r   make_rst_code_block_titler      s     	

eW r   c                R    V ^8  d   QhR\         R\        R\        \         ,          /# )r   r   levelr   )r   intr   )r   s   "r   r   r   +   s%     #" #"3 #"s #"tCy #"r   c                    ^R^R^R^R^R^R/pV^8  d   ^pM	V^8  d   ^pW!,          pV\        V 4      ,          pV^8X  d   W@V.# W.# )zCreate an RST section header.

Parameters
----------
title : str
    Section title.
level : int
    Heading level (1-6).

Returns
-------
list[str]
    RST formatted section header lines.
=-^"'~)len)r   r   markersmarker	underlines   &&   r   make_rst_section_headerr,   +   ss      	
3	3	3	3	3	3G qy	^FU#Iz),,!!r   c                N    V ^8  d   QhRRR\         R\        \        R3,          /# )r   appr   include_hiddenr   )booldictr   )r   s   "r   r   r   Q   s*      E 4 4U
CS r   c                ^    / pV P                   '       d   \        W4       F	  w  r4WBV&   K  	  V# )a  Build mapping of command names to App objects.

Parameters
----------
app : App
    The app to extract commands from.
include_hidden : bool
    Whether to include hidden commands.

Returns
-------
dict[str, App]
    Mapping of command names to App instances.
)	_commandsr
   )r.   r/   command_mapnamesubapps   &&   r   _build_command_mapr7   Q   s2     K
}}},SALD & Br   c                    V ^8  d   QhR\         R\        \        R3,          R\         \        ,          R\        \        ,          R,          R\        \        ,          R,          R\         /# )	r   entriesr4   r   parent_pathnormalized_filterNnormalized_excluder   )r   r1   r   set)r   s   "r   r   r   g   sa     ( ((c5j!( c( 3x$	(
 C4( 
(r   c                   . pV  F  pVP                   '       g   K  VP                   ^ ,          pVP                  V4      pVf    Vf   Vf   VP                  V4       KZ  K\  K^  \        WrW4V4      '       g   Ks  VP                  V4       K  	  V# )a  Filter command entries based on inclusion/exclusion rules.

Parameters
----------
entries : list
    Command entries to filter.
command_map : dict[str, App]
    Mapping of command names to App objects.
parent_path : list[str]
    Parent command path.
normalized_filter : set[str] | None
    Normalized filter set.
normalized_exclude : set[str] | None
    Normalized exclude set.

Returns
-------
list
    Filtered command entries.
)namesgetappendr   )	r9   r4   r:   r;   r<   filtered_entriesentrycmd_namer6   s	   &&&&&    r   _filter_command_entriesrE   g   s    6 ;;;{{1~H __X.F~$,1C1K$++E2 2L, *(ARhnoo$++E2  r   c                >    V ^8  d   QhR\         \        ,          RR/# )r   linesr   N)r   r   )r   s   "r   r   r      s     	 	c 	t 	r   c                    V P                  R4       V P                  R4       V P                  R4       V P                  R4       R# )zGenerate table of contents using RST contents directive.

The `.. contents::` directive automatically generates a TOC from
section headings, which is the idiomatic approach for RST/Sphinx.
z.. contents:: Table of Contentsz
   :local:z   :depth: 6r   N)rA   )rG   s   &r   _generate_tocrI      s5     
LL23	LL	LL 	LLr   Nc                $   V ^8  d   QhRRR\         R\         R\        R\        R\        \        ,          R,          R	\         R
\         R\        \        ,          R,          R\        \        ,          R,          R\         R\         R\         R\        /# )r   r.   r   	recursiver/   heading_levelmax_heading_levelcommand_chainNgenerate_tocflatten_commandscommands_filterexclude_commandsno_root_titlecode_block_titleskip_preambler   )r0   r    r   r   )r   s   "r   r   r      s     y y	yy y 	y
 y 9t#y y y #Y%y 3i$&y y y y 	yr   c                   ^ RI Hp . pVf   . p\        W4      w  pppV'       d   V'       g   VR,          pMV'       d   TpMTpR.pV'       d   VP                  V4       MVP	                  V4       \        RP                  V4      4      P                  RR4      pVP	                  RV R24       VP	                  R	4       V
'       d   V'       g   TpM6V'       d   V'       d   TpM#V'       d   V\        V4      ,           ^,
          MTp\        VV4      pV
'       d	   V'       dC   V'       d   \        V4      pM\        VV4      pVP                  V4       VP	                  R	4       V P                  P                  R
RR7      pV'       Eg   \        V 4      '       Ed   V
'       d	   V'       d   \        V 4      pRpV'       d   \!        V\"        4      '       d   TpM\%        VRRR7      pV'       dR   VP'                  R^4      p\        V4      ^8  d   RP                  V4       RV^,           2pMRP                  V4      pV'       d`   VP	                  R4       VP	                  R	4       VP'                  R4       F  pVP	                  RV 24       K  	  VP	                  R	4       V'       g`   \)        V V4      pV'       dL   VR 9   p\%        VRVR7      pV'       d1   VP	                  VP+                  4       4       VP	                  R	4       V'       d&   V'       g   V P,                  '       d   \/        V4       V P                  V .4      ;_uu_ 4        V P1                  . V4      pRRR4       \3        W4      w  p p!. p"\5        V RR7      p#V! V^,           VR7      p$X EFW  w  p%p&V'       g   V%'       d   V%P6                  '       g   K+  V
'       d   V'       g   K=  V&P8                  R8X  Ed<   V&P:                   U'u. uF5  p'V'P<                  '       d   \?        V V'P<                  4      '       d   K3  V'NK7  	  p(p'V('       g   K  \A        V(V#V"V V!4      p)V)'       g   K  V&PB                  '       d1   VP	                  RV&PB                   R24       VP	                  R	4       V) F  p*V*P<                  '       d   V*P<                  ^ ,          MR	p+\%        V*PD                  R4      p,VP	                  RV+ R24       V,'       d   VP	                  RV, 24       VP	                  R	4       K  	  EK  V&P8                  R8X  g   EK  V$PG                  4        V&PI                  R	R7      p-V$! RRV-4       V$PK                  4       P+                  4       p.V.'       g   EK  V&PB                  '       d1   VP	                  RV&PB                   R24       VP	                  R	4       VP	                  V.4       VP	                  R	4       EKZ  	  V'       Ed   V P,                  '       Ed   \3        W4      w  p p!. p"\M        W4       EFt  w  p/p0\O        V/V"V V!V04      '       g   K  VP	                  R	4       V'       d   VV/.,           MVV/.p1V'       d   Tp2MV
'       d   V'       g   V^,
          p2MTp2\Q        V/V V!4      w  p3p4V'       * ;'       d9    T;'       d/    VRJ;'       d#    \        V4      ^8H  ;'       d    V/V^ ,          8H  p5V'       * ;'       dL    T;'       dB    VRJ;'       d6    \        V4      ^8H  ;'       d     V^ ,          PS                  V/R,           4      p6V0P                  V V0.4      ;_uu_ 4        \U        T0TTT2TT1RTT3T4T6TT5;'       g    T6R7      p7RRR4       VP	                  X74       EKw  	  ^ RI+p8RP                  V4      p9V8PY                  RRV94      p9V9#   + '       g   i     ELw; iu up'i   + '       g   i     Li; i)!a1  Generate reStructuredText documentation for a CLI application.

Parameters
----------
app : App
    The cyclopts App instance to document.
recursive : bool
    If True, generate documentation for all subcommands recursively.
    Default is True.
include_hidden : bool
    If True, include hidden commands/parameters in documentation.
    Default is False.
heading_level : int
    Starting heading level for the main application title.
    Default is 1 (uses '=' markers).
max_heading_level : int
    Maximum heading level to use. Headings deeper than this will be capped
    at this level. RST uses different underline characters for each level.
    Default is 6.
command_chain : list[str]
    Internal parameter to track command hierarchy.
    Default is None.
generate_toc : bool
    If True, generate a table of contents for multi-command apps.
    Default is True.
flatten_commands : bool
    If True, generate all commands at the same heading level instead of nested.
    Default is False.
commands_filter : list[str], optional
    If specified, only include commands in this list.
    Supports nested command paths like "db.migrate".
    Default is None (include all commands).
exclude_commands : list[str], optional
    If specified, exclude commands in this list.
    Supports nested command paths like "db.migrate".
    Default is None (no exclusions).
no_root_title : bool
    If True, skip generating the root application title.
    Useful when embedding in existing documentation with its own title.
    Default is False.
skip_preamble : bool
    If True, skip the description and usage sections for the target command
    when filtering to a single command via ``commands_filter``.
    Useful when the user provides their own section introduction.
    Default is False.

Returns
-------
str
    The generated RST documentation.
)RstFormatterNcyclopts /r#   z.. _:r   help_formatrestructuredtext)fallbackF)preserve_markupz::
z    T)r/   )rL   r/   commandz**z:**z``	parameterr   .)rK   r/   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   z\n{3,}z

)r]   rst)-cyclopts.help.formatters.rstrW   r   extendrA   r   joinreplacer(   minr   r,   	app_stackresolver   r   
isinstancer   r   splitr   stripr3   rI   _assemble_help_panelsr   r7   showr   r9   r?   r	   rE   r   descriptionresetcopy
get_outputr
   r   r   
startswithgenerate_rst_docsresub):r.   rK   r/   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rW   rG   app_namefull_command
base_titler   anchor_partsanchor_nameeffective_heading_levelheader_linesr\   usage
usage_textpartslinerr   preserve	desc_texthelp_panels_with_groupsnormalized_commands_filternormalized_exclude_commandsr:   r4   	formattergrouppanelecommand_entriesrB   rC   primary_namedesc
panel_copyoutputr5   r6   subcommand_chainnext_heading_levelsub_commands_filtersub_exclude_commandsis_single_targetis_intermediate_pathsubdocsrx   docs:   &&&&&&&&&&&&&                                             r   rw   rw      s   D :E)5c)I&HlJ
 -b!	  <LM*H%!#((<"89AA#sKK	LL4}A&'	LL ]"/	m"/ MZ-#m2D"Dq"H_l ""9;LM-4U;L25:QRL\"R--''@R'SK =.s33m!#&EJeS))!&J!-eT5!QJ !&,,T15E5zA~(+(?'@%(%L
%(XXm%<
T"R &,,T2DLL4v/ 3R  )#{; #&AAH$[$QIY__./R  Mcmmme 
u		"%";";B"L 
 ?X?; ;  K %S>K =1+<^\I 0u%


  <<9$*/--p-QL`adfgfmfmLnqq-Op"  7k;UWr  $ {{{r%++c23R  *16u{{1~"#E$5$5t<r,r23LL4v/R  * \\[(OO"-JdD*-))+113F v;;;LL2ekk]#!67LL$V$R k 0n yS]]]B[C
?"$? ,SALD&)k#=?Z\b  LL9F}v5XW[L\%2"}%2Q%6"%2"8U02M95!5 "! / /!/ /#4// / (A-/ / OA..  "! > >!> >#4/> > (A-> > $A&11$*= ! !!3-00+'#1"4&7"2!&%5$7%9"6%5"2"J"J6J 1  LL!o Bt 
))E
C
&&FC
(CJY 
		8 qp 10s*   __1_19_12#_6_.	6`)T)TF      NTFNNFFF)__doc__typingr   cyclopts._markupr   cyclopts.docs.baser   r   r   r   r   r	   r
   r   r   r   cyclopts.corer   r   r,   r7   rE   rI   rw   r   r   r   <module>r      sL    ?   )   !(#"L,(V	y yr   