package j$.time;

import androidx.media3.common.C;
import j$.time.chrono.ChronoLocalDate;
import j$.time.chrono.ChronoZonedDateTime;
import j$.time.chrono.InterfaceC2285d;
import j$.time.format.DateTimeFormatter;
import java.io.DataOutput;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class LocalDateTime implements j$.time.temporal.m, j$.time.temporal.o, InterfaceC2285d, Serializable {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final LocalDateTime f19110c = c0(LocalDate.f19105d, l.f19304e);

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final LocalDateTime f19111d = c0(LocalDate.f19106e, l.f19305f);
    private static final long serialVersionUID = 6207766400415563566L;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final LocalDate f19112a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final l f19113b;

    @Override // j$.time.temporal.m
    public final j$.time.temporal.m c(long j4, j$.time.temporal.v vVar) {
        j$.time.temporal.b bVar = (j$.time.temporal.b) vVar;
        return j4 == Long.MIN_VALUE ? b(Long.MAX_VALUE, bVar).b(1L, bVar) : b(-j4, bVar);
    }

    public static LocalDateTime now() {
        b bVarC = b.c();
        Instant instantJ = Instant.J(System.currentTimeMillis());
        return d0(instantJ.getEpochSecond(), instantJ.getNano(), bVarC.a().r().d(instantJ));
    }

    @Override // j$.time.chrono.InterfaceC2285d
    public final ChronoZonedDateTime H(ZoneId zoneId) {
        return ZonedDateTime.J(this, zoneId, null);
    }

    public static LocalDateTime Y(int i6) {
        return new LocalDateTime(LocalDate.h0(i6, 12, 31), l.c0(0));
    }

    public static LocalDateTime b0(int i6, int i7, int i8, int i9, int i10, int i11) {
        return new LocalDateTime(LocalDate.h0(i6, i7, i8), l.d0(i9, i10, i11, 0));
    }

    public static LocalDateTime c0(LocalDate localDate, l lVar) {
        Objects.requireNonNull(localDate, "date");
        Objects.requireNonNull(lVar, "time");
        return new LocalDateTime(localDate, lVar);
    }

    public static LocalDateTime d0(long j4, int i6, ZoneOffset zoneOffset) {
        Objects.requireNonNull(zoneOffset, "offset");
        long j6 = i6;
        j$.time.temporal.a.NANO_OF_SECOND.c0(j6);
        long jC0 = j4 + ((long) zoneOffset.c0());
        long j7 = 86400;
        return new LocalDateTime(LocalDate.j0(Math.floorDiv(jC0, j7)), l.e0((((long) ((int) Math.floorMod(jC0, j7))) * C.NANOS_PER_SECOND) + j6));
    }

    public static LocalDateTime B(j$.time.temporal.n nVar) {
        if (nVar instanceof LocalDateTime) {
            return (LocalDateTime) nVar;
        }
        if (nVar instanceof ZonedDateTime) {
            return ((ZonedDateTime) nVar).Y();
        }
        if (nVar instanceof OffsetDateTime) {
            return ((OffsetDateTime) nVar).toLocalDateTime();
        }
        try {
            return new LocalDateTime(LocalDate.J(nVar), l.J(nVar));
        } catch (c e6) {
            throw new c("Unable to obtain LocalDateTime from TemporalAccessor: " + nVar + " of type " + nVar.getClass().getName(), e6);
        }
    }

    private LocalDateTime(LocalDate localDate, l lVar) {
        this.f19112a = localDate;
        this.f19113b = lVar;
    }

    private LocalDateTime k0(LocalDate localDate, l lVar) {
        return (this.f19112a == localDate && this.f19113b == lVar) ? this : new LocalDateTime(localDate, lVar);
    }

    @Override // j$.time.temporal.n
    public final boolean f(j$.time.temporal.s sVar) {
        if (!(sVar instanceof j$.time.temporal.a)) {
            return sVar != null && sVar.Y(this);
        }
        j$.time.temporal.a aVar = (j$.time.temporal.a) sVar;
        return aVar.V() || aVar.d0();
    }

    @Override // j$.time.temporal.n
    public final j$.time.temporal.x l(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            return ((j$.time.temporal.a) sVar).d0() ? this.f19113b.l(sVar) : this.f19112a.l(sVar);
        }
        return sVar.J(this);
    }

    @Override // j$.time.temporal.n
    public final int j(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            return ((j$.time.temporal.a) sVar).d0() ? this.f19113b.j(sVar) : this.f19112a.j(sVar);
        }
        return super.j(sVar);
    }

    @Override // j$.time.temporal.n
    public final long g(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            return ((j$.time.temporal.a) sVar).d0() ? this.f19113b.g(sVar) : this.f19112a.g(sVar);
        }
        return sVar.r(this);
    }

    private int r(LocalDateTime localDateTime) {
        int iR = this.f19112a.r(localDateTime.f19112a);
        return iR == 0 ? this.f19113b.compareTo(localDateTime.f19113b) : iR;
    }

    public final LocalDate h0() {
        return this.f19112a;
    }

    @Override // j$.time.chrono.InterfaceC2285d
    public final ChronoLocalDate o() {
        return this.f19112a;
    }

    public final int J() {
        return this.f19112a.c0();
    }

    @Override // j$.time.chrono.InterfaceC2285d
    public final l n() {
        return this.f19113b;
    }

    public int getSecond() {
        return this.f19113b.b0();
    }

    public int getNano() {
        return this.f19113b.Y();
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: h */
    public final j$.time.temporal.m m(LocalDate localDate) {
        return k0(localDate, this.f19113b);
    }

    public final LocalDateTime j0(LocalDate localDate) {
        return k0(localDate, this.f19113b);
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: i0, reason: merged with bridge method [inline-methods] */
    public final LocalDateTime a(long j4, j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            boolean zD0 = ((j$.time.temporal.a) sVar).d0();
            l lVar = this.f19113b;
            LocalDate localDate = this.f19112a;
            if (zD0) {
                return k0(localDate, lVar.a(j4, sVar));
            }
            return k0(localDate.a(j4, sVar), lVar);
        }
        return (LocalDateTime) sVar.p(this, j4);
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: e0, reason: merged with bridge method [inline-methods] */
    public final LocalDateTime b(long j4, j$.time.temporal.v vVar) {
        if (!(vVar instanceof j$.time.temporal.b)) {
            return (LocalDateTime) vVar.p(this, j4);
        }
        switch (j.f19301a[((j$.time.temporal.b) vVar).ordinal()]) {
            case 1:
                return g0(this.f19112a, 0L, 0L, 0L, j4);
            case 2:
                LocalDateTime localDateTimeF0 = f0(j4 / 86400000000L);
                return localDateTimeF0.g0(localDateTimeF0.f19112a, 0L, 0L, 0L, (j4 % 86400000000L) * 1000);
            case 3:
                LocalDateTime localDateTimeF02 = f0(j4 / 86400000);
                return localDateTimeF02.g0(localDateTimeF02.f19112a, 0L, 0L, 0L, (j4 % 86400000) * 1000000);
            case 4:
                return plusSeconds(j4);
            case 5:
                return g0(this.f19112a, 0L, j4, 0L, 0L);
            case 6:
                return g0(this.f19112a, j4, 0L, 0L, 0L);
            case 7:
                LocalDateTime localDateTimeF03 = f0(j4 / 256);
                return localDateTimeF03.g0(localDateTimeF03.f19112a, (j4 % 256) * 12, 0L, 0L, 0L);
            default:
                return k0(this.f19112a.b(j4, vVar), this.f19113b);
        }
    }

    public final LocalDateTime f0(long j4) {
        return k0(this.f19112a.m0(j4), this.f19113b);
    }

    public LocalDateTime plusSeconds(long j4) {
        return g0(this.f19112a, 0L, 0L, j4, 0L);
    }

    @Override // j$.time.chrono.InterfaceC2285d
    /* JADX INFO: renamed from: k */
    public final InterfaceC2285d c(long j4, j$.time.temporal.b bVar) {
        return j4 == Long.MIN_VALUE ? b(Long.MAX_VALUE, bVar).b(1L, bVar) : b(-j4, bVar);
    }

    private LocalDateTime g0(LocalDate localDate, long j4, long j6, long j7, long j8) {
        long j9 = j4 | j6 | j7 | j8;
        l lVarE0 = this.f19113b;
        if (j9 == 0) {
            return k0(localDate, lVarE0);
        }
        long j10 = j4 / 24;
        long j11 = j10 + (j6 / 1440) + (j7 / 86400) + (j8 / 86400000000000L);
        long j12 = 1;
        long j13 = ((j4 % 24) * 3600000000000L) + ((j6 % 1440) * 60000000000L) + ((j7 % 86400) * C.NANOS_PER_SECOND) + (j8 % 86400000000000L);
        long jM0 = lVarE0.m0();
        long j14 = (j13 * j12) + jM0;
        long jFloorDiv = Math.floorDiv(j14, 86400000000000L) + (j11 * j12);
        long jFloorMod = Math.floorMod(j14, 86400000000000L);
        if (jFloorMod != jM0) {
            lVarE0 = l.e0(jFloorMod);
        }
        return k0(localDate.m0(jFloorDiv), lVarE0);
    }

    @Override // j$.time.temporal.n
    public final Object d(j$.time.temporal.u uVar) {
        if (uVar == j$.time.temporal.t.b()) {
            return this.f19112a;
        }
        return super.d(uVar);
    }

    public String format(DateTimeFormatter dateTimeFormatter) {
        Objects.requireNonNull(dateTimeFormatter, "formatter");
        return dateTimeFormatter.a(this);
    }

    @Override // j$.time.chrono.InterfaceC2285d, java.lang.Comparable
    /* JADX INFO: renamed from: Z, reason: merged with bridge method [inline-methods] */
    public final int compareTo(InterfaceC2285d interfaceC2285d) {
        if (interfaceC2285d instanceof LocalDateTime) {
            return r((LocalDateTime) interfaceC2285d);
        }
        return super.compareTo(interfaceC2285d);
    }

    public final boolean U(LocalDateTime localDateTime) {
        if (localDateTime != null) {
            return r(localDateTime) > 0;
        }
        long epochDay = this.f19112a.toEpochDay();
        long epochDay2 = localDateTime.f19112a.toEpochDay();
        if (epochDay <= epochDay2) {
            return epochDay == epochDay2 && this.f19113b.m0() > localDateTime.f19113b.m0();
        }
        return true;
    }

    public final boolean V(LocalDateTime localDateTime) {
        if (localDateTime != null) {
            return r(localDateTime) < 0;
        }
        long epochDay = this.f19112a.toEpochDay();
        long epochDay2 = localDateTime.f19112a.toEpochDay();
        if (epochDay >= epochDay2) {
            return epochDay == epochDay2 && this.f19113b.m0() < localDateTime.f19113b.m0();
        }
        return true;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof LocalDateTime) {
            LocalDateTime localDateTime = (LocalDateTime) obj;
            if (this.f19112a.equals(localDateTime.f19112a) && this.f19113b.equals(localDateTime.f19113b)) {
                return true;
            }
        }
        return false;
    }

    public final int hashCode() {
        return this.f19112a.hashCode() ^ this.f19113b.hashCode();
    }

    public final String toString() {
        return this.f19112a.toString() + "T" + this.f19113b.toString();
    }

    private Object writeReplace() {
        return new t((byte) 5, this);
    }

    private void readObject(ObjectInputStream objectInputStream) throws InvalidObjectException {
        throw new InvalidObjectException("Deserialization via serialization delegate");
    }

    final void l0(DataOutput dataOutput) {
        this.f19112a.v0(dataOutput);
        this.f19113b.q0(dataOutput);
    }
}
