package j$.time.chrono;

import j$.time.LocalDate;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;

/* JADX INFO: loaded from: classes2.dex */
public final class p extends AbstractC2284c {
    private static final long serialVersionUID = -5207853542612002020L;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final transient n f19166a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final transient int f19167b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final transient int f19168c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final transient int f19169d;

    static p Y(n nVar, int i6, int i7, int i8) {
        return new p(nVar, i6, i7, i8);
    }

    static p b0(n nVar, long j4) {
        return new p(nVar, j4);
    }

    private p(n nVar, int i6, int i7, int i8) {
        nVar.g0(i6, i7, i8);
        this.f19166a = nVar;
        this.f19167b = i6;
        this.f19168c = i7;
        this.f19169d = i8;
    }

    private p(n nVar, long j4) {
        int[] iArrH0 = nVar.h0((int) j4);
        this.f19166a = nVar;
        this.f19167b = iArrH0[0];
        this.f19168c = iArrH0[1];
        this.f19169d = iArrH0[2];
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final k i() {
        return this.f19166a;
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final l u() {
        return q.AH;
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final int K() {
        return this.f19166a.j0(this.f19167b);
    }

    @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 sVar.J(this);
        }
        if (!f(sVar)) {
            throw new j$.time.temporal.w(j$.time.d.a("Unsupported field: ", sVar));
        }
        j$.time.temporal.a aVar = (j$.time.temporal.a) sVar;
        int i6 = o.f19165a[aVar.ordinal()];
        return i6 != 1 ? i6 != 2 ? i6 != 3 ? this.f19166a.W(aVar) : j$.time.temporal.x.j(1L, 5L) : j$.time.temporal.x.j(1L, K()) : j$.time.temporal.x.j(1L, r2.i0(this.f19167b, this.f19168c));
    }

    @Override // j$.time.temporal.n
    public final long g(j$.time.temporal.s sVar) {
        if (!(sVar instanceof j$.time.temporal.a)) {
            return sVar.r(this);
        }
        int i6 = o.f19165a[((j$.time.temporal.a) sVar).ordinal()];
        int i7 = this.f19168c;
        int i8 = this.f19169d;
        int i9 = this.f19167b;
        switch (i6) {
            case 1:
                return i8;
            case 2:
                return V();
            case 3:
                return ((i8 - 1) / 7) + 1;
            case 4:
                return ((int) Math.floorMod(toEpochDay() + 3, 7)) + 1;
            case 5:
                return ((i8 - 1) % 7) + 1;
            case 6:
                return ((V() - 1) % 7) + 1;
            case 7:
                return toEpochDay();
            case 8:
                return ((V() - 1) / 7) + 1;
            case 9:
                return i7;
            case 10:
                return ((((long) i9) * 12) + ((long) i7)) - 1;
            case 11:
                return i9;
            case 12:
                return i9;
            case 13:
                return i9 <= 1 ? 0 : 1;
            default:
                throw new j$.time.temporal.w(j$.time.d.a("Unsupported field: ", sVar));
        }
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    /* JADX INFO: renamed from: f0, reason: merged with bridge method [inline-methods] */
    public final p a(long j4, j$.time.temporal.s sVar) {
        if (!(sVar instanceof j$.time.temporal.a)) {
            return (p) super.a(j4, sVar);
        }
        j$.time.temporal.a aVar = (j$.time.temporal.a) sVar;
        n nVar = this.f19166a;
        nVar.W(aVar).b(j4, aVar);
        int i6 = (int) j4;
        int i7 = o.f19165a[aVar.ordinal()];
        int i8 = this.f19169d;
        int i9 = this.f19168c;
        int i10 = this.f19167b;
        switch (i7) {
            case 1:
                return e0(i10, i9, i6);
            case 2:
                return B(Math.min(i6, K()) - V());
            case 3:
                return B((j4 - g(j$.time.temporal.a.ALIGNED_WEEK_OF_MONTH)) * 7);
            case 4:
                return B(j4 - ((long) (((int) Math.floorMod(toEpochDay() + 3, 7)) + 1)));
            case 5:
                return B(j4 - g(j$.time.temporal.a.ALIGNED_DAY_OF_WEEK_IN_MONTH));
            case 6:
                return B(j4 - g(j$.time.temporal.a.ALIGNED_DAY_OF_WEEK_IN_YEAR));
            case 7:
                return new p(nVar, j4);
            case 8:
                return B((j4 - g(j$.time.temporal.a.ALIGNED_WEEK_OF_YEAR)) * 7);
            case 9:
                return e0(i10, i6, i8);
            case 10:
                return J(j4 - (((((long) i10) * 12) + ((long) i9)) - 1));
            case 11:
                if (i10 < 1) {
                    i6 = 1 - i6;
                }
                return e0(i6, i9, i8);
            case 12:
                return e0(i6, i9, i8);
            case 13:
                return e0(1 - i10, i9, i8);
            default:
                throw new j$.time.temporal.w(j$.time.d.a("Unsupported field: ", sVar));
        }
    }

    private p e0(int i6, int i7, int i8) {
        n nVar = this.f19166a;
        int iI0 = nVar.i0(i6, i7);
        if (i8 > iI0) {
            i8 = iI0;
        }
        return new p(nVar, i6, i7, i8);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    /* JADX INFO: renamed from: h */
    public final j$.time.temporal.m m(LocalDate localDate) {
        return (p) super.m(localDate);
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final ChronoLocalDate m(j$.time.temporal.o oVar) {
        return (p) super.m(oVar);
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final ChronoLocalDate N(j$.time.temporal.r rVar) {
        return (p) super.N(rVar);
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final long toEpochDay() {
        return this.f19166a.g0(this.f19167b, this.f19168c, this.f19169d);
    }

    private int V() {
        return this.f19166a.f0(this.f19167b, this.f19168c) + this.f19169d;
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final boolean O() {
        return this.f19166a.D(this.f19167b);
    }

    @Override // j$.time.chrono.AbstractC2284c
    final ChronoLocalDate U(long j4) {
        return j4 == 0 ? this : e0(Math.addExact(this.f19167b, (int) j4), this.f19168c, this.f19169d);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // j$.time.chrono.AbstractC2284c
    /* JADX INFO: renamed from: d0, reason: merged with bridge method [inline-methods] */
    public final p J(long j4) {
        if (j4 == 0) {
            return this;
        }
        long j6 = (((long) this.f19167b) * 12) + ((long) (this.f19168c - 1)) + j4;
        return e0(this.f19166a.c0(Math.floorDiv(j6, 12L)), ((int) Math.floorMod(j6, 12L)) + 1, this.f19169d);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // j$.time.chrono.AbstractC2284c
    /* JADX INFO: renamed from: c0, reason: merged with bridge method [inline-methods] */
    public final p B(long j4) {
        return new p(this.f19166a, toEpochDay() + j4);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    public final ChronoLocalDate b(long j4, j$.time.temporal.v vVar) {
        return (p) super.b(j4, vVar);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    public final j$.time.temporal.m b(long j4, j$.time.temporal.v vVar) {
        return (p) super.b(j4, vVar);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    public final ChronoLocalDate c(long j4, j$.time.temporal.v vVar) {
        return (p) super.c(j4, vVar);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    public final j$.time.temporal.m c(long j4, j$.time.temporal.v vVar) {
        return (p) super.c(j4, vVar);
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate
    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof p) {
            p pVar = (p) obj;
            if (this.f19167b == pVar.f19167b && this.f19168c == pVar.f19168c && this.f19169d == pVar.f19169d && this.f19166a.equals(pVar.f19166a)) {
                return true;
            }
        }
        return false;
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate
    public final int hashCode() {
        this.f19166a.getClass();
        int i6 = this.f19167b;
        return (((i6 << 11) + (this.f19168c << 6)) + this.f19169d) ^ ((i6 & (-2048)) ^ 2100100019);
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final InterfaceC2285d L(j$.time.l lVar) {
        return C2287f.B(this, lVar);
    }

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

    private Object writeReplace() {
        return new D((byte) 6, this);
    }

    final void writeExternal(ObjectOutput objectOutput) throws IOException {
        objectOutput.writeObject(this.f19166a);
        objectOutput.writeInt(j(j$.time.temporal.a.YEAR));
        objectOutput.writeByte(j(j$.time.temporal.a.MONTH_OF_YEAR));
        objectOutput.writeByte(j(j$.time.temporal.a.DAY_OF_MONTH));
    }
}
