+
    Q(i%                        R t ^ RIt^ RIHtHt ^ RIt^ RIHtHtH	t	 ^ RI
Ht ^ RIHt ]'       d   ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHtHt ]! ]4      t]! RR7       ! R R4      4       t]P@                  ! R]PB                  4      t"R R lt# ! R R]PH                  4      t% ! R R]]%,          4      t&R# )z7MkDocs plugin for automatic Cyclopts CLI documentation.N)TYPE_CHECKINGAny)definefield
validators)generate_markdown_docs)
import_app)MkDocsConfig)Files)Page)base)config_options)PluginError)
BasePluginget_plugin_loggerT)kw_onlyc                     a  ] tR t^t o Rt]! ]P                  ! ]4      R7      t	]! ^]P                  ! ]
4      R7      t]! ^]P                  ! ]
4      R7      t]! R]P                  ! ]P                  ! ]4      4      R7      t]! R]P                  ! ]P                  ! ]4      4      R7      t]! R]P                  ! ]4      R7      t]! R]P                  ! ]4      R7      t]! R]P                  ! ]4      R7      t]! R]P                  ! ]4      R7      t]! R]P                  ! ]4      R7      t]! R]P                  ! ]4      R7      t]RRRR/V 3R	 lR
 ll4       tV 3R ltRtV tR# )DirectiveOptionsz-Configuration for the ::: cyclopts directive.)	validator)defaultr   NTFdefault_heading_leveldefault_max_heading_levelc                L   < V ^8  d   QhRS[ RS[R,          RS[R,          RR/# )   directive_textr   Nr   returnr   )strint)format__classdict__s   "Y/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cyclopts/ext/mkdocs.py__annotate__DirectiveOptions.__annotate__,   sA     7M 7M7M  #Tz	7M
 $':7M 
7M    c                  VP                  4       P                  R4      pV'       d6   V^ ,          P                  4       P                  R4      '       d
   VR,          pRP                  V4      p\        P
                  ! V4      ;'       g    / p\        V\        4      '       g   \        R4      hRV9  d   \        R4      hVe   VP                  RV4       Ve   VP                  R	V4       VP                  4        UUu/ uF  w  rxVP                  R
R4      VbK  	  p	pp V ! R/ V	B # u uppi   \         d   p
\        RT
 24      T
hRp
?
ii ; i)a?  Parse options from a ::: cyclopts directive block.

Expected format:
    ::: cyclopts
        module: myapp.cli:app
        heading_level: 2
        max_heading_level: 6
        recursive: true
        commands:
          - cmd1
          - cmd2

Parameters
----------
directive_text : str
    The directive text to parse.
default_heading_level : int | None
    Default heading level from plugin config. Used if :heading-level: not specified.
default_max_heading_level : int | None
    Default max heading level from plugin config. Used if :max-heading-level: not specified.

::: cyclopts:   NNz=Invalid YAML in ::: cyclopts directive: expected a dictionarymodulez:The "module" option is required for ::: cyclopts directiveNheading_levelmax_heading_level-_z!Error creating DirectiveOptions:  )stripsplit
startswithjoinyaml	safe_load
isinstancedict	TypeError
ValueError
setdefaultitemsreplace)clsr   r   r   linesyaml_contentoptionskeyvaluenormalized_optionses   &&$$       r    from_directive_block%DirectiveOptions.from_directive_block+   s;   : $$&,,T2 U1X^^%00@@"IEyy'...44"'4(([\\7"YZZ ,0EF$024MN NU]]_]_zsckk#s3U:_]	M,+,, ^  	M@DE1L	Ms    D*"D0 0E;E

