
    ;3h                        d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ erdd
lmZ  e        G d de             Zy)zgr.Markdown() component.    )annotationsN)CallableSequence)TYPE_CHECKINGAny)document)	Component)Events)I18nData)Timerc                      e Zd ZdZej
                  ej                  gZ	 ddddddddddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZddZ	dd	Z
dd
ZddZddZ xZS )Markdowna  
    Used to render arbitrary Markdown output. Can also render latex enclosed by dollar signs. As this component does not accept user input,
    it is rarely used as an input component.

    Demos: blocks_hello, blocks_kinematics
    Guides: key-features
    NFTvalue)labeleveryinputs
show_labelrtllatex_delimitersvisibleelem_idelem_classesrenderkeypreserved_by_keysanitize_htmlline_breaksheader_linksheight
max_height
min_heightshow_copy_button	containerpaddingc                   || _         |ddddg}|| _        || _        || _        || _        || _        || _        || _        || _        || _	        t        | -  ||||||	|
|||||       y)a  
        Parameters:
            value: Value to show in Markdown component. If a function is provided, the function will be called each time the app loads to set the initial value of this component.
            label: This parameter has no effect
            every: Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
            inputs: Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.
            show_label: This parameter has no effect.
            rtl: If True, sets the direction of the rendered text to right-to-left. Default is False, which renders text left-to-right.
            latex_delimiters: A list of dicts of the form {"left": open delimiter (str), "right": close delimiter (str), "display": whether to display in newline (bool)} that will be used to render LaTeX expressions. If not provided, `latex_delimiters` is set to `[{ "left": "$$", "right": "$$", "display": True }]`, so only expressions enclosed in $$ delimiters will be rendered as LaTeX, and in a new line. Pass in an empty list to disable LaTeX rendering. For more information, see the [KaTeX documentation](https://katex.org/docs/autorender.html).
            visible: If False, component will be hidden.
            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
            elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
            render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
            key: in a gr.render, Components with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render.
            preserved_by_key: A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor.
            sanitize_html: If False, will disable HTML sanitization when converted from markdown. This is not recommended, as it can lead to security vulnerabilities.
            line_breaks: If True, will enable Github-flavored Markdown line breaks in chatbot messages. If False (default), single new lines will be ignored.
            header_links: If True, will automatically create anchors for headings, displaying a link icon on hover.
            height: The height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. If markdown content exceeds the height, the component will scroll.
            max_height: The maximum height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. If markdown content exceeds the height, the component will scroll. If markdown content is shorter than the height, the component will shrink to fit the content. Will not have any effect if `height` is set and is smaller than `max_height`.
            min_height: The minimum height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. If markdown content exceeds the height, the component will expand to fit the content. Will not have any effect if `height` is set and is larger than `min_height`.
            show_copy_button: If True, includes a copy button to copy the text in the Markdown component. Default is False.
            container: If True, the Markdown component will be displayed in a container. Default is False.
            padding: If True, the Markdown component will have a certain padding (set by the `--block-padding` CSS variable) in all directions. Default is False.
        Nz$$T)leftrightdisplay)r   r   r   r   r   r   r   r   r   r   r   r#   )r   r   r   r   r   r   r    r!   r"   r$   super__init__)selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   	__class__s                          Z/var/www/html/audio-gradio/venv/lib/python3.12/site-packages/gradio/components/markdown.pyr*   zMarkdown.__init__"   s    f #)- NO 0*&($$ 0!%- 	 	
    c                    |S )z
        Parameters:
            payload: the `str` of Markdown corresponding to the displayed value.
        Returns:
            Passes the `str` of Markdown corresponding to the displayed value.
         )r+   payloads     r-   
preprocesszMarkdown.preprocessq   s	     r.   c                l    |yt        |t              rt        |      S t        j                  |      }|S )a8  
        Parameters:
            value: Expects a valid `str` that can be rendered as Markdown.
        Returns:
            The same `str` as the input, but with leading and trailing whitespace removed.
            If an I18nData object is provided, returns it serialized for the frontend to translate.
        N)
isinstancer   strinspectcleandoc)r+   r   unindented_ys      r-   postprocesszMarkdown.postprocessz   s6     =eX&u:''.r.   c                     yNz# Hello!r0   r+   s    r-   example_payloadzMarkdown.example_payload       r.   c                     yr;   r0   r<   s    r-   example_valuezMarkdown.example_value   r>   r.   c                
    ddiS )Ntypestringr0   r<   s    r-   api_infozMarkdown.api_info   s    !!r.   )N),r   z str | I18nData | Callable | Noner   str | I18nData | Noner   zTimer | float | Noner   z7Component | Sequence[Component] | set[Component] | Noner   zbool | Noner   boolr   z"list[dict[str, str | bool]] | Noner   rF   r   
str | Noner   list[str] | str | Noner   rF   r   z(int | str | tuple[int | str, ...] | Noner   rH   r   rF   r   rF   r   rF   r   int | str | Noner    rI   r!   rI   r"   rF   r#   rF   r$   rF   )r1   rG   returnrG   )r   rE   rJ   zstr | dict | None)rJ   r   )rJ   zdict[str, Any])__name__
__module____qualname____doc__r
   changecopyEVENTSr*   r2   r9   r=   r@   rD   __classcell__)r,   s   @r-   r   r      s|    	F 37M
 (,&*JN"&?C"/38<3:"!"#''+'+!&1M
/M
 %	M

 $M
 HM
  M
 M
 =M
 M
 M
 -M
 M
 6M
 1M
  !M
" #M
$ %M
& !'M
( %)M
* %+M
, -M
. /M
0 1M
^$"r.   r   )rN   
__future__r   r6   collections.abcr   r   typingr   r   gradio_client.documentationr   gradio.components.baser	   gradio.eventsr
   gradio.i18nr   gradio.componentsr   r   r0   r.   r-   <module>r[      sF     "  . % 0 ,    ' 
"y " "r.   