# Scout findings ## Project snapshot - **Tech stack:** SvelteKit + TypeScript + Vite + Tailwind v4. - **App name/branding:** `beA-Edit`. - **Core purpose:** upload one or more ZIP files, extract relevant PDFs/images, preview them, optionally reorder attachments, and download a merged PDF. ## Main user flow 1. User adds ZIP files via drag/drop or file picker (`ZipDropzone`). 2. `+page.svelte` starts async extraction for each file. 3. Each ZIP is processed into one or more `ProcessedZipArchive` entries. 4. `ProcessedZipArchiveEditor` shows thumbnails, allows reordering, and can download the merged PDF. 5. `AttachmentPreview` renders image previews directly and PDF previews via `pdfjs-dist`. ## Important source files - `src/routes/+page.svelte` — top-level page state, file selection, localStorage-backed thumbnail width setting, async ZIP processing. - `src/lib/zip-processing.ts` — archive extraction, recursive nested ZIP handling, metadata ordering, PDF merge/export, image conversion. - `src/lib/services/zip-inflating.service.ts` — thin wrapper around `fflate` unzip. - `src/lib/services/xml-reading.service.ts` — parses XJustiz XML metadata (`sender`, `receiver`, `documentNames`). - `src/lib/components/ZipDropzone.svelte` — file picker + drag/drop ZIP intake. - `src/lib/components/ProcessedZipArchiveEditor.svelte` — archive editor, drag reordering, download button. - `src/lib/components/AttachmentPreview.svelte` — preview generation for images/PDFs. - `src/lib/components/Card.svelte` — generic page container. ## ZIP/PDF processing details - ZIP entries are filtered to ignore macOS metadata (`__MACOSX`, `.DS_Store`, `._*`). - Relevant attachments are PDFs and common image formats. - Nested ZIP archives are processed recursively. - `xjustiz_nachricht.xml` is used to derive archive naming and ordering. - Ordering prefers document names from metadata before falling back to original attachment order. - PDF merging uses `pdf-lib`; images are embedded as PNG/JPG, with browser-side canvas conversion for other image types. ## UI/state details - Thumbnail width is stored in `localStorage` under `thumbnailWidth` and clamped to `100..400`. - Processing progress is shown as a count of pending ZIP files. - The editor supports manual attachment reordering via drag-and-drop. ## Dependencies worth noting - `fflate` for ZIP extraction - `pdf-lib` for PDF generation/merging - `pdfjs-dist` for PDF thumbnail previews - `@skeletonlabs/skeleton` / `@skeletonlabs/skeleton-svelte` for styling components ## Current working tree observations - `agents.md` is newly created. - Existing local changes are present in: - `src/lib/zip-processing.ts` - `src/routes/+page.svelte` - New/untracked directory present: - `src/lib/services/`