@echo off
setlocal
set "DIST=%~dp0dist"
if not exist "%DIST%" mkdir "%DIST%"

set "PDF_MJS_URL=https://unpkg.com/pdfjs-dist@4.4.168/build/pdf.mjs"
set "PDF_WORKER_URL=https://unpkg.com/pdfjs-dist@4.4.168/build/pdf.worker.min.mjs"
set "MAMMOTH_URL=https://unpkg.com/mammoth@1.6.0/mammoth.browser.js"

powershell -Command "Invoke-WebRequest -Uri %PDF_MJS_URL% -OutFile '%DIST%\pdf.mjs'"
powershell -Command "Invoke-WebRequest -Uri %PDF_WORKER_URL% -OutFile '%DIST%\pdf.worker.min.js'"
powershell -Command "Invoke-WebRequest -Uri %MAMMOTH_URL% -OutFile '%DIST%\mammoth.browser.js'"

echo.
echo [OK] Libs telechargees dans dist\. L’extension fonctionne hors-ligne.
exit /b 0
