package ub;

import androidx.lifecycle.a0;
import androidx.lifecycle.z0;
import ca.canadapost.core.data.auth.model.UserProfile;
import ca.canadapost.core.data.model.RepositoryError;
import ca.canadapost.core.data.model.ResultWrapper;
import dn.p;
import kn.l;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import rm.n0;
import rm.y;
import tp.a1;
import tp.g2;
import tp.i;
import tp.i0;
import tp.k;
import tp.m0;
import tp.w0;
import wp.s;
import wp.x;
import wp.z;

/* loaded from: classes4.dex */
public final class a extends z0 implements l8.c {

    /* renamed from: s, reason: collision with root package name */
    static final /* synthetic */ l[] f37041s = {p0.h(new g0(a.class, "doubleClickGuardResendCode", "getDoubleClickGuardResendCode()Z", 0))};

    /* renamed from: t, reason: collision with root package name */
    public static final int f37042t = 8;

    /* renamed from: b, reason: collision with root package name */
    private final g9.l f37043b;

    /* renamed from: c, reason: collision with root package name */
    private final ka.b f37044c;

    /* renamed from: d, reason: collision with root package name */
    private final rd.c f37045d;

    /* renamed from: e, reason: collision with root package name */
    private final tb.c f37046e;

    /* renamed from: f, reason: collision with root package name */
    private final i0 f37047f;

    /* renamed from: g, reason: collision with root package name */
    private final /* synthetic */ l8.d f37048g;

    /* renamed from: h, reason: collision with root package name */
    private final s f37049h;

    /* renamed from: i, reason: collision with root package name */
    private final x f37050i;

    /* renamed from: j, reason: collision with root package name */
    private final s f37051j;

    /* renamed from: k, reason: collision with root package name */
    private final x f37052k;

    /* renamed from: l, reason: collision with root package name */
    private final s f37053l;

    /* renamed from: m, reason: collision with root package name */
    private final x f37054m;

    /* renamed from: n, reason: collision with root package name */
    private final s f37055n;

    /* renamed from: o, reason: collision with root package name */
    private final x f37056o;

    /* renamed from: p, reason: collision with root package name */
    private final l8.e f37057p;

    /* renamed from: q, reason: collision with root package name */
    private boolean f37058q;

    /* renamed from: r, reason: collision with root package name */
    private int f37059r;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: ub.a$a, reason: collision with other inner class name */
    /* loaded from: classes4.dex */
    public static final class C0883a extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f37060p;

        /* renamed from: q, reason: collision with root package name */
        Object f37061q;

        /* renamed from: r, reason: collision with root package name */
        /* synthetic */ Object f37062r;

        /* renamed from: t, reason: collision with root package name */
        int f37064t;

