package cc;

import android.app.Application;
import android.content.Context;
import ca.canadapost.core.data.model.ResultWrapper;
import l8.h;

/* loaded from: classes4.dex */
public final class f extends androidx.lifecycle.b implements l8.h, l8.c {

    /* renamed from: n, reason: collision with root package name */
    static final /* synthetic */ kn.l[] f11443n = {kotlin.jvm.internal.p0.h(new kotlin.jvm.internal.g0(f.class, "doubleClickGuard", "getDoubleClickGuard()Z", 0))};

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

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

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

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

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

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

    /* renamed from: h, reason: collision with root package name */
    private final androidx.lifecycle.a0 f11450h;

    /* renamed from: i, reason: collision with root package name */
    private final l8.g f11451i;

    /* renamed from: j, reason: collision with root package name */
    private final androidx.lifecycle.a0 f11452j;

    /* renamed from: k, reason: collision with root package name */
    private final l8.g f11453k;

    /* renamed from: l, reason: collision with root package name */
    private final androidx.lifecycle.a0 f11454l;

    /* renamed from: m, reason: collision with root package name */
    private boolean f11455m;

    /* loaded from: classes4.dex */
    static final class a extends kotlin.coroutines.jvm.internal.l implements dn.p {

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

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

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

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f11456p;
            if (i10 == 0) {
                rm.y.b(obj);
                g9.l lVar = f.this.f11445c;
                this.f11456p = 1;
                obj = lVar.deactivateAccount(this);
                if (obj == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            ResultWrapper resultWrapper = (ResultWrapper) obj;
            if (resultWrapper instanceof ResultWrapper.Success) {
                f.this.f11455m = true;
                f.this.f11451i.s();
            } else if (resultWrapper instanceof ResultWrapper.Error) {
                f.this.a0((ResultWrapper.Error) resultWrapper, true);
            }
            return rm.n0.f34904a;
        }

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

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

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

        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.f11458p;
            if (i10 == 0) {
                rm.y.b(obj);
                g9.l lVar = f.this.f11445c;
                this.f11458p = 1;
                if (lVar.e(this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            f.this.f11453k.s();
            return rm.n0.f34904a;
        }

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

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public f(t7.c contextService, g9.l userAuthenticationRepository) {
        super((Application) r0);
        kotlin.jvm.internal.t.g(contextService, "contextService");
        kotlin.jvm.internal.t.g(userAuthenticationRepository, "userAuthenticationRepository");
        Context a10 = contextService.a();
        kotlin.jvm.internal.t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f11445c = userAuthenticationRepository;
        this.f11446d = new l8.i(contextService);
        this.f11447e = new l8.d();
        this.f11448f = new l8.e(false, 0L, 3, null);
        l8.g gVar = new l8.g();
        this.f11449g = gVar;
        this.f11450h = gVar;
        l8.g gVar2 = new l8.g();
        this.f11451i = gVar2;
        this.f11452j = gVar2;
        l8.g gVar3 = new l8.g();
        this.f11453k = gVar3;
        this.f11454l = gVar3;
    }

    private final boolean Y() {
        return this.f11448f.a(this, f11443n[0]).booleanValue();
    }

    @Override // l8.h
    public androidx.lifecycle.a0 J() {
        return this.f11446d.J();
    }

    public final void U() {
        if (this.f11455m) {
            b0();
        }
    }

    public final void V() {
        h.a.a(this, androidx.lifecycle.a1.a(this), null, null, null, new a(null), 7, null);
    }

    public final androidx.lifecycle.a0 W() {
        return this.f11452j;
    }

    public final androidx.lifecycle.a0 X() {
        return this.f11450h;
    }

    public final androidx.lifecycle.a0 Z() {
        return this.f11454l;
    }

    public void a0(ResultWrapper.Error error, boolean z10) {
        kotlin.jvm.internal.t.g(error, "error");
        this.f11447e.a(error, z10);
    }

    public final void b0() {
        h.a.a(this, androidx.lifecycle.a1.a(this), null, null, null, new b(null), 7, null);
    }

    public final void c0() {
        if (Y()) {
            return;
        }
        this.f11449g.s();
    }

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

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

    @Override // l8.h
    public tp.u1 u(tp.m0 m0Var, vm.g context, tp.o0 start, String str, dn.p block) {
        kotlin.jvm.internal.t.g(m0Var, "<this>");
        kotlin.jvm.internal.t.g(context, "context");
        kotlin.jvm.internal.t.g(start, "start");
        kotlin.jvm.internal.t.g(block, "block");
        return this.f11446d.u(m0Var, context, start, str, block);
    }
}
