The badges whose name contains search (ignoring case, an empty search matching all), split into the ones viewerId manages and the rest. Without a viewer every badge is in other.
Where a badge comes from: what it is awarded for (a tournament win, reaching an X Power or supporting on Patreon, told apart by its code) and who drew it.
What the badge is awarded for, read from its code: patreon and patreon_plus are the supporter badges, codes starting with xp (Splatoon 2) or one of {@link SPLATOON_3_XP_BADGE_VALUES} (Splatoon 3) are X Power badges and every other badge is a tournament prize.
The Splatoon 3 X Power badge a peak X Power earns: the highest of {@link SPLATOON_3_XP_BADGE_VALUES} it reaches, null below the lowest one. A player holds only this one XP badge, not the ones under it.
Who owns a badge and how many times. A user can own several copies of a badge, one per win: in the edit dialog the owners are a count per user, sent to the server as a list with one user id per copy. Copies come either from a finalized tournament (tied to it, shown in its winners' feed) or from a manager granting them by hand.
How the edited owners differ from the current ones, per user whose count changed: how many copies they are added or removed. A user new to the list is added all of their copies.
Splits new owners (one user id per copy) into the tournament wins kept and the copies granted by hand. A user's wins count first towards their new total, the rest of it being a manual grant. Lowering a total below the user's wins removes the most recent ones (highest tournament id).
Badges an editor can attach: the ones any of managerIds manage plus those already attached, so an attached badge they no longer manage still renders and stays removable.