package o; import java.io.Serializable; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.threeten.bp.DateTimeException; /* renamed from: o.gta, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15540gta extends gsR implements Serializable { private static final HashMap ERA_FULL_NAMES; private static final HashMap ERA_NARROW_NAMES; private static final HashMap ERA_SHORT_NAMES; private static final String FALLBACK_LANGUAGE = "en"; public static final C15540gta INSTANCE = new C15540gta(); private static final long serialVersionUID = 3127340209035924785L; @Override // o.gsR public final /* bridge */ /* synthetic */ gsJ resolveDate(Map map, gtA gta) { return resolveDate((Map) map, gta); } static { HashMap hashMap = new HashMap<>(); ERA_NARROW_NAMES = hashMap; HashMap hashMap2 = new HashMap<>(); ERA_SHORT_NAMES = hashMap2; HashMap hashMap3 = new HashMap<>(); ERA_FULL_NAMES = hashMap3; hashMap.put(FALLBACK_LANGUAGE, new String[]{"BH", "HE"}); hashMap2.put(FALLBACK_LANGUAGE, new String[]{"B.H.", "H.E."}); hashMap3.put(FALLBACK_LANGUAGE, new String[]{"Before Hijrah", "Hijrah Era"}); } private C15540gta() { } @Override // o.gsR public final gsX date(gsY gsy, int i, int i2, int i3) { return (gsX) super.date(gsy, i, i2, i3); } @Override // o.gsR public final gsX date(int i, int i2, int i3) { return gsX.of(i, i2, i3); } @Override // o.gsR public final gsX dateYearDay(gsY gsy, int i, int i2) { return (gsX) super.dateYearDay(gsy, i, i2); } /* JADX WARN: Type inference failed for: r3v2, types: [o.gsX] */ @Override // o.gsR public final gsX dateYearDay(int i, int i2) { return gsX.of(i, 1, 1).plusDays(i2 - 1); } @Override // o.gsR public final gsX dateEpochDay(long j) { return gsX.of(C15520gsp.ofEpochDay(j)); } @Override // o.gsR public final gsX date(gtK gtk) { if (gtk instanceof gsX) { return (gsX) gtk; } return gsX.ofEpochDay(gtk.getLong(EnumC15534gtD.EPOCH_DAY)); } @Override // o.gsR public final gsO localDateTime(gtK gtk) { return super.localDateTime(gtk); } @Override // o.gsR public final gsS zonedDateTime(gtK gtk) { return super.zonedDateTime(gtk); } @Override // o.gsR public final gsS zonedDateTime(C15523gss c15523gss, AbstractC15502gsH abstractC15502gsH) { return super.zonedDateTime(c15523gss, abstractC15502gsH); } @Override // o.gsR public final gsX dateNow() { return (gsX) super.dateNow(); } @Override // o.gsR public final gsX dateNow(AbstractC15502gsH abstractC15502gsH) { return (gsX) super.dateNow(abstractC15502gsH); } @Override // o.gsR public final gsX dateNow(AbstractC15514gsj abstractC15514gsj) { gtG.requireNonNull(abstractC15514gsj, "clock"); return (gsX) super.dateNow(abstractC15514gsj); } @Override // o.gsR public final boolean isLeapYear(long j) { return gsX.isLeapYear(j); } @Override // o.gsR public final int prolepticYear(gsY gsy, int i) { if (gsy instanceof EnumC15504gsZ) { return gsy != EnumC15504gsZ.AH ? 1 - i : i; } throw new ClassCastException("Era must be HijrahEra"); } @Override // o.gsR public final EnumC15504gsZ eraOf(int i) { if (i == 0) { return EnumC15504gsZ.BEFORE_AH; } if (i == 1) { return EnumC15504gsZ.AH; } throw new DateTimeException("invalid Hijrah era"); } @Override // o.gsR public final List eras() { return Arrays.asList(EnumC15504gsZ.values()); } @Override // o.gsR public final gtT range(EnumC15534gtD enumC15534gtD) { return enumC15534gtD.range(); } /* JADX WARN: Type inference failed for: r11v20, types: [o.gtE, o.gsX] */ /* JADX WARN: Type inference failed for: r11v35, types: [o.gsX] */ /* JADX WARN: Type inference failed for: r11v71, types: [o.gsX] */ @Override // o.gsR public final gsX resolveDate(Map map, gtA gta) { if (map.containsKey(EnumC15534gtD.EPOCH_DAY)) { return dateEpochDay(map.remove(EnumC15534gtD.EPOCH_DAY).longValue()); } Long remove = map.remove(EnumC15534gtD.PROLEPTIC_MONTH); if (remove != null) { if (gta != gtA.LENIENT) { EnumC15534gtD.PROLEPTIC_MONTH.checkValidValue(remove.longValue()); } updateResolveMap(map, EnumC15534gtD.MONTH_OF_YEAR, gtG.floorMod(remove.longValue(), 12) + 1); updateResolveMap(map, EnumC15534gtD.YEAR, gtG.floorDiv(remove.longValue(), 12L)); } Long remove2 = map.remove(EnumC15534gtD.YEAR_OF_ERA); if (remove2 != null) { if (gta != gtA.LENIENT) { EnumC15534gtD.YEAR_OF_ERA.checkValidValue(remove2.longValue()); } Long remove3 = map.remove(EnumC15534gtD.ERA); if (remove3 == null) { Long l = map.get(EnumC15534gtD.YEAR); if (gta != gtA.STRICT) { updateResolveMap(map, EnumC15534gtD.YEAR, (l == null || l.longValue() > 0) ? remove2.longValue() : gtG.safeSubtract(1L, remove2.longValue())); } else if (l != null) { updateResolveMap(map, EnumC15534gtD.YEAR, l.longValue() > 0 ? remove2.longValue() : gtG.safeSubtract(1L, remove2.longValue())); } else { map.put(EnumC15534gtD.YEAR_OF_ERA, remove2); } } else if (remove3.longValue() == 1) { updateResolveMap(map, EnumC15534gtD.YEAR, remove2.longValue()); } else if (remove3.longValue() == 0) { updateResolveMap(map, EnumC15534gtD.YEAR, gtG.safeSubtract(1L, remove2.longValue())); } else { throw new DateTimeException("Invalid value for era: ".concat(String.valueOf(remove3))); } } else if (map.containsKey(EnumC15534gtD.ERA)) { EnumC15534gtD.ERA.checkValidValue(map.get(EnumC15534gtD.ERA).longValue()); } if (!map.containsKey(EnumC15534gtD.YEAR)) { return null; } if (map.containsKey(EnumC15534gtD.MONTH_OF_YEAR)) { if (map.containsKey(EnumC15534gtD.DAY_OF_MONTH)) { int checkValidIntValue = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue, 1, 1).plusMonths(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L)).plusDays(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_MONTH).longValue(), 1L)); } int checkValidIntValue2 = range(EnumC15534gtD.MONTH_OF_YEAR).checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), EnumC15534gtD.MONTH_OF_YEAR); int checkValidIntValue3 = range(EnumC15534gtD.DAY_OF_MONTH).checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_MONTH).longValue(), EnumC15534gtD.DAY_OF_MONTH); if (gta == gtA.SMART && checkValidIntValue3 > 28) { checkValidIntValue3 = Math.min(checkValidIntValue3, date(checkValidIntValue, checkValidIntValue2, 1).lengthOfMonth()); } return date(checkValidIntValue, checkValidIntValue2, checkValidIntValue3); } if (map.containsKey(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH)) { if (map.containsKey(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH)) { int checkValidIntValue4 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue4, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.MONTHS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } int checkValidIntValue5 = EnumC15534gtD.MONTH_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue()); gsX plus = date(checkValidIntValue4, checkValidIntValue5, 1).plus(((EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue()) - 1) * 7) + (EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH).longValue()) - 1), (InterfaceC15539gtV) gtH.DAYS); if (gta != gtA.STRICT || plus.get(EnumC15534gtD.MONTH_OF_YEAR) == checkValidIntValue5) { return plus; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } if (map.containsKey(EnumC15534gtD.DAY_OF_WEEK)) { int checkValidIntValue6 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue6, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.MONTHS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } int checkValidIntValue7 = EnumC15534gtD.MONTH_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue()); gsX with = date(checkValidIntValue6, checkValidIntValue7, 1).plus(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue()) - 1, (InterfaceC15539gtV) gtH.WEEKS).with(gtO.nextOrSame(EnumC15515gsk.of(EnumC15534gtD.DAY_OF_WEEK.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue())))); if (gta != gtA.STRICT || with.get(EnumC15534gtD.MONTH_OF_YEAR) == checkValidIntValue7) { return with; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } } } if (map.containsKey(EnumC15534gtD.DAY_OF_YEAR)) { int checkValidIntValue8 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return dateYearDay(checkValidIntValue8, 1).plusDays(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_YEAR).longValue(), 1L)); } return dateYearDay(checkValidIntValue8, EnumC15534gtD.DAY_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_YEAR).longValue())); } if (!map.containsKey(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR)) { return null; } if (map.containsKey(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR)) { int checkValidIntValue9 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue9, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } ?? plusDays = date(checkValidIntValue9, 1, 1).plusDays(((EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue()) - 1) * 7) + (EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR).longValue()) - 1)); if (gta != gtA.STRICT || plusDays.get(EnumC15534gtD.YEAR) == checkValidIntValue9) { return plusDays; } throw new DateTimeException("Strict mode rejected date parsed to a different year"); } if (!map.containsKey(EnumC15534gtD.DAY_OF_WEEK)) { return null; } int checkValidIntValue10 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue10, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } gsX with2 = date(checkValidIntValue10, 1, 1).plus(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue()) - 1, (InterfaceC15539gtV) gtH.WEEKS).with(gtO.nextOrSame(EnumC15515gsk.of(EnumC15534gtD.DAY_OF_WEEK.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue())))); if (gta != gtA.STRICT || with2.get(EnumC15534gtD.YEAR) == checkValidIntValue10) { return with2; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } @Override // o.gsR public final String getId() { return "Hijrah-umalqura"; } @Override // o.gsR public final String getCalendarType() { return "islamic-umalqura"; } private Object readResolve() { return INSTANCE; } }