package c5; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Locale; import z4.o; import z4.q; import z4.r; /* loaded from: classes2.dex */ public final class c extends q { /* renamed from: b, reason: collision with root package name */ public static final r f3734b = new a(); /* renamed from: a, reason: collision with root package name */ private final List f3735a; class a implements r { a() { } @Override // z4.r public q a(z4.e eVar, f5.a aVar) { if (aVar.c() == Date.class) { return new c(); } return null; } } public c() { ArrayList arrayList = new ArrayList(); this.f3735a = arrayList; Locale locale = Locale.US; arrayList.add(DateFormat.getDateTimeInstance(2, 2, locale)); if (!Locale.getDefault().equals(locale)) { arrayList.add(DateFormat.getDateTimeInstance(2, 2)); } if (b5.e.e()) { arrayList.add(b5.j.c(2, 2)); } } private synchronized Date e(String str) { Iterator it = this.f3735a.iterator(); while (it.hasNext()) { try { return ((DateFormat) it.next()).parse(str); } catch (ParseException unused) { } } try { return d5.a.c(str, new ParsePosition(0)); } catch (ParseException e10) { throw new o(str, e10); } } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public Date b(g5.a aVar) { if (aVar.F0() != g5.b.NULL) { return e(aVar.D0()); } aVar.w0(); return null; } @Override // z4.q /* renamed from: g, reason: merged with bridge method [inline-methods] */ public synchronized void d(g5.c cVar, Date date) { if (date == null) { cVar.j0(); } else { cVar.I0(((DateFormat) this.f3735a.get(0)).format(date)); } } }