package W;

import Z6.AbstractC0385z;
import com.google.android.gms.internal.measurement.C1;
import java.io.Serializable;
import n4.u0;

/* JADX INFO: loaded from: classes.dex */
public final class D extends G6.i implements O6.l {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ int f6906u = 0;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public int f6907v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final /* synthetic */ K f6908w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public Object f6909x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final /* synthetic */ Object f6910y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final /* synthetic */ Serializable f6911z;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public D(P6.m mVar, K k8, P6.k kVar, E6.d dVar) {
        super(1, dVar);
        this.f6910y = mVar;
        this.f6908w = k8;
        this.f6911z = kVar;
    }

    /* JADX WARN: Type inference failed for: r1v3, types: [G6.i, O6.p] */
    @Override // O6.l
    public final Object b(Object obj) {
        E6.d dVar = (E6.d) obj;
        switch (this.f6906u) {
            case u0.f15495q /* 0 */:
                return new D((P6.m) this.f6910y, this.f6908w, (P6.k) this.f6911z, dVar).p(A6.n.f457a);
            default:
                return new D(this.f6908w, (E6.i) this.f6910y, (O6.p) this.f6911z, dVar).p(A6.n.f457a);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x005c  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x0061  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0066  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x007b  */
    /* JADX WARN: Type inference failed for: r6v2, types: [G6.i, O6.p] */
    @Override // G6.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object p(Object obj) throws Throwable {
        P6.m mVar;
        P6.k kVar;
        C0336c c0336c;
        Object obj2;
        switch (this.f6906u) {
            case u0.f15495q /* 0 */:
                F6.a aVar = F6.a.f2580q;
                int i = this.f6907v;
                P6.k kVar2 = (P6.k) this.f6911z;
                P6.m mVar2 = (P6.m) this.f6910y;
                K k8 = this.f6908w;
                try {
                } catch (C0335b unused) {
                    Object obj3 = mVar2.f5535q;
                    this.f6909x = kVar2;
                    this.f6907v = 3;
                    obj = k8.k(obj3, true, this);
                    if (obj == aVar) {
                        return aVar;
                    }
                }
                if (i == 0) {
                    C1.N(obj);
                    this.f6909x = mVar2;
                    this.f6907v = 1;
                    obj = k8.j(this);
                    if (obj == aVar) {
                        return aVar;
                    }
                    mVar = mVar2;
                } else {
                    if (i != 1) {
                        if (i == 2) {
                            kVar = (P6.k) ((Serializable) this.f6909x);
                            C1.N(obj);
                            kVar.f5533q = ((Number) obj).intValue();
                            return A6.n.f457a;
                        }
                        if (i != 3) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        kVar2 = (P6.k) ((Serializable) this.f6909x);
                        C1.N(obj);
                        kVar2.f5533q = ((Number) obj).intValue();
                        return A6.n.f457a;
                    }
                    mVar = (P6.m) ((Serializable) this.f6909x);
                    C1.N(obj);
                }
                mVar.f5535q = obj;
                U uH = k8.h();
                this.f6909x = kVar2;
                this.f6907v = 2;
                obj = uH.a();
                if (obj == aVar) {
                    return aVar;
                }
                kVar = kVar2;
                kVar.f5533q = ((Number) obj).intValue();
                return A6.n.f457a;
            default:
                F6.a aVar2 = F6.a.f2580q;
                int i5 = this.f6907v;
                K k9 = this.f6908w;
                if (i5 == 0) {
                    C1.N(obj);
                    this.f6907v = 1;
                    obj = K.g(k9, true, this);
                    if (obj == aVar2) {
                        return aVar2;
                    }
                } else {
                    if (i5 != 1) {
                        if (i5 != 2) {
                            if (i5 != 3) {
                                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                            }
                            Object obj4 = this.f6909x;
                            C1.N(obj);
                            return obj4;
                        }
                        c0336c = (C0336c) this.f6909x;
                        C1.N(obj);
                        obj2 = c0336c.f6978b;
                        if ((obj2 == null ? obj2.hashCode() : 0) == c0336c.f6979c) {
                            throw new IllegalStateException("Data in DataStore was mutated but DataStore is only compatible with Immutable types.");
                        }
                        if (!P6.g.a(c0336c.f6978b, obj)) {
                            this.f6909x = obj;
                            this.f6907v = 3;
                            if (k9.k(obj, true, this) == aVar2) {
                                return aVar2;
                            }
                        }
                        return obj;
                    }
                    C1.N(obj);
                }
                c0336c = (C0336c) obj;
                F f3 = new F((G6.i) this.f6911z, c0336c, null);
                this.f6909x = c0336c;
                this.f6907v = 2;
                obj = AbstractC0385z.C((E6.i) this.f6910y, f3, this);
                if (obj == aVar2) {
                    return aVar2;
                }
                obj2 = c0336c.f6978b;
                if ((obj2 == null ? obj2.hashCode() : 0) == c0336c.f6979c) {
                }
                break;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Multi-variable type inference failed */
    public D(K k8, E6.i iVar, O6.p pVar, E6.d dVar) {
        super(1, dVar);
        this.f6908w = k8;
        this.f6910y = iVar;
        this.f6911z = (G6.i) pVar;
    }
}
