package wd;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a0;
import androidx.lifecycle.a1;
import ca.canadapost.core.data.model.RepositoryError;
import ca.canadapost.core.data.model.ResultWrapper;
import dn.p;
import kotlin.jvm.internal.t;
import l8.h;
import rm.n0;
import rm.y;
import tp.m0;
import tp.o0;
import tp.u1;

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

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

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

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

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

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

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

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

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

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

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

        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.f49118p;
            if (i10 == 0) {
                y.b(obj);
                g9.d dVar = j.this.f49110c;
                this.f49118p = 1;
                obj = dVar.c(this);
                if (obj == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                y.b(obj);
            }
            if (((ResultWrapper.Error) obj) != null) {
                j.this.T(new ResultWrapper.Error(null, null, RepositoryError.Unknown, null, 8, null), true);
            } else {
                j.this.f49116i.s();
            }
            return n0.f34904a;
        }

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

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public j(g9.d repository, t7.c contextService) {
        super((Application) r0);
        t.g(repository, "repository");
        t.g(contextService, "contextService");
        Context a10 = contextService.a();
        t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f49110c = repository;
        this.f49111d = contextService;
        this.f49112e = new l8.i(contextService);
        this.f49113f = new l8.d();
        l8.g gVar = new l8.g();
        this.f49114g = gVar;
        this.f49115h = gVar;
        l8.g gVar2 = new l8.g();
        this.f49116i = gVar2;
        this.f49117j = gVar2;
    }

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

    public final a0 S() {
        return this.f49115h;
    }

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

    public final a0 U() {
        return this.f49117j;
    }

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

    public final void W() {
        this.f49114g.s();
    }

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

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

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