# groupImageVariants

**Kind:** Function

**Source:** [`atloria-monorepo/packages/doc-automation/src/v2/stages/stage-13-upload/upload.service.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/packages/doc-automation/src/v2/stages/stage-13-upload/upload.service.ts#L112)

Group a flat `{ refPath → blobUrl }` map into
`{ <desktopBlobUrl>: ImageVariantSet }`.

PURE and exported for direct unit testing. Only base images that (a) resolved
to a blob URL AND (b) actually have at least one companion (tablet/mobile/crop)
produce an entry — a lone desktop shot needs no picker. Crops are ordered by
their N. Keyed by the desktop blob URL because that is the exact URL the
rendered `<img src>` carries (minus any `#atloria-annotations=` fragment), so
the reader joins without content parsing.

## Signature

```ts
function groupImageVariants(refToUrl: Record<string, string>): Record<string, ImageVariantSet>
```

## Parameters

| Name | Type |
|---|---|
| `refToUrl` | `Record<string, string>` |

**Returns:** `Record<string, ImageVariantSet>`
