
    ch                    r    S r SSKJr  SSKrSSKrSSKJr  SSKJrJ	r	  SS jr
SS jrSS jrSS	 jrSS
 jrg)zUtilities related to the CLI.    )annotationsN)Any)env_utilerrorsc                h     SSK nUR                  " U 40 UD6  g! [         a    [        U SS9   gf = f)zPrint a message to the terminal using click if available, else print
using the built-in print function.

You can provide any keyword arguments that click.secho supports.
r   NT)flush)clicksechoImportErrorprintmessagekwargsr	   s      eC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\streamlit/cli_util.pyprint_to_clir      s4    #G&v& #gT"#s    11c                V     SSK nUR                  " U 40 UD6$ ! [         a    U s $ f = f)zStyle a message using click if available, else return the message
unchanged.

You can provide any keyword arguments that click.style supports.
r   N)r	   styler   r   s      r   style_for_clir   (   s2    {{7-f-- s    ((c                .    SS K nUR                  U 5        g )Nr   )
webbrowseropen)urlr   s     r   _open_browser_with_webbrowserr   7   s    OOC    c                    X/n[        [        R                  S5       n[        R                  " X#[        R
                  S9  S S S 5        g ! , (       d  f       g = f)Nw)stdoutstderr)r   osdevnull
subprocessPopenSTDOUT)commandr   cmd_liner    s       r   _open_browser_with_commandr&   =   s;    ~H	bjj#	'*:K:KL 
		s   $A
Ac                r   [         R                  (       a  [        U 5        g[         R                  (       a4  [         R                  " S5      (       a  [        SU 5        g[        U 5        g[         R                  (       a  [        SU 5        gSSKn[        R                  " SUR                  5        S35      e)a  Open a web browser pointing to a given URL.

We use this function instead of Python's `webbrowser` module because this
way we can capture stdout/stderr to avoid polluting the terminal with the
browser's messages. For example, Chrome always prints things like "Created
new window in existing browser session", and those get on the user's way.

url : str
    The URL. Must include the protocol.

Nzxdg-openr   r   z!Cannot open browser in platform "")r   
IS_WINDOWSr   IS_LINUX_OR_BSDis_executable_in_pathr&   	IS_DARWINplatformr   Errorsystem)r   r-   s     r   open_browserr0   C   s    0 %c*))*55&z37%c*"63/
,,:8??;L:MQO
PPr   )r   strr   r   returnNone)r   r1   r   r   r2   r1   )r   r1   r2   r3   )r$   r1   r   r1   r2   r3   )__doc__
__future__r   r   r!   typingr   	streamlitr   r   r   r   r   r&   r0    r   r   <module>r9      s4    $ " 	   &#M'Qr   