Ec                   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[S[ ,          R,          ;R&   S[S[ ,          R,          ;R&   S[;R&   S[;R&   S[;R	&   S[;R
&   S[;R&   S[;R&   # )r   r(   r)   r*   Ncommandsexclude_commands	recursiveinclude_hiddenflatten_commandsgenerate_toccode_block_titleskip_preamble)r   r   listbool)r   r   s   "r    r!   r"      s      >	 
 P  T  3i$q  3i$&   Q  W  Y  T  Y   V! r#   r-   )__name__
__module____qualname____firstlineno____doc__r   r   instance_ofr   r(   r   r)   r*   optionalrN   rF   rG   rO   rH   rI   rJ   rK   rL   rM   classmethodrC   __annotate_func____static_attributes____classdictcell__r   s   @r    r   r      s_    7*"8"8"=>FqJ4J4J34OPM"1
8N8Ns8ST!&tz?R?RS]SiSijnSo?p!qH).
 3 3J4J4J44P Q* DJ4J4J44PQI *:P:PQU:VWN"5J<R<RSW<XYtz7M7Md7STL"5J<R<RSW<XY9O9OPT9UVM7M -1	7M
 157M 7M 7M'  r#   r   z^::: cyclopts\n(?:[ \t]+.*\n?)*c                <    V ^8  d   QhR\         R\        R\         /# )r   markdownplugin_configr   )r   r   )r   s   "r    r!   r!   p   s&     j j# jc jc jr#   c                6  aaa . o\         P                  ! R\         P                  \         P                  ,          4      pVP	                  V 4       F2  pSP                  VP                  4       VP                  4       34       K4  	  V P                  R4      pRp^ p^ p\        V4       EF)  w  r\        V	4      ^,           p
V'       g   V^ 8H  ;'       g#    WH^,
          ,          P                  4       '       * pV	P                  R4      ;'       g    V	P                  R4      ;'       d    V	P                  4       pV'       d   V'       d   RpTpM{V	P                  R4      ;'       g    V	P                  R4      ;'       d    V	P                  4       pV	P                  4       '       * pV'       g   V'       g   SP                  Wg34       RpWz,          pEK,  	  V'       d   SP                  Wg34       R V3R lloR	 VV3R
 llp\        P                  W4      pV# )a  Process all ::: cyclopts directives in markdown content.

Parameters
----------
markdown : str
    The markdown content containing ::: cyclopts directives.
plugin_config : CycloptsPluginConfig
    The plugin configuration with default values. If None, uses DirectiveOptions defaults.

Returns
-------
str
    The markdown content with directives replaced by generated documentation.
z^[`~]{3,}.*?^[`~]{3,}r%   Fz    	Tc                0    V ^8  d   QhR\         R\        /# )r   posr   )r   rO   )r   s   "r    r!   1process_cyclopts_directives.<locals>.__annotate__   s      c d r#   c                H   < S F  w  rYu;8:  d   V8  g   K    R#  K  	  R# )z+Check if a position is inside a code block.TFr-   )rb   startendcode_blockss   &  r    is_in_code_block5process_cyclopts_directives.<locals>.is_in_code_block   s'    %JE!c! " & r#   c                D    V ^8  d   QhR\         P                  R\        /# )r   matchr   )reMatchr   )r   s   "r    r!   rc      s"     $V $V $Vc $Vr#   c                 r  < S! V P                  4       4      '       d   V P                  ^ 4      # V P                  ^ 4      p S	'       d   S	P                  MRpS	'       d   S	P                  MRp\        P                  VVVR7      p\        VP                  4      p\        VVP                  VP                  VP                  VP                  VP                  VP                  VP                  VP                   RVP"                  VP$                  R7      pV#   \&         d   p\)        RT 24      ThRp?ii ; i)    N)r   r   T)rH   rI   r)   r*   rK   rJ   commands_filterrG   no_root_titlerL   rM   z)Error processing ::: cyclopts directive: )re   groupr   r   r   rC   r   r(   r   rH   rI   r)   r*   rK   rJ   rF   rG   rL   rM   	Exceptionr   )
rk   r   default_headingdefault_max_headingr>   appmarkdown_docsrB   rh   r^   s
   &       r    replace_directive6process_cyclopts_directives.<locals>.replace_directive   s   EKKM**;;q>!Q	VERmAAX\OMZ-"I"I`d&;;&5*= < G W^^,C2!++&55%33")";";$11!(!9!9 ' 0 0!(!9!9"!(!9!9%33M !  	V I!MNTUU	Vs%   D 	D B7D D6"D11D6)rl   compile	MULTILINEDOTALLfinditerappendre   rf   r/   	enumeratelenr.   r0   DIRECTIVE_PATTERNsub)r]   r^   fenced_patternrk   r<   in_indented_blockblock_startcurrent_posilineline_len
prev_blankis_indentedis_blankrx   	processedrg   rh   s   &f              @@r    process_cyclopts_directivesr   p   s     K ZZ 8",,:RSN((2EKKM599;78 3
 NN4 EKKU#t9q= !a;;uU|'9'9';#;J??62KKdood6K]]QUQ[Q[Q]Kk$(!)  ??62KKdood6K]]QUQ[Q[Q]K::<'H x""K#=>$)!/ $4 K56 $V $VN "%%&7BIr#   c                   j    ] tR t^tRt]P                  ! ]^R7      t]P                  ! ]^R7      t	Rt
R# )CycloptsPluginConfigz4Configuration schema for the Cyclopts MkDocs plugin.)r   r-   N)rP   rQ   rR   rS   rT   cTyper   r   r   rY   r-   r#   r    r   r      s'    >FF32 !sA 6r#   r   c                   6   a  ] tR t^t o RtV 3R lR ltRtV tR# )CycloptsPluginaK  MkDocs plugin to generate Cyclopts CLI documentation.

Usage in mkdocs.yml:
    plugins:
      - cyclopts:
          default_heading_level: 2

Usage in Markdown files:
    ::: cyclopts
        :module: myapp.cli:app
        :heading-level: 2
        :recursive: true
        :commands: init, build
        :exclude-commands: debug
c          
      2   < V ^8  d   QhRS[ RRRRRRRS[ /# )	r   r]   pager   configr	   filesr
   r   )r   )r   r   s   "r    r!   CycloptsPlugin.__annotate__   s9     	B 	B 	Bv 	B~ 	B^e 	Btw 	Br#   c               >    RV9  d   V# \        WP                  4      # )zProcess ::: cyclopts directives in markdown content.

This event is called after the page's markdown is loaded from file
but before it's converted to HTML.
r&   )r   r   )selfr]   r   r   r   kwargss   &&$$$,r    on_page_markdownCycloptsPlugin.on_page_markdown   s      )O*8[[AAr#   r-   N)rP   rQ   rR   rS   rT   r   rY   rZ   r[   s   @r    r   r      s      	B 	Br#   r   )'rT   rl   typingr   r   r2   attrsr   r   r   cyclopts.docs.markdownr   cyclopts.utilsr   mkdocs.config.defaultsr	   mkdocs.structure.filesr
   mkdocs.structure.pagesr   mkdocs.configr   r   r   mkdocs.exceptionsr   mkdocs.pluginsr   r   rP   loggerr   rz   r{   r   r   Configr   r   r-   r#   r    <module>r      s    = 	 %  + + 9 %3,+  - ) 8	8	$ IM IM IM` JJ&LL jZ74;; 7BZ 45 Br#   