package km;

import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Set;
import km.m;

/* loaded from: classes3.dex */
public abstract class h {

    /* loaded from: classes3.dex */
    class a extends h {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ h f25930a;

        a(h hVar) {
            this.f25930a = hVar;
        }

        @Override // km.h
        public Object c(m mVar) {
            return this.f25930a.c(mVar);
        }

        @Override // km.h
        boolean d() {
            return this.f25930a.d();
        }

        @Override // km.h
        public void i(q qVar, Object obj) {
            boolean f10 = qVar.f();
            qVar.w(true);
            try {
                this.f25930a.i(qVar, obj);
            } finally {
                qVar.w(f10);
            }
        }

        public String toString() {
            return this.f25930a + ".serializeNulls()";
        }
    }

    /* loaded from: classes3.dex */
    class b extends h {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ h f25932a;

        b(h hVar) {
            this.f25932a = hVar;
        }

        @Override // km.h
        public Object c(m mVar) {
            return mVar.v() == m.b.NULL ? mVar.r() : this.f25932a.c(mVar);
        }

        @Override // km.h
        boolean d() {
            return this.f25932a.d();
        }

        @Override // km.h
        public void i(q qVar, Object obj) {
            if (obj == null) {
                qVar.j();
            } else {
                this.f25932a.i(qVar, obj);
            }
        }

        public String toString() {
            return this.f25932a + ".nullSafe()";
        }
    }

    /* loaded from: classes3.dex */
    class c extends h {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ h f25934a;

        c(h hVar) {
            this.f25934a = hVar;
        }

        @Override // km.h
        public Object c(m mVar) {
            boolean g10 = mVar.g();
            mVar.G(true);
            try {
                return this.f25934a.c(mVar);
            } finally {
                mVar.G(g10);
            }
        }

        @Override // km.h
        boolean d() {
            return true;
        }

        @Override // km.h
        public void i(q qVar, Object obj) {
            boolean g10 = qVar.g();
            qVar.v(true);
            try {
                this.f25934a.i(qVar, obj);
            } finally {
                qVar.v(g10);
            }
        }

        public String toString() {
            return this.f25934a + ".lenient()";
        }
    }

    /* loaded from: classes3.dex */
    class d extends h {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ h f25936a;

        d(h hVar) {
            this.f25936a = hVar;
        }

        @Override // km.h
        public Object c(m mVar) {
            boolean e10 = mVar.e();
            mVar.C(true);
            try {
                return this.f25936a.c(mVar);
            } finally {
                mVar.C(e10);
            }
        }

        @Override // km.h
        boolean d() {
            return this.f25936a.d();
        }

        @Override // km.h
        public void i(q qVar, Object obj) {
            this.f25936a.i(qVar, obj);
        }

        public String toString() {
            return this.f25936a + ".failOnUnknown()";
        }
    }

    /* loaded from: classes3.dex */
    public interface e {
        h a(Type type, Set set, t tVar);
    }

    public final h a() {
        return new d(this);
    }

    public final Object b(String str) {
        m t10 = m.t(new kr.d().W(str));
        Object c10 = c(t10);
        if (d() || t10.v() == m.b.END_DOCUMENT) {
            return c10;
        }
        throw new j("JSON document was not fully consumed.");
    }

    public abstract Object c(m mVar);

    boolean d() {
        return false;
    }

    public final h e() {
        return new c(this);
    }

    public final h f() {
        return new b(this);
    }

    public final h g() {
        return new a(this);
    }

    public final String h(Object obj) {
        kr.d dVar = new kr.d();
        try {
            j(dVar, obj);
            return dVar.N();
        } catch (IOException e10) {
            throw new AssertionError(e10);
        }
    }

    public abstract void i(q qVar, Object obj);

    public final void j(kr.e eVar, Object obj) {
        i(q.m(eVar), obj);
    }
}
