
    <i*                        d Z d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
mZmZ  G d d	e          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Z G d" d#e          Zd$S )%zb
Directives for additional body elements.

See `docutils.parsers.rst.directives` for API details.
reStructuredText    )nodes)	Directive)
directives)normalize_options)Lexer
LexerErrorNumberLinesc                       e Zd ZdZdZej        ej        dZdZ	dZ
	 ej        ej        ej        ej        ej        ej        fZ	 d ZdS )BasePseudoSectionz!Base class for Topic and Sidebar.TclassnameNc                    t          | j        j        | j                  r|                     d| j        z            |                                  | j        r| j        d         }| j        	                    || j
                  \  }}t          j        |dg|R  g}d| j        v rt| j        	                    | j        d         | j
                  \  }}|                    t          j        | j        d         dg|R             |                    |           ng }g }d                    | j                  } | j        |g||z   R  }|dxx         | j                            dg           z  cc<   | j                            | j
                  \  |_        |_        |                     |           |r&| j                            | j        | j        |           |gS )NzBThe "%s" directive may not be used within topics or body elements.r    subtitle
classesr   )
isinstancestate_machinenodeinvalid_parentserrorr   assert_has_content	argumentsstateinline_textlinenor   titleoptionsappendr   extendjoincontent
node_classgetget_source_and_linesourcelineadd_namenested_parsecontent_offset)self
title_text	textnodesmessagestitlesmore_messagestextr   s           /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/docutils/parsers/rst/directives/body.pyrunzBasePseudoSection.run*   s   d(-t/CDD 	E** 8:>)D E E E!!!> 	*J"&*"8"8&0$+#? #?Ixk*b=9===>FT\))+/:+A+AL,dk,; ,;(	=enT\*-Er 9.79 9 9 : : :...FHyy&&tt:v'8:::Y4<++GR888(<<T[II		d 	MJ##DL$2EtLLLv    )__name__
__module____qualname____doc__final_argument_whitespacer   class_option	unchangedoption_spechas_contentr%   r   SubStructuralBibliographic
DecorativeBodyParttopicr   r5    r6   r4   r   r      s~        ++ $&3%/1 1KKJ<*E,?'UZNO    r6   r   c                        e Zd ZdZej        ZdS )Topic   N)r7   r8   r9   required_argumentsr   rE   r%   rF   r6   r4   rH   rH   I   s        JJJr6   rH   c                   H    e Zd ZdZej        Zej        de	j
        iz  Zd ZdS )SidebarrI   r   c                    t          | j        j        t          j                  r|                     d| j        z            d| j        v r| j        s|                     d          t          
                    |           S )Nz<The "%s" directive may not be used within a sidebar element.r   z6The "subtitle" option may not be used without a title.)r   r   r   r   sidebarr   r   r    r   r   r5   )r-   s    r4   r5   zSidebar.runV   s    d(-u}== 	=** 026)< = = =%%dn%** 0 1 1 1 !$$T***r6   N)r7   r8   r9   optional_argumentsr   rN   r%   r   r>   r   unchanged_requiredr5   rF   r6   r4   rL   rL   O   sL        J#/ *"?3A AK+ + + + +r6   rL   c                   :    e Zd ZdZej        ej        dZdZd Z	dS )	LineBlockzLegacy directive for line blocks.

    Use is deprecated in favour of the line block syntax,
    cf. `parsers.rst.states.Body.line_block()`.
    r   Tc                 8   |                                   t          j        | j                            dg                     }| j                            | j                  \  |_        |_	        | 
                    |           |g}t          | j                  D ]\  }}| j                            |                                | j        | j        z             \  }}t          j	        |dg|R  }|j        |_        |j	        |z   |_	        |                                r6t#          |          t#          |                                          z
  |_        ||z  }|                    |           | xj        dz  c_        | j                            |           |S )Nr   r   r   rI   )r   r   
