package j$.time.chrono;

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

/* JADX INFO: loaded from: classes2.dex */
public final class w extends AbstractC2284c {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    static final LocalDate f19176d = LocalDate.h0(1873, 1, 1);
    private static final long serialVersionUID = -305327627230580483L;

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private transient x f19178b;

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

    w(LocalDate localDate) {
        if (localDate.d0(f19176d)) {
            throw new j$.time.c("JapaneseDate before Meiji 6 is not supported");
        }
        x xVarQ = x.q(localDate);
        this.f19178b = xVarQ;
        this.f19179c = (localDate.c0() - xVarQ.s().c0()) + 1;
        this.f19177a = localDate;
    }

    w(x xVar, int i6, LocalDate localDate) {
        if (localDate.d0(f19176d)) {
            throw new j$.time.c("JapaneseDate before Meiji 6 is not supported");
        }
        this.f19178b = xVar;
        this.f19179c = i6;
        this.f19177a = localDate;
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate
    public final int hashCode() {
        u.f19174d.getClass();
        return this.f19177a.hashCode() ^ (-688086063);
    }

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

    public final x V() {
        return this.f19178b;
    }

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

    @Override // j$.time.chrono.ChronoLocalDate
    public final int K() {
        int iK;
        x xVar = this.f19178b;
        x xVarT = xVar.t();
        LocalDate localDate = this.f19177a;
        if (xVarT != null && xVarT.s().c0() == localDate.c0()) {
            iK = xVarT.s().Y() - 1;
        } else {
            iK = localDate.K();
        }
        return this.f19179c == 1 ? iK - (xVar.s().Y() - 1) : iK;
    }

    @Override // j$.time.chrono.ChronoLocalDate, j$.time.temporal.n
    public final boolean f(j$.time.temporal.s sVar) {
        if (sVar == j$.time.temporal.a.ALIGNED_DAY_OF_WEEK_IN_MONTH || sVar == j$.time.temporal.a.ALIGNED_DAY_OF_WEEK_IN_YEAR || sVar == j$.time.temporal.a.ALIGNED_WEEK_OF_MONTH || sVar == j$.time.temporal.a.ALIGNED_WEEK_OF_YEAR) {
            return false;
        }
        if (sVar instanceof j$.time.temporal.a) {
            return ((j$.time.temporal.a) sVar).V();
        }
        return sVar != null && sVar.Y(this);
    }

    @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 = v.f19175a[aVar.ordinal()];
        if (i6 == 1) {
            return j$.time.temporal.x.j(1L, this.f19177a.e0());
        }
        if (i6 == 2) {
            return j$.time.temporal.x.j(1L, K());
        }
        if (i6 != 3) {
            return u.f19174d.W(aVar);
        }
        x xVar = this.f19178b;
        int iC0 = xVar.s().c0();
        return xVar.t() != null ? j$.time.temporal.x.j(1L, (r6.s().c0() - iC0) + 1) : j$.time.temporal.x.j(1L, 999999999 - iC0);
    }

    @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 = v.f19175a[((j$.time.temporal.a) sVar).ordinal()];
        int i7 = this.f19179c;
        x xVar = this.f19178b;
        LocalDate localDate = this.f19177a;
        switch (i6) {
            case 2:
                return i7 == 1 ? (localDate.Y() - xVar.s().Y()) + 1 : localDate.Y();
            case 3:
                return i7;
            case 4:
            case 5:
            case 6:
            case 7:
                throw new j$.time.temporal.w(j$.time.d.a("Unsupported field: ", sVar));
            case 8:
                return xVar.p();
            default:
                return localDate.g(sVar);
        }
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate, j$.time.temporal.m
    /* JADX INFO: renamed from: b0, reason: merged with bridge method [inline-methods] */
    public final w a(long j4, j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            j$.time.temporal.a aVar = (j$.time.temporal.a) sVar;
            if (g(aVar) == j4) {
                return this;
            }
            int[] iArr = v.f19175a;
            int i6 = iArr[aVar.ordinal()];
            LocalDate localDate = this.f19177a;
            if (i6 == 3 || i6 == 8 || i6 == 9) {
                u uVar = u.f19174d;
                int iA = uVar.W(aVar).a(j4, aVar);
                int i7 = iArr[aVar.ordinal()];
                if (i7 == 3) {
                    return c0(localDate.u0(uVar.v(this.f19178b, iA)));
                }
                if (i7 == 8) {
                    return c0(localDate.u0(uVar.v(x.v(iA), this.f19179c)));
                }
                if (i7 == 9) {
                    return c0(localDate.u0(iA));
                }
            }
            return c0(localDate.a(j4, sVar));
        }
        return (w) super.a(j4, sVar);
    }

    public final w d0(j$.time.temporal.q qVar) {
        return (w) super.m(qVar);
    }

    @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 (w) super.m(localDate);
    }

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

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

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

    @Override // j$.time.chrono.AbstractC2284c
    final ChronoLocalDate U(long j4) {
        return c0(this.f19177a.p0(j4));
    }

    @Override // j$.time.chrono.AbstractC2284c
    final ChronoLocalDate J(long j4) {
        return c0(this.f19177a.n0(j4));
    }

    @Override // j$.time.chrono.AbstractC2284c
    final ChronoLocalDate B(long j4) {
        return c0(this.f19177a.m0(j4));
    }

    public final w Y(long j4, j$.time.temporal.b bVar) {
        return (w) super.b(j4, (j$.time.temporal.v) bVar);
    }

    @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 (w) 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 (w) 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 (w) 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 (w) super.c(j4, vVar);
    }

    private w c0(LocalDate localDate) {
        return localDate.equals(this.f19177a) ? this : new w(localDate);
    }

    @Override // j$.time.chrono.ChronoLocalDate
    public final long toEpochDay() {
        return this.f19177a.toEpochDay();
    }

    @Override // j$.time.chrono.AbstractC2284c, j$.time.chrono.ChronoLocalDate
    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof w) {
            return this.f19177a.equals(((w) obj).f19177a);
        }
        return false;
    }

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

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