
    ;3h                        d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl	Z	d dl
mZ d dlZd dlmZ d dlmZ  eej"                        j$                  dz  d	z  Z ed
      dz   ed      dddf	 	 	 	 	 	 	 	 	 ddZy)    )annotationsN)Path)	AnnotatedOptional)print)custom_component_analytics)_get_executable_path	templatesfrontenddemozapp.py.	localhostc                Z   t        dd d d d ||       |j                         }t        d|  d       t        j                  d      }|st        d      t        d|dd	
      }t        d|d      }t        j                  |ddgt        |dz        dd	      }|j                  dk7  rt        d      |j                  j                  d      j                         }t        j                  ||d|dt        dt!        |       ddd|d|d|gt        j"                  t        j$                        }	 |j'                          |j                  j)                         }d }	|j*                  r|j*                  j)                         }	|j                  d      j-                  dd      j-                  dd      j-                  d d!      }d|v r#|d"t!        |dz        j                          d#z  }d$|v rt        |       |	rt        |	j                  d             |j                  t        d%       y )&Ndev)python_pathgradio_pathz:recycle: [green]Launching[/] z in reload mode
nodez0node must be installed in order to run dev mode.pythonz--python-pathT)cli_arg_namecheck_3gradioz--gradio-path)r   z-ez/console.log(require.resolve('@gradio/preview'))r   F)cwdcheckcapture_outputr   zYCould not find `@gradio/preview`. Run `npm i -D @gradio/preview` in your frontend folder.zutf-8z--component-directoryz--rootz--appz--modez--host)stdoutstderrzChanges detected in:z [orange3]Changed detected in:[/]z	Watching:z[orange3]Watching:[/]zRunning on local URLz[orange3]Backend Server[/]'z',zTo create a public linkz)Backend server failed to launch. Exiting.)r   resolver   shutilwhich
ValueErrorr	   
subprocessrunr   
returncoder   decodestripPopengradio_template_pathstrPIPESTDOUTpollreadliner   replace)
appcomponent_directoryhostr   r   r   gradio_node_pathproctexterrs
             b/var/www/html/audio-gradio/venv/lib/python3.12/site-packages/gradio/cli/commands/components/dev.py_devr7      sC   @  .557	*3%/@
AB<<DKLL&+OTK '+OK "~~	tFG$z12	 ""a'g
 	
 (..55g>DDF# H!	
$   )D, 		{{##%;;++&&(C KK W+-OPW["9:W+-IJ	 	 #d*a/*<=CCEFbIID$,d#**W%&??&=>1     )
r/   zxAnnotated[Path, typer.Argument(help='The path to the app. By default, looks for demo/app.py in the current directory.')]r0   zAnnotated[Path, typer.Option(help='The directory with the custom component source code. By default, uses the current directory.')]r1   zdAnnotated[str, typer.Option(help='The host to run the front end server on. Defaults to localhost.')]r   zAnnotated[Optional[str], typer.Option(help='Path to python executable. If None, will use the default path found by `which python3`. If python3 is not found, `which python` will be tried. If both fail an error will be raised.')]r   zAnnotated[Optional[str], typer.Option(help='Path to gradio executable. If None, will use the default path found by `shutil.which`.')])
__future__r   r   r"   pathlibr   typingr   r   typerrichr   r   gradio.analyticsr   0gradio.cli.commands.components.install_componentr	   __file__parentr(   r7    r8   r6   <module>rC      s    "    &    7 QFOO,33kAJN  	Vx 	S	 	 	 	=t
ttt&'t23tr8   