package o; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; /* loaded from: classes.dex */ public final class XM extends TypeAdapter implements HJa { private PYE a; private Gson b; private InterfaceC15734iCu c; public XM(Gson gson, InterfaceC15734iCu interfaceC15734iCu, PYE pye) { this.b = gson; this.c = interfaceC15734iCu; this.a = pye; } @Override // com.google.gson.TypeAdapter public final void write(JsonWriter jsonWriter, Object obj) throws IOException { if (obj == null) { jsonWriter.nullValue(); return; } XI xi = (XI) obj; Gson gson = this.b; PYE pye = this.a; jsonWriter.beginObject(); if (xi != xi.b) { pye.c(jsonWriter, 520); String str = xi.b; DTh.b(gson, String.class, str).write(jsonWriter, str); } if (xi != xi.a) { pye.c(jsonWriter, 672); String str2 = xi.a; DTh.b(gson, String.class, str2).write(jsonWriter, str2); } jsonWriter.endObject(); } @Override // com.google.gson.TypeAdapter /* renamed from: read */ public final Object read2(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.skipValue(); return null; } XI xi = new XI(); Gson gson = this.b; InterfaceC15734iCu interfaceC15734iCu = this.c; jsonReader.beginObject(); while (jsonReader.hasNext()) { int e = interfaceC15734iCu.e(jsonReader); boolean z = jsonReader.peek() != JsonToken.NULL; if (e != 214) { if (e != 569) { jsonReader.skipValue(); } else if (z) { xi.b = (String) gson.getAdapter(String.class).read2(jsonReader); } else { xi.b = null; jsonReader.nextNull(); } } else if (z) { xi.a = (String) gson.getAdapter(String.class).read2(jsonReader); } else { xi.a = null; jsonReader.nextNull(); } } jsonReader.endObject(); return xi; } }