package o; import com.huawei.hms.framework.common.hianalytics.CrashHianalyticsData; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; import o.gsJ; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public final class gsL extends gsO implements Serializable { private static final int HOURS_PER_DAY = 24; private static final long MICROS_PER_DAY = 86400000000L; private static final long MILLIS_PER_DAY = 86400000; private static final int MINUTES_PER_DAY = 1440; private static final int MINUTES_PER_HOUR = 60; private static final long NANOS_PER_DAY = 86400000000000L; private static final long NANOS_PER_HOUR = 3600000000000L; private static final long NANOS_PER_MINUTE = 60000000000L; private static final long NANOS_PER_SECOND = 1000000000; private static final int SECONDS_PER_DAY = 86400; private static final int SECONDS_PER_HOUR = 3600; private static final int SECONDS_PER_MINUTE = 60; private static final long serialVersionUID = 4556003607393004514L; private final D date; private final C15521gsq time; /* JADX INFO: Access modifiers changed from: package-private */ public static gsL of(R r, C15521gsq c15521gsq) { return new gsL<>(r, c15521gsq); } private gsL(D d, C15521gsq c15521gsq) { gtG.requireNonNull(d, "date"); gtG.requireNonNull(c15521gsq, CrashHianalyticsData.TIME); this.date = d; this.time = c15521gsq; } private gsL with(InterfaceC15536gtL interfaceC15536gtL, C15521gsq c15521gsq) { D d = this.date; return (d == interfaceC15536gtL && this.time == c15521gsq) ? this : new gsL<>(d.getChronology().ensureChronoLocalDate(interfaceC15536gtL), c15521gsq); } @Override // o.gtK public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { return interfaceC15537gtP instanceof EnumC15534gtD ? interfaceC15537gtP.isDateBased() || interfaceC15537gtP.isTimeBased() : interfaceC15537gtP != null && interfaceC15537gtP.isSupportedBy(this); } @Override // o.InterfaceC15536gtL public final boolean isSupported(InterfaceC15539gtV interfaceC15539gtV) { return interfaceC15539gtV instanceof gtH ? interfaceC15539gtV.isDateBased() || interfaceC15539gtV.isTimeBased() : interfaceC15539gtV != null && interfaceC15539gtV.isSupportedBy(this); } @Override // o.gtE, o.gtK public final gtT range(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { return (interfaceC15537gtP.isTimeBased() ? this.time : this.date).range(interfaceC15537gtP); } return interfaceC15537gtP.rangeRefinedBy(this); } @Override // o.gtE, o.gtK public final int get(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { return (interfaceC15537gtP.isTimeBased() ? this.time : this.date).get(interfaceC15537gtP); } return range(interfaceC15537gtP).checkValidIntValue(getLong(interfaceC15537gtP), interfaceC15537gtP); } @Override // o.gtK public final long getLong(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { return interfaceC15537gtP.isTimeBased() ? this.time.getLong(interfaceC15537gtP) : this.date.getLong(interfaceC15537gtP); } return interfaceC15537gtP.getFrom(this); } @Override // o.gsO, o.AbstractC15535gtF, o.InterfaceC15536gtL public final gsL with(gtJ gtj) { if (gtj instanceof gsJ) { return with((gsJ) gtj, this.time); } if (gtj instanceof C15521gsq) { return with(this.date, (C15521gsq) gtj); } if (gtj instanceof gsL) { return this.date.getChronology().ensureChronoLocalDateTime((gsL) gtj); } return this.date.getChronology().ensureChronoLocalDateTime((gsL) gtj.adjustInto(this)); } @Override // o.gsO, o.InterfaceC15536gtL public final gsL with(InterfaceC15537gtP interfaceC15537gtP, long j) { if (interfaceC15537gtP instanceof EnumC15534gtD) { if (interfaceC15537gtP.isTimeBased()) { return with(this.date, this.time.with(interfaceC15537gtP, j)); } return with(this.date.with(interfaceC15537gtP, j), this.time); } return this.date.getChronology().ensureChronoLocalDateTime(interfaceC15537gtP.adjustInto(this, j)); } @Override // o.gsO, o.InterfaceC15536gtL public final gsL plus(long j, InterfaceC15539gtV interfaceC15539gtV) { if (interfaceC15539gtV instanceof gtH) { switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoUnit[((gtH) interfaceC15539gtV).ordinal()]) { case 1: return plusNanos(j); case 2: return plusDays(j / MICROS_PER_DAY).plusNanos((j % MICROS_PER_DAY) * 1000); case 3: return plusDays(j / MILLIS_PER_DAY).plusNanos((j % MILLIS_PER_DAY) * 1000000); case 4: return plusSeconds(j); case 5: return plusMinutes(j); case 6: return plusHours(j); case 7: return plusDays(j / 256).plusHours((j % 256) * 12); default: return with(this.date.plus(j, interfaceC15539gtV), this.time); } } return this.date.getChronology().ensureChronoLocalDateTime(interfaceC15539gtV.addTo(this, j)); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gsL$3, reason: invalid class name */ /* loaded from: classes6.dex */ public static /* synthetic */ class AnonymousClass3 { static final int[] $SwitchMap$org$threeten$bp$temporal$ChronoUnit; static { int[] iArr = new int[gtH.values().length]; $SwitchMap$org$threeten$bp$temporal$ChronoUnit = iArr; try { iArr[gtH.NANOS.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MICROS.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MILLIS.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.SECONDS.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MINUTES.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.HOURS.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.HALF_DAYS.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } } } private gsL plusDays(long j) { return with(this.date.plus(j, gtH.DAYS), this.time); } private gsL plusHours(long j) { return plusWithOverflow(this.date, j, 0L, 0L, 0L); } private gsL plusMinutes(long j) { return plusWithOverflow(this.date, 0L, j, 0L, 0L); } /* JADX INFO: Access modifiers changed from: package-private */ public final gsL plusSeconds(long j) { return plusWithOverflow(this.date, 0L, 0L, j, 0L); } private gsL plusNanos(long j) { return plusWithOverflow(this.date, 0L, 0L, 0L, j); } private gsL plusWithOverflow(D d, long j, long j2, long j3, long j4) { if ((j | j2 | j3 | j4) == 0) { return with(d, this.time); } long j5 = j4 / NANOS_PER_DAY; long j6 = j3 / 86400; long j7 = j2 / 1440; long j8 = j / 24; long nanoOfDay = this.time.toNanoOfDay(); long j9 = (j4 % NANOS_PER_DAY) + ((j3 % 86400) * NANOS_PER_SECOND) + ((j2 % 1440) * NANOS_PER_MINUTE) + ((j % 24) * NANOS_PER_HOUR) + nanoOfDay; long floorDiv = gtG.floorDiv(j9, NANOS_PER_DAY); long floorMod = gtG.floorMod(j9, NANOS_PER_DAY); return with(d.plus(j5 + j6 + j7 + j8 + floorDiv, gtH.DAYS), floorMod == nanoOfDay ? this.time : C15521gsq.ofNanoOfDay(floorMod)); } @Override // o.gsO /* renamed from: atZone */ public final gsS atZone2(AbstractC15502gsH abstractC15502gsH) { return gsP.ofBest(this, abstractC15502gsH, null); } /* JADX WARN: Type inference failed for: r0v5, types: [o.gsJ] */ @Override // o.InterfaceC15536gtL public final long until(InterfaceC15536gtL interfaceC15536gtL, InterfaceC15539gtV interfaceC15539gtV) { gsO localDateTime = toLocalDate().getChronology().localDateTime(interfaceC15536gtL); if (interfaceC15539gtV instanceof gtH) { gtH gth = (gtH) interfaceC15539gtV; if (gth.isTimeBased()) { long j = localDateTime.getLong(EnumC15534gtD.EPOCH_DAY) - this.date.getLong(EnumC15534gtD.EPOCH_DAY); switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoUnit[gth.ordinal()]) { case 1: j = gtG.safeMultiply(j, NANOS_PER_DAY); break; case 2: j = gtG.safeMultiply(j, MICROS_PER_DAY); break; case 3: j = gtG.safeMultiply(j, MILLIS_PER_DAY); break; case 4: j = gtG.safeMultiply(j, SECONDS_PER_DAY); break; case 5: j = gtG.safeMultiply(j, MINUTES_PER_DAY); break; case 6: j = gtG.safeMultiply(j, 24); break; case 7: j = gtG.safeMultiply(j, 2); break; } return gtG.safeAdd(j, this.time.until(localDateTime.toLocalTime(), interfaceC15539gtV)); } ?? localDate = localDateTime.toLocalDate(); gsJ gsj = localDate; if (localDateTime.toLocalTime().isBefore(this.time)) { gsj = localDate.minus(1L, gtH.DAYS); } return this.date.until(gsj, interfaceC15539gtV); } return interfaceC15539gtV.between(this, localDateTime); } private Object writeReplace() { return new C15548gti((byte) 12, this); } /* JADX INFO: Access modifiers changed from: package-private */ public final void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeObject(this.date); objectOutput.writeObject(this.time); } /* JADX INFO: Access modifiers changed from: package-private */ public static gsO readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { return ((gsJ) objectInput.readObject()).atTime((C15521gsq) objectInput.readObject()); } @Override // o.gsO public final C15521gsq toLocalTime() { return this.time; } @Override // o.gsO public final D toLocalDate() { return this.date; } }