line_blockr    r&   r   r'   r   r(   r)   r*   	enumerater$   r   r   stripr,   lenlstripindentr"   nest_line_block_lines)r-   block	node_listi	line_text
text_nodesr0   r)   s           r4   r5   zLineBlock.runl   s   !!! )9)9'2)F)FGGG)==dkJJ		eG	%dl33 
	% 
	%LAy#':#9#9!!4;1D#D$F $F J:i9j999D,DK
QDI   G!)nns93C3C3E3E/F/FFTMEX&&&1$
((///r6   N)
r7   r8   r9   r:   r   r<   r=   r>   r?   r5   rF   r6   r4   rR   rR   a   sL          '3%/1 1KK    r6   rR   c                   6    e Zd Zej        ej        dZdZd ZdS )ParsedLiteralr   Tc                 L   t          | j                  }|                                  d                    | j                  }| j                            || j                  \  }}t          j	        |dg|R i |}| j
        dz   |_        |                     |           |g|z   S )Nr   r   rI   )r   r    r   r#   r$   r   r   r   r   literal_blockr,   r)   r*   )r-   r    r3   r`   r0   r   s         r4   r5   zParsedLiteral.run   s    #DL11!!!yy&&#z55dDKHH
H"4DjDDDGDD'!+	dv  r6   N	r7   r8   r9   r   r<   r=   r>   r?   r5   rF   r6   r4   rb   rb      s@        &3%/1 1KK! ! ! ! !r6   rb   c                   J    e Zd ZdZdZej        ej        ej        dZdZ	d Z
dS )	CodeBlockzParse and mark up content of a code block.

    Configuration setting: syntax_highlight
       Highlight Code content with Pygments?
       Possible values: ('long', 'short', 'none')

    rI   )r   r   number-linesTc                 L   |                                   | j        r| j        d         }nd}t          | j                  }dg}|r|                    |           d|v r|                    |d                    	 t          d                    | j                  || j	        j
        j        j                  }np# t          $ rc}| j	        j
        j        j        dk    r*t          d                    | j                  |d          }n|                     |          Y d }~nd }~ww xY wd|v rd	 t!          |d         pd	          }n## t"          $ r |                     d
          w xY w|t'          | j                  z   }t)          |||          }t+          j        d                    | j                  |          }|                     |           d|v r|d         |j        d<   |D ]9\  }}	|r|t+          j        |	|	|          z  }"|t+          j        |	          z  }:|gS )Nr   r   coder   r      nonerh   rI   z+:number-lines: with non-integer start valuerT   r(   )r   r   r   r    r!   r"   r   r#   r$   r   documentsettingssyntax_highlightr	   report_levelwarningint
ValueErrorr   rX   r
   r   rd   r*   
attributesinlineText)
r-   languager    r   tokensr   	startlineendliner   values
             r4   r5   zCodeBlock.run   s[   !!!> 	~a(HHH#DL11( 	%NN8$$$NN79-...	*499T\22H:.7HJ JFF 	* 	* 	*z"+81<<tyy66&IIll5))) 	* W$$P 7 <1==		 P P Pjj!NOOOP#dl"3"33G G<<F"499T\#:#:GLLLdw(/(9DOH%$ 	* 	*NGU *UE7CCCC 
5)))vs%   :=B8 8
D%AD  D%-E  E%N)r7   r8   r9   r:   rO   r   r<   r=   r>   r?   r5   rF   r6   r4   rg   rg      sZ          &3%/#-#7 K K/ / / / /r6   rg   c                   6    e Zd Zej        ej        dZdZd ZdS )	MathBlockr   Tc                    t          | j                  }|                                  d                    | j                                      d          }g }|D ]s}|st          j        | j        |fi |}| j	        
                    | j                  \  |_        |_        |                     |           |                    |           t|S )Nr   z

)r   r    r   r#   r$   splitr   
math_block
block_textr   r'   r   r(   r)   r*   r!   )r-   r    r$   _nodesr\   r   s         r4   r5   zMathBlock.run   s    #DL11!!!))DL))//77 	  	 E #DOUFFgFFD,@@MMT[YMM$MM$r6   Nre   rF   r6   r4   r}   r}      sB        &3%/ K
 K    r6   r}   c                   >    e Zd ZdZdZdZej        ej        dZ	d Z
