package o; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.Calendar; import org.threeten.bp.DateTimeException; import org.threeten.bp.temporal.UnsupportedTemporalTypeException; /* renamed from: o.gtd, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15543gtd extends gsK implements Serializable { static final C15520gsp MIN_DATE = C15520gsp.of(1873, 1, 1); private static final long serialVersionUID = -305327627230580483L; private transient C15542gtc era; private final C15520gsp isoDate; private transient int yearOfEra; @Override // o.gsK, o.InterfaceC15536gtL public final /* bridge */ /* synthetic */ long until(InterfaceC15536gtL interfaceC15536gtL, InterfaceC15539gtV interfaceC15539gtV) { return super.until(interfaceC15536gtL, interfaceC15539gtV); } public static C15543gtd now() { return now(AbstractC15514gsj.systemDefaultZone()); } public static C15543gtd now(AbstractC15502gsH abstractC15502gsH) { return now(AbstractC15514gsj.system(abstractC15502gsH)); } public static C15543gtd now(AbstractC15514gsj abstractC15514gsj) { return new C15543gtd(C15520gsp.now(abstractC15514gsj)); } public static C15543gtd of(C15542gtc c15542gtc, int i, int i2, int i3) { gtG.requireNonNull(c15542gtc, "era"); if (i <= 0) { throw new DateTimeException("Invalid YearOfEra: ".concat(String.valueOf(i))); } C15520gsp startDate = c15542gtc.startDate(); C15520gsp endDate = c15542gtc.endDate(); C15520gsp of = C15520gsp.of((startDate.getYear() - 1) + i, i2, i3); if (of.isBefore(startDate) || of.isAfter(endDate)) { throw new DateTimeException("Requested date is outside bounds of era ".concat(String.valueOf(c15542gtc))); } return new C15543gtd(c15542gtc, i, of); } /* JADX INFO: Access modifiers changed from: package-private */ public static C15543gtd ofYearDay(C15542gtc c15542gtc, int i, int i2) { gtG.requireNonNull(c15542gtc, "era"); if (i <= 0) { throw new DateTimeException("Invalid YearOfEra: ".concat(String.valueOf(i))); } C15520gsp startDate = c15542gtc.startDate(); C15520gsp endDate = c15542gtc.endDate(); if (i == 1 && (i2 = i2 + (startDate.getDayOfYear() - 1)) > startDate.lengthOfYear()) { throw new DateTimeException("DayOfYear exceeds maximum allowed in the first year of era ".concat(String.valueOf(c15542gtc))); } C15520gsp ofYearDay = C15520gsp.ofYearDay((startDate.getYear() - 1) + i, i2); if (ofYearDay.isBefore(startDate) || ofYearDay.isAfter(endDate)) { throw new DateTimeException("Requested date is outside bounds of era ".concat(String.valueOf(c15542gtc))); } return new C15543gtd(c15542gtc, i, ofYearDay); } public static C15543gtd of(int i, int i2, int i3) { return new C15543gtd(C15520gsp.of(i, i2, i3)); } public static C15543gtd from(gtK gtk) { return C15545gtf.INSTANCE.date(gtk); } /* JADX INFO: Access modifiers changed from: package-private */ public C15543gtd(C15520gsp c15520gsp) { if (c15520gsp.isBefore(MIN_DATE)) { throw new DateTimeException("Minimum supported date is January 1st Meiji 6"); } this.era = C15542gtc.from(c15520gsp); this.yearOfEra = c15520gsp.getYear() - (r0.startDate().getYear() - 1); this.isoDate = c15520gsp; } C15543gtd(C15542gtc c15542gtc, int i, C15520gsp c15520gsp) { if (c15520gsp.isBefore(MIN_DATE)) { throw new DateTimeException("Minimum supported date is January 1st Meiji 6"); } this.era = c15542gtc; this.yearOfEra = i; this.isoDate = c15520gsp; } private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { objectInputStream.defaultReadObject(); this.era = C15542gtc.from(this.isoDate); this.yearOfEra = this.isoDate.getYear() - (r2.startDate().getYear() - 1); } @Override // o.gsJ public final C15545gtf getChronology() { return C15545gtf.INSTANCE; } @Override // o.gsJ public final int lengthOfMonth() { return this.isoDate.lengthOfMonth(); } @Override // o.gsJ public final int lengthOfYear() { Calendar calendar = Calendar.getInstance(C15545gtf.LOCALE); calendar.set(0, this.era.getValue() + 2); calendar.set(this.yearOfEra, this.isoDate.getMonthValue() - 1, this.isoDate.getDayOfMonth()); return calendar.getActualMaximum(6); } @Override // o.gsJ, o.gtK public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP == EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH || interfaceC15537gtP == EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR || interfaceC15537gtP == EnumC15534gtD.ALIGNED_WEEK_OF_MONTH || interfaceC15537gtP == EnumC15534gtD.ALIGNED_WEEK_OF_YEAR) { return false; } return super.isSupported(interfaceC15537gtP); } @Override // o.gtE, o.gtK public final gtT range(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { if (isSupported(interfaceC15537gtP)) { EnumC15534gtD enumC15534gtD = (EnumC15534gtD) interfaceC15537gtP; int i = AnonymousClass1.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]; if (i == 1) { return actualRange(6); } if (i == 2) { return actualRange(1); } return getChronology().range(enumC15534gtD); } throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } return interfaceC15537gtP.rangeRefinedBy(this); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gtd$1, reason: invalid class name */ /* loaded from: classes6.dex */ public static /* synthetic */ class AnonymousClass1 { static final int[] $SwitchMap$org$threeten$bp$temporal$ChronoField; static { int[] iArr = new int[EnumC15534gtD.values().length]; $SwitchMap$org$threeten$bp$temporal$ChronoField = iArr; try { iArr[EnumC15534gtD.DAY_OF_YEAR.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.YEAR_OF_ERA.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ERA.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } } } private gtT actualRange(int i) { Calendar calendar = Calendar.getInstance(C15545gtf.LOCALE); calendar.set(0, this.era.getValue() + 2); calendar.set(this.yearOfEra, this.isoDate.getMonthValue() - 1, this.isoDate.getDayOfMonth()); return gtT.of(calendar.getActualMinimum(i), calendar.getActualMaximum(i)); } @Override // o.gtK public final long getLong(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { switch (AnonymousClass1.$SwitchMap$org$threeten$bp$temporal$ChronoField[((EnumC15534gtD) interfaceC15537gtP).ordinal()]) { case 1: return getDayOfYear(); case 2: return this.yearOfEra; case 3: case 4: case 5: case 6: throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); case 7: return this.era.getValue(); default: return this.isoDate.getLong(interfaceC15537gtP); } } return interfaceC15537gtP.getFrom(this); } private long getDayOfYear() { int dayOfYear; if (this.yearOfEra == 1) { dayOfYear = (this.isoDate.getDayOfYear() - this.era.startDate().getDayOfYear()) + 1; } else { dayOfYear = this.isoDate.getDayOfYear(); } return dayOfYear; } @Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL public final C15543gtd with(gtJ gtj) { return (C15543gtd) super.with(gtj); } @Override // o.gsJ, o.InterfaceC15536gtL public final C15543gtd with(InterfaceC15537gtP interfaceC15537gtP, long j) { if (interfaceC15537gtP instanceof EnumC15534gtD) { EnumC15534gtD enumC15534gtD = (EnumC15534gtD) interfaceC15537gtP; if (getLong(enumC15534gtD) == j) { return this; } int i = AnonymousClass1.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]; if (i == 1 || i == 2 || i == 7) { int checkValidIntValue = getChronology().range(enumC15534gtD).checkValidIntValue(j, enumC15534gtD); int i2 = AnonymousClass1.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]; if (i2 == 1) { return with(this.isoDate.plusDays(checkValidIntValue - getDayOfYear())); } if (i2 == 2) { return withYear(checkValidIntValue); } if (i2 == 7) { return withYear(C15542gtc.of(checkValidIntValue), this.yearOfEra); } } return with(this.isoDate.with(interfaceC15537gtP, j)); } return (C15543gtd) interfaceC15537gtP.adjustInto(this, j); } @Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL public final C15543gtd plus(gtN gtn) { return (C15543gtd) super.plus(gtn); } @Override // o.gsK, o.gsJ, o.InterfaceC15536gtL public final C15543gtd plus(long j, InterfaceC15539gtV interfaceC15539gtV) { return (C15543gtd) super.plus(j, interfaceC15539gtV); } @Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL public final C15543gtd minus(gtN gtn) { return (C15543gtd) super.minus(gtn); } @Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL public final C15543gtd minus(long j, InterfaceC15539gtV interfaceC15539gtV) { return (C15543gtd) super.minus(j, interfaceC15539gtV); } private C15543gtd withYear(C15542gtc c15542gtc, int i) { return with(this.isoDate.withYear(C15545gtf.INSTANCE.prolepticYear(c15542gtc, i))); } private C15543gtd withYear(int i) { return withYear(getEra(), i); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.gsK public final gsK plusYears(long j) { return with(this.isoDate.plusYears(j)); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.gsK public final gsK plusMonths(long j) { return with(this.isoDate.plusMonths(j)); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.gsK public final gsK plusDays(long j) { return with(this.isoDate.plusDays(j)); } private C15543gtd with(C15520gsp c15520gsp) { return c15520gsp.equals(this.isoDate) ? this : new C15543gtd(c15520gsp); } @Override // o.gsK, o.gsJ public final gsO atTime(C15521gsq c15521gsq) { return super.atTime(c15521gsq); } @Override // o.gsK, o.gsJ public final gsT until(gsJ gsj) { C15500gsA until = this.isoDate.until(gsj); return getChronology().period(until.getYears(), until.getMonths(), until.getDays()); } @Override // o.gsJ public final long toEpochDay() { return this.isoDate.toEpochDay(); } @Override // o.gsJ public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof C15543gtd) { return this.isoDate.equals(((C15543gtd) obj).isoDate); } return false; } @Override // o.gsJ public final int hashCode() { return getChronology().getId().hashCode() ^ this.isoDate.hashCode(); } private Object writeReplace() { return new C15548gti((byte) 1, this); } /* JADX INFO: Access modifiers changed from: package-private */ public final void writeExternal(DataOutput dataOutput) throws IOException { dataOutput.writeInt(get(EnumC15534gtD.YEAR)); dataOutput.writeByte(get(EnumC15534gtD.MONTH_OF_YEAR)); dataOutput.writeByte(get(EnumC15534gtD.DAY_OF_MONTH)); } /* JADX INFO: Access modifiers changed from: package-private */ public static gsJ readExternal(DataInput dataInput) throws IOException { return C15545gtf.INSTANCE.date(dataInput.readInt(), (int) dataInput.readByte(), (int) dataInput.readByte()); } @Override // o.gsJ public final C15542gtc getEra() { return this.era; } }