+
    f0i                        R t ^ RIHt ^ RIHtHt ^RIHt ^ RIt]'       d   ^ RI	H
t
 R R lt ! R R	]P                  4      t ! R
 R]4      t ! R R]4      t]P                   ! R4       ! R R]4      4       tR# )a5  

Post-processors run on the text of the entire document after is has been serialized into a string.
Postprocessors should be used to work with the text just before output. Usually, they are used add
back sections that were extracted in a preprocessor, fix up outgoing encodings, or wrap the whole
document.

)annotations)TYPE_CHECKINGAny)utilN)Markdownc               $    V ^8  d   QhRRRRRR/# )   mdr   kwargsr   returnzutil.Registry[Postprocessor] )formats   "]/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/markdown/postprocessors.py__annotate__r   '   s"      X  9U     c                    \         P                  ! 4       pVP                  \        V 4      R^4       VP                  \	        4       R^4       V# )z/Build the default postprocessors for Markdown. raw_htmlamp_substitute)r   RegistryregisterRawHtmlPostprocessorAndSubstitutePostprocessor)r	   r
   postprocessorss   &, r   build_postprocessorsr   '   sB    ]]_N04j"E68:JBOr   c                  &    ] tR t^/tRtR R ltRtR# )Postprocessora  
Postprocessors are run after the ElementTree it converted back into text.

Each Postprocessor implements a `run` method that takes a pointer to a
text string, modifies it as necessary and returns a text string.

Postprocessors must extend `Postprocessor`.

c                    V ^8  d   QhRRRR/# r   textstrr   r   )r   s   "r   r   Postprocessor.__annotate__:   s        r   c                    R# )z
Subclasses of `Postprocessor` should implement a `run` method, which
takes the html document as a single text string and returns a
(possibly modified) string.

Nr   selfr   s   &&r   runPostprocessor.run:   s     	r   r   N__name__
__module____qualname____firstlineno____doc__r$   __static_attributes__r   r   r   r   r   /   s     r   r   c                  b    ] tR t^DtRt]P                  ! R4      tR R ltR R lt	R R lt
R	tR
# )r   z"Restore raw html to the document. z^\<\/?([^ >]+)c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   !RawHtmlPostprocessor.__annotate__I   s        r   c                   a aa R VV V3R lloS P                   P                  P                  '       dF   \        P                  R,          p\
        P                  ! RV RV 24      oSP                  SV4      # V# )z*Iterate over html stash and restore html. c                    V ^8  d   QhRRRR/# r   mzre.Match[str]r   r   r   )r   s   "r   r   .RawHtmlPostprocessor.run.<locals>.__annotate__K   s     	C 	C 	C# 	Cr   c                  < V P                  ^4      ;p'       d   RpMV P                  ^4      pRp\        V4      ;pSP                  P                  P                  8  d   V P                  ^ 4      # SP                  SP                  P                  P                  V,          4      pV'       d   SP                  V4      '       d   SP                  SV4      # SP                  SRV R24      # )   TF<p>z</p>)	groupintr	   	htmlStashhtml_counterstash_to_stringrawHtmlBlocksisblocklevelsub)r3   keywrappedhtmlpatternr#   substitute_matchs   &   r   rD   2RawHtmlPostprocessor.run.<locals>.substitute_matchK   s    ggaj s ggaj3xDGG$5$5$B$BBwwqz!''(9(9(G(G(LMDd//55{{#3T::;;/3tfD1ABBr   z([0-9]+)r7   z</p>|)r	   r:   r;   r   HTML_PLACEHOLDERrecompiler?   )r#   r   base_placeholderrC   rD   s   f& @@r   r$   RawHtmlPostprocessor.runI   sn    	C 	C 77)))#44{Bjj3(8&:%AQ?S!TUG;;/66Kr   c                    V ^8  d   QhRRRR/# )r   rB   r   r   boolr   )r   s   "r   r   r/   _   s        r   c                    V P                   P                  V4      pV'       dJ   VP                  ^4      ^ ,          R9   d   R# V P                  P	                  VP                  ^4      4      # R# )z'Check is block of HTML is block-level. TF)!?@%)BLOCK_LEVEL_REGEXmatchr8   r	   is_block_level)r#   rB   r3   s   && r   r>   !RawHtmlPostprocessor.isblocklevel_   sS    ""((.wwqz!} 4477))!''!*55r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r/   i   s      C C r   c                    \        V4      # )z&Convert a stashed object to a string. )r   r"   s   &&r   r<   $RawHtmlPostprocessor.stash_to_stringi   s    4yr   r   N)r'   r(   r)   r*   r+   rG   rH   rR   r$   r>   r<   r,   r   r   r   r   r   D   s)    -

#45, r   r   c                  &    ] tR t^ntRtR R ltRtR# )r   zRestore valid entities c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   'AndSubstitutePostprocessor.__annotate__q   s        r   c                	F    VP                  \        P                  R 4      pV# )&)replacer   AMP_SUBSTITUTEr"   s   &&r   r$   AndSubstitutePostprocessor.runq   s    ||D//5r   r   Nr&   r   r   r   r   r   n   s    " r   r   zThis class is deprecated and will be removed in the future; use [`UnescapeTreeprocessor`][markdown.treeprocessors.UnescapeTreeprocessor] instead.c                      ] tR t^vtRt]P                  ! RP                  ]P                  ]P                  4      4      tR R ltR R ltRtR# )	UnescapePostprocessorzRestore escaped chars. z	{}(\d+){}c                    V ^8  d   QhRRRR/# r2   r   )r   s   "r   r   "UnescapePostprocessor.__annotate__   s     $ $- $C $r   c                	H    \        \        VP                  ^4      4      4      # )r6   )chrr9   r8   )r#   r3   s   &&r   unescapeUnescapePostprocessor.unescape   s    3qwwqz?##r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rd      s     0 0 0 0r   c                	N    V P                   P                  V P                  V4      # )N)REr?   rg   r"   s   &&r   r$   UnescapePostprocessor.run   s    ww{{4==$//r   r   N)r'   r(   r)   r*   r+   rG   rH   r   r   STXETXrk   rg   r$   r,   r   r   r   rb   rb   v   s9    
 #	L''$((;	<B$0 0r   rb   )r+   
__future__r   typingr   r    r   rG   markdownr   r   	Processorr   r   r   
deprecatedrb   r   r   r   <module>ru      sv   ( # %  	!DNN *'= 'T  \	0M 	0		0r   