@echo off
title Pidgey Zip Builder
echo.
echo  =======================================
echo   Pidgey Extension Zip Builder (Standalone)
echo   Building fresh zip to Downloads folder...
echo  =======================================
echo.

set OUTPUT=C:\Users\Calyp\Downloads
set BASE=C:\Users\Calyp\Desktop
set SCRIPT=%~f0

:: Pin a shortcut to Desktop on first run
set SHORTCUT=%USERPROFILE%\Desktop\Build Pidgey Zips.lnk
if not exist "%SHORTCUT%" (
    echo  [Shortcut added to your Desktop!]
)

echo [1/1] Zipping pidgey-assist-standalone...
set TMP_DIR=%TEMP%\pidgey-store-build
if exist "%TMP_DIR%" rmdir /s /q "%TMP_DIR%"
mkdir "%TMP_DIR%"
mkdir "%TMP_DIR%\icons"

echo   Copying required extension files...
copy "%~dp0manifest.json" "%TMP_DIR%\" >nul
copy "%~dp0sidepanel.html" "%TMP_DIR%\" >nul
copy "%~dp0mic_permission.html" "%TMP_DIR%\" >nul
copy "%~dp0*.css" "%TMP_DIR%\" >nul
copy "%~dp0*.js" "%TMP_DIR%\" >nul
copy "%~dp0models.json" "%TMP_DIR%\" >nul
xcopy "%~dp0icons\*" "%TMP_DIR%\icons\" /s /y /q >nul
xcopy "%~dp0tools\*" "%TMP_DIR%\tools\" /s /y /q >nul

echo   Compressing to zip...
powershell -Command "Compress-Archive -Path '%TMP_DIR%\*' -DestinationPath '%OUTPUT%\pidgey-assist-standalone.zip' -Force"
rmdir /s /q "%TMP_DIR%"
echo  Done!

echo.
echo  =======================================
echo   ZIP SAVED TO: C:\Users\Calyp\Downloads
echo  =======================================
echo.