dS )RubricrI   r   Tr   c                     t          | j                  }| j        d         }| j                            || j                  \  }}t          j        |dg|R i |}|                     |           |g|z   S )Nr   r   )	r   r    r   r   r   r   r   rubricr*   )r-   r    rubric_textr/   r0   r   s         r4   r5   z
Rubric.run   s{    #DL11nQ'"j44[$+NN	8k2E	EEEWEEfx(""r6   N)r7   r8   r9   rJ   rO   r;   r   r<   r=   r>   r5   rF   r6   r4   r   r      sM         $&3%/1 1K# # # # #r6   r   c                       e Zd ZdZg Zd ZdS )
BlockQuoteTc                     |                                   | j                            | j        | j                  }|D ]1}t          |t          j                  r|dxx         | j        z  cc<   2|S )Nr   )r   r   block_quoter$   r,   r   r   r   )r-   elementselements      r4   r5   zBlockQuote.run  sx    !!!:))$,8KLL 	3 	3G'5#455 3	"""dl2"""r6   N)r7   r8   r9   r?   r   r5   rF   r6   r4   r   r      s-        KG    r6   r   c                       e Zd ZdgZdS )EpigraphepigraphNr7   r8   r9   r   rF   r6   r4   r   r     s        lGGGr6   r   c                       e Zd ZdgZdS )
Highlights
highlightsNr   rF   r6   r4   r   r             nGGGr6   r   c                       e Zd ZdgZdS )	PullQuotez
pull-quoteNr   rF   r6   r4   r   r     r   r6   r   c                   6    e Zd Zej        ej        dZdZd ZdS )Compoundr   Tc                    |                                   d                    | j                  }t          j        |          }|dxx         | j                            dg           z  cc<   | j                            | j	                  \  |_
        |_        |                     |           | j                            | j        | j        |           |gS )Nr   r   r   )r   r#   r$   r   compoundr    r&   r   r'   r   r(   r)   r*   r   r+   r,   )r-   r3   r   s      r4   r5   zCompound.run"  s    !!!yy&&~d##Y4<++GR888(<<T[II		d
d.A4HHHvr6   Nre   rF   r6   r4   r   r     s@        &3%/1 1KK	 	 	 	 	r6   r   c                   2    e Zd ZdZdZdej        iZdZd Z	dS )	ContainerrI   Tr   c                 Z   |                                   d                    | j                  }	 | j        r t	          j        | j        d                   }ng }n:# t          $ r- |                     d| j        d| j        d         d          w xY wt          j
        |          }|d                             |           | j                            | j                  \  |_        |_        |                     |           | j                            | j        | j        |           |gS )Nr   r   z#Invalid class attribute value for "z" directive: "z".r   )r   r#   r$   r   r   r<   rs   r   r   r   	containerr"   r   r'   r   r(   r)   r*   r   r+   r,   )r-   r3   r   r   s       r4   r5   zContainer.run5  s*   !!!yy&&	2~ $1$.2CDD 	2 	2 	2***999dnQ///12 2 2	2 t$$Yw'''(<<T[II		d
d.A4HHHvs   )A 7BN)
r7   r8   r9   rO   r;   r   r=   r>   r?   r5   rF   r6   r4   r   r   .  sA         $:/0KK    r6   r   N)r:   __docformat__docutilsr   docutils.parsers.rstr   r   docutils.parsers.rst.rolesr   docutils.utils.code_analyzerr   r	   r
   r   rH   rL   rR   rb   rg   r}   r   r   r   r   r   r   r   rF   r6   r4   <module>r      s  
  #       * * * * * * + + + + + + 8 8 8 8 8 8 G G G G G G G G G G1 1 1 1 1	 1 1 1h       + + + + + + + +$    	   B! ! ! ! !I ! ! !"> > > > >	 > > >B    	   4# # # # #Y # # #"           z   
       
    
   
    y   $    	     r6   