@echo off
chcp 949 >nul
title Phantom Eyes - ¿µ±¸ »èÁ¦

REM ¦¡¦¡ °ü¸®ÀÚ ±ÇÇÑ ¦¡¦¡
net session >nul 2>&1
if %errorlevel% neq 0 (
  powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)

echo [Phantom Eyes] ·ÎÄÃ Eyes ¸¦ ¿ÏÀü »èÁ¦ÇÕ´Ï´Ù...

REM ¦¡¦¡ ºÎÆÃ ÀÚµ¿½ÃÀÛ(ÀÛ¾÷ ½ºÄÉÁÙ·¯) µî·Ï ÇØÁ¦ ¦¡¦¡
schtasks /Delete /TN "PhantomEyes" /F >nul 2>nul

REM ¦¡¦¡ ½ÇÇàÁß ÄÜ¼ÖÃ¢(Phantom Eyes) Á¾·á ¦¡¦¡
taskkill /FI "WINDOWTITLE eq Phantom Eyes*" /T /F >nul 2>nul

REM ¦¡¦¡ ¿öÄ¿ ÇÁ·Î¼¼½º Á¾·á (ÇÏÀ§ Chrome Æ÷ÇÔ) ¦¡¦¡
for /f %%p in ('powershell -NoProfile -Command "Get-CimInstance Win32_Process ^| Where-Object { $_.CommandLine -like '*main.py*--worker*' } ^| Select-Object -ExpandProperty ProcessId" 2^>nul') do (
  taskkill /PID %%p /T /F >nul 2>nul
)
REM ¦¡¦¡ Phantom Eyes Àü¿ë Chrome ÀÜ¿© Á¤¸® (ÀÏ¹Ý Chrome Á¦¿Ü) ¦¡¦¡
for /f %%p in ('powershell -NoProfile -Command "Get-CimInstance Win32_Process ^| Where-Object { $_.Name -eq 'chrome.exe' -and $_.CommandLine -like '*PhantomEyes*profile_*' } ^| Select-Object -ExpandProperty ProcessId" 2^>nul') do (
  taskkill /PID %%p /T /F >nul 2>nul
)
timeout /t 2 >nul

REM ¦¡¦¡ ¼³Ä¡ Æú´õ + WebKit Ä³½Ã »èÁ¦ ¦¡¦¡
set "DIR=%LOCALAPPDATA%\PhantomEyes"
if exist "%DIR%" rmdir /s /q "%DIR%"
if exist "%LOCALAPPDATA%\ms-playwright" rmdir /s /q "%LOCALAPPDATA%\ms-playwright"

echo [Phantom Eyes] »èÁ¦ ¿Ï·á (ÄÚµå/ÇÁ·ÎÇÊ/ºê¶ó¿ìÀú Ä³½Ã ¸ðµÎ Á¦°Å).
timeout /t 3 >nul
