package o; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import java.lang.reflect.Type; import java.util.Map; /* loaded from: classes.dex */ public final class aTD { /* loaded from: classes.dex */ public static class Sts implements JsonDeserializer { private final Gson a; public Sts(Gson gson) { this.a = gson; } @Override // com.google.gson.JsonDeserializer public final T deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { if (jsonElement.isJsonObject()) { JsonObject asJsonObject = jsonElement.getAsJsonObject(); if (asJsonObject.has("data") && !(asJsonObject.get("data") instanceof JsonNull)) { JsonObject asJsonObject2 = asJsonObject.getAsJsonObject("data"); asJsonObject.remove("data"); for (Map.Entry entry : asJsonObject2.entrySet()) { asJsonObject.add(entry.getKey(), entry.getValue()); } } return (T) this.a.fromJson(asJsonObject, type); } return (T) this.a.fromJson(jsonElement, type); } } }