        C0883a(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f37062r = obj;
            this.f37064t |= Integer.MIN_VALUE;
            return a.this.Y(null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class b extends kotlin.coroutines.jvm.internal.l implements p {

        /* renamed from: p, reason: collision with root package name */
        int f37065p;

        b(vm.d dVar) {
            super(2, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new b(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f37065p;
            if (i10 == 0) {
                y.b(obj);
                this.f37065p = 1;
                if (w0.a(200L, this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    if (i10 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    y.b(obj);
                    return n0.f34904a;
                }
                y.b(obj);
            }
            s sVar = a.this.f37055n;
            Boolean a10 = kotlin.coroutines.jvm.internal.b.a(true);
            this.f37065p = 2;
            if (sVar.emit(a10, this) == f10) {
                return f10;
            }
            return n0.f34904a;
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((b) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class c extends kotlin.coroutines.jvm.internal.l implements p {

        /* renamed from: p, reason: collision with root package name */
        Object f37067p;

        /* renamed from: q, reason: collision with root package name */
        Object f37068q;

        /* renamed from: r, reason: collision with root package name */
        int f37069r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ String f37070s;

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

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: ub.a$c$a, reason: collision with other inner class name */
        /* loaded from: classes4.dex */
        public static final class C0884a extends kotlin.coroutines.jvm.internal.l implements p {

            /* renamed from: p, reason: collision with root package name */
            int f37072p;

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

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ ResultWrapper f37074r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0884a(a aVar, ResultWrapper resultWrapper, vm.d dVar) {
                super(2, dVar);
                this.f37073q = aVar;
                this.f37074r = resultWrapper;
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                return new C0884a(this.f37073q, this.f37074r, dVar);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                wm.d.f();
                if (this.f37072p != 0) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
                this.f37073q.e0((ResultWrapper.Error) this.f37074r, true);
                return n0.f34904a;
            }

            @Override // dn.p
            public final Object invoke(m0 m0Var, vm.d dVar) {
                return ((C0884a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(String str, a aVar, vm.d dVar) {
            super(2, dVar);
            this.f37070s = str;
            this.f37071t = aVar;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new c(this.f37070s, this.f37071t, dVar);
        }

        /* JADX WARN: Failed to find 'out' block for switch in B:2:0x0009. Please report as an issue. */
        /* JADX WARN: Removed duplicated region for block: B:15:0x00d7 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:20:0x00a2 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:24:0x007b  */
        /* JADX WARN: Removed duplicated region for block: B:27:0x00a3  */
        /* JADX WARN: Removed duplicated region for block: B:9:0x00ee A[RETURN] */
        @Override // kotlin.coroutines.jvm.internal.a
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object invokeSuspend(Object obj) {
            Object f10;
            a aVar;
            ResultWrapper resultWrapper;
            a aVar2;
            ResultWrapper resultWrapper2;
            s sVar;
            Boolean a10;
            s sVar2;
            Boolean a11;
            g2 c10;
            C0884a c0884a;
            f10 = wm.d.f();
            switch (this.f37069r) {
                case 0:
                    y.b(obj);
                    String str = this.f37070s;
                    if (str != null) {
                        aVar = this.f37071t;
                        g9.l lVar = aVar.f37043b;
                        UserProfile userProfile = (UserProfile) aVar.f37044c.a().f();
                        String userName = userProfile != null ? userProfile.getUserName() : null;
                        if (userName == null) {
                            userName = "";
                        }
                        this.f37067p = aVar;
                        this.f37069r = 1;
                        obj = lVar.m(userName, str, this);
                        if (obj == f10) {
                            return f10;
                        }
                        resultWrapper = (ResultWrapper) obj;
                        if (!(resultWrapper instanceof ResultWrapper.Success)) {
                            s sVar3 = aVar.f37055n;
                            Boolean a12 = kotlin.coroutines.jvm.internal.b.a(true);
                            this.f37067p = aVar;
                            this.f37069r = 2;
                            if (sVar3.emit(a12, this) == f10) {
                                return f10;
                            }
                            sVar = aVar.f37049h;
                            a10 = kotlin.coroutines.jvm.internal.b.a(false);
                            this.f37067p = null;
                            this.f37069r = 3;
                            if (sVar.emit(a10, this) == f10) {
                                return f10;
                            }
                        } else if (resultWrapper instanceof ResultWrapper.Error) {
                            aVar.f37058q = true;
                            s sVar4 = aVar.f37055n;
                            Boolean a13 = kotlin.coroutines.jvm.internal.b.a(false);
                            this.f37067p = aVar;
                            this.f37068q = resultWrapper;
                            this.f37069r = 4;
                            if (sVar4.emit(a13, this) == f10) {
                                return f10;
                            }
                            aVar2 = aVar;
                            resultWrapper2 = resultWrapper;
                            sVar2 = aVar2.f37049h;
                            a11 = kotlin.coroutines.jvm.internal.b.a(false);
                            this.f37067p = aVar2;
                            this.f37068q = resultWrapper2;
                            this.f37069r = 5;
                            if (sVar2.emit(a11, this) == f10) {
                                return f10;
                            }
                            c10 = a1.c();
                            c0884a = new C0884a(aVar2, resultWrapper2, null);
                            this.f37067p = null;
                            this.f37068q = null;
                            this.f37069r = 6;
                            if (i.g(c10, c0884a, this) == f10) {
                                return f10;
                            }
                        }
                    }
                    return n0.f34904a;
                case 1:
                    aVar = (a) this.f37067p;
                    y.b(obj);
                    resultWrapper = (ResultWrapper) obj;
                    if (!(resultWrapper instanceof ResultWrapper.Success)) {
                    }
                    break;
                case 2:
                    aVar = (a) this.f37067p;
                    y.b(obj);
                    sVar = aVar.f37049h;
                    a10 = kotlin.coroutines.jvm.internal.b.a(false);
                    this.f37067p = null;
                    this.f37069r = 3;
                    if (sVar.emit(a10, this) == f10) {
                    }
                    return n0.f34904a;
                case 3:
                case 6:
                    y.b(obj);
                    return n0.f34904a;
                case 4:
                    resultWrapper2 = (ResultWrapper) this.f37068q;
                    aVar2 = (a) this.f37067p;
                    y.b(obj);
                    sVar2 = aVar2.f37049h;
                    a11 = kotlin.coroutines.jvm.internal.b.a(false);
                    this.f37067p = aVar2;
                    this.f37068q = resultWrapper2;
                    this.f37069r = 5;
                    if (sVar2.emit(a11, this) == f10) {
                    }
                    c10 = a1.c();
                    c0884a = new C0884a(aVar2, resultWrapper2, null);
                    this.f37067p = null;
                    this.f37068q = null;
                    this.f37069r = 6;
                    if (i.g(c10, c0884a, this) == f10) {
                    }
                    return n0.f34904a;
                case 5:
                    resultWrapper2 = (ResultWrapper) this.f37068q;
                    aVar2 = (a) this.f37067p;
                    y.b(obj);
                    c10 = a1.c();
                    c0884a = new C0884a(aVar2, resultWrapper2, null);
                    this.f37067p = null;
                    this.f37068q = null;
                    this.f37069r = 6;
                    if (i.g(c10, c0884a, this) == f10) {
                    }
                    return n0.f34904a;
                default:
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((c) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class d extends kotlin.coroutines.jvm.internal.l implements p {

        /* renamed from: p, reason: collision with root package name */
        Object f37075p;

        /* renamed from: q, reason: collision with root package name */
        int f37076q;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ String f37078s;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: ub.a$d$a, reason: collision with other inner class name */
        /* loaded from: classes4.dex */
        public static final class C0885a extends kotlin.coroutines.jvm.internal.l implements p {

            /* renamed from: p, reason: collision with root package name */
            int f37079p;

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

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ ResultWrapper f37081r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0885a(a aVar, ResultWrapper resultWrapper, vm.d dVar) {
                super(2, dVar);
                this.f37080q = aVar;
                this.f37081r = resultWrapper;
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                return new C0885a(this.f37080q, this.f37081r, dVar);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                wm.d.f();
                if (this.f37079p != 0) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
                this.f37080q.e0((ResultWrapper.Error) this.f37081r, true);
                return n0.f34904a;
            }

            @Override // dn.p
            public final Object invoke(m0 m0Var, vm.d dVar) {
                return ((C0885a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(String str, vm.d dVar) {
            super(2, dVar);
            this.f37078s = str;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new d(this.f37078s, dVar);
        }

        /* JADX WARN: Removed duplicated region for block: B:14:0x00c9 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:20:0x00b3 A[RETURN] */
        @Override // kotlin.coroutines.jvm.internal.a
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object invokeSuspend(Object obj) {
            Object f10;
            ResultWrapper resultWrapper;
            s sVar;
            Boolean a10;
            g2 c10;
            C0885a c0885a;
            f10 = wm.d.f();
            int i10 = this.f37076q;
            if (i10 == 0) {
                y.b(obj);
                tb.c cVar = a.this.f37046e;
                String str = this.f37078s;
                UserProfile userProfile = (UserProfile) a.this.f37044c.a().f();
                String userName = userProfile != null ? userProfile.getUserName() : null;
                if (userName == null) {
                    userName = "";
                }
                this.f37076q = 1;
                obj = cVar.a(str, userName, this);
                if (obj == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    if (i10 != 2) {
                        if (i10 == 3) {
                            resultWrapper = (ResultWrapper) this.f37075p;
                            y.b(obj);
                            sVar = a.this.f37051j;
                            a10 = kotlin.coroutines.jvm.internal.b.a(false);
                            this.f37075p = resultWrapper;
                            this.f37076q = 4;
                            if (sVar.emit(a10, this) == f10) {
                                return f10;
                            }
                            c10 = a1.c();
                            c0885a = new C0885a(a.this, resultWrapper, null);
                            this.f37075p = null;
                            this.f37076q = 5;
                            if (i.g(c10, c0885a, this) == f10) {
                            }
                            return n0.f34904a;
                        }
                        if (i10 == 4) {
                            resultWrapper = (ResultWrapper) this.f37075p;
                            y.b(obj);
                            c10 = a1.c();
                            c0885a = new C0885a(a.this, resultWrapper, null);
                            this.f37075p = null;
                            this.f37076q = 5;
                            if (i.g(c10, c0885a, this) == f10) {
                                return f10;
                            }
                            return n0.f34904a;
                        }
                        if (i10 != 5) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                    }
                    y.b(obj);
                    return n0.f34904a;
                }
                y.b(obj);
            }
            ResultWrapper resultWrapper2 = (ResultWrapper) obj;
            if (resultWrapper2 instanceof ResultWrapper.Success) {
                s sVar2 = a.this.f37051j;
                Boolean a11 = kotlin.coroutines.jvm.internal.b.a(true);
                this.f37076q = 2;
                if (sVar2.emit(a11, this) == f10) {
                    return f10;
                }
            } else if (resultWrapper2 instanceof ResultWrapper.Error) {
                s sVar3 = a.this.f37049h;
                Boolean a12 = kotlin.coroutines.jvm.internal.b.a(false);
                this.f37075p = resultWrapper2;
                this.f37076q = 3;
                if (sVar3.emit(a12, this) == f10) {
                    return f10;
                }
                resultWrapper = resultWrapper2;
                sVar = a.this.f37051j;
                a10 = kotlin.coroutines.jvm.internal.b.a(false);
                this.f37075p = resultWrapper;
                this.f37076q = 4;
                if (sVar.emit(a10, this) == f10) {
                }
                c10 = a1.c();
                c0885a = new C0885a(a.this, resultWrapper, null);
                this.f37075p = null;
                this.f37076q = 5;
                if (i.g(c10, c0885a, this) == f10) {
                }
            }
            return n0.f34904a;
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((d) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class e extends kotlin.coroutines.jvm.internal.l implements p {

        /* renamed from: p, reason: collision with root package name */
        Object f37082p;

        /* renamed from: q, reason: collision with root package name */
        int f37083q;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ String f37085s;

        /* renamed from: t, reason: collision with root package name */
        final /* synthetic */ String f37086t;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: ub.a$e$a, reason: collision with other inner class name */
        /* loaded from: classes4.dex */
        public static final class C0886a extends kotlin.coroutines.jvm.internal.l implements p {

            /* renamed from: p, reason: collision with root package name */
            int f37087p;

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

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ ResultWrapper f37089r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0886a(a aVar, ResultWrapper resultWrapper, vm.d dVar) {
                super(2, dVar);
                this.f37088q = aVar;
                this.f37089r = resultWrapper;
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                return new C0886a(this.f37088q, this.f37089r, dVar);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                wm.d.f();
                if (this.f37087p != 0) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
                this.f37088q.e0(new ResultWrapper.Error(((ResultWrapper.Error) this.f37089r).getException(), ((ResultWrapper.Error) this.f37089r).getMessage(), ((ResultWrapper.Error) this.f37089r).getError(), null, 8, null), true);
                return n0.f34904a;
            }

            @Override // dn.p
            public final Object invoke(m0 m0Var, vm.d dVar) {
                return ((C0886a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
            }
        }

        /* loaded from: classes4.dex */
        public /* synthetic */ class b {

            /* renamed from: a, reason: collision with root package name */
            public static final /* synthetic */ int[] f37090a;

            static {
                int[] iArr = new int[RepositoryError.values().length];
                try {
                    iArr[RepositoryError.ServiceError.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                f37090a = iArr;
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        e(String str, String str2, vm.d dVar) {
            super(2, dVar);
            this.f37085s = str;
            this.f37086t = str2;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new e(this.f37085s, this.f37086t, dVar);
        }

        /* JADX WARN: Failed to find 'out' block for switch in B:2:0x000b. Please report as an issue. */
        /* JADX WARN: Removed duplicated region for block: B:17:0x00d9  */
        /* JADX WARN: Removed duplicated region for block: B:24:0x007e  */
        /* JADX WARN: Removed duplicated region for block: B:27:0x0094  */
        /* JADX WARN: Removed duplicated region for block: B:35:0x0078 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:36:0x0079  */
        /* JADX WARN: Removed duplicated region for block: B:9:0x00bf  */
        @Override // kotlin.coroutines.jvm.internal.a
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object invokeSuspend(Object obj) {
            Object f10;
            s sVar;
            Boolean a10;
            ResultWrapper resultWrapper;
            ResultWrapper.Error error;
            f10 = wm.d.f();
            switch (this.f37083q) {
                case 0:
                    y.b(obj);
                    rd.c cVar = a.this.f37045d;
                    String str = this.f37085s;
                    String str2 = this.f37086t;
                    UserProfile userProfile = (UserProfile) a.this.f37044c.a().f();
                    String userName = userProfile != null ? userProfile.getUserName() : null;
                    if (userName == null) {
                        userName = "";
                    }
                    this.f37083q = 1;
                    obj = cVar.c(str, str2, userName, this);
                    if (obj == f10) {
                        return f10;
                    }
                    ResultWrapper resultWrapper2 = (ResultWrapper) obj;
                    sVar = a.this.f37049h;
                    a10 = kotlin.coroutines.jvm.internal.b.a(false);
                    this.f37082p = resultWrapper2;
                    this.f37083q = 2;
                    if (sVar.emit(a10, this) != f10) {
                        return f10;
                    }
                    resultWrapper = resultWrapper2;
                    if (!(resultWrapper instanceof ResultWrapper.Success)) {
                        s sVar2 = a.this.f37051j;
                        Boolean a11 = kotlin.coroutines.jvm.internal.b.a(true);
                        this.f37082p = null;
                        this.f37083q = 3;
                        if (sVar2.emit(a11, this) == f10) {
                            return f10;
                        }
                    } else if (resultWrapper instanceof ResultWrapper.Error) {
                        s sVar3 = a.this.f37051j;
                        Boolean a12 = kotlin.coroutines.jvm.internal.b.a(false);
                        this.f37082p = resultWrapper;
                        this.f37083q = 4;
                        if (sVar3.emit(a12, this) == f10) {
                            return f10;
                        }
                        error = (ResultWrapper.Error) resultWrapper;
                        if (b.f37090a[error.getError().ordinal()] != 1) {
                            s sVar4 = a.this.f37053l;
                            String message = error.getMessage();
                            String str3 = message != null ? message : "";
                            this.f37082p = null;
                            this.f37083q = 5;
                            if (sVar4.emit(str3, this) == f10) {
                                return f10;
                            }
                        } else {
                            g2 c10 = a1.c();
                            C0886a c0886a = new C0886a(a.this, resultWrapper, null);
                            this.f37082p = null;
                            this.f37083q = 6;
                            if (i.g(c10, c0886a, this) == f10) {
                                return f10;
                            }
                        }
                    }
                    return n0.f34904a;
                case 1:
                    y.b(obj);
                    ResultWrapper resultWrapper22 = (ResultWrapper) obj;
                    sVar = a.this.f37049h;
                    a10 = kotlin.coroutines.jvm.internal.b.a(false);
                    this.f37082p = resultWrapper22;
                    this.f37083q = 2;
                    if (sVar.emit(a10, this) != f10) {
                    }
                    break;
                case 2:
                    resultWrapper = (ResultWrapper) this.f37082p;
                    y.b(obj);
                    if (!(resultWrapper instanceof ResultWrapper.Success)) {
                    }
                    return n0.f34904a;
                case 3:
                case 5:
                case 6:
                    y.b(obj);
                    return n0.f34904a;
                case 4:
                    resultWrapper = (ResultWrapper) this.f37082p;
                    y.b(obj);
                    error = (ResultWrapper.Error) resultWrapper;
                    if (b.f37090a[error.getError().ordinal()] != 1) {
                    }
                    return n0.f34904a;
                default:
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((e) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class f extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        Object f37091p;

        /* renamed from: q, reason: collision with root package name */
        Object f37092q;

        /* renamed from: r, reason: collision with root package name */
        Object f37093r;

        /* renamed from: s, reason: collision with root package name */
        Object f37094s;

        /* renamed from: t, reason: collision with root package name */
        /* synthetic */ Object f37095t;

        /* renamed from: v, reason: collision with root package name */
        int f37097v;

        f(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f37095t = obj;
            this.f37097v |= Integer.MIN_VALUE;
            return a.this.i0(null, null, null, this);
        }
    }

    public a(g9.l authRepository, ka.b profileRepository, rd.c forgotPasswordRepository, tb.c changePasswordRepository, i0 dispatcher) {
        t.g(authRepository, "authRepository");
        t.g(profileRepository, "profileRepository");
        t.g(forgotPasswordRepository, "forgotPasswordRepository");
        t.g(changePasswordRepository, "changePasswordRepository");
        t.g(dispatcher, "dispatcher");
        this.f37043b = authRepository;
        this.f37044c = profileRepository;
        this.f37045d = forgotPasswordRepository;
        this.f37046e = changePasswordRepository;
        this.f37047f = dispatcher;
        this.f37048g = new l8.d();
        s b10 = z.b(0, 0, null, 7, null);
        this.f37049h = b10;
        this.f37050i = wp.g.a(b10);
        s b11 = z.b(0, 0, null, 7, null);
        this.f37051j = b11;
        this.f37052k = wp.g.a(b11);
        s b12 = z.b(0, 0, null, 7, null);
        this.f37053l = b12;
        this.f37054m = wp.g.a(b12);
        s b13 = z.b(0, 0, null, 7, null);
        this.f37055n = b13;
        this.f37056o = b13;
        this.f37057p = new l8.e(false, 30000L);
        this.f37059r = 1;
    }

    private final boolean Z() {
        return this.f37057p.a(this, f37041s[0]).booleanValue();
    }

    private final void f0(String str) {
        k.d(androidx.lifecycle.a1.a(this), this.f37047f, null, new d(str, null), 2, null);
    }

    private final void h0(String str, String str2) {
        k.d(androidx.lifecycle.a1.a(this), this.f37047f, null, new e(str, str2, null), 2, null);
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0088  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0081 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0059  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0027  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object Y(String str, vm.d dVar) {
        C0883a c0883a;
        Object f10;
        int i10;
        s sVar;
        Boolean a10;
        if (dVar instanceof C0883a) {
            c0883a = (C0883a) dVar;
            int i11 = c0883a.f37064t;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                c0883a.f37064t = i11 - Integer.MIN_VALUE;
                Object obj = c0883a.f37062r;
                f10 = wm.d.f();
                i10 = c0883a.f37064t;
                if (i10 != 0) {
                    y.b(obj);
                    s sVar2 = this.f37049h;
                    Boolean a11 = kotlin.coroutines.jvm.internal.b.a(true);
                    c0883a.f37060p = this;
                    c0883a.f37061q = str;
                    c0883a.f37064t = 1;
                    if (sVar2.emit(a11, c0883a) == f10) {
                        return f10;
                    }
                } else {
                    if (i10 != 1) {
                        if (i10 != 2) {
                            if (i10 != 3) {
                                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                            }
                            this = (a) c0883a.f37060p;
                            y.b(obj);
                            k.d(androidx.lifecycle.a1.a(this), null, null, new b(null), 3, null);
                            return n0.f34904a;
                        }
                        String str2 = (String) c0883a.f37061q;
                        a aVar = (a) c0883a.f37060p;
                        y.b(obj);
                        str = str2;
                        this = aVar;
                        if (this.Z() || this.f37058q) {
                            this.f37058q = false;
                            this.f37059r = 1;
                            k.d(androidx.lifecycle.a1.a(this), null, null, new c(str, this, null), 3, null);
                            return n0.f34904a;
                        }
                        s sVar3 = this.f37049h;
                        Boolean a12 = kotlin.coroutines.jvm.internal.b.a(false);
                        c0883a.f37060p = this;
                        c0883a.f37061q = null;
                        c0883a.f37064t = 3;
                        if (sVar3.emit(a12, c0883a) == f10) {
                            return f10;
                        }
                        k.d(androidx.lifecycle.a1.a(this), null, null, new b(null), 3, null);
                        return n0.f34904a;
                    }
                    str = (String) c0883a.f37061q;
                    this = (a) c0883a.f37060p;
                    y.b(obj);
                }
                sVar = this.f37055n;
                a10 = kotlin.coroutines.jvm.internal.b.a(false);
                c0883a.f37060p = this;
                c0883a.f37061q = str;
                c0883a.f37064t = 2;
                if (sVar.emit(a10, c0883a) == f10) {
                    return f10;
                }
                if (this.Z()) {
                }
                this.f37058q = false;
                this.f37059r = 1;
                k.d(androidx.lifecycle.a1.a(this), null, null, new c(str, this, null), 3, null);
                return n0.f34904a;
            }
        }
        c0883a = new C0883a(dVar);
        Object obj2 = c0883a.f37062r;
        f10 = wm.d.f();
        i10 = c0883a.f37064t;
        if (i10 != 0) {
        }
        sVar = this.f37055n;
        a10 = kotlin.coroutines.jvm.internal.b.a(false);
        c0883a.f37060p = this;
        c0883a.f37061q = str;
        c0883a.f37064t = 2;
        if (sVar.emit(a10, c0883a) == f10) {
        }
        if (this.Z()) {
        }
        this.f37058q = false;
        this.f37059r = 1;
        k.d(androidx.lifecycle.a1.a(this), null, null, new c(str, this, null), 3, null);
        return n0.f34904a;
    }

    public final x a0() {
        return this.f37054m;
    }

    public final x b0() {
        return this.f37052k;
    }

    public final x c0() {
        return this.f37050i;
    }

    public final x d0() {
        return this.f37056o;
    }

    public void e0(ResultWrapper.Error error, boolean z10) {
        t.g(error, "error");
        this.f37048g.a(error, z10);
    }

    public final Object g0(String str, vm.d dVar) {
        Object f10;
        Object emit = this.f37053l.emit(str, dVar);
        f10 = wm.d.f();
        return emit == f10 ? emit : n0.f34904a;
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x006a  */
    /* JADX WARN: Removed duplicated region for block: B:16:0x006e  */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0044  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object i0(String str, String str2, String str3, vm.d dVar) {
        f fVar;
        Object f10;
        int i10;
        if (dVar instanceof f) {
            fVar = (f) dVar;
            int i11 = fVar.f37097v;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                fVar.f37097v = i11 - Integer.MIN_VALUE;
                Object obj = fVar.f37095t;
                f10 = wm.d.f();
                i10 = fVar.f37097v;
                if (i10 != 0) {
                    y.b(obj);
                    s sVar = this.f37049h;
                    Boolean a10 = kotlin.coroutines.jvm.internal.b.a(true);
                    fVar.f37091p = this;
                    fVar.f37092q = str;
                    fVar.f37093r = str2;
                    fVar.f37094s = str3;
                    fVar.f37097v = 1;
                    if (sVar.emit(a10, fVar) == f10) {
                        return f10;
                    }
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    str3 = (String) fVar.f37094s;
                    str2 = (String) fVar.f37093r;
                    str = (String) fVar.f37092q;
                    this = (a) fVar.f37091p;
                    y.b(obj);
                }
                if (t.b(str, h.SECURITY_QUESTIONS.getVerificationMethod())) {
                    this.f0(str3);
                } else {
                    this.h0(str2, str3);
                }
                return n0.f34904a;
            }
        }
        fVar = new f(dVar);
        Object obj2 = fVar.f37095t;
        f10 = wm.d.f();
        i10 = fVar.f37097v;
        if (i10 != 0) {
        }
        if (t.b(str, h.SECURITY_QUESTIONS.getVerificationMethod())) {
        }
        return n0.f34904a;
    }

    @Override // l8.c
    public a0 o() {
        return this.f37048g.o();
    }

    @Override // l8.c
    public a0 t() {
        return this.f37048g.t();
    }